Migrate to yarn
This commit is contained in:
24
gather/src/items/Part.ts
Normal file
24
gather/src/items/Part.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user