mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-25 00:38:08 +00:00
Merge branch 'main' into PetFixes
This commit is contained in:
@@ -166,7 +166,9 @@ void Entity::Initialize() {
|
||||
|
||||
if (!groupIDs.empty()) {
|
||||
m_Groups = GeneralUtils::SplitString(groupIDs, ';');
|
||||
m_Groups.erase(m_Groups.end() - 1);
|
||||
if (!m_Groups.empty()) {
|
||||
if (m_Groups.back().empty()) m_Groups.erase(m_Groups.end() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,7 +336,7 @@ void Entity::Initialize() {
|
||||
|
||||
CDDestructibleComponentTable* destCompTable = CDClientManager::Instance().GetTable<CDDestructibleComponentTable>();
|
||||
std::vector<CDDestructibleComponent> destCompData = destCompTable->Query([=](CDDestructibleComponent entry) { return (entry.id == componentID); });
|
||||
|
||||
|
||||
bool isSmashable = GetVarAs<int32_t>(u"is_smashable") != 0;
|
||||
if (buffComponentID > 0 || collectibleComponentID > 0 || isSmashable) {
|
||||
DestroyableComponent* comp = AddComponent<DestroyableComponent>();
|
||||
@@ -541,8 +543,7 @@ void Entity::Initialize() {
|
||||
|
||||
// Known bug with moving platform in FV that casues it to build at the end instead of the start.
|
||||
// This extends the smash time so players can ride up the lift.
|
||||
if (m_TemplateID == 9483)
|
||||
{
|
||||
if (m_TemplateID == 9483) {
|
||||
rebuildComponent->SetResetTime(rebuildComponent->GetResetTime() + 25);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,10 +47,6 @@ std::vector<LWOMAPID> EntityManager::m_GhostingExcludedZones = {
|
||||
|
||||
// Configure some exceptions for ghosting, nessesary for some special objects.
|
||||
std::vector<LOT> EntityManager::m_GhostingExcludedLOTs = {
|
||||
// NT - Pipes
|
||||
9524,
|
||||
12408,
|
||||
|
||||
// AG - Footrace
|
||||
4967
|
||||
};
|
||||
|
||||
@@ -60,6 +60,8 @@ void Player::SetSystemAddress(const SystemAddress& value) {
|
||||
}
|
||||
|
||||
void Player::SetRespawnPos(const NiPoint3 position) {
|
||||
if (!m_Character) return;
|
||||
|
||||
m_respawnPos = position;
|
||||
|
||||
m_Character->SetRespawnPoint(Game::zoneManager->GetZone()->GetWorldID(), position);
|
||||
|
||||
@@ -44,57 +44,53 @@ inline void StripCR(std::string& str) {
|
||||
void UserManager::Initialize() {
|
||||
std::string line;
|
||||
|
||||
AssetMemoryBuffer fnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_first.txt");
|
||||
if (!fnBuff.m_Success) {
|
||||
auto fnStream = Game::assetManager->GetFile("names/minifigname_first.txt");
|
||||
if (!fnStream) {
|
||||
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_first.txt").string().c_str());
|
||||
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
||||
}
|
||||
std::istream fnStream = std::istream(&fnBuff);
|
||||
|
||||
while (std::getline(fnStream, line, '\n')) {
|
||||
std::string name = line;
|
||||
StripCR(name);
|
||||
m_FirstNames.push_back(name);
|
||||
}
|
||||
fnBuff.close();
|
||||
|
||||
AssetMemoryBuffer mnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_middle.txt");
|
||||
if (!mnBuff.m_Success) {
|
||||
auto mnStream = Game::assetManager->GetFile("names/minifigname_middle.txt");
|
||||
if (!mnStream) {
|
||||
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_middle.txt").string().c_str());
|
||||
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
||||
}
|
||||
std::istream mnStream = std::istream(&mnBuff);
|
||||
|
||||
while (std::getline(mnStream, line, '\n')) {
|
||||
std::string name = line;
|
||||
StripCR(name);
|
||||
m_MiddleNames.push_back(name);
|
||||
}
|
||||
mnBuff.close();
|
||||
|
||||
AssetMemoryBuffer lnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_last.txt");
|
||||
if (!lnBuff.m_Success) {
|
||||
auto lnStream = Game::assetManager->GetFile("names/minifigname_last.txt");
|
||||
if (!lnStream) {
|
||||
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_last.txt").string().c_str());
|
||||
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
||||
}
|
||||
std::istream lnStream = std::istream(&lnBuff);
|
||||
|
||||
while (std::getline(lnStream, line, '\n')) {
|
||||
std::string name = line;
|
||||
StripCR(name);
|
||||
m_LastNames.push_back(name);
|
||||
}
|
||||
lnBuff.close();
|
||||
|
||||
//Load our pre-approved names:
|
||||
AssetMemoryBuffer chatListBuff = Game::assetManager->GetFileAsBuffer("chatplus_en_us.txt");
|
||||
if (!chatListBuff.m_Success) {
|
||||
// Load our pre-approved names:
|
||||
auto chatListStream = Game::assetManager->GetFile("chatplus_en_us.txt");
|
||||
if (!chatListStream) {
|
||||
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "chatplus_en_us.txt").string().c_str());
|
||||
throw std::runtime_error("Aborting initialization due to missing chat whitelist file.");
|
||||
}
|
||||
std::istream chatListStream = std::istream(&chatListBuff);
|
||||
|
||||
while (std::getline(chatListStream, line, '\n')) {
|
||||
StripCR(line);
|
||||
m_PreapprovedNames.push_back(line);
|
||||
}
|
||||
chatListBuff.close();
|
||||
}
|
||||
|
||||
UserManager::~UserManager() {
|
||||
|
||||
@@ -22,7 +22,6 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
if (entity->IsPlayer() && !this->m_DontApplyImmune) {
|
||||
const float immunityTime = Game::zoneManager->GetWorldConfig()->globalImmunityTime;
|
||||
destroyableComponent->SetDamageCooldownTimer(immunityTime);
|
||||
LOG_DEBUG("Target targetEntity %llu took damage, setting damage cooldown timer to %f s", branch.target, immunityTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,11 +187,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
return;
|
||||
}
|
||||
|
||||
const float immunityTime = Game::zoneManager->GetWorldConfig()->globalImmunityTime;
|
||||
LOG_DEBUG("Damage cooldown timer currently %f s", destroyableComponent->GetDamageCooldownTimer());
|
||||
|
||||
const bool isImmune = (destroyableComponent->IsImmune()) || (destroyableComponent->IsCooldownImmune());
|
||||
|
||||
const bool isImmune = destroyableComponent->IsImmune() || destroyableComponent->IsCooldownImmune();
|
||||
bitStream->Write(isImmune);
|
||||
|
||||
if (isImmune) {
|
||||
@@ -219,8 +214,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
|
||||
//Handle player damage cooldown
|
||||
if (isSuccess && targetEntity->IsPlayer() && !this->m_DontApplyImmune) {
|
||||
destroyableComponent->SetDamageCooldownTimer(immunityTime);
|
||||
LOG_DEBUG("Target targetEntity %llu took damage, setting damage cooldown timer to %f s", branch.target, immunityTime);
|
||||
destroyableComponent->SetDamageCooldownTimer(Game::zoneManager->GetWorldConfig()->globalImmunityTime);
|
||||
}
|
||||
|
||||
eBasicAttackSuccessTypes successState = eBasicAttackSuccessTypes::FAILIMMUNE;
|
||||
|
||||
@@ -398,7 +398,8 @@ void BuffComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
for (const auto& [id, buff] : m_Buffs) {
|
||||
auto* buffEntry = doc->NewElement("b");
|
||||
if (buff.cancelOnZone || buff.cancelOnLogout) continue;
|
||||
// TODO: change this if to if (buff.cancelOnZone || buff.cancelOnLogout) handling at some point. No current way to differentiate between zone transfer and logout.
|
||||
if (buff.cancelOnZone) continue;
|
||||
|
||||
buffEntry->SetAttribute("id", id);
|
||||
buffEntry->SetAttribute("t", buff.time);
|
||||
|
||||
@@ -557,7 +557,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
|
||||
}
|
||||
|
||||
if (IsImmune() || IsCooldownImmune()) {
|
||||
LOG_DEBUG("Target targetEntity %llu is immune!", m_Parent->GetObjectID()); //Immune is succesfully proc'd
|
||||
LOG_DEBUG("Target targetEntity %llu is immune!", m_Parent->GetObjectID());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<int>(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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool i
|
||||
outBitStream->Write<uint32_t>(0);
|
||||
} else {
|
||||
outBitStream->Write<uint32_t>(1);
|
||||
outBitStream->Write<LWOOBJID>(m_CurrentPlayerID);
|
||||
for (size_t i = 0; i < 10; i++) {
|
||||
outBitStream->Write<float_t>(0.0f);
|
||||
}
|
||||
@@ -60,6 +61,7 @@ void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool i
|
||||
outBitStream->Write<LWOOBJID>(m_CurrentPlayerID);
|
||||
outBitStream->Write<float_t>(m_DynamicParams.cannonTimeout);
|
||||
outBitStream->Write<float_t>(m_DynamicParams.cannonFOV);
|
||||
if (!isInitialUpdate) m_Dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eConnectionType.h"
|
||||
#include "eGameMessageType.h"
|
||||
#include "ePlayerFlag.h"
|
||||
#include "dConfig.h"
|
||||
|
||||
using namespace std;
|
||||
#include "StringifiedEnum.h"
|
||||
|
||||
void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, eGameMessageType messageID) {
|
||||
|
||||
@@ -49,11 +49,11 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
User* usr = UserManager::Instance()->GetUser(sysAddr);
|
||||
|
||||
if (!entity) {
|
||||
LOG("Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);
|
||||
LOG("Failed to find associated entity (%llu), aborting GM: %4i, %s!", objectID, messageID, StringifiedEnum::ToString(messageID).data());
|
||||
return;
|
||||
}
|
||||
|
||||
if (messageID != eGameMessageType::READY_FOR_UPDATES) LOG_DEBUG("received game message ID: %i", messageID);
|
||||
if (messageID != eGameMessageType::READY_FOR_UPDATES) LOG_DEBUG("Received GM with ID and name: %4i, %s", messageID, StringifiedEnum::ToString(messageID).data());
|
||||
|
||||
switch (messageID) {
|
||||
|
||||
@@ -344,12 +344,12 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
|
||||
SyncSkill sync = SyncSkill(inStream); // inStream replaced &bitStream
|
||||
|
||||
ostringstream buffer;
|
||||
std::ostringstream buffer;
|
||||
|
||||
for (unsigned int k = 0; k < sync.sBitStream.size(); k++) {
|
||||
char s;
|
||||
s = sync.sBitStream.at(k);
|
||||
buffer << setw(2) << hex << setfill('0') << (int)s << " ";
|
||||
buffer << std::setw(2) << std::hex << std::setfill('0') << static_cast<int>(s) << " ";
|
||||
}
|
||||
|
||||
if (usr != nullptr) {
|
||||
@@ -690,8 +690,11 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
case eGameMessageType::CANCEL_DONATION_ON_PLAYER:
|
||||
GameMessages::HandleCancelDonationOnPlayer(inStream, entity);
|
||||
break;
|
||||
case eGameMessageType::REQUEST_VENDOR_STATUS_UPDATE:
|
||||
GameMessages::SendVendorStatusUpdate(entity, sysAddr, true);
|
||||
break;
|
||||
default:
|
||||
LOG_DEBUG("Unknown game message ID: %i", messageID);
|
||||
LOG_DEBUG("Received Unknown GM with ID: %4i, %s", messageID, StringifiedEnum::ToString(messageID).data());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
#include "Logger.h"
|
||||
#include "GameMessages.h"
|
||||
#include "CDClientDatabase.h"
|
||||
|
||||
enum class eGameMessageType : uint16_t;
|
||||
#include "eGameMessageType.h"
|
||||
|
||||
namespace GameMessageHandler {
|
||||
void HandleMessage(RakNet::BitStream* inStream, const SystemAddress& sysAddr, LWOOBJID objectID, eGameMessageType messageID);
|
||||
|
||||
@@ -113,7 +113,7 @@ void GameMessages::SendFireEventClientSide(const LWOOBJID& objectID, const Syste
|
||||
uint32_t argSize = args.size();
|
||||
bitStream.Write(argSize);
|
||||
for (uint32_t k = 0; k < argSize; k++) {
|
||||
bitStream.Write(static_cast<uint16_t>(args[k]));
|
||||
bitStream.Write<uint16_t>(args[k]);
|
||||
}
|
||||
bitStream.Write(object);
|
||||
bitStream.Write0();
|
||||
@@ -223,13 +223,13 @@ void GameMessages::SendInvalidZoneTransferList(Entity* entity, const SystemAddre
|
||||
uint32_t CustomerFeedbackURLLength = feedbackURL.size();
|
||||
bitStream.Write(CustomerFeedbackURLLength);
|
||||
for (uint32_t k = 0; k < CustomerFeedbackURLLength; k++) {
|
||||
bitStream.Write(static_cast<uint16_t>(feedbackURL[k]));
|
||||
bitStream.Write<uint16_t>(feedbackURL[k]);
|
||||
}
|
||||
|
||||
uint32_t InvalidMapTransferListLength = invalidMapTransferList.size();
|
||||
bitStream.Write(InvalidMapTransferListLength);
|
||||
for (uint32_t k = 0; k < InvalidMapTransferListLength; k++) {
|
||||
bitStream.Write(static_cast<uint16_t>(invalidMapTransferList[k]));
|
||||
bitStream.Write<uint16_t>(invalidMapTransferList[k]);
|
||||
}
|
||||
|
||||
bitStream.Write(feedbackOnExit);
|
||||
@@ -320,17 +320,17 @@ void GameMessages::SendPlayNDAudioEmitter(Entity* entity, const SystemAddress& s
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::PLAY_ND_AUDIO_EMITTER);
|
||||
bitStream.Write(eGameMessageType::PLAY_ND_AUDIO_EMITTER);
|
||||
bitStream.Write0();
|
||||
bitStream.Write0();
|
||||
|
||||
uint32_t length = audioGUID.size();
|
||||
bitStream.Write(length);
|
||||
for (uint32_t k = 0; k < length; k++) {
|
||||
bitStream.Write(static_cast<char>(audioGUID[k]));
|
||||
bitStream.Write<char>(audioGUID[k]);
|
||||
}
|
||||
|
||||
bitStream.Write(uint32_t(0));
|
||||
bitStream.Write<uint32_t>(0);
|
||||
bitStream.Write0();
|
||||
bitStream.Write0();
|
||||
|
||||
@@ -347,6 +347,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) {
|
||||
@@ -364,7 +377,7 @@ void GameMessages::SendPlatformResync(Entity* entity, const SystemAddress& sysAd
|
||||
}
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::PLATFORM_RESYNC);
|
||||
bitStream.Write(eGameMessageType::PLATFORM_RESYNC);
|
||||
|
||||
bool bReverse = false;
|
||||
int eCommand = 0;
|
||||
@@ -421,7 +434,7 @@ void GameMessages::SendChatModeUpdate(const LWOOBJID& objectID, eGameMasterLevel
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write((uint16_t)eGameMessageType::UPDATE_CHAT_MODE);
|
||||
bitStream.Write(eGameMessageType::UPDATE_CHAT_MODE);
|
||||
bitStream.Write(level);
|
||||
SEND_PACKET_BROADCAST;
|
||||
}
|
||||
@@ -430,7 +443,7 @@ void GameMessages::SendGMLevelBroadcast(const LWOOBJID& objectID, eGameMasterLev
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write((uint16_t)eGameMessageType::SET_GM_LEVEL);
|
||||
bitStream.Write(eGameMessageType::SET_GM_LEVEL);
|
||||
bitStream.Write1();
|
||||
bitStream.Write(level);
|
||||
SEND_PACKET_BROADCAST;
|
||||
@@ -461,9 +474,9 @@ void GameMessages::SendAddItemToInventoryClientSync(Entity* entity, const System
|
||||
bitStream.Write<uint32_t>(extraInfo.name.size());
|
||||
if (extraInfo.name.size() > 0) {
|
||||
for (uint32_t i = 0; i < extraInfo.name.size(); ++i) {
|
||||
bitStream.Write(static_cast<uint16_t>(extraInfo.name[i]));
|
||||
bitStream.Write<uint16_t>(extraInfo.name[i]);
|
||||
}
|
||||
bitStream.Write(static_cast<uint16_t>(0x00));
|
||||
bitStream.Write<uint16_t>(0x00);
|
||||
}
|
||||
|
||||
bitStream.Write(item->GetLot());
|
||||
@@ -500,7 +513,7 @@ void GameMessages::SendNotifyClientFlagChange(const LWOOBJID& objectID, uint32_t
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write((uint16_t)eGameMessageType::NOTIFY_CLIENT_FLAG_CHANGE);
|
||||
bitStream.Write(eGameMessageType::NOTIFY_CLIENT_FLAG_CHANGE);
|
||||
bitStream.Write(bFlag);
|
||||
bitStream.Write(iFlagID);
|
||||
|
||||
@@ -523,7 +536,7 @@ void GameMessages::SendChangeObjectWorldState(const LWOOBJID& objectID, eObjectW
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write((uint16_t)eGameMessageType::CHANGE_OBJECT_WORLD_STATE);
|
||||
bitStream.Write(eGameMessageType::CHANGE_OBJECT_WORLD_STATE);
|
||||
bitStream.Write(state);
|
||||
|
||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST
|
||||
@@ -578,7 +591,7 @@ void GameMessages::SendNotifyMissionTask(Entity* entity, const SystemAddress& sy
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::NOTIFY_MISSION_TASK);
|
||||
bitStream.Write(eGameMessageType::NOTIFY_MISSION_TASK);
|
||||
|
||||
bitStream.Write(missionID);
|
||||
bitStream.Write(taskMask);
|
||||
@@ -596,7 +609,7 @@ void GameMessages::SendModifyLEGOScore(Entity* entity, const SystemAddress& sysA
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::MODIFY_LEGO_SCORE);
|
||||
bitStream.Write(eGameMessageType::MODIFY_LEGO_SCORE);
|
||||
bitStream.Write(score);
|
||||
|
||||
bitStream.Write(sourceType != eLootSourceType::NONE);
|
||||
@@ -610,14 +623,14 @@ void GameMessages::SendUIMessageServerToSingleClient(Entity* entity, const Syste
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::UI_MESSAGE_SERVER_TO_SINGLE_CLIENT);
|
||||
bitStream.Write(eGameMessageType::UI_MESSAGE_SERVER_TO_SINGLE_CLIENT);
|
||||
|
||||
bitStream.Write<AMFBaseValue&>(args);
|
||||
uint32_t strMessageNameLength = message.size();
|
||||
bitStream.Write(strMessageNameLength);
|
||||
|
||||
for (uint32_t k = 0; k < strMessageNameLength; k++) {
|
||||
bitStream.Write(static_cast<char>(message[k]));
|
||||
bitStream.Write<char>(message[k]);
|
||||
}
|
||||
|
||||
SEND_PACKET;
|
||||
@@ -629,14 +642,14 @@ void GameMessages::SendUIMessageServerToAllClients(const std::string& message, A
|
||||
|
||||
LWOOBJID empty = 0;
|
||||
bitStream.Write(empty);
|
||||
bitStream.Write((uint16_t)eGameMessageType::UI_MESSAGE_SERVER_TO_ALL_CLIENTS);
|
||||
bitStream.Write(eGameMessageType::UI_MESSAGE_SERVER_TO_ALL_CLIENTS);
|
||||
|
||||
bitStream.Write<AMFBaseValue&>(args);
|
||||
uint32_t strMessageNameLength = message.size();
|
||||
bitStream.Write(strMessageNameLength);
|
||||
|
||||
for (uint32_t k = 0; k < strMessageNameLength; k++) {
|
||||
bitStream.Write(static_cast<char>(message[k]));
|
||||
bitStream.Write<char>(message[k]);
|
||||
}
|
||||
|
||||
SEND_PACKET_BROADCAST;
|
||||
@@ -647,11 +660,11 @@ void GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(Entity* entity,
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::PLAY_EMBEDDED_EFFECT_ON_ALL_CLIENTS_NEAR_OBJECT);
|
||||
bitStream.Write(eGameMessageType::PLAY_EMBEDDED_EFFECT_ON_ALL_CLIENTS_NEAR_OBJECT);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(effectName.length()));
|
||||
bitStream.Write<uint32_t>(effectName.length());
|
||||
for (uint32_t k = 0; k < effectName.length(); k++) {
|
||||
bitStream.Write(static_cast<uint16_t>(effectName[k]));
|
||||
bitStream.Write<uint16_t>(effectName[k]);
|
||||
}
|
||||
bitStream.Write(fromObjectID);
|
||||
bitStream.Write(radius);
|
||||
@@ -668,7 +681,7 @@ void GameMessages::SendPlayFXEffect(const LWOOBJID& entity, int32_t effectID, co
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity);
|
||||
bitStream.Write((uint16_t)eGameMessageType::PLAY_FX_EFFECT);
|
||||
bitStream.Write(eGameMessageType::PLAY_FX_EFFECT);
|
||||
|
||||
bitStream.Write(effectID != -1);
|
||||
if (effectID != -1) bitStream.Write(effectID);
|
||||
@@ -716,22 +729,22 @@ void GameMessages::SendBroadcastTextToChatbox(Entity* entity, const SystemAddres
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::BROADCAST_TEXT_TO_CHATBOX);
|
||||
bitStream.Write(eGameMessageType::BROADCAST_TEXT_TO_CHATBOX);
|
||||
|
||||
LWONameValue attribs;
|
||||
attribs.name = attrs;
|
||||
attribs.length = attrs.size();
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(attribs.length));
|
||||
bitStream.Write<uint32_t>(attribs.length);
|
||||
for (uint32_t i = 0; i < attribs.length; ++i) {
|
||||
bitStream.Write(static_cast<uint16_t>(attribs.name[i]));
|
||||
bitStream.Write<uint16_t>(attribs.name[i]);
|
||||
}
|
||||
bitStream.Write(static_cast<uint16_t>(0x00)); // Null Terminator
|
||||
bitStream.Write<uint16_t>(0x00); // Null Terminator
|
||||
|
||||
uint32_t wsTextLength = wsText.size();
|
||||
bitStream.Write(wsTextLength);
|
||||
for (uint32_t k = 0; k < wsTextLength; k++) {
|
||||
bitStream.Write(static_cast<uint16_t>(wsText[k]));
|
||||
bitStream.Write<uint16_t>(wsText[k]);
|
||||
}
|
||||
|
||||
SEND_PACKET_BROADCAST;
|
||||
@@ -772,7 +785,7 @@ void GameMessages::SendRebuildNotifyState(Entity* entity, eRebuildState prevStat
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::REBUILD_NOTIFY_STATE);
|
||||
bitStream.Write(eGameMessageType::REBUILD_NOTIFY_STATE);
|
||||
|
||||
bitStream.Write(prevState);
|
||||
bitStream.Write(state);
|
||||
@@ -786,7 +799,7 @@ void GameMessages::SendEnableRebuild(Entity* entity, bool enable, bool fail, boo
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::ENABLE_REBUILD);
|
||||
bitStream.Write(eGameMessageType::ENABLE_REBUILD);
|
||||
|
||||
bitStream.Write(enable);
|
||||
bitStream.Write(fail);
|
||||
@@ -806,7 +819,7 @@ void GameMessages::SendTerminateInteraction(const LWOOBJID& objectID, eTerminate
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write((uint16_t)eGameMessageType::TERMINATE_INTERACTION);
|
||||
bitStream.Write(eGameMessageType::TERMINATE_INTERACTION);
|
||||
|
||||
bitStream.Write(terminator);
|
||||
bitStream.Write(type);
|
||||
@@ -842,7 +855,7 @@ void GameMessages::SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOB
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
|
||||
bitStream.Write((uint16_t)eGameMessageType::DIE);
|
||||
bitStream.Write(eGameMessageType::DIE);
|
||||
|
||||
bitStream.Write(bClientDeath);
|
||||
bitStream.Write(bSpawnLoot);
|
||||
@@ -853,7 +866,7 @@ void GameMessages::SendDie(Entity* entity, const LWOOBJID& killerID, const LWOOB
|
||||
uint32_t deathTypeLength = deathType.size();
|
||||
bitStream.Write(deathTypeLength);
|
||||
for (uint32_t k = 0; k < deathTypeLength; k++) {
|
||||
bitStream.Write(static_cast<uint16_t>(deathType[k]));
|
||||
bitStream.Write<uint16_t>(deathType[k]);
|
||||
}
|
||||
|
||||
bitStream.Write(directionRelative_AngleXZ);
|
||||
@@ -976,7 +989,7 @@ void GameMessages::SendStop2DAmbientSound(Entity* entity, bool force, std::strin
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::STOP2_D_AMBIENT_SOUND);
|
||||
bitStream.Write(eGameMessageType::STOP2_D_AMBIENT_SOUND);
|
||||
|
||||
uint32_t audioGUIDSize = audioGUID.size();
|
||||
|
||||
@@ -984,7 +997,7 @@ void GameMessages::SendStop2DAmbientSound(Entity* entity, bool force, std::strin
|
||||
bitStream.Write(audioGUIDSize);
|
||||
|
||||
for (uint32_t k = 0; k < audioGUIDSize; k++) {
|
||||
bitStream.Write(static_cast<char>(audioGUID[k]));
|
||||
bitStream.Write<char>(audioGUID[k]);
|
||||
}
|
||||
|
||||
bitStream.Write(result);
|
||||
@@ -999,13 +1012,12 @@ void GameMessages::SendPlay2DAmbientSound(Entity* entity, std::string audioGUID,
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::PLAY2_D_AMBIENT_SOUND);
|
||||
|
||||
bitStream.Write(eGameMessageType::PLAY2_D_AMBIENT_SOUND);
|
||||
uint32_t audioGUIDSize = audioGUID.size();
|
||||
|
||||
bitStream.Write(audioGUIDSize);
|
||||
for (uint32_t k = 0; k < audioGUIDSize; k++) {
|
||||
bitStream.Write(static_cast<char>(audioGUID[k]));
|
||||
bitStream.Write<char>(audioGUID[k]);
|
||||
}
|
||||
bitStream.Write(result);
|
||||
|
||||
@@ -1018,7 +1030,7 @@ void GameMessages::SendSetNetworkScriptVar(Entity* entity, const SystemAddress&
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::SCRIPT_NETWORK_VAR_UPDATE);
|
||||
bitStream.Write(eGameMessageType::SCRIPT_NETWORK_VAR_UPDATE);
|
||||
|
||||
// FIXME: this is a bad place to need to do a conversion because we have no clue whether data is utf8 or plain ascii
|
||||
// an this has performance implications
|
||||
@@ -1027,9 +1039,9 @@ void GameMessages::SendSetNetworkScriptVar(Entity* entity, const SystemAddress&
|
||||
|
||||
bitStream.Write(dataSize);
|
||||
for (auto value : u16Data) {
|
||||
bitStream.Write(uint16_t(value));
|
||||
bitStream.Write<uint16_t>(value);
|
||||
}
|
||||
if (dataSize > 0) bitStream.Write(uint16_t(0));
|
||||
if (dataSize > 0) bitStream.Write<uint16_t>(0);
|
||||
|
||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
||||
SEND_PACKET;
|
||||
@@ -1144,7 +1156,7 @@ void GameMessages::SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPo
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::PLAYER_REACHED_RESPAWN_CHECKPOINT);
|
||||
bitStream.Write(eGameMessageType::PLAYER_REACHED_RESPAWN_CHECKPOINT);
|
||||
|
||||
bitStream.Write(position.x);
|
||||
bitStream.Write(position.y);
|
||||
@@ -1176,7 +1188,7 @@ void GameMessages::SendAddSkill(Entity* entity, TSkillID skillID, BehaviorSlot s
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)eGameMessageType::ADD_SKILL);
|
||||
bitStream.Write(eGameMessageType::ADD_SKILL);
|
||||
|
||||
bitStream.Write(AICombatWeight != 0);
|
||||
if (AICombatWeight != 0) bitStream.Write(AICombatWeight);
|
||||
@@ -1345,8 +1357,8 @@ void GameMessages::SendRemoveItemFromInventory(Entity* entity, const SystemAddre
|
||||
bitStream.Write(eInvType);
|
||||
bitStream.Write1();
|
||||
bitStream.Write(eLootTypeSource);
|
||||
bitStream.Write(static_cast<uint32_t>(0)); //extra info
|
||||
//bitStream.Write(static_cast<uint16_t>(0)); //extra info
|
||||
bitStream.Write<uint32_t>(0); //extra info
|
||||
//bitStream.Write<uint16_t>(0); //extra info
|
||||
bitStream.Write(forceDeletion);
|
||||
bitStream.Write0();
|
||||
bitStream.Write1();
|
||||
@@ -1469,11 +1481,11 @@ void GameMessages::SendMatchUpdate(Entity* entity, const SystemAddress& sysAddr,
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write(eGameMessageType::MATCH_UPDATE);
|
||||
bitStream.Write(uint32_t(data.size()));
|
||||
bitStream.Write<uint32_t>(data.size());
|
||||
for (char character : data) {
|
||||
bitStream.Write(uint16_t(character));
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
if (data.size() > 0) bitStream.Write(uint16_t(0));
|
||||
if (data.size() > 0) bitStream.Write<uint16_t>(0);
|
||||
bitStream.Write(type);
|
||||
|
||||
SEND_PACKET;
|
||||
@@ -1557,7 +1569,7 @@ void GameMessages::NotifyLevelRewards(LWOOBJID objectID, const SystemAddress& sy
|
||||
CMSGHEADER;
|
||||
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write((uint16_t)eGameMessageType::NOTIFY_LEVEL_REWARDS);
|
||||
bitStream.Write(eGameMessageType::NOTIFY_LEVEL_REWARDS);
|
||||
|
||||
bitStream.Write(level);
|
||||
bitStream.Write(sending_rewards);
|
||||
@@ -1743,7 +1755,7 @@ void GameMessages::SendSetRailMovement(const LWOOBJID& objectID, bool pathGoForw
|
||||
|
||||
bitStream.Write(pathGoForward);
|
||||
|
||||
bitStream.Write(uint32_t(pathName.size()));
|
||||
bitStream.Write<uint32_t>(pathName.size());
|
||||
for (auto character : pathName) {
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
@@ -1782,14 +1794,14 @@ void GameMessages::SendStartRailMovement(const LWOOBJID& objectID, std::u16strin
|
||||
bitStream.Write(cameraLocked);
|
||||
bitStream.Write(collisionEnabled);
|
||||
|
||||
bitStream.Write(uint32_t(loopSound.size()));
|
||||
bitStream.Write<uint32_t>(loopSound.size());
|
||||
for (auto character : loopSound) {
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
|
||||
bitStream.Write(goForward);
|
||||
|
||||
bitStream.Write(uint32_t(pathName.size()));
|
||||
bitStream.Write<uint32_t>(pathName.size());
|
||||
for (auto character : pathName) {
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
@@ -1812,12 +1824,12 @@ void GameMessages::SendStartRailMovement(const LWOOBJID& objectID, std::u16strin
|
||||
bitStream.Write<LWOOBJID>(railActivatorObjectID);
|
||||
}
|
||||
|
||||
bitStream.Write(uint32_t(startSound.size()));
|
||||
bitStream.Write<uint32_t>(startSound.size());
|
||||
for (auto character : startSound) {
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
|
||||
bitStream.Write(uint32_t(stopSound.size()));
|
||||
bitStream.Write<uint32_t>(stopSound.size());
|
||||
for (auto character : stopSound) {
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
@@ -1835,7 +1847,7 @@ void GameMessages::SendNotifyClientObject(const LWOOBJID& objectID, std::u16stri
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write(eGameMessageType::NOTIFY_CLIENT_OBJECT);
|
||||
|
||||
bitStream.Write(uint32_t(name.size()));
|
||||
bitStream.Write<uint32_t>(name.size());
|
||||
for (auto character : name) {
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
@@ -1846,7 +1858,7 @@ void GameMessages::SendNotifyClientObject(const LWOOBJID& objectID, std::u16stri
|
||||
|
||||
bitStream.Write(paramObj);
|
||||
|
||||
bitStream.Write(uint32_t(paramStr.size()));
|
||||
bitStream.Write<uint32_t>(paramStr.size());
|
||||
for (auto character : paramStr) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -1864,7 +1876,7 @@ void GameMessages::SendNotifyClientZoneObject(const LWOOBJID& objectID, const st
|
||||
bitStream.Write(objectID);
|
||||
bitStream.Write(eGameMessageType::NOTIFY_CLIENT_ZONE_OBJECT);
|
||||
|
||||
bitStream.Write(uint32_t(name.size()));
|
||||
bitStream.Write<uint32_t>(name.size());
|
||||
for (const auto& character : name) {
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
@@ -1873,7 +1885,7 @@ void GameMessages::SendNotifyClientZoneObject(const LWOOBJID& objectID, const st
|
||||
bitStream.Write(param2);
|
||||
bitStream.Write(paramObj);
|
||||
|
||||
bitStream.Write(uint32_t(paramStr.size()));
|
||||
bitStream.Write<uint32_t>(paramStr.size());
|
||||
for (const auto& character : paramStr) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -1890,9 +1902,9 @@ void GameMessages::SendNotifyClientFailedPrecondition(LWOOBJID objectId, const S
|
||||
bitStream.Write(objectId);
|
||||
bitStream.Write(eGameMessageType::NOTIFY_CLIENT_FAILED_PRECONDITION);
|
||||
|
||||
bitStream.Write(uint32_t(failedReason.size()));
|
||||
bitStream.Write<uint32_t>(failedReason.size());
|
||||
for (uint16_t character : failedReason) {
|
||||
bitStream.Write(uint16_t(character));
|
||||
bitStream.Write<uint16_t>(character);
|
||||
}
|
||||
|
||||
bitStream.Write(preconditionID);
|
||||
@@ -2016,7 +2028,7 @@ void GameMessages::SendLockNodeRotation(Entity* entity, std::string nodeName) {
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write(eGameMessageType::LOCK_NODE_ROTATION);
|
||||
|
||||
bitStream.Write(uint32_t(nodeName.size()));
|
||||
bitStream.Write<uint32_t>(nodeName.size());
|
||||
for (char character : nodeName) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -2051,7 +2063,7 @@ void GameMessages::SendGetModelsOnProperty(LWOOBJID objectId, std::map<LWOOBJID,
|
||||
bitStream.Write(objectId);
|
||||
bitStream.Write(eGameMessageType::GET_MODELS_ON_PROPERTY);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(models.size()));
|
||||
bitStream.Write<uint32_t>(models.size());
|
||||
|
||||
for (const auto& pair : models) {
|
||||
bitStream.Write(pair.first);
|
||||
@@ -2433,7 +2445,7 @@ void GameMessages::HandleBBBLoadItemRequest(RakNet::BitStream* inStream, Entity*
|
||||
void GameMessages::SendBlueprintLoadItemResponse(const SystemAddress& sysAddr, bool success, LWOOBJID oldItemId, LWOOBJID newItemId) {
|
||||
CBITSTREAM;
|
||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CLIENT, eClientMessageType::BLUEPRINT_LOAD_RESPONSE_ITEMID);
|
||||
bitStream.Write(static_cast<uint8_t>(success));
|
||||
bitStream.Write<uint8_t>(success);
|
||||
bitStream.Write<LWOOBJID>(oldItemId);
|
||||
bitStream.Write<LWOOBJID>(newItemId);
|
||||
SEND_PACKET;
|
||||
@@ -3058,7 +3070,7 @@ void GameMessages::SendNotifyObject(LWOOBJID objectId, LWOOBJID objIDSender, std
|
||||
bitStream.Write(eGameMessageType::NOTIFY_OBJECT);
|
||||
|
||||
bitStream.Write(objIDSender);
|
||||
bitStream.Write(static_cast<uint32_t>(name.size()));
|
||||
bitStream.Write<uint32_t>(name.size());
|
||||
for (const auto character : name) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -3115,7 +3127,7 @@ void GameMessages::SendServerTradeInvite(LWOOBJID objectId, bool bNeedInvitePopU
|
||||
|
||||
bitStream.Write(bNeedInvitePopUp);
|
||||
bitStream.Write(i64Requestor);
|
||||
bitStream.Write(static_cast<uint32_t>(wsName.size()));
|
||||
bitStream.Write<uint32_t>(wsName.size());
|
||||
for (const auto character : wsName) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -3133,7 +3145,7 @@ void GameMessages::SendServerTradeInitialReply(LWOOBJID objectId, LWOOBJID i64In
|
||||
|
||||
bitStream.Write(i64Invitee);
|
||||
bitStream.Write(resultType);
|
||||
bitStream.Write(static_cast<uint32_t>(wsName.size()));
|
||||
bitStream.Write<uint32_t>(wsName.size());
|
||||
for (const auto character : wsName) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -3151,7 +3163,7 @@ void GameMessages::SendServerTradeFinalReply(LWOOBJID objectId, bool bResult, LW
|
||||
|
||||
bitStream.Write(bResult);
|
||||
bitStream.Write(i64Invitee);
|
||||
bitStream.Write(static_cast<uint32_t>(wsName.size()));
|
||||
bitStream.Write<uint32_t>(wsName.size());
|
||||
for (const auto character : wsName) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -3193,7 +3205,7 @@ void GameMessages::SendServerTradeUpdate(LWOOBJID objectId, uint64_t coins, cons
|
||||
|
||||
bitStream.Write(false);
|
||||
bitStream.Write(coins);
|
||||
bitStream.Write(static_cast<uint32_t>(items.size()));
|
||||
bitStream.Write<uint32_t>(items.size());
|
||||
|
||||
for (const auto& item : items) {
|
||||
bitStream.Write(item.itemId);
|
||||
@@ -3402,7 +3414,7 @@ void GameMessages::SendNotifyPetTamingPuzzleSelected(LWOOBJID objectId, const st
|
||||
bitStream.Write(objectId);
|
||||
bitStream.Write(eGameMessageType::NOTIFY_TAMING_PUZZLE_SELECTED);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(bricks.size()));
|
||||
bitStream.Write<uint32_t>(bricks.size());
|
||||
for (const auto& brick : bricks) {
|
||||
bitStream.Write(brick.designerID);
|
||||
bitStream.Write(brick.materialID);
|
||||
@@ -3451,7 +3463,7 @@ void GameMessages::SendAddPetToPlayer(LWOOBJID objectId, int32_t iElementalType,
|
||||
bitStream.Write(eGameMessageType::ADD_PET_TO_PLAYER);
|
||||
|
||||
bitStream.Write(iElementalType);
|
||||
bitStream.Write(static_cast<uint32_t>(name.size()));
|
||||
bitStream.Write<uint32_t>(name.size());
|
||||
for (const auto character : name) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -3585,7 +3597,7 @@ void GameMessages::SendSetPetName(LWOOBJID objectId, std::u16string name, LWOOBJ
|
||||
bitStream.Write(objectId);
|
||||
bitStream.Write(eGameMessageType::SET_PET_NAME);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(name.size()));
|
||||
bitStream.Write<uint32_t>(name.size());
|
||||
for (const auto character : name) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -3624,12 +3636,12 @@ void GameMessages::SendPetNameChanged(LWOOBJID objectId, int32_t moderationStatu
|
||||
|
||||
bitStream.Write(moderationStatus);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(name.size()));
|
||||
bitStream.Write<uint32_t>(name.size());
|
||||
for (const auto character : name) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(ownerName.size()));
|
||||
bitStream.Write<uint32_t>(ownerName.size());
|
||||
for (const auto character : ownerName) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -3907,19 +3919,19 @@ void GameMessages::SendDisplayMessageBox(LWOOBJID objectId, bool bShow, LWOOBJID
|
||||
bitStream.Write(bShow);
|
||||
bitStream.Write(callbackClient);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(identifier.size()));
|
||||
bitStream.Write<uint32_t>(identifier.size());
|
||||
for (const auto character : identifier) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
|
||||
bitStream.Write(imageID);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(text.size()));
|
||||
bitStream.Write<uint32_t>(text.size());
|
||||
for (const auto character : text) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(userData.size()));
|
||||
bitStream.Write<uint32_t>(userData.size());
|
||||
for (const auto character : userData) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -3936,7 +3948,7 @@ void GameMessages::SendDisplayChatBubble(LWOOBJID objectId, const std::u16string
|
||||
bitStream.Write(objectId);
|
||||
bitStream.Write(eGameMessageType::DISPLAY_CHAT_BUBBLE);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(text.size()));
|
||||
bitStream.Write<uint32_t>(text.size());
|
||||
for (const auto character : text) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -4127,8 +4139,7 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
|
||||
}
|
||||
|
||||
racingControlComponent->OnRequestDie(entity);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
|
||||
if (!destroyableComponent) return;
|
||||
@@ -4245,7 +4256,7 @@ void GameMessages::SendModuleAssemblyDBDataForClient(LWOOBJID objectId, LWOOBJID
|
||||
|
||||
bitStream.Write(assemblyID);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(data.size()));
|
||||
bitStream.Write<uint32_t>(data.size());
|
||||
for (auto character : data) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -4390,7 +4401,7 @@ void GameMessages::SendNotifyRacingClient(LWOOBJID objectId, int32_t eventType,
|
||||
|
||||
bitStream.Write(paramObj);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(paramStr.size()));
|
||||
bitStream.Write<uint32_t>(paramStr.size());
|
||||
for (auto character : paramStr) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -4585,7 +4596,7 @@ void GameMessages::SendShowActivityCountdown(LWOOBJID objectId, bool bPlayAdditi
|
||||
|
||||
bitStream.Write(bPlayCountdownSound);
|
||||
|
||||
bitStream.Write(static_cast<uint32_t>(sndName.size()));
|
||||
bitStream.Write<uint32_t>(sndName.size());
|
||||
for (auto character : sndName) {
|
||||
bitStream.Write(character);
|
||||
}
|
||||
@@ -5601,7 +5612,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
if (entity->GetLOT() != 9980 || Game::server->GetZoneID() != 1200) {
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->Progress(eMissionTaskType::SCRIPT, entity->GetLOT(), entity->GetObjectID());
|
||||
if (count >= 7 && everyPieceSwapped) missionComponent->Progress(eMissionTaskType::RACING, LWOOBJID_EMPTY, (LWOOBJID)eRacingTaskParam::MODULAR_BUILDING);
|
||||
if (count >= 7 && everyPieceSwapped) missionComponent->Progress(eMissionTaskType::RACING, LWOOBJID_EMPTY, static_cast<LWOOBJID>(eRacingTaskParam::MODULAR_BUILDING));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,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);
|
||||
|
||||
@@ -423,25 +423,16 @@ void Item::DisassembleModel(uint32_t numToDismantle) {
|
||||
if (renderAssetSplit.empty()) return;
|
||||
|
||||
std::string lxfmlPath = "BrickModels" + lxfmlFolderName + "/" + GeneralUtils::SplitString(renderAssetSplit.back(), '.').at(0) + ".lxfml";
|
||||
auto buffer = Game::assetManager->GetFileAsBuffer(lxfmlPath.c_str());
|
||||
auto file = Game::assetManager->GetFile(lxfmlPath.c_str());
|
||||
|
||||
if (!buffer.m_Success) {
|
||||
if (!file) {
|
||||
LOG("Failed to load %s to disassemble model into bricks, check that this file exists", lxfmlPath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
std::istream file(&buffer);
|
||||
|
||||
if (!file.good()) {
|
||||
buffer.close();
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream data;
|
||||
data << file.rdbuf();
|
||||
|
||||
buffer.close();
|
||||
|
||||
uint32_t fileSize;
|
||||
file.seekg(0, std::ios::end);
|
||||
fileSize = static_cast<uint32_t>(file.tellg());
|
||||
|
||||
@@ -324,14 +324,9 @@ void ControlBehaviors::ProcessCommand(Entity* modelEntity, const SystemAddress&
|
||||
}
|
||||
|
||||
ControlBehaviors::ControlBehaviors() {
|
||||
auto blocksDefStreamBuffer = Game::assetManager->GetFileAsBuffer("ui\\ingame\\blocksdef.xml");
|
||||
if (!blocksDefStreamBuffer.m_Success) {
|
||||
LOG("failed to open blocksdef");
|
||||
return;
|
||||
}
|
||||
std::istream blocksBuffer(&blocksDefStreamBuffer);
|
||||
if (!blocksBuffer.good()) {
|
||||
LOG("Blocks buffer is not good!");
|
||||
auto blocksBuffer = Game::assetManager->GetFile("ui\\ingame\\blocksdef.xml");
|
||||
if (!blocksBuffer) {
|
||||
LOG("Failed to open blocksdef.xml");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -342,7 +337,7 @@ ControlBehaviors::ControlBehaviors() {
|
||||
std::string buffer{};
|
||||
bool commentBlockStart = false;
|
||||
while (std::getline(blocksBuffer, read)) {
|
||||
// tinyxml2 should handle comment blocks but the client has one that fails the processing.
|
||||
// tinyxml2 should handle comment blocks but the client has one that fails the processing.
|
||||
// This preprocessing just removes all comments from the read file out of an abundance of caution.
|
||||
if (read.find("<!--") != std::string::npos) {
|
||||
commentBlockStart = true;
|
||||
|
||||
@@ -17,26 +17,18 @@ const BrickList& BrickDatabase::GetBricks(const LxfmlPath& lxfmlPath) {
|
||||
return cached->second;
|
||||
}
|
||||
|
||||
AssetMemoryBuffer buffer = Game::assetManager->GetFileAsBuffer((lxfmlPath).c_str());
|
||||
auto file = Game::assetManager->GetFile((lxfmlPath).c_str());
|
||||
|
||||
if (!buffer.m_Success) {
|
||||
return emptyCache;
|
||||
}
|
||||
|
||||
std::istream file(&buffer);
|
||||
if (!file.good()) {
|
||||
if (!file) {
|
||||
return emptyCache;
|
||||
}
|
||||
|
||||
std::stringstream data;
|
||||
data << file.rdbuf();
|
||||
if (data.str().empty()) {
|
||||
buffer.close();
|
||||
return emptyCache;
|
||||
}
|
||||
|
||||
buffer.close();
|
||||
|
||||
auto* doc = new tinyxml2::XMLDocument();
|
||||
if (doc->Parse(data.str().c_str(), data.str().size()) != 0) {
|
||||
delete doc;
|
||||
|
||||
@@ -289,11 +289,11 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
return;
|
||||
}
|
||||
|
||||
if (chatCommand == "leave-zone") {
|
||||
if (chatCommand == "leave-zone" || chatCommand == "leavezone") {
|
||||
const auto currentZone = Game::zoneManager->GetZone()->GetZoneID().GetMapID();
|
||||
|
||||
LWOMAPID newZone = 0;
|
||||
if (currentZone % 100 == 0) {
|
||||
|
||||
if (currentZone == 1001 || currentZone % 100 == 0) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"You are not in an instanced zone.");
|
||||
return;
|
||||
} else {
|
||||
@@ -348,6 +348,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<MissionComponent>();
|
||||
if (!missionComponent) return;
|
||||
missionComponent->ResetMission(missionId);
|
||||
}
|
||||
|
||||
if (user->GetMaxGMLevel() == eGameMasterLevel::CIVILIAN || entity->GetGMLevel() >= eGameMasterLevel::CIVILIAN) {
|
||||
if (chatCommand == "die") {
|
||||
entity->Smash(entity->GetObjectID());
|
||||
@@ -609,15 +620,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
if (args[0].find("/") != std::string::npos) return;
|
||||
if (args[0].find("\\") != std::string::npos) return;
|
||||
|
||||
auto buf = Game::assetManager->GetFileAsBuffer(("macros/" + args[0] + ".scm").c_str());
|
||||
auto infile = Game::assetManager->GetFile(("macros/" + args[0] + ".scm").c_str());
|
||||
|
||||
if (!buf.m_Success) {
|
||||
if (!infile) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Unknown macro! Is the filename right?");
|
||||
return;
|
||||
}
|
||||
|
||||
std::istream infile(&buf);
|
||||
|
||||
if (infile.good()) {
|
||||
std::string line;
|
||||
while (std::getline(infile, line)) {
|
||||
@@ -627,8 +636,6 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Unknown macro! Is the filename right?");
|
||||
}
|
||||
|
||||
buf.close();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user