public static void interactWithAliMorissaae(Player p, Npc n) {
		    p.setEntityFocus(n.getClientIndex());
            AreaEvent interactWithAliMorissaaeAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
            interactWithAliMorissaaeAreaEvent.setAction(() => {
				n.setFaceLocation(p.getLocation());
				p.setFaceLocation(n.getLocation());
				p.setEntityFocus(65535);
				showAliDialogue(p, 205);
		    });
            Server.registerCoordinateEvent(interactWithAliMorissaaeAreaEvent);
	    }
	    public static void talkToBob(Player p, Npc npc, int item, int option) {
		    p.setEntityFocus(npc.getClientIndex());
            AreaEvent talkToBobAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1);
            talkToBobAreaEvent.setAction(() => {
				npc.setFaceLocation(p.getLocation());
				p.setFaceLocation(npc.getLocation());
				p.setEntityFocus(65535);
				if (option == 0) { // use item on bob
					if (item > 0) {
						p.setTemporaryAttribute("bobsAxesBarrowItem", item);
						showBobDialogue(p, 101);
					}
				} else if (option == 1) { // talk
					showBobDialogue(p, 107);
				} else if (option == 2) { // trade
					p.setShopSession(new ShopSession(p, 4));
				}
		    });
            Server.registerCoordinateEvent(talkToBobAreaEvent);
	    }
	    public static bool interactWithBoatNPC(Player p, Npc n) {
		    int id = n.getId();
		    if (id != 4540 && id != 1304 && id != 2436 && id != 3781 && id != 1361 && id != 4962) {
			    return false;
		    }
		    p.setEntityFocus(n.getClientIndex());
            AreaEvent interactWithBoatNPCAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
            interactWithBoatNPCAreaEvent.setAction(() => {
				n.setFaceLocation(p.getLocation());
				p.setFaceLocation(n.getLocation());
				p.setEntityFocus(65535);
				switch(n.getId()) {
					case 4540: // Home boat
						showBentleyDialogue(p, 240);
						break;
						
					case 1304: // Canifis sailor
						showCanifisSailorDialogue(p, 280);
						break;
						
					case 2436: // Waterbirth isle
						showJarvaldDialogue(p, 300);
						break;
						
					case 3781: // Pest control squire
						showSquireDialogue(p, 340);
						break;
						
					case 1361: // Warrior guild
						showArnorDialogue(p, 370);
						break;
					
					case 4962: // fremmenik shore
						showCaptainBarnabyDialogue(p, 410);
						break;
				}
		    });
            Server.registerCoordinateEvent(interactWithBoatNPCAreaEvent);
		    return true;
	    }
	    public static void interactWithAubury(Player p, Npc n, int option) {
		    p.setEntityFocus(n.getClientIndex());
            AreaEvent interactWithAuburyAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
            interactWithAuburyAreaEvent.setAction(() => {
				n.setFaceLocation(p.getLocation());
				p.setFaceLocation(n.getLocation());
				p.setEntityFocus(65535);
				switch(option) {
					case 1: // talk to
						
						break;
						
					case 2: // trade
						p.setShopSession(new ShopSession(p, 3));
						break;
						
					case 3: // teleport
						RuneCraft.teleportToEssMine(p, n);
						break;
				}
		    });
            Server.registerCoordinateEvent(interactWithAuburyAreaEvent);
	    }
	    public static bool dialogue(Player p, Npc npc, bool rightClickPay) {
		    if ((npc.getId() != 1055 && npc.getId() != 437) || (rightClickPay && npc.getId() != 437)) {
			    return false;
		    }
		    p.setEntityFocus(npc.getClientIndex());
            AreaEvent dialogueAreaEvent = new AreaEvent(p, npc.getLocation().getX()-1, npc.getLocation().getY()-1, npc.getLocation().getX()+1, npc.getLocation().getY()+1);
            dialogueAreaEvent.setAction(() => {
				npc.setFaceLocation(p.getLocation());
				int status = npc.getId() == 1055 ? 43 : 1;
				if (rightClickPay) {
					if (!p.getInventory().hasItemAmount(995, AGILITY_ARENA_PRICE)) {
						p.getPackets().sendMessage("You don't have enough money to pay the entrance fee.");
						return;
					}
					status = 29;
				}
				doDialogue(p, status);
		    });
            Server.registerCoordinateEvent(dialogueAreaEvent);
		    return true;
	    }
 public static bool talkToMaster(Player p, Npc npc)
 {
     for (int i = 0; i < SLAYER_MASTERS.Length; i++) {
         if (npc.getId() == (int)SLAYER_MASTERS[i][0]) {
             int j = i;
             p.setEntityFocus(npc.getClientIndex());
             AreaEvent talkToMasterAreaEvent = new AreaEvent(p, npc.getLocation().getX()-1, npc.getLocation().getY()-1, npc.getLocation().getX()+1, npc.getLocation().getY()+1);
             talkToMasterAreaEvent.setAction(() => {
                 p.setTemporaryAttribute("slayerMaster", j);
                 npc.setFaceLocation(p.getLocation());
                 p.setFaceLocation(npc.getLocation());
                 p.setEntityFocus(65535);
                 doDialogue(p, 1000);
             });
             Server.registerCoordinateEvent(talkToMasterAreaEvent);
             return true;
         }
     }
     return false;
 }
 public static bool openSlayerShop(Player p, Npc npc)
 {
     int id = npc.getId();
     if (id != 8273 && id != 1597 && id != 8274 && id != 1598 && id != 8275 || p.isDead()) {
         return false;
     }
     p.setEntityFocus(npc.getClientIndex());
     AreaEvent openSlayerShopAreaEvent = new AreaEvent(p, npc.getLocation().getX()-1, npc.getLocation().getY()-1, npc.getLocation().getX()+1, npc.getLocation().getY()+1);
     openSlayerShopAreaEvent.setAction(() => {
         p.setFaceLocation(npc.getLocation());
         npc.setFaceLocation(p.getLocation());
         p.setShopSession(new ShopSession(p, 2));
     });
     Server.registerCoordinateEvent(openSlayerShopAreaEvent);
     return true;
 }
 public static bool openPointsInterface(Player p, Npc npc)
 {
     int id = npc.getId();
     if (id != 8273 && id != 1597 && id != 8274 && id != 1598 && id != 8275 || p.isDead()) {
         return false;
     }
     p.setEntityFocus(npc.getClientIndex());
     AreaEvent openPointsInterfaceAreaEvent = new AreaEvent(p, npc.getLocation().getX()-1, npc.getLocation().getY()-1, npc.getLocation().getX()+1, npc.getLocation().getY()+1);
     openPointsInterfaceAreaEvent.setAction(() => {
         p.setEntityFocus(65535);
         npc.setFaceLocation(p.getLocation());
         displayPoints(p, 1);
     });
     Server.registerCoordinateEvent(openPointsInterfaceAreaEvent);
     return true;
 }
        private static void thieveNpc(Player p, Npc npc, int index)
        {
            AreaEvent thieveNpcAreaEvent = new AreaEvent(p, npc.getLocation().getX()-1, npc.getLocation().getY()-1, npc.getLocation().getX()+1, npc.getLocation().getY()+1);
            thieveNpcAreaEvent.setAction(() => {
                if (!canThieveNpc(p, npc, index)) {
                    return;
                }
                p.setFaceLocation(npc.getLocation());
                p.setLastAnimation(new Animation(881));
                p.getPackets().sendMessage("You attempt to pick the " + NPC_NAMES[index] + " pocket...");
                p.setTemporaryAttribute("lastPickPocket", Environment.TickCount);

                Event thieveNpcEvent = new Event(1000);
                thieveNpcEvent.setAction(() => {
                    thieveNpcEvent.stop();
                    if (!p.getLocation().withinDistance(npc.getLocation(), 2)) {
                        return;
                    }
                    if (successfulThieve(p, index, false)) {
                        int rewardIndex = misc.random(NPC_REWARD[index].Length - 1);
                        int reward = NPC_REWARD[index][rewardIndex];
                        int rewardAmount = NPC_REWARD_AMOUNT[index][rewardIndex];
                        if (index == 7) { // Master farmer.
                            if (misc.random(15) == 0) {
                                reward = HERB_SEEDS[misc.random(HERB_SEEDS.Length - 1)];
                            }
                        }
                        p.getSkills().addXp(Skills.SKILL.THIEVING, NPC_XP[index]);
                        p.getInventory().addItem(reward, rewardAmount);
                        p.getPackets().sendMessage("You pick the " + NPC_NAMES[index] + " pocket.");
                    } else {
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().sendMessage("You fail to pick the " + NPC_NAMES[index] + " pocket.");
                        p.getPackets().sendMessage("You've been stunned!");
                        npc.setForceText("What do you think you're doing?");
                        p.setTemporaryAttribute("unmovable", true);
                        p.setTemporaryAttribute("stunned", true);
                        p.setLastGraphics(new Graphics(80, 0, 100));
                        p.setLastAnimation(new Animation(p.getDefenceAnimation()));
                        p.hit(1);
                        npc.setFaceLocation(p.getLocation());
                        Event removeStunEvent = new Event(5000);
                        removeStunEvent.setAction(() => {
                            removeStunEvent.stop();
                            p.removeTemporaryAttribute("unmovable");
                            p.removeTemporaryAttribute("stunned");
                            p.setLastGraphics(new Graphics(65535));
                        });
                        Server.registerEvent(removeStunEvent);
                    }
                });
                Server.registerEvent(thieveNpcEvent);
            });
            Server.registerCoordinateEvent(thieveNpcAreaEvent);
        }