mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 18:54:13 +00:00
Updated vendor component
Fixed a few issues in VendorComponent. - Corrected serialization to only happen on construction. - Added functionality to refresh the vendor based on info from the vendor component table - some whitespaceing inconsistencies. - Sorted includes. Tested the vendor in Nimbus Station and when the player re-enters the world, the vendor inventory refreshes, as opposed to previously where the world would need to reset in order to refresh the inventory.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
#ifndef VENDORCOMPONENT_H
|
||||
#define VENDORCOMPONENT_H
|
||||
|
||||
#include "RakNetTypes.h"
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "CDClientManager.h"
|
||||
#include "Component.h"
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "RakNetTypes.h"
|
||||
|
||||
/**
|
||||
* A component for vendor NPCs. A vendor sells items to the player.
|
||||
@@ -56,17 +57,36 @@ public:
|
||||
*/
|
||||
std::map<LOT, int>& GetInventory();
|
||||
|
||||
/**
|
||||
* Refresh the inventory of this vendor.
|
||||
*/
|
||||
void RefreshInventory(bool isCreation = false);
|
||||
|
||||
/**
|
||||
* Called on startup of vendor to setup the variables for the component.
|
||||
*/
|
||||
void SetupConstants();
|
||||
private:
|
||||
/**
|
||||
* The buy scaler.
|
||||
* The buy scalar.
|
||||
*/
|
||||
float m_BuyScalar;
|
||||
|
||||
/**
|
||||
* The sell scaler.
|
||||
* The sell scalar.
|
||||
*/
|
||||
float m_SellScalar;
|
||||
|
||||
/**
|
||||
* The refresh time of this vendors' inventory.
|
||||
*/
|
||||
float m_RefreshTimeSeconds;
|
||||
|
||||
/**
|
||||
* Loot matrix id of this vendor.
|
||||
*/
|
||||
uint32_t m_LootMatrixID;
|
||||
|
||||
/**
|
||||
* The list of items the vendor sells.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user