mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +00:00
Fix missions re-ordering on reload (#686)
* Fix missions re-ordering on reload Check for success rather than failure * Add a comment * Get base value from database * Update Mission.h
This commit is contained in:
@@ -26,6 +26,8 @@ Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) {
|
||||
|
||||
m_Timestamp = 0;
|
||||
|
||||
m_UniqueMissionID = dZoneManager::Instance()->GetUniqueMissionIdStartingValue();
|
||||
|
||||
m_Reward = 0;
|
||||
|
||||
m_State = MissionState::MISSION_STATE_UNKNOWN;
|
||||
@@ -283,6 +285,7 @@ void Mission::Accept() {
|
||||
|
||||
void Mission::Complete(const bool yieldRewards) {
|
||||
if (m_State != MissionState::MISSION_STATE_ACTIVE && m_State != MissionState::MISSION_STATE_COMPLETE_ACTIVE) {
|
||||
// If we are accepting a mission here there is no point to giving it a unique ID since we just complete it immediately.
|
||||
Accept();
|
||||
}
|
||||
|
||||
|
@@ -220,6 +220,18 @@ public:
|
||||
* @return true if the mission exists, false otherwise
|
||||
*/
|
||||
static bool IsValidMission(uint32_t missionId, CDMissions& info);
|
||||
|
||||
/**
|
||||
* @brief Returns the unique mission order ID
|
||||
*
|
||||
* @return The unique order ID
|
||||
*/
|
||||
uint32_t GetUniqueMissionOrderID() { return m_UniqueMissionID; };
|
||||
|
||||
/**
|
||||
* Sets the unique mission order ID of this mission
|
||||
*/
|
||||
void SetUniqueMissionOrderID(uint32_t value) { m_UniqueMissionID = value; };
|
||||
private:
|
||||
/**
|
||||
* Progresses all the newly accepted tasks for this mission after it has been accepted to reflect the state of the
|
||||
@@ -261,6 +273,11 @@ private:
|
||||
* All the tasks that can be progressed for this mission
|
||||
*/
|
||||
std::vector<MissionTask*> m_Tasks;
|
||||
|
||||
/**
|
||||
* The unique ID what order this mission was accepted in.
|
||||
*/
|
||||
uint32_t m_UniqueMissionID;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user