Skip to content

Commit f124b71

Browse files
committed
Skeleton
1 parent 3961329 commit f124b71

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4133
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.vscode/settings.json
1+
.vscode/settings.json
2+
.emmy.lua

Config/Options.lua

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---@type string, MoonMedia
2+
local Name, T = ...
3+
4+
local ShowPopup = false
5+
6+
StaticPopupDialogs[MOON_CONFIG_RL] = {
7+
text = "One or more of the changes you have made require you to reload your user interface.",
8+
button1 = ACCEPT,
9+
button2 = CANCEL,
10+
OnAccept = C_UI.Reload(),
11+
whileDead = 1,
12+
hideOnEscape = false
13+
}
14+
15+
-- StaticPopup_Show("MOON_CONFIG_RL")
16+
17+
---@class Options
18+
T.Options = {
19+
name = C_AddOns.GetAddOnMetadata(Name, "Title"),
20+
type = "group",
21+
args = {
22+
sets = {
23+
inline = true,
24+
name = "Sound Sets",
25+
type = "group",
26+
order = 0,
27+
get = function(info) return T.db.sets[info[#info]] end,
28+
set = function(info, value) T.db.sets[info[#info]] = value; ShowPopup = true end,
29+
args = {
30+
loud = {
31+
desc = "Include sounds from Super Mario Brothers. This may or may not cause brain damage.",
32+
name = "Loud",
33+
order = 0,
34+
type = "toggle"
35+
},
36+
subtle = {
37+
desc = "Include sounds guaranteed not to melt your brain.",
38+
name = "Subtle",
39+
order = 1,
40+
type = "toggle"
41+
}
42+
}
43+
}
44+
}
45+
}

Config/Settings.lua

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---@type string, MoonMedia
2+
local Name, T = ...
3+
4+
---@class Settings
5+
T.Defaults = {
6+
sets = {
7+
loud = false,
8+
subtle = true
9+
}
10+
}

Core/Main.lua

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---@type string, MoonMedia
2+
local Name, T = ...
3+
local LSM = LibStub("LibSharedMedia-3.0")
4+
5+
local Path = [[Interface\AddOns\MoonMedia\]]
6+
local Sounds = {
7+
loud = {
8+
"smb_bowserfalls.ogg",
9+
"smb_bowserfire.ogg",
10+
"smb_breakblock.ogg",
11+
"smb_bump.ogg",
12+
"smb_coin.ogg",
13+
"smb_fireball.ogg",
14+
"smb_fireworks.ogg",
15+
"smb_flagpole.ogg",
16+
"smb_gameover.ogg",
17+
"smb_jump-small.ogg",
18+
"smb_jump-super.ogg",
19+
"smb_kick.ogg",
20+
"smb_mariodie.ogg",
21+
"smb_pause.ogg",
22+
"smb_pipe.ogg",
23+
"smb_powerup.ogg",
24+
"smb_powerup_appears.ogg",
25+
"smb_stage_clear.ogg",
26+
"smb_stomp.ogg",
27+
"smb_vine.ogg",
28+
"smb_warning.ogg",
29+
"smb_world_clear.ogg"
30+
},
31+
subtle = {
32+
"red-blip.ogg",
33+
"redalert-soft.ogg",
34+
"redalert.ogg",
35+
"redalertdouble.ogg",
36+
"redalertdoublehigh.ogg",
37+
"redcelebration.ogg",
38+
"redchangedown-old.ogg",
39+
"redchangedown.ogg",
40+
"redchangeup-old.ogg",
41+
"redchangeup.ogg",
42+
"reddropdown.ogg",
43+
"rederror-soft.ogg",
44+
"rederror.ogg",
45+
"rederrordown.ogg",
46+
"redfadeout-gentle.ogg",
47+
"redfadeout-harsh.ogg",
48+
"redlongalert.ogg",
49+
"redrefresh.ogg",
50+
"redring.ogg",
51+
"redrise.ogg"
52+
}
53+
}
54+
55+
local function LoadMedia()
56+
for category in next, Sounds do
57+
if T.db.sets[category] then
58+
print(category)
59+
end
60+
end
61+
62+
-- local path = Path[Type]
63+
-- if path then
64+
-- local key = File:gsub('%.%w-$','')
65+
-- local file = path .. File
66+
67+
-- local pathKey = MediaKey[Type]
68+
-- if pathKey then E.Media[pathKey][key] = file end
69+
70+
-- if Name then -- Register to LSM
71+
-- local nameKey = (Name == true and key) or Name
72+
-- if type(CustomType) == 'table' then
73+
-- for _, name in ipairs(CustomType) do
74+
-- LSM:Register(name, nameKey, file, Mask)
75+
-- end
76+
-- else
77+
-- LSM:Register(CustomType or Type, nameKey, file, Mask)
78+
-- end
79+
-- end
80+
-- end
81+
end
82+
83+
local function LoadDatabase()
84+
if not MoonMediaDB then
85+
MoonMediaDB = {}
86+
end
87+
88+
for key, value in pairs(T.Defaults) do
89+
if MoonMediaDB[key] == nil then
90+
MoonMediaDB[key] = value
91+
end
92+
end
93+
94+
if not MoonMediaDB.version or MoonMediaDB.version ~= T.Version then
95+
MoonMediaDB.version = T.Version
96+
end
97+
98+
T.db = MoonMediaDB
99+
100+
T.Defaults = nil
101+
end
102+
103+
local function Enable()
104+
LoadDatabase()
105+
LoadMedia()
106+
107+
LibStub("AceConfig-3.0"):RegisterOptionsTable(Name, T.Options)
108+
LibStub("AceConfigDialog-3.0"):AddToBlizOptions(Name, Name)
109+
end
110+
111+
EventUtil.ContinueOnAddOnLoaded(Name, Enable)

Libs/AceConfig-3.0.lua

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
--- AceConfig-3.0 wrapper library.
2+
-- Provides an API to register an options table with the config registry,
3+
-- as well as associate it with a slash command.
4+
-- @class file
5+
-- @name AceConfig-3.0
6+
-- @release $Id: AceConfig-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $
7+
8+
--[[
9+
AceConfig-3.0
10+
11+
Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole.
12+
13+
]]
14+
15+
local cfgreg = LibStub("AceConfigRegistry-3.0")
16+
local cfgcmd = LibStub("AceConfigCmd-3.0")
17+
18+
local MAJOR, MINOR = "AceConfig-3.0", 3
19+
local AceConfig = LibStub:NewLibrary(MAJOR, MINOR)
20+
21+
if not AceConfig then return end
22+
23+
--TODO: local cfgdlg = LibStub("AceConfigDialog-3.0", true)
24+
--TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0", true)
25+
26+
-- Lua APIs
27+
local pcall, error, type, pairs = pcall, error, type, pairs
28+
29+
-- -------------------------------------------------------------------
30+
-- :RegisterOptionsTable(appName, options, slashcmd, persist)
31+
--
32+
-- - appName - (string) application name
33+
-- - options - table or function ref, see AceConfigRegistry
34+
-- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command
35+
36+
--- Register a option table with the AceConfig registry.
37+
-- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly.
38+
-- @paramsig appName, options [, slashcmd]
39+
-- @param appName The application name for the config table.
40+
-- @param options The option table (or a function to generate one on demand). http://www.wowace.com/addons/ace3/pages/ace-config-3-0-options-tables/
41+
-- @param slashcmd A slash command to register for the option table, or a table of slash commands.
42+
-- @usage
43+
-- local AceConfig = LibStub("AceConfig-3.0")
44+
-- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"})
45+
function AceConfig:RegisterOptionsTable(appName, options, slashcmd)
46+
local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options)
47+
if not ok then error(msg, 2) end
48+
49+
if slashcmd then
50+
if type(slashcmd) == "table" then
51+
for _,cmd in pairs(slashcmd) do
52+
cfgcmd:CreateChatCommand(cmd, appName)
53+
end
54+
else
55+
cfgcmd:CreateChatCommand(slashcmd, appName)
56+
end
57+
end
58+
end

0 commit comments

Comments
 (0)