mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
Add Dragonriding Vigor module
This displays the Vigor charges for the player whenever they're on a Dragonriding mount (which is detected via explicit buff ID scanning from a hardcoded list...I'd like to make that more robust so I don't have to keep up with new mounts being added, but I'm not sure how to do it another way just yet). The Alternate Power bar is hidden if the Vigor module is enabled so that we don't end up with duplicate Vigor trackers (although right now it flashes on the screen before the mount buff is detected, so I'd also like to fix that...). I've effectively had to implement my own Vigor module from scratch by poking into the internals of the Vigor widget by its ID in order to determine the recharge amount on the final Vigor charge because there's currently no API to get this information otherwise. Hopefully this gets added; if it does, I'll happily rip out this widget inspection junk. Aside from the partial charge stuff, this is just a skinned version of an Alternate Power indicator that only shows when the user is on a dragonriding mount. ClassPowerCounter doesn't sound like a particularly appropriate base class for this, but since Vigor is implemented as Alternate Power, it worked out nicely.
This commit is contained in:
@ -101,6 +101,7 @@ modules\ArcaneCharges.lua
|
|||||||
modules\RollTheBones.lua
|
modules\RollTheBones.lua
|
||||||
modules\EssencePower.lua
|
modules\EssencePower.lua
|
||||||
modules\DruidEnergy.lua
|
modules\DruidEnergy.lua
|
||||||
|
modules\DragonridingVigor.lua
|
||||||
|
|
||||||
#@do-not-package@
|
#@do-not-package@
|
||||||
IceHUD_Options\Json.lua
|
IceHUD_Options\Json.lua
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
v1.14.12:
|
||||||
|
|
||||||
|
- Added a module for showing Dragonriding Vigor points.
|
||||||
|
|
||||||
v1.14.11:
|
v1.14.11:
|
||||||
|
|
||||||
- Packaged a new version of LibDogTag-Unit to fix the Guild roster resetting its scroll position every 20 seconds.
|
- Packaged a new version of LibDogTag-Unit to fix the Guild roster resetting its scroll position every 20 seconds.
|
||||||
|
153
modules/DragonridingVigor.lua
Normal file
153
modules/DragonridingVigor.lua
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false)
|
||||||
|
local DragonridingVigor = IceCore_CreateClass(IceClassPowerCounter)
|
||||||
|
|
||||||
|
local DragonridingBuffs = {
|
||||||
|
360954, -- Highland Drake
|
||||||
|
368896, -- Renewed Proto-Drake
|
||||||
|
368899, -- Windborn Velocidrake
|
||||||
|
368901, -- Cliffside Wylderdrake
|
||||||
|
}
|
||||||
|
|
||||||
|
local vigorWidgetSetID = 283
|
||||||
|
local vigorWidgetID = 4460
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:init()
|
||||||
|
DragonridingVigor.super.prototype.init(self, "Vigor")
|
||||||
|
|
||||||
|
self:SetDefaultColor("VigorNumeric", 150, 150, 255)
|
||||||
|
|
||||||
|
self.unit = "player"
|
||||||
|
self.numericColor = "VigorNumeric"
|
||||||
|
self.unitPower = ALTERNATE_POWER_INDEX
|
||||||
|
self.minLevel = 0
|
||||||
|
self.bTreatEmptyAsFull = false
|
||||||
|
self.runeWidth = self.runeHeight
|
||||||
|
self.shouldRegisterDisplayPower = false
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:Enable(core)
|
||||||
|
self.numRunes = UnitPowerMax(self.unit, ALTERNATE_POWER_INDEX)
|
||||||
|
self.runeCoords = { }
|
||||||
|
for i = 1, self.numRunes do
|
||||||
|
self:SetupNewRune(i)
|
||||||
|
end
|
||||||
|
|
||||||
|
DragonridingVigor.super.prototype.Enable(self, core)
|
||||||
|
|
||||||
|
self:RegisterEvent("UNIT_AURA", "CheckShouldShow")
|
||||||
|
self:RegisterEvent("UPDATE_UI_WIDGET", "UpdateVigorRecharge")
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:EnteringWorld()
|
||||||
|
DragonridingVigor.super.prototype.EnteringWorld(self)
|
||||||
|
|
||||||
|
self:CheckShouldShow("player")
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:CheckShouldShow(event, unit, info)
|
||||||
|
if unit ~= "player" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if IceHUD:HasAnyBuff("player", DragonridingBuffs) then
|
||||||
|
self:Show(true)
|
||||||
|
else
|
||||||
|
self:Show(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:UpdateRunePower(event, arg1, arg2)
|
||||||
|
self:UpdateVigorRecharge("internal")
|
||||||
|
DragonridingVigor.super.prototype.UpdateRunePower(self, event, arg1, arg2)
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:UpdateVigorRecharge(event, widget)
|
||||||
|
self.partialReady = nil
|
||||||
|
self.partialReadyPercent = nil
|
||||||
|
if event ~= "internal" and (not widget or widget.widgetSetID ~= vigorWidgetSetID) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if event ~= "internal" then
|
||||||
|
if self.moduleSettings.hideBlizz then
|
||||||
|
self:HideBlizz()
|
||||||
|
else
|
||||||
|
self:ShowBlizz()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local info = C_UIWidgetManager.GetFillUpFramesWidgetVisualizationInfo(vigorWidgetID)
|
||||||
|
if not info then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if info.numFullFrames == info.numTotalFrames then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if info.fillMax == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.partialReady = IceHUD:Clamp(info.numFullFrames + 1, 0, info.numTotalFrames)
|
||||||
|
self.partialReadyPercent = info.fillValue / info.fillMax
|
||||||
|
if event ~= "internal" then
|
||||||
|
self:UpdateRunePower()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:SetupNewRune(rune)
|
||||||
|
self.runeCoords[rune] = {0, 1, 0, 1}
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:GetDefaultSettings()
|
||||||
|
local defaults = DragonridingVigor.super.prototype.GetDefaultSettings(self)
|
||||||
|
|
||||||
|
defaults.pulseWhenFull = false
|
||||||
|
defaults.runeGap = 4
|
||||||
|
defaults.inactiveDisplayMode = "Shown"
|
||||||
|
defaults.hideBlizz = true
|
||||||
|
defaults.vpos = -25
|
||||||
|
|
||||||
|
return defaults
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:GetOptions()
|
||||||
|
local opts = DragonridingVigor.super.prototype.GetOptions(self)
|
||||||
|
|
||||||
|
opts.inactiveDisplayMode.hidden = function() return true end
|
||||||
|
|
||||||
|
return opts
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:GetRuneAtlas(rune)
|
||||||
|
return "dragonriding_vigor_fillfull"
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:GetShineAtlas(rune)
|
||||||
|
return "Mage-ArcaneCharge-SmallSpark"
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:GetFrameAtlas(rune)
|
||||||
|
return "dragonriding_vigor_frame"
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:GetBackgroundAtlas(rune)
|
||||||
|
return "dragonriding_vigor_background"
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:GetPartialRuneAtlas(rune)
|
||||||
|
return "dragonriding_vigor_fill"
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:ShowBlizz()
|
||||||
|
UIWidgetPowerBarContainerFrame:Show()
|
||||||
|
end
|
||||||
|
|
||||||
|
function DragonridingVigor.prototype:HideBlizz()
|
||||||
|
UIWidgetPowerBarContainerFrame:Hide()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Load us up
|
||||||
|
if ALTERNATE_POWER_INDEX and C_UIWidgetManager and C_UIWidgetManager.GetFillUpFramesWidgetVisualizationInfo then
|
||||||
|
IceHUD.DragonridingVigor = DragonridingVigor:new()
|
||||||
|
end
|
@ -35,6 +35,7 @@ function PlayerAlternatePower.prototype:Enable(core)
|
|||||||
self:RegisterEvent("UNIT_POWER_BAR_SHOW", "PowerBarShow")
|
self:RegisterEvent("UNIT_POWER_BAR_SHOW", "PowerBarShow")
|
||||||
self:RegisterEvent("UNIT_POWER_BAR_HIDE", "PowerBarHide")
|
self:RegisterEvent("UNIT_POWER_BAR_HIDE", "PowerBarHide")
|
||||||
|
|
||||||
|
self.wantToShow = true
|
||||||
self:Update(self.unit)
|
self:Update(self.unit)
|
||||||
|
|
||||||
if self.maxPower == 0 then
|
if self.maxPower == 0 then
|
||||||
@ -50,6 +51,7 @@ function PlayerAlternatePower.prototype:PowerBarShow(event, unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.wantToShow = true
|
||||||
self:Show(true)
|
self:Show(true)
|
||||||
self:Update(self.unit)
|
self:Update(self.unit)
|
||||||
end
|
end
|
||||||
@ -59,6 +61,7 @@ function PlayerAlternatePower.prototype:PowerBarHide(event, unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.wantToShow = false
|
||||||
self:Show(false)
|
self:Show(false)
|
||||||
self:Update(self.unit)
|
self:Update(self.unit)
|
||||||
end
|
end
|
||||||
@ -73,6 +76,12 @@ function PlayerAlternatePower.prototype:Update(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if IceHUD.DragonridingVigor and IceHUD.DragonridingVigor.bIsVisible then
|
||||||
|
self:Show(false)
|
||||||
|
elseif self.wantToShow then
|
||||||
|
self:Show(true)
|
||||||
|
end
|
||||||
|
|
||||||
self.maxPower = UnitPowerMax(self.unit, self.powerIndex)
|
self.maxPower = UnitPowerMax(self.unit, self.powerIndex)
|
||||||
self.power = UnitPower(self.unit, self.powerIndex)
|
self.power = UnitPower(self.unit, self.powerIndex)
|
||||||
if self.maxPower > 0 then
|
if self.maxPower > 0 then
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
v1.14.12:
|
||||||
|
|
||||||
|
- Added a module for showing Dragonriding Vigor points.
|
||||||
|
|
||||||
v1.14.11:
|
v1.14.11:
|
||||||
|
|
||||||
- Packaged a new version of LibDogTag-Unit to fix the Guild roster resetting its scroll position every 20 seconds.
|
- Packaged a new version of LibDogTag-Unit to fix the Guild roster resetting its scroll position every 20 seconds.
|
||||||
|
Reference in New Issue
Block a user