mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 20:52:01 +00:00 
			
		
		
		
	feat: Add logging for testing Johnny missions (#1880)
This commit is contained in:
		| @@ -19,6 +19,7 @@ | ||||
| #include "MissionPrerequisites.h" | ||||
| #include "AchievementCacheKey.h" | ||||
| #include "eMissionState.h" | ||||
| #include "StringifiedEnum.h" | ||||
|  | ||||
|  // MARK: Mission Component | ||||
|  | ||||
| @@ -136,6 +137,7 @@ void MissionComponent::RemoveMission(uint32_t missionId) { | ||||
| } | ||||
|  | ||||
| void MissionComponent::Progress(eMissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count, bool ignoreAchievements) { | ||||
| 	LOG("Progressing missions %s %i %llu %s %s", StringifiedEnum::ToString(type).data(), value, associate, targets.c_str(), ignoreAchievements ? "(ignoring achievements)" : ""); | ||||
| 	std::vector<uint32_t> acceptedAchievements; | ||||
| 	if (count > 0 && !ignoreAchievements) { | ||||
| 		acceptedAchievements = LookForAchievements(type, value, true, associate, targets, count); | ||||
|   | ||||
| @@ -29,6 +29,11 @@ | ||||
| #include "CDMissionEmailTable.h" | ||||
| #include "ChatPackets.h" | ||||
| #include "PlayerManager.h" | ||||
| #include "StringifiedEnum.h" | ||||
|  | ||||
| namespace { | ||||
| 	std::set<uint32_t> g_TestedMissions = {773, 774, 775, 776, 777}; // TODO Figure out why these missions are broken sometimes | ||||
| } | ||||
|  | ||||
| Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) { | ||||
| 	m_MissionComponent = missionComponent; | ||||
| @@ -563,12 +568,14 @@ void Mission::YieldRewards() { | ||||
|  | ||||
| void Mission::Progress(eMissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count) { | ||||
| 	const auto isRemoval = count < 0; | ||||
|  | ||||
| 	const bool testedMission = GetTestedMissions().contains(GetMissionId()); | ||||
| 	if (testedMission) LOG("%i Removal: %s complete: %s achievement: %s", GetMissionId(), isRemoval ? "true" : "false", IsComplete() ? "true" : "false", IsAchievement() ? "true" : "false"); | ||||
| 	if (isRemoval && (IsComplete() || IsAchievement())) { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	for (auto* task : m_Tasks) { | ||||
| 		if (testedMission) LOG("Complete: %s Type: %s TaskType: %s", task->IsComplete() ? "true" : "false", StringifiedEnum::ToString(type).data(), StringifiedEnum::ToString(task->GetType()).data()); | ||||
| 		if (task->IsComplete() && !isRemoval) { | ||||
| 			continue; | ||||
| 		} | ||||
| @@ -618,3 +625,7 @@ Mission::~Mission() { | ||||
|  | ||||
| 	m_Tasks.clear(); | ||||
| } | ||||
|  | ||||
| const std::set<uint32_t>& Mission::GetTestedMissions() const { | ||||
| 	return g_TestedMissions; | ||||
| } | ||||
|   | ||||
| @@ -241,6 +241,9 @@ public: | ||||
| 	 * Sets the unique mission order ID of this mission | ||||
| 	 */ | ||||
| 	void SetUniqueMissionOrderID(uint32_t value) { m_UniqueMissionID = value; }; | ||||
|  | ||||
| 	const std::set<uint32_t>& GetTestedMissions() const; | ||||
|  | ||||
| private: | ||||
| 	/** | ||||
| 	 * Progresses all the newly accepted tasks for this mission after it has been accepted to reflect the state of the | ||||
|   | ||||
| @@ -15,6 +15,7 @@ | ||||
| #include "MissionComponent.h" | ||||
| #include "eMissionTaskType.h" | ||||
| #include "eReplicaComponentType.h" | ||||
| #include "StringifiedEnum.h" | ||||
|  | ||||
| MissionTask::MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask) { | ||||
| 	this->info = info; | ||||
| @@ -99,6 +100,7 @@ Mission* MissionTask::GetMission() const { | ||||
|  | ||||
|  | ||||
| uint32_t MissionTask::GetTarget() const { | ||||
| 	if (mission->GetTestedMissions().contains(mission->GetMissionId())) LOG("Target: %i", info->targetValue); | ||||
| 	return info->target; | ||||
| } | ||||
|  | ||||
| @@ -158,6 +160,7 @@ bool MissionTask::InParameters(const uint32_t value) const { | ||||
|  | ||||
|  | ||||
| bool MissionTask::IsComplete() const { | ||||
| 	if (mission->GetTestedMissions().contains(mission->GetMissionId())) LOG("uid: %i target: %i", info->uid, 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; | ||||
| @@ -168,6 +171,7 @@ bool MissionTask::IsComplete() const { | ||||
|  | ||||
|  | ||||
| void MissionTask::Complete() { | ||||
| 	if (mission->GetTestedMissions().contains(mission->GetMissionId())) LOG("target: %i", info->targetValue); | ||||
| 	SetProgress(info->targetValue); | ||||
| } | ||||
|  | ||||
| @@ -180,6 +184,7 @@ void MissionTask::CheckCompletion() const { | ||||
|  | ||||
|  | ||||
| void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& targets, int32_t count) { | ||||
| 	if (mission->GetTestedMissions().contains(mission->GetMissionId())) LOG("Progressing mission %s %i", StringifiedEnum::ToString(GetType()).data(), value); | ||||
| 	if (IsComplete() && count > 0) return; | ||||
|  | ||||
| 	const auto type = GetType(); | ||||
| @@ -229,7 +234,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& | ||||
| 		entity = Game::entityManager->GetEntity(associate); | ||||
| 		if (entity == nullptr) { | ||||
| 			if (associate != LWOOBJID_EMPTY) { | ||||
| 				LOG("Failed to find associated entity (%llu)!", associate); | ||||
| 				if (mission->GetTestedMissions().contains(mission->GetMissionId())) LOG("Failed to find associated entity (%llu)!", associate); | ||||
| 			} | ||||
| 			break; | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Markowitz
					David Markowitz