Skip to content

Commit

Permalink
Add the config
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkthnx committed Jan 3, 2025
1 parent 54b0f50 commit 8452517
Show file tree
Hide file tree
Showing 17 changed files with 2,001 additions and 28 deletions.
100 changes: 100 additions & 0 deletions LevelUpFX/Config/About.lua
Original file line number Diff line number Diff line change
@@ -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)
62 changes: 62 additions & 0 deletions LevelUpFX/Config/Settings.lua
Original file line number Diff line number Diff line change
@@ -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)
55 changes: 30 additions & 25 deletions LevelUpFX/LevelUpFX.lua
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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),
Expand All @@ -130,4 +135,4 @@ SlashCmdList["LEVELUPDISPLAY"] = function(msg)
Spirit = math.random(0, 5),
}
ShowLevelUpMessage(testLevel, statGains)
end
end)
12 changes: 9 additions & 3 deletions LevelUpFX/LevelUpFX_Classic.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 14 additions & 0 deletions LevelUpFX/Libs/Dashi/embed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Ui>
<Script file='modules/build.lua'/>
<Script file='modules/misc.lua'/>
<Script file='modules/event.lua'/>
<Script file='modules/input.lua'/>
<Script file='modules/output.lua'/>
<Script file='modules/defer.lua'/>
<Script file='modules/locale.lua'/>
<Script file='modules/load.lua'/>
<Script file='modules/widgets.lua'/>
<Script file='modules/settings.lua'/>
<Script file='modules/library.lua'/>
<Script file='modules/object.lua'/>
</Ui>
37 changes: 37 additions & 0 deletions LevelUpFX/Libs/Dashi/modules/build.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
local _, addon = ...

--[[ namespace:IsRetail()
Checks if the current client is running the "retail" version.
--]]
function addon:IsRetail()
return WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
end

--[[ namespace:IsClassicEra()
Checks if the current client is running the "classic era" version (e.g. vanilla).
--]]
function addon:IsClassicEra()
return WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
end

--[[ namespace:IsClassic()
Checks if the current client is running the "classic" version.
--]]
function addon:IsClassic()
-- instead of using the floating constant for classic we'll just NOR the other two,
-- as they are static
return not addon:IsRetail() and not addon:IsClassicEra()
end

local _, buildVersion, _, interfaceVersion = GetBuildInfo()
--[[ namespace:HasBuild(_buildNumber_[, _interfaceVersion_])
Checks if the current client is running a build equal to or newer than the specified.
Optionally also check against the interface version.
--]]
function addon:HasBuild(build, interface)
if interface and interfaceVersion < interface then
return
end

return tonumber(buildVersion) >= build
end
Loading

0 comments on commit 8452517

Please sign in to comment.