refactor(Scripts/Commands): Convert cs_mmap to new system (#9020)
This commit is contained in:
committed by
GitHub
parent
d6e0e9e5cf
commit
540e8e9209
@@ -36,10 +36,6 @@
|
|||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "TargetedMovementGenerator.h"
|
#include "TargetedMovementGenerator.h"
|
||||||
|
|
||||||
#if AC_COMPILER == AC_COMPILER_GNU
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace Acore::ChatCommands;
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
class mmaps_commandscript : public CommandScript
|
class mmaps_commandscript : public CommandScript
|
||||||
@@ -51,21 +47,21 @@ public:
|
|||||||
{
|
{
|
||||||
static ChatCommandTable mmapCommandTable =
|
static ChatCommandTable mmapCommandTable =
|
||||||
{
|
{
|
||||||
{ "loadedtiles", SEC_ADMINISTRATOR, false, &HandleMmapLoadedTilesCommand, "" },
|
{ "loadedtiles", HandleMmapLoadedTilesCommand, SEC_ADMINISTRATOR, Console::No },
|
||||||
{ "loc", SEC_ADMINISTRATOR, false, &HandleMmapLocCommand, "" },
|
{ "loc", HandleMmapLocCommand, SEC_ADMINISTRATOR, Console::No },
|
||||||
{ "path", SEC_ADMINISTRATOR, false, &HandleMmapPathCommand, "" },
|
{ "path", HandleMmapPathCommand, SEC_ADMINISTRATOR, Console::No },
|
||||||
{ "stats", SEC_ADMINISTRATOR, false, &HandleMmapStatsCommand, "" },
|
{ "stats", HandleMmapStatsCommand, SEC_ADMINISTRATOR, Console::No },
|
||||||
{ "testarea", SEC_ADMINISTRATOR, false, &HandleMmapTestArea, "" },
|
{ "testarea", HandleMmapTestArea, SEC_ADMINISTRATOR, Console::No }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ChatCommandTable commandTable =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
{ "mmap", SEC_ADMINISTRATOR, true, nullptr, "", mmapCommandTable },
|
{ "mmap", mmapCommandTable }
|
||||||
};
|
};
|
||||||
return commandTable;
|
return commandTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleMmapPathCommand(ChatHandler* handler, char const* args)
|
static bool HandleMmapPathCommand(ChatHandler* handler, Optional<std::string> para)
|
||||||
{
|
{
|
||||||
if (!MMAP::MMapFactory::createOrGetMMapMgr()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
|
if (!MMAP::MMapFactory::createOrGetMMapMgr()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
|
||||||
{
|
{
|
||||||
@@ -84,14 +80,12 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* para = strtok((char*)args, " ");
|
|
||||||
|
|
||||||
bool useStraightPath = false;
|
bool useStraightPath = false;
|
||||||
if (para && strcmp(para, "true") == 0)
|
if (StringStartsWith("true", *para))
|
||||||
useStraightPath = true;
|
useStraightPath = true;
|
||||||
|
|
||||||
bool useRaycast = false;
|
bool useRaycast = false;
|
||||||
if (para && (strcmp(para, "line") == 0 || strcmp(para, "ray") == 0 || strcmp(para, "raycast") == 0))
|
if (StringStartsWith("line", *para) || StringStartsWith("ray", *para) || StringStartsWith("raycast", *para))
|
||||||
{
|
{
|
||||||
useRaycast = true;
|
useRaycast = true;
|
||||||
}
|
}
|
||||||
@@ -122,13 +116,13 @@ public:
|
|||||||
if (!player->IsGameMaster())
|
if (!player->IsGameMaster())
|
||||||
handler->PSendSysMessage("Enable GM mode to see the path points.");
|
handler->PSendSysMessage("Enable GM mode to see the path points.");
|
||||||
|
|
||||||
for (uint32 i = 0; i < pointPath.size(); ++i)
|
for (auto i : pointPath)
|
||||||
player->SummonCreature(VISUAL_WAYPOINT, pointPath[i].x, pointPath[i].y, pointPath[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
|
player->SummonCreature(VISUAL_WAYPOINT, i.x, i.y, i.z, 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleMmapLocCommand(ChatHandler* handler, char const* /*args*/)
|
static bool HandleMmapLocCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage("mmap tileloc:");
|
handler->PSendSysMessage("mmap tileloc:");
|
||||||
|
|
||||||
@@ -191,7 +185,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleMmapLoadedTilesCommand(ChatHandler* handler, char const* /*args*/)
|
static bool HandleMmapLoadedTilesCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
uint32 mapid = handler->GetSession()->GetPlayer()->GetMapId();
|
uint32 mapid = handler->GetSession()->GetPlayer()->GetMapId();
|
||||||
dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapMgr()->GetNavMesh(mapid);
|
dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapMgr()->GetNavMesh(mapid);
|
||||||
@@ -216,7 +210,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleMmapStatsCommand(ChatHandler* handler, char const* /*args*/)
|
static bool HandleMmapStatsCommand(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage("mmap stats:");
|
handler->PSendSysMessage("mmap stats:");
|
||||||
//handler->PSendSysMessage(" global mmap pathfinding is %sabled", DisableMgr::IsPathfindingEnabled(mapId) ? "en" : "dis");
|
//handler->PSendSysMessage(" global mmap pathfinding is %sabled", DisableMgr::IsPathfindingEnabled(mapId) ? "en" : "dis");
|
||||||
@@ -263,7 +257,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleMmapTestArea(ChatHandler* handler, char const* /*args*/)
|
static bool HandleMmapTestArea(ChatHandler* handler)
|
||||||
{
|
{
|
||||||
float radius = 40.0f;
|
float radius = 40.0f;
|
||||||
WorldObject* object = handler->GetSession()->GetPlayer();
|
WorldObject* object = handler->GetSession()->GetPlayer();
|
||||||
|
|||||||
Reference in New Issue
Block a user