Module:Bribes: Difference between revisions
From IdleOn MMO Wiki
mNo edit summary |
mNo edit summary |
||
Line 23: | Line 23: | ||
local cost = bribe.cost | local cost = bribe.cost | ||
local intName = bribe.intName | local intName = bribe.intName | ||
if bribe.intName == "BribeExpansion" then | if bribe.intName == "BribeExpansion" then | ||
Line 30: | Line 29: | ||
name, | name, | ||
desc, | desc, | ||
frame: | frame:callParserFunction( '#invoke', { 'Loops', 'coinDisplay', coins = 'cost'} ) | ||
) | ) | ||
else | else | ||
Line 37: | Line 36: | ||
name, | name, | ||
desc, | desc, | ||
frame: | frame:callParserFunction( '#invoke', { 'Loops', 'coinDisplay', coins = 'cost'} ) | ||
) | ) | ||
end | end |
Revision as of 21:57, 8 March 2024
hewwo
local data = mw.loadJsonData('Module:Bribes/data.json')
local p = {}
local Loops = require("Module:Loops")
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 = bribe.cost
local intName = bribe.intName
if bribe.intName == "BribeExpansion" then
ret = ret .. string.format(
ROW_TEMPLATE_EXPANSION,
name,
desc,
frame:callParserFunction( '#invoke', { 'Loops', 'coinDisplay', coins = 'cost'} )
)
else
ret = ret .. string.format(
ROW_TEMPLATE,
name,
desc,
frame:callParserFunction( '#invoke', { 'Loops', 'coinDisplay', coins = 'cost'} )
)
end
end
return ret
end
return p
---------------------------------losin my sanity