调用方式
Core.point_conditions.editionPointResource(platform, info, unit, class, cache)
记录依赖项 Core.point_conditions.editionPointResource,然后按该名称调用。带命名空间的调用不会传入 self:请使用冒号调用,或自行传入该对象。
作用
Selects the point resource for era and progression clients from the addon's per-edition map (combo points, Holy Power, Soul Shards, Chi, Shadow Orbs and similar). When the resource depends on specialization, only the player can be resolved.
参数
| 名称 | 类型 | 作用 |
|---|---|---|
platform | RMPlatform | Platform used for readability checks and the player's specialization. |
info | table | Client info with family and, on progression clients, expansion. |
unit | string | Unit token the resource is for. |
class | string | The unit's class file token. |
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
返回值
| 1 | number | nil | Enum.PowerType value of the selected resource, or nil when unavailable. |
|---|---|---|
| 2 | string | nil | Nil on success; otherwise the reason, such as unsupported-point-expansion, point-specialization-unavailable, point-resource-unavailable or invalid-point-resource. |
| 3 | string | nil | "power" on success, marking the selector as a power type; absent on failure. |
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
- 该版本不可用(原因见提示)
- 仅在暴雪的弃用兼容层开启时
| 游戏 API | |||||
|---|---|---|---|---|---|
Enum |
秘密值(正式服和永久服)
在正式服和永久服上,游戏交给插件的是秘密值。此辅助函数会检查它读取的内容(addon.Platform:CanReadValue),遇到无法比较的秘密值时返回 nil 并附上原因(例如 restricted-value),而不是返回该秘密值。请将 nil 视为不可用,而不是假。
插件如何调用它
Core.point_conditions.GetConditionPointResourceV2if policy=='probe' and (family=='era' or family=='progression') then return editionPointResource(platform,info,unit,record.class,cache) end
依赖项
editionPointPowers(builtin:Core/point_conditions.lua:editionPointPowers)
源码
Core/point_conditions.lua,第 163 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
Core.point_conditions.editionPointResource(platform, info, unit, class, cache)
local family=info.family
local map=editionPointPowers[family]
if family=='progression' then
local expansion=info.expansion
if not platform:CanReadValue(expansion) then return nil,'restricted-value' end
if type(expansion)~='number' then return nil,'unsupported-point-expansion' end
map=map[expansion]
if map==nil then return nil,'unsupported-point-expansion' end
end
local name=map[class]
if type(name)=='table' then
-- Only the player's own specialization is readable.
if unit~='player' then return nil,'point-specialization-unavailable' end
local spec,why=addon.Functions.cache.getCached(cache,platform.GetPlayerSpecializationIndex,platform)
if spec==nil then return nil,why end
name=name[spec]
end
if name==nil then return nil,'point-resource-unavailable' end
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 types=rawget(enum,'PowerType')
if not platform:CanReadValue(types) then return nil,'restricted-value' end
if type(types)~='table' then return nil,'point-resource-unavailable' end
local selected=rawget(types,name)
if not platform:CanReadValue(selected) then return nil,'restricted-value' 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
return selected,nil,'power'




