17,101
edits
Inconvenient (talk | contribs) (moved getPotionNavbox to Module:Navboxes) |
(getFiremakingTable: Add XP with bonfire stats & refactor to avoid repetitive string concatenation) |
||
Line 472: | Line 472: | ||
function p.getFiremakingTable(frame) | function p.getFiremakingTable(frame) | ||
local | local resultPart = {} | ||
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"') | |||
table.insert(resultPart, '\r\n|-class="headerRow-0"') | |||
table.insert(resultPart, '\r\n!colspan="2" rowspan="2"|Logs!!rowspan="2"|'..Icons.Icon({'Firemaking', type='skill', notext=true})..' Level') | |||
table.insert(resultPart, '!!rowspan="2"|Burn Time!!colspan="2"|Without Bonfire!!colspan="2"|With Bonfire!!rowspan="2"|Bonfire Bonus!!rowspan="2"|Bonfire Time') | |||
table.insert(resultPart, '\r\n|-class="headerRow-1"') | |||
table.insert(resultPart, '\r\n!XP!!XP/s!!XP!!XP/s') | |||
for i, logData in Shared.skpairs(SkillData.Firemaking) do | for i, logData in Shared.skpairs(SkillData.Firemaking) do | ||
local name = Shared.titleCase(logData.type..' Logs') | local name = Shared.titleCase(logData.type..' Logs') | ||
local burnTime = logData.interval / 1000 | local burnTime = logData.interval / 1000 | ||
local XPS = logData.xp / burnTime | local XPS = logData.xp / burnTime | ||
local XP_BF = logData.xp * (1 + logData.bonfireBonus / 100) | |||
local XPS_BF = XP_BF / burnTime | |||
table.insert(resultPart, '\r\n|-') | |||
table.insert(resultPart, '\r\n|data-sort-value="'..name..'"|'..Icons.Icon({name, type='item', size='50', notext=true})) | |||
table.insert(resultPart, '||[['..name..']]') | |||
table.insert(resultPart, '||style ="text-align: right;"|'..logData.level) | |||
table.insert(resultPart, '||style ="text-align: right;" data-sort-value="'..burnTime..'"|'..Shared.timeString(burnTime, true)) | |||
table.insert(resultPart, '||style ="text-align: right;"|'..logData.xp) | |||
table.insert(resultPart, '||style ="text-align: right;" data-sort-value="'..XPS..'"|'..Shared.round(XPS, 2, 2)) | |||
table.insert(resultPart, '||style ="text-align: right;"|'..Shared.round(XP_BF, 2, 0)) | |||
table.insert(resultPart, '||style ="text-align: right;" data-sort-value="'..XPS_BF..'"|'..Shared.round(XPS_BF, 2, 2)) | |||
table.insert(resultPart, '||style ="text-align: right;" data-sort-value="'..logData.bonfireBonus..'"|'..logData.bonfireBonus..'%') | |||
table.insert(resultPart, '||style ="text-align: right;" data-sort-value="'..logData.bonfireInterval..'"|'..Shared.timeString(logData.bonfireInterval / 1000, true)) | |||
end | end | ||
table.insert(resultPart, '\r\n|}') | |||
return | return table.concat(resultPart) | ||
end | end | ||
return p | return p |