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

@@ -0,0 +1,6 @@
DELETE FROM `rbac_permissions` WHERE `id`=776;
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES (776, 'Command: debug phase');
DELETE FROM `rbac_linked_permissions` WHERE `id`=192 AND linkedId=776;
INSERT INTO `rbac_linked_permissions` (`id`, `linkedId`) VALUES (192, 776);
+12
View File
@@ -1776,6 +1776,12 @@ void ObjectMgr::LoadCreatures()
data.phaseMask = 1;
}
if (data.phaseGroup && GetPhasesForGroup(data.phaseGroup).empty())
{
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with non-existing `phasegroup` (%u) set, `phasegroup` set to 0", guid, data.id, data.phaseGroup);
data.phaseGroup = 0;
}
if (data.phaseGroup && data.phaseid)
{
TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
@@ -2084,6 +2090,12 @@ void ObjectMgr::LoadGameobjects()
data.phaseid = fields[18].GetUInt32();
data.phaseGroup = fields[19].GetUInt32();
if (data.phaseGroup && GetPhasesForGroup(data.phaseGroup).empty())
{
TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with non-existing `phasegroup` (%u) set, `phasegroup` set to 0", guid, data.id, data.phaseGroup);
data.phaseGroup = 0;
}
if (data.phaseGroup && data.phaseid)
{
TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: %u Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
+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;
}
};
+1 -1
View File
@@ -206,7 +206,7 @@ public:
{ "model", rbac::RBAC_PERM_COMMAND_NPC_SET_MODEL, false, &HandleNpcSetModelCommand, "", NULL },
{ "movetype", rbac::RBAC_PERM_COMMAND_NPC_SET_MOVETYPE, false, &HandleNpcSetMoveTypeCommand, "", NULL },
{ "phase", rbac::RBAC_PERM_COMMAND_NPC_SET_PHASE, false, &HandleNpcSetPhaseCommand, "", NULL },
{ "phasegroup", rbac::RBAC_PERM_COMMAND_NPC_SET_DATA, false, &HandleNpcSetPhaseGroup, "", NULL },
{ "phasegroup", rbac::RBAC_PERM_COMMAND_NPC_SET_PHASE, false, &HandleNpcSetPhaseGroup, "", NULL },
{ "spawndist", rbac::RBAC_PERM_COMMAND_NPC_SET_SPAWNDIST, false, &HandleNpcSetSpawnDistCommand, "", NULL },
{ "spawntime", rbac::RBAC_PERM_COMMAND_NPC_SET_SPAWNTIME, false, &HandleNpcSetSpawnTimeCommand, "", NULL },
{ "data", rbac::RBAC_PERM_COMMAND_NPC_SET_DATA, false, &HandleNpcSetDataCommand, "", NULL },