Jump to content

[patch] Prevent cheating on BG using logout


Guest Merlin2009

Recommended Posts

Hello,

Player on the BG (Warsong) captures flag, logout and appears at home base graveyard with flag near player,

takes flag and go to base.

Should be (as on the off server):

Logout on the BG caused teleport to home bind location.

Patch:

--- WorldSession.cpp.bak        2009-12-24 01:33:29.000000000 +0200
+++ WorldSession.cpp    2009-12-24 01:32:41.000000000 +0200
@@ -355,10 +355,13 @@
            _player->BuildPlayerRepop();
            _player->RepopAtGraveyard();
        }
-
        //drop a flag if player is carrying it
+        //also teleport player to home location (prevent cheating)
        if(BattleGround *bg = _player->GetBattleGround())
+        {
          bg->EventPlayerLoggedOut(_player);
+          _player->TeleportTo(_player->m_homebindMapId, _player->m_homebindX, _player->m_homebindY, _player->m_homebindZ, _player->GetOrientation());
+        }

        ///- Remove from OutdoorPvP
        sOutdoorPvPMgr.HandlePlayerLeaveZone(_player,_player->GetZoneId());

Any suggestions are welcome.

Link to comment
Share on other sites

Hello,

Player on the BG (Warsong) captures flag, logout and appears at home base graveyard with flag near player,

takes flag and go to base.

Should be (as on the off server):

Logout on the BG caused teleport to home bind location.

Patch:

--- WorldSession.cpp.bak        2009-12-24 01:33:29.000000000 +0200
+++ WorldSession.cpp    2009-12-24 01:32:41.000000000 +0200
@@ -355,10 +355,13 @@
            _player->BuildPlayerRepop();
            _player->RepopAtGraveyard();
        }
-
        //drop a flag if player is carrying it
+        //also teleport player to home location (prevent cheating)
        if(BattleGround *bg = _player->GetBattleGround())
+        {
          bg->EventPlayerLoggedOut(_player);
+          _player->TeleportTo(_player->m_homebindMapId, _player->m_homebindX, _player->m_homebindY, _player->m_homebindZ, _player->GetOrientation());
+        }

        ///- Remove from OutdoorPvP
        sOutdoorPvPMgr.HandlePlayerLeaveZone(_player,_player->GetZoneId());

Any suggestions are welcome.

Why teleport to homebind? Player must apear not at graveyard, but at the logout point

Link to comment
Share on other sites

porting to homebind is totally wrong, the flag must be removed from the player when he logs out and his last position must be stored, in db so that he get's to this position at login..

don't know where exactly the problem is.. but at least i haven't ever heared, that porting to homebind is blizzlike

edit: i think i know why:

the player who logs out is under attack when he is logging out, a player who logs out and is under attack will be repopped at the graveyard.. and AFTER this we call the dropflag method

so things which need to be done:

dropping the flag before repopping the player

probably something like:

http://pastebin.com/m420a1dc

and then saving the deathstate for the player somehow when he logs out from bg.. but don't know.. maybe this is just a bug in Player::SaveToDB() or something else..

Link to comment
Share on other sites

I was right when I said that we must look at BattleGround::EventPlayerLoggedOut().

There are nice hack

@@ -245,22 +245,19 @@ void BattleGround::Update(uint32 diff)
        if (!GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
            m_SetDeleteThis = true;
        return;
    }

-    // remove offline players from bg after 5 minutes
+    // remove offline players from bg without delays (blizzlike is after 5 minutes)
    if (!m_OfflineQueue.empty())
    {
        BattleGroundPlayerMap::iterator itr = m_Players.find(*(m_OfflineQueue.begin()));
        if (itr != m_Players.end())
        {
-            if (itr->second.OfflineRemoveTime <= sWorld.GetGameTime())
-            {
-                RemovePlayerAtLeave(itr->first, true, true);// remove player from BG
-                m_OfflineQueue.pop_front();                 // remove from offline queue
-                //do not use itr for anything, because it is erased in RemovePlayerAtLeave()
-            }
+            RemovePlayerAtLeave(itr->first, true, true);// remove player from BG
+            m_OfflineQueue.pop_front();                 // remove from offline queue
+            //do not use itr for anything, because it is erased in RemovePlayerAtLeave()
        }
    }

    /*********************************************************/
    /***           BATTLEGROUND BALLANCE SYSTEM            ***/

I'm not really understanding whats wrong i tried reproducing it ingame but i don't see it.

On intentional logout, if u log back in within the 5 minute time limit your fine and load back into the bg in last position and you drop flag as u logout "this has been test twice and its offlike , if your out of game longer u get ported back to last position b4 the bg and have the abandon debuff.

Link to comment
Share on other sites

porting to homebind is totally wrong, the flag must be removed from the player when he logs out and his last position must be stored, in db so that he get's to this position at login..

don't know where exactly the problem is.. but at least i haven't ever heared, that porting to homebind is blizzlike

edit: i think i know why:

the player who logs out is under attack when he is logging out, a player who logs out and is under attack will be repopped at the graveyard.. and AFTER this we call the dropflag method

so things which need to be done:

dropping the flag before repopping the player

probably something like:

http://pastebin.com/m420a1dc

and then saving the deathstate for the player somehow when he logs out from bg.. but don't know.. maybe this is just a bug in Player::SaveToDB() or something else..

I tested with the last rev and logout exploit still work, even with the flag ;)

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