Quantcast

Attempt clean-up for Classic

Jim Whitehead [07-24-19 - 14:41]
Attempt clean-up for Classic
Filename
BindConfig.lua
BlizzardFrames.lua
Clique.lua
Clique.xml
OptionsPanel.lua
diff --git a/BindConfig.lua b/BindConfig.lua
index 3f2d5aa..9f096b7 100755
--- a/BindConfig.lua
+++ b/BindConfig.lua
@@ -47,12 +47,20 @@ function CliqueConfig:OnHide()
     self:UpdateAlert()
 end

-function CliqueConfig:SetupGUI()
-    self.talents = {}
-    for i = 1, GetNumSpecializations() do
-        local id, name = GetSpecializationInfo(i)
-        self.talents[i] = name
+-- compat:classic
+function CliqueConfig:SetupTalents()
+    if not GetNumSpecializations then
+        self.talents = {L["Default"]}
+    else
+        for i = 1, GetNumSpecializations() do
+            local id, name = GetSpecializationInfo(i)
+            self.talents[i] = name
+        end
     end
+end
+
+function CliqueConfig:SetupGUI()
+    self:SetupTalents()

     self.rows = {}
     for i = 1, MAX_ROWS do
diff --git a/BlizzardFrames.lua b/BlizzardFrames.lua
index d20e26c..94dc9a6 100755
--- a/BlizzardFrames.lua
+++ b/BlizzardFrames.lua
@@ -59,21 +59,25 @@ function panel:CreateOptions()
     self.PetFrame = make_checkbox("PetFrame", L["Player's pet frame"])
     self.TargetFrame = make_checkbox("TargetFrame", L["Player's target frame"])
     self.TargetFrameToT = make_checkbox("TargetFrameToT", L["Target of target frame"])
-    self.FocusFrame = make_checkbox("FocusFrame", L["Player's focus frame"])
-    self.FocusFrameToT = make_checkbox("FocusFrameToT", L["Target of focus frame"])
-    self.arena = make_checkbox("ArenaEnemy", L["Arena enemy frames"])
     self.party = make_checkbox("Party", L["Party member frames"])
     self.compactraid = make_checkbox("CompactRaid", L["Compact raid frames"])
-    --self.compactparty = make_checkbox("CompactParty", L["Compact party frames"])
     self.boss = make_checkbox("BossTarget", L["Boss target frames"])

+    self.FocusFrame = make_checkbox("FocusFrame", L["Player's focus frame"])
+    self.FocusFrameToT = make_checkbox("FocusFrameToT", L["Target of focus frame"])
+    self.arena = make_checkbox("ArenaEnemy", L["Arena enemy frames"])
+
     table.insert(bits, self.intro)
     table.insert(bits, self.PlayerFrame)
     table.insert(bits, self.PetFrame)
     table.insert(bits, self.TargetFrame)
 	table.insert(bits, self.TargetFrameToT)
-    table.insert(bits, self.FocusFrame)
-    table.insert(bits, self.FocusFrameToT)
+
+    if addon.compatRelease then
+        table.insert(bits, self.FocusFrame)
+        table.insert(bits, self.FocusFrameToT)
+        table.insert(bits, self.arena)
+    end

     -- Group these together
     bits[1]:SetPoint("TOPLEFT", 5, -5)
