Module:Bribes: Difference between revisions

From IdleOn MMO Wiki
mNo edit summary
No edit summary
Tag: Manual revert
Line 21: Line 21:
         local name = bribe.name
         local name = bribe.name
         local desc = bribe.desc
         local desc = bribe.desc
         local cost = "" .. bribe.cost
         local cost = tostring(bribe.cost)
         local intName = bribe.intName
         local intName = bribe.intName



Revision as of 01:30, 11 March 2024

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({bribe.cost})-- frame:callParserFunction( '#invoke', { 'CoinDisplay', 'Main', coins = bribe.cost} )
        )
    end
    return ret
end

return p