12,714
edits
Supersting (talk | contribs) (No, I think I have it now.) |
m (Correct item name error) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 389: | Line 389: | ||
local thiefItems = Skills.getThievingSourcesForItem(item.id) | local thiefItems = Skills.getThievingSourcesForItem(item.id) | ||
if type(thiefItems) == 'table' then | if type(thiefItems) == 'table' then | ||
local includedNPCs = {} | |||
local thiefPart = {} | local thiefPart = {} | ||
for i, thiefRow in ipairs(thiefItems) do | for i, thiefRow in ipairs(thiefItems) do | ||
Line 394: | Line 395: | ||
--if 'all' is the npc, this is a rare item so just say 'Thieving level 1' | --if 'all' is the npc, this is a rare item so just say 'Thieving level 1' | ||
table.insert(lineArray, Icons._SkillReq('Thieving', 1)) | table.insert(lineArray, Icons._SkillReq('Thieving', 1)) | ||
elseif not Shared.contains(includedNPCs, thiefRow.npc) then | |||
table.insert(thiefPart, Icons.Icon({thiefRow.npc, type='thieving', notext=true})) | table.insert(thiefPart, Icons.Icon({thiefRow.npc, type='thieving', notext=true})) | ||
table.insert(includedNPCs, thiefRow.npc) | |||
end | end | ||
end | end | ||
Line 496: | Line 498: | ||
table.insert(lineArray, Icons.Icon({'Fishing', type='skill', notext=true}) .. ' [[Fishing#Special|Special]]') | table.insert(lineArray, Icons.Icon({'Fishing', type='skill', notext=true}) .. ' [[Fishing#Special|Special]]') | ||
elseif item.id == SkillData.Fishing.lostChestItem then | elseif item.id == SkillData.Fishing.lostChestItem then | ||
table.insert(lineArray, Icons._SkillReq(SkillData.Fishing.name, | table.insert(lineArray, Icons._SkillReq(SkillData.Fishing.name, 100)) | ||
end | end | ||
Line 585: | Line 587: | ||
elseif item.id == 'melvorD:Signet_Ring_Half_B' then | elseif item.id == 'melvorD:Signet_Ring_Half_B' then | ||
table.insert(lineArray, 'Killing any monster while wearing '..Icons.Icon({'Gold Topaz Ring', type='item'})) | table.insert(lineArray, 'Killing any monster while wearing '..Icons.Icon({'Gold Topaz Ring', type='item'})) | ||
elseif item.id == 'melvorTotH:Deadly_Toxins_Potion' then | |||
--Adding a special override for Deadly Toxins potions | |||
table.insert(lineArray, 'Brewing [[Lethal Toxins Potion]]s while wearing '..Icons.Icon({'Toxic Maker Gloves', type='item'})) | |||
end | |||
--Township Task reward | |||
for _, task in ipairs(SkillData.Township.tasks) do | |||
if task.rewards.items[1] ~= nil then -- Skip tasks with no items | |||
if GameData.getEntityByID(task.rewards.items, item.id) then | |||
table.insert(lineArray, Icons.Icon({'Tasks', type='township'})) | |||
break | |||
end | |||
end | |||
end | end | ||
Line 620: | Line 635: | ||
--Set up function for adding rows | --Set up function for adding rows | ||
local buildRow = function(source, type, minqty, qty, weight, totalWeight) | local buildRow = function(source, type, 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 | |||
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) | ||
table.insert(rowPart, '\r\n|style="text-align: left;"|'..type) | --Weeding out brackets since they don't play nice with data-sort-value | ||
local _, _, typeText = string.find(type, "%|([%a%s]+)%]") | |||
if typeText == nil then _, _, typeText = string.find(type, "%[%[([%a%s]+)%]") end | |||
if typeText == nil then typeText = type end | |||
table.insert(rowPart, '\r\n|style="text-align: left;" data-sort-value="'..typeText..'"|'..expIcon..type) | |||
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)) | ||
Line 662: | Line 682: | ||
local monster = GameData.getEntityByID('monsters', drop.id) | local monster = GameData.getEntityByID('monsters', drop.id) | ||
if monster ~= nil then | if monster ~= nil then | ||
table.insert(dropRows, {source = | table.insert(dropRows, {source = Icons.Icon({monster.name, type='monster'}), type = '[[Monster]]', minqty = drop.minQty, qty = drop.maxQty, weight = drop.dropWt, totalWeight = drop.totalWt, expIcon = Icons.getExpansionIcon(drop.id)}) | ||
end | end | ||
end | end | ||
Line 670: | Line 690: | ||
if (dungeon.oneTimeRewardID ~= nil and item.id == dungeon.oneTimeRewardID) or | if (dungeon.oneTimeRewardID ~= nil and item.id == dungeon.oneTimeRewardID) or | ||
(type(dungeon.rewardItemIDs) == 'table' and Shared.contains(dungeon.rewardItemIDs, item.id)) then | (type(dungeon.rewardItemIDs) == 'table' and Shared.contains(dungeon.rewardItemIDs, item.id)) then | ||
table.insert(dropRows, {source = | table.insert(dropRows, {source = Icons.Icon({dungeon.name, type='dungeon'}), type = '[[Dungeon]]', minqty = 1, qty = 1, weight = 1, totalWeight = 1, expIcon = Icons.getExpansionIcon(dungeon.id)}) | ||
elseif dungeon.eventID ~= nil then | elseif dungeon.eventID ~= nil then | ||
-- Is the item dropped from a combat event (e.g. Impending Darkness event)? | -- Is the item dropped from a combat event (e.g. Impending Darkness event)? | ||
Line 677: | Line 697: | ||
for eventCycle, itemRewardID in ipairs(event.itemRewardIDs) do | for eventCycle, itemRewardID in ipairs(event.itemRewardIDs) do | ||
if item.id == itemRewardID then | if item.id == itemRewardID then | ||
local sourceTxt = | local sourceTxt = Icons.Icon({dungeon.name, type='dungeon'}) .. (eventCycle == Shared.tableCount(event.itemRewardIDs) and '' or ', Cycle ' .. eventCycle) | ||
table.insert(dropRows, {source = sourceTxt, type = '[[Dungeon]]', minqty = 1, qty = 1, weight = 1, totalWeight = 1}) | table.insert(dropRows, {source = sourceTxt, type = '[[Dungeon]]', minqty = 1, qty = 1, weight = 1, totalWeight = 1}) | ||
break | break | ||
Line 701: | Line 721: | ||
if wt > 0 then | if wt > 0 then | ||
local sourceTxt = Icons.Icon({item2.name, type='item'}) | local sourceTxt = Icons.Icon({item2.name, type='item'}) | ||
table.insert(dropRows, {source = sourceTxt, type = '[[Chest]]', minqty = minQty, qty = maxQty, weight = wt, totalWeight = totalWt}) | table.insert(dropRows, {source = sourceTxt, type = '[[Chest]]', minqty = minQty, qty = maxQty, weight = wt, totalWeight = totalWt, expIcon = Icons.getExpansionIcon(item2.id)}) | ||
end | end | ||
end | end | ||
Line 715: | Line 735: | ||
sourceTxt = Icons.Icon({thiefRow.npc, type='thieving'}) | sourceTxt = Icons.Icon({thiefRow.npc, type='thieving'}) | ||
end | end | ||
table.insert(dropRows, {source = sourceTxt, type = Icons.Icon({SkillData.Thieving.name, type='skill'}), minqty = thiefRow.minQty, qty = thiefRow.maxQty, weight = thiefRow.wt, totalWeight = thiefRow.totalWt}) | table.insert(dropRows, {source = sourceTxt, type = Icons.Icon({SkillData.Thieving.name, type='skill'}), minqty = thiefRow.minQty, qty = thiefRow.maxQty, weight = thiefRow.wt, totalWeight = thiefRow.totalWt, expIcon = Icons.getExpansionIcon(thiefRow.npcID)}) | ||
end | end | ||
Line 752: | Line 772: | ||
if thisGem ~= nil then | if thisGem ~= nil then | ||
local mineType = Icons.Icon({SkillData.Mining.name, type='skill'}) | local mineType = Icons.Icon({SkillData.Mining.name, type='skill'}) | ||
local expIcon = '' | |||
local sourceTxt | |||
if item.type == 'Superior Gem' then | |||
expIcon = Icons.TotH() | |||
sourceTxt = '[[Mining#Superior Gems|Superior Gem]]' | |||
else | |||
sourceTxt = '[[Mining#Gems|Gem]]' | |||
end | |||
table.insert(dropRows, {source = sourceTxt, type = mineType, minqty = thisGem.minQuantity, qty = thisGem.maxQuantity, weight = thisGem.weight, totalWeight = totalGemWeight, expIcon = expIcon}) | |||
-- Check for Alt. Magic spells also | -- Check for Alt. Magic spells also | ||
Line 759: | Line 787: | ||
for j, spell in ipairs(Magic.getSpellsBySpellBook('altMagic')) do | for j, spell in ipairs(Magic.getSpellsBySpellBook('altMagic')) do | ||
if spell.produces ~= nil and spell.produces == producesKey then | if spell.produces ~= nil and spell.produces == producesKey then | ||
table.insert(dropRows, {source = Icons.Icon({spell.name, type=Magic._getSpellIconType(spell)}), type = magicType, minqty = thisGem.minQuantity, qty = thisGem.maxQuantity, weight = thisGem.weight, totalWeight = totalGemWeight}) | table.insert(dropRows, {source = Icons.Icon({spell.name, type=Magic._getSpellIconType(spell)}), type = magicType, minqty = thisGem.minQuantity, qty = thisGem.maxQuantity, weight = thisGem.weight, totalWeight = totalGemWeight, expIcon = Icons.getExpansionIcon(spell.id)}) | ||
end | end | ||
end | end | ||
Line 781: | Line 809: | ||
end) | end) | ||
for i, data in ipairs(dropRows) do | for i, data in ipairs(dropRows) do | ||
table.insert(resultPart, buildRow(data.source, data.type, data.minqty, data.qty, data.weight, data.totalWeight)) | table.insert(resultPart, buildRow(data.source, data.type, data.minqty, data.qty, data.weight, data.totalWeight, data.expIcon)) | ||
end | end | ||
Line 1,039: | Line 1,067: | ||
'Mastery Token (Cooking)', | 'Mastery Token (Cooking)', | ||
'Gem Gloves', | 'Gem Gloves', | ||
"Thief's Moneysack" | "Thief's Moneysack", | ||
"Golden Stardust" | |||
} | } | ||
local checkFuncs = { | local checkFuncs = { |