Anonymous

Module:Constants: Difference between revisions

From Melvor Idle
Fixed some edge case modifiers
(Updated getModifierDetails to use modifiers from gameData)
(Fixed some edge case modifiers)
Line 393: Line 393:
["DamageTakenWhenStunned"] = { text = "{V}% damage taken when stunned", isIncreaseNegative = true, skills = {'Combat'} },
["DamageTakenWhenStunned"] = { text = "{V}% damage taken when stunned", isIncreaseNegative = true, skills = {'Combat'} },
["DeadlyPoisonDOTDamage"] = { text = "{V}% Damage taken from Deadly Poison", skills = {'Combat'} },
["DeadlyPoisonDOTDamage"] = { text = "{V}% Damage taken from Deadly Poison", skills = {'Combat'} },
["DeadlyToxinsFromHerblore"] = { text = "When creating Lethal Toxins Potions in Herblore, gain {V} Deadly Toxins Potion(s) as an additional Potion (Cannot be doubled)", skills = {'Herblore'} },
["DeadlyToxinsFromHerblore"] = { text = "When creating Lethal Toxins Potions in Herblore, gain +1 Deadly Toxins Potion(s) as an additional Potion (Cannot be doubled)", skills = {'Herblore'} },
["decreaseEnemyEvasionOnSleep"] = { text = "When a Sleep is applied to the Target, -10% Global Evasion Rating for the remainder of the fight (Stacks up to 3 times)", skills = {'Combat'} },
["decreaseEnemyEvasionOnSleep"] = { text = "When a Sleep is applied to the Target, -10% Global Evasion Rating for the remainder of the fight (Stacks up to 3 times)", skills = {'Combat'} },
["decreaseEnemyEvasionOnStun"] = { text = "When a Stun is applied to the Target, -10% Global Evasion Rating for the remainder of the fight (Stacks up to 3 times)", skills = {'Combat'} },
["decreaseEnemyEvasionOnStun"] = { text = "When a Stun is applied to the Target, -10% Global Evasion Rating for the remainder of the fight (Stacks up to 3 times)", skills = {'Combat'} },
Line 944: Line 944:
['(value)=>value+1'] = function(val) return val + 1 end,
['(value)=>value+1'] = function(val) return val + 1 end,
['(value)=>Math.pow(2,value)'] = function(val) return 2^val end,
['(value)=>Math.pow(2,value)'] = function(val) return 2^val end,
["(value)=>{if(value>=2){return getLangString('ALLOW_UNHOLY_PRAYERS');}\nelse if(value>=1){return getLangString('ALLOW_UNHOLY_PRAYERS_WITH_EQUIPMENT');}\nelse{return 'Invalid modifier value.';}}"] = function(val) return 'Allows for Unholy Prayers to be used' end,
["(value)=>{if(value>1){return templateLangString('MODIFIER_DATA_increasedSieveToolLevels',{value:numberWithCommas(value)});}\nelse{return templateLangString('MODIFIER_DATA_increasedSieveToolLevel',{value:numberWithCommas(value)});}}"] = function(val) return '+' .. val .. ' level(s) of the Sieve Tool in Archaeology' end,
["(value)=>{if(value>1){return templateLangString('MODIFIER_DATA_increasedTrowelToolLevels',{value:numberWithCommas(value)});}\nelse{return templateLangString('MODIFIER_DATA_increasedTrowelToolLevel',{value:numberWithCommas(value)});}}"] = function(val) return '+' .. val .. ' level(s) of the Trowel Tool in Archaeology' end,
["(value)=>{if(value>1){return templateLangString('MODIFIER_DATA_increasedBrushToolLevels',{value:numberWithCommas(value)});}\nelse{return templateLangString('MODIFIER_DATA_increasedBrushToolLevel',{value:numberWithCommas(value)});}}"] = function(val) return '+' .. val .. ' level(s) of the Brush Tool in Archaeology' end,
["(value)=>{if(value>1){return templateLangString('MODIFIER_DATA_increasedShovelToolLevels',{value:numberWithCommas(value)});}\nelse{return templateLangString('MODIFIER_DATA_increasedShovelToolLevel',{value:numberWithCommas(value)});}}"] = function(val) return '+' .. val .. ' level(s) of the Shovel Tool in Archaeology' end,
['(value)=>game.golbinRaid.startingWeapons[value].name'] = function(val)
['(value)=>game.golbinRaid.startingWeapons[value].name'] = function(val)
-- For golbin raid starting weapons
-- For golbin raid starting weapons
Line 957: Line 962:
}
}
local ruleFunc = ruleFunctions[modifyValue] or ruleFunctions['value']
local ruleFunc = ruleFunctions[modifyValue] or ruleFunctions['value']
 
if type(value) == 'table' then
if type(value) == 'table' then
-- If table is a pair of values then format both & add a separator
-- If table is a pair of values then format both & add a separator
Line 989: Line 994:


resultText = string.gsub(resultText, '${value}', function(rule) return (formatModValue(modMagnitude, rule) or '') end)
resultText = string.gsub(resultText, '${value}', function(rule) return (formatModValue(modMagnitude, rule) or '') end)
 
--Temp fix for a few edge case modifiers
if string.match(resultText, 'UNDEFINED TRANSLATION') then
resultText = modifierTypes[modName].text
end
if doColor then
if doColor then
local colorCode = (isNegative ~= nil and isNegative and 'color:red' or 'color:green')
local colorCode = (isNegative ~= nil and isNegative and 'color:red' or 'color:green')