--Trigger on combat
--Check bag for amount
--Maybe grey out if no trinket?
--Maybe make equipped glow :?
--Or fuck with opacity
--Make two rows
--PLAYER_REGEN_DISABLED PLAYER_REGEN_ENABLED
function(e)
	if e == "PLAYER_REGEN_ENABLED" then
		local row = 1
		for k, v in ipairs(aura_env.daiTrinket) do
			if not WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k] or not WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k][0] then
				--Frame does not exist, create new frame
				local iname = GetItemInfo(v)
				local icon = GetItemIcon(v)
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k] = CreateFrame("Button", nil, aura_env.region, "SecureActionButtonTemplate")
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:SetAttribute("type", "macro")
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:SetAttribute("macrotext", format("/equip %s", iname))
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:RegisterForClicks("LeftButtonDown")
				print(k, "at", ((k - 1) * aura_env.size) - ((row - 1) * 8 * aura_env.size), - row * aura_env.size)
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:SetPoint("CENTER", aura_env.region, "CENTER", ((k - 1) * aura_env.size) - ((row - 1) * 8 * aura_env.size), - row * aura_env.size)
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:SetNormalTexture(icon)
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:SetSize(aura_env.size, aura_env.size)
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:Show()
				if k % 8 == 0 then row = row + 1 end
			else
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:Show()
			end
		end
	elseif e == "PLAYER_REGEN_DISABLED" then
		for k, v in ipairs(aura_env.daiTrinket) do
			if WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k] and WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k][0] then
				WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons[k]:Hide()
			end
		end
	end
end

--INIT
if not WeakAurasSaved.CustomTrash then WeakAurasSaved.CustomTrash = {} end
if not WeakAurasSaved.CustomTrash.TrinketFuckery then WeakAurasSaved.CustomTrash.TrinketFuckery = {} end
if not WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons then WeakAurasSaved.CustomTrash.TrinketFuckery.Buttons = {} end
aura_env.size = 48
aura_env.daiTrinket = {
	137400, --Coagulated Nightwell Residue
	151978, --Smoldering Titanguard
	151956, --Garothi Feedback Circuit
	151957, --Ishkar's Felshield Emitter
	147023, --Leviathan's Hunger
	152645, --Eye of Dogs
	151975, --Apocalypse Drive
	151977, --Diima's Glacial Aegis
	137315, --Writhing Heart of Darkness
	151976, --Riftworld Codex
	147024, --Reliquary of the Damned
	137344, --Talisman of the Shaper
	151964, --Seeping Scourgewing
	136978, --Ember of Nulification
	152289, --Highfather's Machination
	151969, --Terminus Signaling Beacon
}
WeakAuras.ScanEvents("PLAYER_REGEN_ENABLED")