12,787
edits
(Update for v1.1) |
m (Correct item name error) |
||
(19 intermediate revisions by 4 users not shown) | |||
Line 47: | Line 47: | ||
-- Gathering skills | -- Gathering skills | ||
-- All follow a similar data structure | -- All follow a similar data structure | ||
for localSkillID, dataProp in | for localSkillID, dataProp in pairs(skillIDs.Gathering) do | ||
local skillData = SkillData[localSkillID] | local skillData = SkillData[localSkillID] | ||
local skill = skillData.name | local skill = skillData.name | ||
Line 56: | Line 56: | ||
xp = recipe.baseExperience | xp = recipe.baseExperience | ||
qty = recipe.baseQuantity or 1 | qty = recipe.baseQuantity or 1 | ||
if localSkillID == 'Farming' then | |||
req = { recipe.seedCost } | |||
end | |||
-- Action time | -- Action time | ||
if recipe.baseMinInterval ~= nil then | if recipe.baseMinInterval ~= nil then | ||
Line 69: | Line 72: | ||
-- Special requirements | -- Special requirements | ||
if recipe.totalMasteryRequired ~= nil then | if recipe.totalMasteryRequired ~= nil then | ||
specialReq = Icons.Icon({'Mastery', notext=true}) .. Shared. | specialReq = Icons.Icon({'Mastery', notext=true}) .. Shared.formatnum(recipe.totalMasteryRequired) .. ' total [[' .. skill .. ']] [[Mastery]]' | ||
end | end | ||
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime, specialReq)) | table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime, specialReq)) | ||
Line 80: | Line 83: | ||
-- Artisan skills | -- Artisan skills | ||
-- Allow follow a similar data structure | -- Allow follow a similar data structure | ||
for localSkillID, dataProp in | for localSkillID, dataProp in pairs(skillIDs.Artisan) do | ||
local skillData = SkillData[localSkillID] | local skillData = SkillData[localSkillID] | ||
local skill = skillData.name | local skill = skillData.name | ||
local lvl, xp, qty, req, time, maxTime = 0, 0, 0, nil, 0, nil | local lvl, xp, qty, req, time, maxTime = 0, 0, 0, nil, 0, nil | ||
for i, recipe in ipairs(skillData.recipes) do | for i, recipe in ipairs(skillData.recipes) do | ||
if recipe.productID == itemID or (localSkillID == 'Cooking' and recipe.perfectCookID == itemID) then | if recipe.productID == itemID or | ||
(localSkillID == 'Cooking' and recipe.perfectCookID == itemID) or | |||
(localSkillID == 'Herblore' and Shared.contains(recipe.potionIDs, itemID)) then | |||
lvl = recipe.level | lvl = recipe.level | ||
xp = recipe.baseExperience | xp = recipe.baseExperience | ||
Line 137: | Line 142: | ||
req = table.concat(shardCostArray, ', ') | req = table.concat(shardCostArray, ', ') | ||
if not Shared.tableIsEmpty(otherCostArray) then | if not Shared.tableIsEmpty(otherCostArray) then | ||
req = req .. '<br/>and one of the following:<br/>' .. table.concat(otherCostArray, "<br/>'''OR''' ") | local costLen = Shared.tableCount(otherCostArray) | ||
req = req .. '<br/>' .. (costLen == 1 and '' or 'and one of the following:<br/>') .. table.concat(otherCostArray, "<br/>'''OR''' ") | |||
end | end | ||
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time)) | table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time)) | ||
Line 148: | Line 154: | ||
local reqItem = Items.getItemByID(itemCost.id) | local reqItem = Items.getItemByID(itemCost.id) | ||
if reqItem == nil then | if reqItem == nil then | ||
table.insert(reqSubPart, itemCost. | table.insert(reqSubPart, itemCost.quantity .. 'x ?????') | ||
else | else | ||
table.insert(reqSubPart, Icons.Icon({reqItem.name, type='item', qty=itemCost. | table.insert(reqSubPart, Icons.Icon({reqItem.name, type='item', qty=itemCost.quantity})) | ||
end | end | ||
end | end | ||
Line 162: | Line 168: | ||
table.insert(qtyPart, Shared.formatnum(qty * altCost.quantityMultiplier)) | table.insert(qtyPart, Shared.formatnum(qty * altCost.quantityMultiplier)) | ||
end | end | ||
local sep = "<br/>'''OR'''" | local sep = "<br/>'''OR''' " | ||
req = table.concat(reqPart, sep) | req = table.concat(reqPart, sep) | ||
local qtyText = table.concat(qtyPart, sep) | local qtyText = table.concat(qtyPart, sep) | ||
Line 177: | Line 183: | ||
-- Bars are handled by getItemSuperheatTable() | -- Bars are handled by getItemSuperheatTable() | ||
-- Gems are handled by _getItemLootSourceTable() | -- Gems are handled by _getItemLootSourceTable() | ||
for i, altSpell in ipairs( | for i, altSpell in ipairs(Magic.getSpellsBySpellBook('altMagic')) do | ||
if altSpell.produces == item.id then | if altSpell.produces == item.id then | ||
table.insert(tables, p._buildAltMagicTable(altSpell)) | table.insert(tables, p._buildAltMagicTable(altSpell)) | ||
Line 202: | Line 208: | ||
function p._buildAltMagicTable(spell) | function p._buildAltMagicTable(spell) | ||
local resultPart = {} | local resultPart = {} | ||
local imgType = | local imgType = Magic._getSpellIconType(spell) | ||
table.insert(resultPart, '{|class="wikitable"\r\n|-') | table.insert(resultPart, '{|class="wikitable"\r\n|-') | ||
table.insert(resultPart, '\r\n!colspan="2"|'..Icons.Icon({spell.name, type=imgType})) | table.insert(resultPart, '\r\n!colspan="2"|'..Icons.Icon({spell.name, type=imgType})) | ||
Line 208: | Line 214: | ||
table.insert(resultPart, '\r\n|'..Icons._SkillReq('Magic', spell.level)) | table.insert(resultPart, '\r\n|'..Icons._SkillReq('Magic', spell.level)) | ||
local costText = | local costText = Magic._getAltSpellCostText(spell) | ||
if costText ~= nil then | if costText ~= nil then | ||
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Materials') | table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Materials') | ||
Line 237: | Line 243: | ||
table.insert(resultPart, '\r\n|-\r\n!style="text-align: right;"|Materials\r\n|') | table.insert(resultPart, '\r\n|-\r\n!style="text-align: right;"|Materials\r\n|') | ||
if type(req) == 'table' then | if type(req) == 'table' then | ||
for i, mat in | for i, mat in ipairs(req) do | ||
if i > 1 then table.insert(resultPart, '<br/>') end | if i > 1 then table.insert(resultPart, '<br/>') end | ||
local matItem = Items.getItemByID(mat.id) | local matItem = Items.getItemByID(mat.id) | ||
if matItem == nil then | if matItem == nil then | ||
table.insert(resultPart, mat. | table.insert(resultPart, mat.quantity..'x ?????') | ||
else | else | ||
table.insert(resultPart, Icons.Icon({matItem.name, type='item', qty=mat. | table.insert(resultPart, Icons.Icon({matItem.name, type='item', qty=mat.quantity})) | ||
end | end | ||
end | end | ||
Line 289: | Line 295: | ||
for i, monster in ipairs(GameData.rawData.monsters) do | for i, monster in ipairs(GameData.rawData.monsters) do | ||
local isDrop = false | local isDrop = false | ||
if monster.bones == item.id and Monsters._getMonsterBones(monster) ~= nil then | if monster.bones ~= nil and monster.bones.itemID == item.id and Monsters._getMonsterBones(monster) ~= nil then | ||
-- Item is a bone, and is either a shard from God dungeons or dropped by a non-boss monster with a loot table | -- Item is a bone, and is either a shard from God dungeons or dropped by a non-boss monster with a loot table | ||
isDrop = true | isDrop = true | ||
Line 319: | Line 325: | ||
local event = GameData.getEntityByID('combatEvents', dungeon.eventID) | local event = GameData.getEntityByID('combatEvents', dungeon.eventID) | ||
if type(event) == 'table' and type(event.itemRewardIDs) == 'table' then | if type(event) == 'table' and type(event.itemRewardIDs) == 'table' then | ||
for | for eventCycle, itemRewardID in ipairs(event.itemRewardIDs) do | ||
if item.id == itemRewardID then | if item.id == itemRewardID then | ||
local dungPrefix = ( | local dungPrefix = (eventCycle == Shared.tableCount(event.itemRewardIDs) and '' or eventCycle .. (eventCycle == 1 and ' cycle' or ' cycles') .. ' of ') | ||
table.insert(dungeonStrPart, dungPrefix .. Icons.Icon({dungeon.name, type='dungeon', notext=true})) | table.insert(dungeonStrPart, dungPrefix .. Icons.Icon({dungeon.name, type='dungeon', notext=true})) | ||
break | break | ||
Line 342: | Line 348: | ||
if item2.dropTable ~= nil then | if item2.dropTable ~= nil then | ||
for j, loot in ipairs(item2.dropTable) do | for j, loot in ipairs(item2.dropTable) do | ||
if loot. | if loot.itemID == item.id then | ||
table.insert(lootPart, Icons.Icon({item2.name, type='item', notext=true})) | table.insert(lootPart, Icons.Icon({item2.name, type='item', notext=true})) | ||
break | break | ||
Line 369: | Line 375: | ||
local upgradeCat = false | local upgradeCat = false | ||
for | for catName, parts in pairs(upgradePart) do | ||
if not Shared.tableIsEmpty(parts) then | if not Shared.tableIsEmpty(parts) then | ||
if not upgradeCat then | if not upgradeCat then | ||
Line 375: | Line 381: | ||
upgradeCat = true | upgradeCat = true | ||
end | end | ||
local typeText = ( | local typeText = (catName == 'up' and 'Upgrading') or 'Downgrading' | ||
table.insert(lineArray, typeText .. ': ' .. table.concat(parts, ',')) | table.insert(lineArray, typeText .. ': ' .. table.concat(parts, ',')) | ||
end | end | ||
Line 383: | 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 388: | 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 | ||
if | if not Shared.tableIsEmpty(thiefPart) then | ||
table.insert(lineArray, 'Pickpocketing: ' .. table.concat(thiefPart, ',')) | table.insert(lineArray, 'Pickpocketing: ' .. table.concat(thiefPart, ',')) | ||
end | end | ||
end | |||
-- Can we get this item by casting an Alt. Magic spell? | |||
local castPart = {} | |||
for i, spell in ipairs(Magic.getSpellsProducingItem(item.id)) do | |||
table.insert(castPart, Icons.Icon({spell.name, type=Magic._getSpellIconType(spell), notext=true})) | |||
end | |||
if not Shared.tableIsEmpty(castPart) then | |||
table.insert(lineArray, 'Casting: ' .. table.concat(castPart, ',')) | |||
end | end | ||
Line 417: | Line 434: | ||
-- Gathering skills | -- Gathering skills | ||
for localSkillID, dataProp in | for localSkillID, dataProp in pairs(skillIDs.Gathering) do | ||
local skillData = SkillData[localSkillID] | local skillData = SkillData[localSkillID] | ||
local skill = skillData.name | local skill = skillData.name | ||
for i, recipe in ipairs(skillData[dataProp.recipeKey]) do | for i, recipe in ipairs(skillData[dataProp.recipeKey]) do | ||
if recipe.productId == item.id then | if recipe.productId == item.id then | ||
table.insert(lineArray, Icons._SkillReq(skill, recipe.level)) | if localSkillID == 'Farming' and recipe.seedCost ~= nil then | ||
local seedItem = Items.getItemByID(recipe.seedCost.id) | |||
if seedItem ~= nil then | |||
table.insert(lineArray, 'Growing: ' .. Icons.Icon({seedItem.name, type='item', notext='true'})) | |||
end | |||
else | |||
table.insert(lineArray, Icons._SkillReq(skill, recipe.level)) | |||
end | |||
break | break | ||
end | end | ||
Line 429: | Line 453: | ||
-- Artisan skills | -- Artisan skills | ||
for localSkillID, dataProp in | for localSkillID, dataProp in pairs(skillIDs.Artisan) do | ||
local skillData = SkillData[localSkillID] | local skillData = SkillData[localSkillID] | ||
local skill = skillData.name | local skill = skillData.name | ||
for i, recipe in ipairs(skillData.recipes) do | for i, recipe in ipairs(skillData.recipes) do | ||
if recipe.productID == item.id or (localSkillID == 'Cooking' and recipe.perfectCookID == item.id) then | if recipe.productID == item.id or | ||
(localSkillID == 'Cooking' and recipe.perfectCookID == item.id) or | |||
(localSkillID == 'Herblore' and Shared.contains(recipe.potionIDs, item.id)) then | |||
table.insert(lineArray, Icons._SkillReq(skill, recipe.level)) | table.insert(lineArray, Icons._SkillReq(skill, recipe.level)) | ||
break | break | ||
Line 445: | Line 471: | ||
end | end | ||
-- Woodcutting | -- Woodcutting | ||
-- | -- Raven Nest | ||
if | if item.id == SkillData.Woodcutting.ravenNestItemID then | ||
local levelReq = nil | local levelReq = nil | ||
for i, tree in ipairs(SkillData.Woodcutting.trees) do | for i, tree in ipairs(SkillData.Woodcutting.trees) do | ||
Line 457: | Line 481: | ||
end | end | ||
table.insert(lineArray, Icons._SkillReq(SkillData.Woodcutting.name, levelReq)) | table.insert(lineArray, Icons._SkillReq(SkillData.Woodcutting.name, levelReq)) | ||
-- Bird Nest, Ash, and Mushroom | |||
elseif Shared.contains({ | |||
SkillData.Woodcutting.nestItemID, | |||
SkillData.Woodcutting.ashItemID, | |||
SkillData.Woodcutting.mushroomItemID | |||
}, item.id) then | |||
table.insert(lineArray, Icons._SkillReq(SkillData.Woodcutting.name, 1)) | |||
end | end | ||
-- Fishing | -- Fishing | ||
-- Junk | |||
if Shared.contains(SkillData.Fishing.junkItemIDs, item.id) then | if Shared.contains(SkillData.Fishing.junkItemIDs, item.id) then | ||
table.insert(lineArray, Icons.Icon({'Fishing', type='skill', notext=true}) .. ' [[Fishing#Junk|Junk]]') | table.insert(lineArray, Icons.Icon({'Fishing', type='skill', notext=true}) .. ' [[Fishing#Junk|Junk]]') | ||
-- Specials | |||
elseif GameData.getEntityByProperty(SkillData.Fishing.specialItems, 'itemID', item.id) ~= nil then | elseif GameData.getEntityByProperty(SkillData.Fishing.specialItems, 'itemID', item.id) ~= nil then | ||
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 | |||
table.insert(lineArray, Icons._SkillReq(SkillData.Fishing.name, 100)) | |||
end | end | ||
-- Firemaking: Coal | -- Firemaking: Coal | ||
if Shared.contains({SkillData.Firemaking.coalItemID, | |||
SkillData.Firemaking.ashItemID, | |||
table.insert(lineArray, Icons._SkillReq( | SkillData.Firemaking.charcoalItemID, | ||
SkillData.Firemaking.fireSpiritItemID, | |||
SkillData.Firemaking.diamondItemID | |||
}, item.id) then | |||
table.insert(lineArray, Icons._SkillReq(SkillData.Firemaking.name, 1)) | |||
end | end | ||
Line 476: | Line 515: | ||
GameData.getEntityByProperty('randomSuperiorGems', 'itemID', item.id) ~= nil) then | GameData.getEntityByProperty('randomSuperiorGems', 'itemID', item.id) ~= nil) then | ||
table.insert(lineArray, Icons.Icon({"Mining", type='skill', notext=true})..' [[Mining#Gems|Gem]]') | table.insert(lineArray, Icons.Icon({"Mining", type='skill', notext=true})..' [[Mining#Gems|Gem]]') | ||
elseif item.id == SkillData.Mining.runestoneItemID then | |||
-- From pure essence mining | |||
local recipe = GameData.getEntityByID(SkillData.Mining.rockData, 'melvorTotH:Pure_Essence') | |||
if recipe ~= nil then | |||
table.insert(lineArray, Icons._SkillReq(SkillData.Mining.name, recipe.level)) | |||
end | |||
end | end | ||
Line 511: | Line 551: | ||
--Tokens are from the appropriate skill | --Tokens are from the appropriate skill | ||
if item.modifiers ~= nil and item.modifiers.masteryToken ~= nil then | if item.modifiers ~= nil and item.modifiers.masteryToken ~= nil then | ||
for localSkillID, skillData in | for localSkillID, skillData in pairs(SkillData) do | ||
if skillData.masteryTokenID ~= nil and skillData.masteryTokenID == item.id then | if skillData.masteryTokenID ~= nil and skillData.masteryTokenID == item.id then | ||
table.insert(lineArray, Icons._SkillReq(skillData.name, 1)) | table.insert(lineArray, Icons._SkillReq(skillData.name, 1)) | ||
Line 547: | 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 582: | 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 624: | 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 = Icons.Icon({monster.name, type='monster'}), type = '[[Monster]]', minqty = drop.minQty, drop.maxQty, weight = drop.dropWt, totalWeight = drop.totalWt}) | 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 632: | 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 = Icons.Icon({dungeon.name, type='dungeon'}), type = '[[Dungeon]]', minqty = 1, qty = 1, weight = 1, totalWeight = 1}) | 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)? | ||
local event = GameData.getEntityByID('combatEvents', dungeon.eventID) | local event = GameData.getEntityByID('combatEvents', dungeon.eventID) | ||
if type(event) == 'table' and type(event.itemRewardIDs) == 'table' then | if type(event) == 'table' and type(event.itemRewardIDs) == 'table' then | ||
for | for eventCycle, itemRewardID in ipairs(event.itemRewardIDs) do | ||
if item.id == itemRewardID then | if item.id == itemRewardID then | ||
local sourceTxt = Icons.Icon({dungeon.name, type='dungeon' | 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 654: | Line 712: | ||
for j, loot in ipairs(item2.dropTable) do | for j, loot in ipairs(item2.dropTable) do | ||
totalWt = totalWt + loot.weight | totalWt = totalWt + loot.weight | ||
if loot. | if loot.itemID == item.id then | ||
wt = loot.weight | wt = loot.weight | ||
minQty = loot.minQuantity | minQty = loot.minQuantity | ||
Line 663: | 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 677: | 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 706: | Line 764: | ||
for i, gemKey in ipairs(gemKeys) do | for i, gemKey in ipairs(gemKeys) do | ||
local thisGem, totalGemWeight = nil, 0 | local thisGem, totalGemWeight = nil, 0 | ||
for j, gem in ipairs(GameData[gemKey]) do | for j, gem in ipairs(GameData.rawData[gemKey]) do | ||
totalGemWeight = totalGemWeight + gem.weight | totalGemWeight = totalGemWeight + gem.weight | ||
if gem.itemID == item.id then | if gem.itemID == item.id then | ||
Line 714: | 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 721: | 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= | 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 730: | Line 796: | ||
--Make sure to return nothing if there are no drop sources | --Make sure to return nothing if there are no drop sources | ||
if Shared.tableIsEmpty(dropRows) then return '' end | if Shared.tableIsEmpty(dropRows) then return '' end | ||
table.sort(dropRows, function(a, b) | table.sort(dropRows, function(a, b) | ||
if a.weight / a.totalWeight == b.weight / b.totalWeight then | if a.weight / a.totalWeight == b.weight / b.totalWeight then | ||
Line 743: | 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 796: | Line 862: | ||
function p._getSuperheatSmithRecipe(item) | function p._getSuperheatSmithRecipe(item) | ||
local smithRecipe = GameData. | local smithRecipe = GameData.getEntityByProperty(SkillData.Smithing.recipes, 'productID', item.id) | ||
if smithRecipe ~= nil and smithRecipe. | if smithRecipe ~= nil and smithRecipe.categoryID == 'melvorD:Bars' then | ||
return smithRecipe | return smithRecipe | ||
end | end | ||
Line 805: | Line 871: | ||
--Manually build the Superheat Item table | --Manually build the Superheat Item table | ||
-- Validate that the item can be superheated | -- Validate that the item can be superheated | ||
local smithRecipe = p._getSuperheatSmithRecipe(item | local smithRecipe = p._getSuperheatSmithRecipe(item) | ||
if smithRecipe == nil then | if smithRecipe == nil then | ||
return 'ERROR: The item "' .. item.name .. '" cannot be superheated[[Category:Pages with script errors]]' | return 'ERROR: The item "' .. item.name .. '" cannot be superheated[[Category:Pages with script errors]]' | ||
Line 833: | Line 899: | ||
for i, spell in ipairs(spells) do | for i, spell in ipairs(spells) do | ||
if spell.specialCost ~= nil and Shared.contains({ 'BarIngredientsWithCoal', 'BarIngredientsWithoutCoal' }, spell.specialCost.type) then | if spell.specialCost ~= nil and Shared.contains({ 'BarIngredientsWithCoal', 'BarIngredientsWithoutCoal' }, spell.specialCost.type) then | ||
local imgType = | local imgType = Magic._getSpellIconType(spell) | ||
table.insert(superheatTable, '\r\n|-\r\n|'..Icons.Icon({spell.name, type=imgType, notext=true, size=50})) | table.insert(superheatTable, '\r\n|-\r\n|'..Icons.Icon({spell.name, type=imgType, notext=true, size=50})) | ||
table.insert(superheatTable, '||'..Icons.Icon({spell.name, type=imgType, noicon=true})..'||style="text-align:right;"|'..smithRecipe.level) | table.insert(superheatTable, '||'..Icons.Icon({spell.name, type=imgType, noicon=true})..'||style="text-align:right;"|'..smithRecipe.level) | ||
Line 881: | Line 947: | ||
end | end | ||
if p._getSuperheatSmithRecipe(item | if p._getSuperheatSmithRecipe(item) ~= nil then | ||
table.insert(resultPart, '\r\n==='..Icons.Icon({'Alt. Magic', type='skill'})..'===\r\n'..p._getItemSuperheatTable(item)) | table.insert(resultPart, '\r\n==='..Icons.Icon({'Alt. Magic', type='skill'})..'===\r\n'..p._getItemSuperheatTable(item)) | ||
end | end | ||
Line 930: | Line 996: | ||
local minQty = 1 | local minQty = 1 | ||
local maxQty = 1 | local maxQty = 1 | ||
if monster.bones == item.id and Monsters._getMonsterBones(monster) ~= nil then | if monster.bones ~= nil and monster.bones.itemID == item.id and Monsters._getMonsterBones(monster) ~= nil then | ||
-- Item is a bone, and is either a shard from God dungeons or dropped by a non-boss monster with a loot table | -- Item is a bone, and is either a shard from God dungeons or dropped by a non-boss monster with a loot table | ||
maxQty = (monster.bones.quantity ~= nil and monster.bones.quantity) or 1 | maxQty = (monster.bones.quantity ~= nil and monster.bones.quantity) or 1 | ||
Line 949: | Line 1,015: | ||
end | end | ||
end | end | ||
local lootChance = monster.lootChance ~= nil and monster.bones ~= item.id and monster.lootChance or 100 | local lootChance = monster.lootChance ~= nil and (monster.bones == nil or monster.bones.itemID ~= item.id) and monster.lootChance or 100 | ||
chance = chance * lootChance | chance = chance * lootChance | ||
weight = weight * 100 | weight = weight * 100 | ||
Line 1,001: | 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 = { |