17,097
edits
(Add Abyssal Compost and current Firemaking Oils) |
(Re-implement modifier skill checks, and clean up itemUseArray accordingly) |
||
Line 6: | Line 6: | ||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
local SkillData = GameData.skillData | local SkillData = GameData.skillData | ||
local Modifiers = require('Module:Modifiers') | |||
local Skills = require('Module:Skills') | local Skills = require('Module:Skills') | ||
local Magic = require('Module:Magic') | local Magic = require('Module:Magic') | ||
Line 19: | Line 20: | ||
Agility = {}, | Agility = {}, | ||
Astrology = {'melvorF:Stardust', 'melvorF:Golden_Stardust', 'melvorItA:Abyssal_Stardust'}, | Astrology = {'melvorF:Stardust', 'melvorF:Golden_Stardust', 'melvorItA:Abyssal_Stardust'}, | ||
Archaeology = { | Archaeology = {}, | ||
Attack = {}, | Attack = {}, | ||
Cartography = { | Cartography = {}, | ||
Combat = {'melvorF:Gold_Emerald_Ring', 'melvorD:Obsidian_Cape', 'melvorF:Throwing_Power_Gloves'}, | Combat = {'melvorF:Gold_Emerald_Ring', 'melvorD:Obsidian_Cape', 'melvorF:Throwing_Power_Gloves'}, | ||
Cooking = {'melvorD:Cooking_Gloves | Cooking = {'melvorD:Cooking_Gloves'}, | ||
Crafting = { | Crafting = {'melvorItA:Abyssal_Crafting_Gloves'}, | ||
Defence = {}, | Defence = {}, | ||
Farming = {'melvorD:Compost', 'melvorD:Weird_Gloop', 'melvorItA:Abyssal_Compost', 'melvorD:Bobs_Rake | Farming = {'melvorD:Compost', 'melvorD:Weird_Gloop', 'melvorItA:Abyssal_Compost', 'melvorD:Bobs_Rake'}, | ||
Firemaking = { | Firemaking = {'melvorItA:Abyssal_Firemaking_Gloves'}, | ||
Fishing = {'melvorD:Message_In_A_Bottle', 'melvorD:Barbarian_Gloves'}, | |||
Fletching = {'melvorItA:Abyssal_Fletching_Gloves'}, | |||
Fishing = { | |||
Fletching = { | |||
Harvesting = {'melvorItA:Abyssal_Harvesting_Gloves'}, | Harvesting = {'melvorItA:Abyssal_Harvesting_Gloves'}, | ||
Herblore = { | Herblore = {'melvorItA:Abyssal_Herblore_Gloves'}, | ||
Hitpoints = {}, | Hitpoints = {}, | ||
Magic = {}, | Magic = {}, | ||
Line 39: | Line 38: | ||
Prayer = {}, | Prayer = {}, | ||
Ranged = {}, | Ranged = {}, | ||
Runecrafting = { | Runecrafting = {'melvorItA:Abyssal_Runecrafting_Gloves'}, | ||
Slayer = {}, | Slayer = {}, | ||
Smithing = {'melvorD:Smithing_Gloves | Smithing = {'melvorD:Smithing_Gloves', 'melvorItA:Abyssal_Smithing_Gloves'}, | ||
Smithing = {}, | |||
Strength = {}, | Strength = {}, | ||
Summoning = { | Summoning = {}, | ||
Thieving = { | Thieving = {'melvorF:Thieving_Gloves'}, | ||
Township = {}, | Township = {}, | ||
Woodcutting = {' | Woodcutting = {}, | ||
} | |||
-- List of modifier IDs which, if present on an item and not specific to any | |||
-- particular skill, indicate that the item applies to all skills | |||
local allSkillModIDs = { | |||
-- Skill XP | |||
'skillXP', | |||
'nonCombatSkillXP', | |||
'abyssalSkillXP', | |||
-- Mastery | |||
'flatMasteryTokens', | |||
'xpFromMasteryTokens', | |||
'masteryPoolCap', | |||
'masteryXP', | |||
'masteryPoolProgress', | |||
-- Resource preservation | |||
'bypassGlobalPreservationChance', | |||
'skillPreservationChance', | |||
'skillPreservationCap', | |||
-- Other preservation (consumables, summons, potion charges) | |||
'consumablePreservationChance', | |||
'summoningChargePreservationChance', | |||
'potionChargePreservationChance', | |||
-- Item doubling | |||
'globalItemDoublingChance', | |||
-- Resource quantity | |||
'flatBasePrimaryProductQuantity', | |||
'basePrimaryProductQuantity', | |||
'flatBaseRandomProductQuantity', | |||
'flatAdditionalSkillItem', | |||
'flatAdditionalPrimaryProductQuantity', | |||
-- Cost reduction | |||
'skillCostReduction', | |||
-- Off item chance | |||
'offItemChance' | |||
} | |||
local function allSkillModCriteriaFromIDs(modIDs) | |||
local modIDsWithProps = {} | |||
for i, modID in ipairs(allSkillModIDs) do | |||
table.insert(modIDsWithProps, { | |||
["id"] = modID, | |||
["type"] = 'id', | |||
["props"] = { | |||
["skillID"] = 'nil', | |||
["modType"] = 'pos' | |||
} | |||
}) | |||
end | |||
return Modifiers.getMatchCriteriaFromIDs(modIDsWithProps) | |||
end | |||
local allSkillModCriteria = allSkillModCriteriaFromIDs(allSkillModIDs) | |||
function p._getItemUses(item, asList, addCategories) | function p._getItemUses(item, asList, addCategories) | ||
Line 106: | Line 158: | ||
-- Mastery tokens | -- Mastery tokens | ||
addUse('Mastery') | addUse('Mastery') | ||
else | |||
local | local modsAllSkills = Modifiers.getMatchingModifiers(item.modifiers, allSkillModCriteria) | ||
if not Shared.tableIsEmpty(modsAllSkills.matched) then | |||
addUse('AllSkills') | |||
else | |||
local skillArray = Modifiers.getModifierSkills(item.modifiers) | |||
local skillArray = | |||
for i, skillName in ipairs(skillArray) do | for i, skillName in ipairs(skillArray) do | ||
addUse(skillName) | addUse(skillName) | ||
end | end | ||
end | end | ||
end | end | ||
end | end | ||
Line 334: | Line 375: | ||
end | end | ||
--Special note for Charge Stone of Rhaelyx | --Special note for Charge Stone of Rhaelyx | ||
if item.id == 'melvorD:Charge_Stone_of_Rhaelyx' then | if item.id == 'melvorD:Charge_Stone_of_Rhaelyx' then |