Nenue@70
|
1 -- SkeletonKey
|
Nenue@70
|
2 -- ActionTemplates.lua
|
Nenue@70
|
3 -- Created: 7/29/2016 9:14 PM
|
Nenue@70
|
4 -- %file-revision%
|
Nenue@70
|
5 -- Code dealing with the implementation of action hotkeys
|
Nenue@70
|
6
|
Nenue@70
|
7 local tostring, tonumber, pairs, ipairs = tostring, tonumber, pairs, ipairs
|
Nenue@70
|
8 local unpack, SetBinding = unpack, SetBinding
|
Nenue@70
|
9 local tinsert, tContains, select, wipe = tinsert, tContains, select, table.wipe
|
Nenue@70
|
10 local GetSpellBookItemInfo, GetSpellBookItemName, GetSpellInfo = GetSpellBookItemInfo, GetSpellBookItemName, GetSpellInfo
|
Nenue@70
|
11 local GetSpecialization, GetSpecializationInfo, IsPassiveSpell, IsTalentSpell = GetSpecialization, GetSpecializationInfo, IsPassiveSpell, IsTalentSpell
|
Nenue@70
|
12 local PetHasSpellbook, PetHasActionBar, GetPetActionInfo, HasPetSpells = PetHasSpellbook, PetHasActionBar, GetPetActionInfo, HasPetSpells
|
Nenue@70
|
13 local GetProfessions, GetProfessionInfo, GetTalentInfo = GetProfessions, GetProfessionInfo, GetTalentInfo
|
Nenue@70
|
14 local GetNumBindings, GetBinding = GetNumBindings, GetBinding
|
Nenue@70
|
15
|
Nenue@70
|
16 local _, kb = ...
|
Nenue@70
|
17 local print = (DEVIAN_PNAME == 'SkeletonKey') and function(...) print('SK', ...) end or nop
|
Nenue@70
|
18 local cprint = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('Cfg', ...) end or nop
|
Nenue@70
|
19
|
Nenue@70
|
20 local CLICK_KEYBINDER_MACRO = "CLICK SkeletonKeyMacro:"
|
Nenue@70
|
21 local CLICK_KEYBINDER_KEY = "CLICK SkeletonKeyKey:"
|
Nenue@70
|
22 local PET_BASIC_SUBTEXT = 'Basic Attack'
|
Nenue@70
|
23 local PET_SPECIAL_SUBTEXT = 'Special Ability'
|
Nenue@70
|
24 local PETACTION_SCRIPT = {
|
Nenue@70
|
25 [PET_ACTION_MOVE_TO] = {'pet_move_to', SLASH_PET_MOVE_TO1},
|
Nenue@70
|
26 [PET_ACTION_ATTACK] = {'pet_attack', SLASH_PET_ATTACK1},
|
Nenue@70
|
27 [PET_ACTION_FOLLOW] = {'pet_follow', SLASH_PET_FOLLOW1},
|
Nenue@70
|
28 [PET_ACTION_WAIT] = {'pet_stay', SLASH_PET_STAY1 },
|
Nenue@70
|
29 [PET_MODE_AGGRESSIVE] = {'pet_aggressive', SLASH_PET_AGGRESSIVE1 },
|
Nenue@70
|
30 [PET_MODE_DEFENSIVE] = { 'pet_defensive', SLASH_PET_DEFENSIVE1},
|
Nenue@70
|
31 [PET_MODE_PASSIVE] = { 'pet_passive', SLASH_PET_PASSIVE1},
|
Nenue@70
|
32 [PET_MODE_ASSIST] = {'pet_assist', SLASH_PET_ASSIST1},
|
Nenue@70
|
33 }
|
Nenue@70
|
34 local SECONDARY_PROFESSIONS = {
|
Nenue@70
|
35 [5] = 3,
|
Nenue@70
|
36 [7] = 4,
|
Nenue@70
|
37 [9] = 5,
|
Nenue@70
|
38 [10] = 6
|
Nenue@70
|
39 }
|
Nenue@70
|
40 local petSpellCache,petSubtextCache
|
Nenue@70
|
41 local SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544
|
Nenue@70
|
42
|
Nenue@70
|
43
|
Nenue@70
|
44 local atype = kb.ActionTypes
|
Nenue@70
|
45
|
Nenue@70
|
46 --- Caps Lock
|
Nenue@70
|
47 atype['mount'] = function(id, name)
|
Nenue@70
|
48 if id == SUMMON_RANDOM_FAVORITE_MOUNT_SPELL then
|
Nenue@70
|
49 return CLICK_KEYBINDER_MACRO, 'mount_random', "/script C_MountJournal.SummonByID(0)", SkeletonKeyMacro
|
Nenue@70
|
50 else
|
Nenue@70
|
51 return CLICK_KEYBINDER_MACRO, 'mount_'..id, "/script C_MountJournal.SummonByID("..id..")", SkeletonKeyMacro
|
Nenue@70
|
52 end
|
Nenue@70
|
53 end
|
Nenue@70
|
54
|
Nenue@70
|
55 atype['macro'] = function(id, name)
|
Nenue@70
|
56 local _, _, text = GetMacroInfo(id)
|
Nenue@70
|
57 return CLICK_KEYBINDER_MACRO, 'macro_' .. tostring(name), name, SkeletonKeyMacro
|
Nenue@70
|
58 end
|
Nenue@70
|
59
|
Nenue@70
|
60 atype['equipset'] = function(id, name)
|
Nenue@70
|
61 return CLICK_KEYBINDER_MACRO, 'equipset_'..tostring(name), "/script UseEquipmentSet("..tostring(id)..")", SkeletonKeyMacro
|
Nenue@70
|
62 end
|
Nenue@70
|
63
|
Nenue@70
|
64 atype['spell'] = function(id, name)
|
Nenue@70
|
65 local attributeName = name
|
Nenue@78
|
66 local profInfo = kb.DynamicSpells.profession[id]
|
Nenue@78
|
67 if profInfo then
|
Nenue@78
|
68 attributeName = "profession_".. profInfo.dynamicIndex .. '_' .. profInfo.dynamicSubIndex
|
Nenue@70
|
69 end
|
Nenue@70
|
70 return CLICK_KEYBINDER_KEY, attributeName, name, SkeletonKeyKey
|
Nenue@70
|
71 end
|
Nenue@70
|
72
|
Nenue@70
|
73 atype['petaction'] = function(_, name)
|
Nenue@70
|
74 -- ID doesn't exist for basic commands, even though they can be picked up
|
Nenue@70
|
75 local attributeName, attributeValue = "petaction_" .. tostring(name), "/cast "..tostring(name)
|
Nenue@70
|
76
|
Nenue@70
|
77 if not petSpellCache then
|
Nenue@70
|
78 kb.UpdatePetInfo()
|
Nenue@70
|
79 end
|
Nenue@70
|
80 -- Compose a multi-macro for subtext abilities
|
Nenue@70
|
81 if petSpellCache[name] then
|
Nenue@70
|
82 attributeValue = ""
|
Nenue@70
|
83 for spellName, enabled in pairs(petSubtextCache[petSpellCache[name]]) do
|
Nenue@70
|
84 attributeValue = attributeValue .. "/cast " .. spellName .. "\n"
|
Nenue@70
|
85 end
|
Nenue@70
|
86 end
|
Nenue@70
|
87
|
Nenue@70
|
88 if PETACTION_SCRIPT[name] then
|
Nenue@70
|
89 attributeName, attributeValue = unpack(PETACTION_SCRIPT[name])
|
Nenue@70
|
90 elseif kb.PetCache.special[name] then
|
Nenue@70
|
91 attributeName = "petaction_"..kb.PetCache.special[name][3].."_" .. tonumber(kb.PetCache.special[name][6])
|
Nenue@70
|
92 end
|
Nenue@70
|
93 return CLICK_KEYBINDER_MACRO, attributeName, attributeValue, SkeletonKeyMacro
|
Nenue@70
|
94 end
|
Nenue@70
|
95
|
Nenue@70
|
96 atype['battlepet'] = function(id, name)
|
Nenue@70
|
97 return CLICK_KEYBINDER_MACRO, 'battlepet_' .. tostring(name), SLASH_SUMMON_BATTLE_PET1 .. " " .. tostring(name), SkeletonKeyMacro
|
Nenue@70
|
98 end
|
Nenue@70
|
99
|
Nenue@70
|
100 atype['item'] = function(id, name)
|
Nenue@75
|
101 return CLICK_KEYBINDER_KEY, tostring(name), tostring(name), SkeletonKeyKey
|
Nenue@70
|
102 end
|
Nenue@70
|
103
|
Nenue@70
|
104
|
Nenue@70
|
105 --- Resolves the SecureActionButton attribute names used for the given action
|
Nenue@70
|
106 kb.RegisterAction = function(actionType, id, name)
|
Nenue@70
|
107 assert(atype[actionType], 'Missing actionType handler for `'..tostring(actionType)..'`')
|
Nenue@74
|
108 local prefix, attributeName, attributeValue, button = atype[actionType](id, name)
|
Nenue@74
|
109 local command = prefix .. attributeName
|
Nenue@74
|
110 return attributeName, attributeValue, command, prefix, button
|
Nenue@70
|
111 end
|
Nenue@70
|
112
|
Nenue@70
|
113
|
Nenue@74
|
114 local spells = {}
|
Nenue@74
|
115 local SkeletonKey_GetGenericSpell = function(spellName, spellID, icon)
|
Nenue@74
|
116 if not spells[spellID] then
|
Nenue@74
|
117 spells[spellID] = {}
|
Nenue@74
|
118 spells[spellID].actionType = 'spell'
|
Nenue@74
|
119 spells[spellID].actionID = spellID
|
Nenue@74
|
120 spells[spellID].actionName = spellName
|
Nenue@74
|
121 spells[spellID].iconPath = icon
|
Nenue@74
|
122 spells[spellID].statusText = '|cFFBBBBBBSpell|r'
|
Nenue@74
|
123 spells[spellID].dynamicType = nil
|
Nenue@74
|
124 end
|
Nenue@74
|
125 return spells[spellID]
|
Nenue@74
|
126 end
|
Nenue@74
|
127
|
Nick@80
|
128 -- verifies binding slot data
|
Nenue@74
|
129 local dynamicTypes = {['profession'] = 'ProfessionCache', ['talent'] = 'TalentCache', ['petaction'] = 'PetInfoCache'}
|
Nenue@74
|
130 kb.ResolveSpellSlot = function(self)
|
Nenue@74
|
131 local spellName, spellID, command, icon = self.actionName, self.actionID, self.command, self.iconPath
|
Nick@80
|
132
|
Nenue@74
|
133 --print(GetSpellInfo(spellName or spellID))
|
Nick@80
|
134 local internalName, _, internalIcon, _, _, _, _ = GetSpellInfo(spellID)
|
Nick@80
|
135 local replacerName, _, _, _, _, _, replacerID = GetSpellInfo(internalName)
|
Nick@80
|
136 print('Resolve Slot: id =', spellID, 'nameFromID =', internalName, 'nameFromName =', replacerName)
|
Nenue@74
|
137 local isAvailable = internalName and true
|
Nenue@74
|
138
|
Nick@80
|
139 -- keep current slotInfo if it's a spell that has been replaced by spec/talent
|
Nick@80
|
140 if internalName and (internalName ~= replacerName) then
|
Nick@80
|
141 print(' |cFFFF4400spell name is overridden by', replacerName, '(was', internalName,')')
|
Nenue@74
|
142 self.statusText = '|cFFFFFF00Spell|r'
|
Nenue@74
|
143 self.isAvailable = true
|
Nenue@74
|
144 return
|
Nenue@74
|
145 end
|
Nenue@74
|
146
|
Nick@80
|
147 -- resolve spell name
|
Nick@80
|
148 local info = kb.DynamicSpells[spellName]
|
Nenue@74
|
149 if not info then
|
Nenue@74
|
150 local dynamicType, dynamicIndex, dynamicSubIndex = command:match("(%a+)_(%S+)_(%S+)")
|
Nenue@74
|
151 if kb.DynamicSpells[dynamicType] then
|
Nenue@74
|
152 print('|cFFFF4400resolving dynamic type index:', internalName, spellName, command)
|
Nenue@74
|
153 dynamicIndex = tonumber(dynamicIndex)
|
Nenue@74
|
154 dynamicSubIndex = tonumber(dynamicSubIndex)
|
Nenue@74
|
155 local cache = kb.DynamicSpells[dynamicType]
|
Nenue@74
|
156 print('type:', dynamicType)
|
Nenue@74
|
157 if dynamicIndex and cache[dynamicIndex] then
|
Nenue@74
|
158 info = kb.DynamicSpells[dynamicType][dynamicIndex]
|
Nenue@74
|
159 print('index:', dynamicIndex)
|
Nenue@74
|
160 if dynamicSubIndex and info[dynamicSubIndex] then
|
Nenue@74
|
161 info = info[dynamicSubIndex]
|
Nenue@74
|
162 print('sub-index:', dynamicSubIndex)
|
Nenue@74
|
163 end
|
Nenue@74
|
164 isAvailable = true
|
Nenue@74
|
165 end
|
Nenue@74
|
166 end
|
Nenue@74
|
167 if not info then
|
Nenue@74
|
168 info = SkeletonKey_GetGenericSpell(spellName, spellID, internalIcon or icon)
|
Nenue@74
|
169 end
|
Nenue@74
|
170 end
|
Nenue@74
|
171 info.isAvailable = isAvailable
|
Nenue@74
|
172
|
Nenue@74
|
173 print('|cFF00FF88Slot Details:|r', info.actionName, info.actionID, info.dynamicType, info.isAvailable)
|
Nenue@74
|
174 for k,v in pairs(info) do
|
Nenue@74
|
175 --cprint(' ',k,v)
|
Nenue@74
|
176 self[k] = v
|
Nenue@74
|
177 end
|
Nenue@74
|
178
|
Nenue@74
|
179 return info
|
Nenue@74
|
180 end
|
Nenue@70
|
181
|
Nenue@70
|
182 do
|
Nenue@76
|
183 local PROFILE_VERSION = 320
|
Nenue@70
|
184 local commandActions = {}
|
Nenue@70
|
185 local bindings = kb.bindings
|
Nenue@70
|
186 local key, macro = SkeletonKeyKey, SkeletonKeyMacro
|
Nenue@70
|
187 kb.LoadBinding = function( configTable)
|
Nenue@70
|
188 if configTable.command then
|
Nenue@70
|
189 configTable.command = configTable.command:gsub('KeyBinder', 'SkeletonKey')
|
Nenue@70
|
190 end
|
Nenue@70
|
191
|
Nenue@70
|
192 local command, name, icon, actionType, actionID, macroName, macroText =
|
Nenue@70
|
193 configTable.command, configTable.actionName, configTable.iconPath, configTable.actionType,
|
Nenue@70
|
194 configTable.actionID, configTable.macroName, configTable.macroText
|
Nenue@70
|
195
|
Nenue@70
|
196
|
Nenue@70
|
197 local indexKey = actionType..'_'..actionID
|
Nenue@70
|
198 local actionPrefix = "*"..actionType.."-"
|
Nenue@70
|
199 local button = SkeletonKeyKey
|
Nenue@72
|
200 local isAvailable
|
Nenue@70
|
201 local specialButtonType
|
Nenue@70
|
202 if actionType == 'spell' then
|
Nick@80
|
203 local realName, _, _, _, _, _, realID = GetSpellInfo(name)
|
Nick@80
|
204 if realName and (realName ~= name) then
|
Nick@80
|
205 print(' *** "', name, '" resolves to something else...', realName, realID)
|
Nick@80
|
206 --name, actionID = realName, realID
|
Nick@80
|
207 indexKey = actionType .. '_'.. realID
|
Nick@80
|
208 end
|
Nick@80
|
209
|
Nick@80
|
210
|
Nick@80
|
211
|
Nick@80
|
212 local dynamicInfo = kb.DynamicSpells[spellName]
|
Nenue@70
|
213 if dynamicInfo then
|
Nenue@76
|
214 configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command) }
|
Nenue@76
|
215
|
Nenue@72
|
216 cprint('|cFF00FFFFDynamicInfo:|r', dynamicInfo.dynamicType, table.concat(configTable.assignedKeys, ','))
|
Nenue@70
|
217 for k, v in pairs(dynamicInfo) do
|
Nenue@71
|
218 --cprint(' --', k, v)
|
Nenue@70
|
219 configTable[k] = v
|
Nenue@70
|
220 end
|
Nenue@76
|
221 isAvailable = configTable.isAvailable
|
Nenue@76
|
222 elseif GetSpellInfo(actionID) then
|
Nenue@76
|
223 isAvailable = true
|
Nenue@76
|
224
|
Nenue@70
|
225 end
|
Nenue@75
|
226 elseif actionType == 'item' then
|
Nenue@75
|
227 actionID = configTable.actionName
|
Nenue@75
|
228 isAvailable = true
|
Nenue@75
|
229 else
|
Nenue@71
|
230
|
Nenue@70
|
231 if actionType ~= 'macro' then
|
Nenue@70
|
232 actionPrefix = '*macrotext-'
|
Nenue@70
|
233 end
|
Nenue@70
|
234
|
Nenue@70
|
235 specialButtonType = 'macro'
|
Nenue@73
|
236 isAvailable = true
|
Nenue@70
|
237 end
|
Nenue@70
|
238
|
Nenue@72
|
239 if isAvailable then
|
Nenue@70
|
240
|
Nenue@72
|
241 local attributeSuffix, attributeValue, command, target, button = kb.RegisterAction(actionType, actionID, name)
|
Nenue@72
|
242 local actionKey = actionPrefix .. attributeSuffix
|
Nenue@72
|
243 cprint('|cFF00FF88LoadBinding()|r', button:GetName(), "*type-"..attributeSuffix, actionType, '|cFFFFFF00'..actionKey, attributeValue, isAvailable)
|
Nenue@70
|
244
|
Nenue@70
|
245
|
Nenue@70
|
246 kb.SecureAttribute(button, "*type-"..attributeSuffix, specialButtonType or actionType)
|
Nenue@70
|
247 kb.SecureAttribute(button, actionKey, attributeValue)
|
Nenue@72
|
248
|
Nenue@72
|
249 cprint('|cFFFF4400add', name, isAvailable, indexKey, unpack(configTable.assignedKeys))
|
Nenue@70
|
250 kb.bindings[indexKey] = configTable.assignedKeys
|
Nenue@70
|
251 commandActions[command] = kb.bindings[indexKey]
|
Nenue@70
|
252 return command, kb.bindings[indexKey]
|
Nenue@70
|
253 else
|
Nenue@72
|
254 if kb.bindings[indexKey] then
|
Nenue@72
|
255 cprint('|cFFFF4400remove', name, isAvailable, indexKey, unpack(configTable.assignedKeys))
|
Nenue@72
|
256 kb.bindings[indexKey] = nil
|
Nenue@72
|
257 end
|
Nenue@72
|
258
|
Nenue@70
|
259 return nil
|
Nenue@70
|
260 end
|
Nenue@70
|
261 end
|
Nenue@70
|
262
|
Nenue@71
|
263
|
Nenue@70
|
264 local usedSlots = {}
|
Nenue@71
|
265 kb.UpgradeProfile = function(profile)
|
Nenue@70
|
266 wipe(usedSlots)
|
Nenue@70
|
267 for slot, configTable in pairs(profile.buttons) do
|
Nenue@70
|
268
|
Nenue@71
|
269 -- convert old style table
|
Nenue@70
|
270 if #configTable >= 1 then
|
Nenue@70
|
271 local command, name, icon, actionType, actionID, macroName, macroText, spellbookSlot, spellbookType = unpack(configTable)
|
Nenue@70
|
272
|
Nenue@70
|
273 cprint('|CFFFF4400Fixing pad entry', slot, command, name)
|
Nenue@70
|
274 local assignedKeys = {GetBindingKey(command)}
|
Nenue@70
|
275 for k,v in pairs(profile.bindings) do
|
Nenue@70
|
276 if v == command then
|
Nenue@70
|
277 tinsert(assignedKeys, k)
|
Nenue@70
|
278 end
|
Nenue@70
|
279 end
|
Nenue@70
|
280
|
Nenue@70
|
281 configTable = {
|
Nenue@70
|
282 command = command,
|
Nenue@70
|
283 actionType = actionType,
|
Nenue@70
|
284 actionName = name,
|
Nenue@70
|
285 actionID = actionID,
|
Nenue@70
|
286 macroName = macroName,
|
Nenue@70
|
287 macroText = macroText,
|
Nenue@70
|
288 iconPath = icon,
|
Nenue@70
|
289 spellbookSlot = spellbookSlot,
|
Nenue@70
|
290 spellbookType = spellbookType,
|
Nenue@70
|
291 assignedKeys = assignedKeys
|
Nenue@70
|
292 }
|
Nenue@71
|
293
|
Nenue@71
|
294 local dynamic = kb.DynamicSpells[name]
|
Nenue@71
|
295 if dynamic then
|
Nenue@71
|
296 configTable.dynamicType = dynamic.dynamicType
|
Nenue@71
|
297 configTable.dynamicIndex = dynamic.dynamicIndex
|
Nenue@71
|
298 configTable.dynamicSubIndex = dynamic.dynamicSubIndex
|
Nenue@71
|
299 configTable.dynamicID = dynamic.dynamicID
|
Nenue@71
|
300 if configTable.dynamicType == 'talent' then
|
Nenue@71
|
301 profile.talents[name] = configTable
|
Nenue@71
|
302 end
|
Nenue@71
|
303 end
|
Nenue@71
|
304
|
Nenue@71
|
305
|
Nenue@70
|
306 kb.currentProfile.buttons[slot] = configTable
|
Nenue@70
|
307 end
|
Nenue@70
|
308 if not configTable.actionID then
|
Nenue@70
|
309 configTable.actionID = configTable.actionName
|
Nenue@70
|
310 end
|
Nenue@70
|
311 if not configTable.iconPath then
|
Nenue@70
|
312 print('corrected missing icon')
|
Nenue@70
|
313 configTable.iconPath = GetSpellTexture(configTable.actionName)
|
Nenue@70
|
314 end
|
Nenue@70
|
315
|
Nenue@70
|
316 usedSlots[configTable.actionName or configTable.actionID] = true
|
Nenue@70
|
317 usedSlots[configTable.command] = true
|
Nenue@70
|
318 end
|
Nenue@70
|
319
|
Nenue@70
|
320
|
Nenue@71
|
321 -- clean up legacy data
|
Nenue@70
|
322 for spellName, talentInfo in pairs(profile.talents) do
|
Nenue@70
|
323 if not usedSlots[spellName] then
|
Nenue@70
|
324 cprint('|cFFFF4400Unslotted talent', spellName)
|
Nenue@70
|
325 profile.talents[spellName] = nil
|
Nenue@70
|
326 end
|
Nenue@70
|
327 end
|
Nenue@70
|
328 for command in pairs(profile.bound) do
|
Nenue@70
|
329 if not usedSlots[command] then
|
Nenue@70
|
330 cprint('|cFFFF4400Unslotted bound entry', command)
|
Nenue@70
|
331 profile.bound[command] = nil
|
Nenue@70
|
332 profile.commands[command] = nil
|
Nenue@70
|
333 end
|
Nenue@70
|
334 end
|
Nenue@70
|
335 for command in pairs(profile.commands) do
|
Nenue@70
|
336 if not usedSlots[command] then
|
Nenue@70
|
337 cprint('|cFFFF4400Unslotted command entry', command)
|
Nenue@70
|
338 profile.commands[command] = nil
|
Nenue@70
|
339 end
|
Nenue@70
|
340 end
|
Nenue@76
|
341
|
Nenue@76
|
342 if profile.talents then
|
Nenue@76
|
343 profile.talents = nil
|
Nenue@76
|
344 end
|
Nenue@76
|
345
|
Nenue@76
|
346
|
Nenue@76
|
347 profile.versionID = PROFILE_VERSION
|
Nenue@71
|
348 end
|
Nenue@70
|
349
|
Nenue@71
|
350 kb.ApplyBindings = function (profile)
|
Nenue@71
|
351 cprint('|cFF0088FFApplyBindings()')
|
Nenue@71
|
352 --cprint('binding profile', profile)
|
Nenue@71
|
353
|
Nenue@71
|
354 local version = profile.versionID or 0
|
Nenue@76
|
355 if version < PROFILE_VERSION then
|
Nenue@71
|
356 kb.UpgradeProfile(profile)
|
Nenue@71
|
357 end
|
Nenue@71
|
358
|
Nenue@71
|
359
|
Nenue@71
|
360 -- then buttons
|
Nenue@71
|
361 for slot, configTable in pairs(profile.buttons) do
|
Nenue@71
|
362 -- convert old style table
|
Nenue@71
|
363 if kb.LoadBinding(configTable) then
|
Nenue@76
|
364
|
Nenue@71
|
365 if not configTable.assignedKeys then
|
Nenue@75
|
366 configTable.assignedKeys = {GetBindingKey(configTable.command)}
|
Nenue@71
|
367 end
|
Nenue@75
|
368 --if configTable.dynamicType == 'talent' then
|
Nenue@75
|
369 -- kb:print(table.concat(configTable.assignedKeys, ', ') .. ' bound to '.. configTable.actionName)
|
Nenue@75
|
370 --end
|
Nenue@74
|
371 for _, key in pairs(configTable.assignedKeys) do
|
Nenue@76
|
372 local command = configTable.command
|
Nenue@76
|
373 cprint('|cFF00FFFF'.. key .. '|r to|cFF00FF00', command)
|
Nenue@76
|
374 SetBinding(key, command)
|
Nenue@76
|
375 if commandActions[command] and not tContains(commandActions[command], key) then
|
Nenue@76
|
376 tinsert(commandActions[command], key)
|
Nenue@76
|
377 end
|
Nenue@74
|
378 end
|
Nenue@74
|
379
|
Nenue@71
|
380 end
|
Nenue@71
|
381 end
|
Nenue@70
|
382 end
|
Nenue@70
|
383
|
Nenue@70
|
384 kb.ApplyAllBindings =function ()
|
Nenue@74
|
385 print('|cFFFFFF00ApplyAllBindings()')
|
Nenue@70
|
386 wipe(kb.bindings)
|
Nenue@70
|
387 --kb:print('Loading binding profile', kb.profileName)
|
Nenue@70
|
388
|
Nenue@70
|
389 -- reflect action key settings
|
Nenue@70
|
390 if GetCVarBool("ActionButtonUseKeyDown") then
|
Nenue@70
|
391 SkeletonKeyMacro:RegisterForClicks("AnyDown")
|
Nenue@70
|
392 SkeletonKeyKey:RegisterForClicks("AnyDown")
|
Nenue@70
|
393 else
|
Nenue@70
|
394 SkeletonKeyMacro:RegisterForClicks("AnyUp")
|
Nenue@70
|
395 SkeletonKeyKey:RegisterForClicks("AnyUp")
|
Nenue@70
|
396 end
|
Nenue@70
|
397
|
Nenue@70
|
398 for i, profile in ipairs(kb.orderedProfiles) do
|
Nenue@70
|
399 kb.ApplyBindings(profile)
|
Nenue@70
|
400 end
|
Nenue@70
|
401 -- do this after to ensure that profession binds are properly overridden
|
Nenue@70
|
402 kb.UpdateProfessionInfo()
|
Nenue@70
|
403
|
Nenue@70
|
404 SaveBindings(GetCurrentBindingSet())
|
Nenue@72
|
405
|
Nenue@75
|
406
|
Nenue@70
|
407 end
|
Nenue@70
|
408 end
|
Nenue@70
|
409
|
Nenue@70
|
410
|
Nenue@78
|
411 local AddSpellInfo = function(id, name, icon, dynamicType, dynamicID, dynamicIndex, dynamicSubIndex, isAvailable)
|
Nenue@78
|
412 local spell = kb.DynamicSpells[id] or {}
|
Nenue@78
|
413 spell.actionName = name
|
Nenue@78
|
414 spell.dynamicType = dynamicType
|
Nenue@78
|
415 spell.dynamicID = dynamicID
|
Nenue@78
|
416 spell.iconPath = icon
|
Nenue@78
|
417 spell.dynamicIndex = dynamicIndex
|
Nenue@78
|
418 spell.dynamicSubIndex = dynamicSubIndex
|
Nenue@78
|
419 spell.isAvailable = isAvailable
|
Nenue@78
|
420 spell.actionType = 'spell'
|
Nenue@78
|
421 spell.spellbookType = BOOKTYPE_SPELL
|
Nenue@78
|
422 kb.DynamicSpells[name] = spell
|
Nenue@78
|
423
|
Nenue@78
|
424 local spellList = dynamicType and kb.DynamicSpells[dynamicType]
|
Nenue@78
|
425 if spellList then
|
Nenue@78
|
426 spellList[dynamicIndex] = spellList[dynamicIndex] or {}
|
Nenue@78
|
427 spellList[dynamicIndex][dynamicSubIndex] = spell
|
Nenue@78
|
428 end
|
Nenue@78
|
429
|
Nenue@78
|
430 cprint('|cFF00FFFFSpellInfo:|r', name, isAvailable, dynamicType or 'spell')
|
Nenue@78
|
431 end
|
Nenue@78
|
432
|
Nenue@70
|
433 kb.UpdateSpecInfo = function()
|
Nenue@70
|
434 kb.specInfo.id = GetSpecialization()
|
Nenue@70
|
435 kb.specInfo.globalID, kb.specInfo.name, kb.specInfo.desc, kb.specInfo.texture = GetSpecializationInfo(kb.specInfo.id)
|
Nenue@70
|
436 end
|
Nenue@70
|
437
|
Nenue@70
|
438 kb.UpdateMacroInfo = function()
|
Nenue@70
|
439 print('|cFFFFFF00kb.UpdateMacroInfo()|r')
|
Nenue@70
|
440 for index = 1, GetNumMacros() do
|
Nenue@70
|
441 local name = GetMacroInfo(index)
|
Nenue@70
|
442 kb.SecureAttribute(SkeletonKeyMacro, "*type-macro_"..tostring(name), 'macro')
|
Nenue@70
|
443 kb.SecureAttribute(SkeletonKeyMacro, "*macro-macro_"..tostring(name), index)
|
Nenue@70
|
444 end
|
Nenue@70
|
445 end
|
Nenue@70
|
446
|
Nenue@78
|
447
|
Nenue@70
|
448 kb.UpdateTalentInfo = function()
|
Nenue@78
|
449 print('|cFFFFFF00kb.UpdateSpells()|r')
|
Nenue@78
|
450 cprint('|cFFFFFF00kb.UpdateSpells()|r')
|
Nenue@70
|
451 if kb.talentsPushed then
|
Nenue@70
|
452 return
|
Nenue@70
|
453 end
|
Nenue@70
|
454 for row =1, MAX_TALENT_TIERS do
|
Nenue@70
|
455 for col = 1, NUM_TALENT_COLUMNS do
|
Nenue@70
|
456 local talentID, talentName, icon, selected, available, spellID = GetTalentInfo(row, col, 1)
|
Nenue@78
|
457 local talentInfo = kb.DynamicSpells[spellID] or {}
|
Nenue@70
|
458 if spellID then
|
Nenue@78
|
459 AddSpellInfo(spellID, talentName, icon, 'talent', talentID, row, col, selected)
|
Nenue@70
|
460 end
|
Nenue@70
|
461
|
Nenue@70
|
462 end
|
Nenue@70
|
463 end
|
Nenue@70
|
464
|
Nenue@70
|
465 for row = 1, MAX_PVP_TALENT_TIERS do
|
Nenue@70
|
466 for col = 1, MAX_PVP_TALENT_COLUMNS do
|
Nenue@78
|
467 local talentID, talentName, icon, selected, available, spellID, unlocked = GetPvpTalentInfo(row, col, 1)
|
Nenue@70
|
468 if spellID then
|
Nenue@78
|
469 AddSpellInfo(spellID, talentName, icon, 'talent', talentID, row, col, selected)
|
Nenue@70
|
470 end
|
Nenue@70
|
471 end
|
Nenue@70
|
472 end
|
Nenue@70
|
473
|
Nenue@78
|
474 local numTabs = GetNumSpellTabs()
|
Nenue@78
|
475 for i = 1, numTabs do
|
Nenue@78
|
476 local name, texture, offset, numSpells = GetSpellTabInfo(i)
|
Nenue@78
|
477 for spellLine = offset+1, offset+numSpells do
|
Nenue@78
|
478 local skillType, spellID = GetSpellBookItemInfo(spellLine)
|
Nenue@78
|
479 if skillType == 'SPELL' then
|
Nenue@78
|
480 local name, _, icon = GetSpellInfo(spellID)
|
Nenue@78
|
481 AddSpellInfo(spellID, name, icon, nil, nil, nil, nil, true)
|
Nenue@78
|
482 elseif skillType == 'FLYOUT' then
|
Nenue@78
|
483 local flyoutID = GetFlyoutID(spellLine)
|
Nenue@78
|
484 local _, _, numSlots = GetFlyoutInfo(flyoutID)
|
Nenue@78
|
485 if numSlots then
|
Nenue@78
|
486 for slot = 1, numSlots do
|
Nenue@78
|
487 local spellID, isKnown = GetFlyoutSlotInfo(flyoutID, slot)
|
Nenue@78
|
488 local name, rank, icon = GetSpellInfo(spellID)
|
Nenue@78
|
489 AddSpellInfo(spellID, name, icon, nil, nil, nil, nil, true)
|
Nenue@78
|
490 end
|
Nenue@78
|
491 end
|
Nenue@78
|
492 end
|
Nenue@78
|
493 end
|
Nenue@78
|
494 end
|
Nenue@78
|
495
|
Nenue@78
|
496
|
Nenue@78
|
497
|
Nenue@70
|
498 kb.talentsPushed = true
|
Nenue@70
|
499 kb.UpdateDynamicButtons('talent')
|
Nenue@70
|
500 end
|
Nenue@78
|
501 kb.UpdateSpells = kb.UpdateTalentInfo
|
Nenue@70
|
502
|
Nenue@70
|
503 kb.UpdateProfessionInfo = function()
|
Nenue@70
|
504 wipe(kb.ProfessionCache)
|
Nenue@70
|
505 local profs = {GetProfessions() }
|
Nenue@70
|
506 --print(GetProfessions())
|
Nenue@70
|
507 local primaryNum = 0
|
Nenue@70
|
508 for i = 1, 6 do
|
Nenue@70
|
509 if profs[i] then
|
Nenue@70
|
510 local profID = profs[i]
|
Nenue@70
|
511 local profName, texture, _, _, numSpells, spellOffset = GetProfessionInfo(profID)
|
Nenue@70
|
512 cprint(i, profID, profName, numSpells, spellOffset)
|
Nenue@70
|
513 if not SECONDARY_PROFESSIONS[profID] then
|
Nenue@70
|
514 primaryNum = primaryNum + 1
|
Nenue@70
|
515 end
|
Nenue@70
|
516 local profNum = SECONDARY_PROFESSIONS[profID] or primaryNum
|
Nenue@70
|
517 cprint(i, profNum)
|
Nenue@70
|
518
|
Nenue@70
|
519
|
Nenue@70
|
520 for j = 1, numSpells do
|
Nenue@70
|
521 local spellName, _, icon, _, _, _, spellID = GetSpellInfo(spellOffset+j, BOOKTYPE_PROFESSION)
|
Nenue@70
|
522 cprint(j, spellName)
|
Nenue@70
|
523 local profInfo = {
|
Nenue@70
|
524 actionType = 'spell',
|
Nenue@70
|
525 actionName = spellName,
|
Nenue@70
|
526 actionID = spellID,
|
Nenue@70
|
527 iconPath = icon,
|
Nenue@70
|
528 dynamicIndex = i,
|
Nenue@70
|
529 dynamicSubIndex = j,
|
Nenue@70
|
530 dynamicType = 'profession',
|
Nenue@70
|
531 spellbookOffset = (spellOffset+j),
|
Nenue@70
|
532 spellbookType = BOOKTYPE_PROFESSION,
|
Nenue@70
|
533 isAvailable = true,
|
Nenue@78
|
534 dynamicID = profID,
|
Nenue@70
|
535 }
|
Nenue@70
|
536
|
Nenue@70
|
537 kb.SecureAttribute(SkeletonKeyKey, "*type-profession_"..i .. '_' ..j, "spell")
|
Nenue@70
|
538 kb.SecureAttribute(SkeletonKeyKey, "*spell-profession_"..i .. '_' ..j, spellName)
|
Nenue@70
|
539
|
Nenue@70
|
540
|
Nenue@70
|
541 kb.DynamicSpells[spellName] = profInfo
|
Nenue@70
|
542 kb.DynamicSpells[spellID] = profInfo
|
Nenue@70
|
543
|
Nenue@78
|
544 kb.DynamicSpells.profession[spellName] = profInfo
|
Nenue@78
|
545 kb.DynamicSpells.profession[spellID] = profInfo
|
Nenue@70
|
546 kb.DynamicSpells.profession[i] = kb.DynamicSpells.profession[i] or {}
|
Nenue@70
|
547 kb.DynamicSpells.profession[i][j] = profInfo
|
Nenue@70
|
548 --print(' |cFF0088FF['..i..']|r|cFFFF44BB['..spellOffset+i..']|r', spellName, "profession_"..i .. '_' ..j)
|
Nenue@70
|
549 end
|
Nenue@70
|
550 end
|
Nenue@70
|
551
|
Nenue@70
|
552 end
|
Nenue@70
|
553
|
Nenue@70
|
554 kb.UpdateDynamicButtons('profession')
|
Nenue@70
|
555 end
|
Nenue@70
|
556
|
Nenue@70
|
557
|
Nenue@70
|
558
|
Nenue@70
|
559 kb.UpdatePetInfo = function()
|
Nenue@70
|
560 local hasPetSpells, petType = HasPetSpells()
|
Nenue@70
|
561
|
Nenue@70
|
562 -- reconcile saved data if it becomes available
|
Nenue@70
|
563 if kb.db then
|
Nenue@70
|
564 kb.db.petSpellsDB = kb.db.petSpellsDB or {}
|
Nenue@70
|
565 kb.db.petSpellsDB.subtext = kb.db.petSpellsDB.subtext or {}
|
Nenue@70
|
566 kb.db.petSpellsDB.spell = kb.db.petSpellsDB.spell or {}
|
Nenue@70
|
567 local spellCache = kb.db.petSpellsDB.spell
|
Nenue@70
|
568 local subtextCache = kb.db.petSpellsDB.subtext
|
Nenue@70
|
569 if petSpellCache then
|
Nenue@70
|
570 for k,v in pairs(petSpellCache) do
|
Nenue@70
|
571 if not spellCache[k] then
|
Nenue@70
|
572 spellCache[k] = v
|
Nenue@70
|
573 end
|
Nenue@70
|
574 end
|
Nenue@70
|
575 end
|
Nenue@70
|
576 petSpellCache = spellCache
|
Nenue@70
|
577 if petSubtextCache then
|
Nenue@70
|
578 for k,v in pairs(petSubtextCache) do
|
Nenue@70
|
579 if not subtextCache[k] then
|
Nenue@70
|
580 subtextCache[k] = v
|
Nenue@70
|
581 end
|
Nenue@70
|
582 end
|
Nenue@70
|
583 end
|
Nenue@70
|
584 petSubtextCache = subtextCache
|
Nenue@70
|
585 else
|
Nenue@70
|
586 petSpellCache = {}
|
Nenue@70
|
587 petSubtextCache = {}
|
Nenue@70
|
588 end
|
Nenue@70
|
589
|
Nenue@70
|
590 if PetHasSpellbook() then
|
Nenue@70
|
591 --print('PET SPELLBOOK')
|
Nenue@70
|
592 local spellbookOffset = 1
|
Nenue@70
|
593 local specialNum = {}
|
Nenue@70
|
594 local newSubtextItems = false
|
Nenue@70
|
595
|
Nenue@70
|
596 repeat
|
Nenue@70
|
597
|
Nenue@70
|
598 local spellType, spellID = GetSpellBookItemInfo(spellbookOffset, BOOKTYPE_PET)
|
Nenue@70
|
599 local spellName, subText = GetSpellBookItemName(spellbookOffset, BOOKTYPE_PET)
|
Nenue@70
|
600 local texture = GetSpellBookItemTexture(spellbookOffset, BOOKTYPE_PET)
|
Nenue@70
|
601 if (spellType == 'SPELL') and (not IsPassiveSpell(spellbookOffset, BOOKTYPE_PET)) then
|
Nenue@70
|
602 local info = kb.PetCache[spellName] or {}
|
Nenue@70
|
603 kb.PetCache.spellslot[spellName] = {spellbookOffset, spellName, subText, spellID, texture}
|
Nenue@70
|
604 --print('|cFF00FF88spellslot['..spellName..']|r', '=>', i, subText)
|
Nenue@70
|
605
|
Nenue@70
|
606 if subText then
|
Nenue@70
|
607 kb.PetCache.subtext[subText] = kb.PetCache.subtext[subText] or {}
|
Nenue@70
|
608 specialNum[subText] = (specialNum[subText] or 0) + 1
|
Nenue@70
|
609
|
Nenue@70
|
610 petSpellCache[spellName] = subText
|
Nenue@70
|
611 petSubtextCache[subText] = petSubtextCache[subText] or {}
|
Nenue@70
|
612
|
Nenue@70
|
613 -- add to the list
|
Nenue@70
|
614 if not petSubtextCache[subText][spellName] then
|
Nenue@70
|
615 petSubtextCache[subText][spellName] = true
|
Nenue@70
|
616 newSubtextItems = true
|
Nenue@70
|
617 --print('|cFF00FFFFspecial['..spellName..']|r', '\n','|cFF00FFFFsubtext['..subText..']['..specialNum[subText]..']|r', '=>', i, spellName, subText, spellID, texture, specialNum[subText])
|
Nenue@70
|
618 end
|
Nenue@70
|
619
|
Nenue@70
|
620
|
Nenue@70
|
621
|
Nenue@70
|
622 local entry = {spellbookOffset, spellName, subText, spellID, texture, specialNum[subText] }
|
Nenue@70
|
623
|
Nenue@70
|
624
|
Nenue@70
|
625 info.spellbookOffset = spellbookOffset
|
Nenue@70
|
626 info.spellbookType = BOOKTYPE_PET
|
Nenue@70
|
627 info.actionName = spellName
|
Nenue@70
|
628 info.spellID = spellID
|
Nenue@70
|
629 info.dynamicType = 'petaction'
|
Nenue@70
|
630 info.dynamicID = spellID
|
Nenue@70
|
631 info.dynamicIndex = subText
|
Nenue@70
|
632 info.dynamicSubIndex = specialNum[subText]
|
Nenue@70
|
633 info.isAvailable = true
|
Nenue@70
|
634
|
Nenue@70
|
635 kb.PetCache.special[spellName] = info
|
Nenue@70
|
636 kb.PetCache.subtext[subText][specialNum[subText]] = info
|
Nenue@78
|
637
|
Nenue@70
|
638 kb.DynamicSpells[spellName] = info
|
Nenue@70
|
639 kb.DynamicSpells[spellID] = info
|
Nenue@70
|
640
|
Nenue@70
|
641 end
|
Nenue@70
|
642
|
Nenue@70
|
643 if spellID then
|
Nenue@70
|
644 kb.PetCache.spell[spellbookOffset] = {spellID, spellName, subText}
|
Nenue@70
|
645 --print('|cFF0088FFspell['..i..']|r', '=>', spellID, spellName, subText)
|
Nenue@70
|
646 end
|
Nenue@70
|
647
|
Nenue@70
|
648 kb.PetCache[spellName] = info
|
Nenue@70
|
649 end
|
Nenue@70
|
650
|
Nenue@70
|
651 spellbookOffset = spellbookOffset + 1
|
Nenue@70
|
652 until spellType == nil
|
Nenue@70
|
653
|
Nenue@70
|
654 if newSubtextItems then
|
Nenue@70
|
655
|
Nenue@70
|
656 local macrotext = ""
|
Nenue@70
|
657 for subText, spells in pairs(petSubtextCache) do
|
Nenue@70
|
658 if specialNum[subText] then
|
Nenue@70
|
659 for spellName, enabled in pairs(spells) do
|
Nenue@70
|
660 macrotext = macrotext .. "/cast " .. spellName .. "\n"
|
Nenue@70
|
661 end
|
Nenue@70
|
662 kb.SecureAttribute(SkeletonKeyMacro, "*macrotext-petaction_"..subText.."_"..specialNum[subText], macrotext)
|
Nenue@70
|
663 end
|
Nenue@70
|
664 end
|
Nenue@70
|
665 end
|
Nenue@70
|
666
|
Nenue@70
|
667
|
Nenue@70
|
668 else
|
Nenue@70
|
669 --print('NO PET SPELLBOOK')
|
Nenue@70
|
670 wipe(kb.PetCache.spell)
|
Nenue@70
|
671 wipe(kb.PetCache.spellslot)
|
Nenue@70
|
672 end
|
Nenue@70
|
673
|
Nenue@70
|
674 if PetHasActionBar() then
|
Nenue@70
|
675 --print('PET ACTION BAR')
|
Nenue@70
|
676 for i = 1, 10 do
|
Nenue@70
|
677
|
Nenue@70
|
678
|
Nenue@70
|
679 local name, subtext, texture, isToken, isActive = GetPetActionInfo(i)
|
Nenue@70
|
680 if name then
|
Nenue@70
|
681 kb.PetCache.action[i] = {name, subtext, texture, isToken, isActive }
|
Nenue@70
|
682
|
Nenue@70
|
683
|
Nenue@70
|
684 end
|
Nenue@70
|
685 --print('|cFFFFFF00action['..i..']|r', name, subtext, texture)
|
Nenue@70
|
686 end
|
Nenue@70
|
687 else
|
Nenue@70
|
688 --print('NO PET ACTION BAR')
|
Nenue@70
|
689 wipe(kb.PetCache.action)
|
Nenue@70
|
690 end
|
Nenue@70
|
691
|
Nenue@70
|
692 kb.UpdateDynamicButtons('petaction')
|
Nenue@70
|
693
|
Nenue@70
|
694 end
|
Nenue@70
|
695
|
Nenue@70
|
696 kb.UpdateSystemBinds = function()
|
Nenue@70
|
697 wipe(kb.SystemBindings)
|
Nenue@70
|
698 local n = GetNumBindings()
|
Nenue@70
|
699 for i=1, n do
|
Nenue@70
|
700 local command, key1, key2 = GetBinding(i)
|
Nenue@70
|
701 if not command:match('ACTION.*%d+') then
|
Nenue@70
|
702 if key1 then
|
Nenue@70
|
703 kb.SystemBindings[key1] = command
|
Nenue@70
|
704 end
|
Nenue@70
|
705 if key2 then
|
Nenue@70
|
706 kb.SystemBindings[key2] = command
|
Nenue@70
|
707 end
|
Nenue@70
|
708 else
|
Nenue@70
|
709 --print('ignoring action button binding', command)
|
Nenue@70
|
710 end
|
Nenue@70
|
711 end
|
Nenue@70
|
712 end
|
Nenue@70
|
713
|
Nenue@70
|
714 kb.UpdateDynamicButtons = function(dynamicType)
|
Nenue@70
|
715 for i, button in ipairs(kb.buttons) do
|
Nenue@70
|
716 if button.isDynamic == dynamicType then
|
Nenue@70
|
717 kb.UpdateSlot(button, true)
|
Nenue@70
|
718 end
|
Nenue@70
|
719 end
|
Nenue@70
|
720 end
|
Nenue@70
|
721
|
Nenue@70
|
722 kb.pendingAttributes = {}
|
Nenue@70
|
723 kb.SecureAttribute = function(target, name, value)
|
Nenue@70
|
724 if InCombatLockdown() then
|
Nenue@70
|
725 if #kb.pendingAttributes == 0 then
|
Nenue@70
|
726 kb:print(kb.L('Key bindings will be applied when you exit combat.'))
|
Nenue@70
|
727 end
|
Nenue@70
|
728 tinsert(kb.pendingAttributes, {target, name, value})
|
Nenue@70
|
729 SkeletonKey:RegisterEvent('PLAYER_REGEN_ENABLED')
|
Nenue@70
|
730 else
|
Nenue@70
|
731 --cprint('|cFFFF4444' .. target:GetName()..'|r.|cFFFFFF00'.. tostring(name)..'|r = "'..tostring(value)..'"')
|
Nenue@70
|
732 target:SetAttribute(name, value)
|
Nenue@70
|
733 end
|
Nenue@70
|
734 end
|
Nenue@70
|
735
|
Nenue@70
|
736 kb.PLAYER_REGEN_ENABLED = function()
|
Nenue@70
|
737 if #kb.pendingAttributes >= 1 then
|
Nenue@70
|
738 local args = tremove(kb.pendingAttributes)
|
Nenue@70
|
739 while args do
|
Nenue@70
|
740 local target, name, value = unpack(args)
|
Nenue@70
|
741 --print(target:GetName(), 'attribute', '"'.. tostring(name)..'" = "'..tostring(value)..'"')
|
Nenue@70
|
742 cprint('deferred', target:GetName(), 'attribute', '"'.. tostring(name)..'" = "'..tostring(value)..'"')
|
Nenue@70
|
743 target:SetAttribute(name, value)
|
Nenue@70
|
744 args = tremove(kb.pendingAttributes)
|
Nenue@70
|
745 end
|
Nenue@70
|
746 end
|
Nenue@70
|
747
|
Nenue@70
|
748 if #kb.pendingCalls >= 1 then
|
Nenue@70
|
749
|
Nenue@70
|
750 local func = tremove(kb.pendingCalls)
|
Nenue@70
|
751 while func do
|
Nenue@70
|
752 func()
|
Nenue@70
|
753 end
|
Nenue@70
|
754 end
|
Nenue@70
|
755 end
|
Nenue@70
|
756
|
Nenue@70
|
757 kb.UpdateBindingsCache = function(actionType, actionID, bindings)
|
Nenue@70
|
758 local indexKey = actionType .. '_' .. actionID
|
Nenue@70
|
759 kb.bindings[indexKey] = bindings
|
Nenue@70
|
760
|
Nenue@70
|
761 cprint('|cFF00FF00'..indexKey..'|r = {'.. table.concat(bindings,', ').. '}')
|
Nenue@70
|
762 tinsert(kb.ChangedBindings, {actionType, actionID})
|
Nenue@70
|
763 end |