Skip to content

Commit 63b5955

Browse files
committed
Remove UpgradeData.uid property
1 parent 4c370bb commit 63b5955

File tree

3 files changed

+46
-84
lines changed

3 files changed

+46
-84
lines changed

src/ts/clickercookie.ts

Lines changed: 40 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export default class ClickerCookie extends Mod {
109109
public church: Building;
110110

111111
// upgrades
112-
public readonly UPGRADES_DATA: UpgradeData[];
112+
public readonly UPGRADES_DATA: Record<string, UpgradeData>;
113113
public readonly BUILDINGS_DATA: Record<string, BuildingData>;
114114

115115
constructor() {
@@ -193,10 +193,9 @@ export default class ClickerCookie extends Mod {
193193
this.church.setVisibility(false);
194194

195195
// upgrades
196-
this.UPGRADES_DATA = [
196+
this.UPGRADES_DATA = {
197197
// keyboard
198-
{
199-
uid: "keyboard1",
198+
"keyboard1": {
200199
name: "Reinforced Keys",
201200
quote: "press harder",
202201
price: 100,
@@ -206,8 +205,7 @@ export default class ClickerCookie extends Mod {
206205
buildingsRequired: 1,
207206
multiplyCookiesPerClick: true
208207
},
209-
{
210-
uid: "keyboard2",
208+
"keyboard2": {
211209
name: "Obsidian Keys",
212210
quote: "so heavy they're always pressed",
213211
price: 500,
@@ -217,8 +215,7 @@ export default class ClickerCookie extends Mod {
217215
buildingsRequired: 5,
218216
multiplyCookiesPerClick: true
219217
},
220-
{
221-
uid: "keyboard3",
218+
"keyboard3": {
222219
name: "Osmium Keys",
223220
quote: "that's very heavy",
224221
price: 10_000,
@@ -228,8 +225,7 @@ export default class ClickerCookie extends Mod {
228225
buildingsRequired: 10,
229226
multiplyCookiesPerClick: true
230227
},
231-
{
232-
uid: "keyboard4",
228+
"keyboard4": {
233229
name: "10 finger typing",
234230
quote: "<i><b>efficiency</b></i>", //? your middle school ict teacher would be so proud
235231
price: 100_000,
@@ -239,8 +235,7 @@ export default class ClickerCookie extends Mod {
239235
buildingsRequired: 25,
240236
multiplyCookiesPerClick: true
241237
},
242-
{
243-
uid: "keyboard5",
238+
"keyboard5": {
244239
name: "Macros",
245240
quote: "why press when you don't have to?",
246241
price: 1_000_000,
@@ -251,8 +246,7 @@ export default class ClickerCookie extends Mod {
251246
multiplyCookiesPerClick: true
252247
},
253248
// grandpa
254-
{
255-
uid: "grandpa1",
249+
"grandpa1": {
256250
name: "Hardwood Walking Stick",
257251
quote: "nonna dat softwood junk",
258252
price: 1_000,
@@ -261,8 +255,7 @@ export default class ClickerCookie extends Mod {
261255
building: this.grandpa,
262256
buildingsRequired: 1
263257
},
264-
{
265-
uid: "grandpa2",
258+
"grandpa2": {
266259
name: "Rocking Chair",
267260
quote: "newest addition to the porch*", //? because his butt problems weren't bad enough
268261
price: 5_000,
@@ -271,8 +264,7 @@ export default class ClickerCookie extends Mod {
271264
building: this.grandpa,
272265
buildingsRequired: 5
273266
},
274-
{
275-
uid: "grandpa3",
267+
"grandpa3": {
276268
name: "Reading Glasses",
277269
quote: "helps with precise chocolate chip placement",
278270
price: 50_000,
@@ -281,8 +273,7 @@ export default class ClickerCookie extends Mod {
281273
building: this.grandpa,
282274
buildingsRequired: 10
283275
},
284-
{
285-
uid: "grandpa4",
276+
"grandpa4": {
286277
name: "Dementia Pills",
287278
quote: "what was i doing again?",
288279
price: 5_000_000,
@@ -291,8 +282,7 @@ export default class ClickerCookie extends Mod {
291282
building: this.grandpa,
292283
buildingsRequired: 25
293284
},
294-
{
295-
uid: "grandpa5",
285+
"grandpa5": {
296286
name: "shotgun",
297287
quote: "grandpa's precious*",
298288
price: 500_000_000,
@@ -302,8 +292,7 @@ export default class ClickerCookie extends Mod {
302292
buildingsRequired: 50
303293
},
304294
// ranch
305-
{
306-
uid: "ranch1",
295+
"ranch1": {
307296
name: "Pig Slop",
308297
quote: "Wait, what have we been feeding them before now?*",
309298
price: 11_000,
@@ -312,8 +301,7 @@ export default class ClickerCookie extends Mod {
312301
building: this.ranch,
313302
buildingsRequired: 1
314303
},
315-
{
316-
uid: "ranch2",
304+
"ranch2": {
317305
name: "Needle bale",
318306
quote: "talk about a hay in a needlestack",
319307
price: 55_000,
@@ -322,8 +310,7 @@ export default class ClickerCookie extends Mod {
322310
building: this.ranch,
323311
buildingsRequired: 5
324312
},
325-
{
326-
uid: "ranch3",
313+
"ranch3": {
327314
name: "Tractors",
328315
quote: "eliminating manual labor since 1892",
329316
price: 550_000,
@@ -332,8 +319,7 @@ export default class ClickerCookie extends Mod {
332319
building: this.ranch,
333320
buildingsRequired: 10
334321
},
335-
{
336-
uid: "ranch4",
322+
"ranch4": {
337323
name: "Big baconator",
338324
quote: "think giant pig mech fueled by potatoes",
339325
price: 55_000_000,
@@ -342,8 +328,7 @@ export default class ClickerCookie extends Mod {
342328
building: this.ranch,
343329
buildingsRequired: 25
344330
},
345-
{
346-
uid: "ranch5",
331+
"ranch5": {
347332
name: "Ranch dressing",
348333
quote: "Wrong ranch.",
349334
price: 5_500_000_000,
@@ -353,8 +338,7 @@ export default class ClickerCookie extends Mod {
353338
buildingsRequired: 50
354339
},
355340
// television
356-
{
357-
uid: "television1",
341+
"television1": {
358342
name: "Streaming service",
359343
quote: "cookie-flix",
360344
price: 120_000,
@@ -363,8 +347,7 @@ export default class ClickerCookie extends Mod {
363347
building: this.television,
364348
buildingsRequired: 1
365349
},
366-
{
367-
uid: "television2",
350+
"television2": {
368351
name: "98-inch screen",
369352
quote: "unnecessarily large is an understatement.",
370353
price: 600_000,
@@ -373,8 +356,7 @@ export default class ClickerCookie extends Mod {
373356
building: this.television,
374357
buildingsRequired: 5
375358
},
376-
{
377-
uid: "television3",
359+
"television3": {
378360
name: "Surround sound",
379361
quote: "it's all around me!",
380362
price: 6_000_000,
@@ -383,8 +365,7 @@ export default class ClickerCookie extends Mod {
383365
building: this.television,
384366
buildingsRequired: 10
385367
},
386-
{
387-
uid: "television4",
368+
"television4": {
388369
name: "OLED Display",
389370
quote: "s*** it burned in...",
390371
price: 60_0000_000,
@@ -393,8 +374,7 @@ export default class ClickerCookie extends Mod {
393374
building: this.television,
394375
buildingsRequired: 25
395376
},
396-
{
397-
uid: "television5",
377+
"television5": {
398378
name: "8K resolution",
399379
quote: "so many pixels!",
400380
price: 60_000_000_000,
@@ -404,8 +384,7 @@ export default class ClickerCookie extends Mod {
404384
buildingsRequired: 50
405385
},
406386
// worker
407-
{
408-
uid: "worker1",
387+
"worker1": {
409388
name: "Medkits",
410389
quote: "Constant supply of Band-Aids in case of emergency",
411390
price: 1_300_000,
@@ -414,8 +393,7 @@ export default class ClickerCookie extends Mod {
414393
building: this.worker,
415394
buildingsRequired: 1
416395
},
417-
{
418-
uid: "worker2",
396+
"worker2": {
419397
name: "Hard hats",
420398
quote: "Keep those skulls safe!*",
421399
price: 6_500_000,
@@ -424,8 +402,7 @@ export default class ClickerCookie extends Mod {
424402
building: this.worker,
425403
buildingsRequired: 5
426404
},
427-
{
428-
uid: "worker3",
405+
"worker3": {
429406
name: "Fast fingers*",
430407
quote: "upmost efficient cookie manufacturing*",
431408
price: 65_000_000,
@@ -434,8 +411,7 @@ export default class ClickerCookie extends Mod {
434411
building: this.worker,
435412
buildingsRequired: 10
436413
},
437-
{
438-
uid: "worker4",
414+
"worker4": {
439415
name: "Weight training",
440416
quote: "firmly attach chocolate chips via brute force",
441417
price: 6_500_000_000,
@@ -444,8 +420,7 @@ export default class ClickerCookie extends Mod {
444420
building: this.worker,
445421
buildingsRequired: 25
446422
},
447-
{
448-
uid: "worker5",
423+
"worker5": {
449424
name: "Robot workers",
450425
quote: "robotic precision",
451426
price: 650_000_000_000,
@@ -455,8 +430,7 @@ export default class ClickerCookie extends Mod {
455430
buildingsRequired: 50
456431
},
457432
// wallet
458-
{
459-
uid: "wallet1",
433+
"wallet1": {
460434
name: "200 dollar bills",
461435
quote: "I'm sure the federal reserve will be okay with this...*",
462436
price: 14_000_000,
@@ -465,8 +439,7 @@ export default class ClickerCookie extends Mod {
465439
building: this.wallet,
466440
buildingsRequired: 1
467441
},
468-
{
469-
uid: "wallet2",
442+
"wallet2": {
470443
name: "Credit cards",
471444
quote: "cookies but digitized",
472445
price: 70_000_000,
@@ -475,8 +448,7 @@ export default class ClickerCookie extends Mod {
475448
building: this.wallet,
476449
buildingsRequired: 5
477450
},
478-
{
479-
uid: "wallet3",
451+
"wallet3": {
480452
name: "Tax refund",
481453
quote: "for when you overbake to the IRS*",
482454
price: 700_000_000,
@@ -485,8 +457,7 @@ export default class ClickerCookie extends Mod {
485457
building: this.wallet,
486458
buildingsRequired: 10
487459
},
488-
{
489-
uid: "wallet4",
460+
"wallet4": {
490461
name: "safe",
491462
quote: "you can keep your cookies even <b>safe</b>r!!",
492463
price: 70_000_000_000,
@@ -495,8 +466,7 @@ export default class ClickerCookie extends Mod {
495466
building: this.wallet,
496467
buildingsRequired: 25
497468
},
498-
{
499-
uid: "wallet5",
469+
"wallet5": {
500470
name: "Wizard\'s wallet",
501471
quote: "<b>infinite</b> storage space*",
502472
price: 7_000_000_000_000,
@@ -506,8 +476,7 @@ export default class ClickerCookie extends Mod {
506476
buildingsRequired: 50
507477
},
508478
// church
509-
{
510-
uid: "church1",
479+
"church1": {
511480
name: "the pope",
512481
quote: "his holiness will provide many cookies",
513482
price: 200_000_000,
@@ -516,8 +485,7 @@ export default class ClickerCookie extends Mod {
516485
building: this.church,
517486
buildingsRequired: 1
518487
},
519-
{
520-
uid: "church2",
488+
"church2": {
521489
name: "Cookie study",
522490
quote: "learning about our baking lord's best recipes",
523491
price: 1_000_000_000,
@@ -526,8 +494,7 @@ export default class ClickerCookie extends Mod {
526494
building: this.church,
527495
buildingsRequired: 5
528496
},
529-
{
530-
uid: "church3",
497+
"church3": {
531498
name: "Cookie ritual",
532499
quote: "summon cookies from the underworld",
533500
price: 10_000_000_000,
@@ -536,8 +503,7 @@ export default class ClickerCookie extends Mod {
536503
building: this.church,
537504
buildingsRequired: 10
538505
},
539-
{
540-
uid: "church4",
506+
"church4": {
541507
name: "Cookie gods",
542508
quote: "Worship them, lest their power overwhelm your mortal form.",
543509
price: 1_000_000_000_000,
@@ -546,8 +512,7 @@ export default class ClickerCookie extends Mod {
546512
building: this.church,
547513
buildingsRequired: 25
548514
},
549-
{
550-
uid: "church5",
515+
"church5": {
551516
name: "Cible",
552517
quote: "Get it? <b>c</b>ookie-b<b>ible</b>!<br><br>I'll see myself out.",
553518
price: 100_000_000_000_000,
@@ -556,7 +521,7 @@ export default class ClickerCookie extends Mod {
556521
building: this.church,
557522
buildingsRequired: 50
558523
}
559-
];
524+
};
560525

561526
Mod.registerKooh("click", () => { this.cookieClicked() });
562527
Mod.registerKooh("loop", () => { this.gameLoop() });
@@ -582,8 +547,8 @@ export default class ClickerCookie extends Mod {
582547
Handlers.BUILDING.register(new Identifier(this.NAMESPACE, "wallet"), this.wallet);
583548
Handlers.BUILDING.register(new Identifier(this.NAMESPACE, "church"), this.church);
584549

585-
for (const upgradeData of this.UPGRADES_DATA) {
586-
Handlers.UPGRADE.register(new Identifier(this.NAMESPACE, upgradeData.uid), new Upgrade(this, upgradeData));
550+
for (const uid in this.UPGRADES_DATA) {
551+
Handlers.UPGRADE.register(new Identifier(this.NAMESPACE, uid), new Upgrade(this, this.UPGRADES_DATA[uid]));
587552
}
588553

589554
// Register personalization things (must be before save load because loading requires these to be registered to set them)

0 commit comments

Comments
 (0)