mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-14 11:28:08 +00:00
Merge branch 'main' into movingPlatformWork
This commit is contained in:
@@ -28,4 +28,11 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB_BOSS_INSTANCE})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB} "boss_instance/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB} PARENT_SCOPE)
|
||||
add_library(dScriptsServerMapNJHub ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB})
|
||||
target_include_directories(dScriptsServerMapNJHub PUBLIC "." "boss_instance")
|
||||
target_link_libraries(dScriptsServerMapNJHub
|
||||
dScriptsServerPets
|
||||
dScriptsServerMapAM
|
||||
dScriptsServerMapGeneral
|
||||
)
|
||||
target_precompile_headers(dScriptsServerMapNJHub REUSE_FROM dScriptsBase)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void CatapultBouncerServer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void CatapultBouncerServer::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"Built", 0, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
self->SetNetworkVar<bool>(u"Built", true);
|
||||
|
@@ -3,5 +3,5 @@
|
||||
|
||||
class CatapultBouncerServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
};
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "CavePrisonCage.h"
|
||||
#include "EntityManager.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Character.h"
|
||||
#include "dZoneManager.h"
|
||||
@@ -46,8 +46,8 @@ void CavePrisonCage::Setup(Entity* self, Spawner* spawner) {
|
||||
Game::entityManager->ConstructEntity(entity);
|
||||
}
|
||||
|
||||
void CavePrisonCage::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state != eRebuildState::RESETTING) {
|
||||
void CavePrisonCage::OnQuickBuildNotifyState(Entity* self, eQuickBuildState state) {
|
||||
if (state != eQuickBuildState::RESETTING) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,14 +69,14 @@ void CavePrisonCage::SpawnCounterweight(Entity* self, Spawner* spawner) {
|
||||
|
||||
self->SetVar<LWOOBJID>(u"Counterweight", counterweight->GetObjectID());
|
||||
|
||||
auto* rebuildComponent = counterweight->GetComponent<RebuildComponent>();
|
||||
auto* quickBuildComponent = counterweight->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (rebuildComponent != nullptr) {
|
||||
rebuildComponent->AddRebuildStateCallback([this, self](eRebuildState state) {
|
||||
OnRebuildNotifyState(self, state);
|
||||
if (quickBuildComponent != nullptr) {
|
||||
quickBuildComponent->AddQuickBuildStateCallback([this, self](eQuickBuildState state) {
|
||||
OnQuickBuildNotifyState(self, state);
|
||||
});
|
||||
|
||||
rebuildComponent->AddRebuildCompleteCallback([this, self](Entity* user) {
|
||||
quickBuildComponent->AddQuickBuildCompleteCallback([this, self](Entity* user) {
|
||||
// The counterweight is a simple mover, which is not implemented, so we'll just set it's position
|
||||
auto* counterweight = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Counterweight"));
|
||||
|
||||
|
@@ -5,7 +5,7 @@ class CavePrisonCage : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void Setup(Entity* self, Spawner* spawner);
|
||||
void OnRebuildNotifyState(Entity* self, eRebuildState state) override;
|
||||
void OnQuickBuildNotifyState(Entity* self, eQuickBuildState state) override;
|
||||
void SpawnCounterweight(Entity* self, Spawner* spawner);
|
||||
void GetButton(Entity* self);
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
@@ -37,7 +37,7 @@ void FlameJetServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
void FlameJetServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
Game::logger->Log("FlameJetServer::OnFireEventServerSide", "Event: %s", args.c_str());
|
||||
LOG("Event: %s", args.c_str());
|
||||
|
||||
if (args == "OnActivated") {
|
||||
self->SetNetworkVar<bool>(u"FlameOn", false);
|
||||
|
@@ -1,15 +1,15 @@
|
||||
#include "ImaginationShrineServer.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
|
||||
void ImaginationShrineServer::OnUse(Entity* self, Entity* user) {
|
||||
// If the rebuild component is complete, use the shrine
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr) {
|
||||
if (quickBuildComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
if (quickBuildComponent->GetState() == eQuickBuildState::COMPLETED) {
|
||||
// Use the shrine
|
||||
BaseUse(self, user);
|
||||
}
|
||||
|
@@ -14,6 +14,6 @@ void NjDragonEmblemChestServer::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
auto* destroyable = self->GetComponent<DestroyableComponent>();
|
||||
if (destroyable != nullptr) {
|
||||
LootGenerator::Instance().DropLoot(user, self, destroyable->GetLootMatrixID(), 0, 0);
|
||||
Loot::DropLoot(user, self, destroyable->GetLootMatrixID(), 0, 0);
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ static std::map<std::u16string, uint32_t> ElementMissions = {
|
||||
{u"fire", 1962},
|
||||
};
|
||||
|
||||
class NjNPCMissionSpinjitzuServer : public CppScripts::Script {
|
||||
class NjNPCMissionSpinjitzuServer : virtual public CppScripts::Script {
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
private:
|
||||
|
@@ -8,7 +8,7 @@ void RainOfArrows::OnStartup(Entity* self) {
|
||||
|
||||
}
|
||||
|
||||
void RainOfArrows::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void RainOfArrows::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
auto myPos = self->GetPosition();
|
||||
auto myRot = self->GetRotation();
|
||||
|
||||
|
@@ -5,7 +5,7 @@ class RainOfArrows : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
private:
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "NjMonastryBossInstance.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "dZoneManager.h"
|
||||
@@ -53,9 +53,9 @@ void NjMonastryBossInstance::OnPlayerLoaded(Entity* self, Entity* player) {
|
||||
// Buff the player
|
||||
auto* destroyableComponent = player->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetHealth((int32_t)destroyableComponent->GetMaxHealth());
|
||||
destroyableComponent->SetArmor((int32_t)destroyableComponent->GetMaxArmor());
|
||||
destroyableComponent->SetImagination((int32_t)destroyableComponent->GetMaxImagination());
|
||||
destroyableComponent->SetHealth(static_cast<int32_t>(destroyableComponent->GetMaxHealth()));
|
||||
destroyableComponent->SetArmor(static_cast<int32_t>(destroyableComponent->GetMaxArmor()));
|
||||
destroyableComponent->SetImagination(static_cast<int32_t>(destroyableComponent->GetMaxImagination()));
|
||||
}
|
||||
|
||||
// Add player ID to instance
|
||||
@@ -101,7 +101,7 @@ void NjMonastryBossInstance::OnPlayerExit(Entity* self, Entity* player) {
|
||||
if (playerToRemove != totalPlayersLoaded.end()) {
|
||||
totalPlayersLoaded.erase(playerToRemove);
|
||||
} else {
|
||||
Game::logger->Log("NjMonastryBossInstance", "Failed to remove player at exit.");
|
||||
LOG("Failed to remove player at exit.");
|
||||
}
|
||||
|
||||
// Set the players loaded var back
|
||||
@@ -117,7 +117,7 @@ void NjMonastryBossInstance::OnPlayerExit(Entity* self, Entity* player) {
|
||||
void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
auto split = GeneralUtils::SplitString(name, TimerSplitChar);
|
||||
auto timerName = split[0];
|
||||
auto objectID = split.size() > 1 ? (LWOOBJID)std::stoull(split[1]) : LWOOBJID_EMPTY;
|
||||
auto objectID = split.size() > 1 ? static_cast<LWOOBJID>(std::stoull(split[1])) : LWOOBJID_EMPTY;
|
||||
|
||||
if (timerName == WaitingForPlayersTimer) {
|
||||
StartFight(self);
|
||||
@@ -221,26 +221,26 @@ void NjMonastryBossInstance::HandleLedgedFrakjawSpawned(Entity* self, Entity* le
|
||||
}
|
||||
|
||||
void NjMonastryBossInstance::HandleCounterWeightSpawned(Entity* self, Entity* counterWeight) {
|
||||
auto* rebuildComponent = counterWeight->GetComponent<RebuildComponent>();
|
||||
if (rebuildComponent != nullptr) {
|
||||
rebuildComponent->AddRebuildStateCallback([this, self, counterWeight](eRebuildState state) {
|
||||
auto* quickBuildComponent = counterWeight->GetComponent<QuickBuildComponent>();
|
||||
if (quickBuildComponent != nullptr) {
|
||||
quickBuildComponent->AddQuickBuildStateCallback([this, self, counterWeight](eQuickBuildState state) {
|
||||
|
||||
switch (state) {
|
||||
case eRebuildState::BUILDING:
|
||||
case eQuickBuildState::BUILDING:
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification,
|
||||
0, 0, counterWeight->GetObjectID(),
|
||||
BaseCounterweightQB + std::to_string(self->GetVar<uint32_t>(WaveNumberVariable)),
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
return;
|
||||
case eRebuildState::INCOMPLETE:
|
||||
case eQuickBuildState::INCOMPLETE:
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), EndCinematicNotification,
|
||||
0, 0, LWOOBJID_EMPTY, "",
|
||||
UNASSIGNED_SYSTEM_ADDRESS);
|
||||
return;
|
||||
case eRebuildState::RESETTING:
|
||||
case eQuickBuildState::RESETTING:
|
||||
ActivityTimerStart(self, SpawnCounterWeightTimer, 0.0f, 0.0f);
|
||||
return;
|
||||
case eRebuildState::COMPLETED: {
|
||||
case eQuickBuildState::COMPLETED: {
|
||||
// TODO: Move the platform?
|
||||
|
||||
// The counterweight is actually a moving platform and we should listen to the last waypoint event here
|
||||
@@ -309,7 +309,7 @@ void NjMonastryBossInstance::HandleLowerFrakjawSpawned(Entity* self, Entity* low
|
||||
if (destroyableComponent != nullptr) {
|
||||
const auto doubleHealth = destroyableComponent->GetHealth() * 2;
|
||||
destroyableComponent->SetHealth(doubleHealth);
|
||||
destroyableComponent->SetMaxHealth((float_t)doubleHealth);
|
||||
destroyableComponent->SetMaxHealth(static_cast<float_t>(doubleHealth));
|
||||
}
|
||||
|
||||
ActivityTimerStart(self, FrakjawSpawnInTimer + std::to_string(lowerFrakjaw->GetObjectID()),
|
||||
@@ -328,7 +328,7 @@ void NjMonastryBossInstance::HandleLowerFrakjawHit(Entity* self, Entity* lowerFr
|
||||
return;
|
||||
|
||||
// Progress the fight to the last wave if frakjaw has less than 50% of his health left
|
||||
if (destroyableComponent->GetHealth() <= (uint32_t)destroyableComponent->GetMaxHealth() / 2 && !self->GetVar<bool>(OnLastWaveVarbiale)) {
|
||||
if (destroyableComponent->GetHealth() <= static_cast<uint32_t>(destroyableComponent->GetMaxHealth()) / 2 && !self->GetVar<bool>(OnLastWaveVarbiale)) {
|
||||
self->SetVar<bool>(OnLastWaveVarbiale, true);
|
||||
|
||||
// Stun frakjaw during the cinematic
|
||||
|
Reference in New Issue
Block a user