diff --git a/common/tasks.h b/common/tasks.h index 65986b50c..e68fe6ddf 100644 --- a/common/tasks.h +++ b/common/tasks.h @@ -163,7 +163,7 @@ struct ActivityInformation { out.WriteInt32(zone_ids.empty() ? 0 : zone_ids.front()); } - out.WriteInt32(0); // unknown id + out.WriteInt32(activity_type == TaskActivityType::Touch ? goal_id : 0); // dz_switch_id (maybe add separate field) out.WriteString(description_override); out.WriteInt32(done_count); out.WriteInt8(1); // unknown diff --git a/zone/client.h b/zone/client.h index bd75e3145..4391e9c94 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1178,6 +1178,10 @@ public: } else { return false; } } + void UpdateTasksOnTouchSwitch(int dz_switch_id) + { + if (task_state) { task_state->UpdateTasksOnTouch(this, dz_switch_id); } + } inline void TaskSetSelector(Mob *mob, int task_set_id) { if (task_manager) { diff --git a/zone/doors.cpp b/zone/doors.cpp index a22560a2b..abebcc7f7 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -210,7 +210,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) { if (m_dz_switch_id != 0) { - // todo: update task touch task events with matching dz switch id + sender->UpdateTasksOnTouchSwitch(m_dz_switch_id); if (sender->TryMovePCDynamicZoneSwitch(m_dz_switch_id)) { safe_delete(outapp); diff --git a/zone/task_client_state.cpp b/zone/task_client_state.cpp index 475a32d9a..11d78d812 100644 --- a/zone/task_client_state.cpp +++ b/zone/task_client_state.cpp @@ -22,7 +22,6 @@ ClientTaskState::ClientTaskState() { m_active_task_count = 0; m_last_completed_task_loaded = 0; - m_checked_touch_activities = false; for (int i = 0; i < MAXACTIVEQUESTS; i++) { m_active_quests[i].slot = i; @@ -1039,11 +1038,11 @@ bool ClientTaskState::UpdateTasksOnDeliver( return is_updated; } -void ClientTaskState::UpdateTasksOnTouch(Client *client, int zone_id, uint16 version) +void ClientTaskState::UpdateTasksOnTouch(Client *client, int dz_switch_id) { // If the client has no tasks, there is nothing further to check. - LogTasks("[UpdateTasksOnTouch] [{}] ", zone_id); + LogTasks("[UpdateTasksOnTouch] [{}] ", dz_switch_id); if (!HasActiveTasks()) { return; @@ -1077,14 +1076,16 @@ void ClientTaskState::UpdateTasksOnTouch(Client *client, int zone_id, uint16 ver if (activity_info->goal_method != METHODSINGLEID) { continue; } - if (!activity_info->CheckZone(zone_id, version)) { + if (!activity_info->CheckZone(zone->GetZoneID(), zone->GetInstanceVersion())) { LogTasks( "[UpdateTasksOnTouch] character [{}] Touch activity_information failed zone check", client->GetName() ); continue; } - + if (activity_info->goal_id != dz_switch_id) { + continue; + } // We found an active task to zone into this zone, so set done count to goal count // (Only a goal count of 1 makes sense for touch activities?) LogTasks("[UpdateTasksOnTouch] Increment on Touch"); @@ -1922,15 +1923,6 @@ void ClientTaskState::TaskPeriodicChecks(Client *client) break; } } - - // Check for activities that require zoning into a specific zone. - // This is done in this method because it gives an extra few seconds for the client screen to display - // the zone before we send the 'Task activity_information Completed' message. - // - if (!m_checked_touch_activities) { - UpdateTasksOnTouch(client, zone->GetZoneID(), zone->GetInstanceVersion()); - m_checked_touch_activities = true; - } } bool ClientTaskState::IsTaskActivityCompleted(TaskType task_type, int index, int activity_id) diff --git a/zone/task_client_state.h b/zone/task_client_state.h index 97d854ca0..25f7bf524 100644 --- a/zone/task_client_state.h +++ b/zone/task_client_state.h @@ -38,7 +38,7 @@ public: void UpdateTasksOnExplore(Client *client, int explore_id); bool UpdateTasksOnSpeakWith(Client *client, int npc_type_id); bool UpdateTasksOnDeliver(Client *client, std::list &items, int cash, int npc_type_id); - void UpdateTasksOnTouch(Client *client, int zone_id, uint16 version); + void UpdateTasksOnTouch(Client *client, int dz_switch_id); void ProcessTaskProximities(Client *client, float x, float y, float z); bool TaskOutOfTime(TaskType task_type, int index); void TaskPeriodicChecks(Client *client); @@ -130,7 +130,6 @@ private: std::vector m_enabled_tasks; std::vector m_completed_tasks; int m_last_completed_task_loaded; - bool m_checked_touch_activities; static void ShowClientTaskInfoMessage(ClientTaskInformation *task, Client *c);