@@ -85,10 +89,8 @@ function panel:CreateOptions()
     local last = bits[#bits]

     table.wipe(bits)
-    table.insert(bits, self.arena)
     table.insert(bits, self.party)
     table.insert(bits, self.compactraid)
-    --table.insert(bits, self.compactparty)
     table.insert(bits, self.boss)

     bits[1]:SetPoint("TOPLEFT", last, "BOTTOMLEFT", 0, -15)
@@ -110,12 +112,15 @@ function panel.refresh()
     panel.PetFrame:SetChecked(opt.PetFrame)
     panel.TargetFrame:SetChecked(opt.TargetFrame)
     panel.TargetFrameToT:SetChecked(opt.TargetFrameToT)
-    panel.FocusFrame:SetChecked(opt.FocusFrame)
-    panel.FocusFrameToT:SetChecked(opt.FocusFrameToT)
-    panel.arena:SetChecked(opt.arena)
+
+    if addon.compatRelease then
+        panel.FocusFrame:SetChecked(opt.FocusFrame)
+        panel.FocusFrameToT:SetChecked(opt.FocusFrameToT)
+        panel.arena:SetChecked(opt.arena)
+    end
+
     panel.party:SetChecked(opt.party)
     panel.compactraid:SetChecked(opt.compactraid)
-    --panel.compactparty:SetChecked(opt.compactparty)
     panel.boss:SetChecked(opt.boss)
     end, geterrorhandler())
 end
@@ -127,12 +132,15 @@ function panel.okay()
     opt.PetFrame = not not panel.PetFrame:GetChecked()
     opt.TargetFrame = not not panel.TargetFrame:GetChecked()
     opt.TargetFrameToT = not not panel.TargetFrameToT:GetChecked()
-    opt.FocusFrame = not not panel.FocusFrame:GetChecked()
-    opt.FocusFrameToT = not not panel.FocusFrameToT:GetChecked()
-    opt.arena = not not panel.arena:GetChecked()
+
+    if addon.compatRelease then
+        opt.FocusFrame = not not panel.FocusFrame:GetChecked()
+        opt.FocusFrameToT = not not panel.FocusFrameToT:GetChecked()
+        opt.arena = not not panel.arena:GetChecked()
+    end
+
     opt.party = not not panel.party:GetChecked()
     opt.compactraid = not not panel.compactraid:GetChecked()
-    --opt.compactparty = not not panel.compactparty:GetChecked()
     opt.boss = not not panel.boss:GetChecked()
     end, geterrorhandler())
 end
@@ -196,6 +204,10 @@ function addon:Enable_BlizzArenaFrames()
         return
     end

+    if not addon.compatRelease then
+        return
+    end
+
     local frames = {
         "ArenaEnemyFrame1",
         "ArenaEnemyFrame2",
@@ -214,9 +226,13 @@ function addon:Enable_BlizzSelfFrames()
         "PetFrame",
         "TargetFrame",
         "TargetFrameToT",
-        "FocusFrame",
-        "FocusFrameToT",
     }
+
+    if addon.compatRelease then
+        table.insert(frames, "FocusFrame")
+        table.insert(frames, "FocusFrameToT")
+    end
+
     for idx, frame in ipairs(frames) do
         if addon.settings.blizzframes[frame] then
             enable(frame)
@@ -246,79 +262,6 @@ function addon:Enable_BlizzPartyFrames()
     end
 end

