コード例 #1
0
ファイル: OpenShop.cs プロジェクト: Krill156/SharpEMU
        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));
        }
コード例 #2
0
ファイル: BrokenBarrows.cs プロジェクト: Krill156/SharpEMU
 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);
 }