Module:Sandbox/User:Suity/mstables

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Template:Module sandbox/doc. [edit] [history] [purge]
Module:Sandbox/User:Suity/mstables requires Module:Coins.
Module:Sandbox/User:Suity/mstables requires Module:ExchangeLite.
Module:Sandbox/User:Suity/mstables loads data from Module:Sandbox/User:Suity/msdata.
Function list
L 9 — fnum
L 13 — caps
L 17 — title
L 21 — plink
L 39 — plinkp
L 43 — p.MiningRocks
L 71 — p.Pickaxes
L 104 — p.Salvage
L 175 — p.CritChance
L 201 — p.CritBonus
L 218 — p.RockertunityBonus
L 243 — p.DoubleOreChance
L 268 — p.GeodeChance
L 296 — p.GeodeSedimentary
L 324 — p.GeodeIgneous
L 352 — p.OreBoxBonus
L 371 — p.Protean
L 392 — p.Skillchompa
L 413 — p.HighAlchTable
L 456 — p.EstGETable
L 501 — p.OresBars
L 524 — p.Smelting
L 542 — p.MaxHeatStart
L 558 — p.SmeltRate
L 580 — p.DoubleSmelt
L 596 — p.ExtraProgress
L 612 — p.ReheatRate
L 634 — p.NewWeapons
L 655 — p.Progress
L 746 — p.SmithingXPTable
L 832 — p.PlusX
L 850 — p.ProgressXP
L 870 — p.BurialSets
L 914 — p.mwImmaculate1
L 942 — p.mwImmaculate2
L 974 — p.mwImmaculate3
L 1006 — p.mwGlorious
L 1046 — p.mwRivets
L 1065 — p.mwLined1
L 1093 — p.mwLined2
L 1119 — p.mwHelmet
L 1150 — p.mwBody
L 1181 — p.mwLegs
L 1212 — p.mwGloves
L 1243 — p.mwBoots
L 1274 — p.mwMalevolent
L 1297 — p.mwTorva
L 1320 — p.Tokens
L 1336 — p.TokenValue
L 1352 — p.TokenCalc
L 1380 — p.TokenCalcIM

This module is a sandbox for Suity. It can be used to test changes to existing modules, prototype new modules, or just experimenting with lua features.

Invocations of this sandbox should be kept in userspace; if the module is intended for use in other namespaces, it should be moved out of the sandbox into a normal module and template.

This default documentation can be overridden by creating the /doc subpage of this module, as normal.

--<nowiki>

local gemw = require('Module:ExchangeLite')
local p = {}
local data = mw.loadData('Module:Sandbox/User:Suity/msdata')
local coins = require('Module:Coins')

local lang = mw.getContentLanguage() -- Number format helper function.
function fnum(x)
    if type(x) == 'number' then return lang:formatNum(x) end
return x end

function caps(str)
    return (str:gsub("^%l", string.upper))
end

function title(first, rest)
   return first:upper()..rest:lower()
end

function plink(name, opts)
    local file = name.. '.png'
    local link = name
    local text = name
    if type(opts) == 'table' then
        if opts.txt then
            text = opts.txt
        end
        if opts.img then
            file = opts.img
        end
    end
    if text ~= '' then
        text = string.format(' [[%s|%s]]', link, text)
    end

    return string.format('<span class="inventory-image">[[File:%s|link=%s]]</span>%s', file, link, text)
end
function plinkp(name, img)
    return plink(name, {img = img, txt = ''})
end

function p.MiningRocks(frame)   -- Table for Mining rocks:
                                -- (level, rock, difficulty, hardness, xp multiplier)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Mining level')   :done()
:tag('th')  :wikitext('Rock')           :done()
:tag('th')  :wikitext('HP')             :done()
:tag('th')  :wikitext('Hardness')       :done()
:tag('th')  :wikitext('XP multiplier')  :done()
:tag('th')  :wikitext('Core rock')      :done()
:done()

for index,i in ipairs(data.rocks) do
    local core = ''
    if i.core == 1 then core = '[[File:Yes check.svg|20px|link=]]' end
t:tag('tr')
:tag('td')  :wikitext(i.level)      :css('text-align', 'center')    :done()
:tag('td')  :wikitext(i.img..' '..i.name)                           :done()
:tag('td')  :wikitext(fnum(i.diff)) :css('text-align', 'center')    :done()
:tag('td')  :wikitext(i.hardness)   :css('text-align', 'center')    :done()
:tag('td')  :wikitext(i.xp)         :css('text-align', 'center')    :done()
:tag('td')  :wikitext(core)         :css('text-align', 'center')    :done()
:done()
end
return t
end

function p.Pickaxes(frame) -- Table for Pickaxes
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Mining level')       :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Pickaxe')            :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Damage')             :attr('colspan', 3) :done()
:tag('th')  :wikitext('Penetration')        :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Augmentable')        :attr('rowspan', 2) :done()
:done()
:tag('tr')
:tag('th')  :wikitext('Min')        :done()
:tag('th')  :wikitext('Average')    :done()
:tag('th')  :wikitext('Max')        :done()
:done()

for index,i in ipairs(data.picks_order) do
    local pick = data.picks[i]
    local augment = ''
    if pick.aug == 1 then augment = '[[File:Yes check.svg|20px|link=]]' end
    t:tag('tr')
    :tag('td')  :wikitext(pick.level)   :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(pick.name)                                    :done()
    :tag('td')  :wikitext(pick.min)     :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(pick.avg)     :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(pick.max)     :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(pick.pen)     :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(augment)      :css('text-align', 'center')    :done()
    :done()
end
return t
end

function p.Salvage(frame) -- Salvage table
	local args = frame:getParent().args
local t = mw.html.create('table')
t:addClass('wikitable sortable')
:tag('tr')
:tag('th')  :wikitext('Old drop')               :attr('rowspan',2)  :done()
:tag('th')  :wikitext('New drop')               :attr('rowspan',2)  :done()
:tag('th')  :wikitext('High Alch value')        :attr('colspan',4)  :done()
:tag('th')	:wikitext('GE value')				:attr('colspan',3)	:done()
:tag('th')  :wikitext('Spring cleaner profit')  :attr('colspan',4)  :done()
:done()
:tag('tr')
:tag('th')  :wikitext('Pre-rework')     :done()
:tag('th')  :wikitext('Salvage')        :done()
:tag('th')  :wikitext('Change')         :done()
:tag('th')  :wikitext('%')      		:done()
:tag('th')  :wikitext('Pre-rework')     :done()
:tag('th')  :wikitext('Change')         :done()
:tag('th')  :wikitext('%')      		:done()
:tag('th')  :wikitext('Pre-rework')     :done()
:tag('th')  :wikitext('Salvage')        :done()
:tag('th')  :wikitext('Change')			:done()
:tag('th')  :wikitext('%')      		:done()
:done()

