Merge branch 'main' into wbl-generic-and-rc-citizen

This commit is contained in:
Aaron Kimbre
2023-08-15 10:11:29 -05:00
1186 changed files with 23552 additions and 14391 deletions

View File

@@ -0,0 +1,45 @@
set(DSCRIPTS_SOURCES_02_SERVER)
add_subdirectory(DLU)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_DLU})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "DLU/${file}")
endforeach()
add_subdirectory(Enemy)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Enemy/${file}")
endforeach()
add_subdirectory(Equipment)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_EQUIPMENT})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Equipment/${file}")
endforeach()
add_subdirectory(Map)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Map/${file}")
endforeach()
add_subdirectory(Minigame)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MINIGAME})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Minigame/${file}")
endforeach()
add_subdirectory(Objects)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_OBJECTS})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Objects/${file}")
endforeach()
add_subdirectory(Pets)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_PETS})
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Pets/${file}")
endforeach()
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} PARENT_SCOPE)

View File

@@ -0,0 +1,3 @@
set(DSCRIPTS_SOURCES_02_SERVER_DLU
"DLUVanityNPC.cpp"
PARENT_SCOPE)

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) {
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[randomEggLoc];
}
}
// 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;
@@ -343,7 +304,7 @@ 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());
@@ -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")) {
@@ -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

@@ -0,0 +1,3 @@
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_AG
"BossSpiderQueenEnemyServer.cpp"
PARENT_SCOPE)

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

@@ -0,0 +1,5 @@
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_AM
"AmDarklingMech.cpp"
"AmSkeletonEngineer.cpp"
"AmDarklingDragon.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,45 @@
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY)
add_subdirectory(AG)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_AG})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "AG/${file}")
endforeach()
add_subdirectory(AM)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_AM})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "AM/${file}")
endforeach()
add_subdirectory(FV)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_FV})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "FV/${file}")
endforeach()
add_subdirectory(General)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_GENERAL})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "General/${file}")
endforeach()
add_subdirectory(Survival)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_SURVIVAL})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "Survival/${file}")
endforeach()
add_subdirectory(VE)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_VE})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "VE/${file}")
endforeach()
add_subdirectory(Waves)
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_WAVES})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "Waves/${file}")
endforeach()
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} PARENT_SCOPE)

View File

@@ -0,0 +1,4 @@
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_FV
"FvMaelstromCavalry.cpp"
"FvMaelstromDragon.cpp"
PARENT_SCOPE)

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,8 +62,6 @@ 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");
@@ -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

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

@@ -0,0 +1,7 @@
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_GENERAL
"BaseEnemyMech.cpp"
"BaseEnemyApe.cpp"
"GfApeSmashingQB.cpp"
"TreasureChestDragonServer.cpp"
"EnemyNjBuff.cpp"
PARENT_SCOPE)

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,7 +29,7 @@ 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;

View File

@@ -0,0 +1,5 @@
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_SURVIVAL
"AgSurvivalStromling.cpp"
"AgSurvivalMech.cpp"
"AgSurvivalSpiderling.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,3 @@
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_VE
"VeMech.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,6 @@
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_WAVES
"WaveBossHammerling.cpp"
"WaveBossApe.cpp"
"WaveBossSpiderling.cpp"
"WaveBossHorsemen.cpp"
PARENT_SCOPE)

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,8 +38,8 @@ 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)
@@ -47,6 +49,6 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
}
}
} else if (args == "ChestDead") {
self->Smash(player->GetObjectID(), SILENT);
self->Smash(player->GetObjectID(), eKillType::SILENT);
}
}

View File

@@ -0,0 +1,4 @@
set(DSCRIPTS_SOURCES_02_SERVER_EQUIPMENT
"MaestromExtracticatorServer.cpp"
"BootyDigServer.cpp"
PARENT_SCOPE)

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

@@ -0,0 +1,28 @@
#include "AgLaserSensorServer.h"
#include "PhantomPhysicsComponent.h"
#include "SkillComponent.h"
#include "ePhysicsEffectType.h"
void AgLaserSensorServer::OnStartup(Entity* self) {
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) {
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

@@ -0,0 +1,17 @@
#include "AgMonumentLaserServer.h"
#include "EntityManager.h"
void AgMonumentLaserServer::OnStartup(Entity* self) {
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

@@ -0,0 +1,8 @@
#pragma once
#include "CppScripts.h"
class AgMonumentLaserServer : public CppScripts::Script {
public:
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

@@ -0,0 +1,16 @@
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG
"AgCagedBricksServer.cpp"
"NpcWispServer.cpp"
"NpcEpsilonServer.cpp"
"AgLaserSensorServer.cpp"
"AgMonumentLaserServer.cpp"
"AgMonumentBirds.cpp"
"RemoveRentalGear.cpp"
"NpcNjAssistantServer.cpp"
"AgBugsprayer.cpp"
"NpcAgCourseStarter.cpp"
"AgMonumentRaceGoal.cpp"
"AgMonumentRaceCancel.cpp"
"NpcCowboyServer.cpp"
"NpcPirateServer.cpp"
PARENT_SCOPE)

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

@@ -0,0 +1,26 @@
#include "NpcCowboyServer.h"
#include "eMissionState.h"
#include "InventoryComponent.h"
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
if (missionID != 1880) {
return;
}
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
if (inventoryComponent == nullptr) {
return;
}
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::NONE);
}
} 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

@@ -0,0 +1,4 @@
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN
"ZoneAgSpiderQueen.cpp"
"SpiderBossTreasureChestServer.cpp"
PARENT_SCOPE)

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

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

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