40#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
41#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
51 static std::vector<ChatCommand> mmapCommandTable =
60 static std::vector<ChatCommand> commandTable =
80 if (!player || !target)
86 char* para = strtok((
char*)args,
" ");
88 bool useStraightPath =
false;
89 if (para && strcmp(para,
"true") == 0)
90 useStraightPath =
true;
92 bool useRaycast =
false;
93 if (para && (strcmp(para,
"line") == 0 || strcmp(para,
"ray") == 0 || strcmp(para,
"raycast") == 0))
108 handler->
PSendSysMessage(
"Building: %s", useStraightPath ?
"StraightPath" : useRaycast ?
"Raycast" :
"SmoothPath");
109 handler->
PSendSysMessage(
"Result: %s - Length: %zu - Type: %u", (result ?
"true" :
"false"), pointPath.size(), path.
GetPathType());
115 handler->
PSendSysMessage(
"StartPosition (%.3f, %.3f, %.3f)", start.x, start.y, start.z);
116 handler->
PSendSysMessage(
"EndPosition (%.3f, %.3f, %.3f)", end.x, end.y, end.z);
117 handler->
PSendSysMessage(
"ActualEndPosition (%.3f, %.3f, %.3f)", actualEnd.x, actualEnd.y, actualEnd.z);
122 for (
uint32 i = 0; i < pointPath.size(); ++i)
148 if (!navmesh || !navmeshquery)
154 float const* min = navmesh->getParams()->orig;
164 dtQueryFilter filter = dtQueryFilter();
166 if (dtStatusFailed(navmeshquery->findNearestPoly(location, extents, &filter, &polyRef,
nullptr)))
168 handler->
PSendSysMessage(
"Dt [??,??] (invalid poly, probably no tile loaded)");
173 handler->
PSendSysMessage(
"Dt [??, ??] (invalid poly, probably no tile loaded)");
176 dtMeshTile
const* tile;
178 if (dtStatusSucceed(navmesh->getTileAndPolyByRef(polyRef, &tile, &poly)))
182 handler->
PSendSysMessage(
"Dt [%02i,%02i]", tile->header->x, tile->header->y);
199 if (!navmesh || !navmeshquery)
207 for (
int32 i = 0; i < navmesh->getMaxTiles(); ++i)
209 dtMeshTile
const* tile = navmesh->getTile(i);
210 if (!tile || !tile->header)
213 handler->
PSendSysMessage(
"[%02i, %02i]", tile->header->x, tile->header->y);
229 dtNavMesh
const* navmesh = manager->
GetNavMesh(terrainMapId);
243 for (
int32 i = 0; i < navmesh->getMaxTiles(); ++i)
245 dtMeshTile
const* tile = navmesh->getTile(i);
246 if (!tile || !tile->header)
250 nodeCount += tile->header->bvNodeCount;
251 polyCount += tile->header->polyCount;
252 vertCount += tile->header->vertCount;
253 triCount += tile->header->detailTriCount;
254 triVertCount += tile->header->detailVertCount;
255 dataSize += tile->dataSize;
261 handler->
PSendSysMessage(
" %u polygons (%u vertices)", polyCount, vertCount);
262 handler->
PSendSysMessage(
" %u triangles (%u vertices)", triCount, triVertCount);
263 handler->
PSendSysMessage(
" %.2f MB of data (not including pointers)", ((
float)dataSize /
sizeof(
unsigned char)) / 1048576);
270 float radius = 40.0f;
274 std::list<Creature*> creatureList;
279 if (!creatureList.empty())
287 object->GetPosition(gx, gy, gz);
288 for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
296 handler->
PSendSysMessage(
"Generated %i paths in %i ms", paths, uPathLoadTime);
@ TEMPSUMMON_TIMED_DESPAWN
Role Based Access Control related classes definition.
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
WorldSession * GetSession()
void PSendSysMessage(const char *fmt, Args &&... args)
static MMapManager * createOrGetMMapManager()
uint32 getLoadedMapsCount() const
dtNavMesh const * GetNavMesh(uint32 mapId)
dtNavMeshQuery const * GetNavMeshQuery(uint32 meshMapId, uint32 instanceMapId, uint32 instanceId)
uint32 getLoadedTilesCount() const
TerrainInfo * GetTerrain() const
void SetUseRaycast(bool useRaycast)
Movement::PointsArray const & GetPath() const
G3D::Vector3 const & GetStartPosition() const
PathType GetPathType() const
G3D::Vector3 const & GetEndPosition() const
bool CalculatePath(float destX, float destY, float destZ, bool forceDest=false)
void SetUseStraightPath(bool useStraightPath)
G3D::Vector3 const & GetActualEndPosition() const
static uint32 GetTerrainMapId(PhaseShift const &phaseShift, uint32 mapId, TerrainInfo const *terrain, float x, float y)
bool IsGameMaster() const
constexpr uint32 GetMapId() const
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
PhaseShift & GetPhaseShift()
uint32 GetInstanceId() const
std::string const & GetName() const
Player * GetPlayer() const
static bool HandleMmapTestArea(ChatHandler *handler, char const *)
static bool HandleMmapLocCommand(ChatHandler *handler, char const *)
static bool HandleMmapPathCommand(ChatHandler *handler, char const *args)
static bool HandleMmapStatsCommand(ChatHandler *handler, char const *)
static bool HandleMmapLoadedTilesCommand(ChatHandler *handler, char const *)
std::vector< ChatCommand > GetCommands() const override
void AddSC_mmaps_commandscript()
bool IsPathfindingEnabled(uint32 mapId)
std::vector< Vector3 > PointsArray
@ RBAC_PERM_COMMAND_MMAP_LOC
@ RBAC_PERM_COMMAND_MMAP_TESTAREA
@ RBAC_PERM_COMMAND_MMAP_STATS
@ RBAC_PERM_COMMAND_MMAP_LOADEDTILES
@ RBAC_PERM_COMMAND_MMAP_PATH
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
constexpr float GetPositionX() const
constexpr float GetPositionY() const
constexpr void GetPosition(float &x, float &y) const