Skip to content

How to Use

Rainrider edited this page Jun 26, 2017 · 7 revisions

How to include LibArtifactData-1.0 in your addon

LibArtifactData-1.0 can be either embedded or used as a stand-alone library.

Stand-alone

Make sure you add LibArtifactData-1.0 to the ##OptionalDeps field in your addon's ToC.

Embedded

Using the WoWAce repository system:

  1. Add the following under externals in your .pkgmeta file:
libs/LibStub:
  url: https://repos.wowace.com/wow/libstub/trunk
  tag: latest
libs/CallbackHandler-1.0:
  url: https://repos.wowace.com/wow/callbackhandler/trunk/CallbackHandler-1.0
  tag: latest
libs/LibArtifactData-1.0:
  url: https://github.com/Rainrider/LibArtifactData-1.0.git
  tag: latest
  1. Add the following in your addon's ToC file:
## OptionalDeps: LibArtifactData-1.0

#@no-lib-strip@
libs\LibStub\LibStub.lua
libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
libs\LibArtifactData-1.0\LibArtifactData-1.0.lua
#@end-no-lib-strip@

The #@no-lib-strip@ and @end-no-lib-strip@ tags are not required if you do not use disembedded packaging for your addon. For more details see the .pkgmeta documentation

Otherwise:

  1. get a copy of LibStub.lua, CallbackHandler.lua and LibArtifactsData-1.0.lua and place them in your addons folder.
  2. make sure LibStub.lua and CallbackHandler-1.0.lua are loaded prior to LibArtifactData-1.0.lua.

How to use:

Simple example:

local name, addon = ...
local LAD = LibStub("LibArtifactData-1.0")

function addon:ARTIFACT_ADDED(message, artifactID)
    local id, data = LAD:GetArtifactInfo(artifactID)
    print(id == artifactID, data.name)
end

LAD.RegisterCallback(addon, "ARTIFACT_ADDED")

Please read the API, Events and Data structure documentation for further details.

Clone this wiki locally