From 5691df9009556fc2ecbfff706c96afb3eb90dfd9 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Mon, 18 Apr 2022 01:04:29 -0700 Subject: [PATCH] Fixed Racing Mission * Try, Try Again achievement now progresses when the player gets last place in a race of 3 or more players, or when solo racing is enabled. * Race Series 1 mission from Velocity Lane now progresses correctly. --- dGame/dComponents/RacingControlComponent.cpp | 11 ++++++---- dGame/dMission/MissionTask.cpp | 21 ++++++++++++++++++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/dGame/dComponents/RacingControlComponent.cpp b/dGame/dComponents/RacingControlComponent.cpp index 27df339d..f3957fff 100644 --- a/dGame/dComponents/RacingControlComponent.cpp +++ b/dGame/dComponents/RacingControlComponent.cpp @@ -410,10 +410,13 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity *player, // If solo racing is enabled OR if there are 3 players in the race, progress placement tasks. if(m_SoloRacing || m_LoadedPlayers > 2) { missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FINISH_WITH_PLACEMENT); // Finish in 1st place on a race - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks. - if(m_Finished != 1) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_WIN_RACE_IN_WORLD); // Finished first place in specific world. - + if(data->finished == 1) { + missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks. + missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_WIN_RACE_IN_WORLD); // Finished first place in specific world. + } + if (data->finished == m_LoadedPlayers) { + missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_LAST_PLACE_FINISH); // Finished first place in specific world. + } } } else if (id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") { auto *vehicle = EntityManager::Instance()->GetEntity(data->vehicleID); diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index 1a340b23..30cd58a1 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -183,7 +183,13 @@ bool MissionTask::InParameters(const uint32_t value) const bool MissionTask::IsComplete() const { - return progress >= info->targetValue; + // Mission 668 has task uid 984 which is a bit mask. Its completion value is 3. + if (info->uid == 984) { + return progress >= 3; + } + else { + return progress >= info->targetValue; + } } @@ -423,12 +429,23 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& if (parameters[0] != associate) break; - if (associate == 1 || associate == 15 || associate == 2 || associate == 3) + if (associate == 1 || associate == 2 || associate == 3) { if (value > info->targetValue) break; AddProgress(info->targetValue); } + // task 15 is a bit mask! + else if (associate == 15) { + if (!InAllTargets(value)) break; + + auto tempProgress = GetProgress(); + // If we won at Nimbus Station, set bit 0 + if (value == 1203) SetProgress(tempProgress |= 1 << 0); + // If we won at Gnarled Forest, set bit 1 + else if (value == 1303) SetProgress(tempProgress |= 1 << 1); + // If both bits are set, then the client sees the mission as complete. + } else if (associate == 10) { // If the player did not crash during the race, progress this task by count.