Merge pull request #531 Add Fong Architect Script

Added the Fong Architect script and split out the Darkitect method into its own file so it can be used across multiple scripts.
This commit is contained in:
David Markowitz 2022-05-01 16:22:12 -07:00 committed by GitHub
commit 427c4a8c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 77 additions and 48 deletions

View File

@ -147,6 +147,7 @@
#include "FvNinjaGuard.h" #include "FvNinjaGuard.h"
#include "FvPassThroughWall.h" #include "FvPassThroughWall.h"
#include "FvBounceOverWall.h" #include "FvBounceOverWall.h"
#include "FvFong.h"
// FB Scripts // FB Scripts
#include "AgJetEffectServer.h" #include "AgJetEffectServer.h"
@ -568,6 +569,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = new FvPassThroughWall(); script = new FvPassThroughWall();
else if (scriptName == "scripts\\ai\\FV\\L_ACT_BOUNCE_OVER_WALL.lua") else if (scriptName == "scripts\\ai\\FV\\L_ACT_BOUNCE_OVER_WALL.lua")
script = new FvBounceOverWall(); script = new FvBounceOverWall();
else if (scriptName == "scripts\\02_server\\Map\\FV\\L_NPC_FONG.lua")
script = new FvFong();
//Misc: //Misc:
if (scriptName == "scripts\\02_server\\Map\\General\\L_EXPLODING_ASSET.lua") if (scriptName == "scripts\\02_server\\Map\\General\\L_EXPLODING_ASSET.lua")

35
dScripts/Darkitect.cpp Normal file
View File

@ -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<DestroyableComponent>();
auto* missionComponent = player->GetComponent<MissionComponent>();
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);
}
});
}

9
dScripts/Darkitect.h Normal file
View File

@ -0,0 +1,9 @@
#pragma once
class Entity;
class Darkitect
{
public:
void Reveal(Entity* self, Entity* player);
};

12
dScripts/FvFong.cpp Normal file
View File

@ -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);
}
}

8
dScripts/FvFong.h Normal file
View File

@ -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;
};

View File

@ -1,14 +1,11 @@
#include "NtDarkitectRevealServer.h" #include "NtDarkitectRevealServer.h"
#include "Darkitect.h"
#include "MissionComponent.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<MissionComponent>(); auto* missionComponent = user->GetComponent<MissionComponent>();
@ -17,37 +14,3 @@ void NtDarkitectRevealServer::OnUse(Entity* self, Entity* user)
missionComponent->ForceProgressTaskType(1344, 1, 14293); 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<DestroyableComponent>();
auto* missionComponent = player->GetComponent<MissionComponent>();
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);
}
});
}

View File

@ -5,5 +5,4 @@ class NtDarkitectRevealServer : public CppScripts::Script
{ {
public: public:
void OnUse(Entity* self, Entity* user) override; void OnUse(Entity* self, Entity* user) override;
void Darkitect(Entity* self, Entity* player);
}; };