mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-23 15:11:19 +00:00
Merge branch 'main' into moreMovementAi
This commit is contained in:
@@ -8,10 +8,6 @@ endforeach()
|
||||
|
||||
add_subdirectory(Enemy)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Enemy/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(Equipment)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_EQUIPMENT})
|
||||
@@ -20,10 +16,6 @@ endforeach()
|
||||
|
||||
add_subdirectory(Map)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Map/${file}")
|
||||
endforeach()
|
||||
|
||||
add_subdirectory(Minigame)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MINIGAME})
|
||||
@@ -38,8 +30,15 @@ endforeach()
|
||||
|
||||
add_subdirectory(Pets)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_02_SERVER_PETS})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} "Pets/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER ${DSCRIPTS_SOURCES_02_SERVER} PARENT_SCOPE)
|
||||
add_library(dScriptsServer STATIC ${DSCRIPTS_SOURCES_02_SERVER})
|
||||
target_include_directories(dScriptsServer PUBLIC "."
|
||||
"DLU"
|
||||
"Equipment"
|
||||
"Minigame"
|
||||
"Minigame/General"
|
||||
"Objects"
|
||||
"Pets")
|
||||
target_link_libraries(dScriptsServer INTERFACE
|
||||
dScriptsServerEnemy
|
||||
dScriptsServerMap)
|
||||
target_precompile_headers(dScriptsServer REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -52,7 +52,7 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
|
||||
if (Game::zoneManager->GetZoneID().GetMapID() == instanceZoneID) {
|
||||
if (Game::zoneManager->GetZoneID().GetMapID() == instanceZoneID && killer) {
|
||||
auto* missionComponent = killer->GetComponent<MissionComponent>();
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
@@ -85,7 +85,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 10, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
//First rotate for anim
|
||||
NiQuaternion rot = NiQuaternion::IDENTITY;
|
||||
NiQuaternion rot = NiQuaternionConstant::IDENTITY;
|
||||
|
||||
controllable->SetStatic(false);
|
||||
|
||||
@@ -179,7 +179,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
|
||||
|
||||
std::vector<LWOOBJID> spiderEggs{};
|
||||
|
||||
auto spooders = Game::entityManager->GetEntitiesInGroup("EGG");
|
||||
auto spooders = Game::entityManager->GetEntitiesInGroup("SpiderEggs");
|
||||
for (auto spodder : spooders) {
|
||||
spiderEggs.push_back(spodder->GetObjectID());
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
|
||||
for (auto en : hatchList) {
|
||||
if (en == randomEgg) {
|
||||
randomEggLoc++;
|
||||
randomEgg = spiderEggs[randomEggLoc];
|
||||
randomEgg = spiderEggs.at(randomEggLoc % spiderEggs.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self) {
|
||||
|
||||
if (index == 0) {
|
||||
impactList.insert(impactList.end(), spawned.begin(), spawned.end());
|
||||
} else {
|
||||
} else if (!spawned.empty()) {
|
||||
const auto randomIndex = GeneralUtils::GenerateRandomNumber<int32_t>(0, spawned.size() - 1);
|
||||
|
||||
impactList.push_back(spawned[randomIndex]);
|
||||
@@ -309,7 +309,7 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) {
|
||||
impactList.erase(impactList.begin());
|
||||
|
||||
if (entity == nullptr) {
|
||||
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact!");
|
||||
LOG("Failed to find impact!");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -317,7 +317,7 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) {
|
||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||
|
||||
if (skillComponent == nullptr) {
|
||||
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact skill component!");
|
||||
LOG("Failed to find impact skill component!");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
|
||||
}
|
||||
|
||||
if (targets.empty()) {
|
||||
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find RFS targets");
|
||||
LOG("Failed to find RFS targets");
|
||||
|
||||
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(5, 10));
|
||||
|
||||
@@ -402,7 +402,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
|
||||
const auto withdrawn = self->GetBoolean(u"isWithdrawn");
|
||||
if (!withdrawn) return;
|
||||
|
||||
NiQuaternion rot = NiQuaternion::IDENTITY;
|
||||
NiQuaternion rot = NiQuaternionConstant::IDENTITY;
|
||||
|
||||
//First rotate for anim
|
||||
controllable->SetStatic(false);
|
||||
@@ -597,12 +597,12 @@ void BossSpiderQueenEnemyServer::OnUpdate(Entity* self) {
|
||||
|
||||
if (!isWithdrawn) return;
|
||||
|
||||
if (controllable->GetRotation() == NiQuaternion::IDENTITY) {
|
||||
if (controllable->GetRotation() == NiQuaternionConstant::IDENTITY) {
|
||||
return;
|
||||
}
|
||||
|
||||
controllable->SetStatic(false);
|
||||
controllable->SetRotation(NiQuaternion::IDENTITY);
|
||||
controllable->SetRotation(NiQuaternionConstant::IDENTITY);
|
||||
controllable->SetStatic(true);
|
||||
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
|
||||
@@ -42,4 +42,15 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_WAVES})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "Waves/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} PARENT_SCOPE)
|
||||
add_library(dScriptsServerEnemy STATIC ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
|
||||
target_link_libraries(dScriptsServerEnemy dScriptsBase)
|
||||
target_include_directories(dScriptsServerEnemy PUBLIC "."
|
||||
"AG"
|
||||
"AM"
|
||||
"FV"
|
||||
"General"
|
||||
"Survival"
|
||||
"VE"
|
||||
"Waves"
|
||||
)
|
||||
target_precompile_headers(dScriptsServerEnemy REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -67,7 +67,7 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
|
||||
auto weakpoint = self->GetVar<int32_t>(u"weakpoint");
|
||||
|
||||
if (weakpoint == 0) {
|
||||
Game::logger->Log("FvMaelstromDragon", "Activating weakpoint");
|
||||
LOG("Activating weakpoint");
|
||||
|
||||
self->AddTimer("ReviveTimer", 12);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class BaseEnemyApe : public CppScripts::Script {
|
||||
class BaseEnemyApe : virtual public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "GeneralUtils.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "dNavMesh.h"
|
||||
|
||||
void BaseEnemyMech::OnStartup(Entity* self) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
@@ -19,7 +20,7 @@ void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
|
||||
ControllablePhysicsComponent* controlPhys = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
||||
if (!controlPhys) return;
|
||||
|
||||
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };
|
||||
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };
|
||||
|
||||
EntityInfo info = EntityInfo();
|
||||
std::vector<LDFBaseData*> cfg;
|
||||
|
||||
@@ -14,7 +14,7 @@ void GfApeSmashingQB::OnTimerDone(Entity* self, std::string timerName) {
|
||||
}
|
||||
}
|
||||
|
||||
void GfApeSmashingQB::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void GfApeSmashingQB::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
auto* ape = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"ape"));
|
||||
if (ape != nullptr) {
|
||||
ape->OnFireEventServerSide(target, "rebuildDone");
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
class GfApeSmashingQB : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
};
|
||||
|
||||
@@ -33,10 +33,10 @@ void TreasureChestDragonServer::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
if (memberObject == nullptr) continue;
|
||||
|
||||
LootGenerator::Instance().DropActivityLoot(memberObject, self, scriptedActivityComponent->GetActivityID(), rating);
|
||||
Loot::DropActivityLoot(memberObject, self, scriptedActivityComponent->GetActivityID(), rating);
|
||||
}
|
||||
} else {
|
||||
LootGenerator::Instance().DropActivityLoot(user, self, scriptedActivityComponent->GetActivityID(), rating);
|
||||
Loot::DropActivityLoot(user, self, scriptedActivityComponent->GetActivityID(), rating);
|
||||
}
|
||||
|
||||
self->Smash(self->GetObjectID());
|
||||
|
||||
@@ -45,7 +45,7 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string
|
||||
if (renderComponent != nullptr)
|
||||
renderComponent->PlayEffect(7730, u"cast", "bootyshine");
|
||||
|
||||
LootGenerator::Instance().DropLoot(player, self, 231, 75, 75);
|
||||
Loot::DropLoot(player, self, 231, 75, 75);
|
||||
}
|
||||
}
|
||||
} else if (args == "ChestDead") {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "AgBugsprayer.h"
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void AgBugsprayer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void AgBugsprayer::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
self->AddTimer("castSkill", 1);
|
||||
self->SetOwnerOverride(target->GetObjectID());
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class AgBugsprayer : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ void AgLaserSensorServer::OnStartup(Entity* self) {
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE);
|
||||
phantomPhysicsComponent->SetDirectionalMultiplier(repelForce);
|
||||
phantomPhysicsComponent->SetDirection(NiPoint3::UNIT_Y);
|
||||
phantomPhysicsComponent->SetDirection(NiPoint3Constant::UNIT_Y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,5 +12,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG
|
||||
"AgMonumentRaceGoal.cpp"
|
||||
"AgMonumentRaceCancel.cpp"
|
||||
"NpcCowboyServer.cpp"
|
||||
"NpcPirateServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
"NpcPirateServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapAG ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
|
||||
target_include_directories(dScriptsServerMapAG PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapAG REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -52,7 +52,7 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
|
||||
|
||||
time_t startTime = std::time(0) + 4; // Offset for starting timer
|
||||
|
||||
data->values[1] = *(float*)&startTime;
|
||||
data->values[1] = *reinterpret_cast<float*>(&startTime);
|
||||
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
} else if (identifier == u"FootRaceCancel") {
|
||||
@@ -81,9 +81,9 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
scriptedActivityComponent->RemoveActivityPlayerData(sender->GetObjectID());
|
||||
} else if (args == "course_finish") {
|
||||
time_t endTime = std::time(0);
|
||||
time_t finish = (endTime - *(time_t*)&data->values[1]);
|
||||
time_t finish = (endTime - *reinterpret_cast<time_t*>(&data->values[1]));
|
||||
|
||||
data->values[2] = *(float*)&finish;
|
||||
data->values[2] = *reinterpret_cast<float*>(&finish);
|
||||
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "NpcCowboyServer.h"
|
||||
#include "eMissionState.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionID != 1880) {
|
||||
@@ -23,4 +24,17 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
|
||||
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
inventoryComponent->RemoveItem(14378, 1);
|
||||
}
|
||||
|
||||
// Next up hide or show the samples based on the mission state
|
||||
int32_t visible = 1;
|
||||
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
visible = 0;
|
||||
}
|
||||
|
||||
auto spawners = Game::zoneManager->GetSpawnersByName("PlungerGunTargets");
|
||||
for (auto* spawner : spawners) {
|
||||
for (const auto entity : spawner->GetSpawnedObjectIDs())
|
||||
GameMessages::SendNotifyClientObject(entity, u"SetVisibility", visible, 0,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "NpcWispServer.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "eMissionState.h"
|
||||
#include "Spawner.h"
|
||||
|
||||
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionID != 1849 && missionID != 1883)
|
||||
@@ -25,7 +26,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
||||
}
|
||||
|
||||
// Next up hide or show the samples based on the mission state
|
||||
auto visible = 1;
|
||||
int32_t visible = 1;
|
||||
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
visible = 0;
|
||||
}
|
||||
@@ -35,9 +36,10 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
||||
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
|
||||
|
||||
for (const auto& group : groups) {
|
||||
auto samples = Game::entityManager->GetEntitiesInGroup(group);
|
||||
for (auto* sample : samples) {
|
||||
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
|
||||
auto spawners = Game::zoneManager->GetSpawnersByName(group);
|
||||
for (const auto* spawner : spawners) {
|
||||
for (const auto objId : spawner->GetSpawnedObjectIDs())
|
||||
GameMessages::SendNotifyClientObject(objId, u"SetVisibility", visible, 0,
|
||||
target->GetObjectID(), "", target->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN
|
||||
"ZoneAgSpiderQueen.cpp"
|
||||
"SpiderBossTreasureChestServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
"SpiderBossTreasureChestServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapAGSpiderQueen ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
|
||||
target_include_directories(dScriptsServerMapAGSpiderQueen PUBLIC ".")
|
||||
target_link_libraries(dScriptsServerMapAGSpiderQueen dScriptsServerMapProperty)
|
||||
target_precompile_headers(dScriptsServerMapAGSpiderQueen REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "ActivityManager.h"
|
||||
#include "ZoneAgProperty.h"
|
||||
|
||||
class ZoneAgSpiderQueen : ZoneAgProperty, ActivityManager {
|
||||
class ZoneAgSpiderQueen : public ZoneAgProperty, ActivityManager {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
|
||||
@@ -5,7 +5,7 @@ void AmBridge::OnStartup(Entity* self) {
|
||||
|
||||
}
|
||||
|
||||
void AmBridge::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void AmBridge::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console" + GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"bridge")));
|
||||
|
||||
if (consoles.empty()) {
|
||||
|
||||
@@ -5,6 +5,6 @@ class AmBridge : 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;
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ void AmDrawBridge::OnTimerDone(Entity* self, std::string timerName) {
|
||||
return;
|
||||
}
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3::ZERO);
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3Constant::ZERO);
|
||||
|
||||
Game::entityManager->SerializeEntity(bridge);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) {
|
||||
|
||||
const auto travelTime = 2.0f;
|
||||
|
||||
forwardVect = forwardVect * (float)((degrees / travelTime) * (3.14f / 180.0f));
|
||||
forwardVect = forwardVect * static_cast<float>((degrees / travelTime) * (3.14f / 180.0f));
|
||||
|
||||
simplePhysicsComponent->SetAngularVelocity(forwardVect);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "AmDropshipComputer.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "eMissionState.h"
|
||||
@@ -10,18 +10,14 @@ void AmDropshipComputer::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
if (!quickBuildComponent || quickBuildComponent->GetState() != eQuickBuildState::COMPLETED) return;
|
||||
|
||||
auto* missionComponent = user->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (missionComponent == nullptr || inventoryComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!missionComponent || !inventoryComponent) return;
|
||||
|
||||
if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == eMissionState::COMPLETE) {
|
||||
return;
|
||||
@@ -33,14 +29,12 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user) {
|
||||
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 pipeNum = GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1));
|
||||
if (!pipeNum) return;
|
||||
|
||||
const auto pipeGroup = myGroup.substr(0, 10);
|
||||
|
||||
const auto nextPipeNum = pipeNum + 1;
|
||||
const auto nextPipeNum = pipeNum.value() + 1;
|
||||
|
||||
const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup);
|
||||
|
||||
@@ -70,13 +64,11 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) {
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
const auto* const quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!quickBuildComponent) return;
|
||||
|
||||
if (timerName == "reset" && rebuildComponent->GetState() == eRebuildState::OPEN) {
|
||||
if (timerName == "reset" && quickBuildComponent->GetState() == eQuickBuildState::OPEN) {
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "BaseCombatAIComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnStartup(Entity* self) {
|
||||
@@ -100,7 +100,7 @@ void AmShieldGeneratorQuickbuild::OnTimerDone(Entity* self, std::string timerNam
|
||||
}
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void AmShieldGeneratorQuickbuild::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
StartShield(self);
|
||||
|
||||
auto enemiesInProximity = self->GetVar<std::vector<LWOOBJID>>(u"Enemies");
|
||||
@@ -174,9 +174,9 @@ void AmShieldGeneratorQuickbuild::BuffPlayers(Entity* self) {
|
||||
}
|
||||
|
||||
void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() != eRebuildState::COMPLETED) {
|
||||
if (quickBuildComponent == nullptr || quickBuildComponent->GetState() != eQuickBuildState::COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public:
|
||||
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 OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
|
||||
void StartShield(Entity* self);
|
||||
void BuffPlayers(Entity* self);
|
||||
|
||||
@@ -144,13 +144,10 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
|
||||
);
|
||||
|
||||
for (const auto& mission : missions) {
|
||||
int32_t missionID = 0;
|
||||
const auto missionID = GeneralUtils::TryParse<int32_t>(mission);
|
||||
if (!missionID) continue;
|
||||
|
||||
if (!GeneralUtils::TryParse(mission, missionID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
missionIDs.push_back(missionID);
|
||||
missionIDs.push_back(missionID.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,9 @@ void AmTemplateSkillVolume::OnSkillEventFired(Entity* self, Entity* caster, cons
|
||||
const auto missionIDs = GeneralUtils::SplitString(missionIDsVariable, '_');
|
||||
|
||||
for (const auto& missionIDStr : missionIDs) {
|
||||
int32_t missionID = 0;
|
||||
const auto missionID = GeneralUtils::TryParse<uint32_t>(missionIDStr);
|
||||
if (!missionID) continue;
|
||||
|
||||
if (!GeneralUtils::TryParse(missionIDStr, missionID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
missionComponent->ForceProgressTaskType(missionID, 1, 1, false);
|
||||
missionComponent->ForceProgressTaskType(missionID.value(), 1, 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,3 +18,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
|
||||
"AmTeapotServer.cpp"
|
||||
"WanderingVendor.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
||||
add_library(dScriptsServerMapAM ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||
target_include_directories(dScriptsServerMapAM PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapAM REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -1,81 +1,29 @@
|
||||
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)
|
||||
add_library(dScriptsServerMap INTERFACE)
|
||||
target_link_libraries(dScriptsServerMap INTERFACE
|
||||
dScriptsServerMapAG
|
||||
dScriptsServerMapAGSpiderQueen
|
||||
dScriptsServerMapAM
|
||||
dScriptsServerMapFV
|
||||
dScriptsServerMapGeneral
|
||||
dScriptsServerMapGF
|
||||
dScriptsServerMapNJHub
|
||||
dScriptsServerMapNS
|
||||
dScriptsServerMapNT
|
||||
dScriptsServerMapPR
|
||||
dScriptsServerMapProperty
|
||||
dScriptsServerMapSS
|
||||
dScriptsServerMapVE)
|
||||
|
||||
@@ -11,4 +11,6 @@ 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)
|
||||
add_library(dScriptsServerMapFV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV})
|
||||
target_include_directories(dScriptsServerMapFV PUBLIC "." "Racing")
|
||||
target_precompile_headers(dScriptsServerMapFV REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "ImgBrickConsoleQB.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
@@ -19,18 +19,18 @@ void ImgBrickConsoleQB::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
if (quickBuildComponent->GetState() == eQuickBuildState::COMPLETED) {
|
||||
if (!self->GetNetworkVar<bool>(u"used")) {
|
||||
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console");
|
||||
|
||||
auto bothBuilt = false;
|
||||
|
||||
for (auto* console : consoles) {
|
||||
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
|
||||
auto* consoleQuickBuildComponent = console->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (consoleRebuildComponent->GetState() != eRebuildState::COMPLETED) {
|
||||
if (consoleQuickBuildComponent->GetState() != eQuickBuildState::COMPLETED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void ImgBrickConsoleQB::SmashCanister(Entity* self) {
|
||||
}
|
||||
}
|
||||
|
||||
void ImgBrickConsoleQB::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void ImgBrickConsoleQB::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
auto energyFX = 0;
|
||||
|
||||
const auto location = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"console"));
|
||||
@@ -145,9 +145,9 @@ void ImgBrickConsoleQB::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
const auto consoles = Game::entityManager->GetEntitiesInGroup("Console");
|
||||
|
||||
for (auto* console : consoles) {
|
||||
auto* consoleRebuildComponent = console->GetComponent<RebuildComponent>();
|
||||
auto* consoleQuickBuildComponent = console->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (consoleRebuildComponent->GetState() != eRebuildState::COMPLETED) {
|
||||
if (consoleQuickBuildComponent->GetState() != eQuickBuildState::COMPLETED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -166,9 +166,9 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) {
|
||||
|
||||
self->SetVar(u"Died", true);
|
||||
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
if (quickBuildComponent->GetState() == eQuickBuildState::COMPLETED) {
|
||||
auto offFX = 0;
|
||||
|
||||
const auto location = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"console"));
|
||||
@@ -227,9 +227,9 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) {
|
||||
|
||||
void ImgBrickConsoleQB::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "reset") {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == eRebuildState::OPEN) {
|
||||
if (quickBuildComponent->GetState() == eQuickBuildState::OPEN) {
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
} else if (timerName == "Die") {
|
||||
|
||||
@@ -8,7 +8,7 @@ public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void SpawnBrick(Entity* self);
|
||||
void SmashCanister(Entity* self);
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
|
||||
|
||||
@@ -2,5 +2,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GF
|
||||
"GfTikiTorch.cpp"
|
||||
"GfCaptainsCannon.cpp"
|
||||
"MastTeleport.cpp"
|
||||
"SpawnLionServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
"SpawnLionServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapGF ${DSCRIPTS_SOURCES_02_SERVER_MAP_GF})
|
||||
target_include_directories(dScriptsServerMapGF PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapGF REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -16,7 +16,7 @@ void MastTeleport::OnStartup(Entity* self) {
|
||||
self->SetNetworkVar<std::string>(u"hookPreconditions", "154;44", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
void MastTeleport::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void MastTeleport::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
if (Preconditions::Check(target, 154) && Preconditions::Check(target, 44)) {
|
||||
self->SetVar<LWOOBJID>(u"userID", target->GetObjectID());
|
||||
|
||||
@@ -81,7 +81,7 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
GameMessages::SendOrientToAngle(playerId, true, rads, player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendTeleport(playerId, position, NiQuaternion::IDENTITY, player->GetSystemAddress());
|
||||
GameMessages::SendTeleport(playerId, position, NiQuaternionConstant::IDENTITY, player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendSetStunned(playerId, eStateChangeType::POP, player->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
class MastTeleport : 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;
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ void BaseInteractDropLootServer::BaseUse(Entity* self, Entity* user) {
|
||||
|
||||
self->SetNetworkVar(u"bInUse", true);
|
||||
|
||||
LootGenerator::Instance().DropLoot(user, self, lootMatrix, 0, 0);
|
||||
Loot::DropLoot(user, self, lootMatrix, 0, 0);
|
||||
|
||||
self->AddCallbackTimer(cooldownTime, [this, self]() {
|
||||
self->SetNetworkVar(u"bInUse", false);
|
||||
|
||||
@@ -3,10 +3,10 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL
|
||||
"BaseInteractDropLootServer.cpp"
|
||||
"Binoculars.cpp"
|
||||
"ExplodingAsset.cpp"
|
||||
"FrictionVolumeServer.cpp"
|
||||
"ForceVolumeServer.cpp"
|
||||
"GrowingFlower.cpp"
|
||||
"ImaginationBackpackHealServer.cpp"
|
||||
"InvalidScript.cpp"
|
||||
"MailBoxServer.cpp"
|
||||
"NjRailSwitch.cpp"
|
||||
"PetDigServer.cpp"
|
||||
@@ -17,6 +17,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL
|
||||
"StoryBoxInteractServer.cpp"
|
||||
"TokenConsoleServer.cpp"
|
||||
"TouchMissionUpdateServer.cpp"
|
||||
"VisToggleNotifierServer.cpp"
|
||||
"NTNaomiDirtServer.cpp"
|
||||
"WishingWellServer.cpp")
|
||||
|
||||
add_subdirectory(Ninjago)
|
||||
@@ -25,4 +27,6 @@ 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)
|
||||
add_library(dScriptsServerMapGeneral ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL})
|
||||
target_include_directories(dScriptsServerMapGeneral PUBLIC "." "Ninjago")
|
||||
target_precompile_headers(dScriptsServerMapGeneral REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "MissionComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "CDClientManager.h"
|
||||
#include "CDObjectSkillsTable.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
//TODO: this has to be updated so that you only get killed if you're in a certain radius.
|
||||
@@ -39,9 +41,11 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
||||
self->SetOwnerOverride(attacker->GetObjectID());
|
||||
|
||||
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16);
|
||||
self->Smash(attacker->GetObjectID());
|
||||
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent != nullptr) {
|
||||
// Technically supposed to get first skill in the skill component but only 1 object in the live game used this.
|
||||
skillComponent->CalculateBehavior(147, 4721, LWOOBJID_EMPTY, true);
|
||||
}
|
||||
|
||||
@@ -65,8 +69,6 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self->ScheduleKillAfterUpdate();
|
||||
}
|
||||
|
||||
void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
|
||||
19
dScripts/02_server/Map/General/FrictionVolumeServer.cpp
Normal file
19
dScripts/02_server/Map/General/FrictionVolumeServer.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "FrictionVolumeServer.h"
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "ePhysicsEffectType.h"
|
||||
#include "Game.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void FrictionVolumeServer::OnStartup(Entity* self) {
|
||||
auto frictionAmount = self->GetVar<float>(u"FrictionAmt");
|
||||
if (frictionAmount == 0.0f) frictionAmount = DefaultFrictionAmount;
|
||||
|
||||
auto* phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) return;
|
||||
|
||||
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::FRICTION);
|
||||
phantomPhysicsComponent->SetDirectionalMultiplier(frictionAmount);
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
}
|
||||
13
dScripts/02_server/Map/General/FrictionVolumeServer.h
Normal file
13
dScripts/02_server/Map/General/FrictionVolumeServer.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __FRICTIONVOLUMESERVER__H__
|
||||
#define __FRICTIONVOLUMESERVER__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class FrictionVolumeServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
private:
|
||||
const float DefaultFrictionAmount = 1.5f;
|
||||
};
|
||||
|
||||
#endif //!__FRICTIONVOLUMESERVER__H__
|
||||
@@ -13,7 +13,7 @@ void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::s
|
||||
const auto mission1 = self->GetVar<int32_t>(u"missionID");
|
||||
const auto mission2 = self->GetVar<int32_t>(u"missionID2");
|
||||
|
||||
LootGenerator::Instance().DropActivityLoot(target, self, self->GetLOT(), 0);
|
||||
Loot::DropActivityLoot(target, self, self->GetLOT(), 0);
|
||||
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
|
||||
14
dScripts/02_server/Map/General/NTNaomiDirtServer.cpp
Normal file
14
dScripts/02_server/Map/General/NTNaomiDirtServer.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "NTNaomiDirtServer.h"
|
||||
|
||||
namespace {
|
||||
std::map<int32_t, std::string> VisibilityMissionTable = {
|
||||
{1253, std::string("Dirt_Clouds_Sent")},
|
||||
{1276, std::string("Dirt_Clouds_Assem")},
|
||||
{1277, std::string("Dirt_Clouds_Para")},
|
||||
{1283, std::string("Dirt_Clouds_Halls")}
|
||||
};
|
||||
};
|
||||
|
||||
void NTNaomiDirtServer::OnStartup(Entity* self) {
|
||||
SetGameVariables(VisibilityMissionTable);
|
||||
}
|
||||
11
dScripts/02_server/Map/General/NTNaomiDirtServer.h
Normal file
11
dScripts/02_server/Map/General/NTNaomiDirtServer.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __NTNAOMIDIRTSERVER__H__
|
||||
#define __NTNAOMIDIRTSERVER__H__
|
||||
|
||||
#include "VisToggleNotifierServer.h"
|
||||
|
||||
class NTNaomiDirtServer : public VisToggleNotifierServer {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
};
|
||||
|
||||
#endif //!__NTNAOMIDIRTSERVER__H__
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "NjRailActivatorsServer.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "Character.h"
|
||||
|
||||
void NjRailActivatorsServer::OnUse(Entity* self, Entity* user) {
|
||||
const auto flag = self->GetVar<int32_t>(u"RailFlagNum");
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
|
||||
// Only allow use if this is not a quick build or the quick build is built
|
||||
if (rebuildComponent == nullptr || rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
if (quickBuildComponent == nullptr || quickBuildComponent->GetState() == eQuickBuildState::COMPLETED) {
|
||||
auto* character = user->GetCharacter();
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(flag, true);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "NjRailPostServer.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void NjRailPostServer::OnStartup(Entity* self) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
if (rebuildComponent != nullptr) {
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
if (quickBuildComponent != nullptr) {
|
||||
self->SetNetworkVar<bool>(NetworkNotActiveVariable, true);
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,8 @@ void NjRailPostServer::OnNotifyObject(Entity* self, Entity* sender, const std::s
|
||||
}
|
||||
}
|
||||
|
||||
void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == eRebuildState::COMPLETED) {
|
||||
void NjRailPostServer::OnQuickBuildNotifyState(Entity* self, eQuickBuildState state) {
|
||||
if (state == eQuickBuildState::COMPLETED) {
|
||||
auto* relatedRail = GetRelatedRail(self);
|
||||
if (relatedRail == nullptr)
|
||||
return;
|
||||
@@ -30,7 +30,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
return;
|
||||
|
||||
self->SetNetworkVar(NetworkNotActiveVariable, false);
|
||||
} else if (state == eRebuildState::RESETTING) {
|
||||
} else if (state == eQuickBuildState::RESETTING) {
|
||||
auto* relatedRail = GetRelatedRail(self);
|
||||
if (relatedRail == nullptr)
|
||||
return;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class NjRailPostServer : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) override;
|
||||
void OnRebuildNotifyState(Entity* self, eRebuildState state) override;
|
||||
void OnQuickBuildNotifyState(Entity* self, eQuickBuildState state) override;
|
||||
private:
|
||||
Entity* GetRelatedRail(Entity* self);
|
||||
const std::u16string NetworkNotActiveVariable = u"NetworkNotActive";
|
||||
|
||||
@@ -107,7 +107,7 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe
|
||||
return;
|
||||
|
||||
auto* playerEntity = Game::entityManager->GetEntity(playerID);
|
||||
if (!playerEntity || !playerEntity->GetParentUser() || !playerEntity->GetParentUser()->GetLastUsedChar())
|
||||
if (!playerEntity || !playerEntity->GetCharacter())
|
||||
return;
|
||||
|
||||
auto* player = playerEntity->GetCharacter();
|
||||
|
||||
@@ -11,7 +11,7 @@ void PropertyDevice::OnStartup(Entity* self) {
|
||||
}
|
||||
}
|
||||
|
||||
void PropertyDevice::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void PropertyDevice::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
auto propertyOwnerID = self->GetNetworkVar<std::string>(m_PropertyOwnerVariable);
|
||||
if (propertyOwnerID == std::to_string(LWOOBJID_EMPTY))
|
||||
return;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
class PropertyDevice : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
const std::u16string m_PropertyOwnerVariable = u"PropertyOwnerID";
|
||||
const uint32_t m_PropertyMissionID = 1291;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "PropertyPlatform.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MovingPlatformComponent.h"
|
||||
|
||||
void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void PropertyPlatform::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
// auto* movingPlatform = self->GetComponent<MovingPlatformComponent>();
|
||||
// if (movingPlatform != nullptr) {
|
||||
// movingPlatform->StopPathing();
|
||||
@@ -14,8 +14,8 @@ void PropertyPlatform::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
void PropertyPlatform::OnUse(Entity* self, Entity* user) {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
if (rebuildComponent != nullptr && rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
|
||||
if (quickBuildComponent != nullptr && quickBuildComponent->GetState() == eQuickBuildState::COMPLETED) {
|
||||
// auto* movingPlatform = self->GetComponent<MovingPlatformComponent>();
|
||||
// if (movingPlatform != nullptr) {
|
||||
// movingPlatform->GotoWaypoint(1);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class PropertyPlatform : public CppScripts::Script {
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
private:
|
||||
float_t movementDelay = 10.0f;
|
||||
float_t effectDelay = 5.0f;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "CDObjectSkillsTable.h"
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
|
||||
void QbEnemyStunner::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void QbEnemyStunner::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
auto* destroyable = self->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (destroyable != nullptr) {
|
||||
@@ -17,12 +17,12 @@ void QbEnemyStunner::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
if (!skillComponent) return;
|
||||
|
||||
// Get the skill IDs of this object.
|
||||
CDObjectSkillsTable* skillsTable = CDClientManager::Instance().GetTable<CDObjectSkillsTable>();
|
||||
CDObjectSkillsTable* skillsTable = CDClientManager::GetTable<CDObjectSkillsTable>();
|
||||
auto skills = skillsTable->Query([=](CDObjectSkills entry) {return (entry.objectTemplate == self->GetLOT()); });
|
||||
std::map<uint32_t, uint32_t> skillBehaviorMap;
|
||||
// For each skill, cast it with the associated behavior ID.
|
||||
for (auto skill : skills) {
|
||||
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
|
||||
CDSkillBehaviorTable* skillBehaviorTable = CDClientManager::GetTable<CDSkillBehaviorTable>();
|
||||
CDSkillBehavior behaviorData = skillBehaviorTable->GetSkillByID(skill.skillID);
|
||||
|
||||
skillBehaviorMap.insert(std::make_pair(skill.skillID, behaviorData.behaviorID));
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
class QbEnemyStunner : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
||||
23
dScripts/02_server/Map/General/VisToggleNotifierServer.cpp
Normal file
23
dScripts/02_server/Map/General/VisToggleNotifierServer.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "VisToggleNotifierServer.h"
|
||||
#include "eMissionState.h"
|
||||
#include "Game.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
void VisToggleNotifierServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionId, eMissionState missionState) {
|
||||
auto itr = m_GameVariables.find(missionId);
|
||||
if (itr != m_GameVariables.end()) {
|
||||
bool visible = true;
|
||||
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
visible = false;
|
||||
}
|
||||
|
||||
auto spawners = Game::zoneManager->GetSpawnersByName(itr->second);
|
||||
if (spawners.empty()) return;
|
||||
for (const auto spawner : spawners) {
|
||||
auto spawnedObjIds = spawner->GetSpawnedObjectIDs();
|
||||
for (const auto& objId : spawnedObjIds) {
|
||||
GameMessages::SendNotifyClientObject(objId, u"SetVisibility", visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
dScripts/02_server/Map/General/VisToggleNotifierServer.h
Normal file
15
dScripts/02_server/Map/General/VisToggleNotifierServer.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef __VISTOGGLENOTIFIERSERVER__H__
|
||||
#define __VISTOGGLENOTIFIERSERVER__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class VisToggleNotifierServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
protected:
|
||||
void SetGameVariables(std::map<int32_t, std::string>& gameVariables) { m_GameVariables = gameVariables; }
|
||||
private:
|
||||
std::map<int32_t, std::string> m_GameVariables;
|
||||
};
|
||||
|
||||
#endif //!__VISTOGGLENOTIFIERSERVER__H__
|
||||
@@ -21,7 +21,7 @@ void WishingWellServer::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendPlayNDAudioEmitter(self, user->GetSystemAddress(), audio);
|
||||
}
|
||||
|
||||
LootGenerator::Instance().DropActivityLoot(
|
||||
Loot::DropActivityLoot(
|
||||
user,
|
||||
self,
|
||||
static_cast<uint32_t>(scriptedActivity->GetActivityID()),
|
||||
|
||||
@@ -10,4 +10,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS_WAVES})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS} "Waves/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS} PARENT_SCOPE)
|
||||
add_library(dScriptsServerMapNS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS})
|
||||
target_include_directories(dScriptsServerMapNS PUBLIC "." "Waves")
|
||||
target_precompile_headers(dScriptsServerMapNS REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Amf3.h"
|
||||
|
||||
void NsLegoClubDoor::OnStartup(Entity* self) {
|
||||
self->SetVar(u"currentZone", (int32_t)Game::zoneManager->GetZoneID().GetMapID());
|
||||
self->SetVar(u"currentZone", static_cast<int32_t>(Game::zoneManager->GetZoneID().GetMapID()));
|
||||
self->SetVar(u"choiceZone", m_ChoiceZoneID);
|
||||
self->SetVar(u"teleportAnim", m_TeleportAnim);
|
||||
self->SetVar(u"teleportString", m_TeleportString);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Amf3.h"
|
||||
|
||||
void NsLupTeleport::OnStartup(Entity* self) {
|
||||
self->SetVar(u"currentZone", (int32_t)Game::zoneManager->GetZoneID().GetMapID());
|
||||
self->SetVar(u"currentZone", static_cast<int32_t>(Game::zoneManager->GetZoneID().GetMapID()));
|
||||
self->SetVar(u"choiceZone", m_ChoiceZoneID);
|
||||
self->SetVar(u"teleportAnim", m_TeleportAnim);
|
||||
self->SetVar(u"teleportString", m_TeleportString);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "GameMessages.h"
|
||||
#include "Character.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RebuildComponent.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "eTerminateType.h"
|
||||
#include "ePlayerFlag.h"
|
||||
|
||||
@@ -12,13 +12,13 @@ void NsTokenConsoleServer::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void NsTokenConsoleServer::OnUse(Entity* self, Entity* user) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ std::vector<Wave> ZoneNsWaves::GetWaves() {
|
||||
}, {}, {},
|
||||
"Treasure_Camera",
|
||||
5.0f,
|
||||
(uint32_t)-1,
|
||||
static_cast<uint32_t>(-1),
|
||||
true,
|
||||
60,
|
||||
},
|
||||
|
||||
@@ -18,9 +18,15 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_NT
|
||||
"NtXRayServer.cpp"
|
||||
"NtSleepingGuard.cpp"
|
||||
"NtImagimeterVisibility.cpp"
|
||||
"NTPipeVisibilityServer.cpp"
|
||||
"NtSentinelWalkwayServer.cpp"
|
||||
"NtDarkitectRevealServer.cpp"
|
||||
"NtParadoxTeleServer.cpp"
|
||||
"NtVentureSpeedPadServer.cpp"
|
||||
"NtVentureCannonServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
"NtBcSubmitServer.cpp"
|
||||
"NtNaomiBreadcrumbServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapNT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NT})
|
||||
target_include_directories(dScriptsServerMapNT PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapNT REUSE_FROM dScriptsBase)
|
||||
|
||||
15
dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp
Normal file
15
dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "NTPipeVisibilityServer.h"
|
||||
#include "Entity.h"
|
||||
#include "Character.h"
|
||||
|
||||
void NTPipeVisibilityServer::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
const auto flag = self->GetVar<int32_t>(u"flag");
|
||||
if (flag == 0) return;
|
||||
|
||||
auto* character = target->GetCharacter();
|
||||
if (!character) return;
|
||||
|
||||
character->SetPlayerFlag(flag, true);
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PipeBuilt");
|
||||
}
|
||||
11
dScripts/02_server/Map/NT/NTPipeVisibilityServer.h
Normal file
11
dScripts/02_server/Map/NT/NTPipeVisibilityServer.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __NTPIPEVISIBILITYSERVER__H__
|
||||
#define __NTPIPEVISIBILITYSERVER__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NTPipeVisibilityServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
};
|
||||
|
||||
#endif //!__NTPIPEVISIBILITYSERVER__H__
|
||||
34
dScripts/02_server/Map/NT/NtBcSubmitServer.cpp
Normal file
34
dScripts/02_server/Map/NT/NtBcSubmitServer.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "NtBcSubmitServer.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
|
||||
#include "Entity.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
// https://explorer.lu/missions/
|
||||
// Key is the main mission, value is the breadcrumb mission to reset upon Mission Dialogue Ok.
|
||||
// To see the actual missions, just append the number to the end of the URL.
|
||||
namespace {
|
||||
std::map<uint32_t, uint32_t> ResetMissionsTable = {
|
||||
{999, 1335},
|
||||
{1002, 1355},
|
||||
{1006, 1349},
|
||||
{1009, 1348},
|
||||
{1379, 1335},
|
||||
{1380, 1355},
|
||||
{1378, 1349},
|
||||
{1377, 1348},
|
||||
};
|
||||
}
|
||||
|
||||
void NtBcSubmitServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (!missionComponent) return;
|
||||
|
||||
auto it = ResetMissionsTable.find(missionID);
|
||||
if (it == ResetMissionsTable.end()) return;
|
||||
|
||||
const auto missionToReset = it->second;
|
||||
missionComponent->ResetMission(missionToReset);
|
||||
}
|
||||
11
dScripts/02_server/Map/NT/NtBcSubmitServer.h
Normal file
11
dScripts/02_server/Map/NT/NtBcSubmitServer.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __NTBCSUBMITSERVER__H__
|
||||
#define __NTBCSUBMITSERVER__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NtBcSubmitServer : public virtual CppScripts::Script {
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
};
|
||||
|
||||
#endif //!__NTBCSUBMITSERVER__H__
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "NtCombatChallengeExplodingDummy.h"
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||
@@ -15,6 +16,17 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
|
||||
}
|
||||
|
||||
void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
||||
auto* destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
auto numTimesHit = self->GetVar<int32_t>(u"numTimesHit");
|
||||
if (destroyableComponent && numTimesHit == 0) {
|
||||
self->SetVar<int32_t>(u"numTimesHit", 1);
|
||||
destroyableComponent->SetHealth(destroyableComponent->GetHealth() / 2);
|
||||
return;
|
||||
} else if (numTimesHit == 2) {
|
||||
return;
|
||||
}
|
||||
self->SetVar<int32_t>(u"numTimesHit", 2);
|
||||
|
||||
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
|
||||
|
||||
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
|
||||
@@ -28,5 +40,6 @@ void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* at
|
||||
if (skillComponent != nullptr) {
|
||||
skillComponent->CalculateBehavior(1338, 30875, attacker->GetObjectID());
|
||||
}
|
||||
self->Kill(attacker);
|
||||
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake", self->GetObjectID(), 16.0f);
|
||||
self->Smash(attacker->GetObjectID());
|
||||
}
|
||||
|
||||
@@ -37,4 +37,5 @@ void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int mission
|
||||
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
|
||||
}
|
||||
}
|
||||
NtBcSubmitServer::OnMissionDialogueOK(self, target, missionID, missionState);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include "NtFactionSpyServer.h"
|
||||
#include "NtBcSubmitServer.h"
|
||||
|
||||
class NtDukeServer : public NtFactionSpyServer {
|
||||
class NtDukeServer : public NtFactionSpyServer, public NtBcSubmitServer {
|
||||
void SetVariables(Entity* self) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
const uint32_t m_SwordMissionID = 1448;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "NtFactionSpyServer.h"
|
||||
#include "NtBcSubmitServer.h"
|
||||
|
||||
class NtHaelServer : public NtFactionSpyServer {
|
||||
class NtHaelServer : public NtFactionSpyServer, public NtBcSubmitServer {
|
||||
void SetVariables(Entity* self) override;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Character.h"
|
||||
#include "ePlayerFlag.h"
|
||||
|
||||
void NTImagimeterVisibility::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void NTImagimeterVisibility::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
auto* character = target->GetCharacter();
|
||||
if (character) character->SetPlayerFlag(ePlayerFlag::NT_PLINTH_REBUILD, true);
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
|
||||
class NTImagimeterVisibility : public CppScripts::Script {
|
||||
public:
|
||||
void OnRebuildComplete(Entity* self, Entity* target) override;
|
||||
void OnQuickBuildComplete(Entity* self, Entity* target) override;
|
||||
};
|
||||
|
||||
43
dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.cpp
Normal file
43
dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "NtNaomiBreadcrumbServer.h"
|
||||
#include <map>
|
||||
|
||||
#include "eMissionState.h"
|
||||
#include "MissionComponent.h"
|
||||
|
||||
// https://explorer.lu/missions/
|
||||
// Key is the main mission, value is the breadcrumb mission to reset upon Mission Dialogue Ok.
|
||||
// To see the actual missions, just append the number to the end of the URL.
|
||||
namespace {
|
||||
std::map<int32_t, std::vector<int32_t>> CompleteBcMissionTable = {
|
||||
{1377, {1378, 1379, 1380, 1349, 1335, 1355}},
|
||||
{1378, {1377, 1379, 1380, 1348, 1335, 1355}},
|
||||
{1379, {1377, 1378, 1380, 1348, 1349, 1355}},
|
||||
{1380, {1377, 1378, 1379, 1348, 1349, 1335}},
|
||||
};
|
||||
|
||||
std::map<int32_t, int32_t> MatchingBCTable = {
|
||||
{1377, 1348},
|
||||
{1378, 1349},
|
||||
{1379, 1335},
|
||||
{1380, 1355}
|
||||
};
|
||||
}
|
||||
|
||||
void NtNaomiBreadcrumbServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (!missionComponent) return;
|
||||
|
||||
auto itr = MatchingBCTable.find(missionID);
|
||||
if (itr == MatchingBCTable.end()) return;
|
||||
|
||||
missionComponent->AcceptMission(itr->second);
|
||||
|
||||
auto it = CompleteBcMissionTable.find(missionID);
|
||||
if (it == CompleteBcMissionTable.end()) return;
|
||||
|
||||
if (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE) {
|
||||
for (const auto& bcMission : it->second) {
|
||||
missionComponent->ResetMission(bcMission);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.h
Normal file
11
dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __NTNAOMIBREADCRUMBSERVER__H__
|
||||
#define __NTNAOMIBREADCRUMBSERVER__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NtNaomiBreadcrumbServer : public CppScripts::Script {
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
};
|
||||
|
||||
#endif //!__NTNAOMIBREADCRUMBSERVER__H__
|
||||
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include "NtFactionSpyServer.h"
|
||||
#include "NtBcSubmitServer.h"
|
||||
|
||||
class NtOverbuildServer : public NtFactionSpyServer {
|
||||
class NtOverbuildServer : public NtFactionSpyServer, public NtBcSubmitServer {
|
||||
void SetVariables(Entity* self) override;
|
||||
const std::u16string m_OtherEntitiesGroupVariable = u"SpyConvo2Group";
|
||||
};
|
||||
|
||||
@@ -11,4 +11,5 @@ void NtVandaServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
||||
inventoryComponent->RemoveItem(alienPartLot, 1);
|
||||
}
|
||||
}
|
||||
NtBcSubmitServer::OnMissionDialogueOK(self, target, missionID, missionState);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
#include "NtBcSubmitServer.h"
|
||||
|
||||
class NtVandaServer : public CppScripts::Script {
|
||||
class NtVandaServer : public NtBcSubmitServer {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
const uint32_t m_AlienPartMissionID = 1183;
|
||||
const std::vector<LOT> m_AlienPartLots = { 12479, 12480, 12481 };
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PR
|
||||
"HydrantBroken.cpp"
|
||||
"PrSeagullFly.cpp"
|
||||
"SpawnGryphonServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
"SpawnGryphonServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapPR ${DSCRIPTS_SOURCES_02_SERVER_MAP_PR})
|
||||
target_include_directories(dScriptsServerMapPR PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapPR REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -19,4 +19,9 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_NS_MED})
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} "NS_Med/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} PARENT_SCOPE)
|
||||
add_library(dScriptsServerMapProperty ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY})
|
||||
target_precompile_headers(dScriptsServerMapProperty REUSE_FROM dScriptsBase)
|
||||
target_include_directories(dScriptsServerMapProperty PUBLIC "."
|
||||
"AG_Med"
|
||||
"AG_Small"
|
||||
"NS_Med")
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_SS
|
||||
"SsModularBuildServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
"SsModularBuildServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapSS ${DSCRIPTS_SOURCES_02_SERVER_MAP_SS})
|
||||
target_include_directories(dScriptsServerMapSS PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapSS REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_MAP_VE
|
||||
"VeMissionConsole.cpp"
|
||||
"VeEpsilonServer.cpp"
|
||||
"VeBricksampleServer.cpp"
|
||||
PARENT_SCOPE)
|
||||
"VeBricksampleServer.cpp")
|
||||
|
||||
add_library(dScriptsServerMapVE ${DSCRIPTS_SOURCES_02_SERVER_MAP_VE})
|
||||
target_include_directories(dScriptsServerMapVE PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerMapVE REUSE_FROM dScriptsBase)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "eTerminateType.h"
|
||||
|
||||
void VeMissionConsole::OnUse(Entity* self, Entity* user) {
|
||||
LootGenerator::Instance().DropActivityLoot(user, self, 12551);
|
||||
Loot::DropActivityLoot(user, self, 12551);
|
||||
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
if (inventoryComponent != nullptr) {
|
||||
|
||||
@@ -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"
|
||||
@@ -45,8 +45,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;
|
||||
}
|
||||
|
||||
@@ -68,14 +68,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
|
||||
|
||||
@@ -27,7 +27,7 @@ void MinigameTreasureChestServer::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
if (self->GetLOT() == frakjawChestId) activityRating = team->members.size();
|
||||
|
||||
LootGenerator::Instance().DropActivityLoot(teamMember, self, sac->GetActivityID(), activityRating);
|
||||
Loot::DropActivityLoot(teamMember, self, sac->GetActivityID(), activityRating);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -35,7 +35,7 @@ void MinigameTreasureChestServer::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
if (self->GetLOT() == frakjawChestId) activityRating = 1;
|
||||
|
||||
LootGenerator::Instance().DropActivityLoot(user, self, sac->GetActivityID(), activityRating);
|
||||
Loot::DropActivityLoot(user, self, sac->GetActivityID(), activityRating);
|
||||
}
|
||||
|
||||
sac->PlayerRemove(user->GetObjectID());
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "SkillComponent.h"
|
||||
#include "TeamManager.h"
|
||||
|
||||
void AgSurvivalBuffStation::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
void AgSurvivalBuffStation::OnQuickBuildComplete(Entity* self, Entity* target) {
|
||||
auto destroyableComponent = self->GetComponent<DestroyableComponent>();
|
||||
// We set the faction to 1 so that the buff station sees players as friendly targets to buff
|
||||
if (destroyableComponent != nullptr) destroyableComponent->SetFaction(1);
|
||||
|
||||
@@ -10,7 +10,7 @@ public:
|
||||
* @param self The Entity that called this script.
|
||||
* @param target The target of the self that called this script.
|
||||
*/
|
||||
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,9 @@
|
||||
set(DSCRIPTS_SOURCES_02_SERVER_PETS
|
||||
"PetFromDigServer.cpp"
|
||||
"PetFromObjectServer.cpp"
|
||||
"DamagingPets.cpp"
|
||||
PARENT_SCOPE)
|
||||
"DamagingPets.cpp")
|
||||
|
||||
add_library(dScriptsServerPets STATIC ${DSCRIPTS_SOURCES_02_SERVER_PETS})
|
||||
target_include_directories(dScriptsServerPets PUBLIC ".")
|
||||
target_precompile_headers(dScriptsServerPets REUSE_FROM dScriptsBase)
|
||||
|
||||
|
||||
@@ -40,6 +40,6 @@ void PetFromDigServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eP
|
||||
return;
|
||||
// TODO: Remove custom group?
|
||||
// Command the pet to the player as it may otherwise go to its spawn point which is non existant
|
||||
// petComponent->Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 6, 202, true);
|
||||
// petComponent->Command(NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 6, 202, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "LeaderboardManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include <algorithm>
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
#include "Loot.h"
|
||||
|
||||
bool ActivityManager::IsPlayerInActivity(Entity* self, LWOOBJID playerID) {
|
||||
@@ -71,7 +71,7 @@ void ActivityManager::StopActivity(Entity* self, const LWOOBJID playerID, const
|
||||
SetActivityValue(self, playerID, 1, value1);
|
||||
SetActivityValue(self, playerID, 2, value2);
|
||||
|
||||
LootGenerator::Instance().GiveActivityLoot(player, self, gameID, CalculateActivityRating(self, playerID));
|
||||
Loot::GiveActivityLoot(player, self, gameID, CalculateActivityRating(self, playerID));
|
||||
|
||||
if (sac != nullptr) {
|
||||
sac->PlayerRemove(player->GetObjectID());
|
||||
@@ -129,7 +129,7 @@ void ActivityManager::ActivityTimerStart(Entity* self, const std::string& timerN
|
||||
auto* timer = new ActivityTimer{ timerName, updateInterval, stopTime };
|
||||
activeTimers.push_back(timer);
|
||||
|
||||
Game::logger->LogDebug("ActivityManager", "Starting timer '%s', %f, %f", timerName.c_str(), updateInterval, stopTime);
|
||||
LOG_DEBUG("Starting timer '%s', %f, %f", timerName.c_str(), updateInterval, stopTime);
|
||||
|
||||
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
|
||||
}
|
||||
@@ -210,10 +210,10 @@ void ActivityManager::OnTimerDone(Entity* self, std::string timerName) {
|
||||
activeTimers.erase(std::remove(activeTimers.begin(), activeTimers.end(), timer),
|
||||
activeTimers.end());
|
||||
delete timer;
|
||||
Game::logger->LogDebug("ActivityManager", "Executing timer '%s'", activityTimerName.c_str());
|
||||
LOG_DEBUG("Executing timer '%s'", activityTimerName.c_str());
|
||||
OnActivityTimerDone(self, activityTimerName);
|
||||
} else {
|
||||
Game::logger->LogDebug("ActivityManager", "Updating timer '%s'", activityTimerName.c_str());
|
||||
LOG_DEBUG("Updating timer '%s'", activityTimerName.c_str());
|
||||
OnActivityTimerUpdate(self, timer->name, timer->stopTime - timer->runTime, timer->runTime);
|
||||
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user