void Player::UpdateZone(uint32 newZone) { m_zoneUpdateId = newZone; m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL; AreaTableEntry const* zone = GetAreaEntryByAreaID(newZone); if(!zone) return; if (sWorld.getConfig(CONFIG_WEATHER)) { Weather *wth = sWorld.FindWeather(zone->ID); if(wth) { wth->SendWeatherUpdateToPlayer(this); } else { if(!sWorld.AddWeather(zone->ID)) { // send fine weather packet to remove old zone's weather Weather::SendFineWeatherUpdateToPlayer(this); } } } pvpInfo.inHostileArea = GetTeam() == ALLIANCE && zone->team == AREATEAM_HORDE || GetTeam() == HORDE && zone->team == AREATEAM_ALLY || sWorld.IsPvPRealm() && zone->team == AREATEAM_NONE; if(pvpInfo.inHostileArea) // in hostile area { if(!IsPvP() || pvpInfo.endTimer != 0) UpdatePvP(true, true); } else // in friendly area { if(IsPvP() && !HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_IN_PVP) && pvpInfo.endTimer == 0) pvpInfo.endTimer = time(0); // start toggle-off } // zonetype is flags // flags & 0x00000001 (1) - snow (only Dun Morogh, Naxxramas, Razorfen Downs and Winterspring) // flags & 0x00000002 (2) - unknown, (only Naxxramas and Razorfen Downs) // flags & 0x00000004 (4) - On Map Dungeon // flags & 0x00000008 (8) - slave capital city flag? // flags & 0x00000010 (16) - unknown // flags & 0x00000020 (32) - slave capital city flag? // flags & 0x00000040 (64) - many zones have this flag // flags & 0x00000080 (128) - arena // flags & 0x00000100 (256) - main capital city flag // flags & 0x00000200 (512) - only for one zone named "City" (where it located?) // flags & 0x00000400 (1024) - outland zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) // flags & 0x00000800 (2048) - sanctuary area (PvP disabled) // flags & 0x00001000 (4096) - only Netherwing Ledge, Socrethar's Seat, Tempest Keep, The Arcatraz, The Botanica, The Mechanar // flags & 0x00002000 (8192) - not used now (no area/zones with this flag set) ... // flags & 0x00004000 (16384) - outland zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) // flags & 0x00008000 (32768) - pvp objective area? if((zone->flags & 0x800) != 0) // in sanctuary { UpdatePvP(false, true); // i'm right? need disable PvP in this area... } if((zone->flags & 0x100) != 0) // in capital city { SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetRestType(REST_TYPE_IN_CITY); InnEnter(time(0),GetMapId(),0,0,0); } else // anywhere else { if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) // but resting (walk from city or maybe in tavern or leave tavern recently) { if(GetRestType()==REST_TYPE_IN_TAVERN) // has been in tavern. Is still in? { if(GetMapId()!=GetInnPosMapId() || sqrt((GetPositionX()-GetInnPosX())*(GetPositionX()-GetInnPosX())+(GetPositionY()-GetInnPosY())*(GetPositionY()-GetInnPosY())+(GetPositionZ()-GetInnPosZ())*(GetPositionZ()-GetInnPosZ()))>40) { RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetRestType(REST_TYPE_NO); } } else // not in tavern (leave city then) { RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetRestType(REST_TYPE_NO); } } } // remove auras from spells with area limitations for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();) { if(iter->second->GetSpellProto()->AreaId && iter->second->GetSpellProto()->AreaId != newZone) { RemoveAura(iter); } else ++iter; } // remove items with area/map limitations (delete only for alive player to allow back in ghost mode) // if player resurrected at teleport this will be applied in resurrect code if(isAlive()) DestroyZoneLimitedItem( true, newZone ); // recent client version not send leave/join channel packets for built-in local channels UpdateLocalChannels( newZone ); // group update SetGroupUpdateFlag(GROUP_UPDATE_FLAG_ZONE); }