public static bool interactTzhaarNPC(Player p, Npc n, int option) { if (n.getId() != 2622 && n.getId() != 2620 && n.getId() != 2623 && n.getId() != 2619 && n.getId() != 2617 && n.getId() != 2618) { return false; } p.setEntityFocus(n.getClientIndex()); int npcX = n.getLocation().getX(); int npcY = n.getLocation().getY(); AreaEvent interactTzhaarNpcAreaEvent = new AreaEvent(p, npcX-1, npcY-1, npcX+1, npcY+1); interactTzhaarNpcAreaEvent.setAction(() => { p.setFaceLocation(n.getLocation()); p.setEntityFocus(65535); switch(n.getId()) { case 2619: // Bankers if (option == 1) { // Talk } else if (option == 2) { // Bank p.getBank().openBank(); } else if (option == 3) { // Collect } break; //TODO tzhaar stores case 2622: // Ore shop if (option == 1) { // Speak } else if (option == 2) { // Trade p.setShopSession(new ShopSession(p, 3)); } break; } }); Server.registerCoordinateEvent(interactTzhaarNpcAreaEvent); return true; }
public void execute(Player player, string[] arguments) { if (arguments.Length > 0) { int shopIndex = 0; if (!int.TryParse(arguments[0], out shopIndex)) { player.getPackets().sendMessage("[OpenShop command]: ::shop shop_number or just ::shop to open first one."); return; } Shop shop = Server.getShopManager().getShop(shopIndex); if (shop == null) { player.getPackets().sendMessage("[OpenShop command]: shop #" + shopIndex + " doesn't exist on server"); return; } player.setShopSession(new ShopSession(player, shopIndex)); } player.setShopSession(new ShopSession(player, 1)); }
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 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); }