Core/Misc: Do not apply Deserter debuff to players teleported from the battleground by gm command (.appear/.summon).
(cherry picked from commit 1dc9b83a2556741ffd0c6ddce447a3e04f51a2b2) Signed-off-by: luis <[email protected]>
This commit is contained in:
@@ -25306,7 +25306,7 @@ Team 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)
|
||||
@@ -25317,7 +25317,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)
|
||||
{
|
||||
|
||||
@@ -2698,7 +2698,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
void SetBGTeam(Team team);
|
||||
Team GetBGTeam() const;
|
||||
|
||||
void LeaveBattleground(bool teleportToEntryPoint = true);
|
||||
void LeaveBattleground(bool teleportToEntryPoint = true, bool withoutDeserterDebuff = false);
|
||||
bool CanJoinToBattleground(BattlegroundTemplate const* bg) const;
|
||||
bool CanReportAfkDueToLimit();
|
||||
void ReportedAfkBy(Player* reporter);
|
||||
|
||||
@@ -373,16 +373,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(), BATTLEGROUND_QUEUE_NONE); // unsure
|
||||
// remember current position as entry point for return at bg end teleportation
|
||||
if (!_player->GetMap()->IsBattlegroundOrArena())
|
||||
_player->SetBattlegroundEntryPoint();
|
||||
}
|
||||
else if (map->IsDungeon())
|
||||
{
|
||||
@@ -421,6 +411,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(), BATTLEGROUND_QUEUE_NONE);
|
||||
// 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();
|
||||
@@ -452,6 +455,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();
|
||||
@@ -506,16 +512,6 @@ 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(), BATTLEGROUND_QUEUE_NONE); // unsure about this
|
||||
// remember current position as entry point for return at bg end teleportation
|
||||
if (!target->GetMap()->IsBattlegroundOrArena())
|
||||
target->SetBattlegroundEntryPoint();
|
||||
}
|
||||
else if (map->IsDungeon())
|
||||
{
|
||||
@@ -546,6 +542,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(), BATTLEGROUND_QUEUE_NONE);
|
||||
// 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();
|
||||
|
||||
Reference in New Issue
Block a user