Beispiel #1
0
        private static void HandleOpen(GameSession session, PacketReader packet)
        {
            int itemId = packet.ReadInt();

            Item item = session.Player.Inventory.Items.Values.FirstOrDefault(x => x.Id == itemId);

            if (item == null)
            {
                return;
            }

            ShopMetadata shop = ShopMetadataStorage.GetShop(item.ShopID);

            if (shop == null)
            {
                Console.WriteLine($"Unknown shop ID: {item.ShopID}");
                return;
            }

            session.Send(ShopPacket.Open(shop));
            foreach (ShopItem shopItem in shop.Items)
            {
                session.Send(ShopPacket.LoadProducts(shopItem));
            }
            session.Send(ShopPacket.Reload());
            session.Send(SystemShopPacket.Open());
        }
Beispiel #2
0
        public static void HandleOpen(GameSession session, IFieldObject <Npc> npcFieldObject)
        {
            NpcMetadata metadata = NpcMetadataStorage.GetNpc(npcFieldObject.Value.Id);

            ShopMetadata shop = ShopMetadataStorage.GetShop(metadata.ShopId);

            if (shop == null)
            {
                Console.WriteLine($"Unknown shop ID: {metadata.ShopId}");
                return;
            }

            session.Send(ShopPacket.Open(shop));
            session.Send(ShopPacket.LoadProducts(shop.Items));
            session.Send(ShopPacket.Reload());
            session.Send(NpcTalkPacket.Respond(npcFieldObject, NpcType.Default, DialogType.None, 0));
        }
Beispiel #3
0
        private static void HandleOpenViaItem(GameSession session, PacketReader packet)
        {
            byte unk    = packet.ReadByte();
            int  itemId = packet.ReadInt();

            List <Item> playerInventory = new(session.Player.Inventory.Items.Values);

            Item item = playerInventory.FirstOrDefault(x => x.Id == itemId);

            if (item == null)
            {
                return;
            }

            ShopMetadata shop = ShopMetadataStorage.GetShop(item.ShopID);

            session.Send(ShopPacket.Open(shop));
            session.Send(ShopPacket.LoadProducts(shop.Items));
        }
Beispiel #4
0
        private static void HandleMapleArenaShop(GameSession session, PacketReader packet)
        {
            bool openShop = packet.ReadBool();

            if (!openShop)
            {
                return;
            }

            ShopMetadata shop = ShopMetadataStorage.GetShop(168);

            session.Send(ShopPacket.Open(shop));
            foreach (ShopItem shopItem in shop.Items)
            {
                session.Send(ShopPacket.LoadProducts(shopItem));
            }
            session.Send(ShopPacket.Reload());
            session.Send(SystemShopPacket.Open());
        }