From f7466c28a5f2c2acd2669991cb3a666c997aafab Mon Sep 17 00:00:00 2001 From: Treeston Date: Wed, 18 Jul 2018 14:19:24 +0200 Subject: 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). --- src/server/scripts/Commands/cs_gobject.cpp | 14 ++++++++------ src/server/scripts/Commands/cs_npc.cpp | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 45a816a6a77..5d5cec9fc3e 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -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); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 02f6e4765d4..0bb08cb9c79 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -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) -- cgit v1.2.3