[Shared Tasks] Task Kill Update Fix (#1573)

* Revert "Revert "Shared task kill update fix""

This reverts commit 859751f74d.

* Swap return for continue in this context

* Slight tweak

* Slight tweak

* Remove no longer needed task methods

* Update scope for IncrementDoneCount

* Create helper method Client::GetPartyMembers() and add client->HasTaskState()

* Move HandleUpdateTasksOnKill responsibility to TaskManager

* Remove unnecessary pointer
This commit is contained in:
Chris Miles
2021-10-01 22:57:00 -05:00
committed by GitHub
parent bb5c491794
commit 9a413cf553
8 changed files with 140 additions and 126 deletions
+38
View File
@@ -10529,3 +10529,41 @@ void Client::SetDoorToolEntityId(uint16 door_tool_entity_id)
{
Client::m_door_tool_entity_id = door_tool_entity_id;
}
// this will fetch raid clients if exists
// fallback to group if raid doesn't exist
// fallback to self if group doesn't exist
std::vector<Client *> Client::GetPartyMembers()
{
// get clients to update
std::vector<Client *> clients_to_update = {};
// raid
Raid *raid = entity_list.GetRaidByClient(this);
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(this);
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(this);
}
return clients_to_update;
}