api/main

lib:Exists()

Gets a value indicating whether or not a bodyguard exists (is assigned to barracks).

Return value

Boolean indicating whether a bodyguard is assigned to the barracks.


lib:GetGUID()

Gets the last known GUID of the bodyguard.
NOTE: This is not 100% reliable, GUID may change.

Return value

The last known GUID string of the bodyguard.


lib:GetHealth()

Gets the bodyguard's health.
The value returned should be fairly accurate.

Return value

Current (predicted) health of the player's bodyguard.


lib:GetInfo()

Gets a read-only copy of the bodyguard table.

Return value

A read-only table that maps its index to the bodyguard table in the library.


lib:GetLevel()

Gets the level of the bodyguard.

Return value

The bodyguard's level (follower level).


lib:GetMaxHealth()

Gets the maximum health of the bodyguard.

Return value

The bodyguard's maximum health.


lib:GetName()

Gets the name of the bodyguard.

Return value

The bodyguard's name (follower name).


lib:GetStatus()

Gets the last known status of the bodyguard.
This can be any of the values defined in the lib.Status table Inactive: Bodyguard is not currently with the player. Active: Bodyguard is with the player. Unknown: Bodyguard status is not known or uncertain (this includes death). As with the GUID method, the bodyguard status is quite unreliable at this time.

Return value

The last known status of the bodyguard.


lib:IsAlive()

Gets a value indicating whether the bodyguard is alive.

Return value

A boolean value indicating whether the bodyguard is currently alive.


lib:RegisterCallback(cb_type, cb_func)

Registers a function for a specific callback type.
This can be used to listen for certain events like health updates from the library. Currently, the following callbacks are available: guid, name, health, level, status. <ul> <li>guid args: guid</li> <li>name args: name</li> <li>health args: health, max health</li> <li>level args: level</li> <li>status args: status</li> </ul> The first argument will always be a reference to the library table.

Parameters

cb_type
Callback type to listen for.
cb_func
Function to call.


lib:UnregisterCallback(cb_type, cb_func)

Unregisters a function from a specific callback type.

Parameters

cb_type
Callback type to unregister from.
cb_func
The function to unregister (has to be the exact same function that was passed to the Register method).


lib:UpdateFromBuilding()

Updates bodyguard data from garrison building API.
This is reliable and will always populate the bodyguard table with accurate information. Information available from garrison API is bodyguard name and level.


lib.Status

Inactive
Bodyguard is not with the player (stationed at barracks).
Active
Bodyguard is with the player.
Unknown
Status of bodyguard is unknown (this includes death).



Comments

Posts Quoted:
Reply
Clear All Quotes