API

Broker Garrison API

Broker Garrison uses the Global "BrokerGarrison" table to serve data to other addons.

.get (realmName, playerName)

Returns all SV variable for a given realm/player.

Arguments

realmName
string - the realm name
playerName
string - the player name

Sample

 -- Get all data from "Smb" on Server "Khaz'goroth"
 local playerData = BrokerGarrison.get("Khaz'goroth", "Smb")

.ldb (name)

Returns the custom LDB data from the addon (see data.lua for all possible variables)

Arguments

name
string - the table key from data.lua, e.g. "crescache" (current player resource cache) or "csr" (current player shipments ready)

Sample

 -- Get the resource cache content for the current player
 local resourceCacheAmount = BrokerGarrison.ldb("crescache")

.registerEvent (event, func)

Registers a function to a specific event

Arguments

event
string - currently one of BrokerGarrison.TYPE_MISSION, BrokerGarrison.TYPE_BUILDING, BrokerGarrison.TYPE_SHIPMENT
function
function - called with arguments: event, realm, player, data

Sample

 -- print() wenn a mission is complete for any player
 BrokerGarrison.registerEvent(BrokerGarrison.TYPE_MISSION, function(event, realm, character, data) (
   print(("Realm-Player: %s-%s":format(realm, character))
   print(("Mission-Name: %s":format(data.name))
 ))

Comments

Posts Quoted:
Reply
Clear All Quotes