Module:Skill calc/bonusGenerator
Documentation for this module may be created at Module:Skill calc/bonusGenerator/doc
--[=[ bonus
-- These determine and return the bonus values for calculators.
-- To create a new one:
-- - if there is no 'object' category, add an 'elseif' catch for that category
-- - if the specific 'skill' for a category is missing, add an 'if' or 'elseif'
-- catch for that skill
-- - each section should set the local bonus variable. Do not break or return early.
-- Inputs:
-- - Skill :: The target skill
-- - Object :: Type of bonus
-- - Pieces :: For most bonuses, this is how many pieces are used.
-- For some, this is a specific item (E.G. tools)
--]=]
--[=[ TODO
-- Include Aura bonuses
-- Include Potion bonuses
-- Include Bonus exp bonuses
-- This module will need some drastic change based on this data: https://docs.google.com/spreadsheets/d/1LjLgtA61DiY5L_3tXZuW0qKsvA-zrKbOhDLnJdsQ1DQ/edit?usp=sharing
--]=]
return function(data)
-- Define and set local variables
local bonus, bonus2, pieces = 0, 0, 0
local object, skill, setting, item = "", "", "", ""
local category, name, subSetting = "", "", ""
-- Find what we've passed
if data.object then object = data.object end
if data.skill then skill = data.skill end
if data.pieces then pieces = data.pieces end
if data.setting then setting = data.setting end
if data.item then item = data.item end
if data.name then name = data.name end
if data.subSetting then subSetting = data.subSetting end
--[=[ Variable usage
-- skill: Skill being used
-- object: Specific type of bonus
-- item: Any additional objects within an object
-- pieces: Number to be considered with object
-- category: Any specific subset within a skill
-- setting: Any specific settings required to distinguish between bonuses
-- name: Name of specific items effected by a bonus
--]=]
-- Figure out what bonus is being searched
if object == "outfit" then
if skill == "Firemaking" then
if pieces == 1 then bonus = (2 / 100)
elseif pieces == 2 then bonus = (5 / 100) end
elseif (skill == "Fishing" or
skill == "Runecrafting" or
skill == "Thieving" or
skill == "Woodcutting") then
if pieces < 4 then bonus = (pieces / 100)
elseif pieces == 4 then bonus = (5 / 100) end
else
if pieces < 5 then bonus = (pieces / 100)
elseif pieces == 5 then bonus = (6 / 100) end
end
-- This section is named 'elite' for the sake of having a relatable in-game set as a guide. This set is used in this calculator as a work around when an 'outfit' would otherwise typically be ignored based on the module's logic. It doesn't come up often enough to change the logic, but enough to have a back door.
elseif object == "elite" then
if pieces < 5 then bonus = (pieces / 100)
elseif pieces == 4 then bonus = (5 / 100)
elseif pieces == 5 then bonus = (6 / 100) end
elseif object == "portable" then
if skill == "Cooking" then bonus = (21 / 100)
elseif skill == "Firemaking" then bonus = (15 / 100)
else bonus = (10 / 100) end
elseif object == "tool" then
if skill == "Cooking" and item == "Dwarven army axe" then
bonus = 3
elseif skill == "Hunter" and item == "Enhanced yaktwee stick" then
bonus = (5 / 100)
end
elseif object == "abyss" then
if item == "Yes" then
bonus = (250 / 100)
elseif item == "Demonic Skull" then
bonus = (350 / 100)
end
elseif object == "extra" then
if not (category == "Churning" or category == "Brewing") then
if category == "Meat" and item == "Bonfire" then
bonus = (10 / 100)
elseif item == "Portable Range" and not (category == "Gnome Drinks") then
bonus = (21 / 100)
elseif skill == "Divination" then
if item == "1" then
bonus = (10 / 100)
--elseif item == "Enriched" and category == "Harvest" then
--bonus = 2
end
elseif skill == "Mining" and item == "1" then
bonus = (10 / 100)
end
end
-- Anachronia spa (should only work with the Anachronia Agility Course)
--elseif object == "spa" and skill == "Agility" then
--bonus = (item / 100)
-- This will allow the user to set a bonus value from random events and items (BXP,
-- advanced pulse cores, etc)
-- 1.5 -> 50% bonus.
elseif object == "custom" then bonus = ((item * 100 - 100) / 100)
elseif object == "altar" then
if item == "Teak" then bonus = (110 / 100)
elseif item == "Cloth" then bonus = (125 / 100)
elseif item == "Oak - 1 incense" or
item == "Mahogany" then bonus = (150 / 100)
elseif item == "Teak - 1 incense" then bonus = (160 / 100)
elseif item == "Cloth - 1 incense" or
item == "Limestone" then bonus = (175 / 100)
elseif item == "Oak - 2 incense" or
item == "Mahogany - 1 incense" or
item == "Marble" then bonus = (200 / 100)
elseif item == "Teak - 2 incense" then bonus = (210 / 100)
elseif item == "Cloth - 2 incense" or
item == "Limestone - 1 incense" then bonus = (225 / 100)
elseif item == "Mahogany - 2 incense" or
item == "Cremation" or
item == "Marble - 1 incense" or
item == "Gilded" then bonus = (250 / 100)
elseif item == "Limestone - 2 incense" then bonus = (275 / 100)
elseif item == "Marble - 2 incense" or
item == "Gilded - 1 incense" then bonus = (300 / 100)
elseif item == "Gilded - 2 incense" or
item == "Chaos" then bonus = (350 / 100)
elseif item == "Ectofuntus" then bonus = (400 / 100)
elseif item == "None" then bonus = 1
end
if setting and setting == "Bones for Cremation" then
bonus = 1
end
elseif object == "wild" then -- Agility
if item == "Demonic Skull" then bonus = (4 / 100)
elseif item == "Wilderness Sword 2+" then bonus = (5 / 100)
elseif item == "Both" then bonus = (4 / 100)
bonus2 = (5 / 100) -- this doesn't seem to work
end
elseif object == "age" and skill == "Farming" then -- Player-owned farm curing
if item == "Baby" then bonus = (5 / 1000)
elseif item == "Adolescent" then bonus = (75 / 10000)
elseif item == "Adult" then bonus = (15 / 1000)
elseif item == "Elder" then bonus = (45 / 10000)
end
-- This section intentionally verbose in case of future expansions
-- This will be multiplied directly to experience; must be atleast 1.
elseif object == "potion" then
bonus = 1 -- Must be atleast 1
if item == "Perfect juju" then
if (skill == "Prayer") then
if name == "Cleansing crystal" then
if setting == "VoiceOfSeren" then
if subsetting == "AvgOverTime" then
bonus = (140.3 / 100)
else
bonus = (126 / 100)
end
else
bonus = (105 / 100)
end
elseif string.find(name, "Gilded") then
bonus = (105 / 100)
end
elseif (skill == "Herblore") then
if (category == "Combination potion") then
-- To be assessed
end
end
end
-- This will be multiplied directly to experience; must be atleast 1.
elseif object == "VoiceOfSeren" then
bonus = 1 -- Must be atleast 1
if not (setting == "Perfect juju") then
if name == "Cleansing crystal" then
if subSetting == "AvgOverTime" then
bonus = (103.3 / 100)
else
bonus = (120 / 100)
end
end
end
-- This will be multiplied directly to experience; must be atleast 1.
elseif object == "aura" then
bonus = 1 -- Must be atleast 1
if item == "Basic" then bonus = (101 / 100)
elseif item == "Greater" then bonus = (101.5 / 100)
elseif item == "Master" then bonus = (102 / 100)
elseif item == "Supreme" then bonus = (102.5 / 100)
end
else
bonus = (tonumber(pieces) / 100)
end
return bonus, bonus2
end