Aufruf als
Conditions.spatial_stats.statistic(cache, unit, mana, percentage, deficit)
Erfassen Sie die Abhängigkeit Conditions.spatial_stats.statistic und rufen Sie sie dann unter diesem Namen auf. Ein Aufruf über den Namensraum übergibt kein self: Verwenden Sie einen Doppelpunkt-Aufruf oder übergeben Sie das Objekt selbst.
Was sie bewirkt
Reads one unit's health or mana for the PROXIMITY_* conditions as an absolute value, a percentage of the maximum, or the deficit below the maximum.
Argumente
| Name | Typ | Was sie bewirkt |
|---|---|---|
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
unit | string | Unit token to read. |
mana | boolean | True for mana, false for health. |
percentage | boolean | True to return current as a percentage (0 to 100) of the maximum. |
deficit | boolean | True, when percentage is false, to return the maximum minus current. |
Rückgabewerte
| 1 | number | nil | The requested reading, or nil when unavailable. |
|---|---|---|
| 2 | string | nil | Reason for nil from observation, or statistic-unavailable when the maximum is zero. |
Editionen
Integrierte Hilfsfunktionen werden auf jeder Edition registriert. Unterschiedlich ist die Spiel-API, die sie lesen; fehlt eine, weicht die Hilfsfunktion aus oder gibt nil mit einem Grund zurück.
- Auf dieser Edition nicht verfügbar (den Grund nennt der Tooltip)
- Nur, solange Blizzards Ersatz für veraltete Funktionen aktiv ist
| Spiel-API | |||||
|---|---|---|---|---|---|
UnitHealth | |||||
UnitHealthMax | |||||
UnitPower | |||||
UnitPowerMax |
Wie das Addon sie aufruft
- Gesundheit in Reichweite (evaluate)
local cur,why=statistic(c,unit,false,false,value.value<0) - Gesundheit in Prozent in Reichweite (evaluate)
local cur,why=statistic(c,unit,false,true,false) - Anzahl nach Gesundheit in Prozent in Reichweite (evaluate)
local cur,why=statistic(c,unit,false,true,false) - Anzahl nach Gesundheit in Reichweite (evaluate)
local cur,why=statistic(c,unit,false,false,value.health<0) - Mana in Reichweite (evaluate)
local cur,why=statistic(c,unit,true,false,value.value<0) - Mana in Prozent in Reichweite (evaluate)
local cur,why=statistic(c,unit,true,true,false) - Anzahl nach Mana in Prozent in Reichweite (evaluate)
local cur,why=statistic(c,unit,true,true,false) - Anzahl nach Mana in Reichweite (evaluate)
local cur,why=statistic(c,unit,true,false,value.mana<0)
Abhängigkeiten
observation→Conditions.spatial_stats.observation
Quelle
Conditions/spatial_stats.lua, Zeile 81. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.
Conditions.spatial_stats.statistic(cache, unit, mana, percentage, deficit)
local method=UnitHealth;if mana then method=UnitPower end
local current,reason=observation(cache,method,unit,mana)
if current==nil then return nil,reason end
if percentage or deficit then
local maximumMethod=UnitHealthMax;if mana then maximumMethod=UnitPowerMax end
local maximum,why=observation(cache,maximumMethod,unit,mana)
if maximum==nil then return nil,why end
if percentage then
if maximum==0 then return nil,"statistic-unavailable" end
local percent=current/maximum*100
if percent~=percent or percent==math.huge then return nil,"statistic-unavailable" end
return percent
end
return maximum-current
end
return current




