12,868
edits
m (Add magic level requirement) |
(getItemSourceTables: Format monster combat level) |
||
(15 intermediate revisions by 2 users not shown) | |||
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, levelNum, 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 | ||
if level == nil then level = 'N/A' end | |||
local rowPart = {} | local rowPart = {} | ||
table.insert(rowPart, '\r\n|-') | table.insert(rowPart, '\r\n|-') | ||
table.insert(rowPart, '\r\n|style="text-align: left;"|'..source) | table.insert(rowPart, '\r\n|style="text-align: left;"|'..source) | ||
-- | -- Retrieve numeric level value for sorting, or remove anything between [[]] | ||
local | local levelValue = '' | ||
if | if levelNum ~= nil then | ||
levelValue = tostring(levelNum) | |||
table.insert(rowPart, '\r\n|style="text-align: left;" data-sort-value="'.. | else | ||
levelValue = level:match('%[%[.-%]%]%s*(%w+)$') or '' | |||
end | |||
table.insert(rowPart, '\r\n|style="text-align: left;" data-sort-value="'..levelValue..'"|'..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 842: | Line 845: | ||
iconName = SourceOverrides[drop.id] | iconName = SourceOverrides[drop.id] | ||
end | end | ||
if monster ~= nil then | if monster ~= nil then | ||
local monsterLevel = Monsters._getMonsterCombatLevel(monster) | |||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = Icons.Icon({iconName, type='monster'}), | source = Icons.Icon({iconName, type='monster'}), | ||
level = Icons.Icon({'Monsters', img='Combat', notext=true}) .. ' Level ' .. Shared.formatnum(monsterLevel), | |||
levelNum = monsterLevel, | |||
minqty = drop.minQty, | |||
qty = drop.maxQty, | qty = drop.maxQty, | ||
weight = drop.dropWt, | weight = drop.dropWt, | ||
Line 859: | Line 866: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = Icons.Icon({drop.name, type='poi'}), | source = Icons.Icon({drop.name, type='poi'}), | ||
level = Icons._SkillReq('Archaeology', drop.level) .. ' ('..drop.size..')', | |||
levelNum = drop.level, | |||
minqty = drop.minQty, | minqty = drop.minQty, | ||
qty = drop.maxQty, | qty = drop.maxQty, | ||
Line 874: | Line 882: | ||
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 889: | Line 897: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = sourceTxt, | source = sourceTxt, | ||
level = '[[Dungeon]]', | |||
minqty = 1, | minqty = 1, | ||
qty = 1, | qty = 1, | ||
Line 918: | Line 926: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = sourceTxt, | source = sourceTxt, | ||
level = '[[Chest]]', | |||
minqty = minQty, | minqty = minQty, | ||
qty = maxQty, | qty = maxQty, | ||
Line 939: | Line 947: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = sourceTxt, | source = sourceTxt, | ||
level = Icons._SkillReq("Thieving", thiefRow.level), | |||
levelNum = thiefRow.level, | |||
minqty = thiefRow.minQty, | minqty = thiefRow.minQty, | ||
qty = thiefRow.maxQty, | qty = thiefRow.maxQty, | ||
Line 954: | Line 963: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = fishSource, | source = fishSource, | ||
level = Icons._SkillReq("Fishing", 1), | |||
levelNum = 1, | |||
minqty = 1, | minqty = 1, | ||
qty = 1, | qty = 1, | ||
Line 972: | Line 982: | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = fishSource, | source = fishSource, | ||
level = Icons._SkillReq("Fishing", 1), | |||
levelNum = 1, | |||
minqty = fishItem.minQuantity, | minqty = fishItem.minQuantity, | ||
qty = fishItem.maxQuantity, | qty = fishItem.maxQuantity, | ||
Line 992: | Line 1,003: | ||
end | end | ||
if thisGem ~= nil then | if thisGem ~= nil then | ||
local expIcon = '' | local expIcon = '' | ||
local sourceTxt | local sourceTxt | ||
local lv = nil | |||
if item.type == 'Superior Gem' then | if item.type == 'Superior Gem' then | ||
expIcon = Icons.TotH() | expIcon = Icons.TotH() | ||
sourceTxt = '[[Mining#Superior Gems|Superior Gem]]' | sourceTxt = '[[Mining#Superior Gems|Superior Gem]]' | ||
-- Superior gems can only be found with Mining 100 or above | |||
lv = 100 | |||
else | else | ||
sourceTxt = '[[Mining#Gems|Gem]]' | sourceTxt = '[[Mining#Gems|Gem]]' | ||
-- Gems can only be found with any Mining level | |||
lv = 1 | |||
end | end | ||
table.insert(dropRows, { | table.insert(dropRows, { | ||
source = sourceTxt, | source = sourceTxt, | ||
level = Icons._SkillReq('Mining', lv), | |||
levelNum = lv, | |||
minqty = thisGem.minQuantity, | minqty = thisGem.minQuantity, | ||
qty = thisGem.maxQuantity, | qty = thisGem.maxQuantity, | ||
Line 1,011: | Line 1,027: | ||
-- 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,017: | Line 1,032: | ||
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.Icon({'Alternative Magic', type='skill', img='Magic', notext=true}) .. ' Level ' .. spell.level, | |||
level = Icons. | levelNum = spell.level, | ||
minqty = thisGem.minQuantity, | minqty = thisGem.minQuantity, | ||
qty = thisGem.maxQuantity, | qty = thisGem.maxQuantity, | ||
Line 1,036: | Line 1,051: | ||
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,045: | Line 1,060: | ||
end) | end) | ||
for i, data in ipairs(dropRows) do | for i, data in ipairs(dropRows) do | ||
table.insert(resultPart, buildRow(data.source, data. | table.insert(resultPart, buildRow(data.source, data.level, data.levelNum, data.minqty, data.qty, data.weight, data.totalWeight, data.expIcon)) | ||
end | end | ||
Line 1,325: | Line 1,340: | ||
local min = found.minQuantity | local min = found.minQuantity | ||
local max = found.maxQuantity | local max = found.maxQuantity | ||
table.insert(resultArray, {id = digSite.id, name = digSite.name, size = sizeName, minQty = min, maxQty = max, dropWt = found.weight, totalWt = sizeWeight}) | table.insert(resultArray, { | ||
id = digSite.id, | |||
name = digSite.name, | |||
level = digSite.level, | |||
size = sizeName, | |||
minQty = min, | |||
maxQty = max, | |||
dropWt = found.weight, | |||
totalWt = sizeWeight}) | |||
end | end | ||
end | end |