Beispiel #1
0
 private static void getLongMask_NoRef(
     MaplePacketLittleEndianWriter mplew, Collection<MonsterStatusEffect> ss, boolean ignore_imm) {
   int[] mask = new int[GameConstants.MAX_MONSTERSTATUS];
   for (MonsterStatusEffect statup : ss) {
     if ((statup != null) && ((!ignore_imm))) {
       mask[(statup.getStati().getPosition() - 1)] |= statup.getStati().getValue();
     }
   }
   for (int i = mask.length; i >= 1; i--) {
     mplew.writeInt(mask[(i - 1)]);
   }
 }
 public static void handleMap(MapleMap map, int numTimes, int size, long now) {
   if (map.getItemsSize() > 0) {
     for (MapleMapItem item : map.getAllItemsThreadsafe()) {
       if (item.shouldExpire(now)) {
         item.expire(map);
       } else if (item.shouldFFA(now)) {
         item.setDropType((byte) 2);
       }
     }
   }
   if (map.getCharactersSize() > 0 || map.getId() == 931000500) {
     if (map.canSpawn(now)) {
       map.respawn(false, now);
     }
     boolean hurt = map.canHurt(now);
     boolean canrune = true;
     for (MapleCharacter chr : map.getCharactersThreadsafe()) {
       handleCooldowns(chr, numTimes, hurt, now);
     }
     if (map.getMobsSize() > 0) {
       for (MapleMonster mons : map.getAllMonstersThreadsafe()) {
         if (mons.getStats().isBoss()) {
           canrune = false;
         }
         if ((mons.isAlive()) && (mons.shouldKill(now))) {
           map.killMonster(mons);
         } else if ((mons.isAlive()) && (mons.shouldDrop(now))) {
           mons.doDropItem(now);
         } else if ((mons.isAlive()) && (mons.getStatiSize() > 0)) {
           for (MonsterStatusEffect mse : mons.getAllBuffs()) {
             if (mse.shouldCancel(now)) {
               mons.cancelSingleStatus(mse);
             }
           }
         }
       }
     }
   }
 }
Beispiel #3
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 #4
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 #5
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();
  }