Anonymous

Module:Constants: Difference between revisions

From Melvor Idle
Added ability to mark modifiers as affecting specific skills
(Changed free bonfire modifier name)
(Added ability to mark modifiers as affecting specific skills)
(10 intermediate revisions by 2 users not shown)
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 = {
  ["increasedGlobalAccuracy"] = { text = "+{V}% Global Accuracy", },
["MeleeStrengthBonus"] = { text = "{V}% Melee Strength Bonus", skills = {'Combat'} },
   ["increasedMeleeAccuracyBonus"] = { text = "+{V}% Melee Accuracy Bonus", },
   ["DamageToDungeonMonsters"] = { text = "{V}% Damage To Dungeon Monsters", skills = {'Combat'} },
   ["increasedMeleeStrengthBonus"] = { text = "+{V}% Melee Strength Bonus", },
   ["GlobalMasteryXP"] = { text = "{V}% Global Mastery XP", skills = {'Woodcutting', 'Fishing', 'Firemaking', 'Cooking', 'Mining', 'Smithing', 'Thieving', 'Farming',
   ["increasedMeleeEvasion"] = { text = "+{V}% Melee Evasion", },
                                                                    'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Agility'} },
   ["increasedRangedAccuracyBonus"] = { text = "+{V}% Ranged Accuracy Bonus", },
   ["ChanceRandomPotionHerblore"] = { text = "{V}% chance to gain a second potion of a random tier", skills = {'Herblore'} },
   ["increasedRangedStrengthBonus"] = { text = "+{V}% Ranged Strength Bonus", },
   ["FlatPrayerCostReduction"] = { text = "{V} Prayer Point Cost for Prayers", inverseSign = true, skills = {'Prayer'} },
   ["increasedRangedEvasion"] = { text = "+{V}% Ranged Evasion", },
   ["MinEarthSpellDmg"] = { text = "{VX} Min Earth Spell Dmg", skills = {'Magic'} },
   ["increasedMagicAccuracyBonus"] = { text = "+{V}% Magic Accuracy Bonus", },
   ["SlayerTaskLength"] = { text = "{V}% Slayer Task Length/Qty", skills = {'Slayer'} },
   ["increasedMagicDamageBonus"] = { text = "+{V}% Magic Damage Bonus", },
   ["ChanceToDoubleLootCombat"] = { text = "{V}% Chance To Double Loot in Combat", skills = {'Combat'} },
   ["increasedMagicEvasion"] = { text = "+{V}% Magic Evasion", },
   ["GPFromAgility"] = { text = "{V}% GP From Agility", skills = {'Agility'} },
   ["increasedMaxHitFlat"] = { text = "+{VX} Max Hit", },
   ["SkillXP"] = { text = "{V1}% {SV0} Skill XP" },
   ["increasedMaxHitPercent"] = { text = "+{V}% Max Hit", },
   ["MiningNodeHP"] = { text = "{V} Mining Node HP", skills = {'Mining'} },
   ["increasedDamageReduction"] = { text = "+{V}% Damage Reduction", },
   ["StaminaPerObstacle"] = { text = "{V} Stamina per Agility Obstacle Completion", skills = {'Agility'} },
   ["increasedChanceToDoubleLootCombat"] = { text = "+{V}% Chance To Double Loot in Combat", },
   ["ChanceToDoubleItems"] = { text = "{V} Chance To Double Items" },
   ["increasedSlayerCoins"] = { text = "+{V}% Slayer Coins", },
   ["FarmingYield"] = { text = "{V}% Farming Yield", skills = {'Farming'} },
   ["increasedSlayerXP"] = { text = "+{V}% Slayer XP", },
   ["GPFromMonstersFlat"] = { text = "{V} GP From Monsters", skills = {'Combat'} },
   ["increasedHPRegenFlat"] = { text = "+{V} Flat HP Regen", },
   ["GlobalPreservationChance"] = { text = "{V}% Chance to Preserve Resources in Skills" },
   ["increasedGPGlobal"] = { text = "+{V}% Global GP (except Item Sales)", },
   ["RunePreservation"] = { text = "{V}% Rune Preservation", skills = {'Magic'} },
   ["increasedGPFromMonsters"] = { text = "+{V}% GP From Monsters", },
   ["MaxHitpoints"] = { text = "{VX} Maximum Hitpoints", skills = {'Combat'} },
   ["increasedGPFromMonstersFlat"] = { text = "+{V} GP From Monsters", },
   ["ChanceToDoubleItemsSkill"] = { text = "{V1}% Chance to Double Items in {SV0}" },
   ["increasedGPFromThieving"] = { text = "+{V}% GP From Thieving", },
   ["autoSlayerUnlocked"] = { text = "{V} Auto Slayer Unlocked", skills = {'Slayer'} },
   ["increasedGPFromThievingFlat"] = { text = "+{V} GP From Thieving", },
   ["HitpointRegeneration"] = { text = "{V}% Hitpoint Regeneration", skills = {'Combat'} },
   ["increasedGPFromAgility"] = { text = "+{V}% GP From Agility", },
   ["SlayerXP"] = { text = "{V}% Slayer XP", skills = {'Slayer'} },
   ["decreasedGPFromAgility"] = { text = "-{V}% GP From Agility", isNegative = true },
   ["PotionChargesFlat"] = { text = "{V} Charges per Potion" },
   ["increasedDamageToBosses"] = { text = "+{V}% Damage To Bosses", },
   ["SkillInterval"] = { text = "{VMS1}s {SV0} Interval", isIncreaseNegative = true },
   ["increasedDamageToSlayerTasks"] = { text = "+{V}% Damage To Slayer Tasks", },
   ["BankSpace"] = { text = "{V} Bank Space" },
   ["increasedDamageToSlayerAreaMonsters"] = { text = "+{V}% Damage To Slayer Area Monsters", },
   ["MinHitBasedOnMaxHit"] = { text = "{V}% of Maximum Hit added to Minimum Hit", skills = {'Combat'} },
   ["increasedDamageToCombatAreaMonsters"] = { text = "+{V}% Damage To Combat Area Monsters", },
   ["DamageToSlayerTasks"] = { text = "{V}% Damage To Slayer Tasks", skills = {'Combat'} },
   ["increasedDamageToDungeonMonsters"] = { text = "+{V}% Damage To Dungeon Monsters", },
   ["Lifesteal"] = { text = "{V}% Lifesteal", skills = {'Combat'} },
   ["increasedDamageToAllMonsters"] = { text = "+{V}% Damage To All Monsters", },
   ["HPRegenFlat"] = { text = "{V} Flat HP Regen", skills = {'Combat'} },
   ["increasedAutoEatEfficiency"] = { text = "+{V}% Auto Eat Efficiency", },
   ["ChanceToDoubleOres"] = { text = "{V}% Chance to Double Ores in Mining", skills = {'Combat'} },
   ["increasedAutoEatThreshold"] = { text = "+{V}% Auto Eat Threshold", },
   ["MaxStamina"] = { text = "{V} Max Stamina" },
   ["increasedAutoEatHPLimit"] = { text = "+{V}% Auto Eat HP Limit", },
   ["MonsterRespawnTimer"] = { text = "{VMS}s Monster Respawn Timer", isIncreaseNegative = true, skills = {'Combat'} },
   ["increasedFoodHealingValue"] = { text = "+{V}% Food Healing Value", },
   ["SkillPreservationChance"] = { text = "{V1}% Chance to Preserve Resources in {SV0}" },
   ["increasedChanceToPreservePrayerPoints"] = { text = "+{V}% Chance To Preserve Prayer Points", },
   ["DamageToCombatAreaMonsters"] = { text = "{V}% Damage To Combat Area Monsters", skills = {'Combat'} },
   ["increasedMinAirSpellDmg"] = { text = "+{VX} Min Air Spell Dmg", },
   ["TreeCutLimit"] = { text = "{V} Tree Cut Limit", skills = {'Woodcutting'} },
   ["increasedMinWaterSpellDmg"] = { text = "+{VX} Min Water Spell Dmg", },
   ["EquipmentSets"] = { text = "{V} Equipment Sets" },
   ["increasedMinEarthSpellDmg"] = { text = "+{VX} Min Earth Spell Dmg", },
   ["HiddenSkillLevel"] = { text = "{V1} Hidden {SV0} Level" },
   ["increasedMinFireSpellDmg"] = { text = "+{VX} Min Fire Spell Dmg", },
   ["ChanceToPreservePrayerPoints"] = { text = "{V}% Chance To Preserve Prayer Points", skills = {'Prayer'} },
   ["increasedAmmoPreservation"] = { text = "+{V}% Ammo Preservation", },
   ["ReflectDamage"] = { text = "{V}% Reflect Damage", skills = {'Combat'} },
   ["increasedRunePreservation"] = { text = "+{V}% Rune Preservation", },
   ["MeleeEvasion"] = { text = "{V}% Melee Evasion", skills = {'Combat'} },
   ["increasedHiddenSkillLevel"] = { text = "+{V1} Hidden {SV0} Level", },
   ["DamageToSlayerAreaMonsters"] = { text = "{V}% Damage To Slayer Area Monsters", skills = {'Combat'} },
   ["decreasedPlayerAttackSpeed"] = { text = "-{VMS}s Player Attack Speed", },
   ["GPFromMonsters"] = { text = "{V}% GP From Monsters", skills = {'Combat'} },
   ["decreasedPlayerAttackSpeedPercent"] = { text = "-{V}% Player Attack Speed", },
   ["MagicEvasion"] = { text = "{V}% Magic Evasion", skills = {'Combat'} },
   ["increasedSlayerAreaEffectNegationFlat"] = { text = "+{V}% Flat Slayer Area Effect Negation", },
   ["PlayerAttackSpeedPercent"] = { text = "{V}% Player Attack Speed", isIncreaseNegative = true, skills = {'Combat'} },
   ["decreasedMonsterRespawnTimer"] = { text = "-{VMS}s Monster Respawn Timer", },
   ["PreservationChance"] = { text = "{V}% Chance to Preserve Resources" },
   ["decreasedGlobalAccuracy"] = { text = "-{V}% Global Accuracy", isNegative = true },
   ["DamageReduction"] = { text = "{V}% Damage Reduction", skills = {'Combat'} },
   ["decreasedMeleeAccuracyBonus"] = { text = "-{V}% Melee Accuracy Bonus", isNegative = true },
   ["MinWaterSpellDmg"] = { text = "{VX} Min Water Spell Dmg", skills = {'Magic'} },
   ["decreasedMeleeStrengthBonus"] = { text = "-{V}% Melee Strength Bonus", isNegative = true },
   ["DamageToAllMonsters"] = { text = "{V}% Damage To All Monsters", skills = {'Combat'} },
   ["decreasedMeleeEvasion"] = { text = "-{V}% Melee Evasion", isNegative = true },
   ["golbinRaidIncreasedStartingRuneCount"] = { text = "{V} to starting Elemental Rune count" },
   ["decreasedRangedAccuracyBonus"] = { text = "-{V} Ranged Accuracy Bonus", isNegative = true },
   ["FoodHealingValue"] = { text = "{V}% Food Healing Value", skills = {'Combat'} },
   ["decreasedRangedStrengthBonus"] = { text = "-{V}% Ranged Strength Bonus", isNegative = true },
   ["MinFireSpellDmg"] = { text = "{VX} Min Fire Spell Dmg", skills = {'Magic'} },
   ["decreasedRangedEvasion"] = { text = "-{V}% Ranged Evasion", isNegative = true },
   ["SlayerCoins"] = { text = "{V}% Slayer Coins", skills = {'Slayer'} },
   ["decreasedMagicAccuracyBonus"] = { text = "-{V}% Magic Accuracy Bonus", isNegative = true },
   ["GPFromThievingFlat"] = { text = "{V} GP From Thieving", skills = {'Thieving'} },
   ["decreasedMagicDamageBonus"] = { text = "-{V}% Magic Damage Bonus", isNegative = true },
   ["GlobalAccuracy"] = { text = "{V}% Global Accuracy", skills = {'Combat'} },
   ["decreasedMagicEvasion"] = { text = "-{V}% Magic Evasion", isNegative = true },
   ["ChanceToDoubleLootThieving"] = { text = "{V}% Chance To Double Loot in Thieving", skills = {'Thieving'} },
   ["decreasedMaxHitFlat"] = { text = "-{VX} Max Hit", isNegative = true },
   ["SlayerAreaEffectNegationFlat"] = { text = "{V}% Flat Slayer Area Effect Negation", skills = {'Combat'} },
   ["decreasedMaxHitPercent"] = { text = "-{V}% Max Hit", isNegative = true },
   ["MagicAccuracyBonus"] = { text = "{V}% Magic Accuracy Bonus", skills = {'Combat'} },
   ["decreasedDamageReduction"] = { text = "-{V}% Damage Reduction", isNegative = true },
   ["SkillIntervalPercent"] = { text = "{V1}% {SV0} Interval", isIncreaseNegative = true },
   ["decreasedChanceToDoubleLootCombat"] = { text = "-{V}% Chance To Double Loot in Combat", isNegative = true },
   ["GlobalSkillXP"] = { text = "{V}% Global Skill XP" },
   ["decreasedSlayerCoins"] = { text = "-{V}% Slayer Coins", isNegative = true },
   ["MeleeAccuracyBonus"] = { text = "{V}% Melee Accuracy Bonus", skills = {'Combat'} },
   ["decreasedSlayerXP"] = { text = "-{V}% Slayer XP", isNegative = true },
   ["DamageToBosses"] = { text = "{V}% Damage To Bosses", skills = {'Combat'} },
   ["decreasedHPRegenFlat"] = { text = "-{V} Flat HP Regen", isNegative = true },
   ["ChanceToPreservePotionCharge"] = { text = "{V}% Chance To Preserve Potion Charge" },
   ["decreasedGPGlobal"] = { text = "-{V}% GP from all sources (Except Item Selling)", isNegative = true },
   ["MaxHitPercent"] = { text = "{V}% Max Hit", skills = {'Combat'} },
   ["decreasedGPFromMonsters"] = { text = "-{V}% GP From Monsters", isNegative = true },
   ["AltMagicSkillXP"] = { text = "{V}% Alt. Magic Skill XP", skills = {'Magic'} },
   ["decreasedGPFromMonstersFlat"] = { text = "-{V} GP From Monsters", isNegative = true },
   ["StaminaPreservationChance"] = { text = "{V}% Chance to Preserve Stamina" },
   ["decreasedDamageToBosses"] = { text = "-{V}% Damage To Bosses", isNegative = true },
   ["MinAirSpellDmg"] = { text = "{VX} Min Air Spell Dmg", skills = {'Combat'} },
   ["decreasedDamageToSlayerTasks"] = { text = "-{V}% Damage To Slayer Tasks", isNegative = true },
   ["AutoEatEfficiency"] = { text = "{V}% Auto Eat Efficiency", skills = {'Combat'} },
   ["decreasedDamageToSlayerAreaMonsters"] = { text = "-{V}% Damage To Slayer Area Monsters", isNegative = true },
   ["GPFromThieving"] = { text = "{V}% GP From Thieving", skills = {'Thieving'} },
   ["decreasedDamageToCombatAreaMonsters"] = { text = "-{V}% Damage To Combat Area Monsters", isNegative = true },
   ["ChanceToDoubleItemsGlobal"] = { text = "{V}% Chance to Double Items Globally" },
   ["decreasedDamageToDungeonMonsters"] = { text = "-{V}% Damage To Dungeon Monsters", isNegative = true },
   ["GPGlobal"] = { text = "{V}% GP from all sources (Except Item Selling)", skills = {'Combat', 'Thieving', 'Agility'} },
   ["decreasedDamageToAllMonsters"] = { text = "-{V}% Damage To All Monsters", isNegative = true },
   ["RangedAccuracyBonus"] = { text = "{V} Ranged Accuracy Bonus", skills = {'Combat'} },
   ["decreasedAutoEatEfficiency"] = { text = "-{V}% Auto Eat Efficiency", isNegative = true },
   ["AutoEatThreshold"] = { text = "{V}% Auto Eat Threshold", skills = {'Combat'} },
   ["decreasedAutoEatThreshold"] = { text = "-{V}% Auto Eat Threshold", isNegative = true },
   ["PlayerAttackSpeed"] = { text = "{VMS}s Player Attack Speed", isIncreaseNegative = true, skills = {'Combat'} },
   ["decreasedAutoEatHPLimit"] = { text = "-{V}% Auto Eat HP Limit", isNegative = true },
   ["freeBonfires"] = { text = "+ Automatically relight bonfires for free", skills = {'Firemaking'} },
   ["decreasedFoodHealingValue"] = { text = "-{V}% Food Healing Value", isNegative = true },
   ["AutoEatHPLimit"] = { text = "{V}% Auto Eat HP Limit", skills = {'Combat'} },
   ["decreasedChanceToPreservePrayerPoints"] = { text = "-{V}% Chance To Preserve Prayer Points", isNegative = true },
   ["BankSpaceShop"] = { text = "{V} Bank Space from Shop" },
   ["decreasedMinAirSpellDmg"] = { text = "-{VX} Min Air Spell Dmg", isNegative = true },
   ["BirdNestDropRate"] = { text = "{V}% Bird Nest drop rate", skills = {'Woodcutting'} },
   ["decreasedMinWaterSpellDmg"] = { text = "-{VX} Min Water Spell Dmg", isNegative = true },
   ["RangedEvasion"] = { text = "{V}% Ranged Evasion", skills = {'Combat'} },
  ["decreasedMinEarthSpellDmg"] = { text =  "-{VX} Min Earth Spell Dmg", isNegative = true },
   ["ChanceDoubleHarvest"] = { text = "{V}% chance for double harvest", skills = {'Farming'} },
  ["decreasedMinFireSpellDmg"] = { text =  "-{VX} Min Fire Spell Dmg", isNegative = true },
  ["decreasedAmmoPreservation"] = { text =  "-{V}% Ammo Preservation", isNegative = true },
  ["decreasedRunePreservation"] = { text =  "-{V}% Rune Preservation", isNegative = true },
  ["decreasedHiddenSkillLevel"] = { text =  "-{V1} Hidden {SV0} Level", isNegative = true },
  ["increasedPlayerAttackSpeed"] = { text =  "+{VMS}s Player Attack Speed", isNegative = true },
  ["increasedPlayerAttackSpeedPercent"] = { text =  "+{V}% Player Attack Speed", isNegative = true },
  ["increasedMonsterRespawnTimer"] = { text =  "+{VMS}s Monster Respawn Timer", isNegative = true },
  ["decreasedSlayerAreaEffectNegationFlat"] = { text =  "-{V}% Flat Slayer Area Effect Negation", isNegative = true },
  ["increasedGPFromSales"] = { text =  "+{V}% GP From Sales", },
  ["increasedBankSpace"] = { text =  "+{V} Bank Space", },
  ["increasedBankSpaceShop"] = { text =  "+{V} Bank Space from Shop", },
  ["increasedChanceToPreservePotionCharge"] = { text =  "+{V}% Chance To Preserve Potion Charge", },
  ["decreasedGPFromSales"] = { text =  "-{V}% GP From Sales", isNegative = true },
  ["decreasedBankSpace"] = { text =  "-{V} Bank Space", isNegative = true },
  ["decreasedBankSpaceShop"] = { text =  "-{V} Bank Space from Shop", isNegative = true },
  ["decreasedChanceToPreservePotionCharge"] = { text =  "-{V}% Chance To Preserve Potion Charge", isNegative = true },
  ["decreasedSkillInterval"] = { text =  "-{VMS1}s {SV0} Interval", },
  ["decreasedSkillIntervalPercent"] = { text =  "-{V1}% {SV0} Interval", },
  ["increasedChanceToDoubleLootThieving"] = { text =  "+{V}% Chance To Double Loot in Thieving", },
  ["increasedPreservationChance"] = { text =  "+{V}% Chance to Preserve Resources", },
  ["increasedStaminaPreservationChance"] = { text =  "+{V}% Chance to Preserve Stamina", },
  ["increasedGlobalMasteryXP"] = { text =  "+{V}% Global Mastery XP", },
  ["increasedGlobalSkillXP"] = { text =  "+{V}% Global Skill XP", },
  ["decreasedGlobalSkillXP"] = { text =  "-{V}% Global Skill XP", isNegative = true },
  ["increasedMasteryXP"] = { text =  "+{V1}% {SV0} Mastery XP", },
  ["increasedSkillXP"] = { text =  "+{V1}% {SV0} Skill XP", },
  ["increasedMaxStamina"] = { text =  "+{V}% Max Stamina", },
  ["increasedMiningNodeHP"] = { text =  "+{V} Mining Node HP", },
  ["increasedSkillInterval"] = { text =  "+{VMS1}s {SV0} Interval", isNegative = true },
  ["increasedSkillIntervalPercent"] = { text =  "+{V1}% {SV0} Interval", isNegative = true },
  ["decreasedChanceToDoubleLootThieving"] = { text =  "-{V}% Chance To Double Loot in Thieving", isNegative = true },
  ["decreasedPreservationChance"] = { text =  "-{V}% Chance to Preserve Resources", isNegative = true },
  ["decreasedStaminaPreservationChance"] = { text =  "-{V}% Chance to Preserve Stamina", isNegative = true },
  ["decreasedGlobalMasteryXP"] = { text =  "-{V}% Global Mastery XP", isNegative = true },
  ["decreasedMasteryXP"] = { text =  "-{V1}% {SV0} Mastery XP", isNegative = true },
  ["decreasedSkillXP"] = { text =  "-{V1}% {SV0} Skill XP", isNegative = true },
  ["decreasedMaxStamina"] = { text =  "-{V} Max Stamina", isNegative = true },
  ["decreasedMiningNodeHP"] = { text =  "-{V} Mining Node HP", isNegative = true },
  ["decreasedGPFromThieving"] = { text =  "-{V}% GP From Thieving", isNegative = true },
  ["decreasedGPFromThievingFlat"] = { text =  "-{V} GP From Thieving", isNegative = true },
  ["dungeonEquipmentSwapping"] = { text =  "{V} Dungeon Equipment Swapping", },
  ["increasedEquipmentSets"] = { text =  "+{V} Equipment Sets", },
  ["autoSlayerUnlocked"] = { text =  "{V} Auto Slayer Unlocked", },
  ["increasedTreeCutLimit"] = { text =  "+{V} Tree Cut Limit", },
  ["increasedChanceToDoubleItems"] = { text =  "+{V} Chance To Double Items", },
  ["decreasedChanceToDoubleItems"] = { text =  "-{V} Chance To Double Items", isNegative = true },
  ["increasedGlobalPreservationChance"] = { text =  "+{V}% Chance to Preserve Resources in Skills", },
  ["decreasedGlobalPreservationChance"] = { text =  "-{V}% Chance to Preserve Resources in Skills", isNegative = true },
  ["increasedFarmingYield"] = { text =  "+{V}% Farming Yield", },
  ["decreasedFarmingYield"] = { text =  "-{V}% Farming Yield", isNegative = true },
  ["increasedMaxHitpoints"] = { text =  "+{VX} Maximum Hitpoints", },
  ["decreasedMaxHitpoints"] = { text =  "-{VX} Maximum Hitpoints", isNegative = true },
  ["increasedStaminaPerObstacle"] = { text =  "+{V} Stamina per Agility Obstacle Completion", },
  ["decreasedStaminaPerObstacle"] = { text =  "+{V} Stamina per Agility Obstacle Completion", isNegative = true },
  ["increasedSlayerTaskLength"] = { text =  "+{V}% Slayer Task Length/Qty", },
  ["decreasedSlayerTaskLength"] = { text =  "+{V}% Slayer Task Length/Qty", isNegative = true },
  ["decreasedFlatPrayerCostReduction"] = { text =  "+{V} Prayer Point Cost for Prayers", isNegative = true },
  ["increasedFlatPrayerCostReduction"] = { text =  "-{V} Prayer Point Cost for Prayers", },
  ["increasedStaminaCost"] = { text =  "+{V} Stamina Cost per action", isNegative = true },
  ["decreasedStaminaCost"] = { text =  "+{V} Stamina Cost per action", },
  ["increasedChanceToDoubleItemsSkill"] = { text =  "+{V1}% Chance to Double Items in {SV0}", },
  ["decreasedChanceToDoubleItemsSkill"] = { text =  "+{V1}% Chance to Double Items in {SV0}", isNegative = true },
  ["increasedChanceToDoubleItemsGlobal"] = { text =  "+{V}% Chance to Double Items Globally", },
  ["decreasedChanceToDoubleItemsGlobal"] = { text =  "+{V}% Chance to Double Items Globally", isNegative = true },
  ["increasedLifesteal"] = { text =  "+{V}% Lifesteal", },
  ["decreasedLifesteal"] = { text =  "+{V}% Lifesteal", isNegative = true },
  ["increasedReflectDamage"] = { text = "+{V}% Reflect Damage", },
  ["decreasedReflectDamage"] = { text = "+{V}% Reflect Damage", isNegative = true },
  ["increasedSkillPreservationChance"] = { text = "+{V1}% Chance to Preserve Resources in {SV0}", },
  ["decreasedSkillPreservationChance"] = { text = "-{V1}% Chance to Preserve Resources in {SV0}", isNegative = true},
  ["increasedChanceToDoubleOres"] = { text = "+{V}% Chance to Double Ores in Mining" },
  ["decreasedChanceToDoubleOres"] = { text = "-{V}% Chance to Double Ores in Mining", isNegative = true },
  ["increasedHitpointRegeneration"] = { text = "+{V}% Hitpoint Regeneration" },
  ["decreasedHitpointRegeneration"] = { text = "-{V}% Hitpoint Regeneration", isNegative = true },
  ["increasedMinHitBasedOnMaxHit"] = { text = "+{V}% of Maximum Hit added to Minimum Hit" },
  ["decreasedMinHitBasedOnMaxHit"] = { text = "-{V}% of Maximum Hit added to Minimum Hit", isNegative = true },
  ["increasedPotionChargesFlat"] = { text = "+{V} Charges per Potion" },
  ["decreasedPotionChargesFlat"] = { text = "-{V} Charges per Potion", isNegative = true },
   ["golbinRaidStartingWeapon"] = { text = "Start the Golbin Raid with an {IV}" },
   ["golbinRaidStartingWeapon"] = { text = "Start the Golbin Raid with an {IV}" },
   ["golbinRaidIncreasedStartingRuneCount"] = { text = "+{V} to starting Elemental Rune count" },
   ["AttackRolls"] = { text = "+Lucky Hit Chance (Roll twice, take the better result)", skills = {'Combat'} },
  --Rows below here are custom handlers for things the game doesn't include yet
   ["AmmoPreservation"] = { text = "{V}% Ammo Preservation", skills = {'Ranged'} },
   ["increasedChanceForElementalRune"] = { text = "+{V}% chance to receive random elemental runes per Runecraft"},
   ["RangedStrengthBonus"] = { text = "{V}% Ranged Strength Bonus", skills = {'Combat'} },
   ["increasedElementalRuneGain"] = { text = "+{V} runes received when generating random elemental runes"},
   ["MagicDamageBonus"] = { text = "{V}% Magic Damage Bonus", skills = {'Combat'} },
   ["increasedBirdNestDropRate"] = { text = "+{V}% Bird Nest drop rate" },
   ["MasteryXP"] = { text = "{V1}% {SV0} Mastery XP" },
   ["increasedAttackRolls"] = { text = "+Lucky Hit Chance (Roll twice, take the better result)" },
   ["dungeonEquipmentSwapping"] = { text = "{V} Dungeon Equipment Swapping", skills = {'Combat'} },
   ["increasedChanceDoubleHarvest"] = { text = "+{V}% chance for double harvest" },
   ["SeeingGoldChance"] = { text = "{V}% chance for Silver Ore to also produce a Gold Bar when smithed", skills = {'Smithing'} },
   ["increasedChanceNoDamageMining"] = { text = "+{V}% chance to do zero damage to Ores and Rune Essence" },
   ["ElementalRuneGain"] = { text = "{V} runes received when generating random elemental runes", skills = {'Runecrafting'} },
   ["increasedSeeingGoldChance"] = { text = "+{V}% chance for Silver Ore to also produce a Gold Bar when smithed" },
   ["StaminaCost"] = { text = "{V} Stamina Cost per action", isIncreaseNegative = true },
   ["freeBonfires"] = { text = "+ Automatically relight bonfires for free" },
   ["GPFromSales"] = { text = "{V}% GP From Sales" },
   ["increasedChanceRandomPotionHerblore"] = { text = "+{V}% chance to gain a second potion of a random tier" },
  ["MaxHitFlat"] = { text = "{VX} Max Hit", skills = {'Combat'} },
   ["increasedAltMagicSkillXP"] = { text = "+{V}% Alt. Magic Skill XP" },
   ["ChanceNoDamageMining"] = { text = "{V}% chance to do zero damage to Ores and Rune Essence", skills = {'Mining'} },
   ["decreasedAltMagicSkillXP"] = { text = "-{V}% Alt. Magic Skill XP", isNegative = true },
   ["ChanceForElementalRune"] = { text = "{V}% chance to receive random elemental runes per Runecraft", skills = {'Runecrafting'} },
}
}
--Difficulties are hard coded which is dumb but means hardcoding them here too
local Difficulties = {
    [0] = 'Very Easy',
    [1] = 'Easy',
    [2] = 'Medium',
    [3] = 'Hard',
    [4] = 'Very Hard',
    [5] = 'Elite',
    [6] = 'Insane'}
