diff --git a/Libs/DF/buildmenu.lua b/Libs/DF/buildmenu.lua index f8f9e1e0..35a32e35 100644 --- a/Libs/DF/buildmenu.lua +++ b/Libs/DF/buildmenu.lua @@ -755,6 +755,8 @@ local parseOptionsTypes = function(menuOptions) widgetTable.type = "selectoutline" elseif (widgetTable.type == "anchordropdown") then widgetTable.type = "selectanchor" + elseif (widgetTable.type == "audiodropdown") then + widgetTable.type = "selectaudio" elseif (widgetTable.type == "dropdown") then widgetTable.type = "select" @@ -1102,6 +1104,10 @@ function detailsFramework:BuildMenuVolatile(parent, menuOptions, xOffset, yOffse elseif (widgetTable.type == "selectoutline") then local func = detailsFramework:CreateOutlineListGenerator(widgetTable.set) dropdown:SetFunction(func) + + elseif (widgetTable.type == "selectaudio") then + local func = detailsFramework:CreateAudioListGenerator(widgetTable.set) + dropdown:SetFunction(func) else dropdown:SetFunction(widgetTable.values) end @@ -1352,6 +1358,9 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh elseif (widgetTable.type == "selectoutline") then dropdown = detailsFramework:CreateOutlineDropDown(parent, widgetTable.set, widgetTable.get(), widgetWidth or 140, widgetHeight or defaultHeight, nil, "$parentWidget" .. index, dropdownTemplate) + + elseif (widgetTable.type == "selectaudio") then + dropdown = detailsFramework:CreateAudioDropDown(parent, widgetTable.set, widgetTable.get(), widgetWidth or 140, widgetHeight or defaultHeight, nil, "$parentWidget" .. index, dropdownTemplate) else dropdown = detailsFramework:NewDropDown(parent, nil, "$parentWidget" .. index, nil, widgetWidth or 140, widgetHeight or defaultHeight, widgetTable.values, widgetTable.get(), dropdownTemplate) end diff --git a/Libs/DF/dropdown.lua b/Libs/DF/dropdown.lua index a8565e00..298ed401 100644 --- a/Libs/DF/dropdown.lua +++ b/Libs/DF/dropdown.lua @@ -1206,6 +1206,40 @@ function DF:CreateAnchorPointListGenerator(callback) return newGenerator end +function DF:CreateAudioListGenerator(callback) + local newGenerator = function() + local dropdownOptions = { + { + label = "--x--x--", + value = "", + onclick = callback + } + } + + --fetch all audio cues from the libsharedmedia + DF.AudioCues = {} + local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") + for audioName, audioPath in pairs(SharedMedia:HashTable("sound")) do + DF.AudioCues[#DF.AudioCues+1] = {audioName, audioPath} + end + + --sort the audio cues by name + table.sort(DF.AudioCues, function(t1, t2) return t1[1] < t2[1] end) + + for i, audioInfo in ipairs(DF.AudioCues) do + table.insert(dropdownOptions, { + label = audioInfo[1], + value = audioInfo[2], + onclick = callback + }) + end + + return dropdownOptions + end + + return newGenerator +end + ---create a dropdown object with a list of fonts ---@param parent frame ---@param callback function @@ -1240,6 +1274,12 @@ function DF:CreateAnchorPointDropDown(parent, callback, default, width, height, return dropDownObject end +function DF:CreateAudioDropDown(parent, callback, default, width, height, member, name, template) + local func = DF:CreateAudioListGenerator(callback) + local dropDownObject = DF:NewDropDown(parent, parent, name, member, width, height, func, default, template) + return dropDownObject +end + ---create a dropdown object ---@param parent frame ---@param func function diff --git a/boot.lua b/boot.lua index c683d16f..afa462b7 100644 --- a/boot.lua +++ b/boot.lua @@ -19,8 +19,8 @@ local addonName, Details222 = ... local version = GetBuildInfo() - Details.build_counter = 12802 - Details.alpha_build_counter = 12802 --if this is higher than the regular counter, use it instead + Details.build_counter = 12803 + Details.alpha_build_counter = 12803 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter diff --git a/classes/container_pets.lua b/classes/container_pets.lua index 9cb760b2..fa56d7b1 100644 --- a/classes/container_pets.lua +++ b/classes/container_pets.lua @@ -471,3 +471,7 @@ function Details:SchedulePetUpdate(seconds) Details.Schedules.NewTimer(seconds, Details.UpdatePets, Details) end + +function Details:GetPetInfo(petGuid) + return petContainer.GetPetInfo(petGuid) +end \ No newline at end of file