mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
parent
737eaba54d
commit
09157506bf
@ -28,6 +28,7 @@
|
||||
#include "GameConfig.h"
|
||||
#include "RocketLaunchLupComponent.h"
|
||||
#include "eUnequippableActiveType.h"
|
||||
#include "RacingTaskParam.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <future>
|
||||
@ -5482,7 +5483,8 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
auto* temp = inv->GetInventory(TEMP_MODELS);
|
||||
std::vector<LOT> modList;
|
||||
|
||||
auto& oldPartList = character->GetVar<std::string>(u"currentModifiedBuild");
|
||||
bool everyPieceSwapped = !oldPartList.empty(); // If the player didn't put a build in initially, then they should not get this achievement.
|
||||
if (count >= 3) {
|
||||
std::u16string modules;
|
||||
|
||||
@ -5490,7 +5492,8 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
uint32_t mod;
|
||||
inStream->Read(mod);
|
||||
modList.push_back(mod);
|
||||
modules += u"1:" + (GeneralUtils::to_u16string(mod));
|
||||
auto modToStr = GeneralUtils::to_u16string(mod);
|
||||
modules += u"1:" + (modToStr);
|
||||
if (k + 1 != count) modules += u"+";
|
||||
|
||||
if (temp->GetLotCount(mod) > 0) {
|
||||
@ -5498,6 +5501,13 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
} else {
|
||||
inv->RemoveItem(mod, 1);
|
||||
}
|
||||
|
||||
// Doing this check for 1 singular mission that needs to know when you've swapped every part out during a car modular build.
|
||||
// since all 8129's are the same, skip checking that
|
||||
if (mod != 8129) {
|
||||
if (oldPartList.find(GeneralUtils::UTF16ToWTF8(modToStr)) != std::string::npos) everyPieceSwapped = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const auto moduleAssembly = new LDFData<std::u16string>(u"assemblyPartLOTs", modules);
|
||||
@ -5516,6 +5526,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
if (entity->GetLOT() != 9980 || Game::server->GetZoneID() != 1200) {
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, entity->GetLOT(), entity->GetObjectID());
|
||||
if (count >= 7 && everyPieceSwapped) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, LWOOBJID_EMPTY, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_MODULAR_BUILDING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -347,6 +347,15 @@ void Item::Disassemble(const eInventoryType inventoryType) {
|
||||
if (data->GetKey() == u"assemblyPartLOTs") {
|
||||
auto modStr = data->GetValueAsString();
|
||||
|
||||
// This shouldn't be null but always check your pointers.
|
||||
if (GetInventory()) {
|
||||
auto inventoryComponent = GetInventory()->GetComponent();
|
||||
if (inventoryComponent) {
|
||||
auto entity = inventoryComponent->GetParent();
|
||||
if (entity) entity->SetVar<std::string>(u"currentModifiedBuild", modStr);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<LOT> modArray;
|
||||
|
||||
std::stringstream ssData(modStr);
|
||||
|
Loading…
Reference in New Issue
Block a user