diff options
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 4 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 51 | 
3 files changed, 33 insertions, 24 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index a64db2be2f6..ea3cfdb1b8b 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -22259,7 +22259,7 @@ uint32 Player::GetBGTeam() const      return m_bgData.bgTeam ? m_bgData.bgTeam : GetTeam();  } -void Player::LeaveBattleground(bool teleportToEntryPoint /*= true*/) +void Player::LeaveBattleground(bool teleportToEntryPoint /*= true*/, bool withoutDeserterDebuff /*= false*/)  {      Battleground* bg = GetBattleground();      if (!bg) @@ -22270,7 +22270,7 @@ void Player::LeaveBattleground(bool teleportToEntryPoint /*= true*/)      // call after remove to be sure that player resurrected for correct cast      if (bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))      { -        if (!GetSession()->HasPermission(rbac::RBAC_PERM_NO_BATTLEGROUND_DESERTER_DEBUFF)) +        if (!withoutDeserterDebuff && !GetSession()->HasPermission(rbac::RBAC_PERM_NO_BATTLEGROUND_DESERTER_DEBUFF))          {              if (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN)              { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 2b5b12c6413..b36b6440e65 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1936,7 +1936,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>          void SetBGTeam(uint32 team);          uint32 GetBGTeam() const; -        void LeaveBattleground(bool teleportToEntryPoint = true); +        void LeaveBattleground(bool teleportToEntryPoint = true, bool withoutDeserterDebuff = false);          bool CanJoinToBattleground(Battleground const* bg) const;          bool CanReportAfkDueToLimit();          void ReportedAfkBy(Player* reporter); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 670efaea221..65c671bef2f 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -384,16 +384,6 @@ public:                      handler->SetSentErrorMessage(true);                      return false;                  } -                // if both players are in different bgs -                else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) -                    _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff - -                // all's well, set bg id -                // when porting out from the bg, it will be reset to 0 -                _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId()); -                // remember current position as entry point for return at bg end teleportation -                if (!_player->GetMap()->IsBattlegroundOrArena()) -                    _player->SetBattlegroundEntryPoint();              }              else if (map->IsDungeon())              { @@ -442,6 +432,19 @@ public:              handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); +            if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) +                _player->LeaveBattleground(false, true); + +            if (map->IsBattlegroundOrArena()) +            { +                // all's well, set bg id +                // when porting out from the bg, it will be reset to 0 +                _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId()); +                // remember current position as entry point for return at bg end teleportation +                if (!_player->GetMap()->IsBattlegroundOrArena()) +                    _player->SetBattlegroundEntryPoint(); +            } +              // stop flight if need              if (_player->IsInFlight())                  _player->FinishTaxiFlight(); @@ -472,6 +475,9 @@ public:              if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))                  return false; +            if (_player->GetBattlegroundId()) +                _player->LeaveBattleground(false, true); +              // stop flight if need              if (_player->IsInFlight())                  _player->FinishTaxiFlight(); @@ -526,18 +532,8 @@ public:                      handler->SetSentErrorMessage(true);                      return false;                  } -                // if both players are in different bgs -                else if (target->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) -                    target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff - -                // all's well, set bg id -                // when porting out from the bg, it will be reset to 0 -                target->SetBattlegroundId(_player->GetBattlegroundId(), _player->GetBattlegroundTypeId()); -                // remember current position as entry point for return at bg end teleportation -                if (!target->GetMap()->IsBattlegroundOrArena()) -                    target->SetBattlegroundEntryPoint();              } -            else if (map->Instanceable()) +            else if (map->IsDungeon())              {                  Map* targetMap = target->GetMap();                  Player* targetGroupLeader = nullptr; @@ -566,6 +562,19 @@ public:              if (handler->needReportToTarget(target))                  ChatHandler(target->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str()); +            if (target->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId()) +                target->LeaveBattleground(false, true); + +            if (map->IsBattlegroundOrArena()) +            { +                // all's well, set bg id +                // when porting out from the bg, it will be reset to 0 +                target->SetBattlegroundId(_player->GetBattlegroundId(), _player->GetBattlegroundTypeId()); +                // remember current position as entry point for return at bg end teleportation +                if (!target->GetMap()->IsBattlegroundOrArena()) +                    target->SetBattlegroundEntryPoint(); +            } +              // stop flight if need              if (_player->IsInFlight())                  _player->FinishTaxiFlight();  | 
