Mercurial > wow > tankspotter
changeset 1:1ba103196ede
Added a check to prevent attempting to use a dead tank. If any players die or 'unghost' it will update the macros (after combat).
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Sun, 14 Nov 2010 17:27:04 -0800 |
| parents | 16396ebfa35f |
| children | a7b2b0617eb0 |
| files | Core.lua |
| diffstat | 1 files changed, 25 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Sun Nov 14 17:03:15 2010 -0800 +++ b/Core.lua Sun Nov 14 17:27:04 2010 -0800 @@ -34,15 +34,17 @@ local tank = nil for i = 1, GetNumRaidMembers()-1 do local unit = 'raid'..i - if tankGUID and UnitGUID(unit) == tankGUID then - return unit - end - if UnitGroupRolesAssigned(unit) == 'TANK' then - if tank == nil then - tank = unit - else - -- Too many tanks. - tank = '' + if not UnitIsDead(unit) then + if tankGUID and UnitGUID(unit) == tankGUID then + return unit + end + if UnitGroupRolesAssigned(unit) == 'TANK' then + if tank == nil then + tank = unit + else + -- Too many tanks. + tank = '' + end end end end @@ -53,12 +55,14 @@ tank = nil for i = 1, GetNumPartyMembers() do local unit = 'party'..i - if tankGUID and UnitGUID(unit) == tankGUID then - return unit - end - - if UnitGroupRolesAssigned(unit) == 'TANK' then - tank = unit + if not UnitIsDead(unit) then + if tankGUID and UnitGUID(unit) == tankGUID then + return unit + end + + if UnitGroupRolesAssigned(unit) == 'TANK' then + tank = unit + end end end @@ -119,10 +123,13 @@ -- This is used to determine when a pet is summoned or dismissed TankSpotter:RegisterEvent("UNIT_PET", 'UpdateAllMacros') +-- If your tank dies, this will trigger a new tank to be found as soon as combat is over. +TankSpotter:RegisterEvent("PLAYER_DEAD", 'UpdateAllMacros') +TankSpotter:RegisterEvent("PLAYER_UNGHOST", 'UpdateAllMacros') + + + SLASH_TANKSPOTTER1, SLASH_TANKSPOTTER2 = '/tankspotter', '/ts' SlashCmdList["TANKSPOTTER"] = function(msg, editBox) TankSpotter:Slash(msg, editBox) end - - --- TankSpotter:UpdateAllMacros()
