Merge pull request #509 from EmosewaMC/racing-achievement-fixes

Fixed Racing Missions Try, Try again and Race Series 1
This commit is contained in:
David Markowitz 2022-04-18 04:03:32 -07:00 committed by GitHub
commit 1defc22caf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 6 deletions

View File

@ -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);

View File

@ -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.