Module:Sandbox/User:Alsang/PotionList: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(rename the SMW properties "Recipe XP", "Recipe KP", and "Recipe duration" to "Activity XP", "Activity KP", and "Activity duration" so they can generate the same fields as Template:Profession info)
(implement "unkown" table format)
Line 35: Line 35:
-- makes the html for the cells containing currency directly, no tags needed
-- makes the html for the cells containing currency directly, no tags needed
-- flag is for if the number should not be known, replaces with zero
-- flag is for if the number should not be known, replaces with zero
local function currency_cell(amount,flag)
local function currency_cell(amount)
return currency._cell(amount, { html = 'yes' })
local a = {}
if flag then
a = currency._cell(amount, { html = 'yes' })
else
a = currency._cell(0, { html = 'yes' }) -- replace this with blank, if I can figure out how to
end
return a
end
end


Line 103: Line 97:
-- flags for if data values should be shown
-- flags for if data values should be shown
item.hasLvl = param.has_content(item.lvl)
item.hasBuy = param.has_content(item.buy)
item.hasBuy = param.has_content(item.buy)
item.hasSell = param.has_content(item.sell)
item.hasSell = param.has_content(item.sell)
Line 202: Line 197:
out
out
:tag('tr')
:tag('tr')
:tag('td')
:tag('td')
:IF(item.hasBuy)
:css{ ['text-align'] = 'center' }
:css{ ['text-align'] = 'center' }
:wikitext(item.lvl)
:wikitext(item.lvl)
:ELSE()
:addClass('table-bg-grey')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:END()
:done()
:done()
:tag('td')
:tag('td')
:wikitext('[[File:' .. item.name .. '.png|30px|link=' .. item.name .. ']] [[' .. item.name .. ']]')
:wikitext('[[File:' .. item.name .. '.png|30px|link=' .. item.name .. ']] [[' .. item.name .. ']]')
:done()
:done()
:tag('td')
:tag('td')
:wikitext(reagentCell)
:wikitext(reagentCell)
:done()
:done()
:wikitext(currency_cell(item.buy,item.hasBuy))
:wikitext(currency_cell(item.sell,item.hasSell))
:IF(item.hasBuy)
:wikitext(currency_cell(item.profit,item.hasProfit))
:wikitext(currency_cell(item.buy))
:ELSE()
:wikitext(currency_cell(item.profitPerHour,item.hasProfit and item.hasDuration))
:tag('td')
:addClass('table-bg-grey')
:attr{ colspan = '10' }
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:done()
:END()
:IF(item.hasSell)
-- I cannot for the life of me figure out why,
-- but if I put item.sell directly into this function it claims it has value nil
-- it works for other functions to display it directly
-- so here is the workaround I guess
--:wikitext(currency_cell(item.buy+200*item.profit))
:wikitext(currency_cell(item.sell))
:ELSE()
:tag('td')
:addClass('table-bg-grey')
:attr{ colspan = '10' }
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:done()
:END()
:IF(item.hasProfit)
:wikitext(currency_cell(item.profit))
:ELSE()
:tag('td')
:addClass('table-bg-grey')
:attr{ colspan = '10' }
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:done()
:END()
:IF(item.hasProfit and item.hasDuration)
:wikitext(currency_cell(item.profitPerHour))
:ELSE()
:tag('td')
:addClass('table-bg-grey')
:attr{ colspan = '10' }
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:done()
:END()
:tag('td')
:tag('td')
:wikitext(item.XP)
:IF(item.hasXP)
:wikitext(item.XP)
:ELSE()
:addClass('table-bg-grey')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:END()
:done()
:done()
:tag('td')
:tag('td')
:wikitext(item.XPPerHour)
:IF(item.hasXP and item.hasDuration)
:wikitext(item.XPPerHour)
:ELSE()
:addClass('table-bg-grey')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:END()
:done()
:done()
:wikitext(currency_cell(item.profitPerXP,item.hasXP and item.hasProfit))
:IF(item.hasXP and item.hasProfit)
--:tag('td')
-- :wikitext(item.KP)
:wikitext(currency_cell(item.profitPerXP))
--:done()
:ELSE()
--:tag('td')
:tag('td')
-- :wikitext(item.KPPerHour)
:addClass('table-bg-grey')
:attr{ colspan = '10' }
--:done()
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:done()
:END()
:done()
:done()