feat/redesign (#1)
Reviewed-on: #1 Co-authored-by: Gonçalo Correia <goncalojoaocorreia@gmail.com> Co-committed-by: Gonçalo Correia <goncalojoaocorreia@gmail.com>
This commit is contained in:
parent
6a44458443
commit
6ebb92c62b
21 changed files with 1395 additions and 273 deletions
37
Core.lua
Normal file → Executable file
37
Core.lua
Normal file → Executable file
|
|
@ -6,11 +6,14 @@ AltSystem.State = {
|
|||
selectedSkillIndex = 1,
|
||||
selectedSkillName = nil, -- skill name used to restore selection across sessions
|
||||
selectedItemIndex = 1, -- 1 = No item
|
||||
selectedDefenseIndex = 1, -- 1 = Base armor
|
||||
selectedDefenseIndex = 1, -- 1 = No Armor
|
||||
shieldEnabled = false,
|
||||
petSummonEnabled = false,
|
||||
announceEnabled = false,
|
||||
announceChannelIndex = 1, -- 1 = Emote, 2 = Party, 3 = Raid, 4 = Guild
|
||||
rollType = "attack", -- "attack" or "defense"
|
||||
announceOptionIndex = 1, -- 1 = Self Roll, 2+ = channel from AnnounceChannels
|
||||
rollLog = {}, -- array of { text = "...", timestamp = time() }, max 100, not persisted
|
||||
}
|
||||
|
||||
-- Channel definitions for announcing rolls
|
||||
|
|
@ -35,12 +38,6 @@ 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
|
||||
if AltSystemDB.petSummonEnabled ~= nil then
|
||||
AltSystem.State.petSummonEnabled = AltSystemDB.petSummonEnabled
|
||||
end
|
||||
|
|
@ -56,6 +53,28 @@ function AltSystem:Init()
|
|||
if AltSystemDB.selectedSkillName then
|
||||
AltSystem.State.selectedSkillName = AltSystemDB.selectedSkillName
|
||||
end
|
||||
if AltSystemDB.rollType then
|
||||
AltSystem.State.rollType = AltSystemDB.rollType
|
||||
end
|
||||
-- Migrate from old announce settings or load new announceOptionIndex
|
||||
if AltSystemDB.announceOptionIndex then
|
||||
AltSystem.State.announceOptionIndex = AltSystemDB.announceOptionIndex
|
||||
elseif AltSystemDB.announceEnabled ~= nil then
|
||||
-- Backwards compat: derive from old announceEnabled + announceChannelIndex
|
||||
if AltSystemDB.announceEnabled and AltSystemDB.announceChannelIndex then
|
||||
AltSystem.State.announceOptionIndex = AltSystemDB.announceChannelIndex + 1
|
||||
else
|
||||
AltSystem.State.announceOptionIndex = 1
|
||||
end
|
||||
end
|
||||
-- Derive announceEnabled and announceChannelIndex from announceOptionIndex
|
||||
if AltSystem.State.announceOptionIndex > 1 then
|
||||
AltSystem.State.announceEnabled = true
|
||||
AltSystem.State.announceChannelIndex = AltSystem.State.announceOptionIndex - 1
|
||||
else
|
||||
AltSystem.State.announceEnabled = false
|
||||
AltSystem.State.announceChannelIndex = 1
|
||||
end
|
||||
|
||||
-- Register slash command /altsystem
|
||||
SLASH_ALTSYSTEM1 = "/altsystem"
|
||||
|
|
@ -68,13 +87,13 @@ function AltSystem:Init()
|
|||
saveFrame:RegisterEvent("PLAYER_LOGOUT")
|
||||
saveFrame:SetScript("OnEvent", function()
|
||||
AltSystemDB = AltSystemDB or {}
|
||||
AltSystemDB.announceEnabled = AltSystem.State.announceEnabled
|
||||
AltSystemDB.announceChannelIndex = AltSystem.State.announceChannelIndex
|
||||
AltSystemDB.announceOptionIndex = AltSystem.State.announceOptionIndex
|
||||
AltSystemDB.petSummonEnabled = AltSystem.State.petSummonEnabled
|
||||
AltSystemDB.shieldEnabled = AltSystem.State.shieldEnabled
|
||||
AltSystemDB.selectedItemIndex = AltSystem.State.selectedItemIndex
|
||||
AltSystemDB.selectedDefenseIndex = AltSystem.State.selectedDefenseIndex
|
||||
AltSystemDB.selectedSkillName = AltSystem.State.selectedSkillName
|
||||
AltSystemDB.rollType = AltSystem.State.rollType
|
||||
end)
|
||||
|
||||
-- Build the main frame now that saved variables are loaded
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue