From e244fbccc2ac2ffe8ad077bab02bf369bb9d9ed6 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Tue, 29 Mar 2022 23:49:04 -0700 Subject: [PATCH] General updates to the property manager clone id is correctly assigned, reputation now shows up, rejection verdict is sent correctly (not sure about where the reason goes if it even goes here). --- .../PropertyManagementComponent.cpp | 13 ++++++++-- .../dComponents/PropertyManagementComponent.h | 25 +++++++++++++++++++ dGame/dGameMessages/PropertyDataMessage.cpp | 18 +++++++++---- dGame/dGameMessages/PropertyDataMessage.h | 5 ++++ 4 files changed, 54 insertions(+), 7 deletions(-) diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index cd99fd78..a433aa56 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -68,10 +68,15 @@ PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Compo this->owner = propertyEntry->getUInt64(2); this->owner = GeneralUtils::SetBit(this->owner, OBJECT_BIT_CHARACTER); this->owner = GeneralUtils::SetBit(this->owner, OBJECT_BIT_PERSISTENT); + this->clone_Id = propertyEntry->getInt(2); this->propertyName = propertyEntry->getString(5).c_str(); this->propertyDescription = propertyEntry->getString(6).c_str(); this->privacyOption = static_cast(propertyEntry->getUInt(9)); + this->moderatorRequested = propertyEntry->getInt(10) == 0 && rejectionReason == "" && privacyOption == PropertyPrivacyOption::Public; + this->LastUpdatedTime = propertyEntry->getUInt64(11); this->claimedTime = propertyEntry->getUInt64(12); + this->rejectionReason = propertyEntry->getString(13); + this->reputation = propertyEntry->getUInt(14); Load(); } @@ -822,17 +827,21 @@ void PropertyManagementComponent::OnQueryPropertyData(Entity* originator, const claimed = claimedTime; privacy = static_cast(this->privacyOption); } - + message.moderatorRequested = moderatorRequested; + message.reputation = reputation; + message.LastUpdatedTime = LastUpdatedTime; message.OwnerId = ownerId; message.OwnerName = ownerName; message.Name = name; message.Description = description; message.ClaimedTime = claimed; message.PrivacyOption = privacy; - + message.cloneId = clone_Id; + message.rejectionReason = rejectionReason; message.Paths = GetPaths(); SendDownloadPropertyData(author, message, UNASSIGNED_SYSTEM_ADDRESS); + // send rejction here? } void PropertyManagementComponent::OnUse(Entity* originator) diff --git a/dGame/dComponents/PropertyManagementComponent.h b/dGame/dComponents/PropertyManagementComponent.h index bf577760..6aee8ed3 100644 --- a/dGame/dComponents/PropertyManagementComponent.h +++ b/dGame/dComponents/PropertyManagementComponent.h @@ -194,11 +194,36 @@ private: */ std::string propertyName = ""; + /** + * The clone ID of this property + */ + LWOCLONEID clone_Id = 0; + + /** + * Whether a moderator was requested + */ + bool moderatorRequested = false; + + /** + * The rejection reason for the property + */ + std::string rejectionReason = ""; + /** * The description of this property */ std::string propertyDescription = ""; + /** + * The reputation of this property + */ + uint32_t reputation = 0; + + /** + * The last time this property was updated + */ + uint32_t LastUpdatedTime = 0; + /** * Determines which players may visit this property */ diff --git a/dGame/dGameMessages/PropertyDataMessage.cpp b/dGame/dGameMessages/PropertyDataMessage.cpp index 9c3b6d3f..cbe3e67b 100644 --- a/dGame/dGameMessages/PropertyDataMessage.cpp +++ b/dGame/dGameMessages/PropertyDataMessage.cpp @@ -13,7 +13,7 @@ void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) con stream.Write(TemplateID); // - template id stream.Write(ZoneId); // - map id stream.Write(VendorMapId); // - vendor map id - stream.Write(1); + stream.Write(cloneId); // clone id const auto& name = GeneralUtils::ASCIIToUTF16(Name); stream.Write(uint32_t(name.size())); @@ -40,11 +40,12 @@ void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) con stream.Write(0); // - minimum price stream.Write(1); // - rent duration - stream.Write(ClaimedTime); // - timestamp + stream.Write(LastUpdatedTime); // - timestamp stream.Write(1); - stream.Write(0); + stream.Write(reputation); // Reputation + stream.Write(0); const auto& spawn = GeneralUtils::ASCIIToUTF16(SpawnName); stream.Write(uint32_t(spawn.size())); @@ -63,9 +64,16 @@ void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) con stream.Write(0); - stream.Write(1); + if (rejectionReason != "") stream.Write(2); + else if (moderatorRequested == true && rejectionReason == "") stream.Write(0); + else stream.Write(1); - stream.Write(0); // String length + const auto& rejectionReasonConverted = GeneralUtils::ASCIIToUTF16(rejectionReason); + stream.Write(uint32_t(rejectionReasonConverted.size())); + for (uint32_t i = 0; i < rejectionReasonConverted.size(); ++i) { + stream.Write(uint16_t(rejectionReasonConverted[i])); + std::cout << rejectionReason[i] << std::endl; + } stream.Write(0); diff --git a/dGame/dGameMessages/PropertyDataMessage.h b/dGame/dGameMessages/PropertyDataMessage.h index 219ac08d..a85702c4 100644 --- a/dGame/dGameMessages/PropertyDataMessage.h +++ b/dGame/dGameMessages/PropertyDataMessage.h @@ -28,8 +28,13 @@ namespace GameMessages std::string Name = ""; std::string Description = ""; + std::string rejectionReason = ""; + bool moderatorRequested = 0; + LWOCLONEID cloneId = 0; + uint32_t reputation = 0; uint64_t ClaimedTime = 0; + uint64_t LastUpdatedTime = 0; NiPoint3 ZonePosition = { 548.0f, 406.0f, 178.0f }; char PrivacyOption = 0;