Beispiel #1
0
  public static byte[] moveMonsterResponse(
      int objectid, short moveid, int currentMp, boolean useSkills, int skillId, int skillLevel) {
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.MOVE_MONSTER_RESPONSE.getValue());
    mplew.writeInt(objectid);
    mplew.writeShort(moveid);
    mplew.write(useSkills ? 1 : 0);
    mplew.writeShort(currentMp);
    mplew.write(skillId);
    mplew.write(skillLevel);

    return mplew.getPacket();
  }
Beispiel #2
0
  public static byte[] applyMonsterStatus(MapleMonster mons, MonsterStatusEffect ms) {
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
    mplew.writeInt(mons.getObjectId());
    PacketHelper.writeMonsterStatusMask(mplew, ms.getStati());
    mplew.writeShort(ms.getX());
    if (ms.isMonsterSkill()) {
      mplew.writeShort(ms.getMobSkill().getSkillId());
      mplew.writeShort(ms.getMobSkill().getSkillLevel());
    } else if (ms.getSkill() > 0) {
      mplew.writeInt(ms.getSkill());
    }
    mplew.writeShort(100);
    mplew.writeShort(1); // delay in ms
    return mplew.getPacket();
  }
Beispiel #3
0
  public static byte[] applyMonsterStatus(int oid, MonsterStatus mse, int x, MobSkill skil) {
    if (ServerProperties.ShowPacket()) {
      System.out.println("调用: " + new java.lang.Throwable().getStackTrace()[0]);
    }
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
    mplew.writeInt(oid);
    PacketHelper.writeMonsterStatusMask(mplew, mse);
    mplew.writeInt(x);
    mplew.writeShort(skil.getSkillId());
    mplew.writeShort(skil.getSkillLevel());
    mplew.writeShort(0);
    mplew.writeShort(0);

    mplew.write(1);
    mplew.write(1);
    return mplew.getPacket();
  }
Beispiel #4
0
  public static byte[] applyMonsterStatus(
      int oid, Map<MonsterStatus, Integer> stati, List<Integer> reflection, MobSkill skil) {
    if (ServerProperties.ShowPacket()) {
      System.out.println("调用: " + new java.lang.Throwable().getStackTrace()[0]);
    }
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
    mplew.writeInt(oid);
    PacketHelper.writeMonsterStatusMask(mplew, stati.keySet());

    for (Map.Entry mse : stati.entrySet()) {
      mplew.writeShort(((Integer) mse.getValue()));
      mplew.writeInt(skil.getSkillId());
      mplew.writeShort(
          100); // buffTime, this needs to be coded properly -- as a workaround, we'll use 100.
    }
    mplew.write(1); // delay in ms
    return mplew.getPacket();
  }
Beispiel #5
0
  public static byte[] showMonsterResist(int oid) {
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.MONSTER_RESIST.getValue());
    mplew.writeInt(oid);
    mplew.writeInt(0);
    mplew.writeShort(1);
    mplew.writeInt(0);

    return mplew.getPacket();
  }
Beispiel #6
0
  public static byte[] getMobSkillEffect(int oid, int skillid, int cid, int skilllevel) {
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.SKILL_EFFECT_MOB.getValue());
    mplew.writeInt(oid);
    mplew.writeInt(skillid);
    mplew.writeInt(cid);
    mplew.writeShort(skilllevel);

    return mplew.getPacket();
  }
Beispiel #7
0
  public static byte[] cancelMonsterPoisonStatus(int oid, MonsterStatusEffect m) {
    if (ServerProperties.ShowPacket()) {
      System.out.println("调用: " + new java.lang.Throwable().getStackTrace()[0]);
    }
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.CANCEL_MONSTER_STATUS.getValue());
    mplew.writeInt(oid);
    //        PacketHelper.writeMonsterStatusMask(mplew, MonsterStatus.持续掉血);
    mplew.writeInt(0);
    mplew.writeInt(1);
    mplew.writeInt(m.getFromID());
    if (m.isMonsterSkill()) {
      mplew.writeShort(m.getMobSkill().getSkillId());
      mplew.writeShort(m.getMobSkill().getSkillLevel());
    } else if (m.getSkill() > 0) {
      mplew.writeInt(m.getSkill());
    }
    mplew.write(3);

    return mplew.getPacket();
  }
Beispiel #8
0
  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();
  }
Beispiel #9
0
  /**
   * 召唤怪物
   *
   * @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();
  }
Beispiel #10
0
  public static byte[] applyMonsterPoisonStatus(MapleMonster mons, List<MonsterStatusEffect> mse) {
    if (ServerProperties.ShowPacket()) {
      System.out.println("调用: " + new java.lang.Throwable().getStackTrace()[0]);
    }
    if ((mse.size() <= 0) || (mse.get(0) == null)) {
      return MaplePacketCreator.enableActions();
    }
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

    mplew.write(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
    mplew.writeInt(mons.getObjectId());
    MonsterStatusEffect ms = (MonsterStatusEffect) mse.get(0);
    if (ms.getStati() == MonsterStatus.中毒) {
      PacketHelper.writeMonsterStatusMask(mplew, MonsterStatus.持续掉血);
      mplew.write(mse.size());
      for (MonsterStatusEffect m : mse) {
        mplew.writeInt(m.getFromID());
        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());
        mplew.writeInt(1000);
        mplew.writeInt(0);
        mplew.writeInt(10000);
        mplew.writeInt((int) (m.getDotTime() / 1000L));
        mplew.writeInt(0);
      }
      mplew.writeShort(1000);
      mplew.write(1);
    } else {
      PacketHelper.writeSingleMask(mplew, ms.getStati());
      mplew.writeInt(ms.getX());
      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);
      mplew.writeShort(0);
      mplew.write(1);
      mplew.write(1);
    }
    return mplew.getPacket();
  }