Module:Skills/Gathering/Sandbox: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 295: Line 295:
end
end
local resultPart = {}
local html = mw.html.create('table')
table.insert(resultPart, '{|class="wikitable sortable"')
:addClass('wikitable sortable')
table.insert(resultPart, '\n|- class="headerRow-0"')
table.insert(resultPart, '\n!colspan=2|Gem!!Gem Chance!!Gem Price')


-- Add header row
local headerRow = html:tag('tr'):addClass('headerRow-0')
:tag('th'):wikitext('Gem')
  :attr('colspan', '2')
:tag('th'):wikitext('[[DLC]]')
:tag('th'):wikitext('Gem Chance')
:tag('th'):wikitext('Gem Price')
-- Add gem rows
for i, gem in ipairs(gemData) do
for i, gem in ipairs(gemData) do
local gemItem = Items.getItemByID(gem.itemID)
local gemItem = Items.getItemByID(gem.itemID)
local gemPct = gem.weight / totalWeight * 100
local gemPct = gem.weight / totalWeight * 100
table.insert(resultPart, '\n|-\n|class="table-img"| ')
local row = html:tag('tr')
table.insert(resultPart, Icons.Icon({gemItem.name, type='item', notext=true}))
 
table.insert(resultPart, '\n| data-sort-value="'..gemItem.name..'"|'..Icons.getDLCColumnIcon(gemItem.id) .. Icons.Icon({gemItem.name, type='item', noicon=true}))
row:tag('td'):addClass('table-img')
table.insert(resultPart, '\n|style="text-align:right" data-sort-value="' .. gemPct .. '" | ' .. string.format("%.1f%%", gemPct))
:wikitext(Icons.Icon({gemItem.name, type='item', notext=true}))
table.insert(resultPart, '\n|data-sort-value="' .. gemItem.sellsFor .. '"| ' .. Items.getValueText(gemItem))
row:tag('td'):attr('data-sort-value', gemItem.name)
:wikitext('[[' .. gemItem.name ..']]')
row:tag('td'):wikitext(Icons.getDLCColumnIcon(gemItem.id))
:attr('data-sort-value', Icons.getExpansionID(gemItem.id))
:css('text-align', 'center')
row:tag('td'):css('text-align', 'right')
:attr('data-sort-value', gemPct)
:wikitext(string.format("%.1f%%", gemPct))
row:tag('td'):attr('data-sort-value', gemItem.sellsFor)
    :wikitext(Items.getValueText(gemItem))
end
end


table.insert(resultPart, '\n|}')
return tostring(html)
return table.concat(resultPart)
end
end


2,875

edits