コード例 #1
0
 /**
  * 箭矢炮盘
  *
  * @param owner
  * @param side
  * @param pos
  */
 public MapleArrowsTurret(MapleCharacter owner, byte side, Point pos) {
   this.map = owner.getMap();
   this.ownerid = owner.getId();
   this.ownerLevel = owner.getLevel();
   this.skillId = 3121013;
   this.skillLevel = owner.getSkillLevel(skillId);
   this.side = side;
   setPosition(pos);
 }
コード例 #2
0
 public MapleSummon(MapleCharacter owner, int skill, Point pos, SummonMovementType movementType) {
   super();
   this.owner = owner;
   this.skill = skill;
   this.skillLevel = owner.getSkillLevel(SkillFactory.getSkill(skill));
   if (skillLevel == 0) {
     throw new RuntimeException("Trying to create a summon for a char without the skill");
   }
   this.movementType = movementType;
   setPosition(pos);
 }
コード例 #3
0
 public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
   if (!c.getPlayer().isAlive()) {
     c.announce(MaplePacketCreator.enableActions());
     return;
   }
   slea.readInt();
   byte slot = (byte) slea.readShort();
   int itemId = slea.readInt();
   MapleCharacter player = c.getPlayer();
   IItem toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot);
   if (toUse != null && toUse.getQuantity() == 1) {
     if (toUse.getItemId() != itemId) {
       return;
     }
     Map<String, Integer> skilldata =
         MapleItemInformationProvider.getInstance()
             .getSkillStats(toUse.getItemId(), c.getPlayer().getJob().getId());
     boolean canuse = false;
     boolean success = false;
     int skill = 0;
     int maxlevel = 0;
     if (skilldata == null) {
       return;
     }
     if (skilldata.get("skillid") == 0) {
       canuse = false;
     } else if (player.getMasterLevel(SkillFactory.getSkill(skilldata.get("skillid")))
             >= skilldata.get("reqSkillLevel")
         || skilldata.get("reqSkillLevel") == 0) {
       canuse = true;
       if (Randomizer.nextInt(101) < skilldata.get("success") && skilldata.get("success") != 0) {
         success = true;
         ISkill skill2 = SkillFactory.getSkill(skilldata.get("skillid"));
         player.changeSkillLevel(
             skill2,
             player.getSkillLevel(skill2),
             Math.max(skilldata.get("masterLevel"), player.getMasterLevel(skill2)),
             -1);
       } else {
         success = false;
         player.message(
             "The skill book lights up, but the skill winds up as if nothing happened.");
       }
       MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
     } else {
       canuse = false;
     }
     player
         .getClient()
         .announce(MaplePacketCreator.skillBookSuccess(player, skill, maxlevel, canuse, success));
   }
 }
コード例 #4
0
  @Override
  public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    final MapleCharacter chr = c.getPlayer();

    if ((slea.available() > 8L) && (chr != null)) {
      slea.skip(4);
      int numChanges = slea.readInt();

      for (int i = 0; i < numChanges; i++) {
        int key = slea.readInt();
        byte type = slea.readByte();
        int action = slea.readInt();
        if ((type == 1) && (action >= 1000)) {
          Skill skil = SkillFactory.getSkill(action);
          if ((skil != null)
              && (((!skil.isFourthJob())
                      && (!skil.isBeginnerSkill())
                      && (skil.isInvisible())
                      && (chr.getSkillLevel(skil) <= 0))
                  || (GameConstants.isLinkedAttackSkill(action))
                  || (action % 10000 < 1000))) {
            continue;
          }
        }
        chr.changeKeybinding(key, type, action);
      }
    } else if (chr != null) {
      int type = slea.readInt();
      int data = slea.readInt();
      switch (type) {
        case 1:
          if (data <= 0) {
            chr.getQuestRemove(MapleQuest.getInstance(GameConstants.HP_ITEM));
          } else {
            chr.getQuestNAdd(MapleQuest.getInstance(GameConstants.HP_ITEM))
                .setCustomData(String.valueOf(data));
          }
          break;
        case 2:
          if (data <= 0) {
            chr.getQuestRemove(MapleQuest.getInstance(GameConstants.MP_ITEM));
          } else {
            chr.getQuestNAdd(MapleQuest.getInstance(GameConstants.MP_ITEM))
                .setCustomData(String.valueOf(data));
          }
          break;
      }
    }
  }