Add "Show Only In Combat" option. Add "Use Focus Target" option.
This commit is contained in:
@@ -5,11 +5,9 @@ if not L then return end
|
||||
|
||||
-- Main Omen window
|
||||
L["<Unknown>"] = true
|
||||
L["Test Mode"] = true
|
||||
L["Omen Quick Menu"] = true
|
||||
L["Enter Test Mode"] = true
|
||||
L["Exit Test Mode"] = true
|
||||
L["Unlock Omen"] = true
|
||||
L["Use Focus Target"] = true
|
||||
L["Test Mode"] = true
|
||||
L["Open Config"] = true
|
||||
L["Hide Omen"] = true
|
||||
L["Name"] = true
|
||||
@@ -87,6 +85,9 @@ L["You are in a battleground"] = true
|
||||
L["Show Omen when you are in a battleground or arena"] = true
|
||||
L["You are in a dungeon"] = true
|
||||
L["Show Omen when you are in a dungeon (5 man and raid)"] = true
|
||||
L["In addition to the above options..."] = true
|
||||
L["Only show when in combat"] = true
|
||||
L["Turning this on will cause Omen to hide whenever you are not in combat."] = true
|
||||
|
||||
-- Config strings, show classes... section
|
||||
L["Show Classes..."] = true
|
||||
|
||||
@@ -72,6 +72,7 @@ local defaults = {
|
||||
PositionH = 82,
|
||||
VGrip1 = 85,
|
||||
VGrip2 = 115,
|
||||
UseFocus = false,
|
||||
Background = {
|
||||
Texture = "Blizzard Parchment",
|
||||
BorderTexture = "Blizzard Dialog",
|
||||
@@ -126,6 +127,7 @@ local defaults = {
|
||||
Resting = false,
|
||||
PVP = false,
|
||||
Dungeon = true,
|
||||
ShowOnlyInCombat = false,
|
||||
},
|
||||
FuBar = {
|
||||
HideMinimapButton = true,
|
||||
@@ -406,6 +408,26 @@ function Omen:CreateFrames()
|
||||
self.VGrip2:SetScript("OnMouseUp", self.VGrip1:GetScript("OnMouseUp"))
|
||||
self.VGrip2:SetScript("OnHide", self.VGrip1:GetScript("OnMouseUp"))
|
||||
self.VGrip2:SetFrameLevel(self.BarList:GetFrameLevel() + 2)
|
||||
|
||||
--[[self.FocusButton = CreateFrame("Button", "OmenFocusButton", self.Title, "OptionsButtonTemplate")
|
||||
self.FocusButton:SetWidth(16)
|
||||
self.FocusButton:SetHeight(16)
|
||||
self.FocusButton:SetPoint("TOPRIGHT")
|
||||
self.FocusButton:SetText("F")
|
||||
self.FocusButton:SetScript("OnClick", function(self, button, down)
|
||||
db.UseFocus = not db.UseFocus
|
||||
if db.UseFocus then
|
||||
self:GetFontString():SetTextColor(1, 0.82, 0, 1)
|
||||
else
|
||||
self:GetFontString():SetTextColor(0.5, 0.5, 0.5, 1)
|
||||
end
|
||||
Omen:UpdateBars()
|
||||
end)
|
||||
if db.UseFocus then
|
||||
self.FocusButton:GetFontString():SetTextColor(1, 0.82, 0, 1)
|
||||
else
|
||||
self.FocusButton:GetFontString():SetTextColor(0.5, 0.5, 0.5, 1)
|
||||
end]]
|
||||
end
|
||||
|
||||
function Omen:OnInitialize()
|
||||
@@ -491,6 +513,11 @@ function Omen:OnEnable()
|
||||
self:RegisterEvent("PLAYER_UPDATE_RESTING", "UpdateVisible")
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateVisible")
|
||||
|
||||
if db.ShowWith.ShowOnlyInCombat then
|
||||
self:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateVisible")
|
||||
self:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateVisible")
|
||||
end
|
||||
|
||||
self:PARTY_MEMBERS_CHANGED()
|
||||
self:PLAYER_TARGET_CHANGED()
|
||||
end
|
||||
@@ -569,23 +596,29 @@ function Omen:Toggle(setting)
|
||||
end
|
||||
end
|
||||
|
||||
function Omen:UpdateVisible()
|
||||
function Omen:UpdateVisible(event)
|
||||
local t = db.ShowWith
|
||||
if t.ShowOnlyInCombat and not InCombatLockdown() and event ~= "PLAYER_REGEN_DISABLED" then
|
||||
self:Toggle(false)
|
||||
return
|
||||
end
|
||||
|
||||
local inInstance, instanceType = IsInInstance()
|
||||
local show
|
||||
if not db.ShowWith.Resting and IsResting() then
|
||||
if not t.Resting and IsResting() then
|
||||
show = false
|
||||
end
|
||||
if not db.ShowWith.PVP and inInstance and (instanceType == "pvp" or instanceType == "arena") then
|
||||
if not t.PVP and inInstance and (instanceType == "pvp" or instanceType == "arena") then
|
||||
show = false
|
||||
end
|
||||
if not db.ShowWith.Dungeon and inInstance and (instanceType == "party" or instanceType == "raid") then
|
||||
if not t.Dungeon and inInstance and (instanceType == "party" or instanceType == "raid") then
|
||||
show = false
|
||||
end
|
||||
if show == nil then
|
||||
show = (db.ShowWith.Pet and UnitExists("pet")) or
|
||||
(db.ShowWith.Alone and GetNumPartyMembers() + GetNumRaidMembers() == 0 and not UnitExists("pet")) or
|
||||
(db.ShowWith.Party and GetNumPartyMembers() > 0) or
|
||||
(db.ShowWith.Raid and GetNumRaidMembers() > 0)
|
||||
show = (t.Pet and UnitExists("pet")) or
|
||||
(t.Alone and GetNumPartyMembers() + GetNumRaidMembers() == 0 and not UnitExists("pet")) or
|
||||
(t.Party and GetNumPartyMembers() > 0) or
|
||||
(t.Raid and GetNumRaidMembers() > 0)
|
||||
end
|
||||
self:Toggle(show)
|
||||
end
|
||||
@@ -622,6 +655,8 @@ function Omen:UpdateBackdrop()
|
||||
end
|
||||
self.Options.args.TitleBar.args.Height.min = h
|
||||
|
||||
--self.FocusButton:SetPoint("TOPRIGHT", -inset, -inset)
|
||||
|
||||
self:ResizeBars()
|
||||
self:ReAnchorBars()
|
||||
self:UpdateBars()
|
||||
@@ -1096,6 +1131,28 @@ local function updatethreat(unitid, mobunitid)
|
||||
end
|
||||
end
|
||||
|
||||
local threatUnitIDFindList = {"target", "targettarget"}
|
||||
local threatUnitIDFindList2 = {"focus", "focustarget", "target", "targettarget"}
|
||||
function Omen:FindThreatMob()
|
||||
-- Figure out which mob to show threat on.
|
||||
-- It has to be attackable and not human controlled.
|
||||
local t = db.UseFocus and threatUnitIDFindList2 or threatUnitIDFindList
|
||||
local name, name2
|
||||
for i = 1, #t do
|
||||
local mob = t[i]
|
||||
if UnitExists(mob) then
|
||||
name2 = UnitName(mob)
|
||||
guidNameLookup[UnitGUID(mob)] = name2
|
||||
if not name then name = name2 end
|
||||
if not UnitIsPlayer(mob) and not UnitPlayerControlled(mob) and UnitCanAttack("player", mob) and UnitHealth(mob) > 0 then
|
||||
self.TitleText:SetText(name2)
|
||||
return mob
|
||||
end
|
||||
end
|
||||
end
|
||||
self.TitleText:SetText(name)
|
||||
end
|
||||
|
||||
function Omen:UpdateBars()
|
||||
if not self.Anchor:IsShown() and not db.CollapseHide then return end
|
||||
|
||||
@@ -1111,20 +1168,12 @@ function Omen:UpdateBars()
|
||||
tankGUID = 25
|
||||
self.TitleText:SetText(L["Test Mode"])
|
||||
else
|
||||
-- Figure out which mob to show threat on, either "target" or "targettarget"
|
||||
-- It has to be attackable and not human controlled, otherwise return
|
||||
local mob = "target"
|
||||
if UnitExists(mob) and (UnitIsPlayer(mob) or UnitPlayerControlled(mob) or not UnitCanAttack("player", mob)) then
|
||||
guidNameLookup[UnitGUID(mob)] = UnitName(mob)
|
||||
mob = "targettarget"
|
||||
end
|
||||
if not UnitExists(mob) or UnitIsPlayer(mob) or UnitPlayerControlled(mob) or not UnitCanAttack("player", mob) then
|
||||
local mob = self:FindThreatMob()
|
||||
if not mob then
|
||||
self:ClearAll()
|
||||
return
|
||||
end
|
||||
mobGUID = UnitGUID(mob)
|
||||
guidNameLookup[mobGUID] = UnitName(mob)
|
||||
self.TitleText:SetText(guidNameLookup[mobGUID])
|
||||
|
||||
-- Schedule a repeating timer for updating threat on "targettarget"
|
||||
-- since we get no events on a targettarget change.
|
||||
@@ -1377,22 +1426,35 @@ do
|
||||
info.disabled = nil
|
||||
info.isTitle = nil
|
||||
info.notCheckable = nil
|
||||
info.text = testMode and L["Exit Test Mode"] or L["Enter Test Mode"]
|
||||
|
||||
info.text = L["Lock Omen"]
|
||||
info.func = function()
|
||||
db.Locked = not db.Locked
|
||||
Omen:UpdateGrips()
|
||||
LibStub("AceConfigRegistry-3.0"):NotifyChange("Omen")
|
||||
end
|
||||
info.checked = db.Locked
|
||||
UIDropDownMenu_AddButton(info, level)
|
||||
|
||||
info.text = "Use Focus Target"
|
||||
info.func = function()
|
||||
db.UseFocus = not db.UseFocus
|
||||
Omen:UpdateBars()
|
||||
end
|
||||
info.checked = db.UseFocus
|
||||
UIDropDownMenu_AddButton(info, level)
|
||||
|
||||
info.text = "Test Mode"
|
||||
info.func = function()
|
||||
testMode = not testMode
|
||||
Omen:UpdateBars()
|
||||
end
|
||||
UIDropDownMenu_AddButton(info, level)
|
||||
|
||||
info.text = db.Locked and L["Unlock Omen"] or L["Lock Omen"]
|
||||
info.func = function()
|
||||
db.Locked = not db.Locked
|
||||
Omen:UpdateGrips()
|
||||
end
|
||||
info.checked = testMode
|
||||
UIDropDownMenu_AddButton(info, level)
|
||||
|
||||
info.text = L["Open Config"]
|
||||
info.func = function() Omen:ShowConfig() end
|
||||
info.checked = nil
|
||||
UIDropDownMenu_AddButton(info, level)
|
||||
|
||||
info.text = L["Hide Omen"]
|
||||
@@ -1633,41 +1695,72 @@ local options = {
|
||||
type = "description",
|
||||
name = L["Show Omen when any of the following are true"],
|
||||
},
|
||||
Pet = {
|
||||
type = "toggle",
|
||||
name = L["You have a pet"],
|
||||
desc = L["Show Omen when you have a pet out"],
|
||||
},
|
||||
Alone = {
|
||||
type = "toggle",
|
||||
order = 2,
|
||||
name = L["You are alone"],
|
||||
desc = L["Show Omen when you are alone"],
|
||||
},
|
||||
Party = {
|
||||
type = "toggle",
|
||||
name = L["You are in a party"],
|
||||
desc = L["Show Omen when you are in a 5-man party"],
|
||||
},
|
||||
Raid = {
|
||||
type = "toggle",
|
||||
name = L["You are in a raid"],
|
||||
desc = L["Show Omen when you are in a raid"],
|
||||
},
|
||||
Resting = {
|
||||
type = "toggle",
|
||||
name = L["You are resting"],
|
||||
desc = L["Show Omen when you are resting"],
|
||||
},
|
||||
PVP = {
|
||||
type = "toggle",
|
||||
order = 3,
|
||||
name = L["You are in a battleground"],
|
||||
desc = L["Show Omen when you are in a battleground or arena"],
|
||||
},
|
||||
Dungeon = {
|
||||
type = "toggle",
|
||||
order = 4,
|
||||
name = L["You are in a dungeon"],
|
||||
desc = L["Show Omen when you are in a dungeon (5 man and raid)"],
|
||||
},
|
||||
Party = {
|
||||
type = "toggle",
|
||||
order = 5,
|
||||
name = L["You are in a party"],
|
||||
desc = L["Show Omen when you are in a 5-man party"],
|
||||
},
|
||||
Raid = {
|
||||
type = "toggle",
|
||||
order = 6,
|
||||
name = L["You are in a raid"],
|
||||
desc = L["Show Omen when you are in a raid"],
|
||||
},
|
||||
Resting = {
|
||||
type = "toggle",
|
||||
order = 7,
|
||||
name = L["You are resting"],
|
||||
desc = L["Show Omen when you are resting"],
|
||||
},
|
||||
Pet = {
|
||||
type = "toggle",
|
||||
order = 8,
|
||||
name = L["You have a pet"],
|
||||
desc = L["Show Omen when you have a pet out"],
|
||||
},
|
||||
intro2 = {
|
||||
order = 10,
|
||||
type = "description",
|
||||
name = L["In addition to the above options..."],
|
||||
},
|
||||
ShowOnlyInCombat = {
|
||||
type = "toggle",
|
||||
order = 11,
|
||||
width = "double",
|
||||
name = L["Only show when in combat"],
|
||||
desc = L["Turning this on will cause Omen to hide whenever you are not in combat."],
|
||||
set = function(info, value)
|
||||
db.ShowWith.ShowOnlyInCombat = value
|
||||
if value then
|
||||
Omen:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateVisible")
|
||||
Omen:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateVisible")
|
||||
else
|
||||
Omen:UnregisterEvent("PLAYER_REGEN_DISABLED")
|
||||
Omen:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
||||
end
|
||||
Omen:UpdateVisible()
|
||||
Omen:UpdateBars()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
ShowClasses = {
|
||||
|
||||
@@ -5,11 +5,9 @@ if not L then return end
|
||||
|
||||
-- Main Omen window
|
||||
L["<Unknown>"] = "<Unbekannt>"
|
||||
L["Test Mode"] = "Testmodus"
|
||||
L["Omen Quick Menu"] = "Omen Schnellmenü"
|
||||
L["Enter Test Mode"] = "Testmodus starten"
|
||||
L["Exit Test Mode"] = "Testmodus beenden"
|
||||
L["Unlock Omen"] = "Omen freischalten"
|
||||
L["Use Focus Target"] = "Fokusziel verwenden"
|
||||
L["Test Mode"] = "Testmodus"
|
||||
L["Open Config"] = "Optionen öffnen"
|
||||
L["Hide Omen"] = "Omen verstecken"
|
||||
L["Name"] = "Name"
|
||||
@@ -87,6 +85,9 @@ L["You are in a battleground"] = "Ich in einem Schlachtfeld bin"
|
||||
L["Show Omen when you are in a battleground or arena"] = "Zeige Omen wenn ich in einem Schlachtfeld bin"
|
||||
L["You are in a dungeon"] = "Ich in einer Instanz bin"
|
||||
L["Show Omen when you are in a dungeon (5 man and raid)"] = "Zeige Omen wenn ich in einer Instanz bin (5er oder Schlachtzug)"
|
||||
L["In addition to the above options..."] = "Zusätzlich zu den Optionen oben..."
|
||||
L["Only show when in combat"] = "Zeige nur wenn im Kampf"
|
||||
L["Turning this on will cause Omen to hide whenever you are not in combat."] = "Wenn Sie diese Option aktivieren wird Omen ausgeblendet, wenn Sie sich nicht im Kampf befinden"
|
||||
|
||||
-- Config strings, show classes... section
|
||||
L["Show Classes..."] = "Zeige Klassen..."
|
||||
|
||||
Reference in New Issue
Block a user