diff --git a/sql/updates/world/2014_10_30_00_world.sql b/sql/updates/world/2014_10_30_00_world.sql new file mode 100644 index 0000000000..716362faf6 --- /dev/null +++ b/sql/updates/world/2014_10_30_00_world.sql @@ -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); + diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 542799a80c..5c9012facd 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -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); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index cb4296a780..b5e2214505 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -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; } }; diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index e27fc8d7a2..40bbee35e4 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -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 },