mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-06 15:28:39 +00:00
Organize dScripts (#814)
* Organize dScripts whitespace Remove parent scope Remove parent scope from initial setter Remove debug Remove helper programs * Fix NtImagimeterVisibility script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
This commit is contained in:
63
dScripts/02_server/Map/njhub/NjWuNPC.cpp
Normal file
63
dScripts/02_server/Map/njhub/NjWuNPC.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "NjWuNPC.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "Character.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
|
||||
// The Dragon statue daily mission
|
||||
if (missionID == m_MainDragonMissionID) {
|
||||
auto* character = target->GetCharacter();
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (character == nullptr || missionComponent == nullptr)
|
||||
return;
|
||||
|
||||
switch (missionState) {
|
||||
case MissionState::MISSION_STATE_AVAILABLE:
|
||||
case MissionState::MISSION_STATE_COMPLETE_AVAILABLE:
|
||||
{
|
||||
// Reset the sub missions
|
||||
for (const auto& subMissionID : m_SubDragonMissionIDs) {
|
||||
missionComponent->RemoveMission(subMissionID);
|
||||
missionComponent->AcceptMission(subMissionID);
|
||||
}
|
||||
|
||||
character->SetPlayerFlag(ePlayerFlags::NJ_WU_SHOW_DAILY_CHEST, false);
|
||||
|
||||
// Hide the chest
|
||||
for (auto* chest : EntityManager::Instance()->GetEntitiesInGroup(m_DragonChestGroup)) {
|
||||
GameMessages::SendNotifyClientObject(chest->GetObjectID(), m_ShowChestNotification, 0, -1,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
case MissionState::MISSION_STATE_READY_TO_COMPLETE:
|
||||
case MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE:
|
||||
{
|
||||
character->SetPlayerFlag(NJ_WU_SHOW_DAILY_CHEST, true);
|
||||
|
||||
// Show the chest
|
||||
for (auto* chest : EntityManager::Instance()->GetEntitiesInGroup(m_DragonChestGroup)) {
|
||||
GameMessages::SendNotifyClientObject(chest->GetObjectID(), m_ShowChestNotification, 1, -1,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
|
||||
auto playerID = target->GetObjectID();
|
||||
self->AddCallbackTimer(5.0f, [this, playerID]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
// Stop the dragon effects
|
||||
for (auto* dragon : EntityManager::Instance()->GetEntitiesInGroup(m_DragonStatueGroup)) {
|
||||
GameMessages::SendStopFXEffect(dragon, true, "on");
|
||||
}
|
||||
});
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user