mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 20:51:29 +00:00
The task goal system made implementing tasks a little confusing since the goal could be ambiguous depending on type. This also didn't support filtering on multiple goals (e.g. looting items from matching npc names inside an area). Deliver types could specify an npc id in `delivertonpc` but the database may have multiple npcs with the same name or a task might want to match partial npc names. This replaces goalids with explicit fields for npcs, items, proximity areas, and touch switch ids. These changes make managing task data easier without needing to update multiple tables and allows filtering task updates by multiple criteria. To mitigate any performance impact from merging task proximities, only clients with explore tasks in the current zone are checked during client movement updates. Items and npcs still support goallists but it would be possible to denormalize entries into delimited strings to combine with the match lists. This would also decouple task goals from reward lists. The client task update functions were refactored to run through a single filtering function which significantly reduces duplicated code from the legacy task system. This will also make it easier to later implement any unhandled types. Since the new fields will handle filtering single entries and lists based on having values set, `goalmethod` now only distinguishes quest controlled from source controlled. This is a breaking api change, `taskexploredarea` has been removed since explore ids no longer exist.
96 lines
2.9 KiB
C++
96 lines
2.9 KiB
C++
#ifndef EQEMU_TASK_MANAGER_H
|
|
#define EQEMU_TASK_MANAGER_H
|
|
|
|
#include "tasks.h"
|
|
#include "task_client_state.h"
|
|
#include "task_goal_list_manager.h"
|
|
#include "../common/types.h"
|
|
#include "../common/repositories/character_tasks_repository.h"
|
|
#include <list>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <algorithm>
|
|
|
|
class Client;
|
|
|
|
class Mob;
|
|
|
|
class TaskManager {
|
|
|
|
public:
|
|
TaskManager();
|
|
~TaskManager();
|
|
int GetActivityCount(int task_id);
|
|
bool LoadTasks(int single_task = 0);
|
|
void ReloadGoalLists();
|
|
bool LoadTaskSets();
|
|
bool LoadClientState(Client *client, ClientTaskState *client_task_state);
|
|
bool SaveClientState(Client *client, ClientTaskState *client_task_state);
|
|
void SendTaskSelector(Client *client, Mob *mob, int task_count, int *task_list);
|
|
bool ValidateLevel(int task_id, int player_level);
|
|
std::string GetTaskName(uint32 task_id);
|
|
TaskType GetTaskType(uint32 task_id);
|
|
void TaskSetSelector(Client *client, ClientTaskState *client_task_state, Mob *mob, int task_set_id);
|
|
// task list provided by QuestManager (perl/lua)
|
|
void TaskQuestSetSelector(
|
|
Client *client,
|
|
ClientTaskState *client_task_state,
|
|
Mob *mob,
|
|
int count,
|
|
int *tasks
|
|
);
|
|
void SharedTaskSelector(Client* client, Mob* mob, int count, const int* tasks);
|
|
void SendActiveTasksToClient(Client *client, bool task_complete = false);
|
|
void SendSingleActiveTaskToClient(
|
|
Client *client,
|
|
ClientTaskInformation &task_info,
|
|
bool task_complete,
|
|
bool bring_up_task_journal = false
|
|
);
|
|
void SendTaskActivityShort(Client *client, int task_id, int activity_id, int client_task_index);
|
|
void SendTaskActivityLong(
|
|
Client *client,
|
|
int task_id,
|
|
int activity_id,
|
|
int client_task_index,
|
|
bool task_complete = false
|
|
);
|
|
void SendCompletedTasksToClient(Client *c, ClientTaskState *client_task_state);
|
|
int FirstTaskInSet(int task_set);
|
|
int LastTaskInSet(int task_set);
|
|
int NextTaskInSet(int task_set, int task_id);
|
|
bool IsTaskRepeatable(int task_id);
|
|
bool IsActiveTaskComplete(ClientTaskInformation& client_task);
|
|
|
|
friend class ClientTaskState;
|
|
|
|
// shared tasks
|
|
void SyncClientSharedTaskState(Client *c, ClientTaskState *cts);
|
|
|
|
void HandleUpdateTasksOnKill(Client* client, NPC* npc);
|
|
|
|
private:
|
|
TaskGoalListManager m_goal_list_manager;
|
|
TaskInformation *m_task_data[MAXTASKS]{};
|
|
std::vector<int> m_task_sets[MAXTASKSETS];
|
|
void SendActiveTaskDescription(
|
|
Client *client,
|
|
int task_id,
|
|
ClientTaskInformation &task_info,
|
|
int start_time,
|
|
int duration,
|
|
bool bring_up_task_journal = false
|
|
);
|
|
|
|
void SendActiveTaskToClient(ClientTaskInformation *task, Client *client, int task_index, bool task_complete);
|
|
|
|
// shared tasks
|
|
void SyncClientSharedTaskWithPersistedState(Client *c, ClientTaskState *cts);
|
|
void SyncClientSharedTaskRemoveLocalIfNotExists(Client *c, ClientTaskState *cts);
|
|
void SendSharedTaskSelector(Client* client, Mob* mob, int task_count, int* task_list);
|
|
void SyncClientSharedTaskStateToLocal(Client *c);
|
|
};
|
|
|
|
|
|
#endif //EQEMU_TASK_MANAGER_H
|