private void useItemOnItem(Player player, Packet packet) { int itemSecondClickSlot = packet.getIn().readShort(); int itemFirstClickSlot = packet.getIn().readShort(StreamBuffer.ValueType.A); packet.getIn().readShort(); packet.getIn().readShort(); if (itemFirstClickSlot > 28 || itemSecondClickSlot > 28) { return; } Item firstClickItem = player.getInventory().getItemContainer().get(itemFirstClickSlot); Item secondClickItem = player.getInventory().getItemContainer().get(itemSecondClickSlot); if (firstClickItem == null || secondClickItem == null || !firstClickItem.validItem() || !secondClickItem.validItem()) return; int firstItem = firstClickItem.getId(); int secondItem = secondClickItem.getId(); if (player.getDuelMainData().getOpponent() != null) { player.getDuelInteraction().endDuelInteraction(true); return; } if (OneIngredients.mixItems( player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return; if (TwoIngredients.mixItems( player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return; if (ThreeIngredients.mixItems( player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return; if (DoughHandler.handleInterface( player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return; /* Fletching */ if (ArrowMaking.perform(player, firstItem, secondItem)) return; if (BowStringing.perform(player, firstItem, secondItem)) return; if (LogCuttingInterfaces.handleItemOnItem(player, firstItem, secondItem)) return; if (CbowFletching.attachLimbs(player, firstItem, secondItem) || CbowFletching.stringCbow(player, firstItem, secondItem)) return; if (GemTips.handleCutting( player, firstItem, secondItem, firstItem != GemTips.CHISEL ? itemFirstClickSlot : itemSecondClickSlot)) return; /* Crafting */ if (GemCutting.handleCutting( player, firstItem, secondItem, firstItem != GemCutting.CHISEL ? itemFirstClickSlot : itemSecondClickSlot)) return; if (LeatherMakingHandler.handleItemOnItem( player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return; if (BasicCraft.handleItemOnItem(player, firstItem, secondItem)) return; if ((firstItem == GlassMaking.GLASSBLOWING_PIPE && secondItem == GlassMaking.MOLTEN_GLASS) || (secondItem == GlassMaking.GLASSBLOWING_PIPE && firstItem == GlassMaking.MOLTEN_GLASS)) { Menus.sendSkillMenu(player, "glassMaking"); return; } /* STRINGING AMULETS */ for (int i = 0; i < GemData.stringItems.length; i++) { if (GemData.stringItems[i][0] == firstItem || GemData.stringItems[i][0] == secondItem) { GemCrafting.string(player, i); return; } } if (ElementalWorkshop.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (ShieldOfArrav.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (DragonSlayer.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (GoblinDiplomacy.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (PiratesTreasure.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (ErnestTheChicken.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (GhostsAhoy.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (AnimalMagnetism.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (TabHandler.itemOnItemHandling(player, firstItem, secondItem)) { return; } if (wetClayHandler.itemOnItemHandling(player, firstItem, secondItem)) { return; } /* Farming */ if (player .getSeedling() .placeSeedInPot( firstClickItem.getId(), secondClickItem.getId(), itemFirstClickSlot, itemSecondClickSlot)) { return; } if (player .getSeedling() .waterSeedling( firstClickItem.getId(), secondClickItem.getId(), itemFirstClickSlot, itemSecondClickSlot)) { return; } if (player .getItemOnItem() .handleItemOnItem( firstClickItem, secondClickItem, itemFirstClickSlot, itemSecondClickSlot)) { return; } if (Tools.attachTool(player, firstItem, secondItem)) { player.getActionSender().sendMessage("You put together the head and handle."); return; } /*Slayer*/ if (player.getSlayer().handleItemOnItem(firstItem, secondItem)) { return; } /* Herblore */ if (PotionMaking.createPotion( player, firstClickItem, secondClickItem, itemFirstClickSlot, itemSecondClickSlot)) { return; } if (Grinding.createProduct( player, firstClickItem, secondClickItem, itemFirstClickSlot, itemSecondClickSlot)) { return; } if (PoisoningWeapon.handlePoison(player, firstClickItem, secondClickItem)) { return; } if (Coconut.handleCoconut(player, firstClickItem, secondClickItem)) { return; } if (PotionMaking.combineDose( player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) { return; } /* Firemaking */ if (firstItem == 590 || secondItem == 590) { if (firstItem == 596 && secondItem == 596) { if (player.getInventory().removeItem(new Item(596))) { player.getInventory().addItem(new Item(594)); player.getActionSender().sendMessage("You light the torch."); return; } } if (firstItem == 36 && secondItem == 36) { if (player.getInventory().removeItem(new Item(36))) { player.getInventory().addItem(new Item(33)); player.getActionSender().sendMessage("You light the candle."); return; } } player .getFiremaking() .attemptFire( firstItem, secondItem, false, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ()); return; } if (GodBook.addPageToBook( player, firstClickItem, secondClickItem, itemFirstClickSlot, itemSecondClickSlot)) { return; } if (firstClickItem.getId() == 1765 && secondClickItem.getId() == 2421) { player.getActionSender().sendMessage("You carefully dye the wig blonde."); player.getInventory().removeItem(new Item(2421)); player.getInventory().removeItem(new Item(1765)); player.getInventory().addItem(new Item(2419)); return; } if (firstClickItem.getId() == 1973 && secondClickItem.getId() == 233) { player .getActionSender() .sendMessage("You use your pestle and mortar to turn the chocolate to dust."); player.getInventory().removeItem(new Item(1973)); player.getInventory().addItem(new Item(1975)); return; } if (firstClickItem.getId() == 946 && secondClickItem.getId() == 1973) { player.getActionSender().sendMessage("You use your knife to turn the chocolate to dust."); player.getInventory().removeItem(new Item(1973)); player.getInventory().addItem(new Item(1975)); return; } player.getActionSender().sendMessage("Nothing interesting happens."); }
private void handleThirdClickItem(Player player, Packet packet) { int interfaceID = packet.getIn().readShort(StreamBuffer.ValueType.A, StreamBuffer.ByteOrder.LITTLE); player.setSlot(packet.getIn().readShort(StreamBuffer.ByteOrder.LITTLE)); player.setClickItem(packet.getIn().readShort(true, StreamBuffer.ValueType.A)); RSInterface inter = RSInterface.forId(interfaceID); if (!player.hasInterfaceOpen(inter)) { // player.getActionSender().removeInterfaces(); return; } Item item = player.getInventory().getItemContainer().get(player.getSlot()); if (item == null || item.getId() != player.getClickItem()) return; if (PotionMaking.emptyPotion(player, new Item(player.getClickItem()), player.getSlot())) return; if (Runecrafting.clickTalisman(player, player.getClickItem())) { return; } for (int[] element : Pouches.POUCHES) { if (item.getId() == element[0]) { Pouches.emptyEssencePouch(player, item.getId()); return; } } switch (item.getId()) { case 2552: // ring of duelling case 2554: case 2556: case 2558: case 2560: case 2562: case 2564: case 2566: Dialogues.startDialogue(player, 10004); break; case 431: // karamjan rum player.getActionSender().statEdit(Skill.ATTACK, -3, false); player.getActionSender().statEdit(Skill.STRENGTH, 2, true); player .getActionSender() .sendMessage("You drink your Karamjan Rum and drop the bottle, whoops!."); player.getInventory().removeItem(new Item(431)); player.setDrunkState(true, 300); break; case 1712: // glory case 1710: case 1708: case 1706: Dialogues.startDialogue(player, 10003); break; case 11105: // glory case 11107: case 11109: case 11111: Dialogues.startDialogue(player, 10015); break; case 3853: case 3855: case 3857: case 3859: case 3861: case 3863: case 3865: case 3867: Dialogues.startDialogue(player, 10002); break; case 11118: // glory case 11120: case 11122: case 11124: Dialogues.startDialogue(player, 10014); break; } }