34 static std::vector<ChatCommand> mmapCommandTable =
43 static std::vector<ChatCommand> commandTable =
63 if (!player || !target)
69 char* para = strtok((
char*)args,
" ");
71 bool useStraightPath =
false;
72 if (para && strcmp(para,
"true") == 0)
73 useStraightPath =
true;
86 handler->
PSendSysMessage(
"Building: %s", useStraightPath ?
"StraightPath" :
"SmoothPath");
93 handler->
PSendSysMessage(
"StartPosition (%.3f, %.3f, %.3f)", start.x, start.y, start.z);
94 handler->
PSendSysMessage(
"EndPosition (%.3f, %.3f, %.3f)", end.x, end.y, end.z);
95 handler->
PSendSysMessage(
"ActualEndPosition (%.3f, %.3f, %.3f)", actualEnd.x, actualEnd.y, actualEnd.z);
100 for (
uint32 i = 0; i < pointPath.size(); ++i)
122 if (!navmesh || !navmeshquery)
128 float const* min = navmesh->getParams()->orig;
140 dtQueryFilter filter = dtQueryFilter();
142 if (dtStatusFailed(navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, NULL)))
144 handler->
PSendSysMessage(
"Dt [??,??] (invalid poly, probably no tile loaded)");
149 handler->
PSendSysMessage(
"Dt [??, ??] (invalid poly, probably no tile loaded)");
152 dtMeshTile
const* tile;
154 if (dtStatusSucceed(navmesh->getTileAndPolyByRef(polyRef, &tile, &poly)))
158 handler->
PSendSysMessage(
"Dt [%02i,%02i]", tile->header->x, tile->header->y);
174 if (!navmesh || !navmeshquery)
182 for (
int32 i = 0; i < navmesh->getMaxTiles(); ++i)
184 dtMeshTile
const* tile = navmesh->getTile(i);
185 if (!tile || !tile->header)
188 handler->
PSendSysMessage(
"[%02i, %02i]", tile->header->x, tile->header->y);
217 for (
int32 i = 0; i < navmesh->getMaxTiles(); ++i)
219 dtMeshTile
const* tile = navmesh->getTile(i);
220 if (!tile || !tile->header)
224 nodeCount += tile->header->bvNodeCount;
225 polyCount += tile->header->polyCount;
226 vertCount += tile->header->vertCount;
227 triCount += tile->header->detailTriCount;
228 triVertCount += tile->header->detailVertCount;
229 dataSize += tile->dataSize;
235 handler->
PSendSysMessage(
" %u polygons (%u vertices)", polyCount, vertCount);
236 handler->
PSendSysMessage(
" %u triangles (%u vertices)", triCount, triVertCount);
237 handler->
PSendSysMessage(
" %.2f MB of data (not including pointers)", ((
float)dataSize /
sizeof(
unsigned char)) / 1048576);
244 float radius = 40.0f;
251 std::list<Creature*> creatureList;
258 cell.
Visit(pair, go_visit, *(object->
GetMap()), *
object, radius);
260 if (!creatureList.empty())
268 object->GetPosition(gx, gy, gz);
269 for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
277 handler->
PSendSysMessage(
"Generated %i paths in %i ms", paths, uPathLoadTime);
TypeMapContainer< AllGridObjectTypes > GridTypeMapContainer
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
@ TEMPSUMMON_TIMED_DESPAWN
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
WorldSession * GetSession()
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
CommandScript(const char *name)
static MMapManager * createOrGetMMapManager()
static bool IsPathfindingEnabled(uint32 mapId)
uint32 getLoadedMapsCount() const
dtNavMeshQuery const * GetNavMeshQuery(uint32 mapId, uint32 instanceId, TerrainSet swaps)
dtNavMesh const * GetNavMesh(uint32 mapId, TerrainSet swaps)
uint32 getLoadedTilesCount() const
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
bool IsGameMaster() const
std::set< uint32 > const & GetTerrainSwaps() const
uint32 GetInstanceId() const
std::string const & GetName() const
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Player * GetPlayer() const
static bool HandleMmapTestArea(ChatHandler *handler, char const *)
static bool HandleMmapLocCommand(ChatHandler *handler, char const *)
std::vector< ChatCommand > GetCommands() const OVERRIDE
static bool HandleMmapPathCommand(ChatHandler *handler, char const *args)
static bool HandleMmapStatsCommand(ChatHandler *handler, char const *)
static bool HandleMmapLoadedTilesCommand(ChatHandler *handler, char const *)
void AddSC_mmaps_commandscript()
std::vector< Vector3 > PointsArray
CellCoord ComputeCellCoord(float x, float y)
@ 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
void Visit(CellCoord const &, TypeContainerVisitor< T, CONTAINER > &visitor, Map &, WorldObject const &, float) const
float GetPositionX() const
void GetPosition(float &x, float &y) const
float GetPositionY() const