Beispiel #1
0
 public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
   if (splitted[0].equalsIgnoreCase("reloadmap")) {
     if (splitted.length < 2) {
       mc.dropMessage("If you don't know how to use it. You should't be using it.");
       return;
     }
     int mapid = Integer.parseInt(splitted[1]);
     MapleMap map = c.getChannelServer().getMapFactory().getMap(mapid);
     map.deleteAndReloadMap();
   } else if (splitted[0].equalsIgnoreCase("reloaddropspawn")) {
     try {
       TimerManager.getInstance().stop();
     } catch (Exception e) {
       mc.dropMessage("Error : " + e);
       e.printStackTrace();
     } finally {
       try {
         TimerManager tMan = TimerManager.getInstance();
         tMan.start();
         mc.dropMessage("Success");
       } catch (Exception e) {
         mc.dropMessage("Error : " + e);
         e.printStackTrace();
       }
     }
   } else if (splitted[0].equalsIgnoreCase("resetreactors")) {
     c.getPlayer().getMap().resetReactors();
   }
 }
Beispiel #2
0
 @Override
 public void execute(MapleClient c, MessageCallback mc, String[] splitted)
     throws Exception, IllegalCommandSyntaxException {
   if (splitted[0].equals("!saveall")) {
     /*
      * Collection<ChannelServer> ccs = ChannelServer.getAllInstances();
      * for (ChannelServer chan : ccs) {
      * mc.dropMessage("Saving characters on channel " +
      * chan.getChannel()); if (chan != null) {
      * Collection<MapleCharacter> chars = new
      * LinkedHashSet<MapleCharacter
      * >(Collections.synchronizedCollection(chan
      * .getPlayerStorage().getAllCharacters())); synchronized (chars) {
      * for (MapleCharacter chr : chars) { try { if (chr != null) {
      * chr.saveToDB(true); } } catch (Exception e) { continue; } } } } }
      * mc.dropMessage("All characters have been saved.");
      */
     mc.dropMessage("无需使用此命令。");
   }
 }
 public void execute(MapleClient c, MessageCallback mc, String[] splitted)
     throws Exception, IllegalCommandSyntaxException {
   MapleCharacter player = c.getPlayer();
   if (splitted[0].equals("shop")) {
     MapleShopFactory sfact = MapleShopFactory.getInstance();
     MapleShop shop = sfact.getShop(getOptionalIntArg(splitted, 1, 1));
     shop.sendShop(c);
   } else if (splitted[0].equals("item")) {
     short quantity = (short) getOptionalIntArg(splitted, 2, 1);
     int itemId = Integer.parseInt(splitted[1]);
     if (ii.getSlotMax(itemId) > 0) {
       if (itemId >= 5000000 && itemId <= 5000100) {
         if (quantity > 1) {
           quantity = 1;
         }
         int petId = MaplePet.createPet(itemId);
         MapleInventoryManipulator.addById(
             c,
             itemId,
             quantity,
             c.getPlayer().getName() + "used !item with quantity " + quantity,
             player.getName(),
             petId);
         return;
       }
       MapleInventoryManipulator.addById(
           c,
           itemId,
           quantity,
           c.getPlayer().getName() + "used !item with quantity " + quantity,
           player.getName());
     } else {
       mc.dropMessage("Item " + itemId + " not found.");
     }
   } else if (splitted[0].equals("drop")) {
     int itemId = Integer.parseInt(splitted[1]);
     if (ii.getSlotMax(itemId) > 0) {
       if (SpecialStuff.getInstance().isGMBlocked(itemId) && !player.isHokage()) {
         mc.dropMessage("Sunny says you cannot drop this item");
         return;
       }
       short quantity = (short) (short) getOptionalIntArg(splitted, 2, 1);
       IItem toDrop;
       if (ii.getInventoryType(itemId) == MapleInventoryType.EQUIP) {
         toDrop = ii.getEquipById(itemId);
       } else {
         toDrop = new Item(itemId, (byte) 0, (short) quantity);
       }
       toDrop.setOwner(player.getName());
       c.getPlayer()
           .getMap()
           .spawnItemDrop(
               c.getPlayer(), c.getPlayer(), toDrop, c.getPlayer().getPosition(), true, true);
     } else {
       mc.dropMessage("The Item " + itemId + " does not exist");
     }
   } else if (splitted[0].equalsIgnoreCase("clearslot")) {
     if (splitted[1].equalsIgnoreCase("all")) {
       clearslot(c, 1);
       clearslot(c, 2);
       clearslot(c, 3);
       clearslot(c, 4);
       clearslot(c, 5);
       mc.dropMessage("All inventory slots cleared.");
     } else if (splitted[1].equalsIgnoreCase("eq")) {
       clearslot(c, 1);
       mc.dropMessage("Eq inventory slots cleared.");
     } else if (splitted[1].equalsIgnoreCase("use")) {
       clearslot(c, 2);
       mc.dropMessage("Use inventory slots cleared.");
     } else if (splitted[1].equalsIgnoreCase("etc")) {
       clearslot(c, 4);
       mc.dropMessage("Etc inventory slots cleared.");
     } else if (splitted[1].equalsIgnoreCase("setup")) {
       clearslot(c, 3);
       mc.dropMessage("Setup inventory slots cleared.");
     } else if (splitted[1].equalsIgnoreCase("cash")) {
       clearslot(c, 5);
       mc.dropMessage("Cash inventory slots cleared.");
     } else {
       mc.dropMessage("!clearslot " + splitted[1] + " does not exist!");
     }
   } else if (splitted[0].equalsIgnoreCase("omghax")) {
     short stat = 1;
     short wa = 1;
     int itemid = 1302000;
     if (splitted.length == 4) {
       try {
         itemid = Integer.parseInt(splitted[1]);
         stat = Short.parseShort(splitted[2]);
         wa = Short.parseShort(splitted[3]);
       } catch (NumberFormatException numberFormatException) {
       }
     } else if (splitted.length == 3) {
       try {
         itemid = Integer.parseInt(splitted[1]);
         stat = Short.parseShort(splitted[2]);
       } catch (NumberFormatException numberFormatException) {
       }
     } else if (splitted.length == 2) {
       try {
         itemid = Integer.parseInt(splitted[1]);
       } catch (NumberFormatException numberFormatException) {
       }
       stat = 32767;
     }
     if (itemid > 1000000 && itemid > 2000000 || ii.getSlotMax(itemid) > 0) {
       MapleInventoryManipulator.addStatItemById(c, itemid, c.getPlayer().getName(), stat, wa, wa);
     } else {
       mc.dropMessage("You have entered invalid Item ID : " + itemid);
     }
   }
 }
Beispiel #4
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!");
   }
 }
Beispiel #5
0
 @Override
 public void execute(MapleClient c, MessageCallback mc, String[] splitted)
     throws Exception, IllegalCommandSyntaxException {
   MapleCharacter player = c.getPlayer();
   if (splitted[0].equals("@dojob")) {
     NPCScriptManager npc = NPCScriptManager.getInstance();
     npc.start(c, 9001001);
   } else if (splitted[0].equals("@spinel")) {
     NPCScriptManager npc = NPCScriptManager.getInstance();
     npc.start(c, 9000020);
   } else if (splitted[0].equals("@str")
       || splitted[0].equals("@int")
       || splitted[0].equals("@luk")
       || splitted[0].equals("@dex")) {
     int amount = Integer.parseInt(splitted[1]);
     boolean str = splitted[0].equals("@str");
     boolean Int = splitted[0].equals("@int");
     boolean luk = splitted[0].equals("@luk");
     boolean dex = splitted[0].equals("@dex");
     if (amount > 0 && amount <= player.getRemainingAp() && amount <= 32763
         || amount < 0
             && amount >= -32763
             && Math.abs(amount) + player.getRemainingAp() <= 32767) {
       if (str && amount + player.getStr() <= 32767 && amount + player.getStr() >= 4) {
         player.setStr(player.getStr() + amount);
         player.updateSingleStat(MapleStat.STR, player.getStr());
         player.setRemainingAp(player.getRemainingAp() - amount);
         player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
       } else if (Int && amount + player.getInt() <= 32767 && amount + player.getInt() >= 4) {
         player.setInt(player.getInt() + amount);
         player.updateSingleStat(MapleStat.INT, player.getInt());
         player.setRemainingAp(player.getRemainingAp() - amount);
         player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
       } else if (luk && amount + player.getLuk() <= 32767 && amount + player.getLuk() >= 4) {
         player.setLuk(player.getLuk() + amount);
         player.updateSingleStat(MapleStat.LUK, player.getLuk());
         player.setRemainingAp(player.getRemainingAp() - amount);
         player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
       } else if (dex && amount + player.getDex() <= 32767 && amount + player.getDex() >= 4) {
         player.setDex(player.getDex() + amount);
         player.updateSingleStat(MapleStat.DEX, player.getDex());
         player.setRemainingAp(player.getRemainingAp() - amount);
         player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
       } else {
         mc.dropMessage(
             "Please make sure the stat you are trying to raise is not over 32,767 or under 4.");
       }
     } else {
       mc.dropMessage(
           "Please make sure your AP is not over 32,767 and you have enough to distribute.");
     }
   } else if (splitted[0].equals("@emo")) {
     player.setHp(0);
     player.updateSingleStat(MapleStat.HP, 0);
   } else if (splitted[0].equals("@expfix")) {
     player.setExp(0);
     player.updateSingleStat(MapleStat.EXP, player.getExp());
     mc.dropMessage("Your exp has been fixed~!");
   } else if (splitted[0].equals("@myap")) {
     mc.dropMessage(
         "You currently have "
             + c.getPlayer().getStr()
             + " STR, "
             + c.getPlayer().getDex()
             + " DEX, "
             + c.getPlayer().getLuk()
             + " LUK, "
             + c.getPlayer().getInt()
             + " INT.");
     mc.dropMessage("You currently have " + c.getPlayer().getRemainingAp() + " Ability Points.");
   } else if (splitted[0].equals("@commands")) {
     mc.dropMessage("The player Commands are:");
     mc.dropMessage(
         "@str, @int, @dex, @achievements, @luk, @save, @dojob, @expfix, @myap, @emo, @rebirth, @apreset, @dispose, @goto");
   } else if (splitted[0].equals("@rebirth")) {
     if (player.getLevel() >= 200) {
       int totalrebirth = c.getPlayer().getReborns() + 1;
       mc.dropMessage("You have been reborned. For a total of " + totalrebirth + " times.");
       player.doReborn();
     } else {
       mc.dropMessage("You are not level 200 yet!");
     }
   } else if (splitted[0].equals("@save")) {
     if (!player.getCheatTracker().Spam(60000, 0)) { // 1 minute
       player.saveToDB(true);
       mc.dropMessage("Character information saved.");
     } else {
       mc.dropMessage("You cannot save more than once every minute.");
     }
   } else if (splitted[0].equalsIgnoreCase("@achievements")) {
     mc.dropMessage("Your finished achievements:");
     for (Integer i : c.getPlayer().getFinishedAchievements()) {
       mc.dropMessage(
           MapleAchievements.getInstance().getById(i).getName()
               + " - "
               + MapleAchievements.getInstance().getById(i).getReward()
               + " NX.");
     }
   } else if (splitted[0].equals("@dispose")) {
     NPCScriptManager.getInstance().dispose(c);
     c.getSession().write(MaplePacketCreator.enableActions());
     mc.dropMessage("Done.");
   } else if (splitted[0].equals("@apreset")) {
     if (player.getMeso() >= 5000000) {
       int str = c.getPlayer().getStr();
       int dex = c.getPlayer().getDex();
       int int_ = c.getPlayer().getInt();
       int luk = c.getPlayer().getLuk();
       int newap = c.getPlayer().getRemainingAp() + (str - 4) + (dex - 4) + (int_ - 4) + (luk - 4);
       c.getPlayer().setStr(4);
       c.getPlayer().setDex(4);
       c.getPlayer().setInt(4);
       c.getPlayer().setLuk(4);
       c.getPlayer().setRemainingAp(newap);
       List<Pair<MapleStat, Integer>> stats = new ArrayList<Pair<MapleStat, Integer>>();
       stats.add(new Pair<MapleStat, Integer>(MapleStat.STR, Integer.valueOf(str)));
       stats.add(new Pair<MapleStat, Integer>(MapleStat.DEX, Integer.valueOf(dex)));
       stats.add(new Pair<MapleStat, Integer>(MapleStat.INT, Integer.valueOf(int_)));
       stats.add(new Pair<MapleStat, Integer>(MapleStat.LUK, Integer.valueOf(luk)));
       stats.add(new Pair<MapleStat, Integer>(MapleStat.AVAILABLEAP, Integer.valueOf(newap)));
       c.getSession().write(MaplePacketCreator.updatePlayerStats(stats));
       mc.dropMessage("Your ap has been reseted. Please CC or Relogin to apply the changes");
     } else {
       mc.dropMessage("Not enough mesos. You need 5mill to apreset");
     }
   } else if (splitted[0].equals("@goto")) {
     ChannelServer cserv = c.getChannelServer();
     HashMap<String, Integer> maps = new HashMap<String, Integer>();
     maps.put("henesys", 100000000);
     maps.put("ellinia", 101000000);
     maps.put("perion", 102000000);
     maps.put("kerning", 103000000);
     maps.put("lith", 104000000);
     maps.put("sleepywood", 105040300);
     maps.put("florina", 110000000);
     maps.put("orbis", 200000000);
     maps.put("happy", 209000000);
     maps.put("elnath", 211000000);
     maps.put("ludi", 220000000);
     maps.put("omega", 221000000);
     maps.put("korean", 222000000);
     maps.put("aqua", 230000000);
     maps.put("leafre", 240000000);
     maps.put("mulung", 250000000);
     maps.put("herb", 251000000);
     maps.put("nlc", 600000000);
     maps.put("shrine", 800000000);
     maps.put("showa", 801000000);
     maps.put("fm", 910000000);
     if (maps.containsKey(splitted[1])) {
       player.changeMap(
           cserv.getMapFactory().getMap(maps.get(splitted[1])),
           cserv.getMapFactory().getMap(maps.get(splitted[1])).getPortal(0));
     } else {
       mc.dropMessage(
           "No map enetered do @goto  <henesys|ellinia|perion|kerning|lith|sleepywood|florina|orbis|happy|elnath|ludi|omega|korean|aqua|leafre|mulung|herb|nlc|shrine|showa|fm>");
     }
   }
 }