private void handleEnterAmount(Player player, Packet packet) {
		    if (player.getTemporaryAttribute("interfaceVariable") == null) {
			    player.getPackets().sendMessage("An error occured, please try again.");
			    return;
		    }
		    EnterVariable var = (EnterVariable) player.getTemporaryAttribute("interfaceVariable");
		    int craftType = (int) (player.getTemporaryAttribute("craftType") == null ? -1 : (int) player.getTemporaryAttribute("craftType")); // 'Category' of item to craft
		    int amount = packet.readInt();
		    switch(var.getInterfaceId()) {
			    case 675: // Jewellery crafting
				    Jewellery.makeJewellery(player, var.getSlot(), amount, true);
				    break;
				
			    case 304: // Dragonhide crafting.
				    int leatherType = (int) (player.getTemporaryAttribute("leatherCraft") == null ? -1 : (int) player.getTemporaryAttribute("leatherCraft")); // Type of leather to craft.
				    switch (var.getSlot()) {
					    case 0:
						    if (leatherType != -1) {
							    Leather.craftDragonHide(player, 1, 0, leatherType, true); // Body
							    break;
						    } else if (craftType == 6) { // Ball of wool
							    Spinning.craftSpinning(player, amount, 0, true);
							    break;
						    }
						    break;
						
					    case 1:
						    if (craftType == 6) { // Bowstring
							    Spinning.craftSpinning(player, amount, 1, true);
							    break;
						    }
						    break;
						
					    case 2:
						     if (craftType == 6) { // Crossbow string
							    Spinning.craftSpinning(player, amount, 2, true);
							    break;
						    }
						     break;
						
					    case 4:
						    Leather.craftDragonHide(player, 1, 4, leatherType, true); // Vambraces
						    break;
						
					    case 8:
						    Leather.craftDragonHide(player, 1, 8, leatherType, true); // Chaps
						    break;
				    }
				    break;
				
			    case 303:
				    switch(var.getSlot()) {
					    case 120: // Unholy symbol
						    Silver.newSilverItem(player, amount, var.getSlot(), true);
						    break;
						
					    case 121: // Tiara
						    Silver.newSilverItem(player, amount, var.getSlot(), true);
						    break;
				    }
				    break;
				
			    case 154: // Craft normal leather.
				    if (var.getSlot() >= 28 && var.getSlot() <= 34) {
					    Leather.craftNormalLeather(player, var.getSlot(), amount, true);
					    break;
				    }
				    break;
			
			    case 542: // Glassblowing.
				    switch(var.getSlot()) {
					    case 40: // Make X beer glass.
						    Glass.craftGlass(player, amount, 0, true);
						    break;
						
					    case 41: // Make X candle lantern.
						    Glass.craftGlass(player, amount, 1, true);
						    break;
						
					    case 42: // Make X oil lamp.
						    Glass.craftGlass(player, amount, 2, true);
						    break;
						
					    case 38: // Make X vial.
						    Glass.craftGlass(player, amount, 3, true);
						    break;
						
					    case 44: // Make X Fishbowl
						    Glass.craftGlass(player, amount, 4, true);
						    break;
						
					    case 39: // Make X orb.
						    Glass.craftGlass(player, amount, 5, true);
						    break;
						
					    case 43: // Make X lantern lens
						    Glass.craftGlass(player, amount, 6, true);
						    break;
						
					    case 45: // Make X dorgeshuun light orb.
						    Glass.craftGlass(player, amount, 7, true);
						    break;
				    }
				    break;
			
			    case 763: // Bank inventory - X.
				    player.getBank().setLastXAmount(amount);
				    player.getBank().deposit(var.getSlot(), amount);
				    player.getBank().refreshBank();
				    break;
				
			    case 762: // Bank - X.
				    player.getBank().setLastXAmount(amount);
				    player.getBank().withdraw(var.getSlot(), amount);
				    player.getBank().refreshBank();
				    break;
				
 			    case 336: // Trade/stake inventory - trade X.
 				    if (player.getTrade() != null) {
	 				    player.getTrade().tradeItem(var.getSlot(), amount);
	 				    break;
				    }
 				    if (player.getDuel() != null) {
 					    player.getDuel().stakeItem(var.getSlot(), amount);
 					    break;
 				    }
 				    break;
 				
 			    case 631:
 				    if (player.getDuel() != null) {
 					    player.getDuel().removeItem(var.getSlot(), amount);
 					    break;
 				    }
 				    break; 
 				
 			    case 335: // Trade/stake interface - remove X.
 				    player.getTrade().removeItem(var.getSlot(), amount);
 				    break;
 				
			    case 620: // Shop - buy X.
 				    player.getShopSession().buyItem(var.getSlot(), amount);
 				    break;

                case 105: //Grand Exchange custom quantity and price inputs.
                    switch(var.getSlot()) {
                        case 0: //custom enter quantity
                            player.getGESession().setCustomAmount(amount);
                            break;
                        case 1: //custom enter per price
                            player.getGESession().setCustomPrice(amount);
                            break;
                    }
                    break;

			    case 305: // What would you like to make? - 4 options
				    if (player.getTemporaryAttribute("fletchType") == null) {
					    return;
				    }
				    int logType = (int) player.getTemporaryAttribute("fletchType");
				    switch(var.getSlot()) {
					    case 0:
						    MakeBows.cutLog(player, amount, logType, 0, (player.getTemporaryAttribute("stringingBow") == null ? false : (bool)player.getTemporaryAttribute("stringingBow")), true);
						    break;
						
					    case 1:
						    MakeBows.cutLog(player, amount, logType, 1, (player.getTemporaryAttribute("stringingBow") == null ? false : (bool)player.getTemporaryAttribute("stringingBow")), true);
						    break;
						
					    case 2:
						    MakeBows.cutLog(player, amount, 0, 2, false, true);
						    break;
						
					    case 3:
						    MakeBows.cutLog(player, amount, 0, 3, false, true);
						    break;
				    }
				    break;
				
			    case 306: // What would you like to make? - 5 options
				    switch(var.getSlot()) {
					    case 0:
						    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
						    break;
						
					    case 1:
						    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
						    break;
						
					    case 2:
						    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
						    break;
						
					    case 3:
						    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
						    break;
						
					    case 4:
						    Clay.craftClay(player, amount, craftType, var.getSlot(), true);
						    break;
				    }
				    break;
				
			    case 309: // What would you like to make - 1 option
				    if (var.getSlot() >= 50 && var.getSlot() <= 60) { // Cut gem
					    Jewellery.cutGem(player, craftType, amount, true);
					    break;
				    } else if (var.getSlot() >= 100 && var.getSlot() <= 110) { // String amulet
					    Jewellery.stringAmulet(player, craftType, amount, true);
					    break;
				    }
				    switch(var.getSlot()) {
					    case 0:
						    MakeXbow.createXbow(player, amount, (int) (player.getTemporaryAttribute("bowType2") == null ? -1 : (int) player.getTemporaryAttribute("bowType2")), (bool) (player.getTemporaryAttribute("stringingBow") == null ? false :(bool) player.getTemporaryAttribute("stringingBow")), true);
						    break;
						
					    case 1:
						    MakeBows.cutLog(player, amount, (int) (player.getTemporaryAttribute("fletchType") == null ? -1 : (int) player.getTemporaryAttribute("fletchType")), (int) (player.getTemporaryAttribute("bowType") == null ? -1 : (int) player.getTemporaryAttribute("bowType")), true, true);
						    break;
						
					    case 2:
						    Herblore.grindIngredient(player, amount, true);
						    break;
						
					    case 3:
						    Herblore.makeUnfinishedPotion(player, amount, true);
						    break;
						
					    case 4:
						    Herblore.completePotion(player, amount, true);
						    break;
						
					    case 5:
						    Cooking.cookItem(player, amount, true, player.getTemporaryAttribute("cookingFireLocation") != null);
						    break;
						
					    case 6:
						    MakeAmmo.makeBoltTip(player, (int) (player.getTemporaryAttribute("boltTips") == null ? -1 : (int) player.getTemporaryAttribute("boltTips")), amount, true);
						    break;
				    }
				    break;
				
			    case 311: // Smelting interface
				    switch(var.getSlot()) {
					    case 13: // Bronze
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
						
					    case 17: // Blurite
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
						
					    case 21: // Iron
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
						
					    case 25: // Silver
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
						
					    case 29: // Steel
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
						
					    case 33: // Gold
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
						
					    case 37: // Mithril
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
						
					    case 41: // Adamant
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
						
					    case 45: // Rune
						    Smelting.smeltOre(player, var.getSlot(), true, amount);
						    break;
				    }
				    break;
				
			    case 300: // Smithing interface.
				    if (player.getTemporaryAttribute("smithingItem") == null) {
					    return;
				    }
				    SmithBar item = (SmithBar) player.getTemporaryAttribute("smithingItem");
				    if (item != null) {
					    item.setAmount(amount);
				    }
				    Smithing.smithItem(player, var.getSlot(), amount, false);
				    break;
			    }
			    player.removeTemporaryAttribute("interfaceVariable");
	    }
	    private void handleClickFive(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
		    int child = packet.readUShort();
		    int slot = packet.readUShort();
		    Console.WriteLine("InterfaceOption 5: interfaceId: " + interfaceId);
		    switch(interfaceId) {
			    case 763: // Bank inventory - X.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    break;
				
			    case 762: // Bank - X.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    break;
				
			    case 336: // Trade inventory - trade X.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    break;
				
			    case 335: // Trade interface - remove X.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    break;
				
 			    case 631: // Duel interface - remove All
 				    if (player.getDuel() != null) {
 					    player.getPackets().displayEnterAmount();
 					    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
					    break;
 				    }
 				    break;
			
			    case 620: // Shop - buy X/buy 50.
				    if (player.getShopSession().isInMainStock()) {
					    player.getPackets().displayEnterAmount();
					    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(interfaceId, slot));
				    } else {
					    player.getShopSession().buyItem(slot, 50);
				    }
				    break;
				
 			    case 621: // Shop - Sell 50.
 				    player.getShopSession().sellItem(slot, 50);
 				    break;
 				
 			    case 590: // Clan chat setup
 				    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
				    if (clan == null) {
					    player.getPackets().sendMessage("Please create your clan chat before changing settings.");
					    break;
				    }
 				    switch(child) {
	 				    case 23: // "Who can enter chat" - sergeant.
                            clan.setEnterRights(Clan.ClanRank.SERGEANT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
	 					    break;
	 					
	 				    case 24: // "Who can talk in chat" - sergeant.
                            clan.setTalkRights(Clan.ClanRank.SERGEANT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
	 					    break;
	 					
	 				    case 25: // // "Who can kick in chat" - sergeant.
                            clan.setKickRights(Clan.ClanRank.SERGEANT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
	 					    break;
	 					
	 				    case 26: // "Who can share loot" - sergeant.
                            clan.setLootRights(Clan.ClanRank.SERGEANT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
	 					    break;
 				    }
 				    break;
		    }	
	    }
	    private void handleClickFour(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
		    int child = packet.readUShort();
		    int slot = packet.readUShort();
		    Console.WriteLine("InterfaceOption 4: interfaceId: " + interfaceId);
		    switch(interfaceId) {
			    case 763: // Bank inventory - Custom amount.
				    player.getBank().deposit(slot, player.getBank().getLastXAmount());
				    player.getBank().refreshBank();
				    break;
				
			    case 762: // Bank - Custom amount.
				    player.getBank().withdraw(slot, player.getBank().getLastXAmount());
				    player.getBank().refreshBank();
				    break;
			
			    case 154: // Craft normal leather.
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(154, child));
				    break;
				
			    case 542: // Glassblowing.
				    switch(child) {
					    case 40: // Make X beer glass.
					    case 41: // Make X candle lantern.
					    case 42: // Make X oil lamp.
					    case 38: // Make X vial.
					    case 44: // Make X Fishbowl
					    case 39: // Make X orb.
					    case 43: // Make X lantern lens
					    case 45: // Make X dorgeshuun light orb.
						    player.getPackets().displayEnterAmount();
						    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(542, child));
						    break;
				    }
				    break;
			    case 336: // Trade/stake inventory - trade all.
				    if (player.getTrade() != null) {
					    player.getTrade().tradeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
					    break;
				    }
				    if (player.getDuel() != null) {
					    player.getDuel().stakeItem(slot, player.getInventory().getItemAmount(player.getInventory().getItemInSlot(slot)));
					    break;
				    }
				    break;
				
			    case 335: // Trade interface - remove all.
				    player.getTrade().removeItem(slot, player.getTrade().getItemAmount(player.getTrade().getItemInSlot(slot)));
				    break;
				
 			    case 631: // Duel interface - remove All
 				    if (player.getDuel() != null) {
					    player.getDuel().removeItem(slot, player.getDuel().getItemAmount(player.getDuel().getItemInSlot(slot)));
					    break;
 				    }
 				    break;
				
 			    case 620: // Shop - buy 10.
 				    player.getShopSession().buyItem(slot, 10);
 				    break;
 				
 			    case 621: // Shop - sell 10.
 				    player.getShopSession().sellItem(slot, 10);
 				    break;
 				
 			    case 590: // Clan chat setup
 				    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
				    if (clan == null) {
					    player.getPackets().sendMessage("Please create your clan chat before changing settings.");
					    break;
				    }
 				    switch(child) {
	 				    case 23: // "Who can enter chat" - corporal.
                            clan.setEnterRights(Clan.ClanRank.CORPORAL);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
	 					    break;
	 					
	 				    case 24: // "Who can talk in chat" - corporal.
                            clan.setTalkRights(Clan.ClanRank.CORPORAL);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
	 					    break;
	 					
	 				    case 25: // // "Who can kick in chat" - corporal.
                            clan.setKickRights(Clan.ClanRank.CORPORAL);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getKickRights()), 590, 25);
	 					    break;
	 					
	 				    case 26: // "Who can share loot" - corporal.
                            clan.setLootRights(Clan.ClanRank.CORPORAL);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
	 					    break;
 				    }
 				    break;
		    }
	    }
	    private void handleClickThree(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
		    int child = packet.readUShort();
		    int slot = packet.readUShort();
		    Console.WriteLine("InterfaceOption 3: interfaceId: " + interfaceId);
		    switch(interfaceId) {
			    case 154: // Craft normal leather.
				    Leather.craftNormalLeather(player, child, player.getInventory().getItemAmount(1741), true);
				    break;
			
			    case 542: // Glassblowing.
				    int totalGlass = player.getInventory().getItemAmount(1775);
				    switch(child) {
					    case 40: // Make all beer glass.
						    Glass.craftGlass(player, totalGlass, 0, true);
						    break;
						
					    case 41: // Make all candle lantern.
						    Glass.craftGlass(player, totalGlass, 1, true);
						    break;
						
					    case 42: // Make all oil lamp.
						    Glass.craftGlass(player, totalGlass, 2, true);
						    break;
						
					    case 38: // Make all vial.
						    Glass.craftGlass(player, totalGlass, 3, true);
						    break;
						
					    case 44: // Make all Fishbowl
						    Glass.craftGlass(player, totalGlass, 4, true);
						    break;
						
					    case 39: // Make all orb.
						    Glass.craftGlass(player, totalGlass, 5, true);
						    break;
						
					    case 43: // Make all lantern lens
						    Glass.craftGlass(player, totalGlass, 6, true);
						    break;
						
					    case 45: // Make all dorgeshuun light orb.
						    Glass.craftGlass(player, totalGlass, 7, true);
						    break;
				    }
				    break;
				
			    case 763: // Bank inventory - 10.
				    player.getBank().deposit(slot, 10);
				    player.getBank().refreshBank();
				    break;
				
			    case 762: // Bank - 10.
				    player.getBank().withdraw(slot, 10);
				    player.getBank().refreshBank();
				    break;
				
 			    case 336: // Trade/stake inventory - trade 10.
 				    if (player.getTrade() != null) {
 					    player.getTrade().tradeItem(slot, 10);
 					    break;
 				    }
 				    if (player.getDuel() != null) {
 					    player.getDuel().stakeItem(slot, 10);
 					    break;
 				    }
 				    break;
 				
 			    case 335: // Trade interface - remove 10.
 				    player.getTrade().removeItem(slot, 10);
 				    break;
 				
 			    case 631: // Duel interface - remove 10.
 				    if (player.getDuel() != null) {
					    player.getDuel().removeItem(slot, 5);
					    break;
 				    }
 				    break;
 				
 			    case 620: // Shop - buy 5.
 				    player.getShopSession().buyItem(slot, 5);
 				    break;
 				
 			    case 621: // Shop - sell 5.
 				    player.getShopSession().sellItem(slot, 5);
 				    break;
 				
 			    case 590: // Clan chat setup
 				    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
				    if (clan == null) {
					    player.getPackets().sendMessage("Please create your clan chat before changing settings.");
					    break;
				    }
 				    switch(child) {
	 				    case 23: // "Who can enter chat" - recruit.
                            clan.setEnterRights(Clan.ClanRank.RECRUIT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
	 					    break;
	 					
	 				    case 24: // "Who can talk in chat" - recruit.
                            clan.setTalkRights(Clan.ClanRank.RECRUIT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
	 					    break;
	 					
	 				    case 26: // "Who can share loot" - recruit.
                            clan.setLootRights(Clan.ClanRank.RECRUIT);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
	 					    break;
 				    }
 				    break;
		    }
	    }
	    private void handleClickTwo(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
		    int child = packet.readUShort();
		    int slot = packet.readUShort();
            Console.WriteLine("InterfaceOption 2: interfaceId: " + interfaceId);
		    switch(interfaceId) {
			    case 105: // GE Interface
				    switch(child) {
					    case 209: // "Collect" and "Collect-items" option
						    player.getGESession().collectSlot1(false);
						    break;
						
					    case 211: // Left box "Collect" option (coins)
						    player.getGESession().collectSlot2();
						    break;
				    }
				    break;
		
			    case 154: // Craft normal leather.
				    Leather.craftNormalLeather(player, child, 5, true);
				    break;
			
			    case 542: // Glassblowing.
				    switch(child) {
					    case 40: // Make 5 beer glass.
						    Glass.craftGlass(player, 5, 0, true);
						    break;
						
					    case 41: // Make 5 candle lantern.
						    Glass.craftGlass(player, 5, 1, true);
						    break;
						
					    case 42: // Make 5 oil lamp.
						    Glass.craftGlass(player, 5, 2, true);
						    break;
						
					    case 38: // Make 5 vial.
						    Glass.craftGlass(player, 5, 3, true);
						    break;
						
					    case 44: // Make 5 Fishbowl
						    Glass.craftGlass(player, 5, 4, true);
						    break;
						
					    case 39: // Make 5 orb.
						    Glass.craftGlass(player, 5, 5, true);
						    break;
						
					    case 43: // Make 5 lantern lens
						    Glass.craftGlass(player, 5, 6, true);
						    break;
						
					    case 45: // Make 5 dorgeshuun light orb.
						    Glass.craftGlass(player, 5, 7, true);
						    break;
				    }
				    break;
			
			    case 763: // Bank inventory - 5.
				    player.getBank().deposit(slot, 5);
				    player.getBank().refreshBank();
				    break;
				
			    case 762: // Bank - 5.
				    player.getBank().withdraw(slot, 5);
				    player.getBank().refreshBank();
				    break;
				
 			    case 336: // Trade/stake inventory - trade 5.
 				    if (player.getTrade() != null) {
 					    player.getTrade().tradeItem(slot, 5);
 					    break;
 				    }
 				    if (player.getDuel() != null) {
 					    player.getDuel().stakeItem(slot, 5);
 					    break;
 				    }
 				    break;
 				
 			    case 631: // Duel interface - remove 5
 				    if (player.getDuel() != null) {
					    player.getDuel().removeItem(slot, 5);
					    break;
 				    }
 				    break;
 				
 			    case 335: // Trade interface - remove 5.
 				    player.getTrade().removeItem(slot, 5);
 				    break;
 				
 			    case 620: // Shop - buy 1.
 				    player.getShopSession().buyItem(slot, 1);
 				    break;
 				
 			    case 621: // Shop - sell 1.
 				    player.getShopSession().sellItem(slot, 1);
 				    break;
 				
 			    case 590: // Clan chat setup
 				    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
				    if (clan == null) {
					    player.getPackets().sendMessage("Please create your clan chat before changing settings.");
					    break;
				    }
 				    switch(child) {
	 				    case 23: // "Who can enter chat" - any friends.
	 					    clan.setEnterRights(Clan.ClanRank.FRIEND);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
	 					    break;
	 					
	 				    case 24: // "Who can talk in chat" - any friends.
                            clan.setTalkRights(Clan.ClanRank.FRIEND);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
	 					    break;
	 					
	 				    case 26: // "Who can share loot" - any friends.
	 					    clan.setLootRights(Clan.ClanRank.FRIEND);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
	 					    break;
 				    }
 				    break;
		    }
	    }
	    private void handleActionButton(Player player, Packet packet) {
		    int interfaceId = packet.readUShort();
            ushort buttonId = packet.readUShort();
            ushort buttonId2 = 0;
		    if(packet.getLength() >= 6) {
                buttonId2 = packet.readUShort();
		    }
		    if(buttonId2 == 65535) {
			    buttonId2 = 0;
		    }
		    Console.WriteLine("button = " + interfaceId + " " +buttonId + " " +buttonId2);
		    switch(interfaceId) {
			    case 751: 
                    switch(buttonId) {
                        case 27: // Report Abuse button click
                            //This is just a test. (you need to code a Static Handler for ReportAbuse.
                            player.getPackets().displayInterface(553); //Opens Report Abuse box
				            break;
                    }
                    break;
			    case 374: // Tzhaar fight pits viewing orb
				    Server.getMinigames().getFightPits().useOrb(player, buttonId);
				    break;

                case 389: // GE Item Search "X" for closing it.
                    player.getPackets().sendInterface(0, 752, 6, 137); // Removes the item search
                    break;

			    case 107: // GE Sell inventory.
				    if (player.getGESession() == null) {
					    break;
				    }
				    switch(buttonId) {
					    case 18: // Offer
						    player.getGESession().offerSellItem(buttonId2);
						    break;
				    }
				    break;
			
			    case 105: // GE interface
				    if (player.getGESession() == null) {
					    break;
				    }
				    switch(buttonId) {
					    case 209: // Collect-notes
						    player.getGESession().collectSlot1(true);
						    break;
				
					    case 203: // Abort offer
						    player.getGESession().abortOffer();
						    break;
						
					    case 31: // Sell, box 1
						    player.getGESession().newSellOffer(0);
						    break;
				
					    case 30: // Buy, box 1
						    player.getGESession().newBuyOffer(0);
						    break;
						
					    case 18: // Check status, box 1
						    player.getGESession().checkOffer(0);
						    break;
						
					    case 46: // Buy, box 2
						    player.getGESession().newBuyOffer(1);
						    break;
						
					    case 47: // Sell, box 2
						    player.getGESession().newSellOffer(1);
						    break;
						
					    case 34: // Check status, box 2
						    player.getGESession().checkOffer(1);
						    break;
						
					    case 62: // Buy, box 3
						    player.getGESession().newBuyOffer(2);
						    break;
						
					    case 63: // Sell, box 3
						    player.getGESession().newSellOffer(2);
						    break;
						
					    case 50: // Check status, box 3
						    player.getGESession().checkOffer(2);
						    break;
						
					    case 81: // Buy, box 4
						    player.getGESession().newBuyOffer(3);
						    break;
						
					    case 82: // Sell, box 4
						    player.getGESession().newSellOffer(3);
						    break;
						
					    case 69: // Check status, box 4
						    player.getGESession().checkOffer(3);
						    break;
						
					    case 100: // Buy, box 5
						    player.getGESession().newBuyOffer(4);
						    break;
						
					    case 101: // Sell, box 5
						    player.getGESession().newSellOffer(4);
						    break;
						
					    case 88: // Check status, box 5
						    player.getGESession().checkOffer(4);
						    break;
						
					    case 119: // Buy, box 6
						    player.getGESession().newBuyOffer(5);
						    break;
						
					    case 120: // Sell, box 6
						    player.getGESession().newSellOffer(5);
						    break;
						
					    case 107: // Check status, box 6
						    player.getGESession().checkOffer(5);
						    break;
						
					    case 127: // The "back" button
                            player.getGESession().goBackToGrandExchange();
						    break;
						
					    case 194: // Search for item
						    player.getGESession().openItemSearch();
						    break;
						
					    case 159: // Increment amount by 1
						    player.getGESession().incrementAmount(1, false);
						    break;
						
					    case 157: // Decrease amount by 1
						    player.getGESession().decreaseAmount(1);
						    break;
						
					    case 162: // Increase amount by +1
                            player.getGESession().incrementAmount(1, true);
						    break;
						
					    case 164: // Increase amount by +10
                            player.getGESession().incrementAmount(10, true);
						    break;
						
					    case 166: // Increase amount by +100
                            player.getGESession().incrementAmount(100, true);
						    break;
						
					    case 168: // Increase amount by +1k (or All if selling)
						    player.getGESession().incrementAmount(1000, true);
						    break;
						case 170: //custom enter quantity
                            player.getPackets().displayEnterAmount();
                            player.setTemporaryAttribute("interfaceVariable", new EnterVariable(105, 0));
                            break;
                        case 185: //custom enter per price
                            player.getPackets().displayEnterAmount();
                            player.setTemporaryAttribute("interfaceVariable", new EnterVariable(105, 1));
                            break;

					    case 177: // Set price to minimum
						    player.getGESession().setPrice(0);
						    break;
						
					    case 180: // Set price to medium
						    player.getGESession().setPrice(1);
						    break;
						
					    case 183: // Set price to maximum
						    player.getGESession().setPrice(2);
						    break;
						
					    case 171: // Set price -1
						    player.getGESession().setPrice(3);
						    break;
						
					    case 173: // Set price +1
						    player.getGESession().setPrice(4);
						    break;
						
					    case 190: // Confirm offer
						    player.getGESession().confirmOffer();
						    break;
				    }
				    break;
			
			    case 161: // Slayer points interfaces
			    case 163:
			    case 164:
				    Slayer.handlePointsInterface(player, interfaceId, buttonId);
				    break;
			
		
			    case 675: // Craft jewellery:
				    player.getPackets().displayEnterAmount();
				    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(675, buttonId));
				    break;
		
			    case 154: // Craft normal leather.
				    Leather.craftNormalLeather(player, buttonId, 1, true);
				    break;
				
			    case 542: // Craft glass.
				    switch (buttonId) {
					    case 40: // Make 1 beer glass.
						    Glass.craftGlass(player, 1, 0, true);
						    break;
						
					    case 41: // Make 1 candle lantern.
						    Glass.craftGlass(player, 1, 1, true);
						    break;
						
					    case 42: // Make 1 oil lamp.
						    Glass.craftGlass(player, 1, 2, true);
						    break;
						
					    case 38: // Make 1 vial.
						    Glass.craftGlass(player, 1, 3, true);
						    break;
						
					    case 44: // Make 1 Fishbowl
						    Glass.craftGlass(player, 1, 4, true);
						    break;
						
					    case 39: // Make 1 orb.
						    Glass.craftGlass(player, 1, 5, true);
						    break;
						
					    case 43: // Make 1 lantern lens
						    Glass.craftGlass(player, 1, 6, true);
						    break;
						
					    case 45: // Make 1 dorgeshuun light orb.
						    Glass.craftGlass(player, 1, 7, true);
						    break;
				    }
				    break;
			
			    case 271 : // Prayer tab.
				    if (!Prayer.canUsePrayer(player, buttonId)) {
					    Prayer.deactivateAllPrayers(player);
					    break;
				    }
				    switch(buttonId) {
					    case 5: // Thick skin.
						    Prayer.togglePrayer(player, PrayerData.Prayer.THICK_SKIN);
						    break;
						
					    case 15: // Rock skin.
                            Prayer.togglePrayer(player, PrayerData.Prayer.ROCK_SKIN);
						    break;
						
					    case 31: // Steel skin.
                            Prayer.togglePrayer(player, PrayerData.Prayer.STEEL_SKIN);
						    break;
						
					    case 7: // Burst of strength.
                            Prayer.togglePrayer(player, PrayerData.Prayer.BURST_OF_STRENGTH);
						    break;
						
					    case 17: // Superhuman strength.
                            Prayer.togglePrayer(player, PrayerData.Prayer.SUPERHUMAN_STRENGTH);
						    break;
						
					    case 33: // Ultimate strength.
                            Prayer.togglePrayer(player, PrayerData.Prayer.ULTIMATE_STRENGTH);
						    break;
						
					    case 9: // Clarity of thought.
                            Prayer.togglePrayer(player, PrayerData.Prayer.CLARITY_OF_THOUGHT);
						    break;
						
					    case 19: // Improved reflexes.
                            Prayer.togglePrayer(player, PrayerData.Prayer.IMPROVED_REFLEXES);
						    break;
						
					    case 35: // Incredible reflexes.
						    Prayer.togglePrayer(player, PrayerData.Prayer.INCREDIBLE_REFLEXES);
						    break;
						
					    case 37: // Magic protect.
                            Prayer.togglePrayer(player, PrayerData.Prayer.PROTECT_FROM_MAGIC);
						    break;
						
					    case 39: // Ranged protect.
                            Prayer.togglePrayer(player, PrayerData.Prayer.PROTECT_FROM_RANGED);
						    break;
						
					    case 41: // Melee protect.
                            Prayer.togglePrayer(player, PrayerData.Prayer.PROTECT_FROM_MELEE);
						    break;
						
					    case 47: // Retribution.
                            Prayer.togglePrayer(player, PrayerData.Prayer.RETRIBUTION);
						    break;
						
					    case 49: // Redemption.
                            Prayer.togglePrayer(player, PrayerData.Prayer.REDEMPTION);
						    break;
						
					    case 51: // Smite.
                            Prayer.togglePrayer(player, PrayerData.Prayer.SMITE);
						    break;
						
					    case 55: // Chivalry.
                            Prayer.togglePrayer(player, PrayerData.Prayer.CHIVALRY);
						    break;
						
					    case 57: // Piety.
                            Prayer.togglePrayer(player, PrayerData.Prayer.PIETY);
						    break;
						
					    case 25: // Protect item.
                            Prayer.togglePrayer(player, PrayerData.Prayer.PROTECT_ITEM);
						    break;
						
					    case 21: // Rapid restore
                            Prayer.togglePrayer(player, PrayerData.Prayer.RAPID_RESTORE);
						    break;
						
					    case 23: // Rapid heal.
                            Prayer.togglePrayer(player, PrayerData.Prayer.RAPID_HEAL);
						    break;
						
					    case 11: // Sharp eye.
                            Prayer.togglePrayer(player, PrayerData.Prayer.SHARP_EYE);
						    break;
						
					    case 27: // Hawk Eye.
                            Prayer.togglePrayer(player, PrayerData.Prayer.HAWK_EYE);
						    break;
						
					    case 43: // Eagle Eye.
                            Prayer.togglePrayer(player, PrayerData.Prayer.EAGLE_EYE);
						    break;
						
					    case 13: // Mystic will.
                            Prayer.togglePrayer(player, PrayerData.Prayer.MYSTIC_WILL);
						    break;
						
					    case 29: // Mystic Lore.
                            Prayer.togglePrayer(player, PrayerData.Prayer.MYSTIC_LORE);
						    break;
						
					    case 45: // Mystic Might.
                            Prayer.togglePrayer(player, PrayerData.Prayer.MYSTIC_MIGHT);
						    break;
				    }
				    break;
				
			    case 90: // Staff attack interface.
				    switch(buttonId) {
					    case 5: // Select spell (Magic XP)
						    MagicData.configureSelectSpellInterface(player);
						    break;
						
					    case 9: // Auto retaliate.
						    player.toggleAutoRetaliate();
						    break;
						
 					    default:
 						    MagicData.cancelAutoCast(player, true);
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
				    }
				    break;
				
			    case 388: // Ancient magic autocast select spell.
				    switch(buttonId) {
					    case 0: // Smoke rush.
						    MagicData.setAutoCastSpell(player, 16, 8, true);
						    break;
						
					    case 1: // Shadow rush.
						    MagicData.setAutoCastSpell(player, 17, 12, true);
						    break;
						
					    case 2: // Blood rush.
						    MagicData.setAutoCastSpell(player, 18, 4, true);
						    break;
						
					    case 3: // Ice rush.
						    MagicData.setAutoCastSpell(player, 19, 0, true);
						    break;
											
					    case 4: // Smoke burst.
						    MagicData.setAutoCastSpell(player, 20, 10, true);
						    break;
						
					    case 5: // Shadow burst.
						    MagicData.setAutoCastSpell(player, 21, 14, true);
						    break;
						
					    case 6: // Blood burst.
						    MagicData.setAutoCastSpell(player, 22, 6, true);
						    break;
						
					    case 7: // Ice burst.
						    MagicData.setAutoCastSpell(player, 23, 2, true);
						    break;
						
					    case 8: // Smoke blitz.
						    MagicData.setAutoCastSpell(player, 24, 9, true);
						    break;
						
					    case 9: // Shadow blitz.
						    MagicData.setAutoCastSpell(player, 25, 13, true);
						    break;
						
					    case 10: // Blood blitz.
						    MagicData.setAutoCastSpell(player, 26, 5, true);
						    break;
						
					    case 11: // Ice blitz.
						    MagicData.setAutoCastSpell(player, 27, 1, true);
						    break;

					    case 12: // Smoke barrage.
						    MagicData.setAutoCastSpell(player, 28, 11, true);
						    break;
						
					    case 13: // Shadow barrage.
						    MagicData.setAutoCastSpell(player, 29, 15, true);
						    break;
						
					    case 14: // Blood barrage.
						    MagicData.setAutoCastSpell(player, 30, 7, true);
						    break;
						
					    case 15: // Ice barrage.
						    MagicData.setAutoCastSpell(player, 31, 3, true);
						    break;

					    case 16: // Cancel.
                            MagicData.cancelAutoCast(player, false);
						    break;
				    }
				    break;
				
			    case 406: // Void knight mace autocast select spell.
				    switch(buttonId) {
					    case 0: // Crumble undead.
						    MagicData.setAutoCastSpell(player, 32, 22, false);
						    break;
						
					    case 1: // Guthix claws.
						    MagicData.setAutoCastSpell(player, 34, 42, false);
						    break;
						
					    case 2: // Wind wave.
						    MagicData.setAutoCastSpell(player, 12, 45, false);
						    break;
						
					    case 3: // Water wave.
						    MagicData.setAutoCastSpell(player, 13, 48, false);
						    break;
						
					    case 4: // Earth wave.
						    MagicData.setAutoCastSpell(player, 14, 52, false);
						    break;
						
					    case 5: // Fire wave.
						    MagicData.setAutoCastSpell(player, 15, 55, false);
						    break;
					
					    case 6: // Cancel.
						    MagicData.cancelAutoCast(player, false);
						    break;
			    }
			    break;
				
			    case 310: // Slayer staff autocast select spell.
				    switch(buttonId) {
					    case 0: // Crumble undead.
						    MagicData.setAutoCastSpell(player, 32, 22, false);
						    break;
						
					    case 1: // Slayer dart.
						    MagicData.setAutoCastSpell(player, 33, 31, false);
						    break;
						
					    case 2: // Wind wave.
                            MagicData.setAutoCastSpell(player, 12, 45, false);
						    break;
						
					    case 3: // Water wave.
                            MagicData.setAutoCastSpell(player, 13, 48, false);
						    break;
						
					    case 4: // Earth wave.
                            MagicData.setAutoCastSpell(player, 14, 52, false);
						    break;
						
					    case 5: // Fire wave.
                            MagicData.setAutoCastSpell(player, 15, 55, false);
						    break;
					
					    case 6: // Cancel.
                            MagicData.cancelAutoCast(player, false);
						    break;
				    }
				    break;
				
			    case 319: // Normal magic autocast select spell.
				    switch(buttonId) {
					    case 0: // Wind strike.
                            MagicData.setAutoCastSpell(player, 0, 1, false);
						    break;
						
					    case 1: // Water strike.
                            MagicData.setAutoCastSpell(player, 1, 4, false);
						    break;
						
					    case 2: // Earth strike.
                            MagicData.setAutoCastSpell(player, 2, 6, false);
						    break;
						
					    case 3: // Fire strike.
                            MagicData.setAutoCastSpell(player, 3, 8, false);
						    break;
						
					    case 4: // Wind bolt.
                            MagicData.setAutoCastSpell(player, 4, 10, false);
						    break;
						
					    case 5: // Water bolt.
                            MagicData.setAutoCastSpell(player, 5, 14, false);
						    break;
						
					    case 6: // Earth bolt.
                            MagicData.setAutoCastSpell(player, 6, 17, false);
						    break;
						
					    case 7: // Fire bolt.
                            MagicData.setAutoCastSpell(player, 7, 20, false);
						    break;
						
					    case 8: // Wind blast.
                            MagicData.setAutoCastSpell(player, 8, 24, false);
						    break;
						
					    case 9: // Water blast.
                            MagicData.setAutoCastSpell(player, 9, 27, false);
						    break;
						
					    case 10: // Earth blast.
                            MagicData.setAutoCastSpell(player, 10, 33, false);
						    break;
						
					    case 11: // Fire blast.
                            MagicData.setAutoCastSpell(player, 11, 38, false);
						    break;

					    case 12: // Wind wave.
                            MagicData.setAutoCastSpell(player, 12, 45, false);
						    break;
						
					    case 13: // Water wave.
                            MagicData.setAutoCastSpell(player, 13, 48, false);
						    break;
						
					    case 14: // Earth wave.
                            MagicData.setAutoCastSpell(player, 14, 52, false);
						    break;
						
					    case 15: // Fire wave.
                            MagicData.setAutoCastSpell(player, 15, 55, false);
						    break;
						
					    case 16: // Cancel.
                            MagicData.cancelAutoCast(player, false);
						    break;
				    }
				    break;
		
			    case 182: // Logout tab.
				    player.getPackets().logout();
				    break;
			
			    case 261: // Settings tab.
				    switch(buttonId) {
					    case 16: // Display settings.
						    player.getPackets().displayInterface(742);
						    break;
						
					    case 18: // Audio settings.
						    player.getPackets().displayInterface(743);
						    break;
		
					    case 3: // Run toggle.
						    if(!player.getWalkingQueue().isRunToggled()) {
							    player.getWalkingQueue().setRunToggled(true);
							    player.getPackets().sendConfig(173, 1);
						    } else {
							    player.getWalkingQueue().setRunToggled(false);
							    player.getPackets().sendConfig(173, 0);
						    }
						    break;
						
					    case 4: // Chat effect toggle.
						    if(!player.isChatEffectsEnabled()) {
							    player.setChatEffectsEnabled(true);
							    player.getPackets().sendConfig(171, 0);
						    } else {
							    player.setChatEffectsEnabled(false);
							    player.getPackets().sendConfig(171, 1);
						    }
						    break;
						
					    case 5: // Split private chat toggle.
						    if(!player.isPrivateChatSplit()) {
							    player.setPrivateChatSplit(true);
							    player.getPackets().sendConfig(287, 1);
						    } else {
							    player.setPrivateChatSplit(false);
							    player.getPackets().sendConfig(287, 0);
						    }
						    break;
						
					    case 7: // Accept aid toggle.
						    if(!player.isAcceptAidEnabled()) {
							    player.setAcceptAidEnabled(true);
							    player.getPackets().sendConfig(427, 1);
						    } else {
							    player.setAcceptAidEnabled(false);
							    player.getPackets().sendConfig(427, 0);
						    }
						    break;
						
					    case 6: // Mouse buttons toggle.
						    if(!player.isMouseTwoButtons()) {
							    player.setMouseTwoButtons(true);
							    player.getPackets().sendConfig(170, 0);
						    } else {
							    player.setMouseTwoButtons(false);
							    player.getPackets().sendConfig(170, 1);
						    }
						    break;
				    }
				    break;
				
			    case 589: // Clan chat 
				    if (buttonId == 9) {
					    foreach(long friend in player.getFriends().getFriendsList()) {
						    player.getPackets().sendFriend(friend, player.getFriends().getWorld(friend));
					    }
					    Server.getClanManager().openClanSetup(player);
					    break;
				    }
				    break;
				
			    case 590: // Clan chat setup
 				    Clan clan = Server.getClanManager().getClanByOwner(player.getLoginDetails().getUsername());
				    if (clan == null) {
					    break;
				    }
				    switch(buttonId) {
					    case 22: // Clan name
						    player.getPackets().displayEnterText("Enter clan name :");
						    player.setTemporaryAttribute("interfaceVariable", new EnterVariable(590, 0));
						    break;
						
	 				    case 23: // "Who can enter chat" - anyone.
                            clan.setEnterRights(Clan.ClanRank.NO_RANK);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getEnterRights()), 590, 23);
	 					    break;
	 					
	 				    case 24: // "Who can talk in chat" - anyone.
                            clan.setTalkRights(Clan.ClanRank.NO_RANK);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getTalkRights()), 590, 24);
	 					    break;
	 					
	 				    case 26: // "Who can share loot" - anyone.
                            clan.setLootRights(Clan.ClanRank.NO_RANK);
	 					    player.getPackets().modifyText(clan.getRankString(clan.getLootRights()), 590, 26);
	 					    break;
				    }
				    break;
				
			    case 763: // Bank inventory
				    switch(buttonId) {
					    case 0: // Deposit 1.
						    player.getBank().deposit(buttonId2, 1);
						    player.getBank().refreshBank();
						    break;
				    }
				    break;
				
			    case 762: // Bank
				    switch(buttonId) {		
					    case 73: // withdraw 1.
						    player.getBank().withdraw(buttonId2, 1);
						    player.getBank().refreshBank();
						    break;
						
					    case 16: // Note item.
						    player.getBank().asNote();
						    break;
						
					    case 41: // first (main) bank tab
						    player.getBank().setCurrentTab(10);
						    break;
						
					    case 39: // first bank tab
						    player.getBank().setCurrentTab(2);
						    break;
						
					    case 37: // second bank tab
						    player.getBank().setCurrentTab(3);
						    break;
						
					    case 35: // third bank tab
						    player.getBank().setCurrentTab(4);
						    break;
						
					    case 33: // fourth bank tab
						    player.getBank().setCurrentTab(5);
						    break;
						
					    case 31: // fifth bank tab
						    player.getBank().setCurrentTab(6);
						    break;
						
					    case 29: // sixth bank tab
						    player.getBank().setCurrentTab(7);
						    break;
						
					    case 27: // seventh bank tab
						    player.getBank().setCurrentTab(8);
						    break;
						
					    case 25: // eighth bank tab
						    player.getBank().setCurrentTab(9);
						    break;
				    }
				    break;
				
			    case 626: // Stake duel confirmation interface.
				    if (buttonId == 53) {
					    if (player.getDuel() != null) {
						    player.getDuel().acceptDuel();
						    break;
					    }
				    }
				    break;
				
			    case 631: // Stake duel first interface.
				    if (player.getDuel() != null) {
					    if (buttonId == 103) {
						    player.getDuel().removeItem(buttonId2, 1);
						    break;
					    } else {
						    player.getDuel().toggleDuelRules(buttonId);
						    break;
					    }
				    }
				    break;
				
			    case 387: // Equipment tab. 
				    switch(buttonId) {
					    case 55: // Character display.
						    player.getEquipment().displayEquipmentScreen();
						    break;
						
					    case 52: // Items kept on death.
						    ProtectedItems.displayItemsInterface(player);
						    break;
				    }
				    break;
				
			    case 274: // Quest tab.
				    switch(buttonId) {
					    case 3: // Achievment diary toggle.
						    player.getPackets().sendTab(85, 259);
						    player.setAchievementDiaryTab(true);
						    break;
				    }
				    break;
				
			    case 259: // Achievment diary tab.
				    switch(buttonId) {
					    case 8: // Quest tab toggle.
						    player.getPackets().sendTab(85, 274);
						    player.setAchievementDiaryTab(false);
						    break;
				    }
				    break;
				
			    case 620: // Shop interface.
				    if (player.getShopSession() == null) {
					    return;
				    }
				    switch(buttonId) {
					    case 26: // Player stock tab.
						    player.getShopSession().openPlayerShop();
						    break;
						
					    case 25: // Main stock tab.
						    player.getShopSession().openMainShop();
						    break;
						
					    case 23: // Value (main stock)	
					    case 24: // Value (player stock)
						    player.getShopSession().valueItem(buttonId2, false);
						    break;
				    }
				    break;
				
			    case 621: // Shop inventory.
				    if (player.getShopSession() == null) {
					    return;
				    }
				    switch(buttonId) {
					    case 0: // Value (player stock)
						    player.getShopSession().valueItem(buttonId2, true);
						    break;
				    }
				    break;
				
			    case 192: // Normal Magic tab.
				    switch(buttonId) {
					    case 0: // Home Teleport.
						    Teleport.homeTeleport(player);
						    break;
						
					    case 15: // Varrock teleport.
						    Teleport.teleport(player, 0);
						    break;
						
					    case 18: // Lumbridge teleport.
						    Teleport.teleport(player, 1);
						    break;
						
					    case 21: // Falador teleport.
						    Teleport.teleport(player, 2);
						    break;
						
					    case 23: // POH teleport.
						    player.getPackets().sendMessage("This teleport is unavailable.");
						    break;
						
					    case 26: // Camelot teleport.
						    Teleport.teleport(player, 3);
						    break;
						
					    case 32: // Ardougne teleport.
						    Teleport.teleport(player, 4);
						    break;
						
					    case 37: // Watchtower teleport.
						    player.getPackets().sendMessage("This teleport is unavailable.");
						    //Teleport.teleport(player, 5);
						    break;
						
					    case 44: // Trollheim teleport.
						    Teleport.teleport(player, 6);
						    break;
						
					    case 47: // Ape Atoll teleport.
						    player.getPackets().sendMessage("This teleport is unavailable.");
						    break;
						
					    case 58: // Charge.
						    MagicCombat.castCharge(player);
						    break;
				    }
				    break;
				
			    case 193: // Ancient magic tab.
				    switch(buttonId) {
					    case 20: // Paddewwa teleport.
						    Teleport.teleport(player, 7);
						    break;
						
					    case 21: // Senntisten teleport.
						    Teleport.teleport(player, 8);
						    break;
						
					    case 22: // Kharyrll teleport.
						    Teleport.teleport(player, 9);
						    break;
						
					    case 23: // Lassar teleport.
						    Teleport.teleport(player, 10);
						    break;
						
					    case 24: // Dareeyak teleport.
						    Teleport.teleport(player, 11);
						    break;
						
					    case 25: // Carrallanger teleport.
						    Teleport.teleport(player, 12);
						    break;
						
					    case 27: // Ghorrock teleport.
						    Teleport.teleport(player, 14);
						    break;
						
					    case 26: // Annakarl teleport.
						    Teleport.teleport(player, 13);
						    break;
						
					    case 28: // Ancients Home teleport.
						    Teleport.homeTeleport(player);
						    break;
				    }
				    break;
				
			    case 13: // Bank pin buttons.
				    if (buttonId == 29) {
					    player.getBank().forgotPin();
					    break;
				    }
				    player.getBank().handleEnterPin(buttonId);
				    break;
				
			    case 14: // Bank pin settings.
				    switch(buttonId) {
					    case 60: // Set new bank pin.
						    player.getBank().displayFirstConfirmation();
						    break;
					
					    case 61: // Change recovery delay.
						    player.getBank().changePinDelay();
						    break;
						
					    case 91: // "No, I might forget it!".
						    if (player.getBank().isPinPending()) {
							    player.getBank().cancelPendingPin();
							    break;
						    }
						    player.getBank().openPinSettings(2);
						    break;
						
					    case 89: // Yes i want to set a pin.
						    if (player.getBank().isPinPending()) {
							    player.getBank().verifyPin(true);
							    break;
						    }
						    player.getBank().openEnterPin();
						    break;
						
					    case 65: // Cancel pin that's pending.
						    player.getBank().openPinSettings(4);
						    break;
						
					    case 62: // Change pin.
						    player.getBank().changePin();
						    break;
						
					    case 63: // Delete pin.
						    player.getBank().deletePin();
						    break;
				    }
				    break;
				
			    case 464: // Emote tab.
				    Emotes.emote(player, buttonId);
				    break;
				
 			    case 320: // Skills Tab.
				    SkillMenu.display(player, buttonId);
				    break;
				
 			    case 499: // Skill menu side menu.
 				    SkillMenu.subMenu(player, buttonId);
 				    break;

 			    case 336: // Trade/duel inventory - trade 1.
 				    if (player.getTrade() != null) {
 					    player.getTrade().tradeItem(buttonId2, 1);
 					    break;
 				    }
 				    if (player.getDuel() != null) {
 					    player.getDuel().stakeItem(buttonId2, 1);
 					    break;
 				    }
 				    break;
 				
 			    case 335: // Trade interface.
 				    if (player.getTrade() == null) {
 					    break;
 				    }
				    switch(buttonId) {
					    case 16: // Accept trade.
						    player.getTrade().accept();
						    break;
						
					    case 18: // Decline trade.
						    player.getTrade().decline();
						    break;
						
					    case 30: // Offer 1
						    player.getTrade().removeItem(buttonId2, 1);
						    break;
				    }
 				    break;
 				
 			    case 334: // Trade confirmation.
 				    if (player.getTrade() == null) {
 					    break;
 				    }
 				    switch(buttonId) {
	 				    case 21: // Decline trade.
	 					    player.getTrade().decline();
						    break;
						
	 				    case 20: // Accept trade.
	 					    player.getTrade().accept();
	 					    break;
	 			    }
 				    break;
 				
 			    case 750: // Run button
				    if(!player.getWalkingQueue().isRunToggled()) {
					    player.getWalkingQueue().setRunToggled(true);
					    player.getPackets().sendConfig(173, 1);
				    } else {
					    player.getWalkingQueue().setRunToggled(false);
					    player.getPackets().sendConfig(173, 0);
				    }
				    break;
				
 			    case 667: // Equipment/bonuses interface.
 				    if (buttonId == 14) {
                        player.getEquipment().unequipItem((ItemData.EQUIP)buttonId2);
 					    break;
 				    }
 				    break;
				
 			    case 771: // Character design interface.
 				    ConfigureAppearance.sortButton(player, buttonId);
 				    break;
 				
 			    case 311: // Smelt interface.
 				    Smelting.smeltOre(player, buttonId, true, -1);
 				    break;
 				
 			    case 300: // Bar smithing interface.
 				    Smithing.smithItem(player, buttonId, 1, true);
 				    break;
 				
 			    case 92: // Unarmed attack interface.
 				    switch(buttonId) {			
 					    case 24: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 85: // Spear attack interface.
 				    switch(buttonId) {
					    case 8: // Special attack.
						    player.getSpecialAttack().toggleSpecBar();
						    break;
						
					    case 24: // Auto retaliate.
						    player.toggleAutoRetaliate();
						    break;
						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 93: // Whip attack interface.
 				    switch(buttonId) {
 					    case 8: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    break;
 						
 					    case 24: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 89: // Dagger attack interface.
 				    switch(buttonId) {					
 					    case 10: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    break;
 						
 					    case 26: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 82: // Longsword/scimitar attack interface.
 				    switch(buttonId) {					
 					    case 10: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    break;
 						
 					    case 26: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 78: // Claw attack interface.
 				    switch(buttonId) {
 					    case 10: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    break;
 						
 					    case 26: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 81: // Godsword attack interface.
 				    switch(buttonId) {
 					    case 10: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    break;
 						
 					    case 26: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 88: // Mace attack interface.
 				    switch(buttonId) {
 					    case 10: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    break;
 						
 					    case 26: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 76: // Granite maul attack interface.
 				    switch(buttonId) {
 					    case 8: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    break;
 						
 					    case 24: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 77: // Bow attack interface.
 				    switch(buttonId) {					
 					    case 11: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    break;
 						
 					    case 27: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 75: // Battleaxe attack interface.
 				    switch(buttonId) {
 					    case 10: // Special attack.
 						    player.getSpecialAttack().toggleSpecBar();
 						    player.getSpecialAttack().dragonBattleaxe();
 						    break;
 						
 					    case 26: // Auto retaliate.
 						    player.toggleAutoRetaliate();
 						    break;
 						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
 				    }
 				    break;
 				
 			    case 91: // Thrown weapon
 				    switch(buttonId) {
					    case 24: // Auto retaliate.
						    player.toggleAutoRetaliate();
						    break;
						
 					    default: 
 						    AttackInterface.configureButton(player, interfaceId, buttonId);
 						    break;
				    }
 				    break;
 				
 			    case 430: // Lunar interface
 				    switch(buttonId) {	
	 				    case 14: // Vengeance
	 					    Lunar.castLunarSpell(player, buttonId);
	 					    break;
 				    }
 				    break;
 				
 			    case 102: // Items on death interface
 				    if (buttonId == 18)
 					    player.getPackets().sendMessage("You will keep this item if you should you die.");
 				    else
 					    player.getPackets().sendMessage("You will lose this item if you should you die.");
 				    break;
 				
			    default:
				    if (interfaceId != 548 && interfaceId != 751) {
					    Console.WriteLine("Unhandled ActionButton : " + interfaceId + " " + buttonId + " " + buttonId2);
				    }
				    break;
		    }
	    }