mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-17 17:25:27 +00:00
refactor(component): vendors load their stock in LoadDataFromTemplate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user