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:
17
dScripts/02_server/Map/AG/AgBugsprayer.cpp
Normal file
17
dScripts/02_server/Map/AG/AgBugsprayer.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "AgBugsprayer.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
self->AddTimer("castSkill", 1);
|
||||
self->SetOwnerOverride(target->GetObjectID());
|
||||
}
|
||||
|
||||
void AgBugsprayer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "castSkill") {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) return;
|
||||
|
||||
skillComponent->CalculateBehavior(1435, 36581, LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
10
dScripts/02_server/Map/AG/AgBugsprayer.h
Normal file
10
dScripts/02_server/Map/AG/AgBugsprayer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgBugsprayer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
27
dScripts/02_server/Map/AG/AgCagedBricksServer.cpp
Normal file
27
dScripts/02_server/Map/AG/AgCagedBricksServer.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "AgCagedBricksServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Character.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
|
||||
//Tell the client to spawn the baby spiderling:
|
||||
auto spooders = EntityManager::Instance()->GetEntitiesInGroup("cagedSpider");
|
||||
for (auto spodder : spooders) {
|
||||
GameMessages::SendFireEventClientSide(spodder->GetObjectID(), user->GetSystemAddress(), u"toggle", LWOOBJID_EMPTY, 0, 0, user->GetObjectID());
|
||||
}
|
||||
|
||||
//Set the flag & mission status:
|
||||
auto character = user->GetCharacter();
|
||||
|
||||
if (!character) return;
|
||||
|
||||
character->SetPlayerFlag(74, true);
|
||||
|
||||
//Remove the maelstrom cube:
|
||||
auto inv = static_cast<InventoryComponent*>(user->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
|
||||
if (inv) {
|
||||
inv->RemoveItem(14553, 1);
|
||||
}
|
||||
}
|
6
dScripts/02_server/Map/AG/AgCagedBricksServer.h
Normal file
6
dScripts/02_server/Map/AG/AgCagedBricksServer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgCagedBricksServer : public CppScripts::Script {
|
||||
void OnUse(Entity* self, Entity* user);
|
||||
};
|
55
dScripts/02_server/Map/AG/AgLaserSensorServer.cpp
Normal file
55
dScripts/02_server/Map/AG/AgLaserSensorServer.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "AgLaserSensorServer.h"
|
||||
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "AgMonumentLaserServer.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgLaserSensorServer::OnStartup(Entity* self) {
|
||||
|
||||
PhantomPhysicsComponent* physComp = static_cast<PhantomPhysicsComponent*>(self->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
|
||||
physComp->SetPhysicsEffectActive(true);
|
||||
physComp->SetEffectType(2); // repulse (prolly should make definitions of these are in Entity.cpp)
|
||||
physComp->SetDirectionalMultiplier(static_cast<float>(m_RepelForce));
|
||||
physComp->SetDirection(NiPoint3::UNIT_Y);
|
||||
|
||||
m_Skill = self->GetComponent<SkillComponent>();
|
||||
}
|
||||
|
||||
|
||||
void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
|
||||
if (!m_Skill) return;
|
||||
|
||||
|
||||
Entity* laser = nullptr;
|
||||
|
||||
for (auto script : EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPT)) {
|
||||
|
||||
AgMonumentLaserServer* hasLaser = (AgMonumentLaserServer*)script;
|
||||
|
||||
if (hasLaser) {
|
||||
const auto source = script->GetPosition();
|
||||
const auto obj = self->GetObjectID();
|
||||
|
||||
if (obj == 76690936093053 && Vector3::DistanceSquared(source, NiPoint3(149.007f, 417.083f, 218.346f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
} else if (obj == 75866302318824 && Vector3::DistanceSquared(source, NiPoint3(48.6403f, 403.803f, 196.711f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
} else if (obj == 75866302318822 && Vector3::DistanceSquared(source, NiPoint3(19.2155f, 420.083f, 249.226f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
} else if (obj == 75866302318823 && Vector3::DistanceSquared(source, NiPoint3(-6.61596f, 404.633f, 274.323f)) <= 1.0f) {
|
||||
laser = script;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (laser != nullptr) {
|
||||
m_Skill->CalculateBehavior(m_SkillCastID, 15714, target->GetObjectID());
|
||||
}
|
||||
}
|
15
dScripts/02_server/Map/AG/AgLaserSensorServer.h
Normal file
15
dScripts/02_server/Map/AG/AgLaserSensorServer.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class SkillComponent;
|
||||
|
||||
class AgLaserSensorServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self);
|
||||
void OnCollisionPhantom(Entity* self, Entity* target);
|
||||
private:
|
||||
SkillComponent* m_Skill;
|
||||
int m_RepelForce = -25;
|
||||
int m_SkillCastID = 163;
|
||||
};
|
||||
|
33
dScripts/02_server/Map/AG/AgMonumentBirds.cpp
Normal file
33
dScripts/02_server/Map/AG/AgMonumentBirds.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "AgMonumentBirds.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//Makes the ag birds fly away when you get close and smashes them.
|
||||
//Created mrb... 6 / 3 / 11
|
||||
//Ported Max 20/07/2020
|
||||
//--------------------------------------------------------------
|
||||
|
||||
void AgMonumentBirds::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(flyRadius, "MonumentBirds");
|
||||
}
|
||||
|
||||
void AgMonumentBirds::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (self->GetVar<bool>(u"IsFlying")) return;
|
||||
|
||||
if (name == "MonumentBirds" && status == "ENTER") {
|
||||
self->AddTimer("killBird", 1.0f);
|
||||
GameMessages::SendPlayAnimation(self, sOnProximityAnim);
|
||||
self->SetVar<bool>(u"IsFlying", true);
|
||||
self->SetVar<LWOOBJID>(u"PlayerID", entering->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void AgMonumentBirds::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName != "killBird") return;
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
|
||||
if (player == nullptr) return;
|
||||
|
||||
self->ScheduleKillAfterUpdate(player);
|
||||
}
|
13
dScripts/02_server/Map/AG/AgMonumentBirds.h
Normal file
13
dScripts/02_server/Map/AG/AgMonumentBirds.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentBirds : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self);
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status);
|
||||
void OnTimerDone(Entity* self, std::string timerName);
|
||||
|
||||
private:
|
||||
std::u16string sOnProximityAnim = u"fly1";
|
||||
float flyRadius = 5.0f;
|
||||
};
|
20
dScripts/02_server/Map/AG/AgMonumentLaserServer.cpp
Normal file
20
dScripts/02_server/Map/AG/AgMonumentLaserServer.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "AgMonumentLaserServer.h"
|
||||
|
||||
void AgMonumentLaserServer::OnStartup(Entity* self) {
|
||||
/*
|
||||
self->SetProximityRadius(m_Radius, "MonumentLaser");
|
||||
|
||||
std::cout << "Monument Laser " << self->GetObjectID() << " is at " << self->GetPosition().GetX()
|
||||
<< ","<< self->GetPosition().GetY() << "," << self->GetPosition().GetZ() << std::endl;
|
||||
*/
|
||||
}
|
||||
|
||||
void AgMonumentLaserServer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
/*
|
||||
if (status == "ENTER") {
|
||||
|
||||
std::cout << "Monument laser ID: " << self->GetObjectID() << std::endl;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
10
dScripts/02_server/Map/AG/AgMonumentLaserServer.h
Normal file
10
dScripts/02_server/Map/AG/AgMonumentLaserServer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentLaserServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self);
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status);
|
||||
private:
|
||||
float m_Radius = 25.0f;
|
||||
};
|
9
dScripts/02_server/Map/AG/AgMonumentRaceCancel.cpp
Normal file
9
dScripts/02_server/Map/AG/AgMonumentRaceCancel.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "AgMonumentRaceCancel.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void AgMonumentRaceCancel::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
auto managers = EntityManager::Instance()->GetEntitiesInGroup("race_manager");
|
||||
if (!managers.empty()) {
|
||||
managers[0]->OnFireEventServerSide(target, "course_cancel");
|
||||
}
|
||||
}
|
6
dScripts/02_server/Map/AG/AgMonumentRaceCancel.h
Normal file
6
dScripts/02_server/Map/AG/AgMonumentRaceCancel.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentRaceCancel : public CppScripts::Script {
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
};
|
15
dScripts/02_server/Map/AG/AgMonumentRaceGoal.cpp
Normal file
15
dScripts/02_server/Map/AG/AgMonumentRaceGoal.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "AgMonumentRaceGoal.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
|
||||
void AgMonumentRaceGoal::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(15, "RaceGoal");
|
||||
}
|
||||
|
||||
void AgMonumentRaceGoal::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (name == "RaceGoal" && entering->IsPlayer() && status == "ENTER") {
|
||||
auto* manager = EntityManager::Instance()->GetEntitiesInGroup("race_manager")[0];
|
||||
|
||||
manager->OnFireEventServerSide(entering, "course_finish");
|
||||
}
|
||||
}
|
9
dScripts/02_server/Map/AG/AgMonumentRaceGoal.h
Normal file
9
dScripts/02_server/Map/AG/AgMonumentRaceGoal.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgMonumentRaceGoal : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
};
|
16
dScripts/02_server/Map/AG/CMakeLists.txt
Normal file
16
dScripts/02_server/Map/AG/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG
|
||||
"AgCagedBricksServer.cpp"
|
||||
"NpcWispServer.cpp"
|
||||
"NpcEpsilonServer.cpp"
|
||||
"AgLaserSensorServer.cpp"
|
||||
"AgMonumentLaserServer.cpp"
|
||||
"AgMonumentBirds.cpp"
|
||||
"RemoveRentalGear.cpp"
|
||||
"NpcNjAssistantServer.cpp"
|
||||
"AgBugsprayer.cpp"
|
||||
"NpcAgCourseStarter.cpp"
|
||||
"AgMonumentRaceGoal.cpp"
|
||||
"AgMonumentRaceCancel.cpp"
|
||||
"NpcCowboyServer.cpp"
|
||||
"NpcPirateServer.cpp"
|
||||
PARENT_SCOPE)
|
108
dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp
Normal file
108
dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
#include "NpcAgCourseStarter.h"
|
||||
#include "EntityManager.h"
|
||||
#include "ScriptedActivityComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "LeaderboardManager.h"
|
||||
#include "MissionComponent.h"
|
||||
#include <ctime>
|
||||
|
||||
void NpcAgCourseStarter::OnStartup(Entity* self) {
|
||||
|
||||
}
|
||||
|
||||
void NpcAgCourseStarter::OnUse(Entity* self, Entity* user) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (scriptedActivityComponent->GetActivityPlayerData(user->GetObjectID()) != nullptr) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"exit", 0, 0, LWOOBJID_EMPTY, "", user->GetSystemAddress());
|
||||
} else {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start", 0, 0, LWOOBJID_EMPTY, "", user->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
||||
void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
|
||||
if (scriptedActivityComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (identifier == u"player_dialog_cancel_course" && button == 1) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"cancel_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
} else if (identifier == u"player_dialog_start_course" && button == 1) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
GameMessages::SendActivityStart(self->GetObjectID(), sender->GetSystemAddress());
|
||||
|
||||
auto* data = scriptedActivityComponent->AddActivityPlayerData(sender->GetObjectID());
|
||||
|
||||
if (data->values[1] != 0) return;
|
||||
|
||||
time_t startTime = std::time(0) + 4; // Offset for starting timer
|
||||
|
||||
data->values[1] = *(float*)&startTime;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
} else if (identifier == u"FootRaceCancel") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
|
||||
if (scriptedActivityComponent->GetActivityPlayerData(sender->GetObjectID()) != nullptr) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"exit", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
} else {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"start", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
}
|
||||
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
|
||||
if (scriptedActivityComponent == nullptr)
|
||||
return;
|
||||
|
||||
auto* data = scriptedActivityComponent->GetActivityPlayerData(sender->GetObjectID());
|
||||
if (data == nullptr)
|
||||
return;
|
||||
|
||||
if (args == "course_cancel") {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"cancel_timer", 0, 0,
|
||||
LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
} else if (args == "course_finish") {
|
||||
time_t endTime = std::time(0);
|
||||
time_t finish = (endTime - *(time_t*)&data->values[1]);
|
||||
|
||||
data->values[2] = *(float*)&finish;
|
||||
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->ForceProgressTaskType(1884, 1, 1, false);
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, -finish, self->GetObjectID(),
|
||||
"performact_time");
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
LeaderboardManager::SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(),
|
||||
0, (uint32_t)finish);
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard",
|
||||
scriptedActivityComponent->GetActivityID(), 0, sender->GetObjectID(),
|
||||
"", sender->GetSystemAddress());
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stop_timer", 1, finish, LWOOBJID_EMPTY, "",
|
||||
sender->GetSystemAddress());
|
||||
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
}
|
||||
}
|
13
dScripts/02_server/Map/AG/NpcAgCourseStarter.h
Normal file
13
dScripts/02_server/Map/AG/NpcAgCourseStarter.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcAgCourseStarter : public CppScripts::Script {
|
||||
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 OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
};
|
26
dScripts/02_server/Map/AG/NpcCowboyServer.cpp
Normal file
26
dScripts/02_server/Map/AG/NpcCowboyServer.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "NpcCowboyServer.h"
|
||||
#include "MissionState.h"
|
||||
#include "InventoryComponent.h"
|
||||
|
||||
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID != 1880) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (missionState == MissionState::MISSION_STATE_COMPLETE_ACTIVE ||
|
||||
missionState == MissionState::MISSION_STATE_ACTIVE ||
|
||||
missionState == MissionState::MISSION_STATE_AVAILABLE ||
|
||||
missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE) {
|
||||
if (inventoryComponent->GetLotCount(14378) == 0) {
|
||||
inventoryComponent->AddItem(14378, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
}
|
||||
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
inventoryComponent->RemoveItem(14378, 1);
|
||||
}
|
||||
}
|
7
dScripts/02_server/Map/AG/NpcCowboyServer.h
Normal file
7
dScripts/02_server/Map/AG/NpcCowboyServer.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcCowboyServer : public CppScripts::Script
|
||||
{
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
};
|
10
dScripts/02_server/Map/AG/NpcEpsilonServer.cpp
Normal file
10
dScripts/02_server/Map/AG/NpcEpsilonServer.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "NpcEpsilonServer.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void NpcEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
|
||||
//If we are completing the Nexus Force join mission, play the celebration for it:
|
||||
if (missionID == 1851) {
|
||||
GameMessages::SendStartCelebrationEffect(target, target->GetSystemAddress(), 22);
|
||||
}
|
||||
}
|
7
dScripts/02_server/Map/AG/NpcEpsilonServer.h
Normal file
7
dScripts/02_server/Map/AG/NpcEpsilonServer.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcEpsilonServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
};
|
||||
|
27
dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp
Normal file
27
dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "NpcNjAssistantServer.h"
|
||||
#include "GameMessages.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "Item.h"
|
||||
|
||||
void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID != mailMission) return;
|
||||
|
||||
if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"switch", 0, 0, LWOOBJID_EMPTY, "", target->GetSystemAddress());
|
||||
|
||||
auto* inv = static_cast<InventoryComponent*>(target->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
|
||||
// If we are ready to complete our missions, we take the kit from you:
|
||||
if (inv && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
auto* id = inv->FindItemByLot(14397); //the kit's lot
|
||||
|
||||
if (id != nullptr) {
|
||||
inv->RemoveItem(id->GetLot(), id->GetCount());
|
||||
}
|
||||
}
|
||||
} else if (missionState == MissionState::MISSION_STATE_AVAILABLE) {
|
||||
auto* missionComponent = static_cast<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
|
||||
missionComponent->CompleteMission(mailAchievement, true);
|
||||
}
|
||||
}
|
10
dScripts/02_server/Map/AG/NpcNjAssistantServer.h
Normal file
10
dScripts/02_server/Map/AG/NpcNjAssistantServer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcNjAssistantServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
|
||||
private:
|
||||
int mailMission = 1728; //mission to get the item out of your mailbox
|
||||
int mailAchievement = 1729; // fun fact: spelled "Achivement" in the actual script
|
||||
};
|
17
dScripts/02_server/Map/AG/NpcPirateServer.cpp
Normal file
17
dScripts/02_server/Map/AG/NpcPirateServer.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "NpcPirateServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
|
||||
void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
auto* inventory = target->GetComponent<InventoryComponent>();
|
||||
if (inventory != nullptr && missionID == 1881) {
|
||||
auto* luckyShovel = inventory->FindItemByLot(14591);
|
||||
|
||||
// Add or remove the lucky shovel based on whether the mission was completed or started
|
||||
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
|
||||
&& luckyShovel == nullptr) {
|
||||
inventory->AddItem(14591, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
inventory->RemoveItem(14591, 1);
|
||||
}
|
||||
}
|
||||
}
|
6
dScripts/02_server/Map/AG/NpcPirateServer.h
Normal file
6
dScripts/02_server/Map/AG/NpcPirateServer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcPirateServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
};
|
43
dScripts/02_server/Map/AG/NpcWispServer.cpp
Normal file
43
dScripts/02_server/Map/AG/NpcWispServer.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "NpcWispServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID != 1849 && missionID != 1883)
|
||||
return;
|
||||
|
||||
auto* inventory = target->GetComponent<InventoryComponent>();
|
||||
if (inventory == nullptr)
|
||||
return;
|
||||
|
||||
LOT maelstromVacuumLot = 14592;
|
||||
auto* maelstromVacuum = inventory->FindItemByLot(maelstromVacuumLot);
|
||||
|
||||
// For the daily we add the maelstrom vacuum if the player doesn't have it yet
|
||||
if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
|
||||
&& maelstromVacuum == nullptr) {
|
||||
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
inventory->RemoveItem(maelstromVacuumLot, 1);
|
||||
}
|
||||
|
||||
// Next up hide or show the samples based on the mission state
|
||||
auto visible = 1;
|
||||
if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
visible = 0;
|
||||
}
|
||||
|
||||
auto groups = missionID == 1849
|
||||
? std::vector<std::string> { "MaelstromSamples" }
|
||||
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
|
||||
|
||||
for (const auto& group : groups) {
|
||||
auto samples = EntityManager::Instance()->GetEntitiesInGroup(group);
|
||||
for (auto* sample : samples) {
|
||||
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
}
|
6
dScripts/02_server/Map/AG/NpcWispServer.h
Normal file
6
dScripts/02_server/Map/AG/NpcWispServer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NpcWispServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
};
|
39
dScripts/02_server/Map/AG/RemoveRentalGear.cpp
Normal file
39
dScripts/02_server/Map/AG/RemoveRentalGear.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "RemoveRentalGear.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "Item.h"
|
||||
#include "Character.h"
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------
|
||||
--Removes the rental gear from the player on mission turn in
|
||||
--
|
||||
--created mrb ... 5 / 25 / 11
|
||||
--updated abeechler 6 / 27 / 11 ... Add session flag resetting for set equips
|
||||
--ported Max 21/07/2020
|
||||
--------------------------------------------------------------
|
||||
--add missionID configData to the object in HF to remove this
|
||||
--gear what the specified mission is completed
|
||||
--------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID != defaultMission && missionID != 313) return;
|
||||
|
||||
if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
auto inv = static_cast<InventoryComponent*>(target->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
if (!inv) return;
|
||||
|
||||
//remove the inventory items
|
||||
for (int item : gearSets) {
|
||||
auto* id = inv->FindItemByLot(item);
|
||||
if (id) {
|
||||
inv->UnEquipItem(id);
|
||||
inv->RemoveItem(id->GetLot(), id->GetCount());
|
||||
}
|
||||
}
|
||||
|
||||
//reset the equipment flag
|
||||
auto character = target->GetCharacter();
|
||||
if (character) character->SetPlayerFlag(equipFlag, false);
|
||||
}
|
||||
}
|
12
dScripts/02_server/Map/AG/RemoveRentalGear.h
Normal file
12
dScripts/02_server/Map/AG/RemoveRentalGear.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class RemoveRentalGear : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
|
||||
private:
|
||||
int defaultMission = 768; //mission to remove gearSets on completion
|
||||
std::vector<int> gearSets = { 14359,14321,14353,14315 }; //inventory items to remove
|
||||
int equipFlag = 126; //Set upon wearing trial faction armor for the first time in a session
|
||||
};
|
||||
|
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;
|
||||
};
|
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;
|
||||
};
|
||||
|
81
dScripts/02_server/Map/CMakeLists.txt
Normal file
81
dScripts/02_server/Map/CMakeLists.txt
Normal file
@@ -0,0 +1,81 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP)
|
||||
|
||||
add_subdirectory(AG)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "AG/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(AG_Spider_Queen)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "AG_Spider_Queen/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(AM)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "AM/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(FV)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "FV/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(General)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "General/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(GF)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_GF})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "GF/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(njhub)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "njhub/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(NS)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "NS/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(NT)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NT})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "NT/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(PR)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PR})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "PR/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(Property)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "Property/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(SS)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_SS})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "SS/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(VE)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_VE})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} "VE/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP ${DSCRIPTS_SOURCES_02_SERVER_MAP} PARENT_SCOPE)
|
14
dScripts/02_server/Map/FV/CMakeLists.txt
Normal file
14
dScripts/02_server/Map/FV/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV
|
||||
"EnemyRoninSpawner.cpp"
|
||||
"FvCandle.cpp"
|
||||
"FvFong.cpp"
|
||||
"FvHorsemenTrigger.cpp"
|
||||
"ImgBrickConsoleQB.cpp")
|
||||
|
||||
add_subdirectory(Racing)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV} "Racing/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV} PARENT_SCOPE)
|
68
dScripts/02_server/Map/FV/EnemyRoninSpawner.cpp
Normal file
68
dScripts/02_server/Map/FV/EnemyRoninSpawner.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
#include "EnemyRoninSpawner.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void EnemyRoninSpawner::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(15, "ronin");
|
||||
}
|
||||
|
||||
void EnemyRoninSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "hatchTime") {
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->PlayEffect(644, u"create", "BurstFX1");
|
||||
}
|
||||
|
||||
EntityInfo info{};
|
||||
info.lot = 7815;
|
||||
info.pos = self->GetPosition();
|
||||
info.rot = self->GetRotation();
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* spawnedEntity = EntityManager::Instance()->CreateEntity(info);
|
||||
|
||||
if (spawnedEntity == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(spawnedEntity);
|
||||
|
||||
spawnedEntity->AddCallbackTimer(60, [spawnedEntity]() {
|
||||
spawnedEntity->Smash(spawnedEntity->GetObjectID());
|
||||
});
|
||||
|
||||
self->Smash(self->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void EnemyRoninSpawner::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (entering->IsPlayer() && name == "ronin" && status == "ENTER" && !self->GetVar<bool>(u"hatching")) {
|
||||
StartHatching(self);
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(305, 3568, LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnemyRoninSpawner::OnHit(Entity* self, Entity* attacker) {
|
||||
if (!self->GetVar<bool>(u"hatching")) {
|
||||
StartHatching(self);
|
||||
}
|
||||
}
|
||||
|
||||
void EnemyRoninSpawner::StartHatching(Entity* self) {
|
||||
self->SetVar(u"hatching", true);
|
||||
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->PlayEffect(2260, u"rebuild_medium", "WakeUpFX1");
|
||||
}
|
||||
|
||||
self->AddTimer("hatchTime", 2);
|
||||
}
|
12
dScripts/02_server/Map/FV/EnemyRoninSpawner.h
Normal file
12
dScripts/02_server/Map/FV/EnemyRoninSpawner.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class EnemyRoninSpawner final : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnHit(Entity* self, Entity* attacker) override;
|
||||
void StartHatching(Entity* self);
|
||||
};
|
||||
|
55
dScripts/02_server/Map/FV/FvCandle.cpp
Normal file
55
dScripts/02_server/Map/FV/FvCandle.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "FvCandle.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
std::vector<int32_t> FvCandle::m_Missions = { 850, 1431, 1529, 1566, 1603 };
|
||||
|
||||
void FvCandle::OnStartup(Entity* self) {
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
if (render == nullptr)
|
||||
return;
|
||||
|
||||
render->PlayEffect(2108, u"create", "candle_light", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||
self->SetI32(u"Smoke", static_cast<int32_t>(5));
|
||||
self->SetBoolean(u"AmHit", false);
|
||||
}
|
||||
|
||||
void FvCandle::OnHit(Entity* self, Entity* attacker) {
|
||||
BlowOutCandle(self, attacker);
|
||||
}
|
||||
|
||||
void FvCandle::BlowOutCandle(Entity* self, Entity* blower) {
|
||||
if (self->GetBoolean(u"AmHit"))
|
||||
return;
|
||||
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
if (render == nullptr)
|
||||
return;
|
||||
|
||||
auto* missionComponent = blower->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
for (const auto mission : m_Missions) {
|
||||
missionComponent->ForceProgressTaskType(mission, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//Update mission tasks here
|
||||
self->SetBoolean(u"AmHit", true);
|
||||
|
||||
render->StopEffect("candle_light", false);
|
||||
render->PlayEffect(2109, u"create", "candle_smoke", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||
|
||||
self->AddTimer("SmokeTime", self->GetI32(u"Smoke"));
|
||||
}
|
||||
|
||||
void FvCandle::OnTimerDone(Entity* self, std::string timerName) {
|
||||
self->SetBoolean(u"AmHit", false);
|
||||
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
if (render == nullptr)
|
||||
return;
|
||||
|
||||
render->StopEffect("candle_smoke", false);
|
||||
render->PlayEffect(2108, u"create", "candle_light", LWOOBJID_EMPTY, 1.0f, 1.0f, true);
|
||||
}
|
14
dScripts/02_server/Map/FV/FvCandle.h
Normal file
14
dScripts/02_server/Map/FV/FvCandle.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvCandle : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self);
|
||||
void OnHit(Entity* self, Entity* attacker);
|
||||
void OnTimerDone(Entity* self, std::string timerName);
|
||||
private:
|
||||
void BlowOutCandle(Entity* self, Entity* blower);
|
||||
|
||||
static std::vector<int32_t> m_Missions;
|
||||
};
|
10
dScripts/02_server/Map/FV/FvFong.cpp
Normal file
10
dScripts/02_server/Map/FV/FvFong.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "FvFong.h"
|
||||
#include "Darkitect.h"
|
||||
#include "MissionState.h"
|
||||
|
||||
void FvFong::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID == 734 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
Darkitect Baron;
|
||||
Baron.Reveal(self, target);
|
||||
}
|
||||
}
|
8
dScripts/02_server/Map/FV/FvFong.h
Normal file
8
dScripts/02_server/Map/FV/FvFong.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FvFong : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
};
|
53
dScripts/02_server/Map/FV/FvHorsemenTrigger.cpp
Normal file
53
dScripts/02_server/Map/FV/FvHorsemenTrigger.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "FvHorsemenTrigger.h"
|
||||
#include "EntityManager.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void FvHorsemenTrigger::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(40, "horsemenTrigger");
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"players", {});
|
||||
}
|
||||
|
||||
void FvHorsemenTrigger::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (name != "horsemenTrigger" || !entering->IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto players = self->GetVar<std::vector<LWOOBJID>>(u"players");
|
||||
|
||||
const auto& iter = std::find(players.begin(), players.end(), entering->GetObjectID());
|
||||
|
||||
if (status == "ENTER" && iter == players.end()) {
|
||||
players.push_back(entering->GetObjectID());
|
||||
} else if (status == "LEAVE" && iter != players.end()) {
|
||||
players.erase(iter);
|
||||
}
|
||||
|
||||
self->SetVar<std::vector<LWOOBJID>>(u"players", players);
|
||||
}
|
||||
|
||||
void
|
||||
FvHorsemenTrigger::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
auto players = self->GetVar<std::vector<LWOOBJID>>(u"players");
|
||||
|
||||
if (args == "HorsemenDeath") {
|
||||
for (const auto& playerId : self->GetVar<std::vector<LWOOBJID>>(u"players")) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
|
||||
if (player == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const auto missionId : m_Missions) {
|
||||
missionComponent->ForceProgressTaskType(missionId, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
dScripts/02_server/Map/FV/FvHorsemenTrigger.h
Normal file
15
dScripts/02_server/Map/FV/FvHorsemenTrigger.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
class FvHorsemenTrigger : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) override;
|
||||
|
||||
private:
|
||||
std::vector<int32_t> m_Missions = { 854, 738, 1432, 1530, 1567, 1604 };
|
||||
};
|
240
dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp
Normal file
240
dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp
Normal file
@@ -0,0 +1,240 @@
|
||||
#include "ImgBrickConsoleQB.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
|
||||
int32_t ImgBrickConsoleQB::ResetBricks = 30;
|
||||
int32_t ImgBrickConsoleQB::ResetConsole = 60;
|
||||
int32_t ImgBrickConsoleQB::ResetInteract = 45;
|
||||
|
||||
void ImgBrickConsoleQB::OnStartup(Entity* self) {
|
||||
self->SetNetworkVar(u"used", false);
|
||||
|
||||
self->AddTimer("reset", ResetBricks);
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
|
||||
if (!self->GetNetworkVar<bool>(u"used")) {
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
|
||||
|
||||
auto bothBuilt = false;
|
||||
|
||||
for (auto* console : consoles) {
|
||||
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
|
||||
|
||||
if (consoleRebuildComponent->GetState() != REBUILD_COMPLETED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
console->CancelAllTimers();
|
||||
|
||||
if (console->GetNetworkVar<bool>(u"used")) {
|
||||
bothBuilt = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (bothBuilt) {
|
||||
SmashCanister(self);
|
||||
} else {
|
||||
SpawnBrick(self);
|
||||
}
|
||||
|
||||
self->AddTimer("Die", ResetInteract);
|
||||
|
||||
auto onFX = 0;
|
||||
|
||||
const auto location = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"console"));
|
||||
|
||||
if (location == "Left") {
|
||||
onFX = 2776;
|
||||
} else {
|
||||
onFX = 2779;
|
||||
}
|
||||
|
||||
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
|
||||
|
||||
if (!facility.empty()) {
|
||||
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeEnergy");
|
||||
GameMessages::SendPlayFXEffect(facility[0]->GetObjectID(), onFX, u"create", location + "PipeOn");
|
||||
}
|
||||
}
|
||||
|
||||
auto* player = user;
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
|
||||
if (missionComponent != nullptr && inventoryComponent != nullptr) {
|
||||
if (missionComponent->GetMissionState(1302) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
inventoryComponent->RemoveItem(13074, 1);
|
||||
|
||||
missionComponent->ForceProgressTaskType(1302, 1, 1);
|
||||
}
|
||||
|
||||
if (missionComponent->GetMissionState(1926) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
inventoryComponent->RemoveItem(14472, 1);
|
||||
|
||||
missionComponent->ForceProgressTaskType(1926, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"used", true);
|
||||
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::SpawnBrick(Entity* self) {
|
||||
const auto netDevil = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug");
|
||||
if (!netDevil.empty()) {
|
||||
netDevil[0]->Reset();
|
||||
netDevil[0]->Deactivate();
|
||||
}
|
||||
|
||||
const auto brick = dZoneManager::Instance()->GetSpawnersByName("Imagination");
|
||||
if (!brick.empty()) {
|
||||
brick[0]->Activate();
|
||||
}
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::SmashCanister(Entity* self) {
|
||||
const auto brick = EntityManager::Instance()->GetEntitiesInGroup("Imagination");
|
||||
if (!brick.empty()) {
|
||||
GameMessages::SendPlayFXEffect(brick[0]->GetObjectID(), 122, u"create", "bluebrick");
|
||||
GameMessages::SendPlayFXEffect(brick[0]->GetObjectID(), 1034, u"cast", "imaginationexplosion");
|
||||
}
|
||||
|
||||
const auto canisters = EntityManager::Instance()->GetEntitiesInGroup("Canister");
|
||||
for (auto* canister : canisters) {
|
||||
canister->Smash(canister->GetObjectID(), VIOLENT);
|
||||
}
|
||||
|
||||
const auto canister = dZoneManager::Instance()->GetSpawnersByName("BrickCanister");
|
||||
if (!canister.empty()) {
|
||||
canister[0]->Reset();
|
||||
canister[0]->Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
auto energyFX = 0;
|
||||
|
||||
const auto location = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"console"));
|
||||
|
||||
if (location == "Left") {
|
||||
energyFX = 2775;
|
||||
} else {
|
||||
energyFX = 2778;
|
||||
}
|
||||
|
||||
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
|
||||
|
||||
if (!facility.empty()) {
|
||||
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeOff");
|
||||
GameMessages::SendPlayFXEffect(facility[0]->GetObjectID(), energyFX, u"create", location + "PipeEnergy");
|
||||
}
|
||||
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
|
||||
|
||||
for (auto* console : consoles) {
|
||||
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
|
||||
|
||||
if (consoleRebuildComponent->GetState() != REBUILD_COMPLETED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
console->CancelAllTimers();
|
||||
}
|
||||
|
||||
self->AddTimer("Die", ResetConsole);
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) {
|
||||
if (self->GetVar<bool>(u"Died")) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->CancelAllTimers();
|
||||
|
||||
self->SetVar(u"Died", true);
|
||||
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
|
||||
auto offFX = 0;
|
||||
|
||||
const auto location = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"console"));
|
||||
|
||||
if (location == "Left") {
|
||||
offFX = 2774;
|
||||
} else {
|
||||
offFX = 2777;
|
||||
}
|
||||
|
||||
const auto& facility = EntityManager::Instance()->GetEntitiesInGroup("FacilityPipes");
|
||||
|
||||
if (!facility.empty()) {
|
||||
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeEnergy");
|
||||
GameMessages::SendStopFXEffect(facility[0], true, location + "PipeOn");
|
||||
GameMessages::SendPlayFXEffect(facility[0]->GetObjectID(), offFX, u"create", location + "PipeOff");
|
||||
GameMessages::SendPlayFXEffect(facility[0]->GetObjectID(), 2750, u"create", location + "imagination_canister");
|
||||
}
|
||||
}
|
||||
|
||||
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
|
||||
|
||||
const auto pipeGroup = myGroup.substr(0, 10);
|
||||
|
||||
const auto firstPipe = pipeGroup + "1";
|
||||
|
||||
const auto samePipeSpawner = dZoneManager::Instance()->GetSpawnersByName(myGroup);
|
||||
if (!samePipeSpawner.empty()) {
|
||||
samePipeSpawner[0]->Reset();
|
||||
samePipeSpawner[0]->Deactivate();
|
||||
}
|
||||
|
||||
const auto firstPipeSpawner = dZoneManager::Instance()->GetSpawnersByName(firstPipe);
|
||||
if (!firstPipeSpawner.empty()) {
|
||||
firstPipeSpawner[0]->Activate();
|
||||
}
|
||||
|
||||
const auto netdevil = dZoneManager::Instance()->GetSpawnersByName("Imagination");
|
||||
if (!netdevil.empty()) {
|
||||
netdevil[0]->Reset();
|
||||
netdevil[0]->Deactivate();
|
||||
}
|
||||
|
||||
const auto brick = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug");
|
||||
if (!brick.empty()) {
|
||||
brick[0]->Activate();
|
||||
}
|
||||
|
||||
const auto canister = dZoneManager::Instance()->GetSpawnersByName("BrickCanister");
|
||||
if (!canister.empty()) {
|
||||
canister[0]->Activate();
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"used", false);
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "reset") {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == REBUILD_OPEN) {
|
||||
self->Smash(self->GetObjectID(), SILENT);
|
||||
}
|
||||
} else if (timerName == "Die") {
|
||||
const auto consoles = EntityManager::Instance()->GetEntitiesInGroup("Console");
|
||||
|
||||
for (auto* console : consoles) {
|
||||
console->Smash(console->GetObjectID(), VIOLENT);
|
||||
}
|
||||
}
|
||||
}
|
19
dScripts/02_server/Map/FV/ImgBrickConsoleQB.h
Normal file
19
dScripts/02_server/Map/FV/ImgBrickConsoleQB.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class ImgBrickConsoleQB : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void SpawnBrick(Entity* self);
|
||||
void SmashCanister(Entity* self);
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
public:
|
||||
static int32_t ResetBricks;
|
||||
static int32_t ResetConsole;
|
||||
static int32_t ResetInteract;
|
||||
};
|
3
dScripts/02_server/Map/FV/Racing/CMakeLists.txt
Normal file
3
dScripts/02_server/Map/FV/Racing/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING
|
||||
"RaceMaelstromGeiser.cpp"
|
||||
PARENT_SCOPE)
|
85
dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp
Normal file
85
dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include "RaceMaelstromGeiser.h"
|
||||
#include "GameMessages.h"
|
||||
#include "PossessableComponent.h"
|
||||
#include "PossessorComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "RacingControlComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
void RaceMaelstromGeiser::OnStartup(Entity* self) {
|
||||
self->SetVar(u"AmFiring", false);
|
||||
|
||||
self->AddTimer("downTime", self->GetVar<int32_t>(u"startTime"));
|
||||
|
||||
self->SetProximityRadius(15, "deathZone");
|
||||
}
|
||||
|
||||
void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (!entering->IsPlayer() || name != "deathZone" || status != "ENTER") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self->GetVar<bool>(u"AmFiring")) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* possessableComponent = entering->GetComponent<PossessableComponent>();
|
||||
|
||||
Entity* vehicle;
|
||||
Entity* player;
|
||||
|
||||
if (possessableComponent != nullptr) {
|
||||
player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
vehicle = entering;
|
||||
} else if (entering->IsPlayer()) {
|
||||
auto* possessorComponent = entering->GetComponent<PossessorComponent>();
|
||||
|
||||
if (possessorComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
|
||||
if (vehicle == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
player = entering;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, VIOLENT, u"", 0, 0, 0, true, false, 0);
|
||||
|
||||
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
|
||||
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
|
||||
if (racingControlComponent != nullptr) {
|
||||
racingControlComponent->OnRequestDie(player);
|
||||
}
|
||||
}
|
||||
|
||||
void RaceMaelstromGeiser::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "downTime") {
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), 4048, u"rebuild_medium", "geiser", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
self->AddTimer("buildUpTime", 1);
|
||||
} else if (timerName == "buildUpTime") {
|
||||
self->SetVar(u"AmFiring", true);
|
||||
|
||||
self->AddTimer("killTime", 1.5f);
|
||||
} else if (timerName == "killTime") {
|
||||
GameMessages::SendStopFXEffect(self, true, "geiser");
|
||||
|
||||
self->SetVar(u"AmFiring", false);
|
||||
|
||||
self->AddTimer("downTime", 3.0);
|
||||
}
|
||||
}
|
10
dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.h
Normal file
10
dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class RaceMaelstromGeiser : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
};
|
6
dScripts/02_server/Map/GF/CMakeLists.txt
Normal file
6
dScripts/02_server/Map/GF/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GF
|
||||
"GfTikiTorch.cpp"
|
||||
"GfCaptainsCannon.cpp"
|
||||
"MastTeleport.cpp"
|
||||
"SpawnLionServer.cpp"
|
||||
PARENT_SCOPE)
|
83
dScripts/02_server/Map/GF/GfCaptainsCannon.cpp
Normal file
83
dScripts/02_server/Map/GF/GfCaptainsCannon.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "GfCaptainsCannon.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetVar<bool>(u"bIsInUse")) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar<LWOOBJID>(u"userID", user->GetObjectID());
|
||||
|
||||
self->SetVar<bool>(u"bIsInUse", true);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", true);
|
||||
|
||||
GameMessages::SendSetStunned(user->GetObjectID(), PUSH, user->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
auto position = self->GetPosition();
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
|
||||
position.x += forward.x * -3;
|
||||
position.z += forward.z * -3;
|
||||
|
||||
auto rotation = self->GetRotation();
|
||||
|
||||
GameMessages::SendTeleport(user->GetObjectID(), position, rotation, user->GetSystemAddress());
|
||||
|
||||
GameMessages::SendPlayAnimation(user, u"cannon-strike-no-equip");
|
||||
|
||||
GameMessages::SendPlayFXEffect(user->GetObjectID(), 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
self->AddTimer("FireCannon", 1.667f);
|
||||
}
|
||||
|
||||
void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
|
||||
if (player == nullptr) {
|
||||
self->SetVar<bool>(u"bIsInUse", false);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "FireCannon") {
|
||||
float cinematicTime = 6.3f;
|
||||
|
||||
GameMessages::SendPlayCinematic(playerId, u"Cannon_Cam", player->GetSystemAddress());
|
||||
|
||||
self->AddTimer("cinematicTimer", cinematicTime);
|
||||
|
||||
const auto sharkObjects = EntityManager::Instance()->GetEntitiesInGroup("SharkCannon");
|
||||
|
||||
for (auto* shark : sharkObjects) {
|
||||
if (shark->GetLOT() != m_SharkItemID) continue;
|
||||
|
||||
GameMessages::SendPlayAnimation(shark, u"cannon");
|
||||
}
|
||||
|
||||
GameMessages::SendPlay2DAmbientSound(player, "{7457d85c-4537-4317-ac9d-2f549219ea87}");
|
||||
} else if (timerName == "cinematicTimer") {
|
||||
GameMessages::SendSetStunned(playerId, POP, player->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
self->SetVar<bool>(u"bIsInUse", false);
|
||||
self->SetNetworkVar<bool>(u"bIsInUse", false);
|
||||
|
||||
GameMessages::SendStopFXEffect(player, true, "hook");
|
||||
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->ForceProgress(601, 910, 1);
|
||||
}
|
||||
|
||||
GameMessages::SendTerminateInteraction(playerId, FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
}
|
11
dScripts/02_server/Map/GF/GfCaptainsCannon.h
Normal file
11
dScripts/02_server/Map/GF/GfCaptainsCannon.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class GfCaptainsCannon : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
int32_t m_SharkItemID = 7343;
|
||||
};
|
75
dScripts/02_server/Map/GF/GfTikiTorch.cpp
Normal file
75
dScripts/02_server/Map/GF/GfTikiTorch.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include "GfTikiTorch.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void GfTikiTorch::OnStartup(Entity* self) {
|
||||
LightTorch(self);
|
||||
}
|
||||
|
||||
void GfTikiTorch::OnUse(Entity* self, Entity* killer) {
|
||||
if (self->GetBoolean(u"isInUse")) {
|
||||
self->SetBoolean(u"isInUse", false);
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"interact");
|
||||
self->SetI64(u"userID", killer->GetObjectID());
|
||||
|
||||
for (int i = 0; i < m_numspawn; i++) {
|
||||
GameMessages::SendDropClientLoot(killer, self->GetObjectID(), 935, 0, self->GetPosition());
|
||||
}
|
||||
|
||||
self->AddTimer("InteractionCooldown", 4);
|
||||
}
|
||||
|
||||
void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "Relight") {
|
||||
LightTorch(self);
|
||||
} else if (timerName == "InteractionCooldown") {
|
||||
Entity* player = EntityManager::Instance()->GetEntity(self->GetI64(u"userID"));
|
||||
|
||||
if (player != nullptr && player->GetCharacter()) {
|
||||
GameMessages::SendTerminateInteraction(player->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
|
||||
self->SetBoolean(u"isInUse", false);
|
||||
|
||||
self->SetI64(u"userID", 0);
|
||||
}
|
||||
}
|
||||
|
||||
void GfTikiTorch::LightTorch(Entity* self) {
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
if (renderComponent == nullptr)
|
||||
return;
|
||||
|
||||
self->SetBoolean(u"isInUse", false);
|
||||
|
||||
renderComponent->PlayEffect(611, u"fire", "tikitorch");
|
||||
self->SetBoolean(u"isBurning", true);
|
||||
}
|
||||
|
||||
void GfTikiTorch::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
|
||||
if (self->GetBoolean(u"isBurning") && message == "waterspray") {
|
||||
GameMessages::SendPlayAnimation(self, u"water");
|
||||
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
if (renderComponent != nullptr) {
|
||||
renderComponent->StopEffect("tikitorch");
|
||||
renderComponent->PlayEffect(611, u"water", "water");
|
||||
renderComponent->PlayEffect(611, u"steam", "steam");
|
||||
}
|
||||
|
||||
auto* casterMissionComponent = caster->GetComponent<MissionComponent>();
|
||||
if (casterMissionComponent != nullptr) {
|
||||
for (const auto missionID : m_missions) {
|
||||
casterMissionComponent->ForceProgressTaskType(missionID, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
|
||||
}
|
||||
}
|
||||
|
||||
self->AddTimer("Relight", 7.0f);
|
||||
self->SetBoolean(u"isBurning", false);
|
||||
}
|
||||
}
|
17
dScripts/02_server/Map/GF/GfTikiTorch.h
Normal file
17
dScripts/02_server/Map/GF/GfTikiTorch.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class GfTikiTorch : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnUse(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) override;
|
||||
private:
|
||||
void LightTorch(Entity* self);
|
||||
|
||||
LOT m_imaginationlot = 935;
|
||||
int32_t m_numspawn = 3;
|
||||
std::vector<int> m_missions = { 472, 1429, 1527, 1564, 1601 };
|
||||
};
|
88
dScripts/02_server/Map/GF/MastTeleport.cpp
Normal file
88
dScripts/02_server/Map/GF/MastTeleport.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
#include "MastTeleport.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Preconditions.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
void MastTeleport::OnStartup(Entity* self) {
|
||||
self->SetNetworkVar<std::string>(u"hookPreconditions", "154;44", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
void MastTeleport::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
if (Preconditions::Check(target, 154) && Preconditions::Check(target, 44)) {
|
||||
self->SetVar<LWOOBJID>(u"userID", target->GetObjectID());
|
||||
|
||||
GameMessages::SendSetStunned(target->GetObjectID(), PUSH, target->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true
|
||||
);
|
||||
|
||||
self->AddTimer("Start", 3);
|
||||
}
|
||||
}
|
||||
|
||||
void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"userID");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
|
||||
if (player == nullptr) return;
|
||||
|
||||
if (timerName == "Start") {
|
||||
auto position = self->GetPosition();
|
||||
auto rotation = self->GetRotation();
|
||||
|
||||
GameMessages::SendTeleport(playerId, position, rotation, player->GetSystemAddress(), true);
|
||||
|
||||
// Hacky fix for odd rotations
|
||||
if (self->GetVar<std::u16string>(u"MastName") != u"Jail") {
|
||||
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 140.0f, player->GetSystemAddress());
|
||||
} else {
|
||||
GameMessages::SendOrientToAngle(playerId, true, (M_PI / 180) * 100.0f, player->GetSystemAddress());
|
||||
}
|
||||
|
||||
const auto cinematic = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Cinematic"));
|
||||
const auto leanIn = self->GetVar<float>(u"LeanIn");
|
||||
|
||||
if (!cinematic.empty()) {
|
||||
GameMessages::SendPlayCinematic(playerId, GeneralUtils::ASCIIToUTF16(cinematic), player->GetSystemAddress(),
|
||||
true, true, false, false, 0, false, leanIn
|
||||
);
|
||||
}
|
||||
|
||||
GameMessages::SendPlayFXEffect(playerId, 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
GameMessages::SendPlayAnimation(player, u"crow-swing-no-equip");
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"swing");
|
||||
|
||||
self->AddTimer("PlayerAnimDone", 6.25f);
|
||||
} else if (timerName == "PlayerAnimDone") {
|
||||
GameMessages::SendStopFXEffect(player, true, "hook");
|
||||
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
|
||||
const auto degrees = -25.0f;
|
||||
|
||||
const auto rads = degrees * (static_cast<float>(M_PI) / 180.0f);
|
||||
|
||||
const Vector3 newPlayerRot = { 0, rads, 0 };
|
||||
|
||||
auto position = self->GetPosition();
|
||||
|
||||
position.x += (forward.x * 20.5f);
|
||||
position.y += 12;
|
||||
position.z += (forward.z * 20.5f);
|
||||
|
||||
GameMessages::SendOrientToAngle(playerId, true, rads, player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendTeleport(playerId, position, NiQuaternion::IDENTITY, player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendSetStunned(playerId, POP, player->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true
|
||||
);
|
||||
}
|
||||
}
|
9
dScripts/02_server/Map/GF/MastTeleport.h
Normal file
9
dScripts/02_server/Map/GF/MastTeleport.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class MastTeleport : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
10
dScripts/02_server/Map/GF/SpawnLionServer.cpp
Normal file
10
dScripts/02_server/Map/GF/SpawnLionServer.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "SpawnLionServer.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void SpawnLionServer::SetVariables(Entity* self) {
|
||||
self->SetVar<LOT>(u"petLOT", 3520);
|
||||
self->SetVar<std::string>(u"petType", "lion");
|
||||
self->SetVar<uint32_t>(u"maxPets", 5);
|
||||
self->SetVar<std::u16string>(u"spawnAnim", u"spawn-lion");
|
||||
self->SetVar<std::u16string>(u"spawnCinematic", u"Lion_spawn");
|
||||
}
|
6
dScripts/02_server/Map/GF/SpawnLionServer.h
Normal file
6
dScripts/02_server/Map/GF/SpawnLionServer.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "SpawnPetBaseServer.h"
|
||||
|
||||
class SpawnLionServer : public SpawnPetBaseServer {
|
||||
void SetVariables(Entity* self) override;
|
||||
};
|
23
dScripts/02_server/Map/General/BankInteractServer.cpp
Normal file
23
dScripts/02_server/Map/General/BankInteractServer.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "BankInteractServer.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void BankInteractServer::OnUse(Entity* self, Entity* user) {
|
||||
AMFArrayValue args;
|
||||
AMFStringValue* bank = new AMFStringValue();
|
||||
bank->SetStringValue("bank");
|
||||
args.InsertValue("state", bank);
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args);
|
||||
}
|
||||
|
||||
void BankInteractServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
if (args == "ToggleBank") {
|
||||
AMFArrayValue args;
|
||||
args.InsertValue("visible", new AMFFalseValue());
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleBank", &args);
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"CloseBank", 0, 0, LWOOBJID_EMPTY, "", sender->GetSystemAddress());
|
||||
}
|
||||
}
|
10
dScripts/02_server/Map/General/BankInteractServer.h
Normal file
10
dScripts/02_server/Map/General/BankInteractServer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class BankInteractServer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
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;
|
||||
};
|
@@ -0,0 +1,30 @@
|
||||
#include "BaseInteractDropLootServer.h"
|
||||
#include "Loot.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void BaseInteractDropLootServer::OnUse(Entity* self, Entity* user) {
|
||||
BaseUse(self, user);
|
||||
}
|
||||
|
||||
void BaseInteractDropLootServer::BaseUse(Entity* self, Entity* user) {
|
||||
auto cooldownTime = self->GetVar<float>(u"cooldownTime");
|
||||
if (cooldownTime == 0) cooldownTime = 5;
|
||||
|
||||
uint32_t lootMatrix = self->GetVar<int32_t>(u"UseLootMatrix");
|
||||
if (lootMatrix == 0) lootMatrix = self->GetVar<int32_t>(u"smashable_loot_matrix");
|
||||
if (lootMatrix == 0) lootMatrix = 715;
|
||||
|
||||
auto useSound = self->GetVar<std::string>(u"sound1");
|
||||
|
||||
if (!useSound.empty()) {
|
||||
GameMessages::SendPlayNDAudioEmitter(self, user->GetSystemAddress(), useSound);
|
||||
}
|
||||
|
||||
self->SetNetworkVar(u"bInUse", true);
|
||||
|
||||
LootGenerator::Instance().DropLoot(user, self, lootMatrix, 0, 0);
|
||||
|
||||
self->AddCallbackTimer(cooldownTime, [this, self]() {
|
||||
self->SetNetworkVar(u"bInUse", false);
|
||||
});
|
||||
}
|
10
dScripts/02_server/Map/General/BaseInteractDropLootServer.h
Normal file
10
dScripts/02_server/Map/General/BaseInteractDropLootServer.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class BaseInteractDropLootServer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
virtual void OnUse(Entity* self, Entity* user) override;
|
||||
void BaseUse(Entity* self, Entity* user);
|
||||
};
|
||||
|
15
dScripts/02_server/Map/General/Binoculars.cpp
Normal file
15
dScripts/02_server/Map/General/Binoculars.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "Binoculars.h"
|
||||
#include "Character.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Game.h"
|
||||
#include "dServer.h"
|
||||
|
||||
void Binoculars::OnUse(Entity* self, Entity* user) {
|
||||
const auto number = self->GetVarAsString(u"number");
|
||||
|
||||
int32_t flag = std::stoi(std::to_string(Game::server->GetZoneID()).substr(0, 2) + number);
|
||||
if (user->GetCharacter()->GetPlayerFlag(flag) == false) {
|
||||
user->GetCharacter()->SetPlayerFlag(flag, true);
|
||||
GameMessages::SendFireEventClientSide(self->GetObjectID(), user->GetSystemAddress(), u"achieve", LWOOBJID_EMPTY, 0, -1, LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
7
dScripts/02_server/Map/General/Binoculars.h
Normal file
7
dScripts/02_server/Map/General/Binoculars.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class Binoculars : public CppScripts::Script {
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user);
|
||||
};
|
28
dScripts/02_server/Map/General/CMakeLists.txt
Normal file
28
dScripts/02_server/Map/General/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL
|
||||
"BankInteractServer.cpp"
|
||||
"BaseInteractDropLootServer.cpp"
|
||||
"Binoculars.cpp"
|
||||
"ExplodingAsset.cpp"
|
||||
"ForceVolumeServer.cpp"
|
||||
"GrowingFlower.cpp"
|
||||
"ImaginationBackpackHealServer.cpp"
|
||||
"InvalidScript.cpp"
|
||||
"MailBoxServer.cpp"
|
||||
"NjRailSwitch.cpp"
|
||||
"PetDigServer.cpp"
|
||||
"PropertyDevice.cpp"
|
||||
"PropertyPlatform.cpp"
|
||||
"QbEnemyStunner.cpp"
|
||||
"QbSpawner.cpp"
|
||||
"StoryBoxInteractServer.cpp"
|
||||
"TokenConsoleServer.cpp"
|
||||
"TouchMissionUpdateServer.cpp"
|
||||
"WishingWellServer.cpp")
|
||||
|
||||
add_subdirectory(Ninjago)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL_NINJAGO})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL} "Ninjago/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL} PARENT_SCOPE)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user