feat: fix go outside and play mission (#1967)

* feat: fix go outside and play mission

* Update dWorldServer/WorldServer.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update dGame/dComponents/MissionComponent.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* const

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
David Markowitz
2026-04-08 22:55:57 -07:00
committed by GitHub
parent 247576e101
commit 8061f512aa
6 changed files with 76 additions and 6 deletions

View File

@@ -407,9 +407,7 @@ void Mission::Catchup() {
task->Progress(target);
}
}
}
if (type == eMissionTaskType::PLAYER_FLAG) {
} else if (type == eMissionTaskType::PLAYER_FLAG) {
for (int32_t target : task->GetAllTargets()) {
const auto flag = GetCharacter()->GetPlayerFlag(target);
@@ -423,6 +421,24 @@ void Mission::Catchup() {
break;
}
}
} else if (type == eMissionTaskType::RACING) {
// check if its a racing meta task ("4") and then set its progress to the current completed missions in all tasks
const auto& clientInfo = task->GetClientInfo();
if (clientInfo.taskParam1.starts_with("4")) {
// Each target is racing mission that needs to be completed.
// If its completed, progress the meta task by 1.
// at the end set the task progress to avoid sending excess msgs across the wire
uint32_t progress = 0;
for (const auto& target : task->GetAllTargets()) {
if (target == 0) continue;
auto* racingMission = m_MissionComponent->GetMission(target);
if (racingMission != nullptr && racingMission->IsComplete()) {
progress++;
}
}
task->SetProgress(progress);
}
}
}
}

View File

@@ -418,7 +418,24 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
AddProgress(count);
} else if (associate == 4 || associate == 5 || associate == 14) {
if (!InAllTargets(value)) break;
AddProgress(count);
if (associate == 4) {
// Recount all completed target missions so this stays idempotent with
// Catchup, which sets the same value on Accept(). AddProgress would
// double-count when LookForAchievements runs Catchup then Progress.
auto* entity = mission->GetAssociate();
if (entity == nullptr) break;
auto* missionComponent = entity->GetComponent<MissionComponent>();
if (missionComponent == nullptr) break;
uint32_t completedCount = 0;
for (const auto& target : GetAllTargets()) {
if (target == 0) continue;
auto* targetMission = missionComponent->GetMission(target);
if (targetMission != nullptr && targetMission->IsComplete()) completedCount++;
}
SetProgress(completedCount);
} else {
AddProgress(count);
}
} else if (associate == 17) {
if (!InAllTargets(value)) break;
AddProgress(count);