mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-19 05:48:09 +00:00
Start of property entrance component rewrite
This is very WIP
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
set(DGAME_DGAMEMESSAGES_SOURCES "GameMessageHandler.cpp"
|
||||
"GameMessages.cpp"
|
||||
"PropertyDataMessage.cpp"
|
||||
"PropertySelectQueryProperty.cpp" PARENT_SCOPE)
|
||||
"PropertyDataMessage.cpp" PARENT_SCOPE)
|
||||
|
@@ -84,7 +84,7 @@
|
||||
#include "PropertyDataMessage.h"
|
||||
#include "PropertyManagementComponent.h"
|
||||
#include "PropertyVendorComponent.h"
|
||||
#include "PropertySelectQueryProperty.h"
|
||||
#include "PropertyData.h"
|
||||
#include "TradingManager.h"
|
||||
#include "ControlBehaviors.h"
|
||||
#include "AMFDeserialize.h"
|
||||
@@ -3084,7 +3084,7 @@ void GameMessages::SendPropertyEntranceBegin(LWOOBJID objectId, const SystemAddr
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendPropertySelectQuery(LWOOBJID objectId, int32_t navOffset, bool thereAreMore, int32_t cloneId, bool hasFeaturedProperty, bool wasFriends, const std::vector<PropertySelectQueryProperty>& entries, const SystemAddress& sysAddr) {
|
||||
void GameMessages::SendPropertySelectQuery(LWOOBJID objectId, int32_t navOffset, bool thereAreMore, int32_t cloneId, bool hasFeaturedProperty, bool wasFriends, const std::vector<PropertyData>& entries, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
@@ -3099,10 +3099,41 @@ void GameMessages::SendPropertySelectQuery(LWOOBJID objectId, int32_t navOffset,
|
||||
|
||||
bitStream.Write<uint32_t>(entries.size());
|
||||
|
||||
for (auto& entry : entries) {
|
||||
entry.Serialize(bitStream);
|
||||
}
|
||||
for (const auto& item : entries) {
|
||||
bitStream.Write(item.CloneID);
|
||||
|
||||
const auto& owner = GeneralUtils::UTF8ToUTF16(item.PrimaryData.OwnerName);
|
||||
bitStream.Write(uint32_t(owner.size()));
|
||||
for (uint32_t i = 0; i < owner.size(); ++i) {
|
||||
bitStream.Write(static_cast<uint16_t>(owner[i]));
|
||||
}
|
||||
|
||||
const auto& name = GeneralUtils::UTF8ToUTF16(item.PrimaryData.Name);
|
||||
bitStream.Write(uint32_t(name.size()));
|
||||
for (uint32_t i = 0; i < name.size(); ++i) {
|
||||
bitStream.Write(static_cast<uint16_t>(name[i]));
|
||||
}
|
||||
|
||||
const auto& description = GeneralUtils::UTF8ToUTF16(item.PrimaryData.Description);
|
||||
bitStream.Write(uint32_t(description.size()));
|
||||
for (uint32_t i = 0; i < description.size(); ++i) {
|
||||
bitStream.Write(static_cast<uint16_t>(description[i]));
|
||||
}
|
||||
|
||||
bitStream.Write(item.PrimaryData.Reputation);
|
||||
|
||||
bitStream.Write(item.PersonalData.IsBestFriend);
|
||||
bitStream.Write(item.PersonalData.IsFriend);
|
||||
bitStream.Write(item.PersonalData.IsModeratorApproved);
|
||||
bitStream.Write(item.PersonalData.IsAlt);
|
||||
bitStream.Write(item.PersonalData.IsOwned);
|
||||
|
||||
bitStream.Write(item.MetaData.AccessType);
|
||||
bitStream.Write(item.MetaData.DateLastPublished);
|
||||
bitStream.Write(item.MetaData.PerformanceIndex);
|
||||
bitStream.Write(item.MetaData.PerformanceCost);
|
||||
}
|
||||
|
||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ class Item;
|
||||
class NiQuaternion;
|
||||
class User;
|
||||
class Leaderboard;
|
||||
class PropertySelectQueryProperty;
|
||||
class PropertyData;
|
||||
class TradeItem;
|
||||
|
||||
enum class eAnimationFlags : uint32_t;
|
||||
@@ -335,7 +335,7 @@ namespace GameMessages {
|
||||
|
||||
void SendPropertyEntranceBegin(LWOOBJID objectId, const SystemAddress& sysAddr);
|
||||
|
||||
void SendPropertySelectQuery(LWOOBJID objectId, int32_t navOffset, bool thereAreMore, int32_t cloneId, bool hasFeaturedProperty, bool wasFriends, const std::vector<PropertySelectQueryProperty>& entries, const SystemAddress& sysAddr);
|
||||
void SendPropertySelectQuery(LWOOBJID objectId, int32_t navOffset, bool thereAreMore, int32_t cloneId, bool hasFeaturedProperty, bool wasFriends, const std::vector<PropertyData>& entries, const SystemAddress& sysAddr);
|
||||
|
||||
void SendNotifyObject(LWOOBJID objectId, LWOOBJID objIDSender, std::u16string name, const SystemAddress& sysAddr, int param1 = 0, int param2 = 0);
|
||||
|
||||
|
39
dGame/dGameMessages/PropertyData.h
Normal file
39
dGame/dGameMessages/PropertyData.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "Entity.h"
|
||||
|
||||
|
||||
struct PropertyPersonalData final {
|
||||
bool IsBestFriend;
|
||||
bool IsFriend;
|
||||
bool IsModeratorApproved;
|
||||
bool IsAlt;
|
||||
bool IsOwned;
|
||||
};
|
||||
|
||||
struct PropertyMetaData final {
|
||||
uint32_t AccessType;
|
||||
uint32_t DateLastPublished;
|
||||
float PerformanceCost;
|
||||
uint32_t PerformanceIndex;
|
||||
};
|
||||
|
||||
struct PropertyPrimaryData final {
|
||||
// The below two objects are not serialized with this struct however are used to gather the relative/Personal data of the property.
|
||||
LWOOBJID OwnerID;
|
||||
bool IsModeratorApproved;
|
||||
|
||||
std::string OwnerName;
|
||||
std::string Name;
|
||||
std::string Description;
|
||||
float Reputation;
|
||||
};
|
||||
|
||||
struct PropertyData {
|
||||
LWOCLONEID CloneID;
|
||||
|
||||
PropertyPrimaryData PrimaryData;
|
||||
PropertyPersonalData PersonalData;
|
||||
PropertyMetaData MetaData;
|
||||
};
|
||||
|
@@ -1,38 +0,0 @@
|
||||
#include "PropertySelectQueryProperty.h"
|
||||
|
||||
void PropertySelectQueryProperty::Serialize(RakNet::BitStream& stream) const {
|
||||
stream.Write(CloneId);
|
||||
|
||||
const auto& owner = GeneralUtils::UTF8ToUTF16(OwnerName);
|
||||
stream.Write(uint32_t(owner.size()));
|
||||
for (uint32_t i = 0; i < owner.size(); ++i) {
|
||||
stream.Write(static_cast<uint16_t>(owner[i]));
|
||||
}
|
||||
|
||||
const auto& name = GeneralUtils::UTF8ToUTF16(Name);
|
||||
stream.Write(uint32_t(name.size()));
|
||||
for (uint32_t i = 0; i < name.size(); ++i) {
|
||||
stream.Write(static_cast<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(static_cast<uint16_t>(description[i]));
|
||||
}
|
||||
|
||||
stream.Write(Reputation);
|
||||
stream.Write(IsBestFriend);
|
||||
stream.Write(IsFriend);
|
||||
stream.Write(IsModeratorApproved);
|
||||
stream.Write(IsAlt);
|
||||
stream.Write(IsOwned);
|
||||
stream.Write(AccessType);
|
||||
stream.Write(DateLastPublished);
|
||||
stream.Write(PerformanceIndex);
|
||||
stream.Write(PerformanceCost);
|
||||
}
|
||||
|
||||
void PropertySelectQueryProperty::Deserialize(RakNet::BitStream& stream) const {
|
||||
// Do we need this?
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef PROPERTYSELECTQUERY_H
|
||||
#define PROPERTYSELECTQUERY_H
|
||||
|
||||
#include "Entity.h"
|
||||
|
||||
class PropertySelectQueryProperty final
|
||||
{
|
||||
public:
|
||||
void Serialize(RakNet::BitStream& stream) const;
|
||||
|
||||
void Deserialize(RakNet::BitStream& stream) const;
|
||||
|
||||
LWOCLONEID CloneId = LWOCLONEID_INVALID; // The cloneID of the property
|
||||
std::string OwnerName = ""; // The property owners name
|
||||
std::string Name = ""; // The property name
|
||||
std::string Description = ""; // The property description
|
||||
float Reputation = 0; // The reputation of the property
|
||||
bool IsBestFriend = false; // Whether or not the property belongs to a best friend
|
||||
bool IsFriend = false; // Whether or not the property belongs to a friend
|
||||
bool IsModeratorApproved = false; // Whether or not a moderator has approved this property
|
||||
bool IsAlt = false; // Whether or not the property is owned by an alt of the account owner
|
||||
bool IsOwned = false; // Whether or not the property is owned
|
||||
uint32_t AccessType = 0; // The privacy option of the property
|
||||
uint32_t DateLastPublished = 0; // The last day the property was published
|
||||
float PerformanceCost = 0; // The performance cost of the property
|
||||
uint32_t PerformanceIndex = 0; // The performance index of the property? Always 0?
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user