Exemple #1
0
        public static void TopOutfit(Client client, InventoryItem item)
        {
            Account  account  = AccountUtil.RetrieveAccount(client);
            Clothing clothing = Clothing.RetrieveClothing(account);

            TopOutfit topOutfit = JsonConvert.DeserializeObject <TopOutfit>(item.Properties);

            if (topOutfit == null)
            {
                return;
            }

            InventoryItem oldOutfit = new InventoryItem
            {
                ID         = 0,
                Name       = $"TopOutfit{new Random().Next(0, 999)}",
                StackCount = 1
            };

            oldOutfit.CreateTopOutfit(
                clothing.Mask,
                clothing.Undershirt,
                clothing.Torso,
                clothing.Top,
                clothing.Hats,
                clothing.Glasses
                );

            topOutfit.Equip(clothing);
            clothing.Update();
            clothing.UpdateClothing(client);

            Utilities.ForceCloseInventory(client);
            NAPI.Task.Run(() =>
            {
                InventoryHandler.AddItemToInventory(client, oldOutfit.Name, 1, oldOutfit);
            }, 1000);
        }