local parentAddonName = "EnhanceQoL"
local addonName, addon = ...
if _G[parentAddonName] then
	addon = _G[parentAddonName]
else
	error(parentAddonName .. " is not loaded")
end

addon.Sounds = addon.Sounds or {}
addon.Sounds.functions = addon.Sounds.functions or {}
addon.Sounds.variables = addon.Sounds.variables or {}
addon.LSounds = addon.LSounds or {} -- Locales for aura

function addon.Sounds.functions.InitDB()
	if not addon.db or not addon.functions or not addon.functions.InitDBValue then return end
	addon.functions.InitDBValue("keepAudioSynced", false)
	addon.functions.InitDBValue("soundExtraEnabled", false)
	addon.functions.InitDBValue("soundExtraEvents", {})
end

addon.Sounds.extraSoundEvents = {
	-- Add events here to expose them in settings and extra sound playback.
	{ event = "ACHIEVEMENT_EARNED", label = "soundExtraEventAchievementEarned" },
	{ event = "CHALLENGE_MODE_LEAVER_TIMER_STARTED", label = "soundExtraEventChallengeLeaverTimer" },
	{ event = "CHALLENGE_MODE_DEATH_COUNT_UPDATED", label = "soundExtraEventChallengeDeaths" },
	{ event = "CHAT_MSG_BN_WHISPER", label = "soundExtraEventChatBNWhisper" },
	{ event = "CHAT_MSG_WHISPER", label = "soundExtraEventChatWhisper" },
	{ event = "LFG_PROPOSAL_SHOW", label = "soundExtraEventLFGQueueStatus" },
	{ event = "PLAYER_REGEN_ENABLED", label = "soundExtraEventLeaveCombat" },
	{ event = "PLAYER_REGEN_DISABLED", label = "soundExtraEventEnterCombat" },
	{ event = "LOOT_ITEM_ROLL_WON", label = "soundExtraEventLootRollWon" },
	{ event = "SHOW_LOOT_TOAST_LEGENDARY_LOOTED", label = "soundExtraEventLootLegendary" },
	{ event = "SHOW_LOOT_TOAST_UPGRADE", label = "soundExtraEventLootUpgrade" },
	{ event = "LFG_ROLE_CHECK_SHOW", label = "soundExtraEventRoleCheck" },
	{ event = "START_PLAYER_COUNTDOWN", label = "soundExtraEventPlayerCountdown" },
	{
		event = "UPDATE_PENDING_MAIL",
		label = "soundExtraEventNewMail",
		condition = function() return HasNewMail and HasNewMail() end,
	},
	{ event = "RESURRECT_REQUEST", label = "soundExtraEventResurrect" },
	{ event = "READY_CHECK", label = "soundExtraEventReadyCheck" },
	{ event = "PARTY_INVITE_REQUEST", label = "soundExtraEventPartyInvite" },
	{ event = "GROUP_INVITE_CONFIRMATION", label = "soundExtraEventGroupInviteConfirm" },
	{
		event = "CRAFTINGORDERS_PERSONAL_ORDER_NEW",
		label = "soundExtraEventCraftingOrdersNew",
		registerEvent = { "PLAYER_ENTERING_WORLD", "CRAFTINGORDERS_UPDATE_PERSONAL_ORDER_COUNTS" },
	},
	{
		event = "CRAFTINGORDERS_PERSONAL_ORDER_REMOVED",
		label = "soundExtraEventCraftingOrdersRemoved",
		registerEvent = { "PLAYER_ENTERING_WORLD", "CRAFTINGORDERS_UPDATE_PERSONAL_ORDER_COUNTS" },
	},
}

