Download
(2Kb)
Download
Updated: 06-13-16 08:07 AM
Compatibility:
Legion (7.0.3)
Updated:06-13-16 08:07 AM
Created:06-12-16 07:45 AM
Downloads:1,022
Favorites:0
MD5:

LegionArtifacts-1.1

Version: 1.1
by: kokomala [More]

LibStub library to cache artifact trait information. Updates is handled by the library and data can safely be accessed after the PLAYER_ENETERING_WORLD event occurs.

Usage:
local LA = LibStub:GetLibrary("LegionArtifacts-1.1")

Public functions:
GetArtifacts() - returns a table array listing of obtained artifact weapons (includes bags, but not banks)
GetPowerPurchased(artifactID) - returns number of powers purchased for specified ID (or equipped if not specified)
GetPowers(artifactID) - returns a table array list of artifact powers, defaults to equipped artifact if no artifactID.
GetPowerInfo(powerID,artifactID) - returns an information array about the specified powerID, defaults to equipped artifact if no artifactID.

All public functions will return false on errors or empty data.

Code:
--for all artifacts and artifact powers, print the power ranks.

for i,artifact in pairs(LA:GetArtifacts()) do
   local _,link = GetItemInfo(artifact)
   local numRank = LA:GetPowerPurchased(artifact)

   print(link, 'Powers purchased: ' .. numRank)

   for j,power in pairs(LA:GetPowers(artifact)) do
      local x = LA:GetPowerInfo(power,artifact)
      local id,_,curRank = unpack(x)

      print(GetSpellLink(id),'Rank: ' .. curRank)
   end
end
Credits: Rainrider's macro code as a starting base.

Change Log
1.1
* New public function: GetPowerPurchased(artifactID)
* Minor optimisation changes
* Minor fixes on error checks. All functions should now properly return false on error.
* Various commenting on code

1.0
* Initial release
Optional Files (0)


There have been no comments posted to this file.
Be the first to add one.



Category Jump: