aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2018-07-18 14:19:24 +0200
committerShauren <shauren.trinity@gmail.com>2021-10-14 19:16:54 +0200
commitc4458dd08ebe442461c711d01b014c6ff268fde6 (patch)
tree79533ba029db9ccacbeb95791e6590cf670179bc /src
parent3e22c70c27dd4bcd6e19b42dd45df27da9368fc4 (diff)
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). (cherry picked from commit f7466c28a5f2c2acd2669991cb3a666c997aafab)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Miscellaneous/Language.h1
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp14
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp2
3 files changed, 11 insertions, 6 deletions
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index bc672dda42f..88dab80ad4c 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -1067,6 +1067,7 @@ enum TrinityStrings
LANG_LIST_RESPAWNS_OVERDUE = 5080,
LANG_LIST_RESPAWNS_CREATURES = 5081,
LANG_LIST_RESPAWNS_GAMEOBJECTS = 5082,
+ LANG_OBJECTINFO_AITYPE = 5083,
LANG_NPCINFO_UNIT_FIELD_FLAGS_2 = 5084,
LANG_NPCINFO_UNIT_FIELD_FLAGS_3 = 5085,
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 0b0d7792874..52dc4f52588 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "DB2Stores.h"
#include "GameEventMgr.h"
#include "GameObject.h"
+#include "GameObjectAI.h"
#include "GameTime.h"
#include "Language.h"
#include "Log.h"
@@ -658,16 +659,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());
@@ -685,6 +685,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->GeoBoxMax.X, modelInfo->GeoBoxMax.Y, modelInfo->GeoBoxMax.Z, modelInfo->GeoBoxMin.X, modelInfo->GeoBoxMin.Y, modelInfo->GeoBoxMin.Z);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 03dd4b9c1a9..102e0917862 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -875,6 +875,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)