Added option to merge pets at the Player Breakdown window

This commit is contained in:
Tercio Jose
2022-12-01 22:52:25 -03:00
parent cad2f6e619
commit f17f8642b7
4 changed files with 171 additions and 86 deletions
+61 -7
View File
@@ -114,7 +114,7 @@ end
--english alias
--window object from Details:GetWindow(n) and playerObject from Details:GetPlayer(playerName, attribute)
function Details:OpenPlayerBreakdown (windowObject, playerObject)
function Details:OpenPlayerBreakdown (windowObject, playerObject) --windowObject = instanceObject
windowObject:AbreJanelaInfo (playerObject)
end
@@ -161,15 +161,69 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo
end
end
local infoNumPoints = info:GetNumPoints()
for i = 1, infoNumPoints do
local a, b, c, d, e = info:GetPoint(i)
if (not b) then
info:ClearAllPoints()
if (not info.bHasInitialized) then
local infoNumPoints = info:GetNumPoints()
for i = 1, infoNumPoints do
local point1, anchorObject, point2, x, y = info:GetPoint(i)
if (not anchorObject) then
info:ClearAllPoints()
end
end
info:SetPoint("center", _G.UIParent, "center", 0, 0)
info:SetUserPlaced(false)
info:SetDontSavePosition(true)
info.bHasInitialized = true
end
info:SetPoint("center", _G.UIParent, "center", 0, 0)
if (not info.RightSideBar) then
info.RightSideBar = CreateFrame("frame", nil, info, "BackdropTemplate")
info.RightSideBar:SetWidth(20)
info.RightSideBar:SetPoint("topleft", info, "topright", 1, 0)
info.RightSideBar:SetPoint("bottomleft", info, "bottomright", 1, 0)
local rightSideBarAlpha = 0.75
DetailsFramework:ApplyStandardBackdrop(info.RightSideBar)
local toggleMergePlayerSpells = function()
Details.merge_player_abilities = not Details.merge_player_abilities
local playerObject = Details:GetPlayerObjectFromBreakdownWindow()
local instanceObject = Details:GetActiveWindowFromBreakdownWindow()
Details:OpenPlayerBreakdown(instanceObject, playerObject) --toggle
Details:OpenPlayerBreakdown(instanceObject, playerObject)
end
local mergePlayerSpellsCheckbox = DetailsFramework:CreateSwitch(info, toggleMergePlayerSpells, Details.merge_player_abilities, _, _, _, _, _, _, _, _, _, _, DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
mergePlayerSpellsCheckbox:SetAsCheckBox()
mergePlayerSpellsCheckbox:SetPoint("bottom", info.RightSideBar, "bottom", 0, 2)
local mergePlayerSpellsLabel = info.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal")
mergePlayerSpellsLabel:SetText("Merge Player Spells")
DetailsFramework:SetFontRotation(mergePlayerSpellsLabel, 90)
mergePlayerSpellsLabel:SetPoint("center", mergePlayerSpellsCheckbox.widget, "center", -6, mergePlayerSpellsCheckbox:GetHeight()/2 + mergePlayerSpellsLabel:GetStringWidth() / 2)
--
local toggleMergePetSpells = function()
Details.merge_pet_abilities = not Details.merge_pet_abilities
local playerObject = Details:GetPlayerObjectFromBreakdownWindow()
local instanceObject = Details:GetActiveWindowFromBreakdownWindow()
Details:OpenPlayerBreakdown(instanceObject, playerObject) --toggle
Details:OpenPlayerBreakdown(instanceObject, playerObject)
end
local mergePetSpellsCheckbox = DetailsFramework:CreateSwitch(info, toggleMergePetSpells, Details.merge_pet_abilities, _, _, _, _, _, _, _, _, _, _, DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
mergePetSpellsCheckbox:SetAsCheckBox(true)
mergePetSpellsCheckbox:SetPoint("bottom", info.RightSideBar, "bottom", 0, 160)
local mergePetSpellsLabel = info.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal")
mergePetSpellsLabel:SetText("Merge Pet Spells")
DetailsFramework:SetFontRotation(mergePetSpellsLabel, 90)
mergePetSpellsLabel:SetPoint("center", mergePetSpellsCheckbox.widget, "center", -6, mergePetSpellsCheckbox:GetHeight()/2 + mergePetSpellsLabel:GetStringWidth() / 2)
mergePlayerSpellsCheckbox:SetAlpha(rightSideBarAlpha)
mergePlayerSpellsLabel:SetAlpha(rightSideBarAlpha)
mergePetSpellsCheckbox:SetAlpha(rightSideBarAlpha)
mergePetSpellsLabel:SetAlpha(rightSideBarAlpha)
end
--passar os parmetros para dentro da tabela da janela.