Core/GameObject: fix some cases where summoned gameobjects of a type different than chest or goober would behave wrongly.

Port From (https://github.com/TrinityCore/TrinityCore/commit/f136d3cfe0e92ac8578c631cc7c2c43086ba796f)
This commit is contained in:
hondacrx
2021-12-24 21:20:14 -05:00
parent 89661001d5
commit 5c4a42317e
@@ -815,9 +815,9 @@ namespace Game.Entities
loot.Clear();
// Do not delete gameobjects that are not consumed on loot, while still allowing them to despawn when they expire if summoned
// Do not delete chests or goobers that are not consumed on loot, while still allowing them to despawn when they expire if summoned
bool isSummonedAndExpired = (GetOwner() != null || GetSpellId() != 0) && m_respawnTime == 0;
if (!GetGoInfo().IsDespawnAtAction() && !isSummonedAndExpired)
if ((GetGoType() == GameObjectTypes.Chest || GetGoType() == GameObjectTypes.Goober) && !GetGoInfo().IsDespawnAtAction() && !isSummonedAndExpired)
{
if (GetGoType() == GameObjectTypes.Chest && GetGoInfo().Chest.chestRestockTime > 0)
{
@@ -831,10 +831,11 @@ namespace Game.Entities
UpdateObjectVisibility();
return;
}
else if (GetOwner() != null || GetSpellId() != 0)
else if (!GetOwnerGUID().IsEmpty() || GetSpellId() != 0)
{
SetRespawnTime(0);
Delete();
return;
}
SetLootState(LootState.NotReady);