for index,i in ipairs(data.tokens) do
	local item = args.tier..' '..i.name
	local ge = gemw.price(item)
	local alch = math.floor(gemw.load({args = {item, 'value'}}) * 0.6)
	local alch_salvage = data.salvage['tier'][args.tier]['alch'] * data.salvage['size'][i.size]
	local salvage_name = i.size
	if args.tier == 'Rune' then 
		alch_salvage = data.salvage['tier'][args.tier]['alch'] * data.salvage['size'][i.rune] 
		salvage_name = i.rune 
		end
	salvage_name = plink(salvage_name..' '..i.type..' '..tostring(args.tier):lower()..' salvage')
	if i.name == 'halberd' then 
		alch_salvage = alch_salvage * 2 
		salvage_name = salvage_name..' <sup>(x2)</sup>'
		end
	local salvage_sc = alch_salvage - data.spring
	if i.name == 'halberd' then salvage_sc = salvage_sc - data.spring end
	local item_sc = (i.bar * data.salvage['tier'][args.tier]['value']) - data.spring
	if i.bar == 0 then item_sc = 0 end
	local change_alch = alch_salvage - alch
	local change_ge = alch_salvage - ge
	local change_sc = salvage_sc - item_sc
	local perc_alch = math.floor(100 * (change_alch / alch) * 100)/100
	local perc_ge = math.floor(100 * (change_ge / ge) * 100)/100
	local perc_sc = math.floor(100 * (change_sc / item_sc) * 100)/100
	if item_sc == 0 then perc_sc = '-'
	else perc_sc = perc_sc..'%' end
	
	t:tag('tr')
	:tag('td')	:wikitext(plink(item))					:done()
	:tag('td')	:wikitext(salvage_name)					:done()
	:tag('td')	:wikitext(coins._amount(alch))			:done()
	:tag('td')	:wikitext(coins._amount(alch_salvage))	:done()
	:tag('td')	:wikitext(coins._amount(change_alch))	:done()
	:tag('td')	:wikitext(perc_alch..'%')				:done()
	:tag('td')	:wikitext(coins._amount(ge))			:done()
	:tag('td')	:wikitext(coins._amount(change_ge))		:done()
	:tag('td')	:wikitext(perc_ge..'%')					:done()
	:tag('td')	:wikitext(coins._amount(item_sc))		:done()
	:tag('td')	:wikitext(coins._amount(salvage_sc))	:done()
	:tag('td')	:wikitext(coins._amount(change_sc))		:done()
	:tag('td')	:wikitext(perc_sc)						:done()
end
return t
end

function p.CritChance(frame) -- Table for Mining levelling benefits (Crit chance).
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Rock')                   :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Critical hit chance')    :attr('colspan', 3) :done()
:done()
:tag('tr')
:tag('th')  :wikitext(data.crit_chance_base * 50 ..'%')    :done()
:tag('th')  :wikitext(data.crit_chances[1] * 50 ..'%')     :done()
:tag('th')  :wikitext(data.crit_chances[2] * 50 ..'%')     :done()
:done()

for index,i in ipairs(data.rocks) do
    if i.core == 1 then
    t:tag('tr')
    :tag('td')  :wikitext(i.img..' '..i.name)                                               :done()
    :tag('td')  :wikitext(i.level)                          :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.crit_chance_level[1])           :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.crit_chance_level[2] or '-')    :css('text-align', 'center')    :done()
    :done()
    end
end
return t
end

function p.CritBonus(frame) -- Table for Mining levelling benefits (Crit bonus).
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Mining level')		:done()
:tag('th')  :wikitext('Critical hit bonus') :done()
:done()

for i = 1,20,1 do
    t:tag('tr')
    :tag('td')  :wikitext(data.crit_bonus_level[i]) :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(data.crit_bonus[i])       :css('text-align', 'center')    :done()
    :done()
end
return t
end

function p.RockertunityBonus(frame) -- Table for Mining levelling benefits (Rockertunity Bonus).
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Rock')                       :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Rockertunity multiplier')    :attr('colspan', 3) :done()
:done()
:tag('th')  :wikitext(frame:extensionTag{name='math', content='\\times'..data.rockertunity_mult_base})	:done()
:tag('th')  :wikitext(frame:extensionTag{name='math', content='\\times'..data.rockertunity_mult[1]})	:done()
:tag('th')  :wikitext(frame:extensionTag{name='math', content='\\times'..data.rockertunity_mult[2]})	:done()
:done()

for index,i in ipairs(data.rocks) do
    if i.core == 1 then
    t:tag('tr')
    :tag('td')  :wikitext(i.img..' '..i.name)                                       		:done()
    :tag('td')  :wikitext(i.level)                  		:css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.rockertunity_level[1])			:css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.rockertunity_level[2] or '-')	:css('text-align', 'center')	:done()
    :done()
    end
end
return t
end

function p.DoubleOreChance(frame) -- Table for Mining levelling benefits (Double ore chance).
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Rock')               :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Double ore chance')  :attr('colspan', 3) :done()
:done()
:tag('tr')
:tag('th')  :wikitext(frame:extensionTag{name='math', content=data.double_ore_chance_base..'\\% '})		:done()
:tag('th')  :wikitext(frame:extensionTag{name='math', content=(data.double_ore_chances[1]*100)..'\\% '}) :done()
:tag('th')  :wikitext(frame:extensionTag{name='math', content=(data.double_ore_chances[2]*100)..'\\% '}) :done()
:done()

for index,i in ipairs(data.rocks) do
    if i.core == 1 then
    t:tag('tr')
    :tag('td')  :wikitext(i.img..' '..i.name)                                               :done()
    :tag('td')  :wikitext(i.level)                          :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.double_ore_chance[1])           :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.double_ore_chance[2] or '-')    :css('text-align', 'center')    :done()
    end
end
return t
end

function p.GeodeChance(frame)   -- Table for Mining levelling benefits (Geode chance).
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Rock')           :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Geode type')     :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Geode chance')   :attr('colspan', 3) :done()
:done()
:tag('tr')
:tag('th')  :wikitext(frame:extensionTag{name='math', content=(data.geode_chance_base*100)..'\\% '}) :done()
:tag('th')  :wikitext(frame:extensionTag{name='math', content=(data.geode_chances[1]*100)..'\\% '})  :done()
:tag('th')  :wikitext(frame:extensionTag{name='math', content=(data.geode_chances[2]*100)..'\\% '})  :done()
:done()

for index,i in ipairs(data.rocks) do
    if i.core == 1 then
    t:tag('tr')
    :tag('td')  :wikitext(i.img..' '..i.name)                                               :done()
    :tag('td')  :wikitext(i.geode)                                                          :done()
    :tag('td')  :wikitext(i.level)                          :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.geode_chance_level[1] or '-')   :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.geode_chance_level[2] or '-')   :css('text-align', 'center')    :done()
    :done()
	end
end
return t
end

function p.GeodeSedimentary(frame)  -- Table for Sedimentary Geodes
local t = mw.html.create('table')
local average = 0
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Item')       :done()
:tag('th')  :wikitext('Chance')     :done()
:tag('th')  :wikitext('GE price')   :done()
:done()

for index,i in ipairs(data.sedimentary) do
    local image = '[[File:'..i.name..'.png|link=]]'
    local price = coins._amount(gemw.price(i.name))
    local effective_value = gemw.price(i.name) * i.prob
    average = average + effective_value
    t:tag('tr')
    :tag('td')  :wikitext(image..' '..'[['..i.name..']]')                       :done()
    :tag('td')  :wikitext((i.prob*100)..'%')    :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(price)                                                :done()
    :done()
