mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
Split out Darkitect reveal into it's own file
add reveal to Fong
This commit is contained in:
parent
12ae6a5525
commit
763a1f4a61
@ -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")
|
||||
|
35
dScripts/Darkitect.cpp
Normal file
35
dScripts/Darkitect.cpp
Normal 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
9
dScripts/Darkitect.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
class Entity;
|
||||
|
||||
class Darkitect
|
||||
{
|
||||
public:
|
||||
void Reveal(Entity* self, Entity* player);
|
||||
};
|
12
dScripts/FvFong.cpp
Normal file
12
dScripts/FvFong.cpp
Normal 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
8
dScripts/FvFong.h
Normal 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;
|
||||
};
|
@ -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<MissionComponent>();
|
||||
auto* missionComponent = user->GetComponent<MissionComponent>();
|
||||
|
||||
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<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);
|
||||
}
|
||||
});
|
||||
if (missionComponent != nullptr)
|
||||
{
|
||||
missionComponent->ForceProgressTaskType(1344, 1, 14293);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user