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); }
private void TestMountState() { var config = LockedAbilitiesConfig.Instance; if (!config.Get <bool>(nameof(config.MountReinEnabled))) { return; } if (!this.player.mount.Active || this.player.mount.Cart) { return; } int mountReinType = ModContent.ItemType <MountReinItem>(); 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 != mountReinType && item.type != utilBeltType)) { continue; } return; } var mountReinItem = ModContent.GetInstance <MountReinItem>(); var utilBeltItem = ModContent.GetInstance <UtilitarianBeltItem>(); Main.NewText("Need " + mountReinItem.item.Name + " or " + utilBeltItem.item.Name + " to equip.", Color.Yellow); this.player.mount.Dismount(this.player); }