Skip to content

Commit

Permalink
v5.1.5
Browse files Browse the repository at this point in the history
- Removed - Debug for missing localization - [localizaton.lua]
- Removed - Excess debug output - [core.lua, initialization.lua, utils.lua]
- Removed - (temp) Redacted - 'Battle-Pets Level-Up!' - [core.lua, initialization.lua, , options.lua, utils.lua]
- Removed - Unused Dependancy - [BLU.toc, BLU_Vanilla.toc, BLU_Cata.toc]
  • Loading branch information
donniedice committed Sep 27, 2024
1 parent dcb2b3f commit a4015c5
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 214 deletions.
11 changes: 2 additions & 9 deletions BLU.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 110002
## Version: v5.1.4
## Title: |cff05dffaB|r|cffffffffetter|r |cff05dffaL|r|cffffffffevel-|r|cff05dffaU|r|cffffffffp!|r - |cff8080ffv5.1.4|r
## Version: v5.1.5
## Title: |cff05dffaB|r|cffffffffetter|r |cff05dffaL|r|cffffffffevel-|r|cff05dffaU|r|cffffffffp!|r - |cff8080ffv5.1.5|r
## Notes: Play sounds from other games! |n|r |cff05dffa/blu -|r Open options panel |n|r |cff05dffaBy Uivi US-BleedingHollow|r
## Author: DonnieDice
## Email: [email protected]
Expand All @@ -16,21 +16,14 @@

## Libraries
Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
Libs\AceAddon-3.0\AceAddon-3.0.xml
Libs\AceEvent-3.0\AceEvent-3.0.xml
Libs\AceTimer-3.0\AceTimer-3.0.xml
Libs\AceBucket-3.0\AceBucket-3.0.xml
Libs\AceHook-3.0\AceHook-3.0.xml
Libs\AceDB-3.0\AceDB-3.0.xml
Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
Libs\AceLocale-3.0\AceLocale-3.0.xml
Libs\AceConsole-3.0\AceConsole-3.0.xml
Libs\AceGUI-3.0\AceGUI-3.0.xml
Libs\AceConfig-3.0\AceConfig-3.0.xml
Libs\AceComm-3.0\AceComm-3.0.xml
Libs\AceTab-3.0\AceTab-3.0.xml
Libs\AceSerializer-3.0\AceSerializer-3.0.xml

data\localization.lua
data\initialization.lua
Expand Down
11 changes: 2 additions & 9 deletions BLU_Cata.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 40400
## Version: v5.1.4
## Title: |cff05dffaB|r|cffffffffetter|r |cff05dffaL|r|cffffffffevel-|r|cff05dffaU|r|cffffffffp!|r - |cff8080ffv5.1.4|r
## Version: v5.1.5
## Title: |cff05dffaB|r|cffffffffetter|r |cff05dffaL|r|cffffffffevel-|r|cff05dffaU|r|cffffffffp!|r - |cff8080ffv5.1.5|r
## Notes: Play sounds from other games! |n|r |cff05dffa/blu -|r Open options panel |n|r |cff05dffaBy Uivi US-BleedingHollow|r
## Author: DonnieDice
## Email: [email protected]
Expand All @@ -16,21 +16,14 @@

## Libraries
Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
Libs\AceAddon-3.0\AceAddon-3.0.xml
Libs\AceEvent-3.0\AceEvent-3.0.xml
Libs\AceTimer-3.0\AceTimer-3.0.xml
Libs\AceBucket-3.0\AceBucket-3.0.xml
Libs\AceHook-3.0\AceHook-3.0.xml
Libs\AceDB-3.0\AceDB-3.0.xml
Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
Libs\AceLocale-3.0\AceLocale-3.0.xml
Libs\AceConsole-3.0\AceConsole-3.0.xml
Libs\AceGUI-3.0\AceGUI-3.0.xml
Libs\AceConfig-3.0\AceConfig-3.0.xml
Libs\AceComm-3.0\AceComm-3.0.xml
Libs\AceTab-3.0\AceTab-3.0.xml
Libs\AceSerializer-3.0\AceSerializer-3.0.xml

data\localization.lua
data\initialization.lua
Expand Down
12 changes: 3 additions & 9 deletions BLU_Vanilla.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 11503
## Version: v5.1.4
## Title: |cff05dffaB|r|cffffffffetter|r |cff05dffaL|r|cffffffffevel-|r|cff05dffaU|r|cffffffffp!|r - |cff8080ffv5.1.4|r
## Version: v5.1.5
## Title: |cff05dffaB|r|cffffffffetter|r |cff05dffaL|r|cffffffffevel-|r|cff05dffaU|r|cffffffffp!|r - |cff8080ffv5.1.5|r
## Notes: Play sounds from other games! |n|r |cff05dffa/blu -|r Open options panel |n|r |cff05dffaBy Uivi US-BleedingHollow|r
## Author: DonnieDice
## Email: [email protected]
Expand All @@ -16,21 +16,15 @@

## Libraries
Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
Libs\AceAddon-3.0\AceAddon-3.0.xml
Libs\AceEvent-3.0\AceEvent-3.0.xml
Libs\AceTimer-3.0\AceTimer-3.0.xml
Libs\AceBucket-3.0\AceBucket-3.0.xml
Libs\AceHook-3.0\AceHook-3.0.xml
Libs\AceDB-3.0\AceDB-3.0.xml
Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
Libs\AceLocale-3.0\AceLocale-3.0.xml
Libs\AceConsole-3.0\AceConsole-3.0.xml
Libs\AceGUI-3.0\AceGUI-3.0.xml
Libs\AceConfig-3.0\AceConfig-3.0.xml
Libs\AceComm-3.0\AceComm-3.0.xml
Libs\AceTab-3.0\AceTab-3.0.xml
Libs\AceSerializer-3.0\AceSerializer-3.0.xml


data\localization.lua
data\initialization.lua
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# BLU | Better Level Up!
# BLU | Better Level-Up!

