API:GetBonus
From RoR Wiki
UI Lua API · Item functions
Version: WAR 1.4.8
Applies the player's current modifiers of one bonus type to a value and returns the result.
value = GetBonus(bonusType, baseValue)
Arguments
- bonusType
number– Bonus (stat) type.- baseValue
number– The value to modify.
Returns
- value
number–baseValueafter the player's modifiers forbonusTypehave been applied. May have a fractional part.
Details
- The modifiers are the ones the client currently has for the player's stats.
- If there is no player object or the Lua state is not available, nothing is returned.
- The function needs at least two arguments and only reads the last two.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
From default/ea_characterwindow/source/characterwindowstats.lua:
function CharacterWindow.CalculateValueWithBonus(bonusType, baseValue)
return GetBonus(bonusType, baseValue)
end
A trade skill level including bonuses, from default/easystem_tooltips/source/itemtooltips.lua:
local bonusType = GetTradeSkillBonusType( tradeSkillId ) playerSkill = GetBonus( bonusType, playerSkill )
