Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function (allstates)
- if not InCombatLockdown() then
- if IsInRaid() then
- local myzone = GetZoneText()
- for i=1, GetNumGroupMembers() do
- local unit = WeakAuras.raidUnits[i]
- local name = UnitName(unit)
- local guid = UnitGUID(unit)
- local zone = select(7,GetRaidRosterInfo(i))
- if UnitGroupRolesAssigned(unit) == "HEALER" and not allstates[guid] and UnitIsConnected(unit) and zone == myzone then --give them a state
- allstates[guid] = {}
- allstates[guid].name = name
- allstates[guid].guid = guid
- allstates[guid].class = select(3,UnitClass(unit))
- allstates[guid].request = GetTime()
- allstates[guid].progressType = "static"
- allstates[guid].value = UnitPower(unit,0)
- allstates[guid].total = UnitPowerMax(unit,0)
- allstates[guid].button = aura_env.getButton(guid)
- allstates[guid].show = true
- allstates[guid].changed = true
- elseif UnitGroupRolesAssigned(unit) ~= "HEALER" and allstates[guid] then --take away their state
- allstates[guid].button:Hide()
- allstates[guid].show = false
- allstates[guid].changed = true
- end
- end
- else
- for _,s in pairs(allstates) do
- s.button:Hide()
- s.show = false
- s.changed = true
- end
- end
- for n,s in pairs(allstates) do
- if (not UnitExists(s.name)) or (not UnitIsConnected(s.name)) then --garbagecollect
- s.button:Hide()
- s.show = false
- s.changed = true
- end
- end
- for i=1, GetNumGroupMembers() do
- local name,_,_,_,_,_,zone = GetRaidRosterInfo(i)
- local guid = UnitGUID(WeakAuras.raidUnits[i])
- if allstates[guid] and zone ~= GetZoneText() then
- allstates[guid].button:Hide()
- allstates[guid].show = false
- allstates[guid].changed = true
- end
- end
- end
- for n,s in pairs(allstates) do
- s.value = UnitPower(s.name,0)
- s.total = UnitPowerMax(s.name,0)
- s.changed = true
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement