Method NameAmountPrefixLength
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
NameAmountPrefixLength(string, int)
Length of the "<amount> " prefix the game writes into a stack's displayed name - "10 Gold" gives 4, "Sword" gives 0. Returned as a length rather than as a cut string, because this is asked for every pair of names, every frame (the nameplate pile rule) and on every pickup (the hover collect): cutting the string out would allocate once per call. The leading number is read digit by digit and has to equal the item's own amount, so a name that merely starts with a digit ("3rd Relic") is never mistaken for a stack prefix.
Why the prefix has to come off at all: ItemBehaviour.GenerateName writes the amount straight into the name, so two gold stacks read "10 Gold" and "15 Gold" - comparing the names as written never matches and nothing of one kind is ever recognised as such (measured 2026-09-23, on the piles).
public static int NameAmountPrefixLength(string text, int amount)