[11523] Implement .npc aiinfo

Comamnd show information about used AI and scripts for targeted creature.
AI classes (including from script DLL) can provide additinal info about own state.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Schmoozerd 2011-05-23 03:01:43 +04:00 committed by VladimirMangos
parent ae2a9e1c6a
commit 4ba5aa83e3
14 changed files with 94 additions and 11 deletions

View file

@ -26,6 +26,7 @@
#include "TemporarySummon.h"
#include "Totem.h"
#include "Pet.h"
#include "CreatureAI.h"
#include "GameObject.h"
#include "Opcodes.h"
#include "Chat.h"
@ -34,6 +35,7 @@
#include "Language.h"
#include "World.h"
#include "GameEventMgr.h"
#include "ScriptMgr.h"
#include "SpellMgr.h"
#include "MapPersistentStateMgr.h"
#include "AccountMgr.h"
@ -1677,6 +1679,35 @@ bool ChatHandler::HandleNpcDelVendorItemCommand(char* args)
return true;
}
//show info about AI
bool ChatHandler::HandleNpcAIInfoCommand(char* /*args*/)
{
Creature* pTarget = getSelectedCreature();
if (!pTarget)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}
PSendSysMessage(LANG_NPC_AI_HEADER, pTarget->GetEntry());
std::string strScript = pTarget->GetScriptName();
std::string strAI = pTarget->GetAIName();
char const* cstrAIClass = pTarget->AI() ? typeid(*pTarget->AI()).name() : " - ";
PSendSysMessage(LANG_NPC_AI_NAMES,
strAI.empty() ? " - " : strAI.c_str(),
cstrAIClass ? cstrAIClass : " - ",
strScript.empty() ? " - " : strScript.c_str());
if (pTarget->AI())
pTarget->AI()->GetAIInformation(*this);
return true;
}
//add move for creature
bool ChatHandler::HandleNpcAddMoveCommand(char* args)
{
@ -2608,7 +2639,7 @@ bool ChatHandler::HandleTicketCommand(char* args)
{
bool accept = m_session->GetPlayer()->isAcceptTickets();
PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, accept ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF));
PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, GetOnOffStr(accept));
}
else
PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count);