mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Organize dScripts (#814)
* Organize dScripts whitespace Remove parent scope Remove parent scope from initial setter Remove debug Remove helper programs * Fix NtImagimeterVisibility script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
This commit is contained in:
3
dScripts/02_server/Map/Property/AG_Med/CMakeLists.txt
Normal file
3
dScripts/02_server/Map/Property/AG_Med/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_AG_MED
|
||||
"ZoneAgMedProperty.cpp"
|
||||
PARENT_SCOPE)
|
42
dScripts/02_server/Map/Property/AG_Med/ZoneAgMedProperty.cpp
Normal file
42
dScripts/02_server/Map/Property/AG_Med/ZoneAgMedProperty.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "ZoneAgMedProperty.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void ZoneAgMedProperty::SetGameVariables(Entity* self) {
|
||||
|
||||
self->SetVar<std::string>(ClaimMarkerGroup, "ClaimMarker");
|
||||
self->SetVar<std::string>(GeneratorGroup, "Generator");
|
||||
self->SetVar<std::string>(GuardGroup, "Guard");
|
||||
self->SetVar<std::string>(PropertyPlaqueGroup, "PropertyPlaque");
|
||||
self->SetVar<std::string>(PropertyVendorGroup, "PropertyVendor");
|
||||
self->SetVar<std::string>(SpotsGroup, "Spots");
|
||||
self->SetVar<std::string>(MSCloudsGroup, "maelstrom");
|
||||
self->SetVar<std::string>(EnemiesGroup, "Enemies");
|
||||
self->SetVar<std::string>(FXManagerGroup, "FXObject");
|
||||
self->SetVar<std::string>(ImagOrbGroup, "Orb");
|
||||
self->SetVar<std::string>(GeneratorFXGroup, "GeneratorFX");
|
||||
|
||||
self->SetVar<std::vector<std::string>>(EnemiesSpawner, {
|
||||
"StrombieWander", "Strombies", "Mechs", "OtherEnemy"
|
||||
});
|
||||
self->SetVar<std::string>(ClaimMarkerSpawner, "ClaimMarker");
|
||||
self->SetVar<std::string>(GeneratorSpawner, "Generator");
|
||||
self->SetVar<std::string>(DamageFXSpawner, "MaelstromFX");
|
||||
self->SetVar<std::string>(FXSpotsSpawner, "MaelstromSpots");
|
||||
self->SetVar<std::string>(PropertyMGSpawner, "PropertyGuard");
|
||||
self->SetVar<std::string>(ImageOrbSpawner, "Orb");
|
||||
self->SetVar<std::string>(GeneratorFXSpawner, "GeneratorFX");
|
||||
self->SetVar<std::string>(SmashablesSpawner, "Smashables");
|
||||
self->SetVar<std::string>(FXManagerSpawner, "FXObject");
|
||||
self->SetVar<std::string>(PropObjsSpawner, "BankObj");
|
||||
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, { "BirdFX", "SunBeam" });
|
||||
self->SetVar<std::vector<std::string>>(BehaviorObjsSpawner, {});
|
||||
|
||||
self->SetVar<uint32_t>(defeatedProperyFlag, 118);
|
||||
self->SetVar<uint32_t>(placedModelFlag, 119);
|
||||
self->SetVar<uint32_t>(guardMissionFlag, 1293);
|
||||
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 1294);
|
||||
self->SetVar<std::string>(passwordFlag, "s3kratK1ttN");
|
||||
self->SetVar<LOT>(generatorIdFlag, 10118);
|
||||
self->SetVar<LOT>(orbIDFlag, 10226);
|
||||
self->SetVar<LOT>(behaviorQBID, 10445);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "BasePropertyServer.h"
|
||||
|
||||
class ZoneAgMedProperty : public BasePropertyServer {
|
||||
void SetGameVariables(Entity* self) override;
|
||||
};
|
4
dScripts/02_server/Map/Property/AG_Small/CMakeLists.txt
Normal file
4
dScripts/02_server/Map/Property/AG_Small/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_AG_SMALL
|
||||
"ZoneAgProperty.cpp"
|
||||
"EnemySpiderSpawner.cpp"
|
||||
PARENT_SCOPE)
|
@@ -0,0 +1,72 @@
|
||||
#include "EnemySpiderSpawner.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
//----------------------------------------------
|
||||
//--Initiate egg hatching on call
|
||||
//----------------------------------------------
|
||||
void EnemySpiderSpawner::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == "prepEgg") {
|
||||
// Highlight eggs about to hatch with Maelstrom effect
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 2856, u"maelstrom", "test", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||
|
||||
// Make indestructible
|
||||
auto dest = static_cast<DestroyableComponent*>(self->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
||||
if (dest) {
|
||||
dest->SetFaction(-1);
|
||||
}
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
|
||||
// Keep track of who prepped me
|
||||
self->SetI64(u"SpawnOwner", sender->GetObjectID());
|
||||
|
||||
} else if (args == "hatchEgg") {
|
||||
// Final countdown to pop
|
||||
self->AddTimer("StartSpawnTime", hatchTime);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//--Called when timers are done
|
||||
//----------------------------------------------------------------
|
||||
void EnemySpiderSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "StartSpawnTime") {
|
||||
SpawnSpiderling(self);
|
||||
} else if (timerName == "SpawnSpiderling") {
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 644, u"create", "egg_puff_b", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||
|
||||
//TODO: set the aggro radius larger
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = 16197;
|
||||
info.pos = self->GetPosition();
|
||||
info.spawner = nullptr;
|
||||
info.spawnerID = self->GetI64(u"SpawnOwner");
|
||||
info.spawnerNodeID = 0;
|
||||
|
||||
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
|
||||
if (newEntity) {
|
||||
EntityManager::Instance()->ConstructEntity(newEntity);
|
||||
newEntity->GetGroups().push_back("BabySpider");
|
||||
|
||||
/*
|
||||
auto* movementAi = newEntity->GetComponent<MovementAIComponent>();
|
||||
|
||||
movementAi->SetDestination(newEntity->GetPosition());
|
||||
*/
|
||||
}
|
||||
|
||||
self->ScheduleKillAfterUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//Called when it is finally time to release the Spiderlings
|
||||
//--------------------------------------------------------------
|
||||
void EnemySpiderSpawner::SpawnSpiderling(Entity* self) {
|
||||
//Initiate the actual spawning
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 2260, u"rebuild_medium", "dropdustmedium", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||
self->AddTimer("SpawnSpiderling", spawnTime);
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
/*
|
||||
------------------------------------------------------
|
||||
|
||||
-- L_ENEMY_SPIDER_SPAWNER.lua
|
||||
|
||||
-- Spawns a spider from the egg
|
||||
-- created abeechler... 5/11/11
|
||||
|
||||
-- ported Max 26/07/2020
|
||||
|
||||
------------------------------------------------------
|
||||
*/
|
||||
|
||||
class EnemySpiderSpawner final : public CppScripts::Script {
|
||||
public:
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
private:
|
||||
void SpawnSpiderling(Entity* self);
|
||||
|
||||
private:
|
||||
float hatchTime = 2.0f; //How long after full wave preparation will it take to hatch an egg ?
|
||||
float spawnTime = 2.0f; //Once spawning begins, how long until we create Spiderlings ?
|
||||
};
|
||||
|
424
dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp
Normal file
424
dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp
Normal file
@@ -0,0 +1,424 @@
|
||||
#include "ZoneAgProperty.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Character.h"
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void ZoneAgProperty::SetGameVariables(Entity* self) {
|
||||
self->SetVar<std::string>(GuardGroup, "Guard");
|
||||
self->SetVar<std::string>(PropertyPlaqueGroup, "PropertyPlaque");
|
||||
self->SetVar<std::string>(PropertyVendorGroup, "PropertyVendor");
|
||||
self->SetVar<std::string>(PropertyBorderGroup, "PropertyBorder");
|
||||
self->SetVar<std::string>(LandTargetGroup, "Land_Target");
|
||||
self->SetVar<std::string>(SpiderScreamGroup, "Spider_Scream");
|
||||
self->SetVar<std::vector<std::string>>(ROFTargetsGroup, { "ROF_Targets_00", "ROF_Targets_01", "ROF_Targets_02", "ROF_Targets_03", "ROF_Targets_04" });
|
||||
self->SetVar<std::string>(SpiderEggsGroup, "SpiderEggs");
|
||||
self->SetVar<std::string>(RocksGroup, "Rocks");
|
||||
self->SetVar<std::string>(EnemiesGroup, "SpiderBoss");
|
||||
self->SetVar<std::vector<std::string>>(ZoneVolumesGroup, { "Zone1Vol", "Zone2Vol", "Zone3Vol", "Zone4Vol", "Zone5Vol", "Zone6Vol", "Zone7Vol", "Zone8Vol", "AggroVol", "TeleVol" });
|
||||
self->SetVar<std::string>(FXManagerGroup, "FXObject");
|
||||
|
||||
self->SetVar<std::string>(EnemiesSpawner, "SpiderBoss");
|
||||
self->SetVar<std::vector<std::string>>(BossSensorSpawner, { "Zone1Vol", "Zone2Vol", "Zone3Vol", "Zone4Vol", "Zone5Vol", "Zone6Vol", "Zone7Vol", "Zone8Vol", "RFS_Targets", "AggroVol", "TeleVol" });
|
||||
self->SetVar<std::string>(LandTargetSpawner, "Land_Target");
|
||||
self->SetVar<std::string>(SpiderScreamSpawner, "Spider_Scream");
|
||||
self->SetVar<std::vector<std::string>>(ROFTargetsSpawner, { "ROF_Targets_00", "ROF_Targets_01", "ROF_Targets_02", "ROF_Targets_03", "ROF_Targets_04" });
|
||||
self->SetVar<std::string>(PropertyMGSpawner, "PropertyGuard");
|
||||
self->SetVar<std::string>(FXManagerSpawner, "FXObject");
|
||||
self->SetVar<std::string>(PropObjsSpawner, "BankObj");
|
||||
self->SetVar<std::string>(SpiderEggsSpawner, "SpiderEggs");
|
||||
self->SetVar<std::string>(RocksSpawner, "Rocks");
|
||||
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, { "BirdFX", "SunBeam" });
|
||||
self->SetVar<std::vector<std::string>>(SpiderRocketSpawner, { "SpiderRocket_Bot", "SpiderRocket_Mid", "SpiderRocket_Top" });
|
||||
self->SetVar<std::string>(MailboxSpawner, "Mailbox");
|
||||
self->SetVar<std::string>(LauncherSpawner, "Launcher");
|
||||
self->SetVar<std::string>(InstancerSpawner, "Instancer");
|
||||
|
||||
self->SetVar<uint32_t>(defeatedProperyFlag, 71);
|
||||
self->SetVar<uint32_t>(placedModelFlag, 73);
|
||||
self->SetVar<uint32_t>(guardFirstMissionFlag, 891);
|
||||
self->SetVar<uint32_t>(guardMissionFlag, 320);
|
||||
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 951);
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnStartup(Entity* self) {
|
||||
LoadProperty(self);
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnPlayerLoaded(Entity* self, Entity* player) {
|
||||
CheckForOwner(self);
|
||||
|
||||
auto rented = self->GetVar<LWOOBJID>(u"PropertyOwner") == LWOOBJID_EMPTY;
|
||||
self->SetVar<bool>(u"rented", rented);
|
||||
|
||||
if (!rented) {
|
||||
const auto numberOfPlayers = self->GetVar<int32_t>(u"numberOfPlayers");
|
||||
self->SetVar<int32_t>(u"numberOfPlayers", numberOfPlayers + 1);
|
||||
}
|
||||
|
||||
if (dZoneManager::Instance()->GetZone()->GetZoneID().GetMapID() == 1102) {
|
||||
GameMessages::SendPlay2DAmbientSound(player, GUIDMaelstrom);
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"maelstromSkyOn", 0, 0,
|
||||
LWOOBJID_EMPTY, "", player->GetSystemAddress());
|
||||
|
||||
self->SetNetworkVar(u"unclaimed", true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
BasePlayerLoaded(self, player);
|
||||
}
|
||||
|
||||
void ZoneAgProperty::PropGuardCheck(Entity* self, Entity* player) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
|
||||
const auto state = missionComponent->GetMissionState(self->GetVar<uint32_t>(guardMissionFlag));
|
||||
const auto firstState = missionComponent->GetMissionState(self->GetVar<uint32_t>(guardFirstMissionFlag));
|
||||
|
||||
if (firstState < MissionState::MISSION_STATE_COMPLETE || (state != MissionState::MISSION_STATE_COMPLETE && state != MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE))
|
||||
ActivateSpawner(self->GetVar<std::string>(PropertyMGSpawner));
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZoneLoadedInfo(Entity* self) {
|
||||
LoadProperty(self);
|
||||
}
|
||||
|
||||
void ZoneAgProperty::LoadInstance(Entity* self) {
|
||||
SetGameVariables(self);
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(self->GetVar<std::string>(InstancerSpawner))) {
|
||||
for (auto* spawnerNode : spawner->m_Info.nodes) {
|
||||
spawnerNode->config.push_back(
|
||||
new LDFData<std::string>(u"custom_script_server",
|
||||
R"(scripts\ai\GENERAL\L_INSTANCE_EXIT_TRANSFER_PLAYER_TO_LAST_NON_INSTANCE.lua)"));
|
||||
spawnerNode->config.push_back(new LDFData<std::u16string>(u"transferText", u"SPIDER_QUEEN_EXIT_QUESTION"));
|
||||
}
|
||||
}
|
||||
|
||||
ActivateSpawner(self->GetVar<std::string>(InstancerSpawner));
|
||||
}
|
||||
|
||||
void ZoneAgProperty::LoadProperty(Entity* self) {
|
||||
SetGameVariables(self);
|
||||
ActivateSpawner(self->GetVar<std::string>(LauncherSpawner));
|
||||
ActivateSpawner(self->GetVar<std::string>(MailboxSpawner));
|
||||
}
|
||||
|
||||
void ZoneAgProperty::ProcessGroupObjects(Entity* self, std::string group) {
|
||||
}
|
||||
|
||||
void ZoneAgProperty::SpawnSpots(Entity* self) {
|
||||
for (const auto& spot : self->GetVar<std::vector<std::string>>(ROFTargetsSpawner)) {
|
||||
ActivateSpawner(spot);
|
||||
}
|
||||
|
||||
ActivateSpawner(self->GetVar<std::string>(LandTargetSpawner));
|
||||
}
|
||||
|
||||
void ZoneAgProperty::KillSpots(Entity* self) {
|
||||
for (const auto& spot : self->GetVar<std::vector<std::string>>(ROFTargetsSpawner)) {
|
||||
DeactivateSpawner(spot);
|
||||
}
|
||||
|
||||
for (const auto& groupName : self->GetVar<std::vector<std::string>>(ROFTargetsGroup)) {
|
||||
for (auto* spot : EntityManager::Instance()->GetEntitiesInGroup(groupName)) {
|
||||
spot->Kill();
|
||||
}
|
||||
}
|
||||
|
||||
DeactivateSpawner(self->GetVar<std::string>(LandTargetSpawner));
|
||||
for (auto* landTarget : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetSpawner))) {
|
||||
landTarget->Kill();
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::SpawnCrashedRocket(Entity* self) {
|
||||
for (const auto& rocket : self->GetVar<std::vector<std::string>>(SpiderRocketSpawner)) {
|
||||
ActivateSpawner(rocket);
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::KillCrashedRocket(Entity* self) {
|
||||
for (const auto& rocket : self->GetVar<std::vector<std::string>>(SpiderRocketSpawner)) {
|
||||
DeactivateSpawner(rocket);
|
||||
DestroySpawner(rocket);
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::StartMaelstrom(Entity* self, Entity* player) {
|
||||
ActivateSpawner(self->GetVar<std::string>(EnemiesSpawner));
|
||||
for (const auto& sensor : self->GetVar<std::vector<std::string>>(BossSensorSpawner)) {
|
||||
ActivateSpawner(sensor);
|
||||
}
|
||||
|
||||
ActivateSpawner(self->GetVar<std::string>(FXManagerSpawner));
|
||||
ActivateSpawner(self->GetVar<std::string>(SpiderScreamSpawner));
|
||||
ActivateSpawner(self->GetVar<std::string>(SpiderEggsSpawner));
|
||||
ActivateSpawner(self->GetVar<std::string>(RocksSpawner));
|
||||
|
||||
SpawnCrashedRocket(self);
|
||||
|
||||
for (const auto& ambient : self->GetVar<std::vector<std::string>>(AmbientFXSpawner)) {
|
||||
DeactivateSpawner(ambient);
|
||||
DestroySpawner(ambient);
|
||||
ResetSpawner(ambient);
|
||||
}
|
||||
|
||||
StartTornadoFx(self);
|
||||
|
||||
if (player != nullptr) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"maelstromSkyOn", 0, 0, LWOOBJID_EMPTY,
|
||||
"", player->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ZoneAgProperty::RetrieveSpawnerId(Entity* self, const std::string& spawner) {
|
||||
auto spawnerIDs = dZoneManager::Instance()->GetSpawnersByName(spawner);
|
||||
if (spawnerIDs.empty())
|
||||
return 0;
|
||||
|
||||
return spawnerIDs[0]->m_Info.spawnerID;
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnTimerDone(Entity* self, std::string timerName) {
|
||||
BaseTimerDone(self, timerName);
|
||||
}
|
||||
|
||||
void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) {
|
||||
if (timerName == "GuardFlyAway") {
|
||||
const auto zoneId = dZoneManager::Instance()->GetZone()->GetWorldID();
|
||||
if (zoneId != 1150)
|
||||
return;
|
||||
|
||||
const auto entities = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(GuardGroup));
|
||||
if (entities.empty())
|
||||
return;
|
||||
|
||||
auto* entity = entities[0];
|
||||
|
||||
GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", 0, 0, entity->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
LoadProperty(self);
|
||||
|
||||
self->AddTimer("KillGuard", 5);
|
||||
} else if (timerName == "KillGuard") {
|
||||
KillGuard(self);
|
||||
} else if (timerName == "tornadoOff") {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("TornadoDebris", false);
|
||||
renderComponent->StopEffect("TornadoVortex", false);
|
||||
renderComponent->StopEffect("silhouette", false);
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer("ShowVendor", 1.2f);
|
||||
self->AddTimer("ShowClearEffects", 2);
|
||||
} else if (timerName == "ShowClearEffects") {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->PlayEffect(-1, u"beamOn", "beam");
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer("killSpider", 2);
|
||||
self->AddTimer("turnSkyOff", 1.5f);
|
||||
self->AddTimer("killFXObject", 8);
|
||||
} else if (timerName == "turnSkyOff") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SkyOff", 0, 0, LWOOBJID_EMPTY,
|
||||
"", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
} else if (timerName == "killSpider") {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(EnemiesGroup))) {
|
||||
entity->Kill();
|
||||
}
|
||||
|
||||
for (const auto& sensor : self->GetVar<std::vector<std::string>>(BossSensorSpawner)) {
|
||||
DeactivateSpawner(sensor);
|
||||
DestroySpawner(sensor);
|
||||
}
|
||||
|
||||
DeactivateSpawner(self->GetVar<std::string>(SpiderEggsSpawner));
|
||||
DestroySpawner(self->GetVar<std::string>(SpiderEggsSpawner));
|
||||
|
||||
DeactivateSpawner(self->GetVar<std::string>(RocksSpawner));
|
||||
DestroySpawner(self->GetVar<std::string>(RocksSpawner));
|
||||
|
||||
KillSpots(self);
|
||||
KillCrashedRocket(self);
|
||||
|
||||
DeactivateSpawner(self->GetVar<std::string>(SpiderScreamSpawner));
|
||||
DestroySpawner(self->GetVar<std::string>(SpiderScreamSpawner));
|
||||
|
||||
for (auto* player : EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CHARACTER)) {
|
||||
GameMessages::SendStop2DAmbientSound(player, true, GUIDMaelstrom);
|
||||
GameMessages::SendPlay2DAmbientSound(player, GUIDPeaceful);
|
||||
}
|
||||
} else if (timerName == "ShowVendor") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"vendorOn", 0, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
for (const auto& ambient : self->GetVar<std::vector<std::string>>(AmbientFXSpawner)) {
|
||||
ActivateSpawner(ambient);
|
||||
}
|
||||
} else if (timerName == "BoundsVisOn") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"boundsAnim", 0, 0,
|
||||
LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
} else if (timerName == "runPlayerLoadedAgain") {
|
||||
CheckForOwner(self);
|
||||
} else if (timerName == "pollTornadoFX") {
|
||||
StartTornadoFx(self);
|
||||
} else if (timerName == "killFXObject") {
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(FXManagerGroup))) {
|
||||
auto* renderComponent = entity->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("beam");
|
||||
}
|
||||
}
|
||||
|
||||
DestroySpawner(self->GetVar<std::string>(FXManagerSpawner));
|
||||
|
||||
self->SetVar<bool>(u"FXObjectGone", true);
|
||||
} else if (timerName == "ProcessGroupObj") {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyRented(Entity* self, Entity* player) {
|
||||
BaseZonePropertyRented(self, player);
|
||||
|
||||
auto* character = player->GetCharacter();
|
||||
if (character == nullptr)
|
||||
return;
|
||||
|
||||
character->SetPlayerFlag(108, true);
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyModelPlaced(Entity* self, Entity* player) {
|
||||
auto* character = player->GetCharacter();
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (!character->GetPlayerFlag(101)) {
|
||||
BaseZonePropertyModelPlaced(self, player);
|
||||
character->SetPlayerFlag(101, true);
|
||||
if (missionComponent->GetMissionState(871) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
self->SetNetworkVar<std::u16string>(u"Tooltip", u"AnotherModel");
|
||||
}
|
||||
|
||||
} else if (!character->GetPlayerFlag(102)) {
|
||||
character->SetPlayerFlag(102, true);
|
||||
if (missionComponent->GetMissionState(871) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
self->SetNetworkVar<std::u16string>(u"Tooltip", u"TwoMoreModels");
|
||||
}
|
||||
|
||||
} else if (!character->GetPlayerFlag(103)) {
|
||||
character->SetPlayerFlag(103, true);
|
||||
} else if (!character->GetPlayerFlag(104)) {
|
||||
character->SetPlayerFlag(104, true);
|
||||
self->SetNetworkVar<std::u16string>(u"Tooltip", u"TwoMoreModelsOff");
|
||||
} else if (self->GetVar<std::string>(u"tutorial") == "place_model") {
|
||||
self->SetVar<std::string>(u"tutorial", "");
|
||||
self->SetNetworkVar<std::u16string>(u"Tooltip", u"PutAway");
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyModelPickedUp(Entity* self, Entity* player) {
|
||||
auto* character = player->GetCharacter();
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (!character->GetPlayerFlag(109)) {
|
||||
character->SetPlayerFlag(109, true);
|
||||
if (missionComponent->GetMissionState(891) == MissionState::MISSION_STATE_ACTIVE && !character->GetPlayerFlag(110)) {
|
||||
self->SetNetworkVar<std::u16string>(u"Tooltip", u"Rotate");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyModelRemoved(Entity* self, Entity* player) {
|
||||
auto* character = player->GetCharacter();
|
||||
character->SetPlayerFlag(111, true);
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyModelRemovedWhileEquipped(Entity* self, Entity* player) {
|
||||
ZoneAgProperty::OnZonePropertyModelRemoved(self, player);
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyModelRotated(Entity* self, Entity* player) {
|
||||
auto* character = player->GetCharacter();
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (!character->GetPlayerFlag(110)) {
|
||||
character->SetPlayerFlag(110, true);
|
||||
|
||||
if (missionComponent->GetMissionState(891) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
self->SetNetworkVar<std::u16string>(u"Tooltip", u"PlaceModel");
|
||||
self->SetVar<std::string>(u"tutorial", "place_model");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyModelEquipped(Entity* self) {
|
||||
self->SetNetworkVar<std::u16string>(u"PlayerAction", u"ModelEquipped");
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyEditBegin(Entity* self) {
|
||||
self->SetNetworkVar<std::u16string>(u"PlayerAction", u"Enter");
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnZonePropertyEditEnd(Entity* self) {
|
||||
self->SetNetworkVar<std::u16string>(u"PlayerAction", u"Exit");
|
||||
}
|
||||
|
||||
void ZoneAgProperty::OnPlayerExit(Entity* self) {
|
||||
// TODO: Destroy stuff
|
||||
}
|
||||
|
||||
void ZoneAgProperty::RemovePlayerRef(Entity* self) {
|
||||
// TODO: Destroy stuff
|
||||
}
|
||||
|
||||
void ZoneAgProperty::BaseOnFireEventServerSide(Entity* self, Entity* sender, std::string args) {
|
||||
if (args == "propertyRented") {
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"playerID");
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
OnZonePropertyRented(self, player);
|
||||
} else if (args == "RetrieveZoneData") {
|
||||
self->SetVar<LWOOBJID>(u"SpiderBossID", sender->GetObjectID());
|
||||
sender->SetVar<int32_t>(u"SpiderEggNetworkID", RetrieveSpawnerId(self, self->GetVar<std::string>(SpiderEggsSpawner)));
|
||||
|
||||
std::vector<uint32_t> table;
|
||||
|
||||
for (const auto& target : self->GetVar<std::vector<std::string>>(ROFTargetsSpawner)) {
|
||||
table.push_back(RetrieveSpawnerId(self, target));
|
||||
}
|
||||
|
||||
ROFTargetGroupIdTable = table;
|
||||
|
||||
ProcessGroupObjects(self, self->GetVar<std::string>(LandTargetGroup));
|
||||
ProcessGroupObjects(self, self->GetVar<std::string>(SpiderScreamGroup));
|
||||
// ProcessGroupObjects(self, groups.ZoneVolumes);
|
||||
} else if (args == "CheckForPropertyOwner") {
|
||||
sender->SetNetworkVar<std::string>(u"PropertyOwnerID", std::to_string(self->GetVar<LWOOBJID>(u"PropertyOwner")));
|
||||
} else if (args == "ClearProperty") {
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"playerID");
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
player->GetCharacter()->SetPlayerFlag(self->GetVar<uint32_t>(defeatedProperyFlag), true);
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PlayCinematic", 0, 0,
|
||||
LWOOBJID_EMPTY, destroyedCinematic, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
self->AddTimer("tornadoOff", 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::NotifyDie(Entity* self) {
|
||||
// TODO
|
||||
}
|
66
dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.h
Normal file
66
dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
#include "BasePropertyServer.h"
|
||||
|
||||
class ZoneAgProperty : public BasePropertyServer {
|
||||
public:
|
||||
void SetGameVariables(Entity* self) override;
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnPlayerLoaded(Entity* self, Entity* player) override;
|
||||
void OnZoneLoadedInfo(Entity* self);
|
||||
void OnZonePropertyRented(Entity* self, Entity* player) override;
|
||||
void OnZonePropertyModelPlaced(Entity* self, Entity* player) override;
|
||||
void OnZonePropertyModelPickedUp(Entity* self, Entity* player) override;
|
||||
void OnZonePropertyModelRemoved(Entity* self, Entity* player) override;
|
||||
void OnZonePropertyModelRemovedWhileEquipped(Entity* self, Entity* player) override;
|
||||
void OnZonePropertyModelRotated(Entity* self, Entity* player) override;
|
||||
void OnZonePropertyEditBegin(Entity* self) override;
|
||||
void OnZonePropertyModelEquipped(Entity* self) override;
|
||||
void OnZonePropertyEditEnd(Entity* self) override;
|
||||
void OnPlayerExit(Entity* self);
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override {
|
||||
BaseOnFireEventServerSide(self, sender, args);
|
||||
}
|
||||
virtual void BaseOnFireEventServerSide(Entity* self, Entity* sender, std::string args);
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
void BaseTimerDone(Entity* self, const std::string& timerName) override;
|
||||
|
||||
void PropGuardCheck(Entity* self, Entity* player) override;
|
||||
void LoadInstance(Entity* self);
|
||||
void LoadProperty(Entity* self);
|
||||
|
||||
void ProcessGroupObjects(Entity* self, std::string group);
|
||||
|
||||
void SpawnSpots(Entity* self) override;
|
||||
void KillSpots(Entity* self) override;
|
||||
void StartMaelstrom(Entity* self, Entity* player) override;
|
||||
void SpawnCrashedRocket(Entity* self);
|
||||
void KillCrashedRocket(Entity* self);
|
||||
|
||||
uint32_t RetrieveSpawnerId(Entity* self, const std::string& spawner);
|
||||
|
||||
void NotifyDie(Entity* self);
|
||||
void RemovePlayerRef(Entity* self);
|
||||
protected:
|
||||
std::string destroyedCinematic = "DestroyMaelstrom";
|
||||
std::vector<uint32_t> ROFTargetGroupIdTable{};
|
||||
std::u16string LandTargetGroup = u"LandTargetGroup";
|
||||
std::u16string SpiderScreamGroup = u"SpiderScreamGroup";
|
||||
std::u16string ROFTargetsGroup = u"ROFTargetsGroup";
|
||||
std::u16string SpiderEggsGroup = u"SpiderEggsGroup";
|
||||
std::u16string RocksGroup = u"RocksGroup";
|
||||
std::u16string ZoneVolumesGroup = u"ZoneVolumesGroup";
|
||||
|
||||
std::u16string EnemiesSpawner = u"EnemiesSpawner";
|
||||
std::u16string BossSensorSpawner = u"BossSensorSpawner";
|
||||
std::u16string LandTargetSpawner = u"LandTargetSpawner";
|
||||
std::u16string SpiderScreamSpawner = u"SpiderScreamSpawner";
|
||||
std::u16string ROFTargetsSpawner = u"ROFTargetsSpawner";
|
||||
std::u16string SpiderEggsSpawner = u"SpiderEggsSpawner";
|
||||
std::u16string RocksSpawner = u"RocksSpawner";
|
||||
std::u16string SpiderRocketSpawner = u"SpiderRocketSpawner";
|
||||
std::u16string MailboxSpawner = u"MailboxSpawner";
|
||||
std::u16string LauncherSpawner = u"LauncherSpawner";
|
||||
std::u16string InstancerSpawner = u"InstancerSpawner";
|
||||
};
|
22
dScripts/02_server/Map/Property/CMakeLists.txt
Normal file
22
dScripts/02_server/Map/Property/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY
|
||||
"PropertyBankInteract.cpp")
|
||||
|
||||
add_subdirectory(AG_Med)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_AG_MED})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} "AG_Med/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(AG_Small)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_AG_SMALL})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} "AG_Small/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(NS_Med)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_NS_MED})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} "NS_Med/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} PARENT_SCOPE)
|
3
dScripts/02_server/Map/Property/NS_Med/CMakeLists.txt
Normal file
3
dScripts/02_server/Map/Property/NS_Med/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_NS_MED
|
||||
"ZoneNsMedProperty.cpp"
|
||||
PARENT_SCOPE)
|
40
dScripts/02_server/Map/Property/NS_Med/ZoneNsMedProperty.cpp
Normal file
40
dScripts/02_server/Map/Property/NS_Med/ZoneNsMedProperty.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "ZoneNsMedProperty.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void ZoneNsMedProperty::SetGameVariables(Entity* self) {
|
||||
self->SetVar<std::string>(ClaimMarkerGroup, "ClaimMarker");
|
||||
self->SetVar<std::string>(GeneratorGroup, "Generator");
|
||||
self->SetVar<std::string>(GuardGroup, "Guard");
|
||||
self->SetVar<std::string>(PropertyPlaqueGroup, "PropertyPlaque");
|
||||
self->SetVar<std::string>(PropertyVendorGroup, "PropertyVendor");
|
||||
self->SetVar<std::string>(SpotsGroup, "Spots");
|
||||
self->SetVar<std::string>(MSCloudsGroup, "maelstrom");
|
||||
self->SetVar<std::string>(EnemiesGroup, "Enemies");
|
||||
self->SetVar<std::string>(FXManagerGroup, "FXObject");
|
||||
self->SetVar<std::string>(ImagOrbGroup, "Orb");
|
||||
self->SetVar<std::string>(GeneratorFXGroup, "GeneratorFX");
|
||||
|
||||
self->SetVar<std::vector<std::string>>(EnemiesSpawner,
|
||||
{ "Admirals", "AdmiralsWander", "Mechs", "Ronin", "RoninWander" });
|
||||
self->SetVar<std::string>(ClaimMarkerSpawner, "ClaimMarker");
|
||||
self->SetVar<std::string>(GeneratorSpawner, "Generator");
|
||||
self->SetVar<std::string>(DamageFXSpawner, "MaelstromFX");
|
||||
self->SetVar<std::string>(FXSpotsSpawner, "MaelstromSpots");
|
||||
self->SetVar<std::string>(PropertyMGSpawner, "PropertyGuard");
|
||||
self->SetVar<std::string>(ImageOrbSpawner, "Orb");
|
||||
self->SetVar<std::string>(GeneratorFXSpawner, "GeneratorFX");
|
||||
self->SetVar<std::string>(SmashablesSpawner, "Smashables");
|
||||
self->SetVar<std::string>(FXManagerSpawner, "FXObject");
|
||||
self->SetVar<std::string>(PropObjsSpawner, "BankObj");
|
||||
self->SetVar<std::vector<std::string>>(AmbientFXSpawner, { "Rockets" });
|
||||
self->SetVar<std::vector<std::string>>(BehaviorObjsSpawner, { });
|
||||
|
||||
self->SetVar<uint32_t>(defeatedProperyFlag, 122);
|
||||
self->SetVar<uint32_t>(placedModelFlag, 123);
|
||||
self->SetVar<uint32_t>(guardMissionFlag, 1322);
|
||||
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 1294);
|
||||
self->SetVar<std::string>(passwordFlag, "s3kratK1ttN");
|
||||
self->SetVar<LOT>(generatorIdFlag, 11031);
|
||||
self->SetVar<LOT>(orbIDFlag, 10226);
|
||||
self->SetVar<LOT>(behaviorQBID, 10445);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "BasePropertyServer.h"
|
||||
|
||||
class ZoneNsMedProperty : public BasePropertyServer {
|
||||
void SetGameVariables(Entity* self) override;
|
||||
};
|
43
dScripts/02_server/Map/Property/PropertyBankInteract.cpp
Normal file
43
dScripts/02_server/Map/Property/PropertyBankInteract.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "PropertyBankInteract.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void PropertyBankInteract::OnStartup(Entity* self) {
|
||||
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||
if (zoneControl != nullptr) {
|
||||
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyBankInteract::OnPlayerLoaded(Entity* self, Entity* player) {
|
||||
auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||
if (zoneControl != nullptr) {
|
||||
zoneControl->OnFireEventServerSide(self, "CheckForPropertyOwner");
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyBankInteract::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
AMFArrayValue args;
|
||||
auto* value = new AMFStringValue();
|
||||
value->SetStringValue("bank");
|
||||
args.InsertValue("state", value);
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"OpenBank", 0, 0, LWOOBJID_EMPTY,
|
||||
"", user->GetSystemAddress());
|
||||
}
|
||||
|
||||
void PropertyBankInteract::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == "ToggleBank") {
|
||||
AMFArrayValue amfArgs;
|
||||
amfArgs.InsertValue("visible", new AMFFalseValue());
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", &amfArgs);
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"CloseBank", 0, 0, LWOOBJID_EMPTY,
|
||||
"", sender->GetSystemAddress());
|
||||
}
|
||||
}
|
10
dScripts/02_server/Map/Property/PropertyBankInteract.h
Normal file
10
dScripts/02_server/Map/Property/PropertyBankInteract.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class PropertyBankInteract : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnPlayerLoaded(Entity* self, Entity* player) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
};
|
Reference in New Issue
Block a user