refactor(component): vendors load their stock in LoadDataFromTemplate

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 08:08:11 -05:00
parent 8ef3e323fe
commit 818ad152ca
4 changed files with 14 additions and 1 deletions

View File

@@ -10,6 +10,11 @@
#include "CDMissionsTable.h"
AchievementVendorComponent::AchievementVendorComponent(Entity* parent, const int32_t componentID) : VendorComponent(parent, componentID) {
}
// The base vendor's template load, then the achievement vendor's stock
void AchievementVendorComponent::LoadDataFromTemplate() {
VendorComponent::LoadDataFromTemplate();
RefreshInventory(true);
};

View File

@@ -12,6 +12,8 @@ class AchievementVendorComponent final : public VendorComponent {
public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::ACHIEVEMENT_VENDOR;
AchievementVendorComponent(Entity* parent, const int32_t componentID);
void LoadDataFromTemplate() override;
void RefreshInventory(bool isCreation = false) override;
bool SellsItem(Entity* buyer, const LOT lot);

View File

@@ -25,8 +25,12 @@ VendorComponent::VendorComponent(Entity* parent, const int32_t componentID) : Co
RegisterMsg(&VendorComponent::OnRequestUse);
m_HasStandardCostItems = false;
m_HasMultiCostItems = false;
}
// The vendor's constants and its stock (the base's refresh: a derived vendor adds its own after)
void VendorComponent::LoadDataFromTemplate() {
SetupConstants();
RefreshInventory(true);
VendorComponent::RefreshInventory(true);
}
void VendorComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) {

View File

@@ -27,6 +27,8 @@ public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::VENDOR;
VendorComponent(Entity* parent, const int32_t componentID);
void LoadDataFromTemplate() override;
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
bool OnRequestUse(GameMessages::RequestUseEvent& event);