addon.Sounds.soundFiles = {
	["class"] = {
		["T33_Jackpot_Sound"] = { -- SoundID 283499
			6421997,
			6421999,
			6422001,
			6422003,
			6422005,
		},
		["class_warlock_summon_imp"] = {
			-- 1255429,
			-- 1255430,
			-- 1255431,
			-- 1255432,
			-- 1255433,
			551168,
		},
		["class_warlock_succubus_butt_slap"] = {
			561144,
			1466150,
		},
		["class_warlock_summon_felguard"] = {
			547320,
			547328,
			547335,
			547332,
		},
		["class_warlock_summon_succubus"] = {
			561163,
			561168,
			561157,
			561154,
		},
		["class_warlock_summon"] = {
			2068351,
			2068352,
		},
	},
	["dungeon"] = {
		["xalatath"] = {
			2530794, -- Open your mind to the whispers
			2530811, -- Do you see it?
			2530835, -- A stone to call forth the darkness
			5770084, -- Your ascension
			5770087, -- Is complete
			5834619, -- *laughing* / haha #1
			5834623, -- Oh, he's alone / always alone
			5834632, -- Embrace who you truly are
			5835195, -- So easily overlooked
			5835211, -- Your survival wasn't necessary
			5835212, -- I simply wish you'd lasted a little longer
			5835214, -- And now you learn the true lesson of the void
			5835215, -- Only the strongest survive
			5835725, -- Inevitable
			5835726, -- The void consumes everything
			5835729, -- Deeper in the darkness
			5854705, -- Too late (timer over)
			5854706, -- Haha #2
			6178494, -- My emissary brings you power
			6178497, -- A willing sacrifice
			6178498, -- Yes, feed
			6178500, -- Shred of control
			6178502, -- Resist
			6178504, -- Overcome this trial
			6178506, -- My power is transcendent
			6178508, -- A gift of power
		},
		["rookery_npc"] = {
			-- Stormrider Vokmar
			5858404,
			5858470,
			5858471,
			5858472,
			5858473,
			5858474,
			5858478,
			5858481,
			5858482,
			5858485,
		},
		["priory_of_the_sacred_flame_npc"] = {
			-- Sister Etna Blayze
			5839837,
			5839839,
			5839840,
			5839841,
			5839846,
			5839847,
			5839853,
			5839854,
			5839855,
			5839860,
			5839861,
		},
		["cinderbrew_meadery_npc"] = {
			5769388,
			5769390,
			5769391,
			5769395,
			5769396,
			5769397,
			5769400,
			5779635,
			5858873,
			5858874,
			5858875,
			5858882,
			5858888,
			5858889,
			5858890,
			5858891,
			5858892,
			5858893,
			5858894,
			5858895,
			5858896,
			5858897,
			5858898,
		},
		["murder_row_belath_dawnblade"] = {
			7238841, -- Belath Dawnblade (Murder Row), SoundID 299127
			7238805, -- Belath Dawnblade (Murder Row), SoundID 299115
			7238845, -- Belath Dawnblade (Murder Row), SoundID 299129
			1407468, -- Belath Dawnblade (Murder Row), SoundID 67186
			7238808, -- Belath Dawnblade (Murder Row), SoundID 299116
			1407465, -- Belath Dawnblade (Murder Row), SoundID 67183
			1407466, -- Belath Dawnblade (Murder Row), SoundID 67184
			1407463, -- Belath Dawnblade (Murder Row), SoundID 67181
			1406999, -- Belath Dawnblade (Murder Row), SoundID 66955
			1407010, -- Belath Dawnblade (Murder Row), SoundID 66966
			1407462, -- Belath Dawnblade (Murder Row), SoundID 67180
			7236595, -- Belath Dawnblade (Murder Row), SoundID 298621, PlayKit 323032
			7236676, -- Belath Dawnblade (Murder Row), SoundID 298700, PlayKit 323033
			7236705, -- Belath Dawnblade (Murder Row), SoundID 298729, PlayKit 323033
			1401438, -- Belath Dawnblade (Murder Row), SoundID 64689
			1406995, -- Belath Dawnblade (Murder Row), SoundID 66951
			1407009, -- Belath Dawnblade (Murder Row), SoundID 66965
			1407464, -- Belath Dawnblade (Murder Row), SoundID 67182
			1281203, -- Belath Dawnblade (Murder Row), SoundID 55053
			1281205, -- Belath Dawnblade (Murder Row), SoundID 55054
			7236564, -- Belath Dawnblade (Murder Row), SoundID 298595, PlayKit 323032
			7236621, -- Belath Dawnblade (Murder Row), SoundID 298647, PlayKit 323032
			7236735, -- Belath Dawnblade (Murder Row), SoundID 298759, PlayKit 323033
			7238811, -- Belath Dawnblade (Murder Row), SoundID 299117
			7238844, -- Belath Dawnblade (Murder Row), SoundID 299128
			7238846, -- Belath Dawnblade (Murder Row), SoundID 299130
			7238853, -- Belath Dawnblade (Murder Row), SoundID 299131
			1406998, -- Belath Dawnblade (Murder Row), SoundID 66954
			1407029, -- Belath Dawnblade (Murder Row), SoundID 66985
			1407031, -- Belath Dawnblade (Murder Row), SoundID 66987
			1407460, -- Belath Dawnblade (Murder Row), SoundID 67178
			1407461, -- Belath Dawnblade (Murder Row), SoundID 67179
			1407467, -- Belath Dawnblade (Murder Row), SoundID 67185
			1281201, -- Belath Dawnblade (Murder Row), SoundID 55052
		},
		["windrunner_spire_lirath_windrunner"] = {
			7236598, -- Lirath Windrunner (Windrunner Spire), SoundID 298624, PlayKit 323717
			7236624, -- Lirath Windrunner (Windrunner Spire), SoundID 298650, PlayKit 323717
			7238319, -- Lirath Windrunner (Windrunner Spire), SoundID 298936
			7238330, -- Lirath Windrunner (Windrunner Spire), SoundID 298947
			7238316, -- Lirath Windrunner (Windrunner Spire), SoundID 298933
			7238318, -- Lirath Windrunner (Windrunner Spire), SoundID 298935
			7238325, -- Lirath Windrunner (Windrunner Spire), SoundID 298942
			7236569, -- Lirath Windrunner (Windrunner Spire), SoundID 298598, PlayKit 323717
			7236683, -- Lirath Windrunner (Windrunner Spire), SoundID 298707, PlayKit 323716
			7236712, -- Lirath Windrunner (Windrunner Spire), SoundID 298736, PlayKit 323716
			7236742, -- Lirath Windrunner (Windrunner Spire), SoundID 298766, PlayKit 323716
			7238309, -- Lirath Windrunner (Windrunner Spire), SoundID 298926
			7238310, -- Lirath Windrunner (Windrunner Spire), SoundID 298927
			7238311, -- Lirath Windrunner (Windrunner Spire), SoundID 298928
			7238312, -- Lirath Windrunner (Windrunner Spire), SoundID 298929
			7238313, -- Lirath Windrunner (Windrunner Spire), SoundID 298930
			7238314, -- Lirath Windrunner (Windrunner Spire), SoundID 298931
			7238315, -- Lirath Windrunner (Windrunner Spire), SoundID 298932
			7238317, -- Lirath Windrunner (Windrunner Spire), SoundID 298934
			7238320, -- Lirath Windrunner (Windrunner Spire), SoundID 298937
			7238321, -- Lirath Windrunner (Windrunner Spire), SoundID 298938
			7238322, -- Lirath Windrunner (Windrunner Spire), SoundID 298939
			7238323, -- Lirath Windrunner (Windrunner Spire), SoundID 298940
			7238324, -- Lirath Windrunner (Windrunner Spire), SoundID 298941
			7238326, -- Lirath Windrunner (Windrunner Spire), SoundID 298943
			7238327, -- Lirath Windrunner (Windrunner Spire), SoundID 298944
			7238328, -- Lirath Windrunner (Windrunner Spire), SoundID 298945
			7238329, -- Lirath Windrunner (Windrunner Spire), SoundID 298946
		},
		["den_of_nalorakk_zuljarra"] = {
			7271224, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271225, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271226, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271227, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271228, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271229, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271230, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271231, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271250, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271251, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271252, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271253, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271254, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271255, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271256, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271257, -- Zul'Jarra (Den of Nalorakk), Greeting, PlayKit 324473
			7271232, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271233, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271234, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271235, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271236, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271237, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271238, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271239, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271242, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271243, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271244, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271245, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271246, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271247, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271248, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271249, -- Zul'Jarra (Den of Nalorakk), Farewell, PlayKit 324472
			7271240, -- Zul'Jarra (Den of Nalorakk), Angry, PlayKit 324474
			7271241, -- Zul'Jarra (Den of Nalorakk), Angry, PlayKit 324474
		},
		["mechagon_npc"] = {
			-- Prince Erazmin
			2931350,
			2931351,
			2931352,
			2931353,
			2931356, --
			2931435, -- In order to stop my father, we need to infiltrate
			2931438, -- Do not allow these bots to detect you
			2931439, -- Remaining within their steam
			2931441, -- You are no longer my father

			-- Gazlowe
			2931354,
			2931355,

			-- Tussle Tonks Announcer
			2925336,
			2925337,
			2925338,
			2925339,
			2925340,
			2925341,
			2925342,
			2925343,
			2925345,
			2925346,
			2925347,
			2925348,
			2925351,
			2925352,
			2925353,
			2925354,
			2925355,
			2925356,
			2925357,
			2925358,
			2925359,
			2925360,
		},
		["stonevault"] = {
			5835282, -- So here we are. High Speaker Eirich... or is it just Eirich now?
			5835283, -- He's fled from the Hall of Awakening into the Stonevault
			5835268, -- He's probably running like a frightened mouse. Wee, sleekit, cowering, timorous beastie!
		},
		["dundun"] = {
			7251817,
			7251820,
			7251823,
		},
		["valeera"] = {
			7430043,
			7430047,
			7430050,
			7430053,
			7430056,
			7430059,
			7430063,
			7430066,
			7430069,
			7430072,
			7430075,
			7430078,
			7430082,
			7430086,
			7430089,
			7430092,
			7430095,
			7430098,
			7430101,
			7430104,
			7430107,
			7430110,
			7430113,
			7430116,
			7430119,
			7430122,
			7430125,
			7430156,
			7430159,
			7430162,
			7430165,
			7430168,
			7430171,
			7430174,
			7430177,
			7430180,
			7430183,
			7430186,
			7430189,
		},
	},
	["mounts"] = {
		["banlu"] = {
			1593212, --Good to see you again, Grandmaster.
			1593213, --Lay off the manabuns.
			1593214, --Good luck, Grandmaster.
			1593215, --Farewell.
			1593216, --The lazy yak never gets washed.
			1593217, --Listen to all voices, Grandmaster. .
			1593218, --Idleness rarely leads to success, Grandmaster.
			1593219, --Is it much further, Grandmaster.
			1593220, --Remember to finish crossing the river
			1593221, --To speak of change without being willing taking action
			1593222, --A kite can not fly without the wind blowing against it.
			1593223, --The wise monk chooses their own style
			1593224, --The best time to plant a tree
			1593225, --Do not concern yourself
			1593226, --The wise brewmaster
			1593227, --Have a told you the tale of the hozen
			1593228, --Ah, a refreshing swim
			1593229, --Don't worry about me, Grandmanster
			1593230, --Filled with sorry
			1593231, --But in the mists of that reflection
			1593232, --You have show patience
			1593233, --It is clear you embody
			1593234, --Your skils are impressive
			1593235, --Let us return to the wandering
			1593236, --Where are we going today, Grandmaster
		},
		["grand_expedition_yak"] = {
			--Cousing Slowhands --
			--Greetings
			640336,
			640338,
			640340,
			--Farewell
			640314,
			640316,
			640318,
			640320,
			--Mystic Birdhat --
			--Greetings
			640180,
			640182,
			640184,
			--Farewell
			640158,
			640160,
			640162,
			640164,
		},
		["peafowl"] = {
			5546937,
			5546939,
			5546941,
			5546943,
		},
		["wonderwing_20"] = {
			2148660,
			2148661,
			2148662,
			2148663,
			2148664,
		},
		["mount_chopper"] = {
			569859,
			569858,
			569855,
			569857,
			569863,
			569856,
			569860,
			569862,
			569861,
			569854,
			569845,
			569852,
			598736,
			598745,
			598748,
			568252,
		},
		["mount_mimiron_head"] = {
			555364,
			595097,
			595100,
			595103,
		},
		["mount_the_dreadwake"] = {
			-- Horn
			566064,

			-- Bell
			1838477,

			-- WaterSplash Dismount
			2066773,
			2066774,
			2066775,
			2066776,
			2066777,

			-- WaterSplash Mount
			2066768,
			2066769,
			2066770,
			2066771,
			2066772,
		},
		["mount_storm_gryphon"] = {
			-- Mount
			5356559,
			5356561,
			5356563,
			5356565,
			5356567,
			5356569,
			5356571,

			-- Thunder
			3088094,

			-- Mountspecial
			5357752,
			5357769,
			5357771,
			5357773,
			5357775,
		},
		["mount_g99_breakneck"] = {
			-- Movement
			2431461,
			2431464,
			2431465,

			-- Summon
			1487173,
			1487174,
			1487175,
			1487176,
			1487177,
			1487178,
			1487179,
			1487180,
			1487181,
			1487182,

			-- Engine start
			1659508,
			1659509,
			1659510,
			1659511,

			-- Gear shift broken
			2138705,

			-- Engine running
			6254769,
			6382128,
			6382130,
			6382181,
			6382183,
			6382185,
			6382187,
			6382189,
			6382191,
			6382193,

			-- Drifting
			6654849,
			6654851,
			6654853,
			6654855,
			6654857,
			6654859,
			6654861,
			6654863,
			6654865,
			6654867,
		},
	},
	["spells"] = {
		["bloodlust"] = {
			568812, -- Bloodlust
			569013, -- Heroism
			569578, -- Timewarp
			569379, -- Timewarp
			568818, -- Timewarp
			569126, -- Timewarp
			568451, -- Timewarp
			4567038, -- Timewarp
			4567040, -- Timewarp
			4567042, -- Timewarp
			1416760, -- Timewarp
			1416761, -- Timewarp
			1416762, -- Timewarp
			4558551, -- Fury of the Aspects
			4558553, -- Fury of the Aspects
			4558555, -- Fury of the Aspects
			4558557, -- Fury of the Aspects
			4558559, -- Fury of the Aspects
			4575217, -- Fury of the Aspects
			4575219, -- Fury of the Aspects
			4575221, -- Fury of the Aspects
		},
	},
	["trinkets"] = {
		["soundMuteGazeOfTheAlnseer"] = {
			2144789, -- Gaze of the Alnseer (Item 249343)
			2144790, -- Gaze of the Alnseer (Item 249343)
			2144791, -- Gaze of the Alnseer (Item 249343)
		},
	},
	["emotes"] = {
		["train"] = {
			--Orc --
			541239, --Male
			541157, --Female

			--Undead --
			542600, --Male
			542526, --Female

			--Tauren --
			542896, --Male
			542818, --Female

			--Troll --
			543093, --Male
			543085, --Female

			--Blood Elf --
			539203, --Male
			539219, --Female
			1306531, --Male Demon Hunter
			1313588, --Female Demon Hunter

			--Goblin --
			542017, --Male
			541769, --Female

			--Nightborne --
			1732405, --Male
			1732030, --Female

			--Highmountain Tauren --
			1730908, --Male
			1730534, --Female

			--Mag'har Orc --
			1951458, --Male
			1951457, --Female

			--Zandalari Troll --
			1903522, --Male
			1903049, --Female

			--Vulpera --
			3106717, --Male
			3106252, --Female

			--Pandaren --
			630296, --Male Train 01
			630298, --Male Train 02
			636621, --Female

			--Dracthyr --
			4737561, --Male Visage
			4738601, --Male Dragonkin
			4741007, --Female Visage
			4739531, --Female Dragonkin

			--Earthen --
			6021052, -- Female
			6021067, -- Male

			--Human --
			540734, --Male
			540535, --Female

			--Dwarf --
			539881, --Male
			539802, --Female

			--Night Elf --
			540947, --Male
			540870, --Female
			1304872, --Male Demon Hunter
			1316209, --Female Demon Hunter

			--Gnome --
			540275, --Male
			540271, --Female

			--Draenei --
			539730, --Male
			539516, --Female

			--Worgen --
			541601, --Male (Human Form)
			542206, --Male (Worgen Form)
			541463, --Female (Human Form)
			542035, --Female (Worgen Form)

			--Void Elf --
			1733163, --Male
			1732785, --Female

			--Lightforged Draenei --
			1731656, --Male
			1731282, --Female

			--Dark Iron Dwarf --
			1902543, --Male
			1902030, --Female

			--Kul Tiran Human --
			2491898, --Male
			2531204, --Female

			--Mechagnome --
			3107182, --Male
			3107651, --Female
		},
	},
	["professions"] = {
		["skinning"] = {
			-- Soundkit 3781
			567454,
			567494,
			567417,
		},
		["herbalism"] = {
			-- Soundkit 1142
			569824,
			569825,
			569797,
			569818,
		},
		["mining"] = {
			-- Soundkit 1143
			569801,
			569811,
			569792,
			569794,
			569821,
		},
		["alchemy"] = {
			-- Soundkit 1105
			569793,
			569802,
			569812,
		},
	},
	["interface"] = {
		["general"] = {
			["changeTab"] = {
				567422,
				567507,
				567433,
			},
			["enterQueue"] = {
				568587,
			},
			["readycheck"] = {
				567478,
			},
			["coinsound"] = {
				567428,
			},
			["mailboxopen"] = {
				567440,
			},
			["repair"] = {
				569801,
				569811,
				569792,
				569794,
				569821,
			},
			["summoning_stone"] = {
				-- Soundkit 3136 for loop sound
				568938,
				-- Soundkit 119083 for first Sound on portal open
				1684459,
				1684460,
				1684461,
				1684462,
				1684463,
			},
		},
		["chat"] = {
			["whisper"] = {
				-- Soundkit 3081
				567421,
			},
		},
		["ping"] = {
			["ping_minimap"] = {
				567416,
			},
			["ping_warning"] = {
				5342387,
			},
			["ping_ping"] = {
				5339002,
			},
			["ping_assist"] = {
				5339006,
			},
			["ping_omw"] = {
				5340605,
			},
			["ping_attack"] = {
				5350036,
			},
		},
		["quest"] = {
			["quest_complete"] = {
				-- Soundkit 619
				567439,
			},
		},
		["auctionhouse"] = {
			["open"] = {
				567482,
			},
			["close"] = { 567499 },
		},
	},
	["misc"] = {
		["eating"] = {
			-- Soundkit 45
			567612,
		},
	},
}
