From 8452517884b8db9dd6159c721d7c5b6db6c2bee7 Mon Sep 17 00:00:00 2001 From: Kkthnx <40672673+Kkthnx@users.noreply.github.com> Date: Fri, 3 Jan 2025 14:34:06 -0500 Subject: [PATCH] Add the config --- LevelUpFX/Config/About.lua | 100 ++++ LevelUpFX/Config/Settings.lua | 62 +++ LevelUpFX/LevelUpFX.lua | 55 +- LevelUpFX/LevelUpFX_Classic.toc | 12 +- LevelUpFX/Libs/Dashi/embed.xml | 14 + LevelUpFX/Libs/Dashi/modules/build.lua | 37 ++ LevelUpFX/Libs/Dashi/modules/defer.lua | 78 +++ LevelUpFX/Libs/Dashi/modules/event.lua | 417 ++++++++++++++ LevelUpFX/Libs/Dashi/modules/input.lua | 41 ++ LevelUpFX/Libs/Dashi/modules/library.lua | 23 + LevelUpFX/Libs/Dashi/modules/load.lua | 35 ++ LevelUpFX/Libs/Dashi/modules/locale.lua | 35 ++ LevelUpFX/Libs/Dashi/modules/misc.lua | 184 +++++++ LevelUpFX/Libs/Dashi/modules/object.lua | 31 ++ LevelUpFX/Libs/Dashi/modules/output.lua | 37 ++ LevelUpFX/Libs/Dashi/modules/settings.lua | 635 ++++++++++++++++++++++ LevelUpFX/Libs/Dashi/modules/widgets.lua | 233 ++++++++ 17 files changed, 2001 insertions(+), 28 deletions(-) create mode 100644 LevelUpFX/Config/About.lua create mode 100644 LevelUpFX/Config/Settings.lua create mode 100644 LevelUpFX/Libs/Dashi/embed.xml create mode 100644 LevelUpFX/Libs/Dashi/modules/build.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/defer.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/event.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/input.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/library.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/load.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/locale.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/misc.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/object.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/output.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/settings.lua create mode 100644 LevelUpFX/Libs/Dashi/modules/widgets.lua diff --git a/LevelUpFX/Config/About.lua b/LevelUpFX/Config/About.lua new file mode 100644 index 0000000..c3c8969 --- /dev/null +++ b/LevelUpFX/Config/About.lua @@ -0,0 +1,100 @@ +local _, namespace = ... + +-- Function to create the About section canvas +local function CreateAboutCanvas(canvas) + -- Set the canvas size + canvas:SetAllPoints(true) + + -- Title + local title = canvas:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") + title:SetPoint("TOP", canvas, "TOP", 0, -70) + title:SetText("|cffFFD700LevelUpFX|r") -- Gold-colored title + + -- Description + local description = canvas:CreateFontString(nil, "ARTWORK", "GameFontHighlight") + description:SetPoint("TOP", title, "BOTTOM", 0, -10) + description:SetWidth(500) + description:SetText("Exclusively for Classic WoW Era Realms! \n\nLevelUpFX enhances your World of Warcraft Classic leveling experience by displaying animated notifications and stat gains for each level-up. Developed by Kkthnx, this addon ensures that every milestone in your Classic adventure feels rewarding and exciting.") + + -- Features Section + local featuresHeading = canvas:CreateFontString(nil, "ARTWORK", "GameFontNormal") + featuresHeading:SetPoint("TOPLEFT", description, "BOTTOMLEFT", 0, -20) + featuresHeading:SetText("|cffFFD700Key Features:|r") + + local features = canvas:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") + features:SetPoint("TOPLEFT", featuresHeading, "BOTTOMLEFT", 0, -10) + features:SetWidth(500) + features:SetText("- Custom level-up notifications with vibrant animations.\n" .. "- Displays stats gained on level-up (Strength, Agility, etc.).\n" .. "- Automatically performs the /cheer emote to celebrate.\n" .. "- Prevents overlapping notifications for seamless display.\n" .. "- Test effects easily with the /leveluptest command.") + + -- Purpose Section + local purposeHeading = canvas:CreateFontString(nil, "ARTWORK", "GameFontNormal") + purposeHeading:SetPoint("TOPLEFT", features, "BOTTOMLEFT", 0, -20) + purposeHeading:SetText("|cffFFD700Why Choose LevelUpFX?|r") + + local purpose = canvas:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") + purpose:SetPoint("TOPLEFT", purposeHeading, "BOTTOMLEFT", 0, -10) + purpose:SetWidth(500) + purpose:SetText("LevelUpFX was crafted to make leveling up in Classic WoW a truly celebratory moment. With sleek visuals and interactive features, it enhances your journey through Azeroth, turning each level-up into a memory worth cherishing.") + + -- Slash Commands Section + local commandsHeading = canvas:CreateFontString(nil, "ARTWORK", "GameFontNormal") + commandsHeading:SetPoint("TOPLEFT", purpose, "BOTTOMLEFT", 0, -20) + commandsHeading:SetText("|cffFFD700Slash Commands:|r") + + local commands = canvas:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") + commands:SetPoint("TOPLEFT", commandsHeading, "BOTTOMLEFT", 0, -10) + commands:SetWidth(500) + commands:SetText("/leveluptest - Test the addon and preview notifications.") + + -- Contributions Section + local contributionsHeading = canvas:CreateFontString(nil, "ARTWORK", "GameFontNormal") + contributionsHeading:SetPoint("TOPLEFT", commands, "BOTTOMLEFT", 0, -20) + contributionsHeading:SetText("|cffFFD700Feedback & Support:|r") + + -- PayPal Button + local paypalButton = CreateFrame("Button", nil, canvas, "UIPanelButtonTemplate") + paypalButton:SetPoint("TOPLEFT", contributionsHeading, "BOTTOMLEFT", 0, -10) + paypalButton:SetSize(150, 25) + paypalButton:SetText("Donate via PayPal") + paypalButton:SetScript("OnClick", function() + print("Visit this link to donate: https://www.paypal.com/paypalme/kkthnxtv") + end) + paypalButton:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("Click to open the donation link.") + GameTooltip:Show() + end) + paypalButton:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + + -- Feedback Button + local feedbackButton = CreateFrame("Button", nil, canvas, "UIPanelButtonTemplate") + feedbackButton:SetPoint("TOPLEFT", paypalButton, "BOTTOMLEFT", 0, -10) + feedbackButton:SetSize(150, 25) + feedbackButton:SetText("Report Feedback") + feedbackButton:SetScript("OnClick", function() + print("Visit the repository for feedback: https://github.com/Kkthnx-Wow/LevelUpFX") + end) + feedbackButton:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText("Click to open the feedback repository.") + GameTooltip:Show() + end) + feedbackButton:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + + -- Support Section + local supportHeading = canvas:CreateFontString(nil, "ARTWORK", "GameFontNormal") + supportHeading:SetPoint("TOPLEFT", feedbackButton, "BOTTOMLEFT", 0, -20) + supportHeading:SetText("|cffFFD700Support:|r") + + local support = canvas:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") + support:SetPoint("TOPLEFT", supportHeading, "BOTTOMLEFT", 0, -10) + support:SetWidth(500) + support:SetText("Have feedback, ideas, or bugs to report? Click 'Report Feedback' or contact us directly. Thank you for using LevelUpFX!") +end + +-- Register the About canvas with the interface +namespace:RegisterSubSettingsCanvas("About LevelUpFX", CreateAboutCanvas) diff --git a/LevelUpFX/Config/Settings.lua b/LevelUpFX/Config/Settings.lua new file mode 100644 index 0000000..8903e83 --- /dev/null +++ b/LevelUpFX/Config/Settings.lua @@ -0,0 +1,62 @@ +local _, namespace = ... + +namespace:RegisterSettings("LevelUpFXDB", { + { + key = "enableAddon", + type = "toggle", + title = "Enable LevelUpFX", + tooltip = "Enable or disable the LevelUpFX addon.", + default = true, + }, + { + key = "cheerOnLevelUp", + type = "toggle", + title = "Cheer on Level Up", + tooltip = "50% chance to perform the 'CHEER' emote when you level up.", + default = false, + }, + { + key = "chatEmoteOnLevelUp", + type = "toggle", + title = "Send Level-Up Emote in Chat", + tooltip = "Send a message to the chat indicating you leveled up.", + default = false, + }, + { + key = "frameScale", + type = "slider", + title = "Frame Scale", + tooltip = "Adjust the scale of the level-up notification frame.", + default = 0.9, + minValue = 0.5, + maxValue = 1.0, + valueStep = 0.1, + valueFormat = "%.1f", -- Format value to 1 decimal place + }, +}) + +namespace:RegisterOptionCallback("enableAddon", function(value) + if not value then + -- Hide the frame if the addon is disabled + if namespace.currentFrame then + namespace.currentFrame:Hide() + end + -- print("|cff5bc0beLevelUpFX|r |cffff0000disabled.|r") + else + -- print("|cff5bc0beLevelUpFX|r |cff00ff00enabled.|r") + end +end) + +namespace:RegisterOptionCallback("frameScale", function(value) + if namespace.currentFrame then + namespace.currentFrame:SetScale(value) + end +end) + +namespace:RegisterOptionCallback("cheerOnLevelUp", function(value) + namespace.cheerEnabled = value +end) + +namespace:RegisterOptionCallback("chatEmoteOnLevelUp", function(value) + namespace.chatEmoteEnabled = value +end) diff --git a/LevelUpFX/LevelUpFX.lua b/LevelUpFX/LevelUpFX.lua index 85058b1..2e4abb7 100644 --- a/LevelUpFX/LevelUpFX.lua +++ b/LevelUpFX/LevelUpFX.lua @@ -1,22 +1,25 @@ --- Create the addon frame and register events -local LevelUpDisplay = CreateFrame("Frame", "LevelUpDisplayFrame") -LevelUpDisplay:RegisterEvent("PLAYER_LEVEL_UP") +local _, namespace = ... -- Reference to the currently displayed frame -local currentFrame = nil +namespace.currentFrame = nil -- Function to create and show the level-up message local function ShowLevelUpMessage(level, statGains) + if not namespace:GetOption("enableAddon") then + return + end + -- Hide any existing frame to prevent overlap - if currentFrame and currentFrame:IsShown() then - currentFrame:Hide() + if namespace.currentFrame and namespace.currentFrame:IsShown() then + namespace.currentFrame:Hide() end -- Create the main frame for the level-up display local frame = CreateFrame("Frame", nil, UIParent) frame:SetSize(600, 150) -- Adjusted width to accommodate horizontal layout frame:SetPoint("CENTER", 0, 400) - currentFrame = frame -- Save reference to the current frame + frame:SetScale(namespace:GetOption("frameScale")) -- Apply scale from settings + namespace.currentFrame = frame -- Save reference to the current frame -- Background texture local background = frame:CreateTexture(nil, "BACKGROUND") @@ -96,31 +99,33 @@ local function ShowLevelUpMessage(level, statGains) frame:Show() fadeOutAnimation:Play() - -- Perform the "CHEER" emote - if math.random() < 0.5 then - DoEmote("CHEER") + -- Perform the "CHEER" emote if enabled + if namespace:GetOption("cheerOnLevelUp") then + if math.random() < 0.5 then + DoEmote("CHEER") + end + end + + -- Send chat emote if enabled + if namespace:GetOption("chatEmoteOnLevelUp") then SendChatMessage("has reached level " .. level .. "!", "EMOTE") end end -- Event handler -LevelUpDisplay:SetScript("OnEvent", function(_, event, ...) - if event == "PLAYER_LEVEL_UP" then - local level, _, _, _, _, strengthDelta, agilityDelta, staminaDelta, intellectDelta, spiritDelta = ... - local statGains = { - Strength = strengthDelta or 0, - Agility = agilityDelta or 0, - Stamina = staminaDelta or 0, - Intellect = intellectDelta or 0, - Spirit = spiritDelta or 0, - } - ShowLevelUpMessage(level, statGains) - end +namespace:RegisterEvent("PLAYER_LEVEL_UP", function(_, level, _, _, _, strengthDelta, agilityDelta, staminaDelta, intellectDelta, spiritDelta) + local statGains = { + Strength = strengthDelta or 0, + Agility = agilityDelta or 0, + Stamina = staminaDelta or 0, + Intellect = intellectDelta or 0, + Spirit = spiritDelta or 0, + } + ShowLevelUpMessage(level, statGains) end) -- Slash command for testing -SLASH_LEVELUPDISPLAY1 = "/leveluptest" -SlashCmdList["LEVELUPDISPLAY"] = function(msg) +namespace:RegisterSlash("/leveluptest", function(msg) local testLevel = tonumber(msg) or math.random(2, 60) local statGains = { Strength = math.random(0, 5), @@ -130,4 +135,4 @@ SlashCmdList["LEVELUPDISPLAY"] = function(msg) Spirit = math.random(0, 5), } ShowLevelUpMessage(testLevel, statGains) -end +end) diff --git a/LevelUpFX/LevelUpFX_Classic.toc b/LevelUpFX/LevelUpFX_Classic.toc index 28390f0..f031c4b 100644 --- a/LevelUpFX/LevelUpFX_Classic.toc +++ b/LevelUpFX/LevelUpFX_Classic.toc @@ -3,11 +3,17 @@ ## Title: |cff5bc0beLevelUpFX|r ## Notes: Celebrate your level-ups with style! Displays a animated message and stats gained whenever you level up in World of Warcraft Classic Era.|n|n|cff669DFFDeveloper|cffffffff:|r |nJosh "|CFF7b8489Kkthnx|r" Russell|n|n|cff009cdePayPal|r|cffffffff:|r |n|cffffffffwww.paypal.me/KkthnxTV|r|n|n|cfff96854Patreon|r|cffffffff:|r |n|cffffffffwww.patreon.com/Kkthnx|r ## Author: Josh "Kkthnx" Russell -## Version: 1.0.0 +## Version: 1.0.1 ## IconTexture: 236567 +## SavedVariables: LevelUpFXDB ## X-Support: Classic -## X-Curse-Project-ID: +## X-Curse-Project-ID: 1170497 ## X-Wago-ID: -# LevelUpFX +# Libraries +Libs\Dashi\embed.xml +# Config +Config\Settings.lua +Config\About.lua +# Core LevelUpFX.lua \ No newline at end of file diff --git a/LevelUpFX/Libs/Dashi/embed.xml b/LevelUpFX/Libs/Dashi/embed.xml new file mode 100644 index 0000000..a95e3b6 --- /dev/null +++ b/LevelUpFX/Libs/Dashi/embed.xml @@ -0,0 +1,14 @@ + +