diff options
| author | Wyrserth <wyrserth@protonmail.com> | 2019-06-28 16:53:39 +0200 | 
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-12-13 00:42:18 +0100 | 
| commit | f136d3cfe0e92ac8578c631cc7c2c43086ba796f (patch) | |
| tree | 7e20eb39dd13caeab374eccf040e0ce62c59ad9f | |
| parent | 575f42089e2014c3df64f0468ed25c45a544f6d8 (diff) | |
Core/GameObject: fix some cases where summoned gameobjects of a type different than chest or goober would behave wrongly.
(cherry picked from commit 9f0ac0c24376ec70b8227a8fb0a1e0e686cb3256)
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 8 | 
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index d1c80e1a52a..9fc455bdf8e 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -124,6 +124,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),      m_respawnDelayTime = 300;      m_despawnDelay = 0;      m_despawnRespawnTime = 0s; +    m_restockTime = 0;      m_lootState = GO_NOT_READY;      m_spawnedByDefault = true;      m_usetimes = 0; @@ -906,9 +907,9 @@ void GameObject::Update(uint32 diff)              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() || GetSpellId()) && m_respawnTime == 0; -            if (!GetGOInfo()->IsDespawnAtAction() && !isSummonedAndExpired) +            if ((GetGoType() == GAMEOBJECT_TYPE_CHEST || GetGoType() == GAMEOBJECT_TYPE_GOOBER) && !GetGOInfo()->IsDespawnAtAction() && !isSummonedAndExpired)              {                  if (GetGoType() == GAMEOBJECT_TYPE_CHEST && GetGOInfo()->chest.chestRestockTime > 0)                  { @@ -922,10 +923,11 @@ void GameObject::Update(uint32 diff)                  UpdateObjectVisibility();                  return;              } -            else if (GetOwner() || GetSpellId()) +            else if (!GetOwnerGUID().IsEmpty() || GetSpellId())              {                  SetRespawnTime(0);                  Delete(); +                return;              }              SetLootState(GO_NOT_READY);  | 
