Thread: "You do not have the required items to do this"

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 "You do not have the required items to do this" 
    Registered Member DivideByZero's Avatar
    Join Date
    Oct 2014
    Posts
    47
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    When I try to:

    - Bury bones
    - Use XP Lamps
    - And possibly other unknown items

    I get this message:

    Code:
    You do not have the required items to do this.
    Here's my Burying class

    Code:
    package com.feather.game.player.content;
    
    import java.util.HashMap;
    import java.util.Map;
    
    import com.feather.cache.parser.ItemDefinitions;
    import com.feather.game.Animation;
    import com.feather.game.item.Item;
    import com.feather.game.player.Player;
    import com.feather.game.player.Skills;
    import com.feather.game.tasks.WorldTask;
    import com.feather.game.tasks.WorldTasksManager;
    import com.feather.utils.Utils;
    
    public class Burying {
    
    	public enum Bone {
    		NORMAL(526, 100),
    
    		BURNT(528, 100),
    
    		WOLF(2859, 100),
    
    		MONKEY(3183, 125),
    
    		BAT(530, 125),
    
    		BIG(532, 200),
    
    		JOGRE(3125, 200),
    
    		ZOGRE(4812, 250),
    
    		SHAIKAHAN(3123, 300),
    
    		BABY(534, 350),
    
    		WYVERN(6812, 400),
    
    		DRAGON(536, 500),
    
    		FAYRG(4830, 525),
    
    		RAURG(4832, 550),
    
    		DAGANNOTH(6729, 650),
    
    		OURG(4834, 750),
    
    		FROST_DRAGON(18830, 850);
    
    		private int id;
    		private double experience;
    
    		private static Map<Integer, Bone> bones = new HashMap<Integer, Bone>();
    
    		static {
    			for (Bone bone : Bone.values()) {
    				bones.put(bone.getId(), bone);
    			}
    		}
    
    		public static Bone forId(int id) {
    			return bones.get(id);
    		}
    
    		private Bone(int id, double experience) {
    			this.id = id;
    			this.experience = experience;
    		}
    
    		public int getId() {
    			return id;
    		}
    
    		public double getExperience() {
    			return experience;
    		}
    		
    		public static final Animation BURY_ANIMATION = new Animation(827);
    
    		public static void bury(final Player player, int inventorySlot) {
    			final Item item = player.getInventory().getItem(inventorySlot);
    			if (item == null || Bone.forId(item.getId()) == null)
    				return;
    			if (player.getBoneDelay() > Utils.currentTimeMillis())
    				return;
    			final Bone bone = Bone.forId(item.getId());
    			final ItemDefinitions itemDef = new ItemDefinitions(item.getId());
    			player.addBoneDelay(3000);
    			player.getPackets().sendSound(2738, 0, 1);
    			player.setNextAnimation(BURY_ANIMATION);
    			player.getPackets().sendGameMessage(
    					"You dig a hole in the ground...");
    			WorldTasksManager.schedule(new WorldTask() {
    				@Override
    				public void run() {
    					player.getPackets().sendGameMessage(
    							"You bury the " + itemDef.getName().toLowerCase());
    					player.getInventory().deleteItem(item.getId(), 1);
    					double xp = bone.getExperience() * player.getAuraManager().getPrayerMultiplier();
    					player.getSkills().addXp(Skills.PRAYER, xp);
    					Double lastPrayer = (Double) player.getTemporaryAttributtes().get("current_prayer_xp");
    					if (lastPrayer == null) {
    						lastPrayer = 0.0;
    					}
    					double total = xp + lastPrayer;
    					int amount = (int) (total / 500);
    					if (amount != 0) {
    						double restore = player.getAuraManager().getPrayerRestoration() * (player.getSkills().getLevelForXp(Skills.PRAYER) * 10);
    						player.getPrayer().restorePrayer((int) (amount * restore));
    						total -= amount * 500;
    					}
    					player.getTemporaryAttributtes().put("current_prayer_xp", total);
    					stop();
    				}
    
    			}, 2);
    		}
    	}
    }
    My XP Lamp class

    Code:
    package com.feather.game.player.content;
    
    import com.feather.Settings;
    import com.feather.cache.parser.ItemDefinitions;
    import com.feather.game.item.Item;
    import com.feather.game.player.Player;
    import com.feather.game.player.Skills;
    
    /**
     * 
     * @author Tyler, Justin, & Clayton
     * 
     */
    public class XPLamp {
    
    	Player player;
    	private static int itemId;
    	private static int slotId;
    	private static int giantExp[] = { 499, 612, 616, 680, 746, 832, 984, 1016, 1142, 1228, 1360, 1504, 1645, 1832, 2016, 2093, 2192, 2280, 2384, 2480, 2596, 2696, 2816, 2940, 3071, 3192, 3331, 3312, 3624, 3784, 3946, 4112, 4288, 4129, 4664, 4872, 5080, 5296, 5532, 5764, 6016, 6276, 6544, 6828, 7116, 7432, 7764, 8100, 7440, 8808, 9185, 9600, 9996, 10436, 10896, 11376, 11880, 12368, 12932, 13474, 14060, 14684, 15290, 16036, 16864, 17372, 18152, 19032, 19760, 20741, 21543, 22474, 23572, 24657, 25709, 26716, 27960, 29173, 30338, 31840, 33328, 34780, 36174, 38097, 39347, 40264, 43003, 44739, 47380, 48972, 51612, 52916, 55428, 57887, 60260, 64516, 66780, 68815, 68815 };
    
    	public XPLamp(Player player, int itemId, int slotId) {
    		XPLamp.itemId = itemId;
    		this.player = player;
    		XPLamp.slotId = slotId;
    	}
    
    	public void openInterface(final Player player, boolean xp) {
    		XPLamp.xp = xp;
    		player.getInterfaceManager().sendInterface(1263);
    		player.getPackets().sendIComponentText(1263, 6, "Xlite");
    		for (int i = 0; i < 40; i++) {
    			if (i == 35) {
    				continue;
    			}
    			player.getPackets().sendIComponentSettings(1263, i, 0, 300, 2150);
    		}
    	}
    
    	public static final int ATTACK = 0, DEFENCE = 1, STRENGTH = 2, HITPOINTS = 3, RANGE = 4, PRAYER = 5, MAGIC = 6, COOKING = 7, WOODCUTTING = 8, FLETCHING = 9, FISHING = 10, FIREMAKING = 11, CRAFTING = 12, SMITHING = 13, MINING = 14, HERBLORE = 15, AGILITY = 16, THIEVING = 17, SLAYER = 18, FARMING = 19, RUNECRAFTING = 20, CONSTRUCTION = 22, HUNTER = 21, SUMMONING = 23, DUNGEONEERING = 24;
    
    	public static void handleButtons(Player player, int buttonId) {
    		int component = buttonId - 13;
    		int[][] EXP_LAMP = { { 0, ATTACK }, { 1, MAGIC }, { 2, MINING }, { 3, WOODCUTTING }, { 4, AGILITY }, { 5, FLETCHING }, { 6, THIEVING }, { 7, STRENGTH }, { 8, RANGE }, { 9, SMITHING }, { 10, FIREMAKING }, { 11, HERBLORE }, { 12, SLAYER }, { 13, CONSTRUCTION }, { 14, DEFENCE }, { 15, PRAYER }, { 16, FISHING }, { 17, CRAFTING }, { 18, FARMING }, { 19, HUNTER }, { 20, SUMMONING }, { 21, HITPOINTS }, { 22, DUNGEONEERING }, { 23, COOKING },// For
    																																																																																																																// women
    				{ 24, RUNECRAFTING }, };
    		ItemDefinitions defs = ItemDefinitions.getItemDefinitions(itemId);
    		if (defs.getName().toLowerCase().contains("shiny")) {
    			int skillId = EXP_LAMP[component][1];
    			if (skillId == 19 || skillId == 22 || skillId == 21 || skillId == 24) {
    				player.getPackets().sendGameMessage("You cannot add experience to that skill.");
    				player.closeInterfaces();
    				return;
    			}
    			if (xp) {
    				player.getSkills().addXp(skillId, 1000000 / Settings.XP_RATE);
    				player.closeInterfaces();
    				player.getInventory().deleteItem(slotId, new Item(itemId));
    				player.getDialogueManager().startDialogue("SimpleMessage", "1m xp has been granted in " + Skills.SKILL_NAME[skillId]);
    			}
    
    		}
    		if (defs.getName().equalsIgnoreCase("Small XP lamp")) {
    			int skillId = EXP_LAMP[component][1];
    			int x = player.getSkills().getLevel(skillId);
    			if (skillId == 19 || skillId == 22 || skillId == 21 || skillId == 24) {
    				player.getPackets().sendGameMessage("You cannot add experience to that skill.");
    				player.closeInterfaces();
    				return;
    			}
    			if (x != 2) {
    
    				player.getSkills().addXp(skillId, (giantExp[x - 1] / 8) / 2);
    				player.getDialogueManager().startDialogue("SimpleMessage", giantExp[x - 1] / 8 + " xp has been granted in " + Skills.SKILL_NAME[skillId]);
    			} else {
    
    				player.getSkills().addXp(skillId, 69 / 2);
    			}
    			player.closeInterfaces();
    			player.getInventory().deleteItem(slotId, new Item(itemId));
    		} else if (defs.getName().equalsIgnoreCase("Medium XP lamp")) {
    			int skillId = EXP_LAMP[component][1];
    			int x = player.getSkills().getLevel(skillId);
    			if (skillId == 19 || skillId == 22 || skillId == 21 || skillId == 24) {
    				player.getPackets().sendGameMessage("You cannot add experience to that skill.");
    				player.closeInterfaces();
    				return;
    			}
    			if (x != 2) {
    
    				player.getSkills().addXp(skillId, (giantExp[x - 1] / 4) / 2);
    				player.getDialogueManager().startDialogue("SimpleMessage", giantExp[x - 1] / 4 + " xp has been granted in " + Skills.SKILL_NAME[skillId]);
    			} else {
    
    				player.getSkills().addXp(skillId, 138 / 2);
    			}
    			player.closeInterfaces();
    			player.getInventory().deleteItem(slotId, new Item(itemId));
    		} else if (defs.getName().equalsIgnoreCase("Large XP lamp")) {
    			int skillId = EXP_LAMP[component][1];
    			int x = player.getSkills().getLevel(skillId);
    			if (skillId == 19 || skillId == 22 || skillId == 21 || skillId == 24) {
    				player.getPackets().sendGameMessage("You cannot add experience to that skill.");
    				player.closeInterfaces();
    				return;
    			}
    			if (x != 2) {
    
    				player.getSkills().addXp(skillId, (giantExp[x - 1] / 2) / 2);
    				player.getDialogueManager().startDialogue("SimpleMessage", giantExp[x - 1] / 2 + " xp has been granted in " + Skills.SKILL_NAME[skillId]);
    			} else {
    
    				player.getSkills().addXp(skillId, 276 / 2);
    			}
    			player.closeInterfaces();
    			player.getInventory().deleteItem(slotId, new Item(itemId));
    		} else if (defs.getName().equalsIgnoreCase("Huge XP lamp")) {
    			int skillId = EXP_LAMP[component][1];
    			int x = player.getSkills().getLevel(skillId);
    			if (skillId == 19 || skillId == 22 || skillId == 21 || skillId == 24) {
    				player.getPackets().sendGameMessage("You cannot add experience to that skill.");
    				player.closeInterfaces();
    				return;
    			}
    			if (x != 2) {
    
    				player.getSkills().addXp(skillId, (giantExp[x - 1]) / 2);
    				player.getDialogueManager().startDialogue("SimpleMessage", giantExp[x - 1] + " xp has been granted in " + Skills.SKILL_NAME[skillId]);
    			} else {
    
    				player.getSkills().addXp(skillId, (giantExp[x - 1]) / 2);
    			}
    			player.closeInterfaces();
    			player.getInventory().deleteItem(slotId, new Item(itemId));
    		}
    	}
    
    	private static boolean xp;
    
    }
    Not sure what other code to provide but this is really starting to annoy me because I can't seem to fix it.

    Any suggestions would be very appreciated.

    Also if you need to see any other code just ask ^-^
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2013
    Posts
    4,409
    Thanks given
    59
    Thanks received
    478
    Rep Power
    138
    Find the message "You do not have the required items to do this." and post the surroundings of it.
    Reply With Quote  
     

  3. #3  
    Success is the worst teacher

    Santa Hat's Avatar
    Join Date
    Oct 2012
    Age
    27
    Posts
    3,334
    Thanks given
    807
    Thanks received
    1,185
    Rep Power
    190
    Post your InventoryOptionsHandler class aswell


    Reply With Quote  
     

  4. #4  
    Registered Member DivideByZero's Avatar
    Join Date
    Oct 2014
    Posts
    47
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    InventoryOptionsHandler
    Code:
    package com.feather.net.decoders.handlers;
    
    import java.util.List;
    
    import com.feather.game.player.content.combining.VineWhip;
    import com.feather.Settings;
    import com.feather.content.utils.ToyHorsey;
    import com.feather.cores.WorldThread;
    import com.feather.game.Animation;
    import com.feather.game.World;
    import com.feather.game.WorldTile;
    import com.feather.game.item.Item;
    import com.feather.game.npc.NPC;
    import com.feather.game.npc.familiar.Familiar.SpecialAttack;
    import com.feather.game.npc.pet.Pet;
    import com.feather.game.player.ClueScrolls;
    import com.feather.game.player.CoordsEvent;
    import com.feather.game.player.Equipment;
    import com.feather.game.player.Inventory;
    import com.feather.game.player.LendingManager;
    import com.feather.game.player.Player;
    import com.feather.game.player.actions.BoxAction;
    import com.feather.game.player.actions.Firemaking;
    import com.feather.game.player.actions.Fletching;
    import com.feather.game.player.actions.GemCutting;
    import com.feather.game.player.actions.HerbCleaning;
    import com.feather.game.player.actions.Herblore;
    import com.feather.game.player.actions.LeatherCrafting;
    import com.feather.game.player.actions.Summoning;
    import com.feather.game.player.actions.BoxAction.HunterEquipment;
    import com.feather.game.player.actions.Fletching.Fletch;
    import com.feather.game.player.actions.GemCutting.Gem;
    import com.feather.game.player.actions.Summoning.Pouches;
    import com.feather.game.player.content.AncientEffigies;
    import com.feather.game.player.content.ArmourSets;
    import com.feather.game.player.content.Dicing;
    import com.feather.game.player.content.Foods;
    import com.feather.game.player.content.Lend;
    import com.feather.game.player.content.Magic;
    import com.feather.game.player.content.Pots;
    import com.feather.game.player.content.Runecrafting;
    import com.feather.game.player.content.SkillCapeCustomizer;
    import com.feather.game.player.content.ArmourSets.Sets;
    import com.feather.game.player.controlers.Barrows;
    import com.feather.game.player.controlers.FightKiln;
    import com.feather.game.tasks.WorldTask;
    import com.feather.game.tasks.WorldTasksManager;
    import com.feather.io.InputStream;
    import com.feather.utils.Logger;
    import com.feather.utils.Utils;
    
    public class InventoryOptionsHandler {
    
    	public static void handleItemOption2(final Player player, final int slotId,
    			final int itemId, Item item) {
    		if (Firemaking.isFiremaking(player, itemId))
    			return;
    
    		if (itemId == 5733) {
    			player.getDialogueManager().startDialogue("RottenPotato"); 
    			return;
    		}
    		
    		if (itemId >= 5509 && itemId <= 5514) {
    			int pouch = -1;
    			if (itemId == 5509)
    				pouch = 0;
    			if (itemId == 5510)
    				pouch = 1;
    			if (itemId == 5512)
    				pouch = 2;
    			if (itemId == 5514)
    				pouch = 3;
    			Runecrafting.emptyPouch(player, pouch);
    			player.stopAll(false);
    		} else if (itemId >= 15086 && itemId <= 15100) {
    			Dicing.handleRoll(player, itemId, true); 
    			return;
    		} else {
    			if (player.isEquipDisabled())
    				return;
    			long passedTime = Utils.currentTimeMillis()
    					- WorldThread.LAST_CYCLE_CTM;
    			WorldTasksManager.schedule(new WorldTask() {
    
    				@Override
    				public void run() {
    					List<Integer> slots = player.getSwitchItemCache();
    					int[] slot = new int[slots.size()];
    					for (int i = 0; i < slot.length; i++)
    						slot[i] = slots.get(i);
    					player.getSwitchItemCache().clear();
    					ButtonHandler.sendWear(player, slot);
    					player.stopAll(false, true, false);
    				}
    			}, passedTime >= 600 ? 0 : passedTime > 330 ? 1 : 0);
    			if (player.getSwitchItemCache().contains(slotId))
    				return;
    			player.getSwitchItemCache().add(slotId);
    		}
    	}
    	
    	public static void dig(final Player player) {
    		player.resetWalkSteps();
    		player.setNextAnimation(new Animation(830));
    		player.lock();
    		WorldTasksManager.schedule(new WorldTask() {
    
    			@Override
    			public void run() {
    				player.unlock();
    				if (Barrows.digIntoGrave(player))
    					return;
    				if(player.getX() == 3005 && player.getY() == 3376
    						|| player.getX() == 2999 && player.getY() == 3375
    						|| player.getX() == 2996 && player.getY() == 3377
    						|| player.getX() == 2989 && player.getY() == 3378
    						|| player.getX() == 2987 && player.getY() == 3387
    						|| player.getX() == 2984 && player.getY() == 3387) {
    					if (ClueScrolls.digSpot(player)){
    						return;
    					}
    					//mole
    					player.setNextWorldTile(new WorldTile(1752, 5137, 0));
    					player.getPackets().sendGameMessage("You seem to have dropped down into a network of mole tunnels.");
    					return;
    				}
    				if (ClueScrolls.digSpot(player)){
    					return;
    				}
    				player.getPackets().sendGameMessage("You find nothing.");
    			}
    			
    		});
    	}
    
    	public static void handleItemOption1(Player player, final int slotId,
    			final int itemId, Item item) {
    		long time = Utils.currentTimeMillis();
    		if (player.getLockDelay() >= time
    				|| player.getEmotesManager().getNextEmoteEnd() >= time)
    			return;
    		player.stopAll(false);
    		/**
    		 * 
    		 * @author Nolan
    		 * Craft Option Click
    		 * 
    		 */
    		if (GemCutting.isCutting(player, itemId))
                        return;		
    		if (Fletching.isFletching(player, itemId))
    	            return;
    		for (int i: ClueScrolls.ScrollIds){
    			if (itemId == i){
    				if (ClueScrolls.Scrolls.getMap(itemId) != null){
    					ClueScrolls.showMap(player, ClueScrolls.Scrolls.getMap(itemId));
    					return;
    				}
    				if (ClueScrolls.Scrolls.getObjMap(itemId) != null){
    					ClueScrolls.showObjectMap(player, ClueScrolls.Scrolls.getObjMap(itemId));
    					return;
    				}
    				if (ClueScrolls.Scrolls.getRiddles(itemId) != null){
    					ClueScrolls.showRiddle(player, ClueScrolls.Scrolls.getRiddles(itemId));
    					return;
    				}
    			}
    			
    		}
    				if (itemId == 2717){
    					ClueScrolls.giveReward(player);
    				}
    		if (Foods.eat(player, item, slotId))
    			return;
    		if (itemId >= 15086 && itemId <= 15100) {
    			Dicing.handleRoll(player, itemId, false); 
    			return;
    		}
    		if (itemId == 6199) {
    			int[] Common = {113, 121, 444, 536, 534, 628, 667, 847, 2460, 2651}; //dont forget to put "," between item id's!
    			int[] Uncommon = {855, 868, 1005, 1027, 1028, 1029, 1030, 2462, 2464, 3840};
    			int[] Rare = {1052, 1305, 1712, 2487, 2503, 2890, 4158};
    			int[] SuperRare = {1038, 1037, 1419, 2513, 2520, 4037, 4039, 4151};
    			int[] Legendary = {1040, 1042, 1044, 1046, 1048, 1053, 1055, 1057};
    			player.getInventory().deleteItem(6199, 1);
    	        int rarity = Utils.getRandom(1000);
    			if (rarity > 0 && rarity <= 500)  {
    			    int length = Common.length;
    				length--;
    			    int reward = Utils.getRandom(length);
    	            player.getInventory().addItem(Common[reward], 1);
    			player.getPackets().sendGameMessage("You've receive a Common item from the Mystery Box!");			
    			}
    			if (rarity > 500 && rarity <= 700)  {
    			    int length = Uncommon.length;
    				length--;
    			    int reward = Utils.getRandom(length);
    				player.getInventory().addItem(Uncommon[reward], 1);
    	        player.getPackets().sendGameMessage("You've received a Uncommon item from the Mystery Box!");
    			}
    			if (rarity > 700 && rarity <= 900)  {
    			    int length = Rare.length;
    				length--;
    			    int reward = Utils.getRandom(length);
    				player.getInventory().addItem(Rare[reward], 1);
    			player.getPackets().sendGameMessage("You've received a Rare item from the Mystery Box!");
    			}
    			if (rarity > 900 && rarity <= 990)  {
    			    int length = SuperRare.length;
    				length--;
    			    int reward = Utils.getRandom(length);
    				player.getInventory().addItem(SuperRare[reward], 1);
    			player.getPackets().sendGameMessage("You've received a Super Rare item from the Mystery Box!");
    			}
    			if (rarity > 990 && rarity <= 1000)  {
    			    int length = Legendary.length;
    				length--;
    			    int reward = Utils.getRandom(length);
    				player.getInventory().addItem(Legendary[reward], 1);
    			player.getPackets().sendGameMessage("You've received a Legendary item from the Mystery Box!");
    			}
    			return;
    			}
    		if (Pots.pot(player, item, slotId))
    			return;
    		if (itemId >= 5509 && itemId <= 5514) {
    			int pouch = -1;
    			if (itemId == 5509)
    				pouch = 0;
    			if (itemId == 5510)
    				pouch = 1;
    			if (itemId == 5512)
    				pouch = 2;
    			if (itemId == 5514)
    				pouch = 3;
    			Runecrafting.fillPouch(player, pouch);
    			return;
    		}
    		if (itemId == 2520) {
    			ToyHorsey.play(player);
    		}
    		if (itemId == 2522) {
    			ToyHorsey.play(player);
    		}
    	
    		if (itemId == 2524) {
    			ToyHorsey.play(player);
    		}
    		
    		if (itemId == 2526) {
    			ToyHorsey.play(player);
    		}
    		if (itemId == 22370) {
    			Summoning.openDreadnipInterface(player);
    		}
    		if (itemId == 952) {// spade
    			dig(player);
    			return;
    		}
    		if (HerbCleaning.clean(player, item, slotId))
    			return;
    		if (Magic.useTabTeleport(player, itemId))
    			return;
    		if (itemId == AncientEffigies.SATED_ANCIENT_EFFIGY
    				|| itemId == AncientEffigies.GORGED_ANCIENT_EFFIGY
    				|| itemId == AncientEffigies.NOURISHED_ANCIENT_EFFIGY
    				|| itemId == AncientEffigies.STARVED_ANCIENT_EFFIGY)
    			player.getDialogueManager().startDialogue("AncientEffigiesD",
    					itemId);
    		else if (itemId == 4155)
    			player.getDialogueManager().startDialogue("EnchantedGemDialouge");
    		else if (itemId >= 23653 && itemId <= 23658)
    			FightKiln.useCrystal(player, itemId);
    		else if (itemId == 1856) {// Information Book
    			player.getInterfaceManager().sendInterface(275);
    			player.getPackets()
    					.sendIComponentText(275, 2, Settings.SERVER_NAME);
    			player.getPackets().sendIComponentText(275, 16,
    					"Welcome to " + Settings.SERVER_NAME + ".");
    			player.getPackets().sendIComponentText(275, 17,
    					"If you need help with commands, use ::commands");
    			player.getPackets().sendIComponentText(275, 18,
    					"You can find the rules at ::rules");
    			player.getPackets().sendIComponentText(275, 19,
    					"Stuck? Use ::unstuck or ::home!");
    			player.getPackets().sendIComponentText(275, 20,
    					"You can change your prayers and spells at home.");
    			player.getPackets().sendIComponentText(275, 21,
    					"If you need any help, do ::ticket. (Don't abuse it)");
    			player.getPackets().sendIComponentText(275, 22,
    					"at start of your message on public chat.");
    			player.getPackets().sendIComponentText(275, 22,
    					"By the way you can compare your ::score with your friends.");
    			player.getPackets().sendIComponentText(275, 23,
    					"Oh and yea, don't forget to ::vote and respect rules.");
    			player.getPackets().sendIComponentText(275, 24, "");
    			player.getPackets().sendIComponentText(275, 25,
    					"Website: " + Settings.WEBSITE_LINK);
    			player.getPackets().sendIComponentText(275, 26, "");
    			player.getPackets().sendIComponentText(275, 27,
    					"Enjoy your time on " + Settings.SERVER_NAME + ".");
    			player.getPackets().sendIComponentText(275, 28,
    					"<img=1> Staff Team");
    			player.getPackets().sendIComponentText(275, 29, "<img=2> Owner : Zero");
    			player.getPackets().sendIComponentText(275, 30, "");
    		//	player.getPackets().sendIComponentText(275, 14,
    					//"<u>Visit Website</u>");
    			for (int i = 31; i < 300; i++)
    				player.getPackets().sendIComponentText(275, i, "");
    		} else if (itemId == HunterEquipment.BOX.getId()) // almost done
    			player.getActionManager().setAction(new BoxAction(HunterEquipment.BOX));
    		else if (itemId == HunterEquipment.BRID_SNARE.getId())
    			player.getActionManager().setAction(
    					new BoxAction(HunterEquipment.BRID_SNARE));
    		else if (item.getDefinitions().getName().startsWith("Burnt")) 
    			player.getDialogueManager().startDialogue("SimplePlayerMessage", "Ugh, this is inedible.");
    		
    		if (Settings.DEBUG)
    			Logger.log("ItemHandler", "Item Select:" + itemId + ", Slot Id:"
    					+ slotId);
    	}
    
    	/*
    	 * returns the other
    	 */
    	public static Item contains(int id1, Item item1, Item item2) {
    		if (item1.getId() == id1)
    			return item2;
    		if (item2.getId() == id1)
    			return item1;
    		return null;
    	}
    
    	public static boolean contains(int id1, int id2, Item... items) {
    		boolean containsId1 = false;
    		boolean containsId2 = false;
    		for (Item item : items) {
    			if (item.getId() == id1)
    				containsId1 = true;
    			else if (item.getId() == id2)
    				containsId2 = true;
    		}
    		return containsId1 && containsId2;
    	}
    
    	public static void handleItemOnItem(final Player player, InputStream stream) {
    		int itemUsedWithId = stream.readShort();
    		int toSlot = stream.readShortLE128();
    		int interfaceId = stream.readInt() >> 16;
    		int interfaceId2 = stream.readInt() >> 16;
    		int fromSlot = stream.readShort();
    		int itemUsedId = stream.readShortLE128();
    		if ((interfaceId2 == 747 || interfaceId2 == 662)
    				&& interfaceId == Inventory.INVENTORY_INTERFACE) {
    			if (player.getFamiliar() != null) {
    				player.getFamiliar().setSpecial(true);
    				if (player.getFamiliar().getSpecialAttack() == SpecialAttack.ITEM) {
    					if (player.getFamiliar().hasSpecialOn())
    						player.getFamiliar().submitSpecial(toSlot);
    				}
    			}
    			return;
    		}
    		if (interfaceId == Inventory.INVENTORY_INTERFACE
    				&& interfaceId == interfaceId2
    				&& !player.getInterfaceManager().containsInventoryInter()) {
    			if (toSlot >= 28 || fromSlot >= 28)
    				return;
    			Item usedWith = player.getInventory().getItem(toSlot);
    			Item itemUsed = player.getInventory().getItem(fromSlot);
    			if (itemUsed == null || usedWith == null
    					|| itemUsed.getId() != itemUsedId
    					|| usedWith.getId() != itemUsedWithId)
    				return;
    			player.stopAll();
    			if (!player.getControlerManager().canUseItemOnItem(itemUsed,
    					usedWith))
    				return;
    			Fletch fletch = Fletching.isFletching(usedWith, itemUsed);
    			if (fletch != null) {
    				player.getDialogueManager().startDialogue("FletchingD", fletch);
    				return;
    			}
    			int herblore = Herblore.isHerbloreSkill(itemUsed, usedWith);
    			if (herblore > -1) {
    				player.getDialogueManager().startDialogue("HerbloreD",
    						herblore, itemUsed, usedWith);
    				return;
    			}
    			if (itemUsed.getId() == LeatherCrafting.NEEDLE.getId()
    					|| usedWith.getId() == LeatherCrafting.NEEDLE.getId()) {
    				if (LeatherCrafting
    						.handleItemOnItem(player, itemUsed, usedWith)) {
    					return;
    				}
    			}
    			if (itemUsed.getName().equals("Whip vine")
    					&& usedWith.getName().contains("Abyssal whip")) {
    				VineWhip.combine(player, itemUsed.getId());
    				return;
    			}
    			Sets set = ArmourSets.getArmourSet(itemUsedId, itemUsedWithId);
    			if (set != null) {
    				ArmourSets.exchangeSets(player, set);
    				return;
    			}
    			if (Firemaking.isFiremaking(player, itemUsed, usedWith))
    				return;
    			else if (contains(1755, Gem.OPAL.getUncut(), itemUsed, usedWith))
    				GemCutting.cut(player, Gem.OPAL);
    			else if (contains(1755, Gem.JADE.getUncut(), itemUsed, usedWith))
    				GemCutting.cut(player, Gem.JADE);
    			else if (contains(1755, Gem.RED_TOPAZ.getUncut(), itemUsed,
    					usedWith))
    				GemCutting.cut(player, Gem.RED_TOPAZ);
    			else if (contains(1755, Gem.SAPPHIRE.getUncut(), itemUsed, usedWith))
    				GemCutting.cut(player, Gem.SAPPHIRE);
    			else if (contains(1755, Gem.EMERALD.getUncut(), itemUsed, usedWith))
    				GemCutting.cut(player, Gem.EMERALD);
    			else if (contains(1755, Gem.RUBY.getUncut(), itemUsed, usedWith))
    				GemCutting.cut(player, Gem.RUBY);
    			else if (contains(1755, Gem.DIAMOND.getUncut(), itemUsed, usedWith))
    				GemCutting.cut(player, Gem.DIAMOND);
    			else if (contains(1755, Gem.DRAGONSTONE.getUncut(), itemUsed,
    					usedWith))
    				GemCutting.cut(player, Gem.DRAGONSTONE);
    			else if (contains(1755, Gem.ONYX.getUncut(), itemUsed, usedWith))
    				GemCutting.cut(player, Gem.ONYX);
    			else
    				player.getPackets().sendGameMessage(
    						"Nothing interesting happens.");
    			if (Settings.DEBUG)
    				Logger.log("ItemHandler", "Used:" + itemUsed.getId()
    						+ ", With:" + usedWith.getId());
    		}
    	}
    
    	public static void handleItemOption3(Player player, int slotId, int itemId,
    			Item item) {
    		long time = Utils.currentTimeMillis();
    		if (player.getLockDelay() >= time
    				|| player.getEmotesManager().getNextEmoteEnd() >= time)
    			return;
    		player.stopAll(false);
    		if (itemId == 20767 || itemId == 20769 || itemId == 20771)
    			SkillCapeCustomizer.startCustomizing(player, itemId);
    		else if(itemId >= 15084 && itemId <= 15100)
    			player.getDialogueManager().startDialogue("DiceBag", itemId);
    		else if(itemId == 24437 || itemId == 24439 || itemId == 24440 || itemId == 24441) 
    			player.getDialogueManager().startDialogue("FlamingSkull", item, slotId);
    		else if (Equipment.getItemSlot(itemId) == Equipment.SLOT_AURA)
    			player.getAuraManager().sendTimeRemaining(itemId);
    	}
    
    	public static void handleItemOption4(Player player, int slotId, int itemId,
    			Item item) {
    		System.out.println("Option 4");
    	}
    
    	public static void handleItemOption5(Player player, int slotId, int itemId,
    			Item item) {
    		System.out.println("Option 5");
    	}
    
    	public static void handleItemOption6(Player player, int slotId, int itemId,
    			Item item) {
    		long time = Utils.currentTimeMillis();
    		if (player.getLockDelay() >= time
    				|| player.getEmotesManager().getNextEmoteEnd() >= time)
    			return;
    		player.stopAll(false);
    		Pouches pouches = Pouches.forId(itemId);
    		if (pouches != null)
    			Summoning.spawnFamiliar(player, pouches);
    		else if (itemId == 1438)
    			Runecrafting.locate(player, 3127, 3405);
    		else if (itemId == 1440)
    			Runecrafting.locate(player, 3306, 3474);
    		else if (itemId == 1442)
    			Runecrafting.locate(player, 3313, 3255);
    		else if (itemId == 1444)
    			Runecrafting.locate(player, 3185, 3165);
    		else if (itemId == 1446)
    			Runecrafting.locate(player, 3053, 3445);
    		else if (itemId == 1448)
    			Runecrafting.locate(player, 2982, 3514);
    		else if (itemId <= 1712 && itemId >= 1706 || itemId >= 10354
    				&& itemId <= 10362)
    			player.getDialogueManager().startDialogue("Transportation",
    					"Edgeville", new WorldTile(3087, 3496, 0), "Karamja",
    					new WorldTile(2918, 3176, 0), "Draynor Village",
    					new WorldTile(3105, 3251, 0), "Al Kharid",
    					new WorldTile(3293, 3163, 0), itemId);
    		else if (itemId == 995) {
    			if (item.getAmount() < 0) {
    				return;
    			}
    			player.getPouch().handleMoneyPouch(false, false, false,
    					player.getInventory().getNumberOf(995), 0);
    		}
    		else if (itemId == 1704 || itemId == 10352)
    			player.getPackets()
    					.sendGameMessage(
    							"The amulet has ran out of charges. You need to recharge it if you wish it use it once more.");
    		else if (itemId >= 3853 && itemId <= 3867)
    			player.getDialogueManager().startDialogue("Transportation",
    					"Burthrope Games Room", new WorldTile(2880, 3559, 0),
    					"Barbarian Outpost", new WorldTile(2519, 3571, 0),
    					"Gamers' Grotto", new WorldTile(2970, 9679, 0),
    					"Corporeal Beast", new WorldTile(2886, 4377, 0), itemId);
    	}
    
    	public static void handleItemOption7(Player player, int slotId, int itemId,
    			Item item) {
    		long time = Utils.currentTimeMillis();
    		if (player.getLockDelay() >= time
    				|| player.getEmotesManager().getNextEmoteEnd() >= time)
    			return;
    		if (!player.getControlerManager().canDropItem(item))
    			return;
    		player.stopAll(false);
    		if (item.getDefinitions().isOverSized()) {
    			player.getPackets().sendGameMessage("The item appears to be oversized.");
    			player.getInventory().deleteItem(item);
    			return;
    		}
    		if (LendingManager.isLendedItem(player, item)) {
    			Lend lend;
    			if ((lend = LendingManager.getLend(player)) != null) {
    				if (lend.getItem().getDefinitions().getLendId() == item.getId()) {
    					player.getDialogueManager().startDialogue("DiscardLend",
    							lend);
    					return;
    				}
    			}
    			return;
    		}
    		if (item.getDefinitions().isDestroyItem()) {
    			player.getDialogueManager().startDialogue("DestroyItemOption",
    					slotId, item);
    			return;
    		}
    		if (player.getPetManager().spawnPet(itemId, true)) {
    			return;
    		}
    		player.getInventory().deleteItem(slotId, item);
    		if (player.getCharges().degradeCompletly(item))
    			return;
    		World.addGroundItem(item, new WorldTile(player), player, false, 180,
    				true);
    		player.getPackets().sendSound(2739, 0, 1);
    	}
    	
    	public static void handleItemOption8(Player player, int slotId, int itemId,
    			Item item) {
    		player.getInventory().sendExamine(slotId);
    	}
    
    	public static void handleItemOnNPC(final Player player, final NPC npc, final Item item) {
    		if (item == null) {
    			return;
    		}
    		player.setCoordsEvent(new CoordsEvent(npc, new Runnable() {
    			@Override
    			public void run() {
    				if (!player.getInventory().containsItem(item.getId(), item.getAmount())) {
    					return;
    				}
    				if (npc instanceof Pet) {
    					player.faceEntity(npc);
    					player.getPetManager().eat(item.getId(), (Pet) npc);
    					return;
    				}
    			}
    		}, npc.getSize()));
    	}
    
    public static void handleItemOnPlayer(final Player player,
    		final Player usedOn, final int itemId) {
    	player.setCoordsEvent(new CoordsEvent(usedOn, new Runnable() {
    		public void run() {
    			player.faceEntity(usedOn);
    			if (usedOn.getInterfaceManager().containsScreenInter()) {
    				player.getPackets().sendGameMessage(usedOn.getDisplayName() + " is busy at the moment.");
    				return;
    			}
    //			if (!usedOn.hasAcceptAid()) {
    //				player.getPackets().sendGameMessage(usedOn.getDisplayName()
    //						+ " doesn't want to accept your items.");
    //				return;
    //			}
    			switch (itemId) {
    			case 962: // Christmas cracker
    				if (player.getInventory().getFreeSlots() < 3
    						|| usedOn.getInventory().getFreeSlots() < 3) {
    					player.getPackets().sendGameMessage((player.getInventory()
    							.getFreeSlots() < 3 ? "You do"
    							: "The other player does")
    							+ " not have enough inventory space to pull this cracker.");
    					return;
    				}
    				player.getDialogueManager().startDialogue(
    						"ChristmasCracker", usedOn, itemId);
    				break;
    			default:
    				player.getPackets().sendGameMessage("Nothing interesting happens.");
    				break;
    			}
    		}
    	}, usedOn.getSize()));
    }
    }

    And the message comes up in my Fletching Class and my Gemcutting Class

    Fletching
    Code:
    public static boolean isFletching(Player player, int logId) {
    	       for (Fletch fletch : Fletch.values()) {
    	           if (!player.getInventory().containsItem(KNIFE, 1)) {
    	                player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                return false;
    	                }       
    	           if (fletch.getId() == logId) {
    	                 player.getDialogueManager().startDialogue("FletchingD", fletch);
    	                 return true;
    	                }
    	           }
    	         return false;
    	     }
    Gemcutting
    Code:
    public static boolean isCutting(Player player, int uncut) {
    	       for (Gem gem : Gem.values()) {
    	           if (!player.getInventory().containsItem(CHISEL, 1)){
                             player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                return false;
    	                }       
    		   if (gem.getUncut() == uncut){
    	                player.getDialogueManager().startDialogue("GemCuttingD", gem);
    	                return true;
    	                }
    	           }
    	         return false;
    	     }
    Also, I just realized, it's sending the message twice

    Code:
    You do not have the required items to do this
    You do not have the required items to do this
    And it only comes up in those two codes. Is somehow my Bones and XP lamp checking for a chisel and Knife?

    EDIT:

    When I have either a Knife or Chisel in my inventory it only sends
    Code:
    You do not have the required items to do this
    Once instead of twice. So for some reason it thinks I'm trying to fletch or cut a gem?
    Reply With Quote  
     

  5. #5  
    Super Donator
    Kova+'s Avatar
    Join Date
    Jan 2012
    Posts
    937
    Thanks given
    124
    Thanks received
    249
    Rep Power
    13
    In your inventory options handler you're probably missing a return which is making the code continue onto the other methods, making it cut a gem/fletch a log.
    "Real programmers don't comment their code. If it was hard to write, it should be hard to understand." - Unkown
    “ Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ” - Martin Fowler
    Reply With Quote  
     

  6. #6  
    Registered Member DivideByZero's Avatar
    Join Date
    Oct 2014
    Posts
    47
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Kova+ View Post
    In your inventory options handler you're probably missing a return which is making the code continue onto the other methods, making it cut a gem/fletch a log.
    Code:
    if (GemCutting.isCutting(player, itemId))
                return;		
    		if (Fletching.isFletching(player, itemId))
            return;
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Jan 2014
    Posts
    376
    Thanks given
    49
    Thanks received
    111
    Rep Power
    106
    Change this:
    Code:
    public static boolean isFletching(Player player, int logId) {
    	       for (Fletch fletch : Fletch.values()) {
    	           if (!player.getInventory().containsItem(KNIFE, 1)) {
    	                player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                return false;
    	                }       
    	           if (fletch.getId() == logId) {
    	                 player.getDialogueManager().startDialogue("FletchingD", fletch);
    	                 return true;
    	                }
    	           }
    	         return false;
    	     }
    to this:
    Code:
    public static boolean isFletching(Player player, int logId) {
    	       for (Fletch fletch : Fletch.values()) {      
    	           if (fletch.getId() == logId) {
    	                if (!player.getInventory().containsItem(KNIFE, 1)) {
    	                     player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                     return false;
    	                } 
    	                 player.getDialogueManager().startDialogue("FletchingD", fletch);
    	                 return true;
    	                }
    	           }
    	         return false;
    	     }
    And this:
    Code:
    public static boolean isCutting(Player player, int uncut) {
    	       for (Gem gem : Gem.values()) {
    	           if (!player.getInventory().containsItem(CHISEL, 1)){
                             player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                return false;
    	                }       
    		   if (gem.getUncut() == uncut){
    	                player.getDialogueManager().startDialogue("GemCuttingD", gem);
    	                return true;
    	                }
    	           }
    	         return false;
    	     }
    to this:
    Code:
    public static boolean isCutting(Player player, int uncut) {
    	       for (Gem gem : Gem.values()) {
    		   if (gem.getUncut() == uncut){
    	                if (!player.getInventory().containsItem(CHISEL, 1)) {
    	                     player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                     return false;
    	                } 
    	                player.getDialogueManager().startDialogue("GemCuttingD", gem);
    	                return true;
    	                }
    	           }
    	         return false;
    	     }
    Basically, you're checking for a knife/chisel before you even figure out whether you've clicked on a log/gem 0_o
    Reply With Quote  
     

  8. #8  
    Registered Member DivideByZero's Avatar
    Join Date
    Oct 2014
    Posts
    47
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Sundays211 View Post
    Change this:
    Code:
    public static boolean isFletching(Player player, int logId) {
    	       for (Fletch fletch : Fletch.values()) {
    	           if (!player.getInventory().containsItem(KNIFE, 1)) {
    	                player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                return false;
    	                }       
    	           if (fletch.getId() == logId) {
    	                 player.getDialogueManager().startDialogue("FletchingD", fletch);
    	                 return true;
    	                }
    	           }
    	         return false;
    	     }
    to this:
    Code:
    public static boolean isFletching(Player player, int logId) {
    	       for (Fletch fletch : Fletch.values()) {      
    	           if (fletch.getId() == logId) {
    	                if (!player.getInventory().containsItem(KNIFE, 1)) {
    	                     player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                     return false;
    	                } 
    	                 player.getDialogueManager().startDialogue("FletchingD", fletch);
    	                 return true;
    	                }
    	           }
    	         return false;
    	     }
    And this:
    Code:
    public static boolean isCutting(Player player, int uncut) {
    	       for (Gem gem : Gem.values()) {
    	           if (!player.getInventory().containsItem(CHISEL, 1)){
                             player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                return false;
    	                }       
    		   if (gem.getUncut() == uncut){
    	                player.getDialogueManager().startDialogue("GemCuttingD", gem);
    	                return true;
    	                }
    	           }
    	         return false;
    	     }
    to this:
    Code:
    public static boolean isCutting(Player player, int uncut) {
    	       for (Gem gem : Gem.values()) {
    		   if (gem.getUncut() == uncut){
    	                if (!player.getInventory().containsItem(CHISEL, 1)) {
    	                     player.getPackets().sendGameMessage("You do not have the required items to do this.");
    	                     return false;
    	                } 
    	                player.getDialogueManager().startDialogue("GemCuttingD", gem);
    	                return true;
    	                }
    	           }
    	         return false;
    	     }
    Basically, you're checking for a knife/chisel before you even figure out whether you've clicked on a log/gem 0_o

    WOW lol thanks bro I can't believe I didn't realize that xD
    Reply With Quote  
     

  9. #9  
    Registered Member DivideByZero's Avatar
    Join Date
    Oct 2014
    Posts
    47
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Still unable to bury bones. But at least now it's not sending those messages.
    Also still can't use XP lamps.
    Reply With Quote  
     

  10. #10  
    Registered Member

    Join Date
    Jan 2014
    Posts
    376
    Thanks given
    49
    Thanks received
    111
    Rep Power
    106
    Quote Originally Posted by DragonFallZero View Post
    Still unable to bury bones. But at least now it's not sending those messages.
    Also still can't use XP lamps.
    Unless I'm missing something, it doesn't look like you're calling the Burying.Bone.bury() method from within your InventoryOptionHandler class. I presume it's the same thing with the xp lamps...
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 50
    Last Post: 04-01-2013, 04:52 PM
  2. Replies: 3
    Last Post: 01-31-2012, 08:33 AM
  3. armour not having the right requirements
    By OodlesOfNoodles in forum Help
    Replies: 0
    Last Post: 11-22-2011, 06:37 PM
  4. Replies: 8
    Last Post: 02-17-2009, 05:06 PM
  5. Replies: 6
    Last Post: 06-10-2008, 10:04 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •