[9187] Fixed problem with non-attackable pes/totems at arenas

... and other FFA areas. Problem is result chnages in related flags work after old 3.x switch.

* Added high-level functions for FFAPvP state set for unit
* Apply FFA PvP to all controlled units also at set, and at summon/load
This commit is contained in:
VladimirMangos 2010-01-16 05:37:57 +03:00
parent 6704929d56
commit cc062f16ac
9 changed files with 45 additions and 15 deletions

View file

@ -2231,7 +2231,7 @@ void Player::SetGameMaster(bool on)
CallForAllControlledUnits(SetGameMasterOnHelper(),true,true,true,false);
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
SetFFAPvP(false);
ResetContestedPvP();
getHostileRefManager().setOnlineOfflineState(false);
@ -2253,7 +2253,7 @@ void Player::SetGameMaster(bool on)
// restore FFA PvP Server state
if(sWorld.IsFFAPvPRealm())
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
SetFFAPvP(true);
// restore FFA PvP area state, remove not allowed for GM mounts
UpdateArea(m_areaUpdateId);
@ -6312,14 +6312,14 @@ void Player::UpdateArea(uint32 newArea)
if(area && (area->flags & AREA_FLAG_ARENA))
{
if(!isGameMaster())
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
SetFFAPvP(true);
}
else
{
// remove ffa flag only if not ffapvp realm
// removal in sanctuaries and capitals is handled in zone update
if(HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && !sWorld.IsFFAPvPRealm())
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
if(IsFFAPvP() && !sWorld.IsFFAPvPRealm())
SetFFAPvP(false);
}
UpdateAreaDependentAuras(newArea);
@ -6387,7 +6387,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
if(sWorld.IsFFAPvPRealm())
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
SetFFAPvP(false);
}
else
{
@ -6401,7 +6401,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
InnEnter(time(0),GetMapId(),0,0,0);
if(sWorld.IsFFAPvPRealm())
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
SetFFAPvP(false);
}
else // anywhere else
{
@ -6415,7 +6415,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
SetRestType(REST_TYPE_NO);
if(sWorld.IsFFAPvPRealm())
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
SetFFAPvP(true);
}
}
else // not in tavern (leave city then)
@ -6425,7 +6425,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
// Set player to FFA PVP when not in rested environment.
if(sWorld.IsFFAPvPRealm())
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
SetFFAPvP(true);
}
}
}