2021-12-05 17:54:36 +00:00
|
|
|
#include "BasePropertyServer.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "dZoneManager.h"
|
|
|
|
#include "Character.h"
|
|
|
|
#include "DestroyableComponent.h"
|
|
|
|
#include "Entity.h"
|
|
|
|
#include "RenderComponent.h"
|
2022-07-05 06:00:10 +00:00
|
|
|
#include "PropertyManagementComponent.h"
|
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "eMissionTaskType.h"
|
|
|
|
#include "eMissionState.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void BasePropertyServer::SetGameVariables(Entity* self) {
|
|
|
|
self->SetVar<std::string>(ClaimMarkerGroup, "");
|
|
|
|
self->SetVar<std::string>(GeneratorGroup, "");
|
|
|
|
self->SetVar<std::string>(GuardGroup, "");
|
|
|
|
self->SetVar<std::string>(PropertyPlaqueGroup, "");
|
|
|
|
self->SetVar<std::string>(PropertyVendorGroup, "");
|
|
|
|
self->SetVar<std::string>(SpotsGroup, "");
|
|
|
|
self->SetVar<std::string>(MSCloudsGroup, "");
|
|
|
|
self->SetVar<std::string>(EnemiesGroup, "");
|
|
|
|
self->SetVar<std::string>(FXManagerGroup, "");
|
|
|
|
self->SetVar<std::string>(ImagOrbGroup, "");
|
|
|
|
self->SetVar<std::string>(GeneratorFXGroup, "");
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->SetVar<std::vector<std::string>>(EnemiesSpawner, {});
|
|
|
|
self->SetVar<std::string>(ClaimMarkerSpawner, "");
|
|
|
|
self->SetVar<std::string>(GeneratorSpawner, "");
|
|
|
|
self->SetVar<std::string>(DamageFXSpawner, "");
|
|
|
|
self->SetVar<std::string>(FXSpotsSpawner, "");
|
|
|
|
self->SetVar<std::string>(PropertyMGSpawner, "");
|
|
|
|
self->SetVar<std::string>(ImageOrbSpawner, "");
|
|
|
|
self->SetVar<std::string>(GeneratorFXSpawner, "");
|
|
|
|
self->SetVar<std::string>(SmashablesSpawner, "");
|
|
|
|
self->SetVar<std::string>(FXManagerSpawner, "");
|
|
|
|
self->SetVar<std::string>(PropObjsSpawner, "");
|
|
|
|
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, {});
|
|
|
|
self->SetVar<std::vector<std::string>>(BehaviorObjsSpawner, {});
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-05-06 18:32:26 +00:00
|
|
|
self->SetVar<int32_t>(defeatedProperyFlag, 0);
|
|
|
|
self->SetVar<int32_t>(placedModelFlag, 0);
|
2021-12-05 17:54:36 +00:00
|
|
|
self->SetVar<uint32_t>(guardMissionFlag, 0);
|
|
|
|
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 0);
|
|
|
|
self->SetVar<std::string>(passwordFlag, "s3kratK1ttN");
|
|
|
|
self->SetVar<LOT>(generatorIdFlag, 0);
|
|
|
|
self->SetVar<LOT>(orbIDFlag, 0);
|
|
|
|
self->SetVar<LOT>(behaviorQBID, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::CheckForOwner(Entity* self) {
|
2023-07-15 20:56:33 +00:00
|
|
|
if (Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(PropertyPlaqueGroup)).empty()) {
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer(RunPlayerLoadedAgainTimer, 0.5f);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self->SetI64(PropertyOwnerVariable, GetOwner());
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::OnStartup(Entity* self) {
|
|
|
|
SetGameVariables(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
|
|
|
int32_t param2, int32_t param3) {
|
|
|
|
if (args == CheckForPropertyOwnerEvent) {
|
|
|
|
sender->SetNetworkVar<std::string>(PropertyOwnerIDVariable, std::to_string(self->GetVar<LWOOBJID>(PropertyOwnerVariable)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) {
|
|
|
|
CheckForOwner(self);
|
|
|
|
|
|
|
|
auto rented = false;
|
|
|
|
auto propertyOwner = PropertyManagementComponent::Instance()->GetOwnerId();
|
|
|
|
|
|
|
|
self->OnFireEventServerSide(self, CheckForPropertyOwnerEvent);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
if (propertyOwner > 0) {
|
|
|
|
rented = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (propertyOwner < 0) {
|
|
|
|
propertyOwner = LWOOBJID_EMPTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
self->SetNetworkVar(PropertyOwnerIDVariable, propertyOwner);
|
|
|
|
|
|
|
|
if (rented) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto plaques = Game::entityManager->GetEntitiesInGroup("PropertyVendor");
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* plaque : plaques) {
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->DestructEntity(plaque);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2023-07-17 22:55:33 +00:00
|
|
|
const auto& mapID = Game::zoneManager->GetZone()->GetZoneID();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (propertyOwner > 0) {
|
|
|
|
auto* missionComponent = player->GetComponent<MissionComponent>();
|
|
|
|
|
|
|
|
if (missionComponent != nullptr) {
|
|
|
|
missionComponent->Progress(
|
|
|
|
eMissionTaskType::VISIT_PROPERTY,
|
|
|
|
mapID.GetMapID(),
|
2023-12-01 16:13:01 +00:00
|
|
|
PropertyManagementComponent::Instance()->GetId()
|
2021-12-05 17:54:36 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GameMessages::SendStop2DAmbientSound(player, true, GUIDMaelstrom);
|
|
|
|
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
|
|
|
|
|
|
|
self->AddTimer(TurnSkyOffTimer, 1.5f);
|
|
|
|
|
|
|
|
// kill tornado FX and play peaceful noises
|
|
|
|
if (!self->GetBoolean(FXObjectsGoneVariable)) {
|
|
|
|
self->AddTimer(KillFXObjectTimer, 1.0f);
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
|
|
|
|
|
|
|
// activate property safe spawner network
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(PropObjsSpawner));
|
|
|
|
|
|
|
|
// tell client script who owns the property
|
|
|
|
self->SetNetworkVar<std::string>(RenterVariable, std::to_string(propertyOwner));
|
|
|
|
|
|
|
|
if (player->GetObjectID() != propertyOwner)
|
|
|
|
return;
|
|
|
|
} else {
|
2023-05-02 22:39:21 +00:00
|
|
|
const auto defeatedFlag = player->GetCharacter()->GetPlayerFlag(self->GetVar<int32_t>(defeatedProperyFlag));
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
self->SetNetworkVar(UnclaimedVariable, true);
|
|
|
|
self->SetVar<LWOOBJID>(PlayerIDVariable, player->GetObjectID());
|
|
|
|
|
|
|
|
if (!defeatedFlag) {
|
|
|
|
StartMaelstrom(self, player);
|
|
|
|
SpawnSpots(self);
|
|
|
|
GameMessages::SendPlay2DAmbientSound(player, GUIDMaelstrom);
|
|
|
|
} else {
|
|
|
|
GameMessages::SendStop2DAmbientSound(player, true, GUIDMaelstrom);
|
|
|
|
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
|
|
|
|
|
|
|
self->AddTimer(TurnSkyOffTimer, 1.5f);
|
|
|
|
self->AddTimer(KillFXObjectTimer, 1.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PropGuardCheck(self, player);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::PropGuardCheck(Entity* self, Entity* player) {
|
|
|
|
auto* missionComponent = player->GetComponent<MissionComponent>();
|
|
|
|
|
|
|
|
if (missionComponent != nullptr
|
|
|
|
&& missionComponent->GetMissionState(self->GetVar<uint32_t>(guardMissionFlag)) != eMissionState::COMPLETE) {
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(PropertyMGSpawner));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::BaseZonePropertyRented(Entity* self, Entity* player) const {
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PlayCinematic", 0, 0, LWOOBJID_EMPTY, "ShowProperty",
|
|
|
|
UNASSIGNED_SYSTEM_ADDRESS);
|
|
|
|
|
|
|
|
self->AddTimer(BoundsVisOnTimer, 2);
|
|
|
|
self->SetVar<LWOOBJID>(PropertyOwnerVariable, player->GetObjectID());
|
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
auto plaques = Game::entityManager->GetEntitiesInGroup("PropertyVendor");
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* plaque : plaques) {
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->DestructEntity(plaque);
|
2022-07-28 13:39:57 +00:00
|
|
|
}
|
|
|
|
|
2022-07-13 16:10:02 +00:00
|
|
|
auto brickLinkMissionID = self->GetVar<uint32_t>(brickLinkMissionIDFlag);
|
|
|
|
if (brickLinkMissionID != 0) {
|
|
|
|
auto missionComponent = player->GetComponent<MissionComponent>();
|
|
|
|
if (missionComponent) missionComponent->CompleteMission(brickLinkMissionID, true);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(PropObjsSpawner));
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::BaseZonePropertyModelPlaced(Entity* self, Entity* player) const {
|
|
|
|
auto* character = player->GetCharacter();
|
|
|
|
if (character == nullptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto flag = self->GetVar<int32_t>(placedModelFlag);
|
|
|
|
if (flag)
|
|
|
|
character->SetPlayerFlag(flag, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::KillClouds(Entity* self) {
|
|
|
|
DeactivateSpawner(self->GetVar<std::string>(DamageFXSpawner));
|
|
|
|
DestroySpawner(self->GetVar<std::string>(DamageFXSpawner));
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::SpawnSpots(Entity* self) {
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(FXSpotsSpawner));
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::KillSpots(Entity* self) {
|
|
|
|
DeactivateSpawner(self->GetVar<std::string>(FXSpotsSpawner));
|
|
|
|
DestroySpawner(self->GetVar<std::string>(FXSpotsSpawner));
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::StartMaelstrom(Entity* self, Entity* player) {
|
|
|
|
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
|
|
|
ActivateSpawner(enemySpawner);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const auto& behaviorObjectSpawner : self->GetVar<std::vector<std::string>>(BehaviorObjsSpawner)) {
|
|
|
|
ActivateSpawner(behaviorObjectSpawner);
|
|
|
|
}
|
|
|
|
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(DamageFXSpawner));
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(GeneratorSpawner));
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(GeneratorFXSpawner));
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(FXManagerSpawner));
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(ImageOrbSpawner));
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(SmashablesSpawner));
|
|
|
|
|
|
|
|
DestroySpawner(self->GetVar<std::string>(ClaimMarkerSpawner));
|
|
|
|
|
|
|
|
for (const auto& ambientFXSpawner : self->GetVar<std::vector<std::string>>(AmbientFXSpawner)) {
|
|
|
|
DestroySpawner(ambientFXSpawner);
|
|
|
|
}
|
|
|
|
|
|
|
|
StartTornadoFx(self);
|
|
|
|
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"maelstromSkyOn", 0, 0, LWOOBJID_EMPTY,
|
|
|
|
"", player->GetSystemAddress());
|
|
|
|
|
|
|
|
self->AddTimer(StartGeneratorTimer, 0.0f);
|
|
|
|
self->AddTimer(StartOrbTimer, 0.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::StartTornadoFx(Entity* self) const {
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto entities = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (entities.empty()) {
|
|
|
|
self->AddTimer("pollTornadoFX", 0.1f);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto* entity : entities) {
|
|
|
|
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
|
|
|
if (renderComponent != nullptr) {
|
|
|
|
renderComponent->PlayEffect(-1, u"debrisOn", "TornadoDebris");
|
|
|
|
renderComponent->PlayEffect(-1, u"VortexOn", "TornadoVortex");
|
|
|
|
renderComponent->PlayEffect(-1, u"onSilhouette", "silhouette");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::BasePlayerExit(Entity* self, Entity* player) {
|
|
|
|
if (self->GetBoolean(UnclaimedVariable)) {
|
|
|
|
if (player->GetObjectID() == self->GetVar<LWOOBJID>(PlayerIDVariable)) {
|
|
|
|
// Destroy all spawners
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::KillGuard(Entity* self) {
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto entities = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(GuardGroup));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (entities.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
DeactivateSpawner(self->GetVar<std::string>(PropertyMGSpawner));
|
|
|
|
|
|
|
|
auto* guard = entities[0];
|
|
|
|
guard->Smash(self->GetObjectID());
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::RequestDie(Entity* self, Entity* other) {
|
|
|
|
auto* destroyable = other->GetComponent<DestroyableComponent>();
|
|
|
|
if (destroyable == nullptr)
|
|
|
|
return;
|
|
|
|
|
2023-05-02 22:39:21 +00:00
|
|
|
destroyable->Smash(other->GetObjectID(), eKillType::SILENT);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::ActivateSpawner(const std::string& spawnerName) {
|
2023-07-17 22:55:33 +00:00
|
|
|
for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) {
|
2021-12-05 17:54:36 +00:00
|
|
|
spawner->Activate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::DeactivateSpawner(const std::string& spawnerName) {
|
2023-07-17 22:55:33 +00:00
|
|
|
for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) {
|
2021-12-05 17:54:36 +00:00
|
|
|
spawner->Deactivate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::TriggerSpawner(const std::string& spawnerName) {
|
2023-07-17 22:55:33 +00:00
|
|
|
for (auto* spawner : Game::zoneManager->GetSpawnersInGroup(spawnerName)) {
|
2021-12-05 17:54:36 +00:00
|
|
|
spawner->Spawn();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::ResetSpawner(const std::string& spawnerName) {
|
2023-07-17 22:55:33 +00:00
|
|
|
for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) {
|
2021-12-05 17:54:36 +00:00
|
|
|
spawner->Reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::DestroySpawner(const std::string& spawnerName) {
|
2023-07-17 22:55:33 +00:00
|
|
|
for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) {
|
2023-03-25 10:26:39 +00:00
|
|
|
if (!spawner) return;
|
|
|
|
spawner->DestroyAllEntities();
|
2021-12-05 17:54:36 +00:00
|
|
|
spawner->Deactivate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LWOOBJID BasePropertyServer::GetOwner() {
|
|
|
|
auto* manager = PropertyManagementComponent::Instance();
|
|
|
|
return manager == nullptr ? LWOOBJID_EMPTY : manager->GetOwnerId();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::BaseTimerDone(Entity* self, const std::string& timerName) {
|
|
|
|
if (timerName == StartGeneratorTimer) {
|
|
|
|
HandleGeneratorTimer(self);
|
|
|
|
} else if (timerName == StartOrbTimer) {
|
|
|
|
HandleOrbsTimer(self);
|
|
|
|
} else if (timerName == StartQuickbuildTimer) {
|
|
|
|
HandleQuickBuildTimer(self);
|
|
|
|
} else if (timerName == "GuardFlyAway") {
|
2023-07-17 22:55:33 +00:00
|
|
|
const auto zoneId = Game::zoneManager->GetZone()->GetWorldID();
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// No guard for the spider instance fight
|
2023-07-17 22:55:33 +00:00
|
|
|
if (Game::zoneManager->GetZoneID().GetMapID() == 1150)
|
2021-12-05 17:54:36 +00:00
|
|
|
return;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto entities = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(GuardGroup));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (entities.empty())
|
|
|
|
return;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* guard = entities[0];
|
2023-07-15 20:56:33 +00:00
|
|
|
GameMessages::SendNotifyClientObject(Game::entityManager->GetZoneControlEntity()->GetObjectID(),
|
2021-12-05 17:54:36 +00:00
|
|
|
u"GuardChat", 0, 0, guard->GetObjectID(),
|
|
|
|
"", UNASSIGNED_SYSTEM_ADDRESS);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer(KillGuardTimer, 5.0f);
|
|
|
|
} else if (timerName == KillGuardTimer) {
|
|
|
|
KillGuard(self);
|
|
|
|
} else if (timerName == TornadoOffTimer) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto fxManagers = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* fxManager : fxManagers) {
|
|
|
|
auto* renderComponent = fxManager->GetComponent<RenderComponent>();
|
|
|
|
if (renderComponent != nullptr) {
|
|
|
|
renderComponent->StopEffect("TornadoDebris", false);
|
|
|
|
renderComponent->StopEffect("TornadoVortex", false);
|
|
|
|
renderComponent->StopEffect("silhouette", false);
|
|
|
|
}
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer(ShowClearEffectsTimer, 2);
|
|
|
|
} else if (timerName == ShowClearEffectsTimer) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto fxManagers = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* fxManager : fxManagers) {
|
|
|
|
auto* renderComponent = fxManager->GetComponent<RenderComponent>();
|
|
|
|
if (renderComponent != nullptr)
|
|
|
|
renderComponent->PlayEffect(-1, u"beamOn", "beam");
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer(KillStrombiesTimer, 2.0f);
|
|
|
|
self->AddTimer(TurnSkyOffTimer, 1.5f);
|
|
|
|
self->AddTimer(KillFXObjectTimer, 8.0f);
|
|
|
|
} else if (timerName == TurnSkyOffTimer) {
|
2023-07-17 22:55:33 +00:00
|
|
|
auto* controller = Game::zoneManager->GetZoneControlObject();
|
2021-12-05 17:54:36 +00:00
|
|
|
GameMessages::SendNotifyClientObject(controller->GetObjectID(), u"SkyOff", 0, 0,
|
|
|
|
LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
|
|
|
} else if (timerName == KillStrombiesTimer) {
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto enemies = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(EnemiesGroup));
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* enemy : enemies) {
|
|
|
|
RequestDie(self, enemy);
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
DestroySpawner(self->GetVar<std::string>(SmashablesSpawner));
|
|
|
|
KillSpots(self);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (player == nullptr)
|
|
|
|
return;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
GameMessages::SendStop2DAmbientSound(player, true, GUIDMaelstrom);
|
|
|
|
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer(ShowVendorTimer, 5.0f);
|
|
|
|
} else if (timerName == KillMarkerTimer) {
|
|
|
|
DestroySpawner(self->GetVar<std::string>(ClaimMarkerSpawner));
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (const auto& behaviorObjectSpawner : self->GetVar<std::vector<std::string>>(BehaviorObjsSpawner)) {
|
|
|
|
DestroySpawner(behaviorObjectSpawner);
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
for (auto* entity : Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(ImagOrbGroup))) {
|
2021-12-05 17:54:36 +00:00
|
|
|
entity->Smash();
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
DestroySpawner(self->GetVar<std::string>(ImageOrbSpawner));
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer(ShowVendorTimer, 1.0f);
|
|
|
|
} else if (timerName == ShowVendorTimer) {
|
2023-07-15 20:56:33 +00:00
|
|
|
GameMessages::SendNotifyClientObject(Game::entityManager->GetZoneControlEntity()->GetObjectID(),
|
2021-12-05 17:54:36 +00:00
|
|
|
u"vendorOn", 0, 0, LWOOBJID_EMPTY, "",
|
|
|
|
UNASSIGNED_SYSTEM_ADDRESS);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (const auto& ambientFXSpawner : self->GetVar<std::vector<std::string>>(AmbientFXSpawner)) {
|
|
|
|
ActivateSpawner(ambientFXSpawner);
|
|
|
|
}
|
|
|
|
} else if (timerName == BoundsVisOnTimer) {
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"boundsAnim", 0, 0,
|
|
|
|
LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
|
|
|
} else if (timerName == RunPlayerLoadedAgainTimer) {
|
|
|
|
CheckForOwner(self);
|
|
|
|
} else if (timerName == PollTornadoFXTimer) {
|
|
|
|
StartTornadoFx(self);
|
|
|
|
} else if (timerName == KillFXObjectTimer) {
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto fxManagers = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (fxManagers.empty()) {
|
|
|
|
self->AddTimer(KillFXObjectTimer, 1.0f);
|
|
|
|
return;
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* fxManager : fxManagers) {
|
|
|
|
auto* renderComponent = fxManager->GetComponent<RenderComponent>();
|
|
|
|
if (renderComponent != nullptr) {
|
|
|
|
renderComponent->StopEffect("beam");
|
|
|
|
}
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
DestroySpawner(self->GetVar<std::string>(FXManagerSpawner));
|
|
|
|
self->SetVar<bool>(u"FXObjectGone", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::HandleOrbsTimer(Entity* self) {
|
|
|
|
self->SetVar<bool>(CollidedVariable, false);
|
2023-07-15 20:56:33 +00:00
|
|
|
auto orbs = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(ImagOrbGroup));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (orbs.empty()) {
|
|
|
|
self->AddTimer(StartOrbTimer, 0.5f);
|
|
|
|
return;
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* orb : orbs) {
|
|
|
|
orb->AddCollisionPhantomCallback([self, this](Entity* other) {
|
|
|
|
if (other != nullptr && other->IsPlayer() && !self->GetVar<bool>(CollidedVariable)) {
|
|
|
|
self->SetVar<bool>(CollidedVariable, true);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
KillClouds(self);
|
|
|
|
DeactivateSpawner(self->GetVar<std::string>(GeneratorSpawner));
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
|
|
|
DeactivateSpawner(enemySpawner);
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
DestroySpawner(self->GetVar<std::string>(GeneratorFXSpawner));
|
2023-07-15 20:56:33 +00:00
|
|
|
GameMessages::SendNotifyClientObject(Game::entityManager->GetZoneControlEntity()->GetObjectID(),
|
2021-12-05 17:54:36 +00:00
|
|
|
u"PlayCinematic", 0, 0, LWOOBJID_EMPTY,
|
|
|
|
"DestroyMaelstrom", UNASSIGNED_SYSTEM_ADDRESS);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// Notifies the client that the property has been claimed with a flag, completes missions too
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (player != nullptr) {
|
|
|
|
auto* character = player->GetCharacter();
|
|
|
|
if (character != nullptr) {
|
2023-05-02 22:39:21 +00:00
|
|
|
character->SetPlayerFlag(self->GetVar<int32_t>(defeatedProperyFlag), true);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer(TornadoOffTimer, 0.5f);
|
|
|
|
self->AddTimer(KillMarkerTimer, 0.7f);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::HandleGeneratorTimer(Entity* self) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto generators = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(GeneratorGroup));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (generators.empty()) {
|
|
|
|
self->AddTimer(StartGeneratorTimer, 0.5f);
|
|
|
|
return;
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* generator : generators) {
|
|
|
|
generator->AddDieCallback([self, this]() {
|
|
|
|
ActivateSpawner(self->GetVar<std::string>(ClaimMarkerSpawner));
|
|
|
|
self->AddTimer(StartQuickbuildTimer, 0.0f);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (const auto& enemySpawner : self->GetVar<std::vector<std::string>>(EnemiesSpawner)) {
|
|
|
|
DeactivateSpawner(enemySpawner);
|
|
|
|
}
|
|
|
|
DeactivateSpawner(self->GetVar<std::string>(GeneratorSpawner));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BasePropertyServer::HandleQuickBuildTimer(Entity* self) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto claimMarkers = Game::entityManager->GetEntitiesInGroup(self->GetVar<std::string>(ClaimMarkerGroup));
|
2021-12-05 17:54:36 +00:00
|
|
|
if (claimMarkers.empty()) {
|
|
|
|
self->AddTimer(StartQuickbuildTimer, 0.5f);
|
|
|
|
return;
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto* claimMarker : claimMarkers) {
|
|
|
|
// TODO: Send password?
|
|
|
|
}
|
|
|
|
}
|