end
    t:tag('tr')
    :tag('th')  :wikitext('Average Value')  :attr('colspan', 2)     :done()
    :tag('th')  :wikitext(coins._amount(math.floor(average)))       :done()
    :done()
return t
end

function p.GeodeIgneous(frame)  -- Table for Igneous Geodes
local t = mw.html.create('table')
local average = 0
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Item')       :done()
:tag('th')  :wikitext('Chance')     :done()
:tag('th')  :wikitext('GE price')   :done()
:done()

for index,i in ipairs(data.igneous) do
    local image = '[[File:'..i.name..'.png|link=]]'
    local price = coins._amount(gemw.price(i.name))
    local effective_value = gemw.price(i.name) * i.prob
    average = average + effective_value
    t:tag('tr')
    :tag('td')  :wikitext(image..' '..'[['..i.name..']]')                       :done()
    :tag('td')  :wikitext((i.prob*100)..'%')    :css('text-align', 'center')    :done()
    :tag('td')  :wikitext(price)                                                :done()
    :done()
end
    t:tag('tr')
    :tag('th')  :wikitext('Average value')  :attr('colspan', 2)     :done()
    :tag('th')  :wikitext(coins._amount(math.floor(average)))       :done()
    :done()
return t
end

function p.OreBoxBonus(frame) -- Table for Mining levelling benefits (Ore box increase).
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Ore')    :done()
:tag('th')  :wikitext('Level')  :done()
:done()

for index,i in ipairs(data.rocks) do
    if i.core == 1 then
    t:tag('tr')
    :tag('td')  :wikitext(i.img..' '..i.name)                           :done()
    :tag('td')  :wikitext(i.ore_box)    :css('text-align', 'center')    :done()
    :done()
    end
end
return t
end

function p.Protean(frame) -- Table for Protean bars
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Level')              :done()
:tag('th')  :wikitext('Metal')              :done()
:tag('th')  :wikitext('XP per bar')         :done()
:tag('th')  :wikitext('Base XP per hour')   :done()
:done()

for index,i in ipairs(data.protean) do
    t:tag('tr')
    :tag('td')  :wikitext(i.level)  					:css('text-align', 'center')    :done()
    :tag('td')  :wikitext(i.name)                                   					:done()
    :tag('td')  :wikitext(i.xp)     					:css('text-align', 'center')    :done()
    :tag('td')  :wikitext(fnum(i.xp * data.protean_hr))	:css('text-align', 'center')	:done()
    :done()
end
return t
end

function p.Skillchompa(frame) -- Table for Skillchompas
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')  :wikitext('Level')              :done()
:tag('th')  :wikitext('Skillchompa')        :done()
:tag('th')  :wikitext('Bonus crit. damage')  :done()
:done()

for index,i in ipairs(data.skillchompa_order) do
    local sc = data.skillchompa[i]
    local name = '[[File:'..i..' skillchompa.png|link=]] [['..i..' skillchompa]]'
    t:tag('tr')
    :tag('td')  :wikitext(sc.level)		:css('text-align', 'center')    :done()
    :tag('td')  :wikitext(name)                                         :done()
    :tag('td')  :wikitext(sc.bonus)     :css('text-align', 'center')    :done()
    :done()
end
return t
end

function p.HighAlchTable(frame)  -- Table for High Alchemy values
    local args = frame:getParent().args
    local item = data.bbc[args.item]
    local alch = {}
    local cell = {}
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr') 
:tag('th')  :wikitext('Level')          :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Metal')          :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Item upgrade')   :attr('colspan', 6) :done()
:done()
:tag('tr')
:tag('th')  :wikitext('Base')   :done()
:tag('th')  :wikitext('+1')     :done()
:tag('th')  :wikitext('+2')     :done()
:tag('th')  :wikitext('+3')     :done()
:tag('th')  :wikitext('+4')     :done()
:tag('th')  :wikitext('+5')     :done()
:done()

for index,i in ipairs(data.metals) do
    local base = math.floor(i.val_item * item)
    local img = i['img'..item]
    
    for x = 1,5,1 do
        alch[x] = coins._amount(base * data.bar_contain[x])
        if i.max > (x-1) then cell[x] = alch[x] else cell[x] = '' end
    end
    t:tag('tr')
    :tag('td')  :wikitext(i.level)  :css('text-align', 'center')        :done()
    :tag('td')  :wikitext(img..' '..i.name)                             :done()
    :tag('td')  :wikitext(coins._amount(base))                          :done()
    :tag('td')  :wikitext(cell[1])                                      :done()
    :tag('td')  :wikitext(cell[2])                                      :done()
    :tag('td')  :wikitext(cell[3])                                      :done()
    :tag('td')  :wikitext(cell[4])                                      :done()
    :tag('td')  :wikitext(cell[5])                                      :done()
    :done()
end
return t
end

function p.EstGETable(frame)  -- Table for estimated GE values
    local args = frame:getParent().args
    local item = data.bbc[args.item]
    local alch = {}
    local cell = {}
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr') 
:tag('th')  :wikitext('Level')          :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Metal')          :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Price per bar')  :attr('rowspan', 2) :done()
:tag('th')  :wikitext('Item upgrade')   :attr('colspan', 6) :done()
:done()
:tag('tr')
:tag('th')  :wikitext('Base')   :done()
:tag('th')  :wikitext('+1')     :done()
:tag('th')  :wikitext('+2')     :done()
:tag('th')  :wikitext('+3')     :done()
:tag('th')  :wikitext('+4')     :done()
:tag('th')  :wikitext('+5')     :done()
:done()

for index,i in ipairs(data.metals) do
    local base = math.floor(i.est_ge * item)
    local img = i['img'..item]
    
    for x = 1,5,1 do
        alch[x] = coins._amount(base * data.bar_contain[x])
        if i.max > (x-1) then cell[x] = alch[x] else cell[x] = '' end
    end
    t:tag('tr')
    :tag('td')  :wikitext(i.level)  :css('text-align', 'center')        :done()
    :tag('td')  :wikitext(img..' '..i.name)                             :done()
    :tag('td')  :wikitext(coins._amount(i.est_ge))                      :done()
    :tag('td')  :wikitext(coins._amount(base))                          :done()
    :tag('td')  :wikitext(cell[1])                                      :done()
    :tag('td')  :wikitext(cell[2])                                      :done()
    :tag('td')  :wikitext(cell[3])                                      :done()
    :tag('td')  :wikitext(cell[4])                                      :done()
    :tag('td')  :wikitext(cell[5])                                      :done()
    :done()
end
return t
end

function p.OresBars(frame) -- Table for Ores and Bars
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')									:done()
:tag('th')	:wikitext('Bar')									:done()
:tag('th')	:wikitext('Primary ore')							:done()
:tag('th')	:wikitext('Secondary ore')							:done()
:tag('th')	:wikitext('Tertiary ore')							:done()
:done()

