[Shared Tasks] Cleanup shared task request and remove (#2341)

Functionally nothing should change in this patch. This refactors a lot
of formatting and code duplication in requests and member removals.

The long SharedTaskMessage namespace and its constants were contributing
to a lot of formatting that was difficult to read. These were shortened
since they're not all shared task specific anyway (though they should
probably just be moved to string_ids.h with other eqstrs now)

Shared task requests were refactored a little to remove an unnecessary
function that filled potential members. The separate functions used for
/taskquit and /taskremove were also combined into a single function to
remove a member while preserving live message differences.
This commit is contained in:
hg
2022-07-30 21:36:04 -04:00
committed by GitHub
parent 8a962e09f6
commit d243cbf8a3
12 changed files with 220 additions and 419 deletions
+3 -10
View File
@@ -33,15 +33,8 @@ public:
TasksRepository::Tasks GetSharedTaskDataByTaskId(uint32 task_id);
std::vector<TaskActivitiesRepository::TaskActivities> GetSharedTaskActivityDataByTaskId(uint32 task_id);
// gets group / raid members belonging to requested character
std::vector<SharedTaskMember> GetRequestMembers(
uint32 requestor_character_id,
const std::vector<CharacterDataRepository::CharacterData> &characters
);
// client attempting to create a shared task
void AttemptSharedTaskCreation(uint32 requested_task_id, uint32 requested_character_id, uint32 npc_type_id);
void AttemptSharedTaskRemoval(uint32 requested_task_id, uint32 requested_character_id, bool remove_from_db);
// shared task activity update middleware
void SharedTaskActivityUpdate(
@@ -72,7 +65,7 @@ public:
);
void RemovePlayerFromSharedTask(SharedTask *s, uint32 character_id);
void PrintSharedTaskState();
void RemovePlayerFromSharedTaskByPlayerName(SharedTask *s, const std::string &character_name);
void RemoveMember(SharedTask* s, const SharedTaskMember& member, bool remove_from_db);
void RemoveEveryoneFromSharedTask(SharedTask *s, uint32 requested_character_id);
void MakeLeaderByPlayerName(SharedTask *s, const std::string &character_name);
@@ -120,7 +113,7 @@ protected:
void AddReplayTimers(SharedTask *s);
bool CanAddPlayer(SharedTask *s, uint32_t character_id, std::string player_name, bool accepted);
bool CanRequestSharedTask(uint32_t task_id, uint32_t character_id, const SharedTaskRequestCharacters &request);
bool CanRequestSharedTask(uint32_t task_id, const SharedTaskRequest& request);
void ChooseNewLeader(SharedTask *s);
bool HandleCompletedActivities(SharedTask* s);
void HandleCompletedTask(SharedTask* s);
@@ -133,7 +126,7 @@ protected:
void RemoveAllMembersFromDynamicZones(SharedTask *s);
// memory search
std::vector<uint32_t> FindCharactersInSharedTasks(const std::vector<uint32_t> &find_characters);
std::vector<SharedTaskMember> FindCharactersInSharedTasks(const std::vector<uint32_t> &find_characters);
};
#endif //EQEMU_SHARED_TASK_MANAGER_H