Jump to content

[fix][7842] GM mode & pets


Guest DonTomika

Recommended Posts

What bug does the patch fix? What features does the patch add?

This patch should fix the bug when a hunter / warlock enters GM mode while he is in combat, and have a pet active, the mob will start attacking the pet instead of evading and running back to its original position (what it does if no pets are active).

For which repository revision was the patch created?

7839

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

Didn't find any.

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 3d567d8..7eb47c7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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);

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use