From c1e8546d48542896d4cbf6534f730dd9634828b5 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Fri, 22 Dec 2023 23:53:21 -0800 Subject: [PATCH] fix: add Nexus Tower missing scripts (#1349) add final missing scripts for nt also fix the turnin for the breadcrumb missions not showing the completion window. Fix another missing script Add another script fix include guards Fix dirt clouds not appearing on mission accept --- CMakeLists.txt | 1 + dGame/EntityManager.cpp | 4 -- dGame/dComponents/MissionComponent.cpp | 9 ++++ dGame/dComponents/MissionComponent.h | 1 + dGame/dComponents/MissionOfferComponent.cpp | 9 ++-- dGame/dComponents/MissionOfferComponent.h | 4 +- dGame/dGameMessages/GameMessages.cpp | 13 ++++++ dGame/dGameMessages/GameMessages.h | 1 + dGame/dUtilities/SlashCommandHandler.cpp | 11 +++++ dNet/AuthPackets.cpp | 2 +- dScripts/02_server/Map/General/CMakeLists.txt | 3 ++ .../Map/General/FrictionVolumeServer.cpp | 19 ++++++++ .../Map/General/FrictionVolumeServer.h | 13 ++++++ .../Map/General/NTNaomiDirtServer.cpp | 14 ++++++ .../02_server/Map/General/NTNaomiDirtServer.h | 11 +++++ .../Map/General/VisToggleNotifierServer.cpp | 23 ++++++++++ .../Map/General/VisToggleNotifierServer.h | 15 +++++++ dScripts/02_server/Map/NT/CMakeLists.txt | 3 ++ .../Map/NT/NTPipeVisibilityServer.cpp | 15 +++++++ .../02_server/Map/NT/NTPipeVisibilityServer.h | 11 +++++ .../02_server/Map/NT/NtBcSubmitServer.cpp | 34 +++++++++++++++ dScripts/02_server/Map/NT/NtBcSubmitServer.h | 11 +++++ dScripts/02_server/Map/NT/NtDukeServer.cpp | 1 + dScripts/02_server/Map/NT/NtDukeServer.h | 3 +- dScripts/02_server/Map/NT/NtHaelServer.h | 3 +- .../Map/NT/NtNaomiBreadcrumbServer.cpp | 43 +++++++++++++++++++ .../Map/NT/NtNaomiBreadcrumbServer.h | 11 +++++ dScripts/02_server/Map/NT/NtOverbuildServer.h | 3 +- dScripts/02_server/Map/NT/NtVandaServer.cpp | 1 + dScripts/02_server/Map/NT/NtVandaServer.h | 3 +- dScripts/CppScripts.cpp | 21 ++++++++- dScripts/NtFactionSpyServer.h | 2 +- dScripts/ai/MINIGAME/CMakeLists.txt | 6 +++ dScripts/ai/MINIGAME/Objects/CMakeLists.txt | 4 ++ .../ai/MINIGAME/Objects/MinigameBlueMark.cpp | 7 +++ .../ai/MINIGAME/Objects/MinigameBlueMark.h | 6 +++ dZoneManager/Spawner.cpp | 9 ++++ dZoneManager/Spawner.h | 1 + 38 files changed, 334 insertions(+), 17 deletions(-) create mode 100644 dScripts/02_server/Map/General/FrictionVolumeServer.cpp create mode 100644 dScripts/02_server/Map/General/FrictionVolumeServer.h create mode 100644 dScripts/02_server/Map/General/NTNaomiDirtServer.cpp create mode 100644 dScripts/02_server/Map/General/NTNaomiDirtServer.h create mode 100644 dScripts/02_server/Map/General/VisToggleNotifierServer.cpp create mode 100644 dScripts/02_server/Map/General/VisToggleNotifierServer.h create mode 100644 dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp create mode 100644 dScripts/02_server/Map/NT/NTPipeVisibilityServer.h create mode 100644 dScripts/02_server/Map/NT/NtBcSubmitServer.cpp create mode 100644 dScripts/02_server/Map/NT/NtBcSubmitServer.h create mode 100644 dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.cpp create mode 100644 dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.h create mode 100644 dScripts/ai/MINIGAME/Objects/CMakeLists.txt create mode 100644 dScripts/ai/MINIGAME/Objects/MinigameBlueMark.cpp create mode 100644 dScripts/ai/MINIGAME/Objects/MinigameBlueMark.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 635f5f44..84b5468e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -269,6 +269,7 @@ set(INCLUDED_DIRECTORIES "dScripts/ai/GENERAL" "dScripts/ai/GF" "dScripts/ai/MINIGAME" + "dScripts/ai/MINIGAME/Objects" "dScripts/ai/NP" "dScripts/ai/NS" "dScripts/ai/PETS" diff --git a/dGame/EntityManager.cpp b/dGame/EntityManager.cpp index 86737dd4..cfbd71d9 100644 --- a/dGame/EntityManager.cpp +++ b/dGame/EntityManager.cpp @@ -47,10 +47,6 @@ std::vector EntityManager::m_GhostingExcludedZones = { // Configure some exceptions for ghosting, nessesary for some special objects. std::vector EntityManager::m_GhostingExcludedLOTs = { - // NT - Pipes - 9524, - 12408, - // AG - Footrace 4967 }; diff --git a/dGame/dComponents/MissionComponent.cpp b/dGame/dComponents/MissionComponent.cpp index 277882bf..33869030 100644 --- a/dGame/dComponents/MissionComponent.cpp +++ b/dGame/dComponents/MissionComponent.cpp @@ -621,3 +621,12 @@ bool MissionComponent::HasCollectible(int32_t collectibleID) { bool MissionComponent::HasMission(uint32_t missionId) { return GetMission(missionId) != nullptr; } + +void MissionComponent::ResetMission(const int32_t missionId) { + auto* mission = GetMission(missionId); + + if (!mission) return; + + m_Missions.erase(missionId); + GameMessages::SendResetMissions(m_Parent, m_Parent->GetSystemAddress(), missionId); +} diff --git a/dGame/dComponents/MissionComponent.h b/dGame/dComponents/MissionComponent.h index 37d5cd84..d53db64e 100644 --- a/dGame/dComponents/MissionComponent.h +++ b/dGame/dComponents/MissionComponent.h @@ -170,6 +170,7 @@ public: */ bool HasMission(uint32_t missionId); + void ResetMission(const int32_t missionId); private: /** * All the missions owned by this entity, mapped by mission ID diff --git a/dGame/dComponents/MissionOfferComponent.cpp b/dGame/dComponents/MissionOfferComponent.cpp index 9299ebd7..60095c4a 100644 --- a/dGame/dComponents/MissionOfferComponent.cpp +++ b/dGame/dComponents/MissionOfferComponent.cpp @@ -29,11 +29,11 @@ uint32_t OfferedMission::GetMissionId() const { return this->missionId; } -bool OfferedMission::GetOfferMission() const { +bool OfferedMission::GetOffersMission() const { return this->offersMission; } -bool OfferedMission::GetAcceptMission() const { +bool OfferedMission::GetAcceptsMission() const { return this->acceptsMission; } @@ -203,7 +203,10 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi const auto selected = canAcceptPool[GeneralUtils::GenerateRandomNumber(0, canAcceptPool.size() - 1)]; GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), selected, m_Parent->GetObjectID()); - } else if (std::find(offered.begin(), offered.end(), missionId) == offered.end() && offeredMission->GetOfferMission()) { + } else if ( + std::find(offered.begin(), offered.end(), missionId) == offered.end() + && + (offeredMission->GetOffersMission() || offeredMission->GetAcceptsMission())) { GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), missionId, m_Parent->GetObjectID()); } } diff --git a/dGame/dComponents/MissionOfferComponent.h b/dGame/dComponents/MissionOfferComponent.h index ad5f83bc..52dcdadb 100644 --- a/dGame/dComponents/MissionOfferComponent.h +++ b/dGame/dComponents/MissionOfferComponent.h @@ -30,13 +30,13 @@ struct OfferedMission { * Returns if this mission is offered by the entity * @return true if this mission is offered by the entity, false otherwise */ - bool GetOfferMission() const; + bool GetOffersMission() const; /** * Returns if this mission may be accepted by the entity (currently unused) * @return true if this mission may be accepted by the entity, false otherwise */ - bool GetAcceptMission() const; + bool GetAcceptsMission() const; private: diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 51860d44..9d903b3b 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -345,6 +345,19 @@ void GameMessages::SendStartPathing(Entity* entity) { SEND_PACKET_BROADCAST; } +void GameMessages::SendResetMissions(Entity* entity, const SystemAddress& sysAddr, const int32_t missionid) { + CBITSTREAM; + CMSGHEADER; + + bitStream.Write(entity->GetObjectID()); + bitStream.Write(eGameMessageType::RESET_MISSIONS); + + bitStream.Write(missionid != -1); + if (missionid != -1) bitStream.Write(missionid); + + SEND_PACKET; +} + void GameMessages::SendPlatformResync(Entity* entity, const SystemAddress& sysAddr, bool bStopAtDesiredWaypoint, int iIndex, int iDesiredWaypointIndex, int nextIndex, eMovementPlatformState movementState) { diff --git a/dGame/dGameMessages/GameMessages.h b/dGame/dGameMessages/GameMessages.h index 5199a72a..8d0a961c 100644 --- a/dGame/dGameMessages/GameMessages.h +++ b/dGame/dGameMessages/GameMessages.h @@ -74,6 +74,7 @@ namespace GameMessages { int iIndex = 0, int iDesiredWaypointIndex = 1, int nextIndex = 1, eMovementPlatformState movementState = eMovementPlatformState::Moving); + void SendResetMissions(Entity* entity, const SystemAddress& sysAddr, const int32_t missionid = -1); void SendRestoreToPostLoadStats(Entity* entity, const SystemAddress& sysAddr); void SendServerDoneLoadingAllObjects(Entity* entity, const SystemAddress& sysAddr); void SendGMLevelBroadcast(const LWOOBJID& objectID, eGameMasterLevel level); diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 39f4a115..a37b6124 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -349,6 +349,17 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit }); } + if (chatCommand == "resetmission") { + uint32_t missionId; + if (!GeneralUtils::TryParse(args[0], missionId)) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission ID."); + return; + } + auto* missionComponent = entity->GetComponent(); + if (!missionComponent) return; + missionComponent->ResetMission(missionId); + } + if (user->GetMaxGMLevel() == eGameMasterLevel::CIVILIAN || entity->GetGMLevel() >= eGameMasterLevel::CIVILIAN) { if (chatCommand == "die") { entity->Smash(entity->GetObjectID()); diff --git a/dNet/AuthPackets.cpp b/dNet/AuthPackets.cpp index 6ee38028..4e84eeca 100644 --- a/dNet/AuthPackets.cpp +++ b/dNet/AuthPackets.cpp @@ -223,7 +223,7 @@ void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAdd server->Send(&packet, sysAddr, false); //Inform the master server that we've created a session for this user: - { + if (responseCode == eLoginResponse::SUCCESS) { CBITSTREAM; BitStreamUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::SET_SESSION_KEY); bitStream.Write(sessionKey); diff --git a/dScripts/02_server/Map/General/CMakeLists.txt b/dScripts/02_server/Map/General/CMakeLists.txt index 1fe3d785..797b53ed 100644 --- a/dScripts/02_server/Map/General/CMakeLists.txt +++ b/dScripts/02_server/Map/General/CMakeLists.txt @@ -3,6 +3,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL "BaseInteractDropLootServer.cpp" "Binoculars.cpp" "ExplodingAsset.cpp" + "FrictionVolumeServer.cpp" "ForceVolumeServer.cpp" "GrowingFlower.cpp" "ImaginationBackpackHealServer.cpp" @@ -17,6 +18,8 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL "StoryBoxInteractServer.cpp" "TokenConsoleServer.cpp" "TouchMissionUpdateServer.cpp" + "VisToggleNotifierServer.cpp" + "NTNaomiDirtServer.cpp" "WishingWellServer.cpp") add_subdirectory(Ninjago) diff --git a/dScripts/02_server/Map/General/FrictionVolumeServer.cpp b/dScripts/02_server/Map/General/FrictionVolumeServer.cpp new file mode 100644 index 00000000..541ccdf7 --- /dev/null +++ b/dScripts/02_server/Map/General/FrictionVolumeServer.cpp @@ -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(u"FrictionAmt"); + if (frictionAmount == 0.0f) frictionAmount = DefaultFrictionAmount; + + auto* phantomPhysicsComponent = self->GetComponent(); + if (!phantomPhysicsComponent) return; + + phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::FRICTION); + phantomPhysicsComponent->SetDirectionalMultiplier(frictionAmount); + phantomPhysicsComponent->SetPhysicsEffectActive(true); + + Game::entityManager->SerializeEntity(self); +} diff --git a/dScripts/02_server/Map/General/FrictionVolumeServer.h b/dScripts/02_server/Map/General/FrictionVolumeServer.h new file mode 100644 index 00000000..9824daef --- /dev/null +++ b/dScripts/02_server/Map/General/FrictionVolumeServer.h @@ -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__ diff --git a/dScripts/02_server/Map/General/NTNaomiDirtServer.cpp b/dScripts/02_server/Map/General/NTNaomiDirtServer.cpp new file mode 100644 index 00000000..cf00326a --- /dev/null +++ b/dScripts/02_server/Map/General/NTNaomiDirtServer.cpp @@ -0,0 +1,14 @@ +#include "NTNaomiDirtServer.h" + +namespace { + std::map 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); +} diff --git a/dScripts/02_server/Map/General/NTNaomiDirtServer.h b/dScripts/02_server/Map/General/NTNaomiDirtServer.h new file mode 100644 index 00000000..ed03df47 --- /dev/null +++ b/dScripts/02_server/Map/General/NTNaomiDirtServer.h @@ -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__ diff --git a/dScripts/02_server/Map/General/VisToggleNotifierServer.cpp b/dScripts/02_server/Map/General/VisToggleNotifierServer.cpp new file mode 100644 index 00000000..a02856ef --- /dev/null +++ b/dScripts/02_server/Map/General/VisToggleNotifierServer.cpp @@ -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); + } + } + } +} diff --git a/dScripts/02_server/Map/General/VisToggleNotifierServer.h b/dScripts/02_server/Map/General/VisToggleNotifierServer.h new file mode 100644 index 00000000..c19b65df --- /dev/null +++ b/dScripts/02_server/Map/General/VisToggleNotifierServer.h @@ -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& gameVariables) { m_GameVariables = gameVariables; } +private: + std::map m_GameVariables; +}; + +#endif //!__VISTOGGLENOTIFIERSERVER__H__ diff --git a/dScripts/02_server/Map/NT/CMakeLists.txt b/dScripts/02_server/Map/NT/CMakeLists.txt index ede9b003..533a70c9 100644 --- a/dScripts/02_server/Map/NT/CMakeLists.txt +++ b/dScripts/02_server/Map/NT/CMakeLists.txt @@ -18,9 +18,12 @@ 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" + "NtBcSubmitServer.cpp" + "NtNaomiBreadcrumbServer.cpp" PARENT_SCOPE) diff --git a/dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp b/dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp new file mode 100644 index 00000000..d8d7d1d9 --- /dev/null +++ b/dScripts/02_server/Map/NT/NTPipeVisibilityServer.cpp @@ -0,0 +1,15 @@ +#include "NTPipeVisibilityServer.h" +#include "Entity.h" +#include "Character.h" + +void NTPipeVisibilityServer::OnRebuildComplete(Entity* self, Entity* target) { + const auto flag = self->GetVar(u"flag"); + if (flag == 0) return; + + auto* character = target->GetCharacter(); + if (!character) return; + + character->SetPlayerFlag(flag, true); + + GameMessages::SendNotifyClientObject(self->GetObjectID(), u"PipeBuilt"); +} diff --git a/dScripts/02_server/Map/NT/NTPipeVisibilityServer.h b/dScripts/02_server/Map/NT/NTPipeVisibilityServer.h new file mode 100644 index 00000000..2694af8b --- /dev/null +++ b/dScripts/02_server/Map/NT/NTPipeVisibilityServer.h @@ -0,0 +1,11 @@ +#ifndef __NTPIPEVISIBILITYSERVER__H__ +#define __NTPIPEVISIBILITYSERVER__H__ + +#include "CppScripts.h" + +class NTPipeVisibilityServer : public CppScripts::Script { +public: + void OnRebuildComplete(Entity* self, Entity* target) override; +}; + +#endif //!__NTPIPEVISIBILITYSERVER__H__ diff --git a/dScripts/02_server/Map/NT/NtBcSubmitServer.cpp b/dScripts/02_server/Map/NT/NtBcSubmitServer.cpp new file mode 100644 index 00000000..9dc3e022 --- /dev/null +++ b/dScripts/02_server/Map/NT/NtBcSubmitServer.cpp @@ -0,0 +1,34 @@ +#include "NtBcSubmitServer.h" + +#include +#include + +#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 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(); + if (!missionComponent) return; + + auto it = ResetMissionsTable.find(missionID); + if (it == ResetMissionsTable.end()) return; + + const auto missionToReset = it->second; + missionComponent->ResetMission(missionToReset); +} diff --git a/dScripts/02_server/Map/NT/NtBcSubmitServer.h b/dScripts/02_server/Map/NT/NtBcSubmitServer.h new file mode 100644 index 00000000..46efa935 --- /dev/null +++ b/dScripts/02_server/Map/NT/NtBcSubmitServer.h @@ -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__ diff --git a/dScripts/02_server/Map/NT/NtDukeServer.cpp b/dScripts/02_server/Map/NT/NtDukeServer.cpp index 07d17e96..4ab19445 100644 --- a/dScripts/02_server/Map/NT/NtDukeServer.cpp +++ b/dScripts/02_server/Map/NT/NtDukeServer.cpp @@ -37,4 +37,5 @@ void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int mission inventoryComponent->RemoveItem(m_SwordLot, lotCount); } } + NtBcSubmitServer::OnMissionDialogueOK(self, target, missionID, missionState); } diff --git a/dScripts/02_server/Map/NT/NtDukeServer.h b/dScripts/02_server/Map/NT/NtDukeServer.h index 2103ba8d..c116dfef 100644 --- a/dScripts/02_server/Map/NT/NtDukeServer.h +++ b/dScripts/02_server/Map/NT/NtDukeServer.h @@ -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; diff --git a/dScripts/02_server/Map/NT/NtHaelServer.h b/dScripts/02_server/Map/NT/NtHaelServer.h index 4597198f..13660ab4 100644 --- a/dScripts/02_server/Map/NT/NtHaelServer.h +++ b/dScripts/02_server/Map/NT/NtHaelServer.h @@ -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; }; diff --git a/dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.cpp b/dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.cpp new file mode 100644 index 00000000..20edc4da --- /dev/null +++ b/dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.cpp @@ -0,0 +1,43 @@ +#include "NtNaomiBreadcrumbServer.h" +#include + +#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> 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 MatchingBCTable = { + {1377, 1348}, + {1378, 1349}, + {1379, 1335}, + {1380, 1355} + }; +} + +void NtNaomiBreadcrumbServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { + auto* missionComponent = target->GetComponent(); + 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); + } + } +} diff --git a/dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.h b/dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.h new file mode 100644 index 00000000..6a82cac7 --- /dev/null +++ b/dScripts/02_server/Map/NT/NtNaomiBreadcrumbServer.h @@ -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__ diff --git a/dScripts/02_server/Map/NT/NtOverbuildServer.h b/dScripts/02_server/Map/NT/NtOverbuildServer.h index a34d117e..6d5ce8b0 100644 --- a/dScripts/02_server/Map/NT/NtOverbuildServer.h +++ b/dScripts/02_server/Map/NT/NtOverbuildServer.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"; }; diff --git a/dScripts/02_server/Map/NT/NtVandaServer.cpp b/dScripts/02_server/Map/NT/NtVandaServer.cpp index 7750d566..45096387 100644 --- a/dScripts/02_server/Map/NT/NtVandaServer.cpp +++ b/dScripts/02_server/Map/NT/NtVandaServer.cpp @@ -11,4 +11,5 @@ void NtVandaServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio inventoryComponent->RemoveItem(alienPartLot, 1); } } + NtBcSubmitServer::OnMissionDialogueOK(self, target, missionID, missionState); } diff --git a/dScripts/02_server/Map/NT/NtVandaServer.h b/dScripts/02_server/Map/NT/NtVandaServer.h index 58162cd9..98842e3b 100644 --- a/dScripts/02_server/Map/NT/NtVandaServer.h +++ b/dScripts/02_server/Map/NT/NtVandaServer.h @@ -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 m_AlienPartLots = { 12479, 12480, 12481 }; diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 24fe7b5b..071bd7a3 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -209,6 +209,11 @@ #include "NtXRayServer.h" #include "NtSleepingGuard.h" #include "NtImagimeterVisibility.h" +#include "FrictionVolumeServer.h" +#include "NTPipeVisibilityServer.h" +#include "NTNaomiDirtServer.h" +#include "MinigameBlueMark.h" +#include "NtNaomiBreadcrumbServer.h" // DLU Scripts #include "DLUVanityNPC.h" @@ -311,6 +316,7 @@ #include "WildNinjaStudent.h" #include "WildNinjaSensei.h" #include "WildNinjaBricks.h" +#include "VisToggleNotifierServer.h" namespace { InvalidScript* invalidToReturn = new InvalidScript(); @@ -694,19 +700,30 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new NtDukeServer(); else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_HAEL_SERVER.lua") script = new NtHaelServer(); + else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_FACTION_SPY_SERVER.lua") + script = new NtFactionSpyServer(); else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_OVERBUILD_SERVER.lua") script = new NtOverbuildServer(); else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_VANDA_SERVER.lua") script = new NtVandaServer(); else if (scriptName == "scripts\\02_server\\Map\\General\\L_FORCE_VOLUME_SERVER.lua") script = new ForceVolumeServer(); + else if (scriptName == "scripts\\02_server\\Map\\General\\L_FRICTION_VOLUME_SERVER.lua") + script = new FrictionVolumeServer(); else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_XRAY_SERVER.lua") script = new NtXRayServer(); else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_SLEEPING_GUARD.lua") script = new NtSleepingGuard(); - else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_IMAGIMETER_VISIBILITY_SERVER.lua") { + else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_IMAGIMETER_VISIBILITY_SERVER.lua") script = new NTImagimeterVisibility(); - } + else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_PIPE_VISIBILITY_SERVER.lua") + script = new NTPipeVisibilityServer(); + else if (scriptName == "scripts\\ai\\MINIGAME\\Objects\\MINIGAME_BLUE_MARK.lua") + script = new MinigameBlueMark(); + else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_NAOMI_BREADCRUMB_SERVER.lua") + script = new NtNaomiBreadcrumbServer(); + else if (scriptName == "scripts\\02_server\\Map\\NT\\L_NT_NAOMI_DIRT_SERVER.lua") + script = new NTNaomiDirtServer(); //AM: else if (scriptName == "scripts\\02_server\\Map\\AM\\L_AM_CONSOLE_TELEPORT_SERVER.lua") diff --git a/dScripts/NtFactionSpyServer.h b/dScripts/NtFactionSpyServer.h index 4406859c..3a1918d0 100644 --- a/dScripts/NtFactionSpyServer.h +++ b/dScripts/NtFactionSpyServer.h @@ -12,7 +12,7 @@ struct SpyData { uint32_t missionID; }; -class NtFactionSpyServer : public CppScripts::Script { +class NtFactionSpyServer : public virtual CppScripts::Script { void OnStartup(Entity* self) override; void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override; void OnCinematicUpdate(Entity* self, Entity* sender, eCinematicEvent event, const std::u16string& pathName, float_t pathTime, float_t totalTime, int32_t waypoint) override; diff --git a/dScripts/ai/MINIGAME/CMakeLists.txt b/dScripts/ai/MINIGAME/CMakeLists.txt index d4517519..f0187057 100644 --- a/dScripts/ai/MINIGAME/CMakeLists.txt +++ b/dScripts/ai/MINIGAME/CMakeLists.txt @@ -6,4 +6,10 @@ foreach(file ${DSCRIPTS_SOURCES_AI_MINIGAME_SG_GF}) set(DSCRIPTS_SOURCES_AI_MINIGAME ${DSCRIPTS_SOURCES_AI_MINIGAME} "SG_GF/${file}") endforeach() +add_subdirectory(Objects) + +foreach(file ${DSCRIPTS_SOURCES_AI_MINIGAME_OBJECTS}) + set(DSCRIPTS_SOURCES_AI_MINIGAME ${DSCRIPTS_SOURCES_AI_MINIGAME} "Objects/${file}") +endforeach() + set(DSCRIPTS_SOURCES_AI_MINIGAME ${DSCRIPTS_SOURCES_AI_MINIGAME} PARENT_SCOPE) diff --git a/dScripts/ai/MINIGAME/Objects/CMakeLists.txt b/dScripts/ai/MINIGAME/Objects/CMakeLists.txt new file mode 100644 index 00000000..54fada5d --- /dev/null +++ b/dScripts/ai/MINIGAME/Objects/CMakeLists.txt @@ -0,0 +1,4 @@ +SET(DSCRIPTS_SOURCES_AI_MINIGAME_OBJECTS + "MinigameBlueMark.cpp" + PARENT_SCOPE +) diff --git a/dScripts/ai/MINIGAME/Objects/MinigameBlueMark.cpp b/dScripts/ai/MINIGAME/Objects/MinigameBlueMark.cpp new file mode 100644 index 00000000..a5e09e4e --- /dev/null +++ b/dScripts/ai/MINIGAME/Objects/MinigameBlueMark.cpp @@ -0,0 +1,7 @@ +#include "MinigameBlueMark.h" +#include "Game.h" +#include "dZoneManager.h" + +void MinigameBlueMark::OnStartup(Entity* self) { + Game::zoneManager->GetZoneControlObject()->NotifyObject(self, "Blue_Mark"); +} diff --git a/dScripts/ai/MINIGAME/Objects/MinigameBlueMark.h b/dScripts/ai/MINIGAME/Objects/MinigameBlueMark.h new file mode 100644 index 00000000..0d644916 --- /dev/null +++ b/dScripts/ai/MINIGAME/Objects/MinigameBlueMark.h @@ -0,0 +1,6 @@ +#include "CppScripts.h" + +class MinigameBlueMark : public CppScripts::Script { +public: + void OnStartup(Entity* self) override; +}; diff --git a/dZoneManager/Spawner.cpp b/dZoneManager/Spawner.cpp index 8cf7b809..b602c17c 100644 --- a/dZoneManager/Spawner.cpp +++ b/dZoneManager/Spawner.cpp @@ -205,6 +205,15 @@ void Spawner::Update(const float deltaTime) { } } +std::vector Spawner::GetSpawnedObjectIDs() const { + std::vector ids; + ids.reserve(m_Entities.size()); + for (const auto& [objId, spawnerNode] : m_Entities) { + ids.push_back(objId); + } + return ids; +} + void Spawner::NotifyOfEntityDeath(const LWOOBJID& objectID) { for (std::function cb : m_SpawnedEntityDieCallbacks) { cb(); diff --git a/dZoneManager/Spawner.h b/dZoneManager/Spawner.h index 1f610b71..79ba40d1 100644 --- a/dZoneManager/Spawner.h +++ b/dZoneManager/Spawner.h @@ -66,6 +66,7 @@ public: void SetRespawnTime(float time); void SetNumToMaintain(int32_t value); bool GetIsSpawnSmashGroup() const { return m_SpawnSmashFoundGroup; }; + std::vector GetSpawnedObjectIDs() const; SpawnerInfo m_Info; bool m_Active = true;