diff options
author | Wyrserth <wyrserth@protonmail.com> | 2019-06-28 16:53:39 +0200 |
---|---|---|
committer | Wyrserth <wyrserth@protonmail.com> | 2019-06-28 16:53:39 +0200 |
commit | 9f0ac0c24376ec70b8227a8fb0a1e0e686cb3256 (patch) | |
tree | ed79b1482eaff4c99744db9bc51003936eecc04f | |
parent | 5dc2dfd60c4ecd243729e86496d926976e383156 (diff) |
Core/GameObject: fix some cases where summoned gameobjects of a type different than chest or goober would behave wrongly.
-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 e9f122eded8..b04b0c7b9b4 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -118,6 +118,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; @@ -781,9 +782,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) { @@ -797,10 +798,11 @@ void GameObject::Update(uint32 diff) UpdateObjectVisibility(); return; } - else if (GetOwner() || GetSpellId()) + else if (GetOwnerGUID() || GetSpellId()) { SetRespawnTime(0); Delete(); + return; } SetLootState(GO_NOT_READY); |