Skip to content
Rainrider edited this page Jun 27, 2016 · 12 revisions

Data structure

The data is laid out as follows:

artifacts = {
    knowledgeLevel = number,
    knowledgeMultiplier = number,
    [artifactID] = { -- itemID of the artifact
        name = string,
        icon = number,
        unspentPower = number, -- amount of artifact power that can be spent for purchasing traits
        numRanksPurchased = number, -- amount of purchased ranks
        numRanksPurchasable = number, -- amount of ranks available for purchase
        power = number, -- amount of power gained for the next rank (the bar value of the artifact xp bar)
        maxPower = number, -- amount of total power until the next rank
        powerForNextRank = number, -- amount of power needed for the next rank (=maxPower - power)
        traits = { -- a table containing the known traits
            {
                traitID = number,
                spellID = number,
                name = string,
                icon = number,
                currentRank = number,
                maxRank = number,
                bonusRanks = number, -- amount of bonus ranks from relics
                isGold = boolean, -- true for traits that have the elite border in the stock ui
                isStart = boolean, -- true for the first learnable trait
                isFinal = boolean, -- true for the last purchasable trait
            },
        },
        relics = { -- a table containing the artifact relics slots
            {
                type = string, -- use _G["RELIC_SLOT_TYPE_"..type:upper()] to get a localized string
                isLocked = boolean, -- true if the slot is locked and relics cannot be placed in it
                name = string|nil, -- name of the currently placed relic if the slot is unlocked
                icon = number|nil, -- icon of the currently placed relic if the slot is unlocked
                itemID = number|nil, -- itemID of the currently placed relic if the slot is unlocked
                link = string|nil, -- item link of the currently placed relic if the slot is unlocked
            },
        },
    },
}

API

  • :GetAllArtifactsInfo() - returns a complete copy of table from above.
    1. artifacts (table)
  • :GetArtifactInfo(artifactID) - returns the data available for the requested artifact. If artifactID is omitted, the data for the currently equipped artifact is returned.
    1. artifactID (number)
    2. artifacts[artifactID] (table)
  • :GetNumObtainedArtifacts() - returns the amount of found artifacts. Can be compared to C_ArtifactUI.GetNumObtainedArtifacts() to verify that data for all obtained artifacts is collected.
    1. numObtained (number)
  • :GetArtifactTraits(artifactID) - returns the known traits for the requested artifact. If artifactID is omitted, the traits for the currently equipped artifact are returned.
    1. artifactID (number)
    2. artifacts[artifactID].traits (table)
  • :GetArtifactRelics(artifactID) - returns the relics for the requested artifact. If artifactID is omitted, the relics for the currently equipped artifact are returned.
    1. artifactID (number)
    2. data (table)
  • :GetArtifactPower(artifactID) - returns power data for the requested artifact. If artifactID is omitted, the values for the currently equipped artifact are returned.
    1. artifactID (number)
    2. unspentPower (number)
    3. power (number)
    4. maxPower (number)
    5. powerForNextRank (number)
    6. numRanksPurchased (number)
    7. numRanksPurchasable (number)
  • :GetArtifactKnowledge() - return the artifact knowledge level and multiplier. Those are shared among all artifacts.
    1. knowledgeLevel (number)
    2. knowledgeMultiplier (number)
  • :ForceUpdate() - forces a complete scan of all obtained artifacts.

Messages

The following messages can be registered through CallbackHandler-1.0:

  • "ARTIFACT_ADDED" - fired after a new artifact has been added
    1. artifactID (number) - itemID of the added artifact
  • "ARTIFACT_EQUIPPED_CHANGED" - fired after a new weapons was equipped
    1. oldArtifactID|nil (number) - itemID of the previously equipped artifact or nil if either no artifact was equipped or LAD just got the data
    2. newArtifactID|nil (number) - itemID of the newly equipped artifact or nil if it is not an artifact
  • "ARTIFACT_KNOWLEDGE_CHANGED"
    1. knowledgeLevel (number)
    2. knowledgeMultiplier (number)
  • "ARTIFACT_TRAITS_UPDATED"
    1. artifactID (number)
    2. numRanksPurchased (number)
    3. artifacts[artifactID].traits (table)
  • "ARTIFACT_XP_UPDATED"
    1. artifactID (number)
    2. unspentPower (number)
    3. power (number)
    4. maxPower (number)
    5. powerForNextRank (number)
    6. numRanksPurchased (number)
    7. numRanksPurchasable (number)
  • "ARTIFACT_DATA_MISSING"
    1. type (string) - the type of missing data. Currently either "artifact", meaning some artifact(s) was/were not scanned at all, or "knowledge", meaning the stored knowledgeMultiplier does not correspond to the knowledgeLevel.
    2. numArtifactsMissing or knowledgeLevel (number) - The return depends on the type. For type "artifact" - how many artifacts are not yet found (open your bank!). For type "knowledge" - the new knowledge level. The multiplier can be only acquired if an artifact is viewed or the addon keeps a table of level-multiplier pairs (those relationships are likely to change through the course of the expansion though as this is intended as a catch-up mechanic).
Clone this wiki locally