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).
This commit is contained in:
EmosewaMC 2022-03-29 23:49:04 -07:00
parent 36edbf393b
commit e244fbccc2
4 changed files with 54 additions and 7 deletions

View File

@ -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<PropertyPrivacyOption>(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<char>(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)

View File

@ -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
*/

View File

@ -13,7 +13,7 @@ void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) con
stream.Write<int32_t>(TemplateID); // - template id
stream.Write<uint16_t>(ZoneId); // - map id
stream.Write<uint16_t>(VendorMapId); // - vendor map id
stream.Write<uint32_t>(1);
stream.Write<uint32_t>(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<uint32_t>(0); // - minimum price
stream.Write<uint32_t>(1); // - rent duration
stream.Write(ClaimedTime); // - timestamp
stream.Write<uint64_t>(LastUpdatedTime); // - timestamp
stream.Write<uint32_t>(1);
stream.Write<uint64_t>(0);
stream.Write<uint32_t>(reputation); // Reputation
stream.Write<uint32_t>(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<uint64_t>(0);
stream.Write<uint32_t>(1);
if (rejectionReason != "") stream.Write<uint32_t>(2);
else if (moderatorRequested == true && rejectionReason == "") stream.Write<uint32_t>(0);
else stream.Write<uint32_t>(1);
stream.Write<uint32_t>(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<uint64_t>(0);

View File

@ -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;