2021-12-05 17:54:36 +00:00
|
|
|
#include "NjWuNPC.h"
|
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "Character.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "eMissionState.h"
|
2023-05-02 22:39:21 +00:00
|
|
|
#include "ePlayerFlag.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// The Dragon statue daily mission
|
|
|
|
if (missionID == m_MainDragonMissionID) {
|
|
|
|
auto* character = target->GetCharacter();
|
|
|
|
auto* missionComponent = target->GetComponent<MissionComponent>();
|
|
|
|
if (character == nullptr || missionComponent == nullptr)
|
|
|
|
return;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
switch (missionState) {
|
|
|
|
case eMissionState::AVAILABLE:
|
|
|
|
case eMissionState::COMPLETE_AVAILABLE:
|
|
|
|
{
|
|
|
|
// Reset the sub missions
|
|
|
|
for (const auto& subMissionID : m_SubDragonMissionIDs) {
|
|
|
|
missionComponent->RemoveMission(subMissionID);
|
|
|
|
missionComponent->AcceptMission(subMissionID);
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-05-02 22:39:21 +00:00
|
|
|
character->SetPlayerFlag(ePlayerFlag::NJ_WU_SHOW_DAILY_CHEST, false);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// Hide the chest
|
2023-07-15 20:56:33 +00:00
|
|
|
for (auto* chest : Game::entityManager->GetEntitiesInGroup(m_DragonChestGroup)) {
|
2021-12-05 17:54:36 +00:00
|
|
|
GameMessages::SendNotifyClientObject(chest->GetObjectID(), m_ShowChestNotification, 0, -1,
|
|
|
|
target->GetObjectID(), "", target->GetSystemAddress());
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
case eMissionState::READY_TO_COMPLETE:
|
|
|
|
case eMissionState::COMPLETE_READY_TO_COMPLETE:
|
|
|
|
{
|
2023-05-02 22:39:21 +00:00
|
|
|
character->SetPlayerFlag(ePlayerFlag::NJ_WU_SHOW_DAILY_CHEST, true);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// Show the chest
|
2023-07-15 20:56:33 +00:00
|
|
|
for (auto* chest : Game::entityManager->GetEntitiesInGroup(m_DragonChestGroup)) {
|
2021-12-05 17:54:36 +00:00
|
|
|
GameMessages::SendNotifyClientObject(chest->GetObjectID(), m_ShowChestNotification, 1, -1,
|
|
|
|
target->GetObjectID(), "", target->GetSystemAddress());
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
auto playerID = target->GetObjectID();
|
|
|
|
self->AddCallbackTimer(5.0f, [this, playerID]() {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* player = Game::entityManager->GetEntity(playerID);
|
2021-12-05 17:54:36 +00:00
|
|
|
if (player == nullptr)
|
|
|
|
return;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// Stop the dragon effects
|
2023-07-15 20:56:33 +00:00
|
|
|
for (auto* dragon : Game::entityManager->GetEntitiesInGroup(m_DragonStatueGroup)) {
|
2021-12-05 17:54:36 +00:00
|
|
|
GameMessages::SendStopFXEffect(dragon, true, "on");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|