Skip to content

Commit e8cf579

Browse files
committed
Added support for heal[<class>] and tank[<class>] (e.g. heal[druid] and tank[deathknight]) to mark tanks/healers of a specific class during dungeons (closes #1)
1 parent 93b0c6c commit e8cf579

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

main.lua

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ function NAM:GetCustomConfigurationOptions(groupOrder, configurations)
235235
type = "description",
236236
name = [[Check http://warcraft.wiki.gg/wiki/UnitId for info about UnitID. Player names will often also work, but may need to include realm name.
237237
In addition to these, you can also use 'MT1' & 'MT2' for the maintanks or 'MA1' & 'MA2' for the mainassists while in a raid group.
238-
In dungeons, 'tank' & 'heal' can be used for the party tank/healer.
238+
In dungeons, 'tank' & 'heal' can be used for the party tank/healer, and e.g. 'tank[deathknight]' & 'heal[druid]' for the tank/healer of a specific class.
239239
You can combine these custom units with target, pet, etc. e.g. 'MA1target' would mark the target of the first main assist.]],
240240
order = increment(),
241241
},
@@ -454,16 +454,30 @@ end
454454
function NAM:ReplaceUnitIDs(unitID, checkDungeonUnits)
455455
if checkDungeonUnits then
456456
local tank, heal
457+
local tankClass, healClass
457458
for _, unit in ipairs({"party1", "party2", "party3", "party4", "player"}) do
458459
if UnitGroupRolesAssigned(unit) == "TANK" then
459460
tank = unit
461+
tankClass = select(2, UnitClass(unit))
460462
elseif UnitGroupRolesAssigned(unit) == "HEALER" then
461463
heal = unit
464+
healClass = select(2, UnitClass(unit))
462465
end
463466
end
464-
465-
unitID = tank and gsub(unitID, "tank", tank) or unitID
466-
unitID = heal and gsub(unitID, "heal", heal) or unitID
467+
if tank then
468+
unitID = gsub(unitID, ("tank%%[%s%%]"):format(tankClass:lower()), tank)
469+
if unitID:find("tank%[") then
470+
return ""
471+
end
472+
unitID = gsub(unitID, "tank", tank)
473+
end
474+
if heal then
475+
unitID = gsub(unitID, ("heal%%[%s%%]"):format(healClass:lower()), heal)
476+
if unitID:find("heal%[") then
477+
return ""
478+
end
479+
unitID = gsub(unitID, "heal", heal)
480+
end
467481
end
468482
local mainTank1, mainTank2 = GetPartyAssignment("MAINTANK")
469483
local mainAssist1, mainAssist2 = GetPartyAssignment("MAINASSIST")

0 commit comments

Comments
 (0)