-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsounds.lua
More file actions
39 lines (33 loc) · 940 Bytes
/
sounds.lua
File metadata and controls
39 lines (33 loc) · 940 Bytes
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
Achiever = Achiever or {}
local basepath = "Interface\\AddOns\\Achiever\\Sounds\\"
local rarepath = basepath .. "Rare\\"
local normpath = basepath .. "Normal\\"
Achiever.raresounds = {
rarepath .. "FinalFantasy1.mp3",
rarepath .. "FinalFantasy.mp3",
rarepath .. "FFXI.mp3",
rarepath .. "Proof-Of-A-Hero.mp3",
}
Achiever.normalsounds = {
normpath .. "Pokemon.mp3",
normpath .. "Diablo2Lvlup.mp3",
normpath .. "xboxonerareachievement.mp3",
}
--- Randomly play a sound from the provided list
---@param list table
function Achiever.playsound(list)
if not Achiever.IsSoundEnabled() then
return
end
if not list or #list == 0 then
print("Achiever: No sounds available in the provided list.")
return
end
local index = math.random(#list)
local path = list[index]
if path then
PlaySoundFile(path, "Master") -- "Master" plays even if sound effects are off
else
print("Achiever: Failed to retrieve sound path.")
end
end