mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7005] Request Area/Zone Ids using 3D coordinates.
.map files not have 3D specifci area infor. So use hack way for update areaflag for some cases (areas 4281, 4342) where exist area dependent auras.
This commit is contained in:
parent
d2d5cb4643
commit
bd4fc1b0ae
8 changed files with 42 additions and 21 deletions
|
|
@ -2125,7 +2125,8 @@ bool ChatHandler::HandleNameTeleCommand(const char * args)
|
|||
return false;
|
||||
|
||||
PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str());
|
||||
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y),guid);
|
||||
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,
|
||||
MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),guid);
|
||||
}
|
||||
else
|
||||
PSendSysMessage(LANG_NO_PLAYER, name.c_str());
|
||||
|
|
|
|||
|
|
@ -1076,7 +1076,7 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps) const
|
|||
}
|
||||
}
|
||||
|
||||
uint16 Map::GetAreaFlag(float x, float y ) const
|
||||
uint16 Map::GetAreaFlag(float x, float y, float z) const
|
||||
{
|
||||
//local x,y coords
|
||||
float lx,ly;
|
||||
|
|
@ -1094,11 +1094,30 @@ uint16 Map::GetAreaFlag(float x, float y ) const
|
|||
// ensure GridMap is loaded
|
||||
const_cast<Map*>(this)->EnsureGridCreated(GridPair(63-gx,63-gy));
|
||||
|
||||
uint16 areaflag;
|
||||
if(GridMaps[gx][gy])
|
||||
return GridMaps[gx][gy]->area_flag[(int)(lx)][(int)(ly)];
|
||||
areaflag = GridMaps[gx][gy]->area_flag[(int)(lx)][(int)(ly)];
|
||||
// this used while not all *.map files generated (instances)
|
||||
else
|
||||
return GetAreaFlagByMapId(i_id);
|
||||
areaflag = GetAreaFlagByMapId(i_id);
|
||||
|
||||
//FIXME: some hacks for areas above or underground for ground area
|
||||
// required for area specific spells/etc, until map/vmap data
|
||||
// not provided correct areaflag with this hacks
|
||||
switch(areaflag)
|
||||
{
|
||||
// Acherus: The Ebon Hold (Plaguelands: The Scarlet Enclave)
|
||||
case 1984: // Plaguelands: The Scarlet Enclave
|
||||
case 2076: // Death's Breach (Plaguelands: The Scarlet Enclave)
|
||||
case 2745: // The Noxious Pass (Plaguelands: The Scarlet Enclave)
|
||||
if(z > 350.0f) areaflag = 2048; break;
|
||||
// Acherus: The Ebon Hold (Eastern Plaguelands)
|
||||
case 856: // The Noxious Glade (Eastern Plaguelands)
|
||||
case 2456: // Death's Breach (Eastern Plaguelands)
|
||||
if(z > 350.0f) areaflag = 1950; break;
|
||||
}
|
||||
|
||||
return areaflag;
|
||||
}
|
||||
|
||||
uint8 Map::GetTerrainType(float x, float y ) const
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
|||
float GetHeight(float x, float y, float z, bool pCheckVMap=true) const;
|
||||
bool IsInWater(float x, float y, float z) const; // does not use z pos. This is for future use
|
||||
|
||||
uint16 GetAreaFlag(float x, float y ) const;
|
||||
uint16 GetAreaFlag(float x, float y, float z) const;
|
||||
uint8 GetTerrainType(float x, float y ) const;
|
||||
float GetWaterLevel(float x, float y ) const;
|
||||
bool IsUnderWater(float x, float y, float z) const;
|
||||
|
|
@ -190,14 +190,14 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
|||
static uint32 GetAreaId(uint16 areaflag,uint32 map_id);
|
||||
static uint32 GetZoneId(uint16 areaflag,uint32 map_id);
|
||||
|
||||
uint32 GetAreaId(float x, float y) const
|
||||
uint32 GetAreaId(float x, float y, float z) const
|
||||
{
|
||||
return GetAreaId(GetAreaFlag(x,y),i_id);
|
||||
return GetAreaId(GetAreaFlag(x,y,z),i_id);
|
||||
}
|
||||
|
||||
uint32 GetZoneId(float x, float y) const
|
||||
uint32 GetZoneId(float x, float y, float z) const
|
||||
{
|
||||
return GetZoneId(GetAreaFlag(x,y),i_id);
|
||||
return GetZoneId(GetAreaFlag(x,y,z),i_id);
|
||||
}
|
||||
|
||||
virtual void MoveAllCreaturesInMoveList();
|
||||
|
|
|
|||
|
|
@ -45,13 +45,13 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||
Map const* GetBaseMap(uint32 id) const { return const_cast<MapManager*>(this)->_GetBaseMap(id); }
|
||||
void DeleteInstance(uint32 mapid, uint32 instanceId);
|
||||
|
||||
inline uint16 GetAreaFlag(uint32 mapid, float x, float y) const
|
||||
inline uint16 GetAreaFlag(uint32 mapid, float x, float y, float z) const
|
||||
{
|
||||
Map const* m = GetBaseMap(mapid);
|
||||
return m->GetAreaFlag(x, y);
|
||||
return m->GetAreaFlag(x, y, z);
|
||||
}
|
||||
inline uint32 GetAreaId(uint32 mapid, float x, float y) { return Map::GetAreaId(GetAreaFlag(mapid, x, y),mapid); }
|
||||
inline uint32 GetZoneId(uint32 mapid, float x, float y) { return Map::GetZoneId(GetAreaFlag(mapid, x, y),mapid); }
|
||||
inline uint32 GetAreaId(uint32 mapid, float x, float y, float z) { return Map::GetAreaId(GetAreaFlag(mapid, x, y, z),mapid); }
|
||||
inline uint32 GetZoneId(uint32 mapid, float x, float y, float z) { return Map::GetZoneId(GetAreaFlag(mapid, x, y, z),mapid); }
|
||||
|
||||
void Initialize(void);
|
||||
void Update(time_t);
|
||||
|
|
|
|||
|
|
@ -1044,12 +1044,12 @@ void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid )
|
|||
|
||||
uint32 WorldObject::GetZoneId() const
|
||||
{
|
||||
return MapManager::Instance().GetBaseMap(m_mapId)->GetZoneId(m_positionX,m_positionY);
|
||||
return MapManager::Instance().GetBaseMap(m_mapId)->GetZoneId(m_positionX,m_positionY,m_positionZ);
|
||||
}
|
||||
|
||||
uint32 WorldObject::GetAreaId() const
|
||||
{
|
||||
return MapManager::Instance().GetBaseMap(m_mapId)->GetAreaId(m_positionX,m_positionY);
|
||||
return MapManager::Instance().GetBaseMap(m_mapId)->GetAreaId(m_positionX,m_positionY,m_positionZ);
|
||||
}
|
||||
|
||||
InstanceData* WorldObject::GetInstanceData()
|
||||
|
|
|
|||
|
|
@ -4858,7 +4858,7 @@ void ObjectMgr::LoadGraveyardZones()
|
|||
WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team)
|
||||
{
|
||||
// search for zone associated closest graveyard
|
||||
uint32 zoneId = MapManager::Instance().GetZoneId(MapId,x,y);
|
||||
uint32 zoneId = MapManager::Instance().GetZoneId(MapId,x,y,z);
|
||||
|
||||
// Simulate std. algorithm:
|
||||
// found some graveyard associated to (ghost_zone,ghost_map)
|
||||
|
|
|
|||
|
|
@ -1368,7 +1368,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
|
|||
|
||||
*p_data << uint8(getLevel()); // player level
|
||||
// do not use GetMap! it will spawn a new instance since the bound instances are not loaded
|
||||
uint32 zoneId = MapManager::Instance().GetZoneId(GetMapId(), GetPositionX(),GetPositionY());
|
||||
uint32 zoneId = MapManager::Instance().GetZoneId(GetMapId(), GetPositionX(),GetPositionY(),GetPositionZ());
|
||||
sLog.outDebug("Player::BuildEnumData: m:%u, x:%f, y:%f, z:%f zone:%u", GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), zoneId);
|
||||
*p_data << uint32(zoneId);
|
||||
*p_data << uint32(GetMapId());
|
||||
|
|
@ -5328,7 +5328,7 @@ void Player::CheckExploreSystem()
|
|||
if (isInFlight())
|
||||
return;
|
||||
|
||||
uint16 areaFlag=MapManager::Instance().GetBaseMap(GetMapId())->GetAreaFlag(GetPositionX(),GetPositionY());
|
||||
uint16 areaFlag=MapManager::Instance().GetBaseMap(GetMapId())->GetAreaFlag(GetPositionX(),GetPositionY(),GetPositionZ());
|
||||
if(areaFlag==0xffff)
|
||||
return;
|
||||
int offset = areaFlag / 32;
|
||||
|
|
@ -6170,16 +6170,17 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
|
|||
if (!zone)
|
||||
{
|
||||
// stored zone is zero, use generic and slow zone detection
|
||||
result = CharacterDatabase.PQuery("SELECT map,position_x,position_y FROM characters WHERE guid='%u'", guidLow);
|
||||
result = CharacterDatabase.PQuery("SELECT map,position_x,position_y,position_z FROM characters WHERE guid='%u'", guidLow);
|
||||
if( !result )
|
||||
return 0;
|
||||
fields = result->Fetch();
|
||||
uint32 map = fields[0].GetUInt32();
|
||||
float posx = fields[1].GetFloat();
|
||||
float posy = fields[2].GetFloat();
|
||||
float posz = fields[3].GetFloat();
|
||||
delete result;
|
||||
|
||||
zone = MapManager::Instance().GetZoneId(map,posx,posy);
|
||||
zone = MapManager::Instance().GetZoneId(map,posx,posy,posz);
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7004"
|
||||
#define REVISION_NR "7005"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue