Open Raid Library Update

This commit is contained in:
Tercio Jose
2023-01-30 16:21:53 -03:00
parent c474b762bb
commit 0802fc55c1
5 changed files with 130 additions and 41 deletions
+42 -5
View File
@@ -64,7 +64,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t
end
local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 94
local CONST_LIB_VERSION = 95
if (not LIB_OPEN_RAID_MAX_VERSION) then
LIB_OPEN_RAID_MAX_VERSION = CONST_LIB_VERSION
@@ -1962,10 +1962,28 @@ end
--get the cooldown time for this spell
local timeLeft, charges, startTimeOffset, duration, auraDuration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) --return 5 values
--check for shared cooldown time - warning: this block of code is duplicated at "openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNUPDATE_PREFIX"
local spellData = LIB_OPEN_RAID_COOLDOWNS_INFO[spellId]
local sharedCooldownId = spellData and spellData.shareid
if (sharedCooldownId) then
local spellsWithSharedCooldown = LIB_OPEN_RAID_COOLDOWNS_SHARED_ID[sharedCooldownId]
for thisSpellId in pairs(spellsWithSharedCooldown) do
--don't run for the spell that triggered the shared cooldown
if (thisSpellId ~= spellId) then
openRaidLib.CooldownManager.CooldownSpellUpdate(playerName, thisSpellId, timeLeft, charges, startTimeOffset, duration, auraDuration)
local cooldownInfo = cooldownGetSpellInfo(playerName, thisSpellId)
local unitCooldownTable = openRaidLib.GetUnitCooldowns(playerName)
--trigger a public callback
openRaidLib.publicCallback.TriggerCallback("CooldownUpdate", openRaidLib.GetUnitID(playerName), thisSpellId, cooldownInfo, unitCooldownTable, openRaidLib.CooldownManager.UnitData)
end
end
end
--update the cooldown
openRaidLib.CooldownManager.CooldownSpellUpdate(playerName, spellId, timeLeft, charges, startTimeOffset, duration, auraDuration) --receive 7 values
local cooldownInfo = cooldownGetSpellInfo(playerName, spellId)
--trigger a public callback
local playerCooldownTable = openRaidLib.GetUnitCooldowns(playerName)
openRaidLib.publicCallback.TriggerCallback("CooldownUpdate", "player", spellId, cooldownInfo, playerCooldownTable, openRaidLib.CooldownManager.UnitData)
@@ -2274,6 +2292,25 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNUPDATE_PREFIX, function(
return openRaidLib.DiagnosticError("CooldownManager|comm received|auraDuration is invalid")
end
--check for shared cooldown time
local spellData = LIB_OPEN_RAID_COOLDOWNS_INFO[spellId] --warning this block of code is duplicated at warning: this block of code is duplicated at "openRaidLib.CooldownManager.OnPlayerCast"
local sharedCooldownId = spellData and spellData.shareid
if (sharedCooldownId) then
local spellsWithSharedCooldown = LIB_OPEN_RAID_COOLDOWNS_SHARED_ID[sharedCooldownId]
for thisSpellId in pairs(spellsWithSharedCooldown) do
--don't run for the spell that triggered the shared cooldown
if (thisSpellId ~= spellId) then
openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, thisSpellId, cooldownTimer, charges, startTime, duration, auraDuration)
local cooldownInfo = cooldownGetSpellInfo(unitName, thisSpellId)
local unitCooldownTable = openRaidLib.GetUnitCooldowns(unitName)
--trigger a public callback
openRaidLib.publicCallback.TriggerCallback("CooldownUpdate", openRaidLib.GetUnitID(unitName), thisSpellId, cooldownInfo, unitCooldownTable, openRaidLib.CooldownManager.UnitData)
end
end
end
--update
--unitName, spellId, cooldownTimer, charges, startTime, duration, auraDuration
openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, cooldownTimer, charges, startTime, duration, auraDuration)
@@ -2630,8 +2667,8 @@ C_Timer.After(0.1, function()
if (unitName and not hasLib) then
local unitInGroup = UnitInParty(unit) or UnitInRaid(unit)
if (unitInGroup) then
local cooldownInfo = allCooldownsFromLib[spellId]
if (cooldownInfo) then -- and not openRaidLib.GetUnitCooldown(unitName)
local spellData = allCooldownsFromLib[spellId]
if (spellData) then -- and not openRaidLib.GetUnitCooldown(unitName)
--check for cast_success spam from channel spells
local unitCastCooldown = recentCastedSpells[unitName]
if (not unitCastCooldown) then
@@ -2643,7 +2680,7 @@ C_Timer.After(0.1, function()
unitCastCooldown[spellId] = GetTime()
--trigger a cooldown usage
local duration = cooldownInfo.duration
local duration = spellData.duration
--time left, charges, startTimeOffset, duration
openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, duration, 0, 0, duration, 0)
local cooldownInfo = cooldownGetSpellInfo(unitName, spellId)