Skip to content

Commit

Permalink
Added options to not show while in Battlegrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed May 23, 2020
1 parent 8350ea2 commit 7a2d7ee
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 26 deletions.
64 changes: 50 additions & 14 deletions Libs/DF/dropdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -883,6 +883,8 @@ end
------------------------------------------------------------------------------------------------------------
function DropDownMetaFunctions:SetTemplate (template)

self.template = template

if (template.width) then
self:SetWidth (template.width)
end
Expand Down Expand Up @@ -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

------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
100 changes: 96 additions & 4 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

local dversion = 180
local dversion = 181

local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
16 changes: 9 additions & 7 deletions gumps/janela_options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion gumps/janela_principal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

This comment has been minimized.

Copy link
@BradCOnGitHub

BradCOnGitHub May 24, 2020

"or" should be "and" I think

self:SetWindowAlphaForCombat (true, true) --> hida a janela
else
self:SetWindowAlphaForCombat (false) --> deshida a janela
end
end

return
Expand Down

0 comments on commit 7a2d7ee

Please sign in to comment.