12,790
edits
m (Add missing modifier skill) |
(Correct RegenerationInterval attributes) |
||
(16 intermediate revisions by 2 users not shown) | |||
Line 65: | Line 65: | ||
["MaxHitPercent"] = { text = "{V}% Max Hit", skills = {'Combat'} }, | ["MaxHitPercent"] = { text = "{V}% Max Hit", skills = {'Combat'} }, | ||
["AltMagicSkillXP"] = { text = "{V}% Alt. Magic Skill XP", skills = {'Magic'} }, | ["AltMagicSkillXP"] = { text = "{V}% Alt. Magic Skill XP", skills = {'Magic'} }, | ||
["MinAirSpellDmg"] = { text = "{VX} Min Air Spell Dmg", skills = {' | ["MinAirSpellDmg"] = { text = "{VX} Min Air Spell Dmg", skills = {'Magic'} }, | ||
["AutoEatEfficiency"] = { text = "{V}% Auto Eat Efficiency", skills = {'Combat'} }, | ["AutoEatEfficiency"] = { text = "{V}% Auto Eat Efficiency", skills = {'Combat'} }, | ||
["GPFromThieving"] = { text = "{V}% GP From Thieving", skills = {'Thieving'} }, | ["GPFromThieving"] = { text = "{V}% GP From Thieving", skills = {'Thieving'} }, | ||
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 309: | Line 309: | ||
["PoisonReflectChance"] = { text = "{V}% chance to poison attackers when hit", skills = {'Combat'} }, | ["PoisonReflectChance"] = { text = "{V}% chance to poison attackers when hit", skills = {'Combat'} }, | ||
["rangedImmunity"] = { text = "Immune to Ranged attacks", skills = {'Combat'} }, | ["rangedImmunity"] = { text = "Immune to Ranged attacks", skills = {'Combat'} }, | ||
["RegenerationInterval"] = { text = "{VMS}s Hitpoint Regeneration interval", skills = {'Combat'} }, | ["RegenerationInterval"] = { text = "{VMS}s Hitpoint Regeneration interval", isIncreaseNegative = true, skills = {'Combat'} }, | ||
["slowImmunity"] = { text = "{V}% chance to ignore Slow effects", skills = {'Combat'} }, | ["slowImmunity"] = { text = "{V}% chance to ignore Slow effects", skills = {'Combat'} }, | ||
["SurgeSpellAccuracy"] = { text = "{V}% Accuracy Rating when using Surge spells", skills = {'Combat'} }, | ["SurgeSpellAccuracy"] = { text = "{V}% Accuracy Rating when using Surge spells", skills = {'Combat'} }, | ||
Line 329: | Line 329: | ||
[4] = 'Very Hard', | [4] = 'Very Hard', | ||
[5] = 'Elite', | [5] = 'Elite', | ||
[6] = 'Insane'} | [6] = 'Insane' | ||
} | |||
function p.getTriangleAttribute(attribute, attackerStyle, targetStyle, mode) | function p.getTriangleAttribute(attribute, attackerStyle, targetStyle, mode) | ||
Line 408: | Line 409: | ||
return Shared.titleCase(styleName) | return Shared.titleCase(styleName) | ||
end | end | ||
elseif type(styleNum) == 'string' and type(ConstantData.attackType[string.lower(styleNum)]) == 'number' then | |||
return Shared.titleCase(styleNum) | |||
end | end | ||
return "ERROR: Invalid combat style[[Category:Pages with script errors]]" | return "ERROR: Invalid combat style[[Category:Pages with script errors]]" | ||
end | end | ||
function p. | |||
--- Slayer functions | |||
-- | |||
function p.getSlayerTierByID(tierID, slayerLevel) -- returns a full table | |||
if slayerLevel == nil then | |||
slayerLevel = 99 -- this might upgrade to 120 in some update | |||
end | |||
if type(tierID) ~= 'number' then | |||
return nil | |||
elseif ConstantData.Slayer.Tiers[tierID + 1] == nil then | |||
return nil | |||
else | |||
local result = Shared.clone(ConstantData.Slayer.Tiers[tierID + 1]) | |||
result.id = tierID | |||
result.minQuantity = 10*(tierID+1) + 4 | |||
result.maxQuantity = 10*(tierID+1) + 4*slayerLevel | |||
return result | |||
end | |||
end | end | ||
function p. | function p.getSlayerTier(name) | ||
local tierID = ConstantData.slayerTier[name] | |||
if tierID == nil then | |||
return nil | |||
else | |||
return p.getSlayerTierByID(tierID) | |||
end | end | ||
end | end | ||
function p. | function p.getSlayerTierByLevel(level) -- returns a full table | ||
for i, tier in | if type(level) ~= 'number' or level < 1 then | ||
if tier. | return "ERROR: Invalid Slayer level [[Category:Pages with script errors]]" | ||
end | |||
for i, tier in ipairs(ConstantData.Slayer.Tiers) do | |||
if tier.minLevel <= level and (tier.maxLevel == nil or tier.maxLevel >= level) then | |||
return p.getSlayerTierByID(i - 1) | |||
end | end | ||
end | end | ||
end | end | ||
function p. | -- | ||
-- the following functions just return subsets of the slayer functions above | |||
return | -- | ||
function p.getSlayerTierName(tierID, fallback) | |||
return type(tierID) == 'number' and ConstantData.slayerTier[tierID] or "ERROR: Invalid Slayer tier[[Category:Pages with script errors]]" | |||
end | |||
function p.getSlayerTierNameByLevel(lvl, fallback) | |||
local tier = p.getSlayerTierByLevel(lvl) | |||
if type(tier) == 'table' then | |||
return tier.display | |||
else | |||
return fallback or "ERROR: Invalid Slayer tier[[Category:Pages with script errors]]" | |||
end | end | ||
end | |||
-- | |||
--- End of slayer functions | |||
--Turns a modifier name like 'increasedMeleeAccuracyBonus' into several pieces of data: | --Turns a modifier name like 'increasedMeleeAccuracyBonus' into several pieces of data: | ||
Line 486: | Line 517: | ||
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 554: | ||
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 567: | ||
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 |