Module:Bribes

From IdleOn MMO Wiki

hewwo


local data = mw.loadJsonData('Module:Bribes/data.json')
local coinformat = require("Module:CoinDisplay")
local p = {}

local ROW_TEMPLATE = [=[<tr>
<td>%s</td>
<td>%s</td>
<td>%s</td>
</tr>]=]

local ROW_TEMPLATE_EXPANSION = [=[<tr>
<th>%s</th>
<th>%s</th>
<th>%s</th>
</tr>]=]

function p.bribez(frame)
    local ret = ""

    for _, bribe in ipairs(data) do
        local name = bribe.name
        local desc = bribe.desc
        local cost = tostring(bribe.cost)
        local intName = bribe.intName

        ret = ret .. string.format(
            bribe.intName == "BribeExpansion" and ROW_TEMPLATE_EXPANSION or ROW_TEMPLATE,
            name,
            desc,
            coinformat._main({cost})-- frame:callParserFunction( '#invoke', { 'CoinDisplay', 'Main', coins = bribe.cost} )
        )
    end
    return ret
end

return p