fixed a bug where it would sometimes yell 25% on first login
This commit is contained in:
parent
ecd020e49e
commit
63496f67a2
45
Core.lua
45
Core.lua
|
@ -1,6 +1,7 @@
|
||||||
LevelUpAnnouncer = LibStub("AceAddon-3.0"):NewAddon("LevelUpAnnouncer", "AceConsole-3.0", "AceEvent-3.0")
|
LevelUpAnnouncer = LibStub("AceAddon-3.0"):NewAddon("LevelUpAnnouncer", "AceConsole-3.0", "AceEvent-3.0")
|
||||||
|
|
||||||
local version = "2.0.2"
|
local version = GetAddOnMetadata("LevelUpAnnouncer", "Version")
|
||||||
|
local author = GetAddOnMetadata("LevelUpAnnouncer", "Author")
|
||||||
|
|
||||||
local defaults = {
|
local defaults = {
|
||||||
profile = {
|
profile = {
|
||||||
|
@ -20,7 +21,7 @@ local options = {
|
||||||
type = "group",
|
type = "group",
|
||||||
args = {
|
args = {
|
||||||
LUPHeader = {
|
LUPHeader = {
|
||||||
name = "Level Up Announcer - by oskar3123 - version " .. version,
|
name = "Level Up Announcer - by " .. author .. " - version " .. version,
|
||||||
type = "header"
|
type = "header"
|
||||||
},
|
},
|
||||||
LUPToggles = {
|
LUPToggles = {
|
||||||
|
@ -33,32 +34,32 @@ local options = {
|
||||||
name = "Enable Sound",
|
name = "Enable Sound",
|
||||||
desc = "Play a sound each time you level up",
|
desc = "Play a sound each time you level up",
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.playSound = value end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.playSound = value end,
|
||||||
get = function(info) return LevelUpAnnouncer.db.profile.playSound end
|
get = function() return LevelUpAnnouncer.db.profile.playSound end
|
||||||
},
|
},
|
||||||
chatAnnounce = {
|
chatAnnounce = {
|
||||||
order = 2,
|
order = 2,
|
||||||
name = "Chat Announce",
|
name = "Chat Announce",
|
||||||
desc = "Announces in chat when you level up",
|
desc = "Announces in chat when you level up",
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.chatAnnounce = value end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.chatAnnounce = value end,
|
||||||
get = function(info) return LevelUpAnnouncer.db.profile.chatAnnounce end
|
get = function() return LevelUpAnnouncer.db.profile.chatAnnounce end
|
||||||
},
|
},
|
||||||
chatPercAnnounce = {
|
chatPercAnnounce = {
|
||||||
order = 3,
|
order = 3,
|
||||||
name = "Percentage Announce",
|
name = "Percentage Announce",
|
||||||
desc = "Announces in chat when you pass a percentage barrier (25%, 50% and 75%)",
|
desc = "Announces in chat when you pass a percentage barrier (25%, 50% and 75%)",
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.chatPercAnnounce = value end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.chatPercAnnounce = value end,
|
||||||
get = function(info) return LevelUpAnnouncer.db.profile.chatPercAnnounce end
|
get = function() return LevelUpAnnouncer.db.profile.chatPercAnnounce end
|
||||||
},
|
},
|
||||||
reversePerc = {
|
reversePerc = {
|
||||||
order = 4,
|
order = 4,
|
||||||
name = "Reverse Percentages",
|
name = "Reverse Percentages",
|
||||||
desc = "Reverses the percentages in percentage announce mode (announces 75% when at 25%, 50% at 50% and 25% at 75%)",
|
desc = "Reverses the percentages in percentage announce mode (announces 75% when at 25%, 50% at 50% and 25% at 75%)",
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.reversePerc = value end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.reversePerc = value end,
|
||||||
get = function(info) return LevelUpAnnouncer.db.profile.reversePerc end
|
get = function() return LevelUpAnnouncer.db.profile.reversePerc end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -73,24 +74,24 @@ local options = {
|
||||||
name = "Level Up Announce Format",
|
name = "Level Up Announce Format",
|
||||||
desc = "The format used when you level up",
|
desc = "The format used when you level up",
|
||||||
type = "input",
|
type = "input",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.dingFormat = value end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.dingFormat = value end,
|
||||||
get = function(info) return LevelUpAnnouncer.db.profile.dingFormat end
|
get = function() return LevelUpAnnouncer.db.profile.dingFormat end
|
||||||
},
|
},
|
||||||
percFormat = {
|
percFormat = {
|
||||||
order = 2,
|
order = 2,
|
||||||
name = "Percentage Announce Format",
|
name = "Percentage Announce Format",
|
||||||
desc = "The format used when you pass a percentage barrier (25%, 50% and 75%)",
|
desc = "The format used when you pass a percentage barrier (25%, 50% and 75%)",
|
||||||
type = "input",
|
type = "input",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.percFormat = value end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.percFormat = value end,
|
||||||
get = function(info) return LevelUpAnnouncer.db.profile.percFormat end
|
get = function() return LevelUpAnnouncer.db.profile.percFormat end
|
||||||
},
|
},
|
||||||
reversePercFormat = {
|
reversePercFormat = {
|
||||||
order = 3,
|
order = 3,
|
||||||
name = "Reversed Percentage Announce Format",
|
name = "Reversed Percentage Announce Format",
|
||||||
desc = "The format used when you pass a percentage barrier in reverse mode (75%, 50% and 25%)",
|
desc = "The format used when you pass a percentage barrier in reverse mode (75%, 50% and 25%)",
|
||||||
type = "input",
|
type = "input",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.reversePercFormat = value end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.reversePercFormat = value end,
|
||||||
get = function(info) return LevelUpAnnouncer.db.profile.reversePercFormat end
|
get = function() return LevelUpAnnouncer.db.profile.reversePercFormat end
|
||||||
},
|
},
|
||||||
placeholderHelp = {
|
placeholderHelp = {
|
||||||
order = 4,
|
order = 4,
|
||||||
|
@ -111,16 +112,16 @@ local options = {
|
||||||
type = "input",
|
type = "input",
|
||||||
pattern = "(%d)",
|
pattern = "(%d)",
|
||||||
usage = "Only numbers are allowed",
|
usage = "Only numbers are allowed",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.soundID = tonumber(value) end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.soundID = tonumber(value) end,
|
||||||
get = function(info) return tostring(LevelUpAnnouncer.db.profile.soundID) end
|
get = function() return tostring(LevelUpAnnouncer.db.profile.soundID) end
|
||||||
},
|
},
|
||||||
messageMode = {
|
messageMode = {
|
||||||
order = 2,
|
order = 2,
|
||||||
name = "Message Mode",
|
name = "Message Mode",
|
||||||
desc = "Modes:\nSAY\nYELL\nPARTY\nINSTANCE_CHAT\nRAID\nRAID_WARNING\nGUILD\nOFFICER\nEMOTE\nCHANNEL.X (So for channel 1 type: \"CHANNEL.1\")",
|
desc = "Modes:\nSAY\nYELL\nPARTY\nINSTANCE_CHAT\nRAID\nRAID_WARNING\nGUILD\nOFFICER\nEMOTE\nCHANNEL.X (So for channel 1 type: \"CHANNEL.1\")",
|
||||||
type = "input",
|
type = "input",
|
||||||
set = function(info, value) LevelUpAnnouncer.db.profile.messageModeString = value end,
|
set = function(_, value) LevelUpAnnouncer.db.profile.messageModeString = value end,
|
||||||
get = function(info) return LevelUpAnnouncer.db.profile.messageModeString end
|
get = function() return LevelUpAnnouncer.db.profile.messageModeString end
|
||||||
},
|
},
|
||||||
testSound = {
|
testSound = {
|
||||||
order = 3,
|
order = 3,
|
||||||
|
@ -176,7 +177,7 @@ function LevelUpAnnouncer:OnInitialize()
|
||||||
LevelUpAnnouncer:RegisterEvent("PLAYER_LEVEL_UP")
|
LevelUpAnnouncer:RegisterEvent("PLAYER_LEVEL_UP")
|
||||||
LevelUpAnnouncer:RegisterEvent("PLAYER_XP_UPDATE")
|
LevelUpAnnouncer:RegisterEvent("PLAYER_XP_UPDATE")
|
||||||
|
|
||||||
local command = function(msg) LibStub("AceConfigDialog-3.0"):Open("LevelUpAnnouncer") end
|
local command = function() LibStub("AceConfigDialog-3.0"):Open("LevelUpAnnouncer") end
|
||||||
LevelUpAnnouncer:RegisterChatCommand("levelup", command)
|
LevelUpAnnouncer:RegisterChatCommand("levelup", command)
|
||||||
LevelUpAnnouncer:RegisterChatCommand("lvlup", command)
|
LevelUpAnnouncer:RegisterChatCommand("lvlup", command)
|
||||||
end
|
end
|
||||||
|
@ -186,7 +187,7 @@ function LevelUpAnnouncer:PLAYER_LOGIN()
|
||||||
self.tmpPercIndex = math.floor(self.xpPct * 4)
|
self.tmpPercIndex = math.floor(self.xpPct * 4)
|
||||||
self.curLevel = UnitLevel("player")
|
self.curLevel = UnitLevel("player")
|
||||||
|
|
||||||
print("|cff0066FFLevel Up Announcer|r, by |cff0066FFoskar3123|r, version |cff0066FF" ..version .. "|r loaded, /" .. "|cff0066FFlevelup|r for settings.")
|
print("|cff0066FFLevel Up Announcer|r, by |cff0066FF" .. author .. "|r, version |cff0066FF" ..version .. "|r loaded, /" .. "|cff0066FFlevelup|r for settings.")
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelUpAnnouncer:PLAYER_LEVEL_UP()
|
function LevelUpAnnouncer:PLAYER_LEVEL_UP()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
## Interface: 70200
|
## Interface: 70200
|
||||||
## Title: Level Up |cff2D8D0BAnnouncer|r
|
## Title: Level Up |cff2D8D0BAnnouncer|r
|
||||||
|
## Version: 2.0.2
|
||||||
## Author: oskar3123
|
## Author: oskar3123
|
||||||
## Notes: A simple addon to play a sound and/or yell in chat when you level up
|
## Notes: A simple addon to play a sound and/or yell in chat when you level up
|
||||||
## Dependencies:
|
## Dependencies:
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package-as: LevelUpAnnouncer
|
||||||
|
enable-nolib-creation: no
|
||||||
|
|
||||||
|
ignore:
|
||||||
|
- README.md
|
||||||
|
|
||||||
|
license-output: LICENSE.txt
|
Loading…
Reference in New Issue