2021-12-05 17:54:36 +00:00
|
|
|
#include "PropertyDataMessage.h"
|
|
|
|
|
|
|
|
#include "GeneralUtils.h"
|
|
|
|
|
|
|
|
#include "Game.h"
|
2023-10-21 23:31:55 +00:00
|
|
|
#include "Logger.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "CDClientManager.h"
|
|
|
|
|
2023-03-17 14:36:21 +00:00
|
|
|
#include "CDPropertyTemplateTable.h"
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) const {
|
|
|
|
stream.Write<int64_t>(0); // - property id
|
|
|
|
|
|
|
|
stream.Write<int32_t>(TemplateID); // - template id
|
|
|
|
stream.Write<uint16_t>(ZoneId); // - map id
|
|
|
|
stream.Write<uint16_t>(VendorMapId); // - vendor map id
|
2022-03-30 06:49:04 +00:00
|
|
|
stream.Write<uint32_t>(cloneId); // clone id
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-08-02 13:56:20 +00:00
|
|
|
const auto& name = GeneralUtils::UTF8ToUTF16(Name);
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint32_t>(name.size());
|
2021-12-05 17:54:36 +00:00
|
|
|
for (uint32_t i = 0; i < name.size(); ++i) {
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint16_t>(name[i]);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-08-02 13:56:20 +00:00
|
|
|
const auto& description = GeneralUtils::UTF8ToUTF16(Description);
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint32_t>(description.size());
|
2021-12-05 17:54:36 +00:00
|
|
|
for (uint32_t i = 0; i < description.size(); ++i) {
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint16_t>(description[i]);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-08-02 13:56:20 +00:00
|
|
|
const auto& owner = GeneralUtils::UTF8ToUTF16(OwnerName);
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint32_t>(owner.size());
|
2021-12-05 17:54:36 +00:00
|
|
|
for (uint32_t i = 0; i < owner.size(); ++i) {
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint16_t>(owner[i]);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stream.Write<LWOOBJID>(OwnerId);
|
|
|
|
|
|
|
|
stream.Write<uint32_t>(0); // - type
|
|
|
|
stream.Write<uint32_t>(0); // - zone code
|
|
|
|
stream.Write<uint32_t>(0); // - minimum price
|
|
|
|
stream.Write<uint32_t>(1); // - rent duration
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2022-03-30 06:49:04 +00:00
|
|
|
stream.Write<uint64_t>(LastUpdatedTime); // - timestamp
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
stream.Write<uint32_t>(1);
|
|
|
|
|
2022-03-30 06:49:04 +00:00
|
|
|
stream.Write<uint32_t>(reputation); // Reputation
|
|
|
|
stream.Write<uint32_t>(0);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
const auto& spawn = GeneralUtils::ASCIIToUTF16(SpawnName);
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint32_t>(spawn.size());
|
2021-12-05 17:54:36 +00:00
|
|
|
for (uint32_t i = 0; i < spawn.size(); ++i) {
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint16_t>(spawn[i]);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
stream.Write<uint32_t>(0); // String length
|
|
|
|
stream.Write<uint32_t>(0); // String length
|
|
|
|
|
|
|
|
stream.Write<uint32_t>(0); // - duration type
|
|
|
|
stream.Write<uint32_t>(1);
|
|
|
|
stream.Write<uint32_t>(1);
|
|
|
|
|
|
|
|
stream.Write<char>(PrivacyOption);
|
|
|
|
|
|
|
|
stream.Write<uint64_t>(0);
|
|
|
|
|
2022-03-30 23:14:24 +00:00
|
|
|
if (rejectionReason != "") stream.Write<uint32_t>(REJECTION_STATUS_REJECTED);
|
2022-03-31 03:31:51 +00:00
|
|
|
else if (moderatorRequested == true && rejectionReason == "") stream.Write<uint32_t>(REJECTION_STATUS_APPROVED);
|
|
|
|
else stream.Write<uint32_t>(REJECTION_STATUS_PENDING);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-03-30 07:02:18 +00:00
|
|
|
// Does this go here???
|
2022-08-02 13:56:20 +00:00
|
|
|
// const auto& rejectionReasonConverted = GeneralUtils::UTF8ToUTF16(rejectionReason);
|
2023-12-28 04:18:20 +00:00
|
|
|
// stream.Write<uint32_t>(rejectionReasonConverted.size());
|
2022-03-31 03:32:59 +00:00
|
|
|
// for (uint32_t i = 0; i < rejectionReasonConverted.size(); ++i) {
|
2023-12-28 04:18:20 +00:00
|
|
|
// stream.Write<uint16_t>(rejectionReasonConverted[i]);
|
2022-03-31 03:32:59 +00:00
|
|
|
// }
|
2022-03-30 23:14:24 +00:00
|
|
|
|
2022-03-31 03:32:59 +00:00
|
|
|
stream.Write<uint32_t>(0);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
stream.Write<uint64_t>(0);
|
|
|
|
|
|
|
|
stream.Write<uint32_t>(1);
|
|
|
|
stream.Write<uint32_t>(1);
|
|
|
|
|
|
|
|
stream.Write<float>(ZonePosition.x);
|
|
|
|
stream.Write<float>(ZonePosition.y);
|
|
|
|
stream.Write<float>(ZonePosition.z);
|
|
|
|
|
|
|
|
stream.Write<float>(MaxBuildHeight);
|
|
|
|
|
|
|
|
stream.Write(ClaimedTime); // - timestamp
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
stream.Write<char>(PrivacyOption);
|
|
|
|
|
2023-12-28 04:18:20 +00:00
|
|
|
stream.Write<uint32_t>(Paths.size());
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
for (const auto& path : Paths) {
|
|
|
|
stream.Write(path.x);
|
|
|
|
stream.Write(path.y);
|
|
|
|
stream.Write(path.z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GameMessages::PropertyDataMessage::PropertyDataMessage(uint32_t mapID) {
|
2023-03-17 14:36:21 +00:00
|
|
|
const auto propertyTemplate = CDClientManager::Instance().GetTable<CDPropertyTemplateTable>()->GetByMapID(mapID);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
TemplateID = propertyTemplate.id;
|
|
|
|
ZoneId = propertyTemplate.mapID;
|
|
|
|
VendorMapId = propertyTemplate.vendorMapID;
|
|
|
|
SpawnName = propertyTemplate.spawnName;
|
|
|
|
}
|