2,875
edits
m (Fix incorrect thieving level requirement) |
m (Remove Source Type column in favour of Level column) |
||
Line 789: | Line 789: | ||
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"') | table.insert(resultPart, '{| class="wikitable sortable stickyHeader"') | ||
table.insert(resultPart, '\r\n|- class="headerRow-0"') | table.insert(resultPart, '\r\n|- class="headerRow-0"') | ||
table.insert(resultPart, '\r\n!Source | table.insert(resultPart, '\r\n!Source!!Level!!Quantity!!colspan="2"|Chance') | ||
--Set up function for adding rows | --Set up function for adding rows | ||
local buildRow = function(source | local buildRow = function(source, level, minqty, qty, weight, totalWeight, expIcon) | ||
if minqty == nil then minqty = 1 end | if minqty == nil then minqty = 1 end | ||
if expIcon == nil then expIcon = '' end | if expIcon == nil then expIcon = '' end | ||
Line 800: | Line 800: | ||
table.insert(rowPart, '\r\n|style="text-align: left;"|'..source) | table.insert(rowPart, '\r\n|style="text-align: left;"|'..source) | ||
--Weeding out brackets since they don't play nice with data-sort-value | --Weeding out brackets since they don't play nice with data-sort-value | ||
local _, _, | local _, _, levelText = string.find(level, "%|([%a%s]+)%]") | ||
if | if levelText == nil then _, _, levelText = string.find(level, "%[%[([%a%s]+)%]") end | ||
if | if levelText == nil then levelText = level end | ||
table.insert(rowPart, '\r\n|style="text-align: left;" data-sort-value="'.. | table.insert(rowPart, '\r\n|style="text-align: left;" data-sort-value="'..levelText..'"|'..expIcon.. level) | ||
table.insert(rowPart, '\r\n|style="text-align: right;" data-sort-value="'..qty..'"|'..Shared.formatnum(minqty)) | table.insert(rowPart, '\r\n|style="text-align: right;" data-sort-value="'..qty..'"|'..Shared.formatnum(minqty)) | ||
if qty ~= minqty then table.insert(rowPart, ' - '..Shared.formatnum(qty)) end | if qty ~= minqty then table.insert(rowPart, ' - '..Shared.formatnum(qty)) end | ||
Line 848: | Line 847: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = Icons.Icon({iconName, type='monster'}), | source = Icons.Icon({iconName, type='monster'}), | ||
level = '[[File:Combat.svg|25px|link=Monsters]] Level ' .. monsterLevel, | |||
level = '[[File:Combat.svg|25px|link= | minqty = drop.minQty, | ||
qty = drop.maxQty, | qty = drop.maxQty, | ||
weight = drop.dropWt, | weight = drop.dropWt, | ||
Line 863: | Line 862: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = Icons.Icon({drop.name, type='poi'}), | source = Icons.Icon({drop.name, type='poi'}), | ||
level = '[[File:Archaeology_(skill).svg|25px|link=Archaeology]] Level ' .. drop.level .. '('..drop.size..')', | |||
minqty = drop.minQty, | minqty = drop.minQty, | ||
qty = drop.maxQty, | qty = drop.maxQty, | ||
Line 879: | Line 877: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = Icons.Icon({dungeon.name, type='dungeon'}), | source = Icons.Icon({dungeon.name, type='dungeon'}), | ||
level = '[[Dungeon]]', | |||
minqty = 1, | minqty = 1, | ||
qty = 1, | qty = 1, | ||
Line 895: | Line 892: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = sourceTxt, | source = sourceTxt, | ||
level = '[[Dungeon]]', | |||
minqty = 1, | minqty = 1, | ||
qty = 1, | qty = 1, | ||
Line 925: | Line 921: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = sourceTxt, | source = sourceTxt, | ||
level = '[[Chest]]', | |||
minqty = minQty, | minqty = minQty, | ||
qty = maxQty, | qty = maxQty, | ||
Line 947: | Line 942: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = sourceTxt, | source = sourceTxt, | ||
level = Icons._SkillReq("Thieving", thiefRow.level), | level = Icons._SkillReq("Thieving", thiefRow.level), | ||
minqty = thiefRow.minQty, | minqty = thiefRow.minQty, | ||
Line 963: | Line 957: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = fishSource, | source = fishSource, | ||
level = Icons._SkillReq("Fishing", 1), | level = Icons._SkillReq("Fishing", 1), | ||
minqty = 1, | minqty = 1, | ||
Line 982: | Line 975: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = fishSource, | source = fishSource, | ||
level = Icons._SkillReq("Fishing", 1), | level = Icons._SkillReq("Fishing", 1), | ||
minqty = fishItem.minQuantity, | minqty = fishItem.minQuantity, | ||
Line 1,003: | Line 995: | ||
end | end | ||
if thisGem ~= nil then | if thisGem ~= nil then | ||
local expIcon = '' | local expIcon = '' | ||
local sourceTxt | local sourceTxt | ||
Line 1,019: | Line 1,010: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = sourceTxt, | source = sourceTxt, | ||
level = lv, | level = lv, | ||
minqty = thisGem.minQuantity, | minqty = thisGem.minQuantity, | ||
Line 1,028: | Line 1,018: | ||
-- Check for Alt. Magic spells also | -- Check for Alt. Magic spells also | ||
local producesKey = (gemKey == 'randomGems' and 'RandomGem') or 'RandomSuperiorGem' | local producesKey = (gemKey == 'randomGems' and 'RandomGem') or 'RandomSuperiorGem' | ||
for j, spell in ipairs(Magic.getSpellsBySpellBook('altMagic')) do | for j, spell in ipairs(Magic.getSpellsBySpellBook('altMagic')) do | ||
Line 1,034: | Line 1,023: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = Icons.Icon({spell.name, type=Magic._getSpellIconType(spell)}), | source = Icons.Icon({spell.name, type=Magic._getSpellIconType(spell)}), | ||
level = Icons._SkillReq("SkillData.Magic.name", spell.level), | |||
level = Icons._SkillReq("Magic", spell.level), | |||
minqty = thisGem.minQuantity, | minqty = thisGem.minQuantity, | ||
qty = thisGem.maxQuantity, | qty = thisGem.maxQuantity, | ||
Line 1,053: | Line 1,041: | ||
if a.weight / a.totalWeight == b.weight / b.totalWeight then | if a.weight / a.totalWeight == b.weight / b.totalWeight then | ||
if a.minqty + a.qty == b.minqty + b.qty then | if a.minqty + a.qty == b.minqty + b.qty then | ||
return (a. | return (a.level == b.level and a.source < b.source) or a.level < b.level | ||
else | else | ||
return a.minqty + a.qty > b.minqty + b.qty | return a.minqty + a.qty > b.minqty + b.qty | ||
Line 1,062: | Line 1,050: | ||
end) | end) | ||
for i, data in ipairs(dropRows) do | for i, data in ipairs(dropRows) do | ||
table.insert(resultPart, buildRow(data.source | table.insert(resultPart, buildRow(data.source, data.level, data.minqty, data.qty, data.weight, data.totalWeight, data.expIcon)) | ||
end | end | ||
edits