VuhDoHealCommAdapter.lua 980 Bytes
Newer Older
humfras's avatar
humfras committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
----------------------------------------------------
local UnitGetIncomingHeals = UnitGetIncomingHeals;
local sIsOthers, sIsOwn, sIsNoInc;
function VUHDO_healCommAdapterInitLocalOverrides()
	sIsOthers = VUHDO_CONFIG["SHOW_INCOMING"];
	sIsOwn = VUHDO_CONFIG["SHOW_OWN_INCOMING"];
	sIsNoInc = not sIsOwn and not sIsOthers;
end
----------------------------------------------------


local VUHDO_INC_HEAL = { };



--
function VUHDO_getIncHealOnUnit(aUnit)
	return VUHDO_INC_HEAL[aUnit] or 0;
end



--
local tAllIncoming;
function VUHDO_determineIncHeal(aUnit)
	if sIsNoInc then return; end

	if sIsOthers then
		if sIsOwn then
			VUHDO_INC_HEAL[aUnit] = UnitGetIncomingHeals(aUnit);
		else
			tAllIncoming = (UnitGetIncomingHeals(aUnit) or 0) - (UnitGetIncomingHeals(aUnit, "player") or 0);
			VUHDO_INC_HEAL[aUnit] = tAllIncoming < 0 and 0 or tAllIncoming;
		end
	else
		VUHDO_INC_HEAL[aUnit] = UnitGetIncomingHeals(aUnit, "player");
	end
end