Core/Phases: some error checking at db loading

- implement .debug phase command
This commit is contained in:
Rat committed 2014-10-30 21:20:04 +01:00
1 parent 8ba89d2311
commit d77bb02e88
4 files changed
+40 -8

No files matched your search

+21 -7
View File
@@ -1389,14 +1389,28 @@ public:
return true;
}
static bool HandleDebugPhaseCommand(ChatHandler* /*handler*/, char const* /*args*/)
static bool HandleDebugPhaseCommand(ChatHandler* handler, char const* /*args*/)
{
/*/
Unit* unit = handler->getSelectedUnit();
Player* player = handler->GetSession()->GetPlayer();
if (unit && unit->GetTypeId() == TYPEID_PLAYER)
player = unit->ToPlayer();
*/
Unit* target = handler->getSelectedUnit();
if (!target)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
return false;
}
std::stringstream phases;
for (uint32 phase : target->GetPhases())
{
phases << phase << " ";
}
if (!phases.str().empty())
handler->PSendSysMessage("Target's current phases: %s", phases.str().c_str());
else
handler->SendSysMessage("Target is not phased");
return true;
}
};