First, add LibMultiAccountCollectibles (LMAC) as a dependency in your addon's manifest:
## DependsOn: LibMultiAccountCollectibles>=1
The library can be accessed via the LibMultiAccountCollectibles global variable, and it is recommended that you localize it for usage; for example:
local LMAC = LibMultiAccountCollectibles
Callbacks
LMAC.EVENT_COLLECTION_UPDATED -- Fired when collection data has been updated, either by the player having collected something or by data import
Get the list of servers and accounts for which data is available:
LMAC.GetServerAndAccountList( alwaysIncludeCurrentAccount )
If the optional alwaysIncludeCurrentAccount parameter is true, the current account will be included even if the user has added the account to the exclusion list in the settings.
The return is a list of tables, with the current server sorted to the front; each table entry has the following members:
server: the name of the serveraccounts: a list of @account names for the server, with the current account sorted to the front and the rest sorted alphabeticallyDetermine if a collectible is collected:
LMAC.IsCollectibleOwnedByAccount( server, account, collectibleId )
If server is omitted (nil), the current server is assumed.
If account is omitted (nil), the current account is assumed.
Determine when an accounts's collection state was most recently scanned:
LMAC.GetLastScanTime( server, account )
If server is omitted (nil), the current server is assumed.
If account is omitted (nil), the current account is assumed.
The return is a Unix-style timestamp.
Get the highest valid collectible ID:
LMAC.GetMaxCollectibleId( )
Callbacks:
LMAC.RegisterForCallback( name, eventCode, callback ) LMAC.UnregisterForCallback( name, eventCode )
eventCode is one of the LMAC.EVENT_* constants.
Open the LibMultiAccountCollectibles settings panel:
LMAC.OpenSettingsPanel( )