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:
4
dScripts/02_server/Map/AG_Spider_Queen/CMakeLists.txt
Normal file
4
dScripts/02_server/Map/AG_Spider_Queen/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN
|
||||
"ZoneAgSpiderQueen.cpp"
|
||||
"SpiderBossTreasureChestServer.cpp"
|
||||
PARENT_SCOPE)
|
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#include "MinigameTreasureChestServer.h"
|
||||
|
||||
class SpiderBossTreasureChestServer : public MinigameTreasureChestServer {
|
||||
};
|
83
dScripts/02_server/Map/AG_Spider_Queen/ZoneAgSpiderQueen.cpp
Normal file
83
dScripts/02_server/Map/AG_Spider_Queen/ZoneAgSpiderQueen.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "ZoneAgSpiderQueen.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "ZoneAgProperty.h"
|
||||
#include "DestroyableComponent.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<uint32_t>(guardFirstMissionFlag, 0);
|
||||
self->SetVar<uint32_t>(guardMissionFlag, 0);
|
||||
self->SetVar<uint32_t>(brickLinkMissionIDFlag, 0);
|
||||
}
|
||||
|
||||
void ZoneAgSpiderQueen::OnStartup(Entity* self) {
|
||||
LoadInstance(self);
|
||||
|
||||
SpawnSpots(self);
|
||||
StartMaelstrom(self, nullptr);
|
||||
}
|
||||
|
||||
void ZoneAgSpiderQueen::BasePlayerLoaded(Entity* self, Entity* player) {
|
||||
ActivityManager::UpdatePlayer(self, player->GetObjectID());
|
||||
ActivityManager::TakeActivityCost(self, player->GetObjectID());
|
||||
|
||||
// Make sure the player has full stats when they join
|
||||
auto* playerDestroyableComponent = player->GetComponent<DestroyableComponent>();
|
||||
if (playerDestroyableComponent != nullptr) {
|
||||
playerDestroyableComponent->SetImagination(playerDestroyableComponent->GetMaxImagination());
|
||||
playerDestroyableComponent->SetArmor(playerDestroyableComponent->GetMaxArmor());
|
||||
playerDestroyableComponent->SetHealth(playerDestroyableComponent->GetMaxHealth());
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"unclaimed", true);
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"maelstromSkyOn", 0, 0, LWOOBJID_EMPTY,
|
||||
"", player->GetSystemAddress());
|
||||
}
|
||||
|
||||
void
|
||||
ZoneAgSpiderQueen::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args == "ClearProperty") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PlayCinematic", 0, 0,
|
||||
LWOOBJID_EMPTY, destroyedCinematic, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
self->AddTimer("tornadoOff", 0.5f);
|
||||
} else {
|
||||
ZoneAgProperty::BaseOnFireEventServerSide(self, sender, args);
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgSpiderQueen::OnPlayerExit(Entity* self, Entity* player) {
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
}
|
||||
|
||||
void ZoneAgSpiderQueen::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
// Disable some stuff from the regular property
|
||||
if (timerName == "BoundsVisOn" || timerName == "GuardFlyAway" || timerName == "ShowVendor")
|
||||
return;
|
||||
|
||||
if (timerName == "killSpider") {
|
||||
auto spawnTargets = EntityManager::Instance()->GetEntitiesInGroup(self->GetVar<std::string>(LandTargetGroup));
|
||||
for (auto* spawnTarget : spawnTargets) {
|
||||
EntityInfo info{};
|
||||
|
||||
info.spawnerID = spawnTarget->GetObjectID();
|
||||
info.pos = spawnTarget->GetPosition();
|
||||
info.rot = spawnTarget->GetRotation();
|
||||
info.lot = chestObject;
|
||||
info.settings = {
|
||||
new LDFData<LWOOBJID>(u"parent_tag", self->GetObjectID())
|
||||
};
|
||||
|
||||
auto* chest = EntityManager::Instance()->CreateEntity(info);
|
||||
EntityManager::Instance()->ConstructEntity(chest);
|
||||
}
|
||||
}
|
||||
|
||||
ZoneAgProperty::BaseTimerDone(self, timerName);
|
||||
}
|
17
dScripts/02_server/Map/AG_Spider_Queen/ZoneAgSpiderQueen.h
Normal file
17
dScripts/02_server/Map/AG_Spider_Queen/ZoneAgSpiderQueen.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "ActivityManager.h"
|
||||
#include "ZoneAgProperty.h"
|
||||
|
||||
class ZoneAgSpiderQueen : ZoneAgProperty, ActivityManager {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnPlayerExit(Entity* self, Entity* player) override;
|
||||
void BasePlayerLoaded(Entity* self, Entity* player) override;
|
||||
void SetGameVariables(Entity* self) override;
|
||||
protected:
|
||||
std::string destroyedCinematic = "DesMaelstromInstance";
|
||||
const LOT chestObject = 16318;
|
||||
};
|
Reference in New Issue
Block a user