@@ -16,7 +16,7 @@ local MYSLOT_VER = 42
16
16
-- TWW Beta Compat code (fix and cleanup below later)
17
17
local GetNumSpellTabs = C_SpellBook and C_SpellBook .GetNumSpellBookSkillLines or _G .GetNumSpellTabs
18
18
local GetSpellTabInfo = (C_SpellBook and C_SpellBook .GetSpellBookSkillLineInfo ) and function (index )
19
- local skillLineInfo = C_SpellBook .GetSpellBookSkillLineInfo (index );
19
+ local skillLineInfo = C_SpellBook .GetSpellBookSkillLineInfo (index )
20
20
if skillLineInfo then
21
21
return skillLineInfo .name ,
22
22
skillLineInfo .iconID ,
@@ -25,7 +25,7 @@ local GetSpellTabInfo = (C_SpellBook and C_SpellBook.GetSpellBookSkillLineInfo)
25
25
skillLineInfo .isGuild ,
26
26
skillLineInfo .offSpecID ,
27
27
skillLineInfo .shouldHide ,
28
- skillLineInfo .specID ;
28
+ skillLineInfo .specID
29
29
end
30
30
end or _G .GetSpellTabInfo
31
31
local PickupSpell = C_Spell and C_Spell .PickupSpell or _G .PickupSpell
@@ -107,6 +107,60 @@ local function TableToString(s)
107
107
return table.concat (t )
108
108
end
109
109
110
+ local function CreateSpellOverrideMap ()
111
+ local spellOverride = {}
112
+
113
+ if C_SpellBook and C_SpellBook .GetNumSpellBookSkillLines then
114
+ -- 11.0
115
+
116
+ for skillLineIndex = 1 , C_SpellBook .GetNumSpellBookSkillLines () do
117
+ local skillLineInfo = C_SpellBook .GetSpellBookSkillLineInfo (skillLineIndex )
118
+ for i = 1 , skillLineInfo .numSpellBookItems do
119
+ local spellIndex = skillLineInfo .itemIndexOffset + i
120
+ local _ , spellId = C_SpellBook .GetSpellBookItemType (spellIndex , Enum .SpellBookSpellBank .Player )
121
+ if spellId then
122
+ local newid = C_Spell .GetOverrideSpell (spellId )
123
+ if newid ~= spellId then
124
+ spellOverride [newid ] = spellId
125
+ end
126
+ end
127
+ end
128
+ end
129
+
130
+ local isInspect = false
131
+ for specIndex = 1 , GetNumSpecGroups (isInspect ) do
132
+ for tier = 1 , MAX_TALENT_TIERS do
133
+ for column = 1 , NUM_TALENT_COLUMNS do
134
+ local spellId = select (6 , GetTalentInfo (tier , column , specIndex ))
135
+ if spellId then
136
+ local newid = C_Spell .GetOverrideSpell (spellId )
137
+ if newid ~= spellId then
138
+ spellOverride [newid ] = spellId
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
144
+
145
+ for pvpTalentSlot = 1 , 3 do
146
+ local slotInfo = C_SpecializationInfo .GetPvpTalentSlotInfo (pvpTalentSlot )
147
+ if slotInfo ~= nil then
148
+ for i , pvpTalentID in ipairs (slotInfo .availableTalentIDs ) do
149
+ local spellId = select (6 , GetPvpTalentInfoByID (pvpTalentID ))
150
+ if spellId then
151
+ local newid = C_Spell .GetOverrideSpell (spellId )
152
+ if newid ~= spellId then
153
+ spellOverride [newid ] = spellId
154
+ end
155
+ end
156
+ end
157
+ end
158
+ end
159
+ end
160
+
161
+ return spellOverride
162
+ end
163
+
110
164
function MySlot :Print (msg )
111
165
DEFAULT_CHAT_FRAME :AddMessage (" |CFFFF0000<|r|CFFFFD100Myslot|r|CFFFF0000>|r" .. (msg or " nil" ))
112
166
end
@@ -121,7 +175,7 @@ function MySlot:GetMacroInfo(macroId)
121
175
return nil
122
176
end
123
177
124
- iconTexture = gsub (strupper (iconTexture or " INV_Misc_QuestionMark" ), " INTERFACE\\ ICONS\\ " , " " );
178
+ iconTexture = gsub (strupper (iconTexture or " INV_Misc_QuestionMark" ), " INTERFACE\\ ICONS\\ " , " " )
125
179
126
180
local msg = _MySlot .Macro ()
127
181
msg .id = macroId
@@ -322,10 +376,18 @@ function MySlot:Export(opt)
322
376
end
323
377
324
378
msg .slot = {}
379
+ -- TODO move to GetActionInfo
380
+ local spellOverride = CreateSpellOverrideMap ()
381
+
325
382
for i = 1 , MYSLOT_MAX_ACTIONBAR do
326
383
if not opt .ignoreActionBars [math.ceil (i / 12 )] then
327
384
local m = self :GetActionInfo (i )
328
385
if m then
386
+ if m .type == ' SPELL' then
387
+ if spellOverride [m .index ] then
388
+ m .index = spellOverride [m .index ]
389
+ end
390
+ end
329
391
msg .slot [# msg .slot + 1 ] = m
330
392
end
331
393
end
@@ -524,22 +586,25 @@ function MySlot:FindOrCreateMacro(macroInfo)
524
586
end
525
587
-- }}}
526
588
589
+
590
+
527
591
function MySlot :RecoverData (msg , opt )
528
592
-- {{{ Cache Spells
529
593
-- cache spells
530
594
local spells = {}
531
595
596
+ -- TODO clean up this with 11.0
532
597
if SPELLS_PER_PAGE then
533
598
for i = 1 , GetNumSpellTabs () do
534
- local tab , tabTex , offset , numSpells , isGuild , offSpecID = GetSpellTabInfo (i );
599
+ local tab , tabTex , offset , numSpells , isGuild , offSpecID = GetSpellTabInfo (i )
535
600
offSpecID = (offSpecID ~= 0 )
536
601
if not offSpecID then
537
- offset = offset + 1 ;
538
- local tabEnd = offset + numSpells ;
602
+ offset = offset + 1
603
+ local tabEnd = offset + numSpells
539
604
for j = offset , tabEnd - 1 do
540
605
local spellType , spellId = GetSpellBookItemInfo (j , BOOKTYPE_SPELL )
541
606
if spellType then
542
- local slot = j + (SPELLS_PER_PAGE * (SPELLBOOK_PAGENUMBERS [i ] - 1 ));
607
+ local slot = j + (SPELLS_PER_PAGE * (SPELLBOOK_PAGENUMBERS [i ] - 1 ))
543
608
local spellName = GetSpellInfo (spellId )
544
609
spells [MySlot .SLOT_TYPE [string.lower (spellType )] .. " _" .. spellId ] = { slot , BOOKTYPE_SPELL , " spell" }
545
610
if spellName then -- flyout
@@ -567,6 +632,8 @@ function MySlot:RecoverData(msg, opt)
567
632
end
568
633
end
569
634
end
635
+
636
+ local spellOverride = CreateSpellOverrideMap ()
570
637
-- }}}
571
638
572
639
@@ -661,6 +728,17 @@ function MySlot:RecoverData(msg, opt)
661
728
PickupSpell (index )
662
729
end
663
730
731
+ if not GetCursorInfo () then
732
+ if spellOverride [index ] then
733
+ PickupSpell (spellOverride [index ])
734
+ end
735
+ end
736
+
737
+ if not GetCursorInfo () then
738
+ local spellName = GetSpellInfo (index )
739
+ PickupSpell (spellName )
740
+ end
741
+
664
742
if not GetCursorInfo () then
665
743
-- flyout and failover
666
744
@@ -765,7 +843,7 @@ function MySlot:RecoverData(msg, opt)
765
843
if not opt .actionOpt .ignorePetActionBar then
766
844
local pettoken = {}
767
845
for i = 1 , NUM_PET_ACTION_SLOTS , 1 do
768
- local name , _ , isToken = GetPetActionInfo (i );
846
+ local name , _ , isToken = GetPetActionInfo (i )
769
847
if isToken then
770
848
pettoken [name ] = i
771
849
end
0 commit comments