Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release loot at end of HandleAutostoreLootItemOpcode #711

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/game/Loot/LootHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recv_data)
if (Item* item = _player->GetItemByGuid(lguid))
item->SetLootState(ITEM_LOOT_CHANGED);
}

if (loot->IsLootedFor(_player)) {
loot->Release(_player);
}
}

void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recv_data*/)
Expand Down
21 changes: 12 additions & 9 deletions src/game/Loot/LootMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1520,20 +1520,23 @@ void Loot::GroupCheck()
masterLooter = player;
}

if (masterLooter)
break;

// check if there is need to launch a roll
for (auto lootItem : m_lootItems)
{
if (!lootItem->isBlocked)
continue;
if (!lootItem->isBlocked)
continue;

uint32 itemSlot = lootItem->lootSlot;
uint32 itemSlot = lootItem->lootSlot;

if (m_roll.find(itemSlot) == m_roll.end() && lootItem->IsAllowed(player, this))
{
if (!m_roll[itemSlot].TryToStart(*this, itemSlot)) // Create and try to start a roll
m_roll.erase(m_roll.find(itemSlot)); // Cannot start roll so we have to delete it (find will not fail as the item was just created)
}
}
if (m_roll.find(itemSlot) == m_roll.end() && lootItem->IsAllowed(player, this))
{
if (!m_roll[itemSlot].TryToStart(*this, itemSlot)) // Create and try to start a roll
m_roll.erase(m_roll.find(itemSlot)); // Cannot start roll so we have to delete it (find will not fail as the item was just created)
}
}
}

// in master loot case we have to send looter list to client
Expand Down