Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetMoraleBarData

From RoR Wiki

UI Lua API · Hotbar functions
Version: WAR 1.4.8

Returns the morale ability placed in a morale bar slot.

hasAbility, abilityId = GetMoraleBarData(moraleLevel)

Arguments

moraleLevel
number – Morale slot, 1 to GameData.NUM_MORALE_LEVELS (4).

Returns

hasAbility
number – 1 if an ability is placed in the slot, otherwise 0. This is a number, not a boolean: 0 counts as true in Lua.
abilityId
number – Id of the ability in the slot, 0 if empty.

Details

  • For a slot outside 1 to 4 the error below is logged (not raised as a Lua error) and nothing is returned.
  • The stock UI only uses the second value.

Errors

  • Error in function call 'GetMoraleBarData': moraleSlotId must be 1 to GameData.NUM_MORALE_LEVELS. (logged)
  • The generic Invalid Parameters message when the argument is missing or not a number.

Example

From easystem_actionbarclustermanager/source/newabilityhandler.lua:

local _, currentlySlottedMoraleAbilityId = GetMoraleBarData (newAbility.moraleLevel)

if (currentlySlottedMoraleAbilityId == 0)
then
    SetMoraleBarData (newAbility.moraleLevel, newAbility.id)
end

See also