Skip to content

Commit 6b72b90

Browse files
committed
New Condition: Torghast Anima Power Count
1 parent 7ece996 commit 6b72b90

File tree

4 files changed

+78
-3
lines changed

4 files changed

+78
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## v9.0.4
2+
* New Condition: Torghast Anima Power Count
23
* #1811 - The group/target point of a group will now be preserved when moving a shrunk group via click-and-drag.
4+
### Bug Fixes
5+
* #1840 - Talents granted by Torghast powers are now correctly reflected by the Talent Learned condition.
6+
37
## v9.0.3
48
### Bug Fixes
59
* #1824 - Fix incorrect detection of Defensive mode in the Pet Attack Mode condition.

Components/Core/Conditions/Categories/Talents.lua

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ local strlowerCache = TMW.strlowerCache
2323

2424
local _, pclass = UnitClass("Player")
2525

26+
local wipe =
27+
wipe
2628
local GetTalentInfo, GetNumTalents, GetGlyphLink, GetSpellInfo =
2729
GetTalentInfo, GetNumTalents, GetGlyphLink, GetSpellInfo
2830
local GetSpecializationInfo, GetNumSpecializationsForClassID, GetSpecializationInfoForClassID, GetNumClasses, GetClassInfo =
2931
GetSpecializationInfo, GetNumSpecializationsForClassID, GetSpecializationInfoForClassID, GetNumClasses, GetClassInfo
3032
local GetNumBattlefieldScores, RequestBattlefieldScoreData, GetBattlefieldScore, GetNumArenaOpponents, GetArenaOpponentSpec =
3133
GetNumBattlefieldScores, RequestBattlefieldScoreData, GetBattlefieldScore, GetNumArenaOpponents, GetArenaOpponentSpec
32-
34+
local UnitAura, IsInJailersTower, C_SpecializationInfo, GetPvpTalentInfoByID =
35+
UnitAura, IsInJailersTower, C_SpecializationInfo, GetPvpTalentInfoByID
36+
3337
local ConditionCategory = CNDT:GetCategory("TALENTS", 1.4, L["CNDTCAT_TALENTS"], true, false)
3438

3539

@@ -353,8 +357,9 @@ function CNDT:PLAYER_TALENT_UPDATE()
353357
wipe(Env.TalentMap)
354358
for tier = 1, MAX_TALENT_TIERS do
355359
for column = 1, NUM_TALENT_COLUMNS do
356-
local id, name, _, selected = GetTalentInfo(tier, column, 1)
360+
local id, name, _, selected, available, _, _, _, _, _, grantedByAura = GetTalentInfo(tier, column, 1)
357361
local lower = name and strlowerCache[name]
362+
selected = selected or grantedByAura
358363
if lower then
359364
Env.TalentMap[lower] = selected
360365
Env.TalentMap[id] = selected
@@ -404,6 +409,7 @@ ConditionCategory:RegisterCondition(9, "TALENTLEARNED", {
404409

405410
CNDT.Env.AzeriteEssenceMap = {}
406411
CNDT.Env.AzeriteEssenceMap_MAJOR = {}
412+
local C_AzeriteEssence = C_AzeriteEssence
407413
function CNDT:AZERITE_ESSENCE_UPDATE()
408414
wipe(Env.AzeriteEssenceMap)
409415
wipe(Env.AzeriteEssenceMap_MAJOR)
@@ -460,6 +466,66 @@ for i, kind in TMW:Vararg("", "_MAJOR") do
460466
})
461467
end
462468

