While holding a custom equipment added by ItemLib, the function RoR2.Stats.StatManager.ProcessCharacterUpdateEvents rapidly throws IndexOutOfRange exceptions. This appears to be caused by PerEquipmentStatDef.totalTimeHeld.FindStatDef(currentEquipmentIndex) on line 349 of the relevant dnSpy file, which internally uses a fixed array of size 30 (original equipment count).
Given that other methods in ItemLib disable addition of custom items/equipment to profile stats, the solution to this is likely to use IL to insert a second condition to the if check on line 347 (if (currentEquipmentIndex != EquipmentIndex.None) --> if (currentEquipmentIndex != EquipmentIndex.None && currentEquipmentIndex < EquipmentIndex.Count)). I'd submit this as a pull request if I had any idea how to work IL :(
While holding a custom equipment added by ItemLib, the function
RoR2.Stats.StatManager.ProcessCharacterUpdateEvents
rapidly throws IndexOutOfRange exceptions. This appears to be caused byPerEquipmentStatDef.totalTimeHeld.FindStatDef(currentEquipmentIndex)
on line 349 of the relevant dnSpy file, which internally uses a fixed array of size 30 (original equipment count).Given that other methods in ItemLib disable addition of custom items/equipment to profile stats, the solution to this is likely to use IL to insert a second condition to the if check on line 347 (
if (currentEquipmentIndex != EquipmentIndex.None)
-->if (currentEquipmentIndex != EquipmentIndex.None && currentEquipmentIndex < EquipmentIndex.Count)
). I'd submit this as a pull request if I had any idea how to work IL :(