Add show threat values and % options.

This commit is contained in:
Xinhuan
2008-10-28 23:20:37 +08:00
parent 40fb526d1f
commit 06fab05a7e
8 changed files with 78 additions and 8 deletions
+57 -8
View File
@@ -121,6 +121,8 @@ local defaults = {
HeadingBGColor = {r = 0, g = 0, b = 0, a = 0,},
UseMyBarColor = false,
MyBarColor = {r = 1, g = 0, b = 0, a = 1,},
ShowPercent = true,
ShowValue = true,
},
ShowWith = {
Pet = true,
@@ -920,7 +922,11 @@ do
if barID == 0 then
bar.Text1:SetText(L["Name"])
bar.Text2:SetText(L["Threat [%]"])
if db.Bar.ShowValue and db.Bar.ShowPercent then
bar.Text2:SetText(L["Threat [%]"])
else
bar.Text2:SetText(L["Threat"])
end
bar.Text3:SetText(L["TPS"])
color = db.Bar.HeadingBGColor
bar.texture:SetVertexColor(color.r, color.g, color.b, color.a)
@@ -1299,10 +1305,20 @@ function Omen:UpdateBars()
local bar = bars[j]
local threat = threatTable[guid]
bar.Text1:SetText(guidNameLookup[guid])
if dbBar.ShortNumbers and threat > 100000 then
bar.Text2:SetFormattedText("%2.1fk [%d%%]", threat / 100000, tankThreat == 0 and 0 or threat / tankThreat * 100)
if dbBar.ShowPercent and dbBar.ShowValue then
if dbBar.ShortNumbers and threat > 100000 then
bar.Text2:SetFormattedText("%2.1fk [%d%%]", threat / 100000, tankThreat == 0 and 0 or threat / tankThreat * 100)
else
bar.Text2:SetFormattedText("%d [%d%%]", threat / 100, tankThreat == 0 and 0 or threat / tankThreat * 100)
end
elseif dbBar.ShowValue then
if dbBar.ShortNumbers and threat > 100000 then
bar.Text2:SetFormattedText("%2.1fk", threat / 100000)
else
bar.Text2:SetFormattedText("%d", threat / 100)
end
else
bar.Text2:SetFormattedText("%d [%d%%]", threat / 100, tankThreat == 0 and 0 or threat / tankThreat * 100)
bar.Text2:SetFormattedText("%d%%", tankThreat == 0 and 0 or threat / tankThreat * 100)
end
local c = (class == "PET" and pet_color) or (db.Bar.UseMyBarColor and guid == myGUID and db.Bar.MyBarColor) or RAID_CLASS_COLORS[class] or default_color
bar.texture:SetVertexColor(c.r, c.g, c.b, c.a or 1)
@@ -1920,6 +1936,7 @@ local options = {
order = 3,
name = L["Short Numbers"],
desc = L["Display large numbers in Ks"],
disabled = function() return not db.Bar.ShowValue end
},
Height = {
type = "range",
@@ -1973,9 +1990,41 @@ local options = {
min = 3, max = 15, step = 0.1,
disabled = function() return not db.Bar.ShowTPS end,
},
ShowHeadings = {
ShowValue = {
type = "toggle",
order = 8,
name = L["Show Threat Values"],
desc = L["Show Threat Values"],
set = function(info, value)
db.Bar.ShowValue = value
if not value then
db.Bar.ShowPercent = true
bars[0].Text2:SetText(L["Threat"])
elseif db.Bar.ShowPercent then
bars[0].Text2:SetText(L["Threat [%]"])
end
Omen:UpdateBars()
end,
},
ShowPercent = {
type = "toggle",
order = 9,
name = L["Show Threat %"],
desc = L["Show Threat %"],
set = function(info, value)
db.Bar.ShowPercent = value
if not value then
db.Bar.ShowValue = true
bars[0].Text2:SetText(L["Threat"])
elseif db.Bar.ShowValue then
bars[0].Text2:SetText(L["Threat [%]"])
end
Omen:UpdateBars()
end,
},
ShowHeadings = {
type = "toggle",
order = 11,
name = L["Show Headings"],
desc = L["Show column headings"],
set = function(info, value)
@@ -1986,7 +2035,7 @@ local options = {
},
HeadingBGColor = {
type = "color",
order = 9,
order = 12,
name = L["Heading BG Color"],
desc = L["Heading background color"],
hasAlpha = true,
@@ -2003,13 +2052,13 @@ local options = {
},
UseMyBarColor = {
type = "toggle",
order = 10,
order = 13,
name = L["Use 'My Bar' color"],
desc = L["Use a different colored background for your threat bar in Omen"],
},
MyBarColor = {
type = "color",
order = 11,
order = 14,
name = L["'My Bar' BG Color"],
desc = L["The background color for your threat bar"],
hasAlpha = true,