コード例 #1
0
ファイル: ItemPacketHandler.java プロジェクト: Ventuz/vscape
  private void handleClick1(Player player, Packet packet) {
    int interfaceID = packet.getIn().readShort(StreamBuffer.ValueType.A);
    player.setSlot(packet.getIn().readShort(StreamBuffer.ValueType.A));
    int itemId = packet.getIn().readShort(StreamBuffer.ValueType.A);
    RSInterface inter = RSInterface.forId(interfaceID);
    switch (interfaceID) {
      case 4233: // make 1 ring crafting
        GemCrafting.startCrafter(player, GemData.getGemSlot()[player.getSlot()], 1, 0);
        break;
      case 4239: // make 1 neckalce crafting
        GemCrafting.startCrafter(player, GemData.getGemSlot()[player.getSlot()], 1, 1);
        break;
      case 4245: // make 1 amulet crafting
        GemCrafting.startCrafter(player, GemData.getGemSlot()[player.getSlot()], 1, 2);
        break;
      case 18821: // make 1 bracelet crafting
        GemCrafting.startCrafter(player, GemData.getGemSlot()[player.getSlot()], 1, 3);
        break;
    }
    if (!player.hasInterfaceOpen(inter)) {
      // player.getActionSender().removeInterfaces();

      return;
    }
    if (interfaceID == 1119
        || interfaceID == 1120
        || interfaceID == 1121
        || interfaceID == 1122
        || interfaceID == 1123) {
      // player.getSmithing().smithItem(itemId, 1);
      SmithBars.startSmithing(player, itemId, 1);
    }
    if (interfaceID == 1688) {
      player.getEquipment().unequip(player.getSlot());
    } else if (interfaceID == 5064 || interfaceID == 7423) {
      BankManager.bankItem(player, player.getSlot(), itemId, 1);
    } else if (interfaceID == 5382) {
      BankManager.withdrawItem(player, player.getSlot(), itemId, 1);
    } else if (interfaceID == 3900) {
      ShopManager.getBuyValue(player, itemId);
    } else if (interfaceID == 3823) {
      ShopManager.getSellValue(player, itemId);
    } else if (interfaceID == 3322) {
      if (player.getStatedInterface() == "duel")
        player.getDuelMainData().stakeItem(new Item(itemId, 1), player.getSlot());
      else TradeManager.offerItem(player, player.getSlot(), itemId, 1);
    } else if (interfaceID == 3415) {
      TradeManager.removeTradeItem(player, player.getSlot(), itemId, 1);
    } else if (interfaceID == 15682 || interfaceID == 15683) {
      player.getFarmingTools().withdrawItems(itemId, 1);
    } else if (interfaceID == 15594 || interfaceID == 15595) {
      player.getFarmingTools().storeItems(itemId, 1);
    } else if (interfaceID == 6669) {
      player.getDuelMainData().removeStakedItem(new Item(itemId, 1));
    }
  }
