mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7440] Use server-side only zone info. Optimize related calles in case zone and subzone use.
This in some cases make some zones not explorable if it not have server side data in current maps but not allow cheating with zone set from client.
This commit is contained in:
parent
071a0317f0
commit
329fb3f9d1
15 changed files with 103 additions and 56 deletions
|
|
@ -1242,14 +1242,15 @@ void Player::Update( uint32 p_time )
|
|||
{
|
||||
if(p_time >= m_zoneUpdateTimer)
|
||||
{
|
||||
uint32 newzone = GetZoneId();
|
||||
uint32 newzone, newarea;
|
||||
GetZoneAndAreaId(newzone,newarea);
|
||||
|
||||
if( m_zoneUpdateId != newzone )
|
||||
UpdateZone(newzone); // also update area
|
||||
UpdateZone(newzone,newarea); // also update area
|
||||
else
|
||||
{
|
||||
// use area updates as well
|
||||
// needed for free far all arenas for example
|
||||
uint32 newarea = GetAreaId();
|
||||
if( m_areaUpdateId != newarea )
|
||||
UpdateArea(newarea);
|
||||
|
||||
|
|
@ -1653,16 +1654,19 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
}
|
||||
}
|
||||
|
||||
uint32 newzone, newarea;
|
||||
GetZoneAndAreaId(newzone,newarea);
|
||||
|
||||
if(!GetSession()->PlayerLogout())
|
||||
{
|
||||
// don't reset teleport semaphore while logging out, otherwise m_teleport_dest won't be used in Player::SaveToDB
|
||||
SetSemaphoreTeleport(false);
|
||||
|
||||
UpdateZone(GetZoneId());
|
||||
UpdateZone(newzone,newarea);
|
||||
}
|
||||
|
||||
// new zone
|
||||
if(old_zone != GetZoneId())
|
||||
if(old_zone != newzone)
|
||||
{
|
||||
// honorless target
|
||||
if(pvpInfo.inHostileArea)
|
||||
|
|
@ -3941,7 +3945,9 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
|||
}
|
||||
|
||||
// trigger update zone for alive state zone updates
|
||||
UpdateZone(GetZoneId());
|
||||
uint32 newzone, newarea;
|
||||
GetZoneAndAreaId(newzone,newarea);
|
||||
UpdateZone(newzone,newarea);
|
||||
|
||||
// update visibility
|
||||
ObjectAccessor::UpdateVisibilityForPlayer(this);
|
||||
|
|
@ -6378,13 +6384,16 @@ void Player::UpdateArea(uint32 newArea)
|
|||
UpdateAreaDependentAuras(newArea);
|
||||
}
|
||||
|
||||
void Player::UpdateZone(uint32 newZone)
|
||||
void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
{
|
||||
if(m_zoneUpdateId != newZone)
|
||||
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
|
||||
|
||||
m_zoneUpdateId = newZone;
|
||||
m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL;
|
||||
|
||||
// zone changed, so area changed as well, update it
|
||||
UpdateArea(GetAreaId());
|
||||
UpdateArea(newArea);
|
||||
|
||||
AreaTableEntry const* zone = GetAreaEntryByAreaID(newZone);
|
||||
if(!zone)
|
||||
|
|
@ -7742,15 +7751,15 @@ void Player::SendUpdateWorldState(uint32 Field, uint32 Value)
|
|||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::SendInitWorldStates()
|
||||
void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
|
||||
{
|
||||
// data depends on zoneid/mapid...
|
||||
BattleGround* bg = GetBattleGround();
|
||||
uint16 NumberOfFields = 0;
|
||||
uint32 mapid = GetMapId();
|
||||
uint32 zoneid = GetZoneId();
|
||||
uint32 areaid = GetAreaId();
|
||||
|
||||
sLog.outDebug("Sending SMSG_INIT_WORLD_STATES to Map:%u, Zone: %u", mapid, zoneid);
|
||||
|
||||
// may be exist better way to do this...
|
||||
switch(zoneid)
|
||||
{
|
||||
|
|
@ -12736,8 +12745,8 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
|
|||
SpellAreaForQuestMapBounds saBounds = spellmgr.GetSpellAreaForQuestMapBounds(quest_id,true);
|
||||
if(saBounds.first != saBounds.second)
|
||||
{
|
||||
uint32 zone = GetZoneId();
|
||||
uint32 area = GetAreaId();
|
||||
uint32 zone, area;
|
||||
GetZoneAndAreaId(zone,area);
|
||||
|
||||
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
|
||||
if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
|
||||
|
|
@ -12951,8 +12960,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
SpellAreaForQuestMapBounds saEndBounds = spellmgr.GetSpellAreaForQuestEndMapBounds(quest_id);
|
||||
if(saEndBounds.first != saEndBounds.second)
|
||||
{
|
||||
uint32 zone = GetZoneId();
|
||||
uint32 area = GetAreaId();
|
||||
GetZoneAndAreaId(zone,area);
|
||||
|
||||
for(SpellAreaForAreaMap::const_iterator itr = saEndBounds.first; itr != saEndBounds.second; ++itr)
|
||||
if(!itr->second->IsFitToRequirements(this,zone,area))
|
||||
|
|
@ -12963,8 +12971,8 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
SpellAreaForQuestMapBounds saBounds = spellmgr.GetSpellAreaForQuestMapBounds(quest_id,false);
|
||||
if(saBounds.first != saBounds.second)
|
||||
{
|
||||
if(!zone) zone = GetZoneId();
|
||||
if(!area) area = GetAreaId();
|
||||
if(!zone || !area)
|
||||
GetZoneAndAreaId(zone,area);
|
||||
|
||||
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
|
||||
if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
|
||||
|
|
@ -18343,8 +18351,11 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
|||
SendInitialActionButtons();
|
||||
SendInitialReputations();
|
||||
m_achievementMgr.SendAllAchievementData();
|
||||
UpdateZone(GetZoneId());
|
||||
SendInitWorldStates();
|
||||
|
||||
// update zone
|
||||
uint32 newzone, newarea;
|
||||
GetZoneAndAreaId(newzone,newarea);
|
||||
UpdateZone(newzone,newarea); // also call SendInitWorldStates();
|
||||
|
||||
// SMSG_SET_AURA_SINGLE
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue