diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 8be1c0d4..5036b111 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -147,6 +147,7 @@ #include "FvNinjaGuard.h" #include "FvPassThroughWall.h" #include "FvBounceOverWall.h" +#include "FvFong.h" // FB Scripts #include "AgJetEffectServer.h" @@ -568,6 +569,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new FvPassThroughWall(); else if (scriptName == "scripts\\ai\\FV\\L_ACT_BOUNCE_OVER_WALL.lua") script = new FvBounceOverWall(); + else if (scriptName == "scripts\\02_server\\Map\\FV\\L_NPC_FONG.lua") + script = new FvFong(); //Misc: if (scriptName == "scripts\\02_server\\Map\\General\\L_EXPLODING_ASSET.lua") diff --git a/dScripts/Darkitect.cpp b/dScripts/Darkitect.cpp new file mode 100644 index 00000000..c4e1e45d --- /dev/null +++ b/dScripts/Darkitect.cpp @@ -0,0 +1,35 @@ +#include "Darkitect.h" +#include "MissionComponent.h" +#include "DestroyableComponent.h" +#include "EntityManager.h" +#include "GameMessages.h" +#include "Character.h" + +void Darkitect::Reveal(Entity* self, Entity* player) +{ + const auto playerID = player->GetObjectID(); + + GameMessages::SendNotifyClientObject(self->GetObjectID(), u"reveal", 0, 0, playerID, "", player->GetSystemAddress()); + + self->AddCallbackTimer(20, [this, self, playerID]() { + auto* player = EntityManager::Instance()->GetEntity(playerID); + + if (!player) return; + + auto* destroyableComponent = player->GetComponent(); + auto* missionComponent = player->GetComponent(); + auto* character = player->GetCharacter(); + + if (destroyableComponent != nullptr && missionComponent != nullptr && character != nullptr) { + destroyableComponent->SetArmor(0); + destroyableComponent->SetHealth(1); + destroyableComponent->SetImagination(0); + + if (missionComponent->GetMissionState(1295) == MissionState::MISSION_STATE_ACTIVE) { + character->SetPlayerFlag(1911, true); + } + + EntityManager::Instance()->SerializeEntity(player); + } + }); +} diff --git a/dScripts/Darkitect.h b/dScripts/Darkitect.h new file mode 100644 index 00000000..f0d19648 --- /dev/null +++ b/dScripts/Darkitect.h @@ -0,0 +1,9 @@ +#pragma once + +class Entity; + +class Darkitect +{ +public: + void Reveal(Entity* self, Entity* player); +}; diff --git a/dScripts/FvFong.cpp b/dScripts/FvFong.cpp new file mode 100644 index 00000000..890bf0ff --- /dev/null +++ b/dScripts/FvFong.cpp @@ -0,0 +1,12 @@ +#include "FvFong.h" +#include "Darkitect.h" +#include "MissionComponent.h" + +void FvFong::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) +{ + if (missionID == 734 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) + { + Darkitect Baron; + Baron.Reveal(self, target); + } +} diff --git a/dScripts/FvFong.h b/dScripts/FvFong.h new file mode 100644 index 00000000..fc47b484 --- /dev/null +++ b/dScripts/FvFong.h @@ -0,0 +1,8 @@ +#pragma once +#include "CppScripts.h" + +class FvFong : public CppScripts::Script +{ + public: + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; +}; diff --git a/dScripts/NtDarkitectRevealServer.cpp b/dScripts/NtDarkitectRevealServer.cpp index 2bfbb063..b8afa510 100644 --- a/dScripts/NtDarkitectRevealServer.cpp +++ b/dScripts/NtDarkitectRevealServer.cpp @@ -1,53 +1,16 @@ #include "NtDarkitectRevealServer.h" +#include "Darkitect.h" #include "MissionComponent.h" -#include "DestroyableComponent.h" -#include "EntityManager.h" -#include "GameMessages.h" -#include "Character.h" - -void NtDarkitectRevealServer::OnUse(Entity* self, Entity* user) +void NtDarkitectRevealServer::OnUse(Entity* self, Entity* user) { - Darkitect(self, user); + Darkitect Baron; + Baron.Reveal(self, user); - auto* missionComponent = user->GetComponent(); + auto* missionComponent = user->GetComponent(); - if (missionComponent != nullptr) - { - missionComponent->ForceProgressTaskType(1344, 1, 14293); - } -} - -void NtDarkitectRevealServer::Darkitect(Entity* self, Entity* player) -{ - const auto playerID = player->GetObjectID(); - - GameMessages::SendNotifyClientObject(self->GetObjectID(), u"reveal", 0, 0, playerID, "", player->GetSystemAddress()); - - self->AddCallbackTimer(20, [this, self, playerID]() { - auto* player = EntityManager::Instance()->GetEntity(playerID); - - if (player == nullptr) - { - return; - } - - auto* destroyableComponent = player->GetComponent(); - auto* missionComponent = player->GetComponent(); - auto* character = player->GetCharacter(); - - if (destroyableComponent != nullptr && missionComponent != nullptr && character != nullptr) - { - destroyableComponent->SetArmor(0); - destroyableComponent->SetHealth(1); - destroyableComponent->SetImagination(0); - - if (missionComponent->GetMissionState(1295) == MissionState::MISSION_STATE_ACTIVE) - { - character->SetPlayerFlag(1911, true); - } - - EntityManager::Instance()->SerializeEntity(player); - } - }); + if (missionComponent != nullptr) + { + missionComponent->ForceProgressTaskType(1344, 1, 14293); + } } diff --git a/dScripts/NtDarkitectRevealServer.h b/dScripts/NtDarkitectRevealServer.h index 60d89934..2b954671 100644 --- a/dScripts/NtDarkitectRevealServer.h +++ b/dScripts/NtDarkitectRevealServer.h @@ -4,6 +4,5 @@ class NtDarkitectRevealServer : public CppScripts::Script { public: - void OnUse(Entity* self, Entity* user) override; - void Darkitect(Entity* self, Entity* player); + void OnUse(Entity* self, Entity* user) override; };