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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
local HEALTH_WARNING_PERCENTAGES =
{
[ HEALTH_WARNING_STAGE_1 ] = 0 ,
[ HEALTH_WARNING_STAGE_2 ] = 0.3 ,
[ HEALTH_WARNING_STAGE_3 ] = 0.15 ,
[ HEALTH_WARNING_FLASH_1 ] = 0.5 ,
[ HEALTH_WARNING_FLASH_2 ] = 0.4 ,
}
local FLASH_TIME_OUT_SECONDS =
{
[ HEALTH_WARNING_FLASH_1 ] = 0.3 ,
[ HEALTH_WARNING_FLASH_2 ] = 0.3 ,
}
local IS_HEALTH_FLASH =
{
[ HEALTH_WARNING_FLASH_1 ] = true ,
[ HEALTH_WARNING_FLASH_2 ] = true ,
}
local currentHealthPercent = 0
local healthWasAboveFlash = currentHealthPercent > flashPercent
local healthIsNowBelowFlash = healthPercent <= flashPercent
return healthWasAboveFlash and healthIsNowBelowFlash
end
if ( healthPercent <= HEALTH_WARNING_PERCENTAGES [ HEALTH_WARNING_STAGE_3 ] )
then
return HEALTH_WARNING_STAGE_3
elseif ( healthPercent <= HEALTH_WARNING_PERCENTAGES [ HEALTH_WARNING_STAGE_2 ] )
then
return HEALTH_WARNING_STAGE_2
elseif ( healthPercent <= HEALTH_WARNING_PERCENTAGES [ HEALTH_WARNING_STAGE_1 ] )
then
return HEALTH_WARNING_STAGE_1
then
return HEALTH_WARNING_FLASH_2
then
return HEALTH_WARNING_FLASH_1
else
return HEALTH_WARNING_NONE
end
end
if ( IS_HEALTH_FLASH [ warningStage ] )
then
else
end
end
end
return
end
local healthPercent = 0
if ( maxHealth and maxHealth > 0 )
then
healthPercent = health / maxHealth
end
currentHealthPercent = healthPercent
end
if ( maxHealth and maxHealth > 0 )
then
currentHealthPercent = health / maxHealth
else
currentHealthPercent = 0
end
end
EVENT_MANAGER : AddFilterForEvent ( "ZO_HealthWarning" , EVENT_POWER_UPDATE , REGISTER_FILTER_POWER_TYPE , POWERTYPE_HEALTH )
EVENT_MANAGER : AddFilterForEvent ( "ZO_HealthWarning" , EVENT_POWER_UPDATE , REGISTER_FILTER_UNIT_TAG , "player" )
|