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()); }
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; } Shop shop = DatabaseManager.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()); }
private static void HandleOpenViaItem(GameSession session, PacketReader packet) { byte unk = packet.ReadByte(); int itemId = packet.ReadInt(); IInventory inventory = session.Player.Inventory; Item item = inventory.GetById(itemId); if (item == null) { return; } Shop shop = DatabaseManager.Shops.FindById(item.ShopID); if (shop == null) { Logger.Warning("Unknown shop ID: {shopID}", item.ShopID); return; } session.Send(ShopPacket.Open(shop, 0)); foreach (ShopItem shopItem in shop.Items) { session.Send(ShopPacket.LoadProducts(shopItem)); } session.Send(ShopPacket.Reload()); }
private static void HandleViaItem(GameSession session, PacketReader packet) { bool openShop = packet.ReadBool(); if (!openShop) { return; } int itemId = packet.ReadInt(); Item item = session.Player.Inventory.Items.Values.FirstOrDefault(x => x.Id == itemId); if (item == null) { return; } Shop shop = DatabaseManager.Shops.FindById(item.ShopID); if (shop == null) { Logger.Warn($"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()); }
private static void OpenSystemShop(GameSession session, int shopId) { Shop shop = DatabaseManager.Shops.FindById(shopId); session.Send(ShopPacket.Open(shop)); foreach (ShopItem shopItem in shop.Items) { session.Send(ShopPacket.LoadProducts(shopItem)); } session.Send(ShopPacket.Reload()); session.Send(SystemShopPacket.Open()); }
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)); }
private static void HandleMapleArenaShop(GameSession session, PacketReader packet) { bool openShop = packet.ReadBool(); if (!openShop) { return; } Shop shop = DatabaseManager.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()); }
public static void OpenSystemShop(GameSession session, int shopId, int npcId) { Shop shop = DatabaseManager.Shops.FindById(shopId); if (shop is null) { Log.Logger.ForContext(typeof(ShopHelper)).Warning("Unknown shop ID: {shopID}", shopId); return; } session.Send(ShopPacket.Open(shop, npcId)); foreach (ShopItem shopItem in shop.Items) { session.Send(ShopPacket.LoadProducts(shopItem)); } session.Send(ShopPacket.Reload()); session.Send(SystemShopPacket.Open()); }
private static void HandleOpen(GameSession session, PacketReader packet) { 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)); session.Send(ShopPacket.Reload()); session.Send(SystemShopPacket.Open()); }
public static void HandleOpen(GameSession session, IFieldObject <NpcMetadata> npcFieldObject, int npcId) { NpcMetadata metadata = npcFieldObject.Value; Shop shop = DatabaseManager.Shops.FindById(metadata.ShopId); if (shop == null) { Logger.Warning("Unknown shop ID: {shopId}", metadata.ShopId); return; } session.Send(ShopPacket.Open(shop, npcId)); foreach (ShopItem shopItem in shop.Items) { session.Send(ShopPacket.LoadProducts(shopItem)); } session.Send(ShopPacket.Reload()); session.Player.ShopId = shop.Id; }
public static void HandleOpen(GameSession session, IFieldObject <NpcMetadata> npcFieldObject) { NpcMetadata metadata = npcFieldObject.Value; Shop shop = DatabaseManager.Shops.FindById(metadata.ShopId); if (shop == null) { Logger.Warn($"Unknown shop ID: {metadata.ShopId}"); return; } session.Send(ShopPacket.Open(shop)); foreach (ShopItem shopItem in shop.Items) { session.Send(ShopPacket.LoadProducts(shopItem)); } session.Send(ShopPacket.Reload()); session.Send(NpcTalkPacket.Respond(npcFieldObject, NpcType.Default, DialogType.None, 0)); session.Player.ShopId = shop.Id; }