Scripts/Commands: .npc info and .gobj info now show runtime AI typenames in addition to AIName/ScriptName.

Trying to figure out what base AI type a given creature is using has annoyed me one too many times (hi there, e8f9068).
This commit is contained in:
Treeston
2018-07-18 14:19:24 +02:00
parent 0c476ff9e0
commit f7466c28a5
4 changed files with 14 additions and 6 deletions

View File

@@ -0,0 +1,3 @@
--
DELETE FROM `trinity_string` WHERE `entry`=5083;
INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES (5083,"Active AI: %s");

View File

@@ -1062,6 +1062,7 @@ enum TrinityStrings
LANG_LIST_RESPAWNS_OVERDUE = 5080,
LANG_LIST_RESPAWNS_CREATURES = 5081,
LANG_LIST_RESPAWNS_GAMEOBJECTS = 5082,
LANG_OBJECTINFO_AITYPE = 5083,
// Room for more Trinity strings 5084-6603

View File

@@ -27,6 +27,7 @@ EndScriptData */
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameEventMgr.h"
#include "GameObjectAI.h"
#include "GameTime.h"
#include "Language.h"
#include "Log.h"
@@ -670,16 +671,15 @@ public:
handler->PSendSysMessage(LANG_GOINFO_LOOTID, lootId);
handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayId);
if (WorldObject* object = handler->getSelectedObject())
if (thisGO)
{
if (object->ToGameObject() && object->ToGameObject()->GetGameObjectData() && object->ToGameObject()->GetGameObjectData()->spawnGroupData->groupId)
if (thisGO->GetGameObjectData() && thisGO->GetGameObjectData()->spawnGroupData->groupId)
{
SpawnGroupTemplateData const* groupData = object->ToGameObject()->GetGameObjectData()->spawnGroupData;
handler->PSendSysMessage(LANG_SPAWNINFO_GROUP_ID, groupData->name.c_str(), groupData->groupId, groupData->flags, object->GetMap()->IsSpawnGroupActive(groupData->groupId));
SpawnGroupTemplateData const* groupData = thisGO->GetGameObjectData()->spawnGroupData;
handler->PSendSysMessage(LANG_SPAWNINFO_GROUP_ID, groupData->name.c_str(), groupData->groupId, groupData->flags, thisGO->GetMap()->IsSpawnGroupActive(groupData->groupId));
}
if (object->ToGameObject())
handler->PSendSysMessage(LANG_SPAWNINFO_COMPATIBILITY_MODE, object->ToGameObject()->GetRespawnCompatibilityMode());
handler->PSendSysMessage(LANG_SPAWNINFO_COMPATIBILITY_MODE, thisGO->GetRespawnCompatibilityMode());
}
handler->PSendSysMessage(LANG_GOINFO_NAME, name.c_str());
@@ -697,6 +697,8 @@ public:
handler->PSendSysMessage(LANG_GOINFO_ADDON, goOverride->Faction, goOverride->Flags);
handler->PSendSysMessage(LANG_OBJECTINFO_AIINFO, gameObjectInfo->AIName.c_str(), sObjectMgr->GetScriptName(gameObjectInfo->ScriptId).c_str());
if (GameObjectAI const* ai = thisGO ? thisGO->AI() : nullptr)
handler->PSendSysMessage(LANG_OBJECTINFO_AITYPE, typeid(*ai).name());
if (GameObjectDisplayInfoEntry const* modelInfo = sGameObjectDisplayInfoStore.LookupEntry(displayId))
handler->PSendSysMessage(LANG_GOINFO_MODEL, modelInfo->maxX, modelInfo->maxY, modelInfo->maxZ, modelInfo->minX, modelInfo->minY, modelInfo->minZ);

View File

@@ -811,6 +811,8 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor());
handler->PSendSysMessage(LANG_NPCINFO_POSITION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
handler->PSendSysMessage(LANG_OBJECTINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str());
if (CreatureAI const* ai = target->AI())
handler->PSendSysMessage(LANG_OBJECTINFO_AITYPE, typeid(*ai).name());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS_EXTRA, cInfo->flags_extra);
for (uint8 i = 0; i < FLAGS_EXTRA_COUNT; ++i)
if (cInfo->flags_extra & flagsExtra[i].Value)