![](https://github.com/donniedice/BLU/blob/main/images/preview.png)

## Overview
**BLU | Better Level Up!** changes up the repetitive sounds in World of Warcraft, giving you the option to hear sounds from other games when you level up, complete Trade Post activities, gain reputation, or level up your Delve Companion.
**BLU | Better Level-Up!** changes up the repetitive sounds in World of Warcraft, giving you the option to hear sounds from other games when you level-up, complete Trade Post activities, gain reputation, or level-up your Delve Companion.

---

## Features
- **Achievements:** Play sounds from other games when you earn achievements.
- **Battle-Pets:** *(`R`etail Only)* Play sounds from other games when you level up battle-pets.
- **Delve Companion Level Up:** *(`R`etail Only)* Play sounds from other games when your Delve Companion levels up.
- **Battle-Pets:** *(`R`etail Only)* Play sounds from other games when you level-up battle-pets.
- **Delve Companion Level-Up:** *(`R`etail Only)* Play sounds from other games when your Delve Companion levels-up.
- **Honor Ranks:** *(`R`etail Only)* Play sounds from other games when you gain honor ranks.
- **Level Up:** Play sounds from other games when you level up.
- **Level-Up:** Play sounds from other games when you level-up.
- **Renown Reputation Ranks:** *(`R`etail Only)* Play sounds from other games when you gain DragonFlight renown reputation ranks.
- **Reputation Ranks:** Play sounds from other games when you gain reputation ranks.
- **Quests:** Play sounds from other games when you accept or turn in quests.
Expand Down Expand Up @@ -73,7 +73,7 @@ The addon can be managed using the following slash commands:
- Warcraft 3
- Witcher 3

*Note: When new sounds are added, they are listed in alphabetical order. This may change the selection order in the code for `Options.lua`. You may need to re-select previously selected sounds after updates.*
*Note: When new sounds are added, they are listed in alphabetical order. This may change the selection order in the code for `sounds.lua`. You may need to re-select previously selected sounds after updates.*

---

Expand Down
59 changes: 15 additions & 44 deletions data/core.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--=====================================================================================
-- BLU | Better Level Up! - core.lua (Fixing Misfires)
-- BLU | Better Level-Up! - core.lua
--=====================================================================================

function BLU:HandlePlayerLevelUp()
Expand Down Expand Up @@ -75,55 +75,30 @@ function BLU:TestRepSound()
end

--=====================================================================================
-- Reputation Event Handler with Hardcoded Rank Matching
-- Reputation Event Handler with Enhanced Rank Handling
--=====================================================================================
function BLU:ReputationChatFrameHook()
-- Ensure this hook is only added once
if BLU.chatFrameHooked then return end

local reputationRanks = {
"Exalted", "Revered", "Honored", "Friendly", "Neutral",
"Unfriendly", "Hostile", "Hated"
}

ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", function(_, _, msg)
self:PrintDebugMessage("INCOMING_CHAT_MESSAGE: " .. msg)

local rankFound = false
if string.match(msg, "You are now Exalted with") then
self:PrintDebugMessage("|cff00ff00Rank found: Exalted|r")
self:ReputationRankIncrease("Exalted", msg)
rankFound = true
elseif string.match(msg, "You are now Revered with") then
self:PrintDebugMessage("|cff00ff00Rank found: Revered|r")
self:ReputationRankIncrease("Revered", msg)
rankFound = true
elseif string.match(msg, "You are now Honored with") then
self:PrintDebugMessage("|cff00ff00Rank found: Honored|r")
self:ReputationRankIncrease("Honored", msg)
rankFound = true
elseif string.match(msg, "You are now Friendly with") then
self:PrintDebugMessage("|cff00ff00Rank found: Friendly|r")
self:ReputationRankIncrease("Friendly", msg)
rankFound = true
elseif string.match(msg, "You are now Neutral with") then
self:PrintDebugMessage("|cff00ff00Rank found: Neutral|r")
self:ReputationRankIncrease("Neutral", msg)
rankFound = true
elseif string.match(msg, "You are now Unfriendly with") then
self:PrintDebugMessage("|cff00ff00Rank found: Unfriendly|r")
self:ReputationRankIncrease("Unfriendly", msg)
rankFound = true
elseif string.match(msg, "You are now Hostile with") then
self:PrintDebugMessage("|cff00ff00Rank found: Hostile|r")
self:ReputationRankIncrease("Hostile", msg)
rankFound = true
elseif string.match(msg, "You are now Hated with") then
self:PrintDebugMessage("|cff00ff00Rank found: Hated|r")
self:ReputationRankIncrease("Hated", msg)
rankFound = true
end

if not rankFound then
self:PrintDebugMessage("NO_RANK_FOUND")
for _, rank in ipairs(reputationRanks) do
if string.match(msg, "You are now " .. rank .. " with") then
self:PrintDebugMessage("|cff00ff00Rank found: " .. rank .. "|r")
self:ReputationRankIncrease(rank, msg)
return false -- Ensure the message is not blocked
end
end

return false -- Ensure that the message is not blocked from being displayed
self:PrintDebugMessage("NO_RANK_FOUND")
return false
end)

BLU.chatFrameHooked = true
Expand All @@ -149,22 +124,18 @@ function BLU:ReputationRankIncrease(rank, msg)
end



--=====================================================================================
-- Delve Level-Up Event Handler
--=====================================================================================

function BLU:OnDelveCompanionLevelUp(event, ...)
self:PrintDebugMessage(BLU_L["DELVE_LEVEL_UP_AWAITING_CONFIRMATION"])

