Как вызывать
addon:GetConditionPointResourceV2(unit, cache)
Доступен напрямую через addon; зависимость не нужна.
Что делает
Определить очки ресурса по исходному действующему соответствию классов и кэшу идентичности, с явной политикой передачи для запасного варианта ComboPoints игрока TBC. Запасной вариант игрока, совпадающий с читаемой исходной таблицей Enum.PowerType и значением ComboPoints, захваченными при загрузке модуля, выбирает target-combo; явные записи таблицы классов, другие участники и другие семейства сохраняют power. Заменённое, унаследованное или недоказуемое происхождение запасного варианта сохраняет power. Эта версионированная политика не утверждает, что встроенный UnitPower сломан или эквивалентен. Известное отсутствие юнита возвращает false; недоступные обязательные наблюдения возвращают nil с причиной. Текущее или максимальное количество здесь не запрашивается.
Аргументы
| Имя | Тип | Что делает |
|---|---|---|
self | RMAddon | Экземпляр аддона Rotation Master (неявно при вызове через двоеточие). |
unit | string | Точный токен выбранного юнита; только буквальный токен player может выбрать передачу очков серии TBC. |
cache | table | nil | Кэш прохода вычисления или nil для прямого наблюдения идентичности. Успешные наблюдения класса игрока могут использовать существующий долговременный кэш идентичности; сопоставление ресурсов остаётся действующим. |
Возвращает
| 1 | number | boolean | nil | Явный неотрицательный целочисленный выбор, false при известном отсутствии юнита или nil, если обязательные данные недоступны. |
|---|---|---|
| 2 | string | nil | Причина по политике, проверке запроса или недоступности идентичности/выбора для выбора nil. |
| 3 | string | nil | Только для выбранного ресурса: target-combo для явного запасного варианта игрока TBC или power для существующей передачи выбранного юнита. |
Издания
Встроенные помощники регистрируются во всех изданиях. Различается игровой API, который они читают; если нужного API нет, помощник использует запасной вариант или возвращает nil с причиной.
- Недоступно в этом издании (причина — во всплывающей подсказке)
- Только пока включены запасные реализации Blizzard для устаревших функций
| Игровой API | |||||
|---|---|---|---|---|---|
Enum | |||||
canaccessvalue |
Секретные значения (Retail и Forever)
В Retail и Forever игра передаёт аддонам секретные значения. Этот помощник проверяет то, что читает (addon.Platform:CanReadValue), и вместо секретного значения, которое нельзя сравнить, возвращает nil с причиной, например restricted-value. Считайте nil недоступным значением, а не ложью.
Как его вызывает аддон
- Очки (evaluate)
local point,reason,transport=addon:GetConditionPointResourceV2(value.unit,cache)
Зависимости
editionPointResource→Core.point_conditions.editionPointResourceplayerClassCacheKey(builtin:Core/point_conditions.lua:playerClassCacheKey)pointComboTypes(builtin:Core/point_conditions.lua:pointComboTypes)pointComboValue(builtin:Core/point_conditions.lua:pointComboValue)pointIdentity→Core.point_conditions.pointIdentity
Исходный код
Core/point_conditions.lua, строка 210. В игре только для чтения; «Дублировать» создаёт редактируемую копию.
Core.point_conditions.GetConditionPointResourceV2(self, unit, cache)
local platform=self.Platform
local info=platform:GetClientInfo()
local policy=info.combatDataPolicy
if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
if not platform:CanReadValue(unit) then return nil,'restricted-value' end
if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
local record,reason=addon.Functions.cache.getCached(cache,pointIdentity,self,unit,playerClassCacheKey)
if not record then return nil,reason end
if not record.exists then return false end
local family=info.family
if policy=='probe' and (family=='era' or family=='progression') then return editionPointResource(platform,info,unit,record.class,cache) end
local points=self.points
if not platform:CanReadValue(points) then return nil,'restricted-value' end
if type(points)~='table' then return nil,'invalid-point-resource-map' end
local fallbackEnum,fallbackTypes
local ok,selected=pcall(function() return points[record.class] end)
if not ok then return nil,'api-error' end
if not platform:CanReadValue(selected) then return nil,'restricted-value' end
if selected==nil or selected==false then
local enum=Enum
if not platform:CanReadValue(enum) then return nil,'restricted-value' end
if type(enum)~='table' then return nil,'point-resource-unavailable' end
local typesOK,types=pcall(function() return enum.PowerType end)
if not typesOK then return nil,'api-error' end
if not platform:CanReadValue(types) then return nil,'restricted-value' end
if type(types)~='table' then return nil,'point-resource-unavailable' end
local fallbackOK,fallback=pcall(function() return types.ComboPoints end)
if not fallbackOK then return nil,'api-error' end
selected=fallback
if not platform:CanReadValue(selected) then return nil,'restricted-value' end
fallbackEnum,fallbackTypes=enum,types
end
if selected==nil then return nil,'point-resource-unavailable' end
if type(selected)~='number' or selected~=selected or selected<0 or selected==math.huge or selected%1~=0 then return nil,'invalid-point-resource' end
if policy=='restricted' and not platform:IsNeverSecretPointPower(selected) then return nil,'unsupported-policy' end
local transport='power'
if unit=='player' and fallbackTypes then
local rawTypes,rawCombo=rawget(fallbackEnum,'PowerType'),rawget(fallbackTypes,'ComboPoints')
if platform:CanReadValue(pointComboTypes) and (not canaccessvalue or canaccessvalue(pointComboTypes))
and platform:CanReadValue(rawTypes) and (not canaccessvalue or canaccessvalue(rawTypes))
and rawequal(fallbackTypes,pointComboTypes) and rawequal(rawTypes,fallbackTypes)
and platform:CanReadValue(rawCombo) and (not canaccessvalue or canaccessvalue(rawCombo)) and rawCombo==selected
and platform:CanReadValue(pointComboValue) and (not canaccessvalue or canaccessvalue(pointComboValue))
and pointComboValue==selected then
local family
if platform:CanReadValue(info) and type(info)=='table' then family=rawget(info,'family') end
if platform:CanReadValue(family) and (not canaccessvalue or canaccessvalue(family)) and family=='tbc' then transport='target-combo' end
end
end
return selected,nil,transport




