Open Raid Library

Open Raid Library

18.1k Downloads

What this library do?

Share information using comms, these comms does not use serialization hence they has a very small size in bytes.

Due to this, the library can keep the pace on updating in real time even during combat.

A working example is found inside Details! Damage Meter Interface/AddOns/Details/frames/window_cdtracker.lua

Usage cases: when your addon need information about:

  • Gear Durability
  • Item Level
  • Missing Gems
  • Missing Enchants
  • Missing Weapon Enchant
  • Cooldowns update in real time, when a player in the raid use it, when it is ready or when it did reduced its time
  • List of cooldowns of a player in the raid and their status such as: is it ready, is in cooldown, its cooldown time
  • Player Spec
  • Player Renown
  • Player Covenant Id
  • Player Talents
  • Player PvP Talents
  • Player Conduits

  

Open Raid Library uses only compression by LibDeflate, no serialization, which decreases the amount of data required to send.

 API: https://www.curseforge.com/wow/addons/openraid/pages/api

API: 

--get the main library object

local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0")

--request to all players to send all data infomation: cooldowns, gear and player data.

openRaidLib.RequestAllData()

COOLDOWNS:
--get all cooldowns from all units
local allUnitsCooldowns = openRaidLib.GetAllUnitsCooldown()
allUnitsCooldowns = {
     ["playerName1"] = {[cooldownSpellId] = cooldownInfo, [cooldownSpellId] = cooldownInfo, ...}
     ["playerName2"] = {[cooldownSpellId] = cooldownInfo, [cooldownSpellId] = cooldownInfo, ...}
     ["playerName3"] = {[cooldownSpellId] = cooldownInfo, [cooldownSpellId] = cooldownInfo, ...}
}

--get all cooldowns from a single unit
local unitCooldows = openRaidLib.GetUnitCooldowns(unitId [,filter])
@unittId: "player", "target", "party2", "raid12", ...
@filter: "defensive-raid", "defensive-target", "defensive-personal", "ofensive", "utility"
--can pass more than one filter separating by comma, example: "defensive-raid, defensive-target"
unitCooldows = {
     [cooldownSpellId] = cooldownInfo,
     [cooldownSpellId] = cooldownInfo,
     [cooldownSpellId] = cooldownInfo,
}

--get a cooldownInfo of a single spell from any unit
local cooldownInfo = openRaidLib.GetUnitCooldownInfo(unitId, spellId)

--get cooldown timers to use with progress bar or cooldown frames, percent are normalized (0 to 1), timeLeft is seconds, minValue/maxValue/currentValue are in GetTime() time space, amount of charges

--by using a cooldown info
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
--by using unitID and spellID if necessary
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromUnitSpellID(unitId, spellId)

EQUIPMENT:
local allPlayersGear = openRaidLib.GetAllUnitsGear()
allPlayersGear = {
     ["playerName1"] = playerGear,
     ["playerName2"] = playerGear,
     ["playerName3"] = playerGear,
}

local playerGear = openRaidLib.GetUnitGear(unitId)
playerGear = {
     .durability = number
     .ilevel = number
     .noGems = {socketId}
     .noEnchants = {socketId}
     .weaponEnchant = number (oils)
}

UNIT INFORMATION
local allUnitsInfo = openRaidLib.GetAllUnitsInfo()
allUnitsInfo = {
     ["unitName1"] = unitInfo,
     ["unitName2"] = unitInfo,
     ["unitName3"] = unitInfo,
}

local unitInfo = openRaidLib.GetUnitInfo(unitId)
unitInfo = {
     .specId = number
     .specName = string
     .role = string
     .renown = number
     .covenantId = number
     .talents = {talentId, talentId, talentId, ...}
     .pvpTalents = {talentId, talentId, talentId}
     .conduits = {spellId, conduitLevel, spellId, conduitLevel, spellId, conduitLevel, ...}
     .class = string class eng name 'ROGUE'
     .classId = number
     .className = string class localized name
     .name = string name without realm
     .nameFull = string name with realm 'unitName-ServerName'
}

CALLBACKS:

Inform your addon when data has been updated. Below there's a summary of them, see the Documentation Here for usage examples.

To register a callback simple use:

function MyAddonObject.OnCooldownListUpdated(unitId, unitCooldowns, allUnitsCooldowns)

end

openRaidLib.RegisterCallback(MyAddonObject, "CooldownListUpdate", "OnCooldownListUpdated") 

  • "CooldownListUpdate": triggers when the lib received a list of cooldowns from another unit in the group.
  • "CooldownUpdate": triggered when an unit in the group uses a cooldown or the timeleft of a cooldown of an unit got an update.
  • "CooldownListWipe": when the list of cooldowns get a wipe, usually when the player leave the group.
  • "GearUpdate": when received an update from a player with all information about the gear.
  • "GearDurabilityUpdate": when the gear durability of a player in the group changes.
  • "GearListWipe": when the list of gear get a wipe, usually when the player leave the group.
  • "UnitInfoUpdate": a unit in the group has been updated.
  • "UnitInfoWipe": when the unit info got wipped, usually when the player leave the group.
  • "TalentUpdate": when a unit changed a talent.
  • "PvPTalentUpdate": when an unit changed a pvp talent.