mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-10 08:44:20 +00:00
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:
31
dScripts/02_server/Map/njhub/OldManNPC.cpp
Normal file
31
dScripts/02_server/Map/njhub/OldManNPC.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user