function p.getDifficultyString(difficulty)
  return Difficulties[difficulty]
end


function p.getSkillName(skillID)
function p.getSkillName(skillID)
Line 189: Line 125:
   end
   end
   return nil
   return nil
end
function p.getSkillID(skillName)
  return ConstantData.skill[skillName]
end
end


Line 200: Line 140:
end
end


function p.getSkillID(skillName)
function p.getEquipmentSlotID(name)
   return ConstantData.skill[skillName]
   return ConstantData.equipmentSlot[name]
end
 
function p.getCombatStyleName(styleNum)
  for name, num in Shared.skpairs(ConstantData.attackType) do
    if num == styleNum then
      return name
    end
  end
  return "ERROR: Invalid combat style[[Category:Pages with script errors]]"
end
 
function p.getSlayerTierName(tier)
  for name, num in Shared.skpairs(ConstantData.slayerTier) do
    if num == tier then
      return name
    end
  end
  return "ERROR: Invalid Slayer tier[[Category:Pages with script errors]]"
end
 
function p.getSlayerTierNameByLevel(lvl)
  for i, tier in Shared.skpairs(ConstantData.Slayer.Tiers) do
    if tier.minLevel <= lvl and (tier.maxLevel >= lvl or tier.maxLevel == -1) then
      return tier.display
    end
  end
  return 'N/A'
