From 2da458c56d024aac04468ce2af454a83ad790bf6 Mon Sep 17 00:00:00 2001 From: treeston Date: Sun, 20 Dec 2015 13:28:16 +0100 Subject: Scripts/Instances: Complete rewrite of the boundary system. - Migrate boundary logic to Maps/AreaBoundary instead of having it sit in InstanceScript (to possibly allow use for other purposes). - Implement the first five boundary types in Maps/AreaBoundary.cpp. - Add boundary checks to Creature's update logic - Add boundary data for all Northrend raids - Add boundary initialization structures and methods to InstanceScript - Modify EnterEvadeMode signature. It now passes a value from the EvadeReason enum as parameter to allow special casing depending on evade reason - Remove previous (weird) boundary code that had them linked to GO spawns --- src/server/scripts/Commands/cs_debug.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index bfc01932061..9902b83ff63 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -93,6 +93,7 @@ public: { "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, "" }, + { "boundary", rbac::RBAC_PERM_COMMAND_DEBUG_BOUNDARY, false, &HandleDebugBoundaryCommand, "" } }; static std::vector commandTable = { @@ -1414,6 +1415,33 @@ public: handler->PSendSysMessage("Cells loaded (mapId: %u) After load - Next GameObject %u, Creature %u", map->GetId(), map->GetMaxLowGuid(), map->GetMaxLowGuid()); return true; } + + static bool HandleDebugBoundaryCommand(ChatHandler* handler, char const* args) + { + Player* player = handler->GetSession()->GetPlayer(); + if (!player) + return false; + Creature* target = handler->getSelectedCreature(); + if (!target || !target->IsAIEnabled || !target->AI()) + { + return false; + } + + char* fill_str = args ? strtok((char*)args, " ") : nullptr; + char* duration_str = args ? strtok(nullptr, " ") : nullptr; + + int duration = duration_str ? atoi(duration_str) : -1; + if (duration <= 0 || duration >= 30 * MINUTE) // arbitary upper limit + duration = 3 * MINUTE; + + bool doFill = fill_str ? (stricmp(fill_str, "FILL") == 0) : false; + + int32 errMsg = target->AI()->VisualizeBoundary(duration, player, doFill); + if (errMsg > 0) + handler->PSendSysMessage(errMsg); + + return true; + } }; void AddSC_debug_commandscript() -- cgit v1.2.3