Beispiel #1
0
  public static byte[] damageFriendlyMob(MapleMonster mob, long damage, boolean display) {
    if (ServerProperties.ShowPacket()) {
      System.out.println("调用: " + new java.lang.Throwable().getStackTrace()[0]);
    }
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.DAMAGE_MONSTER.getValue());
    mplew.writeInt(mob.getObjectId());
    mplew.write(display ? 1 : 2);
    if (damage > 2147483647L) {
      mplew.writeInt(2147483647);
    } else {
      mplew.writeInt((int) damage);
    }
    if (mob.getHp() > 2147483647L) {
      mplew.writeInt((int) (mob.getHp() / mob.getMobMaxHp() * 2147483647.0D));
    } else {
      mplew.writeInt((int) mob.getHp());
    }
    if (mob.getMobMaxHp() > 2147483647L) {
      mplew.writeInt(2147483647);
    } else {
      mplew.writeInt((int) mob.getMobMaxHp());
    }

    return mplew.getPacket();
  }
Beispiel #2
0
  public static byte[] showBossHP(MapleMonster mob) {
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.BOSS_ENV.getValue());
    mplew.write(6);
    mplew.writeInt(mob.getId() == 9400589 ? 9300184 : mob.getId());
    if (mob.getHp() > 2147483647L) {
      mplew.writeInt((int) (mob.getHp() / mob.getMobMaxHp() * 2147483647.0D));
    } else {
      mplew.writeInt((int) mob.getHp());
    }
    if (mob.getMobMaxHp() > 2147483647L) {
      mplew.writeInt(2147483647);
    } else {
      mplew.writeInt((int) mob.getMobMaxHp());
    }
    mplew.write(mob.getStats().getTagColor());
    mplew.write(mob.getStats().getTagBgColor());

    return mplew.getPacket();
  }