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:
David Markowitz
2022-11-03 10:57:54 -07:00
committed by GitHub
parent b974eed8f5
commit 8d37d9b681
567 changed files with 886 additions and 252 deletions

View File

@@ -0,0 +1,26 @@
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NT
"NtCombatChallengeDummy.cpp"
"NtCombatChallengeExplodingDummy.cpp"
"NtCombatChallengeServer.cpp"
"NtAssemblyTubeServer.cpp"
"NtParadoxPanelServer.cpp"
"NtImagBeamBuffer.cpp"
"NtBeamImaginationCollectors.cpp"
"NtDirtCloudServer.cpp"
"NtConsoleTeleportServer.cpp"
"SpawnStegoServer.cpp"
"SpawnSaberCatServer.cpp"
"SpawnShrakeServer.cpp"
"NtDukeServer.cpp"
"NtHaelServer.cpp"
"NtOverbuildServer.cpp"
"NtVandaServer.cpp"
"NtXRayServer.cpp"
"NtSleepingGuard.cpp"
"NtImagimeterVisibility.cpp"
"NtSentinelWalkwayServer.cpp"
"NtDarkitectRevealServer.cpp"
"NtParadoxTeleServer.cpp"
"NtVentureSpeedPadServer.cpp"
"NtVentureCannonServer.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,114 @@
#include "NtAssemblyTubeServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
void NtAssemblyTubeServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");
}
void NtAssemblyTubeServer::OnPlayerLoaded(Entity* self, Entity* player) {
}
void NtAssemblyTubeServer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (status != "ENTER" || !entering->IsPlayer() || name != "teleport") return;
auto* player = entering;
const auto playerID = player->GetObjectID();
RunAssemblyTube(self, player);
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
}
}
void NtAssemblyTubeServer::RunAssemblyTube(Entity* self, Entity* player) {
const auto playerID = player->GetObjectID();
const auto iter = m_TeleportingPlayerTable.find(playerID);
if (iter == m_TeleportingPlayerTable.end()) m_TeleportingPlayerTable[playerID] = false;
const auto bPlayerBeingTeleported = m_TeleportingPlayerTable[playerID];
if (player->IsPlayer() && !bPlayerBeingTeleported) {
auto teleCinematic = self->GetVar<std::u16string>(u"Cinematic");
GameMessages::SendSetStunned(playerID, PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
if (!teleCinematic.empty()) {
const auto teleCinematicUname = teleCinematic;
GameMessages::SendPlayCinematic(player->GetObjectID(), teleCinematicUname, player->GetSystemAddress(),
true, true, true, false, 0, false, -1, false, true
);
}
GameMessages::SendPlayAnimation(player, u"tube-sucker", 4.0f);
const auto animTime = 3;
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
TeleportPlayer(self, player);
});
}
}
void NtAssemblyTubeServer::TeleportPlayer(Entity* self, Entity* player) {
auto destinationGroup = self->GetVar<std::u16string>(u"teleGroup");
auto* destination = self;
if (!destinationGroup.empty()) {
const auto& groupObjs = EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
if (!groupObjs.empty()) {
destination = groupObjs[0];
}
}
const auto destPosition = destination->GetPosition();
const auto destRotation = destination->GetRotation();
GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"tube-resurrect", 4.0f);
const auto animTime = 2;
const auto playerID = player->GetObjectID();
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
UnlockPlayer(self, player);
});
const auto useSound = self->GetVar<std::string>(u"sound1");
if (!useSound.empty()) {
GameMessages::SendPlayNDAudioEmitter(player, player->GetSystemAddress(), useSound);
}
}
void NtAssemblyTubeServer::UnlockPlayer(Entity* self, Entity* player) {
const auto playerID = player->GetObjectID();
m_TeleportingPlayerTable[playerID] = false;
GameMessages::SendSetStunned(playerID, POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
}

View File

@@ -0,0 +1,16 @@
#pragma once
#include "CppScripts.h"
class NtAssemblyTubeServer : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnPlayerLoaded(Entity* self, Entity* player) override;
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
void RunAssemblyTube(Entity* self, Entity* player);
void TeleportPlayer(Entity* self, Entity* player);
void UnlockPlayer(Entity* self, Entity* player);
private:
std::map<LWOOBJID, bool> m_TeleportingPlayerTable;
};

View File

@@ -0,0 +1,29 @@
#include "NtBeamImaginationCollectors.h"
#include "GeneralUtils.h"
#include "GameMessages.h"
void NtBeamImaginationCollectors::OnStartup(Entity* self) {
self->AddTimer("PlayFX", GetRandomNum());
}
int32_t NtBeamImaginationCollectors::GetRandomNum() {
int32_t randNum = m_LastRandom;
while (randNum == m_LastRandom) {
randNum = GeneralUtils::GenerateRandomNumber<int32_t>(m_RandMin, m_RandMax);
}
m_LastRandom = randNum;
return randNum;
}
void NtBeamImaginationCollectors::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != "PlayFX") {
return;
}
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, m_FxName, "Beam");
self->AddTimer("PlayFX", GetRandomNum());
}

View File

@@ -0,0 +1,16 @@
#pragma once
#include "CppScripts.h"
class NtBeamImaginationCollectors : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
int32_t GetRandomNum();
void OnTimerDone(Entity* self, std::string timerName) override;
private:
int32_t m_LastRandom = 0;
int32_t m_RandMin = 5;
int32_t m_RandMax = 15;
std::u16string m_FxName = u"beam_collect";
};

View File

@@ -0,0 +1,26 @@
#include "NtCombatChallengeDummy.h"
#include "EntityManager.h"
void NtCombatChallengeDummy::OnDie(Entity* self, Entity* killer) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnDie(challengeObject, killer);
}
}
}
void NtCombatChallengeDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnHitOrHealResult(challengeObject, attacker, damage);
}
}
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "CppScripts.h"
class NtCombatChallengeDummy : public CppScripts::Script
{
public:
void OnDie(Entity* self, Entity* killer) override;
void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
};

View File

@@ -0,0 +1,32 @@
#include "NtCombatChallengeExplodingDummy.h"
#include "EntityManager.h"
#include "SkillComponent.h"
void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnDie(challengeObject, killer);
}
}
}
void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnHitOrHealResult(challengeObject, attacker, damage);
}
}
auto skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent != nullptr) {
skillComponent->CalculateBehavior(1338, 30875, attacker->GetObjectID());
}
self->Kill(attacker);
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include "CppScripts.h"
class NtCombatChallengeExplodingDummy : public CppScripts::Script
{
void OnDie(Entity* self, Entity* killer) override;
void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
};

View File

@@ -0,0 +1,208 @@
#include "NtCombatChallengeServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
void NtCombatChallengeServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"UI_Open", 0, 0, user->GetObjectID(), "", user->GetSystemAddress());
}
void NtCombatChallengeServer::OnDie(Entity* self, Entity* killer) {
if (killer != self && killer != nullptr) {
SpawnTargetDummy(self);
}
}
void NtCombatChallengeServer::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
auto totalDmg = self->GetVar<int32_t>(u"totalDmg");
totalDmg += damage;
self->SetVar(u"totalDmg", totalDmg);
self->SetNetworkVar(u"totalDmg", totalDmg);
GameMessages::SendPlayNDAudioEmitter(self, attacker->GetSystemAddress(), scoreSound);
}
void NtCombatChallengeServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
int32_t param2, int32_t param3) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"UI_Close", 0, 0, sender->GetObjectID(), "", sender->GetSystemAddress());
}
void NtCombatChallengeServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
if (identifier == u"PlayButton" && button == 1) {
self->SetNetworkVar(u"bInUse", true);
self->SetVar(u"playerID", sender->GetObjectID());
auto* inventoryComponent = sender->GetComponent<InventoryComponent>();
if (inventoryComponent != nullptr) {
inventoryComponent->RemoveItem(3039, 1);
}
GameMessages::SendPlayNDAudioEmitter(self, sender->GetSystemAddress(), startSound);
self->AddTimer("start_delay", 2.0f);
GameMessages::SendShowActivityCountdown(self->GetObjectID(), false, false, u"", 0, sender->GetSystemAddress());
self->SetNetworkVar(u"toggle", true);
} else if (identifier == u"CloseButton") {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"UI_Close", 1, 0, sender->GetObjectID(), "", sender->GetSystemAddress());
}
}
void NtCombatChallengeServer::SpawnTargetDummy(Entity* self) {
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
auto targetNumber = self->GetVar<int32_t>(u"TargetNumber");
if (targetNumber == 0) targetNumber = 1;
if (targetNumber > tTargets.size()) targetNumber = tTargets.size();
self->SetVar<int32_t>(u"TargetNumber", targetNumber + 1);
const auto dummyLOT = tTargets[targetNumber - 1];
EntityInfo info{};
info.lot = dummyLOT;
info.spawnerID = self->GetObjectID();
info.pos = self->GetPosition();
info.rot = self->GetRotation();
info.settings = { new LDFData<std::string>(u"custom_script_server", "scripts\\02_server\\Map\\NT\\L_NT_COMBAT_CHALLENGE_DUMMY.lua") };
auto* dummy = EntityManager::Instance()->CreateEntity(info);
dummy->SetVar(u"challengeObjectID", self->GetObjectID());
EntityManager::Instance()->ConstructEntity(dummy);
self->SetVar(u"currentDummy", dummy->GetObjectID());
}
void NtCombatChallengeServer::SetAttackImmunity(LWOOBJID objID, bool bTurnOn) {
}
void NtCombatChallengeServer::OnChildLoaded(Entity* self, Entity* child) {
auto targetNumber = self->GetVar<int32_t>(u"TargetNumber");
if (targetNumber == 0) targetNumber = 1;
self->SetVar(u"TargetNumber", targetNumber + 1);
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
child->SetRotation(NiQuaternion::LookAt(child->GetPosition(), player->GetPosition()));
self->SetVar(u"currentTargetID", child->GetObjectID());
EntityManager::Instance()->SerializeEntity(child);
child->GetGroups().push_back("targets_" + std::to_string(self->GetObjectID()));
}
void NtCombatChallengeServer::ResetGame(Entity* self) {
const auto totalDmg = self->GetVar<int32_t>(u"totalDmg");
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player != nullptr) {
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
for (const auto& mission : tMissions) {
if (totalDmg >= mission.damage) {
missionComponent->ForceProgressTaskType(mission.mission, 1, 1);
}
}
}
}
self->SetVar(u"TargetNumber", 1);
self->SetVar(u"playerID", LWOOBJID_EMPTY);
self->SetVar(u"totalDmg", 0);
self->SetNetworkVar(u"totalDmg", false);
self->SetNetworkVar(u"update_time", 0);
const auto& targetObjs = EntityManager::Instance()->GetEntitiesInGroup("targets_" + std::to_string(self->GetObjectID()));
for (auto* target : targetObjs) {
target->Smash(self->GetObjectID());
}
const auto currentID = self->GetVar<LWOOBJID>(u"currentDummy");
auto* current = EntityManager::Instance()->GetEntity(currentID);
if (current != nullptr) {
current->Smash(self->GetObjectID());
}
}
void NtCombatChallengeServer::OnActivityTimerUpdate(Entity* self, float timeRemaining) {
self->SetNetworkVar(u"update_time", std::ceil(timeRemaining));
if (timeRemaining <= 3) {
GameMessages::SendPlayNDAudioEmitter(self, UNASSIGNED_SYSTEM_ADDRESS, timerLowSound);
} else {
GameMessages::SendPlayNDAudioEmitter(self, UNASSIGNED_SYSTEM_ADDRESS, timerSound);
}
}
void NtCombatChallengeServer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "start_delay") {
self->SetVar(u"game_tick", gameTime);
SpawnTargetDummy(self);
self->AddTimer("game_tick", 1);
self->SetNetworkVar(u"totalTime", gameTime);
} else if (timerName == "game_tick") {
auto gameTick = self->GetVar<float>(u"game_tick");
gameTick -= 1;
self->SetVar(u"game_tick", gameTick);
if (gameTick <= 0) {
ResetGame(self);
GameMessages::SendPlayNDAudioEmitter(self, UNASSIGNED_SYSTEM_ADDRESS, stopSound);
self->AddTimer("reset_tick", 5);
} else {
self->AddTimer("game_tick", 1);
OnActivityTimerUpdate(self, gameTick);
}
} else if (timerName == "reset_tick") {
self->SetNetworkVar(u"toggle", false);
self->SetNetworkVar(u"bInUse", false);
}
}

