예제 #1
0
    static bool HandleMmapStatsCommand(ChatHandler* handler, char const* /*args*/)
    {
        Player* player = handler->GetSession()->GetPlayer();
        uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMap(), player->GetPositionX(), player->GetPositionY());
        handler->PSendSysMessage("mmap stats:");
        handler->PSendSysMessage("  global mmap pathfinding is %sabled", DisableMgr::IsPathfindingEnabled(player->GetMapId()) ? "en" : "dis");

        MMAP::MMapManager* manager = MMAP::MMapFactory::createOrGetMMapManager();
        handler->PSendSysMessage(" %u maps loaded with %u tiles overall", manager->getLoadedMapsCount(), manager->getLoadedTilesCount());

        dtNavMesh const* navmesh = manager->GetNavMesh(terrainMapId);
        if (!navmesh)
        {
            handler->PSendSysMessage("NavMesh not loaded for current map.");
            return true;
        }

        uint32 tileCount = 0;
        uint32 nodeCount = 0;
        uint32 polyCount = 0;
        uint32 vertCount = 0;
        uint32 triCount = 0;
        uint32 triVertCount = 0;
        uint32 dataSize = 0;
        for (int32 i = 0; i < navmesh->getMaxTiles(); ++i)
        {
            dtMeshTile const* tile = navmesh->getTile(i);
            if (!tile || !tile->header)
                continue;

            tileCount++;
            nodeCount += tile->header->bvNodeCount;
            polyCount += tile->header->polyCount;
            vertCount += tile->header->vertCount;
            triCount += tile->header->detailTriCount;
            triVertCount += tile->header->detailVertCount;
            dataSize += tile->dataSize;
        }

        handler->PSendSysMessage("Navmesh stats:");
        handler->PSendSysMessage(" %u tiles loaded", tileCount);
        handler->PSendSysMessage(" %u BVTree nodes", nodeCount);
        handler->PSendSysMessage(" %u polygons (%u vertices)", polyCount, vertCount);
        handler->PSendSysMessage(" %u triangles (%u vertices)", triCount, triVertCount);
        handler->PSendSysMessage(" %.2f MB of data (not including pointers)", ((float)dataSize / sizeof(unsigned char)) / 1048576);

        return true;
    }
예제 #2
0
        static bool HandleMmapStatsCommand(ChatHandler* handler, const char* /*args*/)
        {
            handler->PSendSysMessage("mmap stats:");
            handler->PSendSysMessage("global mmap pathfinding is %sabled", sWorld->getBoolConfig(CONFIG_BOOL_MMAP_ENABLED) ? "en" : "dis");

            MMAP::MMapManager *manager = MMAP::MMapFactory::createOrGetMMapManager();
            handler->PSendSysMessage(" %u maps loaded with %u tiles overall", manager->getLoadedMapsCount(), manager->getLoadedTilesCount());

            const dtNavMesh* navmesh = manager->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId());
            if (!navmesh)
            {
                handler->PSendSysMessage("NavMesh not loaded for current map.");
                return true;
            }

            uint32 tileCount = 0;
            uint32 nodeCount = 0;
            uint32 polyCount = 0;
            uint32 vertCount = 0;
            uint32 triCount = 0;
            uint32 triVertCount = 0;
            uint32 dataSize = 0;
            for (int32 i = 0; i < navmesh->getMaxTiles(); ++i)
            {
                const dtMeshTile* tile = navmesh->getTile(i);
                if (!tile || !tile->header)
                    continue;

                tileCount ++;
                nodeCount += tile->header->bvNodeCount;
                polyCount += tile->header->polyCount;
                vertCount += tile->header->vertCount;
                triCount += tile->header->detailTriCount;
                triVertCount += tile->header->detailVertCount;
                dataSize += tile->dataSize;
            }

            handler->PSendSysMessage(" Navmesh stats on current map:");
            handler->PSendSysMessage(" %u tiles loaded", tileCount);
            handler->PSendSysMessage(" %u BVTree nodes", nodeCount);
            handler->PSendSysMessage(" %u polygons (%u vertices)", polyCount, vertCount);
            handler->PSendSysMessage(" %u triangles (%u vertices)", triCount, triVertCount);
            handler->PSendSysMessage(" %.2f MB of data (not including pointers)", ((float)dataSize / sizeof(unsigned char)) / 1048576);

            return true;
        }