add chat bubble configuration

This commit is contained in:
avitasia
2026-03-05 15:16:44 -08:00
parent 2f0d7294df
commit bcad865ec7
2 changed files with 164 additions and 0 deletions
+28
View File
@@ -52,6 +52,20 @@ L:RegisterTranslations("enUS", function()
["QOL Options"] = true, ["QOL Options"] = true,
["Quality of life options to prevent common issues"] = true, ["Quality of life options to prevent common issues"] = true,
["Chat Bubbles"] = true,
["Chat bubble options"] = true,
["Chat Bubbles (Say/Yell)"] = true,
["Whether to enable chat bubbles for /say and /yell messages."] = true,
["Chat Bubbles (Party)"] = true,
["Whether to enable chat bubbles for /party messages."] = true,
["Chat Bubbles (Whisper)"] = true,
["Whether to enable chat bubbles for /whisper messages."] = true,
["Chat Bubbles (Raid)"] = true,
["Whether to enable chat bubbles for /raid messages."] = true,
["Chat Bubbles (Battleground)"] = true,
["Whether to enable chat bubbles for battleground messages."] = true,
["Chat Bubble Distance"] = true,
["The distance in yards to show chat bubbles"] = true,
["Advanced options"] = true, ["Advanced options"] = true,
["Collection of various advanced options"] = true, ["Collection of various advanced options"] = true,
@@ -218,6 +232,20 @@ L:RegisterTranslations("zhCN", function()
["QOL Options"] = "便利性选项", ["QOL Options"] = "便利性选项",
["Quality of life options to prevent common issues"] = "用于防止常见错误的便利性选项", ["Quality of life options to prevent common issues"] = "用于防止常见错误的便利性选项",
["Chat Bubbles"] = "聊天气泡",
["Chat bubble options"] = "聊天气泡相关选项",
["Chat Bubbles (Say/Yell)"] = "聊天气泡(说话/大喊)",
["Whether to enable chat bubbles for /say and /yell messages."] = "是否为 /say 与 /yell 消息启用聊天气泡。",
["Chat Bubbles (Party)"] = "聊天气泡(队伍)",
["Whether to enable chat bubbles for /party messages."] = "是否为 /party 消息启用聊天气泡。",
["Chat Bubbles (Whisper)"] = "聊天气泡(密语)",
["Whether to enable chat bubbles for /whisper messages."] = "是否为 /whisper 消息启用聊天气泡。",
["Chat Bubbles (Raid)"] = "聊天气泡(团队)",
["Whether to enable chat bubbles for /raid messages."] = "是否为 /raid 消息启用聊天气泡。",
["Chat Bubbles (Battleground)"] = "聊天气泡(战场)",
["Whether to enable chat bubbles for battleground messages."] = "是否为战场消息启用聊天气泡。",
["Chat Bubble Distance"] = "聊天气泡距离",
["The distance in yards to show chat bubbles"] = "显示聊天气泡的最大距离(码)",
["Advanced options"] = "高级选项", ["Advanced options"] = "高级选项",
["Collection of various advanced options"] = "各类高级选项集合", ["Collection of various advanced options"] = "各类高级选项集合",
+136
View File
@@ -146,6 +146,14 @@ function Nampower:SavePerCharacterSettings()
settingData.set(settingData.get()) -- trigger the set function for each setting with the current value settingData.set(settingData.get()) -- trigger the set function for each setting with the current value
end end
end end
if Nampower.cmdtable.args.chat_bubbles then
for settingKey, settingData in pairs(Nampower.cmdtable.args.chat_bubbles.args) do
if settingData.get and settingData.set then
settingData.set(settingData.get())
end
end
end
end end
function Nampower:ApplySavedSettings() function Nampower:ApplySavedSettings()
@@ -195,6 +203,14 @@ function Nampower:ApplySavedSettings()
end end
end end
end end
if Nampower.cmdtable.args.chat_bubbles then
for settingKey, settingData in pairs(Nampower.cmdtable.args.chat_bubbles.args) do
if Nampower.db.profile[settingKey]~= nil and settingData.set then
settingData.set(Nampower.db.profile[settingKey])
end
end
end
end end
function Nampower:OnEnable() function Nampower:OnEnable()
@@ -496,6 +512,14 @@ Nampower.cmdtable = {
args = { args = {
}, },
}, },
chat_bubbles = {
type = "group",
name = L["Chat Bubbles"],
desc = L["Chat bubble options"],
order = 120,
args = {
},
},
spacerc3 = { spacerc3 = {
type = "header", type = "header",
name = " ", name = " ",
@@ -1094,6 +1118,118 @@ if Nampower:HasMinimumVersion(3, 1, 0) then
} }
end end
if Nampower:HasMinimumVersion(3, 3, 0) then
Nampower.cmdtable.args.chat_bubbles.args.ChatBubbles = {
type = "toggle",
name = L["Chat Bubbles (Say/Yell)"],
desc = L["Whether to enable chat bubbles for /say and /yell messages."],
order = 5,
get = function()
return GetCVar("ChatBubbles") == "1"
end,
set = function(v)
Nampower.db.profile.ChatBubbles = v
if v == true then
SetCVar("ChatBubbles", "1")
else
SetCVar("ChatBubbles", "0")
end
end,
}
Nampower.cmdtable.args.chat_bubbles.args.ChatBubblesParty = {
type = "toggle",
name = L["Chat Bubbles (Party)"],
desc = L["Whether to enable chat bubbles for /party messages."],
order = 10,
get = function()
return GetCVar("ChatBubblesParty") == "1"
end,
set = function(v)
Nampower.db.profile.ChatBubblesParty = v
if v == true then
SetCVar("ChatBubblesParty", "1")
else
SetCVar("ChatBubblesParty", "0")
end
end,
}
Nampower.cmdtable.args.chat_bubbles.args.NP_ChatBubblesWhisper = {
type = "toggle",
name = L["Chat Bubbles (Whisper)"],
desc = L["Whether to enable chat bubbles for /whisper messages."],
order = 15,
get = function()
return GetCVar("NP_ChatBubblesWhisper") == "1"
end,
set = function(v)
Nampower.db.profile.NP_ChatBubblesWhisper = v
if v == true then
SetCVar("NP_ChatBubblesWhisper", "1")
else
SetCVar("NP_ChatBubblesWhisper", "0")
end
end,
}
Nampower.cmdtable.args.chat_bubbles.args.NP_ChatBubblesRaid = {
type = "toggle",
name = L["Chat Bubbles (Raid)"],
desc = L["Whether to enable chat bubbles for /raid messages."],
order = 20,
get = function()
return GetCVar("NP_ChatBubblesRaid") == "1"
end,
set = function(v)
Nampower.db.profile.NP_ChatBubblesRaid = v
if v == true then
SetCVar("NP_ChatBubblesRaid", "1")
else
SetCVar("NP_ChatBubblesRaid", "0")
end
end,
}
Nampower.cmdtable.args.chat_bubbles.args.NP_ChatBubblesBattleground = {
type = "toggle",
name = L["Chat Bubbles (Battleground)"],
desc = L["Whether to enable chat bubbles for battleground messages."],
order = 25,
get = function()
return GetCVar("NP_ChatBubblesBattleground") == "1"
end,
set = function(v)
Nampower.db.profile.NP_ChatBubblesBattleground = v
if v == true then
SetCVar("NP_ChatBubblesBattleground", "1")
else
SetCVar("NP_ChatBubblesBattleground", "0")
end
end,
}
Nampower.cmdtable.args.chat_bubbles.args.NP_ChatBubbleDistance = {
type = "range",
name = L["Chat Bubble Distance"],
desc = L["The distance in yards to show chat bubbles"],
order = 30,
min = 5,
max = 100,
step = 1,
get = function()
local value = tonumber(GetCVar("NP_ChatBubbleDistance")) or 0
return math.floor(value + 0.5)
end,
set = function(v)
Nampower.db.profile.NP_ChatBubbleDistance = v
SetCVar("NP_ChatBubbleDistance", v)
end,
}
else
Nampower.cmdtable.args.chat_bubbles = nil
end
local deuce = Nampower:NewModule("Nampower Options Menu") local deuce = Nampower:NewModule("Nampower Options Menu")
deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar
deuce.consoleCmd = not deuce.hasFuBar deuce.consoleCmd = not deuce.hasFuBar