From 7a2d7ee6dd3d6c6af3d77c147f751a677c678acc Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 23 May 2020 12:43:44 -0300 Subject: [PATCH] Added options to not show while in Battlegrounds --- Libs/DF/dropdown.lua | 64 ++++++++++++++++++------ Libs/DF/fw.lua | 100 +++++++++++++++++++++++++++++++++++-- gumps/janela_options.lua | 16 +++--- gumps/janela_principal.lua | 9 +++- 4 files changed, 163 insertions(+), 26 deletions(-) diff --git a/Libs/DF/dropdown.lua b/Libs/DF/dropdown.lua index 46830ba98..cb0d37865 100644 --- a/Libs/DF/dropdown.lua +++ b/Libs/DF/dropdown.lua @@ -510,7 +510,7 @@ end function DropDownMetaFunctions:Open() self.dropdown.dropdownframe:Show() self.dropdown.dropdownborder:Show() - self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down") + --self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down") self.opened = true if (last_opened) then last_opened:Close() @@ -525,7 +525,7 @@ function DropDownMetaFunctions:Close() return end self.dropdown.dropdownframe:Hide() - self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up") + --self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up") local selectedTexture = _G [self:GetName() .. "_ScrollFrame_ScrollChild_SelectedTexture"] selectedTexture:Hide() @@ -614,8 +614,8 @@ function DetailsFrameworkDropDownOnMouseDown (button) _this_row = DF:CreateDropdownButton (parent, name) local anchor_i = i-1 - _this_row:SetPoint ("topleft", parent, "topleft", 5, (-anchor_i*20)-5) - _this_row:SetPoint ("topright", parent, "topright", -5, (-anchor_i*20)-5) + _this_row:SetPoint ("topleft", parent, "topleft", 1, (-anchor_i*20)-0) + _this_row:SetPoint ("topright", parent, "topright", 0, (-anchor_i*20)-0) _this_row.object = object object.menus [i] = _this_row end @@ -730,7 +730,7 @@ function DetailsFrameworkDropDownOnMouseDown (button) object:ShowScroll() scrollFrame:EnableMouseWheel (true) object.scroll:Altura (size-35) - object.scroll:SetMinMaxValues (0, (showing*20) - size + 20) + object.scroll:SetMinMaxValues (0, (showing*20) - size + 2) --width scrollBorder:SetWidth (frame_witdh+20) scrollFrame:SetWidth (frame_witdh+20) @@ -757,12 +757,12 @@ function DetailsFrameworkDropDownOnMouseDown (button) scrollFrame:SetWidth (frame_witdh) scrollChild:SetWidth (frame_witdh) --height - scrollBorder:SetHeight ((showing*20) + 10) - scrollFrame:SetHeight ((showing*20) + 10) + scrollBorder:SetHeight ((showing*20) + 1) + scrollFrame:SetHeight ((showing*20) + 1) --mouse over texture - mouseOverTexture:SetWidth (frame_witdh-10) + mouseOverTexture:SetWidth (frame_witdh - 1) --selected - selectedTexture:SetWidth (frame_witdh - 9) + selectedTexture:SetWidth (frame_witdh - 1) for index, row in ipairs (object.menus) do row:SetPoint ("topright", scrollChild, "topright", -5, ((-index-1)*20)-5) @@ -883,6 +883,8 @@ end ------------------------------------------------------------------------------------------------------------ function DropDownMetaFunctions:SetTemplate (template) + self.template = template + if (template.width) then self:SetWidth (template.width) end @@ -923,7 +925,41 @@ function DropDownMetaFunctions:SetTemplate (template) local r, g, b, a = DF:ParseColors (template.onleavebordercolor) self.onleave_backdrop_border_color = {r, g, b, a} end - + + self:RefreshDropIcon() +end + +function DropDownMetaFunctions:RefreshDropIcon() + local template = self.template + + if (not template) then + return + end + + if (template.dropicon) then + self.dropdown.arrowTexture:SetTexture(template.dropicon) + self.dropdown.arrowTexture2:SetTexture(template.dropicon) + + if (template.dropiconsize) then + self.dropdown.arrowTexture:SetSize(unpack(template.dropiconsize)) + self.dropdown.arrowTexture2:SetSize(unpack(template.dropiconsize)) + end + + if (template.dropiconcoords) then + self.dropdown.arrowTexture:SetTexCoord(unpack(template.dropiconcoords)) + else + self.dropdown.arrowTexture:SetTexCoord(0, 1, 0, 1) + end + + if (template.dropiconpoints) then + self.dropdown.arrowTexture:ClearAllPoints() + self.dropdown.arrowTexture2:ClearAllPoints() + self.dropdown.arrowTexture:SetPoint("right", self.dropdown, "right", unpack(template.dropiconpoints)) + self.dropdown.arrowTexture2:SetPoint("right", self.dropdown, "right", unpack(template.dropiconpoints)) + end + + + end end ------------------------------------------------------------------------------------------------------------ @@ -1074,8 +1110,8 @@ function DF:CreateNewDropdownFrame (parent, name) f:SetSize (150, 20) local statusbar = f:CreateTexture ("$parent_StatusBarTexture", "BACKGROUND") - statusbar:SetPoint ("topleft", f, "topleft", 3, -3) - statusbar:SetPoint ("bottomright", f, "bottomright", -3, 3) + statusbar:SetPoint ("topleft", f, "topleft", 0, 0) + statusbar:SetPoint ("bottomright", f, "bottomright", 0, 0) f.statusbar = statusbar local icon = f:CreateTexture ("$parent_IconTexture", "ARTWORK") @@ -1172,8 +1208,8 @@ function DF:CreateDropdownButton (parent, name) f:SetSize (150, 20) local statusbar = f:CreateTexture ("$parent_StatusBarTexture", "ARTWORK") - statusbar:SetPoint ("left", f, "left", 1, 0) - statusbar:SetPoint ("right", f, "right", -10, 0) + statusbar:SetPoint ("topleft", f, "topleft", 0, 0) + statusbar:SetPoint ("bottomright", f, "bottomright", 0, 0) statusbar:SetSize (150, 20) statusbar:SetTexture ([[Interface\Tooltips\UI-Tooltip-Background]]) f.statusbar = statusbar diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 2c395d373..592809457 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 180 +local dversion = 181 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -2049,11 +2049,22 @@ DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font DF.dropdown_templates = DF.dropdown_templates or {} DF.dropdown_templates ["OPTIONS_DROPDOWN_TEMPLATE"] = { - backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, - backdropcolor = {1, 1, 1, .5}, + backdrop = { + edgeFile = [[Interface\Buttons\WHITE8X8]], + edgeSize = 1, + bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], + tileSize = 64, + tile = true + }, + + backdropcolor = {1, 1, 1, .7}, backdropbordercolor = {0, 0, 0, 1}, - onentercolor = {1, 1, 1, .5}, + onentercolor = {1, 1, 1, .9}, onenterbordercolor = {1, 1, 1, 1}, + + dropicon = "Interface\\BUTTONS\\arrow-Down-Down", + dropiconsize = {16, 16}, + dropiconpoints = {-2, -3}, } -- switches @@ -3665,6 +3676,87 @@ DF.BattlegroundSizes = { [1803] = 10, --Seething Shore } +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +--> execute range + + function DF.GetExecuteRange(unitId) + unitId = unitId or "player" + + local classLoc, class = UnitClass(unitId) + local spec = GetSpecialization() + + if (spec and class) then + --prist + if (class == "PRIEST") then + --playing as shadow? + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + if (specID == 258) then --shadow + local _, _, _, using_SWDeath = GetTalentInfo(5, 2, 1) + if (using_SWDeath) then + return 0.20 + end + end + end + + elseif (class == "MAGE") then + --playing fire mage? + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + if (specID == 63) then --fire + local _, _, _, using_SearingTouch = GetTalentInfo(1, 3, 1) + if (using_SearingTouch) then + return 0.30 + end + end + end + + elseif (class == "WARRIOR") then + --is playing as a Arms warrior? + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + + if (specID == 71) then --arms + local _, _, _, using_Massacre = GetTalentInfo(3, 1, 1) + if (using_Massacre) then + --if using massacre, execute can be used at 35% health in Arms spec + return 0.35 + end + end + + if (specID == 71 or specID == 72) then --arms or fury + return 0.20 + end + end + + elseif (class == "HUNTER") then + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + if (specID == 253) then --beast mastery + --> is using killer instinct? + local _, _, _, using_KillerInstinct = GetTalentInfo(1, 1, 1) + if (using_KillerInstinct) then + return 0.35 + end + end + end + + elseif (class == "PALADIN") then + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + if (specID == 70) then --retribution paladin + --> is using hammer of wrath? + local _, _, _, using_HammerOfWrath = GetTalentInfo(2, 3, 1) + if (using_HammerOfWrath) then + return 0.20 + end + end + end + end + end + end + + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --> delta seconds reader diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index a531093f7..c70a05246 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -2571,14 +2571,16 @@ function window:CreateFrame17() _detalhes:SendOptionsModifiedEvent (DetailsOptionsWindow.instance) end + local texCoords = {.9, 0.1, 0.1, .9} local typeCombatAlpha = { - {value = 1, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_1"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_03", texcoord = {1, 0, 0, 1}, color = "gray"}, - {value = 2, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_2"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}}, - {value = 3, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_3"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}}, - {value = 4, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_4"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}}, - {value = 5, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_5"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}}, - {value = 6, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_6"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}}, - {value = 7, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_7"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = {1, 0, 0, 1}, desc = Loc ["STRING_OPTIONS_COMBAT_ALPHA_6"] .. " + " .. Loc ["STRING_OPTIONS_COMBAT_ALPHA_3"]}, + {value = 1, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_1"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_03", texcoord = texCoords, color = "gray"}, + {value = 2, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_2"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords}, + {value = 3, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_3"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords}, + {value = 4, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_4"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords}, + {value = 5, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_5"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords}, + {value = 6, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_6"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords}, + {value = 7, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_7"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords, desc = Loc ["STRING_OPTIONS_COMBAT_ALPHA_6"] .. " + " .. Loc ["STRING_OPTIONS_COMBAT_ALPHA_3"]}, + {value = 8, label = "In Battlegound", onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords}, } local buildTypeCombatAlpha = function() return typeCombatAlpha diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index e74731be1..26c8ec5c0 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -7463,7 +7463,14 @@ function _detalhes:SetCombatAlpha (modify_type, alpha_amount, interacting) elseif (self.hide_in_combat_type == 7) then --"Raid Debug" = Out of Combat and Inside Raid or Dungeon _detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAndGroupAlpha", 0.3, self) - + + elseif (self.hide_in_combat_type == 8) then --"In Battlegrounds" + local isInInstance = IsInInstance() + if (isInInstance or _detalhes.zone_type == "pvp") then + self:SetWindowAlphaForCombat (true, true) --> hida a janela + else + self:SetWindowAlphaForCombat (false) --> deshida a janela + end end return