Mercurial > wow > skeletonkey
comparison SkeletonKey/ActionTemplates.lua @ 30:b0e4d04d428a
- use a fixed loop to parse GetProfessions() result so unlearned secondaries don't break the cache
- removed a bad varaible reference that was causing confirmation popup to barf
author | Nenue |
---|---|
date | Fri, 05 Aug 2016 19:41:18 -0400 |
parents | 73df13211b22 |
children | daff39af0c6d |
comparison
equal
deleted
inserted
replaced
29:bb160c04de88 | 30:b0e4d04d428a |
---|---|
252 end | 252 end |
253 | 253 |
254 kb.UpdateProfessionInfo = function() | 254 kb.UpdateProfessionInfo = function() |
255 wipe(kb.ProfessionCache) | 255 wipe(kb.ProfessionCache) |
256 local profs = {GetProfessions() } | 256 local profs = {GetProfessions() } |
257 print(GetProfessions()) | |
257 local primaryNum = 0 | 258 local primaryNum = 0 |
258 for i, index in ipairs(profs) do | 259 for i = 1, 6 do |
259 local profName, texture, rank, maxRank, numSpells, spellOffset = GetProfessionInfo(index) | 260 if profs[i] then |
260 print(i, index, profName, numSpells, spellOffset) | 261 local index = profs[i] |
261 if not SECONDARY_PROFESSIONS[index] then | 262 local profName, texture, _, _, numSpells, spellOffset = GetProfessionInfo(index) |
262 primaryNum = primaryNum + 1 | 263 print(i, index, profName, numSpells, spellOffset) |
263 end | 264 if not SECONDARY_PROFESSIONS[index] then |
264 local profNum = SECONDARY_PROFESSIONS[index] or primaryNum | 265 primaryNum = primaryNum + 1 |
265 | 266 end |
266 | 267 local profNum = SECONDARY_PROFESSIONS[index] or primaryNum |
267 kb.ProfessionCache[profNum] = kb.ProfessionCache[i] or {} | 268 print(i, profNum) |
268 | 269 |
269 for j = 1, numSpells do | 270 |
270 local spellName, _, icon, _, _, _, spellID = GetSpellInfo(spellOffset+j, BOOKTYPE_PROFESSION) | 271 kb.ProfessionCache[profNum] = kb.ProfessionCache[profNum] or {} |
271 | 272 |
272 local profInfo = { | 273 for j = 1, numSpells do |
273 spellName = spellName, | 274 local spellName, _, icon, _, _, _, spellID = GetSpellInfo(spellOffset+j, BOOKTYPE_PROFESSION) |
274 spellID = spellID, | 275 |
275 icon = icon, | 276 local profInfo = { |
276 profOffset = i, | 277 spellName = spellName, |
277 profIndex = index, | 278 spellID = spellID, |
278 spellOffset = (spellOffset+j), | 279 icon = icon, |
279 spellNum = j | 280 profOffset = i, |
280 } | 281 profIndex = index, |
281 | 282 spellOffset = (spellOffset+j), |
282 kb.SecureAttribute(KeyBinderKey, "*type-profession_"..i .. '_' ..j, "spell") | 283 spellNum = j |
283 kb.SecureAttribute(KeyBinderKey, "*spell-profession_"..i .. '_' ..j, spellName) | 284 } |
284 | 285 |
285 kb.ProfessionCache[i .. '_' .. j] = profInfo | 286 kb.SecureAttribute(KeyBinderKey, "*type-profession_"..i .. '_' ..j, "spell") |
286 kb.ProfessionCache[spellName] = profInfo | 287 kb.SecureAttribute(KeyBinderKey, "*spell-profession_"..i .. '_' ..j, spellName) |
287 kb.ProfessionCache[spellID] = profInfo | 288 |
288 print(' |cFF0088FF['..i..']|r|cFFFF44BB['..spellOffset+i..']|r', spellName, "profession_"..i .. '_' ..j) | 289 kb.ProfessionCache[i .. '_' .. j] = profInfo |
290 kb.ProfessionCache[spellName] = profInfo | |
291 kb.ProfessionCache[spellID] = profInfo | |
292 print(' |cFF0088FF['..i..']|r|cFFFF44BB['..spellOffset+i..']|r', spellName, "profession_"..i .. '_' ..j) | |
293 end | |
289 end | 294 end |
290 | 295 |
291 end | 296 end |
292 | 297 |
293 kb.UpdateDynamicButtons('profession') | 298 kb.UpdateDynamicButtons('profession') |