From 0a376bdc764f9be7784a58858c03166a775fbf05 Mon Sep 17 00:00:00 2001 From: sudlud Date: Sat, 27 Apr 2024 01:56:46 +0200 Subject: [PATCH] fix(Core/GameObject): load guid based scripts correctly (#18811) - m_goData must be assigned before Create() is beeing called - otherwise GetScriptId() can't load the correct scriptiD in Create() - all in all this is now more in line with how it's beeing done in Creature.cpp --- src/server/game/Entities/GameObject/GameObject.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 83f21ac4c..0db064434 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -406,7 +406,7 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u } } - LastUsedScriptID = GetGOInfo()->ScriptId; + LastUsedScriptID = GetScriptId(); AIM_Initialize(); if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry()) @@ -1140,6 +1140,7 @@ bool GameObject::LoadGameObjectFromDB(ObjectGuid::LowType spawnId, Map* map, boo GOState go_state = data->go_state; uint32 artKit = data->artKit; + m_goData = data; m_spawnId = spawnId; if (!Create(map->GenerateLowGuid(), entry, map, phaseMask, x, y, z, ang, data->rotation, animprogress, go_state, artKit)) @@ -1175,8 +1176,6 @@ bool GameObject::LoadGameObjectFromDB(ObjectGuid::LowType spawnId, Map* map, boo m_respawnTime = 0; } - m_goData = data; - if (addToMap && !GetMap()->AddToMap(this)) return false;