mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +00:00
format codebase
This commit is contained in:
@@ -8,8 +8,7 @@ void ActMine::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(MINE_RADIUS, "mineRadius");
|
||||
}
|
||||
|
||||
void ActMine::OnRebuildNotifyState(Entity* self, eRebuildState state)
|
||||
{
|
||||
void ActMine::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == eRebuildState::REBUILD_COMPLETED) {
|
||||
auto* rebuild = self->GetComponent<RebuildComponent>();
|
||||
if (rebuild) {
|
||||
@@ -35,7 +34,7 @@ void ActMine::OnProximityUpdate(Entity* self, Entity* entering, std::string name
|
||||
|
||||
void ActMine::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "Tick") {
|
||||
if (self->GetVar<int>(u"NumWarnings") >= MAX_WARNINGS){
|
||||
if (self->GetVar<int>(u"NumWarnings") >= MAX_WARNINGS) {
|
||||
auto* skill = self->GetComponent<SkillComponent>();
|
||||
if (!skill) return;
|
||||
skill->CalculateBehavior(SKILL_ID, BEHAVIOR_ID, LWOOBJID_EMPTY);
|
||||
@@ -50,4 +49,4 @@ void ActMine::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "BlowedUp") {
|
||||
self->Kill(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,17 +2,17 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class ActMine : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnRebuildNotifyState(Entity* self, eRebuildState state) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
int MAX_WARNINGS = 3;
|
||||
float MINE_RADIUS = 10.0;
|
||||
float TICK_TIME = 0.25;
|
||||
float BLOWED_UP_TIME = 0.1;
|
||||
uint32_t SKILL_ID = 317;
|
||||
uint32_t BEHAVIOR_ID = 3719;
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnRebuildNotifyState(Entity* self, eRebuildState state) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
int MAX_WARNINGS = 3;
|
||||
float MINE_RADIUS = 10.0;
|
||||
float TICK_TIME = 0.25;
|
||||
float BLOWED_UP_TIME = 0.1;
|
||||
uint32_t SKILL_ID = 317;
|
||||
uint32_t BEHAVIOR_ID = 3719;
|
||||
};
|
||||
|
||||
|
@@ -1,23 +1,17 @@
|
||||
#include "ActNinjaTurret.h"
|
||||
|
||||
void ActNinjaTurret::OnRebuildNotifyState(Entity* self, eRebuildState state)
|
||||
{
|
||||
if (state == eRebuildState::REBUILD_COMPLETED)
|
||||
{
|
||||
self->SetVar(u"AmBuilt", true);
|
||||
}
|
||||
else if (state == eRebuildState::REBUILD_RESETTING)
|
||||
{
|
||||
self->SetVar(u"AmBuilt", false);
|
||||
}
|
||||
void ActNinjaTurret::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == eRebuildState::REBUILD_COMPLETED) {
|
||||
self->SetVar(u"AmBuilt", true);
|
||||
} else if (state == eRebuildState::REBUILD_RESETTING) {
|
||||
self->SetVar(u"AmBuilt", false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ActNinjaTurret::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3)
|
||||
{
|
||||
if (args == "ISpawned" && self->GetVar<bool>(u"AmBuilt"))
|
||||
{
|
||||
sender->Smash();
|
||||
}
|
||||
ActNinjaTurret::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args == "ISpawned" && self->GetVar<bool>(u"AmBuilt")) {
|
||||
sender->Smash();
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ class ActNinjaTurret : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnRebuildNotifyState(Entity* self, eRebuildState state) override;
|
||||
void OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
};
|
||||
|
||||
|
@@ -4,70 +4,58 @@
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target)
|
||||
{
|
||||
const auto myGroup = "AllPipes";
|
||||
void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
const auto myGroup = "AllPipes";
|
||||
|
||||
const auto groupObjs = EntityManager::Instance()->GetEntitiesInGroup(myGroup);
|
||||
const auto groupObjs = EntityManager::Instance()->GetEntitiesInGroup(myGroup);
|
||||
|
||||
auto indexCount = 0;
|
||||
auto indexCount = 0;
|
||||
|
||||
self->SetVar(u"PlayerID", target->GetObjectID());
|
||||
self->SetVar(u"PlayerID", target->GetObjectID());
|
||||
|
||||
for (auto* object : groupObjs)
|
||||
{
|
||||
if (object == self)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (auto* object : groupObjs) {
|
||||
if (object == self) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* rebuildComponent = object->GetComponent<RebuildComponent>();
|
||||
auto* rebuildComponent = object->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == REBUILD_COMPLETED)
|
||||
{
|
||||
indexCount++;
|
||||
}
|
||||
}
|
||||
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
|
||||
indexCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (indexCount >= 2)
|
||||
{
|
||||
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
|
||||
if (indexCount >= 2) {
|
||||
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
|
||||
|
||||
if (!refinery.empty())
|
||||
{
|
||||
GameMessages::SendPlayFXEffect(refinery[0]->GetObjectID(), 3999, u"create", "pipeFX");
|
||||
}
|
||||
if (!refinery.empty()) {
|
||||
GameMessages::SendPlayFXEffect(refinery[0]->GetObjectID(), 3999, u"create", "pipeFX");
|
||||
}
|
||||
|
||||
for (auto* object : groupObjs)
|
||||
{
|
||||
auto* player = EntityManager::Instance()->GetEntity(object->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
for (auto* object : groupObjs) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(object->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
|
||||
if (player != nullptr)
|
||||
{
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (player != nullptr) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr)
|
||||
{
|
||||
missionComponent->ForceProgressTaskType(769, 1, 1, false);
|
||||
}
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->ForceProgressTaskType(769, 1, 1, false);
|
||||
}
|
||||
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), u"ParadoxPipeFinish", player->GetSystemAddress(), true, true, false, false, 0, false, 2.0f);
|
||||
}
|
||||
|
||||
object->SetVar(u"PlayerID", LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), u"ParadoxPipeFinish", player->GetSystemAddress(), true, true, false, false, 0, false, 2.0f);
|
||||
}
|
||||
|
||||
object->SetVar(u"PlayerID", LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActParadoxPipeFix::OnRebuildNotifyState(Entity* self, eRebuildState state)
|
||||
{
|
||||
if (state == REBUILD_RESETTING)
|
||||
{
|
||||
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
|
||||
void ActParadoxPipeFix::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == REBUILD_RESETTING) {
|
||||
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
|
||||
|
||||
if (!refinery.empty())
|
||||
{
|
||||
GameMessages::SendStopFXEffect(refinery[0], true, "pipeFX");
|
||||
}
|
||||
}
|
||||
if (!refinery.empty()) {
|
||||
GameMessages::SendStopFXEffect(refinery[0], true, "pipeFX");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
class ActParadoxPipeFix : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnRebuildNotifyState(Entity* self, eRebuildState state) override;
|
||||
};
|
||||
|
||||
|
@@ -1,8 +1,7 @@
|
||||
#include "ActPlayerDeathTrigger.h"
|
||||
|
||||
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target)
|
||||
{
|
||||
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target->IsPlayer() || target->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||
|
||||
target->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
|
||||
target->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@
|
||||
#include "MissionTaskType.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == "achieve") {
|
||||
auto missionComponent = sender->GetComponent<MissionComponent>();
|
||||
if (!missionComponent) return;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
class ActSharkPlayerDeathTrigger : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
};
|
||||
|
||||
|
@@ -7,56 +7,46 @@
|
||||
#include "PossessorComponent.h"
|
||||
|
||||
|
||||
void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target)
|
||||
{
|
||||
auto* possessableComponent = target->GetComponent<PossessableComponent>();
|
||||
void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
auto* possessableComponent = target->GetComponent<PossessableComponent>();
|
||||
|
||||
Entity* vehicle;
|
||||
Entity* player;
|
||||
Entity* vehicle;
|
||||
Entity* player;
|
||||
|
||||
if (possessableComponent != nullptr)
|
||||
{
|
||||
auto* player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
if (possessableComponent != nullptr) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (target->IsPlayer())
|
||||
{
|
||||
auto* possessorComponent = target->GetComponent<PossessorComponent>();
|
||||
return;
|
||||
} else if (target->IsPlayer()) {
|
||||
auto* possessorComponent = target->GetComponent<PossessorComponent>();
|
||||
|
||||
if (possessorComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (possessorComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (vehicle == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
player = target;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player = target;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, VIOLENT, u"", 0, 0, 0, true, false, 0);
|
||||
|
||||
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, VIOLENT, u"", 0, 0, 0, true, false, 0);
|
||||
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
|
||||
|
||||
if (racingControlComponent != nullptr)
|
||||
{
|
||||
racingControlComponent->OnRequestDie(player);
|
||||
}
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
|
||||
if (racingControlComponent != nullptr) {
|
||||
racingControlComponent->OnRequestDie(player);
|
||||
}
|
||||
}
|
||||
|
@@ -6,215 +6,212 @@
|
||||
#include <algorithm>
|
||||
#include "dLogger.h"
|
||||
|
||||
bool ActivityManager::IsPlayerInActivity(Entity *self, LWOOBJID playerID) {
|
||||
const auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
return sac != nullptr && sac->IsPlayedBy(playerID);
|
||||
bool ActivityManager::IsPlayerInActivity(Entity* self, LWOOBJID playerID) {
|
||||
const auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
return sac != nullptr && sac->IsPlayedBy(playerID);
|
||||
}
|
||||
|
||||
void ActivityManager::UpdatePlayer(Entity *self, LWOOBJID playerID, const bool remove) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return;
|
||||
void ActivityManager::UpdatePlayer(Entity* self, LWOOBJID playerID, const bool remove) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return;
|
||||
|
||||
if (remove) {
|
||||
sac->PlayerRemove(playerID);
|
||||
} else {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player != nullptr) {
|
||||
sac->PlayerJoin(player);
|
||||
SetActivityScore(self, playerID, 0);
|
||||
}
|
||||
}
|
||||
if (remove) {
|
||||
sac->PlayerRemove(playerID);
|
||||
} else {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player != nullptr) {
|
||||
sac->PlayerJoin(player);
|
||||
SetActivityScore(self, playerID, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActivityManager::SetActivityScore(Entity *self, LWOOBJID playerID, uint32_t score) {
|
||||
SetActivityValue(self, playerID, 0, score);
|
||||
void ActivityManager::SetActivityScore(Entity* self, LWOOBJID playerID, uint32_t score) {
|
||||
SetActivityValue(self, playerID, 0, score);
|
||||
}
|
||||
|
||||
void ActivityManager::SetActivityValue(Entity *self, const LWOOBJID playerID, const uint32_t valueIndex,
|
||||
const float_t value) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return;
|
||||
void ActivityManager::SetActivityValue(Entity* self, const LWOOBJID playerID, const uint32_t valueIndex,
|
||||
const float_t value) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return;
|
||||
|
||||
sac->SetActivityValue(playerID, valueIndex, value);
|
||||
sac->SetActivityValue(playerID, valueIndex, value);
|
||||
}
|
||||
|
||||
float_t ActivityManager::GetActivityValue(Entity *self, const LWOOBJID playerID, const uint32_t valueIndex) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return -1.0f;
|
||||
float_t ActivityManager::GetActivityValue(Entity* self, const LWOOBJID playerID, const uint32_t valueIndex) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return -1.0f;
|
||||
|
||||
return sac->GetActivityValue(playerID, valueIndex);
|
||||
return sac->GetActivityValue(playerID, valueIndex);
|
||||
}
|
||||
|
||||
void ActivityManager::StopActivity(Entity *self, const LWOOBJID playerID, const uint32_t score,
|
||||
const uint32_t value1, const uint32_t value2, bool quit) {
|
||||
int32_t gameID = 0;
|
||||
void ActivityManager::StopActivity(Entity* self, const LWOOBJID playerID, const uint32_t score,
|
||||
const uint32_t value1, const uint32_t value2, bool quit) {
|
||||
int32_t gameID = 0;
|
||||
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr) {
|
||||
gameID = self->GetLOT();
|
||||
}
|
||||
else {
|
||||
gameID = sac->GetActivityID();
|
||||
}
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr) {
|
||||
gameID = self->GetLOT();
|
||||
} else {
|
||||
gameID = sac->GetActivityID();
|
||||
}
|
||||
|
||||
if (quit) {
|
||||
UpdatePlayer(self, playerID, true);
|
||||
} else {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
if (quit) {
|
||||
UpdatePlayer(self, playerID, true);
|
||||
} else {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
SetActivityScore(self, playerID, score);
|
||||
SetActivityValue(self, playerID, 1, value1);
|
||||
SetActivityValue(self, playerID, 2, value2);
|
||||
SetActivityScore(self, playerID, score);
|
||||
SetActivityValue(self, playerID, 1, value1);
|
||||
SetActivityValue(self, playerID, 2, value2);
|
||||
|
||||
LootGenerator::Instance().GiveActivityLoot(player, self, gameID, CalculateActivityRating(self, playerID));
|
||||
LootGenerator::Instance().GiveActivityLoot(player, self, gameID, CalculateActivityRating(self, playerID));
|
||||
|
||||
// Save the new score to the leaderboard and show the leaderboard to the player
|
||||
LeaderboardManager::SaveScore(playerID, gameID, score, value1);
|
||||
const auto* leaderboard = LeaderboardManager::GetLeaderboard(gameID, InfoType::Standings,
|
||||
false, player->GetObjectID());
|
||||
GameMessages::SendActivitySummaryLeaderboardData(self->GetObjectID(), leaderboard, player->GetSystemAddress());
|
||||
delete leaderboard;
|
||||
// Save the new score to the leaderboard and show the leaderboard to the player
|
||||
LeaderboardManager::SaveScore(playerID, gameID, score, value1);
|
||||
const auto* leaderboard = LeaderboardManager::GetLeaderboard(gameID, InfoType::Standings,
|
||||
false, player->GetObjectID());
|
||||
GameMessages::SendActivitySummaryLeaderboardData(self->GetObjectID(), leaderboard, player->GetSystemAddress());
|
||||
delete leaderboard;
|
||||
|
||||
// Makes the leaderboard show up for the player
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard",
|
||||
gameID,0, playerID, "",
|
||||
player->GetSystemAddress());
|
||||
// Makes the leaderboard show up for the player
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard",
|
||||
gameID, 0, playerID, "",
|
||||
player->GetSystemAddress());
|
||||
|
||||
if (sac != nullptr) {
|
||||
sac->PlayerRemove(player->GetObjectID());
|
||||
}
|
||||
}
|
||||
if (sac != nullptr) {
|
||||
sac->PlayerRemove(player->GetObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ActivityManager::TakeActivityCost(const Entity *self, const LWOOBJID playerID) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return false;
|
||||
bool ActivityManager::TakeActivityCost(const Entity* self, const LWOOBJID playerID) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return false;
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player == nullptr)
|
||||
return false;
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player == nullptr)
|
||||
return false;
|
||||
|
||||
return sac->TakeCost(player);
|
||||
return sac->TakeCost(player);
|
||||
}
|
||||
|
||||
uint32_t ActivityManager::CalculateActivityRating(Entity *self, const LWOOBJID playerID) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return 0;
|
||||
uint32_t ActivityManager::CalculateActivityRating(Entity* self, const LWOOBJID playerID) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr)
|
||||
return 0;
|
||||
|
||||
return sac->GetInstance(playerID)->GetParticipants().size();
|
||||
return sac->GetInstance(playerID)->GetParticipants().size();
|
||||
}
|
||||
|
||||
uint32_t ActivityManager::GetActivityID(const Entity* self) {
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
return sac != nullptr ? sac->GetActivityID() : 0;
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
return sac != nullptr ? sac->GetActivityID() : 0;
|
||||
}
|
||||
|
||||
void ActivityManager::GetLeaderboardData(Entity *self, const LWOOBJID playerID, const uint32_t activityID, uint32_t numResults) {
|
||||
LeaderboardManager::SendLeaderboard(activityID, Standings, false, self->GetObjectID(), playerID);
|
||||
void ActivityManager::GetLeaderboardData(Entity* self, const LWOOBJID playerID, const uint32_t activityID, uint32_t numResults) {
|
||||
LeaderboardManager::SendLeaderboard(activityID, Standings, false, self->GetObjectID(), playerID);
|
||||
}
|
||||
|
||||
void ActivityManager::ActivityTimerStart(Entity *self, const std::string& timerName, const float_t updateInterval,
|
||||
const float_t stopTime) {
|
||||
auto* timer = new ActivityTimer { timerName, updateInterval, stopTime };
|
||||
activeTimers.push_back(timer);
|
||||
void ActivityManager::ActivityTimerStart(Entity* self, const std::string& timerName, const float_t updateInterval,
|
||||
const float_t stopTime) {
|
||||
auto* timer = new ActivityTimer{ timerName, updateInterval, stopTime };
|
||||
activeTimers.push_back(timer);
|
||||
|
||||
Game::logger->Log("ActivityManager", "Starting timer '%s', %f, %f", timerName.c_str(), updateInterval, stopTime);
|
||||
Game::logger->Log("ActivityManager", "Starting timer '%s', %f, %f", timerName.c_str(), updateInterval, stopTime);
|
||||
|
||||
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
|
||||
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
|
||||
}
|
||||
|
||||
void ActivityManager::ActivityTimerStopAllTimers(Entity* self) {
|
||||
for (auto* timer : activeTimers) {
|
||||
self->CancelTimer(GetPrefixedName(timer->name));
|
||||
delete timer;
|
||||
}
|
||||
for (auto* timer : activeTimers) {
|
||||
self->CancelTimer(GetPrefixedName(timer->name));
|
||||
delete timer;
|
||||
}
|
||||
|
||||
activeTimers.clear();
|
||||
activeTimers.clear();
|
||||
}
|
||||
|
||||
float_t ActivityManager::ActivityTimerGetCurrentTime(Entity *self, const std::string &timerName) const {
|
||||
auto* timer = GetTimer(timerName);
|
||||
return timer != nullptr ? timer->runTime : 0.0f;
|
||||
float_t ActivityManager::ActivityTimerGetCurrentTime(Entity* self, const std::string& timerName) const {
|
||||
auto* timer = GetTimer(timerName);
|
||||
return timer != nullptr ? timer->runTime : 0.0f;
|
||||
}
|
||||
|
||||
int32_t ActivityManager::GetGameID(Entity *self) const
|
||||
{
|
||||
int32_t gameID = 0;
|
||||
int32_t ActivityManager::GetGameID(Entity* self) const {
|
||||
int32_t gameID = 0;
|
||||
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr) {
|
||||
gameID = self->GetLOT();
|
||||
}
|
||||
else {
|
||||
gameID = sac->GetActivityID();
|
||||
}
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (sac == nullptr) {
|
||||
gameID = self->GetLOT();
|
||||
} else {
|
||||
gameID = sac->GetActivityID();
|
||||
}
|
||||
|
||||
return gameID;
|
||||
return gameID;
|
||||
}
|
||||
|
||||
float_t ActivityManager::ActivityTimerGetRemainingTime(Entity *self, const std::string &timerName) const {
|
||||
auto* timer = GetTimer(timerName);
|
||||
return timer != nullptr ? std::min(timer->stopTime - timer->runTime, 0.0f) : 0.0f;
|
||||
float_t ActivityManager::ActivityTimerGetRemainingTime(Entity* self, const std::string& timerName) const {
|
||||
auto* timer = GetTimer(timerName);
|
||||
return timer != nullptr ? std::min(timer->stopTime - timer->runTime, 0.0f) : 0.0f;
|
||||
}
|
||||
|
||||
void ActivityManager::ActivityTimerReset(Entity *self, const std::string &timerName) {
|
||||
auto* timer = GetTimer(timerName);
|
||||
if (timer != nullptr) {
|
||||
timer->runTime = 0.0f;
|
||||
}
|
||||
void ActivityManager::ActivityTimerReset(Entity* self, const std::string& timerName) {
|
||||
auto* timer = GetTimer(timerName);
|
||||
if (timer != nullptr) {
|
||||
timer->runTime = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
ActivityTimer* ActivityManager::GetTimer(const std::string &name) const {
|
||||
for (auto* timer : activeTimers) {
|
||||
if (timer->name == name)
|
||||
return timer;
|
||||
}
|
||||
ActivityTimer* ActivityManager::GetTimer(const std::string& name) const {
|
||||
for (auto* timer : activeTimers) {
|
||||
if (timer->name == name)
|
||||
return timer;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ActivityManager::ActivityTimerStop(Entity *self, const std::string &timerName) {
|
||||
auto* timer = GetTimer(timerName);
|
||||
if (timer != nullptr) {
|
||||
self->CancelTimer(GetPrefixedName(timer->name));
|
||||
void ActivityManager::ActivityTimerStop(Entity* self, const std::string& timerName) {
|
||||
auto* timer = GetTimer(timerName);
|
||||
if (timer != nullptr) {
|
||||
self->CancelTimer(GetPrefixedName(timer->name));
|
||||
|
||||
activeTimers.erase(std::remove(activeTimers.begin(), activeTimers.end(), timer),
|
||||
activeTimers.end());
|
||||
delete timer;
|
||||
}
|
||||
activeTimers.erase(std::remove(activeTimers.begin(), activeTimers.end(), timer),
|
||||
activeTimers.end());
|
||||
delete timer;
|
||||
}
|
||||
}
|
||||
|
||||
std::string ActivityManager::GetPrefixedName(const std::string &name) const {
|
||||
return TimerPrefix + "_" + name;
|
||||
std::string ActivityManager::GetPrefixedName(const std::string& name) const {
|
||||
return TimerPrefix + "_" + name;
|
||||
}
|
||||
|
||||
void ActivityManager::OnTimerDone(Entity *self, std::string timerName) {
|
||||
auto nameSplit = GeneralUtils::SplitString(timerName, '_');
|
||||
if (nameSplit.size() > 1 && nameSplit.at(0) == TimerPrefix) {
|
||||
const auto& activityTimerName = nameSplit.at(1);
|
||||
auto* timer = GetTimer(activityTimerName);
|
||||
void ActivityManager::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto nameSplit = GeneralUtils::SplitString(timerName, '_');
|
||||
if (nameSplit.size() > 1 && nameSplit.at(0) == TimerPrefix) {
|
||||
const auto& activityTimerName = nameSplit.at(1);
|
||||
auto* timer = GetTimer(activityTimerName);
|
||||
|
||||
if (timer != nullptr) {
|
||||
timer->runTime += timer->updateInterval;
|
||||
if (timer != nullptr) {
|
||||
timer->runTime += timer->updateInterval;
|
||||
|
||||
if (timer->stopTime != -1.0f && timer->runTime >= timer->stopTime) {
|
||||
activeTimers.erase(std::remove(activeTimers.begin(), activeTimers.end(), timer),
|
||||
activeTimers.end());
|
||||
delete timer;
|
||||
Game::logger->Log("ActivityManager", "Executing timer '%s'", activityTimerName.c_str());
|
||||
OnActivityTimerDone(self, activityTimerName);
|
||||
} else {
|
||||
Game::logger->Log("ActivityManager", "Updating timer '%s'", activityTimerName.c_str());
|
||||
OnActivityTimerUpdate(self, timer->name, timer->stopTime - timer->runTime, timer->runTime);
|
||||
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (timer->stopTime != -1.0f && timer->runTime >= timer->stopTime) {
|
||||
activeTimers.erase(std::remove(activeTimers.begin(), activeTimers.end(), timer),
|
||||
activeTimers.end());
|
||||
delete timer;
|
||||
Game::logger->Log("ActivityManager", "Executing timer '%s'", activityTimerName.c_str());
|
||||
OnActivityTimerDone(self, activityTimerName);
|
||||
} else {
|
||||
Game::logger->Log("ActivityManager", "Updating timer '%s'", activityTimerName.c_str());
|
||||
OnActivityTimerUpdate(self, timer->name, timer->stopTime - timer->runTime, timer->runTime);
|
||||
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,41 +2,41 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
struct ActivityTimer {
|
||||
std::string name;
|
||||
float_t updateInterval;
|
||||
float_t stopTime;
|
||||
float_t runTime = 0;
|
||||
std::string name;
|
||||
float_t updateInterval;
|
||||
float_t stopTime;
|
||||
float_t runTime = 0;
|
||||
};
|
||||
|
||||
class ActivityManager : public CppScripts::Script {
|
||||
public:
|
||||
static bool IsPlayerInActivity(Entity *self, LWOOBJID playerID);
|
||||
static void UpdatePlayer(Entity *self, LWOOBJID playerID, bool remove = false);
|
||||
static void SetActivityScore(Entity *self, LWOOBJID playerID, uint32_t score);
|
||||
static void SetActivityValue(Entity *self, LWOOBJID playerID, uint32_t valueIndex, float_t value);
|
||||
static float_t GetActivityValue(Entity *self, LWOOBJID playerID, uint32_t valueIndex) ;
|
||||
static bool TakeActivityCost(const Entity* self, LWOOBJID playerID);
|
||||
static uint32_t GetActivityID(const Entity* self);
|
||||
void StopActivity(Entity *self, LWOOBJID playerID, uint32_t score, uint32_t value1 = 0, uint32_t value2 = 0, bool quit = false);
|
||||
virtual uint32_t CalculateActivityRating(Entity* self, LWOOBJID playerID);
|
||||
static void GetLeaderboardData(Entity *self, LWOOBJID playerID, uint32_t activityID, uint32_t numResults = 0);
|
||||
// void FreezePlayer(Entity *self, const LWOOBJID playerID, const bool state) const;
|
||||
static bool IsPlayerInActivity(Entity* self, LWOOBJID playerID);
|
||||
static void UpdatePlayer(Entity* self, LWOOBJID playerID, bool remove = false);
|
||||
static void SetActivityScore(Entity* self, LWOOBJID playerID, uint32_t score);
|
||||
static void SetActivityValue(Entity* self, LWOOBJID playerID, uint32_t valueIndex, float_t value);
|
||||
static float_t GetActivityValue(Entity* self, LWOOBJID playerID, uint32_t valueIndex);
|
||||
static bool TakeActivityCost(const Entity* self, LWOOBJID playerID);
|
||||
static uint32_t GetActivityID(const Entity* self);
|
||||
void StopActivity(Entity* self, LWOOBJID playerID, uint32_t score, uint32_t value1 = 0, uint32_t value2 = 0, bool quit = false);
|
||||
virtual uint32_t CalculateActivityRating(Entity* self, LWOOBJID playerID);
|
||||
static void GetLeaderboardData(Entity* self, LWOOBJID playerID, uint32_t activityID, uint32_t numResults = 0);
|
||||
// void FreezePlayer(Entity *self, const LWOOBJID playerID, const bool state) const;
|
||||
|
||||
// Activity timer
|
||||
void OnTimerDone(Entity *self, std::string timerName) override;
|
||||
virtual void OnActivityTimerDone(Entity* self, const std::string& name) {};
|
||||
virtual void OnActivityTimerUpdate(Entity* self, const std::string& name, float_t timeRemaining, float_t elapsedTime) {};
|
||||
void ActivityTimerStart(Entity *self, const std::string& timerName, float_t updateInterval, float_t stopTime = -1.0f);
|
||||
void ActivityTimerReset(Entity *self, const std::string& timerName);
|
||||
void ActivityTimerStop(Entity* self, const std::string& timerName);
|
||||
void ActivityTimerStopAllTimers(Entity* self);
|
||||
float_t ActivityTimerGetRemainingTime(Entity *self, const std::string& timerName) const;
|
||||
float_t ActivityTimerGetCurrentTime(Entity *self, const std::string& timerName) const;
|
||||
int32_t GetGameID(Entity* self) const;
|
||||
// Activity timer
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
virtual void OnActivityTimerDone(Entity* self, const std::string& name) {};
|
||||
virtual void OnActivityTimerUpdate(Entity* self, const std::string& name, float_t timeRemaining, float_t elapsedTime) {};
|
||||
void ActivityTimerStart(Entity* self, const std::string& timerName, float_t updateInterval, float_t stopTime = -1.0f);
|
||||
void ActivityTimerReset(Entity* self, const std::string& timerName);
|
||||
void ActivityTimerStop(Entity* self, const std::string& timerName);
|
||||
void ActivityTimerStopAllTimers(Entity* self);
|
||||
float_t ActivityTimerGetRemainingTime(Entity* self, const std::string& timerName) const;
|
||||
float_t ActivityTimerGetCurrentTime(Entity* self, const std::string& timerName) const;
|
||||
int32_t GetGameID(Entity* self) const;
|
||||
private:
|
||||
std::string GetPrefixedName(const std::string& name) const;
|
||||
[[nodiscard]] ActivityTimer* GetTimer(const std::string& name) const;
|
||||
std::vector<ActivityTimer*> activeTimers {};
|
||||
std::string GetPrefixedName(const std::string& name) const;
|
||||
[[nodiscard]] ActivityTimer* GetTimer(const std::string& name) const;
|
||||
std::vector<ActivityTimer*> activeTimers{};
|
||||
|
||||
std::string TimerPrefix = "ActivityTimer";
|
||||
std::string TimerPrefix = "ActivityTimer";
|
||||
};
|
||||
|
@@ -1,20 +1,17 @@
|
||||
#include "AgBugsprayer.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target)
|
||||
{
|
||||
self->AddTimer("castSkill", 1);
|
||||
self->SetOwnerOverride(target->GetObjectID());
|
||||
void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
self->AddTimer("castSkill", 1);
|
||||
self->SetOwnerOverride(target->GetObjectID());
|
||||
}
|
||||
|
||||
void AgBugsprayer::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
if (timerName == "castSkill")
|
||||
{
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
void AgBugsprayer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "castSkill") {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
skillComponent->CalculateBehavior(1435, 36581, LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
skillComponent->CalculateBehavior(1435, 36581, LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,6 @@ class AgBugsprayer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
||||
|
@@ -23,14 +23,12 @@ void AgBusDoor::OnProximityUpdate(Entity* self, Entity* entering, std::string na
|
||||
m_Counter = 0;
|
||||
m_OuterCounter = 0;
|
||||
|
||||
for (const auto& pair : proximityMonitorComponent->GetProximityObjects("busDoor"))
|
||||
{
|
||||
for (const auto& pair : proximityMonitorComponent->GetProximityObjects("busDoor")) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(pair.first);
|
||||
if (entity != nullptr && entity->IsPlayer()) m_Counter++;
|
||||
}
|
||||
|
||||
for (const auto& pair : proximityMonitorComponent->GetProximityObjects("busDoorOuter"))
|
||||
{
|
||||
for (const auto& pair : proximityMonitorComponent->GetProximityObjects("busDoorOuter")) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(pair.first);
|
||||
if (entity != nullptr && entity->IsPlayer()) m_OuterCounter++;
|
||||
}
|
||||
@@ -40,8 +38,7 @@ void AgBusDoor::OnProximityUpdate(Entity* self, Entity* entering, std::string na
|
||||
if (m_Counter > 0) {
|
||||
MoveDoor(self, true);
|
||||
}
|
||||
}
|
||||
else if (status == "LEAVE") {
|
||||
} else if (status == "LEAVE") {
|
||||
// move down when no players are inside either radii
|
||||
if (m_Counter <= 0) {
|
||||
MoveDoor(self, false);
|
||||
@@ -52,13 +49,12 @@ void AgBusDoor::OnProximityUpdate(Entity* self, Entity* entering, std::string na
|
||||
void AgBusDoor::MoveDoor(Entity* self, bool bOpen) {
|
||||
if (bOpen) {
|
||||
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 1, 0);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0, 1);
|
||||
self->AddTimer("dustTimer", 2.0f);
|
||||
}
|
||||
|
||||
//This is currently commented out because it might be the reason that people's audio is cutting out.
|
||||
//This is currently commented out because it might be the reason that people's audio is cutting out.
|
||||
GameMessages::SendPlayNDAudioEmitter(self, UNASSIGNED_SYSTEM_ADDRESS, "{9a24f1fa-3177-4745-a2df-fbd996d6e1e3}");
|
||||
}
|
||||
|
||||
@@ -66,4 +62,4 @@ void AgBusDoor::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "dustTimer") {
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 642, u"create", "busDust", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,9 +20,8 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
//Remove the maelstrom cube:
|
||||
auto inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
|
||||
if (inv)
|
||||
{
|
||||
|
||||
if (inv) {
|
||||
inv->RemoveItem(14553, 1);
|
||||
}
|
||||
}
|
||||
|
@@ -3,4 +3,4 @@
|
||||
|
||||
class AgCagedBricksServer : public CppScripts::Script {
|
||||
void OnUse(Entity* self, Entity* user);
|
||||
};
|
||||
};
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "AgDarkSpiderling.h"
|
||||
#include "BaseCombatAIComponent.h"
|
||||
|
||||
void AgDarkSpiderling::OnStartup(Entity *self) {
|
||||
auto* combatAI = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAI != nullptr) {
|
||||
combatAI->SetStunImmune(true);
|
||||
}
|
||||
void AgDarkSpiderling::OnStartup(Entity* self) {
|
||||
auto* combatAI = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAI != nullptr) {
|
||||
combatAI->SetStunImmune(true);
|
||||
}
|
||||
}
|
||||
|
@@ -2,5 +2,5 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgDarkSpiderling : public CppScripts::Script {
|
||||
void OnStartup(Entity *self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
};
|
||||
|
@@ -29,7 +29,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
if (renderComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;
|
||||
|
||||
if (self->GetVar<bool>(u"on")) {
|
||||
@@ -37,7 +37,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
|
||||
renderComponent->StopEffect("fanOn");
|
||||
self->SetVar<bool>(u"on", false);
|
||||
|
||||
|
||||
for (Entity* volume : fanVolumes) {
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
|
||||
if (!volumePhys) continue;
|
||||
@@ -48,8 +48,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
GameMessages::SendPlayAnimation(fxObj, u"trigger");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
|
||||
} else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-on");
|
||||
|
||||
renderComponent->PlayEffect(495, u"fanOn", "fanOn");
|
||||
@@ -68,8 +67,8 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
}
|
||||
}
|
||||
|
||||
void AgFans::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
void AgFans::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args.length() == 0 || !self->GetVar<bool>(u"alive")) return;
|
||||
|
||||
if ((args == "turnOn" && self->GetVar<bool>(u"on")) || (args == "turnOff" && !self->GetVar<bool>(u"on"))) return;
|
||||
@@ -81,4 +80,4 @@ void AgFans::OnDie(Entity* self, Entity* killer) {
|
||||
ToggleFX(self, true);
|
||||
}
|
||||
self->SetVar<bool>(u"alive", false);
|
||||
}
|
||||
}
|
||||
|
@@ -7,8 +7,8 @@ public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnFireEventServerSide(
|
||||
Entity *self,
|
||||
Entity *sender,
|
||||
Entity* self,
|
||||
Entity* sender,
|
||||
std::string args,
|
||||
int32_t param1,
|
||||
int32_t param2,
|
||||
|
@@ -6,4 +6,4 @@ public:
|
||||
void OnDie(Entity* self, Entity* killer);
|
||||
private:
|
||||
void CrateAnimal(Entity* self);
|
||||
};
|
||||
};
|
||||
|
@@ -3,10 +3,8 @@
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AgJetEffectServer::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
if (inUse)
|
||||
{
|
||||
void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
|
||||
if (inUse) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,8 +22,7 @@ void AgJetEffectServer::OnUse(Entity* self, Entity* user)
|
||||
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
|
||||
|
||||
if (entities.empty())
|
||||
{
|
||||
if (entities.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,12 +34,10 @@ void AgJetEffectServer::OnUse(Entity* self, Entity* user)
|
||||
self->AddTimer("CineDone", 9);
|
||||
}
|
||||
|
||||
void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target)
|
||||
{
|
||||
void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
|
||||
|
||||
if (entities.empty())
|
||||
{
|
||||
if (entities.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,8 +45,7 @@ void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target)
|
||||
|
||||
auto groups = self->GetGroups();
|
||||
|
||||
if (groups.empty())
|
||||
{
|
||||
if (groups.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,34 +57,28 @@ void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target)
|
||||
|
||||
self->AddTimer("PlayEffect", 2.5f);
|
||||
|
||||
if (group == "Base_Radar")
|
||||
{
|
||||
if (group == "Base_Radar") {
|
||||
self->AddTimer("CineDone", 5);
|
||||
}
|
||||
}
|
||||
|
||||
void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
if (timerName == "radarDish")
|
||||
{
|
||||
void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "radarDish") {
|
||||
GameMessages::SendStopFXEffect(self, true, "radarDish");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "PlayEffect")
|
||||
{
|
||||
if (timerName == "PlayEffect") {
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup("mortarMain");
|
||||
|
||||
if (entities.empty())
|
||||
{
|
||||
if (entities.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto size = entities.size();
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,8 +91,7 @@ void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName)
|
||||
mortar->SetOwnerOverride(builder);
|
||||
|
||||
SkillComponent* skillComponent;
|
||||
if (!mortar->TryGetComponent(COMPONENT_TYPE_SKILL, skillComponent))
|
||||
{
|
||||
if (!mortar->TryGetComponent(COMPONENT_TYPE_SKILL, skillComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,8 +100,7 @@ void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName)
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "CineDone")
|
||||
{
|
||||
if (timerName == "CineDone") {
|
||||
GameMessages::SendNotifyClientObject(
|
||||
self->GetObjectID(),
|
||||
u"toggleInUse",
|
||||
|
@@ -13,7 +13,7 @@ void AgLaserSensorServer::OnStartup(Entity* self) {
|
||||
physComp->SetEffectType(2); // repulse (prolly should make definitions of these are in Entity.cpp)
|
||||
physComp->SetDirectionalMultiplier(static_cast<float>(m_RepelForce));
|
||||
physComp->SetDirection(NiPoint3::UNIT_Y);
|
||||
|
||||
|
||||
m_Skill = self->GetComponent<SkillComponent>();
|
||||
}
|
||||
|
||||
@@ -36,16 +36,13 @@ void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (obj == 76690936093053 && Vector3::DistanceSquared(source, NiPoint3(149.007f, 417.083f, 218.346f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
}
|
||||
else if (obj == 75866302318824 && Vector3::DistanceSquared(source, NiPoint3(48.6403f, 403.803f, 196.711f)) <= 1.0f) {
|
||||
} else if (obj == 75866302318824 && Vector3::DistanceSquared(source, NiPoint3(48.6403f, 403.803f, 196.711f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
}
|
||||
else if (obj == 75866302318822 && Vector3::DistanceSquared(source, NiPoint3(19.2155f, 420.083f, 249.226f)) <= 1.0f) {
|
||||
} else if (obj == 75866302318822 && Vector3::DistanceSquared(source, NiPoint3(19.2155f, 420.083f, 249.226f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
}
|
||||
else if (obj == 75866302318823 && Vector3::DistanceSquared(source, NiPoint3(-6.61596f, 404.633f, 274.323f)) <= 1.0f) {
|
||||
} else if (obj == 75866302318823 && Vector3::DistanceSquared(source, NiPoint3(-6.61596f, 404.633f, 274.323f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
}
|
||||
|
@@ -28,6 +28,6 @@ void AgMonumentBirds::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
|
||||
if (player == nullptr) return;
|
||||
|
||||
|
||||
self->ScheduleKillAfterUpdate(player);
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
void AgMonumentLaserServer::OnStartup(Entity* self) {
|
||||
/*
|
||||
self->SetProximityRadius(m_Radius, "MonumentLaser");
|
||||
|
||||
|
||||
std::cout << "Monument Laser " << self->GetObjectID() << " is at " << self->GetPosition().GetX()
|
||||
<< ","<< self->GetPosition().GetY() << "," << self->GetPosition().GetZ() << std::endl;
|
||||
*/
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "AgMonumentRaceCancel.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgMonumentRaceCancel::OnCollisionPhantom(Entity *self, Entity *target) {
|
||||
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager");
|
||||
if (!managers.empty()) {
|
||||
managers[0]->OnFireEventServerSide(target, "course_cancel");
|
||||
}
|
||||
void AgMonumentRaceCancel::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager");
|
||||
if (!managers.empty()) {
|
||||
managers[0]->OnFireEventServerSide(target, "course_cancel");
|
||||
}
|
||||
}
|
||||
|
@@ -2,5 +2,5 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentRaceCancel : public CppScripts::Script {
|
||||
void OnCollisionPhantom(Entity *self, Entity *target) override;
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
};
|
||||
|
@@ -2,17 +2,14 @@
|
||||
#include "EntityManager.h"
|
||||
|
||||
|
||||
void AgMonumentRaceGoal::OnStartup(Entity* self)
|
||||
{
|
||||
self->SetProximityRadius(15, "RaceGoal");
|
||||
void AgMonumentRaceGoal::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(15, "RaceGoal");
|
||||
}
|
||||
|
||||
void AgMonumentRaceGoal::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status)
|
||||
{
|
||||
if (name == "RaceGoal" && entering->IsPlayer() && status == "ENTER")
|
||||
{
|
||||
auto* manager = EntityManager::Instance()->GetEntitiesInGroup("race_manager")[0];
|
||||
void AgMonumentRaceGoal::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (name == "RaceGoal" && entering->IsPlayer() && status == "ENTER") {
|
||||
auto* manager = EntityManager::Instance()->GetEntitiesInGroup("race_manager")[0];
|
||||
|
||||
manager->OnFireEventServerSide(entering, "course_finish");
|
||||
}
|
||||
manager->OnFireEventServerSide(entering, "course_finish");
|
||||
}
|
||||
}
|
||||
|
@@ -1,16 +1,16 @@
|
||||
#include "AgPicnicBlanket.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void AgPicnicBlanket::OnUse(Entity *self, Entity *user) {
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
if (self->GetVar<bool>(u"active"))
|
||||
return;
|
||||
self->SetVar<bool>(u"active", true);
|
||||
void AgPicnicBlanket::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
if (self->GetVar<bool>(u"active"))
|
||||
return;
|
||||
self->SetVar<bool>(u"active", true);
|
||||
|
||||
auto lootTable = std::unordered_map<LOT, int32_t> {{935, 3}};
|
||||
LootGenerator::Instance().DropLoot(user, self, lootTable, 0, 0);
|
||||
auto lootTable = std::unordered_map<LOT, int32_t>{ {935, 3} };
|
||||
LootGenerator::Instance().DropLoot(user, self, lootTable, 0, 0);
|
||||
|
||||
self->AddCallbackTimer(5.0f, [self]() {
|
||||
self->SetVar<bool>(u"active", false);
|
||||
});
|
||||
self->AddCallbackTimer(5.0f, [self]() {
|
||||
self->SetVar<bool>(u"active", false);
|
||||
});
|
||||
}
|
||||
|
@@ -2,5 +2,5 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgPicnicBlanket : public CppScripts::Script {
|
||||
void OnUse(Entity *self, Entity *user) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
};
|
||||
|
@@ -6,43 +6,34 @@
|
||||
#include "MissionComponent.h"
|
||||
#include "Item.h"
|
||||
|
||||
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState)
|
||||
{
|
||||
auto* character = target->GetCharacter();
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
|
||||
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
auto* character = target->GetCharacter();
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
|
||||
|
||||
const auto state = missionComponent->GetMissionState(320);
|
||||
if (missionID == 768 && missionState == MissionState::MISSION_STATE_AVAILABLE)
|
||||
{
|
||||
if (!character->GetPlayerFlag(71))
|
||||
{
|
||||
// TODO: Cinematic "MissionCam"
|
||||
}
|
||||
}
|
||||
else if (missionID == 768 && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE)
|
||||
{
|
||||
const auto state = missionComponent->GetMissionState(320);
|
||||
if (missionID == 768 && missionState == MissionState::MISSION_STATE_AVAILABLE) {
|
||||
if (!character->GetPlayerFlag(71)) {
|
||||
// TODO: Cinematic "MissionCam"
|
||||
}
|
||||
} else if (missionID == 768 && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
//remove the inventory items
|
||||
for (int item : gearSets)
|
||||
{
|
||||
for (int item : gearSets) {
|
||||
auto* id = inventoryComponent->FindItemByLot(item);
|
||||
|
||||
if (id)
|
||||
{
|
||||
if (id) {
|
||||
inventoryComponent->UnEquipItem(id);
|
||||
inventoryComponent->RemoveItem(id->GetLot(), id->GetCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (
|
||||
(missionID == 320 && state == MissionState::MISSION_STATE_AVAILABLE) /*||
|
||||
(state == MissionState::MISSION_STATE_COMPLETE && missionID == 891 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE)*/
|
||||
)
|
||||
{
|
||||
//GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());
|
||||
} else if (
|
||||
(missionID == 320 && state == MissionState::MISSION_STATE_AVAILABLE) /*||
|
||||
(state == MissionState::MISSION_STATE_COMPLETE && missionID == 891 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE)*/
|
||||
) {
|
||||
//GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());
|
||||
|
||||
target->GetCharacter()->SetPlayerFlag(113, true);
|
||||
target->GetCharacter()->SetPlayerFlag(113, true);
|
||||
|
||||
EntityManager::Instance()->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
|
||||
}
|
||||
EntityManager::Instance()->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
|
||||
}
|
||||
}
|
||||
|
@@ -4,53 +4,53 @@
|
||||
#include "EntityManager.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
void AgPropguards::OnMissionDialogueOK(Entity *self, Entity *target, int missionID, MissionState missionState) {
|
||||
auto* character = target->GetCharacter();
|
||||
if (character == nullptr)
|
||||
return;
|
||||
void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
auto* character = target->GetCharacter();
|
||||
if (character == nullptr)
|
||||
return;
|
||||
|
||||
const auto flag = GetFlagForMission(missionID);
|
||||
if (flag == 0)
|
||||
return;
|
||||
const auto flag = GetFlagForMission(missionID);
|
||||
if (flag == 0)
|
||||
return;
|
||||
|
||||
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_ACTIVE)
|
||||
&& !character->GetPlayerFlag(flag)) {
|
||||
// If the player just started the mission, play a cinematic highlighting the target
|
||||
GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress());
|
||||
} else if (missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
// Makes the guard disappear once the mission has been completed
|
||||
const auto zoneControlID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID();
|
||||
GameMessages::SendNotifyClientObject(zoneControlID, u"GuardChat", 0, 0, self->GetObjectID(),
|
||||
"", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_ACTIVE)
|
||||
&& !character->GetPlayerFlag(flag)) {
|
||||
// If the player just started the mission, play a cinematic highlighting the target
|
||||
GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress());
|
||||
} else if (missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
// Makes the guard disappear once the mission has been completed
|
||||
const auto zoneControlID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID();
|
||||
GameMessages::SendNotifyClientObject(zoneControlID, u"GuardChat", 0, 0, self->GetObjectID(),
|
||||
"", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
self->AddCallbackTimer(5.0f, [self]() {
|
||||
auto spawnerName = self->GetVar<std::string>(u"spawner_name");
|
||||
if (spawnerName.empty())
|
||||
spawnerName = "Guard";
|
||||
self->AddCallbackTimer(5.0f, [self]() {
|
||||
auto spawnerName = self->GetVar<std::string>(u"spawner_name");
|
||||
if (spawnerName.empty())
|
||||
spawnerName = "Guard";
|
||||
|
||||
auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName);
|
||||
for (auto* spawner : spawners) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName);
|
||||
for (auto* spawner : spawners) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
|
||||
self->Smash();
|
||||
});
|
||||
}
|
||||
self->Smash();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t AgPropguards::GetFlagForMission(uint32_t missionID) {
|
||||
switch (missionID) {
|
||||
case 872:
|
||||
return 97;
|
||||
case 873:
|
||||
return 98;
|
||||
case 874:
|
||||
return 99;
|
||||
case 1293:
|
||||
return 118;
|
||||
case 1322:
|
||||
return 122;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
switch (missionID) {
|
||||
case 872:
|
||||
return 97;
|
||||
case 873:
|
||||
return 98;
|
||||
case 874:
|
||||
return 99;
|
||||
case 1293:
|
||||
return 118;
|
||||
case 1322:
|
||||
return 122;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgPropguards : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity *self, Entity *target, int missionID, MissionState missionState) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
private:
|
||||
static uint32_t GetFlagForMission(uint32_t missionID);
|
||||
static uint32_t GetFlagForMission(uint32_t missionID);
|
||||
};
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "GameMessages.h"
|
||||
|
||||
void AgQbElevator::OnStartup(Entity* self) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
//when the QB is finished being built by a player
|
||||
@@ -15,7 +15,7 @@ void AgQbElevator::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
if (delayTime < 1) delayTime = 1;
|
||||
|
||||
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
|
||||
0, 0, MovementPlatformState::Stationary);
|
||||
0, 0, MovementPlatformState::Stationary);
|
||||
|
||||
//add a timer that will kill the QB if no players get on in the killTime
|
||||
self->AddTimer("startKillTimer", killTime);
|
||||
@@ -33,9 +33,8 @@ void AgQbElevator::OnProximityUpdate(Entity* self, Entity* entering, std::string
|
||||
self->CancelTimer("StartElevator");
|
||||
|
||||
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
|
||||
1, 1, MovementPlatformState::Moving);
|
||||
}
|
||||
else if (!self->GetBoolean(u"StartTimer")) {
|
||||
1, 1, MovementPlatformState::Moving);
|
||||
} else if (!self->GetBoolean(u"StartTimer")) {
|
||||
self->SetBoolean(u"StartTimer", true);
|
||||
self->AddTimer("StartElevator", startTime);
|
||||
}
|
||||
@@ -46,9 +45,8 @@ void AgQbElevator::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
if (timerName == "StartElevator") {
|
||||
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
|
||||
1, 1, MovementPlatformState::Moving);
|
||||
}
|
||||
else if (timerName == "startKillTimer") {
|
||||
1, 1, MovementPlatformState::Moving);
|
||||
} else if (timerName == "startKillTimer") {
|
||||
killTimerStartup(self);
|
||||
} else if (timerName == "KillTimer") {
|
||||
self->Smash(self->GetObjectID(), VIOLENT);
|
||||
|
@@ -16,4 +16,4 @@ private:
|
||||
float startTime = 8.0f;
|
||||
float killTime = 10.0f;
|
||||
float proxRadius = 5.0f;
|
||||
};
|
||||
};
|
||||
|
@@ -2,10 +2,8 @@
|
||||
#include "GameMessages.h"
|
||||
|
||||
|
||||
void AgSalutingNpcs::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target)
|
||||
{
|
||||
if (emote != 356)
|
||||
{
|
||||
void AgSalutingNpcs::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
|
||||
if (emote != 356) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -5,4 +5,4 @@ void AgShipPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target)
|
||||
if (target->GetLOT() == 1 && !target->GetIsDead()) {
|
||||
target->Smash(self->GetObjectID(), eKillType::VIOLENT, u"electro-shock-death");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,7 @@
|
||||
#include "AgShipPlayerShockServer.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
if (active) {
|
||||
return;
|
||||
@@ -15,8 +14,7 @@ void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user)
|
||||
self->AddTimer("FXTime", fxTime);
|
||||
}
|
||||
|
||||
void AgShipPlayerShockServer::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
void AgShipPlayerShockServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
GameMessages::SendStopFXEffect(self, true, "console_sparks");
|
||||
active = false;
|
||||
}
|
||||
|
@@ -28,18 +28,15 @@ void AgSpaceStuff::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"scale_0" + GeneralUtils::to_u16string(scaleType));
|
||||
self->AddTimer("FloaterPath", 0.4);
|
||||
}
|
||||
else if (timerName == "FloaterPath") {
|
||||
} else if (timerName == "FloaterPath") {
|
||||
int pathType = GeneralUtils::GenerateRandomNumber<int>(1, 4);
|
||||
int randTime = GeneralUtils::GenerateRandomNumber<int>(20, 25);
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"path_0" + (GeneralUtils::to_u16string(pathType)));
|
||||
self->AddTimer("FloaterScale", randTime);
|
||||
}
|
||||
else if (timerName == "ShipShakeExplode") {
|
||||
} else if (timerName == "ShipShakeExplode") {
|
||||
DoShake(self, true);
|
||||
}
|
||||
else if (timerName == "ShipShakeIdle") {
|
||||
} else if (timerName == "ShipShakeIdle") {
|
||||
DoShake(self, false);
|
||||
}
|
||||
}
|
||||
@@ -79,8 +76,7 @@ void AgSpaceStuff::DoShake(Entity* self, bool explodeIdle) {
|
||||
auto* shipFxObject2 = GetEntityInGroup(ShipFX2);
|
||||
if (shipFxObject2)
|
||||
GameMessages::SendPlayAnimation(shipFxObject2, u"explosion");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
auto* shipFxObject = GetEntityInGroup(ShipFX);
|
||||
auto* shipFxObject2 = GetEntityInGroup(ShipFX2);
|
||||
|
||||
|
@@ -1,16 +1,16 @@
|
||||
#include "AgStagePlatforms.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
|
||||
void AgStagePlatforms::OnStartup(Entity *self) {
|
||||
auto* component = self->GetComponent<MovingPlatformComponent>();
|
||||
if (component) {
|
||||
component->SetNoAutoStart(true);
|
||||
component->StopPathing();
|
||||
}
|
||||
void AgStagePlatforms::OnStartup(Entity* self) {
|
||||
auto* component = self->GetComponent<MovingPlatformComponent>();
|
||||
if (component) {
|
||||
component->SetNoAutoStart(true);
|
||||
component->StopPathing();
|
||||
}
|
||||
}
|
||||
|
||||
void AgStagePlatforms::OnWaypointReached(Entity* self, uint32_t waypointIndex) {
|
||||
auto* component = self->GetComponent<MovingPlatformComponent>();
|
||||
if (waypointIndex == 0 && component)
|
||||
component->StopPathing();
|
||||
auto* component = self->GetComponent<MovingPlatformComponent>();
|
||||
if (waypointIndex == 0 && component)
|
||||
component->StopPathing();
|
||||
}
|
||||
|
@@ -3,6 +3,6 @@
|
||||
|
||||
class AgStagePlatforms : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnWaypointReached(Entity* self, uint32_t waypointIndex) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnWaypointReached(Entity* self, uint32_t waypointIndex) override;
|
||||
};
|
||||
|
@@ -1,16 +1,16 @@
|
||||
#include "AgStromlingProperty.h"
|
||||
#include "MovementAIComponent.h"
|
||||
|
||||
void AgStromlingProperty::OnStartup(Entity *self) {
|
||||
auto movementInfo = MovementAIInfo {
|
||||
"Wander",
|
||||
71,
|
||||
3,
|
||||
100,
|
||||
1,
|
||||
4
|
||||
};
|
||||
void AgStromlingProperty::OnStartup(Entity* self) {
|
||||
auto movementInfo = MovementAIInfo{
|
||||
"Wander",
|
||||
71,
|
||||
3,
|
||||
100,
|
||||
1,
|
||||
4
|
||||
};
|
||||
|
||||
auto* movementAIComponent = new MovementAIComponent(self, movementInfo);
|
||||
self->AddComponent(COMPONENT_TYPE_MOVEMENT_AI, movementAIComponent);
|
||||
auto* movementAIComponent = new MovementAIComponent(self, movementInfo);
|
||||
self->AddComponent(COMPONENT_TYPE_MOVEMENT_AI, movementAIComponent);
|
||||
}
|
||||
|
@@ -2,5 +2,5 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgStromlingProperty : public CppScripts::Script {
|
||||
void OnStartup(Entity *self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
};
|
||||
|
@@ -6,60 +6,60 @@
|
||||
#include "TeamManager.h"
|
||||
|
||||
void AgSurvivalBuffStation::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
// We set the faction to 1 so that the buff station sees players as friendly targets to buff
|
||||
if (destroyableComponent != nullptr) destroyableComponent->SetFaction(1);
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
// We set the faction to 1 so that the buff station sees players as friendly targets to buff
|
||||
if (destroyableComponent != nullptr) destroyableComponent->SetFaction(1);
|
||||
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent != nullptr) skillComponent->CalculateBehavior(skillIdForBuffStation, behaviorIdForBuffStation, self->GetObjectID());
|
||||
if (skillComponent != nullptr) skillComponent->CalculateBehavior(skillIdForBuffStation, behaviorIdForBuffStation, self->GetObjectID());
|
||||
|
||||
self->AddCallbackTimer(smashTimer, [self]() {
|
||||
self->Smash();
|
||||
});
|
||||
self->AddTimer("DropArmor", dropArmorTimer);
|
||||
self->AddTimer("DropLife", dropLifeTimer);
|
||||
self->AddTimer("Dropimagination", dropImaginationTimer);
|
||||
// Since all survival players should be on the same team, we get the team.
|
||||
auto team = TeamManager::Instance()->GetTeam(target->GetObjectID());
|
||||
self->AddCallbackTimer(smashTimer, [self]() {
|
||||
self->Smash();
|
||||
});
|
||||
self->AddTimer("DropArmor", dropArmorTimer);
|
||||
self->AddTimer("DropLife", dropLifeTimer);
|
||||
self->AddTimer("Dropimagination", dropImaginationTimer);
|
||||
// Since all survival players should be on the same team, we get the team.
|
||||
auto team = TeamManager::Instance()->GetTeam(target->GetObjectID());
|
||||
|
||||
std::vector<LWOOBJID> builderTeam;
|
||||
// Not on a team
|
||||
if (team == nullptr) {
|
||||
builderTeam.push_back(target->GetObjectID());
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"BuilderTeam", builderTeam);
|
||||
return;
|
||||
}
|
||||
std::vector<LWOOBJID> builderTeam;
|
||||
// Not on a team
|
||||
if (team == nullptr) {
|
||||
builderTeam.push_back(target->GetObjectID());
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"BuilderTeam", builderTeam);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto memberID : team->members) {
|
||||
builderTeam.push_back(memberID);
|
||||
}
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"BuilderTeam", builderTeam);
|
||||
for (auto memberID : team->members) {
|
||||
builderTeam.push_back(memberID);
|
||||
}
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"BuilderTeam", builderTeam);
|
||||
}
|
||||
|
||||
void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) {
|
||||
uint32_t powerupToDrop = lifePowerup;
|
||||
if (timerName == "DropArmor") {
|
||||
powerupToDrop = armorPowerup;
|
||||
self->AddTimer("DropArmor", dropArmorTimer);
|
||||
}
|
||||
if (timerName == "DropLife") {
|
||||
powerupToDrop = lifePowerup;
|
||||
self->AddTimer("DropLife", dropLifeTimer);
|
||||
}
|
||||
if (timerName == "Dropimagination") {
|
||||
powerupToDrop = imaginationPowerup;
|
||||
self->AddTimer("Dropimagination", dropImaginationTimer);
|
||||
}
|
||||
auto team = self->GetVar<std::vector<LWOOBJID>>(u"BuilderTeam");
|
||||
for (auto memberID : team) {
|
||||
auto member = EntityManager::Instance()->GetEntity(memberID);
|
||||
if (member != nullptr && !member->GetIsDead()) {
|
||||
GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
|
||||
} else {
|
||||
// If player left the team or left early erase them from the team variable.
|
||||
team.erase(std::find(team.begin(), team.end(), memberID));
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"BuilderTeam", team);
|
||||
}
|
||||
}
|
||||
uint32_t powerupToDrop = lifePowerup;
|
||||
if (timerName == "DropArmor") {
|
||||
powerupToDrop = armorPowerup;
|
||||
self->AddTimer("DropArmor", dropArmorTimer);
|
||||
}
|
||||
if (timerName == "DropLife") {
|
||||
powerupToDrop = lifePowerup;
|
||||
self->AddTimer("DropLife", dropLifeTimer);
|
||||
}
|
||||
if (timerName == "Dropimagination") {
|
||||
powerupToDrop = imaginationPowerup;
|
||||
self->AddTimer("Dropimagination", dropImaginationTimer);
|
||||
}
|
||||
auto team = self->GetVar<std::vector<LWOOBJID>>(u"BuilderTeam");
|
||||
for (auto memberID : team) {
|
||||
auto member = EntityManager::Instance()->GetEntity(memberID);
|
||||
if (member != nullptr && !member->GetIsDead()) {
|
||||
GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
|
||||
} else {
|
||||
// If player left the team or left early erase them from the team variable.
|
||||
team.erase(std::find(team.begin(), team.end(), memberID));
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"BuilderTeam", team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,49 +4,49 @@
|
||||
class AgSurvivalBuffStation : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief When the rebuild of self is complete, we calculate the behavior that is assigned to self in the database.
|
||||
*
|
||||
* @param self The Entity that called this script.
|
||||
* @param target The target of the self that called this script.
|
||||
*/
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
/**
|
||||
* @brief When the rebuild of self is complete, we calculate the behavior that is assigned to self in the database.
|
||||
*
|
||||
* @param self The Entity that called this script.
|
||||
* @param target The target of the self that called this script.
|
||||
*/
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
/**
|
||||
* Skill ID for the buff station.
|
||||
*/
|
||||
uint32_t skillIdForBuffStation = 201;
|
||||
/**
|
||||
* Behavior ID for the buff station.
|
||||
*/
|
||||
uint32_t behaviorIdForBuffStation = 1784;
|
||||
/**
|
||||
* Timer for dropping armor.
|
||||
*/
|
||||
float dropArmorTimer = 6.0f;
|
||||
/**
|
||||
* Timer for dropping life.
|
||||
*/
|
||||
float dropLifeTimer = 3.0f;
|
||||
/**
|
||||
* Timer for dropping imagination.
|
||||
*/
|
||||
float dropImaginationTimer = 4.0f;
|
||||
/**
|
||||
* Timer for smashing.
|
||||
*/
|
||||
float smashTimer = 25.0f;
|
||||
/**
|
||||
* LOT for armor powerup.
|
||||
*/
|
||||
LOT armorPowerup = 6431;
|
||||
/**
|
||||
* LOT for life powerup.
|
||||
*/
|
||||
LOT lifePowerup = 177;
|
||||
/**
|
||||
* LOT for imagination powerup.
|
||||
*/
|
||||
LOT imaginationPowerup = 935;
|
||||
};
|
||||
/**
|
||||
* Skill ID for the buff station.
|
||||
*/
|
||||
uint32_t skillIdForBuffStation = 201;
|
||||
/**
|
||||
* Behavior ID for the buff station.
|
||||
*/
|
||||
uint32_t behaviorIdForBuffStation = 1784;
|
||||
/**
|
||||
* Timer for dropping armor.
|
||||
*/
|
||||
float dropArmorTimer = 6.0f;
|
||||
/**
|
||||
* Timer for dropping life.
|
||||
*/
|
||||
float dropLifeTimer = 3.0f;
|
||||
/**
|
||||
* Timer for dropping imagination.
|
||||
*/
|
||||
float dropImaginationTimer = 4.0f;
|
||||
/**
|
||||
* Timer for smashing.
|
||||
*/
|
||||
float smashTimer = 25.0f;
|
||||
/**
|
||||
* LOT for armor powerup.
|
||||
*/
|
||||
LOT armorPowerup = 6431;
|
||||
/**
|
||||
* LOT for life powerup.
|
||||
*/
|
||||
LOT lifePowerup = 177;
|
||||
/**
|
||||
* LOT for imagination powerup.
|
||||
*/
|
||||
LOT imaginationPowerup = 935;
|
||||
};
|
||||
|
@@ -1,15 +1,15 @@
|
||||
#include "AgSurvivalMech.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void AgSurvivalMech::OnStartup(Entity *self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
void AgSurvivalMech::OnStartup(Entity* self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
|
||||
auto* destroyable = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyable != nullptr) {
|
||||
destroyable->SetFaction(4);
|
||||
}
|
||||
auto* destroyable = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyable != nullptr) {
|
||||
destroyable->SetFaction(4);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t AgSurvivalMech::GetPoints() {
|
||||
return 200;
|
||||
return 200;
|
||||
}
|
||||
|
@@ -2,6 +2,6 @@
|
||||
#include "BaseWavesGenericEnemy.h"
|
||||
|
||||
class AgSurvivalMech : public BaseWavesGenericEnemy {
|
||||
void OnStartup(Entity *self) override;
|
||||
uint32_t GetPoints() override;
|
||||
void OnStartup(Entity* self) override;
|
||||
uint32_t GetPoints() override;
|
||||
};
|
||||
|
@@ -1,15 +1,15 @@
|
||||
#include "AgSurvivalSpiderling.h"
|
||||
#include "BaseCombatAIComponent.h"
|
||||
|
||||
void AgSurvivalSpiderling::OnStartup(Entity *self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
void AgSurvivalSpiderling::OnStartup(Entity* self) {
|
||||
BaseWavesGenericEnemy::OnStartup(self);
|
||||
|
||||
auto* combatAI = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAI != nullptr) {
|
||||
combatAI->SetStunImmune(true);
|
||||
}
|
||||
auto* combatAI = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAI != nullptr) {
|
||||
combatAI->SetStunImmune(true);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t AgSurvivalSpiderling::GetPoints() {
|
||||
return 300;
|
||||
return 300;
|
||||
}
|
||||
|
@@ -2,6 +2,6 @@
|
||||
#include "BaseWavesGenericEnemy.h"
|
||||
|
||||
class AgSurvivalSpiderling : public BaseWavesGenericEnemy {
|
||||
void OnStartup(Entity *self) override;
|
||||
uint32_t GetPoints() override;
|
||||
void OnStartup(Entity* self) override;
|
||||
uint32_t GetPoints() override;
|
||||
};
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "AgSurvivalStromling.h"
|
||||
|
||||
uint32_t AgSurvivalStromling::GetPoints() {
|
||||
return 100;
|
||||
return 100;
|
||||
}
|
||||
|
@@ -2,5 +2,5 @@
|
||||
#include "BaseWavesGenericEnemy.h"
|
||||
|
||||
class AgSurvivalStromling : public BaseWavesGenericEnemy {
|
||||
uint32_t GetPoints() override;
|
||||
uint32_t GetPoints() override;
|
||||
};
|
||||
|
@@ -5,4 +5,4 @@ class AgTurret : public CppScripts::Script {
|
||||
void OnStartup(Entity* self);
|
||||
void OnTimerDone(Entity* self, std::string timerName);
|
||||
void OnRebuildStart(Entity* self, Entity* user);
|
||||
};
|
||||
};
|
||||
|
@@ -3,53 +3,53 @@
|
||||
#include "EntityManager.h"
|
||||
#include "Character.h"
|
||||
|
||||
void AmBlueX::OnUse(Entity *self, Entity *user) {
|
||||
auto* skillComponent = user->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(m_SwordSkill, m_SwordBehavior, self->GetObjectID());
|
||||
}
|
||||
void AmBlueX::OnUse(Entity* self, Entity* user) {
|
||||
auto* skillComponent = user->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(m_SwordSkill, m_SwordBehavior, self->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void AmBlueX::OnSkillEventFired(Entity *self, Entity *caster, const std::string &message) {
|
||||
if (message == "FireDukesStrike") {
|
||||
self->SetNetworkVar<bool>(m_XUsedVariable, true);
|
||||
self->SetNetworkVar<bool>(m_StartEffectVariable, true);
|
||||
void AmBlueX::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
|
||||
if (message == "FireDukesStrike") {
|
||||
self->SetNetworkVar<bool>(m_XUsedVariable, true);
|
||||
self->SetNetworkVar<bool>(m_StartEffectVariable, true);
|
||||
|
||||
auto* character = caster->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(self->GetVar<int32_t>(m_FlagVariable), true);
|
||||
}
|
||||
auto* character = caster->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(self->GetVar<int32_t>(m_FlagVariable), true);
|
||||
}
|
||||
|
||||
EntityInfo info {};
|
||||
info.lot = m_FXObject;
|
||||
info.pos = self->GetPosition();
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
EntityInfo info{};
|
||||
info.lot = m_FXObject;
|
||||
info.pos = self->GetPosition();
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* fxObject = EntityManager::Instance()->CreateEntity(info, nullptr, self);
|
||||
EntityManager::Instance()->ConstructEntity(fxObject);
|
||||
auto* fxObject = EntityManager::Instance()->CreateEntity(info, nullptr, self);
|
||||
EntityManager::Instance()->ConstructEntity(fxObject);
|
||||
|
||||
auto fxObjectID = fxObject->GetObjectID();
|
||||
auto playerID = caster->GetObjectID();
|
||||
auto fxObjectID = fxObject->GetObjectID();
|
||||
auto playerID = caster->GetObjectID();
|
||||
|
||||
// Add a callback for the bomb to explode
|
||||
self->AddCallbackTimer(m_BombTime, [this, self, fxObjectID, playerID]() {
|
||||
auto* fxObject = EntityManager::Instance()->GetEntity(fxObjectID);
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
// Add a callback for the bomb to explode
|
||||
self->AddCallbackTimer(m_BombTime, [this, self, fxObjectID, playerID]() {
|
||||
auto* fxObject = EntityManager::Instance()->GetEntity(fxObjectID);
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr)
|
||||
return;
|
||||
if (skillComponent == nullptr)
|
||||
return;
|
||||
|
||||
// Cast the skill that destroys the object
|
||||
if (player != nullptr) {
|
||||
skillComponent->CalculateBehavior(m_AOESkill, m_AOEBehavior, LWOOBJID_EMPTY, false, false, playerID);
|
||||
} else {
|
||||
skillComponent->CalculateBehavior(m_AOESkill, m_AOEBehavior, LWOOBJID_EMPTY);
|
||||
}
|
||||
// Cast the skill that destroys the object
|
||||
if (player != nullptr) {
|
||||
skillComponent->CalculateBehavior(m_AOESkill, m_AOEBehavior, LWOOBJID_EMPTY, false, false, playerID);
|
||||
} else {
|
||||
skillComponent->CalculateBehavior(m_AOESkill, m_AOEBehavior, LWOOBJID_EMPTY);
|
||||
}
|
||||
|
||||
fxObject->Smash();
|
||||
self->Smash();
|
||||
});
|
||||
}
|
||||
fxObject->Smash();
|
||||
self->Smash();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -2,19 +2,19 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmBlueX : public CppScripts::Script {
|
||||
void OnUse(Entity *self, Entity *user) override;
|
||||
void OnSkillEventFired(Entity *self, Entity *caster, const std::string &message) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
private:
|
||||
const float_t m_BombTime = 3.3f;
|
||||
const uint32_t m_MissionID = 1448;
|
||||
const uint32_t m_SwordSkill = 1259;
|
||||
const uint32_t m_SwordBehavior = 29305;
|
||||
const uint32_t m_AOESkill = 1258;
|
||||
const uint32_t m_AOEBehavior = 29301;
|
||||
const LOT m_FXObject = 13808;
|
||||
const float_t m_BombTime = 3.3f;
|
||||
const uint32_t m_MissionID = 1448;
|
||||
const uint32_t m_SwordSkill = 1259;
|
||||
const uint32_t m_SwordBehavior = 29305;
|
||||
const uint32_t m_AOESkill = 1258;
|
||||
const uint32_t m_AOEBehavior = 29301;
|
||||
const LOT m_FXObject = 13808;
|
||||
|
||||
// Variables
|
||||
const std::u16string m_XUsedVariable = u"XUsed";
|
||||
const std::u16string m_FlagVariable = u"flag";
|
||||
const std::u16string m_StartEffectVariable = u"startEffect";
|
||||
// Variables
|
||||
const std::u16string m_XUsedVariable = u"XUsed";
|
||||
const std::u16string m_FlagVariable = u"flag";
|
||||
const std::u16string m_StartEffectVariable = u"startEffect";
|
||||
};
|
||||
|
@@ -1,33 +1,28 @@
|
||||
#include "AmBridge.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AmBridge::OnStartup(Entity* self)
|
||||
{
|
||||
|
||||
void AmBridge::OnStartup(Entity* self) {
|
||||
|
||||
}
|
||||
|
||||
void AmBridge::OnRebuildComplete(Entity* self, Entity* target)
|
||||
{
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console" + GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"bridge")));
|
||||
void AmBridge::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console" + GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"bridge")));
|
||||
|
||||
if (consoles.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (consoles.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* console = consoles[0];
|
||||
auto* console = consoles[0];
|
||||
|
||||
console->NotifyObject(self, "BridgeBuilt");
|
||||
console->NotifyObject(self, "BridgeBuilt");
|
||||
|
||||
self->AddTimer("SmashBridge", 50);
|
||||
self->AddTimer("SmashBridge", 50);
|
||||
}
|
||||
|
||||
void AmBridge::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
if (timerName != "SmashBridge")
|
||||
{
|
||||
return;
|
||||
}
|
||||
void AmBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName != "SmashBridge") {
|
||||
return;
|
||||
}
|
||||
|
||||
self->Smash(self->GetObjectID(), VIOLENT);
|
||||
self->Smash(self->GetObjectID(), VIOLENT);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
class AmBridge : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
@@ -2,35 +2,29 @@
|
||||
#include "ChooseYourDestinationNsToNt.h"
|
||||
#include "AMFFormat.h"
|
||||
|
||||
void AmConsoleTeleportServer::OnStartup(Entity* self)
|
||||
{
|
||||
self->SetVar(u"teleportAnim", m_TeleportAnim);
|
||||
self->SetVar(u"teleportString", m_TeleportString);
|
||||
self->SetVar(u"teleportEffectID", m_TeleportEffectID);
|
||||
self->SetVar(u"teleportEffectTypes", m_TeleportEffectTypes);
|
||||
void AmConsoleTeleportServer::OnStartup(Entity* self) {
|
||||
self->SetVar(u"teleportAnim", m_TeleportAnim);
|
||||
self->SetVar(u"teleportString", m_TeleportString);
|
||||
self->SetVar(u"teleportEffectID", m_TeleportEffectID);
|
||||
self->SetVar(u"teleportEffectTypes", m_TeleportEffectTypes);
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
BaseOnUse(self, user);
|
||||
void AmConsoleTeleportServer::OnUse(Entity* self, Entity* user) {
|
||||
BaseOnUse(self, user);
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData)
|
||||
{
|
||||
BaseOnMessageBoxResponse(self, sender, button, identifier, userData);
|
||||
void AmConsoleTeleportServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
BaseOnMessageBoxResponse(self, sender, button, identifier, userData);
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnChoiceBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier)
|
||||
{
|
||||
|
||||
void AmConsoleTeleportServer::OnChoiceBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) {
|
||||
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
BaseOnTimerDone(self, timerName);
|
||||
void AmConsoleTeleportServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
BaseOnTimerDone(self, timerName);
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, int32_t param3)
|
||||
{
|
||||
BaseOnFireEventServerSide(self, sender, args, param1, param2, param3);
|
||||
void AmConsoleTeleportServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
BaseOnFireEventServerSide(self, sender, args, param1, param2, param3);
|
||||
}
|
||||
|
@@ -5,18 +5,18 @@
|
||||
class AmConsoleTeleportServer : 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;
|
||||
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 = 1900;
|
||||
std::string m_SpawnPoint = "NS_LW";
|
||||
std::u16string m_TeleportAnim = u"nexus-teleport";
|
||||
std::u16string m_TeleportString = u"UI_TRAVEL_TO_NEXUS_TOWER";
|
||||
int32_t m_TeleportEffectID = 6478;
|
||||
std::vector<std::u16string> m_TeleportEffectTypes = {u"teleportRings", u"teleportBeam"};
|
||||
int32_t m_ChoiceZoneID = 1900;
|
||||
std::string m_SpawnPoint = "NS_LW";
|
||||
std::u16string m_TeleportAnim = u"nexus-teleport";
|
||||
std::u16string m_TeleportString = u"UI_TRAVEL_TO_NEXUS_TOWER";
|
||||
int32_t m_TeleportEffectID = 6478;
|
||||
std::vector<std::u16string> m_TeleportEffectTypes = { u"teleportRings", u"teleportBeam" };
|
||||
};
|
||||
|
@@ -7,153 +7,146 @@
|
||||
#include "BaseCombatAIComponent.h"
|
||||
|
||||
void AmDarklingDragon::OnStartup(Entity* self) {
|
||||
self->SetVar<int32_t>(u"weakspot", 0);
|
||||
self->SetVar<int32_t>(u"weakspot", 0);
|
||||
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetStunImmune(true);
|
||||
}
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetStunImmune(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AmDarklingDragon::OnDie(Entity* self, Entity* killer) {
|
||||
if (self->GetVar<bool>(u"bDied")) {
|
||||
return;
|
||||
}
|
||||
if (self->GetVar<bool>(u"bDied")) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar<bool>(u"bDied", true);
|
||||
|
||||
auto golemId = self->GetVar<LWOOBJID>(u"Golem");
|
||||
self->SetVar<bool>(u"bDied", true);
|
||||
|
||||
auto* golem = EntityManager::Instance()->GetEntity(golemId);
|
||||
auto golemId = self->GetVar<LWOOBJID>(u"Golem");
|
||||
|
||||
if (golem != nullptr) {
|
||||
golem->Smash(self->GetObjectID());
|
||||
}
|
||||
auto* golem = EntityManager::Instance()->GetEntity(golemId);
|
||||
|
||||
if (golem != nullptr) {
|
||||
golem->Smash(self->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"gothit", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"gothit", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
if (true) {
|
||||
auto weakpoint = self->GetVar<int32_t>(u"weakspot");
|
||||
if (true) {
|
||||
auto weakpoint = self->GetVar<int32_t>(u"weakspot");
|
||||
|
||||
if (weakpoint == 1)
|
||||
{
|
||||
self->Smash(attacker->GetObjectID());
|
||||
}
|
||||
}
|
||||
if (weakpoint == 1) {
|
||||
self->Smash(attacker->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent != nullptr) {
|
||||
if (destroyableComponent->GetArmor() > 0) return;
|
||||
if (destroyableComponent != nullptr) {
|
||||
if (destroyableComponent->GetArmor() > 0) return;
|
||||
|
||||
auto weakpoint = self->GetVar<int32_t>(u"weakpoint");
|
||||
auto weakpoint = self->GetVar<int32_t>(u"weakpoint");
|
||||
|
||||
if (weakpoint == 0) {
|
||||
self->AddTimer("ReviveTimer", 12);
|
||||
if (weakpoint == 0) {
|
||||
self->AddTimer("ReviveTimer", 12);
|
||||
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetDisabled(true);
|
||||
baseCombatAIComponent->SetStunned(true);
|
||||
}
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetDisabled(true);
|
||||
baseCombatAIComponent->SetStunned(true);
|
||||
}
|
||||
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->Interrupt();
|
||||
}
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->Interrupt();
|
||||
}
|
||||
|
||||
self->SetVar<int32_t>(u"weakpoint", 2);
|
||||
self->SetVar<int32_t>(u"weakpoint", 2);
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"stunstart", 1.7f);
|
||||
GameMessages::SendPlayAnimation(self, u"stunstart", 1.7f);
|
||||
|
||||
self->AddTimer("timeToStunLoop", 1);
|
||||
self->AddTimer("timeToStunLoop", 1);
|
||||
|
||||
auto position = self->GetPosition();
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
auto backwards = forward * -1;
|
||||
auto position = self->GetPosition();
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
auto backwards = forward * -1;
|
||||
|
||||
forward.x *= 10;
|
||||
forward.z *= 10;
|
||||
forward.x *= 10;
|
||||
forward.z *= 10;
|
||||
|
||||
auto rotation = self->GetRotation();
|
||||
auto rotation = self->GetRotation();
|
||||
|
||||
auto objectPosition = NiPoint3();
|
||||
auto objectPosition = NiPoint3();
|
||||
|
||||
objectPosition.y = position.y;
|
||||
objectPosition.x = position.x - (backwards.x * 8);
|
||||
objectPosition.z = position.z - (backwards.z * 8);
|
||||
objectPosition.y = position.y;
|
||||
objectPosition.x = position.x - (backwards.x * 8);
|
||||
objectPosition.z = position.z - (backwards.z * 8);
|
||||
|
||||
auto golem = self->GetVar<int32_t>(u"DragonSmashingGolem");
|
||||
auto golem = self->GetVar<int32_t>(u"DragonSmashingGolem");
|
||||
|
||||
EntityInfo info {};
|
||||
info.lot = golem != 0 ? golem : 8340;
|
||||
info.pos = objectPosition;
|
||||
info.rot = rotation;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.settings = {
|
||||
new LDFData<std::string>(u"rebuild_activators",
|
||||
std::to_string(objectPosition.x + forward.x) + "\x1f" +
|
||||
std::to_string(objectPosition.y) + "\x1f" +
|
||||
std::to_string(objectPosition.z + forward.z)
|
||||
),
|
||||
new LDFData<int32_t>(u"respawn", 100000),
|
||||
new LDFData<float>(u"rebuild_reset_time", 15),
|
||||
new LDFData<bool>(u"no_timed_spawn", true),
|
||||
new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID())
|
||||
};
|
||||
EntityInfo info{};
|
||||
info.lot = golem != 0 ? golem : 8340;
|
||||
info.pos = objectPosition;
|
||||
info.rot = rotation;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.settings = {
|
||||
new LDFData<std::string>(u"rebuild_activators",
|
||||
std::to_string(objectPosition.x + forward.x) + "\x1f" +
|
||||
std::to_string(objectPosition.y) + "\x1f" +
|
||||
std::to_string(objectPosition.z + forward.z)
|
||||
),
|
||||
new LDFData<int32_t>(u"respawn", 100000),
|
||||
new LDFData<float>(u"rebuild_reset_time", 15),
|
||||
new LDFData<bool>(u"no_timed_spawn", true),
|
||||
new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID())
|
||||
};
|
||||
|
||||
auto* golemObject = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* golemObject = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(golemObject);
|
||||
}
|
||||
}
|
||||
EntityManager::Instance()->ConstructEntity(golemObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "ReviveHeldTimer") {
|
||||
self->AddTimer("backToAttack", 2.5);
|
||||
}
|
||||
else if (timerName == "ExposeWeakSpotTimer") {
|
||||
self->SetVar<int32_t>(u"weakspot", 1);
|
||||
}
|
||||
else if (timerName == "timeToStunLoop") {
|
||||
GameMessages::SendPlayAnimation(self, u"stunloop", 1.8f);
|
||||
}
|
||||
else if (timerName == "ReviveTimer") {
|
||||
GameMessages::SendPlayAnimation(self, u"stunend", 2.0f);
|
||||
self->AddTimer("backToAttack", 1);
|
||||
}
|
||||
else if (timerName == "backToAttack") {
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (baseCombatAIComponent != nullptr)
|
||||
{
|
||||
baseCombatAIComponent->SetDisabled(false);
|
||||
baseCombatAIComponent->SetStunned(false);
|
||||
}
|
||||
if (skillComponent != nullptr)
|
||||
{
|
||||
skillComponent->Interrupt();
|
||||
}
|
||||
self->SetVar<int32_t>(u"weakspot", -1);
|
||||
GameMessages::SendNotifyObject(self->GetObjectID(), self->GetObjectID(), u"DragonRevive", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "ReviveHeldTimer") {
|
||||
self->AddTimer("backToAttack", 2.5);
|
||||
} else if (timerName == "ExposeWeakSpotTimer") {
|
||||
self->SetVar<int32_t>(u"weakspot", 1);
|
||||
} else if (timerName == "timeToStunLoop") {
|
||||
GameMessages::SendPlayAnimation(self, u"stunloop", 1.8f);
|
||||
} else if (timerName == "ReviveTimer") {
|
||||
GameMessages::SendPlayAnimation(self, u"stunend", 2.0f);
|
||||
self->AddTimer("backToAttack", 1);
|
||||
} else if (timerName == "backToAttack") {
|
||||
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (baseCombatAIComponent != nullptr) {
|
||||
baseCombatAIComponent->SetDisabled(false);
|
||||
baseCombatAIComponent->SetStunned(false);
|
||||
}
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->Interrupt();
|
||||
}
|
||||
self->SetVar<int32_t>(u"weakspot", -1);
|
||||
GameMessages::SendNotifyObject(self->GetObjectID(), self->GetObjectID(), u"DragonRevive", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
void AmDarklingDragon::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
if (args != "rebuildDone") return;
|
||||
void AmDarklingDragon::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
if (args != "rebuildDone") return;
|
||||
|
||||
self->AddTimer("ExposeWeakSpotTimer", 3.8f);
|
||||
self->AddTimer("ExposeWeakSpotTimer", 3.8f);
|
||||
|
||||
self->CancelTimer("ReviveTimer");
|
||||
self->CancelTimer("ReviveTimer");
|
||||
|
||||
self->AddTimer("ReviveHeldTimer", 10.5f);
|
||||
self->AddTimer("ReviveHeldTimer", 10.5f);
|
||||
|
||||
self->SetVar<LWOOBJID>(u"Golem", sender->GetObjectID());
|
||||
self->SetVar<LWOOBJID>(u"Golem", sender->GetObjectID());
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"quickbuildhold", 1.9f);
|
||||
}
|
||||
GameMessages::SendPlayAnimation(self, u"quickbuildhold", 1.9f);
|
||||
}
|
||||
|
@@ -4,45 +4,45 @@
|
||||
class AmDarklingDragon : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief When called, this function will make self immune to stuns and initialize a weakspot boolean to false.
|
||||
*
|
||||
* @param self The Entity that called this function.
|
||||
*/
|
||||
void OnStartup(Entity* self) override;
|
||||
/**
|
||||
* @brief When called, this function will destroy the golem if it was alive, otherwise returns immediately.
|
||||
*
|
||||
* @param self The Entity that called this function.
|
||||
* @param killer The Entity that killed self.
|
||||
*/
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
/**
|
||||
* @brief When self is hit or healed, this function will check if self is at zero armor. If self is at zero armor, a golem Entity Quick Build
|
||||
* is spawned that, when built, will reveal a weakpoint on the dragon that if hit will smash the dragon instantly. If at more than zero armor,
|
||||
* this function returns early.
|
||||
*
|
||||
* @param self The Entity that was hit.
|
||||
* @param attacker The Entity that attacked self.
|
||||
* @param damage The amount of damage attacker did to self.
|
||||
*/
|
||||
void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
|
||||
/**
|
||||
* @brief Called when self has a timer that ended.
|
||||
*
|
||||
* @param self The Entity who owns a timer that finished.
|
||||
* @param timerName The name of a timer attacked to self that has ended.
|
||||
*/
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
/**
|
||||
* @brief When the Client has finished rebuilding the Golem for the dragon, this function exposes the weak spot for a set amount of time.
|
||||
*
|
||||
* @param self The Entity that called this script.
|
||||
* @param sender The Entity that sent a fired event.
|
||||
* @param args The argument that tells us what event has been fired off.
|
||||
* @param param1 Unused in this script.
|
||||
* @param param2 Unused in this script.
|
||||
* @param param3 Unused in this script.
|
||||
*/
|
||||
void OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
|
||||
/**
|
||||
* @brief When called, this function will make self immune to stuns and initialize a weakspot boolean to false.
|
||||
*
|
||||
* @param self The Entity that called this function.
|
||||
*/
|
||||
void OnStartup(Entity* self) override;
|
||||
/**
|
||||
* @brief When called, this function will destroy the golem if it was alive, otherwise returns immediately.
|
||||
*
|
||||
* @param self The Entity that called this function.
|
||||
* @param killer The Entity that killed self.
|
||||
*/
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
/**
|
||||
* @brief When self is hit or healed, this function will check if self is at zero armor. If self is at zero armor, a golem Entity Quick Build
|
||||
* is spawned that, when built, will reveal a weakpoint on the dragon that if hit will smash the dragon instantly. If at more than zero armor,
|
||||
* this function returns early.
|
||||
*
|
||||
* @param self The Entity that was hit.
|
||||
* @param attacker The Entity that attacked self.
|
||||
* @param damage The amount of damage attacker did to self.
|
||||
*/
|
||||
void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
|
||||
/**
|
||||
* @brief Called when self has a timer that ended.
|
||||
*
|
||||
* @param self The Entity who owns a timer that finished.
|
||||
* @param timerName The name of a timer attacked to self that has ended.
|
||||
*/
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
/**
|
||||
* @brief When the Client has finished rebuilding the Golem for the dragon, this function exposes the weak spot for a set amount of time.
|
||||
*
|
||||
* @param self The Entity that called this script.
|
||||
* @param sender The Entity that sent a fired event.
|
||||
* @param args The argument that tells us what event has been fired off.
|
||||
* @param param1 Unused in this script.
|
||||
* @param param2 Unused in this script.
|
||||
* @param param3 Unused in this script.
|
||||
*/
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
|
||||
};
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#include "AmDarklingMech.h"
|
||||
|
||||
void AmDarklingMech::OnStartup(Entity* self)
|
||||
{
|
||||
BaseEnemyMech::OnStartup(self);
|
||||
qbTurretLOT = 13171;
|
||||
void AmDarklingMech::OnStartup(Entity* self) {
|
||||
BaseEnemyMech::OnStartup(self);
|
||||
qbTurretLOT = 13171;
|
||||
}
|
||||
|
@@ -5,5 +5,5 @@
|
||||
class AmDarklingMech : public BaseEnemyMech
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
};
|
||||
|
@@ -3,141 +3,119 @@
|
||||
#include "GameMessages.h"
|
||||
#include "SimplePhysicsComponent.h"
|
||||
|
||||
void AmDrawBridge::OnStartup(Entity* self)
|
||||
{
|
||||
self->SetNetworkVar(u"InUse", false);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
void AmDrawBridge::OnStartup(Entity* self) {
|
||||
self->SetNetworkVar(u"InUse", false);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
}
|
||||
|
||||
void AmDrawBridge::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
auto* bridge = GetBridge(self);
|
||||
void AmDrawBridge::OnUse(Entity* self, Entity* user) {
|
||||
auto* bridge = GetBridge(self);
|
||||
|
||||
if (bridge == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (bridge == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self->GetNetworkVar<bool>(u"InUse"))
|
||||
{
|
||||
self->SetNetworkVar(u"startEffect", 5);
|
||||
if (!self->GetNetworkVar<bool>(u"InUse")) {
|
||||
self->SetNetworkVar(u"startEffect", 5);
|
||||
|
||||
self->AddTimer("ChangeBridge", 5);
|
||||
self->AddTimer("ChangeBridge", 5);
|
||||
|
||||
self->SetNetworkVar(u"InUse", true);
|
||||
}
|
||||
self->SetNetworkVar(u"InUse", true);
|
||||
}
|
||||
|
||||
auto* player = user;
|
||||
auto* player = user;
|
||||
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
|
||||
void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
if (timerName == "ChangeBridge")
|
||||
{
|
||||
auto* bridge = GetBridge(self);
|
||||
void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "ChangeBridge") {
|
||||
auto* bridge = GetBridge(self);
|
||||
|
||||
if (bridge == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (bridge == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self->GetVar<bool>(u"BridgeDown"))
|
||||
{
|
||||
self->SetVar(u"BridgeDown", true);
|
||||
if (!self->GetVar<bool>(u"BridgeDown")) {
|
||||
self->SetVar(u"BridgeDown", true);
|
||||
|
||||
MoveBridgeDown(self, bridge, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
MoveBridgeDown(self, bridge, true);
|
||||
} else {
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
|
||||
MoveBridgeDown(self, bridge, false);
|
||||
}
|
||||
MoveBridgeDown(self, bridge, false);
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"BridgeLeaving", true);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
}
|
||||
else if (timerName == "SmashEffectBridge")
|
||||
{
|
||||
self->SetNetworkVar(u"SmashBridge", 5);
|
||||
}
|
||||
else if (timerName == "rotateBridgeDown")
|
||||
{
|
||||
auto* bridge = GetBridge(self);
|
||||
self->SetNetworkVar(u"BridgeLeaving", true);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
} else if (timerName == "SmashEffectBridge") {
|
||||
self->SetNetworkVar(u"SmashBridge", 5);
|
||||
} else if (timerName == "rotateBridgeDown") {
|
||||
auto* bridge = GetBridge(self);
|
||||
|
||||
if (bridge == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (bridge == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"BridgeLeaving", false);
|
||||
self->SetNetworkVar(u"BridgeLeaving", false);
|
||||
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (simplePhysicsComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3::ZERO);
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3::ZERO);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(bridge);
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(bridge);
|
||||
}
|
||||
}
|
||||
|
||||
void AmDrawBridge::OnNotifyObject(Entity *self, Entity *sender, const std::string& name, int32_t param1, int32_t param2)
|
||||
{
|
||||
if (name == "BridgeBuilt")
|
||||
{
|
||||
self->SetVar(u"BridgeID", sender->GetObjectID());
|
||||
void AmDrawBridge::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
if (name == "BridgeBuilt") {
|
||||
self->SetVar(u"BridgeID", sender->GetObjectID());
|
||||
|
||||
self->AddTimer("SmashEffectBridge", 45);
|
||||
self->AddTimer("SmashEffectBridge", 45);
|
||||
|
||||
self->SetNetworkVar(u"BridgeDead", true);
|
||||
self->SetNetworkVar(u"BridgeDead", true);
|
||||
|
||||
sender->AddDieCallback([this, self, sender] () {
|
||||
NotifyDie(self, sender);
|
||||
});
|
||||
}
|
||||
sender->AddDieCallback([this, self, sender]() {
|
||||
NotifyDie(self, sender);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down)
|
||||
{
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) {
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (simplePhysicsComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto forwardVect = simplePhysicsComponent->GetRotation().GetForwardVector();
|
||||
auto forwardVect = simplePhysicsComponent->GetRotation().GetForwardVector();
|
||||
|
||||
auto degrees = down ? 90.0f : -90.0f;
|
||||
auto degrees = down ? 90.0f : -90.0f;
|
||||
|
||||
const auto travelTime = 2.0f;
|
||||
const auto travelTime = 2.0f;
|
||||
|
||||
forwardVect = forwardVect * (float) ((degrees / travelTime) * (3.14f / 180.0f));
|
||||
forwardVect = forwardVect * (float)((degrees / travelTime) * (3.14f / 180.0f));
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(forwardVect);
|
||||
simplePhysicsComponent->SetAngularVelocity(forwardVect);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(bridge);
|
||||
EntityManager::Instance()->SerializeEntity(bridge);
|
||||
|
||||
self->AddTimer("rotateBridgeDown", travelTime);
|
||||
self->AddTimer("rotateBridgeDown", travelTime);
|
||||
}
|
||||
|
||||
void AmDrawBridge::NotifyDie(Entity* self, Entity* other)
|
||||
{
|
||||
self->SetNetworkVar(u"InUse", false);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
void AmDrawBridge::NotifyDie(Entity* self, Entity* other) {
|
||||
self->SetNetworkVar(u"InUse", false);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
|
||||
self->CancelAllTimers();
|
||||
self->CancelAllTimers();
|
||||
}
|
||||
|
||||
Entity* AmDrawBridge::GetBridge(Entity* self)
|
||||
{
|
||||
const auto bridgeID = self->GetVar<LWOOBJID>(u"BridgeID");
|
||||
Entity* AmDrawBridge::GetBridge(Entity* self) {
|
||||
const auto bridgeID = self->GetVar<LWOOBJID>(u"BridgeID");
|
||||
|
||||
return EntityManager::Instance()->GetEntity(bridgeID);
|
||||
return EntityManager::Instance()->GetEntity(bridgeID);
|
||||
}
|
||||
|
@@ -4,13 +4,13 @@
|
||||
class AmDrawBridge : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnNotifyObject(Entity *self, Entity *sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
|
||||
void MoveBridgeDown(Entity* self, Entity* bridge, bool down);
|
||||
void NotifyDie(Entity* self, Entity* other);
|
||||
void MoveBridgeDown(Entity* self, Entity* bridge, bool down);
|
||||
void NotifyDie(Entity* self, Entity* other);
|
||||
|
||||
Entity* GetBridge(Entity* self);
|
||||
Entity* GetBridge(Entity* self);
|
||||
};
|
||||
|
@@ -4,94 +4,78 @@
|
||||
#include "InventoryComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
void AmDropshipComputer::OnStartup(Entity* self)
|
||||
{
|
||||
self->AddTimer("reset", 45.0f);
|
||||
void AmDropshipComputer::OnStartup(Entity* self) {
|
||||
self->AddTimer("reset", 45.0f);
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (missionComponent == nullptr || inventoryComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto* missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == MissionState::MISSION_STATE_COMPLETE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (missionComponent == nullptr || inventoryComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(m_NexusTalonDataCard, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == MissionState::MISSION_STATE_COMPLETE) {
|
||||
return;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(m_NexusTalonDataCard, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnDie(Entity* self, Entity* killer)
|
||||
{
|
||||
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
|
||||
void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
|
||||
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
|
||||
|
||||
int32_t pipeNum = 0;
|
||||
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int32_t pipeNum = 0;
|
||||
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto pipeGroup = myGroup.substr(0, 10);
|
||||
const auto pipeGroup = myGroup.substr(0, 10);
|
||||
|
||||
const auto nextPipeNum = pipeNum + 1;
|
||||
const auto nextPipeNum = pipeNum + 1;
|
||||
|
||||
const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup);
|
||||
const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup);
|
||||
|
||||
if (!samePipeSpawners.empty())
|
||||
{
|
||||
samePipeSpawners[0]->SoftReset();
|
||||
if (!samePipeSpawners.empty()) {
|
||||
samePipeSpawners[0]->SoftReset();
|
||||
|
||||
samePipeSpawners[0]->Deactivate();
|
||||
}
|
||||
samePipeSpawners[0]->Deactivate();
|
||||
}
|
||||
|
||||
if (killer != nullptr && killer->IsPlayer())
|
||||
{
|
||||
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
|
||||
if (killer != nullptr && killer->IsPlayer()) {
|
||||
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
|
||||
|
||||
const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
|
||||
if (!nextPipeSpawners.empty())
|
||||
{
|
||||
nextPipeSpawners[0]->Activate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto nextPipe = pipeGroup + "1";
|
||||
if (!nextPipeSpawners.empty()) {
|
||||
nextPipeSpawners[0]->Activate();
|
||||
}
|
||||
} else {
|
||||
const auto nextPipe = pipeGroup + "1";
|
||||
|
||||
const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
|
||||
if (!firstPipeSpawners.empty())
|
||||
{
|
||||
firstPipeSpawners[0]->Activate();
|
||||
}
|
||||
}
|
||||
if (!firstPipeSpawners.empty()) {
|
||||
firstPipeSpawners[0]->Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (rebuildComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "reset" && rebuildComponent->GetState() == REBUILD_OPEN)
|
||||
{
|
||||
self->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
if (timerName == "reset" && rebuildComponent->GetState() == REBUILD_OPEN) {
|
||||
self->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
}
|
||||
|
@@ -4,10 +4,10 @@
|
||||
class AmDropshipComputer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
const LOT m_NexusTalonDataCard = 12323;
|
||||
const LOT m_NexusTalonDataCard = 12323;
|
||||
};
|
||||
|
@@ -1,17 +1,14 @@
|
||||
#include "AmScrollReaderServer.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmScrollReaderServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData)
|
||||
{
|
||||
if (identifier == u"story_end")
|
||||
{
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
void AmScrollReaderServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
if (identifier == u"story_end") {
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
missionComponent->ForceProgressTaskType(969, 1, 1, false);
|
||||
}
|
||||
missionComponent->ForceProgressTaskType(969, 1, 1, false);
|
||||
}
|
||||
}
|
||||
|
@@ -4,5 +4,5 @@
|
||||
class AmScrollReaderServer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
|
||||
};
|
||||
|
@@ -6,167 +6,139 @@
|
||||
#include "BaseCombatAIComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AmShieldGenerator::OnStartup(Entity* self)
|
||||
{
|
||||
self->SetProximityRadius(20, "shield");
|
||||
self->SetProximityRadius(21, "buffer");
|
||||
|
||||
StartShield(self);
|
||||
void AmShieldGenerator::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(20, "shield");
|
||||
self->SetProximityRadius(21, "buffer");
|
||||
|
||||
StartShield(self);
|
||||
}
|
||||
|
||||
void AmShieldGenerator::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status)
|
||||
{
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
void AmShieldGenerator::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (status == "ENTER" && name == "shield")
|
||||
{
|
||||
if (destroyableComponent->HasFaction(4))
|
||||
{
|
||||
EnemyEnteredShield(self, entering);
|
||||
}
|
||||
}
|
||||
|
||||
if (name != "buffer" || !entering->IsPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (status == "ENTER" && name == "shield") {
|
||||
if (destroyableComponent->HasFaction(4)) {
|
||||
EnemyEnteredShield(self, entering);
|
||||
}
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
if (name != "buffer" || !entering->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == "ENTER")
|
||||
{
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
if (iter == entitiesInProximity.end())
|
||||
{
|
||||
entitiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
}
|
||||
else if (status == "LEAVE")
|
||||
{
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
if (status == "ENTER") {
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter != entitiesInProximity.end())
|
||||
{
|
||||
entitiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
if (iter == entitiesInProximity.end()) {
|
||||
entitiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
} else if (status == "LEAVE") {
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Players", entitiesInProximity);
|
||||
if (iter != entitiesInProximity.end()) {
|
||||
entitiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Players", entitiesInProximity);
|
||||
}
|
||||
|
||||
void AmShieldGenerator::OnDie(Entity* self, Entity* killer)
|
||||
{
|
||||
self->CancelAllTimers();
|
||||
void AmShieldGenerator::OnDie(Entity* self, Entity* killer) {
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
|
||||
if (child != nullptr)
|
||||
{
|
||||
child->Kill();
|
||||
}
|
||||
if (child != nullptr) {
|
||||
child->Kill();
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGenerator::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
if (timerName == "BuffPlayers")
|
||||
{
|
||||
BuffPlayers(self);
|
||||
void AmShieldGenerator::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "BuffPlayers") {
|
||||
BuffPlayers(self);
|
||||
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
}
|
||||
else if (timerName == "PlayFX")
|
||||
{
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 5351, u"generatorOn", "generatorOn");
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
} else if (timerName == "PlayFX") {
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 5351, u"generatorOn", "generatorOn");
|
||||
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
}
|
||||
else if (timerName == "RefreshEnemies")
|
||||
{
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
} else if (timerName == "RefreshEnemies") {
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity)
|
||||
{
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr)
|
||||
{
|
||||
EnemyEnteredShield(self, enemy);
|
||||
}
|
||||
}
|
||||
if (enemy != nullptr) {
|
||||
EnemyEnteredShield(self, enemy);
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
}
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGenerator::StartShield(Entity* self)
|
||||
{
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
void AmShieldGenerator::StartShield(Entity* self) {
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
|
||||
const auto myPos = self->GetPosition();
|
||||
const auto myRot = self->GetRotation();
|
||||
const auto myPos = self->GetPosition();
|
||||
const auto myRot = self->GetRotation();
|
||||
|
||||
EntityInfo info {};
|
||||
info.lot = 13111;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
EntityInfo info{};
|
||||
info.lot = 13111;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
self->SetVar(u"Child", child->GetObjectID());
|
||||
self->SetVar(u"Child", child->GetObjectID());
|
||||
|
||||
BuffPlayers(self);
|
||||
BuffPlayers(self);
|
||||
}
|
||||
|
||||
void AmShieldGenerator::BuffPlayers(Entity* self)
|
||||
{
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
void AmShieldGenerator::BuffPlayers(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity)
|
||||
{
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
skillComponent->CalculateBehavior(1200, 27024, playerID, true);
|
||||
}
|
||||
skillComponent->CalculateBehavior(1200, 27024, playerID, true);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGenerator::EnemyEnteredShield(Entity* self, Entity* intruder)
|
||||
{
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
void AmShieldGenerator::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dir = intruder->GetRotation().GetForwardVector() * -1;
|
||||
dir.y += 15;
|
||||
dir.x *= 50;
|
||||
dir.z *= 50;
|
||||
auto dir = intruder->GetRotation().GetForwardVector() * -1;
|
||||
dir.y += 15;
|
||||
dir.x *= 50;
|
||||
dir.z *= 50;
|
||||
|
||||
// TODO: Figure out how todo knockback, I'll stun them for now
|
||||
// TODO: Figure out how todo knockback, I'll stun them for now
|
||||
|
||||
if (NiPoint3::DistanceSquared(self->GetPosition(), movementAIComponent->GetCurrentPosition()) < 20 * 20)
|
||||
{
|
||||
baseCombatAIComponent->Stun(2.0f);
|
||||
movementAIComponent->SetDestination(baseCombatAIComponent->GetStartPosition());
|
||||
}
|
||||
if (NiPoint3::DistanceSquared(self->GetPosition(), movementAIComponent->GetCurrentPosition()) < 20 * 20) {
|
||||
baseCombatAIComponent->Stun(2.0f);
|
||||
movementAIComponent->SetDestination(baseCombatAIComponent->GetStartPosition());
|
||||
}
|
||||
|
||||
baseCombatAIComponent->ClearThreat();
|
||||
baseCombatAIComponent->ClearThreat();
|
||||
}
|
||||
|
@@ -4,12 +4,12 @@
|
||||
class AmShieldGenerator : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
void StartShield(Entity* self);
|
||||
void BuffPlayers(Entity* self);
|
||||
void EnemyEnteredShield(Entity* self, Entity* intruder);
|
||||
void StartShield(Entity* self);
|
||||
void BuffPlayers(Entity* self);
|
||||
void EnemyEnteredShield(Entity* self, Entity* intruder);
|
||||
};
|
||||
|
@@ -8,235 +8,195 @@
|
||||
#include "RebuildComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnStartup(Entity* self)
|
||||
{
|
||||
self->SetProximityRadius(20, "shield");
|
||||
self->SetProximityRadius(21, "buffer");
|
||||
void AmShieldGeneratorQuickbuild::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(20, "shield");
|
||||
self->SetProximityRadius(21, "buffer");
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status)
|
||||
{
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
void AmShieldGeneratorQuickbuild::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (name == "shield")
|
||||
{
|
||||
if (!destroyableComponent->HasFaction(4) || entering->IsPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (name == "shield") {
|
||||
if (!destroyableComponent->HasFaction(4) || entering->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
if (status == "ENTER")
|
||||
{
|
||||
EnemyEnteredShield(self, entering);
|
||||
if (status == "ENTER") {
|
||||
EnemyEnteredShield(self, entering);
|
||||
|
||||
const auto& iter = std::find(enemiesInProximity.begin(), enemiesInProximity.end(), entering->GetObjectID());
|
||||
const auto& iter = std::find(enemiesInProximity.begin(), enemiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter == enemiesInProximity.end())
|
||||
{
|
||||
enemiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
}
|
||||
else if (status == "LEAVE")
|
||||
{
|
||||
const auto& iter = std::find(enemiesInProximity.begin(), enemiesInProximity.end(), entering->GetObjectID());
|
||||
if (iter == enemiesInProximity.end()) {
|
||||
enemiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
} else if (status == "LEAVE") {
|
||||
const auto& iter = std::find(enemiesInProximity.begin(), enemiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter != enemiesInProximity.end())
|
||||
{
|
||||
enemiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
if (iter != enemiesInProximity.end()) {
|
||||
enemiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Enemies", enemiesInProximity);
|
||||
}
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Enemies", enemiesInProximity);
|
||||
}
|
||||
|
||||
if (name != "buffer" || !entering->IsPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (name != "buffer" || !entering->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
if (status == "ENTER")
|
||||
{
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
if (status == "ENTER") {
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter == entitiesInProximity.end())
|
||||
{
|
||||
entitiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
}
|
||||
else if (status == "LEAVE")
|
||||
{
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
if (iter == entitiesInProximity.end()) {
|
||||
entitiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
} else if (status == "LEAVE") {
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter != entitiesInProximity.end())
|
||||
{
|
||||
entitiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
if (iter != entitiesInProximity.end()) {
|
||||
entitiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Players", entitiesInProximity);
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Players", entitiesInProximity);
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnDie(Entity* self, Entity* killer)
|
||||
{
|
||||
self->CancelAllTimers();
|
||||
void AmShieldGeneratorQuickbuild::OnDie(Entity* self, Entity* killer) {
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
|
||||
if (child != nullptr)
|
||||
{
|
||||
child->Kill();
|
||||
}
|
||||
if (child != nullptr) {
|
||||
child->Kill();
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
if (timerName == "BuffPlayers")
|
||||
{
|
||||
BuffPlayers(self);
|
||||
void AmShieldGeneratorQuickbuild::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "BuffPlayers") {
|
||||
BuffPlayers(self);
|
||||
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
}
|
||||
else if (timerName == "PlayFX")
|
||||
{
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 5351, u"generatorOn", "generatorOn");
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
} else if (timerName == "PlayFX") {
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 5351, u"generatorOn", "generatorOn");
|
||||
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
}
|
||||
else if (timerName == "RefreshEnemies")
|
||||
{
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
} else if (timerName == "RefreshEnemies") {
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity)
|
||||
{
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr)
|
||||
{
|
||||
EnemyEnteredShield(self, enemy);
|
||||
}
|
||||
}
|
||||
if (enemy != nullptr) {
|
||||
EnemyEnteredShield(self, enemy);
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
}
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target)
|
||||
{
|
||||
StartShield(self);
|
||||
void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
StartShield(self);
|
||||
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity)
|
||||
{
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr)
|
||||
{
|
||||
enemy->Smash();
|
||||
}
|
||||
}
|
||||
if (enemy != nullptr) {
|
||||
enemy->Smash();
|
||||
}
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity)
|
||||
{
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (player == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (missionComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
missionComponent->ForceProgressTaskType(987, 1, 1, false);
|
||||
}
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
missionComponent->ForceProgressTaskType(987, 1, 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::StartShield(Entity* self)
|
||||
{
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
void AmShieldGeneratorQuickbuild::StartShield(Entity* self) {
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
|
||||
const auto myPos = self->GetPosition();
|
||||
const auto myRot = self->GetRotation();
|
||||
const auto myPos = self->GetPosition();
|
||||
const auto myRot = self->GetRotation();
|
||||
|
||||
EntityInfo info {};
|
||||
info.lot = 13111;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
EntityInfo info{};
|
||||
info.lot = 13111;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
self->SetVar(u"Child", child->GetObjectID());
|
||||
self->SetVar(u"Child", child->GetObjectID());
|
||||
|
||||
BuffPlayers(self);
|
||||
BuffPlayers(self);
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self)
|
||||
{
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity)
|
||||
{
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
skillComponent->CalculateBehavior(1200, 27024, playerID, true);
|
||||
}
|
||||
skillComponent->CalculateBehavior(1200, 27024, playerID, true);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder)
|
||||
{
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dir = intruder->GetRotation().GetForwardVector() * -1;
|
||||
dir.y += 15;
|
||||
dir.x *= 50;
|
||||
dir.z *= 50;
|
||||
auto dir = intruder->GetRotation().GetForwardVector() * -1;
|
||||
dir.y += 15;
|
||||
dir.x *= 50;
|
||||
dir.z *= 50;
|
||||
|
||||
// TODO: Figure out how todo knockback, I'll stun them for now
|
||||
// TODO: Figure out how todo knockback, I'll stun them for now
|
||||
|
||||
if (NiPoint3::DistanceSquared(self->GetPosition(), movementAIComponent->GetCurrentPosition()) < 20 * 20)
|
||||
{
|
||||
baseCombatAIComponent->Stun(2.0f);
|
||||
movementAIComponent->SetDestination(baseCombatAIComponent->GetStartPosition());
|
||||
}
|
||||
if (NiPoint3::DistanceSquared(self->GetPosition(), movementAIComponent->GetCurrentPosition()) < 20 * 20) {
|
||||
baseCombatAIComponent->Stun(2.0f);
|
||||
movementAIComponent->SetDestination(baseCombatAIComponent->GetStartPosition());
|
||||
}
|
||||
|
||||
baseCombatAIComponent->ClearThreat();
|
||||
baseCombatAIComponent->ClearThreat();
|
||||
}
|
||||
|
@@ -4,13 +4,13 @@
|
||||
class AmShieldGeneratorQuickbuild : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
|
||||
void StartShield(Entity* self);
|
||||
void BuffPlayers(Entity* self);
|
||||
void EnemyEnteredShield(Entity* self, Entity* intruder);
|
||||
void StartShield(Entity* self);
|
||||
void BuffPlayers(Entity* self);
|
||||
void EnemyEnteredShield(Entity* self, Entity* intruder);
|
||||
};
|
||||
|
@@ -2,26 +2,23 @@
|
||||
#include "DestroyableComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AmSkeletonEngineer::OnHit(Entity* self, Entity* attacker)
|
||||
{
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
void AmSkeletonEngineer::OnHit(Entity* self, Entity* attacker) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (destroyableComponent == nullptr || skillComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (destroyableComponent->GetHealth() < 12 && !self->GetVar<bool>(u"injured"))
|
||||
{
|
||||
self->SetVar(u"injured", true);
|
||||
if (destroyableComponent->GetHealth() < 12 && !self->GetVar<bool>(u"injured")) {
|
||||
self->SetVar(u"injured", true);
|
||||
|
||||
skillComponent->CalculateBehavior(953, 19864, self->GetObjectID(), true);
|
||||
skillComponent->CalculateBehavior(953, 19864, self->GetObjectID(), true);
|
||||
|
||||
const auto attackerID = attacker->GetObjectID();
|
||||
const auto attackerID = attacker->GetObjectID();
|
||||
|
||||
self->AddCallbackTimer(4.5f, [this, self, attackerID] () {
|
||||
self->Smash(attackerID);
|
||||
});
|
||||
}
|
||||
self->AddCallbackTimer(4.5f, [this, self, attackerID]() {
|
||||
self->Smash(attackerID);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -5,5 +5,5 @@
|
||||
class AmSkeletonEngineer : public EnemyNjBuff
|
||||
{
|
||||
public:
|
||||
void OnHit(Entity* self, Entity* attacker) override;
|
||||
void OnHit(Entity* self, Entity* attacker) override;
|
||||
};
|
||||
|
@@ -5,372 +5,319 @@
|
||||
#include "ProximityMonitorComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmSkullkinDrill::OnStartup(Entity* self)
|
||||
{
|
||||
self->SetNetworkVar(u"bIsInUse", false);
|
||||
self->SetVar(u"bActive", true);
|
||||
void AmSkullkinDrill::OnStartup(Entity* self) {
|
||||
self->SetNetworkVar(u"bIsInUse", false);
|
||||
self->SetVar(u"bActive", true);
|
||||
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active");
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active");
|
||||
|
||||
if (movingPlatformComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
movingPlatformComponent->SetSerialized(true);
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
movingPlatformComponent->GotoWaypoint(0);
|
||||
movingPlatformComponent->SetSerialized(true);
|
||||
|
||||
auto* standObj = GetStandObj(self);
|
||||
movingPlatformComponent->GotoWaypoint(0);
|
||||
|
||||
if (standObj != nullptr)
|
||||
{
|
||||
standObj->SetVar(u"bActive", true);
|
||||
}
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
self->SetProximityRadius(5, "spin_distance");
|
||||
if (standObj != nullptr) {
|
||||
standObj->SetVar(u"bActive", true);
|
||||
}
|
||||
|
||||
self->SetProximityRadius(5, "spin_distance");
|
||||
}
|
||||
|
||||
Entity* AmSkullkinDrill::GetStandObj(Entity* self)
|
||||
{
|
||||
const auto& myGroup = self->GetGroups();
|
||||
Entity* AmSkullkinDrill::GetStandObj(Entity* self) {
|
||||
const auto& myGroup = self->GetGroups();
|
||||
|
||||
if (myGroup.empty())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
if (myGroup.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string groupName = "Drill_Stand_";
|
||||
std::string groupName = "Drill_Stand_";
|
||||
|
||||
groupName.push_back(myGroup[0][myGroup[0].size() - 1]);
|
||||
groupName.push_back(myGroup[0][myGroup[0].size() - 1]);
|
||||
|
||||
const auto standObjs = EntityManager::Instance()->GetEntitiesInGroup(groupName);
|
||||
const auto standObjs = EntityManager::Instance()->GetEntitiesInGroup(groupName);
|
||||
|
||||
if (standObjs.empty())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
if (standObjs.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return standObjs[0];
|
||||
return standObjs[0];
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message)
|
||||
{
|
||||
if (message != "NinjagoSpinEvent" || self->GetNetworkVar<bool>(u"bIsInUse"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
void AmSkullkinDrill::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
|
||||
if (message != "NinjagoSpinEvent" || self->GetNetworkVar<bool>(u"bIsInUse")) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
|
||||
if (proximityMonitorComponent == nullptr || !proximityMonitorComponent->IsInProximity("spin_distance", caster->GetObjectID()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (proximityMonitorComponent == nullptr || !proximityMonitorComponent->IsInProximity("spin_distance", caster->GetObjectID())) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar(u"activaterID", caster->GetObjectID());
|
||||
self->SetVar(u"activaterID", caster->GetObjectID());
|
||||
|
||||
self->SetNetworkVar(u"bIsInUse", true);
|
||||
self->SetNetworkVar(u"bIsInUse", true);
|
||||
|
||||
TriggerDrill(self);
|
||||
TriggerDrill(self);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::TriggerDrill(Entity* self)
|
||||
{
|
||||
GameMessages::SendPlayAnimation(self, u"slowdown");
|
||||
void AmSkullkinDrill::TriggerDrill(Entity* self) {
|
||||
GameMessages::SendPlayAnimation(self, u"slowdown");
|
||||
|
||||
self->AddTimer("killDrill", 10.0f);
|
||||
|
||||
auto* standObj = GetStandObj(self);
|
||||
self->AddTimer("killDrill", 10.0f);
|
||||
|
||||
if (standObj != nullptr)
|
||||
{
|
||||
standObj->SetVar(u"bActive", false);
|
||||
}
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
if (standObj != nullptr) {
|
||||
standObj->SetVar(u"bActive", false);
|
||||
}
|
||||
|
||||
if (movingPlatformComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
movingPlatformComponent->GotoWaypoint(1);
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
movingPlatformComponent->GotoWaypoint(1);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnWaypointReached(Entity* self, uint32_t waypointIndex)
|
||||
{
|
||||
if (waypointIndex == 1)
|
||||
{
|
||||
auto myPos = self->GetPosition();
|
||||
auto myRot = self->GetRotation();
|
||||
void AmSkullkinDrill::OnWaypointReached(Entity* self, uint32_t waypointIndex) {
|
||||
if (waypointIndex == 1) {
|
||||
auto myPos = self->GetPosition();
|
||||
auto myRot = self->GetRotation();
|
||||
|
||||
myPos.y -= 21;
|
||||
myPos.y -= 21;
|
||||
|
||||
EntityInfo info = {};
|
||||
info.lot = 12346;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.scale = 3; // Needs the scale, otherwise attacks fail
|
||||
info.spawnerID = self->GetObjectID();
|
||||
EntityInfo info = {};
|
||||
info.lot = 12346;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.scale = 3; // Needs the scale, otherwise attacks fail
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(child);
|
||||
EntityManager::Instance()->ConstructEntity(child);
|
||||
|
||||
self->SetVar(u"ChildSmash", child->GetObjectID());
|
||||
self->SetVar(u"ChildSmash", child->GetObjectID());
|
||||
|
||||
child->AddDieCallback([this, self] () {
|
||||
const auto& userID = self->GetVar<LWOOBJID>(u"activaterID");
|
||||
child->AddDieCallback([this, self]() {
|
||||
const auto& userID = self->GetVar<LWOOBJID>(u"activaterID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(userID);
|
||||
auto* player = EntityManager::Instance()->GetEntity(userID);
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
OnHitOrHealResult(self, player, 1);
|
||||
});
|
||||
}
|
||||
|
||||
OnArrived(self, waypointIndex);
|
||||
OnHitOrHealResult(self, player, 1);
|
||||
});
|
||||
}
|
||||
|
||||
OnArrived(self, waypointIndex);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
if (self->GetNetworkVar<bool>(u"bIsInUse"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
void AmSkullkinDrill::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetNetworkVar<bool>(u"bIsInUse")) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"bIsInUse", true);
|
||||
self->SetNetworkVar(u"bIsInUse", true);
|
||||
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 5499, u"on-anim", "tornado");
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 5502, u"on-anim", "staff");
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 5499, u"on-anim", "tornado");
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 5502, u"on-anim", "staff");
|
||||
|
||||
const auto userID = user->GetObjectID();
|
||||
const auto userID = user->GetObjectID();
|
||||
|
||||
self->SetVar(u"userID", userID);
|
||||
self->SetVar(u"activaterID", userID);
|
||||
self->SetVar(u"userID", userID);
|
||||
self->SetVar(u"activaterID", userID);
|
||||
|
||||
PlayAnim(self, user, "spinjitzu-staff-windup");
|
||||
PlayCinematic(self);
|
||||
PlayAnim(self, user, "spinjitzu-staff-windup");
|
||||
PlayCinematic(self);
|
||||
|
||||
FreezePlayer(self, user, true);
|
||||
FreezePlayer(self, user, true);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze)
|
||||
{
|
||||
eStunState eChangeType = POP;
|
||||
void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze) {
|
||||
eStunState eChangeType = POP;
|
||||
|
||||
if (bFreeze)
|
||||
{
|
||||
if (player->GetIsDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (bFreeze) {
|
||||
if (player->GetIsDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
eChangeType = PUSH;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->GetIsDead())
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
GameMessages::SendSetStunned(player->GetObjectID(), eChangeType, player->GetSystemAddress(), self->GetObjectID(),
|
||||
true, false, true, false, true, false, true
|
||||
);
|
||||
eChangeType = PUSH;
|
||||
} else {
|
||||
if (player->GetIsDead()) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
GameMessages::SendSetStunned(player->GetObjectID(), eChangeType, player->GetSystemAddress(), self->GetObjectID(),
|
||||
true, false, true, false, true, false, true
|
||||
);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex)
|
||||
{
|
||||
auto* standObj = GetStandObj(self);
|
||||
void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
if (waypointIndex == 1)
|
||||
{
|
||||
GameMessages::SendPlayAnimation(self, u"no-spin");
|
||||
GameMessages::SendStopFXEffect(self, true, "active");
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"indicator", "indicator");
|
||||
if (waypointIndex == 1) {
|
||||
GameMessages::SendPlayAnimation(self, u"no-spin");
|
||||
GameMessages::SendStopFXEffect(self, true, "active");
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"indicator", "indicator");
|
||||
|
||||
self->SetVar(u"bActive", false);
|
||||
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
|
||||
self->SetVar(u"bActive", false);
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
if (player != nullptr)
|
||||
{
|
||||
PlayAnim(self, player, "spinjitzu-staff-end");
|
||||
}
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (standObj != nullptr)
|
||||
{
|
||||
standObj->SetVar(u"bActive", false);
|
||||
}
|
||||
if (player != nullptr) {
|
||||
PlayAnim(self, player, "spinjitzu-staff-end");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMessages::SendPlayAnimation(self, u"idle");
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active");
|
||||
GameMessages::SendStopFXEffect(self, true, "indicator");
|
||||
}
|
||||
if (standObj != nullptr) {
|
||||
standObj->SetVar(u"bActive", false);
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
GameMessages::SendPlayAnimation(self, u"idle");
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active");
|
||||
GameMessages::SendStopFXEffect(self, true, "indicator");
|
||||
}
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::PlayCinematic(Entity* self)
|
||||
{
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"userID"));
|
||||
void AmSkullkinDrill::PlayCinematic(Entity* self) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"userID"));
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& cine = self->GetVar<std::u16string>(u"cinematic");
|
||||
const auto& cine = self->GetVar<std::u16string>(u"cinematic");
|
||||
|
||||
if (cine.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (cine.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), cine, player->GetSystemAddress());
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), cine, player->GetSystemAddress());
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::PlayAnim(Entity* self, Entity* player, const std::string& animName)
|
||||
{
|
||||
const auto animTime = animName == "spinjitzu-staff-end" ? 0.5f : 1.0f;
|
||||
void AmSkullkinDrill::PlayAnim(Entity* self, Entity* player, const std::string& animName) {
|
||||
const auto animTime = animName == "spinjitzu-staff-end" ? 0.5f : 1.0f;
|
||||
|
||||
GameMessages::SendPlayAnimation(player, GeneralUtils::ASCIIToUTF16(animName));
|
||||
GameMessages::SendPlayAnimation(player, GeneralUtils::ASCIIToUTF16(animName));
|
||||
|
||||
self->AddTimer("AnimDone_" + animName, animTime);
|
||||
self->AddTimer("AnimDone_" + animName, animTime);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage)
|
||||
{
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || !attacker->IsPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (destroyableComponent == nullptr || !attacker->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->GetVar<bool>(u"bActive"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (self->GetVar<bool>(u"bActive")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto activaterID = self->GetVar<LWOOBJID>(u"activaterID");
|
||||
const auto activaterID = self->GetVar<LWOOBJID>(u"activaterID");
|
||||
|
||||
auto* activator = EntityManager::Instance()->GetEntity(activaterID);
|
||||
auto* activator = EntityManager::Instance()->GetEntity(activaterID);
|
||||
|
||||
// TODO: Missions
|
||||
if (activator != nullptr)
|
||||
{
|
||||
auto* missionComponent = activator->GetComponent<MissionComponent>();
|
||||
// TODO: Missions
|
||||
if (activator != nullptr) {
|
||||
auto* missionComponent = activator->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr)
|
||||
{
|
||||
for (const auto missionID : m_MissionsToUpdate)
|
||||
{
|
||||
missionComponent->ForceProgressValue(missionID, 1, self->GetLOT());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (missionComponent != nullptr) {
|
||||
for (const auto missionID : m_MissionsToUpdate) {
|
||||
missionComponent->ForceProgressValue(missionID, 1, self->GetLOT());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self->Smash(attacker->GetObjectID(), SILENT);
|
||||
self->Smash(attacker->GetObjectID(), SILENT);
|
||||
|
||||
self->CancelAllTimers();
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* standObj = GetStandObj(self);
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
if (standObj != nullptr)
|
||||
{
|
||||
GameMessages::SendPlayFXEffect(standObj->GetObjectID(), 4946, u"explode", "explode");
|
||||
}
|
||||
if (standObj != nullptr) {
|
||||
GameMessages::SendPlayFXEffect(standObj->GetObjectID(), 4946, u"explode", "explode");
|
||||
}
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
if (timerName == "killDrill")
|
||||
{
|
||||
const auto childID = self->GetVar<LWOOBJID>(u"ChildSmash");
|
||||
void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "killDrill") {
|
||||
const auto childID = self->GetVar<LWOOBJID>(u"ChildSmash");
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(childID);
|
||||
auto* child = EntityManager::Instance()->GetEntity(childID);
|
||||
|
||||
if (child != nullptr)
|
||||
{
|
||||
child->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
if (child != nullptr) {
|
||||
child->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"bIsInUse", false);
|
||||
self->SetVar(u"bActive", true);
|
||||
self->SetVar(u"activaterID", LWOOBJID_EMPTY);
|
||||
self->SetNetworkVar(u"bIsInUse", false);
|
||||
self->SetVar(u"bActive", true);
|
||||
self->SetVar(u"activaterID", LWOOBJID_EMPTY);
|
||||
|
||||
auto* standObj = GetStandObj(self);
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
if (standObj != nullptr)
|
||||
{
|
||||
standObj->SetVar(u"bActive", true);
|
||||
}
|
||||
if (standObj != nullptr) {
|
||||
standObj->SetVar(u"bActive", true);
|
||||
}
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
movingPlatformComponent->GotoWaypoint(0);
|
||||
movingPlatformComponent->GotoWaypoint(0);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& data = GeneralUtils::SplitString(timerName, '_');
|
||||
const auto& data = GeneralUtils::SplitString(timerName, '_');
|
||||
|
||||
if (data.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (data.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data[0] == "AnimDone")
|
||||
{
|
||||
const auto& animName = data[1];
|
||||
if (data[0] == "AnimDone") {
|
||||
const auto& animName = data[1];
|
||||
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (animName == "spinjitzu-staff-windup")
|
||||
{
|
||||
TriggerDrill(self);
|
||||
if (animName == "spinjitzu-staff-windup") {
|
||||
TriggerDrill(self);
|
||||
|
||||
GameMessages::SendPlayAnimation(player, u"spinjitzu-staff-loop");
|
||||
}
|
||||
else if (animName == "spinjitzu-staff-end")
|
||||
{
|
||||
FreezePlayer(self, player, false);
|
||||
GameMessages::SendPlayAnimation(player, u"spinjitzu-staff-loop");
|
||||
} else if (animName == "spinjitzu-staff-end") {
|
||||
FreezePlayer(self, player, false);
|
||||
|
||||
self->SetVar(u"userID", LWOOBJID_EMPTY);
|
||||
self->SetVar(u"userID", LWOOBJID_EMPTY);
|
||||
|
||||
GameMessages::SendStopFXEffect(player, true, "tornado");
|
||||
GameMessages::SendStopFXEffect(player, true, "staff");
|
||||
}
|
||||
GameMessages::SendStopFXEffect(player, true, "tornado");
|
||||
GameMessages::SendStopFXEffect(player, true, "staff");
|
||||
}
|
||||
|
||||
}
|
||||
else if (data[0] == "TryUnFreezeAgain")
|
||||
{
|
||||
} else if (data[0] == "TryUnFreezeAgain") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,30 +4,30 @@
|
||||
class AmSkullkinDrill : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
|
||||
Entity* GetStandObj(Entity* self);
|
||||
Entity* GetStandObj(Entity* self);
|
||||
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
|
||||
void TriggerDrill(Entity* self);
|
||||
void TriggerDrill(Entity* self);
|
||||
|
||||
void OnWaypointReached(Entity* self, uint32_t waypointIndex) override;
|
||||
void OnWaypointReached(Entity* self, uint32_t waypointIndex) override;
|
||||
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
|
||||
void FreezePlayer(Entity* self, Entity* player, bool bFreeze);
|
||||
void FreezePlayer(Entity* self, Entity* player, bool bFreeze);
|
||||
|
||||
void OnArrived(Entity* self, uint32_t waypointIndex);
|
||||
void OnArrived(Entity* self, uint32_t waypointIndex);
|
||||
|
||||
void PlayCinematic(Entity* self);
|
||||
void PlayCinematic(Entity* self);
|
||||
|
||||
void PlayAnim(Entity* self, Entity* player, const std::string& animName);
|
||||
void PlayAnim(Entity* self, Entity* player, const std::string& animName);
|
||||
|
||||
void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
|
||||
void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
|
||||
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
private:
|
||||
std::vector<int32_t> m_MissionsToUpdate = {972, 1305, 1308};
|
||||
std::vector<int32_t> m_MissionsToUpdate = { 972, 1305, 1308 };
|
||||
};
|
||||
|
@@ -2,39 +2,34 @@
|
||||
#include "GameMessages.h"
|
||||
#include "dpEntity.h"
|
||||
|
||||
void AmSkullkinDrillStand::OnStartup(Entity* self)
|
||||
{
|
||||
self->SetVar(u"bActive", true);
|
||||
void AmSkullkinDrillStand::OnStartup(Entity* self) {
|
||||
self->SetVar(u"bActive", true);
|
||||
|
||||
self->SetProximityRadius(new dpEntity(self->GetObjectID(), {6, 14, 6}), "knockback");
|
||||
self->SetProximityRadius(new dpEntity(self->GetObjectID(), { 6, 14, 6 }), "knockback");
|
||||
}
|
||||
|
||||
void AmSkullkinDrillStand::OnNotifyObject(Entity *self, Entity *sender, const std::string& name, int32_t param1, int32_t param2)
|
||||
{
|
||||
|
||||
void AmSkullkinDrillStand::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
|
||||
}
|
||||
|
||||
void AmSkullkinDrillStand::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status)
|
||||
{
|
||||
if (!self->GetVar<bool>(u"bActive"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
void AmSkullkinDrillStand::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (!self->GetVar<bool>(u"bActive")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entering->IsPlayer() || status != "ENTER" || name != "knockback")
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!entering->IsPlayer() || status != "ENTER" || name != "knockback") {
|
||||
return;
|
||||
}
|
||||
|
||||
auto myPos = self->GetPosition();
|
||||
auto myPos = self->GetPosition();
|
||||
|
||||
auto objPos = entering->GetPosition();
|
||||
auto objPos = entering->GetPosition();
|
||||
|
||||
NiPoint3 newVec = {(objPos.x - myPos.x) * 4.5f, 15, (objPos.z - myPos.z) * 4.5f};
|
||||
NiPoint3 newVec = { (objPos.x - myPos.x) * 4.5f, 15, (objPos.z - myPos.z) * 4.5f };
|
||||
|
||||
GameMessages::SendKnockback(entering->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, newVec);
|
||||
GameMessages::SendKnockback(entering->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, newVec);
|
||||
|
||||
GameMessages::SendPlayFXEffect(entering->GetObjectID(), 1378, u"create", "pushBack");
|
||||
|
||||
GameMessages::SendPlayAnimation(entering, u"knockback-recovery");
|
||||
GameMessages::SendPlayFXEffect(entering->GetObjectID(), 1378, u"create", "pushBack");
|
||||
|
||||
GameMessages::SendPlayAnimation(entering, u"knockback-recovery");
|
||||
}
|
||||
|
@@ -4,9 +4,9 @@
|
||||
class AmSkullkinDrillStand : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
|
||||
void OnNotifyObject(Entity *self, Entity *sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
};
|
||||
|
@@ -5,278 +5,239 @@
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmSkullkinTower::OnStartup(Entity* self)
|
||||
{
|
||||
self->SetProximityRadius(20, "Tower");
|
||||
void AmSkullkinTower::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(20, "Tower");
|
||||
|
||||
// onPhysicsComponentReady
|
||||
// onPhysicsComponentReady
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent != nullptr)
|
||||
{
|
||||
movingPlatformComponent->StopPathing();
|
||||
}
|
||||
if (movingPlatformComponent != nullptr) {
|
||||
movingPlatformComponent->StopPathing();
|
||||
}
|
||||
|
||||
SpawnLegs(self, "Left");
|
||||
SpawnLegs(self, "Right");
|
||||
SpawnLegs(self, "Rear");
|
||||
SpawnLegs(self, "Left");
|
||||
SpawnLegs(self, "Right");
|
||||
SpawnLegs(self, "Rear");
|
||||
}
|
||||
|
||||
void AmSkullkinTower::SpawnLegs(Entity* self, const std::string& loc)
|
||||
{
|
||||
auto pos = self->GetPosition();
|
||||
auto rot = self->GetRotation();
|
||||
pos.y += self->GetVarAs<float>(u"vert_offset");
|
||||
void AmSkullkinTower::SpawnLegs(Entity* self, const std::string& loc) {
|
||||
auto pos = self->GetPosition();
|
||||
auto rot = self->GetRotation();
|
||||
pos.y += self->GetVarAs<float>(u"vert_offset");
|
||||
|
||||
auto newRot = rot;
|
||||
auto offset = self->GetVarAs<float>(u"hort_offset");
|
||||
auto newRot = rot;
|
||||
auto offset = self->GetVarAs<float>(u"hort_offset");
|
||||
|
||||
auto legLOT = self->GetVar<LOT>(u"legLOT");
|
||||
auto legLOT = self->GetVar<LOT>(u"legLOT");
|
||||
|
||||
if (legLOT == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (legLOT == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<LDFBaseData*> config = { new LDFData<std::string>(u"Leg", loc) };
|
||||
std::vector<LDFBaseData*> config = { new LDFData<std::string>(u"Leg", loc) };
|
||||
|
||||
EntityInfo info {};
|
||||
info.lot = legLOT;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.settings = config;
|
||||
info.rot = newRot;
|
||||
EntityInfo info{};
|
||||
info.lot = legLOT;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.settings = config;
|
||||
info.rot = newRot;
|
||||
|
||||
if (loc == "Right")
|
||||
{
|
||||
const auto dir = rot.GetForwardVector();
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
}
|
||||
else if (loc == "Rear")
|
||||
{
|
||||
const auto dir = rot.GetRightVector();
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
}
|
||||
else if (loc == "Left")
|
||||
{
|
||||
const auto dir = rot.GetForwardVector() * -1;
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
}
|
||||
if (loc == "Right") {
|
||||
const auto dir = rot.GetForwardVector();
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
} else if (loc == "Rear") {
|
||||
const auto dir = rot.GetRightVector();
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
} else if (loc == "Left") {
|
||||
const auto dir = rot.GetForwardVector() * -1;
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
}
|
||||
|
||||
info.rot = NiQuaternion::LookAt(info.pos, self->GetPosition());
|
||||
info.rot = NiQuaternion::LookAt(info.pos, self->GetPosition());
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
|
||||
OnChildLoaded(self, entity);
|
||||
OnChildLoaded(self, entity);
|
||||
}
|
||||
|
||||
void AmSkullkinTower::OnChildLoaded(Entity* self, Entity* child)
|
||||
{
|
||||
auto legTable = self->GetVar<std::vector<LWOOBJID>>(u"legTable");
|
||||
void AmSkullkinTower::OnChildLoaded(Entity* self, Entity* child) {
|
||||
auto legTable = self->GetVar<std::vector<LWOOBJID>>(u"legTable");
|
||||
|
||||
legTable.push_back(child->GetObjectID());
|
||||
legTable.push_back(child->GetObjectID());
|
||||
|
||||
self->SetVar(u"legTable", legTable);
|
||||
self->SetVar(u"legTable", legTable);
|
||||
|
||||
const auto selfID = self->GetObjectID();
|
||||
const auto selfID = self->GetObjectID();
|
||||
|
||||
child->AddDieCallback([this, selfID, child] () {
|
||||
auto* self = EntityManager::Instance()->GetEntity(selfID);
|
||||
auto* destroyableComponent = child->GetComponent<DestroyableComponent>();
|
||||
child->AddDieCallback([this, selfID, child]() {
|
||||
auto* self = EntityManager::Instance()->GetEntity(selfID);
|
||||
auto* destroyableComponent = child->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || self == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (destroyableComponent == nullptr || self == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotifyDie(self, child, destroyableComponent->GetKiller());
|
||||
});
|
||||
NotifyDie(self, child, destroyableComponent->GetKiller());
|
||||
});
|
||||
}
|
||||
|
||||
void AmSkullkinTower::NotifyDie(Entity* self, Entity* other, Entity* killer)
|
||||
{
|
||||
auto players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
void AmSkullkinTower::NotifyDie(Entity* self, Entity* other, Entity* killer) {
|
||||
auto players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
const auto& iter = std::find(players.begin(), players.end(), killer->GetObjectID());
|
||||
const auto& iter = std::find(players.begin(), players.end(), killer->GetObjectID());
|
||||
|
||||
if (iter == players.end())
|
||||
{
|
||||
players.push_back(killer->GetObjectID());
|
||||
}
|
||||
if (iter == players.end()) {
|
||||
players.push_back(killer->GetObjectID());
|
||||
}
|
||||
|
||||
self->SetVar(u"Players", players);
|
||||
self->SetVar(u"Players", players);
|
||||
|
||||
OnChildRemoved(self, other);
|
||||
OnChildRemoved(self, other);
|
||||
}
|
||||
|
||||
void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child)
|
||||
{
|
||||
auto legTable = self->GetVar<std::vector<LWOOBJID>>(u"legTable");
|
||||
void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
|
||||
auto legTable = self->GetVar<std::vector<LWOOBJID>>(u"legTable");
|
||||
|
||||
const auto& iter = std::find(legTable.begin(), legTable.end(), child->GetObjectID());
|
||||
const auto& iter = std::find(legTable.begin(), legTable.end(), child->GetObjectID());
|
||||
|
||||
if (iter != legTable.end())
|
||||
{
|
||||
legTable.erase(iter);
|
||||
}
|
||||
if (iter != legTable.end()) {
|
||||
legTable.erase(iter);
|
||||
}
|
||||
|
||||
self->SetVar(u"legTable", legTable);
|
||||
self->SetVar(u"legTable", legTable);
|
||||
|
||||
if (legTable.size() == 2)
|
||||
{
|
||||
GameMessages::SendPlayAnimation(self, u"wobble-1");
|
||||
}
|
||||
else if (legTable.size() == 1)
|
||||
{
|
||||
GameMessages::SendPlayAnimation(self, u"wobble-2");
|
||||
}
|
||||
else if (legTable.empty())
|
||||
{
|
||||
const auto animTime = 2.5f;
|
||||
if (legTable.size() == 2) {
|
||||
GameMessages::SendPlayAnimation(self, u"wobble-1");
|
||||
} else if (legTable.size() == 1) {
|
||||
GameMessages::SendPlayAnimation(self, u"wobble-2");
|
||||
} else if (legTable.empty()) {
|
||||
const auto animTime = 2.5f;
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"fall");
|
||||
GameMessages::SendPlayAnimation(self, u"fall");
|
||||
|
||||
self->AddTimer("spawnGuys", animTime - 0.2f);
|
||||
self->AddTimer("spawnGuys", animTime - 0.2f);
|
||||
|
||||
self->CancelTimer("RespawnLeg");
|
||||
self->CancelTimer("RespawnLeg");
|
||||
self->CancelTimer("RespawnLeg");
|
||||
self->CancelTimer("RespawnLeg");
|
||||
self->CancelTimer("RespawnLeg");
|
||||
self->CancelTimer("RespawnLeg");
|
||||
|
||||
std::vector<int32_t> missionIDs;
|
||||
std::vector<int32_t> missionIDs;
|
||||
|
||||
auto missionsString = self->GetVar<std::u16string>(u"missions");
|
||||
auto missionsString = self->GetVar<std::u16string>(u"missions");
|
||||
|
||||
if (!missionsString.empty())
|
||||
{
|
||||
// Split the missions string by '_'
|
||||
const auto missions = GeneralUtils::SplitString(
|
||||
GeneralUtils::UTF16ToWTF8(missionsString),
|
||||
'_'
|
||||
);
|
||||
if (!missionsString.empty()) {
|
||||
// Split the missions string by '_'
|
||||
const auto missions = GeneralUtils::SplitString(
|
||||
GeneralUtils::UTF16ToWTF8(missionsString),
|
||||
'_'
|
||||
);
|
||||
|
||||
for (const auto& mission : missions)
|
||||
{
|
||||
int32_t missionID = 0;
|
||||
for (const auto& mission : missions) {
|
||||
int32_t missionID = 0;
|
||||
|
||||
if (!GeneralUtils::TryParse(mission, missionID))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!GeneralUtils::TryParse(mission, missionID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
missionIDs.push_back(missionID);
|
||||
}
|
||||
}
|
||||
missionIDs.push_back(missionID);
|
||||
}
|
||||
}
|
||||
|
||||
const auto& players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
const auto& players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto& playerID : players)
|
||||
{
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (const auto& playerID : players) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (player == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (missionComponent == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
for (const auto missionID : missionIDs)
|
||||
{
|
||||
missionComponent->ForceProgressValue(missionID, 1, self->GetLOT());
|
||||
}
|
||||
if (missionComponent == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//missionComponent->ForceProgressValue(1305, 1, self->GetLOT());
|
||||
}
|
||||
}
|
||||
for (const auto missionID : missionIDs) {
|
||||
missionComponent->ForceProgressValue(missionID, 1, self->GetLOT());
|
||||
}
|
||||
|
||||
auto deadLegs = self->GetVar<std::vector<std::string>>(u"DeadLegs");
|
||||
//missionComponent->ForceProgressValue(1305, 1, self->GetLOT());
|
||||
}
|
||||
}
|
||||
|
||||
const auto& leg = child->GetVar<std::string>(u"Leg");
|
||||
auto deadLegs = self->GetVar<std::vector<std::string>>(u"DeadLegs");
|
||||
|
||||
const auto& legIter = std::find(deadLegs.begin(), deadLegs.end(), leg);
|
||||
const auto& leg = child->GetVar<std::string>(u"Leg");
|
||||
|
||||
if (legIter == deadLegs.end())
|
||||
{
|
||||
deadLegs.push_back(leg);
|
||||
}
|
||||
const auto& legIter = std::find(deadLegs.begin(), deadLegs.end(), leg);
|
||||
|
||||
self->SetVar(u"DeadLegs", deadLegs);
|
||||
if (legIter == deadLegs.end()) {
|
||||
deadLegs.push_back(leg);
|
||||
}
|
||||
|
||||
self->AddTimer("RespawnLeg", 20);
|
||||
self->SetVar(u"DeadLegs", deadLegs);
|
||||
|
||||
self->AddTimer("RespawnLeg", 20);
|
||||
}
|
||||
|
||||
void AmSkullkinTower::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status)
|
||||
{
|
||||
if (status != "LEAVE")
|
||||
{
|
||||
return;
|
||||
}
|
||||
void AmSkullkinTower::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (status != "LEAVE") {
|
||||
return;
|
||||
}
|
||||
|
||||
auto players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
auto players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
const auto& iter = std::find(players.begin(), players.end(), entering->GetObjectID());
|
||||
const auto& iter = std::find(players.begin(), players.end(), entering->GetObjectID());
|
||||
|
||||
if (iter != players.end())
|
||||
{
|
||||
players.erase(iter);
|
||||
}
|
||||
if (iter != players.end()) {
|
||||
players.erase(iter);
|
||||
}
|
||||
|
||||
self->SetVar(u"Players", players);
|
||||
self->SetVar(u"Players", players);
|
||||
}
|
||||
|
||||
void AmSkullkinTower::OnTimerDone(Entity* self, std::string timerName)
|
||||
{
|
||||
if (timerName == "RespawnLeg")
|
||||
{
|
||||
auto deadLegs = self->GetVar<std::vector<std::string>>(u"DeadLegs");
|
||||
void AmSkullkinTower::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "RespawnLeg") {
|
||||
auto deadLegs = self->GetVar<std::vector<std::string>>(u"DeadLegs");
|
||||
|
||||
if (deadLegs.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (deadLegs.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnLegs(self, deadLegs[0]);
|
||||
SpawnLegs(self, deadLegs[0]);
|
||||
|
||||
deadLegs.erase(deadLegs.begin());
|
||||
deadLegs.erase(deadLegs.begin());
|
||||
|
||||
self->SetVar<std::vector<std::string>>(u"DeadLegs", deadLegs);
|
||||
}
|
||||
else if (timerName == "spawnGuys")
|
||||
{
|
||||
EntityInfo info {};
|
||||
info.lot = self->GetVar<LOT>(u"enemyToSpawn");
|
||||
auto pos = self->GetPosition();
|
||||
pos.y += 7;
|
||||
info.pos = pos;
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
for (size_t i = 0; i < 2; i++)
|
||||
{
|
||||
info.pos.x += i * 2; // Just to set the apart a bit
|
||||
self->SetVar<std::vector<std::string>>(u"DeadLegs", deadLegs);
|
||||
} else if (timerName == "spawnGuys") {
|
||||
EntityInfo info{};
|
||||
info.lot = self->GetVar<LOT>(u"enemyToSpawn");
|
||||
auto pos = self->GetPosition();
|
||||
pos.y += 7;
|
||||
info.pos = pos;
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
for (size_t i = 0; i < 2; i++) {
|
||||
info.pos.x += i * 2; // Just to set the apart a bit
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
}
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
self->AddTimer("killTower", 0.7f);
|
||||
}
|
||||
else if (timerName == "killTower")
|
||||
{
|
||||
self->Smash(self->GetObjectID());
|
||||
}
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
}
|
||||
|
||||
self->AddTimer("killTower", 0.7f);
|
||||
} else if (timerName == "killTower") {
|
||||
self->Smash(self->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
@@ -4,17 +4,17 @@
|
||||
class AmSkullkinTower : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
|
||||
void SpawnLegs(Entity* self, const std::string& loc);
|
||||
void SpawnLegs(Entity* self, const std::string& loc);
|
||||
|
||||
void OnChildLoaded(Entity* self, Entity* child);
|
||||
void OnChildLoaded(Entity* self, Entity* child);
|
||||
|
||||
void NotifyDie(Entity* self, Entity* other, Entity* killer);
|
||||
void NotifyDie(Entity* self, Entity* other, Entity* killer);
|
||||
|
||||
void OnChildRemoved(Entity* self, Entity* child);
|
||||
void OnChildRemoved(Entity* self, Entity* child);
|
||||
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
@@ -7,7 +7,7 @@ void AmTeapotServer::OnUse(Entity* self, Entity* user) {
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
if (!inventoryComponent) return;
|
||||
|
||||
if (inventoryComponent->GetLotCount(BLUE_FLOWER_LEAVES) >= 10){
|
||||
if (inventoryComponent->GetLotCount(BLUE_FLOWER_LEAVES) >= 10) {
|
||||
inventoryComponent->RemoveItem(BLUE_FLOWER_LEAVES, 10);
|
||||
inventoryComponent->AddItem(WU_S_IMAGINATION_TEA, 1);
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmTeapotServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
private:
|
||||
LOT BLUE_FLOWER_LEAVES = 12317;
|
||||
LOT WU_S_IMAGINATION_TEA = 12109;
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
private:
|
||||
LOT BLUE_FLOWER_LEAVES = 12317;
|
||||
LOT WU_S_IMAGINATION_TEA = 12109;
|
||||
};
|
||||
|
@@ -1,27 +1,23 @@
|
||||
#include "AmTemplateSkillVolume.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmTemplateSkillVolume::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message)
|
||||
{
|
||||
if (message != "NinjagoSpinAttackEvent")
|
||||
{
|
||||
return;
|
||||
}
|
||||
void AmTemplateSkillVolume::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
|
||||
if (message != "NinjagoSpinAttackEvent") {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = caster->GetComponent<MissionComponent>();
|
||||
auto* missionComponent = caster->GetComponent<MissionComponent>();
|
||||
|
||||
const auto missionIDsVariable = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"missions"));
|
||||
const auto missionIDs = GeneralUtils::SplitString(missionIDsVariable, '_');
|
||||
const auto missionIDsVariable = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"missions"));
|
||||
const auto missionIDs = GeneralUtils::SplitString(missionIDsVariable, '_');
|
||||
|
||||
for (const auto& missionIDStr : missionIDs)
|
||||
{
|
||||
int32_t missionID = 0;
|
||||
for (const auto& missionIDStr : missionIDs) {
|
||||
int32_t missionID = 0;
|
||||
|
||||
if (!GeneralUtils::TryParse(missionIDStr, missionID))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!GeneralUtils::TryParse(missionIDStr, missionID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
missionComponent->ForceProgressTaskType(missionID, 1, 1, false);
|
||||
}
|
||||
missionComponent->ForceProgressTaskType(missionID, 1, 1, false);
|
||||
}
|
||||
}
|
||||
|
@@ -4,5 +4,5 @@
|
||||
class AmTemplateSkillVolume : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
};
|
||||
|
@@ -1,13 +1,13 @@
|
||||
#include "AnvilOfArmor.h"
|
||||
|
||||
void AnvilOfArmor::OnStartup(Entity *self) {
|
||||
self->SetVar<uint32_t>(u"numCycles", 8);
|
||||
self->SetVar<float_t>(u"secPerCycle", 25.0f);
|
||||
self->SetVar<float_t>(u"delayToFirstCycle", 1.5f);
|
||||
self->SetVar<float_t>(u"deathDelay", 25.0f);
|
||||
self->SetVar<uint32_t>(u"numberOfPowerups", 4);
|
||||
self->SetVar<LOT>(u"lootLOT", 6431);
|
||||
void AnvilOfArmor::OnStartup(Entity* self) {
|
||||
self->SetVar<uint32_t>(u"numCycles", 8);
|
||||
self->SetVar<float_t>(u"secPerCycle", 25.0f);
|
||||
self->SetVar<float_t>(u"delayToFirstCycle", 1.5f);
|
||||
self->SetVar<float_t>(u"deathDelay", 25.0f);
|
||||
self->SetVar<uint32_t>(u"numberOfPowerups", 4);
|
||||
self->SetVar<LOT>(u"lootLOT", 6431);
|
||||
|
||||
// Initiate the actual script
|
||||
OnTemplateStartup(self);
|
||||
// Initiate the actual script
|
||||
OnTemplateStartup(self);
|
||||
}
|
||||
|
@@ -2,5 +2,5 @@
|
||||
#include "ScriptedPowerupSpawner.h"
|
||||
|
||||
class AnvilOfArmor : public ScriptedPowerupSpawner {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
};
|
||||
|
@@ -1,26 +1,23 @@
|
||||
#include "BankInteractServer.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void BankInteractServer::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
AMFArrayValue args;
|
||||
AMFStringValue* bank = new AMFStringValue();
|
||||
bank->SetStringValue("bank");
|
||||
args.InsertValue("state", bank);
|
||||
void BankInteractServer::OnUse(Entity* self, Entity* user) {
|
||||
AMFArrayValue args;
|
||||
AMFStringValue* bank = new AMFStringValue();
|
||||
bank->SetStringValue("bank");
|
||||
args.InsertValue("state", bank);
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
|
||||
}
|
||||
|
||||
void BankInteractServer::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3)
|
||||
{
|
||||
if (args == "ToggleBank")
|
||||
{
|
||||
AMFArrayValue args;
|
||||
void BankInteractServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == "ToggleBank") {
|
||||
AMFArrayValue args;
|
||||
args.InsertValue("visible", new AMFFalseValue());
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", &args);
|
||||
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", &args);
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"CloseBank", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
}
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"CloseBank", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
class BankInteractServer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
};
|
||||
|
@@ -2,120 +2,101 @@
|
||||
#include "GameMessages.h"
|
||||
#include "Player.h"
|
||||
|
||||
void BaseConsoleTeleportServer::BaseOnUse(Entity* self, Entity* user)
|
||||
{
|
||||
auto* player = user;
|
||||
void BaseConsoleTeleportServer::BaseOnUse(Entity* self, Entity* user) {
|
||||
auto* player = user;
|
||||
|
||||
const auto& teleportLocString = self->GetVar<std::u16string>(u"teleportString");
|
||||
const auto& teleportLocString = self->GetVar<std::u16string>(u"teleportString");
|
||||
|
||||
GameMessages::SendDisplayMessageBox(player->GetObjectID(), true, self->GetObjectID(), u"TransferBox", 0, teleportLocString, u"", player->GetSystemAddress());
|
||||
GameMessages::SendDisplayMessageBox(player->GetObjectID(), true, self->GetObjectID(), u"TransferBox", 0, teleportLocString, u"", player->GetSystemAddress());
|
||||
}
|
||||
|
||||
void BaseConsoleTeleportServer::BaseOnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData)
|
||||
{
|
||||
auto* player = sender;
|
||||
void BaseConsoleTeleportServer::BaseOnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
auto* player = sender;
|
||||
|
||||
if (button == 1)
|
||||
{
|
||||
if (button == 1) {
|
||||
|
||||
GameMessages::SendSetStunned(player->GetObjectID(), PUSH, player->GetSystemAddress(), player->GetObjectID(),
|
||||
true, true, true, true, true, true, true
|
||||
);
|
||||
GameMessages::SendSetStunned(player->GetObjectID(), PUSH, player->GetSystemAddress(), player->GetObjectID(),
|
||||
true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
const auto teleportFXID = self->GetVar<int32_t>(u"teleportEffectID");
|
||||
const auto teleportFXID = self->GetVar<int32_t>(u"teleportEffectID");
|
||||
|
||||
if (teleportFXID != 0)
|
||||
{
|
||||
const auto& teleportFXs = self->GetVar<std::vector<std::u16string>>(u"teleportEffectTypes");
|
||||
if (teleportFXID != 0) {
|
||||
const auto& teleportFXs = self->GetVar<std::vector<std::u16string>>(u"teleportEffectTypes");
|
||||
|
||||
for (const auto& type : teleportFXs)
|
||||
{
|
||||
GameMessages::SendPlayFXEffect(player->GetObjectID(), teleportFXID, type, "FX" + GeneralUtils::UTF16ToWTF8(type));
|
||||
}
|
||||
}
|
||||
for (const auto& type : teleportFXs) {
|
||||
GameMessages::SendPlayFXEffect(player->GetObjectID(), teleportFXID, type, "FX" + GeneralUtils::UTF16ToWTF8(type));
|
||||
}
|
||||
}
|
||||
|
||||
const auto& teleIntroAnim = self->GetVar<std::u16string>(u"teleportAnim");
|
||||
const auto& teleIntroAnim = self->GetVar<std::u16string>(u"teleportAnim");
|
||||
|
||||
if (!teleIntroAnim.empty())
|
||||
{
|
||||
GameMessages::SendPlayAnimation(player, teleIntroAnim);
|
||||
}
|
||||
if (!teleIntroAnim.empty()) {
|
||||
GameMessages::SendPlayAnimation(player, teleIntroAnim);
|
||||
}
|
||||
|
||||
const auto animTime = 3.32999992370605f;
|
||||
const auto animTime = 3.32999992370605f;
|
||||
|
||||
UpdatePlayerTable(self, player, true);
|
||||
UpdatePlayerTable(self, player, true);
|
||||
|
||||
const auto playerID = player->GetObjectID();
|
||||
const auto playerID = player->GetObjectID();
|
||||
|
||||
self->AddCallbackTimer(animTime, [playerID, self] () {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
self->AddCallbackTimer(animTime, [playerID, self]() {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendDisplayZoneSummary(playerID, player->GetSystemAddress(), false, false, self->GetObjectID());
|
||||
});
|
||||
}
|
||||
else if (button == -1 || button == 0)
|
||||
{
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, player->GetObjectID());
|
||||
}
|
||||
GameMessages::SendDisplayZoneSummary(playerID, player->GetSystemAddress(), false, false, self->GetObjectID());
|
||||
});
|
||||
} else if (button == -1 || button == 0) {
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, player->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void BaseConsoleTeleportServer::UpdatePlayerTable(Entity* self, Entity* player, bool bAdd)
|
||||
{
|
||||
const auto iter = std::find(m_Players.begin(), m_Players.end(), player->GetObjectID());
|
||||
void BaseConsoleTeleportServer::UpdatePlayerTable(Entity* self, Entity* player, bool bAdd) {
|
||||
const auto iter = std::find(m_Players.begin(), m_Players.end(), player->GetObjectID());
|
||||
|
||||
if (iter == m_Players.end() && bAdd)
|
||||
{
|
||||
m_Players.push_back(player->GetObjectID());
|
||||
}
|
||||
else if (iter != m_Players.end() && !bAdd)
|
||||
{
|
||||
m_Players.erase(iter);
|
||||
}
|
||||
if (iter == m_Players.end() && bAdd) {
|
||||
m_Players.push_back(player->GetObjectID());
|
||||
} else if (iter != m_Players.end() && !bAdd) {
|
||||
m_Players.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
bool BaseConsoleTeleportServer::CheckPlayerTable(Entity* self, Entity* player)
|
||||
{
|
||||
const auto iter = std::find(m_Players.begin(), m_Players.end(), player->GetObjectID());
|
||||
bool BaseConsoleTeleportServer::CheckPlayerTable(Entity* self, Entity* player) {
|
||||
const auto iter = std::find(m_Players.begin(), m_Players.end(), player->GetObjectID());
|
||||
|
||||
return iter != m_Players.end();
|
||||
return iter != m_Players.end();
|
||||
}
|
||||
|
||||
void BaseConsoleTeleportServer::BaseOnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, int32_t param3)
|
||||
{
|
||||
if (args == "summaryComplete")
|
||||
{
|
||||
TransferPlayer(self, sender, 0);
|
||||
}
|
||||
void BaseConsoleTeleportServer::BaseOnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
if (args == "summaryComplete") {
|
||||
TransferPlayer(self, sender, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseConsoleTeleportServer::TransferPlayer(Entity* self, Entity* player, int32_t altMapID)
|
||||
{
|
||||
if (player == nullptr || !CheckPlayerTable(self, player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
void BaseConsoleTeleportServer::TransferPlayer(Entity* self, Entity* player, int32_t altMapID) {
|
||||
if (player == nullptr || !CheckPlayerTable(self, player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignoring extra effects for now
|
||||
// Ignoring extra effects for now
|
||||
|
||||
/*GameMessages::SendSetStunned(player->GetObjectID(), POP, player->GetSystemAddress(), player->GetObjectID(),
|
||||
true, true, true, true, true, true, true
|
||||
);*/
|
||||
/*GameMessages::SendSetStunned(player->GetObjectID(), POP, player->GetSystemAddress(), player->GetObjectID(),
|
||||
true, true, true, true, true, true, true
|
||||
);*/
|
||||
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, player->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, player->GetObjectID());
|
||||
|
||||
const auto& teleportZone = self->GetVar<std::u16string>(u"transferZoneID");
|
||||
const auto& teleportZone = self->GetVar<std::u16string>(u"transferZoneID");
|
||||
|
||||
static_cast<Player*>(player)->SendToZone(std::stoi(GeneralUtils::UTF16ToWTF8(teleportZone)));
|
||||
static_cast<Player*>(player)->SendToZone(std::stoi(GeneralUtils::UTF16ToWTF8(teleportZone)));
|
||||
|
||||
UpdatePlayerTable(self, player, false);
|
||||
UpdatePlayerTable(self, player, false);
|
||||
}
|
||||
|
||||
void BaseConsoleTeleportServer::BaseOnTimerDone(Entity* self, const std::string& timerName)
|
||||
{
|
||||
|
||||
void BaseConsoleTeleportServer::BaseOnTimerDone(Entity* self, const std::string& timerName) {
|
||||
|
||||
}
|
||||
|
@@ -4,14 +4,14 @@
|
||||
class BaseConsoleTeleportServer
|
||||
{
|
||||
public:
|
||||
void BaseOnUse(Entity* self, Entity* user);
|
||||
void BaseOnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData);
|
||||
void UpdatePlayerTable(Entity* self, Entity* player, bool bAdd);
|
||||
bool CheckPlayerTable(Entity* self, Entity* player);
|
||||
void BaseOnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, int32_t param3);
|
||||
void TransferPlayer(Entity* self, Entity* player, int32_t altMapID);
|
||||
void BaseOnTimerDone(Entity* self, const std::string& timerName);
|
||||
void BaseOnUse(Entity* self, Entity* user);
|
||||
void BaseOnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData);
|
||||
void UpdatePlayerTable(Entity* self, Entity* player, bool bAdd);
|
||||
bool CheckPlayerTable(Entity* self, Entity* player);
|
||||
void BaseOnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3);
|
||||
void TransferPlayer(Entity* self, Entity* player, int32_t altMapID);
|
||||
void BaseOnTimerDone(Entity* self, const std::string& timerName);
|
||||
|
||||
private:
|
||||
std::vector<LWOOBJID> m_Players = {};
|
||||
std::vector<LWOOBJID> m_Players = {};
|
||||
};
|
||||
|
@@ -5,130 +5,130 @@
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void BaseEnemyApe::OnStartup(Entity *self) {
|
||||
self->SetVar<uint32_t>(u"timesStunned", 2);
|
||||
self->SetVar<bool>(u"knockedOut", false);
|
||||
void BaseEnemyApe::OnStartup(Entity* self) {
|
||||
self->SetVar<uint32_t>(u"timesStunned", 2);
|
||||
self->SetVar<bool>(u"knockedOut", false);
|
||||
}
|
||||
|
||||
void BaseEnemyApe::OnDie(Entity *self, Entity *killer) {
|
||||
auto* anchor = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
|
||||
if (anchor != nullptr && !anchor->GetIsDead()) {
|
||||
anchor->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
|
||||
auto* anchor = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
|
||||
if (anchor != nullptr && !anchor->GetIsDead()) {
|
||||
anchor->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseEnemyApe::OnSkillCast(Entity *self, uint32_t skillID) {
|
||||
const auto groundPoundSkill = self->GetVar<uint32_t>(u"GroundPoundSkill") != 0 ? self->GetVar<uint32_t>(u"GroundPoundSkill") : 725;
|
||||
const auto spawnQuickBuildTime = self->GetVar<float_t>(u"spawnQBTime") != 0.0f ? self->GetVar<float_t>(u"spawnQBTime") : 5.0f;
|
||||
void BaseEnemyApe::OnSkillCast(Entity* self, uint32_t skillID) {
|
||||
const auto groundPoundSkill = self->GetVar<uint32_t>(u"GroundPoundSkill") != 0 ? self->GetVar<uint32_t>(u"GroundPoundSkill") : 725;
|
||||
const auto spawnQuickBuildTime = self->GetVar<float_t>(u"spawnQBTime") != 0.0f ? self->GetVar<float_t>(u"spawnQBTime") : 5.0f;
|
||||
|
||||
if (skillID == groundPoundSkill && self->GetVar<LWOOBJID>(u"QB") == LWOOBJID_EMPTY) {
|
||||
self->AddTimer("spawnQBTime", spawnQuickBuildTime);
|
||||
}
|
||||
if (skillID == groundPoundSkill && self->GetVar<LWOOBJID>(u"QB") == LWOOBJID_EMPTY) {
|
||||
self->AddTimer("spawnQBTime", spawnQuickBuildTime);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseEnemyApe::OnHit(Entity *self, Entity *attacker) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr && destroyableComponent->GetArmor() < 1 && !self->GetBoolean(u"knockedOut")) {
|
||||
StunApe(self, true);
|
||||
self->CancelTimer("spawnQBTime");
|
||||
void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr && destroyableComponent->GetArmor() < 1 && !self->GetBoolean(u"knockedOut")) {
|
||||
StunApe(self, true);
|
||||
self->CancelTimer("spawnQBTime");
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"disable", 1.7f);
|
||||
GameMessages::SendPlayAnimation(self, u"disable", 1.7f);
|
||||
|
||||
const auto reviveTime = self->GetVar<float_t>(u"reviveTime") != 0.0f
|
||||
? self->GetVar<float_t>(u"reviveTime") : 12.0f;
|
||||
self->AddTimer("reviveTime", reviveTime);
|
||||
}
|
||||
const auto reviveTime = self->GetVar<float_t>(u"reviveTime") != 0.0f
|
||||
? self->GetVar<float_t>(u"reviveTime") : 12.0f;
|
||||
self->AddTimer("reviveTime", reviveTime);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseEnemyApe::OnTimerDone(Entity *self, std::string timerName) {
|
||||
if (timerName == "reviveTime") {
|
||||
void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "reviveTime") {
|
||||
|
||||
// Revives the ape, giving it back some armor
|
||||
const auto timesStunned = self->GetVar<uint32_t>(u"timesStunned");
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned);
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
self->SetVar<uint32_t>(u"timesStunned", timesStunned + 1);
|
||||
StunApe(self, false);
|
||||
// Revives the ape, giving it back some armor
|
||||
const auto timesStunned = self->GetVar<uint32_t>(u"timesStunned");
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned);
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
self->SetVar<uint32_t>(u"timesStunned", timesStunned + 1);
|
||||
StunApe(self, false);
|
||||
|
||||
} else if (timerName == "spawnQBTime" && self->GetVar<LWOOBJID>(u"QB") == LWOOBJID_EMPTY) {
|
||||
// Spawn QB in front of ape.
|
||||
const auto position = self->GetPosition();
|
||||
const auto rotation = self->GetRotation();
|
||||
} else if (timerName == "spawnQBTime" && self->GetVar<LWOOBJID>(u"QB") == LWOOBJID_EMPTY) {
|
||||
// Spawn QB in front of ape.
|
||||
const auto position = self->GetPosition();
|
||||
const auto rotation = self->GetRotation();
|
||||
|
||||
const auto backwardVector = rotation.GetForwardVector() * -1;
|
||||
const auto objectPosition = NiPoint3(
|
||||
position.GetX() - (backwardVector.GetX() * 8),
|
||||
position.GetY(),
|
||||
position.GetZ() - (backwardVector.GetZ() * 8)
|
||||
);
|
||||
const auto backwardVector = rotation.GetForwardVector() * -1;
|
||||
const auto objectPosition = NiPoint3(
|
||||
position.GetX() - (backwardVector.GetX() * 8),
|
||||
position.GetY(),
|
||||
position.GetZ() - (backwardVector.GetZ() * 8)
|
||||
);
|
||||
|
||||
EntityInfo entityInfo {};
|
||||
EntityInfo entityInfo{};
|
||||
|
||||
entityInfo.pos = position;
|
||||
entityInfo.rot = rotation;
|
||||
entityInfo.pos.SetY(entityInfo.pos.GetY() + 13.0f);
|
||||
entityInfo.pos = position;
|
||||
entityInfo.rot = rotation;
|
||||
entityInfo.pos.SetY(entityInfo.pos.GetY() + 13.0f);
|
||||
|
||||
entityInfo.spawnerID = self->GetObjectID();
|
||||
entityInfo.lot = self->GetVar<LOT>(u"QuickbuildAnchorLOT") != 0
|
||||
? self->GetVar<LOT>(u"QuickbuildAnchorLOT") : 7549;
|
||||
entityInfo.settings = {
|
||||
new LDFData<std::string>(u"rebuild_activators",
|
||||
std::to_string(objectPosition.GetX()) + "\x1f" +
|
||||
std::to_string(objectPosition.GetY()) + "\x1f" +
|
||||
std::to_string(objectPosition.GetZ())
|
||||
),
|
||||
new LDFData<bool>(u"no_timed_spawn", true),
|
||||
new LDFData<LWOOBJID>(u"ape", self->GetObjectID())
|
||||
};
|
||||
entityInfo.spawnerID = self->GetObjectID();
|
||||
entityInfo.lot = self->GetVar<LOT>(u"QuickbuildAnchorLOT") != 0
|
||||
? self->GetVar<LOT>(u"QuickbuildAnchorLOT") : 7549;
|
||||
entityInfo.settings = {
|
||||
new LDFData<std::string>(u"rebuild_activators",
|
||||
std::to_string(objectPosition.GetX()) + "\x1f" +
|
||||
std::to_string(objectPosition.GetY()) + "\x1f" +
|
||||
std::to_string(objectPosition.GetZ())
|
||||
),
|
||||
new LDFData<bool>(u"no_timed_spawn", true),
|
||||
new LDFData<LWOOBJID>(u"ape", self->GetObjectID())
|
||||
};
|
||||
|
||||
auto* anchor = EntityManager::Instance()->CreateEntity(entityInfo);
|
||||
EntityManager::Instance()->ConstructEntity(anchor);
|
||||
self->SetVar<LWOOBJID>(u"QB", anchor->GetObjectID());
|
||||
auto* anchor = EntityManager::Instance()->CreateEntity(entityInfo);
|
||||
EntityManager::Instance()->ConstructEntity(anchor);
|
||||
self->SetVar<LWOOBJID>(u"QB", anchor->GetObjectID());
|
||||
|
||||
} else if (timerName == "anchorDamageTimer") {
|
||||
} else if (timerName == "anchorDamageTimer") {
|
||||
|
||||
// Attacks the ape with some god skill
|
||||
const auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"smasher"));
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
// Attacks the ape with some god skill
|
||||
const auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"smasher"));
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(1273, 29446, self->GetObjectID(), true, false, player->GetObjectID());
|
||||
}
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(1273, 29446, self->GetObjectID(), true, false, player->GetObjectID());
|
||||
}
|
||||
|
||||
self->SetVar<LWOOBJID>(u"QB", LWOOBJID_EMPTY);
|
||||
}
|
||||
self->SetVar<LWOOBJID>(u"QB", LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseEnemyApe::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args == "rebuildDone" && sender != nullptr) {
|
||||
self->SetVar<LWOOBJID>(u"smasher", sender->GetObjectID());
|
||||
const auto anchorDamageDelayTime = self->GetVar<float_t>(u"AnchorDamageDelayTime") != 0.0f ? self->GetVar<float_t>(u"AnchorDamageDelayTime") : 0.5f;
|
||||
self->AddTimer("anchorDamageTimer", anchorDamageDelayTime);
|
||||
}
|
||||
void BaseEnemyApe::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args == "rebuildDone" && sender != nullptr) {
|
||||
self->SetVar<LWOOBJID>(u"smasher", sender->GetObjectID());
|
||||
const auto anchorDamageDelayTime = self->GetVar<float_t>(u"AnchorDamageDelayTime") != 0.0f ? self->GetVar<float_t>(u"AnchorDamageDelayTime") : 0.5f;
|
||||
self->AddTimer("anchorDamageTimer", anchorDamageDelayTime);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseEnemyApe::StunApe(Entity *self, bool stunState) {
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(stunState);
|
||||
combatAIComponent->SetStunned(stunState);
|
||||
void BaseEnemyApe::StunApe(Entity* self, bool stunState) {
|
||||
auto* combatAIComponent = self->GetComponent<BaseCombatAIComponent>();
|
||||
if (combatAIComponent != nullptr) {
|
||||
combatAIComponent->SetDisabled(stunState);
|
||||
combatAIComponent->SetStunned(stunState);
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->Interrupt();
|
||||
}
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->Interrupt();
|
||||
}
|
||||
|
||||
GameMessages::SendSetStunned(self->GetObjectID(), stunState ? PUSH : POP, UNASSIGNED_SYSTEM_ADDRESS, self->GetObjectID(),
|
||||
true, true, true, true, true,
|
||||
true, true, true, true);
|
||||
GameMessages::SendSetStunned(self->GetObjectID(), stunState ? PUSH : POP, UNASSIGNED_SYSTEM_ADDRESS, self->GetObjectID(),
|
||||
true, true, true, true, true,
|
||||
true, true, true, true);
|
||||
|
||||
self->SetBoolean(u"knockedOut", stunState);
|
||||
}
|
||||
self->SetBoolean(u"knockedOut", stunState);
|
||||
}
|
||||
}
|
||||
|
@@ -3,13 +3,13 @@
|
||||
|
||||
class BaseEnemyApe : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity *self) override;
|
||||
void OnDie(Entity *self, Entity *killer) override;
|
||||
void OnSkillCast(Entity *self, uint32_t skillID) override;
|
||||
void OnHit(Entity *self, Entity *attacker) 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;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnSkillCast(Entity* self, uint32_t skillID) override;
|
||||
void OnHit(Entity* self, Entity* attacker) 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:
|
||||
static void StunApe(Entity* self, bool stunState);
|
||||
static void StunApe(Entity* self, bool stunState);
|
||||
};
|
||||
|
@@ -7,17 +7,17 @@
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void BaseEnemyMech::OnStartup(Entity* self) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetFaction(4);
|
||||
}
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetFaction(4);
|
||||
}
|
||||
}
|
||||
|
||||
void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
|
||||
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));
|
||||
if (!controlPhys) return;
|
||||
|
||||
NiPoint3 newLoc = {controlPhys->GetPosition().x, dpWorld::Instance().GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };
|
||||
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::Instance().GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };
|
||||
|
||||
EntityInfo info = EntityInfo();
|
||||
std::vector<LDFBaseData*> cfg;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
class BaseEnemyMech : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
protected:
|
||||
LOT qbTurretLOT = 6254;
|
||||
|
@@ -2,47 +2,47 @@
|
||||
#include "EntityManager.h"
|
||||
#include "Character.h"
|
||||
|
||||
void BaseFootRaceManager::OnStartup(Entity *self) {
|
||||
// TODO: Add to FootRaceStarter group
|
||||
void BaseFootRaceManager::OnStartup(Entity* self) {
|
||||
// TODO: Add to FootRaceStarter group
|
||||
}
|
||||
|
||||
void BaseFootRaceManager::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
const auto splitArguments = GeneralUtils::SplitString(args, '_');
|
||||
if (splitArguments.size() > 1) {
|
||||
void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
const auto splitArguments = GeneralUtils::SplitString(args, '_');
|
||||
if (splitArguments.size() > 1) {
|
||||
|
||||
const auto eventName = splitArguments[0];
|
||||
const auto player = EntityManager::Instance()->GetEntity(std::stoull(splitArguments[1]));
|
||||
const auto eventName = splitArguments[0];
|
||||
const auto player = EntityManager::Instance()->GetEntity(std::stoull(splitArguments[1]));
|
||||
|
||||
if (player != nullptr) {
|
||||
if (eventName == "updatePlayer") {
|
||||
UpdatePlayer(self, player->GetObjectID());
|
||||
} else if (IsPlayerInActivity(self, player->GetObjectID())) {
|
||||
if (eventName == "initialActivityScore") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, true);
|
||||
}
|
||||
if (player != nullptr) {
|
||||
if (eventName == "updatePlayer") {
|
||||
UpdatePlayer(self, player->GetObjectID());
|
||||
} else if (IsPlayerInActivity(self, player->GetObjectID())) {
|
||||
if (eventName == "initialActivityScore") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, true);
|
||||
}
|
||||
|
||||
SetActivityScore(self, player->GetObjectID(), 1);
|
||||
} else if (eventName == "updatePlayerTrue") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, false);
|
||||
}
|
||||
SetActivityScore(self, player->GetObjectID(), 1);
|
||||
} else if (eventName == "updatePlayerTrue") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, false);
|
||||
}
|
||||
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
} else if (eventName == "PlayerWon") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, false);
|
||||
if (param2 != -1) // Certain footraces set a flag
|
||||
character->SetPlayerFlag(param2, true);
|
||||
}
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
} else if (eventName == "PlayerWon") {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, false);
|
||||
if (param2 != -1) // Certain footraces set a flag
|
||||
character->SetPlayerFlag(param2, true);
|
||||
}
|
||||
|
||||
StopActivity(self, player->GetObjectID(), 0, param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
StopActivity(self, player->GetObjectID(), 0, param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class BaseFootRaceManager : public ActivityManager {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
};
|
||||
|
@@ -2,32 +2,29 @@
|
||||
#include "Loot.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void BaseInteractDropLootServer::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
BaseUse(self, user);
|
||||
void BaseInteractDropLootServer::OnUse(Entity* self, Entity* user) {
|
||||
BaseUse(self, user);
|
||||
}
|
||||
|
||||
void BaseInteractDropLootServer::BaseUse(Entity* self, Entity* user)
|
||||
{
|
||||
auto cooldownTime = self->GetVar<float>(u"cooldownTime");
|
||||
if (cooldownTime == 0) cooldownTime = 5;
|
||||
void BaseInteractDropLootServer::BaseUse(Entity* self, Entity* user) {
|
||||
auto cooldownTime = self->GetVar<float>(u"cooldownTime");
|
||||
if (cooldownTime == 0) cooldownTime = 5;
|
||||
|
||||
uint32_t lootMatrix = self->GetVar<int32_t>(u"UseLootMatrix");
|
||||
if (lootMatrix == 0) lootMatrix = self->GetVar<int32_t>(u"smashable_loot_matrix");
|
||||
if (lootMatrix == 0) lootMatrix = 715;
|
||||
uint32_t lootMatrix = self->GetVar<int32_t>(u"UseLootMatrix");
|
||||
if (lootMatrix == 0) lootMatrix = self->GetVar<int32_t>(u"smashable_loot_matrix");
|
||||
if (lootMatrix == 0) lootMatrix = 715;
|
||||
|
||||
auto useSound = self->GetVar<std::string>(u"sound1");
|
||||
auto useSound = self->GetVar<std::string>(u"sound1");
|
||||
|
||||
if (!useSound.empty())
|
||||
{
|
||||
GameMessages::SendPlayNDAudioEmitter(self, user->GetSystemAddress(), useSound);
|
||||
}
|
||||
if (!useSound.empty()) {
|
||||
GameMessages::SendPlayNDAudioEmitter(self, user->GetSystemAddress(), useSound);
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"bInUse", true);
|
||||
self->SetNetworkVar(u"bInUse", true);
|
||||
|
||||
LootGenerator::Instance().DropLoot(user, self, lootMatrix, 0, 0);
|
||||
LootGenerator::Instance().DropLoot(user, self, lootMatrix, 0, 0);
|
||||
|
||||
self->AddCallbackTimer(cooldownTime, [this, self] () {
|
||||
self->SetNetworkVar(u"bInUse", false);
|
||||
});
|
||||
self->AddCallbackTimer(cooldownTime, [this, self]() {
|
||||
self->SetNetworkVar(u"bInUse", false);
|
||||
});
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
class BaseInteractDropLootServer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
virtual void OnUse(Entity* self, Entity* user) override;
|
||||
void BaseUse(Entity* self, Entity* user);
|
||||
virtual void OnUse(Entity* self, Entity* user) override;
|
||||
void BaseUse(Entity* self, Entity* user);
|
||||
};
|
||||
|
||||
|
@@ -9,61 +9,61 @@
|
||||
#include "PropertyManagementComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void BasePropertyServer::SetGameVariables(Entity *self) {
|
||||
self->SetVar<std::string>(ClaimMarkerGroup, "");
|
||||
self->SetVar<std::string>(GeneratorGroup, "");
|
||||
self->SetVar<std::string>(GuardGroup, "");
|
||||
self->SetVar<std::string>(PropertyPlaqueGroup, "");
|
||||
self->SetVar<std::string>(PropertyVendorGroup, "");
|
||||
self->SetVar<std::string>(SpotsGroup, "");
|
||||
self->SetVar<std::string>(MSCloudsGroup, "");
|
||||
self->SetVar<std::string>(EnemiesGroup, "");
|
||||
self->SetVar<std::string>(FXManagerGroup, "");
|
||||
self->SetVar<std::string>(ImagOrbGroup, "");
|
||||
self->SetVar<std::string>(GeneratorFXGroup, "");
|
||||
void BasePropertyServer::SetGameVariables(Entity* self) {
|
||||
self->SetVar<std::string>(ClaimMarkerGroup, "");
|
||||
self->SetVar<std::string>(GeneratorGroup, "");
|
||||
self->SetVar<std::string>(GuardGroup, "");
|
||||
self->SetVar<std::string>(PropertyPlaqueGroup, "");
|
||||
self->SetVar<std::string>(PropertyVendorGroup, "");
|
||||
self->SetVar<std::string>(SpotsGroup, "");
|
||||
self->SetVar<std::string>(MSCloudsGroup, "");
|
||||
self->SetVar<std::string>(EnemiesGroup, "");
|
||||
self->SetVar<std::string>(FXManagerGroup, "");
|
||||
self->SetVar<std::string>(ImagOrbGroup, "");
|
||||
self->SetVar<std::string>(GeneratorFXGroup, "");
|
||||
|
||||
self->SetVar<std::vector<std::string>>(EnemiesSpawner, {});
|
||||
self->SetVar<std::string>(ClaimMarkerSpawner, "");
|
||||
self->SetVar<std::string>(GeneratorSpawner, "");
|
||||
self->SetVar<std::string>(DamageFXSpawner, "");
|
||||
self->SetVar<std::string>(FXSpotsSpawner, "");
|
||||
self->SetVar<std::string>(PropertyMGSpawner, "");
|
||||
self->SetVar<std::string>(ImageOrbSpawner, "");
|
||||
self->SetVar<std::string>(GeneratorFXSpawner, "");
|
||||
self->SetVar<std::string>(SmashablesSpawner, "");
|
||||
self->SetVar<std::string>(FXManagerSpawner, "");
|
||||
self->SetVar<std::string>(PropObjsSpawner, "");
|
||||
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, {});
|
||||
self->SetVar<std::vector<std::string>>(BehaviorObjsSpawner, {});
|
||||
self->SetVar<std::vector<std::string>>(EnemiesSpawner, {});
|
||||
self->SetVar<std::string>(ClaimMarkerSpawner, "");
|
||||
self->SetVar<std::string>(GeneratorSpawner, "");
|
||||
self->SetVar<std::string>(DamageFXSpawner, "");
|
||||
self->SetVar<std::string>(FXSpotsSpawner, "");
|
||||
self->SetVar<std::string>(PropertyMGSpawner, "");
|
||||
self->SetVar<std::string>(ImageOrbSpawner, "");
|
||||
self->SetVar<std::string>(GeneratorFXSpawner, "");
|
||||
self->SetVar<std::string>(SmashablesSpawner, "");
|
||||
self->SetVar<std::string>(FXManagerSpawner, "");
|
||||
self->SetVar<std::string>(PropObjsSpawner, "");
|
||||
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, {});
|
||||
self->SetVar<std::vector<std::string>>(BehaviorObjsSpawner, {});
|
||||
|
||||
self->SetVar<uint32_t>(defeatedProperyFlag, 0);
|
||||
self->SetVar<uint32_t>(placedModelFlag, 0);
|
||||
self->SetVar<uint32_t>(guardMissionFlag, 0);
|
||||
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 0);
|
||||
self->SetVar<std::string>(passwordFlag, "s3kratK1ttN");
|
||||
self->SetVar<LOT>(generatorIdFlag, 0);
|
||||
self->SetVar<LOT>(orbIDFlag, 0);
|
||||
self->SetVar<LOT>(behaviorQBID, 0);
|
||||
self->SetVar<uint32_t>(defeatedProperyFlag, 0);
|
||||
self->SetVar<uint32_t>(placedModelFlag, 0);
|
||||
self->SetVar<uint32_t>(guardMissionFlag, 0);
|
||||
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 0);
|
||||
self->SetVar<std::string>(passwordFlag, "s3kratK1ttN");
|
||||
self->SetVar<LOT>(generatorIdFlag, 0);
|
||||
self->SetVar<LOT>(orbIDFlag, 0);
|
||||
self->SetVar<LOT>(behaviorQBID, 0);
|
||||
}
|
||||
|
||||
void BasePropertyServer::CheckForOwner(Entity* self) {
|
||||
if (EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(PropertyPlaqueGroup)).empty()) {
|
||||
self->AddTimer(RunPlayerLoadedAgainTimer, 0.5f);
|
||||
return;
|
||||
}
|
||||
if (EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(PropertyPlaqueGroup)).empty()) {
|
||||
self->AddTimer(RunPlayerLoadedAgainTimer, 0.5f);
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetI64(PropertyOwnerVariable, GetOwner());
|
||||
}
|
||||
|
||||
void BasePropertyServer::OnStartup(Entity *self) {
|
||||
SetGameVariables(self);
|
||||
void BasePropertyServer::OnStartup(Entity* self) {
|
||||
SetGameVariables(self);
|
||||
}
|
||||
|
||||
void BasePropertyServer::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == CheckForPropertyOwnerEvent) {
|
||||
sender->SetNetworkVar<std::string>(PropertyOwnerIDVariable, std::to_string(self->GetVar<LWOOBJID>(PropertyOwnerVariable)));
|
||||
}
|
||||
void BasePropertyServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == CheckForPropertyOwnerEvent) {
|
||||
sender->SetNetworkVar<std::string>(PropertyOwnerIDVariable, std::to_string(self->GetVar<LWOOBJID>(PropertyOwnerVariable)));
|
||||
}
|
||||
}
|
||||
|
||||
void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) {
|
||||
@@ -73,7 +73,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) {
|
||||
auto propertyOwner = PropertyManagementComponent::Instance()->GetOwnerId();
|
||||
|
||||
self->OnFireEventServerSide(self, CheckForPropertyOwnerEvent);
|
||||
|
||||
|
||||
if (propertyOwner > 0) {
|
||||
rented = true;
|
||||
}
|
||||
@@ -85,19 +85,17 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) {
|
||||
self->SetNetworkVar(PropertyOwnerIDVariable, propertyOwner);
|
||||
|
||||
if (rented) {
|
||||
auto plaques = EntityManager::Instance()->GetEntitiesInGroup("PropertyVendor");
|
||||
for (auto* plaque : plaques) {
|
||||
EntityManager::Instance()->DestructEntity(plaque);
|
||||
}
|
||||
auto plaques = EntityManager::Instance()->GetEntitiesInGroup("PropertyVendor");
|
||||
for (auto* plaque : plaques) {
|
||||
EntityManager::Instance()->DestructEntity(plaque);
|
||||
}
|
||||
|
||||
const auto& mapID = dZoneManager::Instance()->GetZone()->GetZoneID();
|
||||
|
||||
if (propertyOwner > 0)
|
||||
{
|
||||
if (propertyOwner > 0) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr)
|
||||
{
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->Progress(
|
||||
MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY,
|
||||
mapID.GetMapID(),
|
||||
@@ -115,7 +113,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) {
|
||||
if (!self->GetBoolean(FXObjectsGoneVariable)) {
|
||||
self->AddTimer(KillFXObjectTimer, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
||||
|
||||
// activate property safe spawner network
|
||||
@@ -130,7 +128,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) {
|
||||
const auto defeatedFlag = player->GetCharacter()->GetPlayerFlag(self->GetVar<uint32_t>(defeatedProperyFlag));
|
||||
|
||||
self->SetNetworkVar(UnclaimedVariable, true);
|
||||
self->SetVar<LWOOBJID>(PlayerIDVariable, player->GetObjectID());
|
||||
self->SetVar<LWOOBJID>(PlayerIDVariable, player->GetObjectID());
|
||||
|
||||
if (!defeatedFlag) {
|
||||
StartMaelstrom(self, player);
|
||||
@@ -152,27 +150,27 @@ void BasePropertyServer::PropGuardCheck(Entity* self, Entity* player) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr
|
||||
&& missionComponent->GetMissionState(self->GetVar<uint32_t>(guardMissionFlag)) != MissionState::MISSION_STATE_COMPLETE) {
|
||||
ActivateSpawner(self->GetVar<std::string>(PropertyMGSpawner));
|
||||
&& missionComponent->GetMissionState(self->GetVar<uint32_t>(guardMissionFlag)) != MissionState::MISSION_STATE_COMPLETE) {
|
||||
ActivateSpawner(self->GetVar<std::string>(PropertyMGSpawner));
|
||||
}
|
||||
}
|
||||
|
||||
void BasePropertyServer::BaseZonePropertyRented(Entity* self, Entity* player) const {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PlayCinematic", 0, 0, LWOOBJID_EMPTY, "ShowProperty",
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
self->AddTimer(BoundsVisOnTimer, 2);
|
||||
self->SetVar<LWOOBJID>(PropertyOwnerVariable, player->GetObjectID());
|
||||
|
||||
auto plaques = EntityManager::Instance()->GetEntitiesInGroup("PropertyVendor");
|
||||
for (auto* plaque : plaques) {
|
||||
EntityManager::Instance()->DestructEntity(plaque);
|
||||
}
|
||||
|
||||
auto brickLinkMissionID = self->GetVar<uint32_t>(brickLinkMissionIDFlag);
|
||||
auto plaques = EntityManager::Instance()->GetEntitiesInGroup("PropertyVendor");
|
||||
for (auto* plaque : plaques) {
|
||||
EntityManager::Instance()->DestructEntity(plaque);
|
||||
}
|
||||
|
||||
auto brickLinkMissionID = self->GetVar<uint32_t>(brickLinkMissionIDFlag);
|
||||
if (brickLinkMissionID != 0) {
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (missionComponent) missionComponent->CompleteMission(brickLinkMissionID, true);
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (missionComponent) missionComponent->CompleteMission(brickLinkMissionID, true);
|
||||
}
|
||||
|
||||
ActivateSpawner(self->GetVar<std::string>(PropObjsSpawner));
|
||||
@@ -185,7 +183,7 @@ void BasePropertyServer::BaseZonePropertyModelPlaced(Entity* self, Entity* playe
|
||||
|
||||
auto flag = self->GetVar<int32_t>(placedModelFlag);
|
||||
if (flag)
|
||||
character->SetPlayerFlag(flag, true);
|
||||
character->SetPlayerFlag(flag, true);
|
||||
}
|
||||
|
||||
void BasePropertyServer::KillClouds(Entity* self) {
|
||||
@@ -203,13 +201,13 @@ void BasePropertyServer::KillSpots(Entity* self) {
|
||||
}
|
||||
|
||||
void BasePropertyServer::StartMaelstrom(Entity* self, Entity* player) {
|
||||
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
||||
ActivateSpawner(enemySpawner);
|
||||
}
|
||||
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
||||
ActivateSpawner(enemySpawner);
|
||||
}
|
||||
|
||||
for (const auto& behaviorObjectSpawner : self->GetVar<std::vector<std::string>>(BehaviorObjsSpawner)) {
|
||||
ActivateSpawner(behaviorObjectSpawner);
|
||||
}
|
||||
for (const auto& behaviorObjectSpawner : self->GetVar<std::vector<std::string>>(BehaviorObjsSpawner)) {
|
||||
ActivateSpawner(behaviorObjectSpawner);
|
||||
}
|
||||
|
||||
ActivateSpawner(self->GetVar<std::string>(DamageFXSpawner));
|
||||
ActivateSpawner(self->GetVar<std::string>(GeneratorSpawner));
|
||||
@@ -221,13 +219,13 @@ void BasePropertyServer::StartMaelstrom(Entity* self, Entity* player) {
|
||||
DestroySpawner(self->GetVar<std::string>(ClaimMarkerSpawner));
|
||||
|
||||
for (const auto& ambientFXSpawner : self->GetVar<std::vector<std::string>>(AmbientFXSpawner)) {
|
||||
DestroySpawner(ambientFXSpawner);
|
||||
DestroySpawner(ambientFXSpawner);
|
||||
}
|
||||
|
||||
StartTornadoFx(self);
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"maelstromSkyOn", 0, 0, LWOOBJID_EMPTY,
|
||||
"", player->GetSystemAddress());
|
||||
"", player->GetSystemAddress());
|
||||
|
||||
self->AddTimer(StartGeneratorTimer, 0.0f);
|
||||
self->AddTimer(StartOrbTimer, 0.0f);
|
||||
@@ -241,20 +239,20 @@ void BasePropertyServer::StartTornadoFx(Entity* self) const {
|
||||
}
|
||||
|
||||
for (auto* entity : entities) {
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->PlayEffect(-1, u"debrisOn", "TornadoDebris");
|
||||
renderComponent->PlayEffect(-1, u"VortexOn", "TornadoVortex");
|
||||
renderComponent->PlayEffect(-1, u"onSilhouette", "silhouette");
|
||||
}
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->PlayEffect(-1, u"debrisOn", "TornadoDebris");
|
||||
renderComponent->PlayEffect(-1, u"VortexOn", "TornadoVortex");
|
||||
renderComponent->PlayEffect(-1, u"onSilhouette", "silhouette");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BasePropertyServer::BasePlayerExit(Entity *self, Entity *player) {
|
||||
void BasePropertyServer::BasePlayerExit(Entity* self, Entity* player) {
|
||||
if (self->GetBoolean(UnclaimedVariable)) {
|
||||
if (player->GetObjectID() == self->GetVar<LWOOBJID>(PlayerIDVariable)) {
|
||||
// Destroy all spawners
|
||||
}
|
||||
if (player->GetObjectID() == self->GetVar<LWOOBJID>(PlayerIDVariable)) {
|
||||
// Destroy all spawners
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,9 +282,9 @@ void BasePropertyServer::ActivateSpawner(const std::string& spawnerName) {
|
||||
}
|
||||
|
||||
void BasePropertyServer::DeactivateSpawner(const std::string& spawnerName) {
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
void BasePropertyServer::TriggerSpawner(const std::string& spawnerName) {
|
||||
@@ -296,27 +294,27 @@ void BasePropertyServer::TriggerSpawner(const std::string& spawnerName) {
|
||||
}
|
||||
|
||||
void BasePropertyServer::ResetSpawner(const std::string& spawnerName) {
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) {
|
||||
spawner->Reset();
|
||||
}
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) {
|
||||
spawner->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
void BasePropertyServer::DestroySpawner(const std::string& spawnerName) {
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) {
|
||||
for (auto* node : spawner->m_Info.nodes) {
|
||||
for (const auto& element : node->entities) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(element);
|
||||
if (entity == nullptr)
|
||||
continue;
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) {
|
||||
for (auto* node : spawner->m_Info.nodes) {
|
||||
for (const auto& element : node->entities) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(element);
|
||||
if (entity == nullptr)
|
||||
continue;
|
||||
|
||||
entity->Kill();
|
||||
}
|
||||
entity->Kill();
|
||||
}
|
||||
|
||||
node->entities.clear();
|
||||
}
|
||||
node->entities.clear();
|
||||
}
|
||||
|
||||
spawner->Deactivate();
|
||||
}
|
||||
spawner->Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
LWOOBJID BasePropertyServer::GetOwner() {
|
||||
@@ -325,194 +323,194 @@ LWOOBJID BasePropertyServer::GetOwner() {
|
||||
}
|
||||
|
||||
void BasePropertyServer::BaseTimerDone(Entity* self, const std::string& timerName) {
|
||||
if (timerName == StartGeneratorTimer) {
|
||||
HandleGeneratorTimer(self);
|
||||
} else if (timerName == StartOrbTimer) {
|
||||
HandleOrbsTimer(self);
|
||||
} else if (timerName == StartQuickbuildTimer) {
|
||||
HandleQuickBuildTimer(self);
|
||||
} else if (timerName == "GuardFlyAway") {
|
||||
const auto zoneId = dZoneManager::Instance()->GetZone()->GetWorldID();
|
||||
if (timerName == StartGeneratorTimer) {
|
||||
HandleGeneratorTimer(self);
|
||||
} else if (timerName == StartOrbTimer) {
|
||||
HandleOrbsTimer(self);
|
||||
} else if (timerName == StartQuickbuildTimer) {
|
||||
HandleQuickBuildTimer(self);
|
||||
} else if (timerName == "GuardFlyAway") {
|
||||
const auto zoneId = dZoneManager::Instance()->GetZone()->GetWorldID();
|
||||
|
||||
// No guard for the spider instance fight
|
||||
if (dZoneManager::Instance()->GetZoneID().GetMapID() == 1150)
|
||||
return;
|
||||
// No guard for the spider instance fight
|
||||
if (dZoneManager::Instance()->GetZoneID().GetMapID() == 1150)
|
||||
return;
|
||||
|
||||
const auto entities = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(GuardGroup));
|
||||
if (entities.empty())
|
||||
return;
|
||||
const auto entities = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(GuardGroup));
|
||||
if (entities.empty())
|
||||
return;
|
||||
|
||||
auto* guard = entities[0];
|
||||
GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(),
|
||||
u"GuardChat", 0, 0, guard->GetObjectID(),
|
||||
"", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
auto* guard = entities[0];
|
||||
GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(),
|
||||
u"GuardChat", 0, 0, guard->GetObjectID(),
|
||||
"", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
self->AddTimer(KillGuardTimer, 5.0f);
|
||||
} else if (timerName == KillGuardTimer) {
|
||||
KillGuard(self);
|
||||
} else if (timerName == TornadoOffTimer) {
|
||||
auto fxManagers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
||||
self->AddTimer(KillGuardTimer, 5.0f);
|
||||
} else if (timerName == KillGuardTimer) {
|
||||
KillGuard(self);
|
||||
} else if (timerName == TornadoOffTimer) {
|
||||
auto fxManagers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
||||
|
||||
for (auto *fxManager : fxManagers) {
|
||||
auto *renderComponent = fxManager->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("TornadoDebris", false);
|
||||
renderComponent->StopEffect("TornadoVortex", false);
|
||||
renderComponent->StopEffect("silhouette", false);
|
||||
}
|
||||
}
|
||||
for (auto* fxManager : fxManagers) {
|
||||
auto* renderComponent = fxManager->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("TornadoDebris", false);
|
||||
renderComponent->StopEffect("TornadoVortex", false);
|
||||
renderComponent->StopEffect("silhouette", false);
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer(ShowClearEffectsTimer, 2);
|
||||
} else if (timerName == ShowClearEffectsTimer) {
|
||||
auto fxManagers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
||||
self->AddTimer(ShowClearEffectsTimer, 2);
|
||||
} else if (timerName == ShowClearEffectsTimer) {
|
||||
auto fxManagers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
||||
|
||||
for (auto *fxManager : fxManagers) {
|
||||
auto *renderComponent = fxManager->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr)
|
||||
renderComponent->PlayEffect(-1, u"beamOn", "beam");
|
||||
}
|
||||
for (auto* fxManager : fxManagers) {
|
||||
auto* renderComponent = fxManager->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr)
|
||||
renderComponent->PlayEffect(-1, u"beamOn", "beam");
|
||||
}
|
||||
|
||||
self->AddTimer(KillStrombiesTimer, 2.0f);
|
||||
self->AddTimer(TurnSkyOffTimer, 1.5f);
|
||||
self->AddTimer(KillFXObjectTimer, 8.0f);
|
||||
} else if (timerName == TurnSkyOffTimer) {
|
||||
auto* controller = dZoneManager::Instance()->GetZoneControlObject();
|
||||
GameMessages::SendNotifyClientObject(controller->GetObjectID(), u"SkyOff", 0, 0,
|
||||
LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
} else if (timerName == KillStrombiesTimer) {
|
||||
const auto enemies = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(EnemiesGroup));
|
||||
for (auto* enemy : enemies) {
|
||||
RequestDie(self, enemy);
|
||||
}
|
||||
self->AddTimer(KillStrombiesTimer, 2.0f);
|
||||
self->AddTimer(TurnSkyOffTimer, 1.5f);
|
||||
self->AddTimer(KillFXObjectTimer, 8.0f);
|
||||
} else if (timerName == TurnSkyOffTimer) {
|
||||
auto* controller = dZoneManager::Instance()->GetZoneControlObject();
|
||||
GameMessages::SendNotifyClientObject(controller->GetObjectID(), u"SkyOff", 0, 0,
|
||||
LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
} else if (timerName == KillStrombiesTimer) {
|
||||
const auto enemies = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(EnemiesGroup));
|
||||
for (auto* enemy : enemies) {
|
||||
RequestDie(self, enemy);
|
||||
}
|
||||
|
||||
DestroySpawner(self->GetVar<std::string>(SmashablesSpawner));
|
||||
KillSpots(self);
|
||||
DestroySpawner(self->GetVar<std::string>(SmashablesSpawner));
|
||||
KillSpots(self);
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player == nullptr)
|
||||
return;
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
GameMessages::SendStop2DAmbientSound(player, true, GUIDMaelstrom);
|
||||
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
||||
GameMessages::SendStop2DAmbientSound(player, true, GUIDMaelstrom);
|
||||
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
||||
|
||||
self->AddTimer(ShowVendorTimer, 5.0f);
|
||||
} else if (timerName == KillMarkerTimer) {
|
||||
DestroySpawner(self->GetVar<std::string>(ClaimMarkerSpawner));
|
||||
self->AddTimer(ShowVendorTimer, 5.0f);
|
||||
} else if (timerName == KillMarkerTimer) {
|
||||
DestroySpawner(self->GetVar<std::string>(ClaimMarkerSpawner));
|
||||
|
||||
for (const auto& behaviorObjectSpawner : self->GetVar<std::vector<std::string>>(BehaviorObjsSpawner)) {
|
||||
DestroySpawner(behaviorObjectSpawner);
|
||||
}
|
||||
for (const auto& behaviorObjectSpawner : self->GetVar<std::vector<std::string>>(BehaviorObjsSpawner)) {
|
||||
DestroySpawner(behaviorObjectSpawner);
|
||||
}
|
||||
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(ImagOrbGroup))) {
|
||||
entity->Smash();
|
||||
}
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(ImagOrbGroup))) {
|
||||
entity->Smash();
|
||||
}
|
||||
|
||||
DestroySpawner(self->GetVar<std::string>(ImageOrbSpawner));
|
||||
DestroySpawner(self->GetVar<std::string>(ImageOrbSpawner));
|
||||
|
||||
self->AddTimer(ShowVendorTimer, 1.0f);
|
||||
} else if (timerName == ShowVendorTimer) {
|
||||
GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(),
|
||||
u"vendorOn", 0, 0, LWOOBJID_EMPTY, "",
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
self->AddTimer(ShowVendorTimer, 1.0f);
|
||||
} else if (timerName == ShowVendorTimer) {
|
||||
GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(),
|
||||
u"vendorOn", 0, 0, LWOOBJID_EMPTY, "",
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
for (const auto& ambientFXSpawner : self->GetVar<std::vector<std::string>>(AmbientFXSpawner)) {
|
||||
ActivateSpawner(ambientFXSpawner);
|
||||
}
|
||||
} else if (timerName == BoundsVisOnTimer) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"boundsAnim", 0, 0,
|
||||
LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
} else if (timerName == RunPlayerLoadedAgainTimer) {
|
||||
CheckForOwner(self);
|
||||
} else if (timerName == PollTornadoFXTimer) {
|
||||
StartTornadoFx(self);
|
||||
} else if (timerName == KillFXObjectTimer) {
|
||||
const auto fxManagers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
||||
if (fxManagers.empty()) {
|
||||
self->AddTimer(KillFXObjectTimer, 1.0f);
|
||||
return;
|
||||
}
|
||||
for (const auto& ambientFXSpawner : self->GetVar<std::vector<std::string>>(AmbientFXSpawner)) {
|
||||
ActivateSpawner(ambientFXSpawner);
|
||||
}
|
||||
} else if (timerName == BoundsVisOnTimer) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"boundsAnim", 0, 0,
|
||||
LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
} else if (timerName == RunPlayerLoadedAgainTimer) {
|
||||
CheckForOwner(self);
|
||||
} else if (timerName == PollTornadoFXTimer) {
|
||||
StartTornadoFx(self);
|
||||
} else if (timerName == KillFXObjectTimer) {
|
||||
const auto fxManagers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
||||
if (fxManagers.empty()) {
|
||||
self->AddTimer(KillFXObjectTimer, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto* fxManager : fxManagers) {
|
||||
auto* renderComponent = fxManager->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("beam");
|
||||
}
|
||||
}
|
||||
for (auto* fxManager : fxManagers) {
|
||||
auto* renderComponent = fxManager->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("beam");
|
||||
}
|
||||
}
|
||||
|
||||
DestroySpawner(self->GetVar<std::string>(FXManagerSpawner));
|
||||
self->SetVar<bool>(u"FXObjectGone", true);
|
||||
}
|
||||
DestroySpawner(self->GetVar<std::string>(FXManagerSpawner));
|
||||
self->SetVar<bool>(u"FXObjectGone", true);
|
||||
}
|
||||
}
|
||||
|
||||
void BasePropertyServer::HandleOrbsTimer(Entity* self) {
|
||||
self->SetVar<bool>(CollidedVariable, false);
|
||||
auto orbs = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(ImagOrbGroup));
|
||||
if (orbs.empty()) {
|
||||
self->AddTimer(StartOrbTimer, 0.5f);
|
||||
return;
|
||||
}
|
||||
self->SetVar<bool>(CollidedVariable, false);
|
||||
auto orbs = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(ImagOrbGroup));
|
||||
if (orbs.empty()) {
|
||||
self->AddTimer(StartOrbTimer, 0.5f);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto* orb : orbs) {
|
||||
orb->AddCollisionPhantomCallback([self, this](Entity* other) {
|
||||
if (other != nullptr && other->IsPlayer() && !self->GetVar<bool>(CollidedVariable)) {
|
||||
self->SetVar<bool>(CollidedVariable, true);
|
||||
for (auto* orb : orbs) {
|
||||
orb->AddCollisionPhantomCallback([self, this](Entity* other) {
|
||||
if (other != nullptr && other->IsPlayer() && !self->GetVar<bool>(CollidedVariable)) {
|
||||
self->SetVar<bool>(CollidedVariable, true);
|
||||
|
||||
KillClouds(self);
|
||||
DeactivateSpawner(self->GetVar<std::string>(GeneratorSpawner));
|
||||
KillClouds(self);
|
||||
DeactivateSpawner(self->GetVar<std::string>(GeneratorSpawner));
|
||||
|
||||
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
||||
DeactivateSpawner(enemySpawner);
|
||||
}
|
||||
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
||||
DeactivateSpawner(enemySpawner);
|
||||
}
|
||||
|
||||
DestroySpawner(self->GetVar<std::string>(GeneratorFXSpawner));
|
||||
GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(),
|
||||
u"PlayCinematic", 0, 0, LWOOBJID_EMPTY,
|
||||
"DestroyMaelstrom", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
DestroySpawner(self->GetVar<std::string>(GeneratorFXSpawner));
|
||||
GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(),
|
||||
u"PlayCinematic", 0, 0, LWOOBJID_EMPTY,
|
||||
"DestroyMaelstrom", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
// Notifies the client that the property has been claimed with a flag, completes missions too
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(self->GetVar<uint32_t>(defeatedProperyFlag), true);
|
||||
}
|
||||
}
|
||||
// Notifies the client that the property has been claimed with a flag, completes missions too
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
auto* character = player->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(self->GetVar<uint32_t>(defeatedProperyFlag), true);
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer(TornadoOffTimer, 0.5f);
|
||||
self->AddTimer(KillMarkerTimer, 0.7f);
|
||||
}
|
||||
});
|
||||
}
|
||||
self->AddTimer(TornadoOffTimer, 0.5f);
|
||||
self->AddTimer(KillMarkerTimer, 0.7f);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void BasePropertyServer::HandleGeneratorTimer(Entity* self) {
|
||||
auto generators = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(GeneratorGroup));
|
||||
if (generators.empty()) {
|
||||
self->AddTimer(StartGeneratorTimer, 0.5f);
|
||||
return;
|
||||
}
|
||||
auto generators = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(GeneratorGroup));
|
||||
if (generators.empty()) {
|
||||
self->AddTimer(StartGeneratorTimer, 0.5f);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto* generator : generators) {
|
||||
generator->AddDieCallback([self, this]() {
|
||||
ActivateSpawner(self->GetVar<std::string>(ClaimMarkerSpawner));
|
||||
self->AddTimer(StartQuickbuildTimer, 0.0f);
|
||||
for (auto* generator : generators) {
|
||||
generator->AddDieCallback([self, this]() {
|
||||
ActivateSpawner(self->GetVar<std::string>(ClaimMarkerSpawner));
|
||||
self->AddTimer(StartQuickbuildTimer, 0.0f);
|
||||
|
||||
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
||||
DeactivateSpawner(enemySpawner);
|
||||
}
|
||||
DeactivateSpawner(self->GetVar<std::string>(GeneratorSpawner));
|
||||
});
|
||||
}
|
||||
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
||||
DeactivateSpawner(enemySpawner);
|
||||
}
|
||||
DeactivateSpawner(self->GetVar<std::string>(GeneratorSpawner));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void BasePropertyServer::HandleQuickBuildTimer(Entity* self) {
|
||||
auto claimMarkers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(ClaimMarkerGroup));
|
||||
if (claimMarkers.empty()) {
|
||||
self->AddTimer(StartQuickbuildTimer, 0.5f);
|
||||
return;
|
||||
}
|
||||
auto claimMarkers = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(ClaimMarkerGroup));
|
||||
if (claimMarkers.empty()) {
|
||||
self->AddTimer(StartQuickbuildTimer, 0.5f);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto* claimMarker : claimMarkers) {
|
||||
// TODO: Send password?
|
||||
}
|
||||
for (auto* claimMarker : claimMarkers) {
|
||||
// TODO: Send password?
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user