View File

@@ -0,0 +1,47 @@
#pragma once
#include "CppScripts.h"
class NtCombatChallengeServer : public CppScripts::Script
{
public:
void OnUse(Entity* self, Entity* user) override;
void OnDie(Entity* self, Entity* killer) override;
void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) override;
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
void SpawnTargetDummy(Entity* self);
void SetAttackImmunity(LWOOBJID objID, bool bTurnOn);
void OnChildLoaded(Entity* self, Entity* child);
void ResetGame(Entity* self);
void OnActivityTimerUpdate(Entity* self, float timeRemaining);
void OnTimerDone(Entity* self, std::string timerName) override;
private:
float gameTime = 30.0f;
std::string startSound = "{a477f897-30da-4b15-8fce-895c6547adae}";
std::string stopSound = "{a832b9c5-b000-4c97-820a-2a7d1e68dd9d}";
std::string timerSound = "{79b38431-4fc7-403b-8ede-eaff700a7ab0}";
std::string timerLowSound = "{0e1f1284-e1c4-42ed-8ef9-93e8756948f8}";
std::string scoreSound = "{cfdade40-3d97-4cf5-b53c-862e0b84c1a1}";
std::vector<LOT> tTargets = {
13556, 13556, 13764, 13764, 13765, 13765,
13766, 13766, 13767, 13767, 13768, 13768,
13830, 13769, 13769, 13770, 13830, 13770,
13771, 13771, 13830, 13772
};
struct MissionRequirements
{
int32_t mission;
int32_t damage;
};
std::vector<MissionRequirements> tMissions = {
{1010, 25},
{1340, 100},
{1341, 240},
{1342, 290}
};
};

View File

@@ -0,0 +1,28 @@
#include "NtConsoleTeleportServer.h"
#include "Entity.h"
#include "AMFFormat.h"
void NtConsoleTeleportServer::OnStartup(Entity* self) {
self->SetVar(u"teleportAnim", m_TeleportAnim);
self->SetVar(u"teleportString", m_TeleportString);
}
void NtConsoleTeleportServer::OnUse(Entity* self, Entity* user) {
BaseOnUse(self, user);
}
void NtConsoleTeleportServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
BaseOnMessageBoxResponse(self, sender, button, identifier, userData);
}
void NtConsoleTeleportServer::OnChoiceBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) {
}
void NtConsoleTeleportServer::OnTimerDone(Entity* self, std::string timerName) {
BaseOnTimerDone(self, timerName);
}
void NtConsoleTeleportServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
BaseOnFireEventServerSide(self, sender, args, param1, param2, param3);
}

View File

@@ -0,0 +1,21 @@
#pragma once
#include "CppScripts.h"
#include "ChooseYourDestinationNsToNt.h"
#include "BaseConsoleTeleportServer.h"
class NtConsoleTeleportServer : public CppScripts::Script, BaseConsoleTeleportServer
{
public:
void OnStartup(Entity* self) override;
void OnUse(Entity* self, Entity* user) override;
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
void OnChoiceBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) override;
void OnTimerDone(Entity* self, std::string timerName) override;
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
private:
int32_t m_ChoiceZoneID = 1800;
std::string m_SpawnPoint = "NS_LW";
std::u16string m_TeleportAnim = u"lup-teleport";
std::u16string m_TeleportString = u"UI_TRAVEL_TO_CRUX_PRIME";
};

View File

@@ -0,0 +1,14 @@
#include "NtDarkitectRevealServer.h"
#include "Darkitect.h"
#include "MissionComponent.h"
void NtDarkitectRevealServer::OnUse(Entity* self, Entity* user) {
Darkitect Baron;
Baron.Reveal(self, user);
auto* missionComponent = user->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->ForceProgressTaskType(1344, 1, 14293);
}
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include "CppScripts.h"
class NtDarkitectRevealServer : public CppScripts::Script
{
public:
void OnUse(Entity* self, Entity* user) override;
};

View File

@@ -0,0 +1,46 @@
#include "NtDirtCloudServer.h"
#include "MissionComponent.h"
std::map<std::string, std::vector<int32_t>> NtDirtCloudServer::m_Missions =
{
{"Dirt_Clouds_Sent", {1333,1253}},
{"Dirt_Clouds_Assem", {1333,1276}},
{"Dirt_Clouds_Para", {1333,1277}},
{"Dirt_Clouds_Halls", {1333,1283}}
};
void NtDirtCloudServer::OnStartup(Entity* self) {
self->SetVar(u"CloudOn", true);
}
void NtDirtCloudServer::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
if (message != "soapspray") {
return;
}
if (!self->GetVar<bool>(u"CloudOn")) {
return;
}
const auto mySpawner = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
if (m_Missions.count(mySpawner) == 0) {
return;
}
const auto& myMis = m_Missions[mySpawner];
auto* missionComponent = caster->GetComponent<MissionComponent>();
if (missionComponent == nullptr) {
return;
}
for (const auto missionID : myMis) {
missionComponent->ForceProgressTaskType(missionID, 1, 1);
}
self->SetVar(u"CloudOn", false);
self->Smash(self->GetObjectID(), VIOLENT);
}

View File

@@ -0,0 +1,12 @@
#pragma once
#include "CppScripts.h"
class NtDirtCloudServer : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
private:
static std::map<std::string, std::vector<int32_t>> m_Missions;
};

View File

@@ -0,0 +1,38 @@
#include "NtDukeServer.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
void NtDukeServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 35.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_DUKE, 13548, 1319
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {
{ "DUKE_NT_CONVO_1", 0 },
{ "DUKE_NT_CONVO_2", 0 },
{ "DUKE_NT_CONVO_3", 0 },
});
// If there's an alternating conversation, indices should be provided using the conversationID variables
self->SetVar<std::vector<LWOOBJID>>(m_SpyCinematicObjectsVariable, { self->GetObjectID() });
}
void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
// Handles adding and removing the sword for the Crux Prime Sword mission
auto* missionComponent = target->GetComponent<MissionComponent>();
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
if (missionComponent != nullptr && inventoryComponent != nullptr) {
auto state = missionComponent->GetMissionState(m_SwordMissionID);
auto lotCount = inventoryComponent->GetLotCount(m_SwordLot);
if ((state == MissionState::MISSION_STATE_AVAILABLE || state == MissionState::MISSION_STATE_ACTIVE) && lotCount < 1) {
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
} else if (state == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
}
}
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "NtFactionSpyServer.h"
class NtDukeServer : public NtFactionSpyServer {
void SetVariables(Entity* self) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
const uint32_t m_SwordMissionID = 1448;
const LOT m_SwordLot = 13777;
};

View File

@@ -0,0 +1,20 @@
#include "NtHaelServer.h"
#include "Entity.h"
void NtHaelServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 25.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_HAEL, 13892, 1321
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {
{ "HAEL_NT_CONVO_1", 0 },
{ "HAEL_NT_CONVO_2", 0 },
{ "HAEL_NT_CONVO_3", 0 },
{ "HAEL_NT_CONVO_4", 0 },
});
// If there's an alternating conversation, indices should be provided using the conversationID variables
self->SetVar<std::vector<LWOOBJID>>(m_SpyCinematicObjectsVariable, { self->GetObjectID() });
}

