mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-18 03:22:27 +00:00
Shared task kill update fix
This commit is contained in:
parent
30c7ed7e45
commit
91c451b6c5
@ -2739,12 +2739,46 @@ void ClientTaskState::SyncSharedTaskZoneClientDoneCountState(
|
||||
|
||||
void ClientTaskState::HandleUpdateTasksOnKill(Client *client, uint32 npc_type_id)
|
||||
{
|
||||
if (!HasActiveTasks()) {
|
||||
return;
|
||||
|
||||
// get clients to update
|
||||
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
|
||||
for (auto &active_task : m_active_tasks) {
|
||||
for (auto &active_task : c->GetTaskState()->m_active_tasks) {
|
||||
auto current_task = &active_task;
|
||||
if (current_task->task_id == TASKSLOTEMPTY) {
|
||||
continue;
|
||||
@ -2812,37 +2846,21 @@ 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
|
||||
if (p_task_data->type != TaskType::Shared) {
|
||||
LogTasksDetail("[HandleUpdateTasksOnKill] Non-Shared Update");
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
IncrementDoneCount(c, p_task_data, current_task->slot, activity_id);
|
||||
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");
|
||||
|
||||
// shared tasks only require one client to receive an update to propagate
|
||||
client->UpdateTasksOnKill(npc_type_id);
|
||||
if (c == client) {
|
||||
IncrementDoneCount(c, p_task_data, current_task->slot, activity_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ClientTaskState::HasActiveTasks()
|
||||
{
|
||||
if (!task_manager) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user