From d545f1216ed75faa60606e6904d57d94cbabd7bc Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 28 Jun 2020 15:23:50 -0300 Subject: [PATCH] Fixes on the new feature Auto Hide --- boot.lua | 4 +- classes/container_combatentes.lua | 3 + core/parser.lua | 5 +- gumps/janela_options.lua | 5 ++ gumps/janela_principal.lua | 131 ++++++++++-------------------- 5 files changed, 59 insertions(+), 89 deletions(-) diff --git a/boot.lua b/boot.lua index d3249c93..0d7ba6e0 100644 --- a/boot.lua +++ b/boot.lua @@ -4,8 +4,8 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 7343 - _detalhes.alpha_build_counter = 7343 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 7344 + _detalhes.alpha_build_counter = 7344 --if this is higher than the regular counter, use it instead _detalhes.game_version = "v8.3.0" _detalhes.userversion = "v8.3.0." .. _detalhes.build_counter _detalhes.realversion = 141 --core version, this is used to check API version for scripts and plugins (see alias below) diff --git a/classes/container_combatentes.lua b/classes/container_combatentes.lua index 4c541d68..8029745c 100644 --- a/classes/container_combatentes.lua +++ b/classes/container_combatentes.lua @@ -23,6 +23,9 @@ local AddUnique = DetailsFramework.table.addunique --framework local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned --framework + + local GetNumDeclensionSets = _G.GetNumDeclensionSets + local DeclineName = _G.DeclineName local GetLocale = _G.GetLocale ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/core/parser.lua b/core/parser.lua index 3c537859..6abf2fed 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -1639,10 +1639,13 @@ end --print () - + --petTable:Add _detalhes.tabela_pets:Adicionar (alvo_serial, alvo_name, alvo_flags, who_serial, who_name, who_flags) --print ("SUMMON", alvo_name, _detalhes.tabela_pets.pets, _detalhes.tabela_pets.pets [alvo_serial], alvo_serial) + + --debug summons: + --print("summon:", who_name, alvo_serial, alvo_name, alvo_flags, spellid, spellName) return end diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index 06f5fcca..ee69ddcc 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -2676,6 +2676,11 @@ function window:CreateFrame17() line.reverseCheckbox = reverseCheckbox line.alphaSlider = alphaSlider + --disable the invert checkbox for some options + if (i == 1 or i == 2 or i == 4 or i == 5 or i == 6) then + reverseCheckbox:Disable() + end + frame17.AutoHideOptions[i] = line end diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 60d7bcaa..4a125cda 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -5044,7 +5044,7 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alpha end end else - amount = self.color [4] + amount = self.color[4] menuamount = 1 rowsamount = 1 end @@ -5069,7 +5069,7 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alpha self.baseframe:Show() self.baseframe:SetAlpha (1) - self:InstanceAlpha (amount) + self:InstanceAlpha (min (amount, self.color[4])) gump:Fade (self.rowframe, "ALPHAANIM", rowsamount) gump:Fade (self.baseframe, "ALPHAANIM", rowsamount) self:SetIconAlpha (menuamount) @@ -7400,46 +7400,28 @@ function _detalhes:UpdateClickThrough() end end ---endd - function _detalhes:DelayedCheckCombatAlpha (instance, alpha) - if ((UnitAffectingCombat("player") or InCombatLockdown())) then + if (UnitAffectingCombat("player") or InCombatLockdown()) then instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela - else - instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela end end function _detalhes:DelayedCheckOutOfCombatAlpha (instance, alpha) - if (UnitAffectingCombat("player") or InCombatLockdown()) then - instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela - else + if (not UnitAffectingCombat("player") and not InCombatLockdown()) then instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela end end -function _detalhes:DelayedCheckOutOfCombatAndGroupAlpha (instance, alpha, invert) +function _detalhes:DelayedCheckOutOfCombatAndGroupAlpha (instance, alpha) if ((_detalhes.zone_type == "raid" or _detalhes.zone_type == "party") and IsInInstance()) then - if (invert) then - if (UnitAffectingCombat("player") or InCombatLockdown()) then - instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela - instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela - else - instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela - end + if (UnitAffectingCombat("player") or InCombatLockdown()) then + instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela else - if (UnitAffectingCombat("player") or InCombatLockdown()) then - instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela - else - instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela - instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela - end + instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela + instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela end - else - instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela - instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela end end @@ -7462,137 +7444,114 @@ function _detalhes:AdjustAlphaByContext(interacting) --not in group if (self.hide_on_context[3].enabled) then - hasRuleEnabled = true - if (_detalhes.in_group) then - if (self.hide_on_context[3].inverse) then + if (self.hide_on_context[3].inverse) then + --while in group + if (_detalhes.in_group) then self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 3)) --> hida a janela self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 3)) --> hida a janela - else - self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 3)) --> deshida a janela + hasRuleEnabled = true end else - if (self.hide_on_context[3].inverse) then - self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 3)) --> deshida a janela - else + --while not in group + if (not _detalhes.in_group) then self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 3)) --> hida a janela self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 3)) --> hida a janela + hasRuleEnabled = true end end end --while not inside instance if (self.hide_on_context[4].enabled) then - hasRuleEnabled = true local isInInstance = IsInInstance() - if (not self.hide_on_context[4].inverse) then - if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then - self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 4)) --> deshida a janela - else - self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela - self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela - end - else - if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then - self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela - self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela - else - self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 4)) --> deshida a janela - end + if (not isInInstance or (not _detalhes.zone_type == "raid" and not _detalhes.zone_type == "party")) then + self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela + self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela + hasRuleEnabled = true end end --while inside instance if (self.hide_on_context[5].enabled) then - hasRuleEnabled = true local isInInstance = IsInInstance() - if (not self.hide_on_context[5].inverse) then - if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then - self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela - self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela - else - self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 5)) --> deshida a janela - end - else - if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then - self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 5)) --> deshida a janela - else - self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela - self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela - end + if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then + self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela + self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela + hasRuleEnabled = true end end --raid debug (inside instance + out of combat) if (self.hide_on_context[6].enabled) then - hasRuleEnabled = true - _detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAndGroupAlpha", 0.3, self, getAlphaByContext(self, 6), self.hide_on_context[6].inverse) + if ((_detalhes.zone_type == "raid" or _detalhes.zone_type == "party") and IsInInstance()) then + _detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAndGroupAlpha", 0.3, self, getAlphaByContext(self, 6)) + end end --in battleground if (self.hide_on_context[7].enabled) then - hasRuleEnabled = true local isInInstance = IsInInstance() if (isInInstance and _detalhes.zone_type == "pvp") then + --player is inside a battleground if (not self.hide_on_context[7].inverse) then self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 7)) --> hida a janela self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 7)) --> hida a janela else self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 7)) --> deshida a janela end + hasRuleEnabled = true + else + --player is not inside a battleground if (not self.hide_on_context[7].inverse) then - self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 7)) --> deshida a janela + --there's no inverse rule: do nothing + --self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 7)) --> deshida a janela else self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 7)) --> hida a janela self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 7)) --> hida a janela + hasRuleEnabled = true end end end --mythic+ if (self.hide_on_context[8].enabled) then - hasRuleEnabled = true - if (_G.DetailsMythicPlusFrame.IsDoingMythicDungeon) then + if (_G.DetailsMythicPlusFrame and _G.DetailsMythicPlusFrame.IsDoingMythicDungeon) then + --player is inside a dungeon mythic+ if (not self.hide_on_context[8].inverse) then self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 8)) --> hida a janela self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 8)) --> hida a janela else self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 8)) --> deshida a janela end + hasRuleEnabled = true + else if (not self.hide_on_context[8].inverse) then - self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 8)) --> deshida a janela + --there's no inverse rule: do nothing + --self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 8)) --> deshida a janela else self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 8)) --> hida a janela self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 8)) --> hida a janela + hasRuleEnabled = true end end end --in combat if (self.hide_on_context[1].enabled) then - if (self.hide_on_context[1].inverse) then - _detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAlpha", 0.3, self, getAlphaByContext(self, 1)) - else - _detalhes:ScheduleTimer ("DelayedCheckCombatAlpha", 0.3, self, getAlphaByContext(self, 1)) - end - hasRuleEnabled = true + _detalhes:ScheduleTimer ("DelayedCheckCombatAlpha", 0.3, self, getAlphaByContext(self, 1)) end --out of combat if (self.hide_on_context[2].enabled) then - hasRuleEnabled = true - if (self.hide_on_context[2].inverse) then - _detalhes:ScheduleTimer ("DelayedCheckCombatAlpha", 0.3, self, getAlphaByContext(self, 2)) - else - _detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAlpha", 0.3, self, getAlphaByContext(self, 2)) - end + _detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAlpha", 0.3, self, getAlphaByContext(self, 2)) end --if no rule is enabled, show the window if (not hasRuleEnabled) then - self:SetWindowAlphaForCombat (true, true, 100) - self:SetWindowAlphaForCombat (true, true, 100) + self:SetWindowAlphaForCombat(false) + self:SetWindowAlphaForCombat(false) end end