3 Commits
2 changed files with 26 additions and 6 deletions
+24 -4
View File
@@ -9,6 +9,7 @@ local defaults = {
chatAnnounce = true, chatAnnounce = true,
chatPercAnnounce = false, chatPercAnnounce = false,
reversePerc = false, reversePerc = false,
replaceWithEmote = true,
dingFormat = "DING! LEVEL {LEVEL}!", dingFormat = "DING! LEVEL {LEVEL}!",
percFormat = "{PERCENTAGE}% INTO LEVEL {LEVEL}!", percFormat = "{PERCENTAGE}% INTO LEVEL {LEVEL}!",
reversePercFormat = "{PERCENTAGE}% UNTIL LEVEL {NEXTLEVEL}!", reversePercFormat = "{PERCENTAGE}% UNTIL LEVEL {NEXTLEVEL}!",
@@ -60,6 +61,14 @@ local options = {
type = "toggle", type = "toggle",
set = function(_, value) LevelUpAnnouncer.db.profile.reversePerc = value end, set = function(_, value) LevelUpAnnouncer.db.profile.reversePerc = value end,
get = function() return LevelUpAnnouncer.db.profile.reversePerc end get = function() return LevelUpAnnouncer.db.profile.reversePerc end
},
replaceWithEmote = {
order = 5,
name = "Smart Message Mode",
desc = "Replace \"Message Mode\" with EMOTE if using SAY or YELL when not in an instance",
type = "toggle",
set = function(_, value) LevelUpAnnouncer.db.profile.replaceWithEmote = value end,
get = function() return LevelUpAnnouncer.db.profile.replaceWithEmote end
} }
} }
}, },
@@ -118,7 +127,7 @@ local options = {
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 (Only works in instances)\nYELL(Only works in instances)\nPARTY\nINSTANCE_CHAT\nRAID\nRAID_WARNING\nGUILD\nOFFICER\nEMOTE\nCHANNEL.X (So for channel 1 type: \"CHANNEL.1\", only works in instances)",
type = "input", type = "input",
set = function(_, value) LevelUpAnnouncer.db.profile.messageModeString = value end, set = function(_, value) LevelUpAnnouncer.db.profile.messageModeString = value end,
get = function() return LevelUpAnnouncer.db.profile.messageModeString end get = function() return LevelUpAnnouncer.db.profile.messageModeString end
@@ -153,7 +162,16 @@ local sendToChat = function(message)
local t = split(str, ".") local t = split(str, ".")
local channel local channel
if #t > 1 then channel = t[2] end if #t > 1 then channel = t[2] end
local mode = t[1] local mode = string.upper(t[1])
local replaceWithEmote = LevelUpAnnouncer.db.profile.replaceWithEmote
-- SendChatMessage is hardware event protected for modes "SAY", "YELL" and "CHANNEL" when player is "outdoors"
if not IsInInstance() and (mode == "SAY" or mode == "YELL" or mode == "CHANNEL") then
if replaceWithEmote and mode ~= "CHANNEL" then
mode = "EMOTE"
else
return
end
end
SendChatMessage(message, mode, nil, channel) SendChatMessage(message, mode, nil, channel)
end end
@@ -208,9 +226,11 @@ function LevelUpAnnouncer:PLAYER_XP_UPDATE()
if self.db.profile.reversePerc then stc = function(p) return sendToChat(replaceFormats(self.db.profile.reversePercFormat, 100 - p, self.curLevel)) end end if self.db.profile.reversePerc then stc = function(p) return sendToChat(replaceFormats(self.db.profile.reversePercFormat, 100 - p, self.curLevel)) end end
if self.xpPct>=0.25 and self.tmpPercIndex<1 then if self.xpPct>=0.25 and self.tmpPercIndex<1 then
stc(25) stc(25)
elseif self.xpPct>=0.5 and self.tmpPercIndex<2 then end
if self.xpPct>=0.5 and self.tmpPercIndex<2 then
stc(50) stc(50)
elseif self.xpPct>=0.75 and self.tmpPercIndex<3 then end
if self.xpPct>=0.75 and self.tmpPercIndex<3 then
stc(75) stc(75)
end end
self.tmpPercIndex = math.floor(self.xpPct * 4) self.tmpPercIndex = math.floor(self.xpPct * 4)
+2 -2
View File
@@ -1,6 +1,6 @@
## Interface: 70300 ## Interface: 80300
## Title: Level Up |cff2D8D0BAnnouncer|r ## Title: Level Up |cff2D8D0BAnnouncer|r
## Version: 2.0.3 ## Version: 2.0.6
## 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: