Skip to content

Commit 77f1363

Browse files
author
acidmanifesto
authored
fix (core) Script Names not loaded with manual add (#11102)
This fixes Script names not being loaded with npcs and gameobjects when manually added with the .npc\gameobject add cmd that would lead the user to restart the server to load up the npc\gameobject with the script that was manually added
1 parent 9f4f824 commit 77f1363

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/server/game/Entities/Creature/Creature.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2837,7 +2837,8 @@ std::string Creature::GetScriptName() const
28372837
uint32 Creature::GetScriptId() const
28382838
{
28392839
if (CreatureData const* creatureData = GetCreatureData())
2840-
return creatureData->ScriptId;
2840+
if (uint32 scriptId = creatureData->ScriptId)
2841+
return scriptId;
28412842

28422843
return sObjectMgr->GetCreatureTemplate(GetEntry())->ScriptID;
28432844
}

src/server/game/Entities/GameObject/GameObject.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,8 @@ void GameObject::EventInform(uint32 eventId)
21412141
uint32 GameObject::GetScriptId() const
21422142
{
21432143
if (GameObjectData const* gameObjectData = GetGOData())
2144-
return gameObjectData->ScriptId;
2144+
if (uint32 scriptId = gameObjectData->ScriptId)
2145+
return scriptId;
21452146

21462147
return GetGOInfo()->ScriptId;
21472148
}

0 commit comments

Comments
 (0)