Aufruf als
Core.point_conditions.pointIdentity(self, unit, key)
Erfassen Sie die Abhängigkeit Core.point_conditions.pointIdentity 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
Observes whether unit exists and, if so, its class, for the point-resource selectors. For the player it reuses a class stored in self.longtermCache under key when it was recorded against the same UnitClass function, and otherwise stores the freshly read class there.
Argumente
| Name | Typ | Was sie bewirkt |
|---|---|---|
self | RMAddon | Rotation Master addon instance. |
unit | string | Unit token to observe. |
key | any | Long-term cache key for the player's class; only used for "player". The addon passes a private table. |
Rückgabewerte
| 1 | table | nil | {exists=false}, or {exists=true, class=token}; nil when unavailable. |
|---|---|---|
| 2 | string | nil | The platform observer's reason for nil. |
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 | |||||
|---|---|---|---|---|---|
UnitClass |
Geheime Werte (Retail und Forever)
Auf Retail und Forever übergibt das Spiel Addons geheime Werte. Diese Hilfsfunktion prüft, was sie liest (addon.Platform:CanReadValue), und gibt statt eines geheimen Werts, den sie nicht vergleichen kann, nil mit einem Grund wie restricted-value zurück. Behandeln Sie nil als nicht verfügbar, nicht als false.
Beispiel
-- needs the dependency Core.point_conditions.pointIdentity
local record, reason = Functions.cache.getCached(cache, Core.point_conditions.pointIdentity, addon, "target")
if not record then return nil, reason end
return record.exists and record.class == "ROGUE"Quelle
Core/point_conditions.lua, Zeile 27. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.
Core.point_conditions.pointIdentity(self, unit, key)
local platform=self.Platform
local nativeClass=UnitClass
local longterm=self.longtermCache
if not platform:CanReadValue(longterm) or type(longterm)~='table' then longterm=nil end
local class
if unit=='player' and longterm and platform:CanReadValue(nativeClass) and type(nativeClass)=='function' then
local entry=rawget(longterm,key)
if platform:CanReadValue(entry) and type(entry)=='table' then
local api,candidate=rawget(entry,'api'),rawget(entry,'class')
if platform:CanReadValue(api) and api==nativeClass and platform:CanReadValue(candidate) and type(candidate)=='string' and candidate~='' then class=candidate end
end
end
local record,reason=platform:GetUnitPointIdentityObservation(unit,class==nil)
if not record then return nil,reason end
if not record.exists then return record end
if class then record.class=class
elseif unit=='player' and longterm and type(nativeClass)=='function' and nativeClass==UnitClass then
rawset(longterm,key,{api=nativeClass,class=record.class})
end
return record




