Module:Constants
From Melvor Idle
Documentation for this module may be created at Module:Constants/doc
local p = {}
local ConstantData = mw.loadData('Module:Constants/data')
local modifierTypes = {
["increasedGlobalAccuracy"] = { text = "+{V}% Global Accuracy", },
["increasedMeleeAccuracyBonus"] = { text = "+{V}% Melee Accuracy Bonus", },
["increasedMeleeStrengthBonus"] = { text = "+{V}% Melee Strength Bonus", },
["increasedMeleeEvasion"] = { text = "+{V}% Melee Evasion", },
["increasedRangedAccuracyBonus"] = { text = "+{V}% Ranged Accuracy Bonus", },
["increasedRangedStrengthBonus"] = { text = "+{V}% Ranged Strength Bonus", },
["increasedRangedEvasion"] = { text = "+{V}% Ranged Evasion", },
["increasedMagicAccuracyBonus"] = { text = "+{V}% Magic Accuracy Bonus", },
["increasedMagicDamageBonus"] = { text = "+{V}% Magic Damage Bonus", },
["increasedMagicEvasion"] = { text = "+{V}% Magic Evasion", },
["increasedMaxHitFlat"] = { text = "+{VX} Max Hit", },
["increasedMaxHitPercent"] = { text = "+{V}% Max Hit", },
["increasedDamageReduction"] = { text = "+{V}% Damage Reduction", },
["increasedChanceToDoubleLootCombat"] = { text = "+{V}% Chance To Double Loot in Combat", },
["increasedSlayerCoins"] = { text = "+{V}% Slayer Coins", },
["increasedSlayerXP"] = { text = "+{V}% Slayer XP", },
["increasedHPRegenFlat"] = { text = "+{V} Flat HP Regen", },
["increasedGPGlobal"] = { text = "+{V}% Global GP (except Item Sales)", },
["increasedGPFromMonsters"] = { text = "+{V}% GP From Monsters", },
["increasedGPFromMonstersFlat"] = { text = "+{V} GP From Monsters", },
["increasedGPFromThieving"] = { text = "+{V}% GP From Thieving", },
["increasedGPFromThievingFlat"] = { text = "+{V} GP From Thieving", },
["increasedGPFromAgility"] = { text = "+{V}% GP From Agility", },
["decreasedGPFromAgility"] = { text = "-{V}% GP From Agility", isNegative = true },
["increasedDamageToBosses"] = { text = "+{V}% Damage To Bosses", },
["increasedDamageToSlayerTasks"] = { text = "+{V}% Damage To Slayer Tasks", },
["increasedDamageToSlayerAreaMonsters"] = { text = "+{V}% Damage To Slayer Area Monsters", },
["increasedDamageToCombatAreaMonsters"] = { text = "+{V}% Damage To Combat Area Monsters", },
["increasedDamageToDungeonMonsters"] = { text = "+{V}% Damage To Dungeon Monsters", },
["increasedDamageToAllMonsters"] = { text = "+{V}% Damage To All Monsters", },
["increasedAutoEatEfficiency"] = { text = "+{V}% Auto Eat Efficiency", },
["increasedAutoEatThreshold"] = { text = "+{V}% Auto Eat Threshold", },
["increasedAutoEatHPLimit"] = { text = "+{V}% Auto Eat HP Limit", },
["increasedFoodHealingValue"] = { text = "+{V}% Food Healing Value", },
["increasedChanceToPreservePrayerPoints"] = { text = "+{V}% Chance To Preserve Prayer Points", },
["increasedFlatPrayerCostReduction"] = { text = "+{V} Flat Prayer Cost Reduction", },
["increasedMinAirSpellDmg"] = { text = "+{V} Min Air Spell Dmg", },
["increasedMinWaterSpellDmg"] = { text = "+{V} Min Water Spell Dmg", },
["increasedMinEarthSpellDmg"] = { text = "+{V} Min Earth Spell Dmg", },
["increasedMinFireSpellDmg"] = { text = "+{V} Min Fire Spell Dmg", },
["increasedAmmoPreservation"] = { text = "+{V}% Ammo Preservation", },
["increasedRunePreservation"] = { text = "+{V}% Rune Preservation", },
["increasedHiddenSkillLevel"] = { text = "+{V1} Hidden {SV0} Level", },
["decreasedPlayerAttackSpeed"] = { text = "-{V} Player Attack Speed", },
["decreasedPlayerAttackSpeedPercent"] = { text = "-{V}% Player Attack Speed", },
["increasedSlayerAreaEffectNegationFlat"] = { text = "+{V}% Flat Slayer Area Effect Negation", },
["decreasedMonsterRespawnTimer"] = { text = "-{VMS}s Monster Respawn Timer", },
["decreasedGlobalAccuracy"] = { text = "-{V}% Global Accuracy", isNegative = true },
["decreasedMeleeAccuracyBonus"] = { text = "-{V}% Melee Accuracy Bonus", isNegative = true },
["decreasedMeleeStrengthBonus"] = { text = "-{V}% Melee Strength Bonus", isNegative = true },
["decreasedMeleeEvasion"] = { text = "-{V}% Melee Evasion", isNegative = true },
["decreasedRangedAccuracyBonus"] = { text = "-{V} Ranged Accuracy Bonus", isNegative = true },
["decreasedRangedStrengthBonus"] = { text = "-{V}% Ranged Strength Bonus", isNegative = true },
["decreasedRangedEvasion"] = { text = "-{V}% Ranged Evasion", isNegative = true },
["decreasedMagicAccuracyBonus"] = { text = "-{V}% Magic Accuracy Bonus", isNegative = true },
["decreasedMagicDamageBonus"] = { text = "-{V}% Magic Damage Bonus", isNegative = true },
["decreasedMagicEvasion"] = { text = "-{V}% Magic Evasion", isNegative = true },
["decreasedMaxHitFlat"] = { text = "-{V} Max Hit", isNegative = true },
["decreasedMaxHitPercent"] = { text = "-{V}% Max Hit", isNegative = true },
["decreasedDamageReduction"] = { text = "-{V}% Damage Reduction", isNegative = true },
["decreasedChanceToDoubleLootCombat"] = { text = "-{V}% Chance To Double Loot in Combat", isNegative = true },
["decreasedSlayerCoins"] = { text = "-{V}% Slayer Coins", isNegative = true },
["decreasedSlayerXP"] = { text = "-{V}% Slayer XP", isNegative = true },
["decreasedHPRegenFlat"] = { text = "-{V} Flat HP Regen", isNegative = true },
["decreasedGPGlobal"] = { text = "-{V}% GP from all sources (Except Item Selling)", isNegative = true },
["decreasedGPFromMonsters"] = { text = "-{V}% GP From Monsters", isNegative = true },
["decreasedGPFromMonstersFlat"] = { text = "-{V} GP From Monsters", isNegative = true },
["decreasedDamageToBosses"] = { text = "-{V}% Damage To Bosses", isNegative = true },
["decreasedDamageToSlayerTasks"] = { text = "-{V}% Damage To Slayer Tasks", isNegative = true },
["decreasedDamageToSlayerAreaMonsters"] = { text = "-{V}% Damage To Slayer Area Monsters", isNegative = true },
["decreasedDamageToCombatAreaMonsters"] = { text = "-{V}% Damage To Combat Area Monsters", isNegative = true },
["decreasedDamageToDungeonMonsters"] = { text = "-{V}% Damage To Dungeon Monsters", isNegative = true },
["decreasedDamageToAllMonsters"] = { text = "-{V}% Damage To All Monsters", isNegative = true },
["decreasedAutoEatEfficiency"] = { text = "-{V}% Auto Eat Efficiency", isNegative = true },
["decreasedAutoEatThreshold"] = { text = "-{V}% Auto Eat Threshold", isNegative = true },
["decreasedAutoEatHPLimit"] = { text = "-{V}% Auto Eat HP Limit", isNegative = true },
["decreasedFoodHealingValue"] = { text = "-{V}% Food Healing Value", isNegative = true },
["decreasedChanceToPreservePrayerPoints"] = { text = "-{V}% Chance To Preserve Prayer Points", isNegative = true },
["decreasedFlatPrayerCostReduction"] = { text = "-{V} Flat Prayer Cost Reduction", isNegative = true },
["decreasedMinAirSpellDmg"] = { text = "-{V} Min Air Spell Dmg", isNegative = true },
["decreasedMinWaterSpellDmg"] = { text = "-{V} Min Water Spell Dmg", isNegative = true },
["decreasedMinEarthSpellDmg"] = { text = "-{V} Min Earth Spell Dmg", isNegative = true },
["decreasedMinFireSpellDmg"] = { text = "-{V} 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 = "+{V} 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 = "-{V1} {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 = "+{V1} {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 },
}
function p.getSkillName(skillID)
for skName, ID in Shared.skpairs(ConstantData.skill) do
if ID == skillID then
return skName
end
end
return nil
end
function p.getModifierText(modifier, value, doColor)
if doColor == nil then doColor = true end
local template = modifierTypes[modifier]
if template == nil then
return 'ERROR: Invalid modifier type [[Category:Pages with script errors]]'
end
local result = template.text
if type(value) == 'table' then
if value[1] ~= nil then
result = string.gsub(result, '{SV0}', p.getSkillName(value[1]))
end
if value[2] ~= nil then
result = string.gsub(result, '{V1}', value[2])
end
else
result = string.gsub(result, '{V}', value)
result = string.gsub(result, '{VMS}', value / 1000)
result = string.gsub(result, '{VX}', value * 10)
end
return result
end
return p