View File

@@ -0,0 +1,6 @@
#pragma once
#include "NtFactionSpyServer.h"
class NtHaelServer : public NtFactionSpyServer {
void SetVariables(Entity* self) override;
};

View File

@@ -0,0 +1,53 @@
#include "NtImagBeamBuffer.h"
#include "EntityManager.h"
#include "SkillComponent.h"
void NtImagBeamBuffer::OnStartup(Entity* self) {
self->SetProximityRadius(100, "ImagZone");
self->AddTimer("BuffImag", 2.0f);
}
void NtImagBeamBuffer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (name != "ImagZone" || !entering->IsPlayer()) {
return;
}
if (status == "ENTER") {
const auto& iter = std::find(m_EntitiesInProximity.begin(), m_EntitiesInProximity.end(), entering->GetObjectID());
if (iter == m_EntitiesInProximity.end()) {
m_EntitiesInProximity.push_back(entering->GetObjectID());
}
} else if (status == "LEAVE") {
const auto& iter = std::find(m_EntitiesInProximity.begin(), m_EntitiesInProximity.end(), entering->GetObjectID());
if (iter != m_EntitiesInProximity.end()) {
m_EntitiesInProximity.erase(iter);
}
}
}
void NtImagBeamBuffer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != "BuffImag") {
return;
}
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent == nullptr) {
return;
}
for (const auto entityID : m_EntitiesInProximity) {
auto* entity = EntityManager::Instance()->GetEntity(entityID);
if (entity == nullptr) {
continue;
}
skillComponent->CalculateBehavior(1311, 30235, entityID, true);
}
self->AddTimer("BuffImag", 2.0f);
}

View File

@@ -0,0 +1,13 @@
#pragma once
#include "CppScripts.h"
class NtImagBeamBuffer : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
void OnTimerDone(Entity* self, std::string timerName) override;
private:
std::vector<LWOOBJID> m_EntitiesInProximity = {};
};

View File

@@ -0,0 +1,11 @@
#include "NtImagimeterVisibility.h"
#include "GameMessages.h"
#include "Entity.h"
#include "Character.h"
void NTImagimeterVisibility::OnRebuildComplete(Entity* self, Entity* target) {
auto* character = target->GetCharacter();
if (character) character->SetPlayerFlag(ePlayerFlags::NT_PLINTH_REBUILD, true);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PlinthBuilt", 0, 0, LWOOBJID_EMPTY, "", target->GetSystemAddress());
}

View File

@@ -0,0 +1,7 @@
#pragma once
#include "CppScripts.h"
class NTImagimeterVisibility : public CppScripts::Script {
public:
void OnRebuildComplete(Entity* self, Entity* target) override;
};

View File

@@ -0,0 +1,30 @@
#include "NtOverbuildServer.h"
#include "EntityManager.h"
void NtOverbuildServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 30.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_OVERBUILD, 13891, 1320
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {
{ "OVERBUILD_NT_CONVO_1", 0 },
{ "OVERBUILD_NT_CONVO_2", 1 },
{ "OVERBUILD_NT_CONVO_3", 0 },
{ "OVERBUILD_NT_CONVO_4", 1 },
{ "OVERBUILD_NT_CONVO_5", 0 },
{ "OVERBUILD_NT_CONVO_6", 1 },
{ "OVERBUILD_NT_CONVO_7", 0 },
});
// Find the second object Dr. Overbuild interacts with
LWOOBJID otherConvoObjectID = LWOOBJID_EMPTY;
for (auto* otherConvoObject : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(m_OtherEntitiesGroupVariable)))) {
otherConvoObjectID = otherConvoObject->GetObjectID();
break;
}
// If there's an alternating conversation, indices should be provided using the conversationID variables
self->SetVar<std::vector<LWOOBJID>>(m_SpyCinematicObjectsVariable, { self->GetObjectID(), otherConvoObjectID });
}

View File

@@ -0,0 +1,7 @@
#pragma once
#include "NtFactionSpyServer.h"
class NtOverbuildServer : public NtFactionSpyServer {
void SetVariables(Entity* self) override;
const std::u16string m_OtherEntitiesGroupVariable = u"SpyConvo2Group";
};

View File

@@ -0,0 +1,66 @@
#include "NtParadoxPanelServer.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "EntityManager.h"
#include "Character.h"
void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"bActive", 1, 0, user->GetObjectID(), "", user->GetSystemAddress());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
self->SetVar(u"bActive", true);
auto* missionComponent = user->GetComponent<MissionComponent>();
const auto playerID = user->GetObjectID();
for (const auto mission : tPlayerOnMissions) {
if (missionComponent->GetMissionState(mission) != MissionState::MISSION_STATE_ACTIVE) {
continue;
}
self->AddCallbackTimer(2, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
const auto flag = self->GetVar<int32_t>(u"flag");
player->GetCharacter()->SetPlayerFlag(flag, true);
GameMessages::SendPlayAnimation(player, u"rebuild-celebrate");
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SparkStop", 0, 0, player->GetObjectID(), "", player->GetSystemAddress());
GameMessages::SendSetStunned(player->GetObjectID(), eStunState::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
self->SetVar(u"bActive", false);
});
GameMessages::SendPlayAnimation(user, u"nexus-powerpanel", 6.0f);
GameMessages::SendSetStunned(user->GetObjectID(), eStunState::PUSH, user->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
return;
}
GameMessages::SendPlayAnimation(user, shockAnim);
const auto dir = self->GetRotation().GetRightVector();
GameMessages::SendKnockback(user->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, { dir.x * 15, 5, dir.z * 15 });
GameMessages::SendPlayFXEffect(self, 6432, u"create", "console_sparks", LWOOBJID_EMPTY, 1.0, 1.0, true);
self->AddCallbackTimer(2, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"bActive", 0, 0, player->GetObjectID(), "", player->GetSystemAddress());
GameMessages::SendStopFXEffect(self, true, "console_sparks");
self->SetVar(u"bActive", false);
});
}

View File

@@ -0,0 +1,13 @@
#pragma once
#include "CppScripts.h"
class NtParadoxPanelServer : public CppScripts::Script
{
public:
void OnUse(Entity* self, Entity* user) override;
private:
std::u16string shockAnim = u"knockback-recovery";
float fxTime = 2.0;
std::vector<int32_t> tPlayerOnMissions = { 1278, 1279, 1280, 1281 };
};

View File

@@ -0,0 +1,113 @@
#include "NtParadoxTeleServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
void NtParadoxTeleServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");
}
void NtParadoxTeleServer::OnPlayerLoaded(Entity* self, Entity* player) {
}
void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (status != "ENTER" || !entering->IsPlayer() || name != "teleport") return;
auto* player = entering;
const auto playerID = player->GetObjectID();
const auto iter = m_TeleportingPlayerTable.find(playerID);
if (iter == m_TeleportingPlayerTable.end()) m_TeleportingPlayerTable[playerID] = false;
const auto bPlayerBeingTeleported = m_TeleportingPlayerTable[playerID];
if (player->IsPlayer() && !bPlayerBeingTeleported) {
GameMessages::SendSetStunned(playerID, PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
GameMessages::SendPlayAnimation(player, u"teledeath", 4.0f);
const auto animTime = 2;
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
TeleportPlayer(self, player);
});
}
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
}
}
void NtParadoxTeleServer::TeleportPlayer(Entity* self, Entity* player) {
auto destinationGroup = self->GetVar<std::u16string>(u"teleGroup");
auto* destination = self;
if (!destinationGroup.empty()) {
const auto& groupObjs = EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
if (!groupObjs.empty()) {
destination = groupObjs[0];
}
}
const auto destPosition = destination->GetPosition();
const auto destRotation = destination->GetRotation();
auto teleCinematic = self->GetVar<std::u16string>(u"Cinematic");
if (!teleCinematic.empty()) {
const auto teleCinematicUname = teleCinematic;
GameMessages::SendPlayCinematic(player->GetObjectID(), teleCinematicUname, player->GetSystemAddress());
}
GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"paradox-teleport-in", 4.0f);
const auto animTime = 2;
const auto playerID = player->GetObjectID();
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
UnlockPlayer(self, player);
});
const auto useSound = self->GetVar<std::string>(u"sound1");
if (!useSound.empty()) {
GameMessages::SendPlayNDAudioEmitter(player, player->GetSystemAddress(), useSound);
}
}
void NtParadoxTeleServer::UnlockPlayer(Entity* self, Entity* player) {
const auto playerID = player->GetObjectID();
m_TeleportingPlayerTable[playerID] = false;
GameMessages::SendSetStunned(playerID, POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
auto teleCinematic = self->GetVar<std::u16string>(u"Cinematic");
if (!teleCinematic.empty()) {
const auto teleCinematicUname = teleCinematic;
GameMessages::SendEndCinematic(player->GetObjectID(), teleCinematicUname, player->GetSystemAddress());
}
}

View File

@@ -0,0 +1,15 @@
#pragma once
#include "CppScripts.h"
class NtParadoxTeleServer : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnPlayerLoaded(Entity* self, Entity* player) override;
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
void TeleportPlayer(Entity* self, Entity* player);
void UnlockPlayer(Entity* self, Entity* player);
private:
std::map<LWOOBJID, bool> m_TeleportingPlayerTable;
};

View File

@@ -0,0 +1,43 @@
#include "NtSentinelWalkwayServer.h"
#include "PhantomPhysicsComponent.h"
#include "EntityManager.h"
#include "MissionComponent.h"
void NtSentinelWalkwayServer::OnStartup(Entity* self) {
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
if (phantomPhysicsComponent == nullptr) {
return;
}
auto force = self->GetVar<int32_t>(u"force");
if (force == 0) {
force = 115;
}
const auto forward = self->GetRotation().GetRightVector() * -1;
phantomPhysicsComponent->SetEffectType(0); // PUSH
phantomPhysicsComponent->SetDirectionalMultiplier(force);
phantomPhysicsComponent->SetDirection(forward);
phantomPhysicsComponent->SetPhysicsEffectActive(true);
EntityManager::Instance()->SerializeEntity(self);
self->SetProximityRadius(3, "speedboost");
}
void NtSentinelWalkwayServer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (name != "speedboost" || !entering->IsPlayer() || status != "ENTER") {
return;
}
auto* player = entering;
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
}
}

View File

@@ -0,0 +1,11 @@
#pragma once
#include "CppScripts.h"
class NtSentinelWalkwayServer : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
private:
const std::vector<int32_t> m_MissionsToUpdate = { 1047, 1330, 1331, 1332 };
};

View File

@@ -0,0 +1,35 @@
#include "NtSleepingGuard.h"
#include "GameMessages.h"
#include "MissionComponent.h"
void NtSleepingGuard::OnStartup(Entity* self) {
self->SetNetworkVar<bool>(u"asleep", true);
}
void NtSleepingGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
if (!self->GetNetworkVar<bool>(u"asleep"))
return;
// Check if emote is in m_ValidEmotes
if (std::find(m_ValidEmotes.begin(), m_ValidEmotes.end(), emote) == m_ValidEmotes.end())
return;
// Set asleep to false
self->SetNetworkVar<bool>(u"asleep", false);
GameMessages::SendPlayAnimation(self, u"greet");
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->CompleteMission(1346);
}
self->AddTimer("AsleepAgain", 5.0f);
}
void NtSleepingGuard::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "AsleepAgain") {
self->SetNetworkVar<bool>(u"asleep", true);
}
}

View File

@@ -0,0 +1,13 @@
#pragma once
#include "CppScripts.h"
class NtSleepingGuard final : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnEmoteReceived(Entity* self, int32_t emote, Entity* target) override;
void OnTimerDone(Entity* self, std::string timerName) override;
private:
std::vector<int32_t> m_ValidEmotes = { 175,372,354,356,374,115,210,373,392,352,364,69,174,386,375,384,376,385,393,383 };
};

View File

@@ -0,0 +1,13 @@
#include "NtVandaServer.h"
#include "InventoryComponent.h"
void NtVandaServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
// Removes the alien parts after completing the mission
if (missionID == m_AlienPartMissionID && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
for (const auto& alienPartLot : m_AlienPartLots) {
inventoryComponent->RemoveItem(alienPartLot, 1);
}
}
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include "CppScripts.h"
class NtVandaServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
const uint32_t m_AlienPartMissionID = 1183;
const std::vector<LOT> m_AlienPartLots = { 12479, 12480, 12481 };
};

View File

@@ -0,0 +1,122 @@
#include "NtVentureCannonServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
auto* player = user;
const auto playerID = player->GetObjectID();
auto enterCinematic = self->GetVar<std::u16string>(u"EnterCinematic");
if (enterCinematic.empty()) {
return;
}
self->SetNetworkVar(u"bIsInUse", true);
GameMessages::SendSetStunned(playerID, PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
auto destPosition = self->GetPosition();
destPosition.y += 5 - 1.57f;
auto destRotation = self->GetRotation();
GameMessages::SendTeleport(playerID, destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"scale-down", 4.0f);
const auto enterCinematicUname = enterCinematic;
GameMessages::SendPlayCinematic(player->GetObjectID(), enterCinematicUname, player->GetSystemAddress());
GameMessages::SendPlayNDAudioEmitter(player, player->GetSystemAddress(), "{e8bf79ce-7453-4a7d-b872-fee65e97ff15}");
self->AddCallbackTimer(3, [this, self]() {
self->SetNetworkVar(u"bIsInUse", false);
});
self->AddCallbackTimer(1.5f, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
EnterCannonEnded(self, player);
});
}
void NtVentureCannonServer::EnterCannonEnded(Entity* self, Entity* player) {
const auto playerID = player->GetObjectID();
const auto& cannonEffectGroup = EntityManager::Instance()->GetEntitiesInGroup("cannonEffect");
if (!cannonEffectGroup.empty()) {
auto* cannonEffect = cannonEffectGroup[0];
GameMessages::SendPlayFXEffect(cannonEffect, 6036, u"create", "cannon_blast", LWOOBJID_EMPTY, 1, 1, true);
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(cannonEffect, u"camshake-bridge", cannonEffect->GetObjectID(), 100);
}
FirePlayer(self, player);
auto exitCinematic = self->GetVar<std::u16string>(u"ExitCinematic");
if (exitCinematic.empty()) {
UnlockCannonPlayer(self, player);
return;
}
const auto exitCinematicUname = exitCinematic;
GameMessages::SendPlayCinematic(player->GetObjectID(), exitCinematicUname, player->GetSystemAddress(),
true, true, true, false, 0, false, 0, false, false
);
self->AddCallbackTimer(1.5f, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
if (player == nullptr) {
return;
}
ExitCannonEnded(self, player);
});
}
void NtVentureCannonServer::ExitCannonEnded(Entity* self, Entity* player) {
UnlockCannonPlayer(self, player);
}
void NtVentureCannonServer::UnlockCannonPlayer(Entity* self, Entity* player) {
GameMessages::SendSetStunned(player->GetObjectID(), POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
self->SetNetworkVar(u"bIsInUse", false);
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
}
void NtVentureCannonServer::FirePlayer(Entity* self, Entity* player) {
auto destinationGroup = self->GetVar<std::u16string>(u"teleGroup");
auto* destination = self;
if (!destinationGroup.empty()) {
const auto& groupObjs = EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
if (!groupObjs.empty()) {
destination = groupObjs[0];
}
}
const auto destPosition = destination->GetPosition();
const auto destRotation = destination->GetRotation();
GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"venture-cannon-out", 4.0f);
}

