Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetBonus

From RoR Wiki
Revision as of 19:43, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 – baseValue after the player's modifiers for bonusType have 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 )

See also