呼叫方式
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'




