mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-21 14:14:22 +00:00
Merge remote-tracking branch 'origin/main' into chore--mount-imporvements
# Conflicts: # dGame/dGameMessages/GameMessages.h
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <sstream>
|
||||
#include <future>
|
||||
#include <chrono>
|
||||
#include <ranges>
|
||||
#include "RakString.h"
|
||||
|
||||
//CDB includes:
|
||||
@@ -365,18 +366,19 @@ void GameMessages::SendResetMissions(Entity* entity, const SystemAddress& sysAdd
|
||||
|
||||
void GameMessages::SendPlatformResync(Entity* entity, const SystemAddress& sysAddr, bool bStopAtDesiredWaypoint,
|
||||
int iIndex, int iDesiredWaypointIndex, int nextIndex,
|
||||
eMovementPlatformState movementState) {
|
||||
eMovementPlatformState movementState, bool special) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
const auto objID = entity->GetObjectID();
|
||||
const auto lot = entity->GetLOT();
|
||||
|
||||
if (lot == 12341 || lot == 5027 || lot == 5028 || lot == 14335 || lot == 14447 || lot == 14449 || lot == 11306 || lot == 11308) {
|
||||
if (lot == 12341 || lot == 5027 || lot == 5028 || lot == 14335 || lot == 14447 || lot == 14449 || lot == 11306 || lot == 11308 || lot == 9483) {
|
||||
iDesiredWaypointIndex = (lot == 11306 || lot == 11308) ? 1 : 0;
|
||||
iIndex = 0;
|
||||
nextIndex = 0;
|
||||
iIndex = lot == 9483 ? 1 : 0;
|
||||
nextIndex = lot == 9483 && !special ? 1 : 0;
|
||||
bStopAtDesiredWaypoint = true;
|
||||
movementState = eMovementPlatformState::Stationary;
|
||||
movementState = lot == 9483 && !special ? eMovementPlatformState::Stopped : eMovementPlatformState::Stationary;
|
||||
}
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
@@ -465,20 +467,20 @@ void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const System
|
||||
|
||||
bitStream.Write(lootSourceType != eLootSourceType::NONE); // Loot source
|
||||
if (lootSourceType != eLootSourceType::NONE) bitStream.Write(lootSourceType);
|
||||
LWONameValue extraInfo;
|
||||
std::u16string extraInfo;
|
||||
|
||||
auto config = item->GetConfig();
|
||||
const auto& config = item->GetConfig();
|
||||
|
||||
for (auto* data : config) {
|
||||
extraInfo.name += GeneralUtils::ASCIIToUTF16(data->GetString()) + u",";
|
||||
for (const auto& data : config.values | std::views::values) {
|
||||
extraInfo += GeneralUtils::ASCIIToUTF16(data->GetString()) + u",";
|
||||
}
|
||||
|
||||
if (extraInfo.name.length() > 0) extraInfo.name.pop_back(); // remove the last comma
|
||||
if (extraInfo.length() > 0) extraInfo.pop_back(); // remove the last comma
|
||||
|
||||
bitStream.Write<uint32_t>(extraInfo.name.size());
|
||||
if (extraInfo.name.size() > 0) {
|
||||
for (uint32_t i = 0; i < extraInfo.name.size(); ++i) {
|
||||
bitStream.Write<uint16_t>(extraInfo.name[i]);
|
||||
bitStream.Write<uint32_t>(extraInfo.size());
|
||||
if (extraInfo.size() > 0) {
|
||||
for (uint32_t i = 0; i < extraInfo.size(); ++i) {
|
||||
bitStream.Write<uint16_t>(extraInfo[i]);
|
||||
}
|
||||
bitStream.Write<uint16_t>(0x00);
|
||||
}
|
||||
@@ -743,13 +745,9 @@ void GameMessages::SendBroadcastTextToChatbox(Entity* entity, const SystemAddres
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write(MessageType::Game::BROADCAST_TEXT_TO_CHATBOX);
|
||||
|
||||
LWONameValue attribs;
|
||||
attribs.name = attrs;
|
||||
attribs.length = attrs.size();
|
||||
|
||||
bitStream.Write<uint32_t>(attribs.length);
|
||||
for (uint32_t i = 0; i < attribs.length; ++i) {
|
||||
bitStream.Write<uint16_t>(attribs.name[i]);
|
||||
bitStream.Write<uint32_t>(attrs.size());
|
||||
for (uint32_t i = 0; i < attrs.size(); ++i) {
|
||||
bitStream.Write<uint16_t>(attrs[i]);
|
||||
}
|
||||
bitStream.Write<uint16_t>(0x00); // Null Terminator
|
||||
|
||||
@@ -2621,11 +2619,11 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream& inStream, Entity* ent
|
||||
info.spawnerID = entity->GetObjectID();
|
||||
info.spawnerNodeID = 0;
|
||||
|
||||
info.settings.push_back(new LDFData<LWOOBJID>(u"blueprintid", blueprintIDs[i]));
|
||||
info.settings.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
||||
info.settings.push_back(new LDFData<int>(u"modelType", 2));
|
||||
info.settings.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
||||
info.settings.push_back(new LDFData<LWOOBJID>(u"userModelID", modelIDs[i]));
|
||||
info.settings.Insert<LWOOBJID>(u"blueprintid", blueprintIDs[i]);
|
||||
info.settings.Insert<int>(u"componentWhitelist", 1);
|
||||
info.settings.Insert<int>(u"modelType", 2);
|
||||
info.settings.Insert<bool>(u"propertyObjectID", true);
|
||||
info.settings.Insert<LWOOBJID>(u"userModelID", modelIDs[i]);
|
||||
Entity* newEntity = Game::entityManager->CreateEntity(info, nullptr);
|
||||
if (newEntity) {
|
||||
Game::entityManager->ConstructEntity(newEntity);
|
||||
@@ -3221,7 +3219,7 @@ void GameMessages::HandleClientTradeRequest(RakNet::BitStream& inStream, Entity*
|
||||
|
||||
LOG("Trade request to (%llu)", i64Invitee);
|
||||
|
||||
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||
const auto& trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||
|
||||
if (trade != nullptr) {
|
||||
if (!trade->IsParticipant(i64Invitee)) {
|
||||
@@ -3244,7 +3242,7 @@ void GameMessages::HandleClientTradeRequest(RakNet::BitStream& inStream, Entity*
|
||||
}
|
||||
|
||||
void GameMessages::HandleClientTradeCancel(RakNet::BitStream& inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||
const auto& trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||
|
||||
if (trade == nullptr) return;
|
||||
|
||||
@@ -3258,7 +3256,7 @@ void GameMessages::HandleClientTradeAccept(RakNet::BitStream& inStream, Entity*
|
||||
|
||||
LOG("Trade accepted from (%llu) -> (%d)", entity->GetObjectID(), bFirst);
|
||||
|
||||
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||
const auto& trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||
|
||||
if (trade == nullptr) return;
|
||||
|
||||
@@ -3324,7 +3322,7 @@ void GameMessages::HandleClientTradeUpdate(RakNet::BitStream& inStream, Entity*
|
||||
LOG("Trade item from (%llu) -> (%llu)/(%llu), (%i), (%llu), (%i), (%i)", entity->GetObjectID(), itemId, itemId2, lot, unknown1, unknown2, unknown3);
|
||||
}
|
||||
|
||||
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||
const auto& trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||
|
||||
if (trade == nullptr) return;
|
||||
|
||||
@@ -5275,7 +5273,8 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream& inStream, En
|
||||
int eInvType = INVENTORY_MAX;
|
||||
bool eLootTypeSourceIsDefault = false;
|
||||
int eLootTypeSource = LOOTTYPE_NONE;
|
||||
LWONameValue extraInfo;
|
||||
int32_t extraInfoLength = 0;
|
||||
std::u16string extraInfo;
|
||||
bool forceDeletion = true;
|
||||
bool iLootTypeSourceIsDefault = false;
|
||||
LWOOBJID iLootTypeSource = LWOOBJID_EMPTY;
|
||||
@@ -5301,12 +5300,12 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream& inStream, En
|
||||
if (eInvTypeIsDefault) inStream.Read(eInvType);
|
||||
inStream.Read(eLootTypeSourceIsDefault);
|
||||
if (eLootTypeSourceIsDefault) inStream.Read(eLootTypeSource);
|
||||
inStream.Read(extraInfo.length);
|
||||
if (extraInfo.length > 0) {
|
||||
for (uint32_t i = 0; i < extraInfo.length; ++i) {
|
||||
inStream.Read(extraInfoLength);
|
||||
if (extraInfoLength > 0) {
|
||||
for (uint32_t i = 0; i < extraInfoLength; ++i) {
|
||||
uint16_t character;
|
||||
inStream.Read(character);
|
||||
extraInfo.name.push_back(character);
|
||||
extraInfo.push_back(character);
|
||||
}
|
||||
uint16_t nullTerm;
|
||||
inStream.Read(nullTerm);
|
||||
@@ -5514,10 +5513,8 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream& inStream, Entity*
|
||||
//inv->UnequipItem(inv->GetItemStackByLOT(6086, eInventoryType::ITEMS)); // take off the thinking cap
|
||||
//Game::entityManager->SerializeEntity(entity);
|
||||
|
||||
const auto moduleAssembly = new LDFData<std::u16string>(u"assemblyPartLOTs", modules);
|
||||
|
||||
std::vector<LDFBaseData*> config;
|
||||
config.push_back(moduleAssembly);
|
||||
LwoNameValue config;
|
||||
config.Insert(u"assemblyPartLOTs", modules);
|
||||
|
||||
LWOOBJID newID = ObjectIDManager::GetPersistentID();
|
||||
|
||||
@@ -5763,7 +5760,6 @@ void GameMessages::HandleUseNonEquipmentItem(RakNet::BitStream& inStream, Entity
|
||||
|
||||
void GameMessages::HandleMatchRequest(RakNet::BitStream& inStream, Entity* entity) {
|
||||
LWOOBJID activator;
|
||||
//std::map<LWOOBJID, LWONameValue> additionalPlayers;
|
||||
uint32_t playerChoicesLen;
|
||||
std::string playerChoices;
|
||||
int type;
|
||||
@@ -6318,7 +6314,7 @@ namespace GameMessages {
|
||||
bitStream.Write(id);
|
||||
|
||||
std::string toWrite;
|
||||
for (const auto* item : localizeParams) {
|
||||
for (const auto& item : localizeParams | std::views::values) {
|
||||
toWrite += item->GetString() + "\n";
|
||||
}
|
||||
if (!toWrite.empty()) toWrite.pop_back();
|
||||
@@ -6498,8 +6494,8 @@ namespace GameMessages {
|
||||
}
|
||||
|
||||
void TeamPickupItem::Serialize(RakNet::BitStream& stream) const {
|
||||
stream.Write(lootID);
|
||||
stream.Write(lootOwnerID);
|
||||
stream.Write(lootID);
|
||||
stream.Write(lootOwnerID);
|
||||
}
|
||||
|
||||
void ToggleGMInvis::Serialize(RakNet::BitStream& stream) const {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "Brick.h"
|
||||
#include "MessageType/Game.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "LDFFormat.h"
|
||||
|
||||
class AMFBaseValue;
|
||||
class AMFArrayValue;
|
||||
@@ -102,9 +103,11 @@ namespace GameMessages {
|
||||
void SendPlayNDAudioEmitter(Entity* entity, const SystemAddress& sysAddr, std::string audioGUID);
|
||||
|
||||
void SendStartPathing(Entity* entity);
|
||||
|
||||
// special is for the FV tree platform, feature is complete if we just do that so meh
|
||||
void SendPlatformResync(Entity* entity, const SystemAddress& sysAddr, bool bStopAtDesiredWaypoint = false,
|
||||
int iIndex = 0, int iDesiredWaypointIndex = 1, int nextIndex = 1,
|
||||
eMovementPlatformState movementState = eMovementPlatformState::Moving);
|
||||
eMovementPlatformState movementState = eMovementPlatformState::Moving, bool special = false);
|
||||
|
||||
void SendResetMissions(Entity* entity, const SystemAddress& sysAddr, const int32_t missionid = -1);
|
||||
void SendRestoreToPostLoadStats(Entity* entity, const SystemAddress& sysAddr);
|
||||
@@ -711,7 +714,7 @@ namespace GameMessages {
|
||||
bool translate{};
|
||||
int32_t time{};
|
||||
std::u16string id{};
|
||||
std::vector<LDFBaseData*> localizeParams{};
|
||||
LwoNameValue localizeParams{};
|
||||
std::u16string imageName{};
|
||||
std::u16string text{};
|
||||
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||
@@ -734,7 +737,7 @@ namespace GameMessages {
|
||||
|
||||
struct ConfigureRacingControl : public GameMsg {
|
||||
ConfigureRacingControl() : GameMsg(MessageType::Game::CONFIGURE_RACING_CONTROL) {}
|
||||
std::vector<std::unique_ptr<LDFBaseData>> racingSettings{};
|
||||
LwoNameValue racingSettings{};
|
||||
};
|
||||
|
||||
struct SetModelToBuild : public GameMsg {
|
||||
@@ -754,7 +757,7 @@ namespace GameMessages {
|
||||
struct ActivityNotify : public GameMsg {
|
||||
ActivityNotify() : GameMsg(MessageType::Game::ACTIVITY_NOTIFY) {}
|
||||
|
||||
std::vector<std::unique_ptr<LDFBaseData>> notification{};
|
||||
LwoNameValue notification{};
|
||||
};
|
||||
|
||||
struct ShootingGalleryFire : public GameMsg {
|
||||
@@ -970,5 +973,12 @@ namespace GameMessages {
|
||||
LWOOBJID possessedId{ LWOOBJID_EMPTY };
|
||||
int32_t setId{ -1 };
|
||||
};
|
||||
|
||||
struct ObjectLoaded : public GameMsg {
|
||||
ObjectLoaded() : GameMsg(MessageType::Game::OBJECT_LOADED) {}
|
||||
|
||||
LWOOBJID objectID{};
|
||||
LOT lot{};
|
||||
};
|
||||
};
|
||||
#endif // GAMEMESSAGES_H
|
||||
|
||||
Reference in New Issue
Block a user