17,097
edits
(0.21 testing) |
m (Try to optimise _getItemSources()) |
||
Line 312: | Line 312: | ||
--Alright, time to go through all the ways you can get an item... | --Alright, time to go through all the ways you can get an item... | ||
--First up: Can we kill somebody and take theirs? | --First up: Can we kill somebody and take theirs? | ||
local killStr = | local killStr = {} | ||
local dungeonStr = | local dungeonStr = {} | ||
for i, monster in Shared.skpairs(MonsterData.Monsters) do | for i, monster in Shared.skpairs(MonsterData.Monsters) do | ||
local isDrop = false | local isDrop = false | ||
Line 345: | Line 344: | ||
--If this is a boss then we actually are completing dungeons for this and need to figure out which one | --If this is a boss then we actually are completing dungeons for this and need to figure out which one | ||
for j, dung in pairs(areaList) do | for j, dung in pairs(areaList) do | ||
table.insert(dungeonStr, (#dungeonStr > 0 and ',' or 'Completing: ') .. Icons.Icon({dung.name, type="dungeon", notext=true})) | |||
end | end | ||
else | else | ||
table.insert(killStr, (#killStr > 0 and ',' or 'Killing: ') .. Icons.Icon({monster.name, type="monster", notext="true"})) | |||
end | end | ||
end | end | ||
Line 366: | Line 353: | ||
-- Special exceptions for Fire/Infernal Cape and first two lore books | -- Special exceptions for Fire/Infernal Cape and first two lore books | ||
if sourceOverrides['Dungeon'][item.id] ~= nil then | if sourceOverrides['Dungeon'][item.id] ~= nil then | ||
table.insert(dungeonStr, (#dungeonStr > 0 and ',' or 'Completing: ') .. Icons.Icon({sourceOverrides['Dungeon'][item.id], type="dungeon", notext=true})) | |||
end | end | ||
if | if #dungeonStr > 0 then table.insert(lineArray, table.concat(dungeonStr)) end | ||
if | if #killStr > 0 then table.insert(lineArray, table.concat(killStr)) end | ||
--Next: Can we find it in a box? | --Next: Can we find it in a box? | ||
--While we're here, check for upgrades, cooking, and growing | --While we're here, check for upgrades, cooking, and growing | ||
local lootStr = | local lootStr = {} | ||
local upgradeStr = | local upgradeStr = {} | ||
local cookStr = | local cookStr = {} | ||
local burnStr = | local burnStr = {} | ||
local growStr = | local growStr = {} | ||
for i, item2 in pairs(ItemData.Items) do | for i, item2 in pairs(ItemData.Items) do | ||
if item2.dropTable ~= nil then | if item2.dropTable ~= nil then | ||
for j, loot in pairs(item2.dropTable) do | for j, loot in pairs(item2.dropTable) do | ||
if loot[1] == item.id then | if loot[1] == item.id then | ||
table.insert(lootStr, (#lootStr > 0 and ',' or 'Opening: ') .. Icons.Icon({item2.name, type="item", notext="true"})) | |||
break | |||
end | end | ||
end | end | ||
end | end | ||
if item2.trimmedItemID == item.id then | if item2.trimmedItemID == item.id then | ||
local pre = ',' | |||
if #upgradeStr == 0 then | |||
pre = 'Upgrading: ' | |||
table.insert(categoryArray, '[[Category:Upgraded Items]]') | table.insert(categoryArray, '[[Category:Upgraded Items]]') | ||
end | end | ||
table.insert(upgradeStr, pre .. Icons.Icon({item2.name, type="item", notext="true"})) | |||
end | end | ||
if item2.cookedItemID == item.id then | if item2.cookedItemID == item.id then | ||
if | local pre = ',' | ||
if #cookStr == 0 then | |||
pre = 'Cooking: ' | |||
table.insert(categoryArray, '[[Category:Cooked Items]]') | table.insert(categoryArray, '[[Category:Cooked Items]]') | ||
end | end | ||
table.insert(cookStr, pre .. Icons.Icon({item2.name, type="item", notext="true"})) | |||
end | end | ||
if item2.burntItemID == item.id then | if item2.burntItemID == item.id then | ||
if | local pre = ',' | ||
if #burnstr == 0 then | |||
pre = 'Burning: ' | |||
table.insert(categoryArray, '[[Category:Burnt Items]]') | table.insert(categoryArray, '[[Category:Burnt Items]]') | ||
end | end | ||
table.insert(burnStr, pre .. Icons.Icon({item2.name, type="item", notext="true"})) | |||
end | end | ||
if item2.grownItemID == item.id then | if item2.grownItemID == item.id then | ||
if | local pre = ',' | ||
if #growStr == 0 then | |||
pre = 'Growing: ' | |||
table.insert(categoryArray, '[[Category:Harvestable Items]]') | table.insert(categoryArray, '[[Category:Harvestable Items]]') | ||
end | end | ||
table.insert(growStr, pre .. Icons.Icon({item2.name, type="item", notext="true"})) | |||
end | end | ||
end | end | ||
if | if #lootStr > 0 then table.insert(lineArray, table.concat(lootStr)) end | ||
if | if #upgradeStr > 0 then table.insert(lineArray, table.concat(upgradeStr)) end | ||
if | if #cookStr > 0 then table.insert(lineArray, table.concat(cookStr)) end | ||
if | if #burnStr > 0 then table.insert(lineArray, table.concat(burnStr)) end | ||
if | if #growStr > 0 then table.insert(lineArray, table.concat(growStr)) end | ||
--Next: Can we take it from somebody else -without- killing them? | --Next: Can we take it from somebody else -without- killing them? | ||
local thiefStr = | local thiefStr = {} | ||
for i, npc in pairs(SkillData.Thieving) do | for i, npc in pairs(SkillData.Thieving) do | ||
if npc.lootTable ~= nil then | if npc.lootTable ~= nil then | ||
for j, loot in pairs(npc.lootTable) do | for j, loot in pairs(npc.lootTable) do | ||
if loot[1] == item.id then | if loot[1] == item.id then | ||
table.insert(theifStr, (#thiefStr > 0 and ',' or 'Pickpocketing: ') .. Icons.Icon({npc.name, type="thieving", notext="true"})) | |||
break | |||
end | end | ||
end | end | ||
end | end | ||
end | end | ||
if | if #thiefStr > 0 then table.insert(lineArray, table.concat(thiefStr)) end | ||
--If all else fails, I guess we should check if we can make it ourselves | --If all else fails, I guess we should check if we can make it ourselves |