From 14def8a1719073ff27e14efebc8b6b8f52df9953 Mon Sep 17 00:00:00 2001 From: Xinhuan Date: Fri, 31 Oct 2008 14:45:16 +0800 Subject: [PATCH] Rewrite Auto Show/Hide options to be more intuitive. Add option not to use Auto Show/Hide. --- Localization/deDE.lua | 12 +-- Localization/enUS.lua | 12 +-- Localization/frFR.lua | 12 +-- Localization/koKR.lua | 12 +-- Localization/zhCN.lua | 12 +-- Localization/zhTW.lua | 12 +-- Omen.lua | 186 +++++++++++++++++++++++------------------- 7 files changed, 140 insertions(+), 118 deletions(-) diff --git a/Localization/deDE.lua b/Localization/deDE.lua index 188ffe1..e004535 100644 --- a/Localization/deDE.lua +++ b/Localization/deDE.lua @@ -81,6 +81,8 @@ L["Control the font size of the title text"] = "Die Schriftgröße des Titeltext -- Config strings, show when... section L["Show When..."] = "Zeige wenn..." L["Show Omen when..."] = "Zeige Omen wenn..." +L["This section controls when Omen is automatically shown or hidden."] = true +L["Use Auto Show/Hide"] = true L["Show Omen when any of the following are true"] = "Zeige Omen wenn ein beliebiges der folgenden wahr ist" L["You have a pet"] = "Ich einen Begleiter habe" L["Show Omen when you have a pet out"] = "Zeige Omen wenn ich einen Begleiter habe" @@ -90,14 +92,12 @@ L["You are in a party"] = "Ich in einer Gruppe bin" L["Show Omen when you are in a 5-man party"] = "Zeige Omen wenn ich einer 5er Gruppe bin" L["You are in a raid"] = "Ich in einem Schlachtzug bin" L["Show Omen when you are in a raid"] = "Zeige Omen wenn ich in einer Schlachtzuggruppe bin" +L["However, hide Omen if any of the following are true (higher priority than the above)."] = true L["You are resting"] = "Ich mich ausruhe" -L["Show Omen when you are resting"] = "Zeige Omen wenn ich mich ausruhe" +L["Turning this on will cause Omen to hide whenever you are in a city or inn."] = true 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 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" -- Config strings, show classes... section diff --git a/Localization/enUS.lua b/Localization/enUS.lua index dac64ca..aaa041c 100644 --- a/Localization/enUS.lua +++ b/Localization/enUS.lua @@ -81,6 +81,8 @@ L["Control the font size of the title text"] = true -- Config strings, show when... section L["Show When..."] = true L["Show Omen when..."] = true +L["This section controls when Omen is automatically shown or hidden."] = true +L["Use Auto Show/Hide"] = true L["Show Omen when any of the following are true"] = true L["You have a pet"] = true L["Show Omen when you have a pet out"] = true @@ -90,14 +92,12 @@ L["You are in a party"] = true L["Show Omen when you are in a 5-man party"] = true L["You are in a raid"] = true L["Show Omen when you are in a raid"] = true +L["However, hide Omen if any of the following are true (higher priority than the above)."] = true L["You are resting"] = true -L["Show Omen when you are resting"] = true +L["Turning this on will cause Omen to hide whenever you are in a city or inn."] = true 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 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 -- Config strings, show classes... section diff --git a/Localization/frFR.lua b/Localization/frFR.lua index 891f5ee..c17e769 100644 --- a/Localization/frFR.lua +++ b/Localization/frFR.lua @@ -81,6 +81,8 @@ L["Control the font size of the title text"] = "Contrôle la taille de la police -- Config strings, show when... section L["Show When..."] = "Afficher quand…" L["Show Omen when..."] = "Afficher Omen quand…" +L["This section controls when Omen is automatically shown or hidden."] = true +L["Use Auto Show/Hide"] = true L["Show Omen when any of the following are true"] = "Affiche Omen quand l'une des conditions suivantes est vraie." L["You have a pet"] = "Vous avez un familier" L["Show Omen when you have a pet out"] = "Affiche Omen quand un familier est à vos côtés." @@ -90,14 +92,12 @@ L["You are in a party"] = "Vous êtes en groupe" L["Show Omen when you are in a 5-man party"] = "Affiche Omen quand vous êtes dans un groupe de 5 joueurs." L["You are in a raid"] = "Vous êtes dans un raid" L["Show Omen when you are in a raid"] = "Affiche Omen quand vous êtes dans un raid." +L["However, hide Omen if any of the following are true (higher priority than the above)."] = true L["You are resting"] = "Vous vous reposez" -L["Show Omen when you are resting"] = "Affiche Omen quand vous êtes en repos." +L["Turning this on will cause Omen to hide whenever you are in a city or inn."] = true L["You are in a battleground"] = "Vous êtes ds un CdB" -L["Show Omen when you are in a battleground or arena"] = "Affiche Omen quand vous êtes dans un champ de bataille ou une arène." -L["You are in a dungeon"] = "Vous êtes ds un donjon" -L["Show Omen when you are in a dungeon (5 man and raid)"] = "Affiche Omen quand vous êtes dans un donjon (à 5 ou en raid)." -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 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 -- Config strings, show classes... section diff --git a/Localization/koKR.lua b/Localization/koKR.lua index 2ad869a..05a6253 100644 --- a/Localization/koKR.lua +++ b/Localization/koKR.lua @@ -81,6 +81,8 @@ L["Control the font size of the title text"] = "제목 문자 글꼴 크기" -- Config strings, show when... section L["Show When..."] = "표시 방법..." L["Show Omen when..."] = "Omen을 언제 표시할지..." +L["This section controls when Omen is automatically shown or hidden."] = true +L["Use Auto Show/Hide"] = true L["Show Omen when any of the following are true"] = "선택한 항목에 따라 Omen을 표시합니다." L["You have a pet"] = "소환수를 가졌을때" L["Show Omen when you have a pet out"] = "소환수를 가진 경우에 Omen을 표시합니다" @@ -90,14 +92,12 @@ L["You are in a party"] = "파티 참여" L["Show Omen when you are in a 5-man party"] = "5인 파티일 경우에 Omen을 표시합니다." L["You are in a raid"] = "공격대 참여" L["Show Omen when you are in a raid"] = "공격대일 경우에 Omen을 표시합니다." +L["However, hide Omen if any of the following are true (higher priority than the above)."] = true L["You are resting"] = "휴식 상태시" -L["Show Omen when you are resting"] = "휴식 상태일 경우에 Omen을 표시합니다." +L["Turning this on will cause Omen to hide whenever you are in a city or inn."] = true L["You are in a battleground"] = "전장 참여" -L["Show Omen when you are in a battleground or arena"] = "전장 또는 투기장일 경우에 Omen을 표시합니다." -L["You are in a dungeon"] = "던전 입장" -L["Show Omen when you are in a dungeon (5 man and raid)"] = "던전(5인 또는 공격대) 입장 경우에 Omen을 표시합니다." -L["In addition to the above options..."] = "상기 옵션 외..." -L["Only show when in combat"] = "전투 중 항상 표시" +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을 숨깁니다." -- Config strings, show classes... section diff --git a/Localization/zhCN.lua b/Localization/zhCN.lua index b6ecbb7..7a4c246 100644 --- a/Localization/zhCN.lua +++ b/Localization/zhCN.lua @@ -81,6 +81,8 @@ L["Control the font size of the title text"] = "标题文本字体大小" -- Config strings, show when... section L["Show When..."] = "当何时显示" L["Show Omen when..."] = "当何时显示 Omen" +L["This section controls when Omen is automatically shown or hidden."] = true +L["Use Auto Show/Hide"] = true L["Show Omen when any of the following are true"] = "当符合以下条件时 Omen 会被显示" L["You have a pet"] = "有宠物" L["Show Omen when you have a pet out"] = "当你的宠物存在时显示 Omen" @@ -90,14 +92,12 @@ L["You are in a party"] = "有队伍" L["Show Omen when you are in a 5-man party"] = "当你在5人队伍中显示 Omen" L["You are in a raid"] = "有团队" L["Show Omen when you are in a raid"] = "当你在团队中显示 Omen" +L["However, hide Omen if any of the following are true (higher priority than the above)."] = true L["You are resting"] = "有空闲" -L["Show Omen when you are resting"] = "当你在空闲时显示 Omen" +L["Turning this on will cause Omen to hide whenever you are in a city or inn."] = true L["You are in a battleground"] = "在战场" -L["Show Omen when you are in a battleground or arena"] = "当你在战场或竞技场内时显示 Omen" -L["You are in a dungeon"] = "在副本" -L["Show Omen when you are in a dungeon (5 man and raid)"] = "当你在副本内时显示 Omen(5人或团队)" -L["In addition to the above options..."] = "除了上述选项……" -L["Only show when in combat"] = "只在战斗中显示" +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 会被隐藏。" -- Config strings, show classes... section diff --git a/Localization/zhTW.lua b/Localization/zhTW.lua index 7f30623..6af8308 100644 --- a/Localization/zhTW.lua +++ b/Localization/zhTW.lua @@ -81,6 +81,8 @@ L["Control the font size of the title text"] = "標題字體大小" -- Config strings, show when... section L["Show When..."] = "顯示時機" L["Show Omen when..."] = "顯示Omen的時機" +L["This section controls when Omen is automatically shown or hidden."] = true +L["Use Auto Show/Hide"] = true L["Show Omen when any of the following are true"] = "Omen會在以下條件中顯示" L["You have a pet"] = "你有寵物" L["Show Omen when you have a pet out"] = "在寵物存在時顯示Omen" @@ -90,14 +92,12 @@ L["You are in a party"] = "你在隊伍中" L["Show Omen when you are in a 5-man party"] = "在5人隊伍中顯示Omen" L["You are in a raid"] = "Raid中" L["Show Omen when you are in a raid"] = "當在Raid中時顯示Omen" +L["However, hide Omen if any of the following are true (higher priority than the above)."] = true L["You are resting"] = "你在測試" -L["Show Omen when you are resting"] = "在測試時顯示Omen" +L["Turning this on will cause Omen to hide whenever you are in a city or inn."] = true L["You are in a battleground"] = "你在戰場中" -L["Show Omen when you are in a battleground or arena"] = "在戰場或競技場裡顯示Omen" -L["You are in a dungeon"] = "副本內" -L["Show Omen when you are in a dungeon (5 man and raid)"] = "在副本內顯示Omen(5人或Raid)" -L["In addition to the above options..."] = "附加條件" -L["Only show when in combat"] = "只有在戰鬥中顯示" +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" -- Config strings, show classes... section diff --git a/Omen.lua b/Omen.lua index 999a597..ed9af57 100644 --- a/Omen.lua +++ b/Omen.lua @@ -137,14 +137,18 @@ local defaults = { AggroBarColor = {r = 1, g = 0, b = 0, a = 1,}, }, ShowWith = { + UseShowWith = true, Pet = true, Alone = false, Party = true, Raid = true, - Resting = false, - PVP = false, - Dungeon = true, - ShowOnlyInCombat = false, + --Resting = false, + --PVP = false, + --Dungeon = true, + --ShowOnlyInCombat = false, + HideWhileResting = true, + HideInPVP = true, + HideWhenOOC = false, }, FuBar = { HideMinimapButton = true, @@ -518,7 +522,7 @@ function Omen:OnEnable() self:RegisterEvent("PLAYER_UPDATE_RESTING", "UpdateVisible") self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateVisible") - if db.ShowWith.ShowOnlyInCombat then + if db.ShowWith.HideWhenOOC then self:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateVisible") self:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateVisible") end @@ -607,28 +611,27 @@ end function Omen:UpdateVisible(event) local t = db.ShowWith - if t.ShowOnlyInCombat and not InCombatLockdown() and event ~= "PLAYER_REGEN_DISABLED" then + if not t.UseShowWith 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) return end + -- Check for pet|party|raid|alone + local show = (t.Pet and UnitExists("pet")) or + (t.Party and inParty) or + (t.Raid and inRaid) or + (t.Alone and not inParty and not inRaid and not UnitExists("pet")) + + -- Then hide override if necessary for resting|pvp local inInstance, instanceType = IsInInstance() - local show - if not t.Resting and IsResting() then + if (t.HideWhileResting and IsResting()) or (t.HideInPVP and (instanceType == "pvp" or instanceType == "arena")) then show = false end - if not t.PVP and inInstance and (instanceType == "pvp" or instanceType == "arena") then - show = false - end - if not t.Dungeon and inInstance and (instanceType == "party" or instanceType == "raid") then - show = false - end - if show == nil then - 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 @@ -1863,73 +1866,92 @@ local options = { intro = { order = 1, type = "description", - name = L["Show Omen when any of the following are true"], + name = L["This section controls when Omen is automatically shown or hidden."], + disabled = false, }, - Alone = { + UseShowWith = { type = "toggle", order = 2, - name = L["You are alone"], - desc = L["Show Omen when you are alone"], + name = L["Use Auto Show/Hide"], + desc = L["Use Auto Show/Hide"], + disabled = false, }, - PVP = { - type = "toggle", + ShowWithGroup = { + type = "group", 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, + guiInline = true, + name = L["Use Auto Show/Hide"], + desc = L["Use Auto Show/Hide"], + disabled = function(info) return not db.ShowWith.UseShowWith end, + args = { + intro2 = { + order = 10, + type = "description", + name = L["Show Omen when any of the following are true"], + }, + Alone = { + type = "toggle", + order = 11, + name = L["You are alone"], + desc = L["Show Omen when you are alone"], + }, + Party = { + type = "toggle", + order = 12, + name = L["You are in a party"], + desc = L["Show Omen when you are in a 5-man party"], + }, + Raid = { + type = "toggle", + order = 13, + name = L["You are in a raid"], + desc = L["Show Omen when you are in a raid"], + }, + Pet = { + type = "toggle", + order = 14, + name = L["You have a pet"], + desc = L["Show Omen when you have a pet out"], + }, + intro3 = { + order = 20, + type = "description", + name = L["However, hide Omen if any of the following are true (higher priority than the above)."], + }, + HideInPVP = { + type = "toggle", + order = 21, + width = "double", + name = L["You are in a battleground"], + desc = L["Turning this on will cause Omen to hide whenever you are in a battleground or arena."], + }, + HideWhileResting = { + type = "toggle", + order = 22, + width = "double", + name = L["You are resting"], + desc = L["Turning this on will cause Omen to hide whenever you are in a city or inn."], + }, + HideWhenOOC = { + type = "toggle", + order = 23, + width = "double", + name = L["You are not in combat"], + desc = L["Turning this on will cause Omen to hide whenever you are not in combat."], + set = function(info, value) + db.ShowWith.HideWhenOOC = 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, + }, + }, }, }, },