# HG changeset patch # User Asa Ayers # Date 1289784424 28800 # Node ID 1ba103196edee1aafdf858dc72671b338cd37394 # Parent 16396ebfa35ff3e7c45bbb180d96b8568b52592a Added a check to prevent attempting to use a dead tank. If any players die or 'unghost' it will update the macros (after combat). diff -r 16396ebfa35f -r 1ba103196ede Core.lua --- 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()