Esempio n. 1
0
        public static void OnOpenShopWindow(WorldClient client, INetPacketStream packet)
        {
            var openShopPacket = new OpenShopWindowPacket(packet);
            var npcEvent       = new NpcShopOpenEventArgs(openShopPacket.ObjectId);

            client.Player.NotifySystem <NpcShopSystem>(npcEvent);
        }
Esempio n. 2
0
        /// <summary>
        /// Opens the NPC Shop.
        /// </summary>
        /// <param name="player">Player entity</param>
        /// <param name="e"></param>
        private void OpenShop(IPlayerEntity player, NpcShopOpenEventArgs e)
        {
            var npc = player.Context.FindEntity <INpcEntity>(e.NpcObjectId);

            if (npc == null)
            {
                Logger.Error("ShopSystem: Cannot find NPC with object id : {0}", e.NpcObjectId);
                return;
            }

            if (npc.Shop == null)
            {
                Logger.Error("ShopSystem: NPC '{0}' doesn't have a shop.", npc.Object.Name);
                return;
            }

            player.PlayerData.CurrentShopName = npc.Object.Name;

            WorldPacketFactory.SendNpcShop(player, npc);
        }