Editing Module:Sandbox/User:Alsang/PotionList

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

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',
'?Activity XP = brewXP',
'?Recipe XP = brewXP',
'?Uses item.Activity XP = prepXP',
'?Uses item.Recipe XP = prepXP',
'?Activity KP = brewKP',
'?Recipe KP = brewKP',
'?Uses item.Activity KP = prepKP',
'?Uses item.Recipe KP = prepKP',
'?Activity duration = brewDuration',
'?Recipe duration = brewDuration',
'?Uses item.Activity duration = prepDuration',
'?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 = tostring(item.xp) -- format to include commas
else
item.XP = 'Unknown'
end
if item.hasKP then
item.KP = tostring(item.KP) .. '%' -- want 1 decimal place
else
item.KP = 'Unknown'
end
if item.hasXP and item.hasDuration then
item.XPPerHour = tostring(item.XPPerHour) -- format to include commas
else
item.XPPerHour = 'Unknown'
end
if item.hasKP and item.hasDuration then
item.KPPerHour = tostring(item.KPPerHour) -- want 2 decimal places
else
item.KPPerHour = 'Unknown'
end
end
end


Line 119: Line 148:
:tag('tr')
:tag('tr')
:tag('th')
:tag('th')
:wikitext('[[File:Alchemist small icon.png|15px]] Level')
:wikitext('Level')
:done()
:done()
:tag('th')
:tag('th')
Line 151: Line 180:
:tag('th')
:tag('th')
:attr{ colspan = '10' }
:attr{ colspan = '10' }
:wikitext('Coins/XP')
:wikitext('Profit/XP')
:done()
:tag('th')
:wikitext('KP')
:done()
:tag('th')
:wikitext('KP/hr')
:done()
:done()
:done()
:done()
Line 166: Line 201:
out
out
:tag('tr')
:tag('tr')
:tag('td')
:tag('td')
:wikitext('[[File:Alchemist small icon.png|15px]] ' .. item.lvl)
:IF(item.hasBuy)
: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))
:IF(item.hasBuy)
:wikitext(currency_cell(item.sell,item.hasSell))
:wikitext(currency_cell(item.buy))
:wikitext(currency_cell(item.profit,item.hasProfit))
:wikitext(currency_cell(item.profitPerHour,item.hasProfit and item.hasDuration))
:ELSE()
:tag('td')
:tag('td')
:addClass('table-bg-grey')
:wikitext(item.XP,item.hasXP)
:done()
:attr{ colspan = '10' }
:tag('td')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:wikitext(item.XPPerHour)
:done()
:done()
:wikitext(currency_cell(item.profitPerXP,item.hasXP and item.hasProfit))
: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')
:IF(item.hasXP)
:wikitext(item.KP)
:wikitext(lang:formatNum(tonumber(item.XP)))
:ELSE()
:addClass('table-bg-grey')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:END()
:done()
:done()
:tag('td')
:tag('td')
:IF(item.hasXP and item.hasDuration)
:wikitext(item.KPPerHour)
:wikitext(lang:formatNum(tonumber(item.XPPerHour)))
:ELSE()
:addClass('table-bg-grey')
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:END()
:done()
:done()
:IF(item.hasXP and item.hasProfit)
:wikitext(currency_cell(item.profitPerXP))
:ELSE()
:tag('td')
:addClass('table-bg-grey')
:attr{ colspan = '10' }
:css{ ['text-align'] = 'center' }
:wikitext('unknown')
:done()
:END()
:done()
:done()
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see Brighter Shores:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template