Module:Constants: Difference between revisions

Added ability to mark modifiers as affecting specific skills
(Added p.getModifierSkills)
(Added ability to mark modifiers as affecting specific skills)
Line 8: Line 8:
--Just hardcoding these because I guess that's where we're at
--Just hardcoding these because I guess that's where we're at
local modifierTypes = {
local modifierTypes = {
["MeleeStrengthBonus"] = { text = "{V}% Melee Strength Bonus" },
["MeleeStrengthBonus"] = { text = "{V}% Melee Strength Bonus", skills = {'Combat'} },
   ["DamageToDungeonMonsters"] = { text = "{V}% Damage To Dungeon Monsters" },
   ["DamageToDungeonMonsters"] = { text = "{V}% Damage To Dungeon Monsters", skills = {'Combat'} },
   ["GlobalMasteryXP"] = { text = "{V}% Global Mastery XP" },
   ["GlobalMasteryXP"] = { text = "{V}% Global Mastery XP", skills = {'Woodcutting', 'Fishing', 'Firemaking', 'Cooking', 'Mining', 'Smithing', 'Thieving', 'Farming',
   ["ChanceRandomPotionHerblore"] = { text = "{V}% chance to gain a second potion of a random tier" },
                                                                    'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Agility'} },
   ["FlatPrayerCostReduction"] = { text = "{V} Prayer Point Cost for Prayers", inverseSign = true },
   ["ChanceRandomPotionHerblore"] = { text = "{V}% chance to gain a second potion of a random tier", skills = {'Herblore'} },
   ["MinEarthSpellDmg"] = { text = "{VX} Min Earth Spell Dmg" },
   ["FlatPrayerCostReduction"] = { text = "{V} Prayer Point Cost for Prayers", inverseSign = true, skills = {'Prayer'} },
   ["SlayerTaskLength"] = { text = "{V}% Slayer Task Length/Qty" },
   ["MinEarthSpellDmg"] = { text = "{VX} Min Earth Spell Dmg", skills = {'Magic'} },
   ["ChanceToDoubleLootCombat"] = { text = "{V}% Chance To Double Loot in Combat" },
   ["SlayerTaskLength"] = { text = "{V}% Slayer Task Length/Qty", skills = {'Slayer'} },
   ["GPFromAgility"] = { text = "{V}% GP From Agility" },
   ["ChanceToDoubleLootCombat"] = { text = "{V}% Chance To Double Loot in Combat", skills = {'Combat'} },
   ["GPFromAgility"] = { text = "{V}% GP From Agility", skills = {'Agility'} },
   ["SkillXP"] = { text = "{V1}% {SV0} Skill XP" },
   ["SkillXP"] = { text = "{V1}% {SV0} Skill XP" },
   ["MiningNodeHP"] = { text = "{V} Mining Node HP" },
   ["MiningNodeHP"] = { text = "{V} Mining Node HP", skills = {'Mining'} },
   ["StaminaPerObstacle"] = { text = "{V} Stamina per Agility Obstacle Completion" },
   ["StaminaPerObstacle"] = { text = "{V} Stamina per Agility Obstacle Completion", skills = {'Agility'} },
   ["ChanceToDoubleItems"] = { text = "{V} Chance To Double Items" },
   ["ChanceToDoubleItems"] = { text = "{V} Chance To Double Items" },
   ["FarmingYield"] = { text = "{V}% Farming Yield" },
   ["FarmingYield"] = { text = "{V}% Farming Yield", skills = {'Farming'} },
   ["GPFromMonstersFlat"] = { text = "{V} GP From Monsters" },
   ["GPFromMonstersFlat"] = { text = "{V} GP From Monsters", skills = {'Combat'} },
   ["GlobalPreservationChance"] = { text = "{V}% Chance to Preserve Resources in Skills" },
   ["GlobalPreservationChance"] = { text = "{V}% Chance to Preserve Resources in Skills" },
   ["RunePreservation"] = { text = "{V}% Rune Preservation" },
   ["RunePreservation"] = { text = "{V}% Rune Preservation", skills = {'Magic'} },
   ["MaxHitpoints"] = { text = "{VX} Maximum Hitpoints" },
   ["MaxHitpoints"] = { text = "{VX} Maximum Hitpoints", skills = {'Combat'} },
   ["ChanceToDoubleItemsSkill"] = { text = "{V1}% Chance to Double Items in {SV0}" },
   ["ChanceToDoubleItemsSkill"] = { text = "{V1}% Chance to Double Items in {SV0}" },
   ["autoSlayerUnlocked"] = { text = "{V} Auto Slayer Unlocked" },
   ["autoSlayerUnlocked"] = { text = "{V} Auto Slayer Unlocked", skills = {'Slayer'} },
   ["HitpointRegeneration"] = { text = "{V}% Hitpoint Regeneration" },
   ["HitpointRegeneration"] = { text = "{V}% Hitpoint Regeneration", skills = {'Combat'} },
   ["SlayerXP"] = { text = "{V}% Slayer XP" },
   ["SlayerXP"] = { text = "{V}% Slayer XP", skills = {'Slayer'} },
   ["PotionChargesFlat"] = { text = "{V} Charges per Potion" },
   ["PotionChargesFlat"] = { text = "{V} Charges per Potion" },
   ["SkillInterval"] = { text = "{VMS1}s {SV0} Interval", isIncreaseNegative = true },
   ["SkillInterval"] = { text = "{VMS1}s {SV0} Interval", isIncreaseNegative = true },
   ["BankSpace"] = { text = "{V} Bank Space" },
   ["BankSpace"] = { text = "{V} Bank Space" },
   ["MinHitBasedOnMaxHit"] = { text = "{V}% of Maximum Hit added to Minimum Hit" },
   ["MinHitBasedOnMaxHit"] = { text = "{V}% of Maximum Hit added to Minimum Hit", skills = {'Combat'} },
   ["DamageToSlayerTasks"] = { text = "{V}% Damage To Slayer Tasks" },
   ["DamageToSlayerTasks"] = { text = "{V}% Damage To Slayer Tasks", skills = {'Combat'} },
   ["Lifesteal"] = { text = "{V}% Lifesteal" },
   ["Lifesteal"] = { text = "{V}% Lifesteal", skills = {'Combat'} },
   ["HPRegenFlat"] = { text = "{V} Flat HP Regen" },
   ["HPRegenFlat"] = { text = "{V} Flat HP Regen", skills = {'Combat'} },
   ["ChanceToDoubleOres"] = { text = "{V}% Chance to Double Ores in Mining" },
   ["ChanceToDoubleOres"] = { text = "{V}% Chance to Double Ores in Mining", skills = {'Combat'} },
   ["MaxStamina"] = { text = "{V} Max Stamina" },
   ["MaxStamina"] = { text = "{V} Max Stamina" },
   ["MonsterRespawnTimer"] = { text = "{VMS}s Monster Respawn Timer", isIncreaseNegative = true },
   ["MonsterRespawnTimer"] = { text = "{VMS}s Monster Respawn Timer", isIncreaseNegative = true, skills = {'Combat'} },
   ["SkillPreservationChance"] = { text = "{V1}% Chance to Preserve Resources in {SV0}" },
   ["SkillPreservationChance"] = { text = "{V1}% Chance to Preserve Resources in {SV0}" },
   ["DamageToCombatAreaMonsters"] = { text = "{V}% Damage To Combat Area Monsters" },
   ["DamageToCombatAreaMonsters"] = { text = "{V}% Damage To Combat Area Monsters", skills = {'Combat'} },
   ["TreeCutLimit"] = { text = "{V} Tree Cut Limit" },
   ["TreeCutLimit"] = { text = "{V} Tree Cut Limit", skills = {'Woodcutting'} },
   ["EquipmentSets"] = { text = "{V} Equipment Sets" },
   ["EquipmentSets"] = { text = "{V} Equipment Sets" },
   ["HiddenSkillLevel"] = { text = "{V1} Hidden {SV0} Level" },
   ["HiddenSkillLevel"] = { text = "{V1} Hidden {SV0} Level" },
   ["ChanceToPreservePrayerPoints"] = { text = "{V}% Chance To Preserve Prayer Points" },
   ["ChanceToPreservePrayerPoints"] = { text = "{V}% Chance To Preserve Prayer Points", skills = {'Prayer'} },
   ["ReflectDamage"] = { text = "{V}% Reflect Damage" },
   ["ReflectDamage"] = { text = "{V}% Reflect Damage", skills = {'Combat'} },
   ["MeleeEvasion"] = { text = "{V}% Melee Evasion" },
   ["MeleeEvasion"] = { text = "{V}% Melee Evasion", skills = {'Combat'} },
   ["DamageToSlayerAreaMonsters"] = { text = "{V}% Damage To Slayer Area Monsters" },
   ["DamageToSlayerAreaMonsters"] = { text = "{V}% Damage To Slayer Area Monsters", skills = {'Combat'} },
   ["GPFromMonsters"] = { text = "{V}% GP From Monsters" },
   ["GPFromMonsters"] = { text = "{V}% GP From Monsters", skills = {'Combat'} },
   ["MagicEvasion"] = { text = "{V}% Magic Evasion" },
   ["MagicEvasion"] = { text = "{V}% Magic Evasion", skills = {'Combat'} },
   ["PlayerAttackSpeedPercent"] = { text = "{V}% Player Attack Speed", isIncreaseNegative = true },
   ["PlayerAttackSpeedPercent"] = { text = "{V}% Player Attack Speed", isIncreaseNegative = true, skills = {'Combat'} },
   ["PreservationChance"] = { text = "{V}% Chance to Preserve Resources" },
   ["PreservationChance"] = { text = "{V}% Chance to Preserve Resources" },
   ["DamageReduction"] = { text = "{V}% Damage Reduction" },
   ["DamageReduction"] = { text = "{V}% Damage Reduction", skills = {'Combat'} },
   ["MinWaterSpellDmg"] = { text = "{VX} Min Water Spell Dmg" },
   ["MinWaterSpellDmg"] = { text = "{VX} Min Water Spell Dmg", skills = {'Magic'} },
   ["DamageToAllMonsters"] = { text = "{V}% Damage To All Monsters" },
   ["DamageToAllMonsters"] = { text = "{V}% Damage To All Monsters", skills = {'Combat'} },
   ["golbinRaidIncreasedStartingRuneCount"] = { text = "{V} to starting Elemental Rune count" },
   ["golbinRaidIncreasedStartingRuneCount"] = { text = "{V} to starting Elemental Rune count" },
   ["FoodHealingValue"] = { text = "{V}% Food Healing Value" },
   ["FoodHealingValue"] = { text = "{V}% Food Healing Value", skills = {'Combat'} },
   ["MinFireSpellDmg"] = { text = "{VX} Min Fire Spell Dmg" },
   ["MinFireSpellDmg"] = { text = "{VX} Min Fire Spell Dmg", skills = {'Magic'} },
   ["SlayerCoins"] = { text = "{V}% Slayer Coins" },
   ["SlayerCoins"] = { text = "{V}% Slayer Coins", skills = {'Slayer'} },
   ["GPFromThievingFlat"] = { text = "{V} GP From Thieving" },
   ["GPFromThievingFlat"] = { text = "{V} GP From Thieving", skills = {'Thieving'} },
   ["GlobalAccuracy"] = { text = "{V}% Global Accuracy" },
   ["GlobalAccuracy"] = { text = "{V}% Global Accuracy", skills = {'Combat'} },
   ["ChanceToDoubleLootThieving"] = { text = "{V}% Chance To Double Loot in Thieving" },
   ["ChanceToDoubleLootThieving"] = { text = "{V}% Chance To Double Loot in Thieving", skills = {'Thieving'} },
   ["SlayerAreaEffectNegationFlat"] = { text = "{V}% Flat Slayer Area Effect Negation" },
   ["SlayerAreaEffectNegationFlat"] = { text = "{V}% Flat Slayer Area Effect Negation", skills = {'Combat'} },
   ["MagicAccuracyBonus"] = { text = "{V}% Magic Accuracy Bonus" },
   ["MagicAccuracyBonus"] = { text = "{V}% Magic Accuracy Bonus", skills = {'Combat'} },
   ["SkillIntervalPercent"] = { text = "{V1}% {SV0} Interval", isIncreaseNegative = true },
   ["SkillIntervalPercent"] = { text = "{V1}% {SV0} Interval", isIncreaseNegative = true },
   ["GlobalSkillXP"] = { text = "{V}% Global Skill XP" },
   ["GlobalSkillXP"] = { text = "{V}% Global Skill XP" },
   ["MeleeAccuracyBonus"] = { text = "{V}% Melee Accuracy Bonus" },
   ["MeleeAccuracyBonus"] = { text = "{V}% Melee Accuracy Bonus", skills = {'Combat'} },
   ["DamageToBosses"] = { text = "{V}% Damage To Bosses" },
   ["DamageToBosses"] = { text = "{V}% Damage To Bosses", skills = {'Combat'} },
   ["ChanceToPreservePotionCharge"] = { text = "{V}% Chance To Preserve Potion Charge" },
   ["ChanceToPreservePotionCharge"] = { text = "{V}% Chance To Preserve Potion Charge" },
   ["MaxHitPercent"] = { text = "{V}% Max Hit" },
   ["MaxHitPercent"] = { text = "{V}% Max Hit", skills = {'Combat'} },
   ["AltMagicSkillXP"] = { text = "{V}% Alt. Magic Skill XP" },
   ["AltMagicSkillXP"] = { text = "{V}% Alt. Magic Skill XP", skills = {'Magic'} },
   ["StaminaPreservationChance"] = { text = "{V}% Chance to Preserve Stamina" },
   ["StaminaPreservationChance"] = { text = "{V}% Chance to Preserve Stamina" },
   ["MinAirSpellDmg"] = { text = "{VX} Min Air Spell Dmg" },
   ["MinAirSpellDmg"] = { text = "{VX} Min Air Spell Dmg", skills = {'Combat'} },
   ["AutoEatEfficiency"] = { text = "{V}% Auto Eat Efficiency" },
   ["AutoEatEfficiency"] = { text = "{V}% Auto Eat Efficiency", skills = {'Combat'} },
   ["GPFromThieving"] = { text = "{V}% GP From Thieving" },
   ["GPFromThieving"] = { text = "{V}% GP From Thieving", skills = {'Thieving'} },
   ["ChanceToDoubleItemsGlobal"] = { text = "{V}% Chance to Double Items Globally" },
   ["ChanceToDoubleItemsGlobal"] = { text = "{V}% Chance to Double Items Globally" },
   ["GPGlobal"] = { text = "{V}% GP from all sources (Except Item Selling)" },
   ["GPGlobal"] = { text = "{V}% GP from all sources (Except Item Selling)", skills = {'Combat', 'Thieving', 'Agility'} },
   ["RangedAccuracyBonus"] = { text = "{V} Ranged Accuracy Bonus" },
   ["RangedAccuracyBonus"] = { text = "{V} Ranged Accuracy Bonus", skills = {'Combat'} },
   ["AutoEatThreshold"] = { text = "{V}% Auto Eat Threshold" },
   ["AutoEatThreshold"] = { text = "{V}% Auto Eat Threshold", skills = {'Combat'} },
   ["PlayerAttackSpeed"] = { text = "{VMS}s Player Attack Speed", isIncreaseNegative = true },
   ["PlayerAttackSpeed"] = { text = "{VMS}s Player Attack Speed", isIncreaseNegative = true, skills = {'Combat'} },
   ["freeBonfires"] = { text = "+ Automatically relight bonfires for free" },
   ["freeBonfires"] = { text = "+ Automatically relight bonfires for free", skills = {'Firemaking'} },
   ["AutoEatHPLimit"] = { text = "{V}% Auto Eat HP Limit" },
   ["AutoEatHPLimit"] = { text = "{V}% Auto Eat HP Limit", skills = {'Combat'} },
   ["BankSpaceShop"] = { text = "{V} Bank Space from Shop" },
   ["BankSpaceShop"] = { text = "{V} Bank Space from Shop" },
   ["BirdNestDropRate"] = { text = "{V}% Bird Nest drop rate" },
   ["BirdNestDropRate"] = { text = "{V}% Bird Nest drop rate", skills = {'Woodcutting'} },
   ["RangedEvasion"] = { text = "{V}% Ranged Evasion" },
   ["RangedEvasion"] = { text = "{V}% Ranged Evasion", skills = {'Combat'} },
   ["ChanceDoubleHarvest"] = { text = "{V}% chance for double harvest" },
   ["ChanceDoubleHarvest"] = { text = "{V}% chance for double harvest", skills = {'Farming'} },
   ["golbinRaidStartingWeapon"] = { text = "Start the Golbin Raid with an {IV}" },
   ["golbinRaidStartingWeapon"] = { text = "Start the Golbin Raid with an {IV}" },
   ["AttackRolls"] = { text = "+Lucky Hit Chance (Roll twice, take the better result)" },
   ["AttackRolls"] = { text = "+Lucky Hit Chance (Roll twice, take the better result)", skills = {'Combat'} },
   ["AmmoPreservation"] = { text = "{V}% Ammo Preservation" },
   ["AmmoPreservation"] = { text = "{V}% Ammo Preservation", skills = {'Ranged'} },
   ["RangedStrengthBonus"] = { text = "{V}% Ranged Strength Bonus" },
   ["RangedStrengthBonus"] = { text = "{V}% Ranged Strength Bonus", skills = {'Combat'} },
   ["MagicDamageBonus"] = { text = "{V}% Magic Damage Bonus" },
   ["MagicDamageBonus"] = { text = "{V}% Magic Damage Bonus", skills = {'Combat'} },
   ["MasteryXP"] = { text = "{V1}% {SV0} Mastery XP" },
   ["MasteryXP"] = { text = "{V1}% {SV0} Mastery XP" },
   ["dungeonEquipmentSwapping"] = { text = "{V} Dungeon Equipment Swapping" },
   ["dungeonEquipmentSwapping"] = { text = "{V} Dungeon Equipment Swapping", skills = {'Combat'} },
   ["SeeingGoldChance"] = { text = "{V}% chance for Silver Ore to also produce a Gold Bar when smithed" },
   ["SeeingGoldChance"] = { text = "{V}% chance for Silver Ore to also produce a Gold Bar when smithed", skills = {'Smithing'} },
   ["ElementalRuneGain"] = { text = "{V} runes received when generating random elemental runes" },
   ["ElementalRuneGain"] = { text = "{V} runes received when generating random elemental runes", skills = {'Runecrafting'} },
   ["StaminaCost"] = { text = "{V} Stamina Cost per action", isIncreaseNegative = true },
   ["StaminaCost"] = { text = "{V} Stamina Cost per action", isIncreaseNegative = true },
   ["GPFromSales"] = { text = "{V}% GP From Sales" },
   ["GPFromSales"] = { text = "{V}% GP From Sales" },
   ["MaxHitFlat"] = { text = "{VX} Max Hit" },
   ["MaxHitFlat"] = { text = "{VX} Max Hit", skills = {'Combat'} },
   ["ChanceNoDamageMining"] = { text = "{V}% chance to do zero damage to Ores and Rune Essence" },
   ["ChanceNoDamageMining"] = { text = "{V}% chance to do zero damage to Ores and Rune Essence", skills = {'Mining'} },
   ["ChanceForElementalRune"] = { text = "{V}% chance to receive random elemental runes per Runecraft" },
   ["ChanceForElementalRune"] = { text = "{V}% chance to receive random elemental runes per Runecraft", skills = {'Runecrafting'} },
}
}


Line 294: Line 295:
function p.getModifierSkills(modifiers)
function p.getModifierSkills(modifiers)
   local skillArray = {}
   local skillArray = {}
   for modifier, value in Shared.skpairs(modifiers) do
   for modifier, value in Shared.skpairs(modifiers) do
     if type(value) == 'table' then
     if type(value) == 'table' then
       for i, subVal in Shared.skpairs(value) do
       for i, subVal in Shared.skpairs(value) do
         local skillName = p.getSkillName(subVal[1])
         local skillName = p.getSkillName(subVal[1])
        if not Shared.contains(skillArray, skillName) then
          table.insert(skillArray, skillName)
        end
      end
    end
    local baseName = p.getModifierDetails(modifier)
    if modifierTypes[baseName].skills ~= nil then
      for i, skillName in Shared.skpairs(modifierTypes[baseName].skills) do
         if not Shared.contains(skillArray, skillName) then
         if not Shared.contains(skillArray, skillName) then
           table.insert(skillArray, skillName)
           table.insert(skillArray, skillName)
Line 304: Line 315:
     end
     end
   end
   end
   return skillArray
   return skillArray
end
end


return p
return p