Esempio n. 1
0
  @Override
  public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
    List<Pair<MapleStat, Integer>> statupdate = new ArrayList<Pair<MapleStat, Integer>>(2);
    c.getSession().write(MaplePacketCreator.updatePlayerStats(statupdate, true));
    slea.readInt(); // whatever

    int update = slea.readInt();
    if (c.getPlayer().getRemainingAp() > 0) {
      switch (update) {
        case 64: // str
          if (c.getPlayer().getStr() >= 32767) {
            return;
          }
          c.getPlayer().setStr(c.getPlayer().getStr() + 1);
          statupdate.add(new Pair<MapleStat, Integer>(MapleStat.STR, c.getPlayer().getStr()));
          break;
        case 128: // dex
          if (c.getPlayer().getDex() >= 32767) {
            return;
          }
          c.getPlayer().setDex(c.getPlayer().getDex() + 1);
          statupdate.add(new Pair<MapleStat, Integer>(MapleStat.DEX, c.getPlayer().getDex()));
          break;
        case 256: // int
          if (c.getPlayer().getInt() >= 32767) {
            return;
          }
          c.getPlayer().setInt(c.getPlayer().getInt() + 1);
          statupdate.add(new Pair<MapleStat, Integer>(MapleStat.INT, c.getPlayer().getInt()));
          break;
        case 512: // luk
          if (c.getPlayer().getLuk() >= 32767) {
            return;
          }
          c.getPlayer().setLuk(c.getPlayer().getLuk() + 1);
          statupdate.add(new Pair<MapleStat, Integer>(MapleStat.LUK, c.getPlayer().getLuk()));
          break;
        case 2048: // hp
        case 8192: // mp
          c.showMessage("You cannot add Ap to HP or MP in NinjaMS. :)");
          return;
        default:
          c.getSession()
              .write(
                  MaplePacketCreator.updatePlayerStats(MaplePacketCreator.EMPTY_STATUPDATE, true));
          return;
      }
      c.getPlayer().setRemainingAp(c.getPlayer().getRemainingAp() - 1);
      statupdate.add(
          new Pair<MapleStat, Integer>(MapleStat.AVAILABLEAP, c.getPlayer().getRemainingAp()));
      c.getSession().write(MaplePacketCreator.updatePlayerStats(statupdate, true));
    } else {
      // AutobanManager.getInstance().addPoints(c, 334, 120000, "Trying to distribute AP to " +
      // update + " that are not availables");
      // log.info("[h4x] Player {} is distributing ap to {} without having any",
      // c.getPlayer().getName(), Integer.valueOf(update));
    }
  }
Esempio n. 2
0
 public void execute(final MapleClient c, final MessageCallback mc, String[] splitted)
     throws Exception, IllegalCommandSyntaxException {
   MapleCharacter player = c.getPlayer();
   if (splitted[0].equalsIgnoreCase("avatarblock")) {
     if (player.haveSight(5)) {
       if (splitted[1].equalsIgnoreCase("on")) {
         mc.dropMessage("You will not see Avatar Smegas");
         player.gainItem(Items.currencyType.Sight, -5);
         player.setAsmega();
       } else {
         mc.dropMessage("You should now be able to see Avatar Smegas");
         player.gainItem(Items.currencyType.Sight, -5);
         player.setAllMega();
       }
     } else {
       mc.dropMessage("You need atleast 5 Tao of Sight to do this.");
     }
   } else if (splitted[0].equalsIgnoreCase("smegablock")) {
     if (player.haveSight(5)) {
       if (splitted[1].equalsIgnoreCase("on")) {
         mc.dropMessage("You will not see Pink & yellow Smegas");
         player.gainItem(Items.currencyType.Sight, -5);
         player.setPsmega();
       } else {
         mc.dropMessage("You should now be able to see pink and Tellow Smegas");
         player.gainItem(Items.currencyType.Sight, -5);
         player.setAsmega();
       }
     } else {
       mc.dropMessage("You need atleast 5 Tao of Sight to do this.");
     }
   } else if (splitted[0].equalsIgnoreCase("allsmegablock")) {
     if (player.haveSight(5)) {
       if (splitted[1].equalsIgnoreCase("on")) {
         mc.dropMessage("You will not see Pink & yellow and Avatar Smegas");
         player.gainItem(Items.currencyType.Sight, -5);
         player.setPsmega();
       } else {
         mc.dropMessage("You should now be able to see pink, Yellow and Avatar Smegas");
         player.gainItem(Items.currencyType.Sight, -5);
         player.setAllMega();
       }
     } else {
       mc.dropMessage("You need atleast 5 Tao of Sight to do this.");
     }
   } else if (splitted[0].equalsIgnoreCase("whodrops")) {
     if (splitted.length < 2) {
       mc.dropMessage("@whodrops <itemid>");
     } else {
       int itemid = Integer.parseInt(splitted[1]);
       List<String> retMobs = SearchProcessor.whoDrops(itemid);
       if (retMobs != null && retMobs.size() > 1) {
         mc.dropMessage("---------------------List---------------------");
         for (String singleRetMob : retMobs) {
           c.showMessage(5, singleRetMob);
         }
         mc.dropMessage(
             "'Per drop' is determined by your drop rate. A monster can drop a maximum of your drop rate items each time. Each drop is individually calculated by this chance. Same principle applies to boss drop.");
       } else {
         mc.dropMessage("No mobs drop this item. ( Item id : " + itemid + " )");
       }
     }
   } else if (splitted[0].equalsIgnoreCase("whisper")) {
     String name = splitted[1];
     String words = StringUtil.joinStringFrom(splitted, 2);
     ChatHandler.whisper(name, words, c);
   } else if (splitted[0].equalsIgnoreCase("addbuddy")) {
     String name = splitted[1];
     String group = "Default Group";
     BuddyListHandler.addBuddy(name, group, c); // cheat, but who cares!
     mc.dropMessage("Done!");
   }
 }