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:
55
dScripts/02_server/Map/AM/AmBlueX.cpp
Normal file
55
dScripts/02_server/Map/AM/AmBlueX.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "AmBlueX.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Character.h"
|
||||
|
||||
void AmBlueX::OnUse(Entity* self, Entity* user) {
|
||||
auto* skillComponent = user->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(m_SwordSkill, m_SwordBehavior, self->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void AmBlueX::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
|
||||
if (message == "FireDukesStrike") {
|
||||
self->SetNetworkVar<bool>(m_XUsedVariable, true);
|
||||
self->SetNetworkVar<bool>(m_StartEffectVariable, true);
|
||||
|
||||
auto* character = caster->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(self->GetVar<int32_t>(m_FlagVariable), true);
|
||||
}
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = m_FXObject;
|
||||
info.pos = self->GetPosition();
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* fxObject = EntityManager::Instance()->CreateEntity(info, nullptr, self);
|
||||
EntityManager::Instance()->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* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr)
|
||||
return;
|
||||
|
||||
// Cast the skill that destroys the object
|
||||
if (player != nullptr) {
|
||||
skillComponent->CalculateBehavior(m_AOESkill, m_AOEBehavior, LWOOBJID_EMPTY, false, false, playerID);
|
||||
} else {
|
||||
skillComponent->CalculateBehavior(m_AOESkill, m_AOEBehavior, LWOOBJID_EMPTY);
|
||||
}
|
||||
|
||||
fxObject->Smash();
|
||||
self->Smash();
|
||||
});
|
||||
}
|
||||
}
|
20
dScripts/02_server/Map/AM/AmBlueX.h
Normal file
20
dScripts/02_server/Map/AM/AmBlueX.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmBlueX : public CppScripts::Script {
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
private:
|
||||
const float_t m_BombTime = 3.3f;
|
||||
const uint32_t m_MissionID = 1448;
|
||||
const uint32_t m_SwordSkill = 1259;
|
||||
const uint32_t m_SwordBehavior = 29305;
|
||||
const uint32_t m_AOESkill = 1258;
|
||||
const uint32_t m_AOEBehavior = 29301;
|
||||
const LOT m_FXObject = 13808;
|
||||
|
||||
// Variables
|
||||
const std::u16string m_XUsedVariable = u"XUsed";
|
||||
const std::u16string m_FlagVariable = u"flag";
|
||||
const std::u16string m_StartEffectVariable = u"startEffect";
|
||||
};
|
28
dScripts/02_server/Map/AM/AmBridge.cpp
Normal file
28
dScripts/02_server/Map/AM/AmBridge.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "AmBridge.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
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")));
|
||||
|
||||
if (consoles.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* console = consoles[0];
|
||||
|
||||
console->NotifyObject(self, "BridgeBuilt");
|
||||
|
||||
self->AddTimer("SmashBridge", 50);
|
||||
}
|
||||
|
||||
void AmBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName != "SmashBridge") {
|
||||
return;
|
||||
}
|
||||
|
||||
self->Smash(self->GetObjectID(), VIOLENT);
|
||||
}
|
10
dScripts/02_server/Map/AM/AmBridge.h
Normal file
10
dScripts/02_server/Map/AM/AmBridge.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmBridge : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
30
dScripts/02_server/Map/AM/AmConsoleTeleportServer.cpp
Normal file
30
dScripts/02_server/Map/AM/AmConsoleTeleportServer.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "AmConsoleTeleportServer.h"
|
||||
#include "ChooseYourDestinationNsToNt.h"
|
||||
#include "AMFFormat.h"
|
||||
|
||||
void AmConsoleTeleportServer::OnStartup(Entity* self) {
|
||||
self->SetVar(u"teleportAnim", m_TeleportAnim);
|
||||
self->SetVar(u"teleportString", m_TeleportString);
|
||||
self->SetVar(u"teleportEffectID", m_TeleportEffectID);
|
||||
self->SetVar(u"teleportEffectTypes", m_TeleportEffectTypes);
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnUse(Entity* self, Entity* user) {
|
||||
BaseOnUse(self, user);
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
BaseOnMessageBoxResponse(self, sender, button, identifier, userData);
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnChoiceBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) {
|
||||
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
BaseOnTimerDone(self, timerName);
|
||||
}
|
||||
|
||||
void AmConsoleTeleportServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
BaseOnFireEventServerSide(self, sender, args, param1, param2, param3);
|
||||
}
|
22
dScripts/02_server/Map/AM/AmConsoleTeleportServer.h
Normal file
22
dScripts/02_server/Map/AM/AmConsoleTeleportServer.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "BaseConsoleTeleportServer.h"
|
||||
|
||||
class AmConsoleTeleportServer : public CppScripts::Script, BaseConsoleTeleportServer
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
|
||||
void OnChoiceBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
|
||||
|
||||
private:
|
||||
int32_t m_ChoiceZoneID = 1900;
|
||||
std::string m_SpawnPoint = "NS_LW";
|
||||
std::u16string m_TeleportAnim = u"nexus-teleport";
|
||||
std::u16string m_TeleportString = u"UI_TRAVEL_TO_NEXUS_TOWER";
|
||||
int32_t m_TeleportEffectID = 6478;
|
||||
std::vector<std::u16string> m_TeleportEffectTypes = { u"teleportRings", u"teleportBeam" };
|
||||
};
|
121
dScripts/02_server/Map/AM/AmDrawBridge.cpp
Normal file
121
dScripts/02_server/Map/AM/AmDrawBridge.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
#include "AmDrawBridge.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "SimplePhysicsComponent.h"
|
||||
|
||||
void AmDrawBridge::OnStartup(Entity* self) {
|
||||
self->SetNetworkVar(u"InUse", false);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
}
|
||||
|
||||
void AmDrawBridge::OnUse(Entity* self, Entity* user) {
|
||||
auto* bridge = GetBridge(self);
|
||||
|
||||
if (bridge == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self->GetNetworkVar<bool>(u"InUse")) {
|
||||
self->SetNetworkVar(u"startEffect", 5);
|
||||
|
||||
self->AddTimer("ChangeBridge", 5);
|
||||
|
||||
self->SetNetworkVar(u"InUse", true);
|
||||
}
|
||||
|
||||
auto* player = user;
|
||||
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
|
||||
void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "ChangeBridge") {
|
||||
auto* bridge = GetBridge(self);
|
||||
|
||||
if (bridge == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self->GetVar<bool>(u"BridgeDown")) {
|
||||
self->SetVar(u"BridgeDown", true);
|
||||
|
||||
MoveBridgeDown(self, bridge, true);
|
||||
} else {
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
|
||||
MoveBridgeDown(self, bridge, false);
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"BridgeLeaving", true);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
} else if (timerName == "SmashEffectBridge") {
|
||||
self->SetNetworkVar(u"SmashBridge", 5);
|
||||
} else if (timerName == "rotateBridgeDown") {
|
||||
auto* bridge = GetBridge(self);
|
||||
|
||||
if (bridge == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"BridgeLeaving", false);
|
||||
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3::ZERO);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(bridge);
|
||||
}
|
||||
}
|
||||
|
||||
void AmDrawBridge::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
if (name == "BridgeBuilt") {
|
||||
self->SetVar(u"BridgeID", sender->GetObjectID());
|
||||
|
||||
self->AddTimer("SmashEffectBridge", 45);
|
||||
|
||||
self->SetNetworkVar(u"BridgeDead", true);
|
||||
|
||||
sender->AddDieCallback([this, self, sender]() {
|
||||
NotifyDie(self, sender);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) {
|
||||
auto* simplePhysicsComponent = bridge->GetComponent<SimplePhysicsComponent>();
|
||||
|
||||
if (simplePhysicsComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto forwardVect = simplePhysicsComponent->GetRotation().GetForwardVector();
|
||||
|
||||
auto degrees = down ? 90.0f : -90.0f;
|
||||
|
||||
const auto travelTime = 2.0f;
|
||||
|
||||
forwardVect = forwardVect * (float)((degrees / travelTime) * (3.14f / 180.0f));
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(forwardVect);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(bridge);
|
||||
|
||||
self->AddTimer("rotateBridgeDown", travelTime);
|
||||
}
|
||||
|
||||
void AmDrawBridge::NotifyDie(Entity* self, Entity* other) {
|
||||
self->SetNetworkVar(u"InUse", false);
|
||||
self->SetVar(u"BridgeDown", false);
|
||||
|
||||
self->CancelAllTimers();
|
||||
}
|
||||
|
||||
Entity* AmDrawBridge::GetBridge(Entity* self) {
|
||||
const auto bridgeID = self->GetVar<LWOOBJID>(u"BridgeID");
|
||||
|
||||
return EntityManager::Instance()->GetEntity(bridgeID);
|
||||
}
|
16
dScripts/02_server/Map/AM/AmDrawBridge.h
Normal file
16
dScripts/02_server/Map/AM/AmDrawBridge.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmDrawBridge : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
|
||||
void MoveBridgeDown(Entity* self, Entity* bridge, bool down);
|
||||
void NotifyDie(Entity* self, Entity* other);
|
||||
|
||||
Entity* GetBridge(Entity* self);
|
||||
};
|
81
dScripts/02_server/Map/AM/AmDropshipComputer.cpp
Normal file
81
dScripts/02_server/Map/AM/AmDropshipComputer.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
#include "AmDropshipComputer.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
void AmDropshipComputer::OnStartup(Entity* self) {
|
||||
self->AddTimer("reset", 45.0f);
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (missionComponent == nullptr || inventoryComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == MissionState::MISSION_STATE_COMPLETE) {
|
||||
return;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(m_NexusTalonDataCard, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
|
||||
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
|
||||
|
||||
int32_t pipeNum = 0;
|
||||
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto pipeGroup = myGroup.substr(0, 10);
|
||||
|
||||
const auto nextPipeNum = pipeNum + 1;
|
||||
|
||||
const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup);
|
||||
|
||||
if (!samePipeSpawners.empty()) {
|
||||
samePipeSpawners[0]->SoftReset();
|
||||
|
||||
samePipeSpawners[0]->Deactivate();
|
||||
}
|
||||
|
||||
if (killer != nullptr && killer->IsPlayer()) {
|
||||
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
|
||||
|
||||
const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
|
||||
if (!nextPipeSpawners.empty()) {
|
||||
nextPipeSpawners[0]->Activate();
|
||||
}
|
||||
} else {
|
||||
const auto nextPipe = pipeGroup + "1";
|
||||
|
||||
const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
|
||||
if (!firstPipeSpawners.empty()) {
|
||||
firstPipeSpawners[0]->Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "reset" && rebuildComponent->GetState() == REBUILD_OPEN) {
|
||||
self->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
}
|
13
dScripts/02_server/Map/AM/AmDropshipComputer.h
Normal file
13
dScripts/02_server/Map/AM/AmDropshipComputer.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmDropshipComputer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
const LOT m_NexusTalonDataCard = 12323;
|
||||
};
|
14
dScripts/02_server/Map/AM/AmScrollReaderServer.cpp
Normal file
14
dScripts/02_server/Map/AM/AmScrollReaderServer.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "AmScrollReaderServer.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmScrollReaderServer::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
if (identifier == u"story_end") {
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
missionComponent->ForceProgressTaskType(969, 1, 1, false);
|
||||
}
|
||||
}
|
8
dScripts/02_server/Map/AM/AmScrollReaderServer.h
Normal file
8
dScripts/02_server/Map/AM/AmScrollReaderServer.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmScrollReaderServer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
|
||||
};
|
144
dScripts/02_server/Map/AM/AmShieldGenerator.cpp
Normal file
144
dScripts/02_server/Map/AM/AmShieldGenerator.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
#include "AmShieldGenerator.h"
|
||||
#include "EntityManager.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MovementAIComponent.h"
|
||||
#include "BaseCombatAIComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AmShieldGenerator::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(20, "shield");
|
||||
self->SetProximityRadius(21, "buffer");
|
||||
|
||||
StartShield(self);
|
||||
}
|
||||
|
||||
void AmShieldGenerator::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (status == "ENTER" && name == "shield") {
|
||||
if (destroyableComponent->HasFaction(4)) {
|
||||
EnemyEnteredShield(self, entering);
|
||||
}
|
||||
}
|
||||
|
||||
if (name != "buffer" || !entering->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
if (status == "ENTER") {
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter == entitiesInProximity.end()) {
|
||||
entitiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
} else if (status == "LEAVE") {
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter != entitiesInProximity.end()) {
|
||||
entitiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Players", entitiesInProximity);
|
||||
}
|
||||
|
||||
void AmShieldGenerator::OnDie(Entity* self, Entity* killer) {
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
|
||||
if (child != nullptr) {
|
||||
child->Kill();
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGenerator::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "BuffPlayers") {
|
||||
BuffPlayers(self);
|
||||
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
} else if (timerName == "PlayFX") {
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 5351, u"generatorOn", "generatorOn");
|
||||
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
} else if (timerName == "RefreshEnemies") {
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr) {
|
||||
EnemyEnteredShield(self, enemy);
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGenerator::StartShield(Entity* self) {
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
|
||||
const auto myPos = self->GetPosition();
|
||||
const auto myRot = self->GetRotation();
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = 13111;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
self->SetVar(u"Child", child->GetObjectID());
|
||||
|
||||
BuffPlayers(self);
|
||||
}
|
||||
|
||||
void AmShieldGenerator::BuffPlayers(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
skillComponent->CalculateBehavior(1200, 27024, playerID, true);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGenerator::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dir = intruder->GetRotation().GetForwardVector() * -1;
|
||||
dir.y += 15;
|
||||
dir.x *= 50;
|
||||
dir.z *= 50;
|
||||
|
||||
// TODO: Figure out how todo knockback, I'll stun them for now
|
||||
|
||||
if (NiPoint3::DistanceSquared(self->GetPosition(), movementAIComponent->GetCurrentPosition()) < 20 * 20) {
|
||||
baseCombatAIComponent->Stun(2.0f);
|
||||
movementAIComponent->SetDestination(baseCombatAIComponent->GetStartPosition());
|
||||
}
|
||||
|
||||
baseCombatAIComponent->ClearThreat();
|
||||
}
|
15
dScripts/02_server/Map/AM/AmShieldGenerator.h
Normal file
15
dScripts/02_server/Map/AM/AmShieldGenerator.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmShieldGenerator : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
void StartShield(Entity* self);
|
||||
void BuffPlayers(Entity* self);
|
||||
void EnemyEnteredShield(Entity* self, Entity* intruder);
|
||||
};
|
202
dScripts/02_server/Map/AM/AmShieldGeneratorQuickbuild.cpp
Normal file
202
dScripts/02_server/Map/AM/AmShieldGeneratorQuickbuild.cpp
Normal file
@@ -0,0 +1,202 @@
|
||||
#include "AmShieldGeneratorQuickbuild.h"
|
||||
#include "EntityManager.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MovementAIComponent.h"
|
||||
#include "BaseCombatAIComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(20, "shield");
|
||||
self->SetProximityRadius(21, "buffer");
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
auto* destroyableComponent = entering->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (name == "shield") {
|
||||
if (!destroyableComponent->HasFaction(4) || entering->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
if (status == "ENTER") {
|
||||
EnemyEnteredShield(self, entering);
|
||||
|
||||
const auto& iter = std::find(enemiesInProximity.begin(), enemiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter == enemiesInProximity.end()) {
|
||||
enemiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
} else if (status == "LEAVE") {
|
||||
const auto& iter = std::find(enemiesInProximity.begin(), enemiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter != enemiesInProximity.end()) {
|
||||
enemiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Enemies", enemiesInProximity);
|
||||
}
|
||||
|
||||
if (name != "buffer" || !entering->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
if (status == "ENTER") {
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter == entitiesInProximity.end()) {
|
||||
entitiesInProximity.push_back(entering->GetObjectID());
|
||||
}
|
||||
} else if (status == "LEAVE") {
|
||||
const auto& iter = std::find(entitiesInProximity.begin(), entitiesInProximity.end(), entering->GetObjectID());
|
||||
|
||||
if (iter != entitiesInProximity.end()) {
|
||||
entitiesInProximity.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"Players", entitiesInProximity);
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnDie(Entity* self, Entity* killer) {
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Child"));
|
||||
|
||||
if (child != nullptr) {
|
||||
child->Kill();
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "BuffPlayers") {
|
||||
BuffPlayers(self);
|
||||
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
} else if (timerName == "PlayFX") {
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 5351, u"generatorOn", "generatorOn");
|
||||
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
} else if (timerName == "RefreshEnemies") {
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr) {
|
||||
EnemyEnteredShield(self, enemy);
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
StartShield(self);
|
||||
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
|
||||
for (const auto enemyID : enemiesInProximity) {
|
||||
auto* enemy = EntityManager::Instance()->GetEntity(enemyID);
|
||||
|
||||
if (enemy != nullptr) {
|
||||
enemy->Smash();
|
||||
}
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
missionComponent->ForceProgressTaskType(987, 1, 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::StartShield(Entity* self) {
|
||||
self->AddTimer("PlayFX", 1.5f);
|
||||
self->AddTimer("BuffPlayers", 3.0f);
|
||||
self->AddTimer("RefreshEnemies", 1.5f);
|
||||
|
||||
const auto myPos = self->GetPosition();
|
||||
const auto myRot = self->GetRotation();
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = 13111;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
self->SetVar(u"Child", child->GetObjectID());
|
||||
|
||||
BuffPlayers(self);
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto entitiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto playerID : entitiesInProximity) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
skillComponent->CalculateBehavior(1200, 27024, playerID, true);
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != REBUILD_COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* baseCombatAIComponent = intruder->GetComponent<BaseCombatAIComponent>();
|
||||
auto* movementAIComponent = intruder->GetComponent<MovementAIComponent>();
|
||||
|
||||
if (baseCombatAIComponent == nullptr || movementAIComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dir = intruder->GetRotation().GetForwardVector() * -1;
|
||||
dir.y += 15;
|
||||
dir.x *= 50;
|
||||
dir.z *= 50;
|
||||
|
||||
// TODO: Figure out how todo knockback, I'll stun them for now
|
||||
|
||||
if (NiPoint3::DistanceSquared(self->GetPosition(), movementAIComponent->GetCurrentPosition()) < 20 * 20) {
|
||||
baseCombatAIComponent->Stun(2.0f);
|
||||
movementAIComponent->SetDestination(baseCombatAIComponent->GetStartPosition());
|
||||
}
|
||||
|
||||
baseCombatAIComponent->ClearThreat();
|
||||
}
|
16
dScripts/02_server/Map/AM/AmShieldGeneratorQuickbuild.h
Normal file
16
dScripts/02_server/Map/AM/AmShieldGeneratorQuickbuild.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmShieldGeneratorQuickbuild : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
|
||||
void StartShield(Entity* self);
|
||||
void BuffPlayers(Entity* self);
|
||||
void EnemyEnteredShield(Entity* self, Entity* intruder);
|
||||
};
|
323
dScripts/02_server/Map/AM/AmSkullkinDrill.cpp
Normal file
323
dScripts/02_server/Map/AM/AmSkullkinDrill.cpp
Normal file
@@ -0,0 +1,323 @@
|
||||
#include "AmSkullkinDrill.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "ProximityMonitorComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmSkullkinDrill::OnStartup(Entity* self) {
|
||||
self->SetNetworkVar(u"bIsInUse", false);
|
||||
self->SetVar(u"bActive", true);
|
||||
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active");
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
movingPlatformComponent->SetSerialized(true);
|
||||
|
||||
movingPlatformComponent->GotoWaypoint(0);
|
||||
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
if (standObj != nullptr) {
|
||||
standObj->SetVar(u"bActive", true);
|
||||
}
|
||||
|
||||
self->SetProximityRadius(5, "spin_distance");
|
||||
}
|
||||
|
||||
Entity* AmSkullkinDrill::GetStandObj(Entity* self) {
|
||||
const auto& myGroup = self->GetGroups();
|
||||
|
||||
if (myGroup.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string groupName = "Drill_Stand_";
|
||||
|
||||
groupName.push_back(myGroup[0][myGroup[0].size() - 1]);
|
||||
|
||||
const auto standObjs = EntityManager::Instance()->GetEntitiesInGroup(groupName);
|
||||
|
||||
if (standObjs.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return standObjs[0];
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
|
||||
if (message != "NinjagoSpinEvent" || self->GetNetworkVar<bool>(u"bIsInUse")) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
|
||||
if (proximityMonitorComponent == nullptr || !proximityMonitorComponent->IsInProximity("spin_distance", caster->GetObjectID())) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar(u"activaterID", caster->GetObjectID());
|
||||
|
||||
self->SetNetworkVar(u"bIsInUse", true);
|
||||
|
||||
TriggerDrill(self);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::TriggerDrill(Entity* self) {
|
||||
GameMessages::SendPlayAnimation(self, u"slowdown");
|
||||
|
||||
self->AddTimer("killDrill", 10.0f);
|
||||
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
if (standObj != nullptr) {
|
||||
standObj->SetVar(u"bActive", false);
|
||||
}
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
movingPlatformComponent->GotoWaypoint(1);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnWaypointReached(Entity* self, uint32_t waypointIndex) {
|
||||
if (waypointIndex == 1) {
|
||||
auto myPos = self->GetPosition();
|
||||
auto myRot = self->GetRotation();
|
||||
|
||||
myPos.y -= 21;
|
||||
|
||||
EntityInfo info = {};
|
||||
info.lot = 12346;
|
||||
info.pos = myPos;
|
||||
info.rot = myRot;
|
||||
info.scale = 3; // Needs the scale, otherwise attacks fail
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* child = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(child);
|
||||
|
||||
self->SetVar(u"ChildSmash", child->GetObjectID());
|
||||
|
||||
child->AddDieCallback([this, self]() {
|
||||
const auto& userID = self->GetVar<LWOOBJID>(u"activaterID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(userID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
OnHitOrHealResult(self, player, 1);
|
||||
});
|
||||
}
|
||||
|
||||
OnArrived(self, waypointIndex);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetNetworkVar<bool>(u"bIsInUse")) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"bIsInUse", true);
|
||||
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 5499, u"on-anim", "tornado");
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 5502, u"on-anim", "staff");
|
||||
|
||||
const auto userID = user->GetObjectID();
|
||||
|
||||
self->SetVar(u"userID", userID);
|
||||
self->SetVar(u"activaterID", userID);
|
||||
|
||||
PlayAnim(self, user, "spinjitzu-staff-windup");
|
||||
PlayCinematic(self);
|
||||
|
||||
FreezePlayer(self, user, true);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze) {
|
||||
eStunState eChangeType = POP;
|
||||
|
||||
if (bFreeze) {
|
||||
if (player->GetIsDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
eChangeType = PUSH;
|
||||
} else {
|
||||
if (player->GetIsDead()) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
GameMessages::SendSetStunned(player->GetObjectID(), eChangeType, player->GetSystemAddress(), self->GetObjectID(),
|
||||
true, false, true, false, true, false, true
|
||||
);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
if (waypointIndex == 1) {
|
||||
GameMessages::SendPlayAnimation(self, u"no-spin");
|
||||
GameMessages::SendStopFXEffect(self, true, "active");
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"indicator", "indicator");
|
||||
|
||||
self->SetVar(u"bActive", false);
|
||||
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player != nullptr) {
|
||||
PlayAnim(self, player, "spinjitzu-staff-end");
|
||||
}
|
||||
|
||||
if (standObj != nullptr) {
|
||||
standObj->SetVar(u"bActive", false);
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
GameMessages::SendPlayAnimation(self, u"idle");
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active");
|
||||
GameMessages::SendStopFXEffect(self, true, "indicator");
|
||||
}
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::PlayCinematic(Entity* self) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"userID"));
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& cine = self->GetVar<std::u16string>(u"cinematic");
|
||||
|
||||
if (cine.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), cine, player->GetSystemAddress());
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::PlayAnim(Entity* self, Entity* player, const std::string& animName) {
|
||||
const auto animTime = animName == "spinjitzu-staff-end" ? 0.5f : 1.0f;
|
||||
|
||||
GameMessages::SendPlayAnimation(player, GeneralUtils::ASCIIToUTF16(animName));
|
||||
|
||||
self->AddTimer("AnimDone_" + animName, animTime);
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || !attacker->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->GetVar<bool>(u"bActive")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto activaterID = self->GetVar<LWOOBJID>(u"activaterID");
|
||||
|
||||
auto* activator = EntityManager::Instance()->GetEntity(activaterID);
|
||||
|
||||
// TODO: Missions
|
||||
if (activator != nullptr) {
|
||||
auto* missionComponent = activator->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
for (const auto missionID : m_MissionsToUpdate) {
|
||||
missionComponent->ForceProgressValue(missionID, 1, self->GetLOT());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self->Smash(attacker->GetObjectID(), SILENT);
|
||||
|
||||
self->CancelAllTimers();
|
||||
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
if (standObj != nullptr) {
|
||||
GameMessages::SendPlayFXEffect(standObj->GetObjectID(), 4946, u"explode", "explode");
|
||||
}
|
||||
}
|
||||
|
||||
void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "killDrill") {
|
||||
const auto childID = self->GetVar<LWOOBJID>(u"ChildSmash");
|
||||
|
||||
auto* child = EntityManager::Instance()->GetEntity(childID);
|
||||
|
||||
if (child != nullptr) {
|
||||
child->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"bIsInUse", false);
|
||||
self->SetVar(u"bActive", true);
|
||||
self->SetVar(u"activaterID", LWOOBJID_EMPTY);
|
||||
|
||||
auto* standObj = GetStandObj(self);
|
||||
|
||||
if (standObj != nullptr) {
|
||||
standObj->SetVar(u"bActive", true);
|
||||
}
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
movingPlatformComponent->GotoWaypoint(0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& data = GeneralUtils::SplitString(timerName, '_');
|
||||
|
||||
if (data.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data[0] == "AnimDone") {
|
||||
const auto& animName = data[1];
|
||||
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (animName == "spinjitzu-staff-windup") {
|
||||
TriggerDrill(self);
|
||||
|
||||
GameMessages::SendPlayAnimation(player, u"spinjitzu-staff-loop");
|
||||
} else if (animName == "spinjitzu-staff-end") {
|
||||
FreezePlayer(self, player, false);
|
||||
|
||||
self->SetVar(u"userID", LWOOBJID_EMPTY);
|
||||
|
||||
GameMessages::SendStopFXEffect(player, true, "tornado");
|
||||
GameMessages::SendStopFXEffect(player, true, "staff");
|
||||
}
|
||||
|
||||
} else if (data[0] == "TryUnFreezeAgain") {
|
||||
|
||||
}
|
||||
}
|
33
dScripts/02_server/Map/AM/AmSkullkinDrill.h
Normal file
33
dScripts/02_server/Map/AM/AmSkullkinDrill.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmSkullkinDrill : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
|
||||
Entity* GetStandObj(Entity* self);
|
||||
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
|
||||
void TriggerDrill(Entity* self);
|
||||
|
||||
void OnWaypointReached(Entity* self, uint32_t waypointIndex) override;
|
||||
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
|
||||
void FreezePlayer(Entity* self, Entity* player, bool bFreeze);
|
||||
|
||||
void OnArrived(Entity* self, uint32_t waypointIndex);
|
||||
|
||||
void PlayCinematic(Entity* self);
|
||||
|
||||
void PlayAnim(Entity* self, Entity* player, const std::string& animName);
|
||||
|
||||
void OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) override;
|
||||
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
private:
|
||||
std::vector<int32_t> m_MissionsToUpdate = { 972, 1305, 1308 };
|
||||
};
|
35
dScripts/02_server/Map/AM/AmSkullkinDrillStand.cpp
Normal file
35
dScripts/02_server/Map/AM/AmSkullkinDrillStand.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "AmSkullkinDrillStand.h"
|
||||
#include "GameMessages.h"
|
||||
#include "dpEntity.h"
|
||||
|
||||
void AmSkullkinDrillStand::OnStartup(Entity* self) {
|
||||
self->SetVar(u"bActive", true);
|
||||
|
||||
self->SetProximityRadius(new dpEntity(self->GetObjectID(), { 6, 14, 6 }), "knockback");
|
||||
}
|
||||
|
||||
void AmSkullkinDrillStand::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
|
||||
}
|
||||
|
||||
void AmSkullkinDrillStand::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (!self->GetVar<bool>(u"bActive")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entering->IsPlayer() || status != "ENTER" || name != "knockback") {
|
||||
return;
|
||||
}
|
||||
|
||||
auto myPos = self->GetPosition();
|
||||
|
||||
auto objPos = entering->GetPosition();
|
||||
|
||||
NiPoint3 newVec = { (objPos.x - myPos.x) * 4.5f, 15, (objPos.z - myPos.z) * 4.5f };
|
||||
|
||||
GameMessages::SendKnockback(entering->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, newVec);
|
||||
|
||||
GameMessages::SendPlayFXEffect(entering->GetObjectID(), 1378, u"create", "pushBack");
|
||||
|
||||
GameMessages::SendPlayAnimation(entering, u"knockback-recovery");
|
||||
}
|
12
dScripts/02_server/Map/AM/AmSkullkinDrillStand.h
Normal file
12
dScripts/02_server/Map/AM/AmSkullkinDrillStand.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmSkullkinDrillStand : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
};
|
243
dScripts/02_server/Map/AM/AmSkullkinTower.cpp
Normal file
243
dScripts/02_server/Map/AM/AmSkullkinTower.cpp
Normal file
@@ -0,0 +1,243 @@
|
||||
#include "AmSkullkinTower.h"
|
||||
#include "EntityManager.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmSkullkinTower::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(20, "Tower");
|
||||
|
||||
// onPhysicsComponentReady
|
||||
|
||||
auto* movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
|
||||
|
||||
if (movingPlatformComponent != nullptr) {
|
||||
movingPlatformComponent->StopPathing();
|
||||
}
|
||||
|
||||
SpawnLegs(self, "Left");
|
||||
SpawnLegs(self, "Right");
|
||||
SpawnLegs(self, "Rear");
|
||||
}
|
||||
|
||||
void AmSkullkinTower::SpawnLegs(Entity* self, const std::string& loc) {
|
||||
auto pos = self->GetPosition();
|
||||
auto rot = self->GetRotation();
|
||||
pos.y += self->GetVarAs<float>(u"vert_offset");
|
||||
|
||||
auto newRot = rot;
|
||||
auto offset = self->GetVarAs<float>(u"hort_offset");
|
||||
|
||||
auto legLOT = self->GetVar<LOT>(u"legLOT");
|
||||
|
||||
if (legLOT == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<LDFBaseData*> config = { new LDFData<std::string>(u"Leg", loc) };
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = legLOT;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.settings = config;
|
||||
info.rot = newRot;
|
||||
|
||||
if (loc == "Right") {
|
||||
const auto dir = rot.GetForwardVector();
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
} else if (loc == "Rear") {
|
||||
const auto dir = rot.GetRightVector();
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
} else if (loc == "Left") {
|
||||
const auto dir = rot.GetForwardVector() * -1;
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
}
|
||||
|
||||
info.rot = NiQuaternion::LookAt(info.pos, self->GetPosition());
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
|
||||
OnChildLoaded(self, entity);
|
||||
}
|
||||
|
||||
void AmSkullkinTower::OnChildLoaded(Entity* self, Entity* child) {
|
||||
auto legTable = self->GetVar<std::vector<LWOOBJID>>(u"legTable");
|
||||
|
||||
legTable.push_back(child->GetObjectID());
|
||||
|
||||
self->SetVar(u"legTable", legTable);
|
||||
|
||||
const auto selfID = self->GetObjectID();
|
||||
|
||||
child->AddDieCallback([this, selfID, child]() {
|
||||
auto* self = EntityManager::Instance()->GetEntity(selfID);
|
||||
auto* destroyableComponent = child->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyableComponent == nullptr || self == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotifyDie(self, child, destroyableComponent->GetKiller());
|
||||
});
|
||||
}
|
||||
|
||||
void AmSkullkinTower::NotifyDie(Entity* self, Entity* other, Entity* killer) {
|
||||
auto players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
const auto& iter = std::find(players.begin(), players.end(), killer->GetObjectID());
|
||||
|
||||
if (iter == players.end()) {
|
||||
players.push_back(killer->GetObjectID());
|
||||
}
|
||||
|
||||
self->SetVar(u"Players", players);
|
||||
|
||||
OnChildRemoved(self, other);
|
||||
}
|
||||
|
||||
void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
|
||||
auto legTable = self->GetVar<std::vector<LWOOBJID>>(u"legTable");
|
||||
|
||||
const auto& iter = std::find(legTable.begin(), legTable.end(), child->GetObjectID());
|
||||
|
||||
if (iter != legTable.end()) {
|
||||
legTable.erase(iter);
|
||||
}
|
||||
|
||||
self->SetVar(u"legTable", legTable);
|
||||
|
||||
if (legTable.size() == 2) {
|
||||
GameMessages::SendPlayAnimation(self, u"wobble-1");
|
||||
} else if (legTable.size() == 1) {
|
||||
GameMessages::SendPlayAnimation(self, u"wobble-2");
|
||||
} else if (legTable.empty()) {
|
||||
const auto animTime = 2.5f;
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"fall");
|
||||
|
||||
self->AddTimer("spawnGuys", animTime - 0.2f);
|
||||
|
||||
self->CancelTimer("RespawnLeg");
|
||||
self->CancelTimer("RespawnLeg");
|
||||
self->CancelTimer("RespawnLeg");
|
||||
|
||||
std::vector<int32_t> missionIDs;
|
||||
|
||||
auto missionsString = self->GetVar<std::u16string>(u"missions");
|
||||
|
||||
if (!missionsString.empty()) {
|
||||
// Split the missions string by '_'
|
||||
const auto missions = GeneralUtils::SplitString(
|
||||
GeneralUtils::UTF16ToWTF8(missionsString),
|
||||
'_'
|
||||
);
|
||||
|
||||
for (const auto& mission : missions) {
|
||||
int32_t missionID = 0;
|
||||
|
||||
if (!GeneralUtils::TryParse(mission, missionID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
missionIDs.push_back(missionID);
|
||||
}
|
||||
}
|
||||
|
||||
const auto& players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
for (const auto& playerID : players) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
|
||||
if (player == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const auto missionID : missionIDs) {
|
||||
missionComponent->ForceProgressValue(missionID, 1, self->GetLOT());
|
||||
}
|
||||
|
||||
//missionComponent->ForceProgressValue(1305, 1, self->GetLOT());
|
||||
}
|
||||
}
|
||||
|
||||
auto deadLegs = self->GetVar<std::vector<std::string>>(u"DeadLegs");
|
||||
|
||||
const auto& leg = child->GetVar<std::string>(u"Leg");
|
||||
|
||||
const auto& legIter = std::find(deadLegs.begin(), deadLegs.end(), leg);
|
||||
|
||||
if (legIter == deadLegs.end()) {
|
||||
deadLegs.push_back(leg);
|
||||
}
|
||||
|
||||
self->SetVar(u"DeadLegs", deadLegs);
|
||||
|
||||
self->AddTimer("RespawnLeg", 20);
|
||||
}
|
||||
|
||||
void AmSkullkinTower::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (status != "LEAVE") {
|
||||
return;
|
||||
}
|
||||
|
||||
auto players = self->GetVar<std::vector<LWOOBJID>>(u"Players");
|
||||
|
||||
const auto& iter = std::find(players.begin(), players.end(), entering->GetObjectID());
|
||||
|
||||
if (iter != players.end()) {
|
||||
players.erase(iter);
|
||||
}
|
||||
|
||||
self->SetVar(u"Players", players);
|
||||
}
|
||||
|
||||
void AmSkullkinTower::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "RespawnLeg") {
|
||||
auto deadLegs = self->GetVar<std::vector<std::string>>(u"DeadLegs");
|
||||
|
||||
if (deadLegs.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnLegs(self, deadLegs[0]);
|
||||
|
||||
deadLegs.erase(deadLegs.begin());
|
||||
|
||||
self->SetVar<std::vector<std::string>>(u"DeadLegs", deadLegs);
|
||||
} else if (timerName == "spawnGuys") {
|
||||
EntityInfo info{};
|
||||
info.lot = self->GetVar<LOT>(u"enemyToSpawn");
|
||||
auto pos = self->GetPosition();
|
||||
pos.y += 7;
|
||||
info.pos = pos;
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
for (size_t i = 0; i < 2; i++) {
|
||||
info.pos.x += i * 2; // Just to set the apart a bit
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
}
|
||||
|
||||
self->AddTimer("killTower", 0.7f);
|
||||
} else if (timerName == "killTower") {
|
||||
self->Smash(self->GetObjectID());
|
||||
}
|
||||
}
|
20
dScripts/02_server/Map/AM/AmSkullkinTower.h
Normal file
20
dScripts/02_server/Map/AM/AmSkullkinTower.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmSkullkinTower : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
|
||||
void SpawnLegs(Entity* self, const std::string& loc);
|
||||
|
||||
void OnChildLoaded(Entity* self, Entity* child);
|
||||
|
||||
void NotifyDie(Entity* self, Entity* other, Entity* killer);
|
||||
|
||||
void OnChildRemoved(Entity* self, Entity* child);
|
||||
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
15
dScripts/02_server/Map/AM/AmTeapotServer.cpp
Normal file
15
dScripts/02_server/Map/AM/AmTeapotServer.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "AmTeapotServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
|
||||
void AmTeapotServer::OnUse(Entity* self, Entity* user) {
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
if (!inventoryComponent) return;
|
||||
|
||||
if (inventoryComponent->GetLotCount(BLUE_FLOWER_LEAVES) >= 10) {
|
||||
inventoryComponent->RemoveItem(BLUE_FLOWER_LEAVES, 10);
|
||||
inventoryComponent->AddItem(WU_S_IMAGINATION_TEA, 1);
|
||||
}
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
10
dScripts/02_server/Map/AM/AmTeapotServer.h
Normal file
10
dScripts/02_server/Map/AM/AmTeapotServer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmTeapotServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
private:
|
||||
LOT BLUE_FLOWER_LEAVES = 12317;
|
||||
LOT WU_S_IMAGINATION_TEA = 12109;
|
||||
};
|
23
dScripts/02_server/Map/AM/AmTemplateSkillVolume.cpp
Normal file
23
dScripts/02_server/Map/AM/AmTemplateSkillVolume.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "AmTemplateSkillVolume.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmTemplateSkillVolume::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
|
||||
if (message != "NinjagoSpinAttackEvent") {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* missionComponent = caster->GetComponent<MissionComponent>();
|
||||
|
||||
const auto missionIDsVariable = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"missions"));
|
||||
const auto missionIDs = GeneralUtils::SplitString(missionIDsVariable, '_');
|
||||
|
||||
for (const auto& missionIDStr : missionIDs) {
|
||||
int32_t missionID = 0;
|
||||
|
||||
if (!GeneralUtils::TryParse(missionIDStr, missionID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
missionComponent->ForceProgressTaskType(missionID, 1, 1, false);
|
||||
}
|
||||
}
|
8
dScripts/02_server/Map/AM/AmTemplateSkillVolume.h
Normal file
8
dScripts/02_server/Map/AM/AmTemplateSkillVolume.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AmTemplateSkillVolume : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
};
|
19
dScripts/02_server/Map/AM/CMakeLists.txt
Normal file
19
dScripts/02_server/Map/AM/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
|
||||
"AmConsoleTeleportServer.cpp"
|
||||
"RandomSpawnerFin.cpp"
|
||||
"RandomSpawnerPit.cpp"
|
||||
"RandomSpawnerStr.cpp"
|
||||
"RandomSpawnerZip.cpp"
|
||||
"AmBridge.cpp"
|
||||
"AmDrawBridge.cpp"
|
||||
"AmShieldGenerator.cpp"
|
||||
"AmShieldGeneratorQuickbuild.cpp"
|
||||
"AmDropshipComputer.cpp"
|
||||
"AmScrollReaderServer.cpp"
|
||||
"AmTemplateSkillVolume.cpp"
|
||||
"AmSkullkinDrill.cpp"
|
||||
"AmSkullkinDrillStand.cpp"
|
||||
"AmSkullkinTower.cpp"
|
||||
"AmBlueX.cpp"
|
||||
"AmTeapotServer.cpp"
|
||||
PARENT_SCOPE)
|
85
dScripts/02_server/Map/AM/RandomSpawnerFin.cpp
Normal file
85
dScripts/02_server/Map/AM/RandomSpawnerFin.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include "RandomSpawnerFin.h"
|
||||
|
||||
void RandomSpawnerFin::OnStartup(Entity* self) {
|
||||
zones = {
|
||||
{ //-- ** Load 1 -------------------------- **
|
||||
{{mobs.pirate, 3, "type1",},
|
||||
{mobs.ronin, 3, "type2",},
|
||||
{mobs.spider, 2, "type3",}},
|
||||
10
|
||||
},
|
||||
{ //-- ** Load 2 -------------------------- **
|
||||
{{mobs.admiral, 3, "type1",},
|
||||
{mobs.ronin, 2, "type2",},
|
||||
{mobs.mech, 2, "type3",}},
|
||||
5
|
||||
},
|
||||
{ //-- ** Load 3 -------------------------- **
|
||||
{{mobs.horse, 2, "type1",},
|
||||
{mobs.admiral, 3, "type2",},
|
||||
{mobs.stromb, 5, "type3",}},
|
||||
10
|
||||
},
|
||||
{ //-- ** Load 4 -------------------------- **
|
||||
{{mobs.horse, 1, "type1",},
|
||||
{mobs.gorilla, 1, "type2",},
|
||||
{mobs.pirate, 4, "type3",}},
|
||||
2
|
||||
},
|
||||
{ //-- ** Load 5 -------------------------- **
|
||||
{{mobs.spider, 1, "type1",},
|
||||
{mobs.mech, 2, "type2",},
|
||||
{mobs.gorilla, 1, "type3",}},
|
||||
1
|
||||
},
|
||||
{ //-- ** Load 6 -------------------------- **
|
||||
{{mobs.mech, 2, "type1",},
|
||||
{mobs.pirate, 4, "type2",},
|
||||
{mobs.horse, 1, "type3",}},
|
||||
10
|
||||
},
|
||||
{ //-- ** Load 7 -------------------------- **
|
||||
{{mobs.stromb, 3, "type1",},
|
||||
{mobs.spider, 1, "type2",},
|
||||
{mobs.horse, 1, "type3",}},
|
||||
5
|
||||
},
|
||||
{ //-- ** Load 8 -------------------------- **
|
||||
{{mobs.pirate, 3, "type1",},
|
||||
{mobs.admiral, 2, "type2",},
|
||||
{mobs.gorilla, 1, "type3",}},
|
||||
2
|
||||
},
|
||||
{ //-- ** Load 9 -------------------------- **
|
||||
{{mobs.stromb, 3, "type1",},
|
||||
{mobs.mech, 2, "type2",},
|
||||
{mobs.spider, 1, "type3",}},
|
||||
10
|
||||
},
|
||||
{ //-- ** Load 10 -------------------------- **
|
||||
{{mobs.admiral, 3, "type1",},
|
||||
{mobs.pirate, 3, "type2",},
|
||||
{mobs.horse, 1, "type3",}},
|
||||
10
|
||||
},
|
||||
};
|
||||
|
||||
sectionMultipliers = {
|
||||
{"secA", 1},
|
||||
{"secB", 1},
|
||||
{"secC", 1.2f},
|
||||
{"secD", 1.3f},
|
||||
{"secE", 1.6f},
|
||||
{"secF", 1},
|
||||
{"secG", 1},
|
||||
{"secH", 1.2f},
|
||||
};
|
||||
|
||||
zoneName = "fin";
|
||||
|
||||
BaseStartup(self);
|
||||
}
|
||||
|
||||
void RandomSpawnerFin::OnTimerDone(Entity* self, std::string timerName) {
|
||||
BaseOnTimerDone(self, timerName);
|
||||
}
|
26
dScripts/02_server/Map/AM/RandomSpawnerFin.h
Normal file
26
dScripts/02_server/Map/AM/RandomSpawnerFin.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "BaseRandomServer.h"
|
||||
|
||||
class RandomSpawnerFin : public CppScripts::Script, BaseRandomServer
|
||||
{
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
private:
|
||||
struct Mobs
|
||||
{
|
||||
static const LOT stromb = 11212;
|
||||
static const LOT mech = 11213;
|
||||
static const LOT spider = 11214;
|
||||
static const LOT pirate = 11215;
|
||||
static const LOT admiral = 11216;
|
||||
static const LOT gorilla = 11217;
|
||||
static const LOT ronin = 11218;
|
||||
static const LOT horse = 11219;
|
||||
static const LOT dragon = 112201;
|
||||
};
|
||||
|
||||
Mobs mobs;
|
||||
};
|
||||
|
83
dScripts/02_server/Map/AM/RandomSpawnerPit.cpp
Normal file
83
dScripts/02_server/Map/AM/RandomSpawnerPit.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "RandomSpawnerPit.h"
|
||||
|
||||
void RandomSpawnerPit::OnStartup(Entity* self) {
|
||||
zones = {
|
||||
{ //-- ** Load 1 -------------------------- **
|
||||
{{mobs.admiral, 4, "type1",},
|
||||
{mobs.spider, 3, "type2",}},
|
||||
5
|
||||
},
|
||||
{ //-- ** Load 2 -------------------------- **
|
||||
{{mobs.admiral, 4, "type1",},
|
||||
{mobs.pirate, 7, "type2",}},
|
||||
15
|
||||
},
|
||||
{ //-- ** Load 3 -------------------------- **
|
||||
{{mobs.spider, 4, "type1",},
|
||||
{mobs.stromb, 10, "type2",}},
|
||||
15
|
||||
},
|
||||
{ //-- ** Load 4 -------------------------- **
|
||||
{{mobs.mech, 2, "type1",},
|
||||
{mobs.horse, 1, "type2",}},
|
||||
6
|
||||
},
|
||||
{ //-- ** Load 5 -------------------------- **
|
||||
{{mobs.gorilla, 1, "type1",},
|
||||
{mobs.admiral, 4, "type2",}},
|
||||
2
|
||||
},
|
||||
{ //-- ** Load 6 -------------------------- **
|
||||
{{mobs.pirate, 7, "type1",},
|
||||
{mobs.ronin, 6, "type2",}},
|
||||
5
|
||||
},
|
||||
{ //-- ** Load 7 -------------------------- **
|
||||
{{mobs.spider, 3, "type1",},
|
||||
{mobs.ronin, 9, "type2",}},
|
||||
10
|
||||
},
|
||||
{ //-- ** Load 8 -------------------------- **
|
||||
{{mobs.gorilla, 1, "type1",},
|
||||
{mobs.stromb, 8, "type2",}},
|
||||
2
|
||||
},
|
||||
{ //-- ** Load 9 -------------------------- **
|
||||
{{mobs.mech, 2, "type1",},
|
||||
{mobs.admiral, 4, "type2",}},
|
||||
2
|
||||
},
|
||||
{ //-- ** Load 10 -------------------------- **
|
||||
{{mobs.horse, 2, "type1",},
|
||||
{mobs.admiral, 3, "type2",}},
|
||||
1
|
||||
},
|
||||
{ //-- ** Load 11 -------------------------- **
|
||||
{{mobs.mech, 3, "type1",},
|
||||
{mobs.ronin, 5, "type2",}},
|
||||
15
|
||||
},
|
||||
{ //-- ** Load 12 -------------------------- **
|
||||
{{mobs.mech, 3, "type1",},
|
||||
{mobs.pirate, 5, "type2",}},
|
||||
15
|
||||
},
|
||||
};
|
||||
|
||||
sectionMultipliers = {
|
||||
{"secA", 1},
|
||||
{"secB", 1.2f},
|
||||
{"secC", 1.2f},
|
||||
{"secD", 1},
|
||||
};
|
||||
|
||||
zoneName = "pit";
|
||||
mobDeathResetNumber = 20;
|
||||
changeNum = 18;
|
||||
|
||||
BaseStartup(self);
|
||||
}
|
||||
|
||||
void RandomSpawnerPit::OnTimerDone(Entity* self, std::string timerName) {
|
||||
BaseOnTimerDone(self, timerName);
|
||||
}
|
26
dScripts/02_server/Map/AM/RandomSpawnerPit.h
Normal file
26
dScripts/02_server/Map/AM/RandomSpawnerPit.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "BaseRandomServer.h"
|
||||
|
||||
class RandomSpawnerPit : public CppScripts::Script, BaseRandomServer
|
||||
{
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
private:
|
||||
struct Mobs
|
||||
{
|
||||
static const LOT stromb = 11212;
|
||||
static const LOT mech = 11213;
|
||||
static const LOT spider = 11214;
|
||||
static const LOT pirate = 11215;
|
||||
static const LOT admiral = 11216;
|
||||
static const LOT gorilla = 11217;
|
||||
static const LOT ronin = 11218;
|
||||
static const LOT horse = 11219;
|
||||
static const LOT dragon = 112200;
|
||||
};
|
||||
|
||||
Mobs mobs;
|
||||
};
|
||||
|
82
dScripts/02_server/Map/AM/RandomSpawnerStr.cpp
Normal file
82
dScripts/02_server/Map/AM/RandomSpawnerStr.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "RandomSpawnerStr.h"
|
||||
|
||||
void RandomSpawnerStr::OnStartup(Entity* self) {
|
||||
zones = {
|
||||
{ //-- ** Load 1 -------------------------- **
|
||||
{{mobs.stromb, 4, "type1",},
|
||||
{mobs.pirate, 3, "type2",},
|
||||
{mobs.ronin, 3, "type3",}},
|
||||
45
|
||||
},
|
||||
{ //-- ** Load 2 -------------------------- **
|
||||
{{mobs.stromb, 3, "type1",},
|
||||
{mobs.pirate, 3, "type2",},
|
||||
{mobs.mech, 3, "type3",}},
|
||||
20
|
||||
},
|
||||
{ //-- ** Load 3 -------------------------- **
|
||||
{{mobs.stromb, 4, "type1",},
|
||||
{mobs.admiral, 2, "type2",},
|
||||
{mobs.spider, 1, "type3",}},
|
||||
10
|
||||
},
|
||||
{ //-- ** Load 4 -------------------------- **
|
||||
{{mobs.mech, 3, "type1",},
|
||||
{mobs.spider, 1, "type2",},
|
||||
{mobs.stromb, 4, "type3",}},
|
||||
3
|
||||
},
|
||||
{ //-- ** Load 5 -------------------------- **
|
||||
{{mobs.horse, 1, "type1",},
|
||||
{mobs.ronin, 5, "type2",},
|
||||
{mobs.pirate, 2, "type3",}},
|
||||
1
|
||||
},
|
||||
{ //-- ** Load 6 -------------------------- **
|
||||
{{mobs.gorilla, 1, "type1",},
|
||||
{mobs.pirate, 5, "type2",},
|
||||
{mobs.admiral, 2, "type3",}},
|
||||
1
|
||||
},
|
||||
{ //-- ** Load 7 -------------------------- **
|
||||
{{mobs.admiral, 2, "type1",},
|
||||
{mobs.stromb, 4, "type2",},
|
||||
{mobs.ronin, 2, "type3",}},
|
||||
3
|
||||
},
|
||||
{ //-- ** Load 8 -------------------------- **
|
||||
{{mobs.admiral, 3, "type1",},
|
||||
{mobs.gorilla, 1, "type2",},
|
||||
{mobs.horse, 1, "type3",}},
|
||||
1
|
||||
},
|
||||
{ //-- ** Load 9 -------------------------- **
|
||||
{{mobs.ronin, 3, "type1",},
|
||||
{mobs.ronin, 3, "type2",},
|
||||
{mobs.ronin, 3, "type3",}},
|
||||
5
|
||||
},
|
||||
{ //-- ** Load 10 -------------------------- **
|
||||
{{mobs.pirate, 4, "type1",},
|
||||
{mobs.pirate, 4, "type2",},
|
||||
{mobs.pirate, 4, "type3",}},
|
||||
1
|
||||
},
|
||||
};
|
||||
|
||||
sectionMultipliers = {
|
||||
{"secA", 1},
|
||||
{"secB", 1},
|
||||
{"secC", 1.2f},
|
||||
};
|
||||
|
||||
zoneName = "str";
|
||||
mobDeathResetNumber = 20;
|
||||
changeNum = 15;
|
||||
|
||||
BaseStartup(self);
|
||||
}
|
||||
|
||||
void RandomSpawnerStr::OnTimerDone(Entity* self, std::string timerName) {
|
||||
BaseOnTimerDone(self, timerName);
|
||||
}
|
26
dScripts/02_server/Map/AM/RandomSpawnerStr.h
Normal file
26
dScripts/02_server/Map/AM/RandomSpawnerStr.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "BaseRandomServer.h"
|
||||
|
||||
class RandomSpawnerStr : public CppScripts::Script, BaseRandomServer
|
||||
{
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
private:
|
||||
struct Mobs
|
||||
{
|
||||
static const LOT stromb = 11212;
|
||||
static const LOT mech = 11213;
|
||||
static const LOT spider = 11214;
|
||||
static const LOT pirate = 11215;
|
||||
static const LOT admiral = 11216;
|
||||
static const LOT gorilla = 11217;
|
||||
static const LOT ronin = 11218;
|
||||
static const LOT horse = 11219;
|
||||
static const LOT dragon = 112200;
|
||||
};
|
||||
|
||||
Mobs mobs;
|
||||
};
|
||||
|
91
dScripts/02_server/Map/AM/RandomSpawnerZip.cpp
Normal file
91
dScripts/02_server/Map/AM/RandomSpawnerZip.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
#include "RandomSpawnerZip.h"
|
||||
|
||||
void RandomSpawnerZip::OnStartup(Entity* self) {
|
||||
zones = {
|
||||
{ //-- ** Load 1 -------------------------- **
|
||||
{{mobs.stromb, 3, "type1",},
|
||||
{mobs.pirate, 2, "type2",},
|
||||
{mobs.admiral, 2, "type3",},
|
||||
{mobs.spider, 1, "type4",}},
|
||||
19
|
||||
},
|
||||
{ //-- ** Load 2 -------------------------- **
|
||||
{{mobs.spider, 1, "type1",},
|
||||
{mobs.pirate, 2, "type2",},
|
||||
{mobs.pirate, 1, "type3",},
|
||||
{mobs.admiral, 1, "type4",}},
|
||||
19
|
||||
},
|
||||
{ //-- ** Load 3 -------------------------- **
|
||||
{{mobs.mech, 3, "type1",},
|
||||
{mobs.stromb, 1, "type2",},
|
||||
{mobs.pirate, 1, "type3",},
|
||||
{mobs.stromb, 1, "type4",}},
|
||||
10
|
||||
},
|
||||
{ //-- ** Load 4 -------------------------- **
|
||||
{{mobs.horse, 1, "type1",},
|
||||
{mobs.stromb, 2, "type2",},
|
||||
{mobs.ronin, 1, "type3",},
|
||||
{mobs.pirate, 1, "type4",}},
|
||||
5
|
||||
},
|
||||
{ //-- ** Load 5 -------------------------- **
|
||||
{{mobs.gorilla, 1, "type1",},
|
||||
{mobs.admiral, 1, "type2",},
|
||||
{mobs.stromb, 2, "type3",},
|
||||
{mobs.pirate, 0, "type4",}},
|
||||
1
|
||||
},
|
||||
{ //-- ** Load 6 -------------------------- **
|
||||
{{mobs.ronin, 2, "type1",},
|
||||
{mobs.admiral, 2, "type2",},
|
||||
{mobs.stromb, 2, "type3",},
|
||||
{mobs.mech, 1, "type4",}},
|
||||
19
|
||||
},
|
||||
{ //-- ** Load 7 -------------------------- **
|
||||
{{mobs.spider, 2, "type1",},
|
||||
{mobs.stromb, 0, "type2",},
|
||||
{mobs.ronin, 0, "type3",},
|
||||
{mobs.pirate, 0, "type4",}},
|
||||
1
|
||||
},
|
||||
{ //-- ** Load 8 -------------------------- **
|
||||
{{mobs.pirate, 4, "type1",},
|
||||
{mobs.admiral, 1, "type2",},
|
||||
{mobs.ronin, 0, "type3",},
|
||||
{mobs.pirate, 0, "type4",}},
|
||||
3
|
||||
},
|
||||
{ //-- ** Load 9 -------------------------- **
|
||||
{{mobs.spider, 1, "type1",},
|
||||
{mobs.mech, 2, "type2",},
|
||||
{mobs.stromb, 2, "type3",},
|
||||
{mobs.pirate, 0, "type4",}},
|
||||
18
|
||||
},
|
||||
{ //-- ** Load 10 -------------------------- **
|
||||
{{mobs.horse, 1, "type1",},
|
||||
{mobs.stromb, 0, "type2",},
|
||||
{mobs.ronin, 2, "type3",},
|
||||
{mobs.pirate, 0, "type4",}},
|
||||
1
|
||||
},
|
||||
};
|
||||
|
||||
sectionMultipliers = {
|
||||
{"secA", 1.2f},
|
||||
{"secB", 1.2f},
|
||||
};
|
||||
|
||||
zoneName = "zip";
|
||||
mobDeathResetNumber = 20;
|
||||
changeNum = 9;
|
||||
|
||||
BaseStartup(self);
|
||||
}
|
||||
|
||||
void RandomSpawnerZip::OnTimerDone(Entity* self, std::string timerName) {
|
||||
BaseOnTimerDone(self, timerName);
|
||||
}
|
26
dScripts/02_server/Map/AM/RandomSpawnerZip.h
Normal file
26
dScripts/02_server/Map/AM/RandomSpawnerZip.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "BaseRandomServer.h"
|
||||
|
||||
class RandomSpawnerZip : public CppScripts::Script, BaseRandomServer
|
||||
{
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
private:
|
||||
struct Mobs
|
||||
{
|
||||
static const LOT stromb = 11212;
|
||||
static const LOT mech = 11213;
|
||||
static const LOT spider = 11214;
|
||||
static const LOT pirate = 11215;
|
||||
static const LOT admiral = 11216;
|
||||
static const LOT gorilla = 11217;
|
||||
static const LOT ronin = 11218;
|
||||
static const LOT horse = 11219;
|
||||
static const LOT dragon = 112200;
|
||||
};
|
||||
|
||||
Mobs mobs;
|
||||
};
|
||||
|
Reference in New Issue
Block a user