From 0dc4efe059187ec0db136f961adc789a2250c704 Mon Sep 17 00:00:00 2001 From: River <110414133+Dreamlogic22@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:08:27 -0600 Subject: [PATCH] Updates for 11.0.7 --- .github/workflows/release.yml | 2 +- CHANGELOG.md | 3 ++ Core/Main.lua | 63 +++++++++++------------------------ TherapyWeeklyRewards.toc | 4 +-- 4 files changed, 25 insertions(+), 47 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7fc5fc8..74ca7de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: jobs: release: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout addon diff --git a/CHANGELOG.md b/CHANGELOG.md index f0eb750..cd415d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### December 17, 2024 ### +* Update TOC for 11.0.7. + ### October 22, 2024 ### * Update TOC for 11.0.5. diff --git a/Core/Main.lua b/Core/Main.lua index b51020d..cf9f49c 100644 --- a/Core/Main.lua +++ b/Core/Main.lua @@ -1,6 +1,6 @@ --[[-------------------------------------------------------------------- - Therapy Weekly Rewards 1.52 (October 22, 2024) + Therapy Weekly Rewards 1.53 (December 17, 2024) ----------------------------------------------------------------------]] @@ -19,7 +19,6 @@ local Earned = 0 local HasRewards = C_WeeklyRewards.HasAvailableRewards local Ready = false local ValueColor = RAID_CLASS_COLORS[select(2, UnitClass("player"))].colorStr -local WatchingLevel = false local function AddCatalystInfo(tooltip) tooltip:AddLine(format(L.CATALYST_CHARGES, CatalystCharges)) @@ -137,19 +136,9 @@ local function SetupActivity(activity) Activities[activity][3] = CreateFrame("Frame") end ----@param ownerId number? -local function Enable(ownerId) - if UnitLevel("player") == GetMaxLevelForLatestExpansion() then - if ownerId then - EventRegistry:UnregisterFrameEventAndCallback("PLAYER_LEVEL_UP", ownerId) - WatchingLevel = false - end - else - if not WatchingLevel then - EventRegistry:RegisterFrameEventAndCallback("PLAYER_LEVEL_UP", Enable) - WatchingLevel = true - end - +local function Enable() + if UnitLevel("player") ~= GetMaxLevelForLatestExpansion() then + EventUtil.RegisterOnceFrameEventAndCallback("PLAYER_LEVEL_UP", Enable) return end @@ -196,41 +185,27 @@ local function LoadDatabase() T.Defaults = nil end ----@param ownerId number ----@param addOnName string -local function OnLoad(ownerId, addOnName) - if addOnName == Name then - EventRegistry:UnregisterFrameEventAndCallback("ADDON_LOADED", ownerId) +local function OnLoad() + LoadDatabase() - LoadDatabase() + LibStub("AceConfig-3.0"):RegisterOptionsTable(Name, T.Options) + LibStub("AceConfigDialog-3.0"):AddToBlizOptions(Name, Name) - LibStub("AceConfig-3.0"):RegisterOptionsTable(Name, T.Options) - LibStub("AceConfigDialog-3.0"):AddToBlizOptions(Name, Name) - end -end + T.Icon = LibStub("LibDBIcon-1.0") ----@param ownerId number -local function OnLogin(ownerId) - if IsLoggedIn() then - EventRegistry:UnregisterFrameEventAndCallback("PLAYER_LOGIN", ownerId) - - T.Icon = LibStub("LibDBIcon-1.0") - - local LDB = LibStub("LibDataBroker-1.1") - if LDB then - Broker = LDB:NewDataObject(Name, { - type = "data source", - label = L.WEEKLY_REWARDS, - text = WrapTextInColorCode(NOT_APPLICABLE, ValueColor), - icon = [[Interface\AddOns\TherapyWeeklyRewards\Media\Vault]] - }) - end + local LDB = LibStub("LibDataBroker-1.1") + if LDB then + Broker = LDB:NewDataObject(Name, { + type = "data source", + label = L.WEEKLY_REWARDS, + text = WrapTextInColorCode(NOT_APPLICABLE, ValueColor), + icon = [[Interface\AddOns\TherapyWeeklyRewards\Media\Vault]] + }) end - if C_GameEnvironmentManager.GetCurrentGameEnvironment() == Enum.GameEnvironment.WoW then + if (C_GameEnvironmentManager.GetCurrentGameEnvironment() == Enum.GameEnvironment.WoW) and (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then C_Timer.After(1, Enable) end end -EventRegistry:RegisterFrameEventAndCallback("ADDON_LOADED", OnLoad) -EventRegistry:RegisterFrameEventAndCallback("PLAYER_LOGIN", OnLogin) \ No newline at end of file +EventUtil.ContinueOnAddOnLoaded(Name, OnLoad) \ No newline at end of file diff --git a/TherapyWeeklyRewards.toc b/TherapyWeeklyRewards.toc index 70b1c6e..a783bfc 100644 --- a/TherapyWeeklyRewards.toc +++ b/TherapyWeeklyRewards.toc @@ -1,6 +1,6 @@ -## Interface: 110005 +## Interface: 110007 ## Title: |cff33ff99Therapy|r Weekly Rewards -## Version: 1.52 +## Version: 1.53 ## SavedVariables: TherapyWeeklyRewardsDB ## Author: River ## Notes: Data broker for weekly activities progress.