diff --git a/Localization/deDE.lua b/Localization/deDE.lua index 54b5d84..91786dc 100644 --- a/Localization/deDE.lua +++ b/Localization/deDE.lua @@ -144,6 +144,8 @@ L["Use Class Colors"] = true L["Use standard class colors for the background color of threat bars"] = true L["Bar BG Color"] = true L["The background color for all threat bars"] = true +L["Always Show Self"] = true +L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"] = true L["Bar Label Options"] = "Optionen für die Beschriftung der Balken" L["Font"] = "Schriftart" L["The font that the labels will use"] = "Die Schriftart die die Balken benutzen" diff --git a/Localization/enUS.lua b/Localization/enUS.lua index 913c3c5..c89965a 100644 --- a/Localization/enUS.lua +++ b/Localization/enUS.lua @@ -144,6 +144,8 @@ L["Use Class Colors"] = true L["Use standard class colors for the background color of threat bars"] = true L["Bar BG Color"] = true L["The background color for all threat bars"] = true +L["Always Show Self"] = true +L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"] = true L["Bar Label Options"] = true L["Font"] = true L["The font that the labels will use"] = true diff --git a/Localization/frFR.lua b/Localization/frFR.lua index dbe1109..ab051ab 100644 --- a/Localization/frFR.lua +++ b/Localization/frFR.lua @@ -144,6 +144,8 @@ L["Use Class Colors"] = true L["Use standard class colors for the background color of threat bars"] = true L["Bar BG Color"] = true L["The background color for all threat bars"] = true +L["Always Show Self"] = true +L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"] = true L["Bar Label Options"] = "Options des labels des barres" L["Font"] = "Police d'écriture" L["The font that the labels will use"] = "La police d'écriture que les labels utiliseront." diff --git a/Localization/koKR.lua b/Localization/koKR.lua index 5605eee..5aa3ef6 100644 --- a/Localization/koKR.lua +++ b/Localization/koKR.lua @@ -144,6 +144,8 @@ L["Use Class Colors"] = true L["Use standard class colors for the background color of threat bars"] = true L["Bar BG Color"] = true L["The background color for all threat bars"] = true +L["Always Show Self"] = true +L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"] = true L["Bar Label Options"] = "바 라벨 옵션" L["Font"] = "글꼴" L["The font that the labels will use"] = "라벨에 사용할 글꼴을 설정합니다." diff --git a/Localization/zhCN.lua b/Localization/zhCN.lua index 51b5861..3b33919 100644 --- a/Localization/zhCN.lua +++ b/Localization/zhCN.lua @@ -144,6 +144,8 @@ L["Use Class Colors"] = true L["Use standard class colors for the background color of threat bars"] = true L["Bar BG Color"] = true L["The background color for all threat bars"] = true +L["Always Show Self"] = true +L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"] = true L["Bar Label Options"] = "计量条标签选项" L["Font"] = "字体" L["The font that the labels will use"] = "标签字体" diff --git a/Localization/zhTW.lua b/Localization/zhTW.lua index 01ac06b..ab0e413 100644 --- a/Localization/zhTW.lua +++ b/Localization/zhTW.lua @@ -144,6 +144,8 @@ L["Use Class Colors"] = true L["Use standard class colors for the background color of threat bars"] = true L["Bar BG Color"] = true L["The background color for all threat bars"] = true +L["Always Show Self"] = true +L["Always show your threat bar on Omen (ignores class filter settings), showing your bar on the last row if necessary"] = true L["Bar Label Options"] = "長條棒標籤選項" L["Font"] = "字體" L["The font that the labels will use"] = "標籤字體" diff --git a/Omen.lua b/Omen.lua index d30f116..8f4cffb 100644 --- a/Omen.lua +++ b/Omen.lua @@ -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()