mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-15 22:30:13 -05:00
Version 0.6
- Improved TargetInfo and ToT module - RoundBar texture looks better than ever - PlayerHealth and TargetHealth modules have an option to turn off Blizzard default frames - Fixed MH3 rounding bug
This commit is contained in:
@ -195,10 +195,12 @@ end
|
||||
function IceBarElement.prototype:Redraw()
|
||||
IceBarElement.super.prototype.Redraw(self)
|
||||
|
||||
if (not self.moduleSettings.enabled) then
|
||||
return
|
||||
end
|
||||
|
||||
self.alpha = self.settings.alphaooc
|
||||
|
||||
self:CreateFrame()
|
||||
|
||||
self.frame:SetAlpha(self.alpha)
|
||||
end
|
||||
|
||||
|
@ -187,6 +187,7 @@ function IceElement.prototype:GetColor(color, alpha)
|
||||
return self.colors[color].r, self.colors[color].g, self.colors[color].b, alpha
|
||||
end
|
||||
|
||||
|
||||
function IceElement.prototype:GetHexColor(color, alpha)
|
||||
local r, g, b, a = self:GetColor(color)
|
||||
return string.format("%02x%02x%02x%02x", a * 255, r * 255, g * 255, b * 255)
|
||||
@ -213,6 +214,11 @@ function IceElement.prototype:GetClassColor(class)
|
||||
end
|
||||
|
||||
|
||||
function IceElement.prototype:ConvertToHex(color)
|
||||
return string.format("ff%02x%02x%02x", color.r*255, color.g*255, color.b*255)
|
||||
end
|
||||
|
||||
|
||||
function IceElement.prototype:FontFactory(weight, size, frame, font)
|
||||
local weightString = ""
|
||||
if (weight) then
|
||||
|
@ -3,9 +3,9 @@
|
||||
## Name: IceHUD
|
||||
## Title: IceHUD |cff7fff7f -Ace2-|r
|
||||
## Notes: Another HUD mod
|
||||
## Version: 0.5 ($Revision$)
|
||||
## Version: 0.6 ($Revision$)
|
||||
## SavedVariables: IceCoreDB
|
||||
## OptionalDeps: FuBar_ToFu, DruidBar, SoleManax, MobHealth
|
||||
## OptionalDeps: Ace2, DewdropLib, FuBar_ToFu, DruidBar, SoleManax, MobHealth
|
||||
## X-Category: UnitFrame
|
||||
## X-Date: $Date$
|
||||
## X-eMail: iceroth@iceroth.net
|
||||
|
@ -52,7 +52,9 @@ end
|
||||
function IceUnitBar.prototype:Redraw()
|
||||
IceUnitBar.super.prototype.Redraw(self)
|
||||
|
||||
if (self.moduleSettings.enabled) then
|
||||
self:Update(self.unit)
|
||||
end
|
||||
end
|
||||
|
||||
-- 'Protected' methods --------------------------------------------------------
|
||||
@ -69,6 +71,8 @@ function IceUnitBar.prototype:Update()
|
||||
self.mana = UnitMana(self.unit)
|
||||
self.maxMana = UnitManaMax(self.unit)
|
||||
self.manaPercentage = math.floor( (self.mana/self.maxMana)*100 )
|
||||
|
||||
_, self.unitClass = UnitClass(self.unit)
|
||||
end
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ end
|
||||
-- OVERRIDE
|
||||
function ComboPoints.prototype:GetDefaultSettings()
|
||||
local defaults = ComboPoints.super.prototype.GetDefaultSettings(self)
|
||||
defaults["vpos"] = -30
|
||||
defaults["vpos"] = 0
|
||||
defaults["comboFontSize"] = 20
|
||||
defaults["comboMode"] = "Graphical"
|
||||
return defaults
|
||||
|
@ -337,6 +337,10 @@ end
|
||||
function MirrorBarHandler.prototype:Redraw()
|
||||
MirrorBarHandler.super.prototype.Redraw(self)
|
||||
|
||||
if (not self.moduleSettings.enabled) then
|
||||
return
|
||||
end
|
||||
|
||||
for i = 1, table.getn(self.bars) do
|
||||
self:SetSettings(self.bars[i])
|
||||
self.bars[i]:UpdatePosition(self.moduleSettings.side, self.moduleSettings.offset + (i-1))
|
||||
|
@ -14,6 +14,7 @@ function PlayerHealth.prototype:GetDefaultSettings()
|
||||
local settings = PlayerHealth.super.prototype.GetDefaultSettings(self)
|
||||
settings["side"] = IceCore.Side.Left
|
||||
settings["offset"] = 1
|
||||
settings["hideBlizz"] = true
|
||||
return settings
|
||||
end
|
||||
|
||||
@ -24,11 +25,60 @@ function PlayerHealth.prototype:Enable(core)
|
||||
self:RegisterEvent("UNIT_HEALTH", "Update")
|
||||
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
|
||||
|
||||
if (self.moduleSettings.hideBlizz) then
|
||||
self:HideBlizz()
|
||||
end
|
||||
|
||||
self:Update(self.unit)
|
||||
end
|
||||
|
||||
|
||||
-- OVERRIDE
|
||||
function PlayerHealth.prototype:GetOptions()
|
||||
local opts = PlayerHealth.super.prototype.GetOptions(self)
|
||||
|
||||
opts["classColor"] = {
|
||||
type = "toggle",
|
||||
name = "Class color bar",
|
||||
desc = "Use class color as the bar color instead of default color",
|
||||
get = function()
|
||||
return self.moduleSettings.classColor
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.classColor = value
|
||||
self:Update(self.unit)
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 40
|
||||
}
|
||||
|
||||
opts["hideBlizz"] = {
|
||||
type = "toggle",
|
||||
name = "Hide Blizzard Frame",
|
||||
desc = "Hides Blizzard Player frame and disables all events related to it",
|
||||
get = function()
|
||||
return self.moduleSettings.hideBlizz
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.hideBlizz = value
|
||||
if (value) then
|
||||
self:HideBlizz()
|
||||
else
|
||||
self:ShowBlizz()
|
||||
end
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 41
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
|
||||
function PlayerHealth.prototype:Update(unit)
|
||||
PlayerHealth.super.prototype.Update(self)
|
||||
if (unit and (unit ~= self.unit)) then
|
||||
@ -36,12 +86,16 @@ function PlayerHealth.prototype:Update(unit)
|
||||
end
|
||||
|
||||
local color = "playerHealth"
|
||||
|
||||
if (self.moduleSettings.classColor) then
|
||||
color = self.unitClass
|
||||
end
|
||||
|
||||
if not (self.alive) then
|
||||
color = "dead"
|
||||
end
|
||||
|
||||
|
||||
|
||||
self:UpdateBar(self.health/self.maxHealth, color)
|
||||
self:SetBottomText1(self.healthPercentage)
|
||||
self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), color)
|
||||
@ -49,5 +103,35 @@ end
|
||||
|
||||
|
||||
|
||||
|
||||
function PlayerHealth.prototype:ShowBlizz()
|
||||
PlayerFrame:Show()
|
||||
|
||||
PlayerFrame:RegisterEvent("UNIT_LEVEL");
|
||||
PlayerFrame:RegisterEvent("UNIT_COMBAT");
|
||||
PlayerFrame:RegisterEvent("UNIT_FACTION");
|
||||
PlayerFrame:RegisterEvent("UNIT_MAXMANA");
|
||||
PlayerFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
|
||||
PlayerFrame:RegisterEvent("PLAYER_ENTER_COMBAT");
|
||||
PlayerFrame:RegisterEvent("PLAYER_LEAVE_COMBAT");
|
||||
PlayerFrame:RegisterEvent("PLAYER_REGEN_DISABLED");
|
||||
PlayerFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
|
||||
PlayerFrame:RegisterEvent("PLAYER_UPDATE_RESTING");
|
||||
PlayerFrame:RegisterEvent("PARTY_MEMBERS_CHANGED");
|
||||
PlayerFrame:RegisterEvent("PARTY_LEADER_CHANGED");
|
||||
PlayerFrame:RegisterEvent("PARTY_LOOT_METHOD_CHANGED");
|
||||
PlayerFrame:RegisterEvent("RAID_ROSTER_UPDATE");
|
||||
PlayerFrame:RegisterEvent("PLAYTIME_CHANGED");
|
||||
end
|
||||
|
||||
|
||||
function PlayerHealth.prototype:HideBlizz()
|
||||
PlayerFrame:Hide()
|
||||
|
||||
PlayerFrame:UnregisterAllEvents()
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Load us up
|
||||
PlayerHealth:new()
|
||||
|
@ -95,7 +95,9 @@ end
|
||||
function PlayerMana.prototype:Redraw()
|
||||
PlayerMana.super.prototype.Redraw(self)
|
||||
|
||||
if (self.moduleSettings.enabled) then
|
||||
self:CreateTickerFrame()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -20,6 +20,8 @@ function TargetHealth.prototype:GetDefaultSettings()
|
||||
settings["side"] = IceCore.Side.Left
|
||||
settings["offset"] = 2
|
||||
settings["mobhealth"] = false
|
||||
settings["classColor"] = false
|
||||
settings["hideBlizz"] = true
|
||||
return settings
|
||||
end
|
||||
|
||||
@ -40,12 +42,47 @@ function TargetHealth.prototype:GetOptions()
|
||||
self:Update(self.unit)
|
||||
end,
|
||||
disabled = function()
|
||||
return (MobHealth3 == nil)
|
||||
return (not self.moduleSettings.enabled) and (MobHealth3 == nil)
|
||||
end,
|
||||
order = 40
|
||||
}
|
||||
|
||||
opts["classColor"] = {
|
||||
type = "toggle",
|
||||
name = "Class color bar",
|
||||
desc = "Use class color as the bar color instead of reaction color",
|
||||
get = function()
|
||||
return self.moduleSettings.classColor
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.classColor = value
|
||||
self:Update(self.unit)
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 40
|
||||
order = 41
|
||||
}
|
||||
|
||||
opts["hideBlizz"] = {
|
||||
type = "toggle",
|
||||
name = "Hide Blizzard Frame",
|
||||
desc = "Hides Blizzard Target frame and disables all events related to it",
|
||||
get = function()
|
||||
return self.moduleSettings.hideBlizz
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.hideBlizz = value
|
||||
if (value) then
|
||||
self:HideBlizz()
|
||||
else
|
||||
self:ShowBlizz()
|
||||
end
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 42
|
||||
}
|
||||
|
||||
return opts
|
||||
@ -57,6 +94,7 @@ function TargetHealth.prototype:Enable(core)
|
||||
|
||||
self:RegisterEvent("UNIT_HEALTH", "Update")
|
||||
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
|
||||
self:RegisterEvent("UNIT_FLAGS", "Update")
|
||||
|
||||
self:Update(self.unit)
|
||||
end
|
||||
@ -90,6 +128,10 @@ function TargetHealth.prototype:Update(unit)
|
||||
self.color = "targetHealthHostile"
|
||||
end
|
||||
|
||||
if (self.moduleSettings.classColor) then
|
||||
self.color = self.unitClass
|
||||
end
|
||||
|
||||
if (self.tapped) then
|
||||
self.color = "tapped"
|
||||
end
|
||||
@ -119,7 +161,7 @@ end
|
||||
|
||||
function TargetHealth.prototype:Round(health)
|
||||
if (health > 1000000) then
|
||||
return self:MathRound(health/100000, 1) .. "M"
|
||||
return self:MathRound(health/1000000, 1) .. "M"
|
||||
end
|
||||
if (health > 1000) then
|
||||
return self:MathRound(health/1000, 1) .. "k"
|
||||
@ -134,5 +176,31 @@ function TargetHealth.prototype:MathRound(num, idp)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function TargetHealth.prototype:ShowBlizz()
|
||||
TargetFrame:Show()
|
||||
|
||||
TargetFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
TargetFrame:RegisterEvent("UNIT_HEALTH")
|
||||
TargetFrame:RegisterEvent("UNIT_LEVEL")
|
||||
TargetFrame:RegisterEvent("UNIT_FACTION")
|
||||
TargetFrame:RegisterEvent("UNIT_CLASSIFICATION_CHANGED")
|
||||
TargetFrame:RegisterEvent("UNIT_AURA")
|
||||
TargetFrame:RegisterEvent("PLAYER_FLAGS_CHANGED")
|
||||
TargetFrame:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
||||
TargetFrame:RegisterEvent("RAID_TARGET_UPDATE")
|
||||
end
|
||||
|
||||
|
||||
function TargetHealth.prototype:HideBlizz()
|
||||
TargetFrame:Hide()
|
||||
|
||||
TargetFrame:UnregisterAllEvents()
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Load us up
|
||||
TargetHealth:new()
|
||||
|
@ -2,16 +2,34 @@ local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local TargetInfo = AceOO.Class(IceElement)
|
||||
|
||||
local target = "target"
|
||||
local internal = "internal"
|
||||
|
||||
TargetInfo.Width = 260
|
||||
TargetInfo.prototype.buffSize = nil
|
||||
TargetInfo.prototype.width = nil
|
||||
|
||||
TargetInfo.prototype.name = nil
|
||||
TargetInfo.prototype.guild = nil
|
||||
TargetInfo.prototype.realm = nil
|
||||
TargetInfo.prototype.rank = nil
|
||||
TargetInfo.prototype.classLocale = nil
|
||||
TargetInfo.prototype.classEnglish = nil
|
||||
TargetInfo.prototype.leader = nil
|
||||
|
||||
TargetInfo.prototype.combat = nil
|
||||
TargetInfo.prototype.pvp = nil
|
||||
TargetInfo.prototype.level = nil
|
||||
TargetInfo.prototype.classification = nil
|
||||
TargetInfo.prototype.reaction = nil
|
||||
TargetInfo.prototype.tapped = nil
|
||||
|
||||
TargetInfo.prototype.isPlayer = nil
|
||||
|
||||
|
||||
-- Constructor --
|
||||
function TargetInfo.prototype:init()
|
||||
TargetInfo.super.prototype.init(self, "TargetInfo")
|
||||
|
||||
self.buffSize = math.floor((TargetInfo.Width - 15) / 16)
|
||||
|
||||
self.scalingEnabled = true
|
||||
end
|
||||
|
||||
@ -19,6 +37,22 @@ end
|
||||
|
||||
-- 'Public' methods -----------------------------------------------------------
|
||||
|
||||
-- OVERRIDE
|
||||
function TargetInfo.prototype:Enable(core)
|
||||
TargetInfo.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
|
||||
self:RegisterEvent("UNIT_AURA", "AuraChanged")
|
||||
|
||||
self:RegisterEvent("UNIT_FACTION", "TargetFaction")
|
||||
self:RegisterEvent("UNIT_LEVEL", "TargetLevel")
|
||||
|
||||
self:RegisterEvent("UNIT_FLAGS", "TargetFlags")
|
||||
self:RegisterEvent("UNIT_DYNAMIC_FLAGS", "TargetFlags")
|
||||
|
||||
self:RegisterEvent("RAID_TARGET_UPDATE", "UpdateRaidTargetIcon")
|
||||
end
|
||||
|
||||
|
||||
-- OVERRIDE
|
||||
function TargetInfo.prototype:GetOptions()
|
||||
@ -64,6 +98,47 @@ function TargetInfo.prototype:GetOptions()
|
||||
order = 32
|
||||
}
|
||||
|
||||
opts["zoom"] = {
|
||||
type = 'range',
|
||||
name = 'Buff zoom',
|
||||
desc = 'Buff/debuff icon zoom',
|
||||
get = function()
|
||||
return self.moduleSettings.zoom
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.zoom = v
|
||||
self:Redraw()
|
||||
end,
|
||||
min = 0,
|
||||
max = 0.2,
|
||||
step = 0.01,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
isPercent = true,
|
||||
order = 33
|
||||
}
|
||||
|
||||
opts["buffSize"] = {
|
||||
type = 'range',
|
||||
name = 'Buff size',
|
||||
desc = 'Buff/debuff icon size',
|
||||
get = function()
|
||||
return self.moduleSettings.buffSize
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.buffSize = v
|
||||
self:Redraw()
|
||||
end,
|
||||
min = 8,
|
||||
max = 20,
|
||||
step = 1,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 34
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
@ -73,6 +148,8 @@ function TargetInfo.prototype:GetDefaultSettings()
|
||||
local defaults = TargetInfo.super.prototype.GetDefaultSettings(self)
|
||||
defaults["fontSize"] = 13
|
||||
defaults["vpos"] = -50
|
||||
defaults["zoom"] = 0.2
|
||||
defaults["buffSize"] = 13
|
||||
return defaults
|
||||
end
|
||||
|
||||
@ -81,23 +158,10 @@ end
|
||||
function TargetInfo.prototype:Redraw()
|
||||
TargetInfo.super.prototype.Redraw(self)
|
||||
|
||||
self:CreateFrame()
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:Enable(core)
|
||||
TargetInfo.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
|
||||
self:RegisterEvent("UNIT_AURA", "AuraChanged")
|
||||
|
||||
self:RegisterEvent("UNIT_FACTION", "InfoTextChanged")
|
||||
self:RegisterEvent("UNIT_LEVEL", "InfoTextChanged")
|
||||
self:RegisterEvent("UNIT_CLASSIFICATION_CHANGED", "InfoTextChanged")
|
||||
self:RegisterEvent("PLAYER_FLAGS_CHANGED", "InfoTextChanged")
|
||||
self:RegisterEvent("UNIT_DYNAMIC_FLAGS", "InfoTextChanged")
|
||||
|
||||
self:RegisterEvent("RAID_TARGET_UPDATE", "RaidIconChanged")
|
||||
if (self.moduleSettings.enabled) then
|
||||
self:CreateFrame(true)
|
||||
self:TargetChanged()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -107,8 +171,11 @@ end
|
||||
-- OVERRIDE
|
||||
function TargetInfo.prototype:CreateFrame()
|
||||
TargetInfo.super.prototype.CreateFrame(self)
|
||||
|
||||
self.width = self.settings.gap + 50
|
||||
|
||||
self.frame:SetFrameStrata("BACKGROUND")
|
||||
self.frame:SetWidth(TargetInfo.Width)
|
||||
self.frame:SetWidth(self.width)
|
||||
self.frame:SetHeight(42)
|
||||
self.frame:ClearAllPoints()
|
||||
self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos)
|
||||
@ -118,171 +185,266 @@ function TargetInfo.prototype:CreateFrame()
|
||||
|
||||
self:CreateTextFrame()
|
||||
self:CreateInfoTextFrame()
|
||||
self:CreateGuildTextFrame()
|
||||
|
||||
self:CreateBuffFrame()
|
||||
self:CreateDebuffFrame()
|
||||
|
||||
self:CreateRaidIconFrame()
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:CreateTextFrame()
|
||||
if (not self.frame.target) then
|
||||
self.frame.target = CreateFrame("Button", nil, self.frame)
|
||||
end
|
||||
|
||||
self.frame.target.unit = target -- for blizz default tooltip handling
|
||||
self.frame.target:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
self.frame.target:SetScript("OnClick", function() self:TargetOnClick(arg1) end)
|
||||
self.frame.target:SetScript("OnEnter", function() UnitFrame_OnEnter() end)
|
||||
self.frame.target:SetScript("OnLeave", function() UnitFrame_OnLeave() end)
|
||||
|
||||
|
||||
self.frame.target:SetWidth(self.width)
|
||||
self.frame.target:SetHeight(14)
|
||||
self.frame.target:SetPoint("TOP", self.frame, "TOP", 0, -2)
|
||||
|
||||
self.frame.targetName = self:FontFactory("Bold", self.moduleSettings.fontSize+1, nil, self.frame.targetName)
|
||||
self.frame.targetName:SetJustifyH("CENTER")
|
||||
self.frame.targetName:SetJustifyV("TOP")
|
||||
self.frame.targetName:SetAllPoints(self.frame.target)
|
||||
|
||||
self.frame.targetName:SetWidth(TargetInfo.Width - 120)
|
||||
self.frame.targetName:SetHeight(14)
|
||||
self.frame.targetName:SetJustifyH("LEFT")
|
||||
self.frame.targetName:SetJustifyV("BOTTOM")
|
||||
|
||||
self.frame.targetName:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 2, -2)
|
||||
self.frame.targetName:Show()
|
||||
self.frame.target:Show()
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:CreateInfoTextFrame()
|
||||
self.frame.targetInfo = self:FontFactory(nil, self.moduleSettings.fontSize, nil, self.frame.targetInfo)
|
||||
|
||||
self.frame.targetInfo:SetWidth(TargetInfo.Width)
|
||||
self.frame.targetInfo:SetWidth(self.width)
|
||||
self.frame.targetInfo:SetHeight(14)
|
||||
self.frame.targetInfo:SetJustifyH("LEFT")
|
||||
self.frame.targetInfo:SetJustifyH("CENTER")
|
||||
self.frame.targetInfo:SetJustifyV("TOP")
|
||||
|
||||
self.frame.targetInfo:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 2, -16)
|
||||
self.frame.targetInfo:SetPoint("TOP", self.frame, "TOP", 0, -16)
|
||||
self.frame.targetInfo:Show()
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:CreateGuildTextFrame()
|
||||
self.frame.targetGuild = self:FontFactory(nil, self.moduleSettings.fontSize, nil, self.frame.targetGuild)
|
||||
|
||||
self.frame.targetGuild:SetHeight(14)
|
||||
self.frame.targetGuild:SetJustifyH("CENTER")
|
||||
self.frame.targetGuild:SetJustifyV("TOP")
|
||||
|
||||
self.frame.targetGuild:SetAlpha(0.6)
|
||||
|
||||
self.frame.targetGuild:SetPoint("TOP", self.frame, "TOP", 0, -30)
|
||||
self.frame.targetGuild:Show()
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:CreateRaidIconFrame()
|
||||
if (self.frame.raidIcon) then
|
||||
return
|
||||
if (not self.frame.raidIcon) then
|
||||
self.frame.raidIcon = CreateFrame("Frame", nil, self.frame)
|
||||
end
|
||||
|
||||
self.frame.raidIcon = self.frame:CreateTexture(nil, "BACKGROUND")
|
||||
if (not self.frame.raidIcon.icon) then
|
||||
self.frame.raidIcon.icon = self.frame.raidIcon:CreateTexture(nil, "BACKGROUND")
|
||||
self.frame.raidIcon.icon:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons")
|
||||
end
|
||||
|
||||
self.frame.raidIcon:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons")
|
||||
self.frame.raidIcon:SetPoint("TOPRIGHT", self.frame, "TOPLEFT", -5, -5)
|
||||
self.frame.raidIcon:SetPoint("BOTTOM", self.frame, "TOP", 0, 1)
|
||||
self.frame.raidIcon:SetWidth(16)
|
||||
self.frame.raidIcon:SetHeight(16)
|
||||
SetRaidTargetIconTexture(self.frame.raidIcon, 0)
|
||||
self.frame:Hide()
|
||||
|
||||
self.frame.raidIcon.icon:SetAllPoints(self.frame.raidIcon)
|
||||
SetRaidTargetIconTexture(self.frame.raidIcon.icon, 0)
|
||||
self.frame.raidIcon:Hide()
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:CreateBuffFrame()
|
||||
if (self.frame.buffFrame) then
|
||||
return
|
||||
if (not self.frame.buffFrame) then
|
||||
self.frame.buffFrame = CreateFrame("Frame", nil, self.frame)
|
||||
end
|
||||
|
||||
self.frame.buffFrame = CreateFrame("Frame", nil, self.frame)
|
||||
|
||||
self.frame.buffFrame:SetFrameStrata("BACKGROUND")
|
||||
self.frame.buffFrame:SetWidth(TargetInfo.Width)
|
||||
self.frame.buffFrame:SetHeight(20)
|
||||
self.frame.buffFrame:SetWidth(1)
|
||||
self.frame.buffFrame:SetHeight(1)
|
||||
|
||||
self.frame.buffFrame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 2, -32)
|
||||
self.frame.buffFrame:ClearAllPoints()
|
||||
self.frame.buffFrame:SetPoint("TOPRIGHT", self.frame, "TOPLEFT", -5, 0)
|
||||
self.frame.buffFrame:Show()
|
||||
|
||||
self.frame.buffFrame.buffs = self:CreateIconFrames(self.frame.buffFrame)
|
||||
if (not self.frame.buffFrame.buffs) then
|
||||
self.frame.buffFrame.buffs = {}
|
||||
end
|
||||
self.frame.buffFrame.buffs = self:CreateIconFrames(self.frame.buffFrame, -1, self.frame.buffFrame.buffs, "buff")
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:CreateDebuffFrame()
|
||||
if (self.frame.debuffFrame) then
|
||||
return
|
||||
if (not self.frame.debuffFrame) then
|
||||
self.frame.debuffFrame = CreateFrame("Frame", nil, self.frame)
|
||||
end
|
||||
|
||||
self.frame.debuffFrame = CreateFrame("Frame", nil, self.frame)
|
||||
|
||||
self.frame.debuffFrame:SetFrameStrata("BACKGROUND")
|
||||
self.frame.debuffFrame:SetWidth(TargetInfo.Width)
|
||||
self.frame.debuffFrame:SetHeight(20)
|
||||
self.frame.debuffFrame:SetWidth(1)
|
||||
self.frame.debuffFrame:SetHeight(1)
|
||||
|
||||
self.frame.debuffFrame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 2, -34 - self.buffSize)
|
||||
self.frame.debuffFrame:ClearAllPoints()
|
||||
self.frame.debuffFrame:SetPoint("TOPLEFT", self.frame, "TOPRIGHT", 5, 0)
|
||||
self.frame.debuffFrame:Show()
|
||||
|
||||
self.frame.debuffFrame.buffs = self:CreateIconFrames(self.frame.debuffFrame)
|
||||
if (not self.frame.debuffFrame.buffs) then
|
||||
self.frame.debuffFrame.buffs = {}
|
||||
end
|
||||
self.frame.debuffFrame.buffs = self:CreateIconFrames(self.frame.debuffFrame, 1, self.frame.debuffFrame.buffs, "debuff")
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TargetInfo.prototype:CreateIconFrames(parent)
|
||||
local buffs = {}
|
||||
|
||||
function TargetInfo.prototype:CreateIconFrames(parent, direction, buffs, type)
|
||||
for i = 1, 16 do
|
||||
if (not buffs[i]) then
|
||||
buffs[i] = CreateFrame("Frame", nil, parent)
|
||||
buffs[i]:SetFrameStrata("BACKGROUND")
|
||||
buffs[i]:SetWidth(self.buffSize)
|
||||
buffs[i]:SetHeight(self.buffSize)
|
||||
buffs[i]:SetPoint("LEFT", (i-1) * self.buffSize + (i-1), 0)
|
||||
buffs[i]:Show()
|
||||
buffs[i].icon = CreateFrame("Frame", nil, buffs[i])
|
||||
end
|
||||
|
||||
buffs[i]:SetFrameStrata("BACKGROUND")
|
||||
buffs[i]:SetWidth(self.moduleSettings.buffSize)
|
||||
buffs[i]:SetHeight(self.moduleSettings.buffSize)
|
||||
|
||||
buffs[i].icon:SetFrameStrata("BACKGROUND")
|
||||
buffs[i].icon:SetWidth(self.moduleSettings.buffSize-2)
|
||||
buffs[i].icon:SetHeight(self.moduleSettings.buffSize-2)
|
||||
|
||||
local pos = (i > 8) and i-8 or i
|
||||
local x = (((pos-1) * self.moduleSettings.buffSize) + (pos-0)) * direction
|
||||
local y = (i > 8) and -self.moduleSettings.buffSize-0 or 0
|
||||
|
||||
buffs[i]:ClearAllPoints()
|
||||
buffs[i]:SetPoint("TOP", x, y)
|
||||
|
||||
buffs[i].icon:ClearAllPoints()
|
||||
buffs[i].icon:SetPoint("CENTER", 0, 0)
|
||||
|
||||
buffs[i]:Show()
|
||||
buffs[i].icon:Show()
|
||||
|
||||
if (not buffs[i].texture) then
|
||||
buffs[i].texture = buffs[i]:CreateTexture()
|
||||
buffs[i].texture:SetTexture(nil)
|
||||
buffs[i].texture:ClearAllPoints()
|
||||
buffs[i].texture:SetAllPoints(buffs[i])
|
||||
|
||||
buffs[i].stack = self:FontFactory("Bold", 15, buffs[i])
|
||||
buffs[i].stack:SetPoint("BOTTOMRIGHT" , buffs[i], "BOTTOMRIGHT", 0, -1)
|
||||
buffs[i].icon.texture = buffs[i].icon:CreateTexture()
|
||||
buffs[i].icon.texture:SetTexture(nil)
|
||||
|
||||
buffs[i].icon.texture:ClearAllPoints()
|
||||
buffs[i].icon.texture:SetAllPoints(buffs[i].icon)
|
||||
|
||||
buffs[i].icon.stack = self:FontFactory("Bold", 11, buffs[i].icon)
|
||||
|
||||
buffs[i].icon.stack:ClearAllPoints()
|
||||
buffs[i].icon.stack:SetPoint("BOTTOMRIGHT" , buffs[i].icon, "BOTTOMRIGHT", 1, -1)
|
||||
end
|
||||
|
||||
buffs[i]:EnableMouse(true)
|
||||
buffs[i].id = i
|
||||
buffs[i]:SetScript("OnEnter", function() self:BuffOnEnter(type) end)
|
||||
buffs[i]:SetScript("OnLeave", function() GameTooltip:Hide() end)
|
||||
end
|
||||
|
||||
return buffs
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function TargetInfo.prototype:UpdateBuffs()
|
||||
local zoom = self.moduleSettings.zoom
|
||||
|
||||
for i = 1, 16 do
|
||||
local buffTexture, buffApplications = UnitBuff("target", i)
|
||||
|
||||
self.frame.buffFrame.buffs[i].texture:SetTexture(buffTexture)
|
||||
--buffTexture = buffTexture or "Interface\\Icons\\Spell_Nature_Regeneration"
|
||||
|
||||
self.frame.buffFrame.buffs[i].icon.texture:SetTexture(buffTexture)
|
||||
self.frame.buffFrame.buffs[i].icon.texture:SetTexCoord(zoom, 1-zoom, zoom, 1-zoom)
|
||||
|
||||
local alpha = buffTexture and 0.3 or 0
|
||||
self.frame.buffFrame.buffs[i].texture:SetTexture(0, 0, 0, alpha)
|
||||
|
||||
self.frame.buffFrame.buffs[i].texture:SetVertexColor(color.r, color.g, color.b)
|
||||
|
||||
|
||||
--buffApplications = 2
|
||||
|
||||
if (buffApplications and (buffApplications > 1)) then
|
||||
self.frame.buffFrame.buffs[i].stack:SetText(buffApplications)
|
||||
self.frame.buffFrame.buffs[i].icon.stack:SetText(buffApplications)
|
||||
else
|
||||
self.frame.buffFrame.buffs[i].stack:SetText(nil)
|
||||
self.frame.buffFrame.buffs[i].icon.stack:SetText(nil)
|
||||
end
|
||||
|
||||
if (buffTexture) then
|
||||
self.frame.buffFrame.buffs[i]:Show()
|
||||
else
|
||||
self.frame.buffFrame.buffs[i]:Hide()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
for i = 1, 16 do
|
||||
local buffTexture, buffApplications = UnitDebuff("target", i)
|
||||
local buffTexture, buffApplications, debuffDispelType = UnitDebuff("target", i)
|
||||
|
||||
self.frame.debuffFrame.buffs[i].texture:SetTexture(buffTexture)
|
||||
--buffTexture = buffTexture or "Interface\\Icons\\Ability_Creature_Disease_04"
|
||||
|
||||
local color = debuffDispelType and DebuffTypeColor[debuffDispelType] or DebuffTypeColor["none"]
|
||||
local alpha = buffTexture and 1 or 0
|
||||
self.frame.debuffFrame.buffs[i].texture:SetTexture(1, 1, 1, alpha)
|
||||
|
||||
self.frame.debuffFrame.buffs[i].texture:SetVertexColor(color.r, color.g, color.b)
|
||||
|
||||
|
||||
self.frame.debuffFrame.buffs[i].icon.texture:SetTexture(buffTexture)
|
||||
self.frame.debuffFrame.buffs[i].icon.texture:SetTexCoord(zoom, 1-zoom, zoom, 1-zoom)
|
||||
|
||||
if (buffApplications and (buffApplications > 1)) then
|
||||
self.frame.debuffFrame.buffs[i].stack:SetText(buffApplications)
|
||||
self.frame.debuffFrame.buffs[i].icon.stack:SetText(buffApplications)
|
||||
else
|
||||
self.frame.debuffFrame.buffs[i].stack:SetText(nil)
|
||||
self.frame.debuffFrame.buffs[i].icon.stack:SetText(nil)
|
||||
end
|
||||
|
||||
|
||||
if (buffTexture) then
|
||||
self.frame.debuffFrame.buffs[i]:Show()
|
||||
else
|
||||
self.frame.debuffFrame.buffs[i]:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TargetInfo.prototype:InfoTextChanged(unit)
|
||||
if (unit == "target") then
|
||||
self.frame.targetInfo:SetText(self:GetInfoString())
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:AuraChanged(unit)
|
||||
if (unit == "target") then
|
||||
if (unit == target) then
|
||||
self:UpdateBuffs()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:RaidIconChanged(unit)
|
||||
if (unit == "target") then
|
||||
self:UpdateRaidTargetIcon()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:UpdateRaidTargetIcon()
|
||||
if not (UnitExists("target")) then
|
||||
if not (UnitExists(target)) then
|
||||
self.frame.raidIcon:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
local index = GetRaidTargetIndex("target");
|
||||
local index = GetRaidTargetIndex(target);
|
||||
|
||||
if (index and (index > 0)) then
|
||||
SetRaidTargetIconTexture(self.frame.raidIcon, index)
|
||||
SetRaidTargetIconTexture(self.frame.raidIcon.icon, index)
|
||||
self.frame.raidIcon:Show()
|
||||
else
|
||||
self.frame.raidIcon:Hide()
|
||||
@ -291,85 +453,169 @@ end
|
||||
|
||||
|
||||
function TargetInfo.prototype:TargetChanged()
|
||||
local name = UnitName("target")
|
||||
local _, unitClass = UnitClass("target")
|
||||
if (not UnitExists(target)) then
|
||||
self.frame.targetName:SetText()
|
||||
self.frame.targetInfo:SetText()
|
||||
self.frame.targetGuild:SetText()
|
||||
|
||||
self.frame.targetName:SetTextColor(self:GetColor(unitClass, 1))
|
||||
self.frame.targetName:SetText(name)
|
||||
self.frame.targetInfo:SetText(self:GetInfoString())
|
||||
self:UpdateBuffs()
|
||||
self:UpdateRaidTargetIcon()
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:GetInfoString()
|
||||
local u = "target"
|
||||
|
||||
if not (UnitExists(u)) then
|
||||
return ""
|
||||
return
|
||||
end
|
||||
|
||||
local class, unitClass = UnitClass(u)
|
||||
local creatureType = UnitCreatureType(u)
|
||||
local classification = UnitClassification(u)
|
||||
local level = UnitLevel(u)
|
||||
self.name, self.realm = UnitName(target)
|
||||
self.classLocale, self.classEnglish = UnitClass(target)
|
||||
self.isPlayer = UnitIsPlayer(target)
|
||||
|
||||
local isPlayer = UnitIsPlayer(u)
|
||||
local guildName, guildRankName, guildRankIndex = GetGuildInfo(target);
|
||||
self.guild = guildName and "<" .. guildName .. ">" or ""
|
||||
|
||||
local classColor = self:GetHexColor(unitClass)
|
||||
|
||||
local sLevel = "[??] "
|
||||
if (level > 0) then
|
||||
sLevel = "[L" .. level
|
||||
if (UnitIsPlusMob(u)) then
|
||||
sLevel = sLevel .. "+"
|
||||
end
|
||||
sLevel = sLevel .. "] "
|
||||
end
|
||||
|
||||
local sClass = ""
|
||||
if (class and isPlayer) then
|
||||
sClass = "|c" .. classColor .. class .. "|r "
|
||||
elseif (creatureType) then
|
||||
sClass = creatureType .. " "
|
||||
end
|
||||
|
||||
local sPVP = ""
|
||||
if (isPlayer) then
|
||||
if (UnitIsPVP(u)) then
|
||||
local color = "ff10ff10" -- friendly
|
||||
if (UnitFactionGroup("target") ~= UnitFactionGroup("player")) then
|
||||
color = "ffff1010"
|
||||
end
|
||||
sPVP = "|c" .. color .. "[PvP]|r "
|
||||
if (self.classLocale and self.isPlayer) then
|
||||
self.classLocale = "|c" .. self:GetHexColor(self.classEnglish) .. self.classLocale .. "|r"
|
||||
else
|
||||
sPVP = "|cff1010ff[PvE]|r "
|
||||
end
|
||||
self.classLocale = UnitCreatureType(target)
|
||||
end
|
||||
|
||||
local sClassification = ""
|
||||
if (classification == "rare" or classification == "rareelite") then
|
||||
sClassification = "[Rare] "
|
||||
end
|
||||
if (classification == "worldboss") then
|
||||
sClassification = "[World Boss] "
|
||||
end
|
||||
|
||||
local sLeader = ""
|
||||
if (UnitIsPartyLeader(u)) then
|
||||
sLeader = "[Leader] "
|
||||
end
|
||||
self.leader = UnitIsPartyLeader(target) and " Leader" or ""
|
||||
|
||||
local sCombat = ""
|
||||
--if (UnitAffectingCombat(u)) then
|
||||
-- sCombat = " +Combat+"
|
||||
--end
|
||||
|
||||
return string.format("%s%s%s%s%s%s",
|
||||
sLevel, sClass, sPVP, sClassification, sLeader, sCombat)
|
||||
-- pass "internal" as a paramater so event handler code doesn't execute
|
||||
-- self:Update() unnecassarily
|
||||
self:TargetLevel(internal)
|
||||
self:TargetReaction(internal)
|
||||
self:TargetFaction(internal)
|
||||
self:TargetFlags(internal)
|
||||
|
||||
self:UpdateBuffs()
|
||||
self:UpdateRaidTargetIcon()
|
||||
|
||||
self:Update(target)
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:TargetLevel(unit)
|
||||
if (unit == target or unit == internal) then
|
||||
self.level = UnitLevel(target)
|
||||
|
||||
local color = GetDifficultyColor((self.level > 0) and self.level or 100)
|
||||
|
||||
if (self.level > 0) then
|
||||
if (UnitIsPlusMob(target)) then
|
||||
self.level = self.level .. "+"
|
||||
end
|
||||
else
|
||||
self.level = "??"
|
||||
end
|
||||
|
||||
self.level = "|c" .. self:ConvertToHex(color) .. self.level .. "|r"
|
||||
|
||||
self:Update(unit)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:TargetReaction(unit)
|
||||
if (unit == target or unit == internal) then
|
||||
self.reaction = UnitReaction(target, "player")
|
||||
|
||||
-- if we don't get reaction, unit is out of range - has to be friendly
|
||||
-- to be targettable (party/raid)
|
||||
if (not self.reaction) then
|
||||
self.reaction = 5
|
||||
end
|
||||
self:Update(unit)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- PVP status
|
||||
function TargetInfo.prototype:TargetFaction(unit)
|
||||
if (unit == target or unit == internal) then
|
||||
if (self.isPlayer) then
|
||||
if (UnitIsPVP(target)) then
|
||||
local color = "ff10ff10" -- friendly
|
||||
if (UnitFactionGroup(target) ~= UnitFactionGroup("player")) then
|
||||
color = "ffff1010" -- hostile
|
||||
end
|
||||
self.pvp = " |c" .. color .. "PvP|r"
|
||||
else
|
||||
self.pvp = " |cff1010ffPvE|r"
|
||||
end
|
||||
else
|
||||
self.pvp = ""
|
||||
end
|
||||
|
||||
self:Update(unit)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:TargetFlags(unit)
|
||||
if (unit == target or unit == internal) then
|
||||
self.tapped = UnitIsTapped(target) and (not UnitIsTappedByPlayer(target))
|
||||
self.combat = UnitAffectingCombat(target) and " |cffee4030Combat|r" or ""
|
||||
self:Update(unit)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:Update(unit)
|
||||
if (unit ~= target) then
|
||||
return
|
||||
end
|
||||
|
||||
local reactionColor = self:ConvertToHex(UnitReactionColor[self.reaction])
|
||||
if (self.tapped) then
|
||||
reactionColor = self:GetHexColor("tapped")
|
||||
end
|
||||
|
||||
local line1 = string.format("|c%s%s|r", reactionColor, self.name or '')
|
||||
self.frame.targetName:SetText(line1)
|
||||
|
||||
local line2 = string.format("%s %s%s%s%s",
|
||||
self.level or '', self.classLocale or '', self.pvp or '', self.leader or '', self.combat or '')
|
||||
self.frame.targetInfo:SetText(line2)
|
||||
|
||||
local realm = self.realm and " " .. self.realm or ""
|
||||
local line3 = string.format("%s%s", self.guild or '', realm)
|
||||
self.frame.targetGuild:SetText(line3)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TargetInfo.prototype:TargetOnClick(button)
|
||||
-- copy&paste from blizz code, it better work ;)
|
||||
if (SpellIsTargeting() and button == "RightButton") then
|
||||
SpellStopTargeting()
|
||||
return
|
||||
end
|
||||
|
||||
if (button == "LeftButton") then
|
||||
if (SpellIsTargeting()) then
|
||||
SpellTargetUnit(target)
|
||||
elseif (CursorHasItem()) then
|
||||
DropItemOnUnit(target)
|
||||
end
|
||||
else
|
||||
ToggleDropDownMenu(1, nil, TargetFrameDropDown, "cursor")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function TargetInfo.prototype:BuffOnEnter(type)
|
||||
if (not this:IsVisible()) then
|
||||
return
|
||||
end
|
||||
|
||||
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT")
|
||||
if (type == "buff") then
|
||||
GameTooltip:SetUnitBuff(target, this.id)
|
||||
else
|
||||
GameTooltip:SetUnitDebuff(target, this.id)
|
||||
end
|
||||
end
|
||||
|
||||
-- Load us up
|
||||
TargetInfo:new()
|
||||
|
@ -32,6 +32,7 @@ function TargetMana.prototype:Enable(core)
|
||||
self:RegisterEvent("UNIT_ENERGY", "Update")
|
||||
self:RegisterEvent("UNIT_MAXENERGY", "Update")
|
||||
self:RegisterEvent("UNIT_AURA", "Update")
|
||||
self:RegisterEvent("UNIT_FLAGS", "Update")
|
||||
|
||||
self:Update("target")
|
||||
end
|
||||
|
@ -4,6 +4,8 @@ local TargetOfTarget = AceOO.Class(IceElement, "Metrognome-2.0")
|
||||
|
||||
TargetOfTarget.prototype.stackedDebuffs = nil
|
||||
TargetOfTarget.prototype.buffSize = nil
|
||||
TargetOfTarget.prototype.height = nil
|
||||
TargetOfTarget.prototype.unit = nil
|
||||
|
||||
|
||||
-- Constructor --
|
||||
@ -14,8 +16,10 @@ function TargetOfTarget.prototype:init()
|
||||
self:SetColor("totFriendly", 0.2, 1, 0.2)
|
||||
self:SetColor("totNeutral", 0.9, 0.9, 0)
|
||||
|
||||
self.buffSize = 15
|
||||
self.buffSize = 12
|
||||
self.height = 12
|
||||
self.stackedDebuffs = {}
|
||||
self.unit = "targettarget"
|
||||
|
||||
self.scalingEnabled = true
|
||||
end
|
||||
@ -100,7 +104,9 @@ end
|
||||
function TargetOfTarget.prototype:Redraw()
|
||||
TargetOfTarget.super.prototype.Redraw(self)
|
||||
|
||||
if (self.moduleSettings.enabled) then
|
||||
self:CreateFrame()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -126,43 +132,80 @@ end
|
||||
|
||||
-- OVERRIDE
|
||||
function TargetOfTarget.prototype:CreateFrame()
|
||||
TargetOfTarget.super.prototype.CreateFrame(self)
|
||||
if not (self.frame) then
|
||||
self.frame = CreateFrame("Button", "IceHUD_"..self.name, self.parent)
|
||||
end
|
||||
|
||||
self.frame:SetFrameStrata("BACKGROUND")
|
||||
self.frame:SetWidth(260)
|
||||
self.frame:SetHeight(50)
|
||||
self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos)
|
||||
self.frame:SetWidth(self.settings.gap)
|
||||
self.frame:SetHeight(self.height)
|
||||
self.frame:SetPoint("TOP", self.parent, "TOP", 0, self.moduleSettings.vpos)
|
||||
self.frame:SetScale(self.moduleSettings.scale)
|
||||
self.frame:Show()
|
||||
|
||||
if (not self.frame.texture) then
|
||||
self.frame.texture = self.frame:CreateTexture()
|
||||
self.frame.texture:SetTexture(IceElement.TexturePath .. "smooth")
|
||||
self.frame.texture:SetVertexColor(0.2, 0.2, 0.2, 0.3)
|
||||
self.frame.texture:SetAllPoints(self.frame)
|
||||
end
|
||||
|
||||
self.frame.unit = self.unit -- for blizz default tooltip handling
|
||||
self.frame:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
||||
self.frame:SetScript("OnClick", function() self:OnClick(arg1) end)
|
||||
self.frame:SetScript("OnEnter", function() UnitFrame_OnEnter() end)
|
||||
self.frame:SetScript("OnLeave", function() UnitFrame_OnLeave() end)
|
||||
|
||||
self:CreateBarFrame()
|
||||
self:CreateToTFrame()
|
||||
self:CreateToTHPFrame()
|
||||
self:CreateDebuffFrame()
|
||||
end
|
||||
|
||||
|
||||
function TargetOfTarget.prototype:CreateBarFrame()
|
||||
if (not self.frame.bar) then
|
||||
self.frame.bar = CreateFrame("StatusBar", nil, self.frame)
|
||||
end
|
||||
|
||||
self.frame.bar:SetFrameStrata("BACKGROUND")
|
||||
self.frame.bar:SetWidth(self.settings.gap)
|
||||
self.frame.bar:SetHeight(self.height)
|
||||
|
||||
self.frame.bar:SetPoint("LEFT", self.frame, "LEFT", 0, 0)
|
||||
|
||||
if (not self.frame.bar.texture) then
|
||||
self.frame.bar.texture = self.frame.bar:CreateTexture()
|
||||
self.frame.bar.texture:SetTexture(IceElement.TexturePath .. "smooth")
|
||||
self.frame.bar.texture:SetAllPoints(self.frame.bar)
|
||||
self.frame.bar:SetStatusBarTexture(self.frame.bar.texture)
|
||||
end
|
||||
|
||||
self.frame.bar:Show()
|
||||
end
|
||||
|
||||
|
||||
function TargetOfTarget.prototype:CreateToTFrame()
|
||||
self.frame.totName = self:FontFactory("Bold", self.moduleSettings.fontSize+1, nil, self.frame.totName)
|
||||
self.frame.totName = self:FontFactory("Bold", self.moduleSettings.fontSize, self.frame.bar, self.frame.totName)
|
||||
|
||||
self.frame.totName:SetWidth(120)
|
||||
self.frame.totName:SetHeight(14)
|
||||
self.frame.totName:SetJustifyH("RIGHT")
|
||||
self.frame.totName:SetJustifyV("BOTTOM")
|
||||
self.frame.totName:SetWidth(self.settings.gap-40)
|
||||
self.frame.totName:SetHeight(self.height)
|
||||
self.frame.totName:SetJustifyH("LEFT")
|
||||
self.frame.totName:SetJustifyV("TOP")
|
||||
|
||||
self.frame.totName:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", 0, -2)
|
||||
self.frame.totName:SetPoint("LEFT", self.frame, "LEFT", 0, 0)
|
||||
self.frame.totName:Show()
|
||||
end
|
||||
|
||||
|
||||
function TargetOfTarget.prototype:CreateToTHPFrame()
|
||||
self.frame.totHealth = self:FontFactory(nil, self.moduleSettings.fontSize, nil, self.frame.totHealth)
|
||||
self.frame.totHealth = self:FontFactory("Bold", self.moduleSettings.fontSize, self.frame.bar, self.frame.totHealth)
|
||||
|
||||
self.frame.totHealth:SetWidth(120)
|
||||
self.frame.totHealth:SetHeight(14)
|
||||
self.frame.totHealth:SetWidth(40)
|
||||
self.frame.totHealth:SetHeight(self.height)
|
||||
self.frame.totHealth:SetJustifyH("RIGHT")
|
||||
self.frame.totHealth:SetJustifyV("TOP")
|
||||
|
||||
self.frame.totHealth:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", 0, -16)
|
||||
self.frame.totHealth:SetPoint("RIGHT", self.frame, "RIGHT", 0, 0)
|
||||
self.frame.totHealth:Show()
|
||||
end
|
||||
|
||||
@ -199,7 +242,7 @@ function TargetOfTarget.prototype:CreateIconFrames(parent)
|
||||
buffs[i].texture:SetTexture(nil)
|
||||
buffs[i].texture:SetAllPoints(buffs[i])
|
||||
|
||||
buffs[i].stack = self:FontFactory("Bold", 15, buffs[i])
|
||||
buffs[i].stack = self:FontFactory("Bold", 11, buffs[i])
|
||||
buffs[i].stack:SetPoint("BOTTOMRIGHT" , buffs[i], "BOTTOMRIGHT", 0, -1)
|
||||
end
|
||||
return buffs
|
||||
@ -211,7 +254,7 @@ function TargetOfTarget.prototype:UpdateBuffs()
|
||||
|
||||
if (self.moduleSettings.showDebuffs) then
|
||||
for i = 1, 16 do
|
||||
local buffTexture, buffApplications = UnitDebuff("targettarget", i)
|
||||
local buffTexture, buffApplications = UnitDebuff(self.unit, i)
|
||||
|
||||
if (buffApplications and (buffApplications > 1)) then
|
||||
debuffs = debuffs + 1
|
||||
@ -241,36 +284,56 @@ end
|
||||
function TargetOfTarget.prototype:Update()
|
||||
self:UpdateBuffs()
|
||||
|
||||
if not (UnitExists("targettarget")) then
|
||||
if not (UnitExists(self.unit)) then
|
||||
self.frame.totName:SetText()
|
||||
self.frame.totHealth:SetText()
|
||||
self.frame:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
local _, unitClass = UnitClass("targettarget")
|
||||
local name = UnitName("targettarget")
|
||||
self.frame:Show()
|
||||
|
||||
self.frame.totName:SetTextColor(self:GetColor(unitClass, 1))
|
||||
self.frame.totName:SetText(name)
|
||||
local _, unitClass = UnitClass(self.unit)
|
||||
local name = UnitName(self.unit)
|
||||
local reaction = UnitReaction(self.unit, "player")
|
||||
|
||||
|
||||
local color = "totFriendly" -- friendly > 4
|
||||
local reaction = UnitReaction("targettarget", "player")
|
||||
if (reaction and (reaction == 4)) then
|
||||
color = "totNeutral"
|
||||
elseif (reaction and (reaction < 4)) then
|
||||
color = "totHostile"
|
||||
end
|
||||
|
||||
local health = UnitHealth("targettarget")
|
||||
local maxHealth = UnitHealthMax("targettarget")
|
||||
local health = UnitHealth(self.unit)
|
||||
local maxHealth = UnitHealthMax(self.unit)
|
||||
local healthPercentage = math.floor( (health/maxHealth)*100 )
|
||||
|
||||
self.frame.totHealth:SetTextColor(self:GetColor(color, 1))
|
||||
local rColor = UnitReactionColor[reaction or 5]
|
||||
|
||||
self.frame.totName:SetTextColor(rColor.r, rColor.g, rColor.b, 0.9)
|
||||
self.frame.totName:SetText(name)
|
||||
|
||||
self.frame.totHealth:SetTextColor(rColor.r, rColor.g, rColor.b, 0.9)
|
||||
self.frame.totHealth:SetText(healthPercentage .. "%")
|
||||
|
||||
self.frame.bar.texture:SetVertexColor(self:GetColor(unitClass, 0.7))
|
||||
self.frame.bar:SetMinMaxValues(0, maxHealth)
|
||||
self.frame.bar:SetValue(health)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TargetOfTarget.prototype:OnClick(button)
|
||||
-- copy&paste from blizz code, it better work ;)
|
||||
if (SpellIsTargeting() and button == "RightButton") then
|
||||
SpellStopTargeting()
|
||||
return
|
||||
end
|
||||
|
||||
if (button == "LeftButton") then
|
||||
if (SpellIsTargeting()) then
|
||||
SpellTargetUnit(self.unit)
|
||||
elseif (CursorHasItem()) then
|
||||
DropItemOnUnit(self.unit)
|
||||
end
|
||||
else
|
||||
ToggleDropDownMenu(1, nil, TargetFrameDropDown, "cursor")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- load us up
|
||||
TargetOfTarget:new()
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
textures/smooth.tga
Normal file
BIN
textures/smooth.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user