Esempio n. 1
0
        public void OnRevive(UnturnedPlayer Player, Vector3 Place, byte idk)
        {
            if (Autos.Contains(Player.CSteamID.m_SteamID) && ((IRocketPlayer)Player).HasPermission("loadout.autoload"))
            {
                LoadoutList List = playerInvs[Player.CSteamID.m_SteamID];
                if (List.inventories.ContainsKey("default"))
                {
                    LoadoutInventory Inventory = List.inventories["default"];

                    #region clothing

                    PlayerClothing clo     = Player.Player.clothing;
                    LoadoutClothes clothes = Inventory.clothes;

                    LoadoutClothing hat      = clothes.hat;
                    LoadoutClothing glasses  = clothes.glasses;
                    LoadoutClothing mask     = clothes.mask;
                    LoadoutClothing shirt    = clothes.shirt;
                    LoadoutClothing vest     = clothes.vest;
                    LoadoutClothing backpack = clothes.backpack;
                    LoadoutClothing 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 < Inventory.items.Count; i++)
                    {
                        LItem item  = Inventory.items[i];
                        Item  item2 = new Item(item.ID, true)
                        {
                            metadata = item.Meta
                        };
                        Player.Inventory.tryAddItem(item2, true);
                    }

                    #endregion items
                    UnturnedChat.Say(Player, Instance.Translate("auto_loaded"));
                }
                else
                {
                    UnturnedChat.Say(Player, Instance.Translate("no_default"));
                }
            }
        }
Esempio n. 2
0
        public static void ClearInventory(this Player player)
        {
            Items[] items = player.inventory.items;
            for (byte b = 0; b < PlayerInventory.PAGES - 2; b++)
            {
                if (items[b]?.items?.Count == 0)
                {
                    continue;
                }

                items[b].ReverseClear();

                if (b < PlayerInventory.SLOTS)
                {
                    player.equipment.sendSlot(b);
                }
            }

            PlayerClothing clothing = player.clothing;
            HumanClothes   clothes  = clothing.thirdClothes;

            // I like sendSwap better but it can only be receieved from owner I think
            // I also really hate everything past this point
            if (clothing.backpack != 0)
            {
                clothes.backpack = 0;
                clothing.askWearBackpack(0, 0, PlaceholderArray, true);
            }

            if (clothing.glasses != 0)
            {
                clothes.glasses = 0;
                clothing.askWearGlasses(0, 0, PlaceholderArray, true);
            }

            if (clothing.hat != 0)
            {
                clothes.hat = 0;
                clothing.askWearHat(0, 0, PlaceholderArray, true);
            }

            if (clothing.mask != 0)
            {
                clothes.mask = 0;
                clothing.askWearMask(0, 0, PlaceholderArray, true);
            }

            if (clothing.pants != 0)
            {
                clothes.pants = 0;
                clothing.askWearPants(0, 0, PlaceholderArray, true);
            }

            if (clothing.shirt != 0)
            {
                clothes.shirt = 0;
                clothing.askWearShirt(0, 0, PlaceholderArray, true);
            }

            if (clothing.vest != 0)
            {
                clothes.vest = 0;
                clothing.askWearVest(0, 0, PlaceholderArray, true);
            }
        }
Esempio n. 3
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer player = (UnturnedPlayer)caller;

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

            if (command[0].ToUpperInvariant() == "AUTO")
            {
                if (Loadout.Instance.Autos.Contains(player.CSteamID.m_SteamID))
                {
                    Loadout.Instance.Autos.Remove(player.CSteamID.m_SteamID);
                    UnturnedChat.Say(player, "Auto loading toggled off.");
                    return;
                }
                else
                {
                    Loadout.Instance.Autos.Add(player.CSteamID.m_SteamID);
                    UnturnedChat.Say(player, "Auto loading toggled on.");
                    return;
                }
            }

            if (!Loadout.Instance.playerInvs[player.CSteamID.m_SteamID].inventories.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.m_SteamID].inventories[command[0]].clothes;

            LoadoutClothing hat      = clothes.hat;
            LoadoutClothing glasses  = clothes.glasses;
            LoadoutClothing mask     = clothes.mask;
            LoadoutClothing shirt    = clothes.shirt;
            LoadoutClothing vest     = clothes.vest;
            LoadoutClothing backpack = clothes.backpack;
            LoadoutClothing 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.m_SteamID].inventories[command[0]].items.Count; i++)
            {
                LItem item  = Loadout.Instance.playerInvs[player.CSteamID.m_SteamID].inventories[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"));
        }
Esempio n. 4
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"));
        }