if event == "CHAT_MSG_SYSTEM" then
local msg = ...
self:PrintDebugMessage(BLU_L["INCOMING_CHAT_MESSAGE"] .. msg)

local levelUpMatch = string.match(msg, "Brann Bronzebeard has reached Level (%d+)")
if levelUpMatch then
local level = tonumber(levelUpMatch)
self:PrintDebugMessage(BLU_L["BRANN_LEVEL_UP_DETECTED"] .. level)
self:HandleEvent("DELVE_LEVEL_UP", "DelveLevelUpSoundSelect", "DelveLevelUpVolume", defaultSounds[3])
else
self:PrintDebugMessage(BLU_L["NO_LEVEL_FOUND"])
Expand Down
51 changes: 6 additions & 45 deletions data/initialization.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--=====================================================================================
-- BLU | Better Level Up! - initialization.lua
-- BLU | Better Level-Up! - initialization.lua
--=====================================================================================
BLU = LibStub("AceAddon-3.0"):NewAddon("BLU", "AceEvent-3.0", "AceConsole-3.0")

Expand All @@ -19,12 +19,7 @@ BLU.debugMode = false
BLU.showWelcomeMessage = true
BLU.sortedOptions = {}
BLU.optionsRegistered = false
BLU.previousPetLevels = {}
local isPetJournalInitialized = false
local PET_LEVEL_SOUND_COOLDOWN = 3

local PET_JOURNAL_POLL_INTERVAL = 0.1
local timeSinceLastPoll = 0

BLU_L = BLU_L or {}

Expand Down Expand Up @@ -61,36 +56,22 @@ function BLU:RegisterSharedEvents()
}

if version == "retail" then
-- Updated event registration for pet tracking
events.MAJOR_FACTION_RENOWN_LEVEL_CHANGED = "HandleRenownLevelChanged"
events.PERKS_ACTIVITY_COMPLETED = "HandlePerksActivityCompleted"
events.PET_BATTLE_LEVEL_CHANGED = "HandlePetLevelUp"
events.PET_JOURNAL_LIST_UPDATE = "UpdatePetData"
events.UNIT_PET_EXPERIENCE = "HandlePetLevelUp"
events.BAG_UPDATE_DELAYED = "HandlePetLevelUp"
events.ACHIEVEMENT_EARNED = "HandleAchievementEarned"
events.HONOR_LEVEL_UPDATE = "HandleHonorLevelUpdate"
-- Register events for Delve Companion level-up handling
events.TRAIT_CONFIG_UPDATED = "OnDelveCompanionLevelUp"
events.UPDATE_FACTION = "OnDelveCompanionLevelUp"
events.CHAT_MSG_SYSTEM = "OnDelveCompanionLevelUp" -- For Brann level-up system messages
events.CHAT_MSG_SYSTEM = "OnDelveCompanionLevelUp"
elseif version == "cata" then
events.ACHIEVEMENT_EARNED = "HandleAchievementEarned"
end

for event, handler in pairs(events) do
if type(self[handler]) == "function" then
self:RegisterEvent(event, handler)
else
if BLU_L["EVENT_HANDLER_NOT_FOUND"] then
self:PrintDebugMessage(string.format(BLU_L["EVENT_HANDLER_NOT_FOUND"], event, handler))
else
print("Missing localization for EVENT_HANDLER_NOT_FOUND") -- Fallback if the localization key is missing
end
end
end

self:PrintDebugMessage("EVENTS_REGISTERED")
end

--=====================================================================================
Expand All @@ -117,19 +98,12 @@ function BLU:OnInitialize()
-- Initialize options
self:InitializeOptions()

-- Debug messages for initial states
self:PrintDebugMessage("DEBUG_MODE_LOADED", tostring(self.debugMode))
self:PrintDebugMessage("SHOW_WELCOME_MESSAGE_LOADED", tostring(self.showWelcomeMessage))

