From 2f1d6d55972225d1f0c369f5cd87e51565f667af Mon Sep 17 00:00:00 2001 From: Aokromes Date: Sat, 1 Apr 2017 07:11:25 +0200 Subject: [PATCH] =?UTF-8?q?Core/Scripts:=20Fix=20a=20logic=20fail=20that?= =?UTF-8?q?=20overriden=20the=20script=20of=20an=20entity=E2=80=A6=20?= =?UTF-8?q?=E2=80=A6=20that=20changed=20entry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/game/Entities/Creature/Creature.cpp | 3 ++- src/server/game/Entities/GameObject/GameObject.cpp | 3 ++- 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 e3ba75c412..64281ca544 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2483,7 +2483,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 fd2f19b87b..831d8301ca 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1948,7 +1948,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 bf39f8641c..971ea3f700 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1866,8 +1866,6 @@ void ObjectMgr::LoadCreatures() data.phaseid = fields[22].GetUInt32(); data.phaseGroup = fields[23].GetUInt32(); data.ScriptId = GetScriptId(fields[23].GetString()); - if (!data.ScriptId) - data.ScriptId = cInfo->ScriptID; MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) @@ -2236,8 +2234,6 @@ void ObjectMgr::LoadGameobjects() } data.ScriptId = GetScriptId(fields[19].GetString()); - if (!data.ScriptId) - data.ScriptId = gInfo->ScriptId; if (std::abs(data.orientation) > 2 * float(M_PI)) {