16,985
edits
m (Add missing modifier skill) |
(_getModifierText: Implement support for value ranges) |
||
Line 78: | Line 78: | ||
["RangedEvasion"] = { text = "{V}% Ranged Evasion", skills = {'Combat'} }, | ["RangedEvasion"] = { text = "{V}% Ranged Evasion", skills = {'Combat'} }, | ||
["ChanceDoubleHarvest"] = { text = "{V}% chance for double harvest", skills = {'Farming'} }, | ["ChanceDoubleHarvest"] = { text = "{V}% chance for double harvest", skills = {'Farming'} }, | ||
["golbinRaidStartingWeapon"] = { text = "Start the Golbin Raid with an { | ["golbinRaidStartingWeapon"] = { text = "Start the Golbin Raid with an {VITEM}", unsigned = true }, | ||
["AttackRolls"] = { text = "+Lucky Hit Chance (Roll twice, take the better result)", skills = {'Combat'} }, | ["AttackRolls"] = { text = "+Lucky Hit Chance (Roll twice, take the better result)", skills = {'Combat'} }, | ||
["AmmoPreservation"] = { text = "{V}% Ammo Preservation", skills = {'Ranged'} }, | ["AmmoPreservation"] = { text = "{V}% Ammo Preservation", skills = {'Ranged'} }, | ||
Line 155: | Line 155: | ||
["summoningSynergy_9_11"] = {text = "The Chef in Thieving now deals no damage to you.", skills = {'Thieving'}}, | ["summoningSynergy_9_11"] = {text = "The Chef in Thieving now deals no damage to you.", skills = {'Thieving'}}, | ||
["summoningSynergy_9_16"] = {text = "Crafting Recipes that require Dragonhide now use {V} quantity to create. Recipe cost cannot go below 1.", skills = {'Crafting'}, inverseSign = true}, | ["summoningSynergy_9_16"] = {text = "Crafting Recipes that require Dragonhide now use {V} quantity to create. Recipe cost cannot go below 1.", skills = {'Crafting'}, inverseSign = true}, | ||
["summoningSynergy_9_17"] = {text = " | ["summoningSynergy_9_17"] = {text = "{VMS}s Skill Interval for Cooking & Smithing.", inverseSign = true, skills = {'Cooking', 'Smithing'}}, | ||
["summoningSynergy_9_18"] = {text = "Generous Cook Potions now provide {V}% charges. This bonus is applied when a new potion is activated.", skills = {'Cooking'}}, | ["summoningSynergy_9_18"] = {text = "Generous Cook Potions now provide {V}% charges. This bonus is applied when a new potion is activated.", skills = {'Cooking'}}, | ||
["summoningSynergy_10_11"] = {text = "Successfully pickpocketting the Miner in Thieving will now grant {V} Rune Essence.", skills = {'Thieving'}}, | ["summoningSynergy_10_11"] = {text = "Successfully pickpocketting the Miner in Thieving will now grant {V} Rune Essence.", skills = {'Thieving'}}, | ||
Line 207: | Line 207: | ||
["debuffImmunity"] = { text = "Immune to debuffs", skills = {'Combat'} }, | ["debuffImmunity"] = { text = "Immune to debuffs", skills = {'Combat'} }, | ||
["Decay"] = { text = "Take {V}% of Max HP as damage on a succesful attack", isIncreaseNegative = true, skills = {'Combat'} }, | ["Decay"] = { text = "Take {V}% of Max HP as damage on a succesful attack", isIncreaseNegative = true, skills = {'Combat'} }, | ||
["doubleItemsSkill"] = { text = "x{VMUL} Items received from {SV0}" }, | ["doubleItemsSkill"] = { text = "x{VMUL} Items received from {SV0}", unsigned = true }, | ||
["doubleOresMining"] = { text = "x{VMUL} Ores received from Mining", skills = {'Mining'} }, | ["doubleOresMining"] = { text = "x{VMUL} Ores received from Mining", unsigned = true, skills = {'Mining'} }, | ||
["DragonBreathDamage"] = { text = "{V}% damage taken from dragonbreath", isIncreaseNegative = true, skills = {'Combat'} }, | ["DragonBreathDamage"] = { text = "{V}% damage taken from dragonbreath", isIncreaseNegative = true, skills = {'Combat'} }, | ||
["FiremakingCoalChance"] = { text = "{V}% chance to receive coal when burning logs in Firemaking", skills = {'Firemaking'} }, | ["FiremakingCoalChance"] = { text = "{V}% chance to receive coal when burning logs in Firemaking", skills = {'Firemaking'} }, | ||
Line 256: | Line 256: | ||
["RedemptionThreshold"] = { text = "{V}% redemption threshold", skills = {'Combat'} }, | ["RedemptionThreshold"] = { text = "{V}% redemption threshold", skills = {'Combat'} }, | ||
["RolledReflectDamage"] = { text = "{S}0-{VX} Reflect Damage", unsigned = true, skills = {'Combat'} }, | ["RolledReflectDamage"] = { text = "{S}0-{VX} Reflect Damage", unsigned = true, skills = {'Combat'} }, | ||
["RuneProvision"] = { text = "Rune providing items provide {VMUL}x as many runes", skills = {'Combat'} }, | ["RuneProvision"] = { text = "Rune providing items provide {VMUL}x as many runes", unsigned = true, skills = {'Combat'} }, | ||
["SecondaryFoodBurnChance"] = { text = "{V}% Secondary Chance to burn food when Cooking", isIncreaseNegative = true, skills = {'Cooking'} }, | ["SecondaryFoodBurnChance"] = { text = "{V}% Secondary Chance to burn food when Cooking", isIncreaseNegative = true, skills = {'Cooking'} }, | ||
["sleepImmunity"] = { text = "Immune to Sleep", skills = {'Combat'} }, | ["sleepImmunity"] = { text = "Immune to Sleep", skills = {'Combat'} }, | ||
Line 486: | Line 486: | ||
return 'ERROR: Invalid modifier type for ' .. modifier .. '[[Category:Pages with script errors]]' | return 'ERROR: Invalid modifier type for ' .. modifier .. '[[Category:Pages with script errors]]' | ||
end | end | ||
local formatModValue = function(value, rule) | |||
local ruleFunctions = { | |||
['V'] = function(val) return val end, | |||
['VD'] = function(val) return val / 10 end, | |||
['VMS'] = function(val) return val / 1000 end, | |||
['VX'] = function(val) return val * 10 end, | |||
['VX100'] = function(val) return val * 100 end, | |||
['V%+100'] = function(val) return val + 100 end, | |||
['VMUL'] = function(val) return 2^val end, | |||
['VITEM'] = function(val) | |||
local item = ItemData.Items[tonumber(val) + 1] | |||
if item ~= nil then | |||
return item.name | |||
end | |||
end | |||
} | |||
local ruleFunc = ruleFunctions[rule] or ruleFunctions['V'] | |||
if type(value) == 'table' then | |||
-- If table is a pair of values then format both & add a separator | |||
return ruleFunc(value[1]) .. '-' .. ruleFunc(value[2]) | |||
else | |||
return ruleFunc(value) | |||
end | |||
end | |||
local result = modText | local result = modText | ||
Line 497: | Line 523: | ||
end | end | ||
return table.concat(resultArray, '<br/>') | return table.concat(resultArray, '<br/>') | ||
elseif Shared.contains(modText, '{SV0}') then | |||
-- If the value is a table and the mod text contains {SV0}, then | |||
-- the value is a {skillID, val} pair, otherwise it is a range of | |||
-- values {minVal, maxVal} | |||
if value[1] ~= nil then | if value[1] ~= nil then | ||
local skillName = p.getSkillName(value[1]) | local skillName = p.getSkillName(value[1]) | ||
Line 507: | Line 536: | ||
end | end | ||
end | end | ||
local valSign = (valueUnsigned and '' or sign) | |||
result = string.gsub(result, '{(V[^}]*)}', function(rule) return valSign .. formatModValue(value, rule) end) | |||
result = string.gsub(result, '{S}', sign) | |||
if doColor then | if doColor then |