feat(TankMode): CoA custom-class role detection via active spec
release / release (push) Successful in 3s
release / release (push) Successful in 3s
Add CoAClassSpecData.lua (copied from coa-db/data) and wire GetPlayerCoARole() into TankMode so CoA tokens resolve TANK/HEALER/DAMAGER from their active spec instead of defaulting to DAMAGER. - CoAClassSpecData.lua: defines CoAClassSpec keyed by UnitClass token, loaded in .toc before Core.xml/Modules.xml - GetPlayerCoARole(): pcall-guarded helper that calls SpecializationUtil.GetActiveSpecialization() (1-based index) to look up the current spec in CoAClassSpec[token].specs; TANK > HEALER > DAMAGER precedence when a spec carries multiple roles; returns nil for vanilla classes so the existing IsTank/IsHealer path is unchanged - mod:Update(): try GetPlayerCoARole() first; fall through to vanilla logic only when nil (vanilla class or unresolvable spec) - Re-evaluation on spec change already covered: PLAYER_TALENT_UPDATE fires on both spec and talent changes, driving mod:Update() luac -p: TankMode.lua OK, CoAClassSpecData.lua OK
This commit is contained in:
@@ -0,0 +1,143 @@
|
|||||||
|
-- CoAClassSpecData.lua — GENERATED by coa-db/tools/gen_coa_class_spec_lua.py
|
||||||
|
-- Source of truth: coa-db/data/class_spec_meta.json (class.file_string tokens + wiki specs).
|
||||||
|
-- Do not hand-edit; regenerate from coa-db. Neutral stat keys; each addon maps them.
|
||||||
|
-- Keyed by the in-game class token (2nd return of UnitClass), e.g. Templar=MONK.
|
||||||
|
CoAClassSpec = {
|
||||||
|
["BARBARIAN"] = { name="Barbarian", classId=12, specs={
|
||||||
|
{ name="Headhunting", roles={"RANGED"}, primaryStat="Agility", weights={ Agility=1, RangedAttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5 } },
|
||||||
|
{ name="Brutality", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Ancestry", roles={"MELEE","SUPPORT"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
}},
|
||||||
|
["WITCHDOCTOR"] = { name="Witch Doctor", classId=13, specs={
|
||||||
|
{ name="Shadowhunting", roles={"RANGED"}, primaryStat="Agility", weights={ Agility=1, RangedAttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5 } },
|
||||||
|
{ name="Voodoo", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Brewing", roles={"HEALER"}, primaryStat="Spirit", weights={ Spirit=1, SpellPower=0.8, CritRating=0.5, HasteRating=0.5, Mp5=0.5, Intellect=0.55 } },
|
||||||
|
}},
|
||||||
|
["DEMONHUNTER"] = { name="Felsworn", classId=14, specs={
|
||||||
|
{ name="Slayer", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Infernal", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Tyrant", roles={"TANK"}, primaryStat="Agility", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Agility=0.4 } },
|
||||||
|
}},
|
||||||
|
["WITCHHUNTER"] = { name="Witch Hunter", classId=15, specs={
|
||||||
|
{ name="Boltslinger", roles={"RANGED"}, primaryStat="Agility", weights={ Agility=1, RangedAttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5 } },
|
||||||
|
{ name="Darkness", roles={"RANGED"}, primaryStat="Agility", weights={ Agility=1, RangedAttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5 } },
|
||||||
|
{ name="Inquisition", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Black Knight", roles={"TANK"}, primaryStat="Agility", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Agility=0.4 } },
|
||||||
|
}},
|
||||||
|
["STORMBRINGER"] = { name="Stormbringer", classId=16, specs={
|
||||||
|
{ name="Maelstrom", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Lightning", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Wind", roles={"CASTER","SUPPORT"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
}},
|
||||||
|
["FLESHWARDEN"] = { name="Knight of Xoroth", classId=17, specs={
|
||||||
|
{ name="Hellfire", roles={"MELEE"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Defiance", roles={"TANK"}, primaryStat="Strength", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Strength=0.4 } },
|
||||||
|
{ name="War", roles={"MELEE"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
}},
|
||||||
|
["GUARDIAN"] = { name="Guardian", classId=18, specs={
|
||||||
|
{ name="Gladiator", roles={"MELEE"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Inspiration", roles={"MELEE","SUPPORT"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Vanguard", roles={"TANK"}, primaryStat="Strength", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Strength=0.4 } },
|
||||||
|
}},
|
||||||
|
["MONK"] = { name="Templar", classId=19, specs={
|
||||||
|
{ name="Oathkeeper", roles={"TANK"}, primaryStat="Agility", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Agility=0.4 } },
|
||||||
|
{ name="Zealot", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Crusader", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
}},
|
||||||
|
["SONOFARUGAL"] = { name="Bloodmage", classId=20, specs={
|
||||||
|
{ name="Fleshweaver", roles={"SUPPORT"}, primaryStat="Spirit", weights={ Spirit=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Sanguine", roles={"CASTER"}, primaryStat="Spirit", weights={ Spirit=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Accursed", roles={"MELEE","CASTER"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Eternal", roles={"TANK"}, primaryStat="Agility", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Agility=0.4 } },
|
||||||
|
}},
|
||||||
|
["RANGER"] = { name="Ranger", classId=21, specs={
|
||||||
|
{ name="Archery", roles={"RANGED"}, primaryStat="Agility", weights={ Agility=1, RangedAttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5 } },
|
||||||
|
{ name="Farstrider", roles={"RANGED","SUPPORT"}, primaryStat="Agility", weights={ Agility=1, RangedAttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5 } },
|
||||||
|
{ name="Brigand", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
}},
|
||||||
|
["CHRONOMANCER"] = { name="Chronomancer", classId=22, specs={
|
||||||
|
{ name="Infinite", roles={"CASTER"}, primaryStat="Spirit", weights={ Spirit=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Time", roles={"HEALER"}, primaryStat="Spirit", weights={ Spirit=1, SpellPower=0.8, CritRating=0.5, HasteRating=0.5, Mp5=0.5, Intellect=0.55 } },
|
||||||
|
{ name="Artificer", roles={"RANGED"}, primaryStat="Spirit", weights={ Spirit=1, RangedAttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5 } },
|
||||||
|
}},
|
||||||
|
["NECROMANCER"] = { name="Necromancer", classId=23, specs={
|
||||||
|
{ name="Death", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Animation", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Rime", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
}},
|
||||||
|
["PYROMANCER"] = { name="Pyromancer", classId=24, specs={
|
||||||
|
{ name="Incineration", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Flameweaving", roles={"HEALER"}, primaryStat="Spirit", weights={ Spirit=1, SpellPower=0.8, CritRating=0.5, HasteRating=0.5, Mp5=0.5, Intellect=0.55 } },
|
||||||
|
{ name="Draconic", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
}},
|
||||||
|
["CULTIST"] = { name="Cultist", classId=25, specs={
|
||||||
|
{ name="Heretic", roles={"HEALER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, CritRating=0.5, HasteRating=0.5, Mp5=0.5, Spirit=0.55 } },
|
||||||
|
{ name="Corruption", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Godblade", roles={"MELEE"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Dreadnought", roles={"TANK"}, primaryStat="Strength", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Strength=0.4 } },
|
||||||
|
}},
|
||||||
|
["STARCALLER"] = { name="Starcaller", classId=26, specs={
|
||||||
|
{ name="Sentinel", roles={"RANGED"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Warden", roles={"MELEE"}, primaryStat="Intellect", weights={ Intellect=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Moon Priest", roles={"HEALER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, CritRating=0.5, HasteRating=0.5, Mp5=0.5, Spirit=0.55 } },
|
||||||
|
{ name="Moon Guard", roles={"TANK"}, primaryStat="Intellect", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Intellect=0.4 } },
|
||||||
|
}},
|
||||||
|
["SUNCLERIC"] = { name="Sun Cleric", classId=27, specs={
|
||||||
|
{ name="Piety", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Valkyrie", roles={"MELEE"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Seraphim", roles={"TANK"}, primaryStat="Strength", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Strength=0.4 } },
|
||||||
|
{ name="Blessings", roles={"HEALER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, CritRating=0.5, HasteRating=0.5, Mp5=0.5, Spirit=0.55 } },
|
||||||
|
}},
|
||||||
|
["TINKER"] = { name="Tinker", classId=28, specs={
|
||||||
|
{ name="Demolition", roles={"RANGED"}, primaryStat="Agility", weights={ Agility=1, RangedAttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5 } },
|
||||||
|
{ name="Mechanics", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Invention", roles={"HEALER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, CritRating=0.5, HasteRating=0.5, Mp5=0.5, Spirit=0.55 } },
|
||||||
|
}},
|
||||||
|
["PROPHET"] = { name="Venomancer", classId=29, specs={
|
||||||
|
{ name="Fortitude", roles={"TANK"}, primaryStat="Intellect", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Intellect=0.4 } },
|
||||||
|
{ name="Stalking", roles={"MELEE"}, primaryStat="Intellect", weights={ Intellect=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Rot", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Vizier", roles={"HEALER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, CritRating=0.5, HasteRating=0.5, Mp5=0.5, Spirit=0.55 } },
|
||||||
|
}},
|
||||||
|
["REAPER"] = { name="Reaper", classId=30, specs={
|
||||||
|
{ name="Soul", roles={"MELEE"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Harvest", roles={"MELEE"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Domination", roles={"TANK"}, primaryStat="Strength", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Strength=0.4 } },
|
||||||
|
}},
|
||||||
|
["WILDWALKER"] = { name="Primalist", classId=31, specs={
|
||||||
|
{ name="Grovekeeper", roles={"SUPPORT"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Wildwalker", roles={"MELEE"}, primaryStat="Strength", weights={ Strength=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Mountain King", roles={"TANK"}, primaryStat="Strength", weights={ Stamina=1, Armor=0.6, Dodge=0.55, Parry=0.55, Defense=0.6, Strength=0.4 } },
|
||||||
|
{ name="Geomancy", roles={"CASTER"}, primaryStat="Intellect", weights={ Intellect=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
}},
|
||||||
|
["SPIRITMAGE"] = { name="Runemaster", classId=32, specs={
|
||||||
|
{ name="Engravement", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
{ name="Glyphic", roles={"CASTER"}, primaryStat="Spirit", weights={ Spirit=1, SpellPower=0.8, HitRating=0.7, CritRating=0.55, HasteRating=0.55 } },
|
||||||
|
{ name="Riftblade", roles={"MELEE"}, primaryStat="Agility", weights={ Agility=1, AttackPower=0.5, CritRating=0.55, HitRating=0.6, HasteRating=0.5, ArmorPenetration=0.5 } },
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
|
||||||
|
CoAClassPrimaryStats = {
|
||||||
|
["BARBARIAN"] = { "Agility" },
|
||||||
|
["WITCHDOCTOR"] = { "Agility", "Intellect", "Spirit" },
|
||||||
|
["DEMONHUNTER"] = { "Agility", "Intellect", "Stamina" },
|
||||||
|
["WITCHHUNTER"] = { "Agility", "Intellect", "Stamina" },
|
||||||
|
["STORMBRINGER"] = { "Intellect" },
|
||||||
|
["FLESHWARDEN"] = { "Strength", "Intellect", "Stamina" },
|
||||||
|
["GUARDIAN"] = { "Strength", "Stamina" },
|
||||||
|
["MONK"] = { "Agility", "Stamina" },
|
||||||
|
["SONOFARUGAL"] = { "Spirit", "Stamina", "Agility" },
|
||||||
|
["RANGER"] = { "Agility" },
|
||||||
|
["CHRONOMANCER"] = { "Spirit" },
|
||||||
|
["NECROMANCER"] = { "Intellect" },
|
||||||
|
["PYROMANCER"] = { "Intellect", "Spirit" },
|
||||||
|
["CULTIST"] = { "Intellect", "Strength", "Stamina" },
|
||||||
|
["STARCALLER"] = { "Intellect", "Stamina" },
|
||||||
|
["SUNCLERIC"] = { "Intellect", "Strength", "Stamina" },
|
||||||
|
["TINKER"] = { "Agility", "Intellect" },
|
||||||
|
["PROPHET"] = { "Intellect", "Stamina" },
|
||||||
|
["REAPER"] = { "Strength", "Stamina" },
|
||||||
|
["WILDWALKER"] = { "Strength", "Intellect", "Stamina" },
|
||||||
|
["SPIRITMAGE"] = { "Agility", "Spirit" },
|
||||||
|
}
|
||||||
|
|
||||||
@@ -22,5 +22,10 @@ Locales.xml
|
|||||||
# so ClassColours.lua:90 sees the populated CCC at OnInitialize time.
|
# so ClassColours.lua:90 sees the populated CCC at OnInitialize time.
|
||||||
CoAClassColors.lua
|
CoAClassColors.lua
|
||||||
|
|
||||||
|
# CoA class/spec metadata: defines CoAClassSpec keyed by class token
|
||||||
|
# (2nd return of UnitClass). Must load before TankMode.lua so that
|
||||||
|
# GetPlayerCoARole() can look up spec roles at OnEnable time.
|
||||||
|
CoAClassSpecData.lua
|
||||||
|
|
||||||
Core.xml
|
Core.xml
|
||||||
Modules.xml
|
Modules.xml
|
||||||
@@ -106,6 +106,62 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--------------------------------------------------------- CoA role detection --
|
||||||
|
-- Returns "TANK", "HEALER", or "DAMAGER" for the player's current spec when
|
||||||
|
-- the player is a CoA custom class. Returns nil if the class is not in
|
||||||
|
-- CoAClassSpec (vanilla path) or if the active spec cannot be resolved (caller
|
||||||
|
-- falls back to existing logic).
|
||||||
|
--
|
||||||
|
-- API rationale: SpecializationUtil.GetActiveSpecialization() is the
|
||||||
|
-- confirmed per-spec API on the CoA/Ascension 3.3.5a client. It returns
|
||||||
|
-- a 1-based integer matching the in-game tab order, which is the same order
|
||||||
|
-- as CoAClassSpec[token].specs. This is the same API used by coa-clique
|
||||||
|
-- (Clique.lua:700) and coa-weakauras (WeakAuras.lua:1608) on this client.
|
||||||
|
-- We guard with pcall so a missing or broken API degrades silently to nil.
|
||||||
|
local function GetPlayerCoARole()
|
||||||
|
if not CoAClassSpec then return nil end
|
||||||
|
|
||||||
|
local token = select(2, UnitClass("player"))
|
||||||
|
if not token then return nil end
|
||||||
|
|
||||||
|
local classData = CoAClassSpec[token]
|
||||||
|
if not classData then return nil end -- vanilla class; use vanilla path
|
||||||
|
|
||||||
|
-- Resolve the active spec index via SpecializationUtil.
|
||||||
|
local specIndex
|
||||||
|
local ok, result = pcall(function()
|
||||||
|
if SpecializationUtil and SpecializationUtil.GetActiveSpecialization then
|
||||||
|
return SpecializationUtil.GetActiveSpecialization()
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end)
|
||||||
|
if ok and result and result >= 1 then
|
||||||
|
specIndex = result
|
||||||
|
end
|
||||||
|
|
||||||
|
local specData
|
||||||
|
if specIndex and classData.specs[specIndex] then
|
||||||
|
specData = classData.specs[specIndex]
|
||||||
|
end
|
||||||
|
|
||||||
|
if not specData then return nil end
|
||||||
|
|
||||||
|
-- Map CoAClassSpec roles → tank-mode role.
|
||||||
|
-- TANK and HEALER take precedence over DAMAGER roles when both present.
|
||||||
|
local roles = specData.roles
|
||||||
|
if not roles then return nil end
|
||||||
|
|
||||||
|
local isTank, isHealer = false, false
|
||||||
|
for _, r in ipairs(roles) do
|
||||||
|
if r == "TANK" then isTank = true end
|
||||||
|
if r == "HEALER" then isHealer = true end
|
||||||
|
end
|
||||||
|
|
||||||
|
if isTank then return "TANK" end
|
||||||
|
if isHealer then return "HEALER" end
|
||||||
|
return "DAMAGER"
|
||||||
|
end
|
||||||
|
|
||||||
--------------------------------------------------------- tank mode functions --
|
--------------------------------------------------------- tank mode functions --
|
||||||
do
|
do
|
||||||
local function getTalentpointsSpent(spellID)
|
local function getTalentpointsSpent(spellID)
|
||||||
@@ -162,10 +218,16 @@ do
|
|||||||
function mod:Update()
|
function mod:Update()
|
||||||
if profile_tankmode.enabled == 1 then
|
if profile_tankmode.enabled == 1 then
|
||||||
-- smart - judge by spec
|
-- smart - judge by spec
|
||||||
local spec = GetActiveTalentGroup()
|
|
||||||
local role
|
local role
|
||||||
|
|
||||||
if class == "WARRIOR" and GetShapeshiftForm() ~= 2 then
|
-- For CoA custom classes, derive role from the active spec via
|
||||||
|
-- CoAClassSpec. GetPlayerCoARole() returns nil when the class is
|
||||||
|
-- vanilla (not in CoAClassSpec) or when the spec cannot be resolved,
|
||||||
|
-- so vanilla classes always fall through to the IsTank/IsHealer path.
|
||||||
|
local coaRole = GetPlayerCoARole()
|
||||||
|
if coaRole then
|
||||||
|
role = coaRole
|
||||||
|
elseif class == "WARRIOR" and GetShapeshiftForm() ~= 2 then
|
||||||
-- no tank for gladiator stance
|
-- no tank for gladiator stance
|
||||||
role = nil
|
role = nil
|
||||||
elseif IsTank() then
|
elseif IsTank() then
|
||||||
|
|||||||
Reference in New Issue
Block a user