diff options
| author | jackpoz <giacomopoz@gmail.com> | 2015-08-16 16:39:02 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2015-11-01 12:30:45 +0100 |
| commit | 7b684e8813376a82526d78c44d00f282229fe471 (patch) | |
| tree | b3f5c36409224685780203b90a0647ffa81e228b /src/server/scripts/Commands | |
| parent | ee5eb215e955dc721e136292ac8451bc66574914 (diff) | |
Script/Commands: Add new "debug loadcells" command
Closes #15292
(cherry picked from commit 5e1722c2f497ac7df8fed5ebe01e352965884584)
Diffstat (limited to 'src/server/scripts/Commands')
| -rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index b3a1f0317c1..07c9af94bf4 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -33,6 +33,7 @@ EndScriptData */ #include "GossipDef.h" #include "Transport.h" #include "Language.h" +#include "MapManager.h" #include "MovementPackets.h" #include "SpellPackets.h" #include "ScenePackets.h" @@ -95,6 +96,7 @@ public: { "los", rbac::RBAC_PERM_COMMAND_DEBUG_LOS, false, &HandleDebugLoSCommand, "" }, { "moveflags", rbac::RBAC_PERM_COMMAND_DEBUG_MOVEFLAGS, false, &HandleDebugMoveflagsCommand, "" }, { "transport", rbac::RBAC_PERM_COMMAND_DEBUG_TRANSPORT, false, &HandleDebugTransportCommand, "" }, + { "loadcells", rbac::RBAC_PERM_COMMAND_DEBUG_LOADCELLS, false, &HandleDebugLoadCellsCommand, "",}, { "phase", rbac::RBAC_PERM_COMMAND_DEBUG_PHASE, false, &HandleDebugPhaseCommand, "" }, }; static std::vector<ChatCommand> commandTable = @@ -1393,6 +1395,30 @@ public: return true; } + static bool HandleDebugLoadCellsCommand(ChatHandler* handler, char const* args) + { + Player* player = handler->GetSession()->GetPlayer(); + if (!player) + return false; + + Map* map = nullptr; + + if (*args) + { + int32 mapId = atoi(args); + map = sMapMgr->FindBaseNonInstanceMap(mapId); + } + if (!map) + map = player->GetMap(); + + for (uint32 cellX = 0; cellX < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellX++) + for (uint32 cellY = 0; cellY < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellY++) + map->LoadGrid((cellX + 0.5f - CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL, (cellY + 0.5f - CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL); + + handler->PSendSysMessage("Cells loaded (mapId: %u)", map->GetId()); + return true; + } + static bool HandleDebugPhaseCommand(ChatHandler* handler, char const* /*args*/) { Unit* target = handler->getSelectedUnit(); |
