aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2011-10-08 13:13:09 +0200
committerMachiavelli <machiavelli.trinity@gmail.com>2011-10-08 13:17:43 +0200
commit680fce6fd89c6a7ae2b9366d90ca4c4e7e16a661 (patch)
treec977f20aeda5415292402cb00e459782e027abd3 /src
parent7b0bff3f7bce302a69ed91834b0f9d9517180d28 (diff)
Core/GameObjects: Fix infinite respawning of chest gameobjects that are summoned trough spells with ie. SPELL_EFFECT_SUMMON_OBJECT_WILD
Closes #1618 Closes #2486
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp12
1 files changed, 5 insertions, 7 deletions
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;
}