Core/Scripts: Fix a logic fail that overriden the script of an entity that changed entry
Port From (https://github.com/TrinityCore/TrinityCore/commit/649009552065940ab0f03d905b945f1a16d603bb)
This commit is contained in:
@@ -2418,7 +2418,11 @@ namespace Game.Entities
|
||||
{
|
||||
CreatureData creatureData = GetCreatureData();
|
||||
if (creatureData != null)
|
||||
return creatureData.ScriptId;
|
||||
{
|
||||
uint scriptId = creatureData.ScriptId;
|
||||
if (scriptId != 0)
|
||||
return scriptId;
|
||||
}
|
||||
|
||||
return Global.ObjectMgr.GetCreatureTemplate(GetEntry()) != null ? Global.ObjectMgr.GetCreatureTemplate(GetEntry()).ScriptID : 0;
|
||||
}
|
||||
|
||||
@@ -2080,7 +2080,11 @@ namespace Game.Entities
|
||||
{
|
||||
GameObjectData gameObjectData = GetGoData();
|
||||
if (gameObjectData != null)
|
||||
return gameObjectData.ScriptId;
|
||||
{
|
||||
uint scriptId = gameObjectData.ScriptId;
|
||||
if (scriptId != 0)
|
||||
return scriptId;
|
||||
}
|
||||
|
||||
return GetGoInfo().ScriptId;
|
||||
}
|
||||
|
||||
@@ -3325,8 +3325,6 @@ namespace Game
|
||||
data.phaseGroup = result.Read<uint>(25);
|
||||
data.terrainSwapMap = result.Read<int>(26);
|
||||
data.ScriptId = GetScriptId(result.Read<string>(27));
|
||||
if (data.ScriptId == 0)
|
||||
data.ScriptId = cInfo.ScriptID;
|
||||
|
||||
var mapEntry = CliDB.MapStorage.LookupByKey(data.mapid);
|
||||
if (mapEntry == null)
|
||||
@@ -4121,8 +4119,6 @@ namespace Game
|
||||
}
|
||||
|
||||
data.ScriptId = GetScriptId(result.Read<string>(21));
|
||||
if (data.ScriptId == 0)
|
||||
data.ScriptId = gInfo.ScriptId;
|
||||
|
||||
if (Math.Abs(data.orientation) > 2 * MathFunctions.PI)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user