Référence › Référence des fonctions › Core

Core.point_conditions.editionPointResource

dépendance

Appel

Core.point_conditions.editionPointResource(platform, info, unit, class, cache)

Enregistrez la dépendance Core.point_conditions.editionPointResource, puis appelez-la sous ce nom. Un appel par espace de noms ne transmet pas self : utilisez un appel avec deux-points ou passez l'objet vous-même.

Ce qu'elle fait

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.

Arguments

NomTypeCe qu'elle fait
platformRMPlatformPlatform used for readability checks and the player's specialization.
infotableClient info with family and, on progression clients, expansion.
unitstringUnit token the resource is for.
classstringThe unit's class file token.
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.

Retours

1number | nilEnum.PowerType value of the selected resource, or nil when unavailable.
2string | nilNil on success; otherwise the reason, such as unsupported-point-expansion, point-specialization-unavailable, point-resource-unavailable or invalid-point-resource.
3string | nil"power" on success, marking the selector as a power type; absent on failure.

Éditions

Les fonctions utilitaires intégrées sont enregistrées sur toutes les éditions. Ce qui diffère, c'est l'API du jeu qu'elles lisent ; quand l'une manque, la fonction utilitaire se rabat sur une alternative ou renvoie nil avec une raison.

  • Indisponible sur cette édition (la raison figure dans l'infobulle)
  • Uniquement tant que les solutions de repli de Blizzard pour les fonctions obsolètes sont actives
API du jeuClassic EraTBC AnniversaryClassic ProgressionForeverRetail
EnumClassic EraTBC AnniversaryClassic ProgressionForeverRetail

Valeurs secrètes (Retail et Forever)

Sur Retail et Forever, le jeu transmet aux addons des valeurs secrètes. Cette fonction utilitaire vérifie ce qu'elle lit (addon.Platform:CanReadValue) et renvoie nil avec une raison telle que restricted-value au lieu d'une valeur secrète qu'elle ne peut pas comparer. Traitez nil comme indisponible, pas comme false.

Comment l'addon l'appelle

Dépendances

Source

Core/point_conditions.lua, ligne 163. En lecture seule dans le jeu ; Dupliquer crée une copie modifiable.

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'

Retour à Référence des fonctions