public void execute(Player player, string[] arguments) { if (arguments.Length == 0) { player.getPackets().sendMessage("[Pickup command]: ::item itemId amount or just ::item itemId"); return; } int itemId = 0; if (!int.TryParse(arguments[0], out itemId)) itemId = 0; int amount = 0; if(arguments.Length >= 2 && !int.TryParse(arguments[1], out amount)) amount = 0; if (!player.inCombat()) { if (amount > 1 && !ItemData.forId(itemId).isNoted() && !ItemData.forId(itemId).isStackable()) { for (int i = 0; i < amount; i++) { if (!player.getInventory().addItem(itemId)) { break; } } } else if(amount == 0) { player.getInventory().addItem(itemId); } else { player.getInventory().addItem(itemId, amount); } } }
public static int[] getProtectedItem1(Player p) { int[] protectedItem = new int[2]; protectedItem[0] = -1; foreach (Item item in p.getInventory().getItems()) { if(item.getItemId() == -1) continue; int price = item.getDefinition().getPrice().getMaximumPrice(); if ((price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice())) { protectedItem[0] = item.getItemId(); protectedItem[1] = INVENTORY; } } foreach(Item item in p.getEquipment().getEquipment()) { if (item.getItemId() == -1) continue; int price = item.getDefinition().getPrice().getMaximumPrice(); if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice()) { protectedItem[0] = item.getItemId(); protectedItem[1] = EQUIPMENT; } } return protectedItem; }
public static void tagPillar(Player p, int pillarIndex) { AreaEvent tagPillarAreaEvent = new AreaEvent(p, AGILITY_ARENA_PILLARS[pillarIndex][1]-1, AGILITY_ARENA_PILLARS[pillarIndex][2]-1, AGILITY_ARENA_PILLARS[pillarIndex][1]+1, AGILITY_ARENA_PILLARS[pillarIndex][2]+1); tagPillarAreaEvent.setAction(() => { if (p.getLocation().getZ() == 3) { p.setFaceLocation(new Location(AGILITY_ARENA_PILLARS[pillarIndex][1], AGILITY_ARENA_PILLARS[pillarIndex][2], 3)); if (pillarIndex != currentPillar) { p.getPackets().sendMessage("You can only get a ticket when the flashing arrow is above the pillar!"); return; } if (p.isTaggedLastAgilityPillar()) { p.getPackets().sendMessage("You have already tagged this pillar, wait until the arrow moves again."); return; } int currentStatus = p.getAgilityArenaStatus(); if (currentStatus == 0) { p.getPackets().sendConfig(309, 4); p.getPackets().sendMessage("You get tickets by tagging more than one pillar in a row. Tag the next pillar!"); } else { p.getInventory().addItem(2996); p.getPackets().sendMessage("You recieve an Agility Arena ticket!"); } p.setAgilityArenaStatus(currentStatus == 0 ? 1 : 1); p.setTaggedLastAgilityPillar(true); } }); Server.registerCoordinateEvent(tagPillarAreaEvent); }
protected static void createdAnimatedArmour(Player p, int index) { if (p.getTemporaryAttribute("warriorGuildAnimator") == null) { return; } p.setLastAnimation(new Animation(827)); p.setTemporaryAttribute("unmovable", true); for (int i = 0; i < ARMOUR_SETS[index].Length; i++) { p.getInventory().deleteItem(ARMOUR_SETS[index][i]); } p.getPackets().sendChatboxInterface(211); p.getPackets().modifyText("You place the armour onto the platform where it", 211, 1); p.getPackets().modifyText("dissapears...", 211, 2); int animatorIndex = (int) p.getTemporaryAttribute("warriorGuildAnimator"); Event createAnimatedArmourEvent = new Event(1500); int createAnimatedArmourCounter = 0; Npc npc = null; createAnimatedArmourEvent.setAction(() => { if (createAnimatedArmourCounter == 0) { p.getPackets().sendChatboxInterface(211); p.getPackets().modifyText("The animator hums, something appears to be working.", 211, 1); p.getPackets().modifyText("You stand back.", 211, 2); createAnimatedArmourEvent.setTick(500); } else if (createAnimatedArmourCounter == 1) { p.getWalkingQueue().forceWalk(0, + 3); createAnimatedArmourEvent.setTick(2000); } else if (createAnimatedArmourCounter == 2) { createAnimatedArmourEvent.setTick(500); Location minCoords = new Location(2849, 3534, 0); Location maxCoords = new Location(2861, 3545, 0); npc = new Npc(ANIMATED_ARMOUR[index]); npc.setMinimumCoords(minCoords); npc.setMaximumCoords(maxCoords); npc.setLocation(new Location(ANIMATOR_LOCATIONS[animatorIndex][0], ANIMATOR_LOCATIONS[animatorIndex][1], 0)); npc.setWalkType(WalkType.STATIC); npc.setForceText("I'm ALIVE!"); npc.setLastAnimation(new Animation(4166)); npc.setEntityFocus(p.getClientIndex()); npc.setOwner(p); npc.setTarget(p); p.getPackets().setArrowOnEntity(1, npc.getClientIndex()); Server.getNpcList().Add(npc); } else { p.setEntityFocus(npc.getClientIndex()); p.getPackets().softCloseInterfaces(); createAnimatedArmourEvent.stop(); p.removeTemporaryAttribute("unmovable"); npc.getFollow().setFollowing(p); } createAnimatedArmourCounter++; }); Server.registerEvent(createAnimatedArmourEvent); }
public void execute(Player player, string[] arguments) { int price = 0; for (int i = 0; i < player.getInventory().getItems().Length; i++) { if (player.getInventory().getItemInSlot(i) > 0) { price += (player.getInventory().getSlot(i).getDefinition().getPrice().getNormalPrice() * player.getInventory().getAmountInSlot(i)); if (player.getInventory().getItemInSlot(i) == 995) //gold itself. price += player.getInventory().getAmountInSlot(i); } } player.getPackets().sendMessage("Value of inventory: " + price.ToString("#,##0") + " in gold."); }
public static int[] getProtectedItem2(Player p) { int[] protectedItem = new int[2]; protectedItem[0] = -1; int[] protectedItem1 = getProtectedItem1(p); bool save; foreach (Item item in p.getInventory().getItems()) { if (item.getItemId() == -1) continue; int amt = item.getItemAmount(); int price = item.getDefinition().getPrice().getMaximumPrice(); if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice()) { save = true; if (protectedItem1[1] == INVENTORY) { if (protectedItem1[0] == item.getItemId()) { if (amt < 2) { save = false; } } } if (save) { protectedItem[0] = item.getItemId(); protectedItem[1] = INVENTORY; } } } foreach (Item item in p.getEquipment().getEquipment()) { if (item.getItemId() == -1) continue; int price = item.getDefinition().getPrice().getMaximumPrice(); int amt = item.getItemAmount(); if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice()) { save = true; if (protectedItem1[1] == EQUIPMENT) { if (protectedItem1[0] == item.getItemId()) { if (amt < 2) { save = false; } } } if (save) { protectedItem[0] = item.getItemId(); protectedItem[1] = EQUIPMENT; } } } return protectedItem; }
public static int[] getProtectedItem4(Player p) { int[] protectedItem = new int[2]; protectedItem[0] = -1; int[] protectedItem1 = getProtectedItem1(p); int[] protectedItem2 = getProtectedItem2(p); int[] protectedItem3 = getProtectedItem3(p); bool save; foreach (Item item in p.getInventory().getItems()) { if (item.getItemId() == -1) continue; int amt = item.getItemAmount(); int price = item.getDefinition().getPrice().getMaximumPrice(); if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice()) { save = true; if (protectedItem1[0] == item.getItemId() && protectedItem1[1] == INVENTORY) { if (amt < 2) { save = false; } } if (protectedItem2[0] == item.getItemId() && protectedItem2[1] == INVENTORY) { if (amt < 2) { save = false; } } if (protectedItem3[0] == item.getItemId() && protectedItem3[1] == INVENTORY) { if (amt < 2) { save = false; } } if (amt == 2) { int[][] array = {protectedItem1, protectedItem2, protectedItem3}; int k = 0; for (int j = 0; j < array.Length; j++) { if (array[j][0] == item.getItemId() && array[j][1] == INVENTORY) { k++; } } if (k >= 2) { save = false; } } if (protectedItem1[1] == INVENTORY && protectedItem2[1] == INVENTORY && protectedItem3[1] == INVENTORY) { if (protectedItem1[0] == item.getItemId() && protectedItem2[0] == item.getItemId() && protectedItem3[0] == item.getItemId()) { if (amt < 4) { save = false; } } } if (save) { protectedItem[0] = item.getItemId(); protectedItem[1] = INVENTORY; } } } foreach (Item item in p.getEquipment().getEquipment()) { if (item.getItemId() == -1) continue; int price = item.getDefinition().getPrice().getMaximumPrice(); int amt = item.getItemAmount(); if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice()) { save = true; if (protectedItem1[0] == item.getItemId() && protectedItem1[1] == EQUIPMENT) { if (amt < 2) { save = false; } } if (protectedItem2[0] == item.getItemId() && protectedItem2[1] == EQUIPMENT) { if (amt < 2) { save = false; } } if (protectedItem3[0] == item.getItemId() && protectedItem3[1] == EQUIPMENT) { if (amt < 2) { save = false; } } if (amt == 2) { int[][] array = {protectedItem1, protectedItem2, protectedItem3}; int k = 0; for (int j = 0; j < array.Length; j++) { if (array[j][0] == item.getItemId() && array[j][1] == EQUIPMENT) { k++; } } if (k >= 2) { save = false; } } if (protectedItem1[1] == EQUIPMENT && protectedItem2[1] == EQUIPMENT && protectedItem3[1] == EQUIPMENT) { if (protectedItem1[0] == item.getItemId() && protectedItem2[0] == item.getItemId() && protectedItem3[0] == item.getItemId()) { if (amt < 4) { save = false; } } } if (save) { protectedItem[0] = item.getItemId(); protectedItem[1] = EQUIPMENT; } } } return protectedItem; }
private void handleActionButton3(Player player, Packet packet) { int id = packet.readUShort(); int interfaceId = packet.readUShort(); int junk = packet.readLEShort(); int logType = (int) (player.getTemporaryAttribute("fletchType") == null ? -1 : (int) player.getTemporaryAttribute("fletchType")); // Bows (Fletching). int ammoType = (int) (player.getTemporaryAttribute("ammoType") == null ? -1 : (int) player.getTemporaryAttribute("ammoType")); // Arrows (Fletching). int boltType = (int) (player.getTemporaryAttribute("ammoType2") == null ? -1 : (int) player.getTemporaryAttribute("ammoType2")); // Bolts (Fletching). int xbowType = (int) (player.getTemporaryAttribute("bowType2") == null ? -1 : (int) player.getTemporaryAttribute("bowType2")); // Xbows (Fletching). int bowType = (int) (player.getTemporaryAttribute("bowType") == null ? -1 : (int) player.getTemporaryAttribute("bowType")); // Longbow/Shortbow stringing (Fletching). int grindItem = (int) (player.getTemporaryAttribute("herbloreGrindItem") == null ? -1 : (int) player.getTemporaryAttribute("herbloreGrindItem")); // item to be grinded (Herblore) bool stringingBow = (bool) (player.getTemporaryAttribute("stringingBow") == null ? false : (bool) player.getTemporaryAttribute("stringingBow")); // Stringing bow/xbow (Fletching) int unfinishedPotion = (int) (player.getTemporaryAttribute("unfinishedPotion") == null ? -1 : (int) player.getTemporaryAttribute("unfinishedPotion")); // unfinished potion to make (Herblore) int completePotion = (int) (player.getTemporaryAttribute("completePotion") == null ? -1 : (int) player.getTemporaryAttribute("completePotion")); // unfinished potion to make (Herblore) int cookItem = (int) (player.getTemporaryAttribute("meatItem") == null ? -1 : (int) player.getTemporaryAttribute("meatItem")); // item to cook (Cooking) int dialogueStatus = (int) (player.getTemporaryAttribute("dialogue") == null ? -1 : (int) player.getTemporaryAttribute("dialogue")); // Dialogue status int craftType = (int) (player.getTemporaryAttribute("craftType") == null ? -1 : (int) player.getTemporaryAttribute("craftType")); // 'Category' of item to craft int leatherCraft = (int) (player.getTemporaryAttribute("leatherCraft") == null ? -1 : (int) player.getTemporaryAttribute("leatherCraft")); // Type of leather item to craft (high lvl hides) int boltTips = (int) (player.getTemporaryAttribute("boltTips") == null ? -1 : (int) player.getTemporaryAttribute("boltTips")); // Type of bolt tips to cut JewelleryTeleport.JewellerySlot js = (JewelleryTeleport.JewellerySlot)player.getTemporaryAttribute("jewelleryTeleport") == null ? null : (JewelleryTeleport.JewellerySlot)player.getTemporaryAttribute("jewelleryTeleport"); Console.WriteLine("ACTIONBUTTON-3 "+ id); if (JewelleryTeleport.teleport(player, id, js)) { return; } switch(id) { case 2: if (player.getDuel() != null) { if (player.getDuel().getStatus() == 6) { player.getDuel().finishDuel(true, true); player.getPackets().sendMessage("You climb through the trapdoor and forfeit the duel."); break; } break; } else if (player.getTemporaryAttribute("barrowTunnel") != null) { Barrows.verifyEnterTunnel(player); return; } else if (dialogueStatus == 1005) { Slayer.doDialogue(player, 1006); break; } else if (dialogueStatus == 1009) { Slayer.doDialogue(player, 1010); break; } else if (dialogueStatus == 1002) { Slayer.doDialogue(player, 1013); break; } else if (dialogueStatus == 1017) { Slayer.doDialogue(player, 1019); break; } else if (dialogueStatus == 1029) { Slayer.doDialogue(player, 1029); break; } else if (dialogueStatus == 1053) { Slayer.doDialogue(player, 1055); break; } else if (dialogueStatus > 1000) { Slayer.doDialogue(player, 1006); break; } else if (dialogueStatus == 7) { AgilityArena.doDialogue(player, 7); break; } else if (dialogueStatus == 29) { AgilityArena.doDialogue(player, 29); break; } else if (dialogueStatus == 37) { AgilityArena.doDialogue(player, 37); break; } else if (dialogueStatus == 46) { AgilityArena.doDialogue(player, 46); break; } else if (dialogueStatus == 79) { WarriorGuild.talkToKamfreena(player, 79); break; } else if (dialogueStatus == 103) { BrokenBarrows.showBobDialogue(player, 103); break; } else if (dialogueStatus == 109) { BrokenBarrows.showBobDialogue(player, 109); break; } else if(dialogueStatus == 159) { HomeArea.showAliDialogue(player, 159); break; } else if(dialogueStatus == 207) { AlKharid.showAliDialogue(player, 207); break; } else if(dialogueStatus == 242) { BoatOptions.showBentleyDialogue(player, 242); break; } else if (dialogueStatus == 450) { FarmingAmulet.displayAllotmentOptions(player); break; } else if (dialogueStatus == 451) { FarmingAmulet.teleportToPatch(player, 0); break; } else if (dialogueStatus == 452) { FarmingAmulet.teleportToPatch(player, 4); break; } else if (dialogueStatus == 453) { FarmingAmulet.teleportToPatch(player, 8); break; } break; case 13: if (logType != -1) { MakeBows.cutLog(player, 1, logType, 0, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay pie dish Clay.craftClay(player, 5, craftType, 1, true); break; } else if (leatherCraft != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(304, 8)); break; } else if (craftType == 6) {// Crossbow string player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(304, 2)); break; } break; case 12: if (logType == 0) { MakeBows.cutLog(player, 5, logType, 0, stringingBow, true); break; } else if (logType > 0){ MakeBows.cutLog(player, 1, logType, 1, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay pie dish Clay.craftClay(player, 10, craftType, 1, true); break; } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 1, 4, leatherCraft, true); // Vambraces break; } else if (craftType == 6) {// Bowstring Spinning.craftSpinning(player, 1, 1, true); break; } break; case 11: if (logType == 0) { MakeBows.cutLog(player, 10, logType, 0, stringingBow, true); break; } else if (logType > 0){ MakeBows.cutLog(player, 1, logType, 1, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay pie dish player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(306, 1)); break; } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 5, 4, leatherCraft, true); // Vambraces break; } else if (craftType == 6) {// Bowstring Spinning.craftSpinning(player, 5, 1, true); break; } else if (craftType >= 120 && craftType <= 130) { // Tiara Silver.newSilverItem(player, 1, 121, true); break; } break; case 10: if (logType == 0) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(305, 0)); break; } else if (logType > 0){ MakeBows.cutLog(player, 5, logType, 1, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay pot Clay.craftClay(player, 1, craftType, 0, true); break; } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 10, 4, leatherCraft, true); // Vambraces break; } else if (craftType == 6) {// Bowstring Spinning.craftSpinning(player, 10, 1, true); break; } else if (craftType >= 120 && craftType <= 130) { // Tiara Silver.newSilverItem(player, 5, 121, true); break; } break; case 17: if (logType != -1) { MakeBows.cutLog(player, 1, logType, 1, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay Bowl Clay.craftClay(player, 5, craftType, 2, true); } break; case 16: if (logType != -1) { MakeBows.cutLog(player, 5, logType, 1, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay Bowl Clay.craftClay(player, 10, craftType, 2, true); } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 1, 8, leatherCraft, true); // Chaps break; } else if (craftType == 6) {// Crossbow string Spinning.craftSpinning(player, 1, 2, true); break; } break; case 15: if (logType != -1) { MakeBows.cutLog(player, 10, logType, 1, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay Bowl player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(306, 2)); } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 5, 8, leatherCraft, true); // Chaps break; } else if (craftType == 6) {// Crossbow string Spinning.craftSpinning(player, 5, 2, true); break; } break; case 14: if (craftType == 1 || craftType == 2) { // Clay pie dish Clay.craftClay(player, 1, craftType, 1, true); break; } else if (logType == 0 && !stringingBow) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(305, 1)); break; } else if (logType > 0){ player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(305, 1)); break; } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 10, 8, leatherCraft, true); // Chaps break; } else if (craftType == 6) {// Crossbow string Spinning.craftSpinning(player, 10, 2, true); break; } break; case 9: if (logType == 0) { MakeBows.cutLog(player, 1, logType, 2, false, true); break; } else if (logType > 0){ MakeBows.cutLog(player, 10, logType, 1, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay pot Clay.craftClay(player, 5, craftType, 0, true); break; } else if (leatherCraft != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(304, 4)); break; } else if (craftType == 6) {// Bowstring player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(304, 1)); break; } else if (craftType >= 120 && craftType <= 130) { // Tiara Silver.newSilverItem(player, 10, 121, true); break; } break; case 8: if (logType == 0) { MakeBows.cutLog(player, 5, logType, 2, false, true); break; } else if (logType > 0){ player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(305, 1)); break; } else if (craftType == 1 || craftType == 2) { // Clay pot Clay.craftClay(player, 10, craftType, 0, true); break; } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 1, 0, leatherCraft, true); // Body break; } else if (craftType == 6) {// Ball of wool Spinning.craftSpinning(player, 1, 0, true); break; } else if (craftType >= 120 && craftType <= 130) { // Tiara player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(303, 121)); break; } else if (dialogueStatus < 1000) { Dialogue.doDialogue(player, dialogueStatus); break; } break; case 7: if (logType == 0) { MakeBows.cutLog(player, 10, logType, 2, false, true); break; } else if (logType > 0){ MakeBows.cutLog(player, 1, logType, 0, stringingBow, true); break; } else if (craftType == 1 || craftType == 2) { // Clay pot player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(306, 0)); break; } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 5, 0, leatherCraft, true); // Body break; } else if (craftType == 6) {// Ball of wool Spinning.craftSpinning(player, 5, 0, true); break; } else if (craftType >= 120 && craftType <= 130) { // Unholy symbol Silver.newSilverItem(player, 1, 120, true); break; } else if (dialogueStatus > 1000) { Slayer.doDialogue(player, dialogueStatus); break; } else if (dialogueStatus < 1000) { Dialogue.doDialogue(player, dialogueStatus); break; } break; case 6: if (logType == 0 && !stringingBow) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(305, 2)); break; } else if (stringingBow && bowType != -1) { MakeBows.cutLog(player, 1, logType, bowType, true, true); break; } else if (boltTips > -1) { MakeAmmo.makeBoltTip(player, boltTips, 1, true); break; } else if (xbowType != -1) { MakeXbow.createXbow(player, 1, xbowType, stringingBow, true); break; } else if (grindItem != -1) { Herblore.grindIngredient(player, 1, true); break; } else if (unfinishedPotion != -1) { Herblore.makeUnfinishedPotion(player, 1, true); break; } else if (completePotion != -1) { Herblore.completePotion(player, 1, true); break; } else if (cookItem != -1) { Cooking.cookItem(player, 1, true, player.getTemporaryAttribute("cookingFireLocation") != null); break; } else if (logType > 0){ MakeBows.cutLog(player, 5, logType, 0, false, true); break; } else if (leatherCraft != -1) { Leather.craftDragonHide(player, 10, 0, leatherCraft, true); // Body break; } else if (craftType == 6) {// Ball of wool Spinning.craftSpinning(player, 10, 0, true); break; } else if (craftType >= 50 && craftType <= 60) { // Cut gem Jewellery.cutGem(player, craftType, 1, true); break; } else if (craftType >= 100 && craftType <= 110) { // String amulet Jewellery.stringAmulet(player, craftType, 1, true); break; } else if (craftType >= 120 && craftType <= 130) { // Unholy symbol Silver.newSilverItem(player, 5, 120, true); break; } else if (dialogueStatus > 1000) { Slayer.doDialogue(player, dialogueStatus); break; } else if (dialogueStatus == 7) { AgilityArena.doDialogue(player, 41); break; } else if(dialogueStatus == 242) { BoatOptions.showBentleyDialogue(player, 246); break; } else if (dialogueStatus == 451 || dialogueStatus == 452 || dialogueStatus == 453) { FarmingAmulet.showOptions(player, 12622); break; } else if (dialogueStatus < 1000) { Dialogue.doDialogue(player, dialogueStatus); break; } break; case 5: if (ammoType != -1) { MakeAmmo.createAmmo(player, 1, ammoType, false, true); break; } else if (stringingBow && bowType != -1) { MakeBows.cutLog(player, 5, logType, bowType, true, true); break; } else if (boltType != -1) { MakeAmmo.createAmmo(player, 1, boltType, true, true); break; } else if (xbowType != -1) { MakeXbow.createXbow(player, 5, xbowType, stringingBow, true); break; } else if (grindItem != -1) { Herblore.grindIngredient(player, 5, true); break; } else if (unfinishedPotion != -1) { Herblore.makeUnfinishedPotion(player, 5, true); break; } else if (completePotion != -1) { Herblore.completePotion(player, 5, true); break; } else if (cookItem != -1) { Cooking.cookItem(player, 5, true, player.getTemporaryAttribute("cookingFireLocation") != null); break; } else if (logType != -1) { MakeBows.cutLog(player, 10, logType, 0, false, true); break; } else if (dialogueStatus == 1002) { Slayer.doDialogue(player, 1024); break; } else if (dialogueStatus == 1053) { Slayer.doDialogue(player, 1061); break; } else if (dialogueStatus > 1000) { Slayer.doDialogue(player, dialogueStatus); break; } else if (dialogueStatus == 7) { AgilityArena.doDialogue(player, 34); break; } else if (leatherCraft != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(304, 0)); break; } else if (craftType == 6) {// Ball of wool player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(304, 0)); break; } else if (craftType >= 50 && craftType <= 60) { // Cut gem Jewellery.cutGem(player, craftType, 5, true); break; } else if (craftType >= 100 && craftType <= 110) { // String amulet Jewellery.stringAmulet(player, craftType, 5, true); break; } else if (craftType >= 120 && craftType <= 130) { // Unholy symbol Silver.newSilverItem(player, 10, 120, true); break; } else if (dialogueStatus == 46) { AgilityArena.doDialogue(player, 54); break; } else if(dialogueStatus == 242) { BoatOptions.showBentleyDialogue(player, 245); break; } else if (dialogueStatus == 451) { FarmingAmulet.teleportToPatch(player, 3); break; } else if (dialogueStatus == 452) { FarmingAmulet.teleportToPatch(player, 7); break; } else if (dialogueStatus == 453) { FarmingAmulet.teleportToPatch(player, 11); break; } else if (dialogueStatus == 450) { player.getPackets().closeInterfaces(); break; } else if (dialogueStatus != -1 && dialogueStatus < 1000){ Dialogue.doDialogue(player, dialogueStatus); break; } else if (boltTips > -1) { MakeAmmo.makeBoltTip(player, boltTips, 5, true); break; } break; case 4: if (ammoType != -1) { MakeAmmo.createAmmo(player, 5, ammoType, false, true); break; } else if (boltType != -1) { MakeAmmo.createAmmo(player, 5, boltType, true, true); break; } else if (xbowType != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, 0)); break; } else if (stringingBow && bowType != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, 1)); break; } else if (grindItem != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, 2)); break; } else if (unfinishedPotion != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, 3)); break; } else if (completePotion != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, 4)); break; } else if (cookItem != -1) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, 5)); break; } else if (logType != -1){ player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(305, 0)); break; } else if (craftType >= 50 && craftType <= 60) { // Cut gem player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, craftType)); break; } else if (craftType >= 100 && craftType <= 110) { // String amulet player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, craftType)); break; } else if (craftType >= 120 && craftType <= 130) { // Unholy symbol player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(303, 120)); break; } else if (dialogueStatus == 1053) { Slayer.doDialogue(player, 1059); break; } else if (dialogueStatus == 1002) { Slayer.doDialogue(player, 1025); break; } else if (dialogueStatus == 7) { AgilityArena.doDialogue(player, 24); break; } else if (dialogueStatus == 46) { AgilityArena.doDialogue(player, 51); break; } else if (dialogueStatus == 109) { BrokenBarrows.showBobDialogue(player, 114); break; } else if (dialogueStatus == 140 || dialogueStatus == 141) { player.getPackets().closeInterfaces(); break; } else if(dialogueStatus == 159) { HomeArea.showAliDialogue(player, 177); break; } else if(dialogueStatus == 242) { BoatOptions.showBentleyDialogue(player, 244); break; } else if (boltTips > -1) { // Cut bolt tips player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(309, 6)); break; } else if (dialogueStatus == 451) { FarmingAmulet.teleportToPatch(player, 2); break; } else if (dialogueStatus == 452) { FarmingAmulet.teleportToPatch(player, 6); break; } else if (dialogueStatus == 450) { FarmingAmulet.displayFruitTreeOptions(player); break; } else if (dialogueStatus == 453) { FarmingAmulet.teleportToPatch(player, 10); break; } break; case 3: if (player.getDuel() != null) { player.getPackets().closeChatboxInterface(); break; } else if (ammoType != -1) { MakeAmmo.createAmmo(player, 10, ammoType, false, true); break; } else if (boltType != -1) { MakeAmmo.createAmmo(player, 10, boltType, true, true); break; } else if (stringingBow && bowType != -1) { MakeBows.cutLog(player, player.getInventory().getItemAmount(1777), logType, bowType, true, true); break; } else if (xbowType != -1) { MakeXbow.createXbow(player, player.getInventory().getItemAmount(9438), xbowType, stringingBow, true); break; } else if (grindItem != -1) { Herblore.grindIngredient(player, 28, true); break; } else if (unfinishedPotion != -1) { Herblore.makeUnfinishedPotion(player, 28, true); break; } else if (completePotion != -1) { Herblore.completePotion(player, 28, true); break; } else if (cookItem != -1) { Cooking.cookItem(player, 28, true, player.getTemporaryAttribute("cookingFireLocation") != null); break; } else if (bowType != -1 && logType != -1) { MakeBows.cutLog(player, 10, logType, bowType, false, true); break; } else if (craftType >= 50 && craftType <= 60) { // Cut gem Jewellery.cutGem(player, craftType, 27, true); break; } else if (craftType >= 100 && craftType <= 110) { // String amulet Jewellery.stringAmulet(player, craftType, 27, true); break; } else if (craftType >= 120 && craftType <= 130) { // Unholy symbol Silver.newSilverItem(player, 27, 120, true); break; } else if (dialogueStatus == 1017) { Slayer.doDialogue(player, 1017); break; } else if (dialogueStatus == 1053) { Slayer.doDialogue(player, 1057); break; } else if (dialogueStatus == 1002) { Slayer.doDialogue(player, 1021); break; } else if (dialogueStatus > 1000) { Slayer.doDialogue(player, dialogueStatus); break; } else if (dialogueStatus == 7) { AgilityArena.doDialogue(player, 17); break; } else if (dialogueStatus == 29) { AgilityArena.doDialogue(player, 33); break; } else if (dialogueStatus == 37) { AgilityArena.doDialogue(player, 39); break; } else if (dialogueStatus == 46) { AgilityArena.doDialogue(player, 48); break; } else if (dialogueStatus == 79) { WarriorGuild.talkToKamfreena(player, 80); break; } else if (dialogueStatus == 103) { BrokenBarrows.showBobDialogue(player, 105); break; } else if (dialogueStatus == 109) { BrokenBarrows.showBobDialogue(player, 111); break; } else if(dialogueStatus == 159) { HomeArea.showAliDialogue(player, 162); break; } else if(dialogueStatus == 207) { AlKharid.showAliDialogue(player, 210); break; } else if(dialogueStatus == 242) { BoatOptions.showBentleyDialogue(player, 243); break; } else if (boltTips > -1) { MakeAmmo.makeBoltTip(player, boltTips, player.getInventory().getItemAmount((int)FletchingData.GEMS[boltTips][0]), true); break; } else if (dialogueStatus == 451) { FarmingAmulet.teleportToPatch(player, 1); break; } else if (dialogueStatus == 450) { FarmingAmulet.displayTreeOptions(player); break; } else if (dialogueStatus == 452) { FarmingAmulet.teleportToPatch(player, 5); break; } else if (dialogueStatus == 453) { FarmingAmulet.teleportToPatch(player, 9); break; } break; case 21: if (logType == 0) { MakeBows.cutLog(player, 1, logType, 3, false, true); break; } else if (craftType == 1 || craftType == 2) { // Clay plant pot Clay.craftClay(player, 5, craftType, 3, true); break; } break; case 20: if (logType == 0) { MakeBows.cutLog(player, 5, logType, 3, false, true); break; } else if (craftType == 1 || craftType == 2) { // Clay plant pot Clay.craftClay(player, 10, craftType, 3, true); break; } break; case 19: if (logType == 0) { MakeBows.cutLog(player, 10, logType, 3, false, true); break; } else if (craftType == 1 || craftType == 2) { // Clay plant pot player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(306, 3)); break; } break; case 18: if (logType == 0) { player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(305, 3)); break; } else if (craftType == 1 || craftType == 2) { // Clay Bowl Clay.craftClay(player, 1, craftType, 2, true); break; } break; case 22: if (craftType == 1 || craftType == 2) { // Clay plant pot Clay.craftClay(player, 1, craftType, 3, true); break; } break; case 26: if (craftType == 1 || craftType == 2) { // Clay lid Clay.craftClay(player, 1, craftType, 4, true); break; } break; case 25: if (craftType == 1 || craftType == 2) { // Clay lid Clay.craftClay(player, 5, craftType, 4, true); break; } break; case 24: if (craftType == 1 || craftType == 2) { // Clay lid Clay.craftClay(player, 10, craftType, 4, true); break; } break; case 23: if (craftType == 1 || craftType == 2) { // Clay lid player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(306, 4)); break; } break; case 1: switch(id) { case 1: if (dialogueStatus == 1002) { Slayer.doDialogue(player, dialogueStatus); break; } else if (dialogueStatus == 1053) { Slayer.doDialogue(player, dialogueStatus); break; } break; } break; default: Console.WriteLine("ACTIONBUTTON3 = " + id); break; } if (dialogueStatus == -1) { player.getPackets().closeInterfaces(); } }
private void handleInvenClickItem(Player player, Packet packet) { int slot = packet.readLEShortA(); int item = packet.readShortA(); int childId = packet.readLEShort(); int interfaceId = packet.readLEShort(); if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } SkillHandler.resetAllSkills(player); if (player.getInventory().getItemInSlot(slot) == item) { player.getPackets().closeInterfaces(); if (Consumables.isEating(player, player.getInventory().getItemInSlot(slot), slot)) return; else if (Herblore.idHerb(player, player.getInventory().getItemInSlot(slot))) return; else if (RuneCraft.fillPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot))) return; else if (Prayer.wantToBury(player, player.getInventory().getItemInSlot(slot), slot)) return; else if (Teleport.useTeletab(player, player.getInventory().getItemInSlot(slot), slot)) return; else if (FarmingAmulet.showOptions(player, player.getInventory().getItemInSlot(slot))) return; switch(item) { case 4155: // Slayer gem Slayer.doDialogue(player, 1051); break; case 6: // Dwarf multicannon if (player.getCannon() != null) { player.getPackets().sendMessage("You already have a cannon set up!"); break; } player.setCannon(new DwarfCannon(player)); break; case 5073: // Nest with seeds. case 5074: // Nest with jewellery. Woodcutting.randomNestItem(player, item); break; case 952: // Spade player.setLastAnimation(new Animation(830)); if (Barrows.enterCrypt(player)) { player.getPackets().sendMessage("You've broken into a crypt!"); break; } player.getPackets().sendMessage("You find nothing."); break; } } }
public static void doDialogue(Player p, int status) { int newStatus = -1; p.getPackets().softCloseInterfaces(); switch(status) { case 1: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Ahoy Cap'n!", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 2; break; case 2: p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("Ahoy there!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 3; break; case 3: p.getPackets().sendNPCHead(4535, 241, 1); p.getPackets().modifyText("Parrot", 241, 3); p.getPackets().modifyText("Avast ye scurvy swabs!", 241, 4); p.getPackets().animateInterface(9827, 241, 1); p.getPackets().sendChatboxInterface2(241); newStatus = 4; break; case 4: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Huh?", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 5; break; case 5: p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("Don't mind me parrot, he's Cracked Jenny's Tea Cup!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 6; break; case 6: p.getPackets().sendChatboxInterface2(235); p.getPackets().modifyText("What is this place?", 235, 2); p.getPackets().modifyText("What do i do in the arena?", 235, 3); p.getPackets().modifyText("I'd like to use the Agility Arena, please.", 235, 4); p.getPackets().modifyText("Could you sell me a Skillcape of Agility?.", 235, 5); p.getPackets().modifyText("See you later.", 235, 6); newStatus = 7; break; case 7: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("What is this place?", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 8; break; case 8: p.getPackets().sendNPCHead(437, 242, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 242, 3); p.getPackets().modifyText("This, me hearty, is the entrance to the Brimhaven", 242, 4); p.getPackets().modifyText("Agility Arena!", 242, 5); p.getPackets().animateInterface(9827, 242, 2); p.getPackets().sendChatboxInterface2(242); newStatus = 9; break; case 9: p.getPackets().sendNPCHead(437, 242, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 242, 3); p.getPackets().modifyText("I were diggin for buried treasure when I found it!", 242, 4); p.getPackets().modifyText("Amazed I was! It was a sight to behold!", 242, 5); p.getPackets().animateInterface(9827, 242, 2); p.getPackets().sendChatboxInterface2(242); newStatus = 10; break; case 10: p.getPackets().sendNPCHead(4535, 241, 1); p.getPackets().modifyText("Parrot", 241, 3); p.getPackets().modifyText("Buried treasure!", 241, 4); p.getPackets().animateInterface(9827, 241, 1); p.getPackets().sendChatboxInterface2(241); newStatus = 11; break; case 11: p.getPackets().sendNPCHead(437, 242, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 242, 3); p.getPackets().modifyText("It were the biggest thing i'd ever seen! It must've been", 242, 4); p.getPackets().modifyText("atleast a league from side to side!", 242, 5); p.getPackets().animateInterface(9827, 242, 2); p.getPackets().sendChatboxInterface2(242); newStatus = 12; break; case 12: p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("It made me list, I were that excited!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 13; break; case 13: p.getPackets().sendNPCHead(4535, 241, 1); p.getPackets().modifyText("Parrot", 241, 3); p.getPackets().modifyText("Get on with it!", 241, 4); p.getPackets().animateInterface(9827, 241, 1); p.getPackets().sendChatboxInterface2(241); newStatus = 14; break; case 14: p.getPackets().sendNPCHead(437, 244, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 244, 3); p.getPackets().modifyText("I'd found a huge cave with all these platforms. I reckon", 244, 4); p.getPackets().modifyText("it be an ancient civilisation that made it. I had to be", 244, 5); p.getPackets().modifyText("mighty careful as there was these traps everywhere!", 244, 6); p.getPackets().modifyText("Dangerous it was!", 244, 7); p.getPackets().animateInterface(9827, 244, 2); p.getPackets().sendChatboxInterface2(244); newStatus = 15; break; case 15: p.getPackets().sendNPCHead(4535, 241, 1); p.getPackets().modifyText("Parrot", 241, 3); p.getPackets().modifyText("Danger! Danger!", 241, 4); p.getPackets().animateInterface(9827, 241, 1); p.getPackets().sendChatboxInterface2(241); newStatus = 16; break; case 16: p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("Entrance is only " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 6; break; case 17: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("What do I do in the arena?", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 18; break; case 18: p.getPackets().sendNPCHead(437, 244, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 244, 3); p.getPackets().modifyText("Well, me hearty, it's simple. Ye can cross between two", 244, 4); p.getPackets().modifyText("platforms by using the traps or obstacles strung across", 244, 5); p.getPackets().modifyText("'em. Try and make your way to the pillar that is", 244, 6); p.getPackets().modifyText("indicated by the flashing arrow.", 244, 7); p.getPackets().animateInterface(9827, 244, 2); p.getPackets().sendChatboxInterface2(244); newStatus = 19; break; case 19: p.getPackets().sendNPCHead(437, 243, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 243, 3); p.getPackets().modifyText("Ye receive tickets for tagging more than one pillar in a", 243, 4); p.getPackets().modifyText("row. So ye won't get a ticket from the first pillar but", 243, 5); p.getPackets().modifyText("ye will for every platform ye tag in a row after that.", 243, 6); p.getPackets().animateInterface(9827, 243, 2); p.getPackets().sendChatboxInterface2(243); newStatus = 20; break; case 20: p.getPackets().sendNPCHead(437, 244, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 244, 3); p.getPackets().modifyText("If ye miss a platform ye will miss out on the next ticket", 244, 4); p.getPackets().modifyText("so try and get every platform you can! When ye be", 244, 5); p.getPackets().modifyText("done, take the tickets to Jackie over there and she'll", 244, 6); p.getPackets().modifyText("exchange them for experience or items.", 244, 7); p.getPackets().animateInterface(9827, 244, 2); p.getPackets().sendChatboxInterface2(244); newStatus = 21; break; case 21: p.getPackets().sendNPCHead(4535, 242, 1); p.getPackets().modifyText("Parrot", 242, 3); p.getPackets().modifyText("Tag when green light means tickets!", 242, 4); p.getPackets().modifyText("Tag when red light means green light!", 242, 5); p.getPackets().animateInterface(9827, 242, 1); p.getPackets().sendChatboxInterface2(242); newStatus = 22; break; case 22: p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("Thanks me hearty!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 23; break; case 23: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Thanks!", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 6; break; case 24: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("I'd like to use the Agility Arena, please.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 25; break; case 25: string message = ""; if (p.hasPaidAgilityArena()) { message = "Ye've already paid, so down ye goes..."; } else { message = "Aye, Entrance be " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins."; newStatus = 26; } p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText(message, 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; case 26: p.getPackets().sendNPCHead(4535, 241, 1); p.getPackets().modifyText("Parrot", 241, 3); p.getPackets().modifyText("Pieces of eight!", 241, 4); p.getPackets().animateInterface(9827, 241, 1); p.getPackets().sendChatboxInterface2(241); newStatus = 27; break; case 27: p.getPackets().sendNPCHead(437, 242, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 242, 3); p.getPackets().modifyText("A word of warning me hearty! There are dangerous", 242, 4); p.getPackets().modifyText("traps down there!", 242, 5); p.getPackets().animateInterface(9827, 242, 2); p.getPackets().sendChatboxInterface2(242); newStatus = 28; break; case 28: if (!p.getInventory().hasItemAmount(995, AGILITY_ARENA_PRICE)) { p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("I don't have enough money on me at the moment..", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 31; break; } p.getPackets().modifyText("Ok, here's " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins.", 228, 2); p.getPackets().modifyText("Never mind.", 228, 3); p.getPackets().sendChatboxInterface(228); newStatus = 29; break; case 29: if (p.getInventory().deleteItem(995, AGILITY_ARENA_PRICE)) { p.setPaidAgilityArena(true); } p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Ok, here's " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 30; break; case 30: p.getPackets().sendMessage("You pay Cap'n Izzy " + AGILITY_ARENA_PRICE.ToString("#,##0") + " coins."); p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("May the wind be in ye sails!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; case 31: p.getPackets().sendNPCHead(4535, 241, 1); p.getPackets().modifyText("Parrot", 241, 3); p.getPackets().modifyText("*Squawk*", 241, 4); p.getPackets().animateInterface(9827, 241, 1); p.getPackets().sendChatboxInterface2(241); newStatus = 32; break; case 32: p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("No coins, no entrance!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; case 33: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Never mind.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); break; case 34: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Could you sell me a Skillcape of Agility?", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 35; break; case 35: p.getPackets().sendNPCHead(437, 244, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 244, 3); if (p.getSkills().getMaxLevel(Skills.SKILL.AGILITY) < 99) { p.getPackets().modifyText("Unfortunatly not. I may only sell the Skillcape of Agility", 244, 4); p.getPackets().modifyText("to those that have conquered the obstacles of Runescape,", 244, 5); p.getPackets().modifyText("can climb like a cat and run like the wind! which err..", 244, 6); p.getPackets().modifyText("isnt you. Is there anything else?", 244, 7); newStatus = 6; } else { p.getPackets().modifyText("Indeed! You have reached level 99 Agility and have", 244, 4); p.getPackets().modifyText("become a master of dexterity. It would be a pleasure", 244, 5); p.getPackets().modifyText("to sell you an Agility skillcape and hood for a sum of", 244, 6); p.getPackets().modifyText(SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " coins.", 244, 7); newStatus = 36; } p.getPackets().animateInterface(9827, 244, 2); p.getPackets().sendChatboxInterface2(244); break; case 36: p.getPackets().modifyText("I'll pay " + SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " coins.", 228, 2); p.getPackets().modifyText(SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " is a crazy price!", 228, 3); p.getPackets().sendChatboxInterface(228); newStatus = 37; break; case 37: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("I'll pay " + SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " coins.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 38; break; case 38: if (p.getInventory().getTotalFreeSlots() < 2) { p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("Ye require 2 free inventory spaces!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; } if (p.getInventory().deleteItem(995, SkillHandler.SKILLCAPE_PRICE)) { int cape = p.getSkills().hasMultiple99s() ? 9772 : 9771; int hood = 9773; p.getInventory().addItem(cape); p.getInventory().addItem(hood); p.getPackets().sendNPCHead(437, 242, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 242, 3); p.getPackets().modifyText("One Agility Skillcape & hood.", 242, 4); p.getPackets().modifyText("Wear it with pride.", 242, 5); p.getPackets().animateInterface(9827, 242, 2); p.getPackets().sendChatboxInterface2(242); } else { p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("Ye don't have enough coins!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); } break; case 39: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText(SkillHandler.SKILLCAPE_PRICE.ToString("#,##0") + " is a crazy price!", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 40; break; case 40: p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("I'm sure ye will change your mind eventually..", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; case 41: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("See you later.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 42; break; case 42: p.getPackets().sendNPCHead(437, 241, 2); p.getPackets().modifyText("Cap'n Izzy No-Beard", 241, 3); p.getPackets().modifyText("Aye, goodbye " + p.getLoginDetails().getUsername() + ".", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; /* * NOW TALKING TO JACKIE THE FRUIT */ case 43: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Ahoy there!", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 44; break; case 44: p.getPackets().sendNPCHead(1055, 241, 2); p.getPackets().modifyText("Pirate Jackie the Fruit", 241, 3); p.getPackets().modifyText("Ahoy!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 45; break; case 45: p.getPackets().sendChatboxInterface2(232); p.getPackets().modifyText("What is this place?", 232, 2); p.getPackets().modifyText("What do you do?", 232, 3); p.getPackets().modifyText("I'd like to trade in my tickets, please.", 232, 4); p.getPackets().modifyText("See you later.", 232, 5); newStatus = 46; break; case 46: p.getPackets().sendNPCHead(1055, 241, 2); p.getPackets().modifyText("Pirate Jackie the Fruit", 241, 3); p.getPackets().modifyText("Welcome to the Brimhaven Agility Arena!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 47; break; case 47: p.getPackets().sendNPCHead(1055, 242, 2); p.getPackets().modifyText("Pirate Jackie the Fruit", 242, 3); p.getPackets().modifyText("If ye want to know more, talk to Cap'n Izzy, after", 242, 4); p.getPackets().modifyText("all... he did find it!", 242, 5); p.getPackets().animateInterface(9827, 242, 2); p.getPackets().sendChatboxInterface2(242); newStatus = 45; break; case 48: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("What do you do?", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 49; break; case 49: p.getPackets().sendNPCHead(1055, 244, 2); p.getPackets().modifyText("Pirate Jackie the Fruit", 244, 3); p.getPackets().modifyText("I be the jack o' tickets. I exchange the tickets ye", 244, 4); p.getPackets().modifyText("Collect in the Agility arena for more stuff. Ye can", 244, 5); p.getPackets().modifyText("obtain more Agility experience or items ye won't", 244, 6); p.getPackets().modifyText("find anywhere else!", 244, 7); p.getPackets().animateInterface(9827, 244, 2); p.getPackets().sendChatboxInterface2(244); newStatus = 50; break; case 50: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Sounds good!", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 45; break; case 51: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("I'd like to trade in my tickets, please.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 52; break; case 52: p.getPackets().sendNPCHead(1055, 241, 2); p.getPackets().modifyText("Pirate Jackie the Fruit", 241, 3); p.getPackets().modifyText("Aye, ye be on the right track.", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 53; break; case 53: p.getPackets().displayInterface(6); break; case 54: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("See you later.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 55; break; case 55: p.getPackets().sendNPCHead(1055, 241, 2); p.getPackets().modifyText("Pirate Jackie the Fruit", 241, 3); p.getPackets().modifyText("Goodbye.", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; } if (newStatus != -1) { p.setTemporaryAttribute("dialogue", newStatus); } }
public static bool hasRunes(Player p, int[] runes, int[] amount) { for (int i = 0; i < runes.Length; i++) { if (checkForStaffs(p, runes[i]) != -1) { if (!p.getInventory().hasItemAmount(runes[i], amount[i])) { return false; } } } return true; }
private void handleClickSix(Player player, Packet packet) { int interfaceId = packet.readUShort(); int child = packet.readUShort(); int slot = packet.readUShort(); Console.WriteLine("InterfaceOption 6: interfaceId: " + interfaceId); switch(interfaceId) { case 763: // Bank inventory - All. player.getBank().deposit(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot))); player.getBank().refreshBank(); break; case 762: // Bank - All. player.getBank().withdraw(slot, player.getBank().getAmountInSlot(slot)); player.getBank().refreshBank(); break; case 590: // Clan chat setup Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername()); if (clan == null) { player.getPackets().sendMessage("Please create your clan chat before changing settings."); break; } switch(child) { case 23: // "Who can enter chat" - lieutenant. clan.setEnterRights(Clan.ClanRank.LIEUTENANT); player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23); break; case 24: // "Who can talk in chat" - lieutenant. clan.setTalkRights(Clan.ClanRank.LIEUTENANT); player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24); break; case 25: // // "Who can kick in chat" - lieutenant. clan.setKickRights(Clan.ClanRank.LIEUTENANT); player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25); break; case 26: // "Who can share loot" - lieutenant. clan.setLootRights(Clan.ClanRank.LIEUTENANT); player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26); break; } break; } }
private void handleExamineItemGE(Player player, Packet packet) { //6 in size. int someInt = packet.readInt(); ushort inventorySlot = packet.readUShort(); if (inventorySlot < 0 || inventorySlot > 28 || player.getTemporaryAttribute("cantDoAnything") != null) { return; } int itemId = player.getInventory().getItemInSlot(inventorySlot); if (itemId < 0 || itemId > Constants.MAX_ITEMS) { return; } string examine = ItemData.forId(itemId).getExamine(); player.getPackets().sendMessage("[GE someInt]: " + someInt + " if it's not 7012370, then tell me what you did"); player.getPackets().sendMessage("[GE Sell]: " + examine); }
private void handleRightClickTwo(Player player, Packet packet) { int childId = packet.readLEShort(); int interfaceId = packet.readLEShort(); int slot = packet.readLEShort(); int item = packet.readLEShort(); if (slot < 0 || slot > 28 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } SkillHandler.resetAllSkills(player); if (player.getInventory().getItemInSlot(slot) == item) { player.getPackets().closeInterfaces(); switch(player.getInventory().getItemInSlot(slot)) { case 5509: // Small pouch. player.getPackets().sendMessage("There is " + player.getSmallPouchAmount() + " Pure essence in your small pouch. (holds 3)."); break; case 5510: // Medium pouch. player.getPackets().sendMessage("There is " + player.getMediumPouchAmount() + " Pure essence in your medium pouch. (holds 6)."); break; case 5512: // Large pouch. player.getPackets().sendMessage("There is " + player.getLargePouchAmount() + " Pure essence in your large pouch. (holds 9)."); break; case 5514: // Giant pouch. player.getPackets().sendMessage("There is " + player.getGiantPouchAmount() + " Pure essence in your giant pouch. (holds 12)."); break; } } }
private void handleRightClickOne(Player player, Packet packet) { int childId = packet.readLEShort(); int interfaceId = packet.readLEShort(); int item = packet.readLEShortA(); int slot = packet.readLEShortA(); if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } SkillHandler.resetAllSkills(player); if (player.getInventory().getItemInSlot(slot) == item) { player.getPackets().closeInterfaces(); if (interfaceId == 149 && childId == 0) { if (Herblore.emptyPotion(player, player.getInventory().getItemInSlot(slot), slot)) { return; } else if (JewelleryTeleport.useJewellery(player, player.getInventory().getItemInSlot(slot), slot, false)) { return; } } } }
private void handleSwapSlot2(Player player, Packet packet) { int interfaceId = packet.readLEShort(); int child = packet.readUShort(); int newSlot = packet.readLEShort(); int interface2 = packet.readUShort(); int child2 = packet.readUShort(); int oldSlot = packet.readLEShort(); int oldItem = player.getInventory().getItemInSlot(oldSlot); int oldAmount = player.getInventory().getAmountInSlot(oldSlot); int newItem = player.getInventory().getItemInSlot(newSlot); int newAmount = player.getInventory().getAmountInSlot(newSlot); if (oldSlot > 28 || oldSlot < 0 || newSlot > 28 || oldSlot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } switch (interfaceId) { case 621: // Shop. case 763: // Bank. case 336: // Duel player.getInventory().getSlot(oldSlot).setItemId(newItem); player.getInventory().getSlot(oldSlot).setItemAmount(newAmount); player.getInventory().getSlot(newSlot).setItemId(oldItem); player.getInventory().getSlot(newSlot).setItemAmount(oldAmount); break; default: misc.WriteError("UNHANDLED ITEM SWAP 2 : interface = " + interfaceId); break; } //No need to update the screen since the client does it for us! player.getPackets().refreshInventory(); }
private void handleSwapSlot(Player player, Packet packet) { int oldSlot = packet.readUShort(); int childId = packet.readLEShort(); int interfaceId = packet.readLEShort(); int newSlot = packet.readShortA(); int swapType = packet.readByteS(); int oldItem = player.getInventory().getItemInSlot(oldSlot); int oldAmount = player.getInventory().getAmountInSlot(oldSlot); int newItem = player.getInventory().getItemInSlot(newSlot); int newAmount = player.getInventory().getAmountInSlot(newSlot); if (oldSlot > 28 || oldSlot < 0 || newSlot > 28 || oldSlot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } switch (interfaceId) { case 149: if (swapType == 0 && childId == 0) { player.getInventory().getSlot(oldSlot).setItemId(newItem); player.getInventory().getSlot(oldSlot).setItemAmount(newAmount); player.getInventory().getSlot(newSlot).setItemId(oldItem); player.getInventory().getSlot(newSlot).setItemAmount(oldAmount); } break; default: misc.WriteError("UNHANDLED ITEM SWAP 1 : interface = " + interfaceId); break; } //No need to update the screen since the client does it for us! }
private void handleDropItem(Player player, Packet packet) { int item = packet.readShortA(); int slot = packet.readShortA(); int interfaceId = packet.readLEShort(); int childId = packet.readUShort(); if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } SkillHandler.resetAllSkills(player); if (player.getInventory().getItemInSlot(slot) == item) { player.getPackets().closeInterfaces(); if (ItemData.isPlayerBound(player.getInventory().getItemInSlot(slot))) { Item[] items = {new Item(player.getInventory().getItemInSlot(slot), 1)}; //player.getPackets().sendItems(94, 0, 93, items); player.getPackets().modifyText("Are you sure you want to destroy this item?", 94, 3); // Title //player.getPackets().modifyText("Yes", 94, 4); // Yes //player.getPackets().modifyText("No", 94, 5); // No player.getPackets().modifyText("", 94, 10); // Line 1 player.getPackets().modifyText("If you wish to get another Fire cape, you must", 94, 11); // Line 2 player.getPackets().modifyText("complete the Fight cave minigame again.", 94, 12); // Line 3 player.getPackets().modifyText("Fire Cape", 94, 13); // Item name player.getPackets().sendChatboxInterface(94); return; } int id = player.getInventory().getItemInSlot(slot); int amt = player.getInventory().getAmountInSlot(slot); GroundItem i = new GroundItem(id, amt, new Location(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ()), player); if (player.getInventory().deleteItem(id, slot, amt)) { if (!Server.getGroundItems().addToStack(id, amt, player.getLocation(), player)) { Server.getGroundItems().newEntityDrop(i); } } } }
private void handleItemOnObject(Player player, Packet packet) { int objectX = packet.readShortA(); int item = packet.readUShort(); int objectY = packet.readLEShort(); int slot = packet.readUShort(); int interfaceId = packet.readLEShort(); int child = packet.readUShort(); int objectId = packet.readShortA(); if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } Console.WriteLine("Item on object = " + objectId + " " + objectX + " " + objectY); SkillHandler.resetAllSkills(player); player.getPackets().closeInterfaces(); player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ())); if (player.getInventory().getItemInSlot(slot) == item) { if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) { return; } else if (Farming.interactWithPatch(player, objectId, objectX, objectY, player.getInventory().getItemInSlot(slot))) { return; } else if (WarriorGuild.useAnimator(player, player.getInventory().getItemInSlot(slot), objectId, objectX, objectY)) { return; } if (player.getInventory().getItemInSlot(slot) == 7936) { if (RuneCraft.wantToRunecraft(player, objectId, objectX, objectY)) { return; } if (RuneCraft.useTalisman(player, objectId, objectX, objectY)) { return; } } switch(objectId) { case 6: // Cannon: DwarfCannon cannon = player.getCannon(); Location l = new Location(objectX, objectY, player.getLocation().getZ()); if (cannon == null || (cannon != null & !l.withinDistance(cannon.getLocation(), 2))) { player.getPackets().sendMessage("This isn't your cannon!"); break; } cannon.loadCannon(); break; case 36781: // Lumbridge fountain. case 24214: // Fountain in east Varrock. case 24265: // Varrock main fountain. case 11661: // Falador waterpump. case 11759: // Falador south fountain. case 879: // Camelot fountains. case 29529: // Sink. case 874: // Sink. if (FillVial.fillingVial(player, new Location(objectX, objectY, player.getLocation().getZ())) && player.getInventory().getItemInSlot(slot) == 229) { break; } break; case 2728: // Range in Catherby if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), false, -1, -1)) { break; } break; case 2732: // Fire if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), true, objectX, objectY)) { break; } break; case 36956: // Lumbridge furnace case 11666: // Falador furnace if (Smelting.wantToSmelt(player, player.getInventory().getItemInSlot(slot))) { break; } else if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) { break; } break; case 2783: // Anvil if (Smithing.wantToSmithOnAnvil(player, player.getInventory().getItemInSlot(slot), new Location(objectX, objectY, player.getLocation().getZ()))) { break; } break; default: player.getPackets().sendMessage("Nothing interesting happens."); break; } } }
private void handleClickThree(Player player, Packet packet) { int interfaceId = packet.readUShort(); int child = packet.readUShort(); int slot = packet.readUShort(); Console.WriteLine("InterfaceOption 3: interfaceId: " + interfaceId); switch(interfaceId) { case 154: // Craft normal leather. Leather.craftNormalLeather(player, child, player.getInventory().getItemAmount(1741), true); break; case 542: // Glassblowing. int totalGlass = player.getInventory().getItemAmount(1775); switch(child) { case 40: // Make all beer glass. Glass.craftGlass(player, totalGlass, 0, true); break; case 41: // Make all candle lantern. Glass.craftGlass(player, totalGlass, 1, true); break; case 42: // Make all oil lamp. Glass.craftGlass(player, totalGlass, 2, true); break; case 38: // Make all vial. Glass.craftGlass(player, totalGlass, 3, true); break; case 44: // Make all Fishbowl Glass.craftGlass(player, totalGlass, 4, true); break; case 39: // Make all orb. Glass.craftGlass(player, totalGlass, 5, true); break; case 43: // Make all lantern lens Glass.craftGlass(player, totalGlass, 6, true); break; case 45: // Make all dorgeshuun light orb. Glass.craftGlass(player, totalGlass, 7, true); break; } break; case 763: // Bank inventory - 10. player.getBank().deposit(slot, 10); player.getBank().refreshBank(); break; case 762: // Bank - 10. player.getBank().withdraw(slot, 10); player.getBank().refreshBank(); break; case 336: // Trade/stake inventory - trade 10. if (player.getTrade() != null) { player.getTrade().tradeItem(slot, 10); break; } if (player.getDuel() != null) { player.getDuel().stakeItem(slot, 10); break; } break; case 335: // Trade interface - remove 10. player.getTrade().removeItem(slot, 10); break; case 631: // Duel interface - remove 10. if (player.getDuel() != null) { player.getDuel().removeItem(slot, 5); break; } break; case 620: // Shop - buy 5. player.getShopSession().buyItem(slot, 5); break; case 621: // Shop - sell 5. player.getShopSession().sellItem(slot, 5); break; case 590: // Clan chat setup Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername()); if (clan == null) { player.getPackets().sendMessage("Please create your clan chat before changing settings."); break; } switch(child) { case 23: // "Who can enter chat" - recruit. clan.setEnterRights(Clan.ClanRank.RECRUIT); player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23); break; case 24: // "Who can talk in chat" - recruit. clan.setTalkRights(Clan.ClanRank.RECRUIT); player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24); break; case 26: // "Who can share loot" - recruit. clan.setLootRights(Clan.ClanRank.RECRUIT); player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26); break; } break; } }
private void handleClickFour(Player player, Packet packet) { int interfaceId = packet.readUShort(); int child = packet.readUShort(); int slot = packet.readUShort(); Console.WriteLine("InterfaceOption 4: interfaceId: " + interfaceId); switch(interfaceId) { case 763: // Bank inventory - Custom amount. player.getBank().deposit(slot, player.getBank().getLastXAmount()); player.getBank().refreshBank(); break; case 762: // Bank - Custom amount. player.getBank().withdraw(slot, player.getBank().getLastXAmount()); player.getBank().refreshBank(); break; case 154: // Craft normal leather. player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(154, child)); break; case 542: // Glassblowing. switch(child) { case 40: // Make X beer glass. case 41: // Make X candle lantern. case 42: // Make X oil lamp. case 38: // Make X vial. case 44: // Make X Fishbowl case 39: // Make X orb. case 43: // Make X lantern lens case 45: // Make X dorgeshuun light orb. player.getPackets().displayEnterAmount(); player.setTemporaryAttribute("interfaceVariable", new EnterVariable(542, child)); break; } break; case 336: // Trade/stake inventory - trade all. if (player.getTrade() != null) { player.getTrade().tradeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot))); break; } if (player.getDuel() != null) { player.getDuel().stakeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot))); break; } break; case 335: // Trade interface - remove all. player.getTrade().removeItem(slot, player.getTrade().getItemAmount(player.getTrade().getItemInSlot(slot))); break; case 631: // Duel interface - remove All if (player.getDuel() != null) { player.getDuel().removeItem(slot, player.getDuel().getItemAmount(player.getDuel().getItemInSlot(slot))); break; } break; case 620: // Shop - buy 10. player.getShopSession().buyItem(slot, 10); break; case 621: // Shop - sell 10. player.getShopSession().sellItem(slot, 10); break; case 590: // Clan chat setup Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername()); if (clan == null) { player.getPackets().sendMessage("Please create your clan chat before changing settings."); break; } switch(child) { case 23: // "Who can enter chat" - corporal. clan.setEnterRights(Clan.ClanRank.CORPORAL); player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23); break; case 24: // "Who can talk in chat" - corporal. clan.setTalkRights(Clan.ClanRank.CORPORAL); player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24); break; case 25: // // "Who can kick in chat" - corporal. clan.setKickRights(Clan.ClanRank.CORPORAL); player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25); break; case 26: // "Who can share loot" - corporal. clan.setLootRights(Clan.ClanRank.CORPORAL); player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26); break; } break; } }
private void handleEquipItem(Player player, Packet packet) { int item = packet.readLEShort(); int slot = packet.readShortA(); int interfaceId = packet.readInt(); if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } SkillHandler.resetAllSkills(player); if (player.getInventory().getItemInSlot(slot) == item) { //player.getPackets().closeInterfaces(); if (RuneCraft.emptyPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot))) { return; } player.getEquipment().equipItem(player.getInventory().getItemInSlot(slot), slot); } }
protected static void getBarrowReward(Player p) { int barrowChance = misc.random(BARROWS_CHANCE); int killCount = p.getBarrowKillCount(); if (barrowChance == 0) { int reward = BARROW_REWARDS[misc.random(BARROW_REWARDS.Length - 1)]; p.getInventory().addItemOrGround(reward); } if (misc.random(20) == 0) { p.getInventory().addItemOrGround(1149); // Dragon med helm. } else if (misc.random(15) == 0) { int halfKey = misc.random(1) == 0 ? 985 : 987; p.getInventory().addItemOrGround(halfKey); // Half key. } if (misc.random(3) == 0 || p.getBarrowTunnel() == KARIL) { // Bolt racks. int amount = getAmountOfReward(4740, killCount); p.getInventory().addItemOrGround(4740, amount); } if (misc.random(3) == 0) { // Blood runes int amount = getAmountOfReward(565, killCount); p.getInventory().addItemOrGround(565, amount); } if (misc.random(2) == 0) { // Death runes int amount = getAmountOfReward(560, killCount); p.getInventory().addItemOrGround(560, amount); } if (misc.random(1) == 0) { // Chaos runes int amount = getAmountOfReward(562, killCount); p.getInventory().addItemOrGround(562, amount); } if (misc.random(1) == 0) { // Coins int amount = getAmountOfReward(995, killCount); p.getInventory().addItemOrGround(995, amount); } if (misc.random(1) == 0) { int amount = getAmountOfReward(558, killCount); // Mind runes. p.getInventory().addItemOrGround(558, amount); } }
public void pickupItem(Player p, int id, Location location) { GroundItem item = itemExists(location, id); if (item != null && p.getSprites().getPrimarySprite() == -1 && p.getSprites().getSecondarySprite() == -1) { if (item.getDefinition().isPlayerBound() && !item.getOwner().Equals(p)) { return; } if (!p.getInventory().addItem(item.getItemId(), item.getItemAmount())) { return; } clearGlobalItem(item); if (item.isRespawn()) { GroundItem i = item; Event itemRespawnEvent = new Event(60000); itemRespawnEvent.setAction(() => { GroundItem respawn = new GroundItem(i.getItemId(), i.getItemAmount(), i.getLocation(), null); respawn.setRespawn(true); respawn.setGlobal(true); newGlobalItem(respawn); itemRespawnEvent.stop(); }); } } }
public static bool dialogue(Player p, Npc npc, bool rightClickPay) { if ((npc.getId() != 1055 && npc.getId() != 437) || (rightClickPay && npc.getId() != 437)) { return false; } p.setEntityFocus(npc.getClientIndex()); AreaEvent dialogueAreaEvent = new AreaEvent(p, npc.getLocation().getX()-1, npc.getLocation().getY()-1, npc.getLocation().getX()+1, npc.getLocation().getY()+1); dialogueAreaEvent.setAction(() => { npc.setFaceLocation(p.getLocation()); int status = npc.getId() == 1055 ? 43 : 1; if (rightClickPay) { if (!p.getInventory().hasItemAmount(995, AGILITY_ARENA_PRICE)) { p.getPackets().sendMessage("You don't have enough money to pay the entrance fee."); return; } status = 29; } doDialogue(p, status); }); Server.registerCoordinateEvent(dialogueAreaEvent); return true; }
public bool tradeItem(int slot, int amount) { int itemId = player.getInventory().getItemInSlot(slot); bool stackable = ItemData.forId(itemId).isStackable(); int tradeSlot = findItem(itemId); if (amount <= 0 || itemId == -1 || status > 2) { return(false); } if (ItemData.forId(itemId).isPlayerBound()) { player.getPackets().sendMessage("You cannot trade that item."); return(false); } if (!stackable) { tradeSlot = findFreeSlot(); if (tradeSlot == -1) { player.getPackets().sendMessage("An error occured whilst trying to find free a trade slot."); return(false); } if (amount > player.getInventory().getItemAmount(itemId)) { amount = player.getInventory().getItemAmount(itemId); } for (int i = 0; i < amount; i++) { tradeSlot = findFreeSlot(); if (!player.getInventory().deleteItem(itemId) || tradeSlot == -1) { break; } items[tradeSlot] = new Item(itemId, 1); } if (status == 2 || player2.getTrade().getStatus() == 2) { this.status = 1; player2.getTrade().setStatus(1); player.getPackets().modifyText("", 335, 36); player2.getPackets().modifyText("", 335, 36); } refreshTrade(); return(true); } else if (stackable) { tradeSlot = findItem(itemId); if (tradeSlot == -1) { tradeSlot = findFreeSlot(); if (tradeSlot == -1) { player.getPackets().sendMessage("An error occured whilst trying to find free a trade slot."); return(false); } } if (amount > player.getInventory().getAmountInSlot(slot)) { amount = player.getInventory().getAmountInSlot(slot); } if (player.getInventory().deleteItem(itemId, amount)) { if (items[tradeSlot] == null) { items[tradeSlot] = new Item(itemId, amount); } else { if (items[tradeSlot].getItemId() == itemId) { items[tradeSlot].setItemId(itemId); items[tradeSlot].setItemAmount(items[tradeSlot].getItemAmount() + amount); } } if (status == 2 || player2.getTrade().getStatus() == 2) { this.status = 1; player2.getTrade().setStatus(1); player.getPackets().modifyText("", 335, 36); player2.getPackets().modifyText("", 335, 36); } refreshTrade(); return(true); } } return(false); }
private void handleItemOnNPC(Player player, Packet packet) { int interfaceId = packet.readInt(); int slot = packet.readLEShort(); int npcIndex = packet.readLEShort(); int item = packet.readLEShortA(); if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } Npc npc = Server.getNpcList()[npcIndex]; if (npc == null || npc.isDestroyed()) { return; } SkillHandler.resetAllSkills(player); player.getPackets().closeInterfaces(); Console.WriteLine("Item on NPC " + npc.getId()); if (player.getInventory().getItemInSlot(slot) == item) { switch(npc.getId()) { case 519: // Bob BrokenBarrows.talkToBob(player, npc, player.getInventory().getItemInSlot(slot), 0); break; } } }
private void handleItemOnItem(Player player, Packet packet) { int itemSlot = packet.readUShort(); int unused = packet.readInt(); int withSlot = packet.readLEShort(); int unused2 = packet.readInt(); int itemUsed = packet.readLEShortA(); int usedWith = packet.readLEShortA(); if (itemSlot > 28 || itemSlot < 0 || withSlot > 28 || withSlot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } SkillHandler.resetAllSkills(player); player.getPackets().closeInterfaces(); if (player.getInventory().getSlot(itemSlot).getItemId() == itemUsed && player.getInventory().getSlot(withSlot).getItemId() == usedWith) { if (Fletching.isFletching(player, itemUsed, usedWith)) { return; } else if (Herblore.doingHerblore(player, itemUsed, usedWith)) { return; } else if (Herblore.mixDoses(player, itemUsed, usedWith, itemSlot, withSlot)) { return; } else if (Crafting.wantsToCraft(player, itemUsed, usedWith)) { return; } else if (Firemaking.isFiremaking(player, itemUsed, usedWith, itemSlot, withSlot)) { return; } else if (Farming.plantSapling(player, itemUsed, usedWith)) { return; } else { player.getPackets().sendMessage("Nothing interesting happens."); } } }
public void useDoor(Player p, int doorId) { bool running = p.getWalkingQueue().isRunToggled(); if (doorId == 9369) { // main entrance int y = p.getLocation().getY() >= 5177 ? 5177 : 5175; CoordinateEvent mainEntranceCoordinateEvent = new CoordinateEvent(p, new Location(2399, y, 0)); mainEntranceCoordinateEvent.setAction(() => { p.getWalkingQueue().setRunToggled(false); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); p.setTemporaryAttribute("unmovable", true); p.getWalkingQueue().forceWalk(0, y == 5177 ? -2 : +2); Event useMainDoorEvent = new Event(1000); useMainDoorEvent.setAction(() => { useMainDoorEvent.stop(); p.removeTemporaryAttribute("unmovable"); p.getWalkingQueue().setRunToggled(running); }); Server.registerEvent(useMainDoorEvent); }); Server.registerCoordinateEvent(mainEntranceCoordinateEvent); } else if (doorId == 9368) { // game door int y = p.getLocation().getY() >= 5169 ? 5169 : 5167; CoordinateEvent gameDoorCoordinateEvent = new CoordinateEvent(p, new Location(2399, y, 0)); gameDoorCoordinateEvent.setAction(() => { if (playersPlaying.Count == 1) { sendNPCMessage(p, "Here is some TokKul, as a reward."); p.getInventory().addItemOrGround(6529, tokkulReward); } removePlayingPlayer(p); p.getWalkingQueue().setRunToggled(false); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); if (y == 5167) { p.getWalkingQueue().forceWalk(0, +2); } else { p.getPackets().sendMessage("You are unable to bypass the hot barrier."); return; } p.setTemporaryAttribute("unmovable", true); Event gameDoorEvent = new Event(1000); gameDoorEvent.setAction(() => { gameDoorEvent.stop(); p.removeTemporaryAttribute("unmovable"); p.getWalkingQueue().setRunToggled(running); p.getPackets().sendMessage("You leave the fight pit."); resetVariables(p); }); Server.registerEvent(gameDoorEvent); }); Server.registerCoordinateEvent(gameDoorCoordinateEvent); } }
public void newSellOffer(byte slot) { this.currentOffer = new SellOffer(slot, p.getLoginDetails().getLongName()); myGEItems[slot] = this.currentOffer; p.getPackets().sendConfig(1109, -1); p.getPackets().sendConfig(1110, 0); p.getPackets().sendConfig(1111, 0); p.getPackets().sendConfig(1112, slot); p.getPackets().sendConfig(1113, 1); p.getPackets().sendConfig(1114, 0); p.getPackets().sendConfig(1115, 0); p.getPackets().sendConfig(1116, 0); p.getPackets().displayInventoryInterface(107); p.getPackets().setRightClickOptions(1026, 107 * 65536 + 18, 0, 27); object[] opts = new object[] { "", "", "", "", "Offer", -1, 0, 7, 4, 93, 7012370 }; p.getPackets().sendClientScript(149, opts, "IviiiIsssss"); p.getPackets().sendItems(-1, 65535, 93, p.getInventory().getItems()); }
public static void showBobDialogue(Player p, int status) { p.getPackets().softCloseInterfaces(); int index = -1; int newStatus = -1; if (p.getTemporaryAttribute("bobsAxesBarrowItem") != null) { int item = (int)p.getTemporaryAttribute("bobsAxesBarrowItem"); index = getIndex(item); if (index == -1) { return; } else if (item == (int)DATA[index][0]) { p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("That item isn't broken..", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); return; } else if (item != (int)DATA[index][1]) { return; } } switch(status) { case 101: p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("That'll cost you " + ((int)DATA[index][2]).ToString("#,##0") + " gold coins to fix, are you sure?", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 102; break; case 102: p.getPackets().modifyText("Yes, I'm sure!", 557, 2); p.getPackets().modifyText("On second thoughts, no thanks.", 557, 3); p.getPackets().sendChatboxInterface2(557); newStatus = 103; break; case 103: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Yes, I'm sure!", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 104; break; case 104: if (!p.getInventory().hasItemAmount(995, (int)DATA[index][2])) { p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("You don't have enough money to pay for the repair!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; } else { if (!p.getInventory().hasItem((int)DATA[index][1])) { p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("The item seems to have gone from your inventory.", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; } else if (p.getInventory().deleteItem(995, (int)DATA[index][2])) { p.getInventory().replaceSingleItem((int)DATA[index][1], (int)DATA[index][0]); p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("There you go, happy doing business with you!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); p.getPackets().sendMessage("You pay Bob his fee and he repairs your " + (string)DATA[index][3] + "."); break; } } break; case 105: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("On second thoughts, no thanks.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 106; break; case 106: p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("Ok, but don't expect my prices to change anytime soon!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; case 107: p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("Hello there " + p.getLoginDetails().getUsername() + ", what can i do for you?", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 108; break; case 108: p.getPackets().modifyText("Could you please repair my Barrow item?", 230, 2); p.getPackets().modifyText("I'm interested in buying an axe.", 230, 3); p.getPackets().modifyText("Nevermind.", 230, 4); p.getPackets().sendChatboxInterface2(230); newStatus = 109; break; case 109: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Could you please repair my Barrow item?", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 110; break; case 110: p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("Certainly! Show me the item and i'll see what i can do.", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); break; case 111: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("I'm interested in buying an axe.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); newStatus = 112; break; case 112: p.getPackets().sendNPCHead(BOB_ID, 241, 2); p.getPackets().modifyText("Bob", 241, 3); p.getPackets().modifyText("What a coincidence! Axes are my speciality!", 241, 4); p.getPackets().animateInterface(9827, 241, 2); p.getPackets().sendChatboxInterface2(241); newStatus = 113; break; case 113: //TODO open bob's shop break; case 114: p.getPackets().sendPlayerHead(64, 2); p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3); p.getPackets().modifyText("Nevermind.", 64, 4); p.getPackets().animateInterface(9827, 64, 2); p.getPackets().sendChatboxInterface2(64); break; } if (newStatus != -1) { p.setTemporaryAttribute("dialogue", newStatus); } }
protected static void changeJewellery(Player p, JewellerySlot js) { bool gloryAmulet = js.index < 2; bool newItem = true; string s = js.index == 2 ? "Ring of Dueling" : js.index == 3 ? "Games necklace" : "Amulet of Glory"; for (int i = 0; i < JEWELLERY[js.index].Length; i++) { int charges = i; if (!js.wearing) { Item item = p.getInventory().getSlot(js.slot); if (item.getItemId() == JEWELLERY[js.index][i]) { if (gloryAmulet) { charges--; } string t = charges > 1 ? " charges" : " charge"; if (charges > 0) { p.getPackets().sendMessage("The " + s + " now has " + charges + t + " ."); } else if (gloryAmulet && charges == 0) { p.getPackets().sendMessage("The Amulet of Glory has run out of charges."); } else if (!gloryAmulet && charges <= 1) { newItem = false; p.getPackets().sendMessage("The " + s + " crumbles to dust."); p.getInventory().deleteItem(item.getItemId(), js.slot, 1); } if (newItem) { item.setItemId(JEWELLERY[js.index][i - 1]); p.getPackets().refreshInventory(); } break; } } else { Item item = p.getEquipment().getSlot((ItemData.EQUIP)js.slot); if (item.getItemId() == JEWELLERY[js.index][i]) { if (gloryAmulet) { charges--; } string t = charges > 1 ? " charges" : " charge"; if (charges > 0) { p.getPackets().sendMessage("The " + s + " now has " + charges + t + " ."); } else if (gloryAmulet && charges == 0) { p.getPackets().sendMessage("The Amulet of Glory has run out of charges."); } else if (!gloryAmulet && charges <= 1) { newItem = false; p.getPackets().sendMessage("The " + s + " crumbles to dust."); item.setItemId(-1); item.setItemAmount(0); } if (newItem) { item.setItemId(JEWELLERY[js.index][i - 1]); } p.getPackets().refreshEquipment(); break; } } } }