Files
warframe-center/gather/src/items/Part.ts
2022-07-07 00:51:28 +03:00

25 lines
558 B
TypeScript

import Api from '../api'
export default class Part {
part: string
urlPath: string
url: string
amount: number
constructor (set: string, part: string, amount: number = 1) {
this.part = part
this.urlPath = `${set}_prime_${part}`
this.url = `https://warframe.market/items/${set}_prime_${part}`
this.amount = amount ?? 1
}
async getPrice (): Promise<number> {
const orders = await Api.getSortedOrders(this.urlPath)
if (orders.length === 0) {
return 0
}
return Number(orders[0].platinum) * this.amount
}
}