2023-02-11 03:33:30 +00:00
|
|
|
#include "ItemComponent.h"
|
|
|
|
#include "Entity.h"
|
|
|
|
#include "eUgcModerationStatus.h"
|
|
|
|
|
|
|
|
ItemComponent::ItemComponent(Entity* parent) : Component(parent) {
|
2023-06-26 04:47:35 +00:00
|
|
|
m_ParentEntity = parent;
|
2023-02-11 03:33:30 +00:00
|
|
|
|
|
|
|
m_DirtyItemInfo = false;
|
|
|
|
|
2023-06-26 04:47:35 +00:00
|
|
|
m_UgId = m_ParentEntity->GetVarAs<LWOOBJID>(u"userModelID");
|
|
|
|
if (m_UgId == LWOOBJID_EMPTY) m_UgId = m_ParentEntity->GetObjectID();
|
2023-02-11 03:33:30 +00:00
|
|
|
|
|
|
|
m_UgModerationStatus = eUgcModerationStatus::NoStatus;
|
|
|
|
|
|
|
|
m_UgDescription = u"";
|
|
|
|
}
|
|
|
|
|
|
|
|
void ItemComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
|
|
|
|
|
|
|
outBitStream->Write(m_DirtyItemInfo || bIsInitialUpdate);
|
2023-07-05 05:17:44 +00:00
|
|
|
if (m_DirtyItemInfo || bIsInitialUpdate) {
|
2023-02-11 03:33:30 +00:00
|
|
|
outBitStream->Write(m_UgId);
|
|
|
|
outBitStream->Write(m_UgModerationStatus);
|
2023-07-05 05:17:44 +00:00
|
|
|
outBitStream->Write(!m_UgDescription.empty());
|
|
|
|
if (!m_UgDescription.empty()){
|
2023-02-11 03:33:30 +00:00
|
|
|
outBitStream->Write<uint32_t>(m_UgDescription.length());
|
2023-07-05 05:17:44 +00:00
|
|
|
outBitStream->Write(reinterpret_cast<const char*>(m_UgDescription.c_str()), m_UgDescription.length() * sizeof(uint16_t));
|
2023-02-11 03:33:30 +00:00
|
|
|
}
|
|
|
|
m_DirtyItemInfo = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|