mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
fix(Core): fix chests not despawning when opened in group (2) (#5387)
* fix(Core): fix chests not despawning when opened in group * fix(Core): fix crashes in pr #5371 * Replaced nullptr checks * Used if with initializer instead of separate scope
This commit is contained in:
@@ -1493,6 +1493,16 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
|
||||
item->is_blocked = false;
|
||||
}
|
||||
|
||||
if (Loot* loot = roll->getLoot(); loot && loot->isLooted() && loot->sourceGameObject)
|
||||
{
|
||||
const GameObjectTemplate* goInfo = loot->sourceGameObject->GetGOInfo();
|
||||
if (goInfo && goInfo->type == GAMEOBJECT_TYPE_CHEST)
|
||||
{
|
||||
// Deactivate chest if the last item was rolled in group
|
||||
loot->sourceGameObject->SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
}
|
||||
|
||||
RollId.erase(rollI);
|
||||
delete roll;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user