12,787
edits
Falterfire (talk | contribs) (ensured gp cost shows up when crafting Thief's Moneysack) |
(_getItemUses: Classify items with special attacks as used in combat) |
||
(6 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 439: | Line 453: | ||
local xp = potionData.herbloreXP | local xp = potionData.herbloreXP | ||
--Potions do have upgrade requirements though | --Potions do have upgrade requirements though | ||
local rowReq = Icons._SkillReq('Herblore', potionData. | local rowReq = Icons._SkillReq('Herblore', potionData.level) | ||
local masteryLvl = potTierMastery[item2.potionTier] | local masteryLvl = potTierMastery[item2.potionTier] | ||
if masteryLvl > 0 then | if masteryLvl > 0 then | ||
rowReq = rowReq..'<br/>'..Icons._MasteryReq(item2.name, masteryLvl) | rowReq = rowReq..'<br/>'..Icons._MasteryReq(item2.name, masteryLvl) | ||
end | end | ||
local reqVal = potionData. | local reqVal = potionData.level + (masteryLvl * 0.01) | ||
table.insert(useArray, {item = item2, qty = 1, mats = mat, skill = 'Herblore', reqVal = reqVal, req = rowReq, xp = xp}) | table.insert(useArray, {item = item2, qty = 1, mats = mat, skill = 'Herblore', reqVal = reqVal, req = rowReq, xp = xp}) | ||
break | break | ||
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 | ||
Line 515: | Line 529: | ||
table.insert(resultPart, Icons.Icon({row.item.name, type=iconType, notext=true, size=50})..'||') | table.insert(resultPart, Icons.Icon({row.item.name, type=iconType, notext=true, size=50})..'||') | ||
if qty > 1 then table.insert(resultPart, "'''"..qty.."x''' ") end | if qty > 1 then table.insert(resultPart, "'''"..qty.."x''' ") end | ||
table.insert(resultPart, | table.insert(resultPart, Icons.Icon({row.item.name, type='item', noicon=true})) | ||
if row.skill == 'Upgrade' then | if row.skill == 'Upgrade' then | ||
table.insert(resultPart, '||data-sort-value="Upgrade"|[[Upgrading Items|Upgrade]]') | table.insert(resultPart, '||data-sort-value="Upgrade"|[[Upgrading Items|Upgrade]]') | ||
Line 641: | Line 655: | ||
local iconType = (spell.type == 'Auroras' and 'aurora') or (spell.type == 'Curses' and 'curse') or 'spell' | local iconType = (spell.type == 'Auroras' and 'aurora') or (spell.type == 'Curses' and 'curse') or 'spell' | ||
table.insert(rowPart, Icons.Icon({spell.name, type=iconType, notext=true, size=50})) | table.insert(rowPart, Icons.Icon({spell.name, type=iconType, notext=true, size=50})) | ||
table.insert(rowPart, '|| | table.insert(rowPart, '||'..Icons.Icon({spell.name, type=iconType, noicon=true})) | ||
table.insert(rowPart, '||data-sort-value="'..spell.level..'"|'..Icons._SkillReq('Magic', spell.level)) | table.insert(rowPart, '||data-sort-value="'..spell.level..'"|'..Icons._SkillReq('Magic', spell.level)) | ||
--Handle required items/dungeon clears | --Handle required items/dungeon clears |