Skip to content

fix(Core/Groups): pass actual loot count to OnPlayerGroupRollRewardItem hook#25312

Open
myfmwei wants to merge 3 commits intoazerothcore:masterfrom
myfmwei:master
Open

fix(Core/Groups): pass actual loot count to OnPlayerGroupRollRewardItem hook#25312
myfmwei wants to merge 3 commits intoazerothcore:masterfrom
myfmwei:master

Conversation

@myfmwei
Copy link
Copy Markdown

@myfmwei myfmwei commented Mar 30, 2026

Summary

  • OnPlayerGroupRollRewardItem was passing _item->GetCount() as the count parameter, which returns the total stack size after merging into the player's
    existing inventory
  • Changed to item->count (LootItem::count) which correctly represents the number of items actually looted from the roll
  • Affects both NEED and GREED roll paths in Group.cpp

Problem

If a player had 3 of a stackable item in their bag and won 2 more via a group roll, the script hook would receive count = 5 (merged stack total) instead of
count = 2 (items actually awarded). The PLAYER_EVENT_ON_LOOT_ITEM hook already used LootItem::count correctly — this fix makes the roll reward hook
consistent with it.

Test plan

  • Player wins a stackable item via NEED roll while already having some in inventory — verify script hook receives the looted count, not the total stack count
  • Player wins a stackable item via GREED roll — same verification
  • Player wins a non-stackable item — count should be 1 in both before and after

root and others added 2 commits March 30, 2026 22:14
…eward script hook

OnPlayerGroupRollRewardItem was passing _item->GetCount() which returns
the total stack size after merging into existing inventory, instead of
item->count which is the actual number of items looted from the roll.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions github-actions bot added CORE Related to the core file-cpp Used to trigger the matrix build labels Mar 30, 2026
Copy link
Copy Markdown
Member

@sogladev sogladev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this

@sogladev sogladev changed the title fix(Group): pass actual loot count to OnPlayerGroupRollRewardItem hook fix(Core/Groups): pass actual loot count to OnPlayerGroupRollRewardItem hook Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE Related to the core file-cpp Used to trigger the matrix build To Be Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants