Merge branch 'main' into guild_temp

This commit is contained in:
Aaron Kimbre
2023-11-15 21:14:20 -06:00
842 changed files with 22115 additions and 15964 deletions

View File

@@ -2,6 +2,7 @@
#include "GameMessages.h"
#include "dServer.h"
#include "VanityUtilities.h"
#include "RenderComponent.h"
void DLUVanityNPC::OnStartup(Entity* self) {
m_NPC = VanityUtilities::GetNPC("averysumner - Destroyer of Worlds");
@@ -17,7 +18,7 @@ void DLUVanityNPC::OnStartup(Entity* self) {
void DLUVanityNPC::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "setupTeleport") {
GameMessages::SendPlayAnimation(self, u"interact");
RenderComponent::PlayAnimation(self, u"interact");
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportBeam", "teleportBeam");
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportRings", "teleportRings");

View File

@@ -13,6 +13,8 @@
#include "GameMessages.h"
#include "SkillComponent.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include <vector>
@@ -27,9 +29,9 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
//self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true, bImmuneToInterrupt = true }
//Get our components:
destroyable = static_cast<DestroyableComponent*>(self->GetComponent(COMPONENT_TYPE_DESTROYABLE));
controllable = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));
combat = static_cast<BaseCombatAIComponent*>(self->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI));
destroyable = static_cast<DestroyableComponent*>(self->GetComponent(eReplicaComponentType::DESTROYABLE));
controllable = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
combat = static_cast<BaseCombatAIComponent*>(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
if (!destroyable || !controllable) return;
@@ -47,12 +49,10 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
m_CurrentBossStage = 1;
// Obtain faction and collision group to save for subsequent resets
//self : SetVar("SBFactionList", self:GetFaction().factionList)
//self : SetVar("SBCollisionGroup", self:GetCollisionGroup().colGroup)
}
void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
if (dZoneManager::Instance()->GetZoneID().GetMapID() == instanceZoneID) {
if (Game::zoneManager->GetZoneID().GetMapID() == instanceZoneID && killer) {
auto* missionComponent = killer->GetComponent<MissionComponent>();
if (missionComponent == nullptr)
return;
@@ -60,16 +60,14 @@ void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
missionComponent->CompleteMission(instanceMissionID);
}
Game::logger->Log("BossSpiderQueenEnemyServer", "Starting timer...");
// There is suppose to be a 0.1 second delay here but that may be admitted?
auto* controller = EntityManager::Instance()->GetZoneControlEntity();
auto* controller = Game::entityManager->GetZoneControlEntity();
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 10, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
self->SetPosition({ 10000, 0, 10000 });
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
controller->OnFireEventServerSide(self, "ClearProperty");
}
@@ -99,7 +97,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
rot = controllable->GetRotation();
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
@@ -115,7 +113,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
//TODO: Set faction to -1 and set immunity
destroyable->SetFaction(-1);
destroyable->SetIsImmune(true);
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
self->AddTimer("WithdrawComplete", withdrawTime + 1.0f);
waitForIdle = true;
@@ -148,7 +146,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
//Reset the current wave death counter
m_DeathCounter = 0;
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
// Prepare a timer for post leap attack
self->AddTimer("AdvanceAttack", attackPause);
@@ -164,9 +162,6 @@ void BossSpiderQueenEnemyServer::SpawnSpiderWave(Entity* self, int spiderCount)
// The Spider Queen Boss is withdrawing and requesting the spawn
// of a hatchling wave
/*auto SpiderEggNetworkID = self->GetI64(u"SpiderEggNetworkID");
if (SpiderEggNetworkID == 0) return;*/
// Clamp invalid Spiderling number requests to the maximum amount of eggs available
if ((spiderCount > maxSpiderEggCnt) || (spiderCount < 0))
spiderCount = maxSpiderEggCnt;
@@ -175,91 +170,59 @@ void BossSpiderQueenEnemyServer::SpawnSpiderWave(Entity* self, int spiderCount)
hatchCounter = spiderCount;
hatchList = {};
Game::logger->Log("SpiderQueen", "Trying to spawn %i spiders", hatchCounter);
// Run the wave manager
SpiderWaveManager(self);
}
void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
auto SpiderEggNetworkID = self->GetI64(u"SpiderEggNetworkID");
// Reset the spider egg spawner network to ensure a maximum number of eggs
//SpiderEggNetworkID:SpawnerReset()
// Obtain a list of all the eggs on the egg spawner network
//auto spiderEggList = SpiderEggNetworkID:SpawnerGetAllObjectIDsSpawned().objects;
//if (table.maxn(spiderEggList) <= 0) {
// self->AddTimer("PollSpiderWaveManager", 1.0f);
// return;
//}
//
//// A check for (wave mangement across multiple spawn iterations
//if(hatchCounter < spiderWaveCnt) {
// // We have already prepped some objects for (hatching,
// // remove them from our list for (random egg pulls
// for (i, sVal in ipairs(spiderEggList) {
// if(hatchList[sVal:GetID()]) {
// // We have found a prepped egg, remove it from the spiderEggList
// spiderEggList[i] = nil
// }
// }
//}
std::vector<LWOOBJID> spiderEggs{};
auto spooders = EntityManager::Instance()->GetEntitiesInGroup("EGG");
auto spooders = Game::entityManager->GetEntitiesInGroup("EGG");
for (auto spodder : spooders) {
spiderEggs.push_back(spodder->GetObjectID());
}
// Select a number of random spider eggs from the list equal to the
// current number needed to complete the current wave
for (int i = 0; i < hatchCounter; i++) {
// Select a random spider egg
auto randomEggLoc = GeneralUtils::GenerateRandomNumber<int>(0, spiderEggs.size() - 1);
auto randomEgg = spiderEggs[randomEggLoc];
if (!spiderEggs.empty()) {
for (int i = 0; i < hatchCounter; i++) {
// Select a random spider egg
auto randomEggLoc = GeneralUtils::GenerateRandomNumber<int>(0, spiderEggs.size() - 1);
auto randomEgg = spiderEggs[randomEggLoc];
//Just a quick check to try and prevent dupes:
for (auto en : hatchList) {
if (en == randomEgg) {
randomEggLoc++;
randomEgg = spiderEggs[randomEggLoc];
}
}
if (randomEgg) {
auto* eggEntity = EntityManager::Instance()->GetEntity(randomEgg);
if (eggEntity == nullptr) {
continue;
//Just a quick check to try and prevent dupes:
for (auto en : hatchList) {
if (en == randomEgg) {
randomEggLoc++;
randomEgg = spiderEggs.at(randomEggLoc % spiderEggs.size());
}
}
// Prep the selected spider egg
//randomEgg:FireEvent{s}erID=self, args="prepEgg"}
eggEntity->OnFireEventServerSide(self, "prepEgg");
Game::logger->Log("SpiderQueen", "Prepping egg %llu", eggEntity->GetObjectID());
if (randomEgg) {
auto* eggEntity = Game::entityManager->GetEntity(randomEgg);
// Add the prepped egg to our hatchList
hatchList.push_back(eggEntity->GetObjectID());
if (eggEntity == nullptr) {
continue;
}
// Decrement the hatchCounter
hatchCounter = hatchCounter - 1;
}
// Prep the selected spider egg
eggEntity->OnFireEventServerSide(self, "prepEgg");
// Remove it from our spider egg list
//table.remove(spiderEggList, randomEggLoc);
spiderEggs[randomEggLoc] = LWOOBJID_EMPTY;
// Add the prepped egg to our hatchList
hatchList.push_back(eggEntity->GetObjectID());
if (spiderEggs.size() <= 0 || (hatchCounter <= 0)) {
break;
// Decrement the hatchCounter
hatchCounter = hatchCounter - 1;
}
// Remove it from our spider egg list
spiderEggs[randomEggLoc] = LWOOBJID_EMPTY;
if (spiderEggs.size() <= 0 || (hatchCounter <= 0)) {
break;
}
}
}
@@ -271,21 +234,19 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
// We have successfully readied a full wave
// initiate hatching!
for (auto egg : hatchList) {
auto* eggEntity = EntityManager::Instance()->GetEntity(egg);
auto* eggEntity = Game::entityManager->GetEntity(egg);
if (eggEntity == nullptr) {
continue;
}
eggEntity->OnFireEventServerSide(self, "hatchEgg");
Game::logger->Log("SpiderQueen", "hatching egg %llu", eggEntity->GetObjectID());
auto time = PlayAnimAndReturnTime(self, spiderWithdrawIdle);
combat->SetStunImmune(false);
combat->Stun(time += 6.0f);
combat->SetStunImmune(true);
//self->AddTimer("disableWaitForIdle", defaultAnimPause);
self->AddTimer("checkForSpiders", 6.0f);
}
@@ -315,7 +276,7 @@ void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self) {
auto index = 0u;
for (const auto& rofGroup : ROFTargetGroupIDTable) {
const auto spawners = dZoneManager::Instance()->GetSpawnersInGroup(rofGroup);
const auto spawners = Game::zoneManager->GetSpawnersInGroup(rofGroup);
std::vector<LWOOBJID> spawned;
@@ -327,7 +288,7 @@ void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self) {
if (index == 0) {
impactList.insert(impactList.end(), spawned.begin(), spawned.end());
} else {
} else if (!spawned.empty()) {
const auto randomIndex = GeneralUtils::GenerateRandomNumber<int32_t>(0, spawned.size() - 1);
impactList.push_back(spawned[randomIndex]);
@@ -343,12 +304,12 @@ void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self) {
void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) {
if (!impactList.empty()) {
auto* entity = EntityManager::Instance()->GetEntity(impactList[0]);
auto* entity = Game::entityManager->GetEntity(impactList[0]);
impactList.erase(impactList.begin());
if (entity == nullptr) {
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact!");
LOG("Failed to find impact!");
return;
}
@@ -356,7 +317,7 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) {
auto* skillComponent = entity->GetComponent<SkillComponent>();
if (skillComponent == nullptr) {
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact skill component!");
LOG("Failed to find impact skill component!");
return;
}
@@ -396,10 +357,6 @@ void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self) {
}
void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
/*
const auto targets = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CHARACTER);
*/
const auto targets = self->GetTargetsInPhantom();
if (self->GetBoolean(u"stoppedFlag")) {
@@ -409,7 +366,7 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
}
if (targets.empty()) {
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find RFS targets");
LOG("Failed to find RFS targets");
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(5, 10));
@@ -432,8 +389,6 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
PlayAnimAndReturnTime(self, spiderSingleShot);
Game::logger->Log("BossSpiderQueenEnemyServer", "Ran RFS");
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(10, 15));
}
@@ -453,7 +408,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
controllable->SetStatic(false);
controllable->SetRotation(rot);
controllable->SetStatic(true);
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
//Play the Spider Boss' mountain idle anim
auto time = PlayAnimAndReturnTime(self, spiderWithdrawIdle);
@@ -464,7 +419,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
rot = controllable->GetRotation();
//If there are still baby spiders, don't do anyhting either
const auto spiders = EntityManager::Instance()->GetEntitiesInGroup("BabySpider");
const auto spiders = Game::entityManager->GetEntitiesInGroup("BabySpider");
if (spiders.size() > 0)
self->AddTimer("checkForSpiders", time);
else
@@ -536,7 +491,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
}*/
auto landingTarget = self->GetI64(u"LandingTarget");
auto landingEntity = EntityManager::Instance()->GetEntity(landingTarget);
auto landingEntity = Game::entityManager->GetEntity(landingTarget);
auto* skillComponent = self->GetComponent<SkillComponent>();
@@ -555,26 +510,6 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake-bridge", self->GetObjectID(), 100.0f);
} else if (timerName == "AdvanceComplete") {
//Reset faction and collision
/*local SBFactionList = self:GetVar("SBFactionList")
local SBCollisionGroup = self:GetVar("SBCollisionGroup")
for i, fVal in ipairs(SBFactionList) {
if(i == 1) {
//Our first faction - flush and add
self:SetFaction{faction = fVal}
else
//Add
self:ModifyFaction{factionID = fVal, bAddFaction = true}
}
}*/
/*
auto SBCollisionGroup = self->GetI32(u"SBCollisionGroup");
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", SBCollisionGroup, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
*/
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 11, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
//Wind up, telegraphing next round
@@ -612,10 +547,10 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
destroyable->SetIsImmune(false);
destroyable->SetFaction(4);
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
} else if (timerName == "Clear") {
EntityManager::Instance()->FireEventServerSide(self, "ClearProperty");
Game::entityManager->FireEventServerSide(self, "ClearProperty");
self->CancelAllTimers();
} else if (timerName == "UnlockSpecials") {
//We no longer need to lock specials
@@ -624,7 +559,6 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
//Did we queue a spcial attack?
if (self->GetBoolean(u"bSpecialQueued")) {
self->SetBoolean(u"bSpecialQueued", false);
//SpiderSkillManager(self, true);
}
}
}
@@ -671,18 +605,7 @@ void BossSpiderQueenEnemyServer::OnUpdate(Entity* self) {
controllable->SetRotation(NiQuaternion::IDENTITY);
controllable->SetStatic(true);
EntityManager::Instance()->SerializeEntity(self);
//if (waitForIdle) return;
////Play the Spider Boss' mountain idle anim
//PlayAnimAndReturnTime(self, spiderWithdrawIdle);
////If there are still baby spiders, don't do anyhting either
//auto spooders = EntityManager::Instance()->GetEntitiesInGroup("BabySpider");
//if (spooders.size() > 0) return;
//else
// WithdrawSpider(self, false);
Game::entityManager->SerializeEntity(self);
}
//----------------------------------------------
@@ -694,11 +617,11 @@ float BossSpiderQueenEnemyServer::PlayAnimAndReturnTime(Entity* self, const std:
//TODO: Get the actual animation time
// Get the anim time
float animTimer = defaultAnimPause; //self:GetAnimationTime{animationID = animID}.time
float animTimer = RenderComponent::GetAnimationTime(self, animID);
// If we have an animation play it
if (animTimer > 0) {
GameMessages::SendPlayAnimation(self, animID);
animTimer = RenderComponent::PlayAnimation(self, animID);
}
// If the anim time is less than the the default time use default

View File

@@ -5,6 +5,9 @@
#include "GameMessages.h"
#include "SkillComponent.h"
#include "BaseCombatAIComponent.h"
#include "EntityInfo.h"
#include "eAninmationFlags.h"
#include "RenderComponent.h"
void AmDarklingDragon::OnStartup(Entity* self) {
self->SetVar<int32_t>(u"weakspot", 0);
@@ -25,7 +28,7 @@ void AmDarklingDragon::OnDie(Entity* self, Entity* killer) {
auto golemId = self->GetVar<LWOOBJID>(u"Golem");
auto* golem = EntityManager::Instance()->GetEntity(golemId);
auto* golem = Game::entityManager->GetEntity(golemId);
if (golem != nullptr) {
golem->Smash(self->GetObjectID());
@@ -63,13 +66,14 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
if (skillComponent != nullptr) {
skillComponent->Interrupt();
skillComponent->Reset();
}
self->SetVar<int32_t>(u"weakpoint", 2);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
float animationTime = RenderComponent::PlayAnimation(self, u"stunstart", 1.7f);
GameMessages::SendPlayAnimation(self, u"stunstart", 1.7f);
self->AddTimer("timeToStunLoop", 1);
self->AddTimer("timeToStunLoop", 1.0f);
auto position = self->GetPosition();
auto forward = self->GetRotation().GetForwardVector();
@@ -105,9 +109,9 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID())
};
auto* golemObject = EntityManager::Instance()->CreateEntity(info);
auto* golemObject = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(golemObject);
Game::entityManager->ConstructEntity(golemObject);
}
}
}
@@ -118,9 +122,9 @@ void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
} else if (timerName == "ExposeWeakSpotTimer") {
self->SetVar<int32_t>(u"weakspot", 1);
} else if (timerName == "timeToStunLoop") {
GameMessages::SendPlayAnimation(self, u"stunloop", 1.8f);
RenderComponent::PlayAnimation(self, u"stunloop", 1.8f);
} else if (timerName == "ReviveTimer") {
GameMessages::SendPlayAnimation(self, u"stunend", 2.0f);
RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1);
} else if (timerName == "backToAttack") {
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
@@ -131,7 +135,9 @@ void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
}
if (skillComponent != nullptr) {
skillComponent->Interrupt();
skillComponent->Reset();
}
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS);
self->SetVar<int32_t>(u"weakspot", -1);
GameMessages::SendNotifyObject(self->GetObjectID(), self->GetObjectID(), u"DragonRevive", UNASSIGNED_SYSTEM_ADDRESS);
}
@@ -148,5 +154,5 @@ void AmDarklingDragon::OnFireEventServerSide(Entity* self, Entity* sender, std::
self->SetVar<LWOOBJID>(u"Golem", sender->GetObjectID());
GameMessages::SendPlayAnimation(self, u"quickbuildhold", 1.9f);
RenderComponent::PlayAnimation(self, u"quickbuildhold", 1.9f);
}

View File

@@ -3,7 +3,7 @@
void FvMaelstromCavalry::OnStartup(Entity* self) {
for (const auto& group : self->GetGroups()) {
const auto& objects = EntityManager::Instance()->GetEntitiesInGroup(group);
const auto& objects = Game::entityManager->GetEntitiesInGroup(group);
for (auto* obj : objects) {
if (obj->GetLOT() != 8551) continue;
@@ -22,7 +22,7 @@ void FvMaelstromCavalry::OnDie(Entity* self, Entity* killer) {
return;
}
const auto& triggers = EntityManager::Instance()->GetEntitiesInGroup("HorsemenTrigger");
const auto& triggers = Game::entityManager->GetEntitiesInGroup("HorsemenTrigger");
for (auto* trigger : triggers) {
trigger->OnFireEventServerSide(self, "HorsemenDeath");

View File

@@ -3,6 +3,9 @@
#include "SkillComponent.h"
#include "BaseCombatAIComponent.h"
#include "DestroyableComponent.h"
#include "eAninmationFlags.h"
#include "EntityInfo.h"
#include "RenderComponent.h"
void FvMaelstromDragon::OnStartup(Entity* self) {
self->SetVar<int32_t>(u"weakspot", 0);
@@ -32,13 +35,13 @@ void FvMaelstromDragon::OnDie(Entity* self, Entity* killer) {
info.rot = rotation;
info.spawnerID = self->GetObjectID();
auto* chest = EntityManager::Instance()->CreateEntity(info);
auto* chest = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(chest);
Game::entityManager->ConstructEntity(chest);
auto golemId = self->GetVar<LWOOBJID>(u"Golem");
auto* golem = EntityManager::Instance()->GetEntity(golemId);
auto* golem = Game::entityManager->GetEntity(golemId);
if (golem != nullptr) {
golem->Smash(self->GetObjectID());
@@ -59,14 +62,12 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
Game::logger->Log("FvMaelstromDragon", "Hit %i", destroyableComponent->GetArmor());
if (destroyableComponent->GetArmor() > 0) return;
auto weakpoint = self->GetVar<int32_t>(u"weakpoint");
if (weakpoint == 0) {
Game::logger->Log("FvMaelstromDragon", "Activating weakpoint");
LOG("Activating weakpoint");
self->AddTimer("ReviveTimer", 12);
@@ -80,13 +81,15 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
if (skillComponent != nullptr) {
skillComponent->Interrupt();
skillComponent->Reset();
}
self->SetVar<int32_t>(u"weakpoint", 2);
GameMessages::SendPlayAnimation(self, u"stunstart", 1.7f);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
RenderComponent::PlayAnimation(self, u"stunstart", 1.7f);
self->AddTimer("timeToStunLoop", 1);
self->AddTimer("timeToStunLoop", 1.0f);
auto position = self->GetPosition();
auto forward = self->GetRotation().GetForwardVector();
@@ -122,9 +125,9 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID())
};
auto* golemObject = EntityManager::Instance()->CreateEntity(info);
auto* golemObject = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(golemObject);
Game::entityManager->ConstructEntity(golemObject);
}
}
}
@@ -135,10 +138,10 @@ void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName) {
} else if (timerName == "ExposeWeakSpotTimer") {
self->SetVar<int32_t>(u"weakspot", 1);
} else if (timerName == "timeToStunLoop") {
GameMessages::SendPlayAnimation(self, u"stunloop", 1.8f);
RenderComponent::PlayAnimation(self, u"stunloop", 1.8f);
} else if (timerName == "ReviveTimer") {
GameMessages::SendPlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1);
RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1.0f);
} else if (timerName == "backToAttack") {
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>();
@@ -150,8 +153,9 @@ void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName) {
if (skillComponent != nullptr) {
skillComponent->Interrupt();
skillComponent->Reset();
}
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS);
self->SetVar<int32_t>(u"weakspot", -1);
GameMessages::SendNotifyObject(self->GetObjectID(), self->GetObjectID(), u"DragonRevive", UNASSIGNED_SYSTEM_ADDRESS);
@@ -171,5 +175,5 @@ FvMaelstromDragon::OnFireEventServerSide(Entity* self, Entity* sender, std::stri
self->SetVar<LWOOBJID>(u"Golem", sender->GetObjectID());
GameMessages::SendPlayAnimation(self, u"quickbuildhold", 1.9f);
RenderComponent::PlayAnimation(self, u"quickbuildhold", 1.9f);
}

View File

@@ -3,7 +3,11 @@
#include "DestroyableComponent.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "SkillComponent.h"
#include "eAninmationFlags.h"
#include "RenderComponent.h"
#include "eStateChangeType.h"
void BaseEnemyApe::OnStartup(Entity* self) {
self->SetVar<uint32_t>(u"timesStunned", 2);
@@ -11,9 +15,9 @@ void BaseEnemyApe::OnStartup(Entity* self) {
}
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
auto* anchor = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
auto* anchor = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
if (anchor != nullptr && !anchor->GetIsDead()) {
anchor->Smash(self->GetObjectID(), SILENT);
anchor->Smash(self->GetObjectID(), eKillType::SILENT);
}
}
@@ -31,9 +35,12 @@ void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) {
if (destroyableComponent != nullptr && destroyableComponent->GetArmor() < 1 && !self->GetBoolean(u"knockedOut")) {
StunApe(self, true);
self->CancelTimer("spawnQBTime");
GameMessages::SendPlayAnimation(self, u"disable", 1.7f);
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent) {
skillComponent->Reset();
}
RenderComponent::PlayAnimation(self, u"disable", 1.7f);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
const auto reviveTime = self->GetVar<float_t>(u"reviveTime") != 0.0f
? self->GetVar<float_t>(u"reviveTime") : 12.0f;
self->AddTimer("reviveTime", reviveTime);
@@ -49,7 +56,8 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
if (destroyableComponent != nullptr) {
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor() / timesStunned);
}
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_COMBAT, eAnimationFlags::IDLE_NONE, UNASSIGNED_SYSTEM_ADDRESS);
self->SetVar<uint32_t>(u"timesStunned", timesStunned + 1);
StunApe(self, false);
@@ -84,14 +92,14 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
new LDFData<LWOOBJID>(u"ape", self->GetObjectID())
};
auto* anchor = EntityManager::Instance()->CreateEntity(entityInfo);
EntityManager::Instance()->ConstructEntity(anchor);
auto* anchor = Game::entityManager->CreateEntity(entityInfo);
Game::entityManager->ConstructEntity(anchor);
self->SetVar<LWOOBJID>(u"QB", anchor->GetObjectID());
} else if (timerName == "anchorDamageTimer") {
// Attacks the ape with some god skill
const auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"smasher"));
const auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"smasher"));
if (player == nullptr) {
return;
}
@@ -125,7 +133,7 @@ void BaseEnemyApe::StunApe(Entity* self, bool stunState) {
skillComponent->Interrupt();
}
GameMessages::SendSetStunned(self->GetObjectID(), stunState ? PUSH : POP, UNASSIGNED_SYSTEM_ADDRESS, self->GetObjectID(),
GameMessages::SendSetStunned(self->GetObjectID(), stunState ? eStateChangeType::PUSH : eStateChangeType::POP, UNASSIGNED_SYSTEM_ADDRESS, self->GetObjectID(),
true, true, true, true, true,
true, true, true, true);

View File

@@ -1,7 +1,7 @@
#pragma once
#include "CppScripts.h"
class BaseEnemyApe : public CppScripts::Script {
class BaseEnemyApe : virtual public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override;

View File

@@ -3,8 +3,10 @@
#include "ControllablePhysicsComponent.h"
#include "EntityManager.h"
#include "dpWorld.h"
#include "EntityInfo.h"
#include "GeneralUtils.h"
#include "DestroyableComponent.h"
#include "eReplicaComponentType.h"
void BaseEnemyMech::OnStartup(Entity* self) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
@@ -14,7 +16,7 @@ void BaseEnemyMech::OnStartup(Entity* self) {
}
void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS));
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
if (!controlPhys) return;
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };
@@ -36,8 +38,8 @@ void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
info.spawnerID = self->GetObjectID();
info.settings = cfg;
Entity* turret = EntityManager::Instance()->CreateEntity(info, nullptr);
Entity* turret = Game::entityManager->CreateEntity(info, nullptr);
if (turret) {
EntityManager::Instance()->ConstructEntity(turret);
Game::entityManager->ConstructEntity(turret);
}
}

View File

@@ -1,6 +1,8 @@
#include "GfApeSmashingQB.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
void GfApeSmashingQB::OnStartup(Entity* self) {
self->SetNetworkVar<LWOOBJID>(u"lootTagOwner", self->GetVar<LWOOBJID>(u"lootTagOwner"));
@@ -13,10 +15,10 @@ void GfApeSmashingQB::OnTimerDone(Entity* self, std::string timerName) {
}
void GfApeSmashingQB::OnRebuildComplete(Entity* self, Entity* target) {
auto* ape = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"ape"));
auto* ape = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"ape"));
if (ape != nullptr) {
ape->OnFireEventServerSide(target, "rebuildDone");
GameMessages::SendPlayAnimation(self, u"smash", 1.7f);
RenderComponent::PlayAnimation(self, u"smash", 1.7f);
self->AddTimer("anchorBreakTime", 1.0f);
}
}

View File

@@ -2,6 +2,7 @@
#include "ScriptedActivityComponent.h"
#include "TeamManager.h"
#include "EntityManager.h"
#include "Loot.h"
void TreasureChestDragonServer::OnStartup(Entity* self) {
@@ -28,14 +29,14 @@ void TreasureChestDragonServer::OnUse(Entity* self, Entity* user) {
rating = team->members.size();
for (const auto member : team->members) {
auto* memberObject = EntityManager::Instance()->GetEntity(member);
auto* memberObject = Game::entityManager->GetEntity(member);
if (memberObject == nullptr) continue;
LootGenerator::Instance().DropActivityLoot(memberObject, self, scriptedActivityComponent->GetActivityID(), rating);
Loot::DropActivityLoot(memberObject, self, scriptedActivityComponent->GetActivityID(), rating);
}
} else {
LootGenerator::Instance().DropActivityLoot(user, self, scriptedActivityComponent->GetActivityID(), rating);
Loot::DropActivityLoot(user, self, scriptedActivityComponent->GetActivityID(), rating);
}
self->Smash(self->GetObjectID());

View File

@@ -2,17 +2,19 @@
#include "EntityManager.h"
#include "RenderComponent.h"
#include "MissionComponent.h"
#include "MissionTaskType.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "Loot.h"
void BootyDigServer::OnStartup(Entity* self) {
auto* zoneControlObject = EntityManager::Instance()->GetZoneControlEntity();
auto* zoneControlObject = Game::entityManager->GetZoneControlEntity();
if (zoneControlObject != nullptr) {
zoneControlObject->OnFireEventServerSide(self, "CheckForPropertyOwner");
}
}
void BootyDigServer::OnPlayerLoaded(Entity* self, Entity* player) {
auto* zoneControlObject = EntityManager::Instance()->GetZoneControlEntity();
auto* zoneControlObject = Game::entityManager->GetZoneControlEntity();
if (zoneControlObject != nullptr) {
zoneControlObject->OnFireEventServerSide(self, "CheckForPropertyOwner");
}
@@ -28,7 +30,7 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
return;
if (args == "ChestReady" && (propertyOwner == std::to_string(LWOOBJID_EMPTY) || player->GetVar<bool>(u"bootyDug"))) {
self->Smash(self->GetObjectID(), SILENT);
self->Smash(self->GetObjectID(), eKillType::SILENT);
} else if (args == "ChestOpened") {
// Make sure players only dig up one booty per instance
player->SetVar<bool>(u"bootyDug", true);
@@ -36,17 +38,17 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
auto* mission = missionComponent->GetMission(1881);
if (mission != nullptr && (mission->GetMissionState() == MissionState::MISSION_STATE_ACTIVE || mission->GetMissionState() == MissionState::MISSION_STATE_COMPLETE_ACTIVE)) {
mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
if (mission != nullptr && (mission->GetMissionState() == eMissionState::ACTIVE || mission->GetMissionState() == eMissionState::COMPLETE_ACTIVE)) {
mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
auto* renderComponent = self->GetComponent<RenderComponent>();
if (renderComponent != nullptr)
renderComponent->PlayEffect(7730, u"cast", "bootyshine");
LootGenerator::Instance().DropLoot(player, self, 231, 75, 75);
Loot::DropLoot(player, self, 231, 75, 75);
}
}
} else if (args == "ChestDead") {
self->Smash(player->GetObjectID(), SILENT);
self->Smash(player->GetObjectID(), eKillType::SILENT);
}
}

View File

@@ -3,48 +3,45 @@
#include "GeneralUtils.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "RenderComponent.h"
void MaestromExtracticatorServer::OnStartup(Entity* self) {
//self:SetNetworkVar("current_anim", failAnim)
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(failAnim));
float animTime = RenderComponent::PlayAnimation(self, failAnim);
if (animTime == 0.0f) animTime = defaultTime;
self->AddTimer("PlayFail", defaultTime);
self->AddTimer("PlayFail", animTime);
self->AddTimer("RemoveSample", destroyAfterNoSampleTime);
}
void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
int32_t param2, int32_t param3) {
if (sender == nullptr)
return;
void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
if (sender == nullptr) return;
if (args == "attemptCollection") {
Entity* player = EntityManager::Instance()->GetEntity(self->GetSpawnerID());
Entity* player = Game::entityManager->GetEntity(self->GetSpawnerID());
if (!player) return;
auto missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent == nullptr) return;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, 14718);
missionComponent->Progress(eMissionTaskType::SMASH, 14718);
CollectSample(self, sender->GetObjectID());
sender->ScheduleKillAfterUpdate();
}
}
void MaestromExtracticatorServer::CollectSample(Entity* self, LWOOBJID sampleObj) {
PlayAnimAndReturnTime(self, collectAnim);
self->AddTimer("RemoveSample", defaultTime);
self->AddTimer("RemoveSample", PlayAnimAndReturnTime(self, collectAnim));
}
void MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) {
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(animID));
float MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) {
return RenderComponent::PlayAnimation(self, animID);
}
void MaestromExtracticatorServer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "RemoveSample") {
self->ScheduleKillAfterUpdate();
}
if (timerName == "PlayFail") {
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(failAnim));
} else if (timerName == "PlayFail") {
RenderComponent::PlayAnimation(self, failAnim);
}
}

View File

@@ -7,7 +7,7 @@ public:
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3);
void CollectSample(Entity* self, LWOOBJID sampleObj);
void PlayAnimAndReturnTime(Entity* self, std::string animID);
float PlayAnimAndReturnTime(Entity* self, std::string animID);
void OnTimerDone(Entity* self, std::string timerName);
private:

View File

@@ -3,10 +3,12 @@
#include "GameMessages.h"
#include "Character.h"
#include "EntityManager.h"
#include "eReplicaComponentType.h"
#include "ePlayerFlag.h"
void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
//Tell the client to spawn the baby spiderling:
auto spooders = EntityManager::Instance()->GetEntitiesInGroup("cagedSpider");
auto spooders = Game::entityManager->GetEntitiesInGroup("cagedSpider");
for (auto spodder : spooders) {
GameMessages::SendFireEventClientSide(spodder->GetObjectID(), user->GetSystemAddress(), u"toggle", LWOOBJID_EMPTY, 0, 0, user->GetObjectID());
}
@@ -16,10 +18,10 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
if (!character) return;
character->SetPlayerFlag(74, true);
character->SetPlayerFlag(ePlayerFlag::CAGED_SPIDER, true);
//Remove the maelstrom cube:
auto inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));
auto inv = static_cast<InventoryComponent*>(user->GetComponent(eReplicaComponentType::INVENTORY));
if (inv) {
inv->RemoveItem(14553, 1);

View File

@@ -2,54 +2,27 @@
#include "PhantomPhysicsComponent.h"
#include "SkillComponent.h"
#include "EntityManager.h"
#include "AgMonumentLaserServer.h"
#include "EntityManager.h"
#include "ePhysicsEffectType.h"
void AgLaserSensorServer::OnStartup(Entity* self) {
PhantomPhysicsComponent* physComp = static_cast<PhantomPhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
physComp->SetPhysicsEffectActive(true);
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>();
self->SetBoolean(u"active", true);
auto repelForce = self->GetVarAs<float>(u"repelForce");
if (!repelForce) repelForce = m_RepelForce;
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
if (!phantomPhysicsComponent) return;
phantomPhysicsComponent->SetPhysicsEffectActive(true);
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE);
phantomPhysicsComponent->SetDirectionalMultiplier(repelForce);
phantomPhysicsComponent->SetDirection(NiPoint3::UNIT_Y);
}
void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) {
if (!m_Skill) return;
Entity* laser = nullptr;
for (auto script : EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPT)) {
AgMonumentLaserServer* hasLaser = (AgMonumentLaserServer*)script;
if (hasLaser) {
const auto source = script->GetPosition();
const auto obj = self->GetObjectID();
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) {
laser = script;
break;
} 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) {
laser = script;
break;
}
}
}
if (laser != nullptr) {
m_Skill->CalculateBehavior(m_SkillCastID, 15714, target->GetObjectID());
}
auto active = self->GetVar<bool>(u"active");
if (!active) return;
auto skillCastID = self->GetVarAs<float>(u"skillCastID");
if (skillCastID == 0) skillCastID = m_SkillCastID;
auto* skillComponent = self->GetComponent<SkillComponent>();
if (!skillComponent) return;
skillComponent->CastSkill(m_SkillCastID, target->GetObjectID());
}

View File

@@ -8,8 +8,7 @@ public:
void OnStartup(Entity* self);
void OnCollisionPhantom(Entity* self, Entity* target);
private:
SkillComponent* m_Skill;
int m_RepelForce = -25;
float m_RepelForce = -25.0f;
int m_SkillCastID = 163;
};

View File

@@ -1,5 +1,8 @@
#include "AgMonumentBirds.h"
#include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
#include "EntityManager.h"
//--------------------------------------------------------------
//Makes the ag birds fly away when you get close and smashes them.
@@ -16,7 +19,7 @@ void AgMonumentBirds::OnProximityUpdate(Entity* self, Entity* entering, std::str
if (name == "MonumentBirds" && status == "ENTER") {
self->AddTimer("killBird", 1.0f);
GameMessages::SendPlayAnimation(self, sOnProximityAnim);
RenderComponent::PlayAnimation(self, sOnProximityAnim);
self->SetVar<bool>(u"IsFlying", true);
self->SetVar<LWOOBJID>(u"PlayerID", entering->GetObjectID());
}
@@ -25,7 +28,7 @@ void AgMonumentBirds::OnProximityUpdate(Entity* self, Entity* entering, std::str
void AgMonumentBirds::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != "killBird") return;
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID"));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID"));
if (player == nullptr) return;

View File

@@ -1,20 +1,17 @@
#include "AgMonumentLaserServer.h"
#include "EntityManager.h"
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;
*/
}
void AgMonumentLaserServer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
/*
if (status == "ENTER") {
std::cout << "Monument laser ID: " << self->GetObjectID() << std::endl;
auto lasers = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"volGroup"));
for (auto laser : lasers) {
if (laser) laser->SetBoolean(u"active", true);
}
}
void AgMonumentLaserServer::OnDie(Entity* self, Entity* killer) {
auto lasers = Game::entityManager->GetEntitiesInGroup(self->GetVarAsString(u"volGroup"));
for (auto laser : lasers) {
if (laser) laser->SetBoolean(u"active", false);
}
*/
}

View File

@@ -3,8 +3,6 @@
class AgMonumentLaserServer : public CppScripts::Script {
public:
void OnStartup(Entity* self);
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status);
private:
float m_Radius = 25.0f;
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override;
};

View File

@@ -2,7 +2,7 @@
#include "EntityManager.h"
void AgMonumentRaceCancel::OnCollisionPhantom(Entity* self, Entity* target) {
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager");
auto managers = Game::entityManager->GetEntitiesInGroup("race_manager");
if (!managers.empty()) {
managers[0]->OnFireEventServerSide(target, "course_cancel");
}

View File

@@ -7,9 +7,9 @@ void AgMonumentRaceGoal::OnStartup(Entity* self) {
}
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");
if (name == "RaceGoal" && entering && entering->IsPlayer() && status == "ENTER") {
auto managers = Game::entityManager->GetEntitiesInGroup("race_manager");
if (managers.empty() || !managers.at(0)) return;
managers.at(0)->OnFireEventServerSide(entering, "course_finish");
}
}

View File

@@ -3,6 +3,8 @@
#include "ScriptedActivityComponent.h"
#include "GameMessages.h"
#include "LeaderboardManager.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "MissionComponent.h"
#include <ctime>
@@ -38,7 +40,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
} else if (identifier == u"player_dialog_start_course" && button == 1) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
@@ -52,7 +54,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
data->values[1] = *(float*)&startTime;
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
} else if (identifier == u"FootRaceCancel") {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
@@ -66,15 +68,12 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
}
}
void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) {
void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
if (scriptedActivityComponent == nullptr)
return;
if (scriptedActivityComponent == nullptr) return;
auto* data = scriptedActivityComponent->GetActivityPlayerData(sender->GetObjectID());
if (data == nullptr)
return;
if (data == nullptr) return;
if (args == "course_cancel") {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"cancel_timer", 0, 0,
@@ -89,13 +88,12 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
auto* missionComponent = sender->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->ForceProgressTaskType(1884, 1, 1, false);
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, -finish, self->GetObjectID(),
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, -finish, self->GetObjectID(),
"performact_time");
}
EntityManager::Instance()->SerializeEntity(self);
LeaderboardManager::SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(),
0, (uint32_t)finish);
Game::entityManager->SerializeEntity(self);
LeaderboardManager::SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(), static_cast<float>(finish));
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard",
scriptedActivityComponent->GetActivityID(), 0, sender->GetObjectID(),

View File

@@ -1,8 +1,8 @@
#include "NpcCowboyServer.h"
#include "MissionState.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1880) {
return;
}
@@ -13,14 +13,14 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
return;
}
if (missionState == MissionState::MISSION_STATE_COMPLETE_ACTIVE ||
missionState == MissionState::MISSION_STATE_ACTIVE ||
missionState == MissionState::MISSION_STATE_AVAILABLE ||
missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE) {
if (missionState == eMissionState::COMPLETE_ACTIVE ||
missionState == eMissionState::ACTIVE ||
missionState == eMissionState::AVAILABLE ||
missionState == eMissionState::COMPLETE_AVAILABLE) {
if (inventoryComponent->GetLotCount(14378) == 0) {
inventoryComponent->AddItem(14378, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventoryComponent->AddItem(14378, 1, eLootSourceType::NONE);
}
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(14378, 1);
}
}

View File

@@ -3,5 +3,5 @@
class NpcCowboyServer : public CppScripts::Script
{
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -1,7 +1,7 @@
#include "NpcEpsilonServer.h"
#include "GameMessages.h"
void NpcEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
//If we are completing the Nexus Force join mission, play the celebration for it:
if (missionID == 1851) {

View File

@@ -2,6 +2,6 @@
#include "CppScripts.h"
class NpcEpsilonServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
};

View File

@@ -3,25 +3,27 @@
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "Item.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != mailMission) return;
if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"switch", 0, 0, LWOOBJID_EMPTY, "", target->GetSystemAddress());
auto* inv = static_cast<InventoryComponent*>(target->GetComponent(COMPONENT_TYPE_INVENTORY));
auto* inv = static_cast<InventoryComponent*>(target->GetComponent(eReplicaComponentType::INVENTORY));
// If we are ready to complete our missions, we take the kit from you:
if (inv && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
if (inv && missionState == eMissionState::READY_TO_COMPLETE) {
auto* id = inv->FindItemByLot(14397); //the kit's lot
if (id != nullptr) {
inv->RemoveItem(id->GetLot(), id->GetCount());
}
}
} else if (missionState == MissionState::MISSION_STATE_AVAILABLE) {
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
} else if (missionState == eMissionState::AVAILABLE) {
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
missionComponent->CompleteMission(mailAchievement, true);
}
}

View File

@@ -2,7 +2,7 @@
#include "CppScripts.h"
class NpcNjAssistantServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
private:
int mailMission = 1728; //mission to get the item out of your mailbox

View File

@@ -1,16 +1,17 @@
#include "NpcPirateServer.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* inventory = target->GetComponent<InventoryComponent>();
if (inventory != nullptr && missionID == 1881) {
auto* luckyShovel = inventory->FindItemByLot(14591);
// Add or remove the lucky shovel based on whether the mission was completed or started
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
if ((missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)
&& luckyShovel == nullptr) {
inventory->AddItem(14591, 1, eLootSourceType::LOOT_SOURCE_NONE);
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
inventory->AddItem(14591, 1, eLootSourceType::NONE);
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventory->RemoveItem(14591, 1);
}
}

View File

@@ -2,5 +2,5 @@
#include "CppScripts.h"
class NpcPirateServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -3,8 +3,9 @@
#include "EntityManager.h"
#include "Entity.h"
#include "GameMessages.h"
#include "eMissionState.h"
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1849 && missionID != 1883)
return;
@@ -16,16 +17,16 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
auto* maelstromVacuum = inventory->FindItemByLot(maelstromVacuumLot);
// For the daily we add the maelstrom vacuum if the player doesn't have it yet
if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
if (missionID == 1883 && (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)
&& maelstromVacuum == nullptr) {
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::NONE);
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
inventory->RemoveItem(maelstromVacuumLot, 1);
}
// Next up hide or show the samples based on the mission state
auto visible = 1;
if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
visible = 0;
}
@@ -34,7 +35,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
for (const auto& group : groups) {
auto samples = EntityManager::Instance()->GetEntitiesInGroup(group);
auto samples = Game::entityManager->GetEntitiesInGroup(group);
for (auto* sample : samples) {
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
target->GetObjectID(), "", target->GetSystemAddress());

View File

@@ -2,5 +2,5 @@
#include "CppScripts.h"
class NpcWispServer : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
};

View File

@@ -1,7 +1,10 @@
#include "RemoveRentalGear.h"
#include "InventoryComponent.h"
#include "Item.h"
#include "eMissionState.h"
#include "Character.h"
#include "eReplicaComponentType.h"
#include "ePlayerFlag.h"
/*
--------------------------------------------------------------
@@ -16,11 +19,11 @@
--------------------------------------------------------------
*/
void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != defaultMission && missionID != 313) return;
if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
auto inv = static_cast<InventoryComponent*>(target->GetComponent(COMPONENT_TYPE_INVENTORY));
if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) {
auto inv = static_cast<InventoryComponent*>(target->GetComponent(eReplicaComponentType::INVENTORY));
if (!inv) return;
//remove the inventory items
@@ -34,6 +37,6 @@ void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int mis
//reset the equipment flag
auto character = target->GetCharacter();
if (character) character->SetPlayerFlag(equipFlag, false);
if (character) character->SetPlayerFlag(ePlayerFlag::EQUPPED_TRIAL_FACTION_GEAR, false);
}
}

View File

@@ -2,11 +2,10 @@
#include "CppScripts.h"
class RemoveRentalGear : public CppScripts::Script {
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
private:
int defaultMission = 768; //mission to remove gearSets on completion
std::vector<int> gearSets = { 14359,14321,14353,14315 }; //inventory items to remove
int equipFlag = 126; //Set upon wearing trial faction armor for the first time in a session
};

View File

@@ -3,13 +3,14 @@
#include "EntityManager.h"
#include "ZoneAgProperty.h"
#include "DestroyableComponent.h"
#include "EntityInfo.h"
void ZoneAgSpiderQueen::SetGameVariables(Entity* self) {
ZoneAgProperty::SetGameVariables(self);
// Disable property flags
self->SetVar<uint32_t>(defeatedProperyFlag, 0);
self->SetVar<uint32_t>(placedModelFlag, 0);
self->SetVar<int32_t>(defeatedProperyFlag, 0);
self->SetVar<int32_t>(placedModelFlag, 0);
self->SetVar<uint32_t>(guardFirstMissionFlag, 0);
self->SetVar<uint32_t>(guardMissionFlag, 0);
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 0);
@@ -62,7 +63,7 @@ void ZoneAgSpiderQueen::OnTimerDone(Entity* self, std::string timerName) {
return;
if (timerName == "killSpider") {
auto spawnTargets = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetGroup));
auto spawnTargets = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetGroup));
for (auto* spawnTarget : spawnTargets) {
EntityInfo info{};
@@ -74,8 +75,8 @@ void ZoneAgSpiderQueen::OnTimerDone(Entity* self, std::string timerName) {
new LDFData<LWOOBJID>(u"parent_tag", self->GetObjectID())
};
auto* chest = EntityManager::Instance()->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(chest);
auto* chest = Game::entityManager->CreateEntity(info);
Game::entityManager->ConstructEntity(chest);
}
}

View File

@@ -2,7 +2,7 @@
#include "ActivityManager.h"
#include "ZoneAgProperty.h"
class ZoneAgSpiderQueen : ZoneAgProperty, ActivityManager {
class ZoneAgSpiderQueen : public ZoneAgProperty, ActivityManager {
public:
void OnStartup(Entity* self) override;
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,

View File

@@ -1,6 +1,7 @@
#include "AmBlueX.h"
#include "SkillComponent.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "Character.h"
void AmBlueX::OnUse(Entity* self, Entity* user) {
@@ -26,16 +27,16 @@ void AmBlueX::OnSkillEventFired(Entity* self, Entity* caster, const std::string&
info.rot = self->GetRotation();
info.spawnerID = self->GetObjectID();
auto* fxObject = EntityManager::Instance()->CreateEntity(info, nullptr, self);
EntityManager::Instance()->ConstructEntity(fxObject);
auto* fxObject = Game::entityManager->CreateEntity(info, nullptr, self);
Game::entityManager->ConstructEntity(fxObject);
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* fxObject = Game::entityManager->GetEntity(fxObjectID);
auto* player = Game::entityManager->GetEntity(playerID);
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent == nullptr)

View File

@@ -6,7 +6,7 @@ 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")));
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console" + GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"bridge")));
if (consoles.empty()) {
return;
@@ -24,5 +24,5 @@ void AmBridge::OnTimerDone(Entity* self, std::string timerName) {
return;
}
self->Smash(self->GetObjectID(), VIOLENT);
self->Smash(self->GetObjectID(), eKillType::VIOLENT);
}

View File

@@ -1,6 +1,6 @@
#include "AmConsoleTeleportServer.h"
#include "ChooseYourDestinationNsToNt.h"
#include "AMFFormat.h"
#include "Amf3.h"
void AmConsoleTeleportServer::OnStartup(Entity* self) {
self->SetVar(u"teleportAnim", m_TeleportAnim);

View File

@@ -2,6 +2,7 @@
#include "EntityManager.h"
#include "GameMessages.h"
#include "SimplePhysicsComponent.h"
#include "eTerminateType.h"
void AmDrawBridge::OnStartup(Entity* self) {
self->SetNetworkVar(u"InUse", false);
@@ -25,7 +26,7 @@ void AmDrawBridge::OnUse(Entity* self, Entity* user) {
auto* player = user;
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
@@ -67,7 +68,7 @@ void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
simplePhysicsComponent->SetAngularVelocity(NiPoint3::ZERO);
EntityManager::Instance()->SerializeEntity(bridge);
Game::entityManager->SerializeEntity(bridge);
}
}
@@ -102,7 +103,7 @@ void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) {
simplePhysicsComponent->SetAngularVelocity(forwardVect);
EntityManager::Instance()->SerializeEntity(bridge);
Game::entityManager->SerializeEntity(bridge);
self->AddTimer("rotateBridgeDown", travelTime);
}
@@ -117,5 +118,5 @@ void AmDrawBridge::NotifyDie(Entity* self, Entity* other) {
Entity* AmDrawBridge::GetBridge(Entity* self) {
const auto bridgeID = self->GetVar<LWOOBJID>(u"BridgeID");
return EntityManager::Instance()->GetEntity(bridgeID);
return Game::entityManager->GetEntity(bridgeID);
}

View File

@@ -3,6 +3,7 @@
#include "RebuildComponent.h"
#include "InventoryComponent.h"
#include "dZoneManager.h"
#include "eMissionState.h"
void AmDropshipComputer::OnStartup(Entity* self) {
self->AddTimer("reset", 45.0f);
@@ -11,7 +12,7 @@ void AmDropshipComputer::OnStartup(Entity* self) {
void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED) {
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
return;
}
@@ -22,11 +23,11 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
return;
}
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == MissionState::MISSION_STATE_COMPLETE) {
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == eMissionState::COMPLETE) {
return;
}
inventoryComponent->AddItem(m_NexusTalonDataCard, 1, eLootSourceType::LOOT_SOURCE_NONE);
inventoryComponent->AddItem(m_NexusTalonDataCard, 1, eLootSourceType::NONE);
}
void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
@@ -41,7 +42,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
const auto nextPipeNum = pipeNum + 1;
const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup);
const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup);
if (!samePipeSpawners.empty()) {
samePipeSpawners[0]->SoftReset();
@@ -52,7 +53,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
if (killer != nullptr && killer->IsPlayer()) {
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
const auto nextPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe);
if (!nextPipeSpawners.empty()) {
nextPipeSpawners[0]->Activate();
@@ -60,7 +61,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
} else {
const auto nextPipe = pipeGroup + "1";
const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
const auto firstPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe);
if (!firstPipeSpawners.empty()) {
firstPipeSpawners[0]->Activate();
@@ -75,7 +76,7 @@ void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
return;
}
if (timerName == "reset" && rebuildComponent->GetState() == REBUILD_OPEN) {
self->Smash(self->GetObjectID(), SILENT);
if (timerName == "reset" && rebuildComponent->GetState() == eRebuildState::OPEN) {
self->Smash(self->GetObjectID(), eKillType::SILENT);
}
}

View File

@@ -2,6 +2,7 @@
#include "EntityManager.h"
#include "DestroyableComponent.h"
#include "GameMessages.h"
#include "EntityInfo.h"
#include "MovementAIComponent.h"
#include "BaseCombatAIComponent.h"
#include "SkillComponent.h"
@@ -48,7 +49,7 @@ void AmShieldGenerator::OnProximityUpdate(Entity* self, Entity* entering, std::s
void AmShieldGenerator::OnDie(Entity* self, Entity* killer) {
self->CancelAllTimers();
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
auto* child = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
if (child != nullptr) {
child->Kill();
@@ -68,7 +69,7 @@ void AmShieldGenerator::OnTimerDone(Entity* self, std::string timerName) {
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
for (const auto enemyID : enemiesInProximity) {
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
auto* enemy = Game::entityManager->GetEntity(enemyID);
if (enemy != nullptr) {
EnemyEnteredShield(self, enemy);
@@ -93,7 +94,7 @@ void AmShieldGenerator::StartShield(Entity* self) {
info.rot = myRot;
info.spawnerID = self->GetObjectID();
auto* child = EntityManager::Instance()->CreateEntity(info);
auto* child = Game::entityManager->CreateEntity(info);
self->SetVar(u"Child", child->GetObjectID());
@@ -110,7 +111,7 @@ void AmShieldGenerator::BuffPlayers(Entity* self) {
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
for (const auto playerID : entitiesInProximity) {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -135,7 +136,7 @@ void AmShieldGenerator::EnemyEnteredShield(Entity* self, Entity* intruder) {
// TODO: Figure out how todo knockback, I'll stun them for now
if (NiPoint3::DistanceSquared(self->GetPosition(), movementAIComponent->GetCurrentPosition()) < 20 * 20) {
if (NiPoint3::DistanceSquared(self->GetPosition(), intruder->GetPosition()) < 20 * 20) {
baseCombatAIComponent->Stun(2.0f);
movementAIComponent->SetDestination(baseCombatAIComponent->GetStartPosition());
}

View File

@@ -5,6 +5,7 @@
#include "MovementAIComponent.h"
#include "BaseCombatAIComponent.h"
#include "SkillComponent.h"
#include "EntityInfo.h"
#include "RebuildComponent.h"
#include "MissionComponent.h"
@@ -68,7 +69,7 @@ void AmShieldGeneratorQuickbuild::OnProximityUpdate(Entity* self, Entity* enteri
void AmShieldGeneratorQuickbuild::OnDie(Entity* self, Entity* killer) {
self->CancelAllTimers();
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
auto* child = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
if (child != nullptr) {
child->Kill();
@@ -88,7 +89,7 @@ void AmShieldGeneratorQuickbuild::OnTimerDone(Entity* self, std::string timerNam
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
for (const auto enemyID : enemiesInProximity) {
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
auto* enemy = Game::entityManager->GetEntity(enemyID);
if (enemy != nullptr) {
EnemyEnteredShield(self, enemy);
@@ -105,7 +106,7 @@ void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
for (const auto enemyID : enemiesInProximity) {
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
auto* enemy = Game::entityManager->GetEntity(enemyID);
if (enemy != nullptr) {
enemy->Smash();
@@ -115,7 +116,7 @@ void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
for (const auto playerID : entitiesInProximity) {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
continue;
@@ -145,7 +146,7 @@ void AmShieldGeneratorQuickbuild::StartShield(Entity* self) {
info.rot = myRot;
info.spawnerID = self->GetObjectID();
auto* child = EntityManager::Instance()->CreateEntity(info);
auto* child = Game::entityManager->CreateEntity(info);
self->SetVar(u"Child", child->GetObjectID());
@@ -162,7 +163,7 @@ void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
for (const auto playerID : entitiesInProximity) {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -175,7 +176,7 @@ void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED) {
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
return;
}
@@ -193,7 +194,7 @@ void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intru
// TODO: Figure out how todo knockback, I'll stun them for now
if (NiPoint3::DistanceSquared(self->GetPosition(), movementAIComponent->GetCurrentPosition()) < 20 * 20) {
if (NiPoint3::DistanceSquared(self->GetPosition(), intruder->GetPosition()) < 20 * 20) {
baseCombatAIComponent->Stun(2.0f);
movementAIComponent->SetDestination(baseCombatAIComponent->GetStartPosition());
}

View File

@@ -4,6 +4,9 @@
#include "DestroyableComponent.h"
#include "ProximityMonitorComponent.h"
#include "MissionComponent.h"
#include "EntityInfo.h"
#include "RenderComponent.h"
#include "eStateChangeType.h"
void AmSkullkinDrill::OnStartup(Entity* self) {
self->SetNetworkVar(u"bIsInUse", false);
@@ -41,7 +44,7 @@ Entity* AmSkullkinDrill::GetStandObj(Entity* self) {
groupName.push_back(myGroup[0][myGroup[0].size() - 1]);
const auto standObjs = EntityManager::Instance()->GetEntitiesInGroup(groupName);
const auto standObjs = Game::entityManager->GetEntitiesInGroup(groupName);
if (standObjs.empty()) {
return nullptr;
@@ -69,7 +72,7 @@ void AmSkullkinDrill::OnSkillEventFired(Entity* self, Entity* caster, const std:
}
void AmSkullkinDrill::TriggerDrill(Entity* self) {
GameMessages::SendPlayAnimation(self, u"slowdown");
RenderComponent::PlayAnimation(self, u"slowdown");
self->AddTimer("killDrill", 10.0f);
@@ -102,16 +105,16 @@ void AmSkullkinDrill::OnWaypointReached(Entity* self, uint32_t waypointIndex) {
info.scale = 3; // Needs the scale, otherwise attacks fail
info.spawnerID = self->GetObjectID();
auto* child = EntityManager::Instance()->CreateEntity(info);
auto* child = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(child);
Game::entityManager->ConstructEntity(child);
self->SetVar(u"ChildSmash", child->GetObjectID());
child->AddDieCallback([this, self]() {
const auto& userID = self->GetVar<LWOOBJID>(u"activaterID");
auto* player = EntityManager::Instance()->GetEntity(userID);
auto* player = Game::entityManager->GetEntity(userID);
if (player == nullptr) {
return;
@@ -146,21 +149,21 @@ void AmSkullkinDrill::OnUse(Entity* self, Entity* user) {
}
void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze) {
eStunState eChangeType = POP;
auto StateChangeType = eStateChangeType::POP;
if (bFreeze) {
if (player->GetIsDead()) {
return;
}
eChangeType = PUSH;
StateChangeType = eStateChangeType::PUSH;
} else {
if (player->GetIsDead()) {
//
}
}
GameMessages::SendSetStunned(player->GetObjectID(), eChangeType, player->GetSystemAddress(), self->GetObjectID(),
GameMessages::SendSetStunned(player->GetObjectID(), StateChangeType, player->GetSystemAddress(), self->GetObjectID(),
true, false, true, false, true, false, true
);
}
@@ -169,7 +172,7 @@ void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
auto* standObj = GetStandObj(self);
if (waypointIndex == 1) {
GameMessages::SendPlayAnimation(self, u"no-spin");
RenderComponent::PlayAnimation(self, u"no-spin");
GameMessages::SendStopFXEffect(self, true, "active");
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"indicator", "indicator");
@@ -177,7 +180,7 @@ void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player != nullptr) {
PlayAnim(self, player, "spinjitzu-staff-end");
@@ -189,14 +192,14 @@ void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
return;
} else {
GameMessages::SendPlayAnimation(self, u"idle");
RenderComponent::PlayAnimation(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"));
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"userID"));
if (player == nullptr) {
return;
@@ -214,7 +217,7 @@ void AmSkullkinDrill::PlayCinematic(Entity* self) {
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));
RenderComponent::PlayAnimation(player, animName);
self->AddTimer("AnimDone_" + animName, animTime);
}
@@ -232,7 +235,7 @@ void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
const auto activaterID = self->GetVar<LWOOBJID>(u"activaterID");
auto* activator = EntityManager::Instance()->GetEntity(activaterID);
auto* activator = Game::entityManager->GetEntity(activaterID);
// TODO: Missions
if (activator != nullptr) {
@@ -245,7 +248,7 @@ void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
}
}
self->Smash(attacker->GetObjectID(), SILENT);
self->Smash(attacker->GetObjectID(), eKillType::SILENT);
self->CancelAllTimers();
@@ -260,10 +263,10 @@ 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 = Game::entityManager->GetEntity(childID);
if (child != nullptr) {
child->Smash(self->GetObjectID(), SILENT);
child->Smash(self->GetObjectID(), eKillType::SILENT);
}
self->SetNetworkVar(u"bIsInUse", false);
@@ -298,7 +301,7 @@ void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -307,7 +310,7 @@ void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
if (animName == "spinjitzu-staff-windup") {
TriggerDrill(self);
GameMessages::SendPlayAnimation(player, u"spinjitzu-staff-loop");
RenderComponent::PlayAnimation(player, u"spinjitzu-staff-loop");
} else if (animName == "spinjitzu-staff-end") {
FreezePlayer(self, player, false);

View File

@@ -1,6 +1,8 @@
#include "AmSkullkinDrillStand.h"
#include "GameMessages.h"
#include "dpEntity.h"
#include "Entity.h"
#include "RenderComponent.h"
void AmSkullkinDrillStand::OnStartup(Entity* self) {
self->SetVar(u"bActive", true);
@@ -31,5 +33,5 @@ void AmSkullkinDrillStand::OnProximityUpdate(Entity* self, Entity* entering, std
GameMessages::SendPlayFXEffect(entering->GetObjectID(), 1378, u"create", "pushBack");
GameMessages::SendPlayAnimation(entering, u"knockback-recovery");
RenderComponent::PlayAnimation(entering, u"knockback-recovery");
}

View File

@@ -2,8 +2,10 @@
#include "EntityManager.h"
#include "DestroyableComponent.h"
#include "MovingPlatformComponent.h"
#include "EntityInfo.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
void AmSkullkinTower::OnStartup(Entity* self) {
self->SetProximityRadius(20, "Tower");
@@ -62,9 +64,9 @@ void AmSkullkinTower::SpawnLegs(Entity* self, const std::string& loc) {
info.rot = NiQuaternion::LookAt(info.pos, self->GetPosition());
auto* entity = EntityManager::Instance()->CreateEntity(info);
auto* entity = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(entity);
Game::entityManager->ConstructEntity(entity);
OnChildLoaded(self, entity);
}
@@ -79,7 +81,7 @@ void AmSkullkinTower::OnChildLoaded(Entity* self, Entity* child) {
const auto selfID = self->GetObjectID();
child->AddDieCallback([this, selfID, child]() {
auto* self = EntityManager::Instance()->GetEntity(selfID);
auto* self = Game::entityManager->GetEntity(selfID);
auto* destroyableComponent = child->GetComponent<DestroyableComponent>();
if (destroyableComponent == nullptr || self == nullptr) {
@@ -116,13 +118,13 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
self->SetVar(u"legTable", legTable);
if (legTable.size() == 2) {
GameMessages::SendPlayAnimation(self, u"wobble-1");
RenderComponent::PlayAnimation(self, u"wobble-1");
} else if (legTable.size() == 1) {
GameMessages::SendPlayAnimation(self, u"wobble-2");
RenderComponent::PlayAnimation(self, u"wobble-2");
} else if (legTable.empty()) {
const auto animTime = 2.5f;
GameMessages::SendPlayAnimation(self, u"fall");
RenderComponent::PlayAnimation(self, u"fall");
self->AddTimer("spawnGuys", animTime - 0.2f);
@@ -155,7 +157,7 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
const auto& players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
for (const auto& playerID : players) {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
continue;
@@ -231,9 +233,9 @@ void AmSkullkinTower::OnTimerDone(Entity* self, std::string timerName) {
for (size_t i = 0; i < 2; i++) {
info.pos.x += i * 2; // Just to set the apart a bit
auto* entity = EntityManager::Instance()->CreateEntity(info);
auto* entity = Game::entityManager->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(entity);
Game::entityManager->ConstructEntity(entity);
}
self->AddTimer("killTower", 0.7f);

View File

@@ -1,15 +1,23 @@
#include "AmTeapotServer.h"
#include "InventoryComponent.h"
#include "GameMessages.h"
#include "Item.h"
#include "eTerminateType.h"
void AmTeapotServer::OnUse(Entity* self, Entity* user) {
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
if (!inventoryComponent) return;
if (inventoryComponent->GetLotCount(BLUE_FLOWER_LEAVES) >= 10) {
inventoryComponent->RemoveItem(BLUE_FLOWER_LEAVES, 10);
auto* blueFlowerItem = inventoryComponent->FindItemByLot(BLUE_FLOWER_LEAVES, eInventoryType::ITEMS);
if (!blueFlowerItem) {
blueFlowerItem = inventoryComponent->FindItemByLot(BLUE_FLOWER_LEAVES, eInventoryType::VAULT_ITEMS);
if (!blueFlowerItem) return;
}
// The client allows you to use the teapot only if you have a stack of 10 leaves in some inventory somewhere.
if (blueFlowerItem->GetCount() >= 10) {
blueFlowerItem->SetCount(blueFlowerItem->GetCount() - 10);
inventoryComponent->AddItem(WU_S_IMAGINATION_TEA, 1);
}
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}

View File

@@ -1,6 +1,7 @@
#include "EnemyRoninSpawner.h"
#include "SkillComponent.h"
#include "RenderComponent.h"
#include "EntityInfo.h"
#include "EntityManager.h"
void EnemyRoninSpawner::OnStartup(Entity* self) {
@@ -21,13 +22,13 @@ void EnemyRoninSpawner::OnTimerDone(Entity* self, std::string timerName) {
info.rot = self->GetRotation();
info.spawnerID = self->GetObjectID();
auto* spawnedEntity = EntityManager::Instance()->CreateEntity(info);
auto* spawnedEntity = Game::entityManager->CreateEntity(info);
if (spawnedEntity == nullptr) {
return;
}
EntityManager::Instance()->ConstructEntity(spawnedEntity);
Game::entityManager->ConstructEntity(spawnedEntity);
spawnedEntity->AddCallbackTimer(60, [spawnedEntity]() {
spawnedEntity->Smash(spawnedEntity->GetObjectID());

View File

@@ -1,11 +1,12 @@
#include "FvCandle.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "eReplicaComponentType.h"
std::vector<int32_t> FvCandle::m_Missions = { 850, 1431, 1529, 1566, 1603 };
void FvCandle::OnStartup(Entity* self) {
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (render == nullptr)
return;
@@ -22,7 +23,7 @@ void FvCandle::BlowOutCandle(Entity* self, Entity* blower) {
if (self->GetBoolean(u"AmHit"))
return;
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (render == nullptr)
return;
@@ -46,7 +47,7 @@ void FvCandle::BlowOutCandle(Entity* self, Entity* blower) {
void FvCandle::OnTimerDone(Entity* self, std::string timerName) {
self->SetBoolean(u"AmHit", false);
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (render == nullptr)
return;

View File

@@ -1,9 +1,9 @@
#include "FvFong.h"
#include "Darkitect.h"
#include "MissionState.h"
#include "eMissionState.h"
void FvFong::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
if (missionID == 734 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
void FvFong::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID == 734 && missionState == eMissionState::READY_TO_COMPLETE) {
Darkitect Baron;
Baron.Reveal(self, target);
}

View File

@@ -4,5 +4,5 @@
class FvFong : public CppScripts::Script
{
public:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
};

View File

@@ -33,7 +33,7 @@ FvHorsemenTrigger::OnFireEventServerSide(Entity* self, Entity* sender, std::stri
if (args == "HorsemenDeath") {
for (const auto& playerId : self->GetVar<std::vector<LWOOBJID>>(u"players")) {
auto* player = EntityManager::Instance()->GetEntity(playerId);
auto* player = Game::entityManager->GetEntity(playerId);
if (player == nullptr) {
continue;

View File

@@ -4,7 +4,9 @@
#include "EntityManager.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
#include "eTerminateType.h"
int32_t ImgBrickConsoleQB::ResetBricks = 30;
int32_t ImgBrickConsoleQB::ResetConsole = 60;
@@ -19,16 +21,16 @@ void ImgBrickConsoleQB::OnStartup(Entity* self) {
void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
if (!self->GetNetworkVar<bool>(u"used")) {
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console");
auto bothBuilt = false;
for (auto* console : consoles) {
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
if (consoleRebuildComponent->GetState() != REBUILD_COMPLETED) {
if (consoleRebuildComponent->GetState() != eRebuildState::COMPLETED) {
continue;
}
@@ -57,7 +59,7 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
onFX = 2779;
}
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
const auto& facility = Game::entityManager->GetEntitiesInGroup("FacilityPipes");
if (!facility.empty()) {
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeEnergy");
@@ -71,13 +73,13 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
if (missionComponent != nullptr && inventoryComponent != nullptr) {
if (missionComponent->GetMissionState(1302) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(1302) == eMissionState::ACTIVE) {
inventoryComponent->RemoveItem(13074, 1);
missionComponent->ForceProgressTaskType(1302, 1, 1);
}
if (missionComponent->GetMissionState(1926) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(1926) == eMissionState::ACTIVE) {
inventoryComponent->RemoveItem(14472, 1);
missionComponent->ForceProgressTaskType(1926, 1, 1);
@@ -86,36 +88,36 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
self->SetNetworkVar(u"used", true);
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
}
void ImgBrickConsoleQB::SpawnBrick(Entity* self) {
const auto netDevil = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug");
const auto netDevil = Game::zoneManager->GetSpawnersByName("MaelstromBug");
if (!netDevil.empty()) {
netDevil[0]->Reset();
netDevil[0]->Deactivate();
}
const auto brick = dZoneManager::Instance()->GetSpawnersByName("Imagination");
const auto brick = Game::zoneManager->GetSpawnersByName("Imagination");
if (!brick.empty()) {
brick[0]->Activate();
}
}
void ImgBrickConsoleQB::SmashCanister(Entity* self) {
const auto brick = EntityManager::Instance()->GetEntitiesInGroup("Imagination");
const auto brick = Game::entityManager->GetEntitiesInGroup("Imagination");
if (!brick.empty()) {
GameMessages::SendPlayFXEffect(brick[0]->GetObjectID(), 122, u"create", "bluebrick");
GameMessages::SendPlayFXEffect(brick[0]->GetObjectID(), 1034, u"cast", "imaginationexplosion");
}
const auto canisters = EntityManager::Instance()->GetEntitiesInGroup("Canister");
const auto canisters = Game::entityManager->GetEntitiesInGroup("Canister");
for (auto* canister : canisters) {
canister->Smash(canister->GetObjectID(), VIOLENT);
canister->Smash(canister->GetObjectID(), eKillType::VIOLENT);
}
const auto canister = dZoneManager::Instance()->GetSpawnersByName("BrickCanister");
const auto canister = Game::zoneManager->GetSpawnersByName("BrickCanister");
if (!canister.empty()) {
canister[0]->Reset();
canister[0]->Deactivate();
@@ -133,19 +135,19 @@ void ImgBrickConsoleQB::OnRebuildComplete(Entity* self, Entity* target) {
energyFX = 2778;
}
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
const auto& facility = Game::entityManager->GetEntitiesInGroup("FacilityPipes");
if (!facility.empty()) {
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeOff");
GameMessages::SendPlayFXEffect(facility[0]->GetObjectID(), energyFX, u"create", location + "PipeEnergy");
}
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console");
for (auto* console : consoles) {
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
if (consoleRebuildComponent->GetState() != REBUILD_COMPLETED) {
if (consoleRebuildComponent->GetState() != eRebuildState::COMPLETED) {
continue;
}
@@ -166,7 +168,7 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
auto offFX = 0;
const auto location = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"console"));
@@ -177,7 +179,7 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) {
offFX = 2777;
}
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
const auto& facility = Game::entityManager->GetEntitiesInGroup("FacilityPipes");
if (!facility.empty()) {
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeEnergy");
@@ -193,29 +195,29 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) {
const auto firstPipe = pipeGroup + "1";
const auto samePipeSpawner = dZoneManager::Instance()->GetSpawnersByName(myGroup);
const auto samePipeSpawner = Game::zoneManager->GetSpawnersByName(myGroup);
if (!samePipeSpawner.empty()) {
samePipeSpawner[0]->Reset();
samePipeSpawner[0]->Deactivate();
}
const auto firstPipeSpawner = dZoneManager::Instance()->GetSpawnersByName(firstPipe);
const auto firstPipeSpawner = Game::zoneManager->GetSpawnersByName(firstPipe);
if (!firstPipeSpawner.empty()) {
firstPipeSpawner[0]->Activate();
}
const auto netdevil = dZoneManager::Instance()->GetSpawnersByName("Imagination");
const auto netdevil = Game::zoneManager->GetSpawnersByName("Imagination");
if (!netdevil.empty()) {
netdevil[0]->Reset();
netdevil[0]->Deactivate();
}
const auto brick = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug");
const auto brick = Game::zoneManager->GetSpawnersByName("MaelstromBug");
if (!brick.empty()) {
brick[0]->Activate();
}
const auto canister = dZoneManager::Instance()->GetSpawnersByName("BrickCanister");
const auto canister = Game::zoneManager->GetSpawnersByName("BrickCanister");
if (!canister.empty()) {
canister[0]->Activate();
}
@@ -227,14 +229,14 @@ void ImgBrickConsoleQB::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "reset") {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent->GetState() == REBUILD_OPEN) {
self->Smash(self->GetObjectID(), SILENT);
if (rebuildComponent->GetState() == eRebuildState::OPEN) {
self->Smash(self->GetObjectID(), eKillType::SILENT);
}
} else if (timerName == "Die") {
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console");
for (auto* console : consoles) {
console->Smash(console->GetObjectID(), VIOLENT);
console->Smash(console->GetObjectID(), eKillType::VIOLENT);
}
}
}

View File

@@ -29,7 +29,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std:
Entity* player;
if (possessableComponent != nullptr) {
player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
player = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
if (player == nullptr) {
return;
@@ -43,7 +43,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std:
return;
}
vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
if (vehicle == nullptr) {
return;
@@ -55,9 +55,9 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std:
}
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, VIOLENT, u"", 0, 0, 0, true, false, 0);
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
auto* zoneController = Game::zoneManager->GetZoneControlObject();
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();

View File

@@ -2,6 +2,9 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "eTerminateType.h"
#include "eStateChangeType.h"
void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
if (self->GetVar<bool>(u"bIsInUse")) {
@@ -13,7 +16,7 @@ void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
self->SetVar<bool>(u"bIsInUse", true);
self->SetNetworkVar<bool>(u"bIsInUse", true);
GameMessages::SendSetStunned(user->GetObjectID(), PUSH, user->GetSystemAddress(),
GameMessages::SendSetStunned(user->GetObjectID(), eStateChangeType::PUSH, user->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
);
@@ -27,7 +30,7 @@ void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
GameMessages::SendTeleport(user->GetObjectID(), position, rotation, user->GetSystemAddress());
GameMessages::SendPlayAnimation(user, u"cannon-strike-no-equip");
RenderComponent::PlayAnimation(user, u"cannon-strike-no-equip");
GameMessages::SendPlayFXEffect(user->GetObjectID(), 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
@@ -37,7 +40,7 @@ void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
const auto playerId = self->GetVar<LWOOBJID>(u"userID");
auto* player = EntityManager::Instance()->GetEntity(playerId);
auto* player = Game::entityManager->GetEntity(playerId);
if (player == nullptr) {
self->SetVar<bool>(u"bIsInUse", false);
@@ -53,17 +56,17 @@ void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
self->AddTimer("cinematicTimer", cinematicTime);
const auto sharkObjects = EntityManager::Instance()->GetEntitiesInGroup("SharkCannon");
const auto sharkObjects = Game::entityManager->GetEntitiesInGroup("SharkCannon");
for (auto* shark : sharkObjects) {
if (shark->GetLOT() != m_SharkItemID) continue;
GameMessages::SendPlayAnimation(shark, u"cannon");
RenderComponent::PlayAnimation(shark, u"cannon");
}
GameMessages::SendPlay2DAmbientSound(player, "{7457d85c-4537-4317-ac9d-2f549219ea87}");
} else if (timerName == "cinematicTimer") {
GameMessages::SendSetStunned(playerId, POP, player->GetSystemAddress(),
GameMessages::SendSetStunned(playerId, eStateChangeType::POP, player->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
);
@@ -78,6 +81,6 @@ void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
missionComponent->ForceProgress(601, 910, 1);
}
GameMessages::SendTerminateInteraction(playerId, FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(playerId, eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
}

View File

@@ -3,6 +3,10 @@
#include "EntityManager.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "eMissionTaskType.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include "eTerminateType.h"
void GfTikiTorch::OnStartup(Entity* self) {
LightTorch(self);
@@ -14,7 +18,7 @@ void GfTikiTorch::OnUse(Entity* self, Entity* killer) {
return;
}
GameMessages::SendPlayAnimation(self, u"interact");
RenderComponent::PlayAnimation(self, u"interact");
self->SetI64(u"userID", killer->GetObjectID());
for (int i = 0; i < m_numspawn; i++) {
@@ -28,10 +32,10 @@ void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "Relight") {
LightTorch(self);
} else if (timerName == "InteractionCooldown") {
Entity* player = EntityManager::Instance()->GetEntity(self->GetI64(u"userID"));
Entity* player = Game::entityManager->GetEntity(self->GetI64(u"userID"));
if (player != nullptr && player->GetCharacter()) {
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(player->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}
self->SetBoolean(u"isInUse", false);
@@ -41,7 +45,7 @@ void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) {
}
void GfTikiTorch::LightTorch(Entity* self) {
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
if (renderComponent == nullptr)
return;
@@ -53,7 +57,7 @@ void GfTikiTorch::LightTorch(Entity* self) {
void GfTikiTorch::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
if (self->GetBoolean(u"isBurning") && message == "waterspray") {
GameMessages::SendPlayAnimation(self, u"water");
RenderComponent::PlayAnimation(self, u"water");
auto* renderComponent = self->GetComponent<RenderComponent>();
if (renderComponent != nullptr) {
@@ -65,7 +69,7 @@ void GfTikiTorch::OnSkillEventFired(Entity* self, Entity* caster, const std::str
auto* casterMissionComponent = caster->GetComponent<MissionComponent>();
if (casterMissionComponent != nullptr) {
for (const auto missionID : m_missions) {
casterMissionComponent->ForceProgressTaskType(missionID, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
casterMissionComponent->ForceProgressTaskType(missionID, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
}
}

View File

@@ -2,11 +2,15 @@
#include "EntityManager.h"
#include "GameMessages.h"
#include "Preconditions.h"
#include "eEndBehavior.h"
#include "DestroyableComponent.h"
#include "eStateChangeType.h"
#ifdef _WIN32
#define _USE_MATH_DEFINES
#include <math.h>
#endif
#include "RenderComponent.h"
void MastTeleport::OnStartup(Entity* self) {
self->SetNetworkVar<std::string>(u"hookPreconditions", "154;44", UNASSIGNED_SYSTEM_ADDRESS);
@@ -16,9 +20,11 @@ void MastTeleport::OnRebuildComplete(Entity* self, Entity* target) {
if (Preconditions::Check(target, 154) && Preconditions::Check(target, 44)) {
self->SetVar<LWOOBJID>(u"userID", target->GetObjectID());
GameMessages::SendSetStunned(target->GetObjectID(), PUSH, target->GetSystemAddress(),
GameMessages::SendSetStunned(target->GetObjectID(), eStateChangeType::PUSH, target->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true
);
auto* destroyableComponent = target->GetComponent<DestroyableComponent>();
if (destroyableComponent) destroyableComponent->SetStatusImmunity(eStateChangeType::PUSH, true, true, true, true, true, false, false, true, true);
self->AddTimer("Start", 3);
}
@@ -27,7 +33,7 @@ void MastTeleport::OnRebuildComplete(Entity* self, Entity* target) {
void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
const auto playerId = self->GetVar<LWOOBJID>(u"userID");
auto* player = EntityManager::Instance()->GetEntity(playerId);
auto* player = Game::entityManager->GetEntity(playerId);
if (player == nullptr) return;
@@ -37,29 +43,25 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
GameMessages::SendTeleport(playerId, position, rotation, player->GetSystemAddress(), true);
// Hacky fix for odd rotations
if (self->GetVar<std::u16string>(u"MastName") != u"Jail") {
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 140.0f, player->GetSystemAddress());
} else {
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 100.0f, player->GetSystemAddress());
}
GameMessages::SendTeleport(playerId, position, rotation, player->GetSystemAddress(), true);
const auto cinematic = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Cinematic"));
const auto leanIn = self->GetVar<float>(u"LeanIn");
if (!cinematic.empty()) {
GameMessages::SendPlayCinematic(playerId, GeneralUtils::ASCIIToUTF16(cinematic), player->GetSystemAddress(),
true, true, false, false, 0, false, leanIn
true, true, false, false, eEndBehavior::RETURN, false, leanIn
);
}
GameMessages::SendPlayFXEffect(playerId, 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
GameMessages::SendPlayAnimation(player, u"crow-swing-no-equip");
float animationTime = 6.25f;
animationTime = RenderComponent::PlayAnimation(player, "crow-swing-no-equip", 4.0f);
GameMessages::SendPlayAnimation(self, u"swing");
RenderComponent::PlayAnimation(self, u"swing");
self->AddTimer("PlayerAnimDone", 6.25f);
self->AddTimer("PlayerAnimDone", animationTime);
} else if (timerName == "PlayerAnimDone") {
GameMessages::SendStopFXEffect(player, true, "hook");
@@ -81,8 +83,11 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
GameMessages::SendTeleport(playerId, position, NiQuaternion::IDENTITY, player->GetSystemAddress());
GameMessages::SendSetStunned(playerId, POP, player->GetSystemAddress(),
GameMessages::SendSetStunned(playerId, eStateChangeType::POP, player->GetSystemAddress(),
LWOOBJID_EMPTY, true, true, true, true, true, true, true
);
auto* destroyableComponent = player->GetComponent<DestroyableComponent>();
if (destroyableComponent) destroyableComponent->SetStatusImmunity(eStateChangeType::POP, true, true, true, true, true, false, false, true, true);
Game::entityManager->SerializeEntity(player);
}
}

View File

@@ -1,22 +1,24 @@
#include "BankInteractServer.h"
#include "GameMessages.h"
#include "Entity.h"
#include "Amf3.h"
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);
args.Insert("state", "bank");
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;
args.InsertValue("visible", new AMFFalseValue());
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", &args);
args.Insert("visible", false);
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", args);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"CloseBank", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
}

View File

@@ -22,7 +22,7 @@ void BaseInteractDropLootServer::BaseUse(Entity* self, Entity* user) {
self->SetNetworkVar(u"bInUse", true);
LootGenerator::Instance().DropLoot(user, self, lootMatrix, 0, 0);
Loot::DropLoot(user, self, lootMatrix, 0, 0);
self->AddCallbackTimer(cooldownTime, [this, self]() {
self->SetNetworkVar(u"bInUse", false);

View File

@@ -3,6 +3,10 @@
#include "GameMessages.h"
#include "MissionComponent.h"
#include "SkillComponent.h"
#include "eMissionTaskType.h"
#include "CDClientManager.h"
#include "CDObjectSkillsTable.h"
#include "RenderComponent.h"
//TODO: this has to be updated so that you only get killed if you're in a certain radius.
//And so that all entities in a certain radius are killed, not just the attacker.
@@ -37,9 +41,11 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
self->SetOwnerOverride(attacker->GetObjectID());
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16);
self->Smash(attacker->GetObjectID());
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent != nullptr) {
// Technically supposed to get first skill in the skill component but only 1 object in the live game used this.
skillComponent->CalculateBehavior(147, 4721, LWOOBJID_EMPTY, true);
}
@@ -51,40 +57,21 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
if (missionComponent != nullptr) {
if (missionID != 0) {
missionComponent->ForceProgressValue(missionID,
static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT),
static_cast<uint32_t>(eMissionTaskType::SCRIPT),
self->GetLOT(), false);
}
if (!achievementIDs.empty()) {
for (const auto& achievementID : GeneralUtils::SplitString(achievementIDs, u'_')) {
missionComponent->ForceProgressValue(std::stoi(GeneralUtils::UTF16ToWTF8(achievementID)),
static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT),
static_cast<uint32_t>(eMissionTaskType::SCRIPT),
self->GetLOT());
}
}
}
self->ScheduleKillAfterUpdate();
}
void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
/*
if msg.objId:BelongsToFaction{factionID = 1}.bIsInFaction then
if (msg.status == "ENTER") then
self:PlayAnimation{ animationID = "bounce" }
self:PlayFXEffect{ name = "bouncin", effectType = "anim" }
self:SetVar("playersNearChest", (self:GetVar("playersNearChest") + 1 ))
elseif (msg.status == "LEAVE") then
self:SetVar("playersNearChest", (self:GetVar("playersNearChest") - 1 ))
if self:GetVar("playersNearChest") < 1 then
self:PlayAnimation{ animationID = "idle" }
self:StopFXEffect{ name = "bouncin" }
self:SetVar("playersNearChest", 0)
end
end
end
*/
auto* destuctableComponent = entering->GetComponent<DestroyableComponent>();
if (destuctableComponent == nullptr) return;
@@ -94,14 +81,14 @@ void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::stri
if (!std::count(factions.begin(), factions.end(), 1)) return;
if (status == "ENTER") {
GameMessages::SendPlayAnimation(self, u"bounce");
RenderComponent::PlayAnimation(self, u"bounce");
GameMessages::SendPlayFXEffect(self, -1, u"anim", "bouncin", LWOOBJID_EMPTY, 1, 1, true);
self->SetVar(u"playersNearChest", self->GetVar<int32_t>(u"playersNearChest") + 1);
} else if (status == "LEAVE") {
self->SetVar(u"playersNearChest", self->GetVar<int32_t>(u"playersNearChest") - 1);
if (self->GetVar<int32_t>(u"playersNearChest") < 1) {
GameMessages::SendPlayAnimation(self, u"idle");
RenderComponent::PlayAnimation(self, u"idle");
GameMessages::SendStopFXEffect(self, true, "bouncin");
self->SetVar<int32_t>(u"playersNearChest", 0);
}

View File

@@ -1,6 +1,7 @@
#include "ForceVolumeServer.h"
#include "PhantomPhysicsComponent.h"
#include "EntityManager.h"
#include "ePhysicsEffectType.h"
void ForceVolumeServer::OnStartup(Entity* self) {
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
@@ -12,10 +13,10 @@ void ForceVolumeServer::OnStartup(Entity* self) {
const auto forceY = self->GetVar<float>(u"ForceY");
const auto forceZ = self->GetVar<float>(u"ForceZ");
phantomPhysicsComponent->SetEffectType(0); // PUSH
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::PUSH);
phantomPhysicsComponent->SetDirectionalMultiplier(forceAmount);
phantomPhysicsComponent->SetDirection({ forceX, forceY, forceZ });
phantomPhysicsComponent->SetPhysicsEffectActive(true);
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
}

View File

@@ -1,5 +1,8 @@
#include "GrowingFlower.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "Loot.h"
void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::string& message) {
if (!self->GetVar<bool>(u"blooming") && (message == "waterspray" || message == "shovelgrow")) {
@@ -10,18 +13,18 @@ void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::s
const auto mission1 = self->GetVar<int32_t>(u"missionID");
const auto mission2 = self->GetVar<int32_t>(u"missionID2");
LootGenerator::Instance().DropActivityLoot(target, self, self->GetLOT(), 0);
Loot::DropActivityLoot(target, self, self->GetLOT(), 0);
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
for (const auto mission : achievementIDs)
missionComponent->ForceProgressTaskType(mission, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
missionComponent->ForceProgressTaskType(mission, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
if (mission1 && missionComponent->GetMissionState(mission1) == MissionState::MISSION_STATE_ACTIVE)
missionComponent->ForceProgressTaskType(mission1, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
if (mission1 && missionComponent->GetMissionState(mission1) == eMissionState::ACTIVE)
missionComponent->ForceProgressTaskType(mission1, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
if (mission2 && missionComponent->GetMissionState(mission2) == MissionState::MISSION_STATE_ACTIVE)
missionComponent->ForceProgressTaskType(mission2, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
if (mission2 && missionComponent->GetMissionState(mission2) == eMissionState::ACTIVE)
missionComponent->ForceProgressTaskType(mission2, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
}
}
}

View File

@@ -1,6 +1,8 @@
#include "ImaginationBackpackHealServer.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
void ImaginationBackpackHealServer::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
if (message == "CastImaginationBackpack") {
@@ -11,8 +13,8 @@ void ImaginationBackpackHealServer::OnSkillEventFired(Entity* self, Entity* cast
return;
auto* missionComponent = caster->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(healMission) == MissionState::MISSION_STATE_ACTIVE) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
if (missionComponent != nullptr && missionComponent->GetMissionState(healMission) == eMissionState::ACTIVE) {
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ClearMaelstrom", 0, 0,
caster->GetObjectID(), "", caster->GetSystemAddress());
}

View File

@@ -1,19 +1,20 @@
#include "MailBoxServer.h"
#include "AMFFormat.h"
#include "Amf3.h"
#include "GameMessages.h"
#include "Entity.h"
void MailBoxServer::OnUse(Entity* self, Entity* user) {
AMFStringValue* value = new AMFStringValue();
value->SetStringValue("Mail");
AMFArrayValue args;
args.InsertValue("state", value);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
args.Insert("state", "Mail");
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", args);
}
void MailBoxServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
if (args == "toggleMail") {
AMFArrayValue args;
args.InsertValue("visible", new AMFFalseValue());
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleMail", &args);
args.Insert("visible", false);
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleMail", args);
}
}

View File

@@ -1,6 +1,8 @@
#include "NjIceRailActivator.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
void NjIceRailActivator::OnPlayerRailArrived(Entity* self, Entity* sender, const std::u16string& pathName,
int32_t waypoint) {
@@ -8,13 +10,13 @@ void NjIceRailActivator::OnPlayerRailArrived(Entity* self, Entity* sender, const
if (breakPoint == waypoint) {
const auto& blockGroup = self->GetVar<std::u16string>(BlockGroupVariable);
for (auto* block : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(blockGroup))) {
GameMessages::SendPlayAnimation(block, u"explode");
for (auto* block : Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(blockGroup))) {
RenderComponent::PlayAnimation(block, u"explode");
const auto blockID = block->GetObjectID();
self->AddCallbackTimer(1.0f, [self, blockID]() {
auto* block = EntityManager::Instance()->GetEntity(blockID);
auto* block = Game::entityManager->GetEntity(blockID);
if (block != nullptr) {
block->Kill(self);

View File

@@ -7,7 +7,7 @@ void NjRailActivatorsServer::OnUse(Entity* self, Entity* user) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
// Only allow use if this is not a quick build or the quick build is built
if (rebuildComponent == nullptr || rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent == nullptr || rebuildComponent->GetState() == eRebuildState::COMPLETED) {
auto* character = user->GetCharacter();
if (character != nullptr) {
character->SetPlayerFlag(flag, true);

View File

@@ -19,7 +19,7 @@ void NjRailPostServer::OnNotifyObject(Entity* self, Entity* sender, const std::s
}
void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == REBUILD_COMPLETED) {
if (state == eRebuildState::COMPLETED) {
auto* relatedRail = GetRelatedRail(self);
if (relatedRail == nullptr)
return;
@@ -30,7 +30,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
return;
self->SetNetworkVar(NetworkNotActiveVariable, false);
} else if (state == REBUILD_RESETTING) {
} else if (state == eRebuildState::RESETTING) {
auto* relatedRail = GetRelatedRail(self);
if (relatedRail == nullptr)
return;
@@ -42,7 +42,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
Entity* NjRailPostServer::GetRelatedRail(Entity* self) {
const auto& railGroup = self->GetVar<std::u16string>(RailGroupVariable);
if (!railGroup.empty()) {
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(railGroup))) {
for (auto* entity : Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(railGroup))) {
return entity;
}
}

View File

@@ -5,5 +5,5 @@ void NjhubLavaPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* targe
if (!target->IsPlayer())
return;
target->Smash(self->GetObjectID(), VIOLENT, u"drown");
target->Smash(self->GetObjectID(), eKillType::VIOLENT, u"drown");
}

View File

@@ -4,6 +4,8 @@
#include "EntityManager.h"
#include "Character.h"
#include "PetComponent.h"
#include "User.h"
#include "eMissionState.h"
std::vector<LWOOBJID> PetDigServer::treasures{};
@@ -46,8 +48,8 @@ void PetDigServer::OnStartup(Entity* self) {
// Reset any bouncers that might've been created by the previous dig
if (digInfo.bouncer) {
auto bounceNumber = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"BouncerNumber"));
auto bouncerSpawners = dZoneManager::Instance()->GetSpawnersByName("PetBouncer" + bounceNumber);
auto switchSpawners = dZoneManager::Instance()->GetSpawnersByName("PetBouncerSwitch" + bounceNumber);
auto bouncerSpawners = Game::zoneManager->GetSpawnersByName("PetBouncer" + bounceNumber);
auto switchSpawners = Game::zoneManager->GetSpawnersByName("PetBouncerSwitch" + bounceNumber);
for (auto* bouncerSpawner : bouncerSpawners) {
for (auto* bouncer : bouncerSpawner->m_Info.nodes)
@@ -93,9 +95,9 @@ void PetDigServer::OnDie(Entity* self, Entity* killer) {
// TODO: Reset other pets
// Handles smashing leftovers (edge case for the AG X)
auto* xObject = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"X"));
auto* xObject = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"X"));
if (xObject != nullptr) {
xObject->Smash(xObject->GetObjectID(), VIOLENT);
xObject->Smash(xObject->GetObjectID(), eKillType::VIOLENT);
}
}
@@ -104,13 +106,13 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
if (playerID == LWOOBJID_EMPTY || playerID != owner->GetObjectID())
return;
auto* playerEntity = EntityManager::Instance()->GetEntity(playerID);
auto* playerEntity = Game::entityManager->GetEntity(playerID);
if (!playerEntity || !playerEntity->GetParentUser() || !playerEntity->GetParentUser()->GetLastUsedChar())
return;
auto* player = playerEntity->GetCharacter();
const auto groupID = self->GetVar<std::u16string>(u"groupID");
auto playerFlag = 0;
int32_t playerFlag = 0;
// The flag that the player dug up
if (groupID == u"Flag1") {
@@ -132,16 +134,16 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
player->SetPlayerFlag(playerFlag, true);
}
auto* xObject = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"X"));
auto* xObject = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"X"));
if (xObject != nullptr) {
xObject->Smash(xObject->GetObjectID(), VIOLENT);
xObject->Smash(xObject->GetObjectID(), eKillType::VIOLENT);
}
}
void PetDigServer::HandleBouncerDig(const Entity* self, const Entity* owner) {
auto bounceNumber = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"BouncerNumber"));
auto bouncerSpawners = dZoneManager::Instance()->GetSpawnersByName("PetBouncer" + bounceNumber);
auto switchSpawners = dZoneManager::Instance()->GetSpawnersByName("PetBouncerSwitch" + bounceNumber);
auto bouncerSpawners = Game::zoneManager->GetSpawnersByName("PetBouncer" + bounceNumber);
auto switchSpawners = Game::zoneManager->GetSpawnersByName("PetBouncerSwitch" + bounceNumber);
for (auto* bouncerSpawner : bouncerSpawners) {
bouncerSpawner->Activate();
@@ -162,13 +164,13 @@ void PetDigServer::ProgressPetDigMissions(const Entity* owner, const Entity* che
if (missionComponent != nullptr) {
// Can You Dig It progress
const auto digMissionState = missionComponent->GetMissionState(843);
if (digMissionState == MissionState::MISSION_STATE_ACTIVE) {
if (digMissionState == eMissionState::ACTIVE) {
missionComponent->ForceProgress(843, 1216, 1);
}
// Pet Excavator progress
const auto excavatorMissionState = missionComponent->GetMissionState(505);
if (excavatorMissionState == MissionState::MISSION_STATE_ACTIVE) {
if (excavatorMissionState == eMissionState::ACTIVE) {
if (chest->HasVar(u"PetDig")) {
int32_t playerFlag = 1260 + chest->GetVarAs<int32_t>(u"PetDig");
Character* player = owner->GetCharacter();
@@ -192,7 +194,7 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
// Some treasures require a mission to be active
if (digInfo.requiredMission >= 0) {
auto* missionComponent = owner->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < eMissionState::ACTIVE) {
return;
}
}
@@ -209,8 +211,8 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig
new LDFData<float>(u"spawnTimer", 1.0)
};
auto* spawnedPet = EntityManager::Instance()->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(spawnedPet);
auto* spawnedPet = Game::entityManager->CreateEntity(info);
Game::entityManager->ConstructEntity(spawnedPet);
}
Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
@@ -218,7 +220,7 @@ Entity* PetDigServer::GetClosestTresure(NiPoint3 position) {
Entity* closest = nullptr;
for (const auto tresureId : treasures) {
auto* tresure = EntityManager::Instance()->GetEntity(tresureId);
auto* tresure = Game::entityManager->GetEntity(tresureId);
if (tresure == nullptr) continue;

View File

@@ -2,9 +2,10 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void PropertyDevice::OnStartup(Entity* self) {
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
auto* zoneControl = Game::entityManager->GetZoneControlEntity();
if (zoneControl != nullptr) {
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
}
@@ -17,7 +18,7 @@ void PropertyDevice::OnRebuildComplete(Entity* self, Entity* target) {
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
if (missionComponent->GetMissionState(m_PropertyMissionID) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(m_PropertyMissionID) == eMissionState::ACTIVE) {
GameMessages::SendPlayFXEffect(self->GetObjectID(), 641, u"create", "callhome");
missionComponent->ForceProgress(m_PropertyMissionID, 1793, self->GetLOT());
}

View File

@@ -1,6 +1,7 @@
#include "PropertyPlatform.h"
#include "RebuildComponent.h"
#include "GameMessages.h"
#include "MovingPlatformComponent.h"
void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
// auto* movingPlatform = self->GetComponent<MovingPlatformComponent>();
@@ -9,18 +10,18 @@ void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
// movingPlatform->SetNoAutoStart(true);
// }
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
0, 0, MovementPlatformState::Stationary);
0, 0, eMovementPlatformState::Stationary);
}
void PropertyPlatform::OnUse(Entity* self, Entity* user) {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent != nullptr && rebuildComponent->GetState() == REBUILD_COMPLETED) {
if (rebuildComponent != nullptr && rebuildComponent->GetState() == eRebuildState::COMPLETED) {
// auto* movingPlatform = self->GetComponent<MovingPlatformComponent>();
// if (movingPlatform != nullptr) {
// movingPlatform->GotoWaypoint(1);
// }
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
1, 1, MovementPlatformState::Moving);
1, 1, eMovementPlatformState::Moving);
self->AddCallbackTimer(movementDelay + effectDelay, [self, this]() {
self->SetNetworkVar<float_t>(u"startEffect", dieDelay);

View File

@@ -3,6 +3,9 @@
#include "CDClientManager.h"
#include "DestroyableComponent.h"
#include "CDObjectSkillsTable.h"
#include "CDSkillBehaviorTable.h"
void QbEnemyStunner::OnRebuildComplete(Entity* self, Entity* target) {
auto* destroyable = self->GetComponent<DestroyableComponent>();
@@ -14,12 +17,12 @@ void QbEnemyStunner::OnRebuildComplete(Entity* self, Entity* target) {
if (!skillComponent) return;
// Get the skill IDs of this object.
CDObjectSkillsTable* skillsTable = CDClientManager::Instance()->GetTable<CDObjectSkillsTable>("ObjectSkills");
CDObjectSkillsTable* skillsTable = CDClientManager::Instance().GetTable<CDObjectSkillsTable>();
auto skills = skillsTable->Query([=](CDObjectSkills entry) {return (entry.objectTemplate == self->GetLOT()); });
std::map<uint32_t, uint32_t> skillBehaviorMap;
// For each skill, cast it with the associated behavior ID.
for (auto skill : skills) {
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
CDSkillBehavior behaviorData = skillBehaviorTable->GetSkillByID(skill.skillID);
skillBehaviorMap.insert(std::make_pair(skill.skillID, behaviorData.behaviorID));

View File

@@ -1,5 +1,6 @@
#include "QbSpawner.h"
#include "BaseCombatAIComponent.h"
#include "EntityInfo.h"
#include "MovementAIComponent.h"
void QbSpawner::OnStartup(Entity* self) {
@@ -40,7 +41,7 @@ void QbSpawner::OnTimerDone(Entity* self, std::string timerName) {
auto gateObjID = self->GetVar<LWOOBJID>(u"gateObj");
if (!gateObjID) return;
auto* gate = EntityManager::Instance()->GetEntity(gateObjID);
auto* gate = Game::entityManager->GetEntity(gateObjID);
if (!gate) return;
auto oPos = gate->GetPosition();
@@ -74,12 +75,12 @@ void QbSpawner::OnTimerDone(Entity* self, std::string timerName) {
new LDFData<int>(u"mobTableLoc", i)
};
auto* child = EntityManager::Instance()->CreateEntity(info, nullptr, self);
EntityManager::Instance()->ConstructEntity(child);
auto* child = Game::entityManager->CreateEntity(info, nullptr, self);
Game::entityManager->ConstructEntity(child);
OnChildLoaded(self, child);
} else {
auto* mob = EntityManager::Instance()->GetEntity(mobTable[i]);
auto* mob = Game::entityManager->GetEntity(mobTable[i]);
AggroTargetObject(self, mob);
}
}
@@ -99,7 +100,7 @@ void QbSpawner::OnChildLoaded(Entity* self, Entity* child) {
const auto selfID = self->GetObjectID();
child->AddDieCallback([this, selfID, child]() {
auto* self = EntityManager::Instance()->GetEntity(selfID);
auto* self = Game::entityManager->GetEntity(selfID);
OnChildRemoved(self, child);
}
);
@@ -119,7 +120,7 @@ void QbSpawner::AggroTargetObject(Entity* self, Entity* enemy) {
auto gateObjID = self->GetVar<LWOOBJID>(u"gateObj");
if (gateObjID) {
auto* gate = EntityManager::Instance()->GetEntity(gateObjID);
auto* gate = Game::entityManager->GetEntity(gateObjID);
if (gate) {
auto* movementAIComponent = enemy->GetComponent<MovementAIComponent>();
if (movementAIComponent) movementAIComponent->SetDestination(gate->GetPosition());
@@ -133,4 +134,3 @@ void QbSpawner::AggroTargetObject(Entity* self, Entity* enemy) {
}
}

View File

@@ -2,7 +2,8 @@
#include "Character.h"
#include "GameMessages.h"
#include "dServer.h"
#include "AMFFormat.h"
#include "Amf3.h"
#include "Entity.h"
void StoryBoxInteractServer::OnUse(Entity* self, Entity* user) {
if (self->GetVar<bool>(u"hasCustomText")) {
@@ -11,24 +12,18 @@ void StoryBoxInteractServer::OnUse(Entity* self, Entity* user) {
{
AMFArrayValue args;
auto* state = new AMFStringValue();
state->SetStringValue("Story");
args.Insert("state", "Story");
args.InsertValue("state", state);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", args);
}
user->AddCallbackTimer(0.1f, [user, customText]() {
AMFArrayValue args;
auto* text = new AMFStringValue();
text->SetStringValue(customText);
args.Insert("visible", true);
args.Insert("text", customText);
args.InsertValue("visible", new AMFTrueValue());
args.InsertValue("text", text);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "ToggleStoryBox", &args);
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "ToggleStoryBox", args);
});
return;

View File

@@ -2,11 +2,14 @@
#include "InventoryComponent.h"
#include "GameMessages.h"
#include "Character.h"
#include "eReplicaComponentType.h"
#include "eTerminateType.h"
#include "ePlayerFlag.h"
//2021-05-03 - max - added script, omitted some parts related to inheritance in lua which we don't need
void TokenConsoleServer::OnUse(Entity* self, Entity* user) {
auto* inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));
auto* inv = static_cast<InventoryComponent*>(user->GetComponent(eReplicaComponentType::INVENTORY));
//make sure the user has the required amount of infected bricks
if (inv && inv->GetLotCount(6194) >= bricksToTake) {
@@ -21,15 +24,15 @@ void TokenConsoleServer::OnUse(Entity* self, Entity* user) {
if (!character) return;
// At this point the player has to be in a faction.
LOT tokenLOT = 0;
if (character->GetPlayerFlag(ePlayerFlags::VENTURE_FACTION)) //venture
if (character->GetPlayerFlag(ePlayerFlag::VENTURE_FACTION)) //venture
tokenLOT = 8321;
else if (character->GetPlayerFlag(ePlayerFlags::ASSEMBLY_FACTION)) //assembly
else if (character->GetPlayerFlag(ePlayerFlag::ASSEMBLY_FACTION)) //assembly
tokenLOT = 8318;
else if (character->GetPlayerFlag(ePlayerFlags::PARADOX_FACTION)) //paradox
else if (character->GetPlayerFlag(ePlayerFlag::PARADOX_FACTION)) //paradox
tokenLOT = 8320;
else if (character->GetPlayerFlag(ePlayerFlags::SENTINEL_FACTION)) //sentinel
else if (character->GetPlayerFlag(ePlayerFlag::SENTINEL_FACTION)) //sentinel
tokenLOT = 8319;
inv->AddItem(tokenLOT, tokensToGive, eLootSourceType::LOOT_SOURCE_NONE);
inv->AddItem(tokenLOT, tokensToGive, eLootSourceType::NONE);
}
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());

View File

@@ -3,6 +3,8 @@
#include "Entity.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
void TouchMissionUpdateServer::OnStartup(Entity* self) {
self->SetProximityRadius(20, "touchCheck"); // Those does not have a collider for some reason?
@@ -15,7 +17,7 @@ void TouchMissionUpdateServer::OnCollisionPhantom(Entity* self, Entity* target)
return;
}
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
if (missionComponent == nullptr) {
return;
@@ -29,7 +31,7 @@ void TouchMissionUpdateServer::OnCollisionPhantom(Entity* self, Entity* target)
const auto state = mission->GetMissionState();
if (state >= MissionState::MISSION_STATE_COMPLETE || mission->GetCompletions() > 1) {
if (state >= eMissionState::COMPLETE || mission->GetCompletions() > 1) {
return;
}

View File

@@ -1,6 +1,9 @@
#include "WishingWellServer.h"
#include "ScriptedActivityComponent.h"
#include "GameMessages.h"
#include "Loot.h"
#include "EntityManager.h"
#include "eTerminateType.h"
void WishingWellServer::OnStartup(Entity* self) {
}
@@ -18,7 +21,7 @@ void WishingWellServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendPlayNDAudioEmitter(self, user->GetSystemAddress(), audio);
}
LootGenerator::Instance().DropActivityLoot(
Loot::DropActivityLoot(
user,
self,
static_cast<uint32_t>(scriptedActivity->GetActivityID()),
@@ -30,7 +33,7 @@ void WishingWellServer::OnUse(Entity* self, Entity* user) {
const auto userID = user->GetObjectID();
self->AddCallbackTimer(10, [self, userID]() {
auto* user = EntityManager::Instance()->GetEntity(userID);
auto* user = Game::entityManager->GetEntity(userID);
if (user == nullptr) return;

View File

@@ -1,4 +1,5 @@
#include "NsConcertChoiceBuildManager.h"
#include "EntityInfo.h"
#include "EntityManager.h"
const std::vector<Crate> NsConcertChoiceBuildManager::crates{
@@ -39,8 +40,8 @@ void NsConcertChoiceBuildManager::SpawnCrate(Entity* self) {
new LDFData<float>(u"crateTime", crate.time),
};
auto* spawnedCrate = EntityManager::Instance()->CreateEntity(info);
EntityManager::Instance()->ConstructEntity(spawnedCrate);
auto* spawnedCrate = Game::entityManager->CreateEntity(info);
Game::entityManager->ConstructEntity(spawnedCrate);
spawnedCrate->AddDieCallback([self]() {
self->CancelAllTimers(); // Don't switch if the crate was smashed
@@ -55,7 +56,7 @@ void NsConcertChoiceBuildManager::SpawnCrate(Entity* self) {
self->AddCallbackTimer(crate.time, [self]() {
auto crateID = self->GetVar<LWOOBJID>(u"currentCrate");
if (crateID != LWOOBJID_EMPTY) {
EntityManager::Instance()->DestroyEntity(crateID);
Game::entityManager->DestroyEntity(crateID);
self->SetVar<LWOOBJID>(u"currentCrate", LWOOBJID_EMPTY);
}

View File

@@ -1,10 +1,10 @@
#include "NsLegoClubDoor.h"
#include "dZoneManager.h"
#include "GameMessages.h"
#include "AMFFormat.h"
#include "Amf3.h"
void NsLegoClubDoor::OnStartup(Entity* self) {
self->SetVar(u"currentZone", (int32_t)dZoneManager::Instance()->GetZoneID().GetMapID());
self->SetVar(u"currentZone", (int32_t)Game::zoneManager->GetZoneID().GetMapID());
self->SetVar(u"choiceZone", m_ChoiceZoneID);
self->SetVar(u"teleportAnim", m_TeleportAnim);
self->SetVar(u"teleportString", m_TeleportString);
@@ -12,116 +12,56 @@ void NsLegoClubDoor::OnStartup(Entity* self) {
args = {};
AMFStringValue* callbackClient = new AMFStringValue();
callbackClient->SetStringValue(std::to_string(self->GetObjectID()));
args.InsertValue("callbackClient", callbackClient);
args.Insert("callbackClient", std::to_string(self->GetObjectID()));
args.Insert("strIdentifier", "choiceDoor");
args.Insert("title", "%[UI_CHOICE_DESTINATION]");
AMFStringValue* strIdentifier = new AMFStringValue();
strIdentifier->SetStringValue("choiceDoor");
args.InsertValue("strIdentifier", strIdentifier);
AMFStringValue* title = new AMFStringValue();
title->SetStringValue("%[UI_CHOICE_DESTINATION]");
args.InsertValue("title", title);
AMFArrayValue* choiceOptions = new AMFArrayValue();
AMFArrayValue* choiceOptions = args.InsertArray("options");
{
AMFArrayValue* nsArgs = new AMFArrayValue();
AMFArrayValue* nsArgs = choiceOptions->PushArray();
AMFStringValue* image = new AMFStringValue();
image->SetStringValue("textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->InsertValue("image", image);
AMFStringValue* caption = new AMFStringValue();
caption->SetStringValue("%[UI_CHOICE_NS]");
nsArgs->InsertValue("caption", caption);
AMFStringValue* identifier = new AMFStringValue();
identifier->SetStringValue("zoneID_1200");
nsArgs->InsertValue("identifier", identifier);
AMFStringValue* tooltipText = new AMFStringValue();
tooltipText->SetStringValue("%[UI_CHOICE_NS_HOVER]");
nsArgs->InsertValue("tooltipText", tooltipText);
choiceOptions->PushBackValue(nsArgs);
nsArgs->Insert("image", "textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->Insert("caption", "%[UI_CHOICE_NS]");
nsArgs->Insert("identifier", "zoneID_1200");
nsArgs->Insert("tooltipText", "%[UI_CHOICE_NS_HOVER]");
}
{
AMFArrayValue* ntArgs = new AMFArrayValue();
AMFArrayValue* ntArgs = choiceOptions->PushArray();
AMFStringValue* image = new AMFStringValue();
image->SetStringValue("textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->InsertValue("image", image);
AMFStringValue* caption = new AMFStringValue();
caption->SetStringValue("%[UI_CHOICE_NT]");
ntArgs->InsertValue("caption", caption);
AMFStringValue* identifier = new AMFStringValue();
identifier->SetStringValue("zoneID_1900");
ntArgs->InsertValue("identifier", identifier);
AMFStringValue* tooltipText = new AMFStringValue();
tooltipText->SetStringValue("%[UI_CHOICE_NT_HOVER]");
ntArgs->InsertValue("tooltipText", tooltipText);
choiceOptions->PushBackValue(ntArgs);
ntArgs->Insert("image", "textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->Insert("caption", "%[UI_CHOICE_NT]");
ntArgs->Insert("identifier", "zoneID_1900");
ntArgs->Insert("tooltipText", "%[UI_CHOICE_NT_HOVER]");
}
options = choiceOptions;
args.InsertValue("options", choiceOptions);
}
void NsLegoClubDoor::OnUse(Entity* self, Entity* user) {
auto* player = user;
if (CheckChoice(self, player)) {
AMFArrayValue* multiArgs = new AMFArrayValue();
AMFArrayValue multiArgs;
AMFStringValue* callbackClient = new AMFStringValue();
callbackClient->SetStringValue(std::to_string(self->GetObjectID()));
multiArgs->InsertValue("callbackClient", callbackClient);
AMFStringValue* strIdentifier = new AMFStringValue();
strIdentifier->SetStringValue("choiceDoor");
multiArgs->InsertValue("strIdentifier", strIdentifier);
AMFStringValue* title = new AMFStringValue();
title->SetStringValue("%[UI_CHOICE_DESTINATION]");
multiArgs->InsertValue("title", title);
multiArgs->InsertValue("options", options);
multiArgs.Insert("callbackClient", std::to_string(self->GetObjectID()));
multiArgs.Insert("strIdentifier", "choiceDoor");
multiArgs.Insert("title", "%[UI_CHOICE_DESTINATION]");
multiArgs.Insert("options", static_cast<AMFBaseValue*>(options));
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", multiArgs);
multiArgs.Remove("options", false); // We do not want the local amf to delete the options!
} else if (self->GetVar<int32_t>(u"currentZone") != m_ChoiceZoneID) {
AMFArrayValue* multiArgs = new AMFArrayValue();
AMFArrayValue multiArgs;
multiArgs.Insert("state", "Lobby");
AMFStringValue* state = new AMFStringValue();
state->SetStringValue("Lobby");
multiArgs->InsertValue("state", state);
AMFArrayValue* context = new AMFArrayValue();
AMFStringValue* user = new AMFStringValue();
user->SetStringValue(std::to_string(player->GetObjectID()));
context->InsertValue("user", user);
AMFStringValue* callbackObj = new AMFStringValue();
callbackObj->SetStringValue(std::to_string(self->GetObjectID()));
context->InsertValue("callbackObj", callbackObj);
AMFStringValue* helpVisible = new AMFStringValue();
helpVisible->SetStringValue("show");
context->InsertValue("HelpVisible", helpVisible);
AMFStringValue* type = new AMFStringValue();
type->SetStringValue("Lego_Club_Valid");
context->InsertValue("type", type);
multiArgs->InsertValue("context", context);
AMFArrayValue* context = multiArgs.InsertArray("context");
context->Insert("user", std::to_string(player->GetObjectID()));
context->Insert("callbackObj", std::to_string(self->GetObjectID()));
context->Insert("HelpVisible", "show");
context->Insert("type", "Lego_Club_Valid");
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "pushGameState", multiArgs);
} else {

View File

@@ -2,6 +2,7 @@
#include "CppScripts.h"
#include "ChooseYourDestinationNsToNt.h"
#include "BaseConsoleTeleportServer.h"
#include "Amf3.h"
class NsLegoClubDoor : public CppScripts::Script, ChooseYourDestinationNsToNt, BaseConsoleTeleportServer
{

View File

@@ -1,10 +1,10 @@
#include "NsLupTeleport.h"
#include "dZoneManager.h"
#include "GameMessages.h"
#include "AMFFormat.h"
#include "Amf3.h"
void NsLupTeleport::OnStartup(Entity* self) {
self->SetVar(u"currentZone", (int32_t)dZoneManager::Instance()->GetZoneID().GetMapID());
self->SetVar(u"currentZone", (int32_t)Game::zoneManager->GetZoneID().GetMapID());
self->SetVar(u"choiceZone", m_ChoiceZoneID);
self->SetVar(u"teleportAnim", m_TeleportAnim);
self->SetVar(u"teleportString", m_TeleportString);
@@ -12,72 +12,36 @@ void NsLupTeleport::OnStartup(Entity* self) {
args = {};
AMFStringValue* callbackClient = new AMFStringValue();
callbackClient->SetStringValue(std::to_string(self->GetObjectID()));
args.InsertValue("callbackClient", callbackClient);
args.Insert("callbackClient", std::to_string(self->GetObjectID()));
args.Insert("strIdentifier", "choiceDoor");
args.Insert("title", "%[UI_CHOICE_DESTINATION]");
AMFStringValue* strIdentifier = new AMFStringValue();
strIdentifier->SetStringValue("choiceDoor");
args.InsertValue("strIdentifier", strIdentifier);
AMFStringValue* title = new AMFStringValue();
title->SetStringValue("%[UI_CHOICE_DESTINATION]");
args.InsertValue("title", title);
AMFArrayValue* choiceOptions = new AMFArrayValue();
AMFArrayValue* choiceOptions = args.InsertArray("options");
{
AMFArrayValue* nsArgs = new AMFArrayValue();
AMFArrayValue* nsArgs = choiceOptions->PushArray();
AMFStringValue* image = new AMFStringValue();
image->SetStringValue("textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->InsertValue("image", image);
AMFStringValue* caption = new AMFStringValue();
caption->SetStringValue("%[UI_CHOICE_NS]");
nsArgs->InsertValue("caption", caption);
AMFStringValue* identifier = new AMFStringValue();
identifier->SetStringValue("zoneID_1200");
nsArgs->InsertValue("identifier", identifier);
AMFStringValue* tooltipText = new AMFStringValue();
tooltipText->SetStringValue("%[UI_CHOICE_NS_HOVER]");
nsArgs->InsertValue("tooltipText", tooltipText);
choiceOptions->PushBackValue(nsArgs);
nsArgs->Insert("image", "textures/ui/zone_thumnails/Nimbus_Station.dds");
nsArgs->Insert("caption", "%[UI_CHOICE_NS]");
nsArgs->Insert("identifier", "zoneID_1200");
nsArgs->Insert("tooltipText", "%[UI_CHOICE_NS_HOVER]");
}
{
AMFArrayValue* ntArgs = new AMFArrayValue();
AMFArrayValue* ntArgs = choiceOptions->PushArray();
AMFStringValue* image = new AMFStringValue();
image->SetStringValue("textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->InsertValue("image", image);
AMFStringValue* caption = new AMFStringValue();
caption->SetStringValue("%[UI_CHOICE_NT]");
ntArgs->InsertValue("caption", caption);
AMFStringValue* identifier = new AMFStringValue();
identifier->SetStringValue("zoneID_1900");
ntArgs->InsertValue("identifier", identifier);
AMFStringValue* tooltipText = new AMFStringValue();
tooltipText->SetStringValue("%[UI_CHOICE_NT_HOVER]");
ntArgs->InsertValue("tooltipText", tooltipText);
choiceOptions->PushBackValue(ntArgs);
ntArgs->Insert("image", "textures/ui/zone_thumnails/Nexus_Tower.dds");
ntArgs->Insert("caption", "%[UI_CHOICE_NT]");
ntArgs->Insert("identifier", "zoneID_1900");
ntArgs->Insert("tooltipText", "%[UI_CHOICE_NT_HOVER]");
}
args.InsertValue("options", choiceOptions);
}
void NsLupTeleport::OnUse(Entity* self, Entity* user) {
auto* player = user;
if (CheckChoice(self, player)) {
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", &args);
GameMessages::SendUIMessageServerToSingleClient(player, player->GetSystemAddress(), "QueueChoiceBox", args);
} else {
BaseOnUse(self, player);
}

View File

@@ -2,6 +2,7 @@
#include "CppScripts.h"
#include "ChooseYourDestinationNsToNt.h"
#include "BaseConsoleTeleportServer.h"
#include "Amf3.h"
class NsLupTeleport : public CppScripts::Script, ChooseYourDestinationNsToNt, BaseConsoleTeleportServer
{

View File

@@ -4,6 +4,8 @@
#include "Character.h"
#include "MissionComponent.h"
#include "RebuildComponent.h"
#include "eTerminateType.h"
#include "ePlayerFlag.h"
void NsTokenConsoleServer::OnStartup(Entity* self) {
@@ -16,7 +18,7 @@ void NsTokenConsoleServer::OnUse(Entity* self, Entity* user) {
return;
}
if (rebuildComponent->GetState() != REBUILD_COMPLETED) {
if (rebuildComponent->GetState() != eRebuildState::COMPLETED) {
return;
}
@@ -42,20 +44,18 @@ void NsTokenConsoleServer::OnUse(Entity* self, Entity* user) {
// Player must be in faction to interact with this entity.
LOT tokenLOT = 0;
if (character->GetPlayerFlag(46)) {
if (character->GetPlayerFlag(ePlayerFlag::VENTURE_FACTION)) //venture
tokenLOT = 8321;
} else if (character->GetPlayerFlag(47)) {
else if (character->GetPlayerFlag(ePlayerFlag::ASSEMBLY_FACTION)) //assembly
tokenLOT = 8318;
} else if (character->GetPlayerFlag(48)) {
else if (character->GetPlayerFlag(ePlayerFlag::PARADOX_FACTION)) //paradox
tokenLOT = 8320;
} else if (character->GetPlayerFlag(49)) {
else if (character->GetPlayerFlag(ePlayerFlag::SENTINEL_FACTION)) //sentinel
tokenLOT = 8319;
}
inventoryComponent->AddItem(tokenLOT, 5, eLootSourceType::LOOT_SOURCE_NONE);
inventoryComponent->AddItem(tokenLOT, 5, eLootSourceType::NONE);
missionComponent->ForceProgressTaskType(863, 1, 1, false);
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
}

View File

@@ -439,7 +439,7 @@ std::vector<Wave> ZoneNsWaves::GetWaves() {
5.0f,
(uint32_t)-1,
true,
30,
60,
},
};
}

View File

@@ -1,6 +1,8 @@
#pragma once
#include "BaseWavesServer.h"
#include "dCommonVars.h"
enum SpawnerName {
interior_A,
interior_B,

View File

@@ -2,6 +2,11 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "RenderComponent.h"
#include "eEndBehavior.h"
#include "eStateChangeType.h"
void NtAssemblyTubeServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");
@@ -22,7 +27,7 @@ void NtAssemblyTubeServer::OnProximityUpdate(Entity* self, Entity* entering, std
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}
@@ -36,23 +41,23 @@ void NtAssemblyTubeServer::RunAssemblyTube(Entity* self, Entity* player) {
if (player->IsPlayer() && !bPlayerBeingTeleported) {
auto teleCinematic = self->GetVar<std::u16string>(u"Cinematic");
GameMessages::SendSetStunned(playerID, PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
if (!teleCinematic.empty()) {
const auto teleCinematicUname = teleCinematic;
GameMessages::SendPlayCinematic(player->GetObjectID(), teleCinematicUname, player->GetSystemAddress(),
true, true, true, false, 0, false, -1, false, true
true, true, true, false, eEndBehavior::RETURN, false, -1, false, true
);
}
GameMessages::SendPlayAnimation(player, u"tube-sucker", 4.0f);
RenderComponent::PlayAnimation(player, u"tube-sucker", 4.0f);
const auto animTime = 3;
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -68,7 +73,7 @@ void NtAssemblyTubeServer::TeleportPlayer(Entity* self, Entity* player) {
auto* destination = self;
if (!destinationGroup.empty()) {
const auto& groupObjs = EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
const auto& groupObjs = Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
if (!groupObjs.empty()) {
destination = groupObjs[0];
@@ -80,14 +85,14 @@ void NtAssemblyTubeServer::TeleportPlayer(Entity* self, Entity* player) {
GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"tube-resurrect", 4.0f);
RenderComponent::PlayAnimation(player, u"tube-resurrect", 4.0f);
const auto animTime = 2;
const auto playerID = player->GetObjectID();
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -108,7 +113,7 @@ void NtAssemblyTubeServer::UnlockPlayer(Entity* self, Entity* player) {
m_TeleportingPlayerTable[playerID] = false;
GameMessages::SendSetStunned(playerID, POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
}

View File

@@ -4,7 +4,7 @@
void NtCombatChallengeDummy::OnDie(Entity* self, Entity* killer) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
@@ -16,7 +16,7 @@ void NtCombatChallengeDummy::OnDie(Entity* self, Entity* killer) {
void NtCombatChallengeDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {

View File

@@ -1,11 +1,12 @@
#include "NtCombatChallengeExplodingDummy.h"
#include "EntityManager.h"
#include "SkillComponent.h"
#include "DestroyableComponent.h"
void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
@@ -15,9 +16,20 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
}
void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
auto numTimesHit = self->GetVar<int32_t>(u"numTimesHit");
if (destroyableComponent && numTimesHit == 0) {
self->SetVar<int32_t>(u"numTimesHit", 1);
destroyableComponent->SetHealth(destroyableComponent->GetHealth() / 2);
return;
} else if (numTimesHit == 2) {
return;
}
self->SetVar<int32_t>(u"numTimesHit", 2);
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
auto* challengeObject = EntityManager::Instance()->GetEntity(challengeObjectID);
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
@@ -28,5 +40,6 @@ void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* at
if (skillComponent != nullptr) {
skillComponent->CalculateBehavior(1338, 30875, attacker->GetObjectID());
}
self->Kill(attacker);
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16.0f);
self->Smash(attacker->GetObjectID());
}

View File

@@ -1,6 +1,7 @@
#include "NtCombatChallengeServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "EntityInfo.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
@@ -18,7 +19,7 @@ void NtCombatChallengeServer::OnDie(Entity* self, Entity* killer) {
void NtCombatChallengeServer::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -42,7 +43,7 @@ void NtCombatChallengeServer::OnFireEventServerSide(Entity* self, Entity* sender
void NtCombatChallengeServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
if (identifier == u"PlayButton" && button == 1) {
if (identifier == u"PlayButton" && button == 1 && !self->GetNetworkVar<bool>(u"bInUse")) {
self->SetNetworkVar(u"bInUse", true);
self->SetVar(u"playerID", sender->GetObjectID());
@@ -68,7 +69,7 @@ void NtCombatChallengeServer::OnMessageBoxResponse(Entity* self, Entity* sender,
void NtCombatChallengeServer::SpawnTargetDummy(Entity* self) {
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -90,11 +91,11 @@ void NtCombatChallengeServer::SpawnTargetDummy(Entity* self) {
info.rot = self->GetRotation();
info.settings = { new LDFData<std::string>(u"custom_script_server", "scripts\\02_server\\Map\\NT\\L_NT_COMBAT_CHALLENGE_DUMMY.lua") };
auto* dummy = EntityManager::Instance()->CreateEntity(info);
auto* dummy = Game::entityManager->CreateEntity(info);
dummy->SetVar(u"challengeObjectID", self->GetObjectID());
EntityManager::Instance()->ConstructEntity(dummy);
Game::entityManager->ConstructEntity(dummy);
self->SetVar(u"currentDummy", dummy->GetObjectID());
}
@@ -110,7 +111,7 @@ void NtCombatChallengeServer::OnChildLoaded(Entity* self, Entity* child) {
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -120,7 +121,7 @@ void NtCombatChallengeServer::OnChildLoaded(Entity* self, Entity* child) {
self->SetVar(u"currentTargetID", child->GetObjectID());
EntityManager::Instance()->SerializeEntity(child);
Game::entityManager->SerializeEntity(child);
child->GetGroups().push_back("targets_" + std::to_string(self->GetObjectID()));
}
@@ -129,7 +130,7 @@ void NtCombatChallengeServer::ResetGame(Entity* self) {
const auto totalDmg = self->GetVar<int32_t>(u"totalDmg");
const auto playerID = self->GetVar<LWOOBJID>(u"playerID");
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player != nullptr) {
auto* missionComponent = player->GetComponent<MissionComponent>();
@@ -149,7 +150,7 @@ void NtCombatChallengeServer::ResetGame(Entity* self) {
self->SetNetworkVar(u"totalDmg", false);
self->SetNetworkVar(u"update_time", 0);
const auto& targetObjs = EntityManager::Instance()->GetEntitiesInGroup("targets_" + std::to_string(self->GetObjectID()));
const auto& targetObjs = Game::entityManager->GetEntitiesInGroup("targets_" + std::to_string(self->GetObjectID()));
for (auto* target : targetObjs) {
target->Smash(self->GetObjectID());
@@ -157,7 +158,7 @@ void NtCombatChallengeServer::ResetGame(Entity* self) {
const auto currentID = self->GetVar<LWOOBJID>(u"currentDummy");
auto* current = EntityManager::Instance()->GetEntity(currentID);
auto* current = Game::entityManager->GetEntity(currentID);
if (current != nullptr) {
current->Smash(self->GetObjectID());

View File

@@ -1,6 +1,6 @@
#include "NtConsoleTeleportServer.h"
#include "Entity.h"
#include "AMFFormat.h"
#include "Amf3.h"
void NtConsoleTeleportServer::OnStartup(Entity* self) {
self->SetVar(u"teleportAnim", m_TeleportAnim);

View File

@@ -42,5 +42,5 @@ void NtDirtCloudServer::OnSkillEventFired(Entity* self, Entity* caster, const st
self->SetVar(u"CloudOn", false);
self->Smash(self->GetObjectID(), VIOLENT);
self->Smash(self->GetObjectID(), eKillType::VIOLENT);
}

View File

@@ -1,12 +1,14 @@
#include "NtDukeServer.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
#include "ePlayerFlag.h"
void NtDukeServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 35.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_DUKE, 13548, 1319
ePlayerFlag::NT_FACTION_SPY_DUKE, 13548, 1319
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {
@@ -19,7 +21,7 @@ void NtDukeServer::SetVariables(Entity* self) {
self->SetVar<std::vector<LWOOBJID>>(m_SpyCinematicObjectsVariable, { self->GetObjectID() });
}
void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
// Handles adding and removing the sword for the Crux Prime Sword mission
auto* missionComponent = target->GetComponent<MissionComponent>();
@@ -29,9 +31,9 @@ void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int mission
auto state = missionComponent->GetMissionState(m_SwordMissionID);
auto lotCount = inventoryComponent->GetLotCount(m_SwordLot);
if ((state == MissionState::MISSION_STATE_AVAILABLE || state == MissionState::MISSION_STATE_ACTIVE) && lotCount < 1) {
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
} else if (state == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
if ((state == eMissionState::AVAILABLE || state == eMissionState::ACTIVE) && lotCount < 1) {
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::NONE);
} else if (state == eMissionState::READY_TO_COMPLETE) {
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
}
}

View File

@@ -3,7 +3,7 @@
class NtDukeServer : public NtFactionSpyServer {
void SetVariables(Entity* self) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
const uint32_t m_SwordMissionID = 1448;
const LOT m_SwordLot = 13777;
};

View File

@@ -1,11 +1,12 @@
#include "NtHaelServer.h"
#include "Entity.h"
#include "ePlayerFlag.h"
void NtHaelServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 25.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_HAEL, 13892, 1321
ePlayerFlag::NT_FACTION_SPY_HAEL, 13892, 1321
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {

View File

@@ -40,7 +40,7 @@ void NtImagBeamBuffer::OnTimerDone(Entity* self, std::string timerName) {
}
for (const auto entityID : m_EntitiesInProximity) {
auto* entity = EntityManager::Instance()->GetEntity(entityID);
auto* entity = Game::entityManager->GetEntity(entityID);
if (entity == nullptr) {
continue;

View File

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

View File

@@ -1,11 +1,12 @@
#include "NtOverbuildServer.h"
#include "EntityManager.h"
#include "ePlayerFlag.h"
void NtOverbuildServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 30.0f);
self->SetVar<SpyData>(m_SpyDataVariable, {
NT_FACTION_SPY_OVERBUILD, 13891, 1320
ePlayerFlag::NT_FACTION_SPY_OVERBUILD, 13891, 1320
});
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {
@@ -20,7 +21,7 @@ void NtOverbuildServer::SetVariables(Entity* self) {
// Find the second object Dr. Overbuild interacts with
LWOOBJID otherConvoObjectID = LWOOBJID_EMPTY;
for (auto* otherConvoObject : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(m_OtherEntitiesGroupVariable)))) {
for (auto* otherConvoObject : Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(m_OtherEntitiesGroupVariable)))) {
otherConvoObjectID = otherConvoObject->GetObjectID();
break;
}

View File

@@ -3,6 +3,10 @@
#include "MissionComponent.h"
#include "EntityManager.h"
#include "Character.h"
#include "eMissionState.h"
#include "RenderComponent.h"
#include "eTerminateType.h"
#include "eStateChangeType.h"
void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"bActive", 1, 0, user->GetObjectID(), "", user->GetSystemAddress());
@@ -16,12 +20,12 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
const auto playerID = user->GetObjectID();
for (const auto mission : tPlayerOnMissions) {
if (missionComponent->GetMissionState(mission) != MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent->GetMissionState(mission) != eMissionState::ACTIVE) {
continue;
}
self->AddCallbackTimer(2, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -31,18 +35,18 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
player->GetCharacter()->SetPlayerFlag(flag, true);
GameMessages::SendPlayAnimation(player, u"rebuild-celebrate");
RenderComponent::PlayAnimation(player, u"rebuild-celebrate");
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SparkStop", 0, 0, player->GetObjectID(), "", player->GetSystemAddress());
GameMessages::SendSetStunned(player->GetObjectID(), eStunState::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
GameMessages::SendSetStunned(player->GetObjectID(), eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
self->SetVar(u"bActive", false);
});
GameMessages::SendPlayAnimation(user, u"nexus-powerpanel", 6.0f);
GameMessages::SendSetStunned(user->GetObjectID(), eStunState::PUSH, user->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
RenderComponent::PlayAnimation(user, u"nexus-powerpanel", 6.0f);
GameMessages::SendSetStunned(user->GetObjectID(), eStateChangeType::PUSH, user->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
return;
}
GameMessages::SendPlayAnimation(user, shockAnim);
RenderComponent::PlayAnimation(user, shockAnim);
const auto dir = self->GetRotation().GetRightVector();
@@ -51,7 +55,7 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendPlayFXEffect(self, 6432, u"create", "console_sparks", LWOOBJID_EMPTY, 1.0, 1.0, true);
self->AddCallbackTimer(2, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;

View File

@@ -2,6 +2,9 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "RenderComponent.h"
#include "eStateChangeType.h"
void NtParadoxTeleServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");
@@ -22,16 +25,15 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std:
const auto bPlayerBeingTeleported = m_TeleportingPlayerTable[playerID];
if (player->IsPlayer() && !bPlayerBeingTeleported) {
GameMessages::SendSetStunned(playerID, PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);
GameMessages::SendPlayAnimation(player, u"teledeath", 4.0f);
const auto animTime = 2;
auto animTime = RenderComponent::PlayAnimation(player, u"teledeath", 4.0f);
if (animTime == 0.0f) animTime = 2.0f;
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -44,7 +46,7 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std:
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}
@@ -53,7 +55,7 @@ void NtParadoxTeleServer::TeleportPlayer(Entity* self, Entity* player) {
auto* destination = self;
if (!destinationGroup.empty()) {
const auto& groupObjs = EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
const auto& groupObjs = Game::entityManager->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(destinationGroup));
if (!groupObjs.empty()) {
destination = groupObjs[0];
@@ -72,14 +74,14 @@ void NtParadoxTeleServer::TeleportPlayer(Entity* self, Entity* player) {
GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"paradox-teleport-in", 4.0f);
RenderComponent::PlayAnimation(player, u"paradox-teleport-in", 4.0f);
const auto animTime = 2;
const auto playerID = player->GetObjectID();
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);
auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) {
return;
@@ -100,7 +102,7 @@ void NtParadoxTeleServer::UnlockPlayer(Entity* self, Entity* player) {
m_TeleportingPlayerTable[playerID] = false;
GameMessages::SendSetStunned(playerID, POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
GameMessages::SendSetStunned(playerID, eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true
);

View File

@@ -2,6 +2,8 @@
#include "PhantomPhysicsComponent.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "ePhysicsEffectType.h"
void NtSentinelWalkwayServer::OnStartup(Entity* self) {
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
@@ -18,12 +20,12 @@ void NtSentinelWalkwayServer::OnStartup(Entity* self) {
const auto forward = self->GetRotation().GetRightVector() * -1;
phantomPhysicsComponent->SetEffectType(0); // PUSH
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::PUSH);
phantomPhysicsComponent->SetDirectionalMultiplier(force);
phantomPhysicsComponent->SetDirection(forward);
phantomPhysicsComponent->SetPhysicsEffectActive(true);
EntityManager::Instance()->SerializeEntity(self);
Game::entityManager->SerializeEntity(self);
self->SetProximityRadius(3, "speedboost");
}
@@ -38,6 +40,6 @@ void NtSentinelWalkwayServer::OnProximityUpdate(Entity* self, Entity* entering,
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}

Some files were not shown because too many files have changed in this diff Show More