use of server.life.MapleMonster in project HeavenMS by ronancpl.
the class MapleMap method spawnHorntailOnGroundBelow.
public void spawnHorntailOnGroundBelow(final Point targetPoint) {
// ayy lmao
MapleMonster htIntro = MapleLifeFactory.getMonster(8810026);
spawnMonsterOnGroundBelow(htIntro, targetPoint);
final MapleMonster ht = MapleLifeFactory.getMonster(8810018);
ht.setParentMobOid(htIntro.getObjectId());
ht.addListener(new MonsterListener() {
@Override
public void monsterKilled(int aniTime) {
}
@Override
public void monsterDamaged(MapleCharacter from, int trueDmg) {
ht.addHp(trueDmg);
}
@Override
public void monsterHealed(int trueHeal) {
ht.addHp(-trueHeal);
}
});
spawnMonsterOnGroundBelow(ht, targetPoint);
for (int x = 8810002; x <= 8810009; x++) {
MapleMonster m = MapleLifeFactory.getMonster(x);
m.setParentMobOid(htIntro.getObjectId());
m.addListener(new MonsterListener() {
@Override
public void monsterKilled(int aniTime) {
}
@Override
public void monsterDamaged(MapleCharacter from, int trueDmg) {
ht.applyAndGetHpDamage(trueDmg, true);
ht.broadcastMobHpBar(from);
}
@Override
public void monsterHealed(int trueHeal) {
ht.addHp(trueHeal);
}
});
spawnMonsterOnGroundBelow(m, targetPoint);
}
}
use of server.life.MapleMonster in project HeavenMS by ronancpl.
the class MaplePacketCreator method spawnMonsterInternal.
/**
* Internal function to handler monster spawning and controlling.
*
* @param life The mob to perform operations with.
* @param requestController Requesting control of mob?
* @param newSpawn New spawn (fade in?)
* @param aggro Aggressive mob?
* @param effect The spawn effect to use.
* @return The spawn/control packet.
*/
private static byte[] spawnMonsterInternal(MapleMonster life, boolean requestController, boolean newSpawn, boolean aggro, int effect, boolean makeInvis) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
if (makeInvis) {
mplew.writeShort(SendOpcode.SPAWN_MONSTER_CONTROL.getValue());
mplew.write(0);
mplew.writeInt(life.getObjectId());
return mplew.getPacket();
}
if (requestController) {
mplew.writeShort(SendOpcode.SPAWN_MONSTER_CONTROL.getValue());
mplew.write(aggro ? 2 : 1);
} else {
mplew.writeShort(SendOpcode.SPAWN_MONSTER.getValue());
}
mplew.writeInt(life.getObjectId());
mplew.write(life.getController() == null ? 5 : 1);
mplew.writeInt(life.getId());
mplew.skip(15);
mplew.write(0x88);
mplew.skip(6);
mplew.writePos(life.getPosition());
mplew.write(life.getStance());
// Origin FH //life.getStartFh()
mplew.writeShort(0);
mplew.writeShort(life.getFh());
if (life.getParentMobOid() != 0) {
MapleMonster parentMob = life.getMap().getMonsterByOid(life.getParentMobOid());
if (parentMob != null && parentMob.isAlive()) {
mplew.write(effect != 0 ? effect : -3);
mplew.writeInt(life.getParentMobOid());
} else {
encodeParentlessMobSpawnEffect(mplew, newSpawn, effect);
}
} else {
encodeParentlessMobSpawnEffect(mplew, newSpawn, effect);
}
mplew.write(life.getTeam());
// getItemEffect
mplew.writeInt(0);
return mplew.getPacket();
}
Aggregations