Beispiel #1
0
        private void TestArmorSlots(ISet <Type> equippedAbilityEnablingItemTypes)
        {
            int maxAccSlot = PlayerItemLibraries.GetCurrentVanillaMaxAccessories(this.player)
                             + PlayerItemLibraries.VanillaAccessorySlotFirst;

            string alert;

            // Test each item against equipped ability items
            for (int slot = 0; slot < maxAccSlot; slot++)
            {
                Item item = this.player.armor[slot];
                if (item == null || item.IsAir)
                {
                    continue;
                }

                if (!this.TestArmorAgainstMissingAbilities(equippedAbilityEnablingItemTypes, slot, out alert))
                {
                    Main.NewText(alert, Color.Yellow);
                    PlayerItemLibraries.DropEquippedArmorItem(this.player, slot, 0);
                    continue;
                }
            }

            this.TestAccessorySlotCapacity();
        }
        private void BlockEquipsIfDisabled()
        {
            var mymod = (NihilismMod)this.mod;

            if (!NihilismConfig.Instance.EnableItemEquipsFilters)
            {
                return;
            }

            var myworld = ModContent.GetInstance <NihilismWorld>();

            if (myworld.Logic == null)
            {
                return;
            }
            if (!myworld.Logic.DataAccess.IsActive())
            {
                return;
            }

            bool _;

            for (int i = 0; i < this.player.armor.Length; i++)
            {
                Item item = this.player.armor[i];
                if (item == null || item.IsAir)
                {
                    continue;
                }

                if (!myworld.Logic.DataAccess.IsItemEnabled(item, out _, out _))
                {
                    PlayerItemLibraries.DropEquippedArmorItem(player, i);
                }
            }

            for (int i = 0; i < this.player.miscEquips.Length; i++)
            {
                Item item = this.player.armor[i];
                if (item == null || item.IsAir)
                {
                    continue;
                }

                if (!myworld.Logic.DataAccess.IsItemEnabled(item, out _, out _))
                {
                    PlayerItemLibraries.DropEquippedMiscItem(player, i);
                }
            }

            if (mymod.WingSlotMod != null)
            {
                this.BlockWingSlotIfDisabled("EquipSlot");
                this.BlockWingSlotIfDisabled("VanitySlot");
            }
        }
        private void BlockEquipsIf()
        {
            var config = RuinedItemsConfig.Instance;

            if (!config.Get <bool>(nameof(config.RuinedItemsLockedFromUse)))
            {
                return;
            }

            for (int i = 0; i < this.player.armor.Length; i++)
            {
                Item item = this.player.armor[i];
                if (item == null || item.IsAir)
                {
                    continue;
                }

                if (item.prefix == ModContent.PrefixType <RuinedPrefix>())
                {
                    PlayerItemLibraries.DropEquippedArmorItem(player, i);
                }
            }

            for (int i = 0; i < this.player.miscEquips.Length; i++)
            {
                Item item = this.player.armor[i];
                if (item == null || item.IsAir)
                {
                    continue;
                }

                if (item.prefix == ModContent.PrefixType <RuinedPrefix>())
                {
                    PlayerItemLibraries.DropEquippedMiscItem(player, i);
                }
            }
        }
Beispiel #4
0
        ////////////////

        private void TestAccessorySlotCapacity()
        {
            if (this.TotalAllowedAccessorySlots < 0)
            {
                return;
            }

            int firstAccSlot = PlayerItemLibraries.VanillaAccessorySlotFirst;
            int maxAccSlot   = PlayerItemLibraries.GetCurrentVanillaMaxAccessories(this.player) + firstAccSlot;

            // Test max accessory slots
            for (int slot = (firstAccSlot + this.TotalAllowedAccessorySlots); slot < maxAccSlot; slot++)
            {
                Item item = this.player.armor[slot];
                if (item == null || item.IsAir)
                {
                    continue;
                }

                Main.NewText("Invalid accessory slot.", Color.Yellow);
                PlayerItemLibraries.DropEquippedArmorItem(this.player, slot, 0);
                break;
            }
        }