Quantcast

Don't apply wrong-spec bindings

James Whitehead II [09-06-12 - 07:32]
Don't apply wrong-spec bindings

Previously, if you were in your primary spec and you had a spell that
was bound to secondary spec only, the binding would still be active
(although it would not do anything). Simple test:

  1. Bind 'moonfire' to 1 on hovercast,secspec
  2. Verify it works
  3. Change to primary spec
  4. You will be unable to use your '1' normal binding
Filename
Clique.lua
diff --git a/Clique.lua b/Clique.lua
index 52d17c7..25fc798 100755
--- a/Clique.lua
+++ b/Clique.lua
@@ -354,6 +354,20 @@ local function correctSpec(entry, currentSpec)
 	return true
 end

+local function getEntryString(entry)
+	local bits = {}
+	bits[#bits+1] = "type"
+	bits[#bits+1] = tostring(entry.type)
+
+	if entry.type == "spell" then
+		bits[#bits+1] = tostring(entry.spell)
+	elseif entry.type == "macro" and entry.macrotext then
+		bits[#bits+1] = tostring(entry.macrotext)
+	end
+
+	return table.concat(bits, ":")
+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
@@ -579,7 +593,7 @@ function addon:GetBindingAttributes(global)

     for idx, entry in ipairs(self.bindings) do
 		if entry.key then
-			if shouldApply(global, entry) then
+			if shouldApply(global, entry) and correctSpec(entry, GetActiveSpecGroup()) then
 				if global then
 					-- Allow for the re-binding of clicks and keys, except for
 					-- unmodified left/right-click