16,999
edits
(Update for v1.0.2) |
(Update for v1.0.3) |
||
Line 80: | Line 80: | ||
foundIDs[1061] = true | foundIDs[1061] = true | ||
-- Harvested | -- Cooked food | ||
for i, recipe in ipairs(SkillData.Cooking.Recipes) do | |||
foundIDs[recipe.itemID] = true | |||
local cookedItem = Items.getItemByID(recipe.itemID) | |||
if cookedItem ~= nil then | |||
local catIdx = recipe.category + 1 | |||
-- Initialize category if it doesn't already exist | |||
if cookedFood[catIdx] == nil then | |||
cookedFood[catIdx] = {} | |||
end | |||
local perfectName = nil | |||
if recipe.perfectCookID ~= nil then | |||
local perfectItem = Items.getItemByID(recipe.perfectCookID) | |||
if perfectItem ~= nil then | |||
perfectName = perfectItem.name | |||
foundIDs[recipe.perfectCookID] = true | |||
end | |||
end | |||
table.insert(cookedFood[catIdx], { ["name"] = cookedItem.name, ["order"] = recipe.level, ["perfectName"] = perfectName }) | |||
end | |||
end | |||
-- Harvested foods | |||
for i, item in ipairs(ItemData.Items) do | for i, item in ipairs(ItemData.Items) do | ||
if item.grownItemID ~= nil then | if item.grownItemID ~= nil and not foundIDs[item.grownItemID] then | ||
-- Item is grown from farming and can be eaten | |||
local grownItem = Items.getItemByID(item.grownItemID) | local grownItem = Items.getItemByID(item.grownItemID) | ||
if grownItem ~= nil and grownItem.canEat then | if grownItem ~= nil and grownItem.canEat then | ||
Line 91: | Line 115: | ||
end | end | ||
-- | -- Other foods, must be checked after cooked & harvested foods have been identified | ||
for i, item in ipairs(ItemData.Items) do | for i, item in ipairs(ItemData.Items) do | ||
if item.canEat and not foundIDs[item.id] then | |||
if | -- Item can be eaten but isn't cooked nor harvested | ||
table.insert(otherFood, { ["name"] = item.name, ["order"] = item.id }) | |||
foundIDs[item.id] = true | |||
foundIDs[ | |||
end | end | ||
end | end | ||
Line 146: | Line 152: | ||
local resultPart = {} | local resultPart = {} | ||
table.insert(resultPart, '{| class="wikitable mw-collapsible" style="margin:0 auto 10px; clear:both; width: 100%"') | table.insert(resultPart, '{| class="wikitable mw-collapsible" style="margin:0 auto 10px; clear:both; width: 100%"') | ||
table.insert(resultPart, '\r\n|-\r\n!style="background-color:#275C87;color:#FFFFFF;padding-left:64px;" colspan="2"| | table.insert(resultPart, '\r\n|-\r\n!style="background-color:#275C87;color:#FFFFFF;padding-left:64px;" colspan="2"| ') | ||
table.insert(resultPart, Icons.Icon({'Food', type='item', img='Crab'})) | |||
table.insert(resultPart, '\r\n|-\r\n!colspan="2"| Cooked') | table.insert(resultPart, '\r\n|-\r\n!colspan="2"| Cooked') | ||
for catID, foodTable in ipairs(cookedFood) do | for catID, foodTable in ipairs(cookedFood) do | ||
Line 227: | Line 234: | ||
function p.getRuneNavbox(frame) | function p.getRuneNavbox(frame) | ||
-- Assumes all runes are from Runecrafting, which may need revising in future updates | -- Assumes all runes are from Runecrafting, which may need revising in future updates | ||
local | local catNames = { 'Standard', 'Combination' } | ||
for i, | local runeList = { {}, {} } | ||
for i, recipe in ipairs(SkillData.Runecrafting.Recipes) do | |||
local | local catIdx = recipe.category + 1 | ||
table.insert(runeList[ | if catNames[catIdx] ~= nil then | ||
local item = Items.getItemByID(recipe.itemID) | |||
if item ~= nil then | |||
table.insert(runeList[catIdx], { ["name"] = item.name, ["order"] = recipe.level }) | |||
end | |||
end | end | ||
end | end | ||
Line 237: | Line 248: | ||
local resultPart = {} | local resultPart = {} | ||
table.insert(resultPart, '{| class="wikitable" style="margin:auto; clear:both; width: 100%"') | table.insert(resultPart, '{| class="wikitable" style="margin:auto; clear:both; width: 100%"') | ||
table.insert(resultPart, '\r\n!colspan="2"| | table.insert(resultPart, '\r\n!colspan="2"|' .. Icons.Icon({'Runes', type='item', img='Air Rune'})) | ||
for | for catIdx, catName in ipairs(catNames) do | ||
table.sort(runeList[ | table.sort(runeList[catIdx], function(a, b) return (a.order == b.order and a.name < b.name) or a.order < b.order end) | ||
table.insert(resultPart, '\r\n|-\r\n!scope="row"|' .. | table.insert(resultPart, '\r\n|-\r\n!scope="row"|' .. catName .. ' Runes') | ||
local listPart = {} | local listPart = {} | ||
for j, rune in ipairs(runeList[ | for j, rune in ipairs(runeList[catIdx]) do | ||
table.insert(listPart, Icons.Icon({rune.name, type='item'})) | table.insert(listPart, Icons.Icon({rune.name, type='item'})) | ||
end | end | ||
Line 275: | Line 286: | ||
local resultPart = {} | local resultPart = {} | ||
table.insert(resultPart, '{| class="wikitable" style="margin:auto; clear:both; width: 100%"') | table.insert(resultPart, '{| class="wikitable" style="margin:auto; clear:both; width: 100%"') | ||
table.insert(resultPart, '\r\n! | table.insert(resultPart, '\r\n!' .. Icons.Icon({'Skillcapes', type='item', img='Cape of Completion'})) | ||
table.insert(resultPart, '\r\n|-\r\n|style="text-align:center;"|'..table.concat(capeText, ' • ')) | table.insert(resultPart, '\r\n|-\r\n|style="text-align:center;"|'..table.concat(capeText, ' • ')) | ||
table.insert(resultPart, '\r\n|}') | table.insert(resultPart, '\r\n|}') | ||
Line 318: | Line 329: | ||
local resultPart = {} | local resultPart = {} | ||
table.insert(resultPart, '{| class="wikitable" style="margin:auto; clear:both; width: 100%"') | table.insert(resultPart, '{| class="wikitable" style="margin:auto; clear:both; width: 100%"') | ||
table.insert(resultPart, '\r\n!colspan=2| | table.insert(resultPart, '\r\n!colspan=2|' .. Icons.Icon({'Spells', type='skill', img='Magic'})) | ||
for i, catDefn in ipairs(catData) do | for i, catDefn in ipairs(catData) do | ||
table.sort(spellTable[catDefn.name], function(a, b) | table.sort(spellTable[catDefn.name], function(a, b) | ||
Line 336: | Line 347: | ||
function p.getFamiliarNavbox(frame) | function p.getFamiliarNavbox(frame) | ||
local | local familiarList = {} | ||
table.sort( | for i, recipe in ipairs(SkillData.Summoning.Marks) do | ||
local item = Items.getItemByID(recipe.itemID) | |||
if item ~= nil then | |||
table.insert(familiarList, { ["name"] = item.name, ["order"] = recipe.level }) | |||
end | |||
end | |||
table.sort(familiarList, function(a, b) return a.order < b.order end) | |||
local | local resultPart = {} | ||
table.insert(resultPart, '{| class="wikitable" style="margin:auto; clear:both; width: 100%"') | |||
table.insert(resultPart, '\r\n!colspan=2|' .. Icons.Icon({'Summoning', 'Summoning Familiars', type='skill'})) | |||
local iconArray = {} | local iconArray = {} | ||
for i, fam in | for i, fam in ipairs(familiarList) do | ||
table.insert(iconArray, Icons.Icon({fam.name, type='item'})) | table.insert(iconArray, Icons.Icon({fam.name, type='item'})) | ||
end | end | ||
table.insert(resultPart, '\r\n|-\r\n|style="text-align:center;"|'..table.concat(iconArray, ' • ')) | |||
table.insert(resultPart, '\r\n|}') | |||
return | return table.concat(resultPart) | ||
end | end | ||
Line 355: | Line 373: | ||
-- Create table header | -- Create table header | ||
table.insert(returnPart, '{| class="wikitable" style="text-align:center; clear:both; margin:auto; margin-bottom:1em;"') | table.insert(returnPart, '{| class="wikitable" style="text-align:center; clear:both; margin:auto; margin-bottom:1em;"') | ||
table.insert(returnPart, '|-\r\n!' .. Icons.Icon({'Thieving', type='skill' | table.insert(returnPart, '|-\r\n!' .. Icons.Icon({'Thieving', 'Thieving Targets', type='skill'})) | ||
table.insert(returnPart, '|-\r\n|') | table.insert(returnPart, '|-\r\n|') | ||
Line 387: | Line 405: | ||
end | end | ||
-- Fishing areas | -- Fishing areas | ||
-- Iterate through all fishing areas, identifying fish within each | -- Iterate through all fishing areas, identifying fish within each | ||
for i, area in ipairs(SkillData.Fishing.Areas) do | for i, area in ipairs(SkillData.Fishing.Areas) do | ||
for j, | for j, recipe in ipairs(area.fish) do | ||
local fishItem = | local fishItem = Items.getItemByID(recipe.itemID) | ||
if fishItem ~= nil then | if fishItem ~= nil then | ||
addCatData(area.name, 'Fishing#Fishing Areas', fishItem.name, | addCatData(area.name, 'Fishing#Fishing Areas', fishItem.name, recipe.level) | ||
end | end | ||
end | end | ||
end | end | ||
-- Junk items | -- Junk items | ||
for i, | for i, itemID in ipairs(SkillData.Fishing.JunkItems) do | ||
addCatData('Junk', 'Fishing#Junk', item.name, 1) | local item = Items.getItemByID(itemID) | ||
if item ~= nil then | |||
addCatData('Junk', 'Fishing#Junk', item.name, 1) | |||
end | |||
end | end | ||
-- Special items | -- Special items | ||
for i, | for i, itemDef in ipairs(SkillData.Fishing.SpecialItems) do | ||
addCatData('Special Items', 'Fishing#Special', item.name, 1 / | local item = Items.getItemByID(itemDef[1]) | ||
if item ~= nil then | |||
local weight = itemDef[2] or 1 | |||
addCatData('Special Items', 'Fishing#Special', item.name, 1 / weight) | |||
end | |||
end | end | ||