aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2018-02-24 20:57:55 -0300
committerfunjoker <funjoker109@gmail.com>2021-08-08 21:21:34 +0200
commit67a1a1d29b76acfcda505fe1a38761a335e93bc5 (patch)
tree4d74e6600201194e4fa52061efa42eeec7434263 /src/server/scripts
parent4c8a49302fe5d5872cae716db0c91604bc95cad4 (diff)
Core/GameObject: implemented gameobject_overrides table to change faction and flags values on a per-spawn basis
Updates #20957 Closes #20958 (cherry picked from commit 34967e9c32b2c7e871bb93f41609a3b08ad92931)
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 9b5bc70b866..0b0d7792874 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -605,14 +605,15 @@ public:
if (!param1)
return false;
+ ObjectGuid::LowType spawnId = 0;
if (strcmp(param1, "guid") == 0)
{
char* tail = strtok(nullptr, "");
char* cValue = handler->extractKeyFromLink(tail, "Hgameobject");
if (!cValue)
return false;
- ObjectGuid::LowType guidLow = atoull(cValue);
- GameObjectData const* data = sObjectMgr->GetGameObjectData(guidLow);
+ spawnId = atoull(cValue);
+ GameObjectData const* data = sObjectMgr->GetGameObjectData(spawnId);
if (!data)
return false;
entry = data->id;
@@ -672,8 +673,16 @@ public:
handler->PSendSysMessage(LANG_GOINFO_NAME, name.c_str());
handler->PSendSysMessage(LANG_GOINFO_SIZE, gameObjectInfo->size);
- if (GameObjectTemplateAddon const* addon = sObjectMgr->GetGameObjectTemplateAddon(entry))
- handler->PSendSysMessage(LANG_GOINFO_ADDON, addon->faction, addon->flags);
+ GameObjectOverride const* goOverride = nullptr;
+ if (spawnId)
+ if (GameObjectOverride const* ovr = sObjectMgr->GetGameObjectOverride(spawnId))
+ goOverride = ovr;
+
+ if (!goOverride)
+ goOverride = sObjectMgr->GetGameObjectTemplateAddon(entry);
+
+ if (goOverride)
+ handler->PSendSysMessage(LANG_GOINFO_ADDON, goOverride->Faction, goOverride->Flags);
handler->PSendSysMessage(LANG_OBJECTINFO_AIINFO, gameObjectInfo->AIName.c_str(), sObjectMgr->GetScriptName(gameObjectInfo->ScriptId).c_str());