API:GetStoreData
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Returns the contents of the merchant store the player has open.
store = GetStoreData()
Arguments
None.
Returns
- store
table– Array of store items, indexed from 1, plus two named fields.
Named fields of store:
| Key | Type | Meaning |
|---|---|---|
canRepair |
boolean |
true if the merchant can repair items.
|
selectedCategory |
number |
Selected store category. The client adds 1 to its stored value. |
Each store item is an item data table with these extra fields:
| Key | Type | Meaning |
|---|---|---|
cost |
number |
Price. |
pageid |
number |
— |
slotid |
number |
— |
canbuy |
boolean |
true if the player can buy the item.
|
altCurrency |
table |
Only present for items that cost an alternative currency. Array of 3 tables with type (number), icon (number), name (wstring), description (wstring) and quantity (number).
|
Details
- Items without an alternative currency have no
altCurrencyfield. - If the Lua state is not available, the function returns nothing.
Errors
None.
Example
From ea_interactionwindow/source/interactionwindowstore.lua:
EA_Window_InteractionStore.storedata = GetStoreData()
...
if EA_Window_InteractionStore.storedata.canRepair then
WindowSetShowing("EA_Window_InteractionStoreRepairAll", true)
From the same file:
EA_Window_InteractionStore.UpdateCategoryList(EA_Window_InteractionStore.storedata.selectedCategory)
