from retail

This commit is contained in:
NoM0Re
2025-01-16 02:47:58 +01:00
parent ccb4d4af95
commit 24196cd7ce
11 changed files with 164 additions and 52 deletions
+45 -7
View File
@@ -160,6 +160,16 @@ local function SoundRepeatStop(self)
Private.StopProfileSystem("sound");
end
--[[
local function SoundStop(self)
Private.StartProfileSystem("sound");
if (self.soundHandle) then
StopSound(self.soundHandle);
end
Private.StopProfileSystem("sound");
end
]]
local function SoundPlayHelper(self)
Private.StartProfileSystem("sound");
local options = self.soundOptions;
@@ -174,24 +184,52 @@ local function SoundPlayHelper(self)
end
if (options.sound == " custom") then
if (options.sound_path) then
pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master");
end
local ok, _, handle = pcall(PlaySoundFile, options.sound_path, options.sound_channel or "Master")
--if ok then
--self.soundHandle = handle
--end
elseif (options.sound == " KitID") then
if (options.sound_kit_id) then
pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master");
end
local ok, _, handle = pcall(PlaySound, options.sound_kit_id, options.sound_channel or "Master")
--if ok then
--self.soundHandle = handle
--end
else
pcall(PlaySoundFile, options.sound, options.sound_channel or "Master");
local ok, _, handle = pcall(PlaySoundFile, options.sound, options.sound_channel or "Master")
--if ok then
--self.soundHandle = handle
--end
end
Private.StopProfileSystem("sound");
end
local function hasSound(options)
if (options.sound == " custom") then
if (options.sound_path and options.sound_path ~= "") then
return true
end
elseif (options.sound == " KitID") then
if (options.sound_kit_id and options.sound_kit_id ~= "") then
return true
end
else
if options.sound and options.sound ~= "" then
return true
end
end
return false
end
local function SoundPlay(self, options)
if (not options or WeakAuras.IsOptionsOpen()) then
return
end
Private.StartProfileSystem("sound");
if not hasSound(options) then
Private.StopProfileSystem("sound")
return
end
--self:SoundStop();
self:SoundRepeatStop();
self.soundOptions = options;