[Tasks] Add task accept packet validation (#2354)

This makes it so clients can only accept tasks that have been offered
This commit is contained in:
hg
2022-07-31 18:54:42 -04:00
committed by GitHub
parent 6068085de4
commit 7c27c4350d
4 changed files with 66 additions and 3 deletions
+14 -3
View File
@@ -1835,7 +1835,13 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app)
AcceptNewTask_Struct *ant = (AcceptNewTask_Struct*)app->pBuffer;
if (ant->task_id > 0 && RuleB(TaskSystem, EnableTaskSystem) && task_state)
task_state->AcceptNewTask(this, ant->task_id, ant->task_master_id, std::time(nullptr));
{
if (task_state->CanAcceptNewTask(this, ant->task_id, ant->task_master_id))
{
task_state->AcceptNewTask(this, ant->task_id, ant->task_master_id, std::time(nullptr));
}
task_state->ClearLastOffers();
}
}
void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app)
@@ -15552,8 +15558,13 @@ void Client::Handle_OP_SharedTaskAccept(const EQApplicationPacket* app)
buf->task_id
);
if (buf->task_id > 0 && RuleB(TaskSystem, EnableTaskSystem) && task_state) {
task_state->AcceptNewTask(this, buf->task_id, buf->npc_entity_id, std::time(nullptr));
if (buf->task_id > 0 && RuleB(TaskSystem, EnableTaskSystem) && task_state)
{
if (task_state->CanAcceptNewTask(this, buf->task_id, buf->npc_entity_id))
{
task_state->AcceptNewTask(this, buf->task_id, buf->npc_entity_id, std::time(nullptr));
}
task_state->ClearLastOffers();
}
}