File structure

This commit is contained in:
2022-03-12 03:35:35 +03:00
parent dcb3c2102e
commit 1e397af280
41 changed files with 1314 additions and 223 deletions

View File

@@ -0,0 +1,11 @@
const Item = require('./Item')
module.exports = class Archwings extends Item {
constructor (name) {
super(name)
this.addPart('harness')
this.addPart('wings')
this.addPart('systems')
}
}

View File

@@ -0,0 +1,11 @@
const Item = require('./Item')
module.exports = class Companion extends Item {
constructor (name) {
super(name)
this.addPart('carapace')
this.addPart('cerebrum')
this.addPart('systems')
}
}

15
gather/src/items/Item.js Normal file
View File

@@ -0,0 +1,15 @@
const Part = require('./Part')
module.exports = class Item {
constructor (name) {
this.name = name
this.set = new Part(name, 'set')
this.parts = []
this.addPart('blueprint')
}
addPart (part, amount) {
this.parts.push(new Part(this.name, part, amount))
}
}

14
gather/src/items/Part.js Normal file
View File

@@ -0,0 +1,14 @@
const Api = require('../api')
module.exports = class Part {
constructor (set, part, amount) {
this.part = part
this.url = `${set}_prime_${part}`
this.amount = amount ?? 1
}
async getPrice () {
const orders = await Api.getSortedOrders(this.url)
return Number(orders[0].platinum) * this.amount
}
}

View File

@@ -0,0 +1,11 @@
const Item = require('./Item')
module.exports = class Primary extends Item {
constructor (name) {
super(name)
this.addPart('barrel')
this.addPart('receiver')
this.addPart('stock')
}
}

View File

@@ -0,0 +1,11 @@
const Item = require('./Item')
module.exports = class Secondary extends Item {
constructor (name) {
super(name)
this.addPart('barrel', 2)
this.addPart('receiver', 2)
this.addPart('link')
}
}

View File

@@ -0,0 +1,11 @@
const Item = require('./Item')
module.exports = class Warframe extends Item {
constructor (name) {
super(name)
this.addPart('systems')
this.addPart('neuroptics')
this.addPart('chassis')
}
}

26
gather/src/items/index.js Normal file
View File

@@ -0,0 +1,26 @@
const items = require('./items.json')
const Warframe = require('./Warframe')
// const Primary = require('./Primary')
// const Secondary = require('./Secondary')
const Companion = require('./Companion')
const Archwings = require('./Archwings')
const result = []
items.warframes.forEach((name) => {
result.push(new Warframe(name))
})
// items.primaries.forEach((name) => {
// result.push(new Primary(name))
// })
items.companions.forEach((name) => {
result.push(new Companion(name))
})
items.archwings.forEach((name) => {
result.push(new Archwings(name))
})
module.exports = result

View File

@@ -0,0 +1,22 @@
{
"warframes": [
"ash", "atlas", "banshee", "chroma", "ember",
"equinox", "frost", "gara", "harrow", "hydroid",
"inaros", "ivara", "limbo", "loki", "mag",
"mesa", "mirage", "nekros", "nezha", "nidus",
"nova", "nyx", "oberon", "octavia", "rhino",
"saryn", "titania", "trinity", "valkyr", "vauban",
"volt", "wukong", "zephyr"
],
"primaries": [
"astilla", "baza", "boar", "boltor", "braton",
"burston", "corinth", "larton", "panthera",
"rubico", "scourge", "soma", "stradavar",
"strun", "sybaris", "tenora", "tiberon", "tigris",
"vectis", "zhuge"
],
"companions": [
"carrier", "dethcube", "helios", "wyrm"
],
"archwings": ["odonata"]
}