/trunk
## Version: 40000.wowi:revision |
## SavedVariables: BabySealDB |
Libs\LibStub\LibStub.lua |
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml |
Libs\LibSharedMedia-3.0\lib.xml |
BabySeal.lua |
Data.lua |
Options.lua |
local addon, BabySeal = ... |
local db |
local LSM = LibStub("LibSharedMedia-3.0") |
local title, desc = select(2, GetAddOnInfo(addon)) |
local f = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer) |
BabySeal.panel = f |
sound.tooltipText = "Sound" |
sound.tooltipRequirement = "Toggle to play the RaidWarning sound on warning." |
local drop = CreateFrame("Button", "BabySealSoundDrop", f, "UIDropDownMenuTemplate") |
drop:SetPoint("TOPLEFT", sound, "BOTTOMLEFT", 0, -2) |
local list = LSM:HashTable("sound") |
local function initialize(self, level) |
local info = UIDropDownMenu_CreateInfo() |
for k,v in pairs(LSM:List("sound")) do |
info = UIDropDownMenu_CreateInfo() |
info.text = k |
info.value = k |
info.checked = db.soundFile == k and true or false |
info.func = function(self) |
UIDropDownMenu_SetSelectedValue(drop, self.value) |
db.soundFile = self.value |
end |
UIDropDownMenu_AddButton(info, level) |
end |
end |
UIDropDownMenu_Initialize(drop, initialize) |
UIDropDownMenu_SetWidth(drop, 100); |
UIDropDownMenu_JustifyText(drop, "LEFT") |
UIDropDownMenu_SetText(drop, db.soundFile) |
self:SetScript("OnShow", nil) |
end) |
BabySeal.prefix = string.format("|cff00aaff%s|r", addon) |
BabySeal.wp = "|cffff0000Warning!|r" |
local LSM = LibStub("LibSharedMedia-3.0") |
LSM:Register("sound", "RaidWarning", "Sound\\Interface\\RaidWarning.ogg") |
function BabySeal:PLAYER_LOGIN() |
BabySealDB = BabySealDB or { |
prewarning = true, |
raidwarning = false, |
sound = false, |
soundFile = "RaidWarning", |
} |
db = BabySealDB |
end |
if db.sound then |
PlaySoundFile(LSM:Fetch("sound", db.soundFile)) |
PlaySound("RaidWarning") |
end |
end |