Пример #1
0
 public LoadoutClothes(LoadoutHat hat, LoadoutGlasses glasses, LoadoutMask mask, LoadoutShirt shirt, LoadoutVest vest, LoadoutBackpack backpack, LoadoutPants pants)
 {
     this.hat      = hat;
     this.glasses  = glasses;
     this.mask     = mask;
     this.shirt    = shirt;
     this.vest     = vest;
     this.backpack = backpack;
     this.pants    = pants;
 }
Пример #2
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            #region vars
            if (command.Length != 1)
            {
                UnturnedChat.Say(caller, Syntax);
                return;
            }
            UnturnedPlayer player = (UnturnedPlayer)caller;

            CSteamID id = player.CSteamID;

            List <LoadoutItem> itemList = new List <LoadoutItem>();

            PlayerClothing clo = player.Player.clothing;

            #endregion vars

            #region items

            for (byte p = 0; p < PlayerInventory.PAGES - 1; p++)
            {
                for (byte i = 0; i < player.Inventory.getItemCount(p); i++)
                {
                    Item item = player.Inventory.getItem(p, i).item;
                    itemList.Add(new LoadoutItem(item.id, item.metadata));
                }
            }

            #endregion items

            #region clothing

            LoadoutHat      hat      = new LoadoutHat(clo.hat, clo.hatQuality, clo.hatState);
            LoadoutGlasses  glasses  = new LoadoutGlasses(clo.glasses, clo.glassesQuality, clo.glassesState);
            LoadoutMask     mask     = new LoadoutMask(clo.mask, clo.maskQuality, clo.maskState);
            LoadoutShirt    shirt    = new LoadoutShirt(clo.shirt, clo.shirtQuality, clo.shirtState);
            LoadoutVest     vest     = new LoadoutVest(clo.vest, clo.vestQuality, clo.vestState);
            LoadoutBackpack backpack = new LoadoutBackpack(clo.backpack, clo.backpackQuality, clo.backpackState);
            LoadoutPants    pants    = new LoadoutPants(clo.pants, clo.pantsQuality, clo.pantsState);

            LoadoutClothes clothes = new LoadoutClothes(hat, glasses, mask, shirt, vest, backpack, pants);

            #endregion clothing

            #region dictionary

            if (!Loadout.Instance.playerInvs.ContainsKey(id))
            {
                Loadout.Instance.playerInvs.Add(id, new LoadoutList(new Dictionary <string, LoadoutInventory>()));
                Loadout.Instance.playerInvs[player.CSteamID]._invs.Add(command[0], new LoadoutInventory(itemList, clothes));
                UnturnedChat.Say(caller, Loadout.Instance.Translate("saved"));
            }
            else
            {
                if (!Loadout.Instance.playerInvs[id]._invs.ContainsKey(command[0]))
                {
                    Loadout.Instance.playerInvs[player.CSteamID]._invs.Add(command[0], new LoadoutInventory(itemList, clothes));
                    UnturnedChat.Say(caller, Loadout.Instance.Translate("saved"));
                }
                else
                {
                    Loadout.Instance.playerInvs[id]._invs.Remove(command[0]);
                    Loadout.Instance.playerInvs[player.CSteamID]._invs.Add(command[0], new LoadoutInventory(itemList, clothes));
                    UnturnedChat.Say(caller, Loadout.Instance.Translate("replaced"));
                }
            }

            #endregion dictionary
        }
Пример #3
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer player = (UnturnedPlayer)caller;

            if (command.Length != 1)
            {
                UnturnedChat.Say(caller, Syntax);
                return;
            }

            if (!Loadout.Instance.playerInvs[player.CSteamID]._invs.ContainsKey(command[0]))
            {
                UnturnedChat.Say(player, Loadout.Instance.Translate("no_kit"));
                return;
            }

            #region clothing

            PlayerClothing clo     = player.Player.clothing;
            LoadoutClothes clothes = Loadout.Instance.playerInvs[player.CSteamID]._invs[command[0]].clothes;


            LoadoutHat      hat      = clothes.hat;
            LoadoutGlasses  glasses  = clothes.glasses;
            LoadoutMask     mask     = clothes.mask;
            LoadoutShirt    shirt    = clothes.shirt;
            LoadoutVest     vest     = clothes.vest;
            LoadoutBackpack backpack = clothes.backpack;
            LoadoutPants    pants    = clothes.pants;

            if (hat != null)
            {
                clo.askWearHat(hat.id, hat.quality, hat.state, true);
            }
            if (glasses != null)
            {
                clo.askWearGlasses(glasses.id, glasses.quality, glasses.state, true);
            }
            if (mask != null)
            {
                clo.askWearMask(mask.id, mask.quality, mask.state, true);
            }
            if (shirt != null)
            {
                clo.askWearShirt(shirt.id, shirt.quality, shirt.state, true);
            }
            if (vest != null)
            {
                clo.askWearVest(vest.id, vest.quality, vest.state, true);
            }
            if (backpack != null)
            {
                clo.askWearBackpack(backpack.id, backpack.quality, backpack.state, true);
            }
            if (pants != null)
            {
                clo.askWearPants(pants.id, pants.quality, pants.state, true);
            }

            #endregion clothing

            #region items

            for (int i = 0; i < Loadout.Instance.playerInvs[player.CSteamID]._invs[command[0]].items.Count; i++)
            {
                LoadoutItem item  = Loadout.Instance.playerInvs[player.CSteamID]._invs[command[0]].items[i];
                Item        item2 = new Item(item.id, true)
                {
                    metadata = item.meta
                };
                player.Inventory.tryAddItem(item2, true);
            }

            #endregion items

            UnturnedChat.Say(caller, Loadout.Instance.Translate("loaded"));
        }