bug http://www.wowace.com/projects/ice-hud/tickets/16-visual-heal-support/ - added support for LibHealComm by request. not included with the mod, but listed as an opt dep

- added LDB support by request/from user-submitted code. this basically will only work if a mod that loads before icehud has LDB included
This commit is contained in:
Parnic
2009-03-20 01:54:50 +00:00
parent 6a361c7771
commit 955e25cfd2
4 changed files with 113 additions and 2 deletions

View File

@ -20,4 +20,5 @@ externals:
optional-dependencies: optional-dependencies:
- libdogtag-3-0 - libdogtag-3-0
- libdogtag-unit-3-0 - libdogtag-unit-3-0
- librangecheck-2-0 - librangecheck-2-0
- libhealcomm-3-0

View File

@ -613,6 +613,8 @@ function IceHUD:OnInitialize()
self:RegisterChatCommand({ "/icehud" }, IceHUD.slashMenu) self:RegisterChatCommand({ "/icehud" }, IceHUD.slashMenu)
self:SyncSettingsVersions() self:SyncSettingsVersions()
self:InitLDB()
end end
@ -650,6 +652,26 @@ function IceHUD:SyncSettingsVersions()
end end
end end
function IceHUD:InitLDB()
local LDB = LibStub and LibStub("LibDataBroker-1.1", true)
if (LDB) then
local ldbButton = LDB:NewDataObject("IceHUD", {
type = "launcher",
text = "IceHUD",
icon = "Interface\\Icons\\Spell_Frost_Frost",
OnClick = function(_, msg)
if not (UnitAffectingCombat("player")) then
waterfall:Open("IceHUD")
else
DEFAULT_CHAT_FRAME:AddMessage("|cff8888ffIceHUD|r: Combat lockdown restriction. Leave combat and try again.")
end
end,
})
end
end
-- fubar stuff -- fubar stuff
IceHUD.OnMenuRequest = IceHUD.options IceHUD.OnMenuRequest = IceHUD.options
IceHUD.hasIcon = "Interface\\Icons\\Spell_Frost_Frost" IceHUD.hasIcon = "Interface\\Icons\\Spell_Frost_Frost"

View File

@ -5,7 +5,7 @@
## Notes: Another HUD addon ## Notes: Another HUD addon
## Version: @project-version@ (Revision: @project-revision@) ## Version: @project-version@ (Revision: @project-revision@)
## SavedVariables: IceCoreDB ## SavedVariables: IceCoreDB
## OptionalDeps: Ace2, LibSharedMedia-3.0, Waterfall-1.0, Deformat, DewdropLib, LibDogTag-3.0, LibDogTag-Unit-3.0, FuBarPlugin-2.0, LibDruidMana-1.0, LibRangeCheck-2.0 ## OptionalDeps: Ace2, LibSharedMedia-3.0, Waterfall-1.0, Deformat, DewdropLib, LibDogTag-3.0, LibDogTag-Unit-3.0, FuBarPlugin-2.0, LibDruidMana-1.0, LibRangeCheck-2.0, LibHealComm-3.0
## X-Category: HUDs ## X-Category: HUDs
## X-Website: http://www.wowace.com/projects/ice-hud/ ## X-Website: http://www.wowace.com/projects/ice-hud/

View File

@ -5,12 +5,15 @@ local PlayerHealth = AceOO.Class(IceUnitBar)
PlayerHealth.prototype.resting = nil PlayerHealth.prototype.resting = nil
local configMode = false local configMode = false
local HealComm
local incomingHealAmt = 0
-- Constructor -- -- Constructor --
function PlayerHealth.prototype:init() function PlayerHealth.prototype:init()
PlayerHealth.super.prototype.init(self, "PlayerHealth", "player") PlayerHealth.super.prototype.init(self, "PlayerHealth", "player")
self:SetDefaultColor("PlayerHealth", 37, 164, 30) self:SetDefaultColor("PlayerHealth", 37, 164, 30)
self:SetDefaultColor("PlayerHealthHealAmount", 37, 164, 30)
end end
@ -24,6 +27,7 @@ function PlayerHealth.prototype:GetDefaultSettings()
settings["lowerText"] = "[FractionalHP:HPColor:Bracket]" settings["lowerText"] = "[FractionalHP:HPColor:Bracket]"
settings["allowMouseInteraction"] = false settings["allowMouseInteraction"] = false
settings["allowMouseInteractionCombat"] = false settings["allowMouseInteractionCombat"] = false
settings["healAlpha"] = 0.6
settings["lockIconAlpha"] = false settings["lockIconAlpha"] = false
settings["showStatusIcon"] = true settings["showStatusIcon"] = true
@ -70,6 +74,13 @@ function PlayerHealth.prototype:Enable(core)
self:RegisterEvent("PLAYER_FLAGS_CHANGED", "CheckPvP") self:RegisterEvent("PLAYER_FLAGS_CHANGED", "CheckPvP")
self:RegisterEvent("UNIT_FACTION", "CheckPvP") self:RegisterEvent("UNIT_FACTION", "CheckPvP")
if AceLibrary:HasInstance("LibHealComm-3.0") then
HealComm = AceLibrary("LibHealComm-3.0")
HealComm.RegisterCallback(self, "HealComm_DirectHealStart", function(event, healerName, healSize, endTime, ...) self:HealComm_DirectHealStart(event, healerName, healSize, endTime, ...) end)
HealComm.RegisterCallback(self, "HealComm_DirectHealStop", function(event, healerName, healSize, succeeded, ...) self:HealComm_DirectHealStop(event, healerName, healSize, succeeded, ...) end)
HealComm.RegisterCallback(self, "HealComm_HealModifierUpdate", function(event, unit, targetName, healModifier) self:HealComm_HealModifierUpdate(event, unit, targetName, healModifier) end)
end
if (self.moduleSettings.hideBlizz) then if (self.moduleSettings.hideBlizz) then
self:HideBlizz() self:HideBlizz()
end end
@ -78,6 +89,21 @@ function PlayerHealth.prototype:Enable(core)
--self:Update(self.unit) --self:Update(self.unit)
end end
function PlayerHealth.prototype:HealComm_DirectHealStart(event, healerName, healSize, endTime, ...)
incomingHealAmt = healSize
self:Update()
end
function PlayerHealth.prototype:HealComm_DirectHealStop(event, healerName, healSize, succeeded, ...)
incomingHealAmt = 0
self:Update()
end
function PlayerHealth.prototype:HealComm_HealModifierUpdate(event, unit, targetName, healModifier)
incomingHealAmt = incomingHealAmt * healModifier
self:Update()
end
-- OVERRIDE -- OVERRIDE
function PlayerHealth.prototype:GetOptions() function PlayerHealth.prototype:GetOptions()
@ -174,6 +200,26 @@ function PlayerHealth.prototype:GetOptions()
order = 43.5 order = 43.5
} }
opts["healAlpha"] =
{
type = "range",
name = "Incoming heal bar alpha",
desc = "What alpha value to use for the bar that displays how much health you'll have after an incoming heal (This gets multiplied by the bar's current alpha to stay in line with the bar on top of it)",
min = 0,
max = 100,
step = 5,
get = function()
return self.moduleSettings.healAlpha * 100
end,
set = function(v)
self.moduleSettings.healAlpha = v / 100.0
self:Redraw()
end,
disabled = function()
return not self.moduleSettings.enabled
end
}
opts["iconSettings"] = opts["iconSettings"] =
{ {
type = 'group', type = 'group',
@ -568,6 +614,13 @@ function PlayerHealth.prototype:GetOptions()
end end
function PlayerHealth.prototype:CreateFrame()
PlayerHealth.super.prototype.CreateFrame(self)
self:CreateHealBar()
end
function PlayerHealth.prototype:CreateBackground(redraw) function PlayerHealth.prototype:CreateBackground(redraw)
PlayerHealth.super.prototype.CreateBackground(self) PlayerHealth.super.prototype.CreateBackground(self)
@ -598,6 +651,32 @@ function PlayerHealth.prototype:CreateBackground(redraw)
self:EnableClickTargeting(self.moduleSettings.allowMouseInteraction) self:EnableClickTargeting(self.moduleSettings.allowMouseInteraction)
end end
function PlayerHealth.prototype:CreateHealBar()
if not self.healFrame then
self.healFrame = CreateFrame("Statusbar", nil, self.frame)
self.CurrScale = 0
end
self.healFrame:SetFrameStrata("LOW")
self.healFrame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
self.healFrame:SetHeight(self.settings.barHeight)
if not self.healFrame.bar then
self.healFrame.bar = self.frame:CreateTexture(nil, "BACKGROUND")
end
self.healFrame.bar:SetTexture(IceElement.TexturePath .. self.settings.barTexture)
self.healFrame.bar:SetAllPoints(self.frame)
self.healFrame:SetStatusBarTexture(self.healFrame.bar)
self.healFrame:SetStatusBarColor(self:GetColor("PlayerHealthIncomingHeal", self.alpha * self.moduleSettings.healAlpha))
self:UpdateBar(1, "undef")
self.healFrame:ClearAllPoints()
self.healFrame:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 0)
end
function PlayerHealth.prototype:EnableClickTargeting(bEnable) function PlayerHealth.prototype:EnableClickTargeting(bEnable)
if bEnable then if bEnable then
@ -782,6 +861,15 @@ function PlayerHealth.prototype:Update(unit)
self:UpdateBar(self.health/self.maxHealth, color) self:UpdateBar(self.health/self.maxHealth, color)
-- sadly, animation uses bar-local variables so we can't use the animation for 2 bar textures on the same bar element
if self.healFrame and self.healFrame.bar and incomingHealAmt then
if (self.moduleSettings.side == IceCore.Side.Left) then
self.healFrame.bar:SetTexCoord(1, 0, 1-((self.health + incomingHealAmt) / self.maxHealth), 1)
else
self.healFrame.bar:SetTexCoord(0, 1, 1-((self.health + incomingHealAmt) / self.maxHealth), 1)
end
end
if not IceHUD.IceCore:ShouldUseDogTags() then if not IceHUD.IceCore:ShouldUseDogTags() then
self:SetBottomText1(math.floor(self.healthPercentage * 100)) self:SetBottomText1(math.floor(self.healthPercentage * 100))
self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), textColor) self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), textColor)