|
| 1 | +class TurboKartRacersMap { |
| 2 | + /** |
| 3 | + * @param {object} data TurboKartRacers data |
| 4 | + * @param {string} mapName TurboKartRacers Map |
| 5 | + */ |
| 6 | + constructor(data, mapName) { |
| 7 | + /** |
| 8 | + * Map |
| 9 | + * @type {string} |
| 10 | + */ |
| 11 | + this.map = mapName; |
| 12 | + /** |
| 13 | + * Plays |
| 14 | + * @type {number} |
| 15 | + */ |
| 16 | + this.plays = data[`${mapName}_plays`] || 0; |
| 17 | + /** |
| 18 | + * Box Pickups |
| 19 | + * @type {number} |
| 20 | + */ |
| 21 | + this.boxPickups = data[`box_pickups_${mapName}`] || 0; |
| 22 | + /** |
| 23 | + * Bronze Trophies |
| 24 | + * @type {number} |
| 25 | + */ |
| 26 | + this.bronzeTrophies = data[`bronze_trophy_${mapName}`] || 0; |
| 27 | + /** |
| 28 | + * Silver Trophies |
| 29 | + * @type {number} |
| 30 | + */ |
| 31 | + this.silverTrophies = data[`silver_trophy_${mapName}`] || 0; |
| 32 | + /** |
| 33 | + * Gold Trophies |
| 34 | + * @type {number} |
| 35 | + */ |
| 36 | + this.goldTrophies = data[`gold_trophy_${mapName}`] || 0; |
| 37 | + } |
| 38 | +} |
| 39 | + |
1 | 40 | /** |
2 | 41 | * TurboKartRacers class |
3 | 42 | */ |
@@ -41,136 +80,36 @@ class TurboKartRacers { |
41 | 80 | * @type {number} |
42 | 81 | */ |
43 | 82 | this.boxPickups = data.box_pickups || 0; |
44 | | - /** |
45 | | - * HypixelGP Box pickups |
46 | | - * @type {number} |
47 | | - */ |
48 | | - this.hypixelgpBoxPickups = data.box_pickups_hypixelgp || 0; |
49 | | - /** |
50 | | - * Retro Box pickups |
51 | | - * @type {number} |
52 | | - */ |
53 | | - this.retroBoxPickups = data.box_pickups_retro || 0; |
54 | | - /** |
55 | | - * Olympus Box pickups |
56 | | - * @type {number} |
57 | | - */ |
58 | | - this.olympusBoxPickups = data.box_pickups_olympus || 0; |
59 | | - /** |
60 | | - * Canyon Box pickups |
61 | | - * @type {number} |
62 | | - */ |
63 | | - this.canyonBoxPickups = data.box_pickups_canyon || 0; |
64 | | - /** |
65 | | - * Jungle Rusg Box pickups |
66 | | - * @type {number} |
67 | | - */ |
68 | | - this.junglerushBoxPickups = data.box_pickups_junglerush || 0; |
69 | 83 | /** |
70 | 84 | * Horn |
71 | 85 | * @type {'DEFAULT' | 'SHY' | 'ALIEN' | 'TAXI' | 'KLAXON' | 'TRICYCLE' | 'ALARM' | 'KLOON' | 'TEDDY' | 'TRUCK' | 'JERRY'} |
72 | 86 | */ |
73 | 87 | this.horn = data.horn || 'DEFAULT'; |
74 | 88 | /** |
75 | | - * Retro Map Plays |
76 | | - * @type {number} |
| 89 | + * retro Map Stats |
| 90 | + * @type {TurboKartRacersMap} |
77 | 91 | */ |
78 | | - this.retroPlays = data.retro_plays || 0; |
| 92 | + this.retro = new TurboKartRacersMap(data, 'retro'); |
79 | 93 | /** |
80 | | - * Hypixel GP Map Plays |
81 | | - * @type {number} |
| 94 | + * HypixelHP Map Stats |
| 95 | + * @type {TurboKartRacersMap} |
82 | 96 | */ |
83 | | - this.hypixelgpPlays = data.hypixelgp_plays || 0; |
| 97 | + this.hypixelgp = new TurboKartRacersMap(data, 'hypixelgp'); |
84 | 98 | /** |
85 | | - * Olympus Map Plays |
86 | | - * @type {number} |
| 99 | + * Olympus Map Stats |
| 100 | + * @type {TurboKartRacersMap} |
87 | 101 | */ |
88 | | - this.olympusPlays = data.olympus_plays || 0; |
| 102 | + this.olympus = new TurboKartRacersMap(data, 'olympus'); |
89 | 103 | /** |
90 | | - * Jungle Rush Map Plays |
91 | | - * @type {number} |
92 | | - */ |
93 | | - this.junglerushPlays = data.junglerush_plays || 0; |
94 | | - /** |
95 | | - * Canyon Map Plays |
96 | | - * @type {number} |
| 104 | + * Jungle Rush Map Stats |
| 105 | + * @type {TurboKartRacersMap} |
97 | 106 | */ |
98 | | - this.canyonPlays = data.canyon_plays || 0; |
| 107 | + this.junglerush = new TurboKartRacersMap(data, 'junglerush'); |
99 | 108 | /** |
100 | | - * Retro Bronze Trophies |
101 | | - * @type {number} |
102 | | - */ |
103 | | - this.retroBronzeTrophies = data.bronze_trophy_retro || 0; |
104 | | - /** |
105 | | - * Jungle Rush Map Plays |
106 | | - * @type {number} |
107 | | - */ |
108 | | - this.retroSilverTrophies = data.silver_trophy_retro || 0; |
109 | | - /** |
110 | | - * Jungle Rush Map Plays |
111 | | - * @type {number} |
112 | | - */ |
113 | | - this.retroGoldTrophies = data.gold_trophy_retro || 0; |
114 | | - /** |
115 | | - * hypixelgp Bronze Trophies |
116 | | - * @type {number} |
117 | | - */ |
118 | | - this.hypixelgpBronzeTrophies = data.bronze_trophy_hypixelgp || 0; |
119 | | - /** |
120 | | - * hypixelgp Silver Trophies |
121 | | - * @type {number} |
122 | | - */ |
123 | | - this.hypixelgpSilverTrophies = data.silver_trophy_hypixelgp || 0; |
124 | | - /** |
125 | | - * hypixelgp Gold Trophies |
126 | | - * @type {number} |
127 | | - */ |
128 | | - this.hypixelgpGoldTrophies = data.gold_trophy_hypixelgp || 0; |
129 | | - /** |
130 | | - * olympus Bronze Trophies |
131 | | - * @type {number} |
132 | | - */ |
133 | | - this.olympusBronzeTrophies = data.bronze_trophy_olympus || 0; |
134 | | - /** |
135 | | - * olympus Silver Trophies |
136 | | - * @type {number} |
137 | | - */ |
138 | | - this.olympusSilverTrophies = data.silver_trophy_olympus || 0; |
139 | | - /** |
140 | | - * olympus Gold Trophies |
141 | | - * @type {number} |
142 | | - */ |
143 | | - this.olympusGoldTrophies = data.gold_trophy_olympus || 0; |
144 | | - /** |
145 | | - * junglerush Bronze Trophies |
146 | | - * @type {number} |
147 | | - */ |
148 | | - this.junglerushBronzeTrophies = data.bronze_trophy_junglerush || 0; |
149 | | - /** |
150 | | - * junglerush Silver Trophies |
151 | | - * @type {number} |
152 | | - */ |
153 | | - this.junglerushSilverTrophies = data.silver_trophy_junglerush || 0; |
154 | | - /** |
155 | | - * junglerush Gold Trophies |
156 | | - * @type {number} |
157 | | - */ |
158 | | - this.junglerushGoldTrophies = data.gold_trophy_junglerush || 0; |
159 | | - /** |
160 | | - * Canyon Bronze Trophies |
161 | | - * @type {number} |
162 | | - */ |
163 | | - this.canyonBronzeTrophies = data.gold_trophy_canyon || 0; |
164 | | - /** |
165 | | - * Canyon Silver Trophies |
166 | | - * @type {number} |
167 | | - */ |
168 | | - this.canyonSilverTrophies = data.gold_trophy_canyon || 0; |
169 | | - /** |
170 | | - * Canyon Gold Trophies |
171 | | - * @type {number} |
| 109 | + * Canyon Map Stats |
| 110 | + * @type {TurboKartRacersMap} |
172 | 111 | */ |
173 | | - this.canyonGoldTrophies = data.gold_trophy_canyon || 0; |
| 112 | + this.canyon = new TurboKartRacersMap(data, 'canyon'); |
174 | 113 | /** |
175 | 114 | * Bananas Recived |
176 | 115 | * @type {number} |
@@ -198,4 +137,5 @@ class TurboKartRacers { |
198 | 137 | this.grandPrixTokens = data.grand_prix_tokens || 0; |
199 | 138 | } |
200 | 139 | } |
| 140 | + |
201 | 141 | module.exports = TurboKartRacers; |
0 commit comments