public static void summon(Player player) { player.getActionSender().walkTo(-1, 0, true); Npc npc = new Npc(238); npc.setPosition(new Position(2780, 3515, 0)); npc.setSpawnPosition(new Position(2780, 3515, 0)); World.register(npc); npc.setPlayerOwner(player.getIndex()); Dialogues.startDialogue(player, 238); }
private void handleFirstClickItem(final Player player, Packet packet) { int interfaceID = packet.getIn().readShort(StreamBuffer.ValueType.A, StreamBuffer.ByteOrder.LITTLE); player.setSlot(packet.getIn().readShort(StreamBuffer.ValueType.A)); int itemId = packet.getIn().readShort(StreamBuffer.ByteOrder.LITTLE); 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() != itemId) return; /* * if (player.getRunecrafting().fillEssencePouch(item)) { return; } if * (player.getHerblore().cleanHerb(item)) { return; } */ if (itemId == 2329) { player.getInventory().replaceItemWithItem(new Item(2329), new Item(2313)); player.getActionSender().sendMessage("You empty your burnt pie onto the ground."); return; } if (Nests.handleNest(player, itemId)) { return; } if (GhostsAhoy.itemHandling(player, itemId)) { return; } if (itemId == Slayer.ENCHANTED_GEM) { Dialogues.startDialogue(player, 10012); return; } if (Cleaning.handleCleaning(player, itemId, player.getSlot())) return; if (player.getBoneBurying().buryBone(itemId, player.getSlot())) { return; } if (itemId >= 5509 && itemId <= 5514) { Pouches.fillEssencePouch(player, itemId); return; } if (player.getPotion().isPotion(itemId)) { player.getPotion().drinkPotion(itemId, player.getSlot()); return; } if (player.getFood().eatFood(itemId, player.getSlot())) { return; } ClueScroll.handleCasket(player, itemId); if (new Item(itemId).getDefinition().getName().toLowerCase().contains("clue scroll") || new Item(itemId).getDefinition().getName().toLowerCase().contains("challenge scroll")) { ClueScroll.cleanClueInterface(player); } if (Puzzle.loadClueInterface(player, itemId)) { player.getActionSender().sendMessage("clue id: " + itemId); return; } if (CoordinateScrolls.loadClueInterface(player, itemId)) { player.getActionSender().sendMessage("clue id: " + itemId); return; } if (DiggingScrolls.loadClueInterface(player, itemId)) { player.getActionSender().sendMessage("clue id: " + itemId); return; } if (ChallengeScrolls.loadClueInterface(player, itemId)) { player.getActionSender().sendMessage("clue id: " + itemId); return; } if (SpeakToScrolls.loadClueInterface(player, itemId)) { player.getActionSender().sendMessage("clue id: " + itemId); return; } if (AnagramsScrolls.loadClueInterface(player, itemId)) { player.getActionSender().sendMessage("clue id: " + itemId); return; } if (MapScrolls.loadClueInterface(player, itemId)) { player.getActionSender().sendMessage("clue id: " + itemId); return; } if (SearchScrolls.loadClueInterface(player, itemId)) { player.getActionSender().sendMessage("clue id: " + itemId); return; } if (TeleTabs.breakTab(player, itemId, player.getSlot())) { return; } if (TabHandler.breakEnchantTab(player, itemId, player.getSlot())) { return; } if (TabHandler.breakBonesTab(player, itemId, player.getSlot())) { return; } if (ElementalWorkshop.itemHandling(player, itemId)) { return; } if (ShieldOfArrav.itemHandling(player, itemId)) { return; } if (DragonSlayer.itemHandling(player, itemId)) { return; } if (BlackKnightsFortress.itemHandling(player, itemId)) { return; } if (PiratesTreasure.itemHandling(player, itemId)) { return; } if (AnimalMagnetism.itemHandling(player, itemId)) { return; } switch (itemId) { case 2528: // genie lamp player.setGenieSelect(-1); player.getActionSender().sendConfig(261, 0); player.getActionSender().sendInterface(2808); return; case 550: // newcomers map player.getActionSender().sendInterface(5392); return; case 33: // candle if (player.getInventory().removeItemSlot(item, player.getSlot())) { player.getActionSender().sendMessage("You extinguish the candle."); player.getInventory().addItemToSlot(new Item(36), player.getSlot()); } return; case 594: // torch if (player.getInventory().removeItemSlot(item, player.getSlot())) { player.getActionSender().sendMessage("You extinguish the torch."); player.getInventory().addItemToSlot(new Item(596), player.getSlot()); } return; case 4531: // candle lantern if (player.getInventory().removeItemSlot(item, player.getSlot())) { player.getActionSender().sendMessage("You extinguish the candle lantern."); player.getInventory().addItemToSlot(new Item(4529), player.getSlot()); } return; case 4534: // black candle lantern if (player.getInventory().removeItemSlot(item, player.getSlot())) { player.getActionSender().sendMessage("You extinguish the black candle lantern."); player.getInventory().addItemToSlot(new Item(4532), player.getSlot()); } return; case 4539: // oil lamp if (player.getInventory().removeItemSlot(item, player.getSlot())) { player.getActionSender().sendMessage("You extinguish the oil lamp."); player.getInventory().addItemToSlot(new Item(4537), player.getSlot()); } return; case 4550: // bullseye lantern if (player.getInventory().removeItemSlot(item, player.getSlot())) { player.getActionSender().sendMessage("You extinguish the bullseye lantern."); player.getInventory().addItemToSlot(new Item(4548), player.getSlot()); } return; case 405: // casket if (player.getInventory().removeItemSlot(item, player.getSlot())) { Casket.openCasket(player); } return; case 2150: // swamp toad if (player.getInventory().removeItemSlot(item, player.getSlot())) { player .getActionSender() .sendMessage( "You pull the legs off the toad. Poor toad. At least they'll grow back."); player.getInventory().addItemToSlot(new Item(2152), player.getSlot()); } return; case 407: // oyster if (player.getInventory().removeItemSlot(item, player.getSlot())) { player.getActionSender().sendMessage("You open the oyster."); player.getInventory().addItemToSlot(new Item(411), player.getSlot()); } return; case 4033: // ShopManager.openShop(player, 39); player.getActionSender().sendMessage("You poke the monkey."); return; case 10592: player.getPets().registerPet(10592, 5428); return; case 952: // spade player.getUpdateFlags().sendAnimation(830); player.getActionSender().sendMessage("You dig into the ground..."); final int task = player.getTask(); player.setSkilling( new CycleEvent() { @Override public void execute(CycleEventContainer container) { if (!player.checkTask(task)) { container.stop(); return; } if (player.getPosition().getX() == 2566 && (player.getPosition().getY() == 3331 || player.getPosition().getY() == 3333)) { player.fadeTeleport(new Position(2530, 3303)); player.getActionSender().sendMessage("and find yourself in plague city."); container.stop(); return; } if (player.getPosition().getX() == 2999 && player.getPosition().getY() == 3383 && (player.getQuestStage(20) == 6 || player.getQuestStage(20) == 7)) { player.setQuestStage(20, 8); QuestHandler.completeQuest(player, 20); player.getInventory().addItem(new Item(PiratesTreasure.CHEST)); container.stop(); return; } if (player.getPosition().equals(GhostsAhoy.TREASURE_LOCATION) && !player.getInventory().playerHasItem(GhostsAhoy.BOOK_OF_HARICANTO)) { player .getDialogue() .sendGiveItemNpc( "You unearth the Book of Haricanto.", new Item(GhostsAhoy.BOOK_OF_HARICANTO)); player.getInventory().addItem(new Item(GhostsAhoy.BOOK_OF_HARICANTO)); container.stop(); return; } if (!MapScrolls.digClue(player) && !DiggingScrolls.digClue(player) && !CoordinateScrolls.digClue(player) && !Barrows.digCrypt(player)) { player.getActionSender().sendMessage("but do not find anything."); container.stop(); } } @Override public void stop() { player.resetAnimation(); } }); CycleEventHandler.getInstance().addEvent(player, player.getSkilling(), 2); return; case 2574: // sextant Sextant.initializeRandomSextantInterface(player); return; case 299: // MithrilSeeds.plantMithrilSeed(player); return; } player.getActionSender().sendMessage("Nothing interesting happens."); /* * if (item == 4155) { String slayerNpc = (String) * player.getSlayerTask()[0]; if (!slayerNpc.equalsIgnoreCase("")) { * player.getDialogue().sendStatement("Your existing task is to kill " + * player.getSlayerTask()[1] + " " + slayerNpc + "s."); * player.getDialogue().setNextDialogue(0); } else { * player.getDialogue().sendStatement("You don't have a slaver task."); * } return; } */ }
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; } }
public static boolean doItemOnObject(Player player, int object, int item) { switch (object) { case 3402: // elemental workshop workbench if (item == 2893 && player.getQuestStage(12) >= 10 && player.getSkill().getLevel()[Skill.SMITHING] >= 20) { if (player.getInventory().playerHasItem(2347)) { player.getInventory().removeItem(new Item(2893)); player.getInventory().addItem(new Item(2890)); if (player.getQuestStage(12) == 10) { player.setQuestStage(12, 11); QuestHandler.completeQuest(player, 12); return true; } return true; } else { player.getDialogue().sendStatement("You need a hammer to smith!"); return true; } } else if (player.getSkill().getLevel()[Skill.SMITHING] < 20) { player.getDialogue().sendStatement("You need 20 smithing to smith and elemental shield."); return true; } break; case 3413: // elemental workshop furnace if (item == 2889 && player.getQuestStage(12) == 8) { player .getDialogue() .sendStatement("The furnace flares dramatically as you pour the lava in."); player.getInventory().replaceItemWithItem(new Item(2889), new Item(2888)); player.setQuestStage(12, 9); return true; } else if (item == 2892 && player.getQuestStage(12) >= 9) { if (player.getInventory().playerHasItem(453, 4)) { player.getInventory().removeItem(new Item(2892)); player.getInventory().removeItem(new Item(453, 4)); player.getInventory().addItem(new Item(2893)); player.getActionSender().sendMessage("You smelt the elemental ore in the furnace."); player.getActionSender().sendMessage("You retrieve elemental metal from the furnace."); player.getUpdateFlags().sendAnimation(899); player.getActionSender().sendSound(469, 0, 0); if (player.getQuestStage(12) == 9) { player.setQuestStage(12, 10); } return true; } else { player.getDialogue().sendStatement("You need 4 coal to smelt Elemental Ore."); return true; } } else if (player.getQuestStage(12) >= 7) { if (item == GlassMaking.BUCKET_OF_SAND) GlassMaking.makeMoltenGlass(player); else if (item == GemCrafting.GOLD_BAR) GemCrafting.openInterface(player); else if (item == SilverCrafting.SILVER_BAR) Menus.sendSkillMenu(player, "silverCrafting"); else if (ItemManager.getInstance().getItemName(item).toLowerCase().endsWith("ore") && item != 668) Smelting.smeltInterface(player); else if (item == 668) Dialogues.startDialogue(player, 10200); return true; } break; case 3414: // elemental workshop lava trough if (item == 2888 && player.getQuestStage(12) == 8) { player.getDialogue().sendStatement("You carefully fill the bowl with lava."); player.getInventory().replaceItemWithItem(new Item(2888), new Item(2889)); return true; } break; } return false; }
public void dialogue(Player player, Npc npc) { Dialogues.startDialogue(player, 251); }
public static void smithInterface(Player player, int itemId) { if (!Constants.SMITHING_ENABLED) { player.getActionSender().sendMessage("This skill is currently disabled."); return; } if (!player.getInventory().playerHasItem(2347)) { player.getDialogue().sendStatement("You need a hammer to start smithing."); return; } if (itemId == 9467) { Dialogues.startDialogue(player, 10201); return; } if (itemId == 2349) { player.setSmithInterface(0); } else if (itemId == 2351) { player.setSmithInterface(1); } else if (itemId == 2353) { player.setSmithInterface(2); } else if (itemId == 2359) { player.setSmithInterface(3); } else if (itemId == 2361) { player.setSmithInterface(4); } else if (itemId == 2363) { player.setSmithInterface(5); } else { return; } if (!SkillHandler.hasRequiredLevel( player, Skill.SMITHING, smithLevel(0, player.getSmithInterface()), "smith this bar")) { player.getTask(); player.resetAnimation(); return; } player.setOldItem(itemId); String fiveb = checkBars(itemId, 5, player); String threeb = checkBars(itemId, 3, player); String twob = checkBars(itemId, 2, player); String oneb = checkBars(itemId, 1, player); player.getActionSender().sendString(fiveb + "5bars" + fiveb, 1112); player.getActionSender().sendString(threeb + "3bars" + threeb, 1109); player.getActionSender().sendString(threeb + "3bars" + threeb, 1110); player.getActionSender().sendString(threeb + "3bars" + threeb, 1118); player.getActionSender().sendString(threeb + "3bars" + threeb, 1111); player.getActionSender().sendString(threeb + "3bars" + threeb, 1095); player.getActionSender().sendString(threeb + "3bars" + threeb, 1115); player.getActionSender().sendString(threeb + "3bars" + threeb, 1090); player.getActionSender().sendString(twob + "2bars" + twob, 1113); player.getActionSender().sendString(twob + "2bars" + twob, 1116); player.getActionSender().sendString(twob + "2bars" + twob, 1114); player.getActionSender().sendString(twob + "2bars" + twob, 1089); player.getActionSender().sendString(twob + "2bars" + twob, 8428); player.getActionSender().sendString(oneb + "1bar" + oneb, 1124); player.getActionSender().sendString(oneb + "1bar" + oneb, 1125); player.getActionSender().sendString(oneb + "1bar" + oneb, 1126); player.getActionSender().sendString(oneb + "1bar" + oneb, 1127); player.getActionSender().sendString(oneb + "1bar" + oneb, 1128); player.getActionSender().sendString(oneb + "1bar" + oneb, 1129); player.getActionSender().sendString(oneb + "1bar" + oneb, 1130); player.getActionSender().sendString(oneb + "1bar" + oneb, 1131); player.getActionSender().sendString(oneb + "1bar" + oneb, 13357); player.getActionSender().sendString(checkLevel(player, "platebody", "Plate body"), 1101); player.getActionSender().sendString(checkLevel(player, "platelegs", "Plate legs"), 1099); player.getActionSender().sendString(checkLevel(player, "plateskirt", "Plate skirt"), 1100); player.getActionSender().sendString(checkLevel(player, "2h sword", "2 hand sword"), 1088); player.getActionSender().sendString(checkLevel(player, "claws", "Claws"), 8429); player.getActionSender().sendString(checkLevel(player, "kiteshield", "Kite shield"), 1105); player.getActionSender().sendString(checkLevel(player, "chainbody", "Chain body"), 1098); player.getActionSender().sendString(checkLevel(player, "battleaxe", "Battle axe"), 1092); player.getActionSender().sendString(checkLevel(player, "warhammer", "Warhammer"), 1083); player.getActionSender().sendString(checkLevel(player, "sq shield", "Square shield"), 1104); player.getActionSender().sendString(checkLevel(player, "knife", "Throwing knives"), 1106); player.getActionSender().sendString(checkLevel(player, "full helm", "Full helm"), 1103); player.getActionSender().sendString(checkLevel(player, "longsword", "Long sword"), 1086); player.getActionSender().sendString(checkLevel(player, "scimitar", "Scimitar"), 1087); player.getActionSender().sendString(checkLevel(player, "arrowtips", "Arrowtips"), 1108); player.getActionSender().sendString(checkLevel(player, "dart tip", "Dart tips"), 1107); player.getActionSender().sendString(checkLevel(player, "nails", "Nails"), 13358); player.getActionSender().sendString(checkLevel(player, "sword", "Sword"), 1085); player.getActionSender().sendString(checkLevel(player, "med helm", "Medium helm"), 1102); player.getActionSender().sendString(checkLevel(player, "mace", "Mace"), 1093); player.getActionSender().sendString(checkLevel(player, "axe", "Axe"), 1091); player.getActionSender().sendString(checkLevel(player, "dagger", "Dagger"), 1094); player.getActionSender().sendUpdateItem(getItemType(player, "dagger"), 0, 1119, 1); player.getActionSender().sendUpdateItem(getItemType(player, "axe"), 0, 1120, 1); player.getActionSender().sendUpdateItem(getItemType(player, "chainbody"), 0, 1121, 1); player.getActionSender().sendUpdateItem(getItemType(player, "med helm"), 0, 1122, 1); player.getActionSender().sendUpdateItem(getItemType(player, "dart tip"), 0, 1123, 10); player.getActionSender().sendUpdateItem(getItemType(player, "sword"), 1, 1119, 1); player.getActionSender().sendUpdateItem(getItemType(player, "mace"), 1, 1120, 1); player.getActionSender().sendUpdateItem(getItemType(player, "platelegs"), 1, 1121, 1); player.getActionSender().sendUpdateItem(getItemType(player, "full helm"), 1, 1122, 1); player.getActionSender().sendUpdateItem(getItemType(player, "arrowtips"), 1, 1123, 15); player.getActionSender().sendUpdateItem(getItemType(player, "scimitar"), 2, 1119, 1); player.getActionSender().sendUpdateItem(getItemType(player, "warhammer"), 2, 1120, 1); player.getActionSender().sendUpdateItem(getItemType(player, "plateskirt"), 2, 1121, 1); player.getActionSender().sendUpdateItem(getItemType(player, "sq shield"), 2, 1122, 1); player.getActionSender().sendUpdateItem(getItemType(player, "knife"), 2, 1123, 5); player.getActionSender().sendUpdateItem(getItemType(player, "longsword"), 3, 1119, 1); player.getActionSender().sendUpdateItem(getItemType(player, "battleaxe"), 3, 1120, 1); player.getActionSender().sendUpdateItem(getItemType(player, "platebody"), 3, 1121, 1); player.getActionSender().sendUpdateItem(getItemType(player, "kiteshield"), 3, 1122, 1); player.getActionSender().sendUpdateItem(getItemType(player, "2h sword"), 4, 1119, 1); player.getActionSender().sendUpdateItem(getItemType(player, "claws"), 4, 1120, 1); player.getActionSender().sendUpdateItem(getItemType(player, "nails"), 4, 1122, 15); if (smithMetal[player.getSmithInterface()].equalsIgnoreCase("steel")) { player.getActionSender().sendString(oneb + "1bar" + oneb, 11459); player.getActionSender().sendString(checkLevel(player, "Steel studs", "Steel studs"), 11461); player.getActionSender().sendUpdateItem(getItemType(player, "Steel studs"), 4, 1121, 1); } else { player.getActionSender().sendString("", 11461); player.getActionSender().sendString("", 11459); player.getActionSender().sendUpdateItem(new Item(-1, 0), 4, 1121, 1); } player.getActionSender().sendString(oneb + "1bar" + oneb, 1132); player.getActionSender().sendString(checkLevel(player, "bolts (unf)", "Bolts (unf)"), 1096); player.getActionSender().sendUpdateItem(getItemType(player, "bolts (unf)"), 3, 1123, 10); player.getActionSender().sendString(oneb + "1bar" + oneb, 1135); player.getActionSender().sendString(checkLevel(player, "limbs", "Limbs"), 1134); player.getActionSender().sendUpdateItem(getItemType(player, "limbs"), 4, 1123, 1); player.getActionSender().sendInterface(994); }