Files
DarkflameServer/dScripts/02_server/Map/njhub/OldManNPC.cpp
David Markowitz 1d2de705fb fix: old man npc mission (#1982)
* fix: old man npc mission

tested that the repeatable daily now has to actually be done and also can actually be done.

* Update OldManNPC.cpp
2026-06-08 20:44:29 -07:00

32 lines
898 B
C++

#include "OldManNPC.h"
#include "eMissionState.h"
#include "Character.h"
#include "MissionComponent.h"
void ResetMissions(Entity& user) {
for (int32_t i = 1; i < 7; i++) {
int32_t flag = 2020 + i;
auto* const character = user.GetCharacter();
if (character) character->SetPlayerFlag(flag, false);
}
}
void OldManNPC::OnUse(Entity* self, Entity* user) {
LOG("");
const auto* const missionComponent = user->GetComponent<MissionComponent>();
if (!missionComponent) return;
const auto* const mission = missionComponent->GetMission(2039);
if (!mission) {
ResetMissions(*user); // shouldnt be needed for dlu but it is because the mission is null
return;
}
const auto missionState = mission->GetMissionState();
LOG("mission state %i", missionState);
if (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE) {
ResetMissions(*user);
}
}