forked from Trimps/Trimps.github.io
-
Notifications
You must be signed in to change notification settings - Fork 1
/
objects.js
5318 lines (5256 loc) · 249 KB
/
objects.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
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
var holidayObj = {
holiday: "",
lastCheck: null,
holidays: {
Eggy: {
check: function(day, month){
if (month == 3) return true;
}
},
Pumpkimp: {
check: function(day, month){
if (month == 9 || (month == 10 && day <= 5)) return true;
}
},
Snowy: {
check: function(day, month){
if ((month == 11 && day >= 15) || (month == 0 && day <= 15)) return true;
}
}
},
checkActive: function(name){
return (this.holiday == name);
},
checkAll: function(){
var date = new Date();
if (this.lastCheck != null && ((date.getTime() - this.lastCheck.getTime()) < 120000)) return;
this.lastCheck = date;
var day = date.getUTCDate();
var month = date.getUTCMonth();
for (var holiday in this.holidays){
if (this.holidays[holiday].check(day, month)){
if (!this.holiday){
message("Loaded " + holiday + " event!", "Notices");
}
this.holiday = holiday;
return;
}
}
if (this.holiday){
message(this.holiday + " event has come to an end!", "Notices");
}
this.holiday = "";
return;
}
}
var tutorial = {
open: false,
viewingStep: 0,
start: function(){
game.global.tutorialActive = true;
game.global.tutorialOpen = true;
this.load();
},
load: function(){
if (game.global.tutorialOpen) this.openWindow();
document.getElementById('openTutorialContainer').style.display = 'block';
document.getElementById('openTutorialContainer2').style.display = 'block';
this.toggleSize(true);
},
popup: function(){
game.global.tutorialOpen = !game.global.tutorialOpen;
if (game.global.totalPortals >= 1) game.global.tutorialStep = 15;
if (game.global.tutorialOpen) this.openWindow();
else this.closeWindow();
},
closeWindow: function(){
game.global.tutorialOpen = false;
document.getElementById('tutorialDiv').style.display = 'none';
},
openWindow: function(){
game.global.tutorialOpen = true;
this.viewingStep = game.global.tutorialStep;
document.getElementById('tutorialDiv').style.display = 'block';
this.getText();
this.stopFlash();
},
reset: function(){
this.closeWindow();
document.getElementById('openTutorialContainer').style.display = 'none';
document.getElementById('openTutorialContainer2').style.display = 'none';
},
makeFlash: function(){
swapClass('flash', 'flashing', document.getElementById('openTutorialBtn'));
swapClass('flash', 'flashing', document.getElementById('openTutorialBtn2'));
},
stopFlash: function(){
swapClass('flash', 'flashNo', document.getElementById('openTutorialBtn'));
swapClass('flash', 'flashNo', document.getElementById('openTutorialBtn2'));
},
check: function(){
var oldStep = game.global.tutorialStep;
if (oldStep == 15) return;
switch(game.global.tutorialStep){
case 0:
if (game.upgrades.Bloodlust.allowed > 0) game.global.tutorialStep++;
break;
case 1:
if (game.global.world >= 2) game.global.tutorialStep++;
break;
case 2:
if (game.global.world >= 4) game.global.tutorialStep++;
break;
case 3:
if (game.global.mapsUnlocked) game.global.tutorialStep++;
break;
case 4:
if (game.global.preMapsActive || game.upgrades.Supershield.allowed > 0 || game.global.mapsActive) game.global.tutorialStep++;
break;
case 5:
if (game.global.mapsActive || game.upgrades.Supershield.allowed > 0) game.global.tutorialStep++;
break;
case 6:
if (game.upgrades.Supershield.allowed > 0 && game.upgrades.Dagadder.allowed > 0 && game.upgrades.Bootboost.allowed > 0) game.global.tutorialStep++;
break;
case 7:
if (game.global.world >= 7 && (game.global.preMapsActive || game.upgrades.Megamace.allowed > 0)) game.global.tutorialStep++;
break;
case 8:
if (game.upgrades.Megamace.allowed > 0 && game.upgrades.Hellishmet.allowed > 0) game.global.tutorialStep++;
break;
case 9:
if (game.upgrades.Trapstorm.allowed > 0) game.global.tutorialStep++;
break;
case 10:
if ((game.upgrades.Shieldblock.allowed > 0) || (!game.mapUnlocks.TheBlock.canRunOnce && game.global.preMapsActive)) game.global.tutorialStep++;
break;
case 11:
if (game.upgrades.Shieldblock.allowed > 0) game.global.tutorialStep++;
break;
case 12:
if (game.upgrades.Bounty.allowed > 0) game.global.tutorialStep++;
break;
case 13:
if (game.upgrades.Anger.done > 0) game.global.tutorialStep++;
break;
case 14:
if (game.global.portalActive) game.global.tutorialStep++;
break;
}
if (oldStep != game.global.tutorialStep) {
if (!game.global.tutorialOpen){
this.makeFlash();
}
else{
this.viewingStep = game.global.tutorialStep;
this.getText();
this.resetScroll();
}
}
},
setWinSize: function(){
var className = (game.global.preMapsActive) ? 'tutorialDivSm' : 'tutorialDiv';
var classWidth = (game.global.tutorialLg) ? 'tutorialWidthLg' : 'tutorialWidth'
swapClass('tutorialDiv', className, document.getElementById('tutorialDiv'));
swapClass('tutorialWidth', classWidth, document.getElementById('tutorialDiv'));
document.getElementById('tutorialBookmarks').style.display = (game.global.tutorialLg) ? 'inline-block' : 'none';
document.getElementById('tutorialInner').style.width = (game.global.tutorialLg) ? '79%' : '100%';
this.resetScroll();
},
toggleSize: function(updateOnly){
if (!updateOnly) game.global.tutorialLg = !game.global.tutorialLg;
this.setWinSize();
document.getElementById('tutorialSizeBtn').className = (game.global.tutorialLg) ? 'icomoon icon-shrink' : 'icomoon icon-expand';
if (game.global.tutorialLg) this.setBookmarks();
},
resetScroll: function(){
var elem = document.getElementById('tutorialTextInner');
elem.scrollTop = 0;
},
next: function(){
if (game.global.tutorialStep > this.viewingStep) {
this.viewingStep++;
this.getText();
this.resetScroll();
}
},
back: function(){
if (this.viewingStep > 0){
this.viewingStep--;
this.getText();
this.resetScroll();
}
},
setViewStep: function(to){
if (to > game.global.tutorialStep || to < 0) return;
this.viewingStep = to;
this.getText();
this.resetScroll();
},
setBookmarks: function(){
var elem = document.getElementById('tutorialBookmarks');
var titles = ["Battle", "Zones", "Tips 1", "Tips 2", "Found a Map", "Map Chamber", "Mapping", "Equipment Prestige", "Custom Maps", "Map Settings", "Trapstorm", "Unique Maps", "Block", "Bounty", "Anger", "Portal"];
var text = "";
for (var x = 0; x <= game.global.tutorialStep; x++){
if (x > titles.length) break;
var selected = (x == this.viewingStep) ? ' selected' : '';
text += "<div class='tutorialBookmark" + selected + "' onclick='tutorial.setViewStep(" + x + ")'>" + titles[x] + "</div>";
}
elem.innerHTML = text;
},
getText: function(){
var text = "";
var goal = "";
var totalSteps = 16;
switch(this.viewingStep){
case 0:
text = "Hello there! Didn't mean to startle you, your look of confusion indicates that you do not remember me. I am your ship's Automated Defensive Voice and Idea Synthesizing On-board Robot, but you can call me ADVISOR. I have noticed that the wildlife in the area seems to be scared of the Ship for now, but if you want to be able to leave the immediate area, you'll need to fight to do it. Luckily I have already completed an analysis of the Trimps, and with enough training they could be used to fight!"
text += "<br/><br/>After researching Battle, press the F key or click the 'Fight' button to send Trimps to battle. You need 1 free Trimp in your town before you can send it to fight - Trap more Trimps or wait for 2 or more unemployed Trimps to breed if you run out!<br/><br/><i>You can show/hide the ADVISOR window by pressing the 'V' key, or by clicking the gold Star on the middle right after you research Battle. You can also click the <span class='icomoon icon-close' style='color: red'></span> button to close the ADVISOR window, or the <span class='icomoon icon-expand'></span> button next to it to expand this window and see a table of contents.</i>"
goal = "Research Battle and kill 10 Bad Guys";
break;
case 1: //if bloodlust has been unlocked
text = "I am quite pleased. With your newly found Upgrade Book, you can now Train your Trimps to fight on their own! In order to maximize breed speed, you should teach the Trimps to only go out and fight when housing is completely full.<br/><br/>";
text += "My sensors have scanned the area, and the map of your current Zone will show you any Bad Guys with special rewards:<br/><span class='glyphicon glyphicon-apple'></span><span class='glyphicon glyphicon-tree-deciduous'></span><span class='icomoon icon-cubes'></span> - Food, Wood, or Metal respectively<br/>";
text += "<span class='glyphicon glyphicon-question-sign'></span> - New Equipment<br/><span class='glyphicon glyphicon-book'></span> - An Upgrade Book (mouse over it to see Upgrade name)<br/><span class='glyphicon glyphicon-gift'></span> - Increases your max population by 5";
text += "<br/><span class='glyphicon glyphicon-user'></span> - A foreman to help automatically build things in the queue<br/><br/>You now have lots of tools at your disposal. Keep your Trimps well equipped, research your upgrades, build more housing and you'll be in Zone 2 before you know it."
goal = "Clear this Zone"
break;
case 2: //if on z2+
text = "You're doing great so far! That Coordination Book you found will allow you to send larger groups of Trimps to fight together at a time. Upgrading this will increase your breeding requirements to maintain a fighting army, but is always worth researching as soon as you can. You will find a Coordination Book at the end of every Zone, allowing you to build a truly massive army. Don't forget that you can build and use Traps to get armies together faster!<br/><br/>";
text += "You also notice there's blueprints for a Gym on this Zone, which will grant your Trimps the ability to Block some damage from attacks. This is a flat damage reduction per Trimp, meaning it scales with army size as you research more levels of Coordination.<br/><br/>";
text += "By the way, you can click many of the numbers on the screen to see breakdowns of where those numbers are coming from. For example, click your Trimps' Health to see all of their Health bonuses, Food per Second to see all Food gathering bonuses, or your total number of Trimps to see totals from various sources of Max Trimps.<br/><br/>";
text += "Continue to improve your town and army. These Bad Guys won't know what hit them.";
goal = "Reach Zone 4";
break;
case 3: //if on z4+
text = "Here's a couple of tips the Bad Guys don't want you to know:<br/><br/><ul><li>You can click the 'Custom' number button, then type '1/4' to select one quarter of your current available workspaces. This makes it easy to evenly split your workers!</li><li>All Equipment shows how many resources you need to spend for each point of a stat. The lower this number, the more efficient that piece of Equipment is!</li><li>If you ever notice that everything is suddenly really expensive, you probably just need to click '+1' again.</li></ul>"
goal = "Find something interesting on Zone 6"
break;
case 4: //unlocked maps
text = "You've certainly found something interesting, your first Map! You should try running it.<br/><br/>Click the orange Maps button under AutoFight. Your current group of soldiers can't come with you, so you can either wait for them to... finish fighting, or you can click the button a second time to go on without them.";
goal = "Enter the Map Chamber";
break;
case 5: //entered map chamber
text = "Welcome to the map chamber! Select the map 'Tricky Paradise' in your map inventory.<br/><br/>Ignore the sliders at the top of this window for now, and take a look directly above the 'Run Map' map button. You'll see that there are currently 3 unique items inside this map, and we want them. To the right, you'll see Size 45 which indicates that this map will have 45 cells, Difficulty 85% indicating that Cell 1 has 15% less health and attack than Cell 1 in Zone 6, and Loot 120% indicating that each drop in this map is worth 20% more resources than the same drop in Zone 6.<br/><br/>Now click 'Run Map' and let's see what happens!"
goal = "Start Tricky Paradise";
break;
case 6: //entered a map
text = "And they're off! Remember that we want 3 items out of this map, and we can see one of these Upgrade Books at the end right now. Press the 'R' key or click the red button that currently says 'Repeat Off' to turn Map Repeating on, so your Trimps will automatically rerun this map after they get the first upgrade.";
text += "<br/><br/>You'll need to clear this map 3 times to earn all of its items. Keep an eye on your City and Equipment and this will be a breeze.";
goal = "Unlock all 3 Map Items from Zone 6";
break;
case 7: //Unlocked supershield, dagadder, bootboost
text = "Amazing job! You've earned all of the Map Items from Zone 6. Remember how you unlocked 3 pieces of Equipment on Zone 1, then 2 pieces each on Zones 2 through 5? From now on, you'll earn upgrades for these Equipments from maps with the same pattern, repeating every 5 Zones. 6, 11, 16 and so on will always have Shield, Dagger, and Boot upgrades, while Maps at all other Zone levels will have 2 upgrades.<br/><br/>";
text += "These 'prestige' upgrades for your Equipment will reset the Equipment to level 1, but they are extremely powerful. If you have the upgrade available, Prestiging your Equipment before buying more Levels is always more efficient. Because your Equipment resets to level 1, you generally want to try and earn these Upgrades soon after they become available.";
text += "You also may have noticed that the orange 'Maps' button now has a number next to it, indicating how many maps you've completed. Every time you complete a map with a level equal to your current Zone level, you'll gain a +20% damage buff for the rest of the Zone! This stacks up to 10 times. Remember you can click your Trimps' 'DMG' numbers to see all currently active bonuses.";
text += "<br/><br/>You can exit your Map the same way you got in, the orange 'Maps' button. Once you're back in the Map Chamber, click it one more time to return to the World."
goal = "Reach Zone 7, then go back to the Map Chamber";
break;
case 8: //entered map chamber on Z7
text = "Welcome back! We're finally going to take a look at those sliders and settings at the top of the Map Chamber. We don't have a level 7 Map so we'll need to make our own!<br/><br/>";
text += "The Loot, Size and Difficulty sliders all let you reduce the randomness of the Map Generator. For example, the default roll for Size is 25 to 75 Cells, but if you drag that slider all the way to the right, the roll becomes 25-30, guaranteeing a nice small Map to quickly grab your Upgrades and damage bonuses. However, you'll also notice that there's a Fragment cost displayed at the top that increases or decreases as you drag the sliders.<br/><br/>";
text += "You don't have a ton of Fragments to work with right now, so you'll need to find a balance you're happy with. I'd suggest leaving the Loot slider alone for now and balancing the Size and Difficulty sliders to whatever you can afford, but you can do whatever you'd like. You can mouse over 'Biome' to see how that Dropdown works, but it doubles the Fragment cost and is best left on 'Random' until later."
goal = "Create a Level 7 Map and complete it at least twice."
break;
case 9: //Unlocked megamace and hellishmet
text = "You're really getting the hang of this!<br/><br/>Now would be a good time to mention that you can click the grey cogwheel icon next to the maps button to customize some nifty map settings based on what you need. If you like getting 10 stacks of Map Bonus, turn on 'Repeat to 10' and 'Exit to World' and watch your Trimps automatically travel back to your current Zone after their 10th map. If you just want to get your upgrades and get out, 'Repeat for Items' is for you. Check each setting's tooltip for more information!";
text += "<br/><br/>Speaking of automation, there's another important book we could use for our automation arsenal hiding in a map up ahead. See if you can claim it for our city!"
goal = "Find a new upgrade in a Level 10 Map";
break;
case 10: //Unlocked trapstorm
text = "Look at that! Gone are the days of adding traps to the building queue yourself, now Trapstorm can handle that for you!<br/><br/>By the way, when in a map you can mouse over the name of the map above the Fight button for some useful information like how long you've been in this map, and how many upgrades remain.<br/><br/>I'm detecting something we haven't seen yet inside a map on the next Zone. Let's go check it out!"
goal = "Run a Level 11 Map, then enter the Map Chamber"
break;
case 11: //Entered map chamber with The Block unlocked
text = "Looks like we've found a Unique Map! These special maps have unique upgrades that cannot be found any other way. Unique Maps are not recyclable, generally have high loot and large size, and they change color from green to red after they've been completed. You can still run a red Unique Map as much as you want, but the color makes it easy to tell at a glance if you've earned the special upgrade from that map yet.<br/><br/>Note that this map has a size of 100 and a difficulty of 130%, so it will be more difficult than Zone 11. If The Block is too hard for you right now, you could farm an easier map first, go for another Coordination, or whatever else you think might be a good idea. Since this map is not recyclable, you can start it and then switch to a different map without destroying your Unique Map, but doing so will reset your progress in the Unique Map to Cell 1.";
goal = "Find a way to clear The Block";
break;
case 12: //Unlocked Shieldblock
text = "You've done it! This special new upgrade will convert your Shield from an accessory that provides Health, to a fully fledged Shield that can actually block damage. What crazy technology!<br/><br/>Block should be a major part of your arsenal now. With enough investment you can even get your Trimps' block higher than enemy Attack, causing your Trimps to take no damage!<br/><br/>You've now shown proficiency with most of the basic skills required to lead a Trimp civilization. My sensors are detecting another Unique Map hiding in a Level 15+ Map, and I strongly believe you have what it takes to find and complete it.";
goal = "Find and complete the Level 15 Unique Map";
break;
case 13: //Unlocked Bounty
text = "Excellent work! You've found and cleared The Wall, and earned the ultra powerful Bounty upgrade.<br/><br/>You've now amassed a powerful army, built a sprawling city, and culled thousands of enemies. There's something frightening at the end of Zone 20, but there's no doubt in my cold artificial mind that you have what it takes to defeat it.";
goal = "Research the Upgrade Book at the end of Zone 20";
break;
case 14: //Unlocked Dimension of Anger
text = "My scanners are indicating that there is advanced Portal technology inside this Unique Map you've just created, but that it is filled with dangers. It will be a tough map to clear, but you should try to complete this one before finishing Zone 21 if possible.<br/><br/>Good luck.";
goal = "Complete the Dimension of Anger";
break;
case 15: //Completed Dimension of Anger
text = "You're the best! You've accomplished every task I've asked of you with hardly any complaining, and I couldn't be more proud.<br/><br/>This Portal that you've unlocked is a powerful, ancient technology, powered by Helium. Luckily you also found a contraption that allows you to harvest Helium from the most powerful enemy of each Zone. Whenever you feel like enemies are getting too hard, you can use this Portal to return to Zone 1, and use Helium to make yourself and your Trimps permanently more powerful. The more Helium you find before you use the Portal, the more powerful you'll be after you use it!<br/><br/>This power is gained in the form of 'Perks', which you'll see on the left side of the Portal screen. You can mouse over any of these Perks to see what they do and how much they cost on their tooltip. Each time you buy 1 level of a Perk it becomes more expensive, so if you're looking for a general rule of thumb, try to spend evenly into all of them for now.<br/><br/>";
text += "The other important thing to know about Portals is that they can be used to start Challenges with powerful rewards. I highly suggest clicking either the 'Discipline' or 'Metal' Challenge on your Portal screen before you activate your Portal, so you can earn a new Perk on your next run!<br/><br/>";
text += "Your choices from now on are up to you. There's a big World out there to explore, filled with thousands of Upgrade Books to research.<br/><br/>See if you can clear Zone 22 to earn a little more Helium for next run, then activate your Portal.";
goal += "Clear Zone 22, then Portal with a Challenge"
break;
}
if (this.viewingStep != 0 && this.viewingStep != 15) text += "<br/><br/><i>Remember you can toggle the ADVISOR window by pressing V or clicking the gold star by the enemy's name.</i>";
this.setWinSize();
document.getElementById('tutorialTextInner').innerHTML = text;
document.getElementById('tutorialGoal').innerHTML = goal;
document.getElementById('tutorialStep').innerHTML = "(" + (this.viewingStep + 1) + "/" + totalSteps + ")";
document.getElementById('tutorialBackBtn').style.display = (this.viewingStep > 0) ? 'inline-block' : 'none';
document.getElementById('tutorialNextBtn').style.display = (this.viewingStep < game.global.tutorialStep) ? 'inline-block' : 'none';
if (game.global.tutorialLg) this.setBookmarks();
}
}
var alchObj = {
tab: document.getElementById('alchemyTab'),
load: function(){
if (game.global.potionData != null) this.potionsOwned = game.global.potionData;
else {
for (var x = 0; x < this.potionsOwned.length; x++){
this.potionsOwned[x] = 0;
this.potionAuto[x] = 0;
}
}
if (game.global.potionAuto != null) this.potionAuto = game.global.potionAuto;
if (this.potionsOwned.length < this.potionNames.length){
var need = this.potionNames.length - this.potionsOwned.length;
for (var x = 0; x < need; x++){
this.potionsOwned.push(0);
this.potionAuto.push(0);
}
}
this.tab.style.display = (game.global.alchemyUnlocked || game.global.challengeActive == "Alchemy") ? 'table-cell' : 'none';
},
rewards: {
Metal: "Potatoes",
Wood: "Mushrooms",
Food: "Seaweed",
Gems: "Firebloom",
Any: "Berries",
},
potionNames: ["Herby Brew", "Gaseous Brew", "Potion of Finding", "Potion of the Void", "Potion of Strength", "Elixir of Crafting", "Elixir of Finding", "Elixir of Accuracy"],
potionsOwned: [0,0,0,0,0,0,0,0],
potionAuto: [0,0,0,0,0,0,0,0],
getRunetrinketMult: function(chance){
var notFind = 100 - chance;
notFind *= Math.pow(0.99, this.potionsOwned[2]);
return (100 - notFind);
},
getRunetrinketBonusAmt: function(){
var world = (game.global.world < 101) ? 101 : game.global.world;
var orig = game.portal.Observation.getDropChance(world);
var newMult = game.portal.Observation.getDropChance(world, true);
return orig - newMult;
},
potions: [
{
challenge: true,
cost: [["Potatoes",5,10]],
description: "Increases all Herbs found by 100% (compounding). <span class='red'>Increases Enemy Attack/Health by 75% (compounding)</span>",
effectText: "+#% Herbs found",
enemyMult: 1.75,
effectComp: 2,
},
{
challenge: true,
cost: [["Mushrooms",5,5]],
description: "Increases all Radon gained by 10% (compounding). <span class='red'>Increases Enemy Attack/Health by 30% (compounding)</span>",
effectText: "+#% Radon",
enemyMult: 1.3,
effectComp: 1.10,
},
{
challenge: true,
cost: [["Seaweed",5,4]],
description: "Increases all non-radon resources earned by 25% additively. Reduces chance to not find a Runetrinket by 1% (compounding). <span class='red'>Increases the cost of all other Potions by 50% (compounding)</span>",
effectText: "+#% res",
effect: 0.25,
},
{
challenge: true,
cost: [["Firebloom",5,4]],
description: "Nullifies 5% (compounding) of increased enemy stats from Brews while in Void Maps. <span class='red'>Increases the cost of all other Potions by 50% (compounding)</span>",
effectText: "#% nullified void stats",
effectComp: 0.95,
inverseComp: true
},
{
challenge: true,
cost: [["Berries",5,4]],
description: "Increases Trimp Attack/Health by 15% additively. <span class='red'>Increases the cost of all other Potions by 50% (compounding)</span>",
effectText: "+#% Stats",
effect: 0.15,
},
{
challenge: false,
cost: [["Potatoes",2000,4],["Berries",1000,4],["Seaweed",1000,4]],
description: "Increases all housing by 5% (compounding).",
effectText: "+#% housing",
effectComp: 1.05,
},
{
challenge: false,
cost: [["Mushrooms",10000,4],["Potatoes",3000,4]],
description: "Increases all non-radon resources by 5% (compounding).",
effectText: "+#% resources",
effectComp: 1.05,
},
{
challenge: false,
cost: [["Firebloom",7000,4],["Seaweed",3000,4]],
description: "Increases Crit Damage by 25%.",
effectText: "+#% Crit Damage",
effect: 0.25,
}
],
allPotionGrowth: 1.5,
getPotionCost: function(potionName, getText){
var index = this.potionNames.indexOf(potionName);
if (index == -1) return "";
var potion = this.potions[index];
var cost = potion.cost;
var costObj = [];
var costText = "";
var owned = 0;
var thisOwned = this.potionsOwned[index];
if (potion.challenge && !potion.enemyMult){
for (var y = 0; y < this.potionsOwned.length; y++){
if (this.potions[y].challenge != (game.global.challengeActive == "Alchemy")) continue;
if (y != index && !this.potions[y].enemyMult) owned += this.potionsOwned[y]; //no cost increase for enemyMult potions
}
}
for (var x = 0; x < cost.length; x++){
var thisCost = Math.ceil(cost[x][1] * Math.pow(cost[x][2], thisOwned));
if (potion.challenge) thisCost *= Math.pow(this.allPotionGrowth, owned);
if (getText){
var ownedName = (game.global.challengeActive == "Alchemy") ? "cowned" : "owned";
var color = (game.herbs[cost[x][0]][ownedName] < thisCost) ? "red" : "green";
costText += "<span class='" + color + "'>" + prettify(thisCost) + " " + cost[x][0] + "</span>";
if (cost.length == x + 2){
if (cost.length > 2) costText += ",";
costText += " and ";
}
else if (cost.length != x + 1) costText += ", ";
}
else costObj.push([cost[x][0], thisCost]);
}
if (getText) return costText;
return costObj;
},
getPotionEffect: function(potionName){
if (game.global.universe != 2) return 1;
var index = this.potionNames.indexOf(potionName);
if (index == -1) return 1;
var potion = this.potions[index];
var onChallenge = (game.global.challengeActive == "Alchemy");
if (potion.challenge && !onChallenge) return 1;
if (!potion.effect && !potion.effectComp) return 1;
var owned = this.potionsOwned[index];
if (potion.effect) return 1 + (potion.effect * owned);
return Math.pow(potion.effectComp, owned);
},
getRadonMult: function(){
if (game.global.challengeActive != "Alchemy") return 1;
var base = 51;
base *= this.getPotionEffect("Gaseous Brew");
return base;
},
getPotionCount: function(potionName){
return this.potionsOwned[this.potionNames.indexOf(potionName)];
},
getEnemyStats: function(map, voidMap){
//Challenge only
var baseMod = 0.1;
baseMod *= Math.pow(this.potions[0].enemyMult, this.potionsOwned[0]); //Herby Brew
baseMod *= Math.pow(this.potions[1].enemyMult, this.potionsOwned[1]); //Gaseous Brew
if (voidMap) {
baseMod *= 10;
if (this.potionsOwned[3] > 0) baseMod *= this.getPotionEffect("Potion of the Void");
return baseMod;
}
if (map) return baseMod * 3;
return baseMod;
},
unlock: function(){
if (typeof game.global.messages.Loot.alchemy === 'undefined') game.global.messages.Loot.alchemy = true;
},
mapCleared: function(mapObj){
if (game.global.universe != 2) return;
if (game.global.challengeActive != "Alchemy" && !game.global.alchemyUnlocked) return;
if (!mapObj || !mapObj.location) return;
var resType = game.mapConfig.locations[mapObj.location].resourceType;
if (resType == "Scaling") resType = getFarmlandsResType(mapObj);
var resource = this.rewards[resType];
if (!resource) return;
var amt = this.getDropRate(mapObj.level);
if (mapObj.location == "Farmlands") amt *= 1.5;
if (amt <= 0) return;
if (game.global.challengeActive == "Alchemy"){
game.herbs[resource].cowned += amt;
}
else{
game.herbs[resource].owned += amt;
}
message("You found " + prettify(amt) + " " + resource + "!", "Loot", "*leaf3", "alchemy", "alchemy");
this.openPopup(true);
},
canAffordPotion: function(potionName){
var cost = this.getPotionCost(potionName);
if (!cost) return false;
var owned = (game.global.challengeActive == "Alchemy") ? "cowned" : "owned";
for (var x = 0; x < cost.length; x++){
var resOwned = game.herbs[cost[x][0]][owned];
if (resOwned < cost[x][1]) return false;
}
return true;
},
craftPotion: function(potionName){
if (!this.canAffordPotion(potionName)) return;
var cost = this.getPotionCost(potionName);
var ownedName = (game.global.challengeActive == "Alchemy") ? "cowned" : "owned";
for (var x = 0; x < cost.length; x++){
game.herbs[cost[x][0]][ownedName] -= cost[x][1];
}
var index = this.potionNames.indexOf(potionName);
this.potionsOwned[index]++;
game.global.potionData = this.potionsOwned;
this.openPopup(true);
},
zoneScale: 1.14,
extraMapScale: 1.25,
getDropRate: function(mapLevel){
var world = game.global.world;
var dif = mapLevel - world;
if (dif < 0) return 0;
var base = ((2 + (Math.floor(world / 10) * 5)) * Math.pow(this.zoneScale, world));
base = Math.floor(base * Math.pow(this.extraMapScale, dif));
base *= this.getPotionEffect("Herby Brew");
return base;
},
openPopup: function(updateOnly){
if (updateOnly && (lastTooltipTitle != "Alchemy" || !game.global.lockTooltip)) return;
var herbContainer = (updateOnly) ? document.getElementById('alchHerbContainer') : null;
if (updateOnly && !herbContainer) updateOnly = false;
var text = (updateOnly) ? "" : "<div class='alchemyTitle'>Herbs</div><div id='alchHerbContainer'>";
var ownedName = (game.global.challengeActive == "Alchemy") ? "cowned" : "owned";
for (var herb in game.herbs){
text += "<div class='alchemyPopupHerb'><span class='alchemyPopupName'>" + herb + "</span><br/>" + prettify(game.herbs[herb][ownedName]) + "</div>";
}
if (updateOnly){
herbContainer.innerHTML = text;
}
else text += "</div>";
text += "<div class='alchemyTitle'>Crafts</div>";
text += "<table id='alchemyCraftTable'><tbody><tr>"
var count = 0;
for (var x = 0; x < this.potions.length; x++){
var potion = this.potions[x];
if ((game.global.challengeActive == "Alchemy") != potion.challenge) continue;
if (count % 5 == 0) text += "</tr><tr>";
var name = this.potionNames[x];
var effectAmt = this.getPotionEffect(name);
if (potion.inverseComp) effectAmt = 1 - effectAmt;
else effectAmt--;
var effectText = prettify(this.potionsOwned[x]) + " owned, " + potion.effectText.replace("#", prettify((effectAmt) * 100));
if (name == "Potion of Finding") effectText += ", +" + this.getRunetrinketBonusAmt().toFixed(2) + "% RT chance"
var btnClass = (this.canAffordPotion(name)) ? "colorSuccess" : "colorDisabled";
if (updateOnly){
var craftBtn = document.getElementById('alchCraftBtn' + x);
if (!craftBtn) {
cancelTooltip();
console.log('button not found for refresh');
return;
}
swapClass('color', btnClass, craftBtn);
document.getElementById('alchPotionEffect' + x).innerHTML = effectText;
document.getElementById('alchPotionCost' + x).innerHTML = this.getPotionCost(name, true);
}
else
text += "<td class='alchemyPopupCraft " + ((potion.enemyMult) ? 'brew' : 'potion') + "'><div class='alchemyPopupName'>" + name + "</div><span id='alchCraftBtn" + x + "' onclick='alchObj.craftPotion(\"" + name + "\")' class='btn btn-sm " + btnClass + "' style='width: 80%; margin-left: 10%;'>Craft</span><br/><span id='alchPotionEffect" + x + "' class='alchemyPotionEffect'>" + effectText + "</span><br/><span id='alchPotionCost" + x + "' class='alchemyCraftCost'>" + this.getPotionCost(name, true) + "</span><div class='alchemyAuto'>AutoCraft up to: <input value='" + this.potionAuto[x] + "' type='number' id='potionAuto" + x + "' /></div><span class='alchemyCraftDescription'>" + potion.description + "</span></td>";
count++;
}
text += "</tr></tbody></table><div id='alchBottomText'>";
if (updateOnly) text = "";
if (game.global.challengeActive == "Alchemy"){
text += "<div class='alchemyEnemyStats'>Enemies in this dimension are enchanted, gaining +" + prettify(this.getEnemyStats(false, false) * 100) + "% enemy stats in World, +" + prettify(this.getEnemyStats(true, false) * 100) + "% in Maps, and +" + prettify(this.getEnemyStats(true, true) * 100) + "% in Void Maps. All Radon drops are increased by " + prettify((this.getRadonMult() - 1) * 100) + "%.";
text += "</div>";
}
text += "<div class='alchemyTitle'>Drop Rates</div><table id='alchemyDropsTable'><tbody>";
var row1 = "<tr><td style='font-weight: bold; font-style: italic'>Map Level</td>";
var row2 = "<tr><td style='font-weight: bold; font-style: italic'>Drop Amt</td>";
for (var y = game.global.world - 1; y <= game.global.world + 10; y++){
row1 += "<td>" + y + "</td>";
row2 += "<td>" + prettify(this.getDropRate(y)) + "</td>";
}
text += row1 + "</tr>" + row2 + "</tr></tbody></table>";
if (updateOnly){
document.getElementById('alchBottomText').innerHTML = text;
return;
}
text += "</div>";
tooltip('confirm', null, 'update', text, 'alchObj.save()', 'Alchemy', 'Save and Close')
},
autoCraft: function(){
//called once every 2 seconds after alchemy is unlocked or during challenge
var onChallenge = (game.global.challengeActive == "Alchemy");
for (var x = 0; x < this.potions.length; x++){
var potion = this.potions[x];
if ((potion.challenge) != onChallenge) continue;
if (this.potionsOwned[x] >= this.potionAuto[x]) continue;
if (this.canAffordPotion(this.potionNames[x])) this.craftPotion(this.potionNames[x]);
}
},
save: function(){
for (var x = 0; x < this.potions.length; x++){
var elem = document.getElementById('potionAuto' + x);
if (!elem) continue;
var val = elem.value;
if (!val || isNumberBad(val)) continue;
this.potionAuto[x] = val;
}
game.global.potionAuto = this.potionAuto;
},
portal: function(){
for (var x = 0; x < this.potions.length; x++){
if (this.potions[x].challenge) this.potionsOwned[x] = 0;
}
for (var herb in game.herbs){
game.herbs[herb].cowned = 0;
}
if (!game.global.alchemyUnlocked) this.tab.style.display = 'none';
game.global.potionData = this.potionsOwned;
}
}
var autoBattle = {
frameTime: 300,
speed: 1,
enemyLevel: 1,
maxEnemyLevel: 1,
autoLevel: true,
dust: 0,
shards: 0,
shardDust: 0,
trimp: null,
enemy: null,
seed: 4568654,
enemiesKilled: 0,
sessionEnemiesKilled: 0,
sessionTrimpsKilled: 0,
maxItems: 4,
notes: " ",
popupMode: "items",
battleTime: 0,
lastSelect: "",
lastActions: [],
activeContract: "",
lootAvg: {
accumulator: 0,
counter: 0
},
presets: {
names: ["Preset 1", "Preset 2", "Preset 3"],
p1: [],
p2: [],
p3: []
},
rings: {
level: 1,
mods: ["attack"]
},
template: function(){
return {
level: 1,
isTrimp: false,
baseHealth: 50,
health: 50,
maxHealth: 50,
baseAttack: 5,
attack: 5,
baseAttackSpeed: 5000,
attackSpeed: 5000,
lastAttack: 0,
shockChance: 0,
shockMod: 0,
bleedChance: 0,
bleedMod: 0,
bleedTime: 0,
hadBleed: false,
poisonChance: 0,
poisonTime: 0,
poisonMod: 0,
poisonStack: 2,
poisonRate: 1,
poisonTick: 1000,
poisonHeal: 0,
defense: 0,
lifesteal: 0,
shockResist: 0,
poisonResist: 0,
bleedResist: 0,
lifestealResist: 0,
slowAura: 1,
damageTakenMult: 1,
enrageMult: 1.25,
enrageFreq: 60,
explodeDamage: 0,
explodeFreq: -1,
lastExplode: 0,
berserkMod: -1,
berserkStack: 0,
ethChance: 0,
dmgTaken: 0,
dustMult: 0,
gooStored: 0,
lastGoo: -1,
bleed: {
time: 0,
mod: 0
},
poison: {
time: 0,
mod: 0,
lastTick: 0,
stacks: 0,
expired: false,
hitsAtMax: 0
},
shock: {
time: 0,
mod: 0,
count: 0,
}
}
},
unlockAllItems: function(){
for (var item in this.items){
this.items[item].owned = true;
}
},
resetAll: function(){
this.enemyLevel = 1;
this.maxEnemyLevel = 1;
this.autoLevel = true;
this.dust = 0;
this.shards = 0;
this.trimp = null;
this.enemy = null;
this.enemiesKilled = 0;
this.lastActions = [];
this.activeContract = "";
this.resetStats();
this.rings = this.getFreshRings();
for (var item in this.items){
item = this.items[item];
item.owned = (item.zone) ? false : true;
item.equipped = false;
item.hidden = false;
item.level = 1;
}
for (var bonus in this.bonuses){
this.bonuses[bonus].level = 0;
}
for (var oneTimer in this.oneTimers){
this.oneTimers[oneTimer].owned = false;
}
for (var setting in this.settings){
this.settings[setting].enabled = this.settings[setting].default;
}
this.items.Sword.equipped = true;
this.items.Pants.equipped = true;
this.presets.p1 = [];
this.presets.p2 = [];
this.presets.p3 = [];
this.resetCombat();
},
save: function(){
var data = {};
data.enemyLevel = this.enemyLevel;
data.dust = this.dust;
data.shards = this.shards;
data.enemiesKilled = this.enemiesKilled;
data.maxEnemyLevel = this.maxEnemyLevel;
data.autoLevel = this.autoLevel;
data.lastActions = this.lastActions;
data.presets = this.presets;
data.activeContract = this.activeContract;
data.items = {};
data.rings = this.rings;
for (var item in this.items){
var thisItem = this.items[item];
if (!thisItem.owned) continue;
data.items[item] = {};
var saveItem = data.items[item];
saveItem.equipped = thisItem.equipped;
saveItem.owned = thisItem.owned;
saveItem.level = thisItem.level;
saveItem.hidden = thisItem.hidden;
}
data.bonuses = {};
for (var bonus in this.bonuses){
var thisBonus = this.bonuses[bonus];
if (thisBonus.level == 0) continue;
data.bonuses[bonus] = thisBonus.level;
}
data.oneTimers = {};
for (var oneTimer in this.oneTimers){
var thisOneTimer = this.oneTimers[oneTimer];
if (!thisOneTimer.owned) continue;
data.oneTimers[oneTimer] = true;
}
data.settings = {};
for (var setting in this.settings){
if (setting == "practice") continue;
var thisSetting = this.settings[setting];
if (thisSetting.enabled == thisSetting.default) continue;
data.settings[setting] = thisSetting.enabled;
}
game.global.autoBattleData = data;
},
load: function(){
var data = game.global.autoBattleData;
var tab = document.getElementById('autoBattleTab');
var canAb = (game.global.highestRadonLevelCleared >= 74);
if (!canAb || !data || !data.items){
this.resetAll();
if (!canAb) tab.style.display = 'none';
else tab.style.display = 'table-cell';
return;
}
tab.style.display = 'table-cell';
this.enemyLevel = data.enemyLevel;
this.dust = data.dust;
this.shards = data.shards ? data.shards : 0;
this.enemiesKilled = data.enemiesKilled;
this.maxEnemyLevel = data.maxEnemyLevel;
this.autoLevel = data.autoLevel;
if (data.rings && data.rings.level) this.rings = data.rings;
else this.rings = this.getFreshRings();
if (data.activeContract) this.activeContract = data.activeContract;
if (data.presets) this.presets = data.presets;
else{
this.presets.p1 = [];
this.presets.p2 = [];
this.presets.p3 = [];
}
if (data.lastActions) this.lastActions = data.lastActions;
for (var x = 0; x < this.lastActions.length; x++){
if (!this.lastActions[x][6]) this.lastActions[x][6] = 0;
}
for (var item in this.items){
var saveItem = data.items[item];
var thisItem = this.items[item];
if (!saveItem) {
//thisItem.owned = false;
thisItem.equipped = false;
thisItem.level = 1;
thisItem.hidden = false;
continue;
}
thisItem.owned = saveItem.owned;
thisItem.equipped = saveItem.equipped;
thisItem.level = saveItem.level;
if (typeof saveItem.hidden !== 'undefined')
thisItem.hidden = saveItem.hidden;
}
for (var bonus in this.bonuses){
if (!data.bonuses || !data.bonuses[bonus]){
this.bonuses[bonus].level = 0;
continue;
}
this.bonuses[bonus].level = data.bonuses[bonus];
}
for (var oneTimer in this.oneTimers){
if (!data.oneTimers || !data.oneTimers[oneTimer]){
this.oneTimers[oneTimer].owned = false;
continue;
}
this.oneTimers[oneTimer].owned = true;
}
for (var setting in this.settings){
if (!data.settings || typeof data.settings[setting] == 'undefined'){
this.settings[setting].enabled = this.settings[setting].default;
continue;
}
this.settings[setting].enabled = data.settings[setting];
}
if (!this.presets.names) this.presets.names = ["Preset 1", "Preset 2", "Preset 3"];
game.stats.saHighestLevel.valueTotal = this.maxEnemyLevel;
this.resetCombat(true);
},
firstUnlock: function(){
this.load();
tooltip('hide');
tooltip('confirm', null, 'update', "<i>\"As you approach the infinitely tall Spire, a Trimp rushes out and embraces Scruffy. Scruffy introduces you to Huffy, who seems to have also realized that Druopitee is kind of a prick. Huffy lets you know that he managed to destroy the Corruption device at the top, but that it was now crawling with horrible shadowy enemies. Huffy lets you know that he is shielded from the Portal inside the Spire, but that even when you Portal and forget him, he can use your subconscious to help direct him in cleansing the Spire and finding artifacts to make your Trimps stronger.\"</i><br/><br/>You've finally made it to Huffy and the first Spire in this Universe. Huffy needs your help removing all of the Enemies! Check out the new tab titled 'SA' to get started.<br/><br/><b>A tip for once you're in</b>: Huffy has figured out how to put on Pants and a Sword but is struggling beyond that. Click two other items to equip them ASAP!", null, 'Spire Assault Unlocked!', 'Continue', false, true);
},
savePreset: function(slot){
this.presets[slot] = [];
for (var item in this.items){
if (this.items[item].equipped) this.presets[slot].push(item);
}
this.presets[slot].push(["level", this.enemyLevel]);
if (this.rings.mods.length) {
var ringMods = ["ring"];
for (var x = 0; x < this.rings.mods.length; x++){
ringMods.push(this.rings.mods[x]);
}
this.presets[slot].push(ringMods);
}
this.popup(true, false, true);
},
loadPreset: function(slot){
var preset = this.presets[slot];
var plength = preset.length;
var maxAdd = this.getMaxItems();
var added = 0;
for (var item in this.items){
this.items[item].equipped = false;
if (this.settings.loadHide.enabled) this.items[item].hidden = (this.items[item].owned) ? true : false;
}
for (var x = 0; x < plength; x++){
var thisPreset = preset[x];
if (Array.isArray(thisPreset)){
if (this.settings.loadLevel.enabled && thisPreset[0] == "level" && thisPreset[1] <= this.maxEnemyLevel){
this.enemyLevel = thisPreset[1];
}
else if (this.settings.loadRing.enabled && thisPreset[0] == "ring"){
this.rings.mods = [];
for (var y = 1; y < thisPreset.length; y++){
this.changeRing(null, y - 1, thisPreset[y])
}
var slots = this.getRingSlots();
while (this.rings.mods.length < slots){ // Adding random mods until all the slots are filled, this is based on the lvl 15 update code. Thanks Hatterson for the fix
var availableMods = this.getAvailableRingMods();
var randomMod = availableMods[Math.floor(Math.random() * availableMods.length)];
this.rings.mods.push(randomMod);
}
}
continue;
}
if (!this.items[thisPreset] || !this.items[thisPreset].owned) continue;
if (added >= maxAdd) continue;
this.items[thisPreset].equipped = true;
this.items[thisPreset].hidden = false;
added++;
}
this.popupMode = 'items';
this.resetCombat(true);
this.popup(true, false, true);
},
getItemOrder: function(){
var items = [];
for (var item in this.items){
items.push({name: item, zone: (this.items[item].zone) ? this.items[item].zone : 0})
}
function itemSort(a,b){
if (a.zone > b.zone) return 1;
if (a.zone < b.zone) return -1;
}
items.sort(itemSort);
return items;
},
getContracts: function(){
var items = this.getItemOrder();
var contracts = [];
for (var x = 0; x < items.length; x++){
if (!this.items[items[x].name].owned) {
contracts.push(items[x].name)
if (contracts.length >= 3) return contracts;
}
}
return contracts;
},
contractPrice: function(item){
var itemObj = this.items[item];
var dif = itemObj.zone - 75
var total = (100 * Math.pow(1.2023, dif));
if (itemObj.dustType == "shards") total /= 1e9;
return total;
},
oneTimerPrice: function(item){
var itemObj = this.oneTimers[item];
var allItems = this.getItemOrder();
var index = itemObj.requiredItems - 1;
if (itemObj.useShards) index++;
if (index <= 6) return 10000;
var lastItem = allItems[index];
var contractPrice = this.contractPrice(lastItem.name);
if (itemObj.useShards) return Math.ceil(contractPrice / 2);
return Math.ceil(contractPrice * 1000) / 10;
},
toggleSetting: function(which){
var setting = this.settings[which];
if (setting.enabled == setting.text.length - 1) setting.enabled = 0;
else setting.enabled++;
if (setting.onToggle) setting.onToggle();
this.popup(true, false, true);
},
settings: {
loadHide: {
enabled: 1,
default: 1,
text: ["Leave Items on Preset Load", "Hide Unused Items on Preset Load"]
},
loadLevel: {
enabled: 1,