View File

@@ -0,0 +1,12 @@
#pragma once
#include "CppScripts.h"
class NtVentureCannonServer : public CppScripts::Script
{
public:
void OnUse(Entity* self, Entity* user) override;
void EnterCannonEnded(Entity* self, Entity* player);
void ExitCannonEnded(Entity* self, Entity* player);
void UnlockCannonPlayer(Entity* self, Entity* player);
void FirePlayer(Entity* self, Entity* player);
};

View File

@@ -0,0 +1,28 @@
#include "NtVentureSpeedPadServer.h"
#include "SkillComponent.h"
#include "MissionComponent.h"
void NtVentureSpeedPadServer::OnStartup(Entity* self) {
self->SetProximityRadius(3, "speedboost");
}
void NtVentureSpeedPadServer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (name != "speedboost" || !entering->IsPlayer() || status != "ENTER") {
return;
}
auto* player = entering;
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
}
auto* skillComponent = player->GetComponent<SkillComponent>();
if (skillComponent != nullptr) {
skillComponent->CalculateBehavior(927, 18913, player->GetObjectID(), true);
}
}

View File

@@ -0,0 +1,11 @@
#pragma once
#include "CppScripts.h"
class NtVentureSpeedPadServer : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
private:
const std::vector<int32_t> m_MissionsToUpdate = { 1047, 1330, 1331, 1332 };
};

View File

@@ -0,0 +1,12 @@
#include "NtXRayServer.h"
#include "SkillComponent.h"
void NtXRayServer::OnCollisionPhantom(Entity* self, Entity* target) {
auto* skillComponent = target->GetComponent<SkillComponent>();
if (skillComponent == nullptr) {
return;
}
skillComponent->CalculateBehavior(1220, 27641, target->GetObjectID());
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include "CppScripts.h"
class NtXRayServer : public CppScripts::Script
{
public:
void OnCollisionPhantom(Entity* self, Entity* target) override;
};

View File

@@ -0,0 +1,10 @@
#include "SpawnSaberCatServer.h"
#include "Entity.h"
void SpawnSaberCatServer::SetVariables(Entity* self) {
self->SetVar<LOT>(u"petLOT", 12432);
self->SetVar<std::string>(u"petType", "sabercat");
self->SetVar<uint32_t>(u"maxPets", 3);
self->SetVar<std::u16string>(u"spawnAnim", u"pq_m_drop-down");
self->SetVar<std::u16string>(u"spawnCinematic", u"AssemblyPet");
}

View File

@@ -0,0 +1,6 @@
#pragma once
#include "SpawnPetBaseServer.h"
class SpawnSaberCatServer : public SpawnPetBaseServer {
void SetVariables(Entity* self) override;
};

View File

@@ -0,0 +1,10 @@
#include "SpawnShrakeServer.h"
#include "Entity.h"
void SpawnShrakeServer::SetVariables(Entity* self) {
self->SetVar<LOT>(u"petLOT", 12434);
self->SetVar<std::string>(u"petType", "shrake");
self->SetVar<uint32_t>(u"maxPets", 3);
self->SetVar<std::u16string>(u"spawnAnim", u"mf_u_g_TT_spawn-1");
self->SetVar<std::u16string>(u"spawnCinematic", u"ParadoxPet");
}

View File

@@ -0,0 +1,6 @@
#pragma once
#include "SpawnPetBaseServer.h"
class SpawnShrakeServer : public SpawnPetBaseServer {
void SetVariables(Entity* self) override;
};

View File

@@ -0,0 +1,10 @@
#include "SpawnStegoServer.h"
#include "Entity.h"
void SpawnStegoServer::SetVariables(Entity* self) {
self->SetVar<LOT>(u"petLOT", 12431);
self->SetVar<std::string>(u"petType", "stego");
self->SetVar<uint32_t>(u"maxPets", 3);
self->SetVar<std::u16string>(u"spawnAnim", u"spawn");
self->SetVar<std::u16string>(u"spawnCinematic", u"VenturePet");
}

View File

@@ -0,0 +1,6 @@
#pragma once
#include "SpawnPetBaseServer.h"
class SpawnStegoServer : public SpawnPetBaseServer {
void SetVariables(Entity* self) override;
};