Skip to content

Commit

Permalink
fix (core) Script Names not loaded with manual add (#11102)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
acidmanifesto committed Mar 22, 2022
1 parent 9f4f824 commit 77f1363
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/server/game/Entities/Creature/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2837,7 +2837,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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Entities/GameObject/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2141,7 +2141,8 @@ void GameObject::EventInform(uint32 eventId)
uint32 GameObject::GetScriptId() const
{
if (GameObjectData const* gameObjectData = GetGOData())
return gameObjectData->ScriptId;
if (uint32 scriptId = gameObjectData->ScriptId)
return scriptId;

return GetGOInfo()->ScriptId;
}
Expand Down

0 comments on commit 77f1363

Please sign in to comment.