Update on LibOpenRaid to version 24
This commit is contained in:
+43
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
local dversion = 294
|
||||
local dversion = 300
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary (major, minor)
|
||||
|
||||
@@ -759,6 +759,48 @@ function DF.SortOrder3R (t1, t2)
|
||||
return t1[3] < t2[3]
|
||||
end
|
||||
|
||||
--return a list of spells from the player spellbook
|
||||
function DF:GetSpellBookSpells()
|
||||
local spellNamesInSpellBook = {}
|
||||
|
||||
for i = 1, GetNumSpellTabs() do
|
||||
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(i)
|
||||
|
||||
if (offspecId == 0) then
|
||||
offset = offset + 1
|
||||
local tabEnd = offset + numSpells
|
||||
|
||||
for j = offset, tabEnd - 1 do
|
||||
local spellType, spellId = GetSpellBookItemInfo(j, "player")
|
||||
|
||||
if (spellId) then
|
||||
if (spellType ~= "FLYOUT") then
|
||||
local spellName = GetSpellInfo(spellId)
|
||||
if (spellName) then
|
||||
spellNamesInSpellBook[spellName] = true
|
||||
end
|
||||
else
|
||||
local _, _, numSlots, isKnown = GetFlyoutInfo(spellId)
|
||||
if (isKnown and numSlots > 0) then
|
||||
for k = 1, numSlots do
|
||||
local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo(spellId, k)
|
||||
if (isKnown) then
|
||||
local spellName = GetSpellInfo(spellID)
|
||||
spellNamesInSpellBook[spellName] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return spellNamesInSpellBook
|
||||
end
|
||||
|
||||
------------------------------
|
||||
--flash animation
|
||||
local onFinish = function (self)
|
||||
if (self.showWhenDone) then
|
||||
self.frame:SetAlpha (1)
|
||||
|
||||
+89
-22
@@ -5218,6 +5218,7 @@ DF.IconRowFunctions = {
|
||||
|
||||
if (not iconFrame) then
|
||||
local newIconFrame = CreateFrame ("frame", "$parentIcon" .. self.NextIcon, self, "BackdropTemplate")
|
||||
newIconFrame.parentIconRow = self
|
||||
|
||||
newIconFrame.Texture = newIconFrame:CreateTexture (nil, "artwork")
|
||||
PixelUtil.SetPoint (newIconFrame.Texture, "topleft", newIconFrame, "topleft", 1, -1)
|
||||
@@ -5263,7 +5264,7 @@ DF.IconRowFunctions = {
|
||||
|
||||
local anchor = self.options.anchor
|
||||
local anchorTo = self.NextIcon == 1 and self or self.IconPool [self.NextIcon - 1]
|
||||
local xPadding = self.NextIcon == 1 and self.options.left_padding or self.options.icon_padding
|
||||
local xPadding = self.NextIcon == 1 and self.options.left_padding or self.options.icon_padding or 1
|
||||
local growDirection = self.options.grow_direction
|
||||
|
||||
if (growDirection == 1) then --grow to right
|
||||
@@ -5288,16 +5289,16 @@ DF.IconRowFunctions = {
|
||||
return iconFrame
|
||||
end,
|
||||
|
||||
SetIcon = function (self, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge)
|
||||
SetIcon = function (self, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff)
|
||||
|
||||
local spellName, _, spellIcon
|
||||
local actualSpellName, _, spellIcon = GetSpellInfo (spellId)
|
||||
|
||||
if (not forceTexture) then
|
||||
spellName, _, spellIcon = GetSpellInfo (spellId)
|
||||
else
|
||||
if forceTexture then
|
||||
spellIcon = forceTexture
|
||||
end
|
||||
|
||||
spellName = spellName or actualSpellName or "unknown_aura"
|
||||
|
||||
if (spellIcon) then
|
||||
local iconFrame = self:GetIcon()
|
||||
iconFrame.Texture:SetTexture (spellIcon)
|
||||
@@ -5315,30 +5316,36 @@ DF.IconRowFunctions = {
|
||||
if (self.options.show_text) then
|
||||
iconFrame.CountdownText:Show()
|
||||
|
||||
local formattedTime = floor (startTime + duration - GetTime())
|
||||
local now = GetTime()
|
||||
|
||||
if (formattedTime >= 3600) then
|
||||
formattedTime = floor (formattedTime / 3600) .. "h"
|
||||
|
||||
elseif (formattedTime >= 60) then
|
||||
formattedTime = floor (formattedTime / 60) .. "m"
|
||||
|
||||
else
|
||||
formattedTime = floor (formattedTime)
|
||||
end
|
||||
iconFrame.timeRemaining = startTime + duration - now
|
||||
iconFrame.expirationTime = startTime + duration
|
||||
|
||||
local formattedTime = (iconFrame.timeRemaining > 0) and iconFrame.parentIconRow.FormatCooldownTime(iconFrame.timeRemaining) or ""
|
||||
iconFrame.CountdownText:SetText (formattedTime)
|
||||
|
||||
iconFrame.CountdownText:SetPoint (self.options.text_anchor or "center", iconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0)
|
||||
DF:SetFontSize (iconFrame.CountdownText, self.options.text_size)
|
||||
DF:SetFontFace (iconFrame.CountdownText, self.options.text_font)
|
||||
DF:SetFontOutline (iconFrame.CountdownText, self.options.text_outline)
|
||||
iconFrame.CountdownText:SetText (formattedTime)
|
||||
|
||||
if self.options.on_tick_cooldown_update then
|
||||
iconFrame.lastUpdateCooldown = now
|
||||
iconFrame:SetScript("OnUpdate", self.OnIconTick)
|
||||
else
|
||||
iconFrame:SetScript("OnUpdate", nil)
|
||||
end
|
||||
|
||||
else
|
||||
iconFrame:SetScript("OnUpdate", nil)
|
||||
iconFrame.CountdownText:Hide()
|
||||
end
|
||||
|
||||
iconFrame.Cooldown:SetHideCountdownNumbers (self.options.surpress_blizzard_cd_timer)
|
||||
else
|
||||
iconFrame.timeRemaining = nil
|
||||
iconFrame.expirationTime = nil
|
||||
iconFrame:SetScript("OnUpdate", nil)
|
||||
iconFrame.CountdownText:Hide()
|
||||
end
|
||||
|
||||
@@ -5381,6 +5388,12 @@ DF.IconRowFunctions = {
|
||||
iconFrame.debuffType = debuffType
|
||||
iconFrame.caster = caster
|
||||
iconFrame.canStealOrPurge = canStealOrPurge
|
||||
iconFrame.isBuff = isBuff
|
||||
iconFrame.spellName = spellName
|
||||
|
||||
--add the spell into the cache
|
||||
self.AuraCache [spellId] = true
|
||||
self.AuraCache [spellName] = true
|
||||
|
||||
--> show the frame
|
||||
self:Show()
|
||||
@@ -5389,12 +5402,64 @@ DF.IconRowFunctions = {
|
||||
end
|
||||
end,
|
||||
|
||||
ClearIcons = function (self)
|
||||
for i = 1, self.NextIcon -1 do
|
||||
self.IconPool [i]:Hide()
|
||||
OnIconTick = function (self, deltaTime)
|
||||
local now = GetTime()
|
||||
if (self.lastUpdateCooldown + 0.05) <= now then
|
||||
self.timeRemaining = self.expirationTime - now
|
||||
if self.timeRemaining > 0 then
|
||||
self.CountdownText:SetText (self.parentIconRow.FormatCooldownTime(self.timeRemaining))
|
||||
else
|
||||
self.CountdownText:SetText ("")
|
||||
end
|
||||
self.lastUpdateCooldown = now
|
||||
end
|
||||
self.NextIcon = 1
|
||||
self:Hide()
|
||||
end,
|
||||
|
||||
FormatCooldownTime = function (formattedTime)
|
||||
if (formattedTime >= 3600) then
|
||||
formattedTime = floor (formattedTime / 3600) .. "h"
|
||||
|
||||
elseif (formattedTime >= 60) then
|
||||
formattedTime = floor (formattedTime / 60) .. "m"
|
||||
|
||||
else
|
||||
formattedTime = floor (formattedTime)
|
||||
end
|
||||
return formattedTime
|
||||
end,
|
||||
|
||||
ClearIcons = function (self, resetBuffs, resetDebuffs)
|
||||
resetBuffs = resetBuffs ~= false
|
||||
resetDebuffs = resetDebuffs ~= false
|
||||
table.wipe (self.AuraCache)
|
||||
|
||||
local iconPool = self.IconPool
|
||||
local countStillShown = 0
|
||||
for i = 1, self.NextIcon -1 do
|
||||
if iconPool[i].isBuff == nil then
|
||||
iconPool[i]:Hide()
|
||||
iconPool[i]:ClearAllPoints()
|
||||
elseif resetBuffs and iconPool[i].isBuff then
|
||||
iconPool[i]:Hide()
|
||||
iconPool[i]:ClearAllPoints()
|
||||
elseif resetDebuffs and not iconPool[i].isBuff then
|
||||
iconPool[i]:Hide()
|
||||
iconPool[i]:ClearAllPoints()
|
||||
else
|
||||
self.AuraCache [iconPool[i].spellId] = true
|
||||
self.AuraCache [iconPool[i].spellName] = true
|
||||
countStillShown = countStillShown + 1
|
||||
end
|
||||
end
|
||||
|
||||
if countStillShown == 0 then
|
||||
self.NextIcon = 1
|
||||
self:Hide()
|
||||
else
|
||||
self.NextIcon = countStillShown + 1
|
||||
table.sort (iconPool, function(i1, i2) return i1:IsShown() and not i2:IsShown() end)
|
||||
end
|
||||
|
||||
end,
|
||||
|
||||
GetIconGrowDirection = function (self)
|
||||
@@ -5476,12 +5541,14 @@ local default_icon_row_options = {
|
||||
grow_direction = 1, --1 = to right 2 = to left
|
||||
surpress_blizzard_cd_timer = false,
|
||||
surpress_tulla_omni_cc = false,
|
||||
on_tick_cooldown_update = true,
|
||||
}
|
||||
|
||||
function DF:CreateIconRow (parent, name, options)
|
||||
local f = CreateFrame("frame", name, parent, "BackdropTemplate")
|
||||
f.IconPool = {}
|
||||
f.NextIcon = 1
|
||||
f.AuraCache = {}
|
||||
|
||||
DF:Mixin (f, DF.IconRowFunctions)
|
||||
DF:Mixin (f, DF.OptionsFunctions)
|
||||
|
||||
Reference in New Issue
Block a user