Editing Module:Sandbox/User:Alsang/PotionList
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 2: | Line 2: | ||
local param = require( 'Module:Paramtest' ) |
local param = require( 'Module:Paramtest' ) |
||
local currency = require('Module:Currency') |
local currency = require('Module:Currency') |
||
local lang = mw.getContentLanguage() |
|||
require("Module:Mw.html extension") |
|||
Line 19: | Line 17: | ||
'?Uses item.Uses item #- = reagents', |
'?Uses item.Uses item #- = reagents', |
||
'?Value = sell', |
'?Value = sell', |
||
'? |
'?Recipe XP = brewXP', |
||
'?Uses item. |
'?Uses item.Recipe XP = prepXP', |
||
'? |
'?Recipe KP = brewKP', |
||
'?Uses item. |
'?Uses item.Recipe KP = prepKP', |
||
'? |
'?Recipe duration = brewDuration', |
||
'?Uses item. |
'?Uses item.Recipe duration = prepDuration', |
||
'sort = Profession Level A' |
'sort = Profession Level A' |
||
} |
} |
||
Line 37: | 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) |
local function currency_cell(amount,flag) |
||
local a = {} |
|||
return currency._cell(amount, { html = 'yes' }) |
|||
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 99: | Line 103: | ||
-- 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 107: | Line 110: | ||
item.hasDuration = param.has_content(item.brewDuration) and param.has_content(item.prepDuration) |
item.hasDuration = param.has_content(item.brewDuration) and param.has_content(item.prepDuration) |
||
-- XP/KP strings, if the requisite data isnt there then display "unknown" |
|||
if item.hasXP then |
|||
--item.xp = lang:formatNum(item.xp) -- format to include commas |
|||
item.XP = item.XP -- format to include commas |
|||
else |
|||
item.XP = 'Unknown' |
|||
end |
|||
if item.hasKP then |
|||
item.KP = item.KP .. '%' -- want 1 decimal place |
|||
else |
|||
item.KP = 'Unknown' |
|||
end |
|||
if item.hasXP and item.hasDuration then |
|||
item.XPPerHour = item.XPPerHour -- format to include commas |
|||
else |
|||
item.XPPerHour = 'Unknown' |
|||
end |
|||
if item.hasKP and item.hasDuration then |
|||
item.KPPerHour = item.KPPerHour -- want 2 decimal places |
|||
else |
|||
item.KPPerHour = 'Unknown' |
|||
end |
|||
end |
end |
||
Line 153: | Line 183: | ||
:wikitext('Coins/XP') |
:wikitext('Coins/XP') |
||
:done() |
:done() |
||
--:tag('th') |
|||
-- :wikitext('KP') |
|||
--:done() |
|||
--:tag('th') |
|||
-- :wikitext('KP/hr') |
|||
--:done() |
|||
:done() |
:done() |
||
Line 166: | Line 202: | ||
out |
out |
||
:tag('tr') |
:tag('tr') |
||
:tag('td') |
:tag('td') |
||
:css{ ['text-align'] = 'center' } |
|||
:IF(item.hasBuy) |
|||
:wikitext(item.lvl) |
|||
:css{ ['text-align'] = 'center' } |
|||
: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)) |
||
:wikitext(currency_cell(item.profit,item.hasProfit)) |
|||
: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() |
|||
:IF(item.hasSell) |
|||
: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,item.hasXP) |
||
:wikitext(lang:formatNum(tonumber(item.XP))) |
|||
:ELSE() |
|||
:addClass('table-bg-grey') |
|||
:css{ ['text-align'] = 'center' } |
|||
:wikitext('unknown') |
|||
:END() |
|||
:done() |
:done() |
||
:tag('td') |
:tag('td') |
||
: |
:wikitext(item.XPPerHour) |
||
:wikitext(lang:formatNum(tonumber(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)) |
|||
--:tag('td') |
|||
:IF(item.hasXP and item.hasProfit) |
|||
:wikitext |
-- :wikitext(item.KP) |
||
: |
--:done() |
||
--:tag('td') |
|||
-- :wikitext(item.KPPerHour) |
|||
--:done() |
|||
:attr{ colspan = '10' } |
|||
:css{ ['text-align'] = 'center' } |
|||
:wikitext('unknown') |
|||
:done() |
|||
:END() |
|||
:done() |
:done() |
||