コード例 #2
0
ファイル: ItemPacketHandler.java プロジェクト: Ventuz/vscape
  private void useItemOnItem(Player player, Packet packet) {
    int itemSecondClickSlot = packet.getIn().readShort();
    int itemFirstClickSlot = packet.getIn().readShort(StreamBuffer.ValueType.A);
    packet.getIn().readShort();
    packet.getIn().readShort();
    if (itemFirstClickSlot > 28 || itemSecondClickSlot > 28) {
      return;
    }
    Item firstClickItem = player.getInventory().getItemContainer().get(itemFirstClickSlot);
    Item secondClickItem = player.getInventory().getItemContainer().get(itemSecondClickSlot);
    if (firstClickItem == null
        || secondClickItem == null
        || !firstClickItem.validItem()
        || !secondClickItem.validItem()) return;
    int firstItem = firstClickItem.getId();
    int secondItem = secondClickItem.getId();
    if (player.getDuelMainData().getOpponent() != null) {
      player.getDuelInteraction().endDuelInteraction(true);
      return;
    }
    if (OneIngredients.mixItems(
        player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return;
    if (TwoIngredients.mixItems(
        player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return;
    if (ThreeIngredients.mixItems(
        player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return;
    if (DoughHandler.handleInterface(
        player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return;
    /* Fletching */
    if (ArrowMaking.perform(player, firstItem, secondItem)) return;
    if (BowStringing.perform(player, firstItem, secondItem)) return;
    if (LogCuttingInterfaces.handleItemOnItem(player, firstItem, secondItem)) return;
    if (CbowFletching.attachLimbs(player, firstItem, secondItem)
        || CbowFletching.stringCbow(player, firstItem, secondItem)) return;
    if (GemTips.handleCutting(
        player,
        firstItem,
        secondItem,
        firstItem != GemTips.CHISEL ? itemFirstClickSlot : itemSecondClickSlot)) return;
    /* Crafting */
    if (GemCutting.handleCutting(
        player,
        firstItem,
        secondItem,
        firstItem != GemCutting.CHISEL ? itemFirstClickSlot : itemSecondClickSlot)) return;
    if (LeatherMakingHandler.handleItemOnItem(
        player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) return;
    if (BasicCraft.handleItemOnItem(player, firstItem, secondItem)) return;
    if ((firstItem == GlassMaking.GLASSBLOWING_PIPE && secondItem == GlassMaking.MOLTEN_GLASS)
        || (secondItem == GlassMaking.GLASSBLOWING_PIPE && firstItem == GlassMaking.MOLTEN_GLASS)) {
      Menus.sendSkillMenu(player, "glassMaking");
      return;
    }
    /* STRINGING AMULETS */
    for (int i = 0; i < GemData.stringItems.length; i++) {
      if (GemData.stringItems[i][0] == firstItem || GemData.stringItems[i][0] == secondItem) {
        GemCrafting.string(player, i);
        return;
      }
    }
    if (ElementalWorkshop.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (ShieldOfArrav.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (DragonSlayer.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (GoblinDiplomacy.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (PiratesTreasure.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (ErnestTheChicken.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (GhostsAhoy.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (AnimalMagnetism.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (TabHandler.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    if (wetClayHandler.itemOnItemHandling(player, firstItem, secondItem)) {
      return;
    }
    /* Farming */
    if (player
        .getSeedling()
        .placeSeedInPot(
            firstClickItem.getId(),
            secondClickItem.getId(),
            itemFirstClickSlot,
            itemSecondClickSlot)) {
      return;
    }
    if (player
        .getSeedling()
        .waterSeedling(
            firstClickItem.getId(),
            secondClickItem.getId(),
            itemFirstClickSlot,
            itemSecondClickSlot)) {
      return;
    }
    if (player
        .getItemOnItem()
        .handleItemOnItem(
            firstClickItem, secondClickItem, itemFirstClickSlot, itemSecondClickSlot)) {
      return;
    }
    if (Tools.attachTool(player, firstItem, secondItem)) {
      player.getActionSender().sendMessage("You put together the head and handle.");
      return;
    }
    /*Slayer*/
    if (player.getSlayer().handleItemOnItem(firstItem, secondItem)) {
      return;
    }
    /* Herblore */
    if (PotionMaking.createPotion(
        player, firstClickItem, secondClickItem, itemFirstClickSlot, itemSecondClickSlot)) {
      return;
    }
    if (Grinding.createProduct(
        player, firstClickItem, secondClickItem, itemFirstClickSlot, itemSecondClickSlot)) {
      return;
    }
    if (PoisoningWeapon.handlePoison(player, firstClickItem, secondClickItem)) {
      return;
    }
    if (Coconut.handleCoconut(player, firstClickItem, secondClickItem)) {
      return;
    }
    if (PotionMaking.combineDose(
        player, firstItem, secondItem, itemFirstClickSlot, itemSecondClickSlot)) {
      return;
    }
    /* Firemaking */
    if (firstItem == 590 || secondItem == 590) {
      if (firstItem == 596 && secondItem == 596) {
        if (player.getInventory().removeItem(new Item(596))) {
          player.getInventory().addItem(new Item(594));
          player.getActionSender().sendMessage("You light the torch.");
          return;
        }
      }
      if (firstItem == 36 && secondItem == 36) {
        if (player.getInventory().removeItem(new Item(36))) {
          player.getInventory().addItem(new Item(33));
          player.getActionSender().sendMessage("You light the candle.");
          return;
        }
      }
      player
          .getFiremaking()
          .attemptFire(
              firstItem,
              secondItem,
              false,
              player.getPosition().getX(),
              player.getPosition().getY(),
              player.getPosition().getZ());
      return;
    }

    if (GodBook.addPageToBook(
        player, firstClickItem, secondClickItem, itemFirstClickSlot, itemSecondClickSlot)) {
      return;
    }
    if (firstClickItem.getId() == 1765 && secondClickItem.getId() == 2421) {
      player.getActionSender().sendMessage("You carefully dye the wig blonde.");
      player.getInventory().removeItem(new Item(2421));
      player.getInventory().removeItem(new Item(1765));
      player.getInventory().addItem(new Item(2419));
      return;
    }
    if (firstClickItem.getId() == 1973 && secondClickItem.getId() == 233) {
      player
          .getActionSender()
          .sendMessage("You use your pestle and mortar to turn the chocolate to dust.");
      player.getInventory().removeItem(new Item(1973));
      player.getInventory().addItem(new Item(1975));
      return;
    }
    if (firstClickItem.getId() == 946 && secondClickItem.getId() == 1973) {
      player.getActionSender().sendMessage("You use your knife to turn the chocolate to dust.");
      player.getInventory().removeItem(new Item(1973));
      player.getInventory().addItem(new Item(1975));
      return;
    }
    player.getActionSender().sendMessage("Nothing interesting happens.");
  }
コード例 #3
0
ファイル: ElementalWorkshop.java プロジェクト: Ventuz/vscape
 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;
 }