count 查找指定的物品或装备数量
count
类型: MethodDeclaration
所属类: Inventory
定义位置: actor.ts
描述
查找指定的物品或装备数量
参数 id
: 物品或装备的文件ID
返回值:货物的数量
参数
参数名 | 类型 | 描述 | 默认值 |
---|---|---|---|
id | string | - | - |
返回值
类型: number
货物的数量
源代码
位置: 第 4451 行
public count(id: string): number {
const list = this.getList(id)
if (!list) return 0
let count = 0
for (const goods of list) {
count += goods instanceof Item ? goods.quantity : 1
}
return count
}
文档生成时间:2025/7/7 12:07:06