Module:Skills/Gathering/Sandbox: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 444: Line 444:
local skillID = 'Fishing'
local skillID = 'Fishing'


local result = '{| class="wikitable sortable stickyHeader"'
local html = mw.html.create('table')
result = result..'\r\n|- class="headerRow-0"'
html:addClass('wikitable sortable stickyHeader')
result = result..'\r\n!Name\r\n!Fish\r\n!Fish Chance'
result = result..'\r\n!Junk Chance\r\n!Special Chance'


local fishAreas = GameData.getEntities(SkillData.Fishing.areas,
-- Add header row
function(obj)
local headerRow = html:tag('tr'):addClass('headerRow-0')
return Skills.getRecipeRealm(obj) == realm.id
headerRow:tag('th'):wikitext('Name')
end
headerRow:tag('th'):wikitext('Fish')
)
headerRow:tag('th'):wikitext('[[DLC]]')
headerRow:tag('th'):wikitext('Fish Chance')
headerRow:tag('th'):wikitext('Junk Chance')
headerRow:tag('th'):wikitext('Special Chance')
 
-- Get fishing areas
local fishAreas = GameData.getEntities(SkillData.Fishing.areas, function(obj)
return Skills.getRecipeRealm(obj) == realm.id
end)


-- Add rows for each fishing area
for i, area in ipairs(fishAreas) do
for i, area in ipairs(fishAreas) do
result = result..'\r\n|-'
local row = html:tag('tr')
result = result..'\r\n| style ="text-align: left;" |'..Icons.getDLCColumnIcon(area.id)..area.name
row:tag('td')
:css('text-align', 'left')
:wikitext(Icons.getDLCColumnIcon(area.id) .. area.name)


local fishArray = {}
local fishArray = {}
Line 466: Line 475:
end
end
end
end
result = result..'\r\n|'..table.concat(fishArray, '<br/>')
row:tag('td')
 
:wikitext(table.concat(fishArray, '<br/>'))
result = result..'\r\n| style="text-align:right"|'..area.fishChance..'%'
row:tag('td')
result = result..'\r\n| style="text-align:right"|'..area.junkChance..'%'
:css('text-align', 'center')
result = result..'\r\n| style="text-align:right"|'..area.specialChance..'%'
:wikitext(Icons.getDLCColumnIcon(area.id))
:attr('data-sort-value', Icons.getExpansionID(area.id))
row:tag('td')
:css('text-align', 'right')
:wikitext(area.fishChance .. '%')
row:tag('td')
:css('text-align', 'right')
:wikitext(area.junkChance .. '%')
row:tag('td')
:css('text-align', 'right')
:wikitext(area.specialChance .. '%')
end
end


result = result..'\r\n|}'
return tostring(html)
return result
end
end


function p.getThievingGeneralRareTable(frame)
function p.getThievingGeneralRareTable(frame)
2,875

edits