17,105
edits
Falterfire (talk | contribs) (Nevermind, the first pass was better) |
(getTreesTable: Expand requirements column to include shop purchases; getMiningOresTable: Include rock/type columns, amend requirements text for consistency) |
||
Line 120: | Line 120: | ||
return p.getToolTable('Rod', '_Rod$', modifiers, 'melvorD:Fishing') | return p.getToolTable('Rod', '_Rod$', modifiers, 'melvorD:Fishing') | ||
end | |||
function p.getRecipeRequirements(skillName, recipe) | |||
local reqText = {} | |||
if recipe.level ~= nil then | |||
table.insert(reqText, Icons._SkillReq(skillName, recipe.level, false)) | |||
end | |||
if recipe.shopItemPurchased ~= nil then | |||
local purchReq = Shop.getPurchaseByID(recipe.shopItemPurchased) | |||
if purchReq ~= nil then | |||
table.insert(reqText, Shop._getPurchaseIcon({purchReq})) | |||
end | |||
end | |||
return table.concat(reqText, '<br/>') | |||
end | end | ||
function p.getTreesTable(frame) | function p.getTreesTable(frame) | ||
local | local resultPart = {} | ||
table.insert(resultPart, '{| class="wikitable sortable"') | |||
table.insert(resultPart, '\n|- class="headerRow-0"') | |||
table.insert(resultPart, '\n!colspan="2"|Tree!!colspan="2"|Logs!!Requirements') | |||
table.insert(resultPart, '!!XP!!Cut Time!!XP/s!!GP/s') | |||
for i, tree in ipairs(SkillData.Woodcutting.trees) do | for i, tree in ipairs(SkillData.Woodcutting.trees) do | ||
local log = Items.getItemByID(tree.productId) | local log = Items.getItemByID(tree.productId) | ||
table.insert(resultPart, '\n|-') | |||
table.insert(resultPart, '\n|class="table-img" data-sort-value="'..tree.name..'"| '..Icons.Icon({log.name, img=tree.name, type='tree', notext=true, size=50})) | |||
table.insert(resultPart, '\n|'..tree.name) | |||
table.insert(resultPart, '\n|class="table-img" data-sort-value="'..log.name..'"| '..Icons.Icon({log.name, type='item', notext=true, size=50})) | |||
table.insert(resultPart, '\n| '..Icons.Icon({log.name, type='item', noicon=true})) | |||
table.insert(resultPart, '\n|data-sort-value="' .. tree.level .. '"| ' .. p.getRecipeRequirements(SkillData.Woodcutting.name, tree)) | |||
table.insert(resultPart, '\n|style="text-align:right"| '..tree.baseExperience) | |||
table.insert(resultPart, '\n|style="text-align:right" data-sort-value="'..tree.baseInterval..'"| '..Shared.timeString(tree.baseInterval/1000, true)) | |||
local XPs = tree.baseExperience / (tree.baseInterval / 1000) | local XPs = tree.baseExperience / (tree.baseInterval / 1000) | ||
local GPs = log.sellsFor / (tree.baseInterval / 1000) | local GPs = log.sellsFor / (tree.baseInterval / 1000) | ||
table.insert(resultPart, '\n|style="text-align:right"| '..Shared.round(XPs, 2, 2)) | |||
table.insert(resultPart, '\n|style="text-align:right" data-sort-value="'..GPs..'"| '..Icons.GP(Shared.round(GPs, 2, 2))) | |||
end | end | ||
table.insert(resultPart, '\n|}') | |||
return | return table.concat(resultPart) | ||
end | end | ||
Line 166: | Line 181: | ||
-- If chance is less than 0.10% then show 2 significant figures, otherwise 2 decimal places | -- If chance is less than 0.10% then show 2 significant figures, otherwise 2 decimal places | ||
local fmt = (dropChance < 0.10 and '%.2g') or '%.2f' | local fmt = (dropChance < 0.10 and '%.2g') or '%.2f' | ||
table.insert(resultPart, '\r\n|-\r\n| | table.insert(resultPart, '\r\n|-\r\n|class="table-img"| ' .. Icons.Icon({item.name, type='item', notext=true})) | ||
table.insert(resultPart, '\r\n| ' .. Icons.Icon({item.name, type='item', noicon=true})) | table.insert(resultPart, '\r\n| ' .. Icons.Icon({item.name, type='item', noicon=true})) | ||
table.insert(resultPart, '\r\n|data-sort-value="' .. item.sellsFor .. '"| ' .. Icons.GP(math.floor(item.sellsFor))) | table.insert(resultPart, '\r\n|data-sort-value="' .. item.sellsFor .. '"| ' .. Icons.GP(math.floor(item.sellsFor))) | ||
Line 195: | Line 210: | ||
for i, item in ipairs(itemArray) do | for i, item in ipairs(itemArray) do | ||
table.insert(resultPart, '\r\n|-') | table.insert(resultPart, '\r\n|-') | ||
table.insert(resultPart, '\r\n| | table.insert(resultPart, '\r\n|class="table-img"| ' .. Icons.Icon({item.name, type='item', notext=true, size=50})) | ||
table.insert(resultPart, '\r\n| ' .. Icons.Icon({item.name, type='item', noicon=true})) | table.insert(resultPart, '\r\n| ' .. Icons.Icon({item.name, type='item', noicon=true})) | ||
table.insert(resultPart, '\r\n|data-sort-value="' .. item.sellsFor .. '"| ' .. Icons.GP(math.floor(item.sellsFor))) | table.insert(resultPart, '\r\n|data-sort-value="' .. item.sellsFor .. '"| ' .. Icons.GP(math.floor(item.sellsFor))) | ||
Line 204: | Line 219: | ||
function p.getMiningOresTable(frame) | function p.getMiningOresTable(frame) | ||
local | local resultPart = {} | ||
table.insert(resultPart, '{|class="wikitable sortable stickyHeader"') | |||
table.insert(resultPart, '\n|- class="headerRow-0"') | |||
table.insert(resultPart, '\n!colspan="2"|Rock!!colspan=2|Ore!!Type!!Requirements') | |||
table.insert(resultPart, '!!XP!!Respawn Time!!Ore Value') | |||
local mineData = GameData.getEntities(SkillData.Mining.rockData, function(rock) return true end) | local mineData = GameData.getEntities(SkillData.Mining.rockData, function(rock) return true end) | ||
Line 214: | Line 230: | ||
for i, oreData in ipairs(mineData) do | for i, oreData in ipairs(mineData) do | ||
local ore = Items.getItemByID(oreData.productId) | local ore = Items.getItemByID(oreData.productId) | ||
local | local respawnStyle, respawnSort, respawnText = 'class="table-na"', 0, 'N/A' | ||
if oreData.hasPassiveRegen then | if oreData.hasPassiveRegen then | ||
respawnStyle = 'style="text-align:right;' | |||
respawnSort = oreData.baseRespawnInterval / 1000 | respawnSort = oreData.baseRespawnInterval / 1000 | ||
respawnText = Shared.timeString(respawnSort, true) | respawnText = Shared.timeString(respawnSort, true) | ||
end | end | ||
local rockName = Icons.Icon({oreData.name, type='rock', noicon=true, nolink=true}) | |||
table.insert(resultPart, '\n|-\n|class="table-img" data-sort-value="' .. rockName .. '"| '..Icons.Icon({oreData.name, type='rock', size='50', notext=true, nolink=true})) | |||
table.insert(resultPart, '\n| ' .. rockName) | |||
table.insert(resultPart, '\n|class="table-img" data-sort-value="' .. ore.name .. '"| '..Icons.Icon({ore.name, type='item', size='50', notext=true})) | |||
table.insert(resultPart, '\n| ' .. Icons.Icon({ore.name, type='item', noicon=true})) | |||
table.insert(resultPart, '\n| ' .. oreData.type) | |||
table.insert(resultPart, '\n|data-sort-value="' .. oreData.level ..'"| '..p.getRecipeRequirements(SkillData.Mining.name, oreData)) | |||
table.insert(resultPart, '\n|style="text-align:right"| '..oreData.baseExperience) | |||
table.insert(resultPart, '\n|' .. respawnStyle .. ' data-sort-value="'..respawnSort..'"| ' .. respawnText) | |||
table.insert(resultPart, '\n|data-sort-value="'..ore.sellsFor..'"| '..Icons.GP(ore.sellsFor)) | |||
end | end | ||
table.insert(resultPart, '\n|}') | |||
return | return table.concat(resultPart) | ||
end | end | ||