fix(mission): GetMissionState answers the client's state bit mask

LWOMissionComponent::getMissionState (0x00cd7400) returns a mask: COMPLETE
once the mission was completed, ORed with the state of the mission in
progress; a mission not in progress gets AVAILABLE when it was never
completed or is repeatable and its prerequisites are met, else 0. DLU's
handler answered UNKNOWN (-1, every bit set) for a mission that cannot be
taken and COMPLETE for a completed repeatable one, and ignored
cooldownInfoRequested. With cooldown info requested (0x00cd7770) the
client only checks the cooldown of a repeat in progress (state 9 or 10):
fewer whole minutes since the last completion than Missions.cooldownTime.

MissionComponent::GetMissionState, used across the server, is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-02 09:42:25 -05:00
parent 0253fea006
commit 8564e293fa
3 changed files with 70 additions and 8 deletions

View File

@@ -56,6 +56,22 @@ public:
*/
eMissionState GetMissionState(uint32_t missionId) const;
/**
* The mission state as the client works it out (LWOMissionComponent::getMissionState 0x00cd7400): a bit mask,
* COMPLETE (8) once the mission was ever completed, ORed with the state of the mission in progress; a mission not in
* progress gets AVAILABLE (1) when it was never completed or is repeatable and its prerequisites are met. 0 for an
* unknown mission.
*/
int32_t GetClientMissionState(uint32_t missionId) const;
/**
* Whether the cooldown (Missions.cooldownTime, minutes) of a completed mission is still running, as the client
* checks it: only for a mission completed before, a cooldown above 0, and while fewer whole minutes than the
* cooldown have passed since the last completion.
*/
bool IsCooldownRunning(uint32_t missionId) const;
static bool IsCooldownRunning(int64_t completedAt, int64_t cooldownMinutes, int64_t now);
/**
* Checks if the entity has all the requirements for accepting the mission specified by the ID.
* @param missionId the mission ID to check for if the character may accept it