public static byte[] damageFriendlyMob(final MapleMonster mob, final long damage, final boolean display) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
public static byte[] showBossHP(final MapleMonster mob) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.BOSS_ENV.getValue());
mplew.write(5);
mplew.writeInt(mob.getId() == 9400589 ? 9300184 : mob.getId()); //hack: MV cant have boss hp bar
if (mob.getHp() > Integer.MAX_VALUE) {
mplew.writeInt((int) (((double) mob.getHp() / mob.getMobMaxHp()) * Integer.MAX_VALUE));
} else {
mplew.writeInt((int) mob.getHp());
}
if (mob.getMobMaxHp() > Integer.MAX_VALUE) {
mplew.writeInt(Integer.MAX_VALUE);
} else {
mplew.writeInt((int) mob.getMobMaxHp());
}
mplew.write(mob.getStats().getTagColor());
mplew.write(mob.getStats().getTagBgColor());
return mplew.getPacket();
}
public static byte[] showBossHP(final int monsterId, final long currentHp, final long maxHp) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
//colour legend: (applies to both colours)
//1 = red, 2 = dark blue, 3 = light green, 4 = dark green, 5 = black, 6 = light blue, 7 = purple
return mplew.getPacket();
}
public static byte[] moveMonster(boolean useskill, int skill, int skill1, int skill2, int skill3, int skill4, int oid, Point startPos, List<LifeMovementFragment> moves) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.MOVE_MONSTER.getValue());
mplew.writeInt(oid);
mplew.writeShort(0); //moveid but always 0
mplew.write(useskill ? 1 : 0); //?? I THINK
mplew.write(skill);
mplew.write(skill1);
mplew.write(skill2);
mplew.write(skill3);
mplew.write(skill4);
mplew.writeZeroBytes(8); //o.o?
mplew.writePos(startPos);
mplew.writeShort(8); //? sometimes 0? sometimes 22? sometimes random numbers?
mplew.writeShort(1);
PacketHelper.serializeMovementList(mplew, moves);
return mplew.getPacket();
}
public static byte[] spawnMonster(MapleMonster life, int spawnType, int link) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.SPAWN_MONSTER.getValue());
mplew.writeInt(life.getObjectId());
mplew.write(1); // 1 = Control normal, 5 = Control none
mplew.writeInt(life.getId());
addMonsterStatus(mplew, life);
mplew.writePos(life.getTruePosition());
mplew.write(life.getStance());
mplew.writeShort(0); // FH
mplew.writeShort(life.getFh()); // Origin FH
mplew.write(spawnType);
if (spawnType == -3 || spawnType >= 0) {
mplew.writeInt(link);
}
mplew.write(life.getCarnivalTeam());
mplew.writeLong(0); //aftershock - 0xFF at end
return mplew.getPacket();
}
public static void addMonsterStatus(MaplePacketLittleEndianWriter mplew, MapleMonster life) {
if (life.getStati().size() <= 1) {
life.addEmpty(); //not done yet lulz ok so we add it now for the lulz
}
mplew.write(life.getChangedStats() != null ? 1 : 0);
if (life.getChangedStats() != null) {
mplew.writeInt(life.getChangedStats().hp > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)life.getChangedStats().hp);
mplew.writeInt(life.getChangedStats().mp);
mplew.writeInt(life.getChangedStats().exp);
mplew.writeInt(life.getChangedStats().watk);
mplew.writeInt(life.getChangedStats().matk);
mplew.writeInt(life.getChangedStats().PDRate);
mplew.writeInt(life.getChangedStats().MDRate);
mplew.writeInt(life.getChangedStats().acc);
mplew.writeInt(life.getChangedStats().eva);
mplew.writeInt(life.getChangedStats().pushed);
mplew.writeInt(life.getChangedStats().level);
}
final boolean ignore_imm = life.getStati().containsKey(MonsterStatus.WEAPON_DAMAGE_REFLECT) || life.getStati().containsKey(MonsterStatus.MAGIC_DAMAGE_REFLECT);
Collection<MonsterStatusEffect> buffs = life.getStati().values();
getLongMask_NoRef(mplew, buffs, ignore_imm); //AFTERSHOCK: extra int
for (MonsterStatusEffect buff : buffs) {
if (buff != null && buff.getStati() != MonsterStatus.WEAPON_DAMAGE_REFLECT && buff.getStati() != MonsterStatus.MAGIC_DAMAGE_REFLECT && (!ignore_imm || (buff.getStati() != MonsterStatus.WEAPON_IMMUNITY && buff.getStati() != MonsterStatus.MAGIC_IMMUNITY && buff.getStati() != MonsterStatus.DAMAGE_IMMUNITY))) {
if (buff.getStati() != MonsterStatus.SUMMON && (buff.getStati() != MonsterStatus.EMPTY_2 || GameConstants.GMS) && (buff.getStati() != MonsterStatus.EMPTY_3 || !GameConstants.GMS)) {
if (buff.getStati() == MonsterStatus.EMPTY_1 || buff.getStati() == MonsterStatus.EMPTY_2 || buff.getStati() == MonsterStatus.EMPTY_3 || buff.getStati() == MonsterStatus.EMPTY_4 || buff.getStati() == MonsterStatus.EMPTY_5 || buff.getStati() == MonsterStatus.EMPTY_6) {
mplew.writeShort(Integer.valueOf((int)System.currentTimeMillis()).shortValue()); //wtf
mplew.writeShort(0);
} else {
mplew.writeShort(buff.getX().shortValue());
}
if (buff.getMobSkill() != null) {
mplew.writeShort(buff.getMobSkill().getSkillId());
mplew.writeShort(buff.getMobSkill().getSkillLevel());
} else if (buff.getSkill() > 0) {
mplew.writeInt(buff.getSkill());
}
}
mplew.writeShort(buff.getStati() == MonsterStatus.HYPNOTIZE ? 40 : (buff.getStati().isEmpty() ? 0 : 1));
if (buff.getStati() == MonsterStatus.EMPTY_1 || buff.getStati() == MonsterStatus.EMPTY_3) {
mplew.writeShort(0);
} else if (buff.getStati() == MonsterStatus.EMPTY_4 || buff.getStati() == MonsterStatus.EMPTY_5) {
mplew.writeInt(0);
}
}
}
//wh spawn - 15 zeroes instead of 16, then 98 F4 56 A6 C7 C9 01 28, then 7 zeroes
//8 -> wh 6, then timestamp, then 28 00, then 6 zeroes
}
public static byte[] controlMonster(MapleMonster life, boolean newSpawn, boolean aggro) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.SPAWN_MONSTER_CONTROL.getValue());
mplew.write(aggro ? 2 : 1);
mplew.writeInt(life.getObjectId());
mplew.write(1); // 1 = Control normal, 5 = Control none
mplew.writeInt(life.getId());
addMonsterStatus(mplew, life);
mplew.writePos(life.getTruePosition());
mplew.write(life.getStance()); // Bitfield
mplew.writeShort(0); // FH
mplew.writeShort(life.getFh()); // Origin FH
mplew.write(life.isFake() ? -4 : newSpawn ? -2 : -1);
mplew.write(life.getCarnivalTeam());
mplew.writeLong(0); //big bang - another int here
return mplew.getPacket();
}
public static byte[] stopControllingMonster(int oid) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
public static byte[] makeMonsterEffect(MapleMonster life, int effect) {
return spawnMonster(life, effect, 0);
}
public static byte[] moveMonsterResponse(int objectid, short moveid, int currentMp, boolean useSkills, int skillId, int skillLevel) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
public static byte[] applyMonsterStatus(final int oid, final MonsterStatus mse, int x, MobSkill skil) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
mplew.writeInt(oid);
PacketHelper.writeSingleMask(mplew, mse);
mplew.writeInt(x);
mplew.writeShort(skil.getSkillId());
mplew.writeShort(skil.getSkillLevel());
mplew.writeShort(mse.isEmpty() ? 1 : 0); // might actually be the buffTime but it's not displayed anywhere
mplew.writeShort(0); // delay in ms
mplew.write(1); // size
mplew.write(1); // ? v97
return mplew.getPacket();
}
public static byte[] applyMonsterStatus(final MapleMonster mons, final MonsterStatusEffect ms) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
mplew.writeInt(mons.getObjectId());
//aftershock extra int here
PacketHelper.writeSingleMask(mplew, ms.getStati());
mplew.writeInt(ms.getX().intValue());
if (ms.isMonsterSkill()) {
mplew.writeShort(ms.getMobSkill().getSkillId());
mplew.writeShort(ms.getMobSkill().getSkillLevel());
} else if (ms.getSkill() > 0) {
mplew.writeInt(ms.getSkill());
}
mplew.writeShort(ms.getStati().isEmpty() ? 1 : 0); // might actually be the buffTime but it's not displayed anywhere
mplew.writeShort(0); // delay in ms
mplew.write(1); // size
mplew.write(1); // ? v97
return mplew.getPacket();
}
public static byte[] applyMonsterStatus(final MapleMonster mons, final List<MonsterStatusEffect> mse) {
if (mse.size() <= 0 || mse.get(0) == null) {
return MaplePacketCreator.enableActions();
}
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
mplew.writeInt(mons.getObjectId());
final MonsterStatusEffect ms = mse.get(0);
if (ms.getStati() == MonsterStatus.POISON) { //stack ftw
PacketHelper.writeSingleMask(mplew, MonsterStatus.EMPTY);
mplew.write(mse.size());
for (MonsterStatusEffect m : mse) {
mplew.writeInt(m.getFromID()); //character ID
if (m.isMonsterSkill()) {
mplew.writeShort(m.getMobSkill().getSkillId());
mplew.writeShort(m.getMobSkill().getSkillLevel());
} else if (m.getSkill() > 0) {
mplew.writeInt(m.getSkill());
}
mplew.writeInt(m.getX()); //dmg
mplew.writeLong(1000); //delay -> tick count
mplew.writeInt(5); //buff time ?
}
mplew.writeShort(300); // delay in ms
mplew.write(1); // size
} else {
PacketHelper.writeSingleMask(mplew, ms.getStati());
mplew.writeInt(ms.getX().intValue());
if (ms.isMonsterSkill()) {
mplew.writeShort(ms.getMobSkill().getSkillId());
mplew.writeShort(ms.getMobSkill().getSkillLevel());
} else if (ms.getSkill() > 0) {
mplew.writeInt(ms.getSkill());
}
mplew.writeShort(0); // might actually be the buffTime but it's not displayed anywhere
mplew.writeShort(0); // delay in ms
mplew.write(1); // size
mplew.write(1); // ? v97
}
return mplew.getPacket();
}
public static byte[] applyMonsterStatus(final int oid, final Map<MonsterStatus, Integer> stati, final List<Integer> reflection, MobSkill skil) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
for (Map.Entry<MonsterStatus, Integer> mse : stati.entrySet()) {
mplew.writeInt(mse.getValue().intValue());
mplew.writeShort(skil.getSkillId());
mplew.writeShort(skil.getSkillLevel());
mplew.writeShort(0); // might actually be the buffTime but it's not displayed anywhere
}
for (Integer ref : reflection) {
mplew.writeInt(ref);
}
mplew.writeLong(0);
mplew.writeShort(0); // delay in ms
int size = stati.size(); // size
if (reflection.size() > 0) {
size /= 2; // This gives 2 buffs per reflection but it's really one buff
}
mplew.write(size); // size
mplew.write(1); // ? v97
return mplew.getPacket();
}
public static byte[] cancelMonsterStatus(int oid, MonsterStatus stat) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
lol chicken mac nuggets. :8:
Waiting for fixed one!
LOL
17-03-12
Active
Re: Fix for invisible mobs. (v1.14 MSEA)
Quote:
Originally Posted by SXMaple
This still has bugs, that why I gave it to him.
no bug, working fine at my server.
17-03-12
drzboy
Re: Fix for invisible mobs. (v1.14 MSEA)
Quote:
Originally Posted by Active
no bug, working fine at my server.
Apparently, it's working fine but, you see.
There is bug like what he has said.
Otherwise he wouldn't have given it to him willingly as stated in this topic credits which is to SXMaple.
And damn, how can you compile lululul while i can't. ;(
okwell..
chickennuggets :(:
18-03-12
Active
Re: Fix for invisible mobs. (v1.14 MSEA)
Quote:
Originally Posted by drzboy
Apparently, it's working fine but, you see.
There is bug like what he has said.
Otherwise he wouldn't have given it to him willingly as stated in this topic credits which is to SXMaple.
And damn, how can you compile lululul while i can't. ;(
okwell..
chickennuggets :(:
some secret cannot tell, fix it at the code.
really working fine at my server
18-03-12
SXMaple
Re: Fix for invisible mobs. (v1.14 MSEA)
Sure spawning mobs works, that's not the bug.
You need to do a lot more testing to find the bug. Posted via Mobile Device
18-03-12
Active
1 Attachment(s)
Re: Fix for invisible mobs. (v1.14 MSEA)
Quote:
Originally Posted by SXMaple
Sure spawning mobs works, that's not the bug.
You need to do a lot more testing to find the bug. Posted via Mobile Device
ok, i will do more testing to find more bug.
btw this also very helpful, thank. Attachment 98079
19-03-12
kakalai
Re: Fix for invisible mobs. (v1.14 MSEA)
Quote:
Originally Posted by Active
ok, i will do more testing to find more bug.
btw this also very helpful, thank. Attachment 98079