2,875
edits
No edit summary |
No edit summary |
||
Line 1,015: | Line 1,015: | ||
function p.getFarmingFoodTable(frame) | function p.getFarmingFoodTable(frame) | ||
local root = mw.html.create('table') | |||
:addClass('wikitable sortable stickyHeader') | |||
-- Header row | |||
local headerRow = root:tag('tr') | |||
:addClass('headerRow-0') | |||
headerRow:tag('th'):attr('colspan', '2'):wikitext('Crop') | |||
headerRow:tag('th'):wikitext(Icons.Icon({"Farming", type="skill", notext=true}) .. '<br>Level') | |||
headerRow:tag('th'):wikitext('[[DLC]]') | |||
headerRow:tag('th'):wikitext('Healing') | |||
headerRow:tag('th'):wikitext('Value') | |||
local recipes = GameData.getEntities(SkillData.Farming.recipes, | |||
function(recipe) | |||
local product = Items.getItemByID(recipe.productId) | |||
return product ~= nil and product.healsFor ~= nil and product.healsFor > 0 | |||
end | |||
) | |||
table.sort(recipes, function(a, b) return a.level < b.level end) | |||
for i, recipe in ipairs(recipes) do | |||
local product = Items.getItemByID(recipe.productId) | |||
if product and product.healsFor and product.healsFor > 0 then | |||
local row = root:tag('tr') | |||
row:tag('td'):wikitext(Icons.Icon({product.name, type='item', notext='true'})) | |||
row:tag('td'):wikitext('[[' .. product.name .. ']]') | |||
row:tag('td'):css('text-align', 'center') | |||
:wikitext(recipe.level) | |||
row:tag('td'):css('text-align', 'center') | |||
:attr('data-sort-value', Icons.getExpansionID(product.id)) | |||
:wikitext(Icons.getDLCColumnIcon(product.id)) | |||
row:tag('td'):css('text-align', 'right') | |||
:attr('data-sort-value', product.healsFor) | |||
:wikitext(Icons.Icon({"Hitpoints", type="skill", notext=true}) .. ' ' .. (product.healsFor * 10)) | |||
row:tag('td'):css('text-align', 'right') | |||
:attr('data-sort-value', product.sellsFor) | |||
:wikitext(Items.getValueText(product)) | |||
end | |||
end | |||
return tostring(root) | |||
end | |||
function p.getFarmingPlotTable(frame) | function p.getFarmingPlotTable(frame) |
edits