[7440] Use server-side only zone info. Optimize related calles in case zone and subzone use. Author: VladimirMangos
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.
--HG--
branch : trunk
This commit is contained in:
1 parent
5286f2351f
commit
6e29ab4fbb
15 files changed
+107
-67
No files matched your search
+34
-31
@@ -1295,14 +1295,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);
|
||||
|
||||
@@ -1732,16 +1733,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)
|
||||
@@ -4046,7 +4050,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);
|
||||
@@ -6529,26 +6535,25 @@ void Player::UpdateArea(uint32 newArea)
|
||||
UpdateAreaDependentAuras(newArea);
|
||||
}
|
||||
|
||||
void Player::UpdateZone(uint32 newZone)
|
||||
void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
{
|
||||
uint32 oldZoneId = m_zoneUpdateId;
|
||||
if(m_zoneUpdateId != newZone)
|
||||
{
|
||||
sOutdoorPvPMgr.HandlePlayerLeaveZone(this, m_zoneUpdateId);
|
||||
sOutdoorPvPMgr.HandlePlayerEnterZone(this, 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)
|
||||
return;
|
||||
|
||||
// inform outdoor pvp
|
||||
if(oldZoneId != m_zoneUpdateId)
|
||||
{
|
||||
sOutdoorPvPMgr.HandlePlayerLeaveZone(this, oldZoneId);
|
||||
sOutdoorPvPMgr.HandlePlayerEnterZone(this, m_zoneUpdateId);
|
||||
}
|
||||
|
||||
if (sWorld.getConfig(CONFIG_WEATHER))
|
||||
{
|
||||
Weather *wth = sWorld.FindWeather(zone->ID);
|
||||
@@ -7927,20 +7932,16 @@ void Player::SendUpdateWorldState(uint32 Field, uint32 Value)
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::SendInitWorldStates(bool forceZone, uint32 forceZoneId)
|
||||
void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
|
||||
{
|
||||
// data depends on zoneid/mapid...
|
||||
BattleGround* bg = GetBattleGround();
|
||||
uint16 NumberOfFields = 0;
|
||||
uint32 mapid = GetMapId();
|
||||
uint32 zoneid;
|
||||
if(forceZone)
|
||||
zoneid = forceZoneId;
|
||||
else
|
||||
zoneid = GetZoneId();
|
||||
OutdoorPvP * pvp = sOutdoorPvPMgr.GetOutdoorPvPToZoneId(zoneid);
|
||||
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)
|
||||
{
|
||||
@@ -13061,8 +13062,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))
|
||||
@@ -13276,8 +13277,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))
|
||||
@@ -13288,8 +13288,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))
|
||||
@@ -18954,8 +18954,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
|
||||
|
||||
|
||||
Reference in new issue
Block a user