示例#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();
  }
示例#2
0
  public static byte[] damageMonster(int oid, long damage) {
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.DAMAGE_MONSTER.getValue());
    mplew.writeInt(oid);
    mplew.write(0);
    mplew.writeInt((int) damage);

    return mplew.getPacket();
  }
示例#3
0
  public static byte[] healMonster(int oid, int heal) {
    if (ServerProperties.ShowPacket()) {
      System.out.println("调用: " + new java.lang.Throwable().getStackTrace()[0]);
    }
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.DAMAGE_MONSTER.getValue());
    mplew.writeInt(oid);
    mplew.write(0);
    mplew.writeInt(-heal);

    return mplew.getPacket();
  }