feat: Add logging for testing Johnny missions (#1880)

This commit is contained in:
David Markowitz
2025-09-20 17:22:16 -07:00
committed by GitHub
parent 06022e4b19
commit bb05b3ac0d
4 changed files with 23 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}