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 34967e9c32)
This commit is contained in:
ariel-
2018-02-24 20:57:55 -03:00
committed by funjoker
parent 4c8a49302f
commit 67a1a1d29b
10 changed files with 117 additions and 32 deletions

View File

@@ -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());