469+
local AnimaPowWatcher = TMW:NewModule("ANIMAPOW", "AceEvent-3.0")
470+
local currentAnimaPows = {}
471+
Env.CurrentAnimaPows = currentAnimaPows
472+
function AnimaPowWatcher:Init()
473+
self:RegisterEvent("PLAYER_ENTERING_WORLD", "OnLocationUpdate")
474+
self:OnLocationUpdate()
475+
end
476+
function AnimaPowWatcher:OnLocationUpdate()
477+
if IsInJailersTower() and not self.watching then
478+
self:RegisterEvent("UNIT_AURA")
479+
self.watching = true
480+
self:UNIT_AURA(nil, "player")
481+
elseif not IsInJailersTower() and self.watching then
482+
wipe(currentAnimaPows)
483+
TMW:Fire("TMW_ANIMA_POWER_COUNT_CHANGED")
484+
self:UnregisterEvent("UNIT_AURA")
485+
self.watching = false
486+
end
487+
end
488+
function AnimaPowWatcher:UNIT_AURA(_, unit)
489+
if unit ~= "player" then return end
490+
491+
for i=1, 300 do
492+
local name, _, count, _, _, _, _, _, _, spellID = UnitAura("player", i, "MAW");
493+
if not spellID then return end
494+
if count == 0 then
495+
count = 1;
496+
end
497+
498+
if currentAnimaPows[spellID] ~= count then
499+
currentAnimaPows[spellID] = count;
500+
currentAnimaPows[strlowerCache[name]] = count;
501+
TMW:Fire("TMW_ANIMA_POWER_COUNT_CHANGED")
502+
end
503+
end
504+
end
505+
506+
507+
ConditionCategory:RegisterCondition(9.4, "ANIMAPOW", {
508+
text = L["UIPANEL_ANIMAPOW"],
509+
range = 5,
510+
unit = PLAYER,
511+
name = function(editbox)
512+
editbox:SetTexts(L["SPELLTOCHECK"], L["CNDT_ONLYFIRST"])
513+
end,
514+
useSUG = true,
515+
icon = 3528304,
516+
tcoords = CNDT.COMMON.standardtcoords,
517+
funcstr = function(ConditionObject, c)
518+
AnimaPowWatcher:Init()
519+
return [[(CurrentAnimaPows[LOWER(c.NameFirst)] or 0) c.Operator c.Level]]
520+
end,
521+
events = function(ConditionObject, c)
522+
return
523+
ConditionObject:GenerateNormalEventString("TMW_ANIMA_POWER_COUNT_CHANGED")
524+
end,
525+
})
526+
527+
528+
463529

464530

465531
ConditionCategory:RegisterCondition(9, "PTSINTAL", {

Localization/TellMeWhen-enUS.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ L["ICONMENU_REACT"] = "Unit Reaction"
589589
L["ICONMENU_FRIEND"] = "Friendly"
590590
L["ICONMENU_HOSTILE"] = "Hostile"
591591

592-
L["ICONMENU_ISPLAYER"] = "Unit Is Player"
592+
L["ICONMENU_ISPLAYER"] = "Unit Is a Player"
593593

594594
L["ICONMENU_ICDTYPE"] = "Cooldown begins on..."
595595
L["ICONMENU_SPELLCAST_COMPLETE"] = "Spell Cast Finish/Instant Cast"
@@ -876,6 +876,7 @@ L["UIPANEL_PTSINTAL"] = "Points in talent"
876876
L["UIPANEL_TALENTLEARNED"] = "Talent learned"
877877
L["UIPANEL_AZESSLEARNED"] = "Azerite Essence Active"
878878
L["UIPANEL_AZESSLEARNED_MAJOR"] = "Major Azerite Essence Active"
879+
L["UIPANEL_ANIMAPOW"] = "Torghast Anima Power Count"
879880
L["UIPANEL_PVPTALENTLEARNED"] = "PvP Talent learned"
880881
L["UIPANEL_GLYPH"] = "Glyph active"
881882
L["UIPANEL_GLYPH_DESC"] = "Checks if you have a particular glyph active."

Options/CHANGELOG.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ TMW.CHANGELOG_LASTVER="7.4.0"
44

55
TMW.CHANGELOG = [==[
66
## v9.0.4
7+
* New Condition: Torghast Anima Power Count
78
* #1811 - The group/target point of a group will now be preserved when moving a shrunk group via click-and-drag.
9+
### Bug Fixes
10+
* #1840 - Talents granted by Torghast powers are now correctly reflected by the Talent Learned condition.
11+
812
## v9.0.3
913
### Bug Fixes
1014
* #1824 - Fix incorrect detection of Defensive mode in the Pet Attack Mode condition.

0 commit comments

Comments
 (0)