end
 
function p.getSlayerTier(name)
  for i, tier in Shared.skpairs(ConstantData.Slayer.Tiers) do
    if tier.display == name then
      local result = Shared.clone(tier)
      result.id = i - 1
      return result
    end
  end
end
 
function p.getSlayerTierByID(tierID)
  if ConstantData.Slayer.Tiers[tierID + 1] == nil then
    return nil
  end
 
  local result = Shared.clone(ConstantData.Slayer.Tiers[tierID + 1])
  result.id = tierID
  return result
end
 
--Turns a modifier name like 'increasedMeleeAccuracyBonus' into several pieces of data:
--Base Name, Text, Sign, and IsNegative
--ex. "MeleeAccuracyBonus", "+{V}% Melee Accuracy", "+", false
function p.getModifierDetails(modifierName)
  local baseName = modifierName
  local isIncrease = true
  local isNegative = false
 
  if Shared.startsWith(modifierName, "increased") or Shared.startsWith(modifierName, "decreased") then
    baseName = string.sub(modifierName, 10)
    isIncrease = Shared.startsWith(modifierName, "increased")
  end
 
  local modifier = modifierTypes[baseName]
  if modifier == nil then
    mw.log(baseName)
    return nil
  end
 
  local isPositive = isIncrease
  if modifier.isIncreaseNegative then
    isPositive = not isPositive
  end
 
  local sign = "+"
  if (not isIncrease and not modifier.inverseSign) or (isIncrease and modifier.inverseSign) then
    sign = "-"
  end
 
  return baseName, modifier.text, sign, not isPositive
end
end


function p._getModifierText(modifier, value, doColor)
function p._getModifierText(modifier, value, doColor)
   if doColor == nil then doColor = true end
   if doColor == nil then doColor = true end
   local template = modifierTypes[modifier]
   local modName, modText, sign, isNegative = p.getModifierDetails(modifier)


   if template == nil then
   if modName == nil then
     return 'ERROR: Invalid modifier type [[Category:Pages with script errors]]'
     return 'ERROR: Invalid modifier type [[Category:Pages with script errors]]'
   end
   end


   local result = template.text
   local result = modText


   if type(value) == 'table' then
   if type(value) == 'table' then
     if Shared.tableCount(value) > 0 and type(value[1]) == 'table' then
     if Shared.tableCount(value) > 0 and type(value[1]) == 'table' then
       --Potentially return multiple rows if necessay
       --Potentially return multiple rows if necessary
       local resultArray = {}
       local resultArray = {}
       for i, subVal in Shared.skpairs(value) do
       for i, subVal in Shared.skpairs(value) do
Line 230: Line 249:
       end
       end
       if value[2] ~= nil then
       if value[2] ~= nil then
         result = string.gsub(result, '{V1}', value[2])
         result = string.gsub(result, '{V1}', sign..value[2])
         result = string.gsub(result, '{VMS1}', value[2] / 1000)
         result = string.gsub(result, '{VMS1}', sign..(value[2] / 1000))
       end
       end
     end
     end
Line 241: Line 260:
       end
       end
     end
     end
     result = string.gsub(result, '{V}', value)
     result = string.gsub(result, '{V}', sign..value)
     result = string.gsub(result, '{VMS}', value / 1000)
     result = string.gsub(result, '{VMS}', sign..(value / 1000))
     result = string.gsub(result, '{VX}', value * 10)
     result = string.gsub(result, '{VX}', sign..(value * 10))
   end
   end


   if doColor then
   if doColor then
     if template.isNegative ~= nil and template.isNegative then
     if isNegative ~= nil and isNegative then
       result = '<span style="color:red">'..result..'</span>'
       result = '<span style="color:red">'..result..'</span>'
     else
     else
Line 272: Line 291:


   return p._getModifierText(modifier, value, doColor)
   return p._getModifierText(modifier, value, doColor)
end
function p.getModifierSkills(modifiers)
  local skillArray = {}
  for modifier, value in Shared.skpairs(modifiers) do
    if type(value) == 'table' then
      for i, subVal in Shared.skpairs(value) do
        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
          table.insert(skillArray, skillName)
        end
      end
    end
  end
  return skillArray
end
end


return p
return p