#include "PropertyDataMessage.h" #include "GeneralUtils.h" #include "Game.h" #include "Logger.h" #include "CDClientManager.h" #include "CDPropertyTemplateTable.h" void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) const { stream.Write(0); // - property id stream.Write(TemplateID); // - template id stream.Write(ZoneId); // - map id stream.Write(VendorMapId); // - vendor map id stream.Write(cloneId); // clone id const auto& name = GeneralUtils::UTF8ToUTF16(Name); stream.Write(uint32_t(name.size())); for (uint32_t i = 0; i < name.size(); ++i) { stream.Write(uint16_t(name[i])); } const auto& description = GeneralUtils::UTF8ToUTF16(Description); stream.Write(uint32_t(description.size())); for (uint32_t i = 0; i < description.size(); ++i) { stream.Write(uint16_t(description[i])); } const auto& owner = GeneralUtils::UTF8ToUTF16(OwnerName); stream.Write(uint32_t(owner.size())); for (uint32_t i = 0; i < owner.size(); ++i) { stream.Write(uint16_t(owner[i])); } stream.Write(OwnerId); stream.Write(0); // - type stream.Write(0); // - zone code stream.Write(0); // - minimum price stream.Write(1); // - rent duration stream.Write(LastUpdatedTime); // - timestamp stream.Write(1); stream.Write(reputation); // Reputation stream.Write(0); const auto& spawn = GeneralUtils::ASCIIToUTF16(SpawnName); stream.Write(uint32_t(spawn.size())); for (uint32_t i = 0; i < spawn.size(); ++i) { stream.Write(uint16_t(spawn[i])); } stream.Write(0); // String length stream.Write(0); // String length stream.Write(0); // - duration type stream.Write(1); stream.Write(1); stream.Write(PrivacyOption); stream.Write(0); if (rejectionReason != "") stream.Write(REJECTION_STATUS_REJECTED); else if (moderatorRequested == true && rejectionReason == "") stream.Write(REJECTION_STATUS_APPROVED); else stream.Write(REJECTION_STATUS_PENDING); // Does this go here??? // const auto& rejectionReasonConverted = GeneralUtils::UTF8ToUTF16(rejectionReason); // stream.Write(uint32_t(rejectionReasonConverted.size())); // for (uint32_t i = 0; i < rejectionReasonConverted.size(); ++i) { // stream.Write(uint16_t(rejectionReasonConverted[i])); // } stream.Write(0); stream.Write(0); stream.Write(1); stream.Write(1); stream.Write(ZonePosition.x); stream.Write(ZonePosition.y); stream.Write(ZonePosition.z); stream.Write(MaxBuildHeight); stream.Write(ClaimedTime); // - timestamp stream.Write(PrivacyOption); stream.Write(uint32_t(Paths.size())); for (const auto& path : Paths) { stream.Write(path.x); stream.Write(path.y); stream.Write(path.z); } } GameMessages::PropertyDataMessage::PropertyDataMessage(uint32_t mapID) { const auto propertyTemplate = CDClientManager::Instance().GetTable()->GetByMapID(mapID); TemplateID = propertyTemplate.id; ZoneId = propertyTemplate.mapID; VendorMapId = propertyTemplate.vendorMapID; SpawnName = propertyTemplate.spawnName; }