From 6460546c8b3c598b4c13fbae12f238af89cc63fa Mon Sep 17 00:00:00 2001 From: speedwaystar Date: Sun, 5 Feb 2023 00:45:25 +0800 Subject: [PATCH 1/2] register sounds with Shared Media Library --- SmartBuff.lua | 54 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/SmartBuff.lua b/SmartBuff.lua index 04dd39e..85d0d48 100644 --- a/SmartBuff.lua +++ b/SmartBuff.lua @@ -141,10 +141,40 @@ local Icons = { }; -- available sounds (25) +---@type LSM local sharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") -local sounds = sharedMedia:List(sharedMedia.MediaType.SOUND) --- dump(sounds) local Sounds = { 1141, 3784, 4574, 17318, 15262, 13830, 15273, 10042, 10720, 17316, 3337, 7894, 7914, 10033, 416, 57207, 78626, 49432, 10571, 58194, 21970, 17339, 84261, 43765} +local soundTable = { + ["Deathbind_Sound"] = 1141, + ["Air_Elemental"] = 3784, + ["PVP_Update"] = 4574, + ["LFG_DungeonReady"] = 17318, + ["Aggro_Enter_Warning_State"] = 15262, + ["Glyph_MinorDestroy"] = 13830, + ["GM_ChatWarning"] = 15273, + ["SPELL_SpellReflection_State_Shield"] = 10042, + ["Disembowel_Impact"] = 10720, + ["LFG_Rewards"] = 17316, + ["EyeOfKilrogg_Death"] = 3337, + ["TextEmote_HuF_Sigh"] = 7894, + ["TextEmote_HuM_Sigh"] = 7914, + ["TextEmote_BeM_Whistle"] = 10033, + ["Murloc_Aggro"] = 416, + ["SPELL_WR_ShieldSlam_Revamp_Cast"] = 57207, + ["Spell_Moroes_Vanish_poof_01"] = 78626, + ["SPELL_WR_WhirlWind_Proto_Cast"] = 49432, + ["Fel_Reaver_Alarm"] = 10571, + ["SPELL_RO_SaberSlash_Cast"] = 58194, + ["FX_ArcaneMagic_DarkSwell"] = 21970, + ["Epic_Fart"] = 17339, + ["VO_72_LASAN_SKYHORN_WOUND"] = 84261, + ["SPELL_PA_SealofInsight"] = 43765 +} +for soundName, soundData in pairs(soundTable) do + sharedMedia:Register(sharedMedia.MediaType.SOUND, soundName, soundData ) +end +local sounds = sharedMedia:HashTable("sound") +-- dump(sounds) local DebugChatFrame = DEFAULT_CHAT_FRAME; @@ -159,7 +189,6 @@ StaticPopupDialogs["SMARTBUFF_DATA_PURGE"] = { hideOnEscape = 1 } - -- Rounds a number to the given number of decimal places. local r_mult; local function Round(num, idp) @@ -195,6 +224,23 @@ function SMARTBUFF_PlaySpashSound() PlaySound(Sounds[O.AutoSoundSelection]); end +function SMARTBUFF_ChooseSplashSound() + local menu = {} + local i = 1 + for sound, soundpath in pairs(sounds) do + menu[i] = { text = sound, notCheckable = true, func = function() PlaySound(soundpath) end } + i = i + 1 + end + local dropDown = CreateFrame("Frame", "DropDownMenuFrame", UIParent, "UIDropDownMenuTemplate") + -- UIDropDownMenu_Initialize(dropDown, menu, "MENU") + -- make the menu appear at the frame: + dropDown:SetPoint("CENTER", UIParent, "CENTER") + dropDown:SetScript("OnMouseUp", function (self, button, down) + print("mousedown") + -- EasyMenu(menu, dropDown, dropDown, 0 , 0, "MENU"); + end) +end + -- Reorders values in the table local function treorder(t, i, n) if (t and type(t) == "table" and t[i]) then @@ -242,7 +288,6 @@ local function IsVisibleToPlayer(self) return false; end - local function CS() if (currentSpec == nil) then currentSpec = GetSpecialization(); @@ -250,6 +295,7 @@ local function CS() if (currentSpec == nil) then currentSpec = 1; SMARTBUFF_AddMsgErr("Could not detect active talent group, set to default = 1"); + printd("Could not detect active talent group, set to default = 1"); end return currentSpec; end From 1c07f5eeefb08dec5ac30fda5bf09758ea3850da Mon Sep 17 00:00:00 2001 From: speedwaystar Date: Sun, 5 Feb 2023 10:36:24 +0800 Subject: [PATCH 2/2] prevent template being automatically reset after manual selection --- SmartBuff.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/SmartBuff.lua b/SmartBuff.lua index 85d0d48..ae3c2fe 100644 --- a/SmartBuff.lua +++ b/SmartBuff.lua @@ -3805,7 +3805,6 @@ function SMARTBUFF_Options_OnHide() SMARTBUFF_SetInCombatBuffs(); SmartBuff_BuffSetup:Hide(); SmartBuff_PlayerSetup:Hide(); - SMARTBUFF_SetTemplate(); SMARTBUFF_Splash_Hide(); SMARTBUFF_RebindKeys(); --collectgarbage();