-- Mute sounds based on game version
local soundsToMute = muteSoundIDs[self:GetGameVersion()]
if soundsToMute and #soundsToMute > 0 then
for _, soundID in ipairs(soundsToMute) do
MuteSoundFile(soundID)
self:PrintDebugMessage("MUTING_SOUND", soundID)
end
else
self:PrintDebugMessage("NO_SOUNDS_TO_MUTE")
end

-- Display the welcome message if enabled
Expand Down Expand Up @@ -186,12 +160,12 @@ end
function BLU:IsGroupCompatibleWithVersion(group, version)
if version == "retail" then
return true
elseif version == "cata" and (group.name:match("Honor Rank%-Up!") or group.name:match("Battle Pet Level%-Up!") or
elseif version == "cata" and (group.name:match("Honor Rank%-Up!") or
group.name:match("Delve Companion Level%-Up!") or group.name:match("Renown Rank%-Up!") or
group.name:match("Post%-Sound Select")) then
return false
elseif version == "vanilla" and (group.name:match("Achievement") or group.name:match("Honor Rank%-Up!") or
group.name:match("Battle Pet Level%-Up!") or group.name:match("Delve Companion Level%-Up!") or
group.name:match("Delve Companion Level%-Up!") or
group.name:match("Renown Rank%-Up!") or group.name:match("Post%-Sound Select")) then
return false
end
Expand All @@ -209,24 +183,22 @@ function BLU:RemoveOptionsForVersion(version)
args.group9 = nil
args.group11 = nil
self.db.profile.AchievementSoundSelect = nil
self.db.profile.BattlePetLevelSoundSelect = nil
--self.db.profile.BattlePetLevelSoundSelect = nil
self.db.profile.DelveLevelUpSoundSelect = nil
self.db.profile.HonorSoundSelect = nil
self.db.profile.RenownSoundSelect = nil
self.db.profile.PostSoundSelect = nil
self:PrintDebugMessage(BLU_L["VANILLA_OPTIONS_REMOVED"])
elseif version == "cata" then
args.group3 = nil
args.group4 = nil
args.group5 = nil
args.group9 = nil
args.group11 = nil
self.db.profile.BattlePetLevelSoundSelect = nil
--self.db.profile.BattlePetLevelSoundSelect = nil
self.db.profile.DelveLevelUpSoundSelect = nil
self.db.profile.HonorSoundSelect = nil
self.db.profile.RenownSoundSelect = nil
self.db.profile.PostSoundSelect = nil
self:PrintDebugMessage(BLU_L["CATA_OPTIONS_REMOVED"])
end
end

Expand All @@ -243,30 +215,19 @@ function BLU:AssignGroupColors()
for _, group in ipairs(self.sortedOptions) do
if group.name and group.args then
group.name = colors[patternIndex] .. group.name .. "|r"
self:PrintDebugMessage("GROUP_COLOR_APPLIED", group.name)

for _, arg in pairs(group.args) do
if arg.name and arg.name ~= "" then
arg.name = colors[patternIndex] .. arg.name .. "|r"
self:PrintDebugMessage("ARGUMENT_NAME_COLOR_APPLIED", arg.name)
else
self:PrintDebugMessage("SKIPPING_ARGUMENT_NAME")
end

if arg.desc and arg.desc ~= "" then
arg.desc = colors[(patternIndex % 2) + 1] .. arg.desc .. "|r"
self:PrintDebugMessage("DESCRIPTION_COLOR_APPLIED", arg.desc)
else
self:PrintDebugMessage("SKIPPING_ARGUMENT_DESC")
end
end

patternIndex = patternIndex % 2 + 1
else
self:PrintDebugMessage("SKIPPING_GROUP", group.name or "Unnamed Group")
end
end
else
self:PrintDebugMessage("NO_GROUPS_TO_COLOR")
end
end
Loading

0 comments on commit a4015c5

Please sign in to comment.