--- function addon:Enable_BlizzCompactParty()
---     if not addon.settings.blizzframes.compactparty then
---         return
---     end
---
---     local frames = {
---         --"CompactPartyFrameMemberSelf",
---         --"CompactPartyFrameMemberSelfBuff1",
---         --"CompactPartyFrameMemberSelfBuff2",
---         --"CompactPartyFrameMemberSelfBuff3",
---         --"CompactPartyFrameMemberSelfDebuff1",
---         --"CompactPartyFrameMemberSelfDebuff2",
---         --"CompactPartyFrameMemberSelfDebuff3",
---         "CompactPartyFrameMember1",
---         "CompactPartyFrameMember1Buff1",
---         "CompactPartyFrameMember1Buff2",
---         "CompactPartyFrameMember1Buff3",
---         "CompactPartyFrameMember1Debuff1",
---         "CompactPartyFrameMember1Debuff2",
---         "CompactPartyFrameMember1Debuff3",
---         "CompactPartyFrameMember1DispelDebuff1",
---         "CompactPartyFrameMember1DispelDebuff2",
---         "CompactPartyFrameMember1DispelDebuff2",
---         "CompactPartyFrameMember2",
---         "CompactPartyFrameMember2Buff1",
---         "CompactPartyFrameMember2Buff2",
---         "CompactPartyFrameMember2Buff3",
---         "CompactPartyFrameMember2Debuff1",
---         "CompactPartyFrameMember2Debuff2",
---         "CompactPartyFrameMember2Debuff3",
---         "CompactPartyFrameMember2DispelDebuff1",
---         "CompactPartyFrameMember2DispelDebuff2",
---         "CompactPartyFrameMember2DispelDebuff2",
---         "CompactPartyFrameMember3",
---         "CompactPartyFrameMember3Buff1",
---         "CompactPartyFrameMember3Buff2",
---         "CompactPartyFrameMember3Buff3",
---         "CompactPartyFrameMember3Debuff1",
---         "CompactPartyFrameMember3Debuff2",
---         "CompactPartyFrameMember3Debuff3",
---         "CompactPartyFrameMember3DispelDebuff1",
---         "CompactPartyFrameMember3DispelDebuff2",
---         "CompactPartyFrameMember3DispelDebuff2",
---         "CompactPartyFrameMember4",
---         "CompactPartyFrameMember4Buff1",
---         "CompactPartyFrameMember4Buff2",
---         "CompactPartyFrameMember4Buff3",
---         "CompactPartyFrameMember4Debuff1",
---         "CompactPartyFrameMember4Debuff2",
---         "CompactPartyFrameMember4Debuff3",
---         "CompactPartyFrameMember4DispelDebuff1",
---         "CompactPartyFrameMember4DispelDebuff2",
---         "CompactPartyFrameMember4DispelDebuff2",
---         "CompactPartyFrameMember5",
---         "CompactPartyFrameMember5Buff1",
---         "CompactPartyFrameMember5Buff2",
---         "CompactPartyFrameMember5Buff3",
---         "CompactPartyFrameMember5Debuff1",
---         "CompactPartyFrameMember5Debuff2",
---         "CompactPartyFrameMember5Debuff3",
---         "CompactPartyFrameMember5DispelDebuff1",
---         "CompactPartyFrameMember5DispelDebuff2",
---         "CompactPartyFrameMember5DispelDebuff2",
---         "CompactPartyFramePet1",
---         "CompactPartyFramePet2",
---         "CompactPartyFramePet3",
---         "CompactPartyFramePet4",
---         "CompactPartyFramePet5",
---     }
---     for idx, frame in ipairs(frames) do
---         enable(frame)
---     end
--- end

 function addon:Enable_BlizzBossFrames()
     if not addon.settings.blizzframes.boss then
@@ -345,10 +288,12 @@ function addon:EnableBlizzardFrames()

     local waitForAddon = {}

-    if IsAddOnLoaded("Blizzard_ArenaUI") then
-        self:Enable_BlizzArenaFrames()
-    else
-        waitForAddon["Blizzard_ArenaUI"] = "Enable_BlizzArenaFrames"
+    if addon.compatRelease then
+        if IsAddOnLoaded("Blizzard_ArenaUI") then
+            self:Enable_BlizzArenaFrames()
+        else
+            waitForAddon["Blizzard_ArenaUI"] = "Enable_BlizzArenaFrames"
+        end
     end

     if next(waitForAddon) then
diff --git a/Clique.lua b/Clique.lua
index a53e12a..de2c0d9 100755
--- a/Clique.lua
+++ b/Clique.lua
@@ -41,6 +41,9 @@ local addonName, addon = ...
 local L = addon.L

 function addon:Initialize()
+    -- Are we running on release or classic?
+    self.compatRelease = not not GetSpecialization
+
     -- Create an AceDB, but it needs to be cleared first
     self.db = LibStub("AceDB-3.0"):New("CliqueDB3", self.defaults)
     self.db.RegisterCallback(self, "OnNewProfile", "OnNewProfile")
