diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2017-03-31 01:58:15 -0300 |
|---|---|---|
| committer | funjoker <funjoker109@gmail.com> | 2020-04-24 17:18:51 +0200 |
| commit | 649009552065940ab0f03d905b945f1a16d603bb (patch) | |
| tree | a15e200a9ba2dbbba05718820fcef2e838f80f2a /src | |
| parent | 8e624be7471f8559c490d02593203be1e110fb20 (diff) | |
Core/Scripts: Fix a logic fail that overriden the script of an entity that changed entry
Closes #19389
(cherry picked from commit dafa7267737ac11b7abb4dcf9943c24ab1e71a8a)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 3 | ||||
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 3 | ||||
| -rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 4 |
3 files changed, 4 insertions, 6 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 42311dcbc41..4bbb29d43c1 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2754,7 +2754,8 @@ std::string Creature::GetScriptName() const uint32 Creature::GetScriptId() const { if (CreatureData const* creatureData = GetCreatureData()) - return creatureData->ScriptId; + if (uint32 scriptId = creatureData->ScriptId) + return scriptId; return sObjectMgr->GetCreatureTemplate(GetEntry())->ScriptID; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index b9e17565702..4e34c8b4785 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -2183,7 +2183,8 @@ void GameObject::EventInform(uint32 eventId, WorldObject* invoker /*= nullptr*/) uint32 GameObject::GetScriptId() const { if (GameObjectData const* gameObjectData = GetGOData()) - return gameObjectData->ScriptId; + if (uint32 scriptId = gameObjectData->ScriptId) + return scriptId; return GetGOInfo()->ScriptId; } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index b1e42a5d065..4ab04447914 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1986,8 +1986,6 @@ void ObjectMgr::LoadCreatures() data.phaseGroup = fields[25].GetUInt32(); data.terrainSwapMap = fields[26].GetInt32(); data.ScriptId = GetScriptId(fields[27].GetString()); - if (!data.ScriptId) - data.ScriptId = cInfo->ScriptID; MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) @@ -2459,8 +2457,6 @@ void ObjectMgr::LoadGameobjects() } data.ScriptId = GetScriptId(fields[21].GetString()); - if (!data.ScriptId) - data.ScriptId = gInfo->ScriptId; if (std::abs(data.orientation) > 2 * float(M_PI)) { |
