Skip to content

Commit

Permalink
Merge pull request Softrix#22 from speedwaystar/main
Browse files Browse the repository at this point in the history
register sounds with Shared Media Library and prevent template being automatically reset after manual selection
  • Loading branch information
Softrix authored Mar 1, 2023
2 parents 274da93 + 1c07f5e commit bdfaa6a
Showing 1 changed file with 50 additions and 5 deletions.
55 changes: 50 additions & 5 deletions SmartBuff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -242,14 +288,14 @@ local function IsVisibleToPlayer(self)
return false;
end


local function CS()
if (currentSpec == nil) then
currentSpec = GetSpecialization();
end
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
Expand Down Expand Up @@ -3759,7 +3805,6 @@ function SMARTBUFF_Options_OnHide()
SMARTBUFF_SetInCombatBuffs();
SmartBuff_BuffSetup:Hide();
SmartBuff_PlayerSetup:Hide();
SMARTBUFF_SetTemplate();
SMARTBUFF_Splash_Hide();
SMARTBUFF_RebindKeys();
--collectgarbage();
Expand Down

0 comments on commit bdfaa6a

Please sign in to comment.