Example #1
0
  private void handleClick1(Player player, Packet packet) {
    int interfaceID = packet.getIn().readShort(StreamBuffer.ValueType.A);
    player.setSlot(packet.getIn().readShort(StreamBuffer.ValueType.A));
    int itemId = packet.getIn().readShort(StreamBuffer.ValueType.A);
    RSInterface inter = RSInterface.forId(interfaceID);
    switch (interfaceID) {
      case 4233: // make 1 ring crafting
        GemCrafting.startCrafter(player, GemData.getGemSlot()[player.getSlot()], 1, 0);
        break;
      case 4239: // make 1 neckalce crafting
        GemCrafting.startCrafter(player, GemData.getGemSlot()[player.getSlot()], 1, 1);
        break;
      case 4245: // make 1 amulet crafting
        GemCrafting.startCrafter(player, GemData.getGemSlot()[player.getSlot()], 1, 2);
        break;
      case 18821: // make 1 bracelet crafting
        GemCrafting.startCrafter(player, GemData.getGemSlot()[player.getSlot()], 1, 3);
        break;
    }
    if (!player.hasInterfaceOpen(inter)) {
      // player.getActionSender().removeInterfaces();

      return;
    }
    if (interfaceID == 1119
        || interfaceID == 1120
        || interfaceID == 1121
        || interfaceID == 1122
        || interfaceID == 1123) {
      // player.getSmithing().smithItem(itemId, 1);
      SmithBars.startSmithing(player, itemId, 1);
    }
    if (interfaceID == 1688) {
      player.getEquipment().unequip(player.getSlot());
    } else if (interfaceID == 5064 || interfaceID == 7423) {
      BankManager.bankItem(player, player.getSlot(), itemId, 1);
    } else if (interfaceID == 5382) {
      BankManager.withdrawItem(player, player.getSlot(), itemId, 1);
    } else if (interfaceID == 3900) {
      ShopManager.getBuyValue(player, itemId);
    } else if (interfaceID == 3823) {
      ShopManager.getSellValue(player, itemId);
    } else if (interfaceID == 3322) {
      if (player.getStatedInterface() == "duel")
        player.getDuelMainData().stakeItem(new Item(itemId, 1), player.getSlot());
      else TradeManager.offerItem(player, player.getSlot(), itemId, 1);
    } else if (interfaceID == 3415) {
      TradeManager.removeTradeItem(player, player.getSlot(), itemId, 1);
    } else if (interfaceID == 15682 || interfaceID == 15683) {
      player.getFarmingTools().withdrawItems(itemId, 1);
    } else if (interfaceID == 15594 || interfaceID == 15595) {
      player.getFarmingTools().storeItems(itemId, 1);
    } else if (interfaceID == 6669) {
      player.getDuelMainData().removeStakedItem(new Item(itemId, 1));
    }
  }
Example #2
0
 private void handleClickAll(Player player, Packet packet) {
   player.setSlot(packet.getIn().readShort(StreamBuffer.ValueType.A));
   int interfaceID = packet.getIn().readShort();
   int itemId = packet.getIn().readShort(StreamBuffer.ValueType.A);
   RSInterface inter = RSInterface.forId(interfaceID);
   if (!player.hasInterfaceOpen(inter)) {
     // player.getActionSender().removeInterfaces();
     return;
   }
   if (interfaceID == 5064 || interfaceID == 7423) {
     BankManager.bankItem(
         player,
         player.getSlot(),
         itemId,
         player.getInventory().getItemContainer().getCount(itemId));
   } else if (interfaceID == 5382) {
     BankManager.withdrawItem(player, player.getSlot(), itemId, player.getBank().getCount(itemId));
   } else if (interfaceID == 3900) {
     ShopManager.buyItem(player, player.getSlot(), itemId, 10);
   } else if (interfaceID == 3823) {
     ShopManager.sellItem(player, player.getSlot(), itemId, 10);
   } else if (interfaceID == 3322) {
     if (player.getStatedInterface() == "duel")
       player
           .getDuelMainData()
           .stakeItem(
               new Item(itemId, player.getInventory().getItemContainer().getCount(itemId)),
               player.getSlot());
     else
       TradeManager.offerItem(
           player,
           player.getSlot(),
           itemId,
           player.getInventory().getItemContainer().getCount(itemId));
   } else if (interfaceID == 15594 || interfaceID == 15595) {
     player.getActionSender().openXInterface(interfaceID);
     player.setClickItem(itemId);
   } else if (interfaceID == 15682 || interfaceID == 15683) {
     player.getActionSender().openXInterface(interfaceID);
     player.setClickItem(itemId);
   } else if (interfaceID == 3415) {
     TradeManager.removeTradeItem(player, player.getSlot(), itemId, Integer.MAX_VALUE);
   } else if (interfaceID == 6669) {
     player.getDuelMainData().removeStakedItem(new Item(itemId, Integer.MAX_VALUE));
   }
 }
 public static void loadAllFiles() throws FileNotFoundException, IOException {
   ItemManager.getInstance().loadItemDefinitions();
   ItemManager.getInstance().loadEquipmentDefinitions();
   NpcLoader.loadDefinitions();
   NpcLoader.loadSpawns();
   ShopManager.loadShops();
   GlobalObjectHandler.loadObjects();
   SpellLoader.loadSpellDefinitions();
   BowLoader.loadBowDefinitions();
   FoodLoader.loadFoodDefinitions();
   PotionLoader.loadPotionDefinitions();
   Bonuses.loadBonusDefinitions();
 }