From 31f668fd8924bf571c128866bd2a85e291feac0f Mon Sep 17 00:00:00 2001 From: Sattva Date: Sat, 20 May 2023 17:10:29 +0300 Subject: [PATCH] Revert "Revert "first attempt"" This reverts commit ae60d632046b44983379518335bcad2db23aebf5. --- Leatrix_Plus.lua | 241 +-- Leatrix_Plus.toc | 9 +- Leatrix_Plus_Library.lua | 18 +- Leatrix_Plus_Wrath.toc | 9 +- .../CallbackHandler-1.0.lua | 240 +++ .../CallbackHandler-1.0.xml | 4 + libs/LibCompat-1.0/Backdrop/Backdrop.lua | 523 +++++ libs/LibCompat-1.0/Backdrop/Backdrop.xml | 23 + libs/LibCompat-1.0/LibCompat-1.0.lua | 965 +++++++++ libs/LibCompat-1.0/LibCompat-1.0.toc | 20 + .../CallbackHandler-1.0.lua | 237 +++ .../LibGroupTalents-1.0.lua | 1727 +++++++++++++++++ .../LibTalentQuery-1.0.lua | 358 ++++ .../Libs/LibGroupTalents-1.0/lib.xml | 5 + libs/LibCompat-1.0/Libs/LibStub/LibStub.lua | 51 + libs/LibCompat-1.0/Templates.xml | 10 + libs/LibCompat-1.0/lib.xml | 11 + libs/LibDBIcon-1.0/LibDBIcon-1.0.lua | 263 +++ libs/LibDataBroker-1.1/LibDataBroker-1.1.lua | 90 + libs/LibDataBroker-1.1/README.textile | 13 + libs/LibStub/LibStub.lua | 51 + libs/LibStub/LibStub.toc | 13 + libs/LibStub/tests/test.lua | 41 + libs/LibStub/tests/test2.lua | 27 + libs/LibStub/tests/test3.lua | 14 + libs/LibStub/tests/test4.lua | 41 + 26 files changed, 4876 insertions(+), 128 deletions(-) create mode 100644 libs/CallbackHandler-1.0/CallbackHandler-1.0.lua create mode 100644 libs/CallbackHandler-1.0/CallbackHandler-1.0.xml create mode 100644 libs/LibCompat-1.0/Backdrop/Backdrop.lua create mode 100644 libs/LibCompat-1.0/Backdrop/Backdrop.xml create mode 100644 libs/LibCompat-1.0/LibCompat-1.0.lua create mode 100644 libs/LibCompat-1.0/LibCompat-1.0.toc create mode 100644 libs/LibCompat-1.0/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua create mode 100644 libs/LibCompat-1.0/Libs/LibGroupTalents-1.0/LibGroupTalents-1.0.lua create mode 100644 libs/LibCompat-1.0/Libs/LibGroupTalents-1.0/LibTalentQuery-1.0.lua create mode 100644 libs/LibCompat-1.0/Libs/LibGroupTalents-1.0/lib.xml create mode 100644 libs/LibCompat-1.0/Libs/LibStub/LibStub.lua create mode 100644 libs/LibCompat-1.0/Templates.xml create mode 100644 libs/LibCompat-1.0/lib.xml create mode 100644 libs/LibDBIcon-1.0/LibDBIcon-1.0.lua create mode 100644 libs/LibDataBroker-1.1/LibDataBroker-1.1.lua create mode 100644 libs/LibDataBroker-1.1/README.textile create mode 100644 libs/LibStub/LibStub.lua create mode 100644 libs/LibStub/LibStub.toc create mode 100644 libs/LibStub/tests/test.lua create mode 100644 libs/LibStub/tests/test2.lua create mode 100644 libs/LibStub/tests/test3.lua create mode 100644 libs/LibStub/tests/test4.lua diff --git a/Leatrix_Plus.lua b/Leatrix_Plus.lua index 5a93846..6eee154 100644 --- a/Leatrix_Plus.lua +++ b/Leatrix_Plus.lua @@ -9,6 +9,7 @@ -- Leatrix Plus ---------------------------------------------------------------------- + LibCompat = LibStub:GetLibrary("LibCompat-1.0") -- Create global table _G.LeaPlusDB = _G.LeaPlusDB or {} @@ -30,7 +31,7 @@ local gameversion, gamebuild, gamedate, gametocversion = GetBuildInfo() if gametocversion and gametocversion < 30000 or gametocversion > 39999 then -- Game client is not Wow Classic - C_Timer.After(2, function() + LibCompat.After(2, function() print(L["LEATRIX PLUS: WRONG VERSION INSTALLED!"]) end) return @@ -125,7 +126,7 @@ -- Add background color eFrame.t = eFrame:CreateTexture(nil, "BACKGROUND") eFrame.t:SetAllPoints() - eFrame.t:SetColorTexture(0.05, 0.05, 0.05, 0.9) + -- eFrame.t:SetColorTexture(0.05, 0.05, 0.05, 0.9) -- Add copy title eFrame.f = eFrame:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge') eFrame.f:SetPoint("TOPLEFT", x, y) @@ -163,7 +164,7 @@ eFrame.b:SetAutoFocus(true) eFrame.b:SetAltArrowKeyMode(true) -- Editbox texture - eFrame.t = CreateFrame("FRAME", nil, eFrame.b, "BackdropTemplate") + eFrame.t = CreateFrame("FRAME", nil, eFrame.b) eFrame.t:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = false, tileSize = 16, edgeSize = 16, insets = { left = 5, right = 5, top = 5, bottom = 5 }}) eFrame.t:SetPoint("LEFT", -6, 0) eFrame.t:SetWidth(eFrame.b:GetWidth() + 6) @@ -172,7 +173,7 @@ -- Handler eFrame.b:SetScript("OnKeyDown", function(void, key) if key == "C" and IsControlKeyDown() then - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() eFrame:Hide() ActionStatus_DisplayMessage(L["Copied to clipboard."], true) if LeaPlusLC.FactoryEditBoxFocusChat then @@ -1178,9 +1179,9 @@ end) -- Unmute sounds when logging in - for void, soundID in pairs(muteLogoutTable) do - UnmuteSoundFile(soundID) - end + -- for void, soundID in pairs(muteLogoutTable) do + -- UnmuteSoundFile(soundID) + -- end end @@ -1423,7 +1424,7 @@ mEB.t = mEB:CreateTexture(nil, "BACKGROUND") mEB.t:SetPoint(mEB:GetPoint()) mEB.t:SetSize(mEB:GetSize()) - mEB.t:SetColorTexture(0.05, 0.05, 0.05, 1.0) + -- mEB.t:SetColorTexture(0.05, 0.05, 0.05, 1.0) -- Create hidden font string (used for setting width of editbox) mEB.z = mEB:CreateFontString(nil, 'ARTWORK', 'GameFontNormal') @@ -1483,7 +1484,7 @@ -- ElvUI fix to move Wowhead link inside the quest log frame if LeaPlusLC.ElvUI then - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() QuestLogTitleText:ClearAllPoints() QuestLogTitleText:SetPoint("TOPLEFT", QuestLogFrame, "TOPLEFT", 32, -18) if QuestLogTitleText:GetStringWidth() > 200 then @@ -2270,7 +2271,7 @@ StartMsg.s = StartMsg:CreateTexture(nil, "BACKGROUND") StartMsg.s:SetAllPoints() - StartMsg.s:SetColorTexture(0.1, 0.1, 0.1, 1.0) + -- StartMsg.s:SetColorTexture(0.1, 0.1, 0.1, 1.0) StartMsg.f = StartMsg:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") StartMsg.f:SetAllPoints(); @@ -2293,12 +2294,12 @@ ticker._remainingIterations = ticker._remainingIterations - 1 end if (not ticker._remainingIterations or ticker._remainingIterations > 0) then - C_Timer.After(duration, ticker._callback) + LibCompat.After(duration, ticker._callback) end end end end - C_Timer.After(duration, ticker._callback) + LibCompat.After(duration, ticker._callback) return ticker end @@ -2358,7 +2359,7 @@ -- Show help button for exclusions LeaPlusLC:CreateHelpButton("SellJunkExcludeHelpButton", SellJunkFrame, titleTX, "Enter item IDs separated by commas. Item IDs can be found in item tooltips while this panel is showing.|n|nJunk items entered here will not be sold automatically.|n|nWhite items entered here will be sold automatically.|n|nThe editbox tooltip will show you more information about the items you have entered.") - local eb = CreateFrame("Frame", nil, SellJunkFrame, "BackdropTemplate") + local eb = CreateFrame("Frame", nil, SellJunkFrame) eb:SetSize(200, 180) eb:SetPoint("TOPLEFT", 350, -92) eb:SetBackdrop({ @@ -2369,7 +2370,7 @@ }) eb:SetBackdropBorderColor(1.0, 0.85, 0.0, 0.5) - eb.scroll = CreateFrame("ScrollFrame", nil, eb, "UIPanelScrollFrameTemplate") + eb.scroll = CreateFrame("ScrollFrame", nil, eb) eb.scroll:SetPoint("TOPLEFT", eb, 12, -10) eb.scroll:SetPoint("BOTTOMRIGHT", eb, -30, 10) @@ -2519,7 +2520,7 @@ eb.Text:HookScript("OnTextChanged", MakeTooltipString) eb.Text:HookScript("OnTextChanged", function() - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() MakeTooltipString() end) end) @@ -2760,7 +2761,7 @@ end) else -- If combat log is undocked, do nothing but show warning - C_Timer.After(1, function() + LibCompat.After(1, function() LeaPlusLC:Print("Combat log cannot be hidden while undocked.") end) end @@ -2848,7 +2849,7 @@ if CompactRaidFrameManagerDisplayFrameHiddenModeToggle then -- Create a border for the button - local cBackdrop = CreateFrame("Frame", nil, CompactRaidFrameManagerDisplayFrameHiddenModeToggle, "BackdropTemplate") + local cBackdrop = CreateFrame("Frame", nil, CompactRaidFrameManagerDisplayFrameHiddenModeToggle) cBackdrop:SetAllPoints() cBackdrop.backdropInfo = {edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}} cBackdrop:ApplyBackdrop() @@ -3288,7 +3289,7 @@ DeathDura:SetScript("OnEvent", function(self, event) ShowDuraStats("status") DeathDura:UnregisterEvent("PLAYER_DEAD") - C_Timer.After(2, function() + LibCompat.After(2, function() DeathDura:RegisterEvent("PLAYER_DEAD") end) end) @@ -3464,7 +3465,7 @@ LeaPlusLC:CreateHelpButton("MuteGameSoundsCustomHelpButton", MuteCustomPanel, titleTX, "Enter sound file IDs separated by comma then click the Mute button.|n|nIf you wish, you can enter a brief note for each file ID but do not include numbers in your notes.|n|nFor example, you can enter 'DevAura 569679, RetAura 568744' to mute the Devotion Aura and Retribution Aura spells.|n|nUse Leatrix Sounds to find, test and play sound file IDs.") -- Add large editbox - local eb = CreateFrame("Frame", nil, MuteCustomPanel, "BackdropTemplate") + local eb = CreateFrame("Frame", nil, MuteCustomPanel) eb:SetSize(548, 180) eb:SetPoint("TOPLEFT", 10, -92) eb:SetBackdrop({ @@ -3475,7 +3476,7 @@ }) eb:SetBackdropBorderColor(1.0, 0.85, 0.0, 0.5) - eb.scroll = CreateFrame("ScrollFrame", nil, eb, "UIPanelScrollFrameTemplate") + eb.scroll = CreateFrame("ScrollFrame", nil, eb) eb.scroll:SetPoint("TOPLEFT", eb, 12, -10) eb.scroll:SetPoint("BOTTOMRIGHT", eb, -30, 10) @@ -3680,7 +3681,7 @@ VehicleSeatIndicator:SetScale(LeaPlusLC["VehicleScale"]) -- Create drag frame - local dragframe = CreateFrame("FRAME", nil, nil, "BackdropTemplate") + local dragframe = CreateFrame("FRAME", nil, nil) dragframe:SetPoint("CENTER", vehicleHolder, "CENTER", 0, 1) dragframe:SetBackdropColor(0.0, 0.5, 1.0) dragframe:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0}}) @@ -3690,7 +3691,7 @@ dragframe.t = dragframe:CreateTexture() dragframe.t:SetAllPoints() - dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) + -- dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) dragframe.t:SetAlpha(0.5) dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge') @@ -4090,7 +4091,7 @@ end) -- Add large editbox - local eb = CreateFrame("Frame", nil, ExcludedButtonsPanel, "BackdropTemplate") + local eb = CreateFrame("Frame", nil, ExcludedButtonsPanel) eb:SetSize(548, 180) eb:SetPoint("TOPLEFT", 10, -92) eb:SetBackdrop({ @@ -4101,7 +4102,7 @@ }) eb:SetBackdropBorderColor(1.0, 0.85, 0.0, 0.5) - eb.scroll = CreateFrame("ScrollFrame", nil, eb, "UIPanelScrollFrameTemplate") + eb.scroll = CreateFrame("ScrollFrame", nil, eb) eb.scroll:SetPoint("TOPLEFT", eb, 12, -10) eb.scroll:SetPoint("BOTTOMRIGHT", eb, -30, 10) @@ -4216,7 +4217,7 @@ do -- Create frame - local pFrame = CreateFrame("FRAME", nil, Minimap, "BackdropTemplate") + local pFrame = CreateFrame("FRAME", nil, Minimap) pFrame:SetSize(100, 20) -- Set position @@ -4268,7 +4269,7 @@ -- Hide frame after 5 seconds pFrame:Show() pingTime = GetTime() - C_Timer.After(5, function() + LibCompat.After(5, function() if GetTime() - pingTime >= 5 then pFrame:Hide() end @@ -4359,7 +4360,7 @@ LeaPlusCB["HideMiniAddonButtons"].tiptext = LeaPlusCB["HideMiniAddonButtons"].tiptext .. "|n|n|cff00AAFF" .. L["Cannot be used with Combine addon buttons."] -- Create button frame (parenting to cluster ensures bFrame scales correctly) - local bFrame = CreateFrame("FRAME", nil, MinimapCluster, "BackdropTemplate") + local bFrame = CreateFrame("FRAME", nil, MinimapCluster) bFrame:ClearAllPoints() bFrame:SetPoint("TOPLEFT", Minimap, "TOPRIGHT", 4, 4) bFrame:Hide() @@ -4372,7 +4373,7 @@ local ButtonFrameTicker bFrame:HookScript("OnShow", function() if ButtonFrameTicker then ButtonFrameTicker:Cancel() end - ButtonFrameTicker = C_Timer.NewTicker(2, function() + ButtonFrameTicker = LibCompat.NewTicker(2, function() if ItemRackMenuFrame and ItemRackMenuFrame:IsShown() and ItemRackMenuFrame:IsMouseOver() then return end if not bFrame:IsMouseOver() and not Minimap:IsMouseOver() then bFrame:Hide() @@ -4529,7 +4530,7 @@ _G.GetMinimapShape = function() return "SQUARE" end -- Create black border around map - local miniBorder = CreateFrame("Frame", nil, Minimap, "BackdropTemplate") + local miniBorder = CreateFrame("Frame", nil, Minimap) miniBorder:SetPoint("TOPLEFT", -3, 3) miniBorder:SetPoint("BOTTOMRIGHT", 3, -3) miniBorder:SetAlpha(0.8) @@ -4594,7 +4595,7 @@ -- Debug buttons local LeaPlusMiniMapDebug = nil if LeaPlusMiniMapDebug then - C_Timer.After(2, function() + LibCompat.After(2, function() MiniMapMailFrame:Show() MiniMapBattlefieldFrame:Show() MiniMapWorldMapButton:Show() @@ -4616,7 +4617,7 @@ end -- Refresh buttons - C_Timer.After(0.1, SetButtonRad) + LibCompat.After(0.1, SetButtonRad) else @@ -4732,8 +4733,8 @@ end -- Run the function a few times on startup - C_Timer.NewTicker(2, MakeButtons, 3) - C_Timer.After(0.1, MakeButtons) + LibCompat.NewTicker(2, MakeButtons, 3) + LibCompat.After(0.1, MakeButtons) end @@ -4869,7 +4870,7 @@ MinimapBorderTop:SetPoint("TOP", MinimapBackdrop, "TOP", 0, 20) -- Refresh buttons - C_Timer.After(0.1, SetButtonRad) + LibCompat.After(0.1, SetButtonRad) -- Function to set zone text bar local function SetZoneTextBar() @@ -5136,7 +5137,7 @@ -- Combine addon buttons: Hide new LibDBIcon icons if LeaPlusLC["CombineAddonButtons"] == "On" then - --C_Timer.After(0.1, function() -- Removed for now + --LibCompat.After(0.1, function() -- Removed for now local buttonName = strlower(name) if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then if button.db and not button.db.hide then @@ -5233,7 +5234,7 @@ DurabilityFrame:SetScale(LeaPlusLC["DurabilityScale"]) -- Create drag frame - local dragframe = CreateFrame("FRAME", nil, nil, "BackdropTemplate") + local dragframe = CreateFrame("FRAME", nil, nil) dragframe:SetPoint("CENTER", durabilityHolder, "CENTER", 0, 1) dragframe:SetBackdropColor(0.0, 0.5, 1.0) dragframe:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0}}) @@ -5243,7 +5244,7 @@ dragframe.t = dragframe:CreateTexture() dragframe.t:SetAllPoints() - dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) + -- dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) dragframe.t:SetAlpha(0.5) dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge') @@ -5408,7 +5409,7 @@ MirrorTimer1:SetScale(LeaPlusLC["TimerScale"]) -- Create drag frame - local dragframe = CreateFrame("FRAME", nil, nil, "BackdropTemplate") + local dragframe = CreateFrame("FRAME", nil, nil) dragframe:SetPoint("TOPRIGHT", MirrorTimer1, "TOPRIGHT", 0, 2.5) dragframe:SetBackdropColor(0.0, 0.5, 1.0) dragframe:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }}) @@ -5418,7 +5419,7 @@ dragframe.t = dragframe:CreateTexture() dragframe.t:SetAllPoints() - dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) + -- dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) dragframe.t:SetAlpha(0.5) dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge') @@ -5646,7 +5647,7 @@ end) -- Debug - -- C_Timer.After(2, function() PVPReadyDialog_Display(self, 1, "Warsong Gulch", 0, "BATTLEGROUND", "", "DAMAGER"); bar:Show() end) + -- LibCompat.After(2, function() PVPReadyDialog_Display(self, 1, "Warsong Gulch", 0, "BATTLEGROUND", "", "DAMAGER"); bar:Show() end) end @@ -5681,7 +5682,7 @@ -- Add background color editFrame.t = editFrame:CreateTexture(nil, "BACKGROUND") editFrame.t:SetAllPoints() - editFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6) + -- editFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6) -- Set textures editFrame.LeftTex:SetTexture(editFrame.RightTex:GetTexture()); editFrame.LeftTex:SetTexCoord(1, 0, 0, 1) @@ -5701,7 +5702,7 @@ titleFrame.CharCount:Hide() titleFrame.t = titleFrame:CreateTexture(nil, "BACKGROUND") titleFrame.t:SetAllPoints() - titleFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6) + -- titleFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6) titleFrame.LeftTex:SetTexture(titleFrame.RightTex:GetTexture()); titleFrame.LeftTex:SetTexCoord(1, 0, 0, 1) titleFrame.BottomTex:SetTexture(titleFrame.TopTex:GetTexture()); titleFrame.BottomTex:SetTexCoord(0, 1, 1, 0) titleFrame.BottomRightTex:SetTexture(titleFrame.TopRightTex:GetTexture()); titleFrame.BottomRightTex:SetTexCoord(0, 1, 1, 0) @@ -5854,7 +5855,7 @@ -- Handle flight time not correct or flight does not exist in database local timeStart = GetTime() - C_Timer.After(1, function() + LibCompat.After(1, function() if UnitOnTaxi("player") then -- Player is on a taxi so register when taxi lands flightFrame:RegisterEvent("PLAYER_CONTROL_GAINED") @@ -5924,7 +5925,7 @@ local speed = -2 if LeaPlusLC["FlightBarSpeech"] == "On" then - C_Timer.After(1, function() + LibCompat.After(1, function() C_VoiceChat.SpeakText(0, L["Flight commenced."], destination, speed, GetCVar("Sound_MasterVolume") * 100) end) mybar:AddUpdateFunction(function(bar) @@ -6585,7 +6586,7 @@ local resTimer = GetCorpseRecoveryDelay() if resTimer and resTimer > 0 then -- Resurrect has a delay so wait before resurrecting - C_Timer.After(resTimer + 1, function() + LibCompat.After(resTimer + 1, function() if not UnitAffectingCombat(arg1) or LeaPlusLC["AutoResNoCombat"] == "Off" then if LeaPlusLC["AutoAcceptRes"] == "On" then if not DoNotAcceptResurrect() then @@ -6753,7 +6754,7 @@ LeaPlusCB["ShowHelm"]:HookScript("OnClick", function() LeaPlusCB["ShowHelm"]:Disable() LeaPlusCB["ShowHelm"]:SetAlpha(1.0) - C_Timer.After(0.5, function() + LibCompat.After(0.5, function() if ShowingHelm() then ShowHelm(false) else @@ -6770,7 +6771,7 @@ LeaPlusCB["ShowCloak"]:HookScript("OnClick", function() LeaPlusCB["ShowCloak"]:Disable() LeaPlusCB["ShowCloak"]:SetAlpha(1.0) - C_Timer.After(0.5, function() + LibCompat.After(0.5, function() if ShowingCloak() then ShowCloak(false) else @@ -7042,7 +7043,7 @@ playerActor:SetUnit("player") -- Set animation playerActor:SetAnimation(0) - C_Timer.After(0.1,function() + LibCompat.After(0.1,function() playerActor:SetAnimation(animTable[math.floor(LeaPlusCB["DressupAnim"]:GetValue() + 0.5)], 0, 1, 1) end) end) @@ -7056,7 +7057,7 @@ if UnitIsPlayer("target") then DressUpFrame.DressUpModel:SetUnit("target") DressUpFrame.DressUpModel:Undress() - C_Timer.After(0.01, function() + LibCompat.After(0.01, function() for i = 1, 19 do local itemName = GetInventoryItemID("player", i) if itemName then @@ -7079,7 +7080,7 @@ playerActor:SetUnit("target") -- Set animation playerActor:SetAnimation(0) - C_Timer.After(0.1,function() + LibCompat.After(0.1,function() playerActor:SetAnimation(animTable[math.floor(LeaPlusCB["DressupAnim"]:GetValue() + 0.5)], 0, 1, 1) end) end @@ -7113,10 +7114,10 @@ LeaPlusCB["DressUpTargetSelfBtn"]:SetScript("OnEvent", function() DressUpFrame.DressUpModel:SetUnit("player") DressUpFrame.DressUpModel:Undress() - C_Timer.After(0.01, function() + LibCompat.After(0.01, function() for i = 1, 19 do local itemName = GetInventoryItemID("target", i) - C_Timer.After(0.01, function() + LibCompat.After(0.01, function() if itemName then DressUpFrame.DressUpModel:TryOn("item:" .. itemName) end @@ -7201,7 +7202,7 @@ -- CharacterStatsTBC is installed RunScript('CSC_HideStatsPanel()') if startup then - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() CharacterModelFrame:ClearAllPoints() CharacterModelFrame:SetPoint("TOPLEFT", PaperDollFrame, 66, -76) CharacterModelFrame:SetPoint("BOTTOMRIGHT", PaperDollFrame, -86, 134) @@ -7226,7 +7227,7 @@ -- CharacterStatsTBC is installed RunScript('CSC_ShowStatsPanel()') if startup then - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() CharacterModelFrame:ClearAllPoints() CharacterModelFrame:SetPoint("TOPLEFT", PaperDollFrame, 66, -76) CharacterModelFrame:SetPoint("BOTTOMRIGHT", PaperDollFrame, -86, 243) @@ -7451,7 +7452,7 @@ end -- Release automatically local delay = LeaPlusLC["AutoReleaseDelay"] / 1000 - C_Timer.After(delay, function() + LibCompat.After(delay, function() local dialog = StaticPopup_Visible("DEATH") if dialog then if IsShiftKeyDown() then @@ -7801,13 +7802,13 @@ if setting and LeaPlusLC["SetWeatherDensity"] == "On" then if setting == "graphicsParticleDensity" then if GetCVar("WeatherDensity") ~= LeaPlusLC["WeatherLevel"] then - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() SetCVar("WeatherDensity", LeaPlusLC["WeatherLevel"]) end) end elseif setting == "raidGraphicsParticleDensity" then if GetCVar("RAIDweatherDensity") ~= LeaPlusLC["WeatherLevel"] then - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() SetCVar("RAIDweatherDensity", LeaPlusLC["WeatherLevel"]) end) end @@ -8487,7 +8488,7 @@ SetCVar("chatClassColorOverride", "0") - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() -- Set local channel colors and lock checkboxes for i = 1, 18 do @@ -8660,14 +8661,10 @@ if arg1 == "RightButton" then -- No modifier key toggles the options panel - if LeaPlusLC:IsPlusShowing() then - LeaPlusLC:HideFrames() - LeaPlusLC:HideConfigPanels() - else - LeaPlusLC:HideFrames() - LeaPlusLC["PageF"]:Show() - end - LeaPlusLC["Page" .. LeaPlusLC["LeaStartPage"]]:Show() + -- if LeaPlusLC:IsPlusShowing() then +ReloadUI() + -- end + -- LeaPlusLC["Page" .. LeaPlusLC["LeaStartPage"]]:Show() end @@ -9021,7 +9018,7 @@ end) -- Create drag frame - local dragframe = CreateFrame("FRAME", nil, nil, "BackdropTemplate") + local dragframe = CreateFrame("FRAME", nil, nil) dragframe:SetPoint("TOPRIGHT", BuffFrame, "TOPRIGHT", 0, 2.5) dragframe:SetBackdropColor(0.0, 0.5, 1.0) dragframe:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }}) @@ -9031,7 +9028,7 @@ dragframe.t = dragframe:CreateTexture() dragframe.t:SetAllPoints() - dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) + -- dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) dragframe.t:SetAlpha(0.5) dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge') @@ -9271,7 +9268,7 @@ if not currentframe then -- No frame selected so select the player frame currentframe = PlayerFrame:GetName() - LeaPlusLC["DragPlayerFrame"].t:SetColorTexture(0.0, 1.0, 0.0,0.5) + -- LeaPlusLC["DragPlayerFrame"].t:SetColorTexture(0.0, 1.0, 0.0,0.5) end -- Set the scale slider value to the selected frame LeaPlusCB["FrameScale"]:SetValue(LeaPlusDB["Frames"][currentframe]["Scale"]) @@ -9385,7 +9382,7 @@ -- Create drag frames local function LeaPlusMakeDrag(dragframe,realframe) - local dragframe = CreateFrame("Frame", nil, nil, "BackdropTemplate") + local dragframe = CreateFrame("Frame", nil, nil) LeaPlusLC[dragframe] = dragframe dragframe:SetSize(realframe:GetSize()) dragframe:SetPoint("TOP", realframe, "TOP", 0, 2.5) @@ -9415,9 +9412,9 @@ -- Set all drag frames to blue then tint the selected frame to green for k,v in pairs(FrameTable) do - LeaPlusLC[k].t:SetColorTexture(0.0, 0.5, 1.0, 0.5) + -- LeaPlusLC[k].t:SetColorTexture(0.0, 0.5, 1.0, 0.5) end - dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) + -- dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) -- Set currentframe variable to selected frame and set the scale slider value currentframe = realframe:GetName() @@ -9432,7 +9429,7 @@ dragframe.t = dragframe:CreateTexture() dragframe.t:SetAllPoints() - dragframe.t:SetColorTexture(0.0, 0.5, 1.0, 0.5) + -- dragframe.t:SetColorTexture(0.0, 0.5, 1.0, 0.5) dragframe.t:SetAlpha(0.5) dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge') @@ -9583,7 +9580,7 @@ UIWidgetTopCenterContainerFrame:SetScale(LeaPlusLC["WidgetScale"]) -- Create drag frame - local dragframe = CreateFrame("FRAME", nil, nil, "BackdropTemplate") + local dragframe = CreateFrame("FRAME", nil, nil) dragframe:SetPoint("CENTER", topCenterHolder, "CENTER", 0, 1) dragframe:SetBackdropColor(0.0, 0.5, 1.0) dragframe:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0}}) @@ -9593,7 +9590,7 @@ dragframe.t = dragframe:CreateTexture() dragframe.t:SetAllPoints() - dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) + -- dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) dragframe.t:SetAlpha(0.5) dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge') @@ -9787,7 +9784,7 @@ FocusFrame:SetScale(LeaPlusLC["FocusScale"]) -- Create drag frame - local dragframe = CreateFrame("FRAME", nil, nil, "BackdropTemplate") + local dragframe = CreateFrame("FRAME", nil, nil) dragframe:SetBackdropColor(0.0, 0.5, 1.0) dragframe:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0}}) dragframe:SetToplevel(true) @@ -9796,7 +9793,7 @@ dragframe.t = dragframe:CreateTexture() dragframe.t:SetAllPoints() - dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) + -- dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5) dragframe.t:SetAlpha(0.5) dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge') @@ -10127,7 +10124,7 @@ -- Add background color editFrame.t = editFrame:CreateTexture(nil, "BACKGROUND") editFrame.t:SetAllPoints() - editFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6) + -- editFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6) -- Set textures editFrame.LeftTex:SetTexture(editFrame.RightTex:GetTexture()); editFrame.LeftTex:SetTexCoord(1, 0, 0, 1) @@ -10147,7 +10144,7 @@ titleFrame.CharCount:Hide() titleFrame.t = titleFrame:CreateTexture(nil, "BACKGROUND") titleFrame.t:SetAllPoints() - titleFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6) + -- titleFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6) titleFrame.LeftTex:SetTexture(titleFrame.RightTex:GetTexture()); titleFrame.LeftTex:SetTexCoord(1, 0, 0, 1) titleFrame.BottomTex:SetTexture(titleFrame.TopTex:GetTexture()); titleFrame.BottomTex:SetTexCoord(0, 1, 1, 0) titleFrame.BottomRightTex:SetTexture(titleFrame.TopRightTex:GetTexture()); titleFrame.BottomRightTex:SetTexCoord(0, 1, 1, 0) @@ -10295,7 +10292,7 @@ end titleFrame.m:SetText(L["Messages"] .. ": " .. totalMsgCount) editFrame:SetVerticalScroll(0) - C_Timer.After(0.1, function() editFrame.ScrollBar.ScrollDownButton:Click() end) + LibCompat.After(0.1, function() editFrame.ScrollBar.ScrollDownButton:Click() end) editFrame:Show() editBox:ClearFocus() end @@ -10740,7 +10737,7 @@ LT["ColorBlind"] = GetCVar("colorblindMode") -- Create drag frame - local TipDrag = CreateFrame("Frame", nil, UIParent, "BackdropTemplate") + local TipDrag = CreateFrame("Frame", nil, UIParent) TipDrag:SetToplevel(true); TipDrag:SetClampedToScreen(false); TipDrag:SetSize(130, 64); @@ -10761,7 +10758,7 @@ -- Create texture TipDrag.t = TipDrag:CreateTexture(); TipDrag.t:SetAllPoints(); - TipDrag.t:SetColorTexture(0.0, 0.5, 1.0, 0.5); + -- TipDrag.t:SetColorTexture(0.0, 0.5, 1.0, 0.5); TipDrag.t:SetAlpha(0.5); --------------------------------------------------------------------------------------------------------- @@ -11471,10 +11468,18 @@ if LeaPlusLC["ViewPortEnable"] == "On" then -- Create border textures - local BordTop = WorldFrame:CreateTexture(nil, "ARTWORK"); BordTop:SetColorTexture(0, 0, 0, 1); BordTop:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0); BordTop:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0) - local BordBot = WorldFrame:CreateTexture(nil, "ARTWORK"); BordBot:SetColorTexture(0, 0, 0, 1); BordBot:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0); BordBot:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0) - local BordLeft = WorldFrame:CreateTexture(nil, "ARTWORK"); BordLeft:SetColorTexture(0, 0, 0, 1); BordLeft:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0); BordLeft:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0) - local BordRight = WorldFrame:CreateTexture(nil, "ARTWORK"); BordRight:SetColorTexture(0, 0, 0, 1); BordRight:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0); BordRight:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0) + local BordTop = WorldFrame:CreateTexture(nil, "ARTWORK"); + -- BordTop:SetColorTexture(0, 0, 0, 1); + BordTop:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0); BordTop:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0) + local BordBot = WorldFrame:CreateTexture(nil, "ARTWORK"); + -- BordBot:SetColorTexture(0, 0, 0, 1); + BordBot:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0); BordBot:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0) + local BordLeft = WorldFrame:CreateTexture(nil, "ARTWORK"); + -- BordLeft:SetColorTexture(0, 0, 0, 1); + BordLeft:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0); BordLeft:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0) + local BordRight = WorldFrame:CreateTexture(nil, "ARTWORK"); + -- BordRight:SetColorTexture(0, 0, 0, 1); + BordRight:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0); BordRight:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0) -- Create viewport configuration panel local SideViewport = LeaPlusLC:CreatePanel("Enable viewport", "SideViewport") @@ -11713,7 +11718,7 @@ -- Show first run message if not LeaPlusDB["FirstRunMessageSeen"] then - C_Timer.After(1, function() + LibCompat.After(1, function() LeaPlusLC:Print(L["Enter"] .. " |cff00ff00" .. "/run leaplus()" .. "|r " .. L["or click the minimap button to open Leatrix Plus."]) LeaPlusDB["FirstRunMessageSeen"] = true end) @@ -11781,14 +11786,14 @@ -- Plot vertical lines for i = 0, wline do local t = LeaPlusLC.grid:CreateTexture(nil, 'BACKGROUND') - if i == wline / 2 then t:SetColorTexture(1, 0, 0, 0.5) else t:SetColorTexture(0, 0, 0, 0.5) end + -- if i == wline / 2 then t:SetColorTexture(1, 0, 0, 0.5) else t:SetColorTexture(0, 0, 0, 0.5) end t:SetPoint('TOPLEFT', grid, 'TOPLEFT', i * w / wline - 1, 0) t:SetPoint('BOTTOMRIGHT', grid, 'BOTTOMLEFT', i * w / wline + 1, 0) end -- Plot horizontal lines for i = 0, hline do local t = LeaPlusLC.grid:CreateTexture(nil, 'BACKGROUND') - if i == hline / 2 then t:SetColorTexture(1, 0, 0, 0.5) else t:SetColorTexture(0, 0, 0, 0.5) end + -- if i == hline / 2 then t:SetColorTexture(1, 0, 0, 0.5) else t:SetColorTexture(0, 0, 0, 0.5) end t:SetPoint('TOPLEFT', grid, 'TOPLEFT', 0, -i * h / hline + 1) t:SetPoint('BOTTOMRIGHT', grid, 'TOPRIGHT', 0, -i * h / hline - 1) end @@ -11896,14 +11901,14 @@ -- Create hover texture mbtn.t = mbtn:CreateTexture(nil, "BACKGROUND") - mbtn.t:SetColorTexture(0.3, 0.3, 0.00, 0.8) + -- mbtn.t:SetColorTexture(0.3, 0.3, 0.00, 0.8) mbtn.t:SetAlpha(0.7) mbtn.t:SetAllPoints() mbtn.t:Hide() -- Create highlight texture mbtn.s = mbtn:CreateTexture(nil, "BACKGROUND") - mbtn.s:SetColorTexture(0.3, 0.3, 0.00, 0.8) + -- mbtn.s:SetColorTexture(0.3, 0.3, 0.00, 0.8) mbtn.s:SetAlpha(1.0) mbtn.s:SetAllPoints() mbtn.s:Hide() @@ -12046,7 +12051,7 @@ if strfind(playlist[tracknumber], "#") then if strfind(playlist[tracknumber], ".mp3") then -- Track is a sound file with track time so create track timer - LeaPlusLC.TrackTimer = C_Timer.NewTimer(trackTime + 1, function() + LeaPlusLC.TrackTimer = LibCompat.NewTimer(trackTime + 1, function() if musicHandle then StopSound(musicHandle) end if tracknumber == #playlist then -- Playlist is at the end, restart from first track @@ -12259,7 +12264,7 @@ button.t:SetPoint("TOPLEFT", button, 0, 0) button.t:SetSize(516, 16) - button.t:SetColorTexture(0.3, 0.3, 0.0, 0.8) + -- button.t:SetColorTexture(0.3, 0.3, 0.0, 0.8) button.t:SetAlpha(0.7) button.t:Hide() @@ -12268,7 +12273,7 @@ button.s:SetPoint("TOPLEFT", button, 0, 0) button.s:SetSize(516, 16) - button.s:SetColorTexture(0.3, 0.4, 0.00, 0.6) + -- button.s:SetColorTexture(0.3, 0.4, 0.00, 0.6) button.s:Hide() button:SetScript("OnEnter", function() @@ -12297,7 +12302,7 @@ -- Restart player if it stopped between tracks during loading screen if playlist and tracknumber and playlist[tracknumber] and not willPlay and not musicHandle then tracknumber = tracknumber - 1 - C_Timer.After(0.1, PlayTrack) + LibCompat.After(0.1, PlayTrack) end end end) @@ -12523,7 +12528,7 @@ local id, player = BNGetFriendInviteInfo(i) if id and player then BNDeclineFriendInvite(id) - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() LeaPlusLC:Print(L["A friend request from"] .. " " .. player .. " " .. L["was automatically declined."]) end) end @@ -12710,7 +12715,7 @@ local sName = C_SummonInfo.GetSummonConfirmSummoner() local sLocation = C_SummonInfo.GetSummonConfirmAreaName() LeaPlusLC:Print(L["The summon from"] .. " " .. sName .. " (" .. sLocation .. ") " .. L["will be automatically accepted in 10 seconds unless cancelled."]) - C_Timer.After(10, function() + LibCompat.After(10, function() local sNameNew = C_SummonInfo.GetSummonConfirmSummoner() local sLocationNew = C_SummonInfo.GetSummonConfirmAreaName() if sName == sNameNew and sLocation == sLocationNew then @@ -13634,7 +13639,7 @@ -- Set the background color Side.t = Side:CreateTexture(nil, "BACKGROUND") Side.t:SetAllPoints() - Side.t:SetColorTexture(0.05, 0.05, 0.05, 0.9) + -- Side.t:SetColorTexture(0.05, 0.05, 0.05, 0.9) -- Add a close Button Side.c = CreateFrame("Button", nil, Side, "UIPanelCloseButton") @@ -13888,7 +13893,7 @@ eb:SetScript("OnEnterPressed", eb.ClearFocus) -- Add editbox border and backdrop - eb.f = CreateFrame("FRAME", nil, eb, "BackdropTemplate") + eb.f = CreateFrame("FRAME", nil, eb) eb.f:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = false, tileSize = 16, edgeSize = 16, insets = { left = 5, right = 5, top = 5, bottom = 5 }}) eb.f:SetPoint("LEFT", -6, 0) eb.f:SetWidth(eb:GetWidth()+6) @@ -13946,11 +13951,11 @@ mbtn:GetHighlightTexture():SetTexCoord(0, 0.125, 0.4375, 0.5) -- Hide the default textures - mbtn:HookScript("OnShow", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) - mbtn:HookScript("OnEnable", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) - mbtn:HookScript("OnDisable", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) - mbtn:HookScript("OnMouseDown", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) - mbtn:HookScript("OnMouseUp", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) + -- mbtn:HookScript("OnShow", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) + -- mbtn:HookScript("OnEnable", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) + -- mbtn:HookScript("OnDisable", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) + -- mbtn:HookScript("OnMouseDown", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) + -- mbtn:HookScript("OnMouseUp", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end) end @@ -13993,7 +13998,7 @@ dbtn:SetScript("OnLeave", GameTooltip_Hide) -- Create dropdown list - local ddlist = CreateFrame("Frame",nil,frame, "BackdropTemplate") + local ddlist = CreateFrame("Frame",nil,frame) LeaPlusCB["ListFrame"..ddname] = ddlist ddlist:SetPoint("TOP",0,-42) ddlist:SetWidth(frame:GetWidth()) @@ -14031,7 +14036,7 @@ dditem.t = dditem:CreateTexture(nil, "BACKGROUND") dditem.t:SetAllPoints() - dditem.t:SetColorTexture(0.3, 0.3, 0.00, 0.8) + -- dditem.t:SetColorTexture(0.3, 0.3, 0.00, 0.8) dditem.t:Hide(); dditem:SetScript("OnEnter", function() dditem.t:Show() end) @@ -14101,7 +14106,7 @@ -- Add background color PageF.t = PageF:CreateTexture(nil, "BACKGROUND") PageF.t:SetAllPoints() - PageF.t:SetColorTexture(0.05, 0.05, 0.05, 0.9) + -- PageF.t:SetColorTexture(0.05, 0.05, 0.05, 0.9) -- Add textures LeaPlusLC:CreateBar("FootTexture", PageF, 570, 48, "BOTTOM", 0.5, 0.5, 0.5, 1.0, "Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated.png") @@ -14243,7 +14248,7 @@ if tonumber(arg1) and tonumber(arg1) < 999999999 then local questCompleted = C_QuestLog.IsQuestFlaggedCompleted(arg1) local questTitle = C_QuestLog.GetQuestInfo(arg1) or L["Unknown"] - C_Timer.After(0.5, function() + LibCompat.After(0.5, function() local questTitle = C_QuestLog.GetQuestInfo(arg1) or L["Unknown"] if questCompleted then LeaPlusLC:Print(questTitle .. " (" .. arg1 .. "):" .. "|cffffffff " .. L["Completed."]) @@ -14798,7 +14803,8 @@ if not LeaPlusLC.HelpFrame then local frame = CreateFrame("FRAME", nil, UIParent) frame:SetSize(570, 340); frame:SetFrameStrata("FULLSCREEN_DIALOG"); frame:SetFrameLevel(100) - frame.tex = frame:CreateTexture(nil, "BACKGROUND"); frame.tex:SetAllPoints(); frame.tex:SetColorTexture(0.05, 0.05, 0.05, 0.9) + frame.tex = frame:CreateTexture(nil, "BACKGROUND"); frame.tex:SetAllPoints(); + -- frame.tex:SetColorTexture(0.05, 0.05, 0.05, 0.9) frame.close = CreateFrame("Button", nil, frame, "UIPanelCloseButton"); frame.close:SetSize(30, 30); frame.close:SetPoint("TOPRIGHT", 0, 0); frame.close:SetScript("OnClick", function() frame:Hide() end) frame:ClearAllPoints(); frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0) frame:SetClampedToScreen(true) @@ -15124,7 +15130,7 @@ end end -- Reinvite - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() for k, v in pairs(groupNames) do C_PartyInfo.InviteUnit(v) end @@ -15142,7 +15148,8 @@ -- Panel frame local frame = CreateFrame("FRAME", nil, UIParent) frame:SetSize(294, 86); frame:SetFrameStrata("FULLSCREEN_DIALOG"); frame:SetFrameLevel(100); frame:SetScale(2) - frame.tex = frame:CreateTexture(nil, "BACKGROUND"); frame.tex:SetAllPoints(); frame.tex:SetColorTexture(0.05, 0.05, 0.05, 0.9) + frame.tex = frame:CreateTexture(nil, "BACKGROUND"); frame.tex:SetAllPoints(); + -- frame.tex:SetColorTexture(0.05, 0.05, 0.05, 0.9) frame.close = CreateFrame("Button", nil, frame, "UIPanelCloseButton"); frame.close:SetSize(30, 30); frame.close:SetPoint("TOPRIGHT", 0, 0); frame.close:SetScript("OnClick", function() frame:Hide() end) frame:ClearAllPoints(); frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0) frame:SetClampedToScreen(true) @@ -15177,7 +15184,7 @@ if endSound then if endSound > 3000000 then endSound = 3000000 endBox:SetText(endSound) end frame.btn:SetText("WAIT") - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() for i = 1, 3000000 do MuteSoundFile(i) end @@ -15190,7 +15197,7 @@ else frame.btn:SetText("INVALID") frame.btn:EnableMouse(false) - C_Timer.After(2, function() + LibCompat.After(2, function() frame.btn:SetText("SET LIMIT") frame.btn:EnableMouse(true) end) @@ -15203,7 +15210,7 @@ frame.MuteAllBtn:SetPoint("TOPLEFT", frame.btn, "TOPRIGHT", 20, 0) frame.MuteAllBtn:SetScript("OnClick", function() frame.MuteAllBtn:SetText("WAIT") - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() for i = 1, 3000000 do MuteSoundFile(i) end @@ -15219,7 +15226,7 @@ frame.UnmuteAllBtn:SetPoint("TOPLEFT", frame.MuteAllBtn, "BOTTOMLEFT", 0, -10) frame.UnmuteAllBtn:SetScript("OnClick", function() frame.UnmuteAllBtn:SetText("WAIT") - C_Timer.After(0.1, function() + LibCompat.After(0.1, function() for i = 1, 3000000 do UnmuteSoundFile(i) end @@ -15695,13 +15702,13 @@ mbtn.t = mbtn:CreateTexture(nil, "BACKGROUND") mbtn.t:SetAllPoints() - mbtn.t:SetColorTexture(0.3, 0.3, 0.00, 0.8) + -- mbtn.t:SetColorTexture(0.3, 0.3, 0.00, 0.8) mbtn.t:SetAlpha(0.7) mbtn.t:Hide() mbtn.s = mbtn:CreateTexture(nil, "BACKGROUND") mbtn.s:SetAllPoints() - mbtn.s:SetColorTexture(0.3, 0.3, 0.00, 0.8) + -- mbtn.s:SetColorTexture(0.3, 0.3, 0.00, 0.8) mbtn.s:Hide() mbtn.f = mbtn:CreateFontString(nil, 'ARTWORK', 'GameFontNormal') diff --git a/Leatrix_Plus.toc b/Leatrix_Plus.toc index ee3936f..d8f4058 100644 --- a/Leatrix_Plus.toc +++ b/Leatrix_Plus.toc @@ -1,4 +1,4 @@ -## Interface: 30401 +## Interface: 30300 ## Title: Leatrix Plus ## Title-zhCN: Leatrix Plus [|cffeda55f功能百宝箱|r] @@ -16,6 +16,13 @@ ## X-Curse-Project-ID: 463863 +libs\LibStub\LibStub.lua +libs\LibCompat-1.0\lib.xml +Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua +Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua +Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua + + Leatrix_Plus_Library.lua Leatrix_Plus_Locale.lua Leatrix_Plus_Media.lua diff --git a/Leatrix_Plus_Library.lua b/Leatrix_Plus_Library.lua index c6c8a5c..2831d5d 100644 --- a/Leatrix_Plus_Library.lua +++ b/Leatrix_Plus_Library.lua @@ -622,9 +622,9 @@ local function createButton(name, object, db) button.dataObject = object button.db = db button:SetFrameStrata("MEDIUM") - button:SetFixedFrameStrata(true) + -- button:SetFixedFrameStrata(true) button:SetFrameLevel(8) - button:SetFixedFrameLevel(true) + -- button:SetFixedFrameLevel(true) button:SetSize(31, 31) button:RegisterForClicks("anyUp") button:RegisterForDrag("LeftButton") @@ -678,12 +678,12 @@ local function createButton(name, object, db) button.fadeOut = button:CreateAnimationGroup() local animOut = button.fadeOut:CreateAnimation("Alpha") - animOut:SetOrder(1) - animOut:SetDuration(0.2) - animOut:SetFromAlpha(1) - animOut:SetToAlpha(0) - animOut:SetStartDelay(1) - button.fadeOut:SetToFinalAlpha(true) + -- animOut:SetOrder(1) + -- animOut:SetDuration(0.2) + -- animOut:SetFromAlpha(1) + -- animOut:SetToAlpha(0) + -- animOut:SetStartDelay(1) + -- button.fadeOut:SetToFinalAlpha(true) lib.objects[name] = button @@ -893,7 +893,7 @@ lib:SetButtonRadius(lib.radius) -- Upgrade to 40 -- LibDBIconEnd end -LeaLibDBIcon() +-- LeaLibDBIcon() -- disabled in 3.3.5, was causing red things ---------------------------------------------------------------------- diff --git a/Leatrix_Plus_Wrath.toc b/Leatrix_Plus_Wrath.toc index ee3936f..d8f4058 100644 --- a/Leatrix_Plus_Wrath.toc +++ b/Leatrix_Plus_Wrath.toc @@ -1,4 +1,4 @@ -## Interface: 30401 +## Interface: 30300 ## Title: Leatrix Plus ## Title-zhCN: Leatrix Plus [|cffeda55f功能百宝箱|r] @@ -16,6 +16,13 @@ ## X-Curse-Project-ID: 463863 +libs\LibStub\LibStub.lua +libs\LibCompat-1.0\lib.xml +Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua +Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua +Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua + + Leatrix_Plus_Library.lua Leatrix_Plus_Locale.lua Leatrix_Plus_Media.lua diff --git a/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua b/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua new file mode 100644 index 0000000..712bf7e --- /dev/null +++ b/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -0,0 +1,240 @@ +--[[ $Id: CallbackHandler-1.0.lua 895 2009-12-06 16:28:55Z nevcairiel $ ]] +local MAJOR, MINOR = "CallbackHandler-1.0", 5 +local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) + +if not CallbackHandler then return end -- No upgrade needed + +local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} + +-- Lua APIs +local tconcat = table.concat +local assert, error, loadstring = assert, error, loadstring +local setmetatable, rawset, rawget = setmetatable, rawset, rawget +local next, select, pairs, type, tostring = next, select, pairs, type, tostring + +-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded +-- List them here for Mikk's FindGlobals script +-- GLOBALS: geterrorhandler + +local xpcall = xpcall + +local function errorhandler(err) + return geterrorhandler()(err) +end + +local function CreateDispatcher(argCount) + local code = [[ + local next, xpcall, eh = ... + + local method, ARGS + local function call() method(ARGS) end + + local function dispatch(handlers, ...) + local index + index, method = next(handlers) + if not method then return end + local OLD_ARGS = ARGS + ARGS = ... + repeat + xpcall(call, eh) + index, method = next(handlers, index) + until not method + ARGS = OLD_ARGS + end + + return dispatch + ]] + + local ARGS, OLD_ARGS = {}, {} + for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end + code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", ")) + return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler) +end + +local Dispatchers = setmetatable({}, {__index=function(self, argCount) + local dispatcher = CreateDispatcher(argCount) + rawset(self, argCount, dispatcher) + return dispatcher +end}) + +-------------------------------------------------------------------------- +-- CallbackHandler:New +-- +-- target - target object to embed public APIs in +-- RegisterName - name of the callback registration API, default "RegisterCallback" +-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" +-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. + +function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused) + -- TODO: Remove this after beta has gone out + assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused") + + RegisterName = RegisterName or "RegisterCallback" + UnregisterName = UnregisterName or "UnregisterCallback" + if UnregisterAllName==nil then -- false is used to indicate "don't want this method" + UnregisterAllName = "UnregisterAllCallbacks" + end + + -- we declare all objects and exported APIs inside this closure to quickly gain access + -- to e.g. function names, the "target" parameter, etc + + + -- Create the registry object + local events = setmetatable({}, meta) + local registry = { recurse=0, events=events } + + -- registry:Fire() - fires the given event/message into the registry + function registry:Fire(eventname, ...) + if not rawget(events, eventname) or not next(events[eventname]) then return end + local oldrecurse = registry.recurse + registry.recurse = oldrecurse + 1 + + Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...) + + registry.recurse = oldrecurse + + if registry.insertQueue and oldrecurse==0 then + -- Something in one of our callbacks wanted to register more callbacks; they got queued + for eventname,callbacks in pairs(registry.insertQueue) do + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + for self,func in pairs(callbacks) do + events[eventname][self] = func + -- fire OnUsed callback? + if first and registry.OnUsed then + registry.OnUsed(registry, target, eventname) + first = nil + end + end + end + registry.insertQueue = nil + end + end + + -- Registration of a callback, handles: + -- self["method"], leads to self["method"](self, ...) + -- self with function ref, leads to functionref(...) + -- "addonId" (instead of self) with function ref, leads to functionref(...) + -- all with an optional arg, which, if present, gets passed as first argument (after self if present) + target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]]) + if type(eventname) ~= "string" then + error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2) + end + + method = method or eventname + + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + + if type(method) ~= "string" and type(method) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2) + end + + local regfunc + + if type(method) == "string" then + -- self["method"] calling style + if type(self) ~= "table" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2) + elseif self==target then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2) + elseif type(self[method]) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) self[method](self,arg,...) end + else + regfunc = function(...) self[method](self,...) end + end + else + -- function ref with self=object or self="addonId" + if type(self)~="table" and type(self)~="string" then + error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string expected.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) method(arg,...) end + else + regfunc = method + end + end + + + if events[eventname][self] or registry.recurse<1 then + -- if registry.recurse<1 then + -- we're overwriting an existing entry, or not currently recursing. just set it. + events[eventname][self] = regfunc + -- fire OnUsed callback? + if registry.OnUsed and first then + registry.OnUsed(registry, target, eventname) + end + else + -- we're currently processing a callback in this registry, so delay the registration of this new entry! + -- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency + registry.insertQueue = registry.insertQueue or setmetatable({},meta) + registry.insertQueue[eventname][self] = regfunc + end + end + + -- Unregister a callback + target[UnregisterName] = function(self, eventname) + if not self or self==target then + error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2) + end + if type(eventname) ~= "string" then + error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2) + end + if rawget(events, eventname) and events[eventname][self] then + events[eventname][self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(events[eventname]) then + registry.OnUnused(registry, target, eventname) + end + end + if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then + registry.insertQueue[eventname][self] = nil + end + end + + -- OPTIONAL: Unregister all callbacks for given selfs/addonIds + if UnregisterAllName then + target[UnregisterAllName] = function(...) + if select("#",...)<1 then + error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2) + end + if select("#",...)==1 and ...==target then + error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2) + end + + + for i=1,select("#",...) do + local self = select(i,...) + if registry.insertQueue then + for eventname, callbacks in pairs(registry.insertQueue) do + if callbacks[self] then + callbacks[self] = nil + end + end + end + for eventname, callbacks in pairs(events) do + if callbacks[self] then + callbacks[self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(callbacks) then + registry.OnUnused(registry, target, eventname) + end + end + end + end + end + end + + return registry +end + + +-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it +-- try to upgrade old implicit embeds since the system is selfcontained and +-- relies on closures to work. + diff --git a/libs/CallbackHandler-1.0/CallbackHandler-1.0.xml b/libs/CallbackHandler-1.0/CallbackHandler-1.0.xml new file mode 100644 index 0000000..876df83 --- /dev/null +++ b/libs/CallbackHandler-1.0/CallbackHandler-1.0.xml @@ -0,0 +1,4 @@ + +