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
This commit is contained in:
David Markowitz
2026-06-08 20:44:29 -07:00
committed by GitHub
parent a156a8fcba
commit 1d2de705fb
5 changed files with 45 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB
"NjJayMissionItems.cpp"
"NjNPCMissionSpinjitzuServer.cpp"
"NjNyaMissionitems.cpp"
"OldManNPC.cpp"
"NjScrollChestServer.cpp"
"NjWuNPC.cpp"
"RainOfArrows.cpp")

View File

@@ -0,0 +1,31 @@
#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);
}
}

View File

@@ -0,0 +1,10 @@
#ifndef OLDMANNPC_H
#define OLDMANNPC_H
#include "CppScripts.h"
class OldManNPC : public CppScripts::Script {
void OnUse(Entity* self, Entity* user) override;
};
#endif //!OLDMANNPC_H