public override void UseGrapple(Player player, ref int type)
        {
            var config   = LockedAbilitiesConfig.Instance;
            int chainAmt = config.Get <int>(nameof(LockedAbilitiesConfig.GrappleRequiresChainAmount));

            if (chainAmt > 0)
            {
                int idx = ItemFinderLibraries.FindIndexOfFirstOfItemInCollection(
                    player.inventory,
                    new HashSet <int> {
                    ItemID.Chain
                }
                    );

                if (idx == -1)
                {
                    Main.NewText("No chains available for grappling.", Color.Yellow);
                    return;
                }

                PlayerItemLibraries.RemoveInventoryItemQuantity(
                    player,
                    ItemID.Chain,
                    chainAmt
                    );
            }
        }
        public override bool?CanUseGrapple(int projType, Player player)
        {
            var config = LockedAbilitiesConfig.Instance;

            if (config.Get <int>(nameof(LockedAbilitiesConfig.GrappleRequiresChainAmount)) > 0)
            {
                int idx = ItemFinderLibraries.FindIndexOfFirstOfItemInCollection(
                    player.inventory,
                    new HashSet <int> {
                    ItemID.Chain
                }
                    );

                if (idx == -1)
                {
                    return(false);
                }
            }

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

            int grappleHarnessType = ModContent.ItemType <GrappleHarnessItem>();
            int utilBeltType       = ModContent.ItemType <UtilitarianBeltItem>();
            int firstAccSlot       = PlayerItemLibraries.VanillaAccessorySlotFirst;
            int lastAccSlot        = PlayerItemLibraries.GetFirstVanitySlot(player);

            for (int i = firstAccSlot; i < lastAccSlot; i++)
            {
                Item item = player.armor[i];
                if (item?.active != true || (item.type != grappleHarnessType && item.type != utilBeltType))
                {
                    continue;
                }

                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Finds first of any of a set of item types currently in the player's possession.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="itemTypes"></param>
        /// <param name="includeBanks"></param>
        /// <returns></returns>
        public static Item FindFirstOfPossessedItemFor(Player player, ISet <int> itemTypes, bool includeBanks)
        {
            int found = ItemFinderLibraries.FindIndexOfFirstOfItemInCollection(player.inventory, itemTypes);

            if (found != -1)
            {
                return(player.inventory[found]);
            }

            found = ItemFinderLibraries.FindIndexOfFirstOfItemInCollection(player.armor, itemTypes);
            if (found != -1)
            {
                return(player.armor[found]);
            }

            found = ItemFinderLibraries.FindIndexOfFirstOfItemInCollection(player.miscEquips, itemTypes);
            if (found != -1)
            {
                return(player.miscEquips[found]);
            }

            if (includeBanks)
            {
                found = ItemFinderLibraries.FindIndexOfFirstOfItemInCollection(player.bank.item, itemTypes);
                if (found != -1)
                {
                    return(player.bank.item[found]);
                }
                found = ItemFinderLibraries.FindIndexOfFirstOfItemInCollection(player.bank2.item, itemTypes);
                if (found != -1)
                {
                    return(player.bank2.item[found]);
                }
                found = ItemFinderLibraries.FindIndexOfFirstOfItemInCollection(player.bank3.item, itemTypes);
                if (found != -1)
                {
                    return(player.bank3.item[found]);
                }
            }

            return(null);
        }