17,101
edits
(getTreesTable: Expand requirements column to include shop purchases; getMiningOresTable: Include rock/type columns, amend requirements text for consistency) |
(getRecipeRequirements: Include mastery requirement; getMiningGemsTable: Expand to include superior gems) |
||
Line 126: | Line 126: | ||
if recipe.level ~= nil then | if recipe.level ~= nil then | ||
table.insert(reqText, Icons._SkillReq(skillName, recipe.level, false)) | table.insert(reqText, Icons._SkillReq(skillName, recipe.level, false)) | ||
end | |||
if recipe.totalMasteryRequired ~= nil then | |||
table.insert(reqText, Shared.formatnum(recipe.totalMasteryRequired) .. ' ' .. Icons.Icon({skillName, type='skill', notext=true}) .. ' ' .. Icons.Icon({'Mastery'})) | |||
end | end | ||
if recipe.shopItemPurchased ~= nil then | if recipe.shopItemPurchased ~= nil then | ||
Line 253: | Line 256: | ||
end | end | ||
function p._getMiningGemsTable(gemType) | |||
function p. | if type(gemType) ~= 'string' then | ||
local | gemType = 'Normal' | ||
end | |||
local validTypes = { | |||
["Normal"] = 'randomGems', | |||
["Superior"] = 'randomSuperiorGems' | |||
} | |||
local gemDataKey = validTypes[gemType] | |||
if gemDataKey == nil then | |||
return 'ERROR: No such gem type "' .. gemType .. '"[[Category:Pages with script errors]]' | |||
end | |||
local gemData = GameData.rawData[gemDataKey] | |||
local totalWeight = 0 | local totalWeight = 0 | ||
for i, | for i, gem in ipairs(gemData) do | ||
totalWeight = totalWeight + | totalWeight = totalWeight + gem.weight | ||
end | end | ||
local resultPart = {} | |||
table.insert(resultPart, '{|class="wikitable sortable stickyHeader"') | |||
table.insert(resultPart, '\n|- class="headerRow-0"') | |||
table.insert(resultPart, '\n!colspan=2|Gem!!Gem Chance!!Gem Price') | |||
for i, | for i, gem in ipairs(gemData) do | ||
local | local gemItem = Items.getItemByID(gem.itemID) | ||
local gemPct = gem.weight / totalWeight * 100 | |||
table.insert(resultPart, '\n|-\n|class="table-img"| ') | |||
table.insert(resultPart, Icons.Icon({gemItem.name, type='item', size='50', notext=true})) | |||
table.insert(resultPart, '\n| ' .. Icons.Icon({gemItem.name, type='item', noicon=true})) | |||
table.insert(resultPart, '\n|style="text-align:right" data-sort-value="' .. gemPct .. '" | ' .. string.format("%.1f%%", gemPct)) | |||
table.insert(resultPart, '\n|data-sort-value="' .. gemItem.sellsFor .. '"| ' .. Icons.GP(gemItem.sellsFor)) | |||
end | end | ||
table.insert(resultPart, '\n|}') | |||
return | return table.concat(resultPart) | ||
end | |||
function p.getMiningGemsTable(frame) | |||
local gemType = frame.args ~= nil and frame.args[1] or frame | |||
return p._getMiningGemsTable(gemType) | |||
end | end | ||
Line 356: | Line 378: | ||
end | end | ||
function p._getThievingGeneralRareTable(npcID) | function p._getThievingGeneralRareTable(npcID) | ||
local rareTxt = '{|class="wikitable sortable"' | local rareTxt = '{|class="wikitable sortable"' |