2,875
edits
No edit summary |
No edit summary |
||
Line 514: | Line 514: | ||
function p.getFiremakingTable(frame) | function p.getFiremakingTable(frame) | ||
local args = frame.args ~= nil and frame.args or frame | |||
local realmName = args.realm | |||
local realm = p.getRealmFromName(realmName) | |||
if realm == nil then | |||
return Shared.printError('Failed to find a realm with name ' .. (realmName or 'nil')) | |||
end | |||
local skillID = 'Firemaking' | |||
local tableHtml = mw.html.create('table') | |||
:addClass('wikitable sortable stickyHeader') | |||
local headerRow0 = tableHtml:tag('tr'):addClass('headerRow-0') | |||
headerRow0:tag('th'):attr('colspan', '2') | |||
:attr('rowspan', '2') | |||
:wikitext('Logs') | |||
headerRow0:tag('th'):attr('rowspan', '2') | |||
:wikitext('Requirements') | |||
headerRow0:tag('th'):attr('rowspan', '2') | |||
:wikitext('Burn Time') | |||
headerRow0:tag('th'):attr('colspan', '2') | |||
:wikitext('Without Bonfire') | |||
headerRow0:tag('th'):attr('colspan', '2') | |||
:wikitext('With Bonfire') | |||
headerRow0:tag('th'):attr('rowspan', '2') | |||
:wikitext('Bonfire Bonus') | |||
headerRow0:tag('th'):attr('rowspan', '2') | |||
:wikitext('Bonfire Time') | |||
local headerRow1 = tableHtml:tag('tr'):addClass('headerRow-1') | |||
headerRow1:tag('th'):wikitext('XP') | |||
headerRow1:tag('th'):wikitext('XP/s') | |||
headerRow1:tag('th'):wikitext('XP') | |||
headerRow1:tag('th'):wikitext('XP/s') | |||
local logsData = GameData.getEntities(SkillData.Firemaking.logs, function(obj) | |||
return p.getRecipeRealm(obj) == realm.id | |||
end) | |||
table.sort(logsData, function(a, b) return p.standardRecipeSort(skillID, a, b) end) | |||
for i, logData in ipairs(logsData) do | |||
local logs = Items.getItemByID(logData.logID) | |||
local name = logs.name | |||
local level = p.getRecipeLevel(skillID, logData) | |||
local baseXP = logData.baseAbyssalExperience or logData.baseExperience | |||
local reqText = p.getRecipeRequirementText(SkillData.Firemaking.name, logData) | |||
local bonfireBonus = logData.bonfireAXPBonus or logData.bonfireXPBonus | |||
local burnTime = logData.baseInterval / 1000 | |||
local bonfireTime = logData.baseBonfireInterval / 1000 | |||
local XPS = baseXP / burnTime | |||
local XP_BF = baseXP * (1 + bonfireBonus / 100) | |||
local XPS_BF = Num.round(XP_BF / burnTime, 2, 2) | |||
XP_BF = Num.round(XP_BF, 2, 0) | |||
local row = tableHtml:tag('tr') | |||
row:tag('td'):attr('data-sort-value', name) | |||
:wikitext('[[File:' .. name .. '_(skill).svg|25x25px|link=' .. name .. ']]') | |||
row:tag('td'):wikitext(Icons.getExpansionIcon(logs.id) .. '[[File:' .. name .. '_(skill).svg|25x25px|link=' .. name .. ']]') | |||
row:tag('td'):attr('style', 'text-align: right;') | |||
:attr('data-sort-value', level) | |||
:wikitext(reqText) | |||
row:tag('td'):attr('style', 'text-align: right;') | |||
:attr('data-sort-value', burnTime) | |||
:wikitext(Shared.timeString(burnTime, true)) | |||
row:tag('td'):attr('style', 'text-align: right;') | |||
:attr('data-sort-value', baseXP) | |||
:wikitext(Num.formatnum(baseXP)) | |||
row:tag('td'):attr('style', 'text-align: right;') | |||
:attr('data-sort-value', XPS) | |||
:wikitext(Num.formatnum(Num.round(XPS, 2, 2))) | |||
if bonfireBonus == 0 then | |||
row:tag('td'):attr('colspan', '4') | |||
:addClass('table-na') | |||
:wikitext('N/A') | |||
else | |||
row:tag('td'):attr('style', 'text-align: right;') | |||
:attr('data-sort-value', XP_BF) | |||
:wikitext(Num.formatnum(XP_BF)) | |||
row:tag('td'):attr('style', 'text-align: right;') | |||
:attr('data-sort-value', XPS_BF) | |||
:wikitext(Num.formatnum(XPS_BF, 2, 2)) | |||
row:tag('td'):attr('style', 'text-align: right;') | |||
:attr('data-sort-value', bonfireBonus) | |||
:wikitext(bonfireBonus .. '%') | |||
row:tag('td'):attr('style', 'text-align: right;') | |||
:attr('data-sort-value', bonfireTime) | |||
:wikitext(Shared.timeString(bonfireTime, true)) | |||
end | |||
end | |||
return tostring(tableHtml) | |||
end | end | ||
edits