Temp

Summary

A small library which keeps track of group members and keeps an up-to-date cache of their specialization, talents and glyphs.

It's similar to the old LibGroupTalents/LibTalentQuery and the current LibRaidInspect libraries, but unlike the former it's actually working on 5.0.5, and unlike the latter it works properly in Battlegrounds and additionally has the feature where it communicates spec/talent/glyph updates to other LibGroupInSpecT users.
This is an important point as of the writing of this there is no way to detect when another player re-specs/talents/glyphs.
This library started out as a part of RaidChecklist as replacement for LibGroupTalents, but has since been split off into its own project.

To make use of this library you'll need to also have the usual LibStub and LibCallbackHandler libs.
For a real usage example, take a look at the RaidChecklist project!

Events

These events can be registered for using the regular CallbackHandler ways.

Reference

eventargs
"GroupInSpecT_Update"guid, unit, info
"GroupInSpecT_Remove"guid

Example

local LGIST = LibStub:GetLibrary("LibGroupInSpecT-1.0")
LGIST.RegisterCallback(addonObject, "GroupInSpecT_Remove", "UnitRemoved")
function addonObject:UnitRemoved(event, guid)
  -- unit with guid removed
end

API

Functions for external use:

lib:Rescan ()
Force a fresh inspection of all group members.
lib:QueuedInspections ()
Returns an array of GUIDs of outstanding inspects.
lib:StaleInspections ()
Returns an array of GUIDs for which the data has become stale and is awaiting an update (no action required, the refresh happens internally). Currently this is only triggered by level-up events.
lib:GetCachedInfo (guid)
Returns the cached info for the given GUID, if available, nil otherwise. Information is cached for current group members only.
lib:GuidToUnit (guid)
Returns the unit id for the given GUID, provided said GUID represents a current group member, else nil.

info table structure

The fields of the table passed as an argument for "GroupInSpecT_Update" callback
or returned by one of the API functions (eg. :GetCachedInfo(guid) )

beta2 (release candidate)

  .guid
  .name
  .realm
  .race
  .race_localized
  .class
  .class_localized
  .class_id
  .gender -- 2 = male, 3 = female
  .global_spec_id
  .spec_index
  .spec_name_localized
  .spec_description
  .spec_icon
  .spec_background
  .spec_role
  .talents = {
    [<spell_id>] = {
      .idx -- 1 to MAX_NUM_TALENT
      .tier
      .column
      .name_localized
      .icon -- was .texture in earlier alpha releases
      .spell_id
    }
    ...
  }
  .glyphs = {
    [<spell_id>] = {
      .idx -- 1 to NUM_GLYPH_SLOTS
      .glyph_id
      .glyph_type
      .name_localized
      .icon
      .spell_id
    }
     ...
  },
  .lku -- last known unit id

beta1 (deprecated)

Supplied before first release to help any authors that used an earlier version upgrade their references.

   .guid
   .name
   .realm
   .race
   .race_localized
   .class
   .class_localized
   .class_id
   .gender -- 2 = male, 3 = female
   .global_spec_id
   .talents = {
     [<tier>] = 0-3 (0 = none chosen)
     ...
   }
   .glyphs = {
     [glyphid] = GLYPHTYPE_MAJOR/GLYPTYPE_MINOR,
     ...
   },
   .lku -- last known unit id

Usage

Typical usage example.
.pkgmeta

Libs/LibGroupInSpecT-1.0: svn://svn.wowace.com/wow/libgroupinspect/mainline/trunk

.toc

## OptionalDeps: LibGroupInSpecT-1.0
Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
Libs\LibGroupInSpecT-1.0\LibGroupInSpecT-1.0.lua

alternatively embeds.xml (referenced in .toc)

<ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
  <script file="Libs\LibStub\LibStub.lua"/>
  <include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
  <include file="Libs\LibGroupInSpecT-1.0\lib.xml"/>
</ui>

.lua

local LGIST=LibStub:GetLibrary("LibGroupInSpecT-1.0")
LGIST.RegisterCallback(addonObject, "GroupInSpecT_Update", "UpdateHandler")
LGIST.Registercallback(addonObject, "GroupInSpecT_Remove", "RemoveHandler")
function addonObject:UpdateHandler(event, guid, unit, info)
  if info.class == "DEATHKNIGHT" and info.spec_role == "TANK" then
    print(UnitName(unit).." is now "..info.spec_name_localized)
  end
end
function addonObject:RemoveHandler(event, guid)
  -- guid info *poof*
end
local info = LGIST:GetCachedInfo(guid)
local hasMassReflect = info and next(info.talents) and info.talents.114028 -- mass reflect talent spell_id
local hasSSGlyph = info and next(info.glyphs) and info.glyphs.56231 -- soulstone glyph spell_id