예제 #1
0
 public static final Item getItemType(Player player, String exactItem) {
   String metal = smithMetal[player.getSmithInterface()];
   int id = ItemManager.getInstance().getItemId(metal + " " + exactItem);
   if (id == -1) {
     if (metal.equalsIgnoreCase("adamant")) {
       id = ItemManager.getInstance().getItemId("addy " + exactItem);
     }
   }
   if (id == -1) {
     if (metal.equalsIgnoreCase("adamant")) {
       id = ItemManager.getInstance().getItemId("adamantite " + exactItem);
     }
   }
   if (id == -1) {
     if (metal.equalsIgnoreCase("rune")) {
       id = ItemManager.getInstance().getItemId("runite " + exactItem);
     }
   }
   if (id == -1) {
     if (metal.equalsIgnoreCase("steel") && exactItem.equalsIgnoreCase("Steel studs")) {
       id = ItemManager.getInstance().getItemId(exactItem);
     }
   }
   return new Item(id);
 }
예제 #2
0
 private void handlePickupItem(Player player, Packet packet) {
   player.setClickY(packet.getIn().readShort(StreamBuffer.ByteOrder.LITTLE));
   player.setClickId(packet.getIn().readShort());
   player.setClickX(packet.getIn().readShort(StreamBuffer.ByteOrder.LITTLE));
   player.setClickZ(player.getPosition().getZ());
   if (!player.getInventory().canAddItem(new Item(player.getClickId()))) {
     return;
   }
   if (ClueScroll.hasClue(player)
       && new Item(player.getClickId())
           .getDefinition()
           .getName()
           .toLowerCase()
           .contains("clue scroll")) {
     player.getActionSender().sendMessage("You can only pick up one scroll at a time.");
     return;
   }
   if (DemonSlayer.itemPickupHandling(player, player.getClickId())) {
     return;
   }
   if ((Boolean) player.getAttributes().get("canPickup")) {
     ItemManager.getInstance()
         .pickupItem(
             player,
             player.getClickId(),
             new Position(player.getClickX(), player.getClickY(), player.getPosition().getZ()));
   }
 }
예제 #3
0
 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;
 }