mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-20 10:45:27 +00:00
refactor(component): an object's starting inventory loads in LoadDataFromTemplate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -108,9 +108,14 @@ InventoryComponent::InventoryComponent(Entity* parent, const int32_t componentID
|
|||||||
if (character) LoadXml(character->GetXMLDoc());
|
if (character) LoadXml(character->GetXMLDoc());
|
||||||
|
|
||||||
CheckProxyIntegrity();
|
CheckProxyIntegrity();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// An object's starting inventory from the InventoryComponent rows, with the equipped items (a character's comes from
|
||||||
|
// its save instead)
|
||||||
|
void InventoryComponent::LoadDataFromTemplate() {
|
||||||
|
const auto lot = m_Parent->GetLOT();
|
||||||
|
if (lot == 1) return;
|
||||||
|
|
||||||
auto* compRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
|
auto* compRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
|
||||||
const auto componentId = compRegistryTable->GetByIDAndType(lot, eReplicaComponentType::INVENTORY);
|
const auto componentId = compRegistryTable->GetByIDAndType(lot, eReplicaComponentType::INVENTORY);
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ public:
|
|||||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY;
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY;
|
||||||
InventoryComponent(Entity* parent, const int32_t componentID);
|
InventoryComponent(Entity* parent, const int32_t componentID);
|
||||||
|
|
||||||
|
void LoadDataFromTemplate() override;
|
||||||
|
|
||||||
void Run(float deltaTime) override;
|
void Run(float deltaTime) override;
|
||||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||||
void LoadXml(const tinyxml2::XMLDocument& document);
|
void LoadXml(const tinyxml2::XMLDocument& document);
|
||||||
|
|||||||
Reference in New Issue
Block a user