LibOpenRaid Update

This commit is contained in:
Tercio Jose
2022-09-07 22:07:50 -03:00
parent 0306cda9c3
commit 842e86404b
6 changed files with 89 additions and 5 deletions
+42 -3
View File
@@ -147,7 +147,7 @@ local filterStringToCooldownType = {
["interrupt"] = CONST_COOLDOWN_TYPE_INTERRUPT,
}
function openRaidLib.CooldownManager.DoesSpellPassFilter(spellId, filters)
function openRaidLib.CooldownManager.DoesSpellPassFilters(spellId, filters)
local allCooldownsData = LIB_OPEN_RAID_COOLDOWNS_INFO
local cooldownData = allCooldownsData[spellId]
if (cooldownData) then
@@ -155,6 +155,8 @@ function openRaidLib.CooldownManager.DoesSpellPassFilter(spellId, filters)
local cooldownType = filterStringToCooldownType[filter]
if (cooldownData.type == cooldownType) then
return true
elseif (cooldownData[filter]) then --custom filter
return true
end
end
else
@@ -175,14 +177,51 @@ local getCooldownsForFilter = function(unitName, allCooldowns, unitDataFilteredC
for spellId, cooldownInfo in pairs(allCooldowns) do
local cooldownData = allCooldownsData[spellId]
if (cooldownData and cooldownData.type == filterStringToCooldownType[filter]) then
filterTable[spellId] = cooldownInfo
if (cooldownData) then
if (cooldownData.type == filterStringToCooldownType[filter]) then
filterTable[spellId] = cooldownInfo
elseif (cooldownData[filter]) then --custom filter
filterTable[spellId] = cooldownInfo
end
end
end
end
return filterTable
end
function openRaidLib.AddCooldownFilter(filterName, spells)
--integrity check
if (type(filterName) ~= "string") then
openRaidLib.DiagnosticError("Usage: openRaidLib.AddFilter(string: filterName, table: spells)", debugstack())
return false
end
if (type(spells) ~= "table") then
openRaidLib.DiagnosticError("Usage: openRaidLib.AddFilter(string: filterName, table: spells)", debugstack())
return false
end
--clear previous filter spell table of the same name
for spellId, cooldownData in pairs(LIB_OPEN_RAID_COOLDOWNS_INFO) do
cooldownData[filterName] = nil
end
local allCooldownsData = LIB_OPEN_RAID_COOLDOWNS_INFO
for spellIndex, spellId in ipairs(spells) do
local cooldownData = allCooldownsData[spellId]
cooldownData[filterName] = true
end
--tag all cache filters as dirt
local allUnitsCooldowns = openRaidLib.GetAllUnitsCooldown()
for unitName in pairs(allUnitsCooldowns) do
openRaidLib.CooldownManager.NeedRebuildFilters[unitName] = true
end
return true
end
--@allCooldowns: all cooldowns sent by an unit, {[spellId] = cooldownInfo}
--@filters: string with filters, "defensive-raid, "defensive-personal"
function openRaidLib.FilterCooldowns(unitName, allCooldowns, filters)
+29 -1
View File
@@ -50,7 +50,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not IsDragonflight()) then
end
local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 45
local CONST_LIB_VERSION = 48
LIB_OPEN_RAID_CAN_LOAD = false
--declae the library within the LibStub
@@ -77,6 +77,7 @@ LIB_OPEN_RAID_CAN_LOAD = false
local CONST_COMM_COOLDOWNUPDATE_PREFIX = "U"
local CONST_COMM_COOLDOWNFULLLIST_PREFIX = "C"
local CONST_COMM_COOLDOWNCHANGES_PREFIX = "S"
local CONST_COMM_COOLDOWNREQUEST_PREFIX = "Z"
local CONST_COMM_GEARINFO_FULL_PREFIX = "G"
local CONST_COMM_GEARINFO_DURABILITY_PREFIX = "R"
@@ -234,6 +235,7 @@ LIB_OPEN_RAID_CAN_LOAD = false
[CONST_COMM_COOLDOWNFULLLIST_PREFIX] = {}, --all cooldowns of a player
[CONST_COMM_COOLDOWNUPDATE_PREFIX] = {}, --an update of a single cooldown
[CONST_COMM_COOLDOWNCHANGES_PREFIX] = {}, --cooldowns got added or removed
[CONST_COMM_COOLDOWNREQUEST_PREFIX] = {}, --a unit requested an update on a spell
[CONST_COMM_GEARINFO_FULL_PREFIX] = {}, --an update of gear information
[CONST_COMM_GEARINFO_DURABILITY_PREFIX] = {}, --an update of the player gear durability
[CONST_COMM_PLAYER_DEAD_PREFIX] = {}, --player is dead
@@ -1951,6 +1953,32 @@ function openRaidLib.CooldownManager.OnReceiveUnitCooldowns(data, unitName)
end
openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNFULLLIST_PREFIX, openRaidLib.CooldownManager.OnReceiveUnitCooldowns)
--send a comm requesting other units in the raid to send an update on the requested spell
--any unit in the raid that has this cooldown should send a CONST_COMM_COOLDOWNUPDATE_PREFIX
--@spellId: spellId to query
function openRaidLib.CooldownManager.RequestCooldownInfo(spellId)
local dataToSend = CONST_COMM_COOLDOWNREQUEST_PREFIX .. "," .. spellId
openRaidLib.commHandler.SendCommData(dataToSend)
diagnosticComm("RequestCooldownInfo| " .. dataToSend) --debug
end
function openRaidLib.RequestCooldownInfo(spellId) --api alias
return openRaidLib.CooldownManager.RequestCooldownInfo(spellId)
end
function openRaidLib.CooldownManager.OnReceiveRequestForCooldownInfoUpdate(data, unitName)
local spellId = tonumber(data[1])
--check if this unit has this cooldown in its list of cooldowns
if (not cooldownGetSpellInfo(UnitName("player"), spellId)) then
return
end
--get the cooldown time for this spell
local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId)
openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, timeLeft, charges, startTimeOffset, duration)
end
openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNREQUEST_PREFIX, openRaidLib.CooldownManager.OnReceiveRequestForCooldownInfoUpdate)
--------------------------------------------------------------------------------------------------------------------------------
--> ~keystones
+1
View File
@@ -196,6 +196,7 @@ LIB_OPEN_RAID_GEM_IDS = {
[173127] = true, --Deadly Jewel Cluster (blue, crit)
[173128] = true, --Quick Jewel Cluster (blue, haste)
[168636] = true, --Leviathan's Eye of Strength (purple, strength)
[168638] = true, --Leviathan's Eye of Intellect (purple, intellect)
[169220] = true, --Straddling Sage Agate (blue, movement speed)
[173126] = true, --Straddling Jewel Doublet (green, movement speed)
}
+9
View File
@@ -48,6 +48,15 @@ local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, current
--by using a cooldown info
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue, cooldownDuration = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
--add spells to a custom filter
--to change the spells in the filter just call it again with different spells, spells not included in the new table are removed from the filter
--to remove the filter, call it with an empty table
@filterName: any string containing alphanumeric characters
@spells: a table containing spellIds {spellId, spellId, spellId, ...}
openRaidLib.AddCooldownFilter(filterName, spells)
--request information about a spell for all units in the raid, units which has this cooldown will report back with a "CooldownUpdate" event
openRaidLib.RequestCooldownInfo(spellId)
EQUIPMENT:
local allPlayersGear = openRaidLib.GetAllUnitsGear()
+1 -1
View File
@@ -18,7 +18,7 @@
_detalhes.BFACORE = 131 --core version on BFA launch
_detalhes.SHADOWLANDSCORE = 143 --core version on Shadowlands launch
_detalhes.dragonflight_beta_version = 23
_detalhes.dragonflight_beta_version = 24
Details = _detalhes
+7
View File
@@ -10,6 +10,13 @@ local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details")
--start funtion
function Details:StartMeUp() --I'll never stop!
local IsDragonflight = function()
return select(4, GetBuildInfo()) >= 100000
end
if (IsDragonflight()) then
Details:Msg("Details! author 'Terciob' does not have access to Dragonflight Beta, please be gentle while reporting bugs and questioning why some bugs haven't been fixed already, thank you!")
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> row single click, this determines what happen when the user click on a bar