From 680fce6fd89c6a7ae2b9366d90ca4c4e7e16a661 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Sat, 8 Oct 2011 13:13:09 +0200 Subject: Core/GameObjects: Fix infinite respawning of chest gameobjects that are summoned trough spells with ie. SPELL_EFFECT_SUMMON_OBJECT_WILD Closes #1618 Closes #2486 --- src/server/game/Entities/GameObject/GameObject.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 086dc4255cc..ac4e5f76e69 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -545,14 +545,12 @@ void GameObject::Update(uint32 diff) loot.clear(); - if (GetOwnerGUID()) + //! If this is summoned by a spell with ie. SPELL_EFFECT_SUMMON_OBJECT_WILD, with or without owner, we check respawn criteria based on spell + //! The GetOwnerGUID() check is mostly for compatibility with hacky scripts - 99% of the time summoning should be done trough spells. + if (GetSpellId() || GetOwnerGUID()) { - if (Unit* owner = GetOwner()) - { - owner->RemoveGameObject(this, false); - SetRespawnTime(0); - Delete(); - } + SetRespawnTime(0); + Delete(); return; } -- cgit v1.2.3