Chat announce rolls

This commit is contained in:
Gonçalo Correia 2026-04-12 20:48:49 +01:00
parent e17370a89f
commit 907e0464ed
5 changed files with 154 additions and 2 deletions

View file

@ -7,6 +7,16 @@ AltSystem.State = {
selectedItemIndex = 1, -- 1 = No item
selectedDefenseIndex = 1, -- 1 = Base armor
shieldEnabled = false,
announceEnabled = false,
announceChannelIndex = 1, -- 1 = Emote, 2 = Party, 3 = Raid, 4 = Guild
}
-- Channel definitions for announcing rolls
AltSystem.AnnounceChannels = {
{ name = "Emote (/e)", channel = "EMOTE" },
{ name = "Party (/p)", channel = "PARTY" },
{ name = "Raid (/ra)", channel = "RAID" },
{ name = "Guild (/g)", channel = "GUILD" },
}
-- Initialization on ADDON_LOADED
@ -21,12 +31,30 @@ frame:SetScript("OnEvent", function(self, event, arg1)
end)
function AltSystem:Init()
-- Load saved settings
AltSystemDB = AltSystemDB or {}
if AltSystemDB.announceEnabled ~= nil then
AltSystem.State.announceEnabled = AltSystemDB.announceEnabled
end
if AltSystemDB.announceChannelIndex then
AltSystem.State.announceChannelIndex = AltSystemDB.announceChannelIndex
end
-- Register slash command /altsystem
SLASH_ALTSYSTEM1 = "/altsystem"
SlashCmdList["ALTSYSTEM"] = function()
AltSystem:ToggleWindow()
end
-- Save settings on logout
local saveFrame = CreateFrame("Frame")
saveFrame:RegisterEvent("PLAYER_LOGOUT")
saveFrame:SetScript("OnEvent", function()
AltSystemDB = AltSystemDB or {}
AltSystemDB.announceEnabled = AltSystem.State.announceEnabled
AltSystemDB.announceChannelIndex = AltSystem.State.announceChannelIndex
end)
print("|cff00ccffAltSystem|r loaded. Type /altsystem to open.")
end