REDIVIVUS

Proposals / #830

Name the ItemStatCost stat id parameter nStatId across the ITEMPROP_ family

applied · by jaenster · submitted 2026-11-02, applied 2026-11-02

Ghidra v1809 · 9528519

Stack[0x10] is the 6th slot of the shared fpProperties signature that all 25 ITEMPROP_ handlers implement. ITEMMOD_ApplyPropertyToUnitStatsExpansion (0065fd70) fills it with (uint)(ushort)pPropTxt->stat[i], the stat column of the Properties.txt row. ITEMPROP_AddStat_Simple then forwards it unchanged: 0065f2e2 loads [EBP+0x14] (that slot) into EDX and 0065f2ec pushes it as the 6th argument of ITEMMOD_AddStatToItem, whose parameter at that position already carries the chosen name nStatId. That callee treats the value as an ItemStatCost row index, bounds-checking it against sgptDataTable->nTxtItemStatCostSize and using it to index pTxtItemStatCost for the valshift field, and casts it to eD2UnitStat. The slot is left typed int32_t; only the name changes. ITEMPROP_AddTimedStat (0065f870) is deliberately left out of this sweep: it already has a register local named nStatId, so its parameter cannot take the name until that local is renamed.

Changes 24, applied together

  1. Rename variable win 0x0065eb30 Stack[0x10]

    namenParam3→nStatId
  2. Rename variable win 0x0065eba0 Stack[0x10]

    namenParam2→nStatId
  3. Rename variable win 0x0065ec10 Stack[0x10]

    namenParam3→nStatId
  4. Rename variable win 0x0065ec80 Stack[0x10]

    namenParam2→nStatId
  5. Rename variable win 0x0065ecf0 Stack[0x10]

    namenParam2→nStatId
  6. Rename variable win 0x0065ee80 Stack[0x10]

    namenParam2→nStatId
  7. Rename variable win 0x0065f010 Stack[0x10]

    namenParam2→nStatId
  8. Rename variable win 0x0065f2b0 Stack[0x10]

    namenParam2→nStatId
  9. Rename variable win 0x0065f310 Stack[0x10]

    namenParam2→nStatId
  10. Rename variable win 0x0065f390 Stack[0x10]

    namenParam2→nStatId
  11. Rename variable win 0x0065f3f0 Stack[0x10]

    namenParam2→nStatId
  12. Rename variable win 0x0065f470 Stack[0x10]

    namenParam2→nStatId
  13. Rename variable win 0x0065f590 Stack[0x10]

    namenParam12→nStatId
  14. Rename variable win 0x0065f6a0 Stack[0x10]

    namenParam→nStatId
  15. Rename variable win 0x0065f960 Stack[0x10]

    namenParam2→nStatId
  16. Rename variable win 0x0065f9d0 Stack[0x10]

    namenParam2→nStatId
  17. Rename variable win 0x0065fa40 Stack[0x10]

    namenParam2→nStatId
  18. Rename variable win 0x0065fae0 Stack[0x10]

    namenParam→nStatId
  19. Rename variable win 0x0065fb50 Stack[0x10]

    namenParam2→nStatId
  20. Rename variable win 0x0065fba0 Stack[0x10]

    namenParam2→nStatId
  21. Rename variable win 0x0065fbf0 Stack[0x10]

    namenParam2→nStatId
  22. Rename variable win 0x0065fc40 Stack[0x10]

    namenParam2→nStatId
  23. Rename variable win 0x0065fc90 Stack[0x10]

    namenParam3→nStatId
  24. Rename variable win 0x0065fd20 Stack[0x10]

    namenParam→nStatId