for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.level)	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.img..' '..i.name)						:done()
	:tag('td')	:wikitext(i.primary)								:done()
	:tag('td')	:wikitext(i.secondary or ' ')						:done()
	:tag('td')	:wikitext(i.tertiary or ' ')						:done()
	:done()
end
return t
end

function p.Smelting(frame) -- Table for smelting
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')	:done()
:tag('th')	:wikitext('Bar')	:done()
:tag('th')	:wikitext('XP')		:done()
:done()
for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.level)	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.img..' '..i.name)						:done()
	:tag('td')	:wikitext(i.smelt)	:css('text-align', 'center')	:done()
	:done()
end
return t
end

function p.MaxHeatStart(frame) -- Table for max heat start (Smithing levelling benefits)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Metal')	:done()
:tag('th')	:wikitext('Level')	:done()
:done()
for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.img..' '..i.name)							:done()
	:tag('td')	:wikitext(i.max_heat)	:css('text-align', 'center')	:done()
	:done()
end
return t
end

function p.SmeltRate(frame) -- Table for Smelting speed (Smithing levelling benefits)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Metal')			:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Smelting rate')	:attr('colspan', 3)	:done()
:done()
:tag('th')	:wikitext(data.smelt_rate_base)					:done()
:tag('th')	:wikitext(data.smelt_rate[1])					:done()
:tag('th')	:wikitext(data.smelt_rate[2])					:done()
:done()
for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.img..' '..i.name)										:done()
	:tag('td')	:wikitext(i.level)					:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.smelt_rate_level[1])	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.smelt_rate_level[2])	:css('text-align', 'center')	:done()
	:done()
end
return t
end

function p.DoubleSmelt(frame)	-- Table for double smelting levels (Smithing levelling benefits)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Metal')	:done()
:tag('th')	:wikitext('Level')	:done()
:done()
for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.img..' '..i.name)									:done()
	:tag('td')	:wikitext(i.double_smelt)		:css('text-align', 'center')	:done()
	:done()
end
return t
end

function p.ExtraProgress(frame)	-- Table for extra base progress per strike (Smithing levelling benefits)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Metal')	:done()
:tag('th')	:wikitext('Level')	:done()
:done()
for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.img..' '..i.name)									:done()
	:tag('td')	:wikitext(i.extra_progress)		:css('text-align', 'center')	:done()
	:done()
end
return t
end

function p.ReheatRate(frame) -- Table for reheat rate (Smithing levelling benefits)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Metal')			:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Reheat rate')	:attr('colspan', 3)	:done()
:done()
:tag('th')	:wikitext(data.reheat_base)						:done()
:tag('th')	:wikitext(data.reheats[1])						:done()
:tag('th')	:wikitext(data.reheats[2])						:done()
:done()
for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.img..' '..i.name)										:done()
	:tag('td')	:wikitext(i.level)					:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.reheat_level[1])		:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.reheat_level[2])		:css('text-align', 'center')	:done()
	:done()
end
return t
end

function p.NewWeapons(frame) -- Table for new metal weapon types
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')		:done()
:tag('th')	:wikitext('Metal')		:done()
:tag('th')	:wikitext('Dual-wield')	:done()
:tag('th')	:wikitext('Two-handed')	:done()
:done()
for index,i in ipairs(data.metals) do
	if i.level >= 60 then
	t:tag('tr')
	:tag('td')	:wikitext(i.level)	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.img..' '..i.name)						:done()
	:tag('td')	:wikitext(i.dw)		:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.twoh)	:css('text-align', 'center')	:done()
	:done()
end end
return t
end

function p.Progress(frame)	-- Table for calculating smithing progress per item
	local args = frame:getParent().args
	local bbc = data.bbc[args.item]
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')						:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Metal')						:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Progress required per item')	:attr('colspan', 7)	:done()
:done()
:tag('th')	:wikitext('Base')								:done()
:tag('th')	:wikitext('+1')									:done()
:tag('th')	:wikitext('+2')									:done()
:tag('th')	:wikitext('+3')									:done()
:tag('th')	:wikitext('+4')									:done()
:tag('th')	:wikitext('+5')									:done()
:tag('th')	:wikitext('Burial')								:done()
:done()

for index,i in ipairs(data.metals) do
	local img = i['img'..bbc]
	local maxcell = {}
	local progress = {}
	local progress_base = bbc * i.progress
	
	for x = 1,5,1 do
		progress[x] = progress_base * data.progress_mult[x]
		if i.max > x - 1 then maxcell[x] = progress[x] else maxcell[x] = '-' end
	end
	
	local burial = '-'
	if i.burial == 1 then burial = progress[i.max] / 2 end

t:tag('tr')
:tag('td')	:wikitext(i.level)				:css('text-align', 'center')	:done()
:tag('td')	:wikitext(img..' '..i.name)										:done()
:tag('td')	:wikitext(fnum(progress_base))	:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[1]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[2]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[3]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[4]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[5]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(burial))			:css('text-align', 'center')	:done()
:done()
end
local c = mw.html.create('table')
c:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')									:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Metal')									:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Cumulative progress required per item')	:attr('colspan', 7)	:done()
:done()
:tag('th')	:wikitext('Base')								:done()
:tag('th')	:wikitext('+1')									:done()
:tag('th')	:wikitext('+2')									:done()
:tag('th')	:wikitext('+3')									:done()
:tag('th')	:wikitext('+4')									:done()
:tag('th')	:wikitext('+5')									:done()
:tag('th')	:wikitext('Burial')								:done()
:done()

for index,i in ipairs(data.metals) do
	local img = i['img'..bbc]
	local maxcell = {}
	local progress = {}
	local progress_base = bbc * i.progress
	
	for x = 1,5,1 do
		if x == 1 then progress[1] = (progress_base * data.progress_mult[x]) + progress_base
		else progress[x] = (progress_base * data.progress_mult[x]) + progress[x-1] end
		if i.max > x - 1 then maxcell[x] = progress[x] else maxcell[x] = '-' end
	end
	
	local burial = '-'
	if i.burial == 1 then burial = progress[i.max] + ((progress_base * data.progress_mult[i.max])/2)  end

c:tag('tr')
:tag('td')	:wikitext(i.level)				:css('text-align', 'center')	:done()
:tag('td')	:wikitext(img..' '..i.name)										:done()
:tag('td')	:wikitext(fnum(progress_base))	:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[1]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[2]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[3]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[4]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[5]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(burial))			:css('text-align', 'center')	:done()
:done()
end
return tostring(t)..tostring(c)
end

function p.SmithingXPTable(frame)	-- Table for calculating smithing XP per item
	local args = frame:getParent().args
	local bbc = data.bbc[args.item]
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')						:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Metal')						:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('XP per item')				:attr('colspan', 7)	:done()
:done()
:tag('th')	:wikitext('Base')								:done()
:tag('th')	:wikitext('+1')									:done()
:tag('th')	:wikitext('+2')									:done()
:tag('th')	:wikitext('+3')									:done()
:tag('th')	:wikitext('+4')									:done()
:tag('th')	:wikitext('+5')									:done()
:tag('th')	:wikitext('Burial')								:done()
:done()
for index,i in ipairs(data.metals) do
	local img = i['img'..bbc]
	local maxcell = {}
	local xp = {}
	local xp_base = bbc * i.xp
	
	for x = 1,5,1 do
		xp[x] = xp_base * data.bar_mult[x]
		if i.max > x - 1 then maxcell[x] = xp[x] else maxcell[x] = '-' end
	end
	
	local burial = '-'
	if i.burial == 1 then burial = xp[i.max] end
