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

implement "unkown" table format
(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:
-- 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
local function currency_cell(amount,flag)
a = 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
 
Line 103 ⟶ 97:
-- flags for if data values should be shown
item.hasLvl = param.has_content(item.lvl)
item.hasBuy = param.has_content(item.buy)
item.hasSell = param.has_content(item.sell)
Line 202 ⟶ 197:
out
:tag('tr')
:tag('td')
:wikitextIF(item.lvlhasBuy)
:css{ ['text-align'] = 'center' }
:wikitext(item.lvl)
:wikitext(item.lvl)
-- :doneELSE()
:addClass('table-bg-grey')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:END()
:done()
:tag('td')
:wikitext('[[File:' .. item.name .. '.png|30px|link=' .. item.name .. ']] [[' .. item.name .. ']]')
:done()
:tag('td')
:wikitext(reagentCell)
:done()
:wikitext(currency_cell(item.buy,item.hasBuy))
:wikitextIF(currency_cell(item.sell,item.hasSell)hasBuy)
:wikitext(currency_cell(item.profit,item.hasProfitbuy))
: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.hasBuyprofit))
:wikitext(currency_cell(item.profitPerXP,item.hasXP and item.hasProfitsell))
: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,item.hasProfit and item.hasDuration))
:ELSE()
:tag('td')
:addClass('table-bg-grey')
:attr{ colspan = '10' }
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:done()
:END()
:tag('td')
:wikitextIF(item.XPhasXP)
:wikitext(item.XP)
:ELSE()
:addClass('table-bg-grey')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:END()
:done()
:tag('td')
:wikitextIF(item.XPPerHourhasXP and item.hasDuration)
:wikitext(item.XPPerHour)
:ELSE()
:addClass('table-bg-grey')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:END()
:done()
:wikitext(currency_cell(item.profitPerXP,item.hasXP and item.hasProfit))
:IF(item.hasXP and item.hasProfit)
--:tag('td')
-- :wikitext(currency_cell(item.KPprofitPerXP))
--:doneELSE()
-- :tag('td')
-- :wikitextaddClass(item.KPPerHour'table-bg-grey')
:attr{ colspan = '10' }
--:done()
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:done()
:END()
:done()
960

edits