Earlier Versions
| Name | Size | Uploaded | Game Version | Downloads | |
| v6 release | 10.53 KB | Jul 28, 2020 | 1.13.4 | 0 | Download |
| v5 release | 10.30 KB | Jun 22, 2020 | 1.13.4 | 127 | Download |
| v4 release | 10.85 KB | Mar 14, 2020 | 1.13.4 | 188 | Download |
| v3 release | 10.86 KB | Mar 7, 2020 | 1.13.3 | 64 | Download |
| v2 release | 10.87 KB | Feb 24, 2020 | 1.13.3 | 55 | Download |
| v1 release | 10.78 KB | Feb 15, 2020 | 1.13.3 | 31 | Download |
Description
About
Library for instant health updates via combat log. Only group members; other units do not receive instant updates.
Because of technical limitations melee auto attack damage is not instant.
Usage
local InstantHealth = LibStub("LibInstantHealth-1.0")
Use InstantHealth.UnitHealth(unit) where you would use UnitHealth(unit), InstantHealth.UnitHealthMax(unit) where you would use UnitHealthMax(unit), and instead of
frame:SetScript("OnEvent", onEvent)
frame:RegisterEvent(event)
frame:RegisterUnitEvent(event, unit1, unit2)
frame:UnregisterEvent(event)
register the events like this
InstantHealth.RegisterCallback(frame, event, onEvent, frame)
InstantHealth.RegisterCallback(frame, event, function (self, event, unit)
if unit == unit1 or unit == unit2 then
onEvent(self, event, unit)
end
end, frame)
InstantHealth.UnregisterCallback(frame, event)
where event is "UNIT_HEALTH", "UNIT_MAXHEALTH", or "UNIT_HEALTH_FREQUENT".
UNIT_HEALTH, UNIT_MAXHEALTH and UNIT_HEALTH_FREQUENT events fire when they normally would; additionally, UNIT_HEALTH_FREQUENT is fired when the health is updated via combat log events.
Because of the potentially large number of UNIT_HEALTH_FREQUENT events, it is recommended to update health bars etc. in OnUpdate if necessary, and not on each UNIT_HEALTH_FREQUENT event.
It is not recommended to use InstantHealth.UnitHealth(unit) and InstantHealth.UnitHealthMax(unit) within event handlers of Blizzard's UNIT_HEALTH, UNIT_MAXHEALTH, UNIT_HEALTH_FREQUENT, and COMBAT_LOG_EVENT/COMBAT_LOG_EVENT_UNFILTERED.
Get 0.05 TON 💎
Download
Add a comment