t:tag('tr')
:tag('td')	:wikitext(i.level)				:css('text-align', 'center')	:done()
:tag('td')	:wikitext(img..' '..i.name)										:done()
:tag('td')	:wikitext(fnum(xp_base))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[1]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[2]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[3]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[4]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[5]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(burial))			:css('text-align', 'center')	:done()
:done()
end
local c = mw.html.create('table')
c:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')						:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Metal')						:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Cumulative XP per item')		:attr('colspan', 7)	:done()
:done()
:tag('th')	:wikitext('Base')								:done()
:tag('th')	:wikitext('+1')									:done()
:tag('th')	:wikitext('+2')									:done()
:tag('th')	:wikitext('+3')									:done()
:tag('th')	:wikitext('+4')									:done()
:tag('th')	:wikitext('+5')									:done()
:tag('th')	:wikitext('Burial')								:done()
:done()
for index,i in ipairs(data.metals) do
	local img = i['img'..bbc]
	local maxcell = {}
	local xp = {}
	local xp_base = bbc * i.xp
	
	for x = 1,5,1 do
		xp[x] = (xp_base * data.bar_mult[x]) * 2
		if i.max > x - 1 then maxcell[x] = xp[x] else maxcell[x] = '-' end
	end
	
	local burial = '-'
	if i.burial == 1 then burial = 1.5 * xp[i.max] end
c:tag('tr')
:tag('td')	:wikitext(i.level)				:css('text-align', 'center')	:done()
:tag('td')	:wikitext(img..' '..i.name)										:done()
:tag('td')	:wikitext(fnum(xp_base))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[1]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[2]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[3]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[4]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(maxcell[5]))		:css('text-align', 'center')	:done()
:tag('td')	:wikitext(fnum(burial))			:css('text-align', 'center')	:done()
:done()
end
return tostring(t)..tostring(c)
end

function p.PlusX(frame) -- Table for max +X
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')				:done()
:tag('th')	:wikitext('Metal')				:done()
:tag('th')	:wikitext('Number of upgrades')	:done()
:done()
for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.level)		:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.img..' '..i.name)							:done()
	:tag('td')	:wikitext('+'..i.max)	:css('text-align', 'center')	:done()
	:done()
end
return t
end

function p.ProgressXP(frame) -- Table for base progress and XP per bar
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')				:done()
:tag('th')	:wikitext('Metal')				:done()
:tag('th')	:wikitext('XP per bar')			:done()
:tag('th')	:wikitext('Progress per bar')	:done()
:done()
for index,i in ipairs(data.metals) do
	t:tag('tr')
	:tag('td')	:wikitext(i.level)			:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.img..' '..i.name)								:done()
	:tag('td')	:wikitext(fnum(i.xp))		:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(fnum(i.progress))	:css('text-align', 'center')	:done()
	:done()
end
return t
end

function p.BurialSets(frame) -- Table for burial sets
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Level')				:attr('rowspan', 2)		:done()
:tag('th')	:wikitext('Metal')				:attr('rowspan', 2)		:done()
:tag('th')	:wikitext('Progress required')	:attr('rowspan', 2)		:done()
:tag('th')	:wikitext('XP for individually<br>burying a set')	:attr('rowspan', 2)		:done()
:tag('th')	:wikitext('XP per burial set')	:attr('colspan', 6)		:done()
:done()
:tag('th')	:wikitext('Base')				:done()
:tag('th')	:wikitext('Solemn Smith I')		:done()
:tag('th')	:wikitext('Solemn Smith II')	:done()
:tag('th')	:wikitext('Solemn Smith III')	:done()
:tag('th')	:wikitext('Solemn Smith IV')	:done()
:tag('th')	:wikitext('Solemn Smith V')		:done()
:done()
for index,i in ipairs(data.metals) do
	if i.burial == 1 then
		local progress = ((data.progress_mult[i.max] * i.progress)/ 2) * data.burial_set
		local base = (data.bar_mult[i.max] * i.xp) * data.burial_set
		local xp_mult = 1 + data.burial_set_xp
		local xp_base = base * xp_mult
		local solemn = {}
		for x = 1,5,1 do
		solemn[x] = base * (xp_mult + (0.01 * x))
		end
	t:tag('tr')
	:tag('td')	:wikitext(i.level)			:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(i.img..' '..i.name)								:done()
	:tag('td')	:wikitext(fnum(progress))	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(fnum(base))	:css('text-align', 'center')		:done()
	:tag('td')	:wikitext(fnum(xp_base))	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(fnum(solemn[1]))	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(fnum(solemn[2]))	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(fnum(solemn[3]))	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(fnum(solemn[4]))	:css('text-align', 'center')	:done()
	:tag('td')	:wikitext(fnum(solemn[5]))	:css('text-align', 'center')	:done()
	:done()
	end
end
return t
end

function p.mwImmaculate1(frame)	-- Creation table for immaculate alloy bars (masterwork)
	local conc_string = ""		-- String for the concentrated alloy bar ingredient list
	for index,i in ipairs(data.metals) do conc_string = conc_string..'1 '..i.img..' '..i.name..'<br>' end
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')				:done()
:tag('th')	:wikitext('Ticks')				:done()
:tag('th')	:wikitext('Output')				:done()
:done()
:tag('tr')
:tag('td')	:wikitext(conc_string)													:done()
:tag('td')	:wikitext(data.mw_bar_conc)		:css('text-align', 'center')			:done()
:tag('td')	:wikitext('1 '..plink('Concentrated alloy bar'))						:done()
:done()
:tag('tr')
:tag('td')	:wikitext(data.mw_bar_enr_ing..plink('Concentrated alloy bar')..'s')	:done()
:tag('td')	:wikitext(data.mw_bar_enr)			:css('text-align', 'center')		:done()
:tag('td')	:wikitext('1 '..plink('Enriched alloy bar'))							:done()
:done()
:tag('tr')
:tag('td')	:wikitext(data.mw_bar_imm_ing..plink('Enriched alloy bar')..'s')		:done()
:tag('td')	:wikitext(data.mw_bar_imm)			:css('text-align', 'center')		:done()
:tag('td')	:wikitext('1 '..plink('Immaculate alloy bar'))							:done()
:done()
return t
end

