mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-09 03:18:57 +01:00
Entities/Player: Restore old checks for UpdatePvPFlag (#24372)
Partly revert671052575a+ implemented timer reset to 300s after relog never worked, therefore removing that part; + reverting other parts with 300s timer changes, as not needed; (cherry picked from commit2efaf1dda8)
This commit is contained in:
@@ -21924,14 +21924,19 @@ void Player::ResetContestedPvP()
|
||||
|
||||
void Player::UpdatePvPFlag(time_t currTime)
|
||||
{
|
||||
if (!IsPvP())
|
||||
return;
|
||||
|
||||
if (!pvpInfo.EndTimer || (currTime < pvpInfo.EndTimer +300) || pvpInfo.IsHostile)
|
||||
return;
|
||||
|
||||
if (pvpInfo.EndTimer && pvpInfo.EndTimer <= currTime)
|
||||
{
|
||||
pvpInfo.EndTimer = 0;
|
||||
RemovePlayerFlag(PLAYER_FLAGS_PVP_TIMER);
|
||||
}
|
||||
|
||||
if (IsPvP() && !pvpInfo.IsHostile && !HasPlayerFlag(PlayerFlags(PLAYER_FLAGS_IN_PVP | PLAYER_FLAGS_PVP_TIMER)))
|
||||
UpdatePvP(false);
|
||||
UpdatePvP(false);
|
||||
}
|
||||
|
||||
void Player::UpdateDuelFlag(time_t currTime)
|
||||
@@ -23639,14 +23644,9 @@ void Player::UpdateHomebindTime(uint32 time)
|
||||
|
||||
void Player::InitPvP()
|
||||
{
|
||||
// pvp flag should stay after relog
|
||||
if (HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
|
||||
UpdatePvP(true, true);
|
||||
else if (HasPlayerFlag(PLAYER_FLAGS_PVP_TIMER))
|
||||
{
|
||||
UpdatePvP(true, true);
|
||||
if (!pvpInfo.IsHostile)
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime() + 300;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::UpdatePvPState(bool onlyFFA)
|
||||
@@ -23673,7 +23673,7 @@ void Player::UpdatePvPState(bool onlyFFA)
|
||||
if (onlyFFA)
|
||||
return;
|
||||
|
||||
if (pvpInfo.IsHostile) // in hostile area
|
||||
if (pvpInfo.IsHostile) // in hostile area
|
||||
{
|
||||
if (!IsPvP() || pvpInfo.EndTimer)
|
||||
UpdatePvP(true, true);
|
||||
@@ -23681,7 +23681,7 @@ void Player::UpdatePvPState(bool onlyFFA)
|
||||
else // in friendly area
|
||||
{
|
||||
if (IsPvP() && !HasPlayerFlag(PLAYER_FLAGS_IN_PVP) && !pvpInfo.EndTimer)
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime() + 300; // start toggle-off
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23701,7 +23701,7 @@ void Player::UpdatePvP(bool state, bool _override)
|
||||
}
|
||||
else
|
||||
{
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime() + 300;
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime();
|
||||
SetPvP(state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ void WorldSession::HandleTogglePvP(WorldPackets::Misc::TogglePvP& /*packet*/)
|
||||
GetPlayer()->RemovePlayerFlag(PLAYER_FLAGS_IN_PVP);
|
||||
GetPlayer()->AddPlayerFlag(PLAYER_FLAGS_PVP_TIMER);
|
||||
if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
|
||||
GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime() + 300; // start toggle-off
|
||||
GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ void WorldSession::HandleSetPvP(WorldPackets::Misc::SetPvP& packet)
|
||||
GetPlayer()->RemovePlayerFlag(PLAYER_FLAGS_IN_PVP);
|
||||
GetPlayer()->AddPlayerFlag(PLAYER_FLAGS_PVP_TIMER);
|
||||
if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
|
||||
GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime() + 300; // start toggle-off
|
||||
GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user