-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple tracker.js
643 lines (612 loc) · 15.4 KB
/
simple tracker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
/* This is a web tracker for The Minish Cap made by cubesolver111
For any suggestions or questions, dm me on discord*/
//This section consists of variables for marking the items.
//If a variable has the word 'has' in it, it is a true/false variable
//that gets taoggled when clicked.
//If the variable is a number, there are multiple upgrades to the item or
//it is treated as a counter that is incremented on click, then reset after a certain point.
//The variables are broken up into 8 groups of 8 as they appear in the rows on the tracker.
//Color choices #453C3C, #877373
var color='#877373';
var sword = 0;
var hasJar = false;
var hasCane = false;
var boomerang = 0;
var wallet = 0;
var shield = 0;
var hasMitts = false;
var hasLantern = false;
var bombs = 0;
var stonesWilds = 0;
var hasBoots = false;
var hasCape = false;
var hasFlute = false;
var bow = 0;
var stonesClouds = 0;
var bottles = 0;
var hasJabber = false;
var hasMushroom = false;
var hasLLRKey = false;
var hasStonesFalls = false;
var hasGripRing = false;
var hasBracelets = false;
var hasFlippers = false;
var hasGraveKey = false;
var hasCarlov = false;
var hasEarth = false;
var hasFire = false;
var hasWater = false;
var hasWind = false;
var hasRed3 = false;
var hasSpin = false;
var hasRock = false;
var hasDash = false;
var hasThrust = false;
var hasLights = false;
var hasRoll = false;
var hasSwordBeam = false;
var hasPerilBeam = false;
var hasGreatSpin = false;
//This section handles the toggling and incrementing of each item.
//Like the variables, it is split up into 8 groups of 8 as the items appear
//in each row on the tracker.
//I could make every item with multiple upgrades use the same type of function as
//the kinstones and small keys, but I prefer the more descriptive image names.
//The only one I am considering changing to fit this style is the bow.
//Row 1
function changeSword() {
if (sword==0) {
$('#swords').css({filter:'grayscale(0%)'});
sword++;
}
else if (sword==1) {
$('#swords').attr('src', 'images/item sprites/Green Sword.png');
sword++;
}
else if (sword==2) {
$('#swords').attr('src', 'images/item sprites/Red Sword.png');
sword++;
}
else if(sword==3) {
$('#swords').attr('src', 'images/item sprites/Blue Sword.png');
sword++;
}
else if (sword==4) {
$('#swords').attr('src', 'images/item sprites/Four Sword.png');
sword++;
}
else {
$('#swords').attr('src', "images/item sprites/Smith's Sword.png");
$('#swords').css({filter:'grayscale(100%)'});
sword=0;
}
}
function changeJar() {
if(hasJar==false) {
$('#jar').css({filter:'grayscale(0%)'});
hasJar=true;
}
else {
$('#jar').css({filter:'grayscale(100%)'});
hasJar=false;
}
}
function changeCane() {
if(hasCane==false) {
$('#cane').css({filter:'grayscale(0%)'});
hasCane=true;
}
else {
$('#cane').css({filter:'grayscale(100%)'});
hasCane=false;
}
}
function changeRang() {
if(boomerang==0) {
$('#rang').css({filter:'grayscale(0%)'});
boomerang=1;
}
else if(boomerang==1) {
$('#rang').attr('src', 'images/item sprites/Magical Boomerang.png');
boomerang=2;
}
else {
$('#rang').attr('src', 'images/item sprites/Boomerang.png');
$('#rang').css({filter:'grayscale(100%)'});
boomerang=0;
}
}
function changeWallet() {
if(wallet==0) {
$('#wallet').attr('src', 'images/item sprites/Wallet300alt.png');
$('#wallet').css({filter:'grayscale(0%)'});
wallet++;
}
else if(wallet==1) {
$('#wallet').attr('src', 'images/item sprites/Wallet500alt.png');
wallet++;
}
else if(wallet==2) {
$('#wallet').attr('src', 'images/item sprites/Wallet999alt.png');
wallet++;
}
else {
$('#wallet').attr('src', 'images/item sprites/Wallet300.png');
$('#wallet').css({filter:'grayscale(100%)'});
wallet=0;
}
}
//Row 2
function changeShield() {
if(shield==0) {
$('#shields').css({filter:'grayscale(0%)'});
shield++;
}
else if (shield==1) {
$('#shields').attr('src','images/item sprites/Mirror Shield.png');
shield++;
}
else {
$('#shields').attr('src','images/item sprites/Small Shield.png');
$('#shields').css({filter:'grayscale(100%)'});
shield=0;
}
}
function changeMitts() {
if(hasMitts==false) {
$('#mitts').css({filter:'grayscale(0%)'});
hasMitts=true;
}
else {
$('#mitts').css({filter:'grayscale(100%)'});
hasMitts=false;
}
}
function changeLantern() {
if(hasLantern==false) {
$('#lantern').css({filter:'grayscale(0%)'});
$('#lantern').attr('src','images/item sprites/Flame Lantern (Lit).png');
hasLantern=true;
}
else {
$('#lantern').css({filter:'grayscale(100%)'});
$('#lantern').attr('src','images/item sprites/Flame Lantern.png');
hasLantern=false;
}
}
function changeBombs() {
if(bombs==0) {
$('#bomb').css({filter:'grayscale(0%)'});
$('#bomb').attr('src','images/item sprites/Bomb10.png');
bombs++;
}
else if(bombs==1) {
$('#bomb').attr('src','images/item sprites/Bomb30.png');
bombs++;
}
else if(bombs==2) {
$('#bomb').attr('src','images/item sprites/Bomb50.png');
bombs++;
}
else if(bombs==3) {
$('#bomb').attr('src','images/item sprites/Bomb99.png');
bombs++;
}
else {
$('#bomb').attr('src','images/item sprites/Bomb.png');
$('#bomb').css({filter:'grayscale(100%)'});
bombs=0;
}
}
function changeStonesWilds() {
if (stonesWilds<3) {
stonesWilds++;
$('#goldWilds').attr('src','images/item sprites/Kinstones/Gold Kinstone (Wilds)' + stonesWilds +'.png');
$('#goldWilds').css({filter:'grayscale(0%)'});
}
else {
$('#goldWilds').attr('src','images/item sprites/Kinstones/Gold Kinstone (Wilds).png');
$('#goldWilds').css({filter:'grayscale(100%)'});
stonesWilds=0;
}
}
//Row 3
function changeBoots() {
if(hasBoots==false) {
$('#boots').css({filter:'grayscale(0%)'});
hasBoots=true;
}
else {
$('#boots').css({filter:'grayscale(100%)'});
hasBoots=false;
}
}
function changeCape() {
if(hasCape==false) {
$('#cape').css({filter:'grayscale(0%)'});
hasCape=true;
}
else {
$('#cape').css({filter:'grayscale(100%)'});
hasCape=false;
}
}
function changeFlute() {
if(hasFlute==false) {
$('#ocarina').css({filter:'grayscale(0%)'});
hasFlute=true;
}
else {
$('#ocarina').css({filter:'grayscale(100%)'});
hasFlute=false;
}
}
function changeBow() {
if(bow==0) {
$('#bow').css({filter:'grayscale(0%)'});
$('#bow').attr('src','images/item sprites/Bow30.png');
bow++;
}
else if (bow==1) {
$('#bow').attr('src','images/item sprites/Bow50.png');
bow++;
}
else if (bow==2) {
$('#bow').attr('src','images/item sprites/Bow70.png');
bow++;
}
else if (bow==3) {
$('#bow').attr('src','images/item sprites/Bow99.png');
bow++;
}
else {
$('#bow').attr('src','images/item sprites/Bow.png');
$('#bow').css({filter:'grayscale(100%)'});
bow=0;
}
}
function changeStonesClouds() {
if(stonesClouds<5) {
stonesClouds++;
$('#goldClouds').attr('src','images/item sprites/Kinstones/Gold Kinstone (Clouds)' + stonesClouds + '.png');
$('#goldClouds').css({filter:'grayscale(0%)'});
}
else {
$('#goldClouds').attr('src','images/item sprites/Kinstones/Gold Kinstone (Clouds).png');
$('#goldClouds').css({filter:'grayscale(100%)'});
stonesClouds=0;
}
}
//Row 4
function changeBottle() {
if(bottles<4) {
bottles++;
$('#bottle').css({filter:'grayscale(0%)'});
$('#bottle').attr('src','images/item sprites/Empty Bottle' + bottles + '.png');
}
else {
$('#bottle').css({filter:'grayscale(100%)'});
$('#bottle').attr('src','images/item sprites/Empty Bottle.png');
bottles=0;
}
}
function changeJabber() {
if(hasJabber==false) {
$('#jabber').css({filter:'grayscale(0%)'});
hasJabber=true;
}
else {
$('#jabber').css({filter:'grayscale(100%)'});
hasJabber=false;
}
}
function changeMushroom() {
if(hasMushroom==false) {
$('#mushroom').css({filter:'grayscale(0%)'});
hasMushroom=true;
}
else {
$('#mushroom').css({filter:'grayscale(100%)'});
hasMushroom=false;
}
}
function changeLLRKey() {
if(hasLLRKey==false) {
$('#llrKey').css({filter:'brightness(120%)'});
hasLLRKey=true;
}
else {
$('#llrKey').css({filter:'grayscale(100%)'});
hasLLRKey=false;
}
}
function changeStonesFalls() {
if(hasStonesFalls==false) {
$('#goldFalls').css({filter:'grayscale(0%)'});
hasStonesFalls=true;
}
else {
$('#goldFalls').css({filter:'grayscale(100%)'});
hasStonesFalls=false;
}
}
//Row 5
function changeGripRing() {
if(hasGripRing==false) {
$('#gripRing').css({filter:'grayscale(0%)'});
hasGripRing=true;
}
else {
$('#gripRing').css({filter:'grayscale(100%)'});
hasGripRing=false;
}
}
function changeBracelets() {
if(hasBracelets==false) {
$('#bracelets').css({filter:'grayscale(0%)'});
hasBracelets=true;
}
else {
$('#bracelets').css({filter:'grayscale(100%)'});
hasBracelets=false;
}
}
function changeFlippers() {
if(hasFlippers==false) {
$('#flippers').css({filter:'grayscale(0%)'});
hasFlippers=true;
}
else {
$('#flippers').css({filter:'grayscale(100%)'});
hasFlippers=false;
}
}
function changeGraveKey() {
if(hasGraveKey==false) {
$('#graveKey').css({filter:'grayscale(0%)'});
hasGraveKey=true;
}
else {
$('#graveKey').css({filter:'grayscale(100%)'});
hasGraveKey=false;
}
}
function changeCarlov() {
if(hasCarlov==false) {
$('#carlovMedal').css({filter:'grayscale(0%)'});
hasCarlov=true;
}
else {
$('#carlovMedal').css({filter:'grayscale(100%)'});
hasCarlov=false;
}
}
//Row 6
function changeEarth() {
if(hasEarth==false) {
$('#earth').css({filter:'grayscale(0%)'});
hasEarth=true;
}
else {
$('#earth').css({filter:'grayscale(100%)'});
hasEarth=false;
}
}
function changeFire() {
if(hasFire==false) {
$('#fire').css({filter:'grayscale(0%)'});
hasFire=true;
}
else {
$('#fire').css({filter:'grayscale(100%)'});
hasFire=false;
}
}
function changeWater() {
if(hasWater==false) {
$('#water').css({filter:'grayscale(0%)'});
hasWater=true;
}
else {
$('#water').css({filter:'grayscale(100%)'});
hasWater=false;
}
}
function changeWind() {
if(hasWind==false) {
$('#wind').css({filter:'grayscale(0%)'});
hasWind=true;
}
else {
$('#wind').css({filter:'grayscale(100%)'});
hasWind=false;
}
}
function changeRed3() {
if(hasRed3==false) {
$('#r3').css({filter:'grayscale(0%)'});
hasRed3=true;
}
else {
$('#r3').css({filter:'grayscale(100%)'});
hasRed3=false;
}
}
//Row 7
function changeSpinAttack() {
if(hasSpin==false) {
$('#spinAttack').css({filter:'grayscale(0%)'});
hasSpin=true;
}
else {
$('#spinAttack').css({filter:'grayscale(100%)'});
hasSpin=false;
}
}
function changeRockBreaker() {
if(hasRock==false) {
$('#rockBreaker').css({filter:'grayscale(0%)'});
hasRock=true;
}
else {
$('#rockBreaker').css({filter:'grayscale(100%)'});
hasRock=false;
}
}
function changeDashAttack() {
if(hasDash==false) {
$('#dashAttack').css({filter:'grayscale(0%)'});
hasDash=true;
}
else {
$('#dashAttack').css({filter:'grayscale(100%)'});
hasDash=false;
}
}
function changeDownThrust() {
if(hasThrust==false) {
$('#downThrust').css({filter:'grayscale(0%)'});
hasThrust=true;
}
else {
$('#downThrust').css({filter:'grayscale(100%)'});
hasThrust=false;
}
}
function changeLights() {
if(hasLights==false) {
$('#lights').css({filter:'grayscale(0%)'});
hasLights=true;
}
else {
$('#lights').css({filter:'grayscale(100%)'});
hasLights=false;
}
}
//Row 8
function changeRollAttack() {
if(hasRoll==false) {
$('#rollAttack').css({filter:'grayscale(0%)'});
hasRoll=true;
}
else {
$('#rollAttack').css({filter:'grayscale(100%)'});
hasRoll=false;
}
}
function changeSwordBeam() {
if(hasSwordBeam==false) {
$('#swordBeam').css({filter:'grayscale(0%)'});
hasSwordBeam=true;
}
else {
$('#swordBeam').css({filter:'grayscale(100%)'});
hasSwordBeam=false;
}
}
function changePerilBeam() {
if(hasPerilBeam==false) {
$('#perilBeam').css({filter:'grayscale(0%)'});
hasPerilBeam=true;
}
else {
$('#perilBeam').css({filter:'grayscale(100%)'});
hasPerilBeam=false;
}
}
function changeGreatSpinAttack() {
if(hasGreatSpin==false) {
$('#greatSpinAttack').css({filter:'grayscale(0%)'});
hasGreatSpin=true;
}
else {
$('#greatSpinAttack').css({filter:'grayscale(100%)'});
hasGreatSpin=false;
}
}
function changeTransparency() {
var trans = ($('#transparency').val());
if (trans==0) {
items.setAttribute("style","background-color:" + color);
}
else if(trans==10) {
items.setAttribute("style","background-color: " + color + "E6");
}
else if (trans==20) {
items.setAttribute("style","background-color: " + color + "CC");
}
else if (trans==30) {
items.setAttribute("style","background-color: " + color + "B3");
}
else if (trans==40) {
items.setAttribute("style","background-color: " + color + "99");
}
else if (trans==50) {
items.setAttribute("style","background-color: " + color + "80");
}
else if (trans==60) {
items.setAttribute("style","background-color: " + color + "66");
}
else if (trans==70) {
items.setAttribute("style","background-color: " + color + "4D");
}
else if (trans==80) {
items.setAttribute("style","background-color: " + color + "33");
}
else if (trans==90) {
items.setAttribute("style","background-color: " + color + "1A");
}
else {
items.setAttribute("style","background-color: " + color + "00");
}
}
function changeColor() {
color = ($('#colorField').val());
items.setAttribute("style","background-color:" + color);
}
//This function sets up the listeners for when a user clicks on each item.
//As with the rest of the code, it is split up into 8 groups of 8.
function setUp() {
$('#swords').click(changeSword);
$('#jar').click(changeJar);
$('#cane').click(changeCane);
$('#rang').click(changeRang);
$('#wallet').click(changeWallet);
$('#shields').click(changeShield);
$('#mitts').click(changeMitts);
$('#lantern').click(changeLantern);
$('#bomb').click(changeBombs);
$('#goldWilds').click(changeStonesWilds);
$('#boots').click(changeBoots);
$('#cape').click(changeCape);
$('#ocarina').click(changeFlute);
$('#bow').click(changeBow);
$('#goldClouds').click(changeStonesClouds);
$('#bottle').click(changeBottle);
$('#jabber').click(changeJabber);
$('#mushroom').click(changeMushroom);
$('#llrKey').click(changeLLRKey);
$('#goldFalls').click(changeStonesFalls);
$('#gripRing').click(changeGripRing);
$('#bracelets').click(changeBracelets);
$('#flippers').click(changeFlippers);
$('#graveKey').click(changeGraveKey);
$('#carlovMedal').click(changeCarlov);
$('#earth').click(changeEarth);
$('#fire').click(changeFire);
$('#water').click(changeWater);
$('#wind').click(changeWind);
$('#r3').click(changeRed3);
$('#spinAttack').click(changeSpinAttack);
$('#rockBreaker').click(changeRockBreaker);
$('#dashAttack').click(changeDashAttack);
$('#downThrust').click(changeDownThrust);
$('#lights').click(changeLights);
$('#rollAttack').click(changeRollAttack);
$('#swordBeam').click(changeSwordBeam);
$('#perilBeam').click(changePerilBeam);
$('#greatSpinAttack').click(changeGreatSpinAttack);
$('#change').click(changeTransparency);
$('#changeColor').click(changeColor);
}
$(document).ready(setUp);