function p.mwImmaculate2(frame)	-- Creation table for immaculate alloy bars (masterwork)
	local conc_string = ""		-- String for the concentrated alloy bar ingredient list
	for index,i in ipairs(data.metals) do conc_string = conc_string..(data.mw_bar_imm_ing*data.mw_bar_enr_ing)..' '..i.img..' '..i.name..'<br>' end
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')				:done()
:tag('th')	:wikitext('Ticks')				:done()
:tag('th')	:wikitext('Output')				:done()
:done()
:tag('tr')
:tag('td')	:wikitext(conc_string)																								:done()
:tag('td')	:wikitext((data.mw_bar_imm_ing*data.mw_bar_enr_ing) * data.mw_bar_conc)				:css('text-align', 'center')	:done()
:tag('td')	:wikitext((data.mw_bar_imm_ing*data.mw_bar_enr_ing)..plink('Concentrated alloy bar')..'s')							:done()
:done()
:tag('tr')
:tag('td')	:wikitext((data.mw_bar_imm_ing*data.mw_bar_enr_ing)..plink('Concentrated alloy bar')..'s')	:done()
:tag('td')	:wikitext(data.mw_bar_enr * data.mw_bar_imm_ing)	:css('text-align', 'center')			:done()
:tag('td')	:wikitext((data.mw_bar_enr_mult * data.mw_bar_enr_ing)..' Enriched alloy bars')				:done()
:done()
:tag('tr')
:tag('td')	:wikitext(data.mw_bar_imm_ing..' Enriched alloy bars')				:done()
:tag('td')	:wikitext(data.mw_bar_imm)			:css('text-align', 'center')	:done()
:tag('td')	:wikitext('1 Immaculate alloy bar')									:done()
:done()
:tag('tr')
:tag('th')	:wikitext('Total')											:done()
:tag('th')	:wikitext(data.mw_bar_imm_total)							:done()
:tag('th')	:wikitext(((data.mw_bar_imm_total * 0.6)/60)..' (minutes)')	:done()
return t
end

function p.mwImmaculate3(frame)	-- Creation table for immaculate alloy bars (masterwork)
	local conc_string = ""		-- String for the concentrated alloy bar ingredient list
	for index,i in ipairs(data.metals) do conc_string = conc_string..(data.mw_bar_imm_ing*data.mw_bar_enr_ing*12)..' '..i.img..' '..i.name..'<br>' end
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')				:done()
:tag('th')	:wikitext('Ticks')				:done()
:tag('th')	:wikitext('Output')				:done()
:done()
:tag('tr')
:tag('td')	:wikitext(conc_string)																									:done()
:tag('td')	:wikitext(data.mw_bar_imm_ing*data.mw_bar_enr_ing*12* data.mw_bar_conc)					:css('text-align', 'center')	:done()
:tag('td')	:wikitext((data.mw_bar_imm_ing*data.mw_bar_enr_ing*12)..' Concentrated alloy bar')										:done()
:done()
:tag('tr')
:tag('td')	:wikitext((data.mw_bar_imm_ing*data.mw_bar_enr_ing*12)..' Concentrated alloy bars')	:done()
:tag('td')	:wikitext(data.mw_bar_enr * data.mw_bar_imm_ing*12)	:css('text-align', 'center')	:done()
:tag('td')	:wikitext((12*data.mw_bar_imm_ing)..' Enriched alloy bars')							:done()
:done()
:tag('tr')
:tag('td')	:wikitext((12*data.mw_bar_imm_ing)..' Enriched alloy bars')				:done()
:tag('td')	:wikitext((12*data.mw_bar_imm))			:css('text-align', 'center')	:done()
:tag('td')	:wikitext('12 Immaculate alloy bars')									:done()
:done()
:tag('tr')
:tag('th')	:wikitext('Total')													:done()
:tag('th')	:wikitext(data.mw_bar_imm_total*12)									:done()
:tag('th')	:wikitext(((data.mw_bar_imm_total * 12 * 0.6)/60)..' (minutes)')	:done()
return t
end

function p.mwGlorious(frame)	-- Creation table for glorious bars (masterwork)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')	:done()
:tag('th')	:wikitext('Ticks')	:done()
:tag('th')	:wikitext('Output')	:done()
:done()
:tag('tr')
:tag('td')	:wikitext(plink('Immaculate alloy bar'))							:done()
:tag('td')	:wikitext(data.mw_bar_fold)			:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Folded alloy bar (0)')									:done()
:done()
:tag('tr')
:tag('td')	:wikitext('Folded alloy bar (X)')									:done()
:tag('td')	:wikitext(data.mw_bar_fold)			:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Folded alloy bar (X+1)')									:done()
:done()
:tag('tr')
:tag('td')	:wikitext('Folded alloy bar (0)')											:done()
:tag('td')	:wikitext(fnum(data.mw_bar_fold * 1000))	:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Folded alloy bar (1000)')										:done()
:done()
:tag('td')	:wikitext('Folded alloy bar (1000)')									:done()
:tag('td')	:wikitext(data.mw_bar_fold)				:css('text-align', 'center')	:done()
:tag('td')	:wikitext(plink('Glorious bar'))										:done()
:done()
:tag('tr')
:tag('th')	:wikitext('Total')									:done()
:tag('th')	:wikitext(fnum(data.mw_bar_glorious))				:done()
:tag('th')	:wikitext((data.mw_bar_glorious/100)..' (minutes)')	:done()
:done()
:tag('tr')
:tag('th')	:wikitext('Total for set')								:done()
:tag('th')	:wikitext(fnum(data.mw_bar_glorious*12))				:done()
:tag('th')	:wikitext((data.mw_bar_glorious*12/100/60)..' (hours)')	:done()
:done()
return t
end

function p.mwRivets(frame)	-- Creation table for rivets (masterwork)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')		:done()
:tag('th')	:wikitext('Progress')	:done()
:tag('th')	:wikitext('Output')		:done()
:tag('tr')
:tag('td')	:wikitext('1 '..plink('Steel bar'))										:done()
:tag('td')	:wikitext(data.mw_rivets)				:css('text-align', 'center')	:done()
:tag('td')	:wikitext(data.mw_rivets_amount..' '..plink('Masterwork rivets'))		:done()
:tag('tr')
:tag('td')	:wikitext('12 '..plink('Steel bar')..'s')								:done()
:tag('td')	:wikitext(12*data.mw_rivets)			:css('text-align', 'center')	:done()
:tag('td')	:wikitext(12*data.mw_rivets_amount..' '..plink('Masterwork rivets'))	:done()
:done()
return t
end

function p.mwLined1(frame)	-- Creation table for lined pieces (masterwork; progress half)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')		:done()
:tag('th')	:wikitext('Progress')	:done()
:tag('th')	:wikitext('Output')		:done()
:tag('tr')
:tag('td')	:wikitext(plink('Glorious bar'))													:done()
:tag('td')	:wikitext(fnum(data.mw_mw_plate))			:css('text-align', 'center')			:done()
:tag('td')	:wikitext(plink('Masterwork plate'))												:done()
:tag('tr')
:tag('td')	:wikitext(plink('Masterwork plate'))												:done()
:tag('td')	:wikitext(fnum(data.mw_curved_plate))		:css('text-align', 'center')			:done()
:tag('td')	:wikitext(plink('Curved masterwork plate'))											:done()
:tag('tr')
:tag('td')	:wikitext(plink('Curved masterwork plate'))											:done()
:tag('td')	:wikitext(fnum(data.mw_untempered))			:css('text-align', 'center')			:done()
:tag('td')	:wikitext(plink('Untempered masterwork armour piece'))								:done()
:tag('tr')
:tag('th')	:wikitext('Total progress')															:done()
:tag('th')	:wikitext(fnum(data.mw_mw_plate + data.mw_curved_plate + data.mw_untempered))		:done()
:tag('tr')
:tag('th')	:wikitext('Total progress for set')													:done()
:tag('th')	:wikitext(fnum(12*(data.mw_mw_plate + data.mw_curved_plate + data.mw_untempered)))	:done()
return t
end

function p.mwLined2(frame)	-- Creation table for lined pieces (masterwork; ticks and dragon forge part)
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')		:done()
:tag('th')	:wikitext('Ticks')		:done()
:tag('th')	:wikitext('Output')		:done()
:tag('tr')
:tag('td')	:wikitext(plink('Untempered masterwork armour piece'))											:done()
:tag('td')	:wikitext(data.mw_armour_piece)									:css('text-align', 'center')	:done()
:tag('td')	:wikitext(plink('Masterwork armour piece'))														:done()
:tag('tr')
:tag('td')	:wikitext(plink('Masterwork armour piece')..'<br>'..plink('Leather'))							:done()
:tag('td')	:wikitext(data.mw_lined)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext(plink('Lined masterwork armour piece'))												:done()
:tag('tr')
:tag('th')	:wikitext('Total')																				:done()
:tag('th')	:wikitext(fnum(data.mw_armour_piece + data.mw_lined))											:done()
:tag('th')	:wikitext(((data.mw_armour_piece + data.mw_lined)/100)..' (minutes)')							:done()
:tag('tr')
:tag('th')	:wikitext('Total for set')																		:done()
:tag('th')	:wikitext(fnum(12 * (data.mw_armour_piece + data.mw_lined)))									:done()
:tag('th')	:wikitext((12 * (data.mw_armour_piece + data.mw_lined)/100)..' (minutes)')						:done()
return t
end

function p.mwHelmet(frame)	-- Creation table masterwork helmet
local bbc = 2
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')		:done()
:tag('th')	:wikitext('Ticks')		:done()
:tag('th')	:wikitext('Output')		:done()
:tag('tr')
:tag('td')	:wikitext(bbc..' Lined masterwork armour pieces')														:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished masterwork helmet (0)')															:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished masterwork helmet (X)<br>1 masterwork rivet')										:done()
:tag('td')	:wikitext(data.mw_unfinished)											:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished masterwork helmet (X+1)')															:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished masterwork helmet (0)<br>'..(data.mw_riveting * bbc)..' masterwork rivets')		:done()
:tag('td')	:wikitext(data.mw_unfinished * data.mw_riveting * bbc)					:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished masterwork helmet (20)')															:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished masterwork helmet (20)')															:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext(plink('Masterwork helm'))																		:done()
:tag('tr')
:tag('th')	:wikitext('Total')												:done()
:tag('th')	:wikitext(fnum(bbc * data.mw_unf_total))						:done()
:tag('th')	:wikitext((fnum(bbc * data.mw_unf_total)/100)..' (minutes)')	:done()
return t
end

function p.mwBody(frame)	-- Creation table masterwork platebody
local bbc = 5
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')		:done()
:tag('th')	:wikitext('Ticks')		:done()
:tag('th')	:wikitext('Output')		:done()
:tag('tr')
:tag('td')	:wikitext(bbc..' Lined masterwork armour pieces')														:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished masterwork platebody (0)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished masterwork platebody (X)<br>1 masterwork rivet')									:done()
:tag('td')	:wikitext(data.mw_unfinished)											:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished masterwork platebody (X+1)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished masterwork platebody (0)<br>'..(data.mw_riveting * bbc)..' masterwork rivets')	:done()
:tag('td')	:wikitext(data.mw_unfinished * data.mw_riveting * bbc)					:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished masterwork platebody (50)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished masterwork platebody (50)')														:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext(plink('Masterwork platebody'))																:done()
:tag('tr')
:tag('th')	:wikitext('Total')												:done()
:tag('th')	:wikitext(fnum(bbc * data.mw_unf_total))						:done()
:tag('th')	:wikitext((fnum(bbc * data.mw_unf_total)/100)..' (minutes)')	:done()
return t
end

function p.mwLegs(frame)	-- Creation table masterwork platelegs
local bbc = 3
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')		:done()
:tag('th')	:wikitext('Ticks')		:done()
:tag('th')	:wikitext('Output')		:done()
:tag('tr')
:tag('td')	:wikitext(bbc..' Lined masterwork armour pieces')														:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork platelegs (0)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork platelegs (X)<br>1 masterwork rivet')									:done()
:tag('td')	:wikitext(data.mw_unfinished)											:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork platelegs (X+1)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork platelegs (0)<br>'..(data.mw_riveting * bbc)..' masterwork rivets')	:done()
:tag('td')	:wikitext(data.mw_unfinished * data.mw_riveting * bbc)					:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork platelegs (30)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork platelegs (30)')														:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext(plink('Masterwork platelegs'))																:done()
:tag('tr')
:tag('th')	:wikitext('Total')												:done()
:tag('th')	:wikitext(fnum(bbc * data.mw_unf_total))						:done()
:tag('th')	:wikitext((fnum(bbc * data.mw_unf_total)/100)..' (minutes)')	:done()
return t
end

function p.mwGloves(frame)	-- Creation table masterwork gauntlets
local bbc = 1
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')		:done()
:tag('th')	:wikitext('Ticks')		:done()
:tag('th')	:wikitext('Output')		:done()
:tag('tr')
:tag('td')	:wikitext(bbc..' Lined masterwork armour pieces')														:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork gauntlets (0)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork gauntlets (X)<br>1 masterwork rivet')									:done()
:tag('td')	:wikitext(data.mw_unfinished)											:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork gauntlets (X+1)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork gauntlets (0)<br>'..(data.mw_riveting * bbc)..' masterwork rivets')	:done()
:tag('td')	:wikitext(data.mw_unfinished * data.mw_riveting * bbc)					:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork gauntlets (10)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork gauntlets (10)')														:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext(plink('Masterwork gloves'))																	:done()
:tag('tr')
:tag('th')	:wikitext('Total')												:done()
:tag('th')	:wikitext(fnum(bbc * data.mw_unf_total))						:done()
:tag('th')	:wikitext((fnum(bbc * data.mw_unf_total)/100)..' (minutes)')	:done()
return t
end

function p.mwBoots(frame)	-- Creation table masterwork boots
local bbc = 1
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Input')		:done()
:tag('th')	:wikitext('Ticks')		:done()
:tag('th')	:wikitext('Output')		:done()
:tag('tr')
:tag('td')	:wikitext(bbc..' Lined masterwork armour pieces')														:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork boots (0)')															:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork boots (X)<br>1 masterwork rivet')										:done()
:tag('td')	:wikitext(data.mw_unfinished)											:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork boots (X+1)')															:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork boots (0)<br>'..(data.mw_riveting * bbc)..' masterwork rivets')		:done()
:tag('td')	:wikitext(data.mw_unfinished * data.mw_riveting * bbc)					:css('text-align', 'center')	:done()
:tag('td')	:wikitext('Unfinished Masterwork boots (10)')														:done()
:tag('tr')
:tag('td')	:wikitext('Unfinished Masterwork boots (10)')															:done()
:tag('td')	:wikitext(data.mw_unfinished * bbc)										:css('text-align', 'center')	:done()
:tag('td')	:wikitext(plink('Masterwork boots'))																			:done()
:tag('tr')
:tag('th')	:wikitext('Total')												:done()
:tag('th')	:wikitext(fnum(bbc * data.mw_unf_total))						:done()
:tag('th')	:wikitext((fnum(bbc * data.mw_unf_total)/100)..' (minutes)')	:done()
return t
end

function p.mwMalevolent(frame)	-- Malevolent essence table
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Item')				:done()
:tag('th')	:wikitext('Ticks')				:done()
:tag('th')	:wikitext('Essence')			:done()
:tag('th')	:wikitext('Price per essence')	:done()
for index,i in ipairs(data.malevolent) do
t:tag('tr')
:tag('td')	:wikitext(i.name)													:done()
:tag('td')	:wikitext(i.bbc * data.tmw_essence)	:css('text-align', 'center')	:done()
:tag('td')	:wikitext(i.bbc)					:css('text-align', 'center')	:done()
:tag('td')	:wikitext(coins._amount(math.ceil(i.price/i.bbc)))					:done()
end
t:tag('tr')
:tag('th')	:wikitext('Total')													:done()
:tag('th')	:wikitext(data.tmw_essence * 12)									:done()
:tag('th')	:wikitext('12')														:done()
:tag('th')	:wikitext(coins._amount(math.ceil(data.malevolent_min * 12)))		:done()
return t
end

function p.mwTorva(frame)	-- Praesulic essence table
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Item')				:done()
:tag('th')	:wikitext('Ticks')				:done()
:tag('th')	:wikitext('Essence')			:done()
:tag('th')	:wikitext('Price per essence')	:done()
for index,i in ipairs(data.torva) do
t:tag('tr')
:tag('td')	:wikitext(i.name)													:done()
:tag('td')	:wikitext(i.bbc * data.tmw_essence)	:css('text-align', 'center')	:done()
:tag('td')	:wikitext(i.bbc)					:css('text-align', 'center')	:done()
:tag('td')	:wikitext(coins._amount(math.ceil(i.price/i.bbc)))					:done()
end
t:tag('tr')
:tag('th')	:wikitext('Total')													:done()
:tag('th')	:wikitext(data.tmw_essence * 12)									:done()
:tag('th')	:wikitext('12')														:done()
:tag('th')	:wikitext(coins._amount(math.ceil(data.torva_min * 12)))			:done()
return t
end

function p.Tokens(frame)	-- Token cost for each piece of equipment
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Item')	:done()
:tag('th')	:wikitext('Tokens')	:done()
for index,i in ipairs(data.tokens) do
	local name = i.name:gsub("(%a)([%w_']*)", title)
t:tag('tr')
:tag('td')	:wikitext(name)										:done()
:tag('td')	:wikitext(i.tokens)	:css('text-align', 'center')	:done()
:done()
end
return t
end

function p.TokenValue(frame)	-- Value at each tier, per token
local t = mw.html.create('table')
t:addClass('wikitable')
:tag('tr')
:tag('th')	:wikitext('Tier')	:done()
:tag('th')	:wikitext('Value')	:done()
for i = 1,4,1 do
	local tiny = 10
	local alch = data.salvage['tier'][data.token_tiers[i]]['alch'] / tiny
t:tag('tr')
:tag('td')	:wikitext(data.token_tiers[i])	:done()
:tag('td')	:wikitext(coins._amount(alch))	:done()
end
return t
end

function p.TokenCalc(frame)	-- Token value calculator
	local args = frame:getParent().args
	local tier = tostring(args.tier)
local t = mw.html.create('table')
t:addClass('wikitable sortable')
:tag('tr')
:tag('th')	:wikitext('Item')				:done()
:tag('th')	:wikitext('GE price')			:done()
:tag('th')	:wikitext('Value in tokens')	:done()
:tag('th')	:wikitext('Profit')				:done()
:tag('th')	:wikitext('% profit')			:done()

for index,i in ipairs(data.tokens) do
	name = tier..' '..i.name
	price = gemw.price(name)
	value = (data.salvage['tier'][tier]['alch'] / 10) * i.tokens
	profit = value - price
	perc = (profit / price) * 100
t:tag('tr')
:tag('td')	:wikitext('[[File:'..name..'.png]] [['..name..']]')							:done()
:tag('td')	:wikitext(coins._amount(price))												:done()
:tag('td')	:wikitext(coins._amount(value))												:done()
:tag('td')	:wikitext(coins._amount(profit))											:done()
:tag('td')	:wikitext((math.floor(100*perc)/100)..'%')	:css('text-align', 'center')	:done()
end
return t
end

function p.TokenCalcIM(frame)	-- Token value IM calculator
	local args = frame:getParent().args
	local tier = tostring(args.tier)
	local nat = 372
local t = mw.html.create('table')
t:addClass('wikitable sortable')
:tag('tr')
:tag('th')	:wikitext('Item')												:attr('rowspan', 2)	:done()
:tag('th')	:wikitext('Assuming [[File:Nature rune.png|link=]] is free')	:attr('colspan', 4)	:done()
:tag('th')	:wikitext('Store bought [[File:Nature rune.png|link=]]')		:attr('colspan', 4)	:done()
:tag('tr')
:tag('th')	:wikitext('High Alch')			:done()
:tag('th')	:wikitext('Value in tokens')	:done()
:tag('th')	:wikitext('Profit')				:done()
:tag('th')	:wikitext('% profit')			:done()
:tag('th')	:wikitext('High Alch')			:done()
:tag('th')	:wikitext('Value in tokens')	:done()
:tag('th')	:wikitext('Profit')				:done()
:tag('th')	:wikitext('% profit')			:done()

for index,i in ipairs(data.tokens) do
	name = tier..' '..i.name
	price = math.floor(gemw.load({args = {name, 'value'}}) * 0.6)
	value = (data.salvage['tier'][tier]['alch'] / 10) * i.tokens
	profit = value - price
	perc = (profit / price) * 100
	price_nat = price - nat
	value_nat = value - (nat / (50 / i.tokens))
	profit_nat =  value_nat - price_nat
	perc_nat = (profit_nat / price_nat ) * 100
	
t:tag('tr')
:tag('td')	:wikitext('[[File:'..name..'.png]] [['..name..']]')							:done()
:tag('td')	:wikitext(coins._amount(price))												:done()
:tag('td')	:wikitext(coins._amount(value))												:done()
:tag('td')	:wikitext(coins._amount(profit))											:done()
:tag('td')	:wikitext((math.floor(100*perc)/100)..'%')	:css('text-align', 'center')	:done()
:tag('td')	:wikitext(coins._amount(price_nat))												:done()
:tag('td')	:wikitext(coins._amount(value_nat))												:done()
:tag('td')	:wikitext(coins._amount(profit_nat))											:done()
:tag('td')	:wikitext((math.floor(100*perc_nat)/100)..'%')	:css('text-align', 'center')	:done()
end
return t
end

return p