This commit is contained in:
2026-04-06 14:13:46 -07:00
commit eb4659817e
11 changed files with 857 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
local db = {}
--#data_transform
function db.getMaterials()
local materials = {}
for k,_ in pairs(data.materials or {}) do
materials[#materials+1] = k
end
return materials
end
--#data_transform
function db.getPrice(mat)
return (data.materials or {})[mat]
end
--#data_transform
function db.getCurrencies()
local currencies = {}
for k,_ in pairs(data.currencies or {}) do
currencies[#currencies+1] = k
end
return currencies
end
--#data_transform
function db.getCurrencyWorth(cur)
return (data.currencies or {})[cur]
end
--#data_transform
function db.setPrice(mat,price)
if not data.materials then data.materials = {} end
data.materials[mat] = price
end
--#data_transform
function db.setWorth(cur,worth)
if not data.currencies then data.currencies = {} end
data.currencies[cur] = worth
end
--#data_transform
function db.getCurrencyUnit()
return data.currency_unit or "cr"
end
--#data_transform
function db.setCurrencyUnit(unit)
data.currency_unit = unit
end
return db