- added a focus threat module by request

This commit is contained in:
Parnic
2009-07-08 03:18:04 +00:00
parent 7fc7a37e56
commit 9e00802862
3 changed files with 50 additions and 25 deletions

View File

@ -51,6 +51,7 @@ modules\Runes.lua
modules\TargetOfTargetHealth.lua modules\TargetOfTargetHealth.lua
modules\TargetOfTargetMana.lua modules\TargetOfTargetMana.lua
modules\Threat.lua modules\Threat.lua
modules\FocusThreat.lua
modules\RangeCheck.lua modules\RangeCheck.lua
modules\MaelstromCount.lua modules\MaelstromCount.lua
modules\HungerForBlood.lua modules\HungerForBlood.lua

20
modules/FocusThreat.lua Normal file
View File

@ -0,0 +1,20 @@
local AceOO = AceLibrary("AceOO-2.0")
local IceFocusThreat = AceOO.Class(IceThreat)
-- constructor
function IceFocusThreat.prototype:init()
IceFocusThreat.super.prototype.init(self, "FocusThreat", "focus")
end
function IceFocusThreat.prototype:GetDefaultSettings()
local settings = IceFocusThreat.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Right
settings["offset"] = 4
return settings
end
-- Load us up
IceHUD.IceFocusThreat = IceFocusThreat:new()

View File

@ -1,5 +1,5 @@
--[[ --[[
Name: IHUD_Threat Name: IceThreat
Version: 1.2 Version: 1.2
Author: Caryna/Turalyon EU (Alliance) (updated for Threat-2.0 by 'acapela' of WoWI and merged into IceHUD by Parnic) Author: Caryna/Turalyon EU (Alliance) (updated for Threat-2.0 by 'acapela' of WoWI and merged into IceHUD by Parnic)
Description: adds a threat bar to IceHUD Description: adds a threat bar to IceHUD
@ -7,15 +7,19 @@ Description: adds a threat bar to IceHUD
local AceOO = AceLibrary("AceOO-2.0") local AceOO = AceLibrary("AceOO-2.0")
local IHUD_Threat = AceOO.Class(IceUnitBar) IceThreat = AceOO.Class(IceUnitBar)
IHUD_Threat.prototype.color = nil IceThreat.prototype.color = nil
IHUD_Threat.aggroBar = nil IceThreat.aggroBar = nil
IHUD_Threat.aggroBarMulti = nil IceThreat.aggroBarMulti = nil
-- constructor -- constructor
function IHUD_Threat.prototype:init() function IceThreat.prototype:init(name, unit)
IHUD_Threat.super.prototype.init(self, "Threat", "target") if not name or not unit then
IceThreat.super.prototype.init(self, "Threat", "target")
else
IceThreat.super.prototype.init(self, name, unit)
end
self:SetDefaultColor("ThreatLow", 102, 204, 51) self:SetDefaultColor("ThreatLow", 102, 204, 51)
self:SetDefaultColor("ThreatMedium", 0, 204, 204) self:SetDefaultColor("ThreatMedium", 0, 204, 204)
@ -28,8 +32,8 @@ function IHUD_Threat.prototype:init()
end end
-- default settings -- default settings
function IHUD_Threat.prototype:GetDefaultSettings() function IceThreat.prototype:GetDefaultSettings()
local settings = IHUD_Threat.super.prototype.GetDefaultSettings(self) local settings = IceThreat.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Left settings["side"] = IceCore.Side.Left
settings["offset"] = 4 settings["offset"] = 4
settings["enabled"] = false settings["enabled"] = false
@ -41,8 +45,8 @@ function IHUD_Threat.prototype:GetDefaultSettings()
end end
-- options stuff -- options stuff
function IHUD_Threat.prototype:GetOptions() function IceThreat.prototype:GetOptions()
local opts = IHUD_Threat.super.prototype.GetOptions(self) local opts = IceThreat.super.prototype.GetOptions(self)
opts["enabled"] = { opts["enabled"] = {
type = "toggle", type = "toggle",
@ -121,8 +125,8 @@ function IHUD_Threat.prototype:GetOptions()
end end
-- enable plugin -- enable plugin
function IHUD_Threat.prototype:Enable(core) function IceThreat.prototype:Enable(core)
IHUD_Threat.super.prototype.Enable(self, core) IceThreat.super.prototype.Enable(self, core)
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self) self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self)
@ -130,26 +134,26 @@ function IHUD_Threat.prototype:Enable(core)
end end
-- disable plugin -- disable plugin
function IHUD_Threat.prototype:Disable(core) function IceThreat.prototype:Disable(core)
IHUD_Threat.super.prototype.Disable(self, core) IceThreat.super.prototype.Disable(self, core)
self:CancelScheduledEvent(self.elementName) self:CancelScheduledEvent(self.elementName)
end end
-- OVERRIDE -- OVERRIDE
function IHUD_Threat.prototype:CreateFrame() function IceThreat.prototype:CreateFrame()
IHUD_Threat.super.prototype.CreateFrame(self) IceThreat.super.prototype.CreateFrame(self)
self:CreateAggroBar() self:CreateAggroBar()
end end
-- needs to be inverted for threat bar -- needs to be inverted for threat bar
function IHUD_Threat.prototype:UseTargetAlpha(scale) function IceThreat.prototype:UseTargetAlpha(scale)
return (scale and (scale > 0)) return (scale and (scale > 0))
end end
-- create the aggro range indicator bar -- create the aggro range indicator bar
function IHUD_Threat.prototype:CreateAggroBar() function IceThreat.prototype:CreateAggroBar()
if not (self.aggroBar) then if not (self.aggroBar) then
self.aggroBar = CreateFrame("StatusBar", nil, self.frame) self.aggroBar = CreateFrame("StatusBar", nil, self.frame)
end end
@ -184,8 +188,8 @@ function IHUD_Threat.prototype:CreateAggroBar()
end end
-- bar stuff -- bar stuff
function IHUD_Threat.prototype:Update(unit) function IceThreat.prototype:Update(unit)
IHUD_Threat.super.prototype.Update(self) IceThreat.super.prototype.Update(self)
if (unit and (unit ~= self.unit)) then if (unit and (unit ~= self.unit)) then
return return
@ -200,15 +204,15 @@ function IHUD_Threat.prototype:Update(unit)
return return
end end
if not UnitExists("target") or not UnitCanAttack("player", "target") or UnitIsDead("target") if not UnitExists(self.unit) or not UnitCanAttack("player", self.unit) or UnitIsDead(self.unit)
or UnitIsFriend("player", "target") or UnitPlayerControlled("target") then or UnitIsFriend("player", self.unit) or UnitPlayerControlled(self.unit) then
self:Show(false) self:Show(false)
return return
else else
self:Show(true) self:Show(true)
end end
local isTanking, threatState, scaledPercent, rawPercent = UnitDetailedThreatSituation("player", "target") local isTanking, threatState, scaledPercent, rawPercent = UnitDetailedThreatSituation("player", self.unit)
local scaledPercentZeroToOne local scaledPercentZeroToOne
if not self.combat and (scaledPercent == 0 or rawPercent == 0) then if not self.combat and (scaledPercent == 0 or rawPercent == 0) then
@ -288,4 +292,4 @@ end
-- Load us up -- Load us up
IceHUD.IHUD_Threat = IHUD_Threat:new() IceHUD.IceThreat = IceThreat:new()