fix(missions): prerequisites read as the client reads them

The client checks Missions.prereqMissionID in
LWOMissionComponent::getMissionState (0x00cd7400): text without any of
!&^;,|(): is one mission ID (met when 0 or ever completed); anything else
goes through its expression reader (sub_00a32980), left to right with no
precedence, & , ; and, | or, ^ xor, ! ~ not, ( ) groups, and/or skipping
the rest once the result is known. Each operand (sub_00c90a80): "id" is
met once the mission was ever completed; "id:state" when the client's
state mask of that mission equals state.

DLU read the text right to left ignoring groups, so
"(509|229)&(812|813|814|815)" (mission 781) was met by 509 alone; a plain
ID needed the mission's state to be 8, so a repeatable being repeated
blocked the missions after it (1870 after 1869); and id:state compared the
mission's own state. GetClientMissionState moves to MissionPrerequisites
so operands can ask for the mask.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-02 15:36:18 -05:00
parent 529bacd077
commit c1079fc20c
4 changed files with 273 additions and 171 deletions

View File

@@ -76,24 +76,7 @@ eMissionState MissionComponent::GetMissionState(const uint32_t missionId) const
int32_t MissionComponent::GetClientMissionState(const uint32_t missionId) const {
// A mission ID below 1 is no mission
if (missionId == 0 || missionId > static_cast<uint32_t>(std::numeric_limits<int32_t>::max())) return 0;
const auto* const mission = GetMission(missionId);
const bool done = mission && (mission->GetCompletions() > 0 || mission->IsComplete());
int32_t state = done ? static_cast<int32_t>(eMissionState::COMPLETE) : 0;
// In progress: its own state
if (mission && !mission->IsComplete()) return state | static_cast<int32_t>(mission->GetMissionState());
CDMissions info{};
if (!Mission::IsValidMission(missionId, info)) return 0;
if ((!done || info.repeatable) && MissionPrerequisites::CheckPrerequisites(missionId, m_Missions)) {
state |= static_cast<int32_t>(eMissionState::AVAILABLE);
}
return state;
return MissionPrerequisites::GetClientMissionState(missionId, m_Missions);
}
bool MissionComponent::IsCooldownRunning(const int64_t completedAt, const int64_t cooldownMinutes, const int64_t now) {