Esempio n. 1
0
        private static void HandleSaveHair(GameSession session, PacketReader packet)
        {
            long hairUid = packet.ReadLong();

            Item hair = session.Player.Inventory.Cosmetics.FirstOrDefault(x => x.Value.Uid == hairUid).Value;

            if (hair == null || hair.ItemSlot != ItemSlot.HR)
            {
                return;
            }

            if (session.Player.HairInventory.SavedHair.Count > 30) // 30 is the max slots
            {
                return;
            }

            Item hairCopy = new Item(hair.Id)
            {
                HairData     = hair.HairData,
                Color        = hair.Color,
                CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds() + Environment.TickCount
            };

            session.Player.HairInventory.SavedHair.Add(hairCopy);

            session.Send(BeautyPacket.SaveHair(hair, hairCopy));
        }