From fc96980762395d84bdc51a3ae648f7064543f23a Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Fri, 29 Jul 2011 16:27:02 +0100 Subject: [PATCH] Add binding-sets for primary/secondary talent spec --- BindConfig.lua | 22 ++++++++++++++++++++-- Clique.lua | 15 ++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/BindConfig.lua b/BindConfig.lua index bc719e4..94b6c14 100755 --- a/BindConfig.lua +++ b/BindConfig.lua @@ -591,11 +591,29 @@ function CliqueConfig:Row_OnClick(frame, button) }) table.insert(submenu.menuList, { - text = L["Out-of-combat only"], + text = L["Out-of-combat (ONLY)"], checked = function() return binding.sets["ooc"] end, func = toggleSet(binding, "ooc"), tooltipTitle = L["Clique: 'ooc' binding-set"], - tooltipText = L["A binding that belongs to the 'ooc' binding-set will only be active when the player is out-of-combat. As soon as the player enters combat, these bindings will no longer be active, so be careful when choosing this binding-set for any spells you use frequently."], + tooltipText = L["A binding that belongs to the 'ooc' binding-set will only be active when the player is out-of-combat, regardless of the other binding-sets this binding belongs to. As soon as the player enters combat, these bindings will no longer be active, so be careful when choosing this binding-set for any spells you use frequently."], + keepShownOnClick = true, + }) + + table.insert(submenu.menuList, { + text = L["Primary talent spec (ONLY)"], + checked = function() return binding.sets["pritalent"] end, + func = toggleSet(binding, "pritalent"), + tooltipTitle = L["Clique: 'pritalent' binding-set"], + tooltipText = L["A binding that belongs to the 'pritalent' binding-set is only active when the player is currently using their primary talent spec, regardless of the other binding-sets that this binding belongs to."], + keepShownOnClick = true, + }) + + table.insert(submenu.menuList, { + text = L["Secondary talent spec (ONLY)"], + checked = function() return binding.sets["sectalent"] end, + func = toggleSet(binding, "sectalent"), + tooltipTitle = L["Clique: 'sectalent' binding-set"], + tooltipText = L["A binding that belongs to the 'sectalent' binding-set is only active when the player is currently using their secondary talent spec, regardless of the other binding-sets that this binding belongs to."], keepShownOnClick = true, }) diff --git a/Clique.lua b/Clique.lua index 6840a8b..5f9f3ab 100755 --- a/Clique.lua +++ b/Clique.lua @@ -339,6 +339,15 @@ local function shouldApply(global, entry) end end +local function correctSpec(entry, currentSpec) + if entry.sets.pritalent and currentSpec ~= 1 then + return false + elseif entry.sets.sectalent and currentSpec ~= 2 then + return false + end + return true +end + -- This function takes a single argument indicating if the attributes being -- computed are for the special 'global' button used by Clique. It then -- computes the set of attributes necessary for the player's bindings to be @@ -388,7 +397,7 @@ function addon:GetClickAttributes(global) -- non-global bindings are only applied on non-global frames. handle -- this logic here. - if shouldApply(global, entry) then + if shouldApply(global, entry) and correctSpec(entry, GetActiveTalentGroup()) then -- Check to see if this is a 'friend' or an 'enemy' binding, and -- check if it would mask an 'ooc' binding with the same key. If -- so, we need to add code that prevents this from happening, by @@ -728,9 +737,9 @@ function addon:TalentGroupChanged() local currentProfile = self.db:GetCurrentProfile() local newProfile - if self.settings.specswap then + if self.settings.specswap then + self.talentGroup = GetActiveTalentGroup() -- Determine which profile to set, based on talent group - self.talentGroup = GetActiveTalentGroup() if self.talentGroup == 1 and self.settings.pri_profileKey then newProfile = self.settings.pri_profileKey elseif self.talentGroup == 2 and self.settings.sec_profileKey then -- 1.7.9.5