@@ -201,7 +204,11 @@ function addon:Initialize()
     -- Register for combat events to ensure we can swap between the two states
     self:RegisterEvent("PLAYER_REGEN_DISABLED", "EnteringCombat")
     self:RegisterEvent("PLAYER_REGEN_ENABLED", "LeavingCombat")
-    self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "TalentGroupChanged")
+
+    if self.compatRelease then
+        self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "TalentGroupChanged")
+    end
+
     self:RegisterEvent("PLAYER_ENTERING_WORLD", "PlayerEnteringWorld")

     -- Register for Clique-based messages for settings updates, etc.
@@ -212,7 +219,9 @@ function addon:Initialize()
     addon:UpdateCombatWatch()

     -- Trigger a 'TalentGroupChanged' so we end up on the right profile
-    addon:TalentGroupChanged()
+    if self.compatRelease then
+        addon:TalentGroupChanged()
+    end

     self:FireMessage("BLACKLIST_CHANGED")
     self:FireMessage("BINDINGS_CHANGED")
@@ -355,6 +364,10 @@ local function shouldApply(global, entry)
 end

 local function correctSpec(entry)
+    if not compatRelease then
+        return true
+    end
+
     -- Check to ensure we're on the right spec for this binding
     local currentSpec = GetSpecialization()
     if currentSpec and entry.sets["spec" .. tostring(currentSpec)] then
diff --git a/Clique.xml b/Clique.xml
index 4b93364..b5223e5 100755
--- a/Clique.xml
+++ b/Clique.xml
@@ -78,7 +78,7 @@
     <Button name="CliqueColumnTemplate" inherits="WhoFrameColumnHeaderTemplate" virtual="true">
         <Scripts>
             <OnClick>
-                PlaySound("igMainMenuOptionCheckBoxOn");
+                PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON);
                 CliqueConfig:Column_OnClick(self, button)
             </OnClick>
         </Scripts>
diff --git a/OptionsPanel.lua b/OptionsPanel.lua
index b9f4342..2910b36 100755
--- a/OptionsPanel.lua
+++ b/OptionsPanel.lua
@@ -76,18 +76,32 @@ function panel:CreateOptions()
     end
     self.specswap:SetScript("PostClick", self.specswap.EnableDisable)

-    -- Generate the dropdowns for each spec
-    for i = 1, GetNumSpecializations() do
-        local _, specName = GetSpecializationInfo(i)
+    if addon.compatRelease then
+        -- Generate the dropdowns for each spec
+        for i = 1, GetNumSpecializations() do
+            local _, specName = GetSpecializationInfo(i)
+            local name = "CliqueOptionsSpec" .. i
+            local label = make_label(name .. "Label", self, "GameFontNormalSmall")
+            label:SetText(L["Talent profile: %s"]:format(specName))
+            self.talentProfiles[i] = make_dropdown(name, self)
+            self.talentProfiles[i].profileLabel = label
+            UIDropDownMenu_SetWidth(self.talentProfiles[i], 200)
+            BlizzardOptionsPanel_SetupDependentControl(self.specswap, self.talentProfiles[i])
+        end
+    end
+
+	for i = 1, 1 do
+        local _, specName = "Default"
         local name = "CliqueOptionsSpec" .. i
         local label = make_label(name .. "Label", self, "GameFontNormalSmall")
-        label:SetText(L["Talent profile: %s"]:format(specName))
+        label:SetText(L["Talent profile: %s"]:format("Default"))
         self.talentProfiles[i] = make_dropdown(name, self)
         self.talentProfiles[i].profileLabel = label
         UIDropDownMenu_SetWidth(self.talentProfiles[i], 200)
         BlizzardOptionsPanel_SetupDependentControl(self.specswap, self.talentProfiles[i])
     end

+
     self.profilelabel = make_label("CliqueOptionsProfileMgmtLabel", self, "GameFontNormalSmall")
     self.profilelabel:SetText(L["Profile Management:"])
     self.profiledd = make_dropdown("CliqueOptionsProfileMgmt", self)