From 7ca1b5967bc039b11239e99a91f86dd0004b7b68 Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Mon, 11 Mar 2024 15:57:11 -0700 Subject: [PATCH] Skins/Spellbook: Update spellbook for new profession tab --- ElvUI/Modules/Skins/Blizzard/Spellbook.lua | 146 +++++---------------- 1 file changed, 31 insertions(+), 115 deletions(-) diff --git a/ElvUI/Modules/Skins/Blizzard/Spellbook.lua b/ElvUI/Modules/Skins/Blizzard/Spellbook.lua index 4be9d37..aaf85df 100644 --- a/ElvUI/Modules/Skins/Blizzard/Spellbook.lua +++ b/ElvUI/Modules/Skins/Blizzard/Spellbook.lua @@ -13,22 +13,17 @@ S:AddCallback("Skin_Spellbook", function() if not E.private.skins.blizzard.enable or not E.private.skins.blizzard.spellbook then return end -- AscensionSpellbook - - AscensionSpellbookFrame:StripTextures(true) - AscensionSpellbookFrame:CreateBackdrop("Transparent") - --AscensionSpellbookFrame:Size -- for later on, the spells will need to be moved as well + AscensionSpellbookFrame:SetWidth(500) AscensionSpellbookFrameNineSlice:StripTextures(true) - --AscensionSpellbookFrameNineSlice:CreateBackdrop("Transparent") + AscensionSpellbookFrame:StripTextures(true) + AscensionSpellbookFramePortraitFrame:StripTextures(true) AscensionSpellbookFrameInsetNineSlice:StripTextures(true) - AscensionSpellbookFrameInset:StripTextures(true) - AscensionSpellbookFrameInset:CreateBackdrop("Transparent") + AscensionSpellbookFrame:CreateBackdrop("Transparent") AscensionSpellbookFrame:RegisterForDrag("LeftButton") AscensionSpellbookFrame:SetMovable(true) AscensionSpellbookFrame:SetScript("OnDragStart", function(self) self:StartMoving() end) AscensionSpellbookFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) - - -- AscensionSpellbookFrame:SetScale(0.9) for i = 1, 3 do local tab = _G["AscensionSpellbookFrameTab"..i] @@ -82,28 +77,39 @@ S:AddCallback("Skin_Spellbook", function() tab:GetNormalTexture():SetTexCoord(unpack(E.TexCoords)) end - AscensionSpellbookFrameSideBarTab1:Point("TOPLEFT", AscensionSpellbookFrame, "TOPRIGHT", 0, -40) - - for i = 2, MAX_SKILLLINE_TABS do - local tab = _G["AscensionSpellbookFrameSideBarTab"..i] - local previous = _G["AscensionSpellbookFrameSideBarTab"..i - 1] - - tab:SetPoint("TOPLEFT", previous, "BOTTOMLEFT", 0, -8) - end - SpellBookPageText:SetTextColor(1, 1, 1) --Professions AscensionSpellbookFrameContentProfessions:StripTextures(true) - for i = 1, 5 do - local professions = _G["AscensionSpellbookFrameContentProfessionsProfession"..i] - --_G["AscensionSpellbookFrameContentProfessionsProfession"..i.."MainSpellIconTexture"]:SetTexCoord(unpack(E.TexCoords)) - --_G["AscensionSpellbookFrameContentProfessionsProfession"..i.."ExtraSpellIconTexture"]:SetTexCoord(unpack(E.TexCoords)) - S:HandleStatusBar(_G["AscensionSpellbookFrameContentProfessionsProfession"..i.."StatusBar"]) - professions.MissingText:FontTemplate(nil,12) - professions.MissingText:SetTextColor(1, 1, 1) + for _, button in ipairs(AscensionSpellbookFrameContentProfessions.professionButtons) do + hooksecurefunc(button, "SetProfession", function(button, skillID) + local _, _, icon = ProfessionUtil.GetProfessionByID(skillID) + button.Icon:SetTexture(icon) + button.Icon:SetTexCoord(unpack(E.TexCoords)) + for extraButton in button.ExtraButtonPool:EnumerateActive() do + local extraIcon = select(3, GetSpellInfo(extraButton.spellID)) + extraButton.Icon:SetTexture(extraIcon) + extraButton.Icon:SetTexCoord(unpack(E.TexCoords)) + extraButton.IconBorder:StripTextures() + extraButton.Highlight:StripTextures() + end + + if button:IsEnabled() == 0 then + button.Icon:SetAlpha(0.7) + button.Icon:SetDesaturated(true) + else + button.Icon:SetAlpha(1) + button.Icon:SetDesaturated(false) + end + end) + S:HandleIcon(button.Icon) + button.IconBorder:StripTextures() + button.Highlight:StripTextures() + S:HandleStatusBar(button.ProgressBar) + S:HandleCloseButton(button.AbandonButton) + button.ProgressBar.RankText:SetPoint("CENTER", 0, 0) end -- Pet Tab @@ -119,94 +125,4 @@ S:AddCallback("Skin_Spellbook", function() E:RegisterCooldown(_G["AscensionSpellbookFrameContentPetSpellsSpellButton"..i.."Cooldown"]) end - - - - -- Blizz Spellbook (Leaving here for now) - SpellBookFrame:StripTextures(true) - SpellBookFrame:CreateBackdrop("Transparent") - SpellBookFrame.backdrop:Point("TOPLEFT", 11, -12) - SpellBookFrame.backdrop:Point("BOTTOMRIGHT", -32, 76) - - S:SetUIPanelWindowInfo(SpellBookFrame, "width", nil, 32) - S:SetBackdropHitRect(SpellBookFrame) - ---[[ - SpellBookFrame:EnableMouseWheel(true) - SpellBookFrame:SetScript("OnMouseWheel", function(_, value) - --do nothing if not on an appropriate book type - if SpellBookFrame.bookType ~= BOOKTYPE_SPELL then - return - end - - local currentPage, maxPages = SpellBook_GetCurrentPage() - - if value > 0 then - if currentPage > 1 then - SpellBookPrevPageButton_OnClick() - end - else - if currentPage < maxPages then - SpellBookNextPageButton_OnClick() - end - end - end) -]] - - for i = 1, 3 do - local tab = _G["SpellBookFrameTabButton"..i] - tab:Size(122, 32) - tab:GetNormalTexture():SetTexture(nil) - tab:GetDisabledTexture():SetTexture(nil) - tab:GetRegions():SetPoint("CENTER", 0, 2) - S:HandleTab(tab) - end - - SpellBookFrameTabButton1:Point("CENTER", SpellBookFrame, "BOTTOMLEFT", 72, 62) - SpellBookFrameTabButton2:Point("LEFT", SpellBookFrameTabButton1, "RIGHT", -15, 0) - SpellBookFrameTabButton3:Point("LEFT", SpellBookFrameTabButton2, "RIGHT", -15, 0) - - S:HandleNextPrevButton(SpellBookPrevPageButton, nil, nil, true) - S:HandleNextPrevButton(SpellBookNextPageButton, nil, nil, true) - - S:HandleCloseButton(SpellBookCloseButton, SpellBookFrame.backdrop) - - S:HandleCheckBox(ShowAllSpellRanksCheckBox) - - for i = 1, SPELLS_PER_PAGE do - local button = _G["SpellButton"..i] - local autoCast = _G["SpellButton"..i.."AutoCastable"] - button:StripTextures() - - autoCast:SetTexture("Interface\\Buttons\\UI-AutoCastableOverlay") - autoCast:SetOutside(button, 16, 16) - - button:CreateBackdrop("Default", true) - - _G["SpellButton"..i.."IconTexture"]:SetTexCoord(unpack(E.TexCoords)) - - E:RegisterCooldown(_G["SpellButton"..i.."Cooldown"]) - end - - hooksecurefunc("SpellButton_UpdateButton", function(self) - local name = self:GetName() - _G[name.."SpellName"]:SetTextColor(1, 0.80, 0.10) - _G[name.."SubSpellName"]:SetTextColor(1, 1, 1) - _G[name.."Highlight"]:SetTexture(1, 1, 1, 0.3) - end) - - for i = 1, MAX_SKILLLINE_TABS do - local tab = _G["SpellBookSkillLineTab"..i] - - tab:StripTextures() - tab:StyleButton(nil, true) - tab:SetTemplate("Default", true) - - tab:GetNormalTexture():SetInside() - tab:GetNormalTexture():SetTexCoord(unpack(E.TexCoords)) - end - - SpellBookSkillLineTab1:Point("TOPLEFT", SpellBookFrame, "TOPRIGHT", -33, -65) - - SpellBookPageText:SetTextColor(1, 1, 1) end) \ No newline at end of file