VendorDefinition ​
Inherits: DatabaseResource < Resource
VendorDefinition serves as a blueprint/template that multiple vendor instances can share Contains all the static configuration data for a vendor type
Properties ​
int | faction_id | 0 |
Array[VendorItemStock] | stocked_items | [] |
float | restock_interval_hours | 24.0 |
ChronoManager.TimeSource | restock_time_source | ChronoManager.TimeSource.GAME |
bool | buys_items | true |
float | buy_value_multiplier | 0.5 |
float | sell_value_multiplier | 1.0 |
int | preferred_currency_id | 0 |
Dictionary | starting_currency | {} |
bool | can_repair | true |
float | repair_cost_multiplier | 1.0 |
Methods ​
bool | is_valid() |
Array[Dictionary] | validate() |
CurrencyDefinition | get_preferred_currency() |
Array[CurrencyDefinition] | get_all_currencies() |
bool | has_currency( currency_def: CurrencyDefinition ) |
int | get_currency_starting_amount( currency_def: CurrencyDefinition ) |
Property descriptions ​
int faction_id = 0 ​
Faction this vendor belongs to (for future faction system integration)
Array[VendorItemStock] stocked_items = [] ​
Items this vendor stocks (templates for runtime inventory)
float restock_interval_hours = 24.0 ​
How often vendor restocks (in hours of the clock below, 0 = never restocks)
ChronoManager.TimeSource restock_time_source = ChronoManager.TimeSource.GAME ​
The clock the restock counts on: the game world (default), the hours of play, or the real clock (UTC, it keeps counting while the game is closed)
bool buys_items = true ​
Whether vendor buys items from players
float buy_value_multiplier = 0.5 ​
Value multiplier when buying from players (0.5 = pays 50% of item value)
float sell_value_multiplier = 1.0 ​
Base value multiplier for all items (affects selling prices)
int preferred_currency_id = 0 ​
Currency vendor prefers for transactions (ID of preferred currency) Used for repairs and buying items from players
Dictionary starting_currency = ​
Starting currency amounts for vendor [currency_id: int] = amount: int PreferredCurrency is always the first entry, additional currencies can be added
bool can_repair = true ​
Whether this vendor repairs the worn equipment of the player (when the project uses durability)
float repair_cost_multiplier = 1.0 ​
What this vendor charges for repairs compared with the standard price (0.5 = half, 2 = double)
Method descriptions ​
bool is_valid() ​
Is it free of errors?
Array[Dictionary] validate() ​
Checks the settings. Gives the problems found (empty when it is fine).
CurrencyDefinition get_preferred_currency() ​
Get the preferred currency definition
Array[CurrencyDefinition] get_all_currencies() ​
Get all currencies this vendor has in starting_currency
bool has_currency( currency_def: CurrencyDefinition ) ​
Check if vendor has a specific currency in their reserves
int get_currency_starting_amount( currency_def: CurrencyDefinition ) ​
Get starting amount for a currency