mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 05:16:37 +00:00
[Tasks] Replace task goals with explicit fields (#2402)
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.
This commit is contained in:
+17
-7
@@ -18,8 +18,7 @@
|
||||
// Command Codes for worldserver ServerOP_ReloadTasks
|
||||
#define RELOADTASKS 0
|
||||
#define RELOADTASKGOALLISTS 1
|
||||
#define RELOADTASKPROXIMITIES 2
|
||||
#define RELOADTASKSETS 3
|
||||
#define RELOADTASKSETS 2
|
||||
|
||||
typedef enum {
|
||||
METHODSINGLEID = 0,
|
||||
@@ -77,17 +76,28 @@ struct ActivityInformation {
|
||||
std::string description_override; // overrides auto generated description -- default empty, max length 128
|
||||
int skill_id; // older clients, first id from above
|
||||
int spell_id; // older clients, first id from above
|
||||
int goal_id;
|
||||
std::string goal_match_list;
|
||||
TaskMethodType goal_method;
|
||||
int goal_count;
|
||||
int deliver_to_npc;
|
||||
uint32_t npc_id;
|
||||
uint32_t npc_goal_id;
|
||||
std::string npc_match_list; // delimited by '|' for partial name matches but also supports ids
|
||||
uint32_t item_id;
|
||||
uint32_t item_goal_id;
|
||||
std::string item_id_list; // delimited by '|' to support multiple item ids
|
||||
int dz_switch_id;
|
||||
float min_x;
|
||||
float min_y;
|
||||
float min_z;
|
||||
float max_x;
|
||||
float max_y;
|
||||
float max_z;
|
||||
std::vector<int> zone_ids;
|
||||
std::string zones; // IDs ; separated, ZoneID is the first in this list for older clients -- default empty string, max length 64
|
||||
int zone_version;
|
||||
bool optional;
|
||||
bool has_area; // non-database field
|
||||
|
||||
inline bool CheckZone(int zone_id, int version)
|
||||
inline bool CheckZone(int zone_id, int version) const
|
||||
{
|
||||
if (zone_ids.empty()) {
|
||||
return true;
|
||||
@@ -166,7 +176,7 @@ struct ActivityInformation {
|
||||
out.WriteInt32(zone_ids.empty() ? 0 : zone_ids.front());
|
||||
}
|
||||
|
||||
out.WriteInt32(activity_type == TaskActivityType::Touch ? goal_id : 0); // dz_switch_id (maybe add separate field)
|
||||
out.WriteInt32(dz_switch_id);
|
||||
out.WriteString(description_override);
|
||||
out.WriteInt32(done_count);
|
||||
out.WriteInt8(1); // unknown
|
||||
|
||||
Reference in New Issue
Block a user