Moving a commands around eliminating a unnecessary file, and porting the "demorph" command
* moved the "wpgps" command into the cs_debug.cpp because it seems more fitting * organized the "modify speed" commands into a table of their own * moved the "gps" command into the cs_misc.cpp
This commit is contained in:
1 parent
0814bfb35e
commit
7e793575be
9 files changed
+141
-174
No files matched your search
@@ -17,6 +17,9 @@
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "Chat.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "CellImpl.h"
|
||||
|
||||
class misc_commandscript : public CommandScript
|
||||
{
|
||||
@@ -27,7 +30,8 @@ public:
|
||||
{
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
|
||||
{ "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
|
||||
{ "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
@@ -64,6 +68,90 @@ public:
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleGPSCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
WorldObject* object = NULL;
|
||||
if (*args)
|
||||
{
|
||||
uint64 guid = handler->extractGuidFromLink((char*)args);
|
||||
if (guid)
|
||||
object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
|
||||
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
object = handler->getSelectedUnit();
|
||||
|
||||
if (!object)
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
|
||||
Cell cell(cellCoord);
|
||||
|
||||
uint32 zoneId, areaId;
|
||||
object->GetZoneAndAreaId(zoneId, areaId);
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
|
||||
AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
|
||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
|
||||
|
||||
float zoneX = object->GetPositionX();
|
||||
float zoneY = object->GetPositionY();
|
||||
|
||||
Map2ZoneCoordinates(zoneX, zoneY, zoneId);
|
||||
|
||||
Map const* map = object->GetMap();
|
||||
float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
|
||||
float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
|
||||
|
||||
GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
|
||||
|
||||
// 63? WHY?
|
||||
int gridX = 63 - gridCoord.x_coord;
|
||||
int gridY = 63 - gridCoord.y_coord;
|
||||
|
||||
uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
|
||||
uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
|
||||
|
||||
if (haveVMap)
|
||||
{
|
||||
if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
|
||||
handler->PSendSysMessage("You are outdoors");
|
||||
else
|
||||
handler->PSendSysMessage("You are indoors");
|
||||
}
|
||||
else
|
||||
handler->PSendSysMessage("no VMAP available for area info");
|
||||
|
||||
handler->PSendSysMessage(LANG_MAP_POSITION,
|
||||
object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
|
||||
zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
|
||||
areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
|
||||
object->GetPhaseMask(),
|
||||
object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
|
||||
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
|
||||
zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
|
||||
|
||||
LiquidData liquidStatus;
|
||||
ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
|
||||
|
||||
if (status)
|
||||
handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_misc_commandscript()
|
||||
|
||||
Reference in new issue
Block a user