Skip to content

Commit 58c7cc2

Browse files
committed
fix paladin auras
- When training a new aura rank, it totally replaces the old spell
1 parent 4bb5573 commit 58c7cc2

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

.luacheckrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ read_globals = {
3636
"FONT_COLOR_CODE_CLOSE",
3737
"HIGHLIGHT_FONT_COLOR_CODE",
3838
"PARENS_TEMPLATE",
39-
"MAX_SKILLLINE_TABS"
39+
"MAX_SKILLLINE_TABS",
40+
41+
"HookCTPUpdate"
4042
}
4143
globals = {"ClassTrainerPlusDBPC", "CTP_UpdateService", "WhatsTrainingFrame"}

Classes/Paladin.lua

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
local _, wt = ...
22
if (wt.currentClass ~= "PALADIN") then return end
3+
4+
-- Paladin Auras are special in that you never have multiple ranks in the spellbook, only the latest one
5+
-- Even so, IsSpellKnown will only return true for your current rank
6+
7+
-- These tables are ordered by rank
8+
local devotionAura = {465, 10290, 643, 10291, 1032, 10292, 10293}
9+
local retAura = {7294, 10298, 10299, 10300, 10301}
10+
local fireResAura = {19891, 19899, 19900}
11+
local frostResAura = {19888, 19897, 19898}
12+
local shadowResAura = {19876, 19895, 19896}
13+
14+
local auraMap = {}
15+
for _, auras in ipairs({devotionAura, retAura, fireResAura, frostResAura, shadowResAura}) do
16+
for _, auraId in ipairs(auras) do
17+
auraMap[auraId] = auras
18+
end
19+
end
20+
function wt.IsPreviouslyLearnedAura(spellId)
21+
print(spellId)
22+
if (not auraMap[spellId]) then return false end
23+
local spellIndex, knownIndex = 0, 0
24+
for i, otherId in ipairs(auraMap[spellId]) do
25+
if (otherId == spellId) then spellIndex = i end
26+
if (IsSpellKnown(otherId)) then knownIndex = i end
27+
end
28+
print(spellId, spellIndex, knownIndex)
29+
return spellIndex <= knownIndex
30+
end
31+
332
wt.SpellsByLevel = {
433
[1] = {{id = 465, cost = 10}},
534
[4] = {{id = 19740, cost = 100}, {id = 20271, cost = 100}},

WhatsTraining.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ local function rebuildSpells(playerLevel, isLevelUpEvent)
165165
categoryKey = MISSINGTALENT_KEY
166166
elseif (level > playerLevel) then
167167
categoryKey = level <= playerLevel + 2 and NEXTLEVEL_KEY or NOTLEVEL_KEY
168+
elseif (wt.IsPreviouslyLearnedAura and wt.IsPreviouslyLearnedAura(spellInfo.id)) then
169+
-- special case for paladin auras, since new ranks totally replace old ranks
170+
categoryKey = KNOWN_KEY
168171
else
169172
local hasReqs = true
170173
if (spell.requiredIds ~= nil) then
@@ -457,9 +460,11 @@ end
457460

458461
local function hookCTP()
459462
wt.ctpDb = ClassTrainerPlusDBPC
460-
HookCTPUpdate(function()
461-
rebuildSpells(UnitLevel("player"))
462-
end)
463+
HookCTPUpdate(
464+
function()
465+
rebuildSpells(UnitLevel("player"))
466+
end
467+
)
463468
end
464469

465470
if (HookCTPUpdate) then

changes.log

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* 1.2
2+
- Fixed old Paladin Aura ranks being listed as "Available Now" after training a new rank
3+
14
* 1.0
25
- Added category for spells that you can't train because you lack the necessary talent
36
- Fixed some minor visual issues
@@ -13,4 +16,5 @@
1316
* 0.3-beta
1417
- Fix WoWI bug 8884
1518
- Won't show other faction's mage ports/teles
16-
- Won't show other race's priest spells
19+
- Won't show other race's priest spells
20+

0 commit comments

Comments
 (0)