Thread: 562 Packets...

Results 1 to 7 of 7
  1. #1 562 Packets... 
    Donator

    Sambu's Avatar
    Join Date
    Apr 2013
    Posts
    405
    Thanks given
    705
    Thanks received
    38
    Rep Power
    135
    Im having problem with Ostava 562's packets.

    Code:
    [Mon Dec 01 00:53:11 EET 2014] Missing packet 150, expected size: 0, actual size: -4
    Invalid size for PacketId 150. Size guessed to be 0
    Invalid size for PacketId 150. Size guessed to be 1
    [Mon Dec 01 00:53:13 EET 2014] Missing packet 150, expected size: 1, actual size: -4
    [Mon Dec 01 00:53:15 EET 2014] Missing packet 163, expected size: 18, actual size: -4
    Invalid size for PacketId 163. Size guessed to be 18
    Invalid size for PacketId 163. Size guessed to be 18
    [Mon Dec 01 00:53:16 EET 2014] Missing packet 163, expected size: 18, actual size: -4
    [Mon Dec 01 00:53:17 EET 2014] Missing packet 163, expected size: 18, actual size: -4
    Invalid size for PacketId 41. Size guessed to be 4
    [Mon Dec 01 01:02:01 EET 2014] Missing packet 41, expected size: 4, actual size: -4
    Its also talking about packet 49, 150, 149 and 151 that doesnt even exist when i click around and walking packet i fixed myself. Also server is throwing me out when i click alot and fast (but when i click slower it still lets me walk around)
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Nov 2014
    Posts
    31
    Thanks given
    7
    Thanks received
    1
    Rep Power
    11
    I'm not sure about those packets, however how did you fix your clicking and walking packetId mismatches. Im having the same issue with my server.

    GL, if I find out Ill be sure to return the favor.
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Dec 2012
    Posts
    2,999
    Thanks given
    894
    Thanks received
    921
    Rep Power
    2555
    Can you post your packet handling method along with packet sizes
    Attached image
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Nov 2014
    Posts
    4
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    server just protecting you from fake packet senders, who wants to flood ya server, so when someone sending to your server alot packets , server will kick off him.
    Reply With Quote  
     

  5. #5  
    Donator

    Sambu's Avatar
    Join Date
    Apr 2013
    Posts
    405
    Thanks given
    705
    Thanks received
    38
    Rep Power
    135
    Quote Originally Posted by Kaleem View Post
    Can you post your packet handling method along with packet sizes
    Sure, btw sorry for late response had a long week at work.

    Packets and their sizes:
    Code:
    public final class WorldPacketsDecoder extends Decoder {
    
    	private static final byte[] PACKET_SIZES = new byte[256];
    	
    	private final static int WALKING_PACKET = 119;
    	private final static int WORLD_MAP_CLICKING_PACKET = 148;
    	public static final int MINI_MAP_WALK_PACKET = 163;
    	private final static int WEIRD_WALKING_PACKET = 160;
    	private final static int AFK_PACKET = 244;
    	public final static int ACTION_BUTTON1_PACKET = 216;
    	public final static int ACTION_BUTTON2_PACKET = 205;
    	private final static int WEAR_ITEM_PACKET = 229;
    	public final static int ACTION_BUTTON3_PACKET = 3;
    	public final static int ACTION_BUTTON4_PACKET = 19;
    	public final static int ACTION_BUTTON5_PACKET = 193;
    	public final static int ACTION_BUTTON6_PACKET = 76;
    	public final static int ACTION_BUTTON7_PACKET = 173;
    	private final static int ACTION_BUTTON8_PACKET = 89;
    	private final static int ACTION_BUTTON9_PACKET = 221;
    	private final static int PLAYER_TRADE_OPTION_PACKET = 141;
    	private final static int PLAYER_OPTION4_PACKET = 114;
    	private final static int MOVE_CAMERA_PACKET = 235;
    	private final static int CLICK_PACKET = 87;
    	private final static int CLOSE_INTERFACE_PACKET = 91;
    	private final static int COMMANDS_PACKET = 171;
    	private final static int IN_OUT_SCREEN_PACKET = 4;
    	private final static int INTER_PACKET_COUNT_CHECKER_PACKET = 5;
    	private final static int SWITCH_DETAIL = 155;
    	private final static int DONE_LOADING_REGION = 116;
    	private final static int PING_PACKET = 255;
    	private final static int SCREEN_PACKET = 170;
    	private final static int PUBLIC_CHAT_PACKET = 182;
    	private final static int QUICK_CHAT_PACKET = 68;
    	private final static int ADD_FRIEND_PACKET = 226;
    	private final static int REMOVE_FRIEND_PACKET = 92;
    	private final static int SEND_FRIEND_MESSAGE_PACKET = 123;
    	private final static int OBJECT_CLICK1_PACKET = 45;
    	private final static int OBJECT_CLICK2_PACKET = 190;
    	private final static int OBJECT_CLICK3_PACKET = 26;
    	private final static int NPC_CLICK1_PACKET = 217;
    	private final static int NPC_CLICK2_PACKET = 254;
    	private final static int ATTACK_NPC = 207;//207
    	private final static int ATTACK_PLAYER = 152;
    	private final static int PLAYER_OPTION_2_PACKET = 140;
    	private final static int ITEM_DROP_PACKET = 248;
    	private final static int ITEM_ON_ITEM_PACKET = 117;
    	private final static int ITEM_SELECT_PACKET = 66;
    	private final static int ITEM_ON_OBJECT_PACKET = 202;
    	private final static int ITEM_OPERATE_PACKET = 29;//189
    	private final static int ITEM_OPERATE1_PACKET = 189;//189
    	private final static int ITEM_ON_NPC_PACKET = 136;//189
    	private final static int ITEM_TAKE_PACKET = 194;
    	private final static int DIALOGUE_CONTINUE_PACKET = 147;
    	private final static int ENTER_INTEGER_PACKET = 206;
    	private final static int SWITCH_INTERFACE_ITEM_PACKET = 253;
    	private final static int ITEM_OPTION1_PACKET = 234;
    	private final static int INTERFACE_ON_PLAYER = 79;
    	private final static int INTERFACE_ON_NPC = 84;
    
    	private static final int MINI_WALKING_PACKET = 0;
    	static {
    		loadPacketSizes();
    	}
    	
    	public static void loadPacketSizes() {
    		for(int id = 0; id < 256; id++)
    			PACKET_SIZES[id] = -4;
    		PACKET_SIZES[AFK_PACKET] = 0;
    		PACKET_SIZES[ACTION_BUTTON1_PACKET] = 6;
    		PACKET_SIZES[WORLD_MAP_CLICKING_PACKET] = 18;
    		PACKET_SIZES[WEIRD_WALKING_PACKET] = 4;
    		PACKET_SIZES[ACTION_BUTTON2_PACKET] = 4;
    		PACKET_SIZES[WEAR_ITEM_PACKET] = 8;
    		PACKET_SIZES[ACTION_BUTTON3_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON4_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON5_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON6_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON7_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON8_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON9_PACKET] = 6;
    		PACKET_SIZES[CLICK_PACKET] = 6;
    		PACKET_SIZES[CLOSE_INTERFACE_PACKET] = 0;
    		PACKET_SIZES[COMMANDS_PACKET] = -1;
    		PACKET_SIZES[IN_OUT_SCREEN_PACKET] = 1;
    		PACKET_SIZES[INTER_PACKET_COUNT_CHECKER_PACKET] = 2;
    		PACKET_SIZES[PING_PACKET] = 0;
    		PACKET_SIZES[MINI_WALKING_PACKET] = -1;
    		PACKET_SIZES[WALKING_PACKET] = 4;
    		PACKET_SIZES[SCREEN_PACKET] = 6;
    		PACKET_SIZES[SWITCH_DETAIL] = 4;
    		PACKET_SIZES[DONE_LOADING_REGION] = 0;
    		PACKET_SIZES[PUBLIC_CHAT_PACKET] = -1;
    		PACKET_SIZES[QUICK_CHAT_PACKET] = -1;
    		PACKET_SIZES[ADD_FRIEND_PACKET] = -1;
    		PACKET_SIZES[REMOVE_FRIEND_PACKET] = -1;
    		PACKET_SIZES[SEND_FRIEND_MESSAGE_PACKET] = -1;
    		PACKET_SIZES[OBJECT_CLICK1_PACKET] = 7;
    		PACKET_SIZES[OBJECT_CLICK2_PACKET] = 7;
    		PACKET_SIZES[OBJECT_CLICK3_PACKET] = 6;
    		PACKET_SIZES[ITEM_DROP_PACKET] = 8;
    		PACKET_SIZES[ITEM_ON_ITEM_PACKET] = 16;
    		PACKET_SIZES[ITEM_SELECT_PACKET] = 8;
    		PACKET_SIZES[ITEM_OPERATE_PACKET] = 8;
    		PACKET_SIZES[ITEM_OPERATE1_PACKET] = 8;
    		PACKET_SIZES[ITEM_ON_NPC_PACKET] = 11;
    		PACKET_SIZES[ITEM_ON_OBJECT_PACKET] = 16;//16
    		PACKET_SIZES[ITEM_TAKE_PACKET] = 7;
    		PACKET_SIZES[DIALOGUE_CONTINUE_PACKET] = 6;
    		PACKET_SIZES[MOVE_CAMERA_PACKET] = 4;
    		PACKET_SIZES[ENTER_INTEGER_PACKET] = 4;
    		PACKET_SIZES[PLAYER_TRADE_OPTION_PACKET] = 3;
    		PACKET_SIZES[PLAYER_OPTION4_PACKET] = 3;
    		PACKET_SIZES[PLAYER_OPTION_2_PACKET] = 3;
    		PACKET_SIZES[SWITCH_INTERFACE_ITEM_PACKET] = 9;
    		PACKET_SIZES[ATTACK_NPC] = 3;
    		PACKET_SIZES[ATTACK_PLAYER] = 0;
    		PACKET_SIZES[NPC_CLICK1_PACKET] = 3;
    		PACKET_SIZES[NPC_CLICK2_PACKET] = 3;
    		PACKET_SIZES[ITEM_OPTION1_PACKET] = 8;
    		PACKET_SIZES[INTERFACE_ON_PLAYER] = 9;
    		PACKET_SIZES[INTERFACE_ON_NPC] = 9;
    	}
    ButtonHandler1
    Code:
    package com.rs.net.decoders.handlers;
    
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    
    public class ButtonHandler {
    
    	public static void sendRemove(Player player, int slotId) {
    		if (slotId >= 15)
    			return;
    		player.stopAll(false, false);
    		Item item = player.getEquipment().getItem(slotId);
    		if (item == null
    				|| !player.getInventory().addItem(item.getId(),
    						item.getAmount()))
    			return;
    		player.getEquipment().getItems().set(slotId, null);
    		player.getEquipment().refresh(slotId);
    		player.getAppearence().generateAppearenceData();
    		/*if (Runecrafting.isTiara(item.getId()))
    			player.getPackets().sendConfig(491, 0);*/
    		if (slotId == 3)
    			player.getCombatDefinitions().desecreaseSpecialAttack(0);
    		
    
    }
    }
    Buttonhandler2
    Code:
    package com.rs.net.decoders.handlers;
    
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    import com.rs.game.player.actions.Firemaking;
    import com.rs.io.InputStream;
    
    public class Buttonhandler2 {
    
    	@SuppressWarnings("unused")
    	public static void itemOnItem(final Player player, final InputStream stream) {
    		final int interfaceIndex = stream.readShort();
    		stream.readShort();
    		int fromSlot = stream.readShort();
    		int toSlot = stream.readShort();
    		int itemUsed = stream.readShortLE128() & 0xFFFF;
    		stream.readShort();
    		int toInterfaceIndex = stream.readShortLE();
    		int usedWith = stream.readShortLE() & 0xFFFF;
    		if (interfaceIndex != 149 && toInterfaceIndex != 149) {
    			return;
    		}
    		Item usedWith1 = player.getInventory().getItem(usedWith);
    			Item itemUsed1 = player.getInventory().getItem(itemUsed);
    			
    			if (Firemaking.isFiremaking(player, itemUsed1, usedWith1))
    				return;
    			else
    				//System.out.println("ITEM 1: " +itemUsed1+ " ITEM 2: " +usedWith1);
    			System.out.println("ITEM 1 kes 2e5tek: " +itemUsed1+ " ITEM 2: " +usedWith1);
    
    	}
    }
    Inventoryhandler
    Code:
    package com.rs.net.decoders.handlers;
    
    
    
    
    
    
    
    
    import com.rs.Settings;
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.game.Animation;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.item.Item;
    import com.rs.game.npc.NPC;
    import com.rs.game.npc.pet.Pet;
    import com.rs.game.player.Equipment;
    //import com.rs.game.npc.familiar.Familiar.SpecialAttack;
    import com.rs.game.player.CoordsEvent;
    import com.rs.game.player.Inventory;
    import com.rs.game.player.Player;
    import com.rs.game.player.actions.Firemaking;
    import com.rs.game.player.actions.Summoning;
    import com.rs.game.player.actions.Summoning.Pouches;
    
    //import com.rs.game.player.content.Runecrafting;
    import com.rs.game.player.controlers.Barrows;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.game.player.actions.Cooking;
    import com.rs.game.player.actions.Cooking.Cookables;
    
    import com.rs.io.InputStream;
    import com.rs.utils.Logger;
    import com.rs.utils.Utils;
    
    public class InventoryOptionsHandler {
    	public static void handleItemOnItem(final Player player, InputStream stream) {
    		try {
    		final int interfaceIndex = stream.readShort();
    	//	int fromSlot = stream.readShort();
    		//int toSlot = stream.readShort();
    		@SuppressWarnings("unused") final int junk1 = stream.readShortLE128() & 0xFFFF;
    		@SuppressWarnings("unused") final int junk2 = stream.readShortLE() & 0xFFFF;
    		@SuppressWarnings("unused") final int junk3 = stream.readShortLE128() & 0xFFFF;
    		final int itemUsed = stream.readShortLE128() & 0xFFFF;
    		@SuppressWarnings("unused") final int junk4 = stream.readShortLE128() & 0xFFFF;
    		@SuppressWarnings("unused") final int junk5 = stream.readShortLE128() & 0xFFFF;
    		final int usedWith = stream.readShortLE() & 0xFFFF;
    		if (interfaceIndex != 149) {
    			return;
    		}
    		System.out.println("ITEM 1: " +itemUsed+ " ITEM 2: " +usedWith);
    if (UseWith(1540,11286,usedWith,itemUsed)) {
    if (!player.getInventory().containsOneItem(2347)){
    player.getPackets().sendGameMessage("You need a hammer for make an dragon fire shield.");
    return;
    }
    player.getPackets().sendGameMessage("You made a Dragon Fire Shield and you got some smithing xp.");
    player.getSkills().addXp(13, 10000);
    player.getInventory().deleteItem(usedWith, 1);
    player.getInventory().deleteItem(itemUsed, 1);
    player.getInventory().addItem(11283, 1);
    }
    Item usedWith1 = player.getInventory().getItem(usedWith);
    Item itemUsed1 = player.getInventory().getItem(itemUsed);
    if (Firemaking.isFiremaking(player, itemUsed1, usedWith1))
    	return;
    if (UseWith(946,1511,usedWith,itemUsed)) {
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make bronze arrows.");   
          	player.getSkills().addXp(9, 500);
         	player.getInventory().deleteItem(1511, 1);
    	player.getInventory().addItem(882, 15); 
    }
    if (UseWith(usedWith,itemUsed,usedWith,itemUsed)) {
    	if (Firemaking.isFiremaking(player, itemUsed1, usedWith1))
    		return;
    }
    if (UseWith(946,1521,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 15) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make iron arrows.");   
          	player.getSkills().addXp(9, 1000);
         	player.getInventory().deleteItem(1521, 1);
    	player.getInventory().addItem(884, 15); 
    }
    if (UseWith(946,1519,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 30) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make steel arrows.");   
          	player.getSkills().addXp(9, 1500);
         	player.getInventory().deleteItem(1519, 1);
    	player.getInventory().addItem(886, 15); 
    }
    if (UseWith(946,1517,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 45) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make mithril arrows.");   
          	player.getSkills().addXp(9, 2000);
         	player.getInventory().deleteItem(1517, 1);
    	player.getInventory().addItem(888, 15); 
    }
    if (UseWith(946,1515,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 60) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make adamant arrows.");   
          	player.getSkills().addXp(9, 4000);
         	player.getInventory().deleteItem(1515, 1);
    	player.getInventory().addItem(890, 15); 
    }
    if (UseWith(946,1513,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 80) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make rune arrows.");   
          	player.getSkills().addXp(9, 8000);
         	player.getInventory().deleteItem(1513, 1);
    	player.getInventory().addItem(892, 15); 
    }
    if (UseWith(13736,13746,usedWith,itemUsed)) {
    player.getInventory().deleteItem(13736, 1);
    player.getInventory().deleteItem(13746, 1);
    player.getInventory().addItem(13738, 1); 
    }
    if (UseWith(13736,13748,usedWith,itemUsed)) {
    player.getInventory().deleteItem(13736, 1);
    player.getInventory().deleteItem(13748, 1);
    player.getInventory().addItem(13740, 1); 
    }
    if (UseWith(13736,13750,usedWith,itemUsed)) {
    player.getInventory().deleteItem(13736, 1);
    player.getInventory().deleteItem(13750, 1);
    player.getInventory().addItem(13742, 1); 
    }
    if (UseWith(13736,13752,usedWith,itemUsed)) {
    player.getInventory().deleteItem(13736, 1);
    player.getInventory().deleteItem(13752, 1);
    player.getInventory().addItem(13744, 1); 
    }
    		} catch(Exception e) {
    		}
    	}
    	@SuppressWarnings("unused")
    	public static void handleItemObject(final Player player, InputStream stream) {
    		final int y = stream.readShortLE() & 0xFFFF;
    		final int objectId = stream.readShortLE() & 0xFFFF;
    		final int unknown = stream.readShort128() & 0xFFFF;// Value : 128 ? 200;
    		final int interfaceId = stream.readShort() & 0xFFFF;
    		final int itemId = stream.readShort128() & 0xFFFF;
    		final int itemSlot = stream.readShort128() & 0xFFFF;
    		final int x = stream.readShortLE() & 0xFFFF;
    		final int slot = player.getInventory().lookupSlot(itemId);
    		if (interfaceId != 149) {// Player is not in invy screen
    			return;
    		}
    		if (!player.getInventory().containsOneItem(itemId)) {
    			return;
    		}
    		final Item item = player.getInventory().getItem(itemSlot);
    		if (!player.hasStarted() || !player.clientHasLoadedMapRegion()
    				|| player.isDead())
    			return;
    		long currentTime = Utils.currentTimeMillis();
    		if (player.getLockDelay() >= currentTime || player.getEmotesManager().getNextEmoteEnd() >= currentTime)
    			return;
    		final WorldTile tile = new WorldTile(x, y, player.getPlane());
    		int regionId = tile.getRegionId();
    		if (!player.getMapRegionsIds().contains(regionId))
    			return;
    		WorldObject mapObject = World.getRegion(regionId).getObject(objectId, tile);
    		if (mapObject == null || mapObject.getId() != objectId)
    			return;
    		final WorldObject object = !player.isAtDynamicRegion() ? mapObject : new WorldObject(objectId, mapObject.getType(), 
    
    mapObject.getRotation(), x, y, player.getPlane());
    		//final int item = player.getInventory().lookupSlot(itemId);
    		if (player.isDead() || Utils.getInterfaceDefinitionsSize() <= interfaceId)
    			return;
    		if (player.getLockDelay() > Utils.currentTimeMillis())
    			return;
    		if (!player.getInterfaceManager().containsInterface(interfaceId))
    			return;
    		/*if (item == null || item.getId() != itemId)
    			return;*/
    		player.stopAll(false); // false
    		final ObjectDefinitions objectDef = object.getDefinitions();
    		//ObjectHandler.handleItemOnObject(player, object, interfaceId, item);
    		if (UseWith(954, 3828, itemId, objectId)) { // warriror
    			if (player.isKalphiteLairSetted())
    				return;
    			player.getInventory().deleteItem(954, 1);
    			player.setKalphiteLair();
    			}
    		else if (UseWith(954, 3827, itemId, objectId)) {
    			if (player.isKalphiteLairEntranceSetted())
    				return;
    			player.getInventory().deleteItem(954, 1);
    			player.setKalphiteLairEntrance();
    	} else if (objectDef.name.toLowerCase().contains("range")
    			|| objectDef.name.toLowerCase().contains("stove")
            	|| objectDef.name.toLowerCase().contains("cooking range")
    			|| objectId == 2728) {
    		Cookables cook = Cooking.isCookingSkill(item);
    		if (cook != null) {
    			player.getDialogueManager().startDialogue(
    					"CookingD", cook, object);
    		}
    	} else
    			player.getPackets().sendGameMessage(
    					"Nothing interesting happens.");
    		System.out.println("Item on object: " + object.getId());
    		System.out.println("worked?.");
    	}
    	
    	
    	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.");
    					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 open this cracker.");
    						return;
    					}
    					player.getDialogueManager().startDialogue(
    							"ChristmasCrackerD", usedOn, itemId);
    					break;
    				default:
    					player.getPackets().sendGameMessage("Nothing interesting happens.");
    					break;
    				}
    			}
    		}, usedOn.getSize()));
    	}
    	
    	
    	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 == 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 itemOperate(final Player player, InputStream stream) {
    		//try {
    			int interfaceSet = stream.readInt();
    			int slotId = stream.readShort();
    			int interfaceId = interfaceSet >> 16;
    			int itemId = stream.readShortLE128();
    		//	int itemId = id;
    			if (interfaceId == 387) {//387
    				if (slotId < 0 || slotId >= Equipment.SIZE || player.getEquipment().getItems().get(slotId) == null) {
    					return;
    				}
    				if (player.getEquipment().getItems().get(slotId).getId() != itemId) {
    					return;
    				}
    				Item item = player.getInventory().getItem(itemId);
    				if(item == null || item.getId() != itemId)
    					return;
    				Pouches pouches = Pouches.forId(itemId);
    				if (pouches != null){
    					Summoning.spawnFamiliar(player, pouches);
    				}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 == 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);
    				}
    			} else
    				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);
    				//player.getPackets().sendGameMessage("Nothing interesting happens.");
    	}
    	
    	public static void itemOperate1(final Player player, InputStream stream) {
    		//try {
    			int interfaceSet = stream.readInt();
    			int slotId = stream.readShort();
    			int interfaceId = interfaceSet >> 16;
    			int itemId = stream.readShortLE128();
    		//	int itemId = id;
    			if (interfaceId == 387) {//387
    				if (slotId < 0 || slotId >= Equipment.SIZE || player.getEquipment().getItems().get(slotId) == null) {
    					return;
    				}
    				if (player.getEquipment().getItems().get(slotId).getId() != itemId) {
    					return;
    				}
    				Item item = player.getInventory().getItem(itemId);
    				if(item == null || item.getId() != itemId)
    					return;
    				Pouches pouches = Pouches.forId(itemId);
    				if (pouches != null){
    					Summoning.spawnFamiliar(player, pouches);
    				}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 == 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);
    				}
    			} else
    				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);
    				//player.getPackets().sendGameMessage("Nothing interesting happens.");
    	}
    	
    		@SuppressWarnings("unused")
    		public static void itemsummon(final Player player, InputStream stream) {
    			final int interfaceId = stream.readShort();
    			final int junk = stream.readShort();
    			final int id = stream.readShort();
    			final int slot = stream.readShort128();
    			int itemId = id;
    			if (!player.getInventory().containsOneItem(id)) {
    				return;
    			}
    			if (interfaceId == 149) {
    				Pouches pouches = Pouches.forId(itemId);
    				if (pouches != null)
    					Summoning.spawnFamiliar(player, pouches);
    			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);
    			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.");
    			 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);
    
    				switch (id) {
    				}
    			} else {
    				System.out.println("Unhandled item, interface: " + interfaceId + ".");
    			}
    		}
    private static boolean UseWith(int Item1, int Item2,int itemUsed,int usedWith) {
    if(itemUsed == Item1 && usedWith == Item2 || itemUsed == Item2 && usedWith == Item1) {
    return true;
    }
    return false;
    }
    @SuppressWarnings("unused")
    public static void itemOnNpc(final Player player, InputStream stream) {
    	try {
    		int slot = stream.readShort() & 0xFFFF;
    		int junk = stream.readIntV1() & 0xFFFF;
    		int junk2 = stream.readByte128() & 0xFFFF;
    		int itemId = stream.readShortLE128() & 0xFFFF;
    		int npcId = stream.readShortLE() & 0xFFFF;
    
    		if (npcId < 0 ) {
    			return;
    		}
    		NPC npc = World.getNPCs().get(npcId);
    		if (npc == null) {
    			return;
    		}
    		if (slot < 0) {
    			return;
    		}
    
    		//player.turnTemporarilyTo(npc);
    		switch (itemId) {
    
    		case 962:
    			player.getPackets()
    			.sendGameMessage(
    					"The amulet has ran out of charges. You need to recharge it if you wish it use it once more.");
    			break;
    
    		}
    
    	} catch (Exception e) {
    	}
    }
    /*
     * 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 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) {
    				//mole
    				player.setNextWorldTile(new WorldTile(1752, 5137, 0));
    				player.getPackets().sendGameMessage("You seem to have dropped down into a network of mole tunnels.");
    				return;
    			}
    			player.getPackets().sendGameMessage("You find nothing.");
    		}
    		
    	});
    }
    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()));
    }
    
    }
    Objects

    Code:
    package com.rs.net.decoders.handlers;
    
    import java.util.ArrayList;
    import com.rs.io.InputStream;
    import com.rs.utils.Utils;
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.item.Item;
    import com.rs.game.player.CoordsEvent;
    import com.rs.game.player.Inventory;
    import com.rs.game.player.Player;
    //import com.rs.game.player.skills.Mining;
    
    /**
     * Simplifies the event which occurs when a certain object is clicked
     * (OBJECT_ClICK_1 packet) so that the end-user of the source will not need to
     * deal with the hassle of adding ifs and other code in WorldPacketsDecoder. <br />
     * I haven't taken the time to copy all the implemented IDs from
     * WorldPacketsDecoder, however. (Besides Mining)
     * 
     * @author Cyber Sheep
     */
    
    public class ObjectHandler {
    
    	/**
    	 * Fix for "Nothing interesting happens" message being sent when an object
    	 * is clicked
    	 */
    
    
    	public static void handleItemOnObject(final Player player, final WorldObject object, final int interfaceId, final Item item) {
    		final int itemId = item.getId();
    		final ObjectDefinitions objectDef = object.getDefinitions();
    		player.setCoordsEvent(new CoordsEvent(object, new Runnable() {
    			@Override
    			public void run() {
    				player.faceObject(object);	
    						System.out.println("Item on object: " + object.getId());
    				
    			}
    		}, objectDef.getSizeX(), objectDef.getSizeY(), object.getRotation()));
    	}
    }
    Quote Originally Posted by Lee Singed View Post
    I'm not sure about those packets, however how did you fix your clicking and walking packetId mismatches. Im having the same issue with my server.

    GL, if I find out Ill be sure to return the favor.
    I be sure to pm you back if i get them sorted out this weekend!
    Quote Originally Posted by raresmoke View Post
    server just protecting you from fake packet senders, who wants to flood ya server, so when someone sending to your server alot packets , server will kick off him.
    Yeah and i can walk 2 clicks (not from minimap) then i lag out, i guess protecting isnt helping me when server isnt even online for everyone lol.

    oh and kaleem i get an error too when i lag out..
    Code:
    java.io.FileNotFoundException: C:\Users\Seppoh\characters\zambu.p (Määritettyä polkua ei löydy)
    	at java.io.FileOutputStream.open(Native Method)
    	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    	at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    	at com.rs.utils.SerializableFilesManager.storeSerializableClass(SerializableFilesManager.java:48)
    	at com.rs.utils.SerializableFilesManager.savePlayer(SerializableFilesManager.java:32)
    	at com.rs.game.player.Player.realFinish(Player.java:872)
    	at com.rs.game.player.Player.finish(Player.java:854)
    	at com.rs.game.player.Player$1.run(Player.java:846)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    Attached image
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Feb 2013
    Posts
    4,409
    Thanks given
    59
    Thanks received
    478
    Rep Power
    138
    Quote Originally Posted by Sambu View Post
    Sure, btw sorry for late response had a long week at work.

    Packets and their sizes:
    Code:
    public final class WorldPacketsDecoder extends Decoder {
    
    	private static final byte[] PACKET_SIZES = new byte[256];
    	
    	private final static int WALKING_PACKET = 119;
    	private final static int WORLD_MAP_CLICKING_PACKET = 148;
    	public static final int MINI_MAP_WALK_PACKET = 163;
    	private final static int WEIRD_WALKING_PACKET = 160;
    	private final static int AFK_PACKET = 244;
    	public final static int ACTION_BUTTON1_PACKET = 216;
    	public final static int ACTION_BUTTON2_PACKET = 205;
    	private final static int WEAR_ITEM_PACKET = 229;
    	public final static int ACTION_BUTTON3_PACKET = 3;
    	public final static int ACTION_BUTTON4_PACKET = 19;
    	public final static int ACTION_BUTTON5_PACKET = 193;
    	public final static int ACTION_BUTTON6_PACKET = 76;
    	public final static int ACTION_BUTTON7_PACKET = 173;
    	private final static int ACTION_BUTTON8_PACKET = 89;
    	private final static int ACTION_BUTTON9_PACKET = 221;
    	private final static int PLAYER_TRADE_OPTION_PACKET = 141;
    	private final static int PLAYER_OPTION4_PACKET = 114;
    	private final static int MOVE_CAMERA_PACKET = 235;
    	private final static int CLICK_PACKET = 87;
    	private final static int CLOSE_INTERFACE_PACKET = 91;
    	private final static int COMMANDS_PACKET = 171;
    	private final static int IN_OUT_SCREEN_PACKET = 4;
    	private final static int INTER_PACKET_COUNT_CHECKER_PACKET = 5;
    	private final static int SWITCH_DETAIL = 155;
    	private final static int DONE_LOADING_REGION = 116;
    	private final static int PING_PACKET = 255;
    	private final static int SCREEN_PACKET = 170;
    	private final static int PUBLIC_CHAT_PACKET = 182;
    	private final static int QUICK_CHAT_PACKET = 68;
    	private final static int ADD_FRIEND_PACKET = 226;
    	private final static int REMOVE_FRIEND_PACKET = 92;
    	private final static int SEND_FRIEND_MESSAGE_PACKET = 123;
    	private final static int OBJECT_CLICK1_PACKET = 45;
    	private final static int OBJECT_CLICK2_PACKET = 190;
    	private final static int OBJECT_CLICK3_PACKET = 26;
    	private final static int NPC_CLICK1_PACKET = 217;
    	private final static int NPC_CLICK2_PACKET = 254;
    	private final static int ATTACK_NPC = 207;//207
    	private final static int ATTACK_PLAYER = 152;
    	private final static int PLAYER_OPTION_2_PACKET = 140;
    	private final static int ITEM_DROP_PACKET = 248;
    	private final static int ITEM_ON_ITEM_PACKET = 117;
    	private final static int ITEM_SELECT_PACKET = 66;
    	private final static int ITEM_ON_OBJECT_PACKET = 202;
    	private final static int ITEM_OPERATE_PACKET = 29;//189
    	private final static int ITEM_OPERATE1_PACKET = 189;//189
    	private final static int ITEM_ON_NPC_PACKET = 136;//189
    	private final static int ITEM_TAKE_PACKET = 194;
    	private final static int DIALOGUE_CONTINUE_PACKET = 147;
    	private final static int ENTER_INTEGER_PACKET = 206;
    	private final static int SWITCH_INTERFACE_ITEM_PACKET = 253;
    	private final static int ITEM_OPTION1_PACKET = 234;
    	private final static int INTERFACE_ON_PLAYER = 79;
    	private final static int INTERFACE_ON_NPC = 84;
    
    	private static final int MINI_WALKING_PACKET = 0;
    	static {
    		loadPacketSizes();
    	}
    	
    	public static void loadPacketSizes() {
    		for(int id = 0; id < 256; id++)
    			PACKET_SIZES[id] = -4;
    		PACKET_SIZES[AFK_PACKET] = 0;
    		PACKET_SIZES[ACTION_BUTTON1_PACKET] = 6;
    		PACKET_SIZES[WORLD_MAP_CLICKING_PACKET] = 18;
    		PACKET_SIZES[WEIRD_WALKING_PACKET] = 4;
    		PACKET_SIZES[ACTION_BUTTON2_PACKET] = 4;
    		PACKET_SIZES[WEAR_ITEM_PACKET] = 8;
    		PACKET_SIZES[ACTION_BUTTON3_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON4_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON5_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON6_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON7_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON8_PACKET] = 6;
    		PACKET_SIZES[ACTION_BUTTON9_PACKET] = 6;
    		PACKET_SIZES[CLICK_PACKET] = 6;
    		PACKET_SIZES[CLOSE_INTERFACE_PACKET] = 0;
    		PACKET_SIZES[COMMANDS_PACKET] = -1;
    		PACKET_SIZES[IN_OUT_SCREEN_PACKET] = 1;
    		PACKET_SIZES[INTER_PACKET_COUNT_CHECKER_PACKET] = 2;
    		PACKET_SIZES[PING_PACKET] = 0;
    		PACKET_SIZES[MINI_WALKING_PACKET] = -1;
    		PACKET_SIZES[WALKING_PACKET] = 4;
    		PACKET_SIZES[SCREEN_PACKET] = 6;
    		PACKET_SIZES[SWITCH_DETAIL] = 4;
    		PACKET_SIZES[DONE_LOADING_REGION] = 0;
    		PACKET_SIZES[PUBLIC_CHAT_PACKET] = -1;
    		PACKET_SIZES[QUICK_CHAT_PACKET] = -1;
    		PACKET_SIZES[ADD_FRIEND_PACKET] = -1;
    		PACKET_SIZES[REMOVE_FRIEND_PACKET] = -1;
    		PACKET_SIZES[SEND_FRIEND_MESSAGE_PACKET] = -1;
    		PACKET_SIZES[OBJECT_CLICK1_PACKET] = 7;
    		PACKET_SIZES[OBJECT_CLICK2_PACKET] = 7;
    		PACKET_SIZES[OBJECT_CLICK3_PACKET] = 6;
    		PACKET_SIZES[ITEM_DROP_PACKET] = 8;
    		PACKET_SIZES[ITEM_ON_ITEM_PACKET] = 16;
    		PACKET_SIZES[ITEM_SELECT_PACKET] = 8;
    		PACKET_SIZES[ITEM_OPERATE_PACKET] = 8;
    		PACKET_SIZES[ITEM_OPERATE1_PACKET] = 8;
    		PACKET_SIZES[ITEM_ON_NPC_PACKET] = 11;
    		PACKET_SIZES[ITEM_ON_OBJECT_PACKET] = 16;//16
    		PACKET_SIZES[ITEM_TAKE_PACKET] = 7;
    		PACKET_SIZES[DIALOGUE_CONTINUE_PACKET] = 6;
    		PACKET_SIZES[MOVE_CAMERA_PACKET] = 4;
    		PACKET_SIZES[ENTER_INTEGER_PACKET] = 4;
    		PACKET_SIZES[PLAYER_TRADE_OPTION_PACKET] = 3;
    		PACKET_SIZES[PLAYER_OPTION4_PACKET] = 3;
    		PACKET_SIZES[PLAYER_OPTION_2_PACKET] = 3;
    		PACKET_SIZES[SWITCH_INTERFACE_ITEM_PACKET] = 9;
    		PACKET_SIZES[ATTACK_NPC] = 3;
    		PACKET_SIZES[ATTACK_PLAYER] = 0;
    		PACKET_SIZES[NPC_CLICK1_PACKET] = 3;
    		PACKET_SIZES[NPC_CLICK2_PACKET] = 3;
    		PACKET_SIZES[ITEM_OPTION1_PACKET] = 8;
    		PACKET_SIZES[INTERFACE_ON_PLAYER] = 9;
    		PACKET_SIZES[INTERFACE_ON_NPC] = 9;
    	}
    ButtonHandler1
    Code:
    package com.rs.net.decoders.handlers;
    
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    
    public class ButtonHandler {
    
    	public static void sendRemove(Player player, int slotId) {
    		if (slotId >= 15)
    			return;
    		player.stopAll(false, false);
    		Item item = player.getEquipment().getItem(slotId);
    		if (item == null
    				|| !player.getInventory().addItem(item.getId(),
    						item.getAmount()))
    			return;
    		player.getEquipment().getItems().set(slotId, null);
    		player.getEquipment().refresh(slotId);
    		player.getAppearence().generateAppearenceData();
    		/*if (Runecrafting.isTiara(item.getId()))
    			player.getPackets().sendConfig(491, 0);*/
    		if (slotId == 3)
    			player.getCombatDefinitions().desecreaseSpecialAttack(0);
    		
    
    }
    }
    Buttonhandler2
    Code:
    package com.rs.net.decoders.handlers;
    
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    import com.rs.game.player.actions.Firemaking;
    import com.rs.io.InputStream;
    
    public class Buttonhandler2 {
    
    	@SuppressWarnings("unused")
    	public static void itemOnItem(final Player player, final InputStream stream) {
    		final int interfaceIndex = stream.readShort();
    		stream.readShort();
    		int fromSlot = stream.readShort();
    		int toSlot = stream.readShort();
    		int itemUsed = stream.readShortLE128() & 0xFFFF;
    		stream.readShort();
    		int toInterfaceIndex = stream.readShortLE();
    		int usedWith = stream.readShortLE() & 0xFFFF;
    		if (interfaceIndex != 149 && toInterfaceIndex != 149) {
    			return;
    		}
    		Item usedWith1 = player.getInventory().getItem(usedWith);
    			Item itemUsed1 = player.getInventory().getItem(itemUsed);
    			
    			if (Firemaking.isFiremaking(player, itemUsed1, usedWith1))
    				return;
    			else
    				//System.out.println("ITEM 1: " +itemUsed1+ " ITEM 2: " +usedWith1);
    			System.out.println("ITEM 1 kes 2e5tek: " +itemUsed1+ " ITEM 2: " +usedWith1);
    
    	}
    }
    Inventoryhandler
    Code:
    package com.rs.net.decoders.handlers;
    
    
    
    
    
    
    
    
    import com.rs.Settings;
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.game.Animation;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.item.Item;
    import com.rs.game.npc.NPC;
    import com.rs.game.npc.pet.Pet;
    import com.rs.game.player.Equipment;
    //import com.rs.game.npc.familiar.Familiar.SpecialAttack;
    import com.rs.game.player.CoordsEvent;
    import com.rs.game.player.Inventory;
    import com.rs.game.player.Player;
    import com.rs.game.player.actions.Firemaking;
    import com.rs.game.player.actions.Summoning;
    import com.rs.game.player.actions.Summoning.Pouches;
    
    //import com.rs.game.player.content.Runecrafting;
    import com.rs.game.player.controlers.Barrows;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.game.player.actions.Cooking;
    import com.rs.game.player.actions.Cooking.Cookables;
    
    import com.rs.io.InputStream;
    import com.rs.utils.Logger;
    import com.rs.utils.Utils;
    
    public class InventoryOptionsHandler {
    	public static void handleItemOnItem(final Player player, InputStream stream) {
    		try {
    		final int interfaceIndex = stream.readShort();
    	//	int fromSlot = stream.readShort();
    		//int toSlot = stream.readShort();
    		@SuppressWarnings("unused") final int junk1 = stream.readShortLE128() & 0xFFFF;
    		@SuppressWarnings("unused") final int junk2 = stream.readShortLE() & 0xFFFF;
    		@SuppressWarnings("unused") final int junk3 = stream.readShortLE128() & 0xFFFF;
    		final int itemUsed = stream.readShortLE128() & 0xFFFF;
    		@SuppressWarnings("unused") final int junk4 = stream.readShortLE128() & 0xFFFF;
    		@SuppressWarnings("unused") final int junk5 = stream.readShortLE128() & 0xFFFF;
    		final int usedWith = stream.readShortLE() & 0xFFFF;
    		if (interfaceIndex != 149) {
    			return;
    		}
    		System.out.println("ITEM 1: " +itemUsed+ " ITEM 2: " +usedWith);
    if (UseWith(1540,11286,usedWith,itemUsed)) {
    if (!player.getInventory().containsOneItem(2347)){
    player.getPackets().sendGameMessage("You need a hammer for make an dragon fire shield.");
    return;
    }
    player.getPackets().sendGameMessage("You made a Dragon Fire Shield and you got some smithing xp.");
    player.getSkills().addXp(13, 10000);
    player.getInventory().deleteItem(usedWith, 1);
    player.getInventory().deleteItem(itemUsed, 1);
    player.getInventory().addItem(11283, 1);
    }
    Item usedWith1 = player.getInventory().getItem(usedWith);
    Item itemUsed1 = player.getInventory().getItem(itemUsed);
    if (Firemaking.isFiremaking(player, itemUsed1, usedWith1))
    	return;
    if (UseWith(946,1511,usedWith,itemUsed)) {
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make bronze arrows.");   
          	player.getSkills().addXp(9, 500);
         	player.getInventory().deleteItem(1511, 1);
    	player.getInventory().addItem(882, 15); 
    }
    if (UseWith(usedWith,itemUsed,usedWith,itemUsed)) {
    	if (Firemaking.isFiremaking(player, itemUsed1, usedWith1))
    		return;
    }
    if (UseWith(946,1521,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 15) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make iron arrows.");   
          	player.getSkills().addXp(9, 1000);
         	player.getInventory().deleteItem(1521, 1);
    	player.getInventory().addItem(884, 15); 
    }
    if (UseWith(946,1519,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 30) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make steel arrows.");   
          	player.getSkills().addXp(9, 1500);
         	player.getInventory().deleteItem(1519, 1);
    	player.getInventory().addItem(886, 15); 
    }
    if (UseWith(946,1517,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 45) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make mithril arrows.");   
          	player.getSkills().addXp(9, 2000);
         	player.getInventory().deleteItem(1517, 1);
    	player.getInventory().addItem(888, 15); 
    }
    if (UseWith(946,1515,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 60) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make adamant arrows.");   
          	player.getSkills().addXp(9, 4000);
         	player.getInventory().deleteItem(1515, 1);
    	player.getInventory().addItem(890, 15); 
    }
    if (UseWith(946,1513,usedWith,itemUsed)) {
           if(player.getSkills().getLevelForXp(9) < 80) {
    	player.getPackets().sendGameMessage("You do not have the level requirement needed to fletch this.");
          	return;
          }
          if (!player.getInventory().containsOneItem(946)) {
          	player.getPackets().sendGameMessage("You need a knife to fletch.");
         	 return;
          }  
          	player.setNextAnimation(new Animation(6702));   
          	player.getPackets().sendGameMessage("You make rune arrows.");   
          	player.getSkills().addXp(9, 8000);
         	player.getInventory().deleteItem(1513, 1);
    	player.getInventory().addItem(892, 15); 
    }
    if (UseWith(13736,13746,usedWith,itemUsed)) {
    player.getInventory().deleteItem(13736, 1);
    player.getInventory().deleteItem(13746, 1);
    player.getInventory().addItem(13738, 1); 
    }
    if (UseWith(13736,13748,usedWith,itemUsed)) {
    player.getInventory().deleteItem(13736, 1);
    player.getInventory().deleteItem(13748, 1);
    player.getInventory().addItem(13740, 1); 
    }
    if (UseWith(13736,13750,usedWith,itemUsed)) {
    player.getInventory().deleteItem(13736, 1);
    player.getInventory().deleteItem(13750, 1);
    player.getInventory().addItem(13742, 1); 
    }
    if (UseWith(13736,13752,usedWith,itemUsed)) {
    player.getInventory().deleteItem(13736, 1);
    player.getInventory().deleteItem(13752, 1);
    player.getInventory().addItem(13744, 1); 
    }
    		} catch(Exception e) {
    		}
    	}
    	@SuppressWarnings("unused")
    	public static void handleItemObject(final Player player, InputStream stream) {
    		final int y = stream.readShortLE() & 0xFFFF;
    		final int objectId = stream.readShortLE() & 0xFFFF;
    		final int unknown = stream.readShort128() & 0xFFFF;// Value : 128 ? 200;
    		final int interfaceId = stream.readShort() & 0xFFFF;
    		final int itemId = stream.readShort128() & 0xFFFF;
    		final int itemSlot = stream.readShort128() & 0xFFFF;
    		final int x = stream.readShortLE() & 0xFFFF;
    		final int slot = player.getInventory().lookupSlot(itemId);
    		if (interfaceId != 149) {// Player is not in invy screen
    			return;
    		}
    		if (!player.getInventory().containsOneItem(itemId)) {
    			return;
    		}
    		final Item item = player.getInventory().getItem(itemSlot);
    		if (!player.hasStarted() || !player.clientHasLoadedMapRegion()
    				|| player.isDead())
    			return;
    		long currentTime = Utils.currentTimeMillis();
    		if (player.getLockDelay() >= currentTime || player.getEmotesManager().getNextEmoteEnd() >= currentTime)
    			return;
    		final WorldTile tile = new WorldTile(x, y, player.getPlane());
    		int regionId = tile.getRegionId();
    		if (!player.getMapRegionsIds().contains(regionId))
    			return;
    		WorldObject mapObject = World.getRegion(regionId).getObject(objectId, tile);
    		if (mapObject == null || mapObject.getId() != objectId)
    			return;
    		final WorldObject object = !player.isAtDynamicRegion() ? mapObject : new WorldObject(objectId, mapObject.getType(), 
    
    mapObject.getRotation(), x, y, player.getPlane());
    		//final int item = player.getInventory().lookupSlot(itemId);
    		if (player.isDead() || Utils.getInterfaceDefinitionsSize() <= interfaceId)
    			return;
    		if (player.getLockDelay() > Utils.currentTimeMillis())
    			return;
    		if (!player.getInterfaceManager().containsInterface(interfaceId))
    			return;
    		/*if (item == null || item.getId() != itemId)
    			return;*/
    		player.stopAll(false); // false
    		final ObjectDefinitions objectDef = object.getDefinitions();
    		//ObjectHandler.handleItemOnObject(player, object, interfaceId, item);
    		if (UseWith(954, 3828, itemId, objectId)) { // warriror
    			if (player.isKalphiteLairSetted())
    				return;
    			player.getInventory().deleteItem(954, 1);
    			player.setKalphiteLair();
    			}
    		else if (UseWith(954, 3827, itemId, objectId)) {
    			if (player.isKalphiteLairEntranceSetted())
    				return;
    			player.getInventory().deleteItem(954, 1);
    			player.setKalphiteLairEntrance();
    	} else if (objectDef.name.toLowerCase().contains("range")
    			|| objectDef.name.toLowerCase().contains("stove")
            	|| objectDef.name.toLowerCase().contains("cooking range")
    			|| objectId == 2728) {
    		Cookables cook = Cooking.isCookingSkill(item);
    		if (cook != null) {
    			player.getDialogueManager().startDialogue(
    					"CookingD", cook, object);
    		}
    	} else
    			player.getPackets().sendGameMessage(
    					"Nothing interesting happens.");
    		System.out.println("Item on object: " + object.getId());
    		System.out.println("worked?.");
    	}
    	
    	
    	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.");
    					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 open this cracker.");
    						return;
    					}
    					player.getDialogueManager().startDialogue(
    							"ChristmasCrackerD", usedOn, itemId);
    					break;
    				default:
    					player.getPackets().sendGameMessage("Nothing interesting happens.");
    					break;
    				}
    			}
    		}, usedOn.getSize()));
    	}
    	
    	
    	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 == 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 itemOperate(final Player player, InputStream stream) {
    		//try {
    			int interfaceSet = stream.readInt();
    			int slotId = stream.readShort();
    			int interfaceId = interfaceSet >> 16;
    			int itemId = stream.readShortLE128();
    		//	int itemId = id;
    			if (interfaceId == 387) {//387
    				if (slotId < 0 || slotId >= Equipment.SIZE || player.getEquipment().getItems().get(slotId) == null) {
    					return;
    				}
    				if (player.getEquipment().getItems().get(slotId).getId() != itemId) {
    					return;
    				}
    				Item item = player.getInventory().getItem(itemId);
    				if(item == null || item.getId() != itemId)
    					return;
    				Pouches pouches = Pouches.forId(itemId);
    				if (pouches != null){
    					Summoning.spawnFamiliar(player, pouches);
    				}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 == 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);
    				}
    			} else
    				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);
    				//player.getPackets().sendGameMessage("Nothing interesting happens.");
    	}
    	
    	public static void itemOperate1(final Player player, InputStream stream) {
    		//try {
    			int interfaceSet = stream.readInt();
    			int slotId = stream.readShort();
    			int interfaceId = interfaceSet >> 16;
    			int itemId = stream.readShortLE128();
    		//	int itemId = id;
    			if (interfaceId == 387) {//387
    				if (slotId < 0 || slotId >= Equipment.SIZE || player.getEquipment().getItems().get(slotId) == null) {
    					return;
    				}
    				if (player.getEquipment().getItems().get(slotId).getId() != itemId) {
    					return;
    				}
    				Item item = player.getInventory().getItem(itemId);
    				if(item == null || item.getId() != itemId)
    					return;
    				Pouches pouches = Pouches.forId(itemId);
    				if (pouches != null){
    					Summoning.spawnFamiliar(player, pouches);
    				}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 == 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);
    				}
    			} else
    				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);
    				//player.getPackets().sendGameMessage("Nothing interesting happens.");
    	}
    	
    		@SuppressWarnings("unused")
    		public static void itemsummon(final Player player, InputStream stream) {
    			final int interfaceId = stream.readShort();
    			final int junk = stream.readShort();
    			final int id = stream.readShort();
    			final int slot = stream.readShort128();
    			int itemId = id;
    			if (!player.getInventory().containsOneItem(id)) {
    				return;
    			}
    			if (interfaceId == 149) {
    				Pouches pouches = Pouches.forId(itemId);
    				if (pouches != null)
    					Summoning.spawnFamiliar(player, pouches);
    			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);
    			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.");
    			 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);
    
    				switch (id) {
    				}
    			} else {
    				System.out.println("Unhandled item, interface: " + interfaceId + ".");
    			}
    		}
    private static boolean UseWith(int Item1, int Item2,int itemUsed,int usedWith) {
    if(itemUsed == Item1 && usedWith == Item2 || itemUsed == Item2 && usedWith == Item1) {
    return true;
    }
    return false;
    }
    @SuppressWarnings("unused")
    public static void itemOnNpc(final Player player, InputStream stream) {
    	try {
    		int slot = stream.readShort() & 0xFFFF;
    		int junk = stream.readIntV1() & 0xFFFF;
    		int junk2 = stream.readByte128() & 0xFFFF;
    		int itemId = stream.readShortLE128() & 0xFFFF;
    		int npcId = stream.readShortLE() & 0xFFFF;
    
    		if (npcId < 0 ) {
    			return;
    		}
    		NPC npc = World.getNPCs().get(npcId);
    		if (npc == null) {
    			return;
    		}
    		if (slot < 0) {
    			return;
    		}
    
    		//player.turnTemporarilyTo(npc);
    		switch (itemId) {
    
    		case 962:
    			player.getPackets()
    			.sendGameMessage(
    					"The amulet has ran out of charges. You need to recharge it if you wish it use it once more.");
    			break;
    
    		}
    
    	} catch (Exception e) {
    	}
    }
    /*
     * 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 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) {
    				//mole
    				player.setNextWorldTile(new WorldTile(1752, 5137, 0));
    				player.getPackets().sendGameMessage("You seem to have dropped down into a network of mole tunnels.");
    				return;
    			}
    			player.getPackets().sendGameMessage("You find nothing.");
    		}
    		
    	});
    }
    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()));
    }
    
    }
    Objects

    Code:
    package com.rs.net.decoders.handlers;
    
    import java.util.ArrayList;
    import com.rs.io.InputStream;
    import com.rs.utils.Utils;
    import com.rs.cache.loaders.ObjectDefinitions;
    import com.rs.game.World;
    import com.rs.game.WorldObject;
    import com.rs.game.WorldTile;
    import com.rs.game.item.Item;
    import com.rs.game.player.CoordsEvent;
    import com.rs.game.player.Inventory;
    import com.rs.game.player.Player;
    //import com.rs.game.player.skills.Mining;
    
    /**
     * Simplifies the event which occurs when a certain object is clicked
     * (OBJECT_ClICK_1 packet) so that the end-user of the source will not need to
     * deal with the hassle of adding ifs and other code in WorldPacketsDecoder. <br />
     * I haven't taken the time to copy all the implemented IDs from
     * WorldPacketsDecoder, however. (Besides Mining)
     * 
     * @author Cyber Sheep
     */
    
    public class ObjectHandler {
    
    	/**
    	 * Fix for "Nothing interesting happens" message being sent when an object
    	 * is clicked
    	 */
    
    
    	public static void handleItemOnObject(final Player player, final WorldObject object, final int interfaceId, final Item item) {
    		final int itemId = item.getId();
    		final ObjectDefinitions objectDef = object.getDefinitions();
    		player.setCoordsEvent(new CoordsEvent(object, new Runnable() {
    			@Override
    			public void run() {
    				player.faceObject(object);	
    						System.out.println("Item on object: " + object.getId());
    				
    			}
    		}, objectDef.getSizeX(), objectDef.getSizeY(), object.getRotation()));
    	}
    }

    I be sure to pm you back if i get them sorted out this weekend!

    Yeah and i can walk 2 clicks (not from minimap) then i lag out, i guess protecting isnt helping me when server isnt even online for everyone lol.

    oh and kaleem i get an error too when i lag out..
    Code:
    java.io.FileNotFoundException: C:\Users\Seppoh\characters\zambu.p (Määritettyä polkua ei löydy)
    	at java.io.FileOutputStream.open(Native Method)
    	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    	at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    	at com.rs.utils.SerializableFilesManager.storeSerializableClass(SerializableFilesManager.java:48)
    	at com.rs.utils.SerializableFilesManager.savePlayer(SerializableFilesManager.java:32)
    	at com.rs.game.player.Player.realFinish(Player.java:872)
    	at com.rs.game.player.Player.finish(Player.java:854)
    	at com.rs.game.player.Player$1.run(Player.java:846)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    java.io.FileNotFoundException: C:\Users\Seppoh\characters\zambu.p
    Reply With Quote  
     

  7. #7  
    Donator

    Sambu's Avatar
    Join Date
    Apr 2013
    Posts
    405
    Thanks given
    705
    Thanks received
    38
    Rep Power
    135
    Quote Originally Posted by Mayne View Post
    java.io.FileNotFoundException: C:\Users\Seppoh\characters\zambu.p
    But if i logout myself it saves the file, i got a video about it.
    Reply With Quote  
     


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. [562] Packets
    By Axed in forum Help
    Replies: 19
    Last Post: 10-11-2009, 01:45 PM
  2. [562] Packet guessed length [NIO]
    By Sinidious in forum Snippets
    Replies: 11
    Last Post: 10-07-2009, 11:57 PM
  3. Some 562 packets
    By dragonkk in forum Configuration
    Replies: 3
    Last Post: 10-02-2009, 03:16 PM
  4. 562 packets
    By Simon in forum Configuration
    Replies: 13
    Last Post: 09-26-2009, 09:16 PM
  5. [562] Packets
    By The Lizard King in forum Configuration
    Replies: 31
    Last Post: 09-24-2009, 06:08 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •