Revert "Shared task kill update fix"

This reverts commit 91c451b6c588338357e86b85f003401b336dcca6.
This commit is contained in:
Akkadius 2021-10-01 18:42:36 -05:00
parent 91c451b6c5
commit 859751f74d

View File

@ -2739,46 +2739,12 @@ void ClientTaskState::SyncSharedTaskZoneClientDoneCountState(
void ClientTaskState::HandleUpdateTasksOnKill(Client *client, uint32 npc_type_id) void ClientTaskState::HandleUpdateTasksOnKill(Client *client, uint32 npc_type_id)
{ {
if (!HasActiveTasks()) {
// get clients to update return;
std::vector<Client *> clients_to_update = {};
// raid
Raid *raid = entity_list.GetRaidByClient(client);
if (raid) {
for (auto &e : raid->members) {
if (e.member && e.member->IsClient()) {
clients_to_update.push_back(e.member->CastToClient());
} }
}
}
// group
if (!clients_to_update.empty()) {
Group *group = entity_list.GetGroupByClient(client);
if (group) {
for (auto &m : group->members) {
if (m && m->IsClient()) {
clients_to_update.push_back(m->CastToClient());
}
}
}
}
// solo
if (!clients_to_update.empty()) {
clients_to_update.push_back(client);
}
for (auto &c: clients_to_update) {
if (c->ClientDataLoaded()) {
continue;
}
LogTasksDetail("[HandleUpdateTasksOnKill] Looping through client [{}]", c->GetCleanName());
// loop over the union of tasks and quests // loop over the union of tasks and quests
for (auto &active_task : c->GetTaskState()->m_active_tasks) { for (auto &active_task : m_active_tasks) {
auto current_task = &active_task; auto current_task = &active_task;
if (current_task->task_id == TASKSLOTEMPTY) { if (current_task->task_id == TASKSLOTEMPTY) {
continue; continue;
@ -2846,21 +2812,37 @@ void ClientTaskState::HandleUpdateTasksOnKill(Client *client, uint32 npc_type_id
// legacy eqemu task update logic loops through group on kill of npc to update a single task // legacy eqemu task update logic loops through group on kill of npc to update a single task
if (p_task_data->type != TaskType::Shared) { if (p_task_data->type != TaskType::Shared) {
LogTasksDetail("[HandleUpdateTasksOnKill] Non-Shared Update"); LogTasksDetail("[HandleUpdateTasksOnKill] Non-Shared Update");
IncrementDoneCount(c, p_task_data, current_task->slot, activity_id);
Raid *raid = entity_list.GetRaidByClient(client);
if (raid) {
for (auto &e : raid->members) {
if (e.member && e.member->IsClient()) {
Client *c = e.member->CastToClient();
c->UpdateTasksOnKill(npc_type_id);
}
}
return; return;
} }
Group *group = entity_list.GetGroupByClient(client);
if (group) {
for (auto &m : group->members) {
if (m && m->IsClient()) {
Client *c = m->CastToClient();
c->UpdateTasksOnKill(npc_type_id);
}
}
return;
}
}
LogTasksDetail("[HandleUpdateTasksOnKill] Shared update"); LogTasksDetail("[HandleUpdateTasksOnKill] Shared update");
// shared tasks only require one client to receive an update to propagate // shared tasks only require one client to receive an update to propagate
if (c == client) { client->UpdateTasksOnKill(npc_type_id);
IncrementDoneCount(c, p_task_data, current_task->slot, activity_id);
} }
} }
} }
}
}
bool ClientTaskState::HasActiveTasks() bool ClientTaskState::HasActiveTasks()
{ {
if (!task_manager) { if (!task_manager) {