-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSupportOperations.lua
More file actions
87 lines (73 loc) · 2.34 KB
/
Copy pathSupportOperations.lua
File metadata and controls
87 lines (73 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
local maxNonces = 1000 -- Keep only the last 1000 nonces
-- Ensure global HappyLog exists
if not HappyLog then
HappyLog = {}
end
-- Debug Print Function
function DebugPrint(...)
if HappyLogDB and HappyLogDB.debug then
print("|cffffd700[HappyLog Debug]:|r", ...)
end
end
-- Function to safely check if a table is empty
function IsTableEmpty(t)
return next(t) == nil
end
-- Function to capitalize the first letter of a string
function CapitalizeFirstLetter(str)
if not str or str == "" then return "" end
return str:sub(1,1):upper() .. str:sub(2):lower()
end
-- Function to safely copy a table
function SafeCopyTable(original)
if type(original) ~= "table" then return {} end
return CopyTable(original)
end
-- Sound notification
function PlayNotificationSound(sound)
PlaySoundFile(sound, "master")
end
function CapitalizeFirstLetter(str)
if not str or str == "" then
return ""
end
return str:sub(1, 1):upper() .. str:sub(2):lower()
end
function StripRealm(name)
return name:match("^(.-)-") or name -- Strips the realm name if present
end
function TrackPlayerMessage(event, text, playerName, ...)
if StripRealm(playerName) == UnitName("player") then
HappyLogDB.lastPlayerMessage = text
DebugPrint("Updated last player message:", HappyLogDB.lastPlayerMessage)
end
end
function JoinAddonChannel()
local channelName = "happylogalertschannel"
JoinChannelByName(channelName, nil, nil, false)
DebugPrint("|cffffd700[HappyLog]:|r Joined or already in channel:", channelName)
end
function CleanOldNonces(receivedNonces)
if #receivedNonces > maxNonces then
local excess = #receivedNonces - maxNonces
for i = 1, excess do
table.remove(receivedNonces, 1) -- Remove oldest entries
end
end
end
function OpenSettingsPanel()
if LibStub then
local ACD = LibStub("AceConfigDialog-3.0", true)
if ACD then
ACD:Open("HappyLog") -- Ensure "HappyLog" matches the registered name in your Ace3 options
return
end
end
DebugPrint("|cffff0000[HappyLog]:|r No valid settings panel API found!")
end
-- Function to print the current column order with placeholders
function PrintColumnOrder()
for i, column in ipairs(HappyLogDB.columnOrder) do
DebugPrint(column or "---")
end
end