12,787
edits
m (typo) |
(_getModifierText: Fix issue with interpretation of 'V+100' modifier values) |
||
(12 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 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 | end | ||
function p. | function p.getSlayerTier(name) | ||
return p. | local tierID = ConstantData.slayerTier[name] | ||
if tierID == nil then | |||
return nil | |||
else | |||
return p.getSlayerTierByID(tierID) | |||
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 498: | Line 525: | ||
['VX'] = function(val) return val * 10 end, | ['VX'] = function(val) return val * 10 end, | ||
['VX100'] = function(val) return val * 100 end, | ['VX100'] = function(val) return val * 100 end, | ||
['V | ['V+100'] = function(val) return val + 100 end, | ||
['VMUL'] = function(val) return 2^val end, | ['VMUL'] = function(val) return 2^val end, | ||
['VITEM'] = function(val) | ['VITEM'] = function(val) |