mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11913] Add commands for MMaps
Added commands are: .mmap [on|off] to show state of mmaps, or to enable/disable mmaps globally .mmap stats to show information about current state of mmaps .mmap loadedtiles to show which tiles are currently loaded .mmap path to calculate and show a path to current select unit .mmap loc to print on which tile one is .mmap testarea to calculate paths for all nearby npcs to player Authorship goes to qsa in addition
This commit is contained in:
parent
2f0ed05566
commit
d83c7d8c8c
5 changed files with 283 additions and 2 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "CellImpl.h"
|
||||
#include "Weather.h"
|
||||
#include "PointMovementGenerator.h"
|
||||
#include "PathFinder.h"
|
||||
#include "TargetedMovementGenerator.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "SkillExtraItems.h"
|
||||
|
|
@ -7091,4 +7092,73 @@ bool ChatHandler::HandleShowGearScoreCommand(char *args)
|
|||
PSendSysMessage(LANG_GEARSCORE, GetNameLink(player).c_str(), gearScore);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleMmap(char* args)
|
||||
{
|
||||
bool on;
|
||||
if (ExtractOnOff(&args, on))
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
sWorld.setConfig(CONFIG_BOOL_MMAP_ENABLED, true);
|
||||
SendSysMessage("WORLD: mmaps are now ENABLED (individual map settings still in effect)");
|
||||
}
|
||||
else
|
||||
{
|
||||
sWorld.setConfig(CONFIG_BOOL_MMAP_ENABLED, false);
|
||||
SendSysMessage("WORLD: mmaps are now DISABLED");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
on = sWorld.getConfig(CONFIG_BOOL_MMAP_ENABLED);
|
||||
PSendSysMessage("mmaps are %sabled", on ? "en" : "dis");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleMmapTestArea(char* args)
|
||||
{
|
||||
float radius = 40.0f;
|
||||
ExtractFloat(&args, radius);
|
||||
|
||||
CellPair pair(MaNGOS::ComputeCellPair( m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY()) );
|
||||
Cell cell(pair);
|
||||
cell.SetNoCreate();
|
||||
|
||||
std::list<Creature*> creatureList;
|
||||
|
||||
MaNGOS::AnyUnitInObjectRangeCheck go_check(m_session->GetPlayer(), radius);
|
||||
MaNGOS::CreatureListSearcher<MaNGOS::AnyUnitInObjectRangeCheck> go_search(creatureList, go_check);
|
||||
TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::AnyUnitInObjectRangeCheck>, GridTypeMapContainer> go_visit(go_search);
|
||||
|
||||
// Get Creatures
|
||||
cell.Visit(pair, go_visit, *(m_session->GetPlayer()->GetMap()), *(m_session->GetPlayer()), radius);
|
||||
|
||||
if (!creatureList.empty())
|
||||
{
|
||||
PSendSysMessage("Found %i Creatures.", creatureList.size());
|
||||
|
||||
uint32 paths = 0;
|
||||
uint32 uStartTime = WorldTimer::getMSTime();
|
||||
|
||||
float gx,gy,gz;
|
||||
m_session->GetPlayer()->GetPosition(gx,gy,gz);
|
||||
for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
|
||||
{
|
||||
PathFinder path(*itr);
|
||||
path.calculate(gx, gy, gz);
|
||||
++paths;
|
||||
}
|
||||
|
||||
uint32 uPathLoadTime = WorldTimer::getMSTimeDiff(uStartTime, WorldTimer::getMSTime());
|
||||
PSendSysMessage("Generated %i paths in %i ms", paths, uPathLoadTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage("No creatures in %f yard range.", radius);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue