Add an internal flag so that if the user manually toggles Omen's visibility, it stays shown/hidden until he next zones, join/leave a party/raid, or change any Auto Show/Hide settings.
This commit is contained in:
@@ -99,6 +99,7 @@ L["You are in a battleground"] = "Ich in einem Schlachtfeld bin"
|
||||
L["Turning this on will cause Omen to hide whenever you are in a battleground or arena."] = true
|
||||
L["You are not in combat"] = true
|
||||
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"
|
||||
L["AUTO_SHOW/HIDE_NOTE"] = "Note: If you manually toggle Omen to show or hide, it will remain shown or hidden regardless of Auto Show/Hide settings until you next zone, join or leave a party or raid, or change any Auto Show/Hide settings."
|
||||
|
||||
-- Config strings, show classes... section
|
||||
L["Show Classes..."] = "Zeige Klassen..."
|
||||
|
||||
@@ -99,6 +99,7 @@ L["You are in a battleground"] = true
|
||||
L["Turning this on will cause Omen to hide whenever you are in a battleground or arena."] = true
|
||||
L["You are not in combat"] = true
|
||||
L["Turning this on will cause Omen to hide whenever you are not in combat."] = true
|
||||
L["AUTO_SHOW/HIDE_NOTE"] = "Note: If you manually toggle Omen to show or hide, it will remain shown or hidden regardless of Auto Show/Hide settings until you next zone, join or leave a party or raid, or change any Auto Show/Hide settings."
|
||||
|
||||
-- Config strings, show classes... section
|
||||
L["Show Classes..."] = true
|
||||
|
||||
@@ -99,6 +99,7 @@ L["You are in a battleground"] = "Vous êtes ds un CdB"
|
||||
L["Turning this on will cause Omen to hide whenever you are in a battleground or arena."] = true
|
||||
L["You are not in combat"] = true
|
||||
L["Turning this on will cause Omen to hide whenever you are not in combat."] = true
|
||||
L["AUTO_SHOW/HIDE_NOTE"] = "Note: If you manually toggle Omen to show or hide, it will remain shown or hidden regardless of Auto Show/Hide settings until you next zone, join or leave a party or raid, or change any Auto Show/Hide settings."
|
||||
|
||||
-- Config strings, show classes... section
|
||||
L["Show Classes..."] = "Afficher les classes…"
|
||||
|
||||
@@ -99,6 +99,7 @@ L["You are in a battleground"] = "전장 참여"
|
||||
L["Turning this on will cause Omen to hide whenever you are in a battleground or arena."] = true
|
||||
L["You are not in combat"] = true
|
||||
L["Turning this on will cause Omen to hide whenever you are not in combat."] = "당신이 전투 중이 아닐 때 Omen을 숨깁니다."
|
||||
L["AUTO_SHOW/HIDE_NOTE"] = "Note: If you manually toggle Omen to show or hide, it will remain shown or hidden regardless of Auto Show/Hide settings until you next zone, join or leave a party or raid, or change any Auto Show/Hide settings."
|
||||
|
||||
-- Config strings, show classes... section
|
||||
L["Show Classes..."] = "직업 표시..."
|
||||
|
||||
@@ -99,6 +99,7 @@ L["You are in a battleground"] = "在战场"
|
||||
L["Turning this on will cause Omen to hide whenever you are in a battleground or arena."] = true
|
||||
L["You are not in combat"] = true
|
||||
L["Turning this on will cause Omen to hide whenever you are not in combat."] = "如选择此项,离开战斗后 Omen 会被隐藏。"
|
||||
L["AUTO_SHOW/HIDE_NOTE"] = "Note: If you manually toggle Omen to show or hide, it will remain shown or hidden regardless of Auto Show/Hide settings until you next zone, join or leave a party or raid, or change any Auto Show/Hide settings."
|
||||
|
||||
-- Config strings, show classes... section
|
||||
L["Show Classes..."] = "显示职业"
|
||||
|
||||
@@ -99,6 +99,7 @@ L["You are in a battleground"] = "你在戰場中"
|
||||
L["Turning this on will cause Omen to hide whenever you are in a battleground or arena."] = true
|
||||
L["You are not in combat"] = true
|
||||
L["Turning this on will cause Omen to hide whenever you are not in combat."] = "選擇此選項會在離開戰鬥後隱藏Omen"
|
||||
L["AUTO_SHOW/HIDE_NOTE"] = "Note: If you manually toggle Omen to show or hide, it will remain shown or hidden regardless of Auto Show/Hide settings until you next zone, join or leave a party or raid, or change any Auto Show/Hide settings."
|
||||
|
||||
-- Config strings, show classes... section
|
||||
L["Show Classes..."] = "顯示職業"
|
||||
|
||||
@@ -142,10 +142,8 @@ local defaults = {
|
||||
Alone = false,
|
||||
Party = true,
|
||||
Raid = true,
|
||||
--Resting = false,
|
||||
--PVP = false,
|
||||
--Dungeon = true,
|
||||
--ShowOnlyInCombat = false,
|
||||
-- Deprecated SV values
|
||||
-- Resting = false, PVP = false, Dungeon = true, ShowOnlyInCombat = false,
|
||||
HideWhileResting = true,
|
||||
HideInPVP = true,
|
||||
HideWhenOOC = false,
|
||||
@@ -177,6 +175,7 @@ local timers = {} -- Format: timers.timerName = timer returned from Ac
|
||||
local bars = {} -- Format: bars[i] = frame containing the i-th bar from the top of Omen
|
||||
local inRaid, inParty -- boolean variables indicating if the player is in a raid and/or party
|
||||
local testMode = false -- boolean: Are we in test mode?
|
||||
local manualToggle = false -- boolean: Did we manually toggle Omen?
|
||||
|
||||
Omen.GuidNameLookup = guidNameLookup
|
||||
Omen.GuidClassLookup = guidClassLookup
|
||||
@@ -543,7 +542,7 @@ function Omen:OnDisable()
|
||||
timers[k] = nil
|
||||
end
|
||||
|
||||
self:Toggle(false)
|
||||
self:_toggle(false)
|
||||
end
|
||||
|
||||
function Omen:OnProfileChanged(event, database, newProfileKey)
|
||||
@@ -598,7 +597,14 @@ function Omen:SetAnchors(useDB)
|
||||
db.PositionW, db.PositionH = w, h
|
||||
end
|
||||
|
||||
-- For public use
|
||||
function Omen:Toggle(setting)
|
||||
manualToggle = true
|
||||
return self:_toggle(setting)
|
||||
end
|
||||
|
||||
-- For internal use
|
||||
function Omen:_toggle(setting)
|
||||
if setting == nil then
|
||||
setting = not self.Anchor:IsShown()
|
||||
end
|
||||
@@ -610,13 +616,15 @@ function Omen:Toggle(setting)
|
||||
end
|
||||
|
||||
function Omen:UpdateVisible(event)
|
||||
if event == "PLAYER_ENTERING_WORLD" then manualToggle = false end
|
||||
|
||||
local t = db.ShowWith
|
||||
if not t.UseShowWith then return end
|
||||
if not t.UseShowWith or manualToggle then return end
|
||||
|
||||
-- Hide if HideWhenOOC option is on, we're not in combat, and the triggering event is not
|
||||
-- "PLAYER_REGEN_DISABLED" (we're out of combat during this event just before entering combat)
|
||||
if t.HideWhenOOC and not InCombatLockdown() and event ~= "PLAYER_REGEN_DISABLED" then
|
||||
self:Toggle(false)
|
||||
self:_toggle(false)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -632,7 +640,7 @@ function Omen:UpdateVisible(event)
|
||||
show = false
|
||||
end
|
||||
|
||||
self:Toggle(show)
|
||||
self:_toggle(show)
|
||||
end
|
||||
|
||||
local bgFrame = {insets = {}}
|
||||
@@ -1059,8 +1067,10 @@ end
|
||||
local lastPartyUpdateTime = GetTime()
|
||||
|
||||
function Omen:PARTY_MEMBERS_CHANGED()
|
||||
inRaid = GetNumRaidMembers() > 0
|
||||
local oldInParty, oldInRaid = inParty, inRaid
|
||||
inParty = GetNumPartyMembers() > 0
|
||||
inRaid = GetNumRaidMembers() > 0
|
||||
if oldInParty ~= inParty or oldInRaid ~= inRaid then manualToggle = false end
|
||||
self:UpdateVisible()
|
||||
|
||||
-- Run the update if the last call is more than 0.5 seconds ago else
|
||||
@@ -1859,6 +1869,7 @@ local options = {
|
||||
get = function(info) return db.ShowWith[ info[#info] ] end,
|
||||
set = function(info, value)
|
||||
db.ShowWith[ info[#info] ] = value
|
||||
manualToggle = false
|
||||
Omen:UpdateVisible()
|
||||
Omen:UpdateBars()
|
||||
end,
|
||||
@@ -1940,6 +1951,7 @@ local options = {
|
||||
desc = L["Turning this on will cause Omen to hide whenever you are not in combat."],
|
||||
set = function(info, value)
|
||||
db.ShowWith.HideWhenOOC = value
|
||||
manualToggle = false
|
||||
if value then
|
||||
Omen:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateVisible")
|
||||
Omen:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateVisible")
|
||||
@@ -1951,6 +1963,11 @@ local options = {
|
||||
Omen:UpdateBars()
|
||||
end,
|
||||
},
|
||||
intro4 = {
|
||||
order = 30,
|
||||
type = "description",
|
||||
name = L["AUTO_SHOW/HIDE_NOTE"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -2578,9 +2595,7 @@ local optionsSlash = {
|
||||
type = "execute",
|
||||
name = L["Toggle Omen"],
|
||||
desc = L["Toggle Omen"].." ( /omen toggle )",
|
||||
func = function()
|
||||
Omen:Toggle()
|
||||
end,
|
||||
func = function() Omen:Toggle() end,
|
||||
},
|
||||
center = {
|
||||
type = "execute",
|
||||
@@ -2596,9 +2611,7 @@ local optionsSlash = {
|
||||
type = "execute",
|
||||
name = L["Configure"],
|
||||
desc = L["Open the configuration dialog"].." ( /omen config )",
|
||||
func = function()
|
||||
Omen:ShowConfig()
|
||||
end,
|
||||
func = function() Omen:ShowConfig() end,
|
||||
guiHidden = true,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user