Skip to content

Commit

Permalink
Update Player
Browse files Browse the repository at this point in the history
when gm is activated players can not attack pets.
  • Loading branch information
talamortis authored and billy1arm committed Feb 13, 2025
1 parent 68556f2 commit 80fa56f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/game/Object/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,13 @@ void Player::SetGameMaster(bool on)
GetHostileRefManager().setOnlineOfflineState(false);
CombatStopWithPets();

if (Pet* pet = GetPet())
{
if (m_ExtraFlags |= PLAYER_EXTRA_GM_ON)
pet->setFaction(35);
pet->GetHostileRefManager().setOnlineOfflineState(false);
}

SetPhaseMask(PHASEMASK_ANYWHERE, false); // see and visible in all phases
}
else
Expand All @@ -2704,6 +2711,12 @@ void Player::SetGameMaster(bool on)
AuraList const& phases = GetAurasByType(SPELL_AURA_PHASE);
SetPhaseMask(!phases.empty() ? phases.front()->GetMiscValue() : uint32(PHASEMASK_NORMAL), false);

if (Pet* pet = GetPet())
{
pet->setFaction(getFaction());
pet->GetHostileRefManager().setOnlineOfflineState(true);
}

CallForAllControlledUnits(SetGameMasterOffHelper(getFaction()), CONTROLLED_PET | CONTROLLED_TOTEMS | CONTROLLED_GUARDIANS | CONTROLLED_CHARM);

// restore FFA PvP Server state
Expand Down

0 comments on commit 80fa56f

Please sign in to comment.