mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- adding HungerForBlood user-submitted module. I don't have an assassination rogue and don't plan on having one, so this is _untested_ by me. the author is responsible for fixing bugs in it
- also updated a few settings in SliceAndDice to conform with the rest of the mod
This commit is contained in:
@ -53,3 +53,4 @@ modules\TargetOfTargetMana.lua
|
||||
modules\Threat.lua
|
||||
modules\RangeCheck.lua
|
||||
modules\MaelstromCount.lua
|
||||
modules\HungerForBlood.lua
|
||||
|
241
modules/HungerForBlood.lua
Normal file
241
modules/HungerForBlood.lua
Normal file
@ -0,0 +1,241 @@
|
||||
local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local HungerForBlood = AceOO.Class(IceUnitBar)
|
||||
|
||||
local hfbEndTime = 0
|
||||
local hfbDuration = 0
|
||||
local hfbBuffCount = 0
|
||||
|
||||
-- Constructor --
|
||||
function HungerForBlood.prototype:init()
|
||||
HungerForBlood.super.prototype.init(self, "HungerForBlood", "player")
|
||||
|
||||
self.moduleSettings = {}
|
||||
self.moduleSettings.desiredLerpTime = 0
|
||||
self.moduleSettings.shouldAnimate = false
|
||||
|
||||
self:SetDefaultColor("HungerForBlood", 0.75, 1, 0.2)
|
||||
self:SetDefaultColor("HungerForBloodMax", 1, 1, 1)
|
||||
end
|
||||
|
||||
-- 'Public' methods -----------------------------------------------------------
|
||||
|
||||
-- OVERRIDE
|
||||
function HungerForBlood.prototype:Enable(core)
|
||||
HungerForBlood.super.prototype.Enable(self, core)
|
||||
|
||||
if IceHUD.WowVer >= 30000 then
|
||||
self:RegisterEvent("UNIT_AURA", "UpdateHungerForBlood")
|
||||
else
|
||||
self:RegisterEvent("PLAYER_AURAS_CHANGED", "UpdateHungerForBlood")
|
||||
end
|
||||
|
||||
self:Show(false)
|
||||
|
||||
self:SetBottomText1("")
|
||||
self:SetBottomText2("")
|
||||
end
|
||||
|
||||
function HungerForBlood.prototype:TargetChanged()
|
||||
self:UpdateHungerForBlood()
|
||||
end
|
||||
|
||||
function HungerForBlood.prototype:Disable(core)
|
||||
HungerForBlood.super.prototype.Disable(self, core)
|
||||
|
||||
self:CancelScheduledEvent(self.elementName)
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function HungerForBlood.prototype:GetDefaultSettings()
|
||||
local settings = HungerForBlood.super.prototype.GetDefaultSettings(self)
|
||||
|
||||
settings["enabled"] = false
|
||||
settings["shouldAnimate"] = false
|
||||
settings["desiredLerpTime"] = nil
|
||||
settings["lowThreshold"] = 0
|
||||
settings["side"] = IceCore.Side.Right
|
||||
settings["offset"] = 8
|
||||
settings["upperText"]="HfB:"
|
||||
settings["usesDogTagStrings"] = false
|
||||
settings["allowMouseInteraction"] = true
|
||||
settings["allowMouseInteractionCombat"] = true
|
||||
settings["lockLowerFontAlpha"] = false
|
||||
settings["lowerTextString"] = ""
|
||||
settings["lowerTextVisible"] = false
|
||||
|
||||
return settings
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function HungerForBlood.prototype:GetOptions()
|
||||
local opts = HungerForBlood.super.prototype.GetOptions(self)
|
||||
|
||||
opts["textSettings"].args["upperTextString"]["desc"] = "The text to display under this bar. # will be replaced with the number of Slice and Dice seconds remaining."
|
||||
|
||||
opts["allowClickCast"] = {
|
||||
type = 'toggle',
|
||||
name = 'Allow click casting',
|
||||
desc = 'Whether or not to allow click casting of Hunger For Blood',
|
||||
get = function()
|
||||
return self.moduleSettings.allowMouseInteraction
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.allowMouseInteraction = v
|
||||
self:CreateBackground(true)
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end
|
||||
}
|
||||
--[[
|
||||
opts["allowClickCastCombat"] = {
|
||||
type = 'toggle',
|
||||
name = 'Allow click casting in combat',
|
||||
desc = 'Whether or not to allow click casting of Hunger For Blood in combat',
|
||||
get = function()
|
||||
return self.moduleSettings.allowMouseInteractionCombat
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.allowMouseInteractionCombat = v
|
||||
self:CreateBackground(true)
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled or not self.moduleSettings.allowMouseInteraction
|
||||
end
|
||||
}
|
||||
]]
|
||||
return opts
|
||||
end
|
||||
|
||||
function HungerForBlood.prototype:CreateFrame()
|
||||
HungerForBlood.super.prototype.CreateFrame(self)
|
||||
if not self.frame.button then
|
||||
self.frame.button = CreateFrame("Button", "IceHUD_HungerForBloodClickFrame", self.frame, "SecureActionButtonTemplate")
|
||||
end
|
||||
self.frame.button:ClearAllPoints()
|
||||
if self.settings.barTexture == "HiBar" then
|
||||
self.frame.button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", 0, 0)
|
||||
self.frame.button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMRIGHT", -1 * self.frame:GetWidth(), 0)
|
||||
else
|
||||
if self.moduleSettings.side == IceCore.Side.Left then
|
||||
self.frame.button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -6, 0)
|
||||
self.frame.button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMRIGHT", -1 * self.frame:GetWidth() / 3, 0)
|
||||
else
|
||||
self.frame.button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 6, 0)
|
||||
self.frame.button:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT", -1 * self.frame:GetWidth() / 1.5, 0)
|
||||
end
|
||||
end
|
||||
|
||||
self:EnableClickCasting(self.moduleSettings.allowMouseInteraction)
|
||||
end
|
||||
|
||||
function HungerForBlood.prototype:EnableClickCasting(bEnable)
|
||||
if bEnable then
|
||||
self.frame.button:EnableMouse(true)
|
||||
self.frame.button:RegisterForClicks("LeftButtonUp")
|
||||
self.frame.button:SetAttribute("type1", "spell")
|
||||
self.frame.button:SetAttribute("spell1","Hunger for Blood")
|
||||
else
|
||||
self.frame.button:EnableMouse(false)
|
||||
self.frame.button:RegisterForClicks()
|
||||
end
|
||||
end
|
||||
|
||||
-- 'Protected' methods --------------------------------------------------------
|
||||
|
||||
function HungerForBlood.prototype:GetBuffDuration(unitName, buffName)
|
||||
local i = 1
|
||||
local buff, rank, texture, count, type, duration, endTime, remaining
|
||||
if IceHUD.WowVer >= 30000 then
|
||||
buff, rank, texture, count, type, duration, endTime = UnitBuff(unitName, i)
|
||||
else
|
||||
buff, rank, texture, count, duration, remaining = UnitBuff(unitName, i)
|
||||
end
|
||||
|
||||
while buff do
|
||||
if (texture and string.match(texture, buffName)) then
|
||||
if endTime and not remaining then
|
||||
remaining = endTime - GetTime()
|
||||
end
|
||||
return duration, remaining, count
|
||||
end
|
||||
|
||||
i = i + 1;
|
||||
|
||||
if IceHUD.WowVer >= 30000 then
|
||||
buff, rank, texture, count, type, duration, endTime = UnitBuff(unitName, i)
|
||||
else
|
||||
buff, rank, texture, count, duration, remaining = UnitBuff(unitName, i)
|
||||
end
|
||||
end
|
||||
|
||||
return nil, nil, nil
|
||||
end
|
||||
|
||||
function HungerForBlood.prototype:UpdateHungerForBlood(unit, fromUpdate)
|
||||
if unit and unit ~= self.unit then
|
||||
return
|
||||
end
|
||||
|
||||
local now = GetTime()
|
||||
local remaining = nil
|
||||
|
||||
if not fromUpdate or IceHUD.WowVer < 30000 then
|
||||
hfbDuration, remaining, hfbBuffCount = self:GetBuffDuration(self.unit, "Ability_Rogue_HungerforBlood")
|
||||
|
||||
if not remaining then
|
||||
hfbEndTime = 0
|
||||
hfbBuffCount = 0
|
||||
else
|
||||
hfbEndTime = remaining + now
|
||||
end
|
||||
end
|
||||
|
||||
if hfbEndTime and hfbEndTime >= now then
|
||||
if not fromUpdate then
|
||||
self.frame:SetScript("OnUpdate", function() self:UpdateHungerForBlood(self.unit, true) end)
|
||||
end
|
||||
|
||||
self:Show(true)
|
||||
if not remaining then
|
||||
remaining = hfbEndTime - now
|
||||
end
|
||||
if (hfbBuffCount ~= nil and hfbBuffCount > 2) then
|
||||
self:UpdateBar(remaining / hfbDuration, "HungerForBloodMax")
|
||||
else
|
||||
self:UpdateBar(remaining / hfbDuration, "HungerForBlood")
|
||||
end
|
||||
|
||||
formatString = self.moduleSettings.upperText or ''
|
||||
else
|
||||
self:UpdateBar(0, "HungerForBlood")
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
-- somewhat redundant, but we also need to check potential remaining time
|
||||
if (remaining ~= nil) then
|
||||
self:SetBottomText1(self.moduleSettings.upperText .. tostring(floor(remaining or 0)) .. "s")
|
||||
if (hfbBuffCount ~= nil) then
|
||||
self:SetBottomText2("+" .. (hfbBuffCount * 3) .. "% dmg")
|
||||
else
|
||||
self:SetBottomText2("")
|
||||
end
|
||||
else
|
||||
hfbBuffCount = 0
|
||||
self:SetBottomText1(self.moduleSettings.upperText .. "0s")
|
||||
self:SetBottomText2("")
|
||||
end
|
||||
end
|
||||
|
||||
function HungerForBlood.prototype:OutCombat()
|
||||
HungerForBlood.super.prototype.OutCombat(self)
|
||||
|
||||
self:UpdateHungerForBlood()
|
||||
end
|
||||
|
||||
local _, unitClass = UnitClass("player")
|
||||
-- Load us up
|
||||
if unitClass == "ROGUE" then
|
||||
IceHUD.HungerForBlood = HungerForBlood:new()
|
||||
end
|
@ -79,6 +79,9 @@ function SliceAndDice.prototype:GetDefaultSettings()
|
||||
settings["showAsPercentOfMax"] = true
|
||||
settings["durationAlpha"] = 0.6
|
||||
settings["usesDogTagStrings"] = false
|
||||
settings["lockLowerFontAlpha"] = false
|
||||
settings["lowerTextString"] = ""
|
||||
settings["lowerTextVisible"] = false
|
||||
|
||||
return settings
|
||||
end
|
||||
@ -86,14 +89,8 @@ end
|
||||
-- OVERRIDE
|
||||
function SliceAndDice.prototype:GetOptions()
|
||||
local opts = SliceAndDice.super.prototype.GetOptions(self)
|
||||
|
||||
opts["shouldAnimate"] = nil
|
||||
opts["desiredLerpTime"] = nil
|
||||
opts["lowThreshold"] = nil
|
||||
opts["textSettings"].args["lowerTextString"] = nil
|
||||
opts["textSettings"].args["lowerTextVisible"] = nil
|
||||
|
||||
opts["textSettings"].args["upperTextString"]["desc"] = "The text to display under this bar. # will be replaced with the number of Slice and Dice seconds remaining."
|
||||
opts["textSettings"].args["lockLowerFontAlpha"] = nil
|
||||
|
||||
opts["showAsPercentOfMax"] =
|
||||
{
|
||||
|
Reference in New Issue
Block a user