Add "Always Show Self" option to Omen.
This commit is contained in:
@@ -128,6 +128,7 @@ local defaults = {
|
||||
BarColor = {r = 1, g = 0, b = 0, a = 1,},
|
||||
UseTankBarColor = true,
|
||||
TankBarColor = {r = 1, g = 0, b = 0, a = 1,},
|
||||
AlwaysShowSelf = true,
|
||||
},
|
||||
ShowWith = {
|
||||
Pet = true,
|
||||
@@ -1283,10 +1284,25 @@ function Omen:UpdateBars()
|
||||
if topthreat == 0 then topthreat = 1 end
|
||||
local tankThreat = threatTable[tankGUID or mobTargetGUID or sortTable[1]]
|
||||
local dbBar = db.Bar
|
||||
local showSelfYet = true
|
||||
myGUID = UnitGUID("player")
|
||||
i = 1
|
||||
|
||||
if dbBar.AlwaysShowSelf then
|
||||
-- Check if we're one of the bars to be displayed
|
||||
for j = 1, #sortTable do
|
||||
if sortTable[j] == myGUID then
|
||||
showSelfYet = false -- Yes, so flag it false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Check how many bars of space we have
|
||||
local numBars = db.Autocollapse and db.NumBars or floor((h - dbBar.Height) / (dbBar.Height + dbBar.Spacing) + 1)
|
||||
|
||||
i = 1 -- Counts one higher than number of bars used
|
||||
if dbBar.ShowHeadings then
|
||||
if db.Autocollapse and i <= db.NumBars or i*dbBar.Height + (i-1)*dbBar.Spacing <= h then
|
||||
if i <= numBars then
|
||||
i = i + 1
|
||||
bars[0].texture:SetWidth(w)
|
||||
bars[0]:Show()
|
||||
@@ -1295,16 +1311,22 @@ function Omen:UpdateBars()
|
||||
bars[0]:Hide()
|
||||
end
|
||||
for j = 1, #sortTable do
|
||||
if i > numBars then break end
|
||||
local guid = sortTable[j]
|
||||
local class = guidClassLookup[guid]
|
||||
if class == nil and dbBar.Classes["*NOTINPARTY*"] or dbBar.Classes[class] then
|
||||
if db.Autocollapse then
|
||||
if i > db.NumBars then break end
|
||||
else
|
||||
if i*dbBar.Height + (i-1)*dbBar.Spacing > h then break end
|
||||
end
|
||||
local show = class == nil and dbBar.Classes["*NOTINPARTY*"] or dbBar.Classes[class]
|
||||
if dbBar.AlwaysShowSelf and i == numBars and not showSelfYet and guid ~= myGUID then
|
||||
show = false
|
||||
end
|
||||
if dbBar.AlwaysShowSelf and guid == myGUID then
|
||||
show = true
|
||||
showSelfYet = true
|
||||
end
|
||||
if show then
|
||||
local bar = bars[dbBar.ShowHeadings and i-1 or i]
|
||||
local threat = threatTable[guid]
|
||||
|
||||
-- Update the text on the bar
|
||||
bar.Text1:SetText(guidNameLookup[guid])
|
||||
if dbBar.ShowPercent and dbBar.ShowValue then
|
||||
if dbBar.ShortNumbers and threat > 100000 then
|
||||
@@ -1321,11 +1343,15 @@ function Omen:UpdateBars()
|
||||
else
|
||||
bar.Text2:SetFormattedText("%d%%", tankThreat == 0 and 0 or threat / tankThreat * 100)
|
||||
end
|
||||
|
||||
-- Update the color of the bar
|
||||
local c = (guid == myGUID and dbBar.UseMyBarColor and dbBar.MyBarColor) or
|
||||
(guid == tankGUID and dbBar.UseTankBarColor and dbBar.TankBarColor) or
|
||||
(dbBar.UseClassColors and (RAID_CLASS_COLORS[class] or (class == "PET" and pet_color))) or
|
||||
dbBar.BarColor
|
||||
bar.texture:SetVertexColor(c.r, c.g, c.b, c.a or 1)
|
||||
|
||||
-- Update the width of the bar, and animate if necessary
|
||||
local width = w * threat / topthreat
|
||||
if width == 0 then width = 1 end
|
||||
if dbBar.AnimateBars and self.Anchor.IsMovingOrSizing ~= 2 then
|
||||
@@ -1333,7 +1359,8 @@ function Omen:UpdateBars()
|
||||
else
|
||||
bar.texture:SetWidth(width)
|
||||
end
|
||||
bar.guid = guid
|
||||
|
||||
bar.guid = guid -- For TPS calcs
|
||||
bar:Show()
|
||||
i = i + 1
|
||||
end
|
||||
@@ -1402,8 +1429,9 @@ function Omen:ClearAll()
|
||||
end
|
||||
|
||||
function Omen:UpdateTPS()
|
||||
local numBars = #bars
|
||||
if testMode then
|
||||
for i = 1, #bars do
|
||||
for i = 1, numBars do
|
||||
bars[i].Text3:SetText(1300 - 50*i)
|
||||
end
|
||||
return
|
||||
@@ -1419,7 +1447,7 @@ function Omen:UpdateTPS()
|
||||
local dataSize = #threatStoreTime
|
||||
if dataSize == 0 or startTime <= threatStoreTime[1] then
|
||||
-- We do not have enough data, TPSWindow seconds has not passed
|
||||
for i = 1, #bars do
|
||||
for i = 1, numBars do
|
||||
bars[i].Text3:SetText("??")
|
||||
end
|
||||
return
|
||||
@@ -1427,15 +1455,16 @@ function Omen:UpdateTPS()
|
||||
-- Check for special case with just 1 data point past TPSWindow seconds
|
||||
if dataSize == 1 then
|
||||
-- Threat generated is 0
|
||||
for i = 1, #bars do
|
||||
for i = 1, numBars do
|
||||
bars[i].Text3:SetText("0")
|
||||
end
|
||||
return
|
||||
end
|
||||
-- We have at least 2 data points
|
||||
for i = 1, #bars do
|
||||
if not bars[i]:IsShown() then return end
|
||||
local guid = bars[i].guid
|
||||
for i = 1, numBars do
|
||||
local bar = bars[i]
|
||||
if not bar:IsShown() then return end
|
||||
local guid = bar.guid
|
||||
local baseThreat = threatStore[1][guid]
|
||||
local secondThreat = threatStore[2][guid]
|
||||
local finalThreat = threatStore[dataSize][guid]
|
||||
@@ -1443,10 +1472,10 @@ function Omen:UpdateTPS()
|
||||
-- Calculate TPS
|
||||
local ratio = (startTime - threatStoreTime[1]) / (threatStoreTime[2] - threatStoreTime[1])
|
||||
local startThreat = (secondThreat - baseThreat) * ratio + baseThreat
|
||||
bars[i].Text3:SetFormattedText("%d", (finalThreat - startThreat) / TPSWindow / 100)
|
||||
bar.Text3:SetFormattedText("%d", (finalThreat - startThreat) / TPSWindow / 100)
|
||||
else
|
||||
-- We don't have enough data for this unit
|
||||
bars[i].Text3:SetText("??")
|
||||
bar.Text3:SetText("??")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2123,9 +2152,15 @@ local options = {
|
||||
end,
|
||||
disabled = function() return db.Bar.UseClassColors end,
|
||||
},
|
||||
AlwaysShowSelf = {
|
||||
type = "toggle",
|
||||
order = 19,
|
||||
name = L["Always Show Self"],
|
||||
desc = L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"],
|
||||
},
|
||||
Texture = {
|
||||
type = "select", dialogControl = 'LSM30_Statusbar',
|
||||
order = 19,
|
||||
order = 25,
|
||||
name = L["Bar Texture"],
|
||||
desc = L["The texture that the bar will use"],
|
||||
values = AceGUIWidgetLSMlists.statusbar,
|
||||
@@ -2141,7 +2176,7 @@ local options = {
|
||||
type = "group",
|
||||
name = L["Bar Label Options"],
|
||||
guiInline = true,
|
||||
order = 20,
|
||||
order = 30,
|
||||
set = function(info, v)
|
||||
db.Bar[ info[#info] ] = v
|
||||
Omen:UpdateBarLabelSettings()
|
||||
|
||||
Reference in New Issue
Block a user