mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
chore(Core/MIsc): added few helpers for chat commands (#6175)
This commit is contained in:
@@ -640,15 +640,11 @@ struct MovementInfo
|
||||
class WorldLocation : public Position
|
||||
{
|
||||
public:
|
||||
explicit WorldLocation(uint32 _mapid = MAPID_INVALID, float _x = 0, float _y = 0, float _z = 0, float _o = 0)
|
||||
: m_mapId(_mapid) { Relocate(_x, _y, _z, _o); }
|
||||
WorldLocation(const WorldLocation& loc) : Position () { WorldRelocate(loc); }
|
||||
/* requried as of C++ 11 */
|
||||
#if __cplusplus >= 201103L
|
||||
WorldLocation(WorldLocation&&) = default;
|
||||
WorldLocation& operator=(const WorldLocation&) = default;
|
||||
WorldLocation& operator=(WorldLocation&&) = default;
|
||||
#endif
|
||||
explicit WorldLocation(uint32 _mapId = MAPID_INVALID, float x = 0.f, float y = 0.f, float z = 0.f, float o = 0.f)
|
||||
: Position(x, y, z, o), m_mapId(_mapId) { }
|
||||
|
||||
WorldLocation(uint32 mapId, Position const& position)
|
||||
: Position(position), m_mapId(mapId) { }
|
||||
|
||||
void WorldRelocate(const WorldLocation& loc)
|
||||
{
|
||||
|
||||
@@ -1347,6 +1347,8 @@ public:
|
||||
void LoadFactionChangeSpells();
|
||||
void LoadFactionChangeTitles();
|
||||
|
||||
[[nodiscard]] bool IsTransportMap(uint32 mapId) const { return _transportMaps.count(mapId) != 0; }
|
||||
|
||||
private:
|
||||
// first free id for selected id type
|
||||
uint32 _auctionId; // pussywizard: accessed by a single thread
|
||||
|
||||
@@ -37,16 +37,22 @@ public:
|
||||
return (iter == i_maps.end() ? nullptr : iter->second);
|
||||
}
|
||||
|
||||
uint32 GetAreaId(uint32 mapid, float x, float y, float z) const
|
||||
[[nodiscard]] uint32 GetAreaId(uint32 mapid, float x, float y, float z) const
|
||||
{
|
||||
Map const* m = const_cast<MapManager*>(this)->CreateBaseMap(mapid);
|
||||
return m->GetAreaId(x, y, z);
|
||||
}
|
||||
uint32 GetZoneId(uint32 mapid, float x, float y, float z) const
|
||||
[[nodiscard]] uint32 GetAreaId(uint32 mapid, Position const& pos) const { return GetAreaId(mapid, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
|
||||
[[nodiscard]] uint32 GetAreaId(WorldLocation const& loc) const { return GetAreaId(loc.GetMapId(), loc); }
|
||||
|
||||
[[nodiscard]] uint32 GetZoneId(uint32 mapid, float x, float y, float z) const
|
||||
{
|
||||
Map const* m = const_cast<MapManager*>(this)->CreateBaseMap(mapid);
|
||||
return m->GetZoneId(x, y, z);
|
||||
}
|
||||
[[nodiscard]] uint32 GetZoneId(uint32 mapid, Position const& pos) const { return GetZoneId(mapid, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
|
||||
[[nodiscard]] uint32 GetZoneId(WorldLocation const& loc) const { return GetZoneId(loc.GetMapId(), loc); }
|
||||
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, uint32 mapid, float x, float y, float z)
|
||||
{
|
||||
Map const* m = const_cast<MapManager*>(this)->CreateBaseMap(mapid);
|
||||
@@ -71,6 +77,11 @@ public:
|
||||
static bool ExistMapAndVMap(uint32 mapid, float x, float y);
|
||||
static bool IsValidMAP(uint32 mapid, bool startUp);
|
||||
|
||||
static bool IsValidMapCoord(uint32 mapid, Position const& pos)
|
||||
{
|
||||
return IsValidMapCoord(mapid, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
|
||||
}
|
||||
|
||||
static bool IsValidMapCoord(uint32 mapid, float x, float y)
|
||||
{
|
||||
return IsValidMAP(mapid, false) && Acore::IsValidMapCoord(x, y);
|
||||
|
||||
Reference in New Issue
Block a user