12,704
edits
(Substitute links with Icons.Icon() where possible to benefit from ambiguous link handling) |
(_getItemUses: Classify items with special attacks as used in combat) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 18: | Line 18: | ||
local itemUseArray = { | local itemUseArray = { | ||
Agility = {}, | Agility = {}, | ||
Astrology = {'Stardust', 'Golden Stardust'}, | |||
Attack = {}, | Attack = {}, | ||
Combat = {'Gold Emerald Ring'}, | Combat = {'Gold Emerald Ring'}, | ||
Line 67: | Line 68: | ||
[23] = 'Combat', | [23] = 'Combat', | ||
[24] = 'Agility', | [24] = 'Agility', | ||
[25] = 'Summoning' | [25] = 'Summoning', | ||
[26] = 'Combat', | |||
[27] = 'Combat', | |||
[28] = 'Combat', | |||
[29] = 'Astrology' | |||
} | } | ||
Line 78: | Line 83: | ||
--Before anything else, if this is a potion add it to the appropriate override section | --Before anything else, if this is a potion add it to the appropriate override section | ||
if item.masteryID ~= nil and item.masteryID[1] == 19 then | if item.masteryID ~= nil and item.masteryID[1] == 19 then | ||
if potionUseArray[item.masteryID[2]] ~= nil then | |||
table.insert(itemUseArray[potionUseArray[item.masteryID[2]]], item.name) | |||
else | |||
table.insert(itemUseArray["Combat"], item.name) | |||
end | |||
end | end | ||
--If the item has any modifiers that affect a given skill, add it to those lists | --If the item has any modifiers that affect a given skill, add it to those lists | ||
if item.modifiers ~= nil then | --Added an exception for Mastery Tokens since they were being incorrectly flagged as usable for all skills | ||
if item.modifiers ~= nil and (item.isToken == nil or not item.isToken) then | |||
local skillArray = Constants.getModifierSkills(item.modifiers) | local skillArray = Constants.getModifierSkills(item.modifiers) | ||
for i, skillName in Shared.skpairs(skillArray) do | for i, skillName in Shared.skpairs(skillArray) do | ||
Line 90: | Line 100: | ||
--First things added to the list are non-skill things that are easy to check | --First things added to the list are non-skill things that are easy to check | ||
if Items.hasCombatStats(item) or Shared.contains(itemUseArray.Combat, item.name) then | if Items.hasCombatStats(item) or item.specialAttacks ~= nil or Shared.contains(itemUseArray.Combat, item.name) then | ||
table.insert(useArray, chr..Icons.Icon({'Combat'})) | table.insert(useArray, chr..Icons.Icon({'Combat'})) | ||
end | end | ||
Line 209: | Line 219: | ||
if canAgile or Shared.contains(itemUseArray.Agility, item.name) then | if canAgile or Shared.contains(itemUseArray.Agility, item.name) then | ||
table.insert(useArray, chr..Icons.Icon({'Agility', type='skill'})) | table.insert(useArray, chr..Icons.Icon({'Agility', type='skill'})) | ||
end | |||
--Astrology | |||
if Shared.contains(itemUseArray.Astrology, item.name) then | |||
table.insert(useArray, chr..Icons.Icon({'Astrology', type='skill'})) | |||
end | end | ||
--Cooking | --Cooking | ||
Line 283: | Line 297: | ||
--And combat skillcapes, since combat skills don't get special treatment | --And combat skillcapes, since combat skills don't get special treatment | ||
local ignoreCapes = {'Ranged Skillcape', 'Attack Skillcape', 'Strength Skillcape', ' | local ignoreCapes = {'Ranged Skillcape', 'Attack Skillcape', 'Strength Skillcape', 'HP Skillcape', 'Defence Skillcape'} | ||
if Shared.contains({'Maximum Skillcape', 'Aorpheat's Signet Ring', 'Cape of Completion'}, item.name) then | if Shared.contains({'Maximum Skillcape', 'Aorpheat's Signet Ring', 'Cape of Completion'}, item.name) then | ||
table.insert(useArray, chr..'All skills') | table.insert(useArray, chr..'All skills') | ||
Line 470: | Line 484: | ||
local xp = item.farmingXP | local xp = item.farmingXP | ||
local rowReq = item.farmingLevel | local rowReq = item.farmingLevel | ||
local qty = | local qty = (item.tier ~= nil and item.tier == 'Tree' and 35 or 15) | ||
table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Farming', req = rowReq, xp = xp}) | table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Farming', req = rowReq, xp = xp}) | ||
end | end |