comparison ActionTemplates.lua @ 72:c48913c5924c

- Dynamic bindings properly update between talent choices, and the hotkey text is also correctly reflected.
author Nenue
date Sat, 07 Jan 2017 12:47:41 -0500
parents ca3118127e5e
children 68365bda5ab5
comparison
equal deleted inserted replaced
71:ca3118127e5e 72:c48913c5924c
148 148
149 149
150 local indexKey = actionType..'_'..actionID 150 local indexKey = actionType..'_'..actionID
151 local actionPrefix = "*"..actionType.."-" 151 local actionPrefix = "*"..actionType.."-"
152 local button = SkeletonKeyKey 152 local button = SkeletonKeyKey
153 local isAvailable = true 153 local isAvailable
154 local specialButtonType 154 local specialButtonType
155 if actionType == 'spell' then 155 if actionType == 'spell' then
156 if not GetSpellInfo(actionID) then 156 cprint(GetSpellInfo(actionID))
157 isAvailable = nil 157 cprint(GetSpellInfo(name))
158 if GetSpellInfo(name) then
159 isAvailable = true
158 end 160 end
159 local dynamicInfo = kb.DynamicSpells[name] 161 local dynamicInfo = kb.DynamicSpells[name]
160 if dynamicInfo then 162 if dynamicInfo then
161 configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command)} 163 configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command)}
162 cprint('|cFF00FFFFDynamicInfo:|r', dynamicInfo.dynamicType, table.concat(configTable.assignedKeys or {}, ',')) 164 cprint('|cFF00FFFFDynamicInfo:|r', dynamicInfo.dynamicType, table.concat(configTable.assignedKeys, ','))
163 for k, v in pairs(dynamicInfo) do 165 for k, v in pairs(dynamicInfo) do
164 --cprint(' --', k, v) 166 --cprint(' --', k, v)
165 configTable[k] = v 167 configTable[k] = v
166 end 168 end
167 end 169 end
168 170
169
170 else 171 else
171 if actionType ~= 'macro' then 172 if actionType ~= 'macro' then
172 actionPrefix = '*macrotext-' 173 actionPrefix = '*macrotext-'
173 end 174 end
174 175
175 specialButtonType = 'macro' 176 specialButtonType = 'macro'
176 end 177 end
177 178
178 local attributeSuffix, attributeValue, command, target, button = kb.RegisterAction(actionType, actionID, name)
179 local actionKey = actionPrefix .. attributeSuffix
180 cprint('|cFF00FF88LoadBinding()|r', button:GetName(), "*type-"..attributeSuffix, actionType, '|cFFFFFF00'..actionKey, attributeValue)
181
182
183
184
185 if isAvailable then 179 if isAvailable then
180
181 local attributeSuffix, attributeValue, command, target, button = kb.RegisterAction(actionType, actionID, name)
182 local actionKey = actionPrefix .. attributeSuffix
183 cprint('|cFF00FF88LoadBinding()|r', button:GetName(), "*type-"..attributeSuffix, actionType, '|cFFFFFF00'..actionKey, attributeValue, isAvailable)
184
185
186 kb.SecureAttribute(button, "*type-"..attributeSuffix, specialButtonType or actionType) 186 kb.SecureAttribute(button, "*type-"..attributeSuffix, specialButtonType or actionType)
187 kb.SecureAttribute(button, actionKey, attributeValue) 187 kb.SecureAttribute(button, actionKey, attributeValue)
188
189 cprint('|cFFFF4400add', name, isAvailable, indexKey, unpack(configTable.assignedKeys))
188 kb.bindings[indexKey] = configTable.assignedKeys 190 kb.bindings[indexKey] = configTable.assignedKeys
189 commandActions[command] = kb.bindings[indexKey] 191 commandActions[command] = kb.bindings[indexKey]
190 return command, kb.bindings[indexKey] 192 return command, kb.bindings[indexKey]
191 else 193 else
194 if kb.bindings[indexKey] then
195 cprint('|cFFFF4400remove', name, isAvailable, indexKey, unpack(configTable.assignedKeys))
196 kb.bindings[indexKey] = nil
197 end
198
192 return nil 199 return nil
193 end 200 end
194 end 201 end
195 202
196 203
302 configTable.assignedKeys = talent.assignedKeys 309 configTable.assignedKeys = talent.assignedKeys
303 end 310 end
304 if not configTable.assignedKeys then 311 if not configTable.assignedKeys then
305 configTable.assignedKeys = {GetBindingKey(configTable.command) } 312 configTable.assignedKeys = {GetBindingKey(configTable.command) }
306 end 313 end
307 configTable.isAvailable = true
308 if configTable.dynamicType then 314 if configTable.dynamicType then
309 kb:print(table.concat(configTable.assignedKeys, ', ') .. ' bound to '.. configTable.actionName) 315 kb:print(table.concat(configTable.assignedKeys, ', ') .. ' bound to '.. configTable.actionName)
310 end 316 end
311
312 end 317 end
313 end 318 end
314 end 319 end
315 320
316 kb.ApplyAllBindings =function () 321 kb.ApplyAllBindings =function ()
333 end 338 end
334 -- do this after to ensure that profession binds are properly overridden 339 -- do this after to ensure that profession binds are properly overridden
335 kb.UpdateProfessionInfo() 340 kb.UpdateProfessionInfo()
336 341
337 SaveBindings(GetCurrentBindingSet()) 342 SaveBindings(GetCurrentBindingSet())
343
338 end 344 end
339 end 345 end
340 346
341 347
342 kb.specInfo = {} 348 kb.specInfo = {}