Anonymous

Module:Constants: Difference between revisions

From Melvor Idle
Attempt to rewrite getModifierText so that we only need one row for pairs, not two. We'll see what breaks.
(Added Insane difficulty)
(Attempt to rewrite getModifierText so that we only need one row for pairs, not two. We'll see what breaks.)
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" },
   ["increasedMeleeAccuracyBonus"] = { text = "+{V}% Melee Accuracy Bonus", },
   ["DamageToDungeonMonsters"] = { text = "{V}% Damage To Dungeon Monsters" },
   ["increasedMeleeStrengthBonus"] = { text = "+{V}% Melee Strength Bonus", },
   ["GlobalMasteryXP"] = { text = "{V}% Global Mastery XP" },
   ["increasedMeleeEvasion"] = { text = "+{V}% Melee Evasion", },
   ["ChanceRandomPotionHerblore"] = { text = "{V}% chance to gain a second potion of a random tier" },
   ["increasedRangedAccuracyBonus"] = { text = "+{V}% Ranged Accuracy Bonus", },
   ["FlatPrayerCostReduction"] = { text = "{V} Prayer Point Cost for Prayers", inverseSign = True },
   ["increasedRangedStrengthBonus"] = { text = "+{V}% Ranged Strength Bonus", },
   ["MinEarthSpellDmg"] = { text = "{VX} Min Earth Spell Dmg" },
   ["increasedRangedEvasion"] = { text = "+{V}% Ranged Evasion", },
   ["SlayerTaskLength"] = { text = "{V}% Slayer Task Length/Qty" },
   ["increasedMagicAccuracyBonus"] = { text = "+{V}% Magic Accuracy Bonus", },
   ["ChanceToDoubleLootCombat"] = { text = "{V}% Chance To Double Loot in Combat" },
   ["increasedMagicDamageBonus"] = { text = "+{V}% Magic Damage Bonus", },
   ["GPFromAgility"] = { text = "{V}% GP From Agility" },
   ["increasedMagicEvasion"] = { text = "+{V}% Magic Evasion", },
   ["SkillXP"] = { text = "{V1}% {SV0} Skill XP" },
   ["increasedMaxHitFlat"] = { text = "+{VX} Max Hit", },
   ["MiningNodeHP"] = { text = "{V} Mining Node HP" },
   ["increasedMaxHitPercent"] = { text = "+{V}% Max Hit", },
   ["StaminaPerObstacle"] = { text = "{V} Stamina per Agility Obstacle Completion" },
   ["increasedDamageReduction"] = { text = "+{V}% Damage Reduction", },
   ["ChanceToDoubleItems"] = { text = "{V} Chance To Double Items" },
   ["increasedChanceToDoubleLootCombat"] = { text = "+{V}% Chance To Double Loot in Combat", },
   ["FarmingYield"] = { text = "{V}% Farming Yield" },
   ["increasedSlayerCoins"] = { text = "+{V}% Slayer Coins", },
   ["GPFromMonstersFlat"] = { text = "{V} GP From Monsters" },
   ["increasedSlayerXP"] = { text = "+{V}% Slayer XP", },
   ["GlobalPreservationChance"] = { text = "{V}% Chance to Preserve Resources in Skills" },
   ["increasedHPRegenFlat"] = { text = "+{V} Flat HP Regen", },
   ["RunePreservation"] = { text = "{V}% Rune Preservation" },
   ["increasedGPGlobal"] = { text = "+{V}% Global GP (except Item Sales)", },
   ["MaxHitpoints"] = { text = "{VX} Maximum Hitpoints" },
   ["increasedGPFromMonsters"] = { text = "+{V}% GP From Monsters", },
   ["ChanceToDoubleItemsSkill"] = { text = "{V1}% Chance to Double Items in {SV0}" },
   ["increasedGPFromMonstersFlat"] = { text = "+{V} GP From Monsters", },
   ["autoSlayerUnlocked"] = { text = "{V} Auto Slayer Unlocked" },
   ["increasedGPFromThieving"] = { text = "+{V}% GP From Thieving", },
   ["HitpointRegeneration"] = { text = "{V}% Hitpoint Regeneration" },
   ["increasedGPFromThievingFlat"] = { text = "+{V} GP From Thieving", },
   ["SlayerXP"] = { text = "{V}% Slayer XP" },
   ["increasedGPFromAgility"] = { text = "+{V}% GP From Agility", },
   ["PotionChargesFlat"] = { text = "{V} Charges per Potion" },
   ["decreasedGPFromAgility"] = { text = "-{V}% GP From Agility", isNegative = true },
   ["SkillInterval"] = { text = "{VMS1}s {SV0} Interval", isIncreaseNegative = True },
   ["increasedDamageToBosses"] = { text = "+{V}% Damage To Bosses", },
   ["BankSpace"] = { text = "{V} Bank Space" },
   ["increasedDamageToSlayerTasks"] = { text = "+{V}% Damage To Slayer Tasks", },
   ["MinHitBasedOnMaxHit"] = { text = "{V}% of Maximum Hit added to Minimum Hit" },
   ["increasedDamageToSlayerAreaMonsters"] = { text = "+{V}% Damage To Slayer Area Monsters", },
   ["DamageToSlayerTasks"] = { text = "{V}% Damage To Slayer Tasks" },
   ["increasedDamageToCombatAreaMonsters"] = { text = "+{V}% Damage To Combat Area Monsters", },
   ["Lifesteal"] = { text = "{V}% Lifesteal" },
   ["increasedDamageToDungeonMonsters"] = { text = "+{V}% Damage To Dungeon Monsters", },
   ["HPRegenFlat"] = { text = "{V} Flat HP Regen" },
   ["increasedDamageToAllMonsters"] = { text = "+{V}% Damage To All Monsters", },
   ["ChanceToDoubleOres"] = { text = "{V}% Chance to Double Ores in Mining" },
   ["increasedAutoEatEfficiency"] = { text = "+{V}% Auto Eat Efficiency", },
   ["MaxStamina"] = { text = "{V} Max Stamina" },
   ["increasedAutoEatThreshold"] = { text = "+{V}% Auto Eat Threshold", },
   ["MonsterRespawnTimer"] = { text = "{VMS}s Monster Respawn Timer", isIncreaseNegative = True },
   ["increasedAutoEatHPLimit"] = { text = "+{V}% Auto Eat HP Limit", },
   ["SkillPreservationChance"] = { text = "{V1}% Chance to Preserve Resources in {SV0}" },
   ["increasedFoodHealingValue"] = { text = "+{V}% Food Healing Value", },
   ["DamageToCombatAreaMonsters"] = { text = "{V}% Damage To Combat Area Monsters" },
   ["increasedChanceToPreservePrayerPoints"] = { text = "+{V}% Chance To Preserve Prayer Points", },
   ["TreeCutLimit"] = { text = "{V} Tree Cut Limit" },
   ["increasedMinAirSpellDmg"] = { text = "+{VX} Min Air Spell Dmg", },
   ["EquipmentSets"] = { text = "{V} Equipment Sets" },
   ["increasedMinWaterSpellDmg"] = { text = "+{VX} Min Water Spell Dmg", },
   ["HiddenSkillLevel"] = { text = "{V1} Hidden {SV0} Level" },
   ["increasedMinEarthSpellDmg"] = { text = "+{VX} Min Earth Spell Dmg", },
   ["ChanceToPreservePrayerPoints"] = { text = "{V}% Chance To Preserve Prayer Points" },
   ["increasedMinFireSpellDmg"] = { text = "+{VX} Min Fire Spell Dmg", },
   ["ReflectDamage"] = { text = "{V}% Reflect Damage" },
   ["increasedAmmoPreservation"] = { text = "+{V}% Ammo Preservation", },
   ["MeleeEvasion"] = { text = "{V}% Melee Evasion" },
   ["increasedRunePreservation"] = { text = "+{V}% Rune Preservation", },
   ["DamageToSlayerAreaMonsters"] = { text = "{V}% Damage To Slayer Area Monsters" },
   ["increasedHiddenSkillLevel"] = { text = "+{V1} Hidden {SV0} Level", },
   ["GPFromMonsters"] = { text = "{V}% GP From Monsters" },
   ["decreasedPlayerAttackSpeed"] = { text = "-{VMS}s Player Attack Speed", },
   ["MagicEvasion"] = { text = "{V}% Magic Evasion" },
   ["decreasedPlayerAttackSpeedPercent"] = { text = "-{V}% Player Attack Speed", },
   ["PlayerAttackSpeedPercent"] = { text = "{V}% Player Attack Speed", isIncreaseNegative = True },
   ["increasedSlayerAreaEffectNegationFlat"] = { text = "+{V}% Flat Slayer Area Effect Negation", },
   ["PreservationChance"] = { text = "{V}% Chance to Preserve Resources" },
   ["decreasedMonsterRespawnTimer"] = { text = "-{VMS}s Monster Respawn Timer", },
   ["DamageReduction"] = { text = "{V}% Damage Reduction" },
   ["decreasedGlobalAccuracy"] = { text = "-{V}% Global Accuracy", isNegative = true },
   ["MinWaterSpellDmg"] = { text = "{VX} Min Water Spell Dmg" },
   ["decreasedMeleeAccuracyBonus"] = { text = "-{V}% Melee Accuracy Bonus", isNegative = true },
   ["DamageToAllMonsters"] = { text = "{V}% Damage To All Monsters" },
   ["decreasedMeleeStrengthBonus"] = { text = "-{V}% Melee Strength Bonus", isNegative = true },
   ["golbinRaidIncreasedStartingRuneCount"] = { text = "{V} to starting Elemental Rune count" },
   ["decreasedMeleeEvasion"] = { text = "-{V}% Melee Evasion", isNegative = true },
   ["FoodHealingValue"] = { text = "{V}% Food Healing Value" },
   ["decreasedRangedAccuracyBonus"] = { text = "-{V} Ranged Accuracy Bonus", isNegative = true },
   ["MinFireSpellDmg"] = { text = "{VX} Min Fire Spell Dmg" },
   ["decreasedRangedStrengthBonus"] = { text = "-{V}% Ranged Strength Bonus", isNegative = true },
   ["SlayerCoins"] = { text = "{V}% Slayer Coins" },
   ["decreasedRangedEvasion"] = { text = "-{V}% Ranged Evasion", isNegative = true },
   ["GPFromThievingFlat"] = { text = "{V} GP From Thieving" },
   ["decreasedMagicAccuracyBonus"] = { text = "-{V}% Magic Accuracy Bonus", isNegative = true },
   ["GlobalAccuracy"] = { text = "{V}% Global Accuracy" },
   ["decreasedMagicDamageBonus"] = { text = "-{V}% Magic Damage Bonus", isNegative = true },
   ["ChanceToDoubleLootThieving"] = { text = "{V}% Chance To Double Loot in Thieving" },
   ["decreasedMagicEvasion"] = { text = "-{V}% Magic Evasion", isNegative = true },
   ["SlayerAreaEffectNegationFlat"] = { text = "{V}% Flat Slayer Area Effect Negation" },
   ["decreasedMaxHitFlat"] = { text = "-{VX} Max Hit", isNegative = true },
   ["MagicAccuracyBonus"] = { text = "{V}% Magic Accuracy Bonus" },
   ["decreasedMaxHitPercent"] = { text = "-{V}% Max Hit", isNegative = true },
   ["SkillIntervalPercent"] = { text = "{V1}% {SV0} Interval", isIncreaseNegative = True },
   ["decreasedDamageReduction"] = { text = "-{V}% Damage Reduction", isNegative = true },
   ["GlobalSkillXP"] = { text = "{V}% Global Skill XP" },
   ["decreasedChanceToDoubleLootCombat"] = { text = "-{V}% Chance To Double Loot in Combat", isNegative = true },
   ["MeleeAccuracyBonus"] = { text = "{V}% Melee Accuracy Bonus" },
   ["decreasedSlayerCoins"] = { text = "-{V}% Slayer Coins", isNegative = true },
   ["DamageToBosses"] = { text = "{V}% Damage To Bosses" },
   ["decreasedSlayerXP"] = { text = "-{V}% Slayer XP", isNegative = true },
   ["ChanceToPreservePotionCharge"] = { text = "{V}% Chance To Preserve Potion Charge" },
   ["decreasedHPRegenFlat"] = { text = "-{V} Flat HP Regen", isNegative = true },
   ["MaxHitPercent"] = { text = "{V}% Max Hit" },
   ["decreasedGPGlobal"] = { text = "-{V}% GP from all sources (Except Item Selling)", isNegative = true },
   ["AltMagicSkillXP"] = { text = "{V}% Alt. Magic Skill XP" },
   ["decreasedGPFromMonsters"] = { text = "-{V}% GP From Monsters", isNegative = true },
   ["StaminaPreservationChance"] = { text = "{V}% Chance to Preserve Stamina" },
   ["decreasedGPFromMonstersFlat"] = { text = "-{V} GP From Monsters", isNegative = true },
   ["MinAirSpellDmg"] = { text = "{VX} Min Air Spell Dmg" },
   ["decreasedDamageToBosses"] = { text = "-{V}% Damage To Bosses", isNegative = true },
   ["AutoEatEfficiency"] = { text = "{V}% Auto Eat Efficiency" },
   ["decreasedDamageToSlayerTasks"] = { text = "-{V}% Damage To Slayer Tasks", isNegative = true },
   ["GPFromThieving"] = { text = "{V}% GP From Thieving" },
   ["decreasedDamageToSlayerAreaMonsters"] = { text = "-{V}% Damage To Slayer Area Monsters", isNegative = true },
   ["ChanceToDoubleItemsGlobal"] = { text = "{V}% Chance to Double Items Globally" },
   ["decreasedDamageToCombatAreaMonsters"] = { text = "-{V}% Damage To Combat Area Monsters", isNegative = true },
   ["GPGlobal"] = { text = "{V}% GP from all sources (Except Item Selling)" },
   ["decreasedDamageToDungeonMonsters"] = { text = "-{V}% Damage To Dungeon Monsters", isNegative = true },
   ["RangedAccuracyBonus"] = { text = "{V} Ranged Accuracy Bonus" },
   ["decreasedDamageToAllMonsters"] = { text = "-{V}% Damage To All Monsters", isNegative = true },
   ["AutoEatThreshold"] = { text = "{V}% Auto Eat Threshold" },
   ["decreasedAutoEatEfficiency"] = { text = "-{V}% Auto Eat Efficiency", isNegative = true },
   ["PlayerAttackSpeed"] = { text = "{VMS}s Player Attack Speed", isIncreaseNegative = True },
   ["decreasedAutoEatThreshold"] = { text = "-{V}% Auto Eat Threshold", isNegative = true },
   ["freeBonfires"] = { text = "+ Automatically relight bonfires for free" },
   ["decreasedAutoEatHPLimit"] = { text = "-{V}% Auto Eat HP Limit", isNegative = true },
   ["AutoEatHPLimit"] = { text = "{V}% Auto Eat HP Limit" },
   ["decreasedFoodHealingValue"] = { text = "-{V}% Food Healing Value", isNegative = true },
   ["BankSpaceShop"] = { text = "{V} Bank Space from Shop" },
   ["decreasedChanceToPreservePrayerPoints"] = { text = "-{V}% Chance To Preserve Prayer Points", isNegative = true },
   ["BirdNestDropRate"] = { text = "{V}% Bird Nest drop rate" },
   ["decreasedMinAirSpellDmg"] = { text = "-{VX} Min Air Spell Dmg", isNegative = true },
   ["RangedEvasion"] = { text = "{V}% Ranged Evasion" },
  ["decreasedMinWaterSpellDmg"] = { text =  "-{VX} Min Water Spell Dmg", isNegative = true },
   ["ChanceDoubleHarvest"] = { text = "{V}% chance for double harvest" },
  ["decreasedMinEarthSpellDmg"] = { text =  "-{VX} Min Earth Spell Dmg", isNegative = true },
  ["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)" },
  --Rows below here are custom handlers for things the game doesn't include yet
   ["AmmoPreservation"] = { text = "{V}% Ammo Preservation" },
   ["increasedChanceForElementalRune"] = { text = "+{V}% chance to receive random elemental runes per Runecraft"},
   ["RangedStrengthBonus"] = { text = "{V}% Ranged Strength Bonus" },
   ["increasedElementalRuneGain"] = { text = "+{V} runes received when generating random elemental runes"},
   ["MagicDamageBonus"] = { text = "{V}% Magic Damage Bonus" },
   ["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" },
   ["increasedChanceDoubleHarvest"] = { text = "+{V}% chance for double harvest" },
   ["SeeingGoldChance"] = { text = "{V}% chance for Silver Ore to also produce a Gold Bar when smithed" },
   ["increasedChanceNoDamageMining"] = { text = "+{V}% chance to do zero damage to Ores and Rune Essence" },
   ["ElementalRuneGain"] = { text = "{V} runes received when generating random elemental runes" },
   ["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" },
   ["increasedAltMagicSkillXP"] = { text = "+{V}% Alt. Magic Skill XP" },
   ["ChanceNoDamageMining"] = { text = "{V}% chance to do zero damage to Ores and Rune Essence" },
   ["decreasedAltMagicSkillXP"] = { text = "-{V}% Alt. Magic Skill XP", isNegative = true },
   ["ChanceForElementalRune"] = { text = "{V}% chance to receive random elemental runes per Runecraft" },
}
}


Line 267: Line 188:
   result.id = tierID
   result.id = tierID
   return result
   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 295: Line 248:
       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 306: Line 259:
       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