Chiamala come
Conditions.equipment.matches(value, record)
Registra la dipendenza Conditions.equipment.matches, poi chiamala con quel nome. Una chiamata con spazio dei nomi non passa self: usa una chiamata con i due punti o passa tu l'oggetto.
Cosa fa
Tests one equipment slot record against a WEAPON_TYPE condition: empty slot, shield, any weapon, holdable, one-hand, two-hand, ranged, or a specific weapon subclass. Returns nil with a reason when the item's class or equip location is not known yet.
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
value | table | Condition settings: kind (empty, shield, weapon, holdable, onehand, twohand or ranged) or a weapon subclass ID in subclass. |
record | table | boolean | Slot record with classID, subClassID, equipLoc and an optional typeReason, or false for an empty slot. |
Valori restituiti
| 1 | boolean | nil | Whether the slot matches, or nil when it cannot be decided. |
|---|---|---|
| 2 | string | nil | Reason for nil: the record's typeReason, item-data-unavailable or invalid-weapon-type. |
Edizioni
Le funzioni di supporto integrate sono registrate su ogni edizione. Ciò che cambia è l'API di gioco che leggono; dove ne manca una, la funzione di supporto ripiega su un'alternativa o restituisce nil con un motivo.
Non legge direttamente alcuna API di gioco.
Come la chiama l'addon
- Tipo di arma (evaluate)
return matches(value, record)
Dipendenze
ARMOR_CLASS(builtin:Conditions/equipment.lua:ARMOR_CLASS)ONEHAND(builtin:Conditions/equipment.lua:ONEHAND)RANGED(builtin:Conditions/equipment.lua:RANGED)SHIELD_SUBCLASS(builtin:Conditions/equipment.lua:SHIELD_SUBCLASS)WEAPON_CLASS(builtin:Conditions/equipment.lua:WEAPON_CLASS)
Sorgente
Conditions/equipment.lua, riga 119. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Conditions.equipment.matches(value, record)
if record == false then return value.kind == "empty" end
if value.kind == "empty" then return false end
if record.classID == nil then return nil, record.typeReason or "item-data-unavailable" end
if value.subclass ~= nil then
return record.classID == WEAPON_CLASS and record.subClassID == value.subclass
end
local kind = value.kind
if kind == "shield" then return record.classID == ARMOR_CLASS and record.subClassID == SHIELD_SUBCLASS end
if kind == "weapon" then return record.classID == WEAPON_CLASS end
if record.equipLoc == nil then return nil, "item-data-unavailable" end
if kind == "holdable" then return record.equipLoc == "INVTYPE_HOLDABLE" end
if record.classID ~= WEAPON_CLASS then return false end
if kind == "onehand" then return ONEHAND[record.equipLoc] == true end
if kind == "twohand" then return record.equipLoc == "INVTYPE_2HWEAPON" end
if kind == "ranged" then return RANGED[record.equipLoc] == true end
return nil, "invalid-weapon-type"