Skip to content

Reasonable AH stack sizes (category rules + realistic breakpoints)#19

Merged
icemansparks merged 1 commit into
merkerhoodfrom
feat/reasonable-stacks
Jul 2, 2026
Merged

Reasonable AH stack sizes (category rules + realistic breakpoints)#19
icemansparks merged 1 commit into
merkerhoodfrom
feat/reasonable-stacks

Conversation

@icemansparks

Copy link
Copy Markdown
Collaborator

Replaces the uniform-random stack assignment (getStackCount, which literally had a // TODO: This is not good comment) with player-like stacking.

Change

getStackCount(config, max, prototype) now:

  • Always single (qty 1) regardless of template stackable: glyphs (16), recipes (9), quest (12), containers (1), keys (13), and cut gems (class 3 with GemProperties != 0). Raw/prospected gems (GemProperties == 0) stack like materials.
  • Commodities get a weighted human breakpoint {1, 5, 10, 20, full} clamped to the stackable ceiling (~30% full stack, ~20% single, ~50% a clean mid) — never a random 7 or 13.

Notes

  • O(1): a switch + one urand, no DB lookup, no heap allocation (fixed 3-element local array).
  • Existing quality/config caps (GetMaxStack, GetMaxStackSize) and the optional DivisibleStacks mode are preserved; only the number chosen within the ceiling changes.
  • prototype is NULL-checked before the stack branch in Sell, so no nullptr risk.

Validation

CI -Werror build is the compile gate. Behaviour to confirm on TEST realm: glyphs/recipes/cut gems list as 1; cloth/ore/herbs/potions list as clean 5/10/20/full stacks.

getStackCount now takes the ItemTemplate and applies player-like stacking instead
of uniform random. Always-single categories (glyphs, recipes, quest/container/key,
and cut gems via GemProperties!=0) return 1 regardless of template stackable; raw
gems and commodities get weighted human breakpoints {1,5,10,20,full} clamped to the
stackable ceiling, never a random 7/13. O(1), no DB/alloc; existing quality/config
caps and the optional DivisibleStacks mode are preserved.
@icemansparks
icemansparks merged commit 0b8b8c5 into merkerhood Jul 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant