[7877] Correctly set totem PvP state at loading and owner PvP state change, including GM totem case.

* Also set PvP state in proper way at pet loading if owner in PvP state.
This commit is contained in:
VladimirMangos 2009-05-23 00:30:18 +04:00
parent e0e5ed7bd8
commit bc4611e8c0
6 changed files with 42 additions and 20 deletions

View file

@ -2079,6 +2079,11 @@ void Player::SetGameMaster(bool on)
pet->getHostilRefManager().setOnlineOfflineState(false);
}
for (int8 i = 0; i < MAX_TOTEM; ++i)
if(m_TotemSlot[i])
if(Creature *totem = GetMap()->GetCreature(m_TotemSlot[i]))
totem->setFaction(35);
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
ResetContestedPvP();
@ -2103,6 +2108,11 @@ void Player::SetGameMaster(bool on)
pet->getHostilRefManager().setOnlineOfflineState(true);
}
for (int8 i = 0; i < MAX_TOTEM; ++i)
if(m_TotemSlot[i])
if(Creature *totem = GetMap()->GetCreature(m_TotemSlot[i]))
totem->setFaction(getFaction());
// restore FFA PvP Server state
if(sWorld.IsFFAPvPRealm())
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
@ -17371,11 +17381,6 @@ void Player::UpdatePvP(bool state, bool ovrride)
if(!state || ovrride)
{
SetPvP(state);
if(Pet* pet = GetPet())
pet->SetPvP(state);
if(Unit* charmed = GetCharm())
charmed->SetPvP(state);
pvpInfo.endTimer = 0;
}
else
@ -17383,14 +17388,7 @@ void Player::UpdatePvP(bool state, bool ovrride)
if(pvpInfo.endTimer != 0)
pvpInfo.endTimer = time(NULL);
else
{
SetPvP(state);
if(Pet* pet = GetPet())
pet->SetPvP(state);
if(Unit* charmed = GetCharm())
charmed->SetPvP(state);
}
}
}