Skip to content

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 ​

intfaction_id0
Array[VendorItemStock]stocked_items[]
floatrestock_interval_hours24.0
ChronoManager.TimeSourcerestock_time_sourceChronoManager.TimeSource.GAME
boolbuys_itemstrue
floatbuy_value_multiplier0.5
floatsell_value_multiplier1.0
intpreferred_currency_id0
Dictionarystarting_currency{}
boolcan_repairtrue
floatrepair_cost_multiplier1.0

Methods ​

boolis_valid()
Array[Dictionary]validate()
CurrencyDefinitionget_preferred_currency()
Array[CurrencyDefinition]get_all_currencies()
boolhas_currency( currency_def: CurrencyDefinition )
intget_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