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:
@@ -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")
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
10
dScripts/02_server/Map/njhub/OldManNPC.h
Normal file
10
dScripts/02_server/Map/njhub/OldManNPC.h
Normal 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
|
||||
@@ -278,6 +278,7 @@
|
||||
#include "NjEarthPetServer.h"
|
||||
#include "NjDragonEmblemChestServer.h"
|
||||
#include "NjNyaMissionitems.h"
|
||||
#include "OldManNPC.h"
|
||||
|
||||
// Scripted equipment
|
||||
#include "AnvilOfArmor.h"
|
||||
@@ -628,6 +629,7 @@ namespace {
|
||||
{"scripts\\02_server\\Map\\njhub\\L_EARTH_PET_SERVER.lua", []() {return new NjEarthPetServer();}},
|
||||
{"scripts\\02_server\\Map\\njhub\\L_DRAGON_EMBLEM_CHEST_SERVER.lua", []() {return new NjDragonEmblemChestServer();}},
|
||||
{"scripts\\02_server\\Map\\njhub\\L_NYA_MISSION_ITEMS.lua", []() {return new NjNyaMissionitems();}},
|
||||
{"scripts\\02_server\\Map\\njhub\\L_OLD_MAN_NPC.lua", []() {return new OldManNPC();}},
|
||||
|
||||
//DLU
|
||||
{"scripts\\02_server\\DLU\\DLUVanityTeleportingObject.lua", []() {return new DLUVanityTeleportingObject();}},
|
||||
|
||||
Reference in New Issue
Block a user