fix(Core/Player): prevent crash exploit spam duel starting (#9226)

This commit is contained in:
IntelligentQuantum
2021-11-28 23:12:53 +03:30
committed by GitHub
parent 25ca425357
commit ab761c9865
8 changed files with 144 additions and 112 deletions

View File

@@ -403,18 +403,16 @@ void Player::UpdateFFAPvPFlag(time_t currTime)
void Player::UpdateDuelFlag(time_t currTime)
{
if (!duel || duel->startTimer == 0 || currTime < duel->startTimer + 3)
return;
if (duel && duel->State == DUEL_STATE_COUNTDOWN && duel->StartTime <= currTime)
{
sScriptMgr->OnPlayerDuelStart(this, duel->Opponent);
sScriptMgr->OnPlayerDuelStart(this, duel->opponent);
SetUInt32Value(PLAYER_DUEL_TEAM, 1);
duel->Opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 2);
SetUInt32Value(PLAYER_DUEL_TEAM, 1);
duel->opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 2);
duel->startTimer = 0;
duel->startTime = currTime;
duel->opponent->duel->startTimer = 0;
duel->opponent->duel->startTime = currTime;
duel->State = DUEL_STATE_IN_PROGRESS;
duel->Opponent->duel->State = DUEL_STATE_IN_PROGRESS;
}
}
/*********************************************************/