private static void HandleBeautyVoucher(GameSession session, PacketReader packet) { long itemUid = packet.ReadLong(); Player player = session.Player; Item voucher = player.Inventory.GetByUid(itemUid); if (voucher == null || voucher.Function.Name != "ItemChangeBeauty") { return; } BeautyShop beautyShop = DatabaseManager.BeautyShops.FindById(voucher.Function.Id); if (beautyShop == null) { return; } List <BeautyShopItem> beautyItems = DatabaseManager.BeautyShopItems.FindAllByShopIdAndGender(beautyShop.Id, player.Gender); player.ShopId = beautyShop.Id; session.Send(BeautyPacket.LoadBeautyShop(beautyShop, beautyItems)); player.Inventory.ConsumeItem(session, voucher.Uid, 1); }
private static void HandleBeautyVoucher(GameSession session, PacketReader packet) { long itemUid = packet.ReadLong(); Player player = session.Player; Item voucher = player.Inventory.Items[itemUid]; if (voucher == null || voucher.Function.Name != "ItemChangeBeauty") { return; } BeautyMetadata beautyShop = BeautyMetadataStorage.GetShopById(voucher.Function.Id); if (beautyShop == null) { return; } List <BeautyItem> beautyItems = BeautyMetadataStorage.GetGenderItems(beautyShop.ShopId, player.Gender); player.ShopId = beautyShop.ShopId; session.Send(BeautyPacket.LoadBeautyShop(beautyShop, beautyItems)); player.Inventory.ConsumeItem(session, voucher.Uid, 1); }
private static void HandleLoadShop(GameSession session, PacketReader packet) { int npcId = packet.ReadInt(); BeautyCategory category = (BeautyCategory)packet.ReadByte(); NpcMetadata beautyNpc = NpcMetadataStorage.GetNpcMetadata(npcId); if (beautyNpc == null) { return; } BeautyShop beautyShop = DatabaseManager.BeautyShops.FindById(beautyNpc.ShopId); if (beautyShop == null) { return; } session.Player.ShopId = beautyNpc.ShopId; if (beautyShop.BeautyCategory == BeautyCategory.Dye) { if (beautyShop.BeautyType == BeautyShopType.Dye) { session.Send(BeautyPacket.LoadDyeShop(beautyShop)); return; } session.Send(BeautyPacket.LoadBeautyShop(beautyShop)); return; } if (beautyShop.BeautyCategory == BeautyCategory.Save) { session.Send(BeautyPacket.LoadSaveShop(beautyShop)); session.Send(BeautyPacket.InitializeSaves()); session.Send(BeautyPacket.LoadSaveWindow()); session.Send(BeautyPacket.LoadSavedHairCount((short)session.Player.HairInventory.SavedHair.Count)); if (session.Player.HairInventory.SavedHair.Count != 0) { session.Player.HairInventory.SavedHair = session.Player.HairInventory.SavedHair.OrderBy(o => o.CreationTime).ToList(); session.Send(BeautyPacket.LoadSavedHairs(session.Player.HairInventory.SavedHair)); } return; } List <BeautyShopItem> beautyItems = DatabaseManager.BeautyShopItems.FindAllByShopIdAndGender(beautyShop.Id, session.Player.Gender); session.Send(BeautyPacket.LoadBeautyShop(beautyShop, beautyItems)); }