Module:Sandbox/User:Artoire/1: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
mNo edit summary
mNo edit summary
Line 199: Line 199:
local result = mw.html.create()
local result = mw.html.create()


result:wikitext(('To get from %s xp (level %s) to %s xp (level %s) requires %s experience'):format(current_xp, current_lvl, target_xp, target_lvl, remaining_xp))
result:wikitext(('To get from %s xp (level %s) to %s xp (level %s) requires %s experience'):format(lang:formatNum(current_xp), current_lvl, lang:formatNum(target_xp), target_lvl, lang:formatNum(remaining_xp)))


local tbl = result:tag('table')
local tbl = result:tag('table')
Line 208: Line 208:
end
end
local colspan = 24
local colspan = 23
if chopping_logs then
if chopping_logs then
colspan = colspan + 4
colspan = colspan + 4
Line 217: Line 217:


tbl
tbl
:tr()
:tag('tr')
:th(skillclickpic('Miner')):done()
:th(skillclickpic('Miner')):done()
:th{ 'Ore', attr = { colspan = '3' } }:done()
:th{ 'Ore', attr = { colspan = '3' } }:done()
:th(skillclickpic('Blacksmith')):done()
:th{ 'Ingot', attr = { colspan = '2' } }:done()
:th{ 'Ingot', attr = { colspan = '3' } }:done()
:IF(chopping_logs)
:IF(chopping_logs)
:th(skillclickpic('Woodcutter'))
:th(skillclickpic('Woodcutter')):done()
:th{ 'Log', attr = { colspan = '3' } }:done()
:th{ 'Log', attr = { colspan = '3' } }:done()
:th()
:END()
:IF(chopping_logs or buying_logs)
:IF(chopping_logs or buying_logs)
:th(skillclickpic('Carpenter'))
:th(skillclickpic('Carpenter')):done()
:DONE()
:END()
:th{ 'Pole', attr = { colspan = '3' } }:done()
:th{ 'Pole', attr = { colspan = '3' } }:done()
:th(skillclickpic('Blacksmith')):done()
:th{ 'Product', attr = { colspan = '3' } }:done()
:th{ 'Product', attr = { colspan = '3' } }:done()
:th{ 'Cost', attr = { colspan = '10' } }:done()
:th{ 'Cost', attr = { colspan = '10' } }:done()
:done()
:done()


for _, weapon in lookup_weapons()[ingot.name] do
for _, weapon in ipairs(lookup_weapons()[ingot.ingot]) do
if not ingot.xp then
if not ingot.xp then
tbl
tbl
:tr()
:tr()
:td{
:td{
'Missing XP for smelting [[' .. ingot.name .. ']]; Please [' .. mw.uri.fullUrl(ingot.name, 'action=edit&section=1') .. ' edit the page] to add the experience earned (after |exp =)',
'Missing XP for smelting [[' .. ingot.ingot .. ']]; Please [' .. mw.uri.fullUrl(ingot.ingot, 'action=edit&section=1') .. ' edit the page] to add the experience earned (after |exp =)',
attr = { colspan = colspan }
attr = { colspan = colspan }
}
}
Line 260: Line 260:
local needed_ores = needed * weapon.ingot.quantity
local needed_ores = needed * weapon.ingot.quantity
local row = tbl
local row = tbl
:tr()
:tag('tr')
:td(lookup_ore(ingot.ore).level)
:td(lookup_ore(ingot.ore).level):done()
:td{ needed_ores .. '×', css = { ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right', ['data-sort-value'] = needed_ores } }
:td{ needed_ores .. '×', css = { ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right', ['data-sort-value'] = needed_ores } }:done()
:td{ ('[[File:%s.png|link=%s|30px]]'):format(ingot.ore), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border' }
:td{ ('[[File:%s.png|link=%s|30px]]'):format(ingot.ore, ingot.ore), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border' }:done()
:td{ '[[' .. ingot.ore .. ']]', addClass = 'plinkt-link no-border' }
:td{ '[[' .. ingot.ore .. ']]', addClass = 'plinkt-link no-border' }:done()
:td{ ('[[File:%s.png|link=%s|30px]]'):format(ingot.ingot, ingot.ingot), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border', ['data-sort-value'] = needed_ores }:done()
:td{ '[[' .. ingot.ingot .. ']]', addClass = 'plinkt-link no-border' }:done()


local pole_info
local pole_info
Line 275: Line 277:
needed_logs = math.ceil(needed_poles / 2)
needed_logs = math.ceil(needed_poles / 2)
row
row
:td(lookup_log(pole_info.log).level)
:td(lookup_log(pole_info.log).level):done()
:td{ needed_logs .. '×', css = { ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right' }, attr = { ['data-sort-value'] = needed_logs } }
:td{ needed_logs .. '×', css = { ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right' }, attr = { ['data-sort-value'] = needed_logs } }:done()
:td{ ('[[File:%s.png|link=%s|30px]]'):format(pole_info.log), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border' }
:td{ ('[[File:%s.png|link=%s|30px]]'):format(pole_info.log, pole.log), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border' }:done()
:td{ '[[' .. pole_info.log .. ']]', addClass = 'plinkt-link no-border' }
:td{ '[[' .. pole_info.log .. ']]', addClass = 'plinkt-link no-border' }:done()
end
end
if chopping_logs or buying_logs then
if chopping_logs or buying_logs then
pole_info = pole_info or lookup_pole(weapon.pole.name)
pole_info = pole_info or lookup_pole(weapon.pole.name)
row
row
:td(pole_info.level)
:td(pole_info.level):done()
end
end


row
row
:td{ needed_poles .. '×', css = { ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right' }, attr = { ['data-sort-value'] = needed_poles } }
:td{ needed_poles .. '×', css = { ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right' }, attr = { ['data-sort-value'] = needed_poles } }:done()
:td{ ('[[File:%s.png|link=%s|30px]]'):format(weapon.pole.name), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border' }
:td{ ('[[File:%s.png|link=%s|30px]]'):format(weapon.pole.name, weapon.pole.name), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border' }:done()
:td{ '[[' .. weapon.pole.name .. ']]', addClass = 'plinkt-link no-border' }
:td{ '[[' .. weapon.pole.name .. ']]', addClass = 'plinkt-link no-border' }:done()
else
else
if chopping_logs then
if chopping_logs then
row
row
:na()
:na()
:td{ '<small>N/A</small>', addClass = 'table-na', attr = { ['data-sort-value'] = '0', colspan = '3' } }
:td{ '<small>N/A</small>', addClass = 'table-na', attr = { ['data-sort-value'] = '0', colspan = '3' } }:done()
end
end
if chopping_logs or buying_logs then
if chopping_logs or buying_logs then
Line 301: Line 303:
end
end
row
row
:td{ '<small>N/A</small>', addClass = 'table-na', attr = { ['data-sort-value'] = '0', colspan = '3' } }
:td{ '<small>N/A</small>', addClass = 'table-na', attr = { ['data-sort-value'] = '0', colspan = '3' } }:done()
end
end


row
row
:td(weapon.level)
:td{ needed .. '&times;', css = { ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right' }, attr = { ['data-sort-value'] = needed } }
:td{ ('[[File:%s.png|link=%s|30px]]'):format(weapon.name), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border' }
:td{ needed .. '&times;', css = { ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right' }, attr = { ['data-sort-value'] = needed } }:done()
:td{ ('[[File:%s.png|link=%s|30px]]'):format(weapon.name, weapon.name), css = { ['border-left'] = '0', ['padding-left'] = '0' }, addClass = 'plinkt-image no-border' }:done()
:td{ '[[' .. weapon.name .. ']]', addClass = 'plinkt-link no-border' }
:td{ '[[' .. weapon.name .. ']]', addClass = 'plinkt-link no-border' }


Line 322: Line 325:
end
end


row:node(currency._cell(amount, { html = 'yes' }))
row:node(currency._cell(cost, { html = 'yes' }))
end
end