From c425206748ee451ed80ff83302e2d76dc024f684 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sat, 11 May 2024 16:19:00 -0500 Subject: [PATCH] Hopefully fix Vigor bar not showing up for some types of dragons Specifically the Algarian Stormrider which has a different flavor of Vigor widget with customized colors. Apparently that's a whole different widget id. So now instead of checking for just the one vigor widget, we look up all widgets in the vigor set and use those to see if any vigor bar is showing. --- changelog.md | 1 + modules/DragonridingVigor.lua | 61 +++++++++++++++++++++++++++++------ this_version.md | 1 + 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/changelog.md b/changelog.md index 5754ecc..85c573b 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ v1.14.41: - Fix swapped DK runes in Cataclysm Classic - Possible fix for castbar flashing sometimes when set to "Never" +- Fix IceHUD Vigor bar not showing up for some types of dragons such as the Algarian Stormrider v1.14.40: diff --git a/modules/DragonridingVigor.lua b/modules/DragonridingVigor.lua index dc4c886..b55c50b 100644 --- a/modules/DragonridingVigor.lua +++ b/modules/DragonridingVigor.lua @@ -11,7 +11,9 @@ local DragonridingBuffs = { } local vigorWidgetSetID = 283 -local vigorWidgetID = 4460 +local vigorWidgetType = 24 +local defaultVigorWidgetID = 4460 +local vigorWidgetIDs = nil local knowsAlternateMountEnum = Enum and Enum.PowerType and Enum.PowerType.AlternateMount local unitPowerType = Enum and Enum.PowerType and Enum.PowerType.AlternateMount unitPowerType = unitPowerType or ALTERNATE_POWER_INDEX @@ -51,12 +53,24 @@ function DragonridingVigor.prototype:EnteringWorld() end function DragonridingVigor.prototype:CheckShouldShow(event, unit, info) - if unit ~= "player" then + if not vigorWidgetIDs or #vigorWidgetIDs == 0 then + self:PopulateVigorWidgetIDs() + end + + if unit ~= "player" or not vigorWidgetIDs then return end - local info = C_UIWidgetManager.GetFillUpFramesWidgetVisualizationInfo(vigorWidgetID) - if not info or info.shownState == 0 then + local shown = false + for i=1,#vigorWidgetIDs do + local info = C_UIWidgetManager.GetFillUpFramesWidgetVisualizationInfo(vigorWidgetIDs[i]) + if info and info.shownState ~= 0 then + shown = true + break + end + end + + if not shown then self:Show(false) self.suppressHideBlizz = true if self.moduleSettings.hideBlizz then @@ -85,14 +99,43 @@ function DragonridingVigor.prototype:UpdateRunePower(event, arg1, arg2) DragonridingVigor.super.prototype.UpdateRunePower(self, event, arg1, arg2) end +function DragonridingVigor.prototype:PopulateVigorWidgetIDs() + local widgets = C_UIWidgetManager.GetAllWidgetsBySetID(vigorWidgetSetID) + if not widgets then + return + end + + for i=1,#widgets do + if widgets[i].widgetType == vigorWidgetType then + if not vigorWidgetIDs then + vigorWidgetIDs = {} + end + + table.insert(vigorWidgetIDs, widgets[i].widgetID) + end + end +end + function DragonridingVigor.prototype:UpdateVigorRecharge(event, widget) + if not vigorWidgetIDs or #vigorWidgetIDs == 0 then + self:PopulateVigorWidgetIDs() + end + if not vigorWidgetIDs or #vigorWidgetIDs == 0 then + return + end + self.partialReady = nil self.partialReadyPercent = nil if event ~= "internal" and (not widget or widget.widgetSetID ~= vigorWidgetSetID) then return end - local info = C_UIWidgetManager.GetFillUpFramesWidgetVisualizationInfo(vigorWidgetID) + local widgetID = defaultVigorWidgetID + if widget then + widgetID = widget.widgetID + end + + local info = C_UIWidgetManager.GetFillUpFramesWidgetVisualizationInfo(widgetID) if not info then return end @@ -166,20 +209,20 @@ function DragonridingVigor.prototype:GetPartialRuneAtlas(rune) end function DragonridingVigor.prototype:ShowBlizz() - local info = C_UIWidgetManager.GetFillUpFramesWidgetVisualizationInfo(vigorWidgetID) + local info = C_UIWidgetManager.GetFillUpFramesWidgetVisualizationInfo(defaultVigorWidgetID) if not info or info.shownState == 0 then return end - UIWidgetPowerBarContainerFrame.widgetFrames[vigorWidgetID]:Show() + UIWidgetPowerBarContainerFrame.widgetFrames[defaultVigorWidgetID]:Show() end function DragonridingVigor.prototype:HideBlizz() - if not UIWidgetPowerBarContainerFrame.widgetFrames or not UIWidgetPowerBarContainerFrame.widgetFrames[vigorWidgetID] then + if not UIWidgetPowerBarContainerFrame.widgetFrames or not UIWidgetPowerBarContainerFrame.widgetFrames[defaultVigorWidgetID] then return end if not self.suppressHideBlizz then - UIWidgetPowerBarContainerFrame.widgetFrames[vigorWidgetID]:Hide() + UIWidgetPowerBarContainerFrame.widgetFrames[defaultVigorWidgetID]:Hide() end end diff --git a/this_version.md b/this_version.md index 50efab1..0d4f34e 100644 --- a/this_version.md +++ b/this_version.md @@ -4,6 +4,7 @@ v1.14.41: - Fix swapped DK runes in Cataclysm Classic - Possible fix for castbar flashing sometimes when set to "Never" +- Fix IceHUD Vigor bar not showing up for some types of dragons such as the Algarian Stormrider v1.14.40: