mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 09:26:36 +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:
+13
-37
@@ -1139,48 +1139,32 @@ public:
|
||||
}
|
||||
inline void UpdateTasksForItem(
|
||||
TaskActivityType activity_type,
|
||||
NPC* npc,
|
||||
int item_id,
|
||||
int count = 1
|
||||
)
|
||||
{
|
||||
if (task_state) {
|
||||
task_state->UpdateTasksForItem(this, activity_type, item_id, count);
|
||||
task_state->UpdateTasksForItem(this, activity_type, npc, item_id, count);
|
||||
}
|
||||
}
|
||||
inline void UpdateTasksOnExplore(int explore_id)
|
||||
inline void UpdateTasksOnExplore(const glm::vec4& pos)
|
||||
{
|
||||
if (task_state) {
|
||||
task_state->UpdateTasksOnExplore(
|
||||
this,
|
||||
explore_id
|
||||
);
|
||||
task_state->UpdateTasksOnExplore(this, pos);
|
||||
}
|
||||
}
|
||||
inline bool UpdateTasksOnSpeakWith(int npc_type_id)
|
||||
inline bool UpdateTasksOnSpeakWith(NPC* npc)
|
||||
{
|
||||
if (task_state) {
|
||||
return task_state->UpdateTasksOnSpeakWith(
|
||||
this,
|
||||
npc_type_id
|
||||
);
|
||||
}
|
||||
else { return false; }
|
||||
return task_state && task_state->UpdateTasksOnSpeakWith(this, npc);
|
||||
}
|
||||
inline bool UpdateTasksOnDeliver(
|
||||
std::list<EQ::ItemInstance *> &items,
|
||||
int cash,
|
||||
int npc_type_id
|
||||
NPC* npc
|
||||
)
|
||||
{
|
||||
if (task_state) {
|
||||
return task_state->UpdateTasksOnDeliver(
|
||||
this,
|
||||
items,
|
||||
cash,
|
||||
npc_type_id
|
||||
);
|
||||
}
|
||||
else { return false; }
|
||||
return task_state && task_state->UpdateTasksOnDeliver(this, items, cash, npc);
|
||||
}
|
||||
void UpdateTasksOnTouchSwitch(int dz_switch_id)
|
||||
{
|
||||
@@ -1235,12 +1219,7 @@ public:
|
||||
inline void ProcessTaskProximities(float x, float y, float z)
|
||||
{
|
||||
if (task_state) {
|
||||
task_state->ProcessTaskProximities(
|
||||
this,
|
||||
x,
|
||||
y,
|
||||
z
|
||||
);
|
||||
task_state->ProcessTaskProximities(this, x, y, z);
|
||||
}
|
||||
}
|
||||
inline void AssignTask(
|
||||
@@ -1252,22 +1231,19 @@ public:
|
||||
task_state->AcceptNewTask(this, task_id, npc_id, std::time(nullptr), enforce_level_requirement);
|
||||
}
|
||||
}
|
||||
inline int ActiveSpeakTask(int npc_type_id)
|
||||
inline int ActiveSpeakTask(NPC* npc)
|
||||
{
|
||||
if (task_state) {
|
||||
return task_state->ActiveSpeakTask(npc_type_id);
|
||||
return task_state->ActiveSpeakTask(this, npc);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
inline int ActiveSpeakActivity(int npc_type_id, int task_id)
|
||||
inline int ActiveSpeakActivity(NPC* npc, int task_id)
|
||||
{
|
||||
if (task_state) {
|
||||
return task_state->ActiveSpeakActivity(
|
||||
npc_type_id,
|
||||
task_id
|
||||
);
|
||||
return task_state->ActiveSpeakActivity(this, npc, task_id);
|
||||
}
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user