4,687
edits
(Fixed testDiscoveryRewards) |
(Cleanup) |
||
Line 125: | Line 125: | ||
end | end | ||
return rewardTable | return rewardTable | ||
end | |||
function p.sortPOIByCoords(array) | |||
table.sort(array, function(a, b) | |||
local aX, aY = p.convertAxialToXY(a.coords) | |||
local bX, bY = p.convertAxialToXY(b.coords) | |||
if aX ~= bX then | |||
return aX < bX | |||
else | |||
return aY < bY | |||
end | |||
end) | |||
return array | |||
end | end | ||
Line 137: | Line 150: | ||
table.insert(POIs, POI) | table.insert(POIs, POI) | ||
end | end | ||
POIs = p.sortPOIByCoords(POIs) | |||
for i, POI in pairs(POIs) do | for i, POI in pairs(POIs) do | ||
Line 215: | Line 220: | ||
end | end | ||
POIs = p.sortPOIByCoords(POIs) | |||
-- Build the table | -- Build the table | ||
local resultTable = mw.html.create('table') | local resultTable = mw.html.create('table') | ||
resultTable:addClass('wikitable | resultTable:addClass('wikitable sortable') | ||
resultTable:tag('tr'):addClass('headerRow-0') | resultTable:tag('tr'):addClass('headerRow-0') | ||
:tag('th'):wikitext('Point of Interest' | :tag('th'):wikitext('Point of Interest') | ||
:tag('th'):wikitext('X' | :tag('th'):wikitext('X') | ||
:tag('th'):wikitext('Y' | :tag('th'):wikitext('Y') | ||
:tag('th'):wikitext('Requirements' | :tag('th'):wikitext('Requirements') | ||
:tag('th'):wikitext('Discovery Rewards' | :tag('th'):wikitext('Discovery Rewards') | ||
for _, POI in ipairs(POIs) do | for _, POI in ipairs(POIs) do |