コード例 #1
0
ファイル: MobPacket.java プロジェクト: eee123666/mapleLemon
  public static byte[] controlMonster(MapleMonster life, boolean newSpawn, boolean aggro) {
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.SPAWN_MONSTER_CONTROL.getValue());
    mplew.write(aggro ? 2 : 1);
    mplew.writeInt(life.getObjectId());
    mplew.writeInt(life.getId());
    mplew.writePos(life.getTruePosition());
    mplew.write(2);
    mplew.writeShort(life.getFh());
    mplew.write(life.getStance());
    mplew.write(newSpawn ? -2 : life.isFake() ? -4 : -1);

    mplew.write(0);
    mplew.writeLong(0);

    return mplew.getPacket();
  }
コード例 #2
0
ファイル: MobPacket.java プロジェクト: eee123666/mapleLemon
  /**
   * 召唤怪物
   *
   * @param life
   * @param spawnType
   * @param link
   * @return
   */
  public static byte[] spawnMonster(MapleMonster life, int spawnType, int link) {
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.SPAWN_MONSTER.getValue());
    mplew.writeInt(life.getObjectId());
    mplew.writeInt(life.getId());
    mplew.writePos(life.getTruePosition());
    mplew.write((life.getController() != null ? 0x08 : 0x02));
    mplew.writeShort(life.getFh());
    mplew.write(life.getStance());
    //        if (effect > 0) {
    //            mplew.write(effect);
    //            mplew.writeInt(life.getObjectId());
    //        }
    mplew.write(spawnType);
    mplew.write(1); // 召唤的时候特效,在wz中有对应的值
    mplew.writeLong(0);

    return mplew.getPacket();
  }