[7842] Set and stop combat for pets at player enter to GM-mode.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
DonTomika 2009-05-17 22:46:11 +04:00 committed by VladimirMangos
parent b7f09eb37c
commit ab3eb09669
2 changed files with 14 additions and 2 deletions

View file

@ -2073,11 +2073,17 @@ void Player::SetGameMaster(bool on)
setFaction(35);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
if (Pet* pet = GetPet())
{
pet->setFaction(35);
pet->getHostilRefManager().setOnlineOfflineState(false);
}
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
ResetContestedPvP();
getHostilRefManager().setOnlineOfflineState(false);
CombatStop();
CombatStopWithPets();
SetPhaseMask(PHASEMASK_ANYWHERE,false); // see and visible in all phases
}
@ -2091,6 +2097,12 @@ void Player::SetGameMaster(bool on)
setFactionForRace(getRace());
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
if (Pet* pet = GetPet())
{
pet->setFaction(getFaction());
pet->getHostilRefManager().setOnlineOfflineState(true);
}
// restore FFA PvP Server state
if(sWorld.IsFFAPvPRealm())
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);