Référence › Référence des fonctions › Conditions

Conditions.totem.findSpecific

dépendance

Appel

Conditions.totem.findSpecific(value, cache, start, compareTime)

Enregistrez la dépendance Conditions.totem.findSpecific, 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

Searches the totem slots for an active totem matching value.spell, by spell ID or name (only the exact spell ID when value.ranked is set). With compareTime it also requires the totem's remaining time, rounded to 3 decimals, to pass value.operator and value.value; an unreadable slot makes a non-match unavailable.

Arguments

NomTypeCe qu'elle fait
valuetableCondition settings: spell, ranked and, for timed checks, operator and value.
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.
startnumber | nilEvaluation start time; nil uses GetTime().
compareTimebooleanTrue to also compare the remaining time.

Retours

1boolean | nilTrue when a matching totem is found, false when none is, or nil when a slot could not be read.
2string | nilReason for nil, such as totem-data-unavailable, totem-rank-unavailable or totem-identity-unavailable.

É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.

Elle ne lit directement aucune API du jeu.

Comment l'addon l'appelle

Dépendances

Source

Conditions/totem.lua, ligne 102. En lecture seule dans le jeu ; Dupliquer crée une copie modifiable.

Conditions.totem.findSpecific(value, cache, start, compareTime)
    local target,reason=observe(cache,platform.GetSpellInfo,value.spell)
    if not target then return nil,reason end
    local count,why=observe(cache,platform.GetTotemSlotCount)
    if not count then return nil,why end
    local unavailable
    for slot=1,count do
        local record,problem=observe(cache,platform.GetTotemInfo,slot)
        if not record then unavailable=unavailable or problem or "totem-data-unavailable"
        elseif record.active and remaining(record,start)>0 then
            local matches=false
            if value.ranked then
                if record.spellID then matches=record.spellID==value.spell
                elseif record.name==target.name or record.name=="" then unavailable=unavailable or "totem-rank-unavailable" end
            else
                matches=record.spellID==value.spell or record.name==target.name
                if not matches and record.name=="" then
                    local info,issue
                    if record.spellID then info,issue=observe(cache,platform.GetSpellInfo,record.spellID) end
                    if info then matches=info.name==target.name
                    else unavailable=unavailable or issue or "totem-identity-unavailable" end
                end
            end
            if matches and (not compareTime or addon.compare(value.operator,addon.round(remaining(record,start),3),value.value)) then return true end
        end
    end
    if unavailable then return nil,unavailable end
    return false

Retour à Référence des fonctions