Script/Commands: Add new "debug loadcells" command
Closes #15292 (cherry picked from commit 5e1722c2f497ac7df8fed5ebe01e352965884584)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
|
||||
DELETE FROM `rbac_permissions` WHERE `id` = 835;
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES (835, 'Command: debug loadcells');
|
||||
|
||||
DELETE FROM `rbac_linked_permissions` WHERE `id` = 192 AND `linkedId` = 835;
|
||||
INSERT INTO `rbac_linked_permissions` (`ìd`, `linkedId`) VALUES (192, 835);
|
||||
@@ -0,0 +1,2 @@
|
||||
DELETE FROM `command` WHERE `name` = 'debug loadcells';
|
||||
INSERT INTO `command` (`name`, `permission`, `help`) VALUES ('debug loadcells', 835, 'Syntax: .debug loadcells [mapId]\nLoads all cells for debugging purposes');
|
||||
@@ -726,6 +726,7 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMAND_TICKET_RESET_COMPLAINT = 832,
|
||||
RBAC_PERM_COMMAND_TICKET_RESET_SUGGESTION = 833,
|
||||
RBAC_PERM_COMMAND_GO_QUEST = 834,
|
||||
RBAC_PERM_COMMAND_DEBUG_LOADCELLS = 835,
|
||||
|
||||
// custom permissions 1000+
|
||||
RBAC_PERM_MAX
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user