Mercurial > wow > tankspotter
comparison Core.lua @ 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 |
comparison
equal
deleted
inserted
replaced
| 0:16396ebfa35f | 1:1ba103196ede |
|---|---|
| 32 end | 32 end |
| 33 | 33 |
| 34 local tank = nil | 34 local tank = nil |
| 35 for i = 1, GetNumRaidMembers()-1 do | 35 for i = 1, GetNumRaidMembers()-1 do |
| 36 local unit = 'raid'..i | 36 local unit = 'raid'..i |
| 37 if tankGUID and UnitGUID(unit) == tankGUID then | 37 if not UnitIsDead(unit) then |
| 38 return unit | 38 if tankGUID and UnitGUID(unit) == tankGUID then |
| 39 end | 39 return unit |
| 40 if UnitGroupRolesAssigned(unit) == 'TANK' then | 40 end |
| 41 if tank == nil then | 41 if UnitGroupRolesAssigned(unit) == 'TANK' then |
| 42 tank = unit | 42 if tank == nil then |
| 43 else | 43 tank = unit |
| 44 -- Too many tanks. | 44 else |
| 45 tank = '' | 45 -- Too many tanks. |
| 46 tank = '' | |
| 47 end | |
| 46 end | 48 end |
| 47 end | 49 end |
| 48 end | 50 end |
| 49 if tank and tank ~= '' then | 51 if tank and tank ~= '' then |
| 50 return tank | 52 return tank |
| 51 end | 53 end |
| 52 | 54 |
| 53 tank = nil | 55 tank = nil |
| 54 for i = 1, GetNumPartyMembers() do | 56 for i = 1, GetNumPartyMembers() do |
| 55 local unit = 'party'..i | 57 local unit = 'party'..i |
| 56 if tankGUID and UnitGUID(unit) == tankGUID then | 58 if not UnitIsDead(unit) then |
| 57 return unit | 59 if tankGUID and UnitGUID(unit) == tankGUID then |
| 58 end | 60 return unit |
| 59 | 61 end |
| 60 if UnitGroupRolesAssigned(unit) == 'TANK' then | 62 |
| 61 tank = unit | 63 if UnitGroupRolesAssigned(unit) == 'TANK' then |
| 64 tank = unit | |
| 65 end | |
| 62 end | 66 end |
| 63 end | 67 end |
| 64 | 68 |
| 65 return tank or 'pet' | 69 return tank or 'pet' |
| 66 end | 70 end |
| 117 TankSpotter:RegisterEvent("PLAYER_ENTERING_WORLD", 'UpdateAllMacros') | 121 TankSpotter:RegisterEvent("PLAYER_ENTERING_WORLD", 'UpdateAllMacros') |
| 118 TankSpotter:RegisterEvent("PARTY_MEMBERS_CHANGED", 'UpdateAllMacros') | 122 TankSpotter:RegisterEvent("PARTY_MEMBERS_CHANGED", 'UpdateAllMacros') |
| 119 -- This is used to determine when a pet is summoned or dismissed | 123 -- This is used to determine when a pet is summoned or dismissed |
| 120 TankSpotter:RegisterEvent("UNIT_PET", 'UpdateAllMacros') | 124 TankSpotter:RegisterEvent("UNIT_PET", 'UpdateAllMacros') |
| 121 | 125 |
| 126 -- If your tank dies, this will trigger a new tank to be found as soon as combat is over. | |
| 127 TankSpotter:RegisterEvent("PLAYER_DEAD", 'UpdateAllMacros') | |
| 128 TankSpotter:RegisterEvent("PLAYER_UNGHOST", 'UpdateAllMacros') | |
| 129 | |
| 130 | |
| 131 | |
| 122 SLASH_TANKSPOTTER1, SLASH_TANKSPOTTER2 = '/tankspotter', '/ts' | 132 SLASH_TANKSPOTTER1, SLASH_TANKSPOTTER2 = '/tankspotter', '/ts' |
| 123 SlashCmdList["TANKSPOTTER"] = function(msg, editBox) | 133 SlashCmdList["TANKSPOTTER"] = function(msg, editBox) |
| 124 TankSpotter:Slash(msg, editBox) | 134 TankSpotter:Slash(msg, editBox) |
| 125 end | 135 end |
| 126 | |
| 127 | |
| 128 -- TankSpotter:UpdateAllMacros() |
