Mercurial > wow > mailopener
comparison Modules/Config.lua @ 0:823e33465b6e
Initial commit
| author | Zerotorescue |
|---|---|
| date | Fri, 03 Sep 2010 12:43:36 +0200 |
| parents | |
| children | 2dd6005d41f3 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:823e33465b6e |
|---|---|
| 1 local MailOpener = LibStub("AceAddon-3.0"):GetAddon("MailOpener"); | |
| 2 local Config = MailOpener:NewModule("Config", "AceEvent-3.0", "AceTimer-3.0"); | |
| 3 | |
| 4 local Media = LibStub("LibSharedMedia-3.0"); | |
| 5 Media:Register("sound", "Cartoon FX", [[Sound\Doodad\Goblin_Lottery_Open03.wav]]); | |
| 6 Media:Register("sound", "Cheer", [[Sound\Event Sounds\OgreEventCheerUnique.wav]]); | |
| 7 Media:Register("sound", "Explosion", [[Sound\Doodad\Hellfire_Raid_FX_Explosion05.wav]]); | |
| 8 Media:Register("sound", "Fel Nova", [[Sound\Spells\SeepingGaseous_Fel_Nova.wav]]); | |
| 9 Media:Register("sound", "Fel Portal", [[Sound\Spells\Sunwell_Fel_PortalStand.wav]]); | |
| 10 Media:Register("sound", "Magic Click", [[Sound\interface\MagicClick.wav]]); | |
| 11 Media:Register("sound", "Rubber Ducky", [[Sound\Doodad\Goblin_Lottery_Open01.wav]]); | |
| 12 Media:Register("sound", "Shing!", [[Sound\Doodad\PortcullisActive_Closed.wav]]); | |
| 13 Media:Register("sound", "Simon Chime", [[Sound\Doodad\SimonGame_LargeBlueTree.wav]]); | |
| 14 Media:Register("sound", "Simon Error", [[Sound\Spells\SimonGame_Visual_BadPress.wav]]); | |
| 15 Media:Register("sound", "Simon Start", [[Sound\Spells\SimonGame_Visual_GameStart.wav]]); | |
| 16 Media:Register("sound", "War Drums", [[Sound\Event Sounds\Event_wardrum_ogre.wav]]); | |
| 17 Media:Register("sound", "Wham!", [[Sound\Doodad\PVP_Lordaeron_Door_Open.wav]]); | |
| 18 Media:Register("sound", "Whisper Ping", [[Sound\interface\iTellMessage.wav]]); | |
| 19 Media:Register("sound", "You Will Die!", [[Sound\Creature\CThun\CThunYouWillDIe.wav]]); | |
| 20 | |
| 21 local AceConfigDialog; | |
| 22 | |
| 23 function Config:OnEnable() | |
| 24 MailOpener:Debug("Enabling |cff00ffffConfig|r module."); | |
| 25 end | |
| 26 | |
| 27 function Config:CommandHandler(message) | |
| 28 local cmd, arg = string.split(" ", (message or ""), 2); | |
| 29 cmd = string.lower(cmd); | |
| 30 | |
| 31 if cmd == "c" or cmd == "config" or cmd == "conf" or cmd == "option" or cmd == "options" or cmd == "opt" or cmd == "setting" or cmd == "settings" then | |
| 32 self:Show(); | |
| 33 elseif cmd == "d" or cmd == "debug" then | |
| 34 MailOpener.debugChannel = false; | |
| 35 for i = 1, NUM_CHAT_WINDOWS do | |
| 36 local name = GetChatWindowInfo(i); | |
| 37 | |
| 38 if name:upper() == "DEBUG" then | |
| 39 MailOpener.debugChannel = _G["ChatFrame" .. i]; | |
| 40 | |
| 41 print("A debug channel already exists, used the old one."); | |
| 42 return; | |
| 43 end | |
| 44 end | |
| 45 | |
| 46 if not MailOpener.debugChannel then | |
| 47 -- Create a new debug channel | |
| 48 local chatFrame = FCF_OpenNewWindow('Debug'); | |
| 49 ChatFrame_RemoveAllMessageGroups(chatFrame); | |
| 50 MailOpener.debugChannel = chatFrame; | |
| 51 | |
| 52 print("New debug channel created."); | |
| 53 end | |
| 54 else | |
| 55 print("Wrong command, available: /mo config (or /mo c)"); | |
| 56 end | |
| 57 end | |
| 58 | |
| 59 function Config:Load() | |
| 60 if not AceConfigDialog then | |
| 61 local options = self:GetOptions(); | |
| 62 | |
| 63 -- Build options dialog | |
| 64 AceConfigDialog = LibStub("AceConfigDialog-3.0"); | |
| 65 -- Register options table | |
| 66 LibStub("AceConfig-3.0"):RegisterOptionsTable("Mail Opener", options); | |
| 67 -- Set a nice default size | |
| 68 AceConfigDialog:SetDefaultSize("Mail Opener", 950, 600); | |
| 69 | |
| 70 -- In case the addon is loaded from another condition, always call the remove interface options | |
| 71 if AddonLoader and AddonLoader.RemoveInterfaceOptions then | |
| 72 AddonLoader:RemoveInterfaceOptions("Mail Opener"); | |
| 73 end | |
| 74 | |
| 75 -- Add to the blizzard addons options thing | |
| 76 AceConfigDialog:AddToBlizOptions("Mail Opener"); | |
| 77 end | |
| 78 end | |
| 79 | |
| 80 function Config:Show() | |
| 81 self:Load(); | |
| 82 | |
| 83 AceConfigDialog:Open("Mail Opener"); | |
| 84 end | |
| 85 | |
| 86 function Config:GetOptions() | |
| 87 local options = { | |
| 88 type = "group", | |
| 89 name = "Mail Opener", | |
| 90 childGroups = "tree", | |
| 91 args = { | |
| 92 }, | |
| 93 }; | |
| 94 | |
| 95 options.args.general = self:GetGeneralOptions(); | |
| 96 | |
| 97 options.args.notifications = self:GetNotificationsOptions(); | |
| 98 | |
| 99 options = self:GetModuleOptions(options); | |
| 100 | |
| 101 options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(MailOpener.db, true); | |
| 102 options.args.profiles.order = 1000; -- we want this as last group | |
| 103 | |
| 104 return options; | |
| 105 end | |
| 106 | |
| 107 function Config:GetModuleOptions(options) | |
| 108 for name, module in MailOpener:IterateModules() do | |
| 109 if module.GetOptionsGroup then | |
| 110 options.args[name] = module:GetOptionsGroup(); | |
| 111 end | |
| 112 end | |
| 113 | |
| 114 return options; | |
| 115 end | |
| 116 | |
| 117 function Config:GetGeneralOptions() | |
| 118 local generalConfigGroup = { | |
| 119 order = 100, | |
| 120 type = "group", | |
| 121 name = "General", | |
| 122 desc = "Change general Mail Opener settings.", | |
| 123 args = { | |
| 124 -- General config inline group | |
| 125 generalConfig = { | |
| 126 order = 10, | |
| 127 type = "group", | |
| 128 inline = true, | |
| 129 name = "General", | |
| 130 args = { | |
| 131 defaultStatus = { | |
| 132 order = 0, | |
| 133 type = "select", | |
| 134 name = "Default mail opener status", | |
| 135 desc = "Select the default Mail Opener status when you open a mailbox for the first time since your log on.", | |
| 136 values = { | |
| 137 _enabled = "Enabled", | |
| 138 disabled = "Disabled", | |
| 139 }, | |
| 140 get = function() return MailOpener.db.profile.general.defaultStatus; end, | |
| 141 set = function(i, v) MailOpener.db.profile.general.defaultStatus = v; end, | |
| 142 }, | |
| 143 defaultQAStatus = { | |
| 144 order = 10, | |
| 145 type = "select", | |
| 146 name = "Default QA Auto Mail status", | |
| 147 desc = "Select the default Quick Auctions auto mail status whenever you open a mailbox.", | |
| 148 values = { | |
| 149 __remember = "Remember", | |
| 150 _enabled = "Enabled", | |
| 151 disabled = "Disabled", | |
| 152 }, | |
| 153 get = function() return MailOpener.db.profile.general.defaultQAStatus; end, | |
| 154 set = function(i, v) MailOpener.db.profile.general.defaultQAStatus = v; end, | |
| 155 hidden = (not MailOpener.QuickAuctionsEnabled), | |
| 156 }, | |
| 157 continueOpeningStackableItems = { | |
| 158 order = 15, | |
| 159 type = "toggle", | |
| 160 name = "Continue trying to open mail after your bags are full", | |
| 161 desc = "If there are a lot of stackable items in your mailbox (e.g. glyphs) you may want to toggle this option on.\n\nThis will cause your Blizzard error frame to get extremely spammy if there are many mails remaining. With this disabled, Mail Opener will completely stop opening mail while your inventory is full.", | |
| 162 width = "full", | |
| 163 get = function() return MailOpener.db.profile.general.continueOpeningStackableItems; end, | |
| 164 set = function(i, v) MailOpener.db.profile.general.continueOpeningStackableItems = v; end, | |
| 165 }, | |
| 166 autoDisableQAAutoMail = { | |
| 167 order = 20, | |
| 168 type = "toggle", | |
| 169 name = "Turn Quick Auction's auto mailing |cffff0000off|r when opening mail", | |
| 170 desc = "Quick Auction's auto mailing is buggy when using other mail opening addons. If you are collecting mail while auto mailer is enabled wrong items may be send to the wrong character.\n\nTo solve this you must disable Quick Auction's auto mail while opening mail and you can re-enable it when mail opening is finished.", | |
| 171 width = "full", | |
| 172 get = function() return MailOpener.db.profile.general.autoDisableQAAutoMail; end, | |
| 173 set = function(i, v) MailOpener.db.profile.general.autoDisableQAAutoMail = v; end, | |
| 174 hidden = (not MailOpener.QuickAuctionsEnabled), | |
| 175 }, | |
| 176 autoReenableQAAutoMail = { | |
| 177 order = 30, | |
| 178 type = "toggle", | |
| 179 name = "Turn Quick Auction's auto mailing |cff00ff00on|r after opening mail has finished", | |
| 180 desc = "Quick Auction's auto mailing is buggy when using other mail opening addons. If you are collecting mail while auto mailer is enabled wrong items may be send to the wrong character.\n\nTo solve this you must disable Quick Auction's auto mail while opening mail and you can re-enable it when mail opening is finished.", | |
| 181 width = "full", | |
| 182 get = function() return MailOpener.db.profile.general.autoReenableQAAutoMail; end, | |
| 183 set = function(i, v) MailOpener.db.profile.general.autoReenableQAAutoMail = v; end, | |
| 184 hidden = (not MailOpener.QuickAuctionsEnabled), | |
| 185 disabled = function() return (MailOpener.db.profile.general.autoSetBackQAAutoMail and not MailOpener.db.profile.general.autoReenableQAAutoMail); end, | |
| 186 }, | |
| 187 autoSetBackQAAutoMail = { | |
| 188 order = 40, | |
| 189 type = "toggle", | |
| 190 name = "Set Quick Auction's auto mailing |cff00ffffback|r after opening mail has finished (remember it)", | |
| 191 desc = "Instead of always turning Quick Auction's auto mail on after mail opening you can choose to set it back to the value it was prior to opening mail.", | |
| 192 width = "full", | |
| 193 get = function() return MailOpener.db.profile.general.autoSetBackQAAutoMail; end, | |
| 194 set = function(i, v) MailOpener.db.profile.general.autoSetBackQAAutoMail = v; end, | |
| 195 hidden = (not MailOpener.QuickAuctionsEnabled), | |
| 196 disabled = function() return (MailOpener.db.profile.general.autoReenableQAAutoMail and not MailOpener.db.profile.general.autoSetBackQAAutoMail); end, | |
| 197 }, | |
| 198 }, | |
| 199 }, -- end General config inline group | |
| 200 -- Profile config inline group | |
| 201 profileConfig = { | |
| 202 order = 15, | |
| 203 type = "group", | |
| 204 inline = true, | |
| 205 name = "New Character Specfic Profile", | |
| 206 args = { | |
| 207 description = { | |
| 208 order = 10, | |
| 209 type = "description", | |
| 210 name = "You can create a new profile to allow different behaviour for different characters. Imagine setting up a profile for your AH banker which will retrieve all sorts of mail containing items while other characters don't automatically open mail with items sent by other players.", | |
| 211 }, | |
| 212 header = { | |
| 213 order = 15, | |
| 214 type = "header", | |
| 215 name = "", | |
| 216 }, | |
| 217 createNewProfile = { | |
| 218 order = 20, | |
| 219 type = "execute", | |
| 220 name = "Create a new character specific profile", | |
| 221 desc = "Create a new profile for this user. You can also make profile groups at the profiles tab to the left.", | |
| 222 width = "double", | |
| 223 func = function() | |
| 224 MailOpener.db:SetProfile(UnitName("player") .. " - " .. GetRealmName()); | |
| 225 end, | |
| 226 }, | |
| 227 }, | |
| 228 }, -- end Profile config inline group | |
| 229 }, | |
| 230 }; | |
| 231 | |
| 232 return generalConfigGroup; | |
| 233 end | |
| 234 | |
| 235 function Config:GetNotificationsOptions() | |
| 236 local notificationsConfigGroup = { | |
| 237 order = 200, | |
| 238 type = "group", | |
| 239 name = "Notifications", | |
| 240 desc = "Toggle notifications.", | |
| 241 args = { | |
| 242 -- Notifications config inline group | |
| 243 nofitications = { | |
| 244 order = 10, | |
| 245 type = "group", | |
| 246 inline = true, | |
| 247 name = "Notifications", | |
| 248 args = { | |
| 249 description = { | |
| 250 order = 10, | |
| 251 type = "description", | |
| 252 name = "Toggle which notification you wish to see.", | |
| 253 }, | |
| 254 }, | |
| 255 }, -- end Notifications config inline group | |
| 256 | |
| 257 -- General Notifications config inline group | |
| 258 general = { | |
| 259 order = 20, | |
| 260 type = "group", | |
| 261 inline = true, | |
| 262 name = "General Notifications", | |
| 263 args = { | |
| 264 welcome = { | |
| 265 order = 20, | |
| 266 type = "toggle", | |
| 267 name = "Show message when |cfffed000opening the mailbox|r", | |
| 268 desc = "Print the welcome message whenever you open the mailbox.", | |
| 269 set = function(i, v) MailOpener.db.profile.notifications.welcome = v; end, | |
| 270 get = function() return MailOpener.db.profile.notifications.welcome; end, | |
| 271 width = "double", | |
| 272 }, | |
| 273 bye = { | |
| 274 order = 21, | |
| 275 type = "toggle", | |
| 276 name = "Show message when |cfffed000closing the mailbox|r", | |
| 277 desc = "Print the bye message whenever you close the mailbox.", | |
| 278 set = function(i, v) MailOpener.db.profile.notifications.bye = v; end, | |
| 279 get = function() return MailOpener.db.profile.notifications.bye; end, | |
| 280 width = "double", | |
| 281 }, | |
| 282 fishedOpeningBatch = { | |
| 283 order = 22, | |
| 284 type = "toggle", | |
| 285 name = "Announce when |cfffed000finished opening the current batch|r", | |
| 286 desc = "Announce when opening of the current batch of mails has been completed.", | |
| 287 set = function(i, v) MailOpener.db.profile.notifications.finishedCurrentBatch = v; end, | |
| 288 get = function() return MailOpener.db.profile.notifications.finishedCurrentBatch; end, | |
| 289 width = "double", | |
| 290 }, | |
| 291 noMoreMailAvailable = { | |
| 292 order = 23, | |
| 293 type = "toggle", | |
| 294 name = "Announce when |cfffed000the mailbox is completely empty|r", | |
| 295 desc = "Announce when there is nothing left for Mail Opener to open.", | |
| 296 set = function(i, v) MailOpener.db.profile.notifications.mailboxIsEmpty = v; end, | |
| 297 get = function() return MailOpener.db.profile.notifications.mailboxIsEmpty; end, | |
| 298 width = "double", | |
| 299 }, | |
| 300 }, | |
| 301 }, -- end General Notifications config inline group | |
| 302 | |
| 303 -- Mail Skipped Notifications config inline group | |
| 304 mailSkipped = { | |
| 305 order = 30, | |
| 306 type = "group", | |
| 307 inline = true, | |
| 308 name = "Mail Skipped Notifications", | |
| 309 args = { | |
| 310 descriptionMailSkipped = { | |
| 311 order = 31, | |
| 312 type = "description", | |
| 313 name = "Announce when mail is skipped because...", | |
| 314 }, | |
| 315 | |
| 316 skippedToggleAll = { | |
| 317 order = 35, | |
| 318 type = "toggle", | |
| 319 name = "Toggle everything", | |
| 320 desc = "Announce when mail is skipped for |cfffed000any|r reason.", | |
| 321 set = function(i, v) MailOpener.db.profile.notifications.skipped.all = v; end, | |
| 322 get = function() return MailOpener.db.profile.notifications.skipped.all; end, | |
| 323 }, | |
| 324 skippedInventoryFull = { | |
| 325 order = 36, | |
| 326 type = "toggle", | |
| 327 name = "Your inventory is full", | |
| 328 desc = "Announce when mail is skipped because |cfffed000your inventory is full|r.", | |
| 329 set = function(i, v) MailOpener.db.profile.notifications.skipped.inventoryFull = v; end, | |
| 330 get = function() return MailOpener.db.profile.notifications.skipped.inventoryFull; end, | |
| 331 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 332 }, | |
| 333 skippedKeepFreeSpaceLimit = { | |
| 334 order = 37, | |
| 335 type = "toggle", | |
| 336 name = "Keep free space limit reached", | |
| 337 desc = "Announce when mail is skipped because |cfffed000the keep free space limit has been reached|r.", | |
| 338 set = function(i, v) MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit = v; end, | |
| 339 get = function() return MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit; end, | |
| 340 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 341 }, | |
| 342 skippedGMMail = { | |
| 343 order = 38, | |
| 344 type = "toggle", | |
| 345 name = "GM mail", | |
| 346 desc = "Announce when mail is skipped because it's |cfffed000mail sent by a Game Master|r.", | |
| 347 set = function(i, v) MailOpener.db.profile.notifications.skipped.GMMail = v; end, | |
| 348 get = function() return MailOpener.db.profile.notifications.skipped.GMMail; end, | |
| 349 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 350 }, | |
| 351 skippedCOD = { | |
| 352 order = 39, | |
| 353 type = "toggle", | |
| 354 name = "C.O.D. mail", | |
| 355 desc = "Announce when mail is skipped because it's |cfffed000a Cost On Delivery mail|r.", | |
| 356 set = function(i, v) MailOpener.db.profile.notifications.skipped.COD = v; end, | |
| 357 get = function() return MailOpener.db.profile.notifications.skipped.COD; end, | |
| 358 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 359 }, | |
| 360 skippedNormalGoldMail = { | |
| 361 order = 40, | |
| 362 type = "toggle", | |
| 363 name = "Normal mail with gold", | |
| 364 desc = "Announce when mail is skipped because it's |cfffed000normal mail containing gold|r.", | |
| 365 set = function(i, v) MailOpener.db.profile.notifications.skipped.normalGoldMail = v; end, | |
| 366 get = function() return MailOpener.db.profile.notifications.skipped.normalGoldMail; end, | |
| 367 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 368 }, | |
| 369 skippedNormalItemsMail = { | |
| 370 order = 41, | |
| 371 type = "toggle", | |
| 372 name = "Normal mail with attachments", | |
| 373 desc = "Announce when mail is skipped because it's |cfffed000normal mail containing items|r.", | |
| 374 set = function(i, v) MailOpener.db.profile.notifications.skipped.normalItemsMail = v; end, | |
| 375 get = function() return MailOpener.db.profile.notifications.skipped.normalItemsMail; end, | |
| 376 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 377 }, | |
| 378 skippedAHExpired = { | |
| 379 order = 42, | |
| 380 type = "toggle", | |
| 381 name = "Auction expired mail", | |
| 382 desc = "Announce when mail is skipped because it's |cfffed000auction expired mail|r.", | |
| 383 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHexpired = v; end, | |
| 384 get = function() return MailOpener.db.profile.notifications.skipped.AHexpired; end, | |
| 385 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 386 }, | |
| 387 skippedAHSuccessful = { | |
| 388 order = 43, | |
| 389 type = "toggle", | |
| 390 name = "Auction successful mail", | |
| 391 desc = "Announce when mail is skipped because it's |cfffed000auction successful mail|r.", | |
| 392 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHsuccess = v; end, | |
| 393 get = function() return MailOpener.db.profile.notifications.skipped.AHsuccess; end, | |
| 394 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 395 }, | |
| 396 skippedAHWon = { | |
| 397 order = 44, | |
| 398 type = "toggle", | |
| 399 name = "Auction won mail", | |
| 400 desc = "Announce when mail is skipped because it's |cfffed000auction won mail|r.", | |
| 401 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHwon = v; end, | |
| 402 get = function() return MailOpener.db.profile.notifications.skipped.AHwon; end, | |
| 403 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 404 }, | |
| 405 skippedAHCanceled = { | |
| 406 order = 45, | |
| 407 type = "toggle", | |
| 408 name = "Auction canceled mail", | |
| 409 desc = "Announce when mail is skipped because it's |cfffed000auction canceled mail|r.", | |
| 410 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHcanceled = v; end, | |
| 411 get = function() return MailOpener.db.profile.notifications.skipped.AHcanceled; end, | |
| 412 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 413 }, | |
| 414 skippedAHOutbid = { | |
| 415 order = 46, | |
| 416 type = "toggle", | |
| 417 name = "Auction outbid mail", | |
| 418 desc = "Announce when mail is skipped because it's |cfffed000auction outbid mail|r.", | |
| 419 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHoutbid = v; end, | |
| 420 get = function() return MailOpener.db.profile.notifications.skipped.AHoutbid; end, | |
| 421 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 422 }, | |
| 423 skippedOther = { | |
| 424 order = 47, | |
| 425 type = "toggle", | |
| 426 name = "Other mail (e.g. plain text)", | |
| 427 desc = "Announce when mail is skipped because it's |cfffed000any other kind of mail|r (e.g. plain text).", | |
| 428 set = function(i, v) MailOpener.db.profile.notifications.skipped.other = v; end, | |
| 429 get = function() return MailOpener.db.profile.notifications.skipped.other; end, | |
| 430 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end, | |
| 431 }, | |
| 432 }, | |
| 433 }, -- end Mail Skipped Notifications config inline group | |
| 434 | |
| 435 -- Mail Processed Notifications config inline group | |
| 436 mailProcessed = { | |
| 437 order = 40, | |
| 438 type = "group", | |
| 439 inline = true, | |
| 440 name = "Mail Processed Notifications", | |
| 441 args = { | |
| 442 descriptionMailProcessed = { | |
| 443 order = 61, | |
| 444 type = "description", | |
| 445 name = "Announce when mail is processed because...", | |
| 446 }, | |
| 447 | |
| 448 processedToggleAll = { | |
| 449 order = 65, | |
| 450 type = "toggle", | |
| 451 name = "Toggle everything", | |
| 452 desc = "Announce when mail is processed for |cfffed000any|r reason.", | |
| 453 set = function(i, v) MailOpener.db.profile.notifications.processed.all = v; end, | |
| 454 get = function() return MailOpener.db.profile.notifications.processed.all; end, | |
| 455 }, | |
| 456 processedNormalGoldMail = { | |
| 457 order = 70, | |
| 458 type = "toggle", | |
| 459 name = "Normal mail with gold", | |
| 460 desc = "Announce when mail is processed because it's |cfffed000normal mail containing gold|r.", | |
| 461 set = function(i, v) MailOpener.db.profile.notifications.processed.normalGoldMail = v; end, | |
| 462 get = function() return MailOpener.db.profile.notifications.processed.normalGoldMail; end, | |
| 463 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end, | |
| 464 }, | |
| 465 processedNormalItemsMail = { | |
| 466 order = 71, | |
| 467 type = "toggle", | |
| 468 name = "Normal mail with attachments", | |
| 469 desc = "Announce when mail is processed because it's |cfffed000normal mail containing items|r.", | |
| 470 set = function(i, v) MailOpener.db.profile.notifications.processed.normalItemsMail = v; end, | |
| 471 get = function() return MailOpener.db.profile.notifications.processed.normalItemsMail; end, | |
| 472 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end, | |
| 473 }, | |
| 474 processedAHExpired = { | |
| 475 order = 72, | |
| 476 type = "toggle", | |
| 477 name = "Auction expired mail", | |
| 478 desc = "Announce when mail is processed because it's |cfffed000auction expired mail|r.", | |
| 479 set = function(i, v) MailOpener.db.profile.notifications.processed.AHexpired = v; end, | |
| 480 get = function() return MailOpener.db.profile.notifications.processed.AHexpired; end, | |
| 481 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end, | |
| 482 }, | |
| 483 processedAHSuccessful = { | |
| 484 order = 73, | |
| 485 type = "toggle", | |
| 486 name = "Auction successful mail", | |
| 487 desc = "Announce when mail is processed because it's |cfffed000auction successful mail|r.", | |
| 488 set = function(i, v) MailOpener.db.profile.notifications.processed.AHsuccess = v; end, | |
| 489 get = function() return MailOpener.db.profile.notifications.processed.AHsuccess; end, | |
| 490 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end, | |
| 491 }, | |
| 492 processedAHWon = { | |
| 493 order = 74, | |
| 494 type = "toggle", | |
| 495 name = "Auction won mail", | |
| 496 desc = "Announce when mail is processed because it's |cfffed000auction won mail|r.", | |
| 497 set = function(i, v) MailOpener.db.profile.notifications.processed.AHwon = v; end, | |
| 498 get = function() return MailOpener.db.profile.notifications.processed.AHwon; end, | |
| 499 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end, | |
| 500 }, | |
| 501 processedAHCanceled = { | |
| 502 order = 75, | |
| 503 type = "toggle", | |
| 504 name = "Auction canceled mail", | |
| 505 desc = "Announce when mail is processed because it's |cfffed000auction canceled mail|r.", | |
| 506 set = function(i, v) MailOpener.db.profile.notifications.processed.AHcanceled = v; end, | |
| 507 get = function() return MailOpener.db.profile.notifications.processed.AHcanceled; end, | |
| 508 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end, | |
| 509 }, | |
| 510 processedAHOutbid = { | |
| 511 order = 76, | |
| 512 type = "toggle", | |
| 513 name = "Auction outbid mail", | |
| 514 desc = "Announce when mail is processed because it's |cfffed000auction outbid mail|r.", | |
| 515 set = function(i, v) MailOpener.db.profile.notifications.processed.AHoutbid = v; end, | |
| 516 get = function() return MailOpener.db.profile.notifications.processed.AHoutbid; end, | |
| 517 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end, | |
| 518 }, | |
| 519 processedOther = { | |
| 520 order = 77, | |
| 521 type = "toggle", | |
| 522 name = "Other mail (e.g. plain text)", | |
| 523 desc = "Announce when mail is processed because it's |cfffed000any other kind of mail|r (e.g. plain text).", | |
| 524 set = function(i, v) MailOpener.db.profile.notifications.processed.other = v; end, | |
| 525 get = function() return MailOpener.db.profile.notifications.processed.other; end, | |
| 526 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end, | |
| 527 }, | |
| 528 }, | |
| 529 }, -- end Mail Processed Notifications config inline group | |
| 530 | |
| 531 -- Sound Notifications config inline group | |
| 532 sound = { | |
| 533 order = 50, | |
| 534 type = "group", | |
| 535 inline = true, | |
| 536 name = "Sound Notifications", | |
| 537 args = { | |
| 538 bagsFullSound = { | |
| 539 order = 100, | |
| 540 type = "toggle", | |
| 541 name = "Play a sound when your |cfffed000inventory is full|r", | |
| 542 desc = "Play a sound when your inventory is full. You can select what sound in the select box next to this.", | |
| 543 set = function(i, v) MailOpener.db.profile.notifications.bagsFullSound = v; end, | |
| 544 get = function() return MailOpener.db.profile.notifications.bagsFullSound; end, | |
| 545 width = "double", | |
| 546 }, | |
| 547 bagsFullSoundFile = { | |
| 548 order = 101, | |
| 549 type = "select", | |
| 550 name = "Sound File", | |
| 551 desc = "Sound file to play when your bags are full.", | |
| 552 dialogControl = "LSM30_Sound", | |
| 553 set = function(i, v) | |
| 554 MailOpener.db.profile.notifications.bagsFullSoundFile = Media:Fetch("sound", v); | |
| 555 MailOpener.db.profile.notifications.bagsFullSoundFileName = v; | |
| 556 | |
| 557 PlaySoundFile(MailOpener.db.profile.notifications.bagsFullSoundFile); | |
| 558 | |
| 559 print("|cff15ff00Mail Opener|r: You may have to increase the mail opening interval if this sound effect gets spammy. The recommended value is 10 seconds."); | |
| 560 end, | |
| 561 get = function() return MailOpener.db.profile.notifications.bagsFullSoundFileName end, | |
| 562 values = function () return (Media:HashTable("sound") or nil); end, | |
| 563 disabled = function() return (not MailOpener.db.profile.notifications.bagsFullSound); end, | |
| 564 }, | |
| 565 bagsFullSoundOnlyOnce = { | |
| 566 order = 102, | |
| 567 type = "toggle", | |
| 568 name = "Only once", | |
| 569 desc = "Only play this sound once each time new mail has been arrived.", | |
| 570 set = function(i, v) MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce = v; end, | |
| 571 get = function() return MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce; end, | |
| 572 disabled = function() return (not MailOpener.db.profile.notifications.bagsFullSound); end, | |
| 573 }, | |
| 574 mailboxEmptySound = { | |
| 575 order = 110, | |
| 576 type = "toggle", | |
| 577 name = "Play a sound when |cfffed000no more mail can be opened|r", | |
| 578 desc = "Play a sound when no more mail can be opened. You can select what sound in the select box next to this.", | |
| 579 set = function(i, v) MailOpener.db.profile.notifications.mailboxEmptySound = v; end, | |
| 580 get = function() return MailOpener.db.profile.notifications.mailboxEmptySound; end, | |
| 581 width = "double", | |
| 582 }, | |
| 583 mailboxEmptySoundFile = { | |
| 584 order = 111, | |
| 585 type = "select", | |
| 586 name = "Sound File", | |
| 587 desc = "Sound file to play when Mail Opener can't open any more mail.", | |
| 588 dialogControl = "LSM30_Sound", | |
| 589 set = function(i, v) | |
| 590 MailOpener.db.profile.notifications.mailboxEmptySoundFile = Media:Fetch("sound", v); | |
| 591 MailOpener.db.profile.notifications.mailboxEmptySoundFileName = v; | |
| 592 | |
| 593 PlaySoundFile(MailOpener.db.profile.notifications.mailboxEmptySoundFile); | |
| 594 | |
| 595 print("|cff15ff00Mail Opener|r: You may have to increase the mail opening interval if this sound effect gets spammy. The recommended value is 10 seconds."); | |
| 596 end, | |
| 597 get = function() return MailOpener.db.profile.notifications.mailboxEmptySoundFileName end, | |
| 598 values = function () return (Media:HashTable("sound") or nil); end, | |
| 599 disabled = function() return (not MailOpener.db.profile.notifications.mailboxEmptySound); end, | |
| 600 }, | |
| 601 mailboxEmptySoundOnlyOnce = { | |
| 602 order = 112, | |
| 603 type = "toggle", | |
| 604 name = "Only once", | |
| 605 desc = "Only play this sound once each time new mail has been arrived.", | |
| 606 set = function(i, v) MailOpener.db.profile.notifications.mailboxEmptySoundOnlyOnce = v; end, | |
| 607 get = function() return MailOpener.db.profile.notifications.mailboxEmptySoundOnlyOnce; end, | |
| 608 disabled = function() return (not MailOpener.db.profile.notifications.mailboxEmptySound); end, | |
| 609 }, | |
| 610 }, | |
| 611 }, -- end Sound Notifications config inline group | |
| 612 }, | |
| 613 }; | |
| 614 | |
| 615 return notificationsConfigGroup; | |
| 616 end |
