diff --git a/Localization/enUS.lua b/Localization/enUS.lua index 3adb115..1476d75 100644 --- a/Localization/enUS.lua +++ b/Localization/enUS.lua @@ -103,8 +103,8 @@ L["The outline that the labels will use"] = true L["None"] = true L["Outline"] = true L["Thick Outline"] = true - -L["Classes"] = true +L["Show bars for these classes"] = true +L["The classes here refer to those in your party/raid only."] = true L["DEATHKNIGHT"] = "Death Knight" L["DRUID"] = "Druid" L["HUNTER"] = "Hunter" @@ -116,6 +116,7 @@ L["ROGUE"] = "Rogue" L["SHAMAN"] = "Shaman" L["WARLOCK"] = "Warlock" L["WARRIOR"] = "Warrior" +L["*Not in Party*"] = true -- Config strings, slash command section L["OMEN_SLASH_DESC"] = "These buttons execute the same functions as the ones in the slash command /omen" diff --git a/Omen.lua b/Omen.lua index 408bd5f..ba19e61 100644 --- a/Omen.lua +++ b/Omen.lua @@ -92,7 +92,7 @@ local defaults = { }, Bar = { Texture = "Blizzard", - Height = 16, + Height = 12, Spacing = 0, AnimateBars = true, ShortNumbers = true, @@ -100,6 +100,20 @@ local defaults = { FontOutline = "", FontColor = {r = 1, g = 1, b = 1, a = 1,}, FontSize = 10, + Classes = { + DEATHKNIGHT = true, + DRUID = true, + HUNTER = true, + MAGE = true, + PALADIN = true, + PET = true, + PRIEST = true, + ROGUE = true, + SHAMAN = true, + WARLOCK = true, + WARRIOR = true, + ["*NOTINPARTY*"] = true, + }, }, ShowWith = { Pet = true, @@ -108,20 +122,7 @@ local defaults = { Raid = true, Resting = false, PVP = false, - Dungeon = true - }, - Classes = { - ["DEATHKNIGHT"] = true, - ["DRUID"] = true, - ["HUNTER"] = true, - ["MAGE"] = true, - ["PALADIN"] = true, - ["PET"] = true, - ["PRIEST"] = true, - ["ROGUE"] = true, - ["SHAMAN"] = true, - ["WARLOCK"] = true, - ["WARRIOR"] = true + Dungeon = true, }, FuBar = { HideMinimapButton = true, @@ -235,7 +236,7 @@ function Omen:CreateFrames() -- Create Title text self.TitleText = self.Title:CreateFontString(nil, nil, "GameFontNormal") - self.TitleText:SetPoint("LEFT", self.Title, "LEFT", 10, 0) + self.TitleText:SetPoint("LEFT", self.Title, "LEFT", 8, 1) self.TitleText:SetJustifyH("LEFT") self.TitleText:SetTextColor(1, 1, 1, 1) self.defaultTitle = "Omen|cffffcc003|r" @@ -669,13 +670,13 @@ do bar:SetPoint("TOPLEFT", Omen.BarList, "TOPLEFT", inset, -inset + (barID-1) * -(db.Bar.Height + db.Bar.Spacing)) bar.Text1 = bar:CreateFontString(nil, nil, "GameFontNormalSmall") - bar.Text1:SetPoint("LEFT", bar, "LEFT", 5, 0) + bar.Text1:SetPoint("LEFT", bar, "LEFT", 5, 1) bar.Text1:SetJustifyH("LEFT") bar.Text1:SetFont(LSM:Fetch("font", db.Bar.Font), db.Bar.FontSize, db.Bar.FontOutline) bar.Text1:SetTextColor(color.r, color.g, color.b, color.a) bar.Text2 = bar:CreateFontString(nil, nil, "GameFontNormalSmall") - bar.Text2:SetPoint("RIGHT", bar, "RIGHT", -5, 0) + bar.Text2:SetPoint("RIGHT", bar, "RIGHT", -5, 1) bar.Text2:SetJustifyH("RIGHT") bar.Text2:SetFont(LSM:Fetch("font", db.Bar.Font), db.Bar.FontSize, db.Bar.FontOutline) bar.Text2:SetTextColor(color.r, color.g, color.b, color.a) @@ -919,7 +920,7 @@ function Omen:UpdateBars() -- in our raid (say an NPC or some other player) local mobTarget = mob.."target" local mobTargetGUID = UnitGUID(mobTarget) - if mobTargetGUID and not guidNameLookup[mobTargetGUID] then + if mobTargetGUID then guidNameLookup[mobTargetGUID] = UnitName(mobTarget) end @@ -987,20 +988,21 @@ function Omen:UpdateBars() local topthreat = threatTable[sortTable[1]] if topthreat == 0 then topthreat = 1 end local tankThreat = threatTable[tankGUID or mobTargetGUID or sortTable[1]] + local dbBar = db.Bar i = 1 for j = 1, #sortTable do local guid = sortTable[j] local class = guidClassLookup[guid] - if class == nil or db.Classes[class] then -- class == nil implies its not in your raid + 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*db.Bar.Height + (i-1)*db.Bar.Spacing > h then break end + if i*dbBar.Height + (i-1)*dbBar.Spacing > h then break end end local bar = bars[j] local threat = threatTable[guid] bar.Text1:SetText(guidNameLookup[guid]) - if db.Bar.ShortNumbers and threat > 100000 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) @@ -1009,7 +1011,7 @@ function Omen:UpdateBars() bar.texture:SetVertexColor(c.r, c.g, c.b) local width = w * threat / topthreat if width == 0 then width = 1 end - if db.Bar.AnimateBars and self.Anchor.IsMovingOrSizing ~= 2 then + if dbBar.AnimateBars and self.Anchor.IsMovingOrSizing ~= 2 then bar:AnimateTo(width) else bar.texture:SetWidth(width) @@ -1023,7 +1025,7 @@ function Omen:UpdateBars() bars[j]:Hide() end if db.Autocollapse then - self.Anchor:SetHeight((i-1)*db.Bar.Height + (i-2)*db.Bar.Spacing + 16 + inset) + self.Anchor:SetHeight((i-1)*dbBar.Height + (i-2)*dbBar.Spacing + self.Title:GetHeight() + inset) end self.Anchor:Show() self.BarList:Show() @@ -1134,6 +1136,8 @@ local options = { order = 10, set = function(info, value) db.Autocollapse = value + Omen.Anchor:SetHeight(5*db.Bar.Height + 4*db.Bar.Spacing + Omen.Title:GetHeight() + 2*db.Background.BarInset) + Omen:SetAnchors() Omen.BarList:Show() Omen:UpdateVisible() Omen:UpdateBars() @@ -1505,6 +1509,31 @@ local options = { }, }, }, + Classes = { + type = "multiselect", + order = 30, + name = L["Show bars for these classes"], + desc = L["The classes here refer to those in your party/raid only."], + values = { + DEATHKNIGHT = L["DEATHKNIGHT"], + DRUID = L["DRUID"], + HUNTER = L["HUNTER"], + MAGE = L["MAGE"], + PALADIN = L["PALADIN"], + PET = L["PET"], + PRIEST = L["PRIEST"], + ROGUE = L["ROGUE"], + SHAMAN = L["SHAMAN"], + WARLOCK = L["WARLOCK"], + WARRIOR = L["WARRIOR"], + ["*NOTINPARTY*"] = L["*Not in Party*"], + }, + get = function(info, k) return db.Bar.Classes[k] end, + set = function(info, k, v) + db.Bar.Classes[k] = v + Omen:UpdateBars() + end, + }, }, }, Warnings = {