forked from genbtc/AutoTrimps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewUI2.js
819 lines (774 loc) · 62.9 KB
/
NewUI2.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
//set up AutoTrimps
if (autoTrimpSettings === undefined) {
console.log('Huh, autoTrimpSettings was undefined in the UI script...')
var autoTrimpSettings = new Object();
}
//create the Automation icon in the game bar
automationMenuInit();
//create container for settings buttons
function automationMenuSettingsInit() {
var settingsrow = document.getElementById("settingsRow");
var autoSettings = document.createElement("DIV");
autoSettings.id = "autoSettings";
autoSettings.setAttribute("style","display: none; max-height: 96vh;overflow: auto;");
settingsrow.appendChild(autoSettings);
}
automationMenuSettingsInit();
//prepare CSS for new Tab interface
var link1 = document.createElement('link');
link1.rel = "stylesheet";
link1.type = "text/css";
link1.href = 'https://genbtc.github.io/AutoTrimps/tabs.css';
document.head.appendChild(link1);
//Tab make helperfunctions
function createTabs(name,description){
var li_0 = document.createElement('li');
var a_0 = document.createElement('a');
a_0.className = "tablinks";
a_0.setAttribute('onclick', 'toggleTab(event, \'' + name + '\')');
a_0.href = "#";
a_0.appendChild( document.createTextNode(name) );
li_0.id = 'tab' + name;
li_0.appendChild( a_0 );
addtabsUL.appendChild( li_0 );
createTabContents(name,description);
}
function createTabContents(name,description){
var div_0 = document.createElement('div');
div_0.className = "tabcontent";
div_0.id = name;
var div_1 = document.createElement('div');
div_1.setAttribute("style", "margin-left: 1vw; margin-right: 1vw;");
var h4_0 = document.createElement('h4');
h4_0.setAttribute('style', 'font-size: 1.2vw;');
h4_0.appendChild( document.createTextNode(description) );
div_1.appendChild( h4_0 );
div_0.appendChild( div_1 );
addTabsDiv.appendChild( div_0 );
}
function toggleTab(evt, tabName) {
//Toggle.
if (evt.currentTarget.className.indexOf(" active") > -1) {
document.getElementById(tabName).style.display = "none";
evt.currentTarget.className = evt.currentTarget.className.replace(" active", "");
}
else {
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
}
function minimizeAllTabs() {
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
}
var addTabsDiv;
var addtabsUL;
//Actually Make the Tabs
function initializeAllTabs() {
//CREATE TABS + CONTENT
addTabsDiv = document.createElement('div');
addtabsUL = document.createElement('ul');
addtabsUL.className = "tab";
addTabsDiv.appendChild( addtabsUL );
//Make Tabs.
createTabs("Core","Main Controls for the script");
createTabs("Maps","AutoMaps + VoidMaps related Settings");
createTabs("Settings","Sub Controls for the script");
createTabs("genBTC","GenBTC Advanced");
createTabs("Scryer","Scryer Stance");
createTabs("Spam","Controls AutoTrimps message Spam");
createTabs("Import Export","Import Export Settings");
//add a minimize button:
var li_0 = document.createElement('li');
var a_0 = document.createElement('a');
a_0.className = "tablinks minimize";
a_0.setAttribute('onclick', 'minimizeAllTabs()');
a_0.href = "#";
a_0.appendChild( document.createTextNode("Minimize All") );
li_0.appendChild( a_0 );
li_0.setAttribute("style","float:right!important;");
addtabsUL.appendChild( li_0 );
//Insert tabs into the game area
document.getElementById("autoSettings").appendChild(addTabsDiv);
//pretend click to make first tab active.
document.getElementById("Core").style.display = "block";
document.getElementsByClassName("tablinks")[0].className += " active";
}
initializeAllTabs();
//Actually Make the Settings Buttons
function initializeAllSettings() {
//START MAKING BUTTONS IN THE TABS:
//CORE:
createSetting('ManualGather2', ['Gather/Build OFF','Auto Gather/Build','Science Research OFF','Auto Gather/Build #2'], '3-Way Button. Auto Gathering of Food,Wood,Metal(w/turkimp) & Science. Auto speed-Builds your build queue. Now able to turn science researching off for the achievement Reach Z120 without using manual research. Please test the Auto Gather/Build #2, its experimental but should work.', 'multitoggle',1,null,"Core");
createSetting('BetterAutoFight', ['AutoFight OFF','Better Auto Fight 1','Better Auto Fight 2'], '3-Way Button, Recommended. Will automatically handle fighting. #2 is the new one, #1 is the old algorithm (if you have any issues). The new BAF#2 does: 3)Click fight anyway if we are dead and stuck in a loop due to Dimensional Generator and we can get away with adding time to it.(RemainingTime + ArmyAdd.Time < GeneTimer) and 4) Clicks fight anyway if we are dead and have >=31 NextGroupTimer and deal with the consequences by firing genetecists afterwards. WARNING: If you autoportal with BetterAutoFight disabled, the game sits there doing nothing until you click FIGHT. (not good for afk) ', 'multitoggle',1,null,"Core");
createSetting('AutoStance', ['Auto Stance OFF','Auto Stance 1','Auto Stance 2'], 'Automatically swap stances to avoid death. Please test the Autostance #2, its very experimental, and in beta.', 'multitoggle',1,null,"Core");
createSetting('BuyStorage', 'Buy Storage', 'Will buy storage when resource is almost full. (like AutoStorage, even anticipates Jestimp)', 'boolean',true,null,"Core");
createSetting('BuyBuildings', 'Buy Buildings', 'Will buy non storage buildings as soon as they are available', 'boolean',true,null,"Core");
createSetting('BuyJobs', 'Buy Jobs', 'Buys jobs based on ratios configured below. CAUTION: you cannot manually assign jobs with this. Toggle if you need to.', 'boolean',true,null,"Core");
createSetting('BuyUpgrades', 'Buy Upgrades', 'Autobuy non equipment Upgrades', 'boolean',true,null,"Core");
createSetting('BuyArmor', 'Buy Armor', 'Auto-Buy/Level-Up the most cost efficient armor available. ', 'boolean',true,null,"Core");
createSetting('BuyArmorUpgrades', 'Buy Armor Upgrades', '(Prestiges) & Gymystic. Will buy the most efficient armor upgrade available. ', 'boolean',true,null,"Core");
createSetting('BuyWeapons', 'Buy Weapons', 'Auto-Buy/Level-Up the most cost efficient weapon available. ', 'boolean',true,null,"Core");
createSetting('BuyWeaponUpgrades', 'Buy Weapon Upgrades', '(Prestiges) Will buy the most efficient weapon upgrade available. ', 'boolean',true,null,"Core");
createSetting('TrapTrimps', 'Trap Trimps', 'Automatically trap trimps when needed, including building traps. (when you turn off, make sure you also turn off the ingame AutoTraps button)', 'boolean',true,null,"Core");
createSetting('BuyShieldblock', 'Buy Shield Block', 'Will buy the shield block upgrade. CAUTION: If you are progressing past zone 60, you probably don\'t want this :)', 'boolean',false,null,"Core");
createSetting('AutoHeirlooms', 'Auto Heirlooms', 'Automatically evaluate and carry the best heirlooms, and recommend upgrades for equipped items. AutoHeirlooms will only change carried items when the heirlooms window is not open. Carried items will be compared and swapped with the types that are already carried. If a carry spot is empty, it will be filled with the best shield (if available). Evaluation is based ONLY on the following mods (listed in order of priority, high to low): Void Map Drop Chance/Trimp Attack, Crit Chance/Crit Damage, Miner Efficiency/Metal Drop, Gem Drop/Dragimp Efficiency, Farmer/Lumberjack Efficiency. For the purposes of carrying, rarity trumps all of the stat evaluations. Empty mod slots are valued at the average value of the best missing mod.', 'boolean',true,null,"Core");
createSetting('HireScientists', 'Hire Scientists', 'Enable or disable hiring of scientists. Math: ScientistRatio=(FarmerRatio+LumberjackRatio+MinerRatio)/25 and stops hiring scientists after 250k Farmers.', 'boolean',true,null,"Core");
createSetting('WorkerRatios', 'Auto Worker Ratios', 'Automatically changes worker ratios based on current progress. WARNING: overrides worker ratio settings. Settings: 1/1/1 up to 300k trimps, 3/3/5 up to 3mil trimps, then 3/1/4 above 3 mil trimps, then 1/1/10 above 1000 tributes, then 1/2/22 above 1500 tributes, then 1/12/12 above 3000 tributes.', 'boolean',true,null,"Core");
createSetting('ManageBreedtimer', 'Auto Breed Timer', '<u>Genetecist management is controlled by the Timer setting box to the right, not this.</u><br><b>Explanation: </b><br><U>[ON](Green): </U>All this does is auto-choose the appropriate timer for various challenges (0, 3.5s, 10s, 30s).<br><U>[OFF](Red): </U>You set the Timer yourself! Even if this is red, it still tampers with genetecists if the timer is >= 0.<br><b>Note: </b>Using AutoStance is recommended to survive the full 30 seconds or else Auto will probably be undesirable.', 'boolean',true,null,"Core");
createSetting('GeneticistTimer', 'Geneticist Timer', 'Manages the breed timer by hiring/firing Geneticists for the purpose of setting the ideal anticpation stacks. Disable with -1 to disable the Hiring/Firing of geneticists. <br><b>Info:</b> Potency and Nursery buying behavior is adjusted dynamically (and disabling no longer disables potency). The Automatic Genetecist Hiring Process can best be summarized by: Buy/Wait/Die,Repeat. (if you do not die, no action is taken). Also self-kills (trimpicide) aka force abandon when your anti-stacks arent maxed out (conservatively).<p><B>Controlled automatically (locked) when Auto Breed Timer is on</B>.', 'value', '30',null,"Core");
createSetting('Prestige', 'Prestige', 'Acquire prestiges through the selected item (inclusive) as soon as they are available in maps. Forces equip first mode. Automap must be enabled. THIS IS AN IMPORTANT SETTING related to speed climbing and should probably always be on something. If you find the script getting stuck somewhere, particularly where you should easily be able to kill stuff, setting this to an option lower down in the list will help ensure you are more powerful at all times, but will spend more time acquiring the prestiges in maps.', 'dropdown', 'Polierarm', ['Off', 'Supershield', 'Dagadder', 'Bootboost', 'Megamace', 'Hellishmet', 'Polierarm', 'Pantastic', 'Axeidic', 'Smoldershoulder', 'Greatersword', 'Bestplate', 'Harmbalest', 'GambesOP'],"Core");
//Make a backup of the prestige setting: backup setting grabs the actual value of the primary setting any time it is changed, (line 412 of the function settingChanged())
if (autoTrimpSettings["PrestigeBackup"] === undefined) {
autoTrimpSettings["PrestigeBackup"] = autoTrimpSettings["Prestige"];
autoTrimpSettings["PrestigeBackup"].id = "PrestigeBackup";
autoTrimpSettings["PrestigeBackup"].name = "PrestigeBackup";
}
createSetting('AutoPortal', 'Auto Portal', 'Automatically portal. Will NOT auto-portal if you have a challenge active, the challenge setting dictates which challenge it will select for the next run. All challenge settings will portal right after the challenge ends, regardless. Helium Per Hour portals at cell 1 of the first level where your He/Hr went down even slightly compared to the current runs Best He/Hr. Take note, there is a Buffer option in the genBTC settings, which is like a grace percentage of how low it can dip without triggering. CAUTION: Selecting He/hr may immediately portal you if its lower.', 'dropdown', 'Off', ['Off', 'Helium Per Hour', 'Balance', 'Decay', 'Electricity', 'Crushed', 'Nom', 'Toxicity', 'Watch', 'Lead', 'Corrupted', 'Custom'],"Core");
createSetting('HeliumHourChallenge', 'Challenge for Helium per Hour and Custom', 'Automatically portal into this challenge when using helium per hour or custom autoportal. Custom portals after cell 100 of the zone specified. ', 'dropdown', 'None', ['None', 'Balance', 'Decay', 'Electricity', 'Crushed', 'Nom', 'Toxicity', 'Watch', 'Lead','Corrupted'],"Core");
document.getElementById("HeliumHourChallengeLabel").innerHTML = "Challenge:";
createSetting('CustomAutoPortal', 'Custom Portal', 'Automatically portal AFTER clearing this level.(ie: setting to 200 would portal when you first reach level 201)', 'value', '200',null, "Core");
createSetting('HeHrDontPortalBefore', 'He/Hr Dont Portal Before', 'Do NOT allow Helium per Hour AutoPortal setting to portal BEFORE this level is reached. It is an additional check that prevents drops in helium/hr from triggering autoportal. Set to 0 or -1 to completely disable this check.', 'value', '200',null, "Core");
createSetting('HeliumHrBuffer', 'He/Hr Portal Buffer %', 'IMPORTANT SETTING. When using the He/Hr Autoportal, it will portal if your He/Hr drops by this amount of % lower than your best for current run, default is 0% (ie: set to 5 to portal at 95% of your best)', 'value', '0', null, 'Core');
createSetting('PauseScript', 'Pause AutoTrimps', 'Pause AutoTrimps Script (not including the graphs module)', 'boolean', null, null, 'Core');
//AutoMaps + VoidMaps settings:
createSetting('AutoMaps', 'Auto Maps', 'Recommended. Automatically run maps to progress. Very Important. Has multiple modes: <b>Prestige, Voids, Want more Damage, Want more Health, Want Health & Damage, and Farming.</b>Prestige takes precedence and does equal level maps until it gets what is needed as per Autotrimps Prestige dropdown setting. Voids is self explanatory: use the Void Difficulty Check setting to control the amount of farming. If \'want more damage\', it will only do 10 maps for 200% mapbonus damage bonus. If \'Farming\', it does maps beyond 10 if the displayed number is over >16x. \'Want more health[or and damage]\' is basically just a status message telling you need more health, theres not much that can be done besides tell AutoLevelEquipment to keep buying stuff. If you \'want health\' but your damage is OK to continue, invest in more HP perks.', 'boolean',true,null,"Maps");
createSetting('RunUniqueMaps', 'Run Unique Maps', 'Relies on AutoMaps. Decides when to run Unique maps. Required for challenges: Electricity, Mapocalypse, Meditate, and Crushed (etc) and their AutoPortal. Required to auto-run The Wall and Dimension of Anger. Required for Bionic Before Spire.', 'boolean',true,null,"Maps");
createSetting('DynamicSiphonology', 'Dynamic Siphonology', 'Recommended Always ON. Use the right level of siphonology based on your damage output. IE: Only uses siphonology if you are weak. With this OFF it means it ALWAYS uses the lowest siphonology map you can create. Siphonology is a perk you get at level 115-125ish, and means you receive map bonus stacks for running maps below your current zone - Up to 3 zones below (1 per perk level).', 'boolean', true, null, 'Maps');
createSetting('LowerFarmingZone', 'Lower Farming Zone', 'Lowers the zone used during Farming mode. Uses the dynamic siphonology code, to Find the minimum map level you can successfully one-shot, and uses this level for any maps done after the first 10 map stacks. The difference being it goes LOWER than what Siphonology gives you map-bonus for, but after 10 stacks you dont need bonus, you just want to do maps that you can one-shot. Goes as low as 10 below current zone if your damage is that bad, but this is extreme and indicates you should probably portal.', 'boolean', true, null, 'Maps');
createSetting('MinutestoFarmBeforeSpire', 'Minutes to Farm Before Spire', 'Farm level 200/199(or BW) maps for X minutes before continuing onto attempting Spire - No Longer runs 10 maps prior to this countdown, so your timer will likely need to increase. (0 to disable)', 'value', '0', null, 'Maps');
createSetting('RunBionicBeforeSpire', 'Run Bionic Before Spire', 'CAUTION: Runs Bionic Wonderlands and repeatedly farms VI(level 200) before attempting Spire, for the purpose of farming. Then attempts the spire. The Minutes-Before-Spire timer runs concurrently to this, and needs to be set. If not set, it will exit without doing any Bionics... You can un-toggle it as desired. WARNING: These 100 square maps take ~3x longer than normal maps. WARNING: If you dont have Bionic Magnet mastery, this will run the pre-requisites and take longer.' , 'boolean', null, null, 'Maps');
createSetting('ExitSpireCell', 'Exit Spire After Cell', 'Optional/Rare. Exits the Spire early, after completing cell X. example: 40 for Row 4. (better use 0 to disable, not -1)', 'value', '0', null, 'Maps');
createSetting('CorruptionCalc', 'Corruption Farm Mode', 'Recommended. Enabling this will cause the Automaps routine to take amount of corruption in a zone into account, to decide whether it should do maps first for map bonus. ONLY in Zone 181+ (or Headstart 1,2,3 zone: 176,166,151) ', 'boolean', false, null, 'Maps');
createSetting('FarmWhenNomStacks7', 'Farm on >7 NOMstacks', 'Optional. On Improbability(cell 100). Ideally meant to be used with DisableFarming (otherwise farming would take care of this, but its slower). If Improbability already has 5 NOMstacks, stack 30 Anticipation. If the Improbability has >7 NOMstacks on it, get +200% dmg from MapBonus. If we still cant kill it, enter Farming mode at 30 stacks, Even with DisableFarming On! (exits when we get under 10x)', 'boolean', null, null, 'Maps');
createSetting('VoidMaps', 'Void Maps', 'The zone at which you want all your void maps to be cleared (Cell 96). 0 is off', 'value', '0',null,"Maps");
createSetting('RunNewVoids', 'Run New Voids', 'Run new void maps acquired after the set void map zone. Runs them at Cell 95 by default, unless you set a decimal value indicating the cell, like: 187.75 CAUTION: May severely slow you down by trying to do too-high level voidmaps. Use the adjacent RunNewVoidsUntil setting to limit this.', 'boolean', null, null, 'Maps');
createSetting('RunNewVoidsUntil', 'New Voids Until', 'Run New Voids Until: Put a cap on what zone new voids will run at, until this zone, inclusive. ', 'value', '-1', null, 'Maps');
//createSetting('VoidsPerZone', 'Voids per Zone', 'Run a max of this many Voids per zone, if you have a lot of Voids saved up. Then moves onto the next zone and does more voids.', 'value', '-1', null, 'Maps');
createSetting('VoidCheck', 'Void Difficulty Check', 'How many hits to be able to take from a void map boss in X stance before we attempt the map. Higher values will get you stronger (by farming for health) before attempting. 12 should be fine.', 'value', '12', null, 'Maps');
createSetting('MaxTox', 'Max Toxicity Stacks', 'Get maximum toxicity stacks before killing the improbability in each zone 60 and above. Generally only recommended for 1 run to maximize bone portal value. This setting will revert to disabled after a successful Max-Tox run + Toxicity Autoportal.', 'boolean', null, null, 'Maps');
createSetting('DisableFarm', 'Disable Farming', 'Disables the extended farming algorithm of the AutoMaps part of the script. Always returns to the world after reaching 10 map stacks. Use at your own risk. (No need to refresh anymore)', 'boolean', null, null, 'Maps');
//Settings:
createSetting('FarmerRatio', 'Farmer Ratio', '', 'value', '1',null,"Settings");
createSetting('LumberjackRatio', 'Lumberjack Ratio', '', 'value', '1',null,"Settings");
createSetting('MinerRatio', 'Miner Ratio', '', 'value', '1',null,"Settings");
createSetting('MaxScientists', 'Max Scientists', 'Advanced. Cap your scientists. recommend: -1 ("infinite" still controls itself and caps to around 250k under normal situations)', 'value', '-1',null,"Settings");
createSetting('MaxExplorers', 'Max Explorers', 'Cap your explorers, most of fragments are gained by looting not gathering. recommend: 150', 'value', '150',null,"Settings");
createSetting('MaxTrainers', 'Max Trainers', 'Advanced. Cap your trainers. recommend: -1', 'value', '-1',null,"Settings");
createSetting('MaxHut', 'Max Huts', 'Huts', 'value', '100',null,"Settings");
createSetting('MaxHouse', 'Max Houses', 'Houses', 'value', '100',null,"Settings");
createSetting('MaxMansion', 'Max Mansions', 'Mansions', 'value', '100',null,"Settings");
createSetting('MaxHotel', 'Max Hotels', 'Hotels', 'value', '100',null,"Settings");
createSetting('MaxResort', 'Max Resorts', 'Resorts', 'value', '100',null,"Settings");
createSetting('MaxGateway', 'Max Gateways', 'WARNING: Not recommended to raise above 25', 'value', '25',null,"Settings");
createSetting('MaxWormhole', 'Max Wormholes', 'WARNING: Wormholes cost helium! Values below 0 do nothing.', 'value', '0',null,"Settings");
createSetting('MaxCollector', 'Max Collectors', 'recommend: -1', 'value', '-1',null,"Settings");
createSetting('FirstGigastation', 'First Gigastation', 'How many warpstations to buy before your first gigastation', 'value', '20',null,"Settings");
createSetting('DeltaGigastation', 'Delta Gigastation', 'How many extra warpstations to buy for each gigastation. Supports decimal values. For example 2.5 will buy +2/+3/+2/+3...', 'value', '2',null,"Settings");
createSetting('MaxGym', 'Max Gyms', 'Advanced. recommend: -1', 'value', '-1',null,"Settings");
createSetting('MaxTribute', 'Max Tributes', 'Advanced. recommend: -1 ', 'value', '-1',null,"Settings");
createSetting('MaxNursery', 'Max Nurseries', 'Advanced. recommend: -1', 'value', '-1',null,"Settings");
//Settings advanced settings
createSetting('LimitEquipment', 'Limit Equipment', 'Limit levels of equipment bought to:(level 11 - the prestige level). At or Above Prestige X (10), your equipment will remain at level 1. In other words, do not level equipment after ~level ~51, and only buy Prestiges. CAUTION: may reduce He/hr performance in many cases.', 'boolean', null, null, 'Settings');
createSetting('BreedFire', 'Breed Fire', 'OPTIONAL. Fire Lumberjacks and Miners to speed up breeding when needed. Basically trades wood/metal to cut the wait between deaths down. Disclaimer: May heavily negatively impact wood-gathering. ', 'boolean', null, null, 'Settings');
createSetting('AutoMagmamancers', 'Auto Magmamancers', 'OPTIONAL. Auto Magmamancer Management. Hires Magmamancers when the Current Zone time goes over 10 minutes. Does a one-time spend of at most 10% of your resources. Every increment of 10 minutes after that repeats the 10% hiring process. Disclaimer: May negatively impact Gem count.', 'boolean', null, null, 'Settings');
//genBTC advanced settings - option buttons.
createSetting('WarpstationCap', 'Warpstation Cap', 'Do not level Warpstations past Basewarp+DeltaGiga **. Without this, if a Giga wasnt available, it would level infinitely (wastes metal better spent on prestiges instead.) **The script bypasses this cap each time a new giga is bought, when it insta-buys as many as it can afford (since AT keeps available metal/gems to a low, overbuying beyond the cap to what is affordable at that first moment is not a bad thing). ', 'boolean', null, null, 'genBTC');
createSetting('WarpstationWall3', 'Warpstation Wall', 'Conserves Metal. Only buys 1 Warpstation when you can afford <b>X</b> warpstations metal cost (at the first one\'s price, simple math). -1, 0, 1 = disable. In other words, only allows warps that cost less than 1/nth your currently owned metal. (to save metal for prestiges)', 'value', 0, null, 'genBTC');
createSetting('CapEquip', 'Cap Equip to 10', 'Do not level equipment past 10. Similar to LimitEquipment, Helps for early game when the script wants to level your tier2s to 40+, but unlike LimitEquipment, does not impact Zone 60+.', 'boolean', null, null, 'genBTC');
createSetting('AlwaysArmorLvl2', 'Always Buy Lvl 2 Armor', 'Always Buy the 2nd point of Armor even if we dont need the HP. Its the most cost effective level, and the need HP decision script isnt always adequate. FORCE on during Spire.', 'boolean', null, null, 'genBTC');
createSetting('WaitTill60', 'Skip Gear Level 58&59', 'Dont Buy Gear during level 58 and 59, wait till level 60, when cost drops down to 10%.', 'boolean', null, null, 'genBTC');
createSetting('DelayArmorWhenNeeded', 'Delay Armor', 'Delays buying armor prestige-upgrades during Want More Damage or Farming automap-modes, Although if you need health AND damage, it WILL buy armor prestiges tho.', 'boolean', null, null, 'genBTC');
createSetting('AutoRoboTrimp', 'AutoRoboTrimp', 'Use RoboTrimps ability starting at this level, and every 5 levels thereafter. (set to 0 to disable. default 60.) 60 is a good choice for mostly everybody.', 'value', '60', null, 'genBTC');
createSetting('AutoGoldenUpgrades', 'AutoGoldenUpgrades', 'IMPORTANT SETTING. Automatically Buy the specified Golden Upgrades as they become available.', 'dropdown', 'Off', ["Off","Helium", "Battle", "Void"], 'genBTC');
//migrate old dynamic prestige to new dynamic prestige
if (autoTrimpSettings["DynamicPrestige2"] === undefined && autoTrimpSettings["DynamicPrestige"]) {
var lastzone;
if (autoTrimpSettings["DynamicPrestige"].enabled) {
lastzone = checkPortalSettings() - 1; //subtract 1 because the function adds 1 for its own purposes.
//if we can't figure out lastzone (likely Helium per Hour AutoPortal setting), then use the last run's Portal zone.
if (lastzone < 0)
lastzone = game.global.lastPortal;
}
createSetting('DynamicPrestige2', 'Dynamic Prestige z', 'Dynamic Prestige: <b>Set Target Zone number: Z #. (disable with 0 or -1)</b><br> Skip getting prestiges at first, and Gradually work up to the desired Prestige setting you have set (set the Prestige dropdown to the highest weapon you want to end up on at the target zone you set here). Runs with Dagger to save a significant amount of time until we need better gear, then starts increasing the prestige setting near the end of the run. Examines which prestiges you have, how many missing ones youd need to achieve the desired target and starts running 5 maps or 2 maps every zone, Until the target prestige is reached. Example: For mace, starts getting the prerequisite prestiges 10 zones away from max, then more and more, finally reaching the desired prestige by the last final zone (also goes for 9 mapbonus on the last zone). ', 'value', -1, null, 'genBTC');
setPageSetting("DynamicPrestige2",lastzone);
} else {
createSetting('DynamicPrestige2', 'Dynamic Prestige z', 'Dynamic Prestige: <b>Set Target Zone number: Z #. (disable with 0 or -1)</b><br> Skip getting prestiges at first, and Gradually work up to the desired Prestige setting you have set (set the Prestige dropdown to the highest weapon you want to end up on at the target zone you set here). Runs with Dagger to save a significant amount of time until we need better gear, then starts increasing the prestige setting near the end of the run. Examines which prestiges you have, how many missing ones youd need to achieve the desired target and starts running 5 maps or 2 maps every zone, Until the target prestige is reached. Example: For mace, starts getting the prerequisite prestiges 10 zones away from max, then more and more, finally reaching the desired prestige by the last final zone (also goes for 9 mapbonus on the last zone). ', 'value', -1, null, 'genBTC');
}
createSetting('AutoHeirlooms2', 'Auto Heirlooms2', 'IMPORTANT SETTING. New algorithm for Heirlooms. While enabled, the old AutoHeirlooms algorithm will be disabled (the button will stay lit or you can turn that one off). CAUTION: Turning this on will immediately re-sort your heirlooms according to the new algorithm, and turning it off again DOES revert to the original algorithm even though it may NOT have a visible result on your heirlooms. (fyi: This lack of action highlights one of the problems with the old one.) ', 'boolean', null, null, 'genBTC');
createSetting('AutoUpgradeHeirlooms', 'Auto Upgrade Heirlooms', 'Automatically buys the upgrades the script advises for the Equipped shield and staff, until we are out of nullifium.', 'boolean', null, null,'genBTC');
createSetting('TrainerCaptoTributes', 'Cap Trainers to a % of Tributes', 'Only Buy a Trainer when its cost is LESS than X% of cost of a tribute. This setting can work in combination with the other one, or set the other one to -1 and this will take full control. Default: -1 (Disabled). 50% is close to the point where the cap does nothing. You can go as low as you want but recommended is 10% to 1%. (example: Trainer cost of 5001, Tribute cost of 100000, @ 5%, it would NOT buy the trainer.)', 'value', '-1', null, 'genBTC');
createSetting('NoNurseriesUntil', 'No Nurseries Until z', 'For Magma z230+ purposes. Nurseries get shut down, and wasting nurseries early on is probably a bad idea. Might want to set this to 230+ for now. Can use combined with the old Max Nurseries cap setting.', 'value', 0, null, 'genBTC');
createSetting('AutoMagmiteSpender2', ['Spend Magmite OFF','Spend Magmite (Portal)','Spend Magmite Always'], 'Auto Spends any unspent Magmite immediately before portaling. (Or Always, if toggled). Part 1 buys any permanent one-and-done upgrades in order from most expensive to least. Part 2 then analyzes Efficiency vs Capacity for cost/benefit, and buys Efficiency if its BETTER than Capacity. If not, if the PRICE of Capacity is less than the price of Supply, it buys Capacity. If not, it buys Supply. And then it repeats itself until you run out of Magmite and cant buy anymore. For Magma z230+ purposes.', 'multitoggle', 1, null, 'genBTC');
createSetting('ForceAbandon', 'Auto Force-Abandon', '(Trimpicide). If a new fight group is available and anticipation stacks arent maxed, force abandon and grab a new group. Located in the geneticist management script. I would leave this on. EXPERIMENTAL.', 'boolean', true, null, 'genBTC');
createSetting('GymWall', 'Gym Wall', 'Conserves Wood. Only buys 1 Gym when you can afford <b>X</b> gyms wood cost (at the first one\'s price, simple math). -1 or 0 to disable. In other words, only allows gyms that cost less than 1/nth your currently owned wood. (to save wood for nurseries for new z230+ Magma nursery strategy). Takes decimal numbers. (Identical to the Warpstation wall setting which is why its called that). Setting to 1 does nothing besides stopping gyms from being bought 2 at a time due to the mastery.', 'value', 0, null, 'genBTC');
createSetting('AutoFinishDaily', 'Auto Finish Daily', 'With this on, the He/Hr Portal and Custom Auto Portal options will auto-finish the daily <b>whenever they trigger</b> and THEN portal you.', 'boolean', false, null, 'genBTC');
createSetting('DynamicGyms', 'Dynamic Gyms', 'Designed to limit your block to slightly more than however much the enemy attack is. If MaxGyms is capped or GymWall is set, those will still work, and this will NOT override those (works concurrently), but it will further limit them. In the future it may override, but the calculation is not easy to get right so I dont want it undo-ing other things yet. EXPERIMENTAL.', 'boolean', false, null, 'genBTC');
// Scryer settings
createSetting('UseScryerStance', 'Use Scryer Stance', '<b>MASTER BUTTON</b> Stay in Scryer stance in z181 and above (Overrides Autostance). Falls back to regular Autostance when not in use (so leave that on). Get 2x resources or Dark Essence. <u>All other buttons have no effect if this one is off.</u>', 'boolean',true,null,'Scryer');
createSetting('ScryerUseWhenOverkill', 'Use When Overkill', 'Use when we can Overkill in S stance, for double loot with no speed penalty. Recommend this be on. NOTE: This being on, and being able to overkill in S will override ALL other settings <u>(Except never use in spire)</u>. This is a boolean logic shortcut that disregards all the other settings including Min and Max Zone. If you ONLY want to use S during Overkill, as a workaround: turn this on and Min zone: to 9999 and everything else off(red). ', 'boolean', true,null, 'Scryer');
createSetting('ScryerMinZone', 'Min Zone', 'Minimum zone to start using scryer in.(inclusive) Recommend:(60 or 181). This needs to be On & Valid for options other than Overkill to work. Tip: Use 9999 to disable all other Non-Overkill scryer usage.', 'value', '181', null, 'Scryer');
createSetting('ScryerMaxZone', 'Max Zone', 'Zone to STOP using scryer at.(not inclusive) Recommend: Leave off (0 or -1 to disable: doesnt prevent options other than Overkill from working.) Positive numbers DO disable it past that zone. ', 'value', '230',null, 'Scryer');
createSetting('ScryerUseinMaps2', ['Maybe Use in Maps','Force Use in Maps'], 'Maybe/Force Use in Maps. Overkill overrides this setting. Does not have to be on for Overkill Button to use S in maps. (Obeys zone settings)', 'multitoggle', 0,null, 'Scryer');
createSetting('ScryerUseinVoidMaps2', ['Maybe Use in VoidMaps','Force Use in VoidMaps'], 'Maybe/Force Use in Void Maps. Overkill overrides this setting. Does not have to be on for Overkill Button to use S in VoidMaps. (Obeys zone settings)', 'multitoggle', 0,null, 'Scryer');
createSetting('ScryerUseinSpire2', ['Maybe Use in Spire','Force Use in Spire','Never Use in Spire'],'Maybe/Force/Never Use in Spire. <b>Never WILL override the Overkill setting, and never use S in Spire.</b> Maybe means default - treat Spire like any other cell (something else has to be ON to trigger Scryer). Force = Always use S.', 'multitoggle', 0,null, 'Scryer');
createSetting('ScryerSkipBoss2', ['Default on Cell 100','Never Use on Cell 100 above VoidLevel','Never Use on Cell 100 (ALL Levels)'], 'On cell 100: Default/Never Use(above VoidLevel)/Never Use(ALL Levels). Overkill overrides this setting. Doesnt use Scrying stance for world Improbabilities/Bosses (cell 100) if you are past the level you have your VoidMaps set to run at. (or all levels, if set.) Default treats cell 100 like any other cell.', 'multitoggle', 0,null, 'Scryer');
createSetting('ScryerSkipCorrupteds2', ['Maybe Use S on Corrupteds','Dont Use S on Corrupteds'], 'Overkill overrides this setting, even on Dont Use. Turning this Green doesnt use S stance for corrupted cells UNLESS you can overkill them. Red/Maybe just means default (corrupteds are treated like normal cells), so something else has to be ON to trigger Scryer to be used. <b>Magma maps and Corrupted Voidmaps are classified under this box as corrupted</b> and Green-DontUse here will override the ForceMaps/ForceVoidmaps (for now)', 'multitoggle', 0,null, 'Scryer');
//Spam settings:
createSetting('SpamGeneral', 'General Spam', 'General Spam = Starting Zone, Auto He/Hr, AutoMagmiteSpender ', 'boolean', true, null, 'Spam');
createSetting('SpamUpgrades', 'Upgrades Spam', 'Upgrades Spam', 'boolean', true, null, 'Spam');
createSetting('SpamEquipment', 'Equipment Spam', 'Equipment Spam', 'boolean', true, null, 'Spam');
createSetting('SpamMaps', 'Maps Spam', 'Maps Spam = Buy,Pick,Run Maps,Recycle,CantAfford', 'boolean', true, null, 'Spam');
createSetting('SpamOther', 'Other Spam', 'Other Spam = Better Auto Fight, Trimpicide, Robotrimp, AutoMagmamancers', 'boolean', true, null, 'Spam');
createSetting('SpamBuilding', 'Building Spam', 'Building Spam = all buildings, even storage', 'boolean', false, null, 'Spam');
createSetting('SpamJobs', 'Job Spam', 'Job Spam = All jobs, in scientific notation', 'boolean', false, null, 'Spam');
// Export/Import/Default settings
createSetting('ExportAutoTrimps', 'Export AutoTrimps', 'Export your Settings.', 'infoclick', 'ExportAutoTrimps', null, 'Import Export');
createSetting('ImportAutoTrimps', 'Import AutoTrimps', 'Import your Settings.', 'infoclick', 'ImportAutoTrimps', null, 'Import Export');
createSetting('DefaultAutoTrimps', 'Reset to Default', 'Reset everything to the way it was when you first installed the script.', 'infoclick', 'DefaultAutoTrimps', null, 'Import Export');
createSetting('CleanupAutoTrimps', 'Cleanup Saved Settings ', 'Deletes old values from previous versions of the script from your AutoTrimps Settings file.', 'infoclick', 'CleanupAutoTrimps', null, 'Import Export');
}
initializeAllSettings();
function loadAutoTrimps() {
//try the import
try {
var thestring = document.getElementById("importBox").value.replace(/(\r\n|\n|\r)/gm,"");
var tmpset = JSON.parse(thestring);
if (tmpset == null)
return;
} catch(err) {
debug("Error importing, the string is bad." + err.message);
return;
}
ATrunning = false; //stop AT, wait, remove
setTimeout(localStorage.removeItem('autoTrimpSettings'),101);
autoTrimpSettings = new Object(); //delete,remake
autoTrimpSettings = tmpset; //load the import.
//load everything again, anew
var settingsrow = document.getElementById("settingsRow");
settingsrow.removeChild(document.getElementById("autoSettings"));
automationMenuSettingsInit();
initializeAllTabs();
initializeAllSettings();
updateCustomButtons();
saveSettings();
checkPortalSettings();
ATrunning = true; //restart AT.
}
function AutoTrimpsTooltip(what, isItIn, event) {
if (game.global.lockTooltip)
return;
var elem = document.getElementById("tooltipDiv");
swapClass("tooltipExtra", "tooltipExtraNone", elem);
var ondisplay = null; // if non-null, called after the tooltip is displayed
var tooltipText;
var costText = "";
if (what == "ExportAutoTrimps"){
tooltipText = "This is your AUTOTRIMPS save string. There are many like it but this one is yours. Save this save somewhere safe so you can save time next time. <br/><br/><textarea id='exportArea' style='width: 100%' rows='5'>" + JSON.stringify(autoTrimpSettings) + "</textarea>";
costText = "<div class='maxCenter'><div id='confirmTooltipBtn' class='btn btn-info' onclick='cancelTooltip()'>Got it</div>";
if (document.queryCommandSupported('copy')){
costText += "<div id='clipBoardBtn' class='btn btn-success'>Copy to Clipboard</div>";
ondisplay = function(){
document.getElementById('exportArea').select();
document.getElementById('clipBoardBtn').addEventListener('click', function(event) {
document.getElementById('exportArea').select();
try {
document.execCommand('copy');
} catch (err) {
document.getElementById('clipBoardBtn').innerHTML = "Error, not copied";
}
});
};
}
else {
ondisplay = function(){
document.getElementById('exportArea').select();
};
}
costText += "</div>";
}
else if (what == "ImportAutoTrimps"){
//runs the loadAutoTrimps() function.
tooltipText = "Import your AUTOTRIMPS save string! It'll be fine, I promise.<br/><br/><textarea id='importBox' style='width: 100%' rows='5'></textarea>";
costText="<div class='maxCenter'><div id='confirmTooltipBtn' class='btn btn-info' onclick='cancelTooltip(); loadAutoTrimps();'>Import</div><div class='btn btn-info' onclick='cancelTooltip()'>Cancel</div></div>";
ondisplay = function () {
document.getElementById('importBox').focus();
};
}
else if (what == "DefaultAutoTrimps"){
resetAutoTrimps();
tooltipText = "Autotrimps has been successfully reset to its defaults! ";
costText="<div class='maxCenter'><div id='confirmTooltipBtn' class='btn btn-info' onclick='cancelTooltip();'>OK</div></div>";
debug(tooltipText,"other");
}
else if (what == "CleanupAutoTrimps"){
cleanupAutoTrimps();
tooltipText = "Autotrimps saved-settings have been attempted to be cleaned up. If anything broke, refreshing will fix it, but check that your settings are correct! (prestige in particular)";
costText="<div class='maxCenter'><div id='confirmTooltipBtn' class='btn btn-info' onclick='cancelTooltip();'>OK</div></div>";
}
game.global.lockTooltip = true;
elem.style.left = "33.75%";
elem.style.top = "25%";
document.getElementById("tipTitle").innerHTML = what;
document.getElementById("tipText").innerHTML = tooltipText;
document.getElementById("tipCost").innerHTML = costText;
elem.style.display = "block";
if (ondisplay !== null)
ondisplay();
}
//remove stale values
function cleanupAutoTrimps() {
for (var setting in autoTrimpSettings) {
var elem = document.getElementById(autoTrimpSettings[setting].id);
if (elem == null)
delete autoTrimpSettings[setting];
}
}
//reset to defaults
function resetAutoTrimps() {
//stop AT, wait, remove
ATrunning = false;
setTimeout(localStorage.removeItem('autoTrimpSettings'),101);
//delete,remake,init defaults, recreate everything:
autoTrimpSettings = new Object();
var settingsrow = document.getElementById("settingsRow");
settingsrow.removeChild(document.getElementById("autoSettings"));
automationMenuSettingsInit();
initializeAllTabs();
initializeAllSettings();
updateCustomButtons();
saveSettings();
checkPortalSettings();
ATrunning = true; //start AT.
}
function automationMenuInit() {
var settingBtnSrch = document.getElementsByClassName("btn btn-default");
for (var i = 0; i < settingBtnSrch.length; i++) {
if (settingBtnSrch[i].getAttribute("onclick") === "toggleSettingsMenu()")
settingBtnSrch[i].setAttribute("onclick", "autoPlusSettingsMenu()");
}
//create the AutoTrimps Script button
var newItem = document.createElement("TD");
newItem.appendChild(document.createTextNode("AutoTrimps"));
newItem.setAttribute("class", "btn btn-default");
newItem.setAttribute("onclick", "autoToggle()");
var settingbarRow = document.getElementById("settingsTable").firstElementChild.firstElementChild;
settingbarRow.insertBefore(newItem, settingbarRow.childNodes[10]);
//create automaps button
var newContainer = document.createElement("DIV");
newContainer.setAttribute("class", "battleSideBtnContainer");
newContainer.setAttribute("style", "display: block;");
newContainer.setAttribute("id", "autoMapBtnContainer");
var abutton = document.createElement("SPAN");
abutton.appendChild(document.createTextNode("Auto Maps"));
abutton.setAttribute("class", "btn fightBtn btn-success");
abutton.setAttribute("id", "autoMapBtn");
abutton.setAttribute("onClick", "settingChanged('AutoMaps')");
abutton.setAttribute("onmouseover", 'tooltip(\"Toggle Automapping\", \"customText\", event, \"Toggle automapping on and off.\")');
abutton.setAttribute("onmouseout", 'tooltip("hide")');
var fightButtonCol = document.getElementById("battleBtnsColumn");
newContainer.appendChild(abutton);
fightButtonCol.appendChild(newContainer);
//create automaps status
newContainer = document.createElement("DIV");
newContainer.setAttribute("style", "display: block; font-size: 1.1vw; text-align: center; background-color: rgba(0,0,0,0.3);");
newContainer.setAttribute("onmouseover", 'tooltip(\"Health to Damage ratio\", \"customText\", event, \"This status box displays the current mode Automaps is in. The number usually shown here during Farming or Want more Damage modes is the \'HDratio\' meaning EnemyHealth to YourDamage Ratio (in X stance). Above 16 will trigger farming, above 4 will trigger going for Map bonus up to 10 stacks. If the number is not shown, hovering will display it below.<p><b>enoughHealth: </b>\" + enoughHealth + \"<br><b>enoughDamage: </b>\" + enoughDamage +\"<br><b>shouldFarm: </b>\" + shouldFarm +\"<br><b>H:D ratio = </b>\" + HDratio + \"<br>\")');
newContainer.setAttribute("onmouseout", 'tooltip("hide")');
abutton = document.createElement("SPAN");
abutton.id = 'autoMapStatus';
newContainer.appendChild(abutton);
fightButtonCol.appendChild(newContainer);
//create hiderStatus - He/hr percent
newContainer = document.createElement("DIV");
newContainer.setAttribute("style", "display: block; font-size: 1vw; text-align: center; margin-top: 2px; background-color: rgba(0,0,0,0.3);");
newContainer.setAttribute("onmouseover", 'tooltip(\"Helium/Hr Info\", \"customText\", event, \"1st is Current He/hr % out of Lifetime He(not including current+unspent).<br> 0.5% is an ideal peak target. This can tell you when to portal... <br>2nd is Current run Total He earned / Lifetime He(not including current) \")');
newContainer.setAttribute("onmouseout", 'tooltip("hide")');
abutton = document.createElement("SPAN");
abutton.id = 'hiderStatus';
newContainer.appendChild(abutton);
fightButtonCol.appendChild(newContainer);
//make timer click toggle paused mode
document.getElementById('portalTimer').setAttribute('onclick', 'toggleSetting(\'pauseGame\')');
document.getElementById('portalTimer').setAttribute('style', 'cursor: default');
//shrink padding for fight buttons to help fit automaps button/status
var btns = document.getElementsByClassName("fightBtn");
for (var x = 0; x < btns.length; x++){
btns[x].style.padding = "0.01vw 0.01vw";
}
}
//toggles the display of the settings menu.
function autoToggle(what){
if(what) {
whatobj = document.getElementById(what);
if(whatobj.style.display === 'block'){
whatobj.style.display = 'none';
document.getElementById(what+'BTN').style.border = '';
}
else {
whatobj.style.display = 'block';
document.getElementById(what+'BTN').style.border = '4px solid green';
}
}
else {
if (game.options.displayed)
toggleSettingsMenu();
if (document.getElementById('graphParent').style.display === 'block')
document.getElementById('graphParent').style.display = 'none';
var item = document.getElementById('autoSettings');
if (item.style.display === 'block')
item.style.display = 'none';
else item.style.display = 'block';
}
}
//overloads the settings menu button to include hiding the auto menu settings.
function autoPlusSettingsMenu() {
var item = document.getElementById('autoSettings');
if(item.style.display === 'block')
item.style.display='none';
item = document.getElementById('graphParent');
if(item.style.display === 'block')
item.style.display='none';
toggleSettingsMenu();
}
function createSetting(id, name, description, type, defaultValue, list, container) {
var btnParent = document.createElement("DIV");
// btnParent.setAttribute('class', 'optionContainer');
btnParent.setAttribute('style', 'display: inline-block; vertical-align: top; margin-left: 1vw; margin-right: 1vw; margin-bottom: 1vw; width: 14.5vw;');
var btn = document.createElement("DIV");
btn.id = id;
if (type == 'boolean') {
if (autoTrimpSettings[id] === undefined) {
autoTrimpSettings[id] = {
id: id,
name: name,
description: description,
type: type,
enabled: defaultValue ? defaultValue : false
};
}
btn.setAttribute('class', 'noselect settingsBtn settingBtn' + autoTrimpSettings[id].enabled);
btn.setAttribute("onclick", 'settingChanged("' + id + '")');
btn.setAttribute("onmouseover", 'tooltip(\"' + name + '\", \"customText\", event, \"' + description + '\")');
btn.setAttribute("onmouseout", 'tooltip("hide")');
btn.textContent = name;
btnParent.appendChild(btn);
if(container) document.getElementById(container).appendChild(btnParent);
else document.getElementById("autoSettings").appendChild(btnParent);
} else if (type == 'value') {
if (autoTrimpSettings[id] === undefined) {
autoTrimpSettings[id] = {
id: id,
name: name,
description: description,
type: type,
value: defaultValue
};
}
btn.setAttribute('class', 'noselect settingsBtn btn-info');
btn.setAttribute("onclick", 'autoSetValueToolTip("' + id + '", "' + name + '")');
btn.setAttribute("onmouseover", 'tooltip(\"' + name + '\", \"customText\", event, \"' + description + '\")');
btn.setAttribute("onmouseout", 'tooltip("hide")');
btn.textContent = name;
btnParent.appendChild(btn);
if(container) document.getElementById(container).appendChild(btnParent);
else document.getElementById("autoSettings").appendChild(btnParent);
} else if (type == 'dropdown') {
if (autoTrimpSettings[id] === undefined) {
autoTrimpSettings[id] = {
id: id,
name: name,
description: description,
type: type,
selected: defaultValue,
list: list
};
}
var btn = document.createElement("select");
btn.id = id;
if(game.options.menu.darkTheme.enabled == 2) btn.setAttribute("style", "color: #C8C8C8; font-size: 1.1vw;");
else btn.setAttribute("style", "color:black; font-size: 1.1vw;");
btn.setAttribute("class", "noselect settingsBtn");
btn.setAttribute("onmouseover", 'tooltip(\"' + name + '\", \"customText\", event, \"' + description + '\")');
btn.setAttribute("onmouseout", 'tooltip("hide")');
btn.setAttribute("onchange", 'settingChanged("' + id + '")');
for (var item in list) {
var option = document.createElement("option");
option.value = list[item];
option.text = list[item];
btn.appendChild(option);
}
btn.value = autoTrimpSettings[id].selected;
var dropdownLabel = document.createElement("Label");
dropdownLabel.id = id + "Label";
dropdownLabel.innerHTML = id + ":";
dropdownLabel.setAttribute('style', 'margin-right: 0.3vw; font-size: 0.8vw;');
btnParent.appendChild(dropdownLabel);
btnParent.appendChild(btn);
if(container) document.getElementById(container).appendChild(btnParent);
else document.getElementById("autoSettings").appendChild(btnParent);
} else if (type == 'infoclick') {
btn.setAttribute('class', 'btn btn-info');
btn.setAttribute("onclick", 'AutoTrimpsTooltip(\'' + defaultValue + '\', null, \'update\')');
btn.setAttribute("onmouseover", 'tooltip(\"' + name + '\", \"customText\", event, \"' + description + '\")');
btn.setAttribute("onmouseout", 'tooltip("hide")');
btn.setAttribute("style", "display: block; font-size: 0.8vw;");
btn.textContent = name;
btnParent.style.width = '';
btnParent.appendChild(btn);
if(container) document.getElementById(container).appendChild(btnParent);
else document.getElementById("autoSettings").appendChild(btnParent);
return;
} else if (type == 'multitoggle') {
defaultValue = defaultValue ? defaultValue : 0;
if (autoTrimpSettings[id] === undefined || autoTrimpSettings[id].type != 'multitoggle') {
autoTrimpSettings[id] = {
id: id,
name: name,
description: description,
type: type,
value: defaultValue
};
}
btn.setAttribute('class', 'noselect settingsBtn settingBtn' + autoTrimpSettings[id].value);
btn.setAttribute("onclick", 'settingChanged("' + id + '")');
btn.setAttribute("onmouseover", 'tooltip(\"' + name.join(' / ') + '\", \"customText\", event, \"' + description + '\")');
btn.setAttribute("onmouseout", 'tooltip("hide")');
btn.textContent = autoTrimpSettings[id]["name"][autoTrimpSettings[id]["value"]];
btnParent.appendChild(btn);
if(container) document.getElementById(container).appendChild(btnParent);
else document.getElementById("autoSettings").appendChild(btnParent);
}
//make sure names/descriptions match what we have stored.
if (autoTrimpSettings[id].name != name)
autoTrimpSettings[id].name = name;
if (autoTrimpSettings[id].description != description)
autoTrimpSettings[id].description = description;
}
function settingChanged(id) {
var btn = autoTrimpSettings[id];
if (btn.type == 'boolean') {
btn.enabled = !btn.enabled;
document.getElementById(id).setAttribute('class', 'noselect settingsBtn settingBtn' + btn.enabled);
}
if (btn.type == 'multitoggle') {
//puts a 5 second pause in between cycling through from "on portal" to "always" so you can switch it to "off".
if (id == 'AutoMagmiteSpender2' && btn.value == 1) {
magmiteSpenderChanged = true;
setTimeout(function(){ magmiteSpenderChanged = false;},5000);
}
btn.value++;
if (btn.value > btn.name.length-1)
btn.value = 0;
document.getElementById(id).setAttribute('class', 'noselect settingsBtn settingBtn' + btn.value);
document.getElementById(id).textContent = btn.name[btn.value];
}
if (btn.type == 'dropdown') {
btn.selected = document.getElementById(id).value;
//part of the prestige dropdown's "backup" system to prevent internal tampering via the dynamic prestige algorithm. everytime we see a user initiated change, make a backup.
if (id == "Prestige")
autoTrimpSettings["PrestigeBackup"].selected = document.getElementById(id).value;
}
updateCustomButtons();
saveSettings();
checkPortalSettings();
}
function autoSetValueToolTip(id, text) {
ranstring = text;
var elem = document.getElementById("tooltipDiv");
var tooltipText = 'Type a number below. You can also use shorthand such as 2e5 or 200k. Put -1 for Infinite.';
tooltipText += '<br/><br/><input id="customNumberBox" style="width: 50%" onkeypress="onKeyPressSetting(event, \'' + id + '\')" value=' + autoTrimpSettings[id].value + '></input>';
var costText = '<div class="maxCenter"><div class="btn btn-info" onclick="autoSetValue(\'' + id + '\')">Apply</div><div class="btn btn-info" onclick="cancelTooltip()">Cancel</div></div>';
game.global.lockTooltip = true;
elem.style.left = '32.5%';
elem.style.top = '25%';
document.getElementById('tipTitle').textContent = ranstring + ': Value Input';
document.getElementById('tipText').innerHTML = tooltipText;
document.getElementById('tipCost').innerHTML = costText;
elem.style.display = 'block';
var box = document.getElementById('customNumberBox');
try {
box.setSelectionRange(0, box.value.length);
} catch (e) {
box.select();
}
box.focus();
}
function onKeyPressSetting(event, id) {
if (event.which == 13 || event.keyCode == 13) {
autoSetValue(id);
}
}
function autoSetValue(id) {
var num = 0;
unlockTooltip();
tooltip('hide');
var numBox = document.getElementById('customNumberBox');
if (numBox) {
num = numBox.value.toLowerCase();
if (num.split('e')[1]) {
num = num.split('e');
num = Math.floor(parseFloat(num[0]) * (Math.pow(10, parseInt(num[1]))));
} else {
var letters = num.replace(/[^a-z]/gi, '');
var base = 0;
if (letters.length) {
var suffices = ['K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp', 'Oc', 'No', 'Dc', 'Ud', 'Dd', 'Td', 'Qad', 'Qid', 'Sxd', 'Spd', 'Od', 'Nd', 'V', 'Uv', 'Dv', 'Tv', 'Qav', 'Qiv', 'Sxv', 'Spv', 'Ov', 'Nv', 'Tt'];
for (var x = 0; x < suffices.length; x++) {
if (suffices[x].toLowerCase() == letters) {
base = x + 1;
break;
}
}
if (base) num = Math.round(parseFloat(num.split(letters)[0]) * Math.pow(1000, base));
}
if (!base) num = parseFloat(num);
}
} else return;
var txtNum = (num > -1) ? prettify(num) : 'Infinite';
autoTrimpSettings[id].value = num;
document.getElementById(id).textContent = ranstring + ': ' + txtNum;
saveSettings();
checkPortalSettings();
}
function updateCustomButtons() {
function toggleElem(elem,showHide) {
var state = showHide ? '' : 'none';
var stateParent = showHide ? 'inline-block' : 'none';
var item = document.getElementById(elem);
item.style.display = state;
item.parentNode.style.display = stateParent;
}
function turnOff(elem) {
toggleElem(elem,false);
}
function turnOn(elem) {
toggleElem(elem,true);
}
//automaps button
if (autoTrimpSettings.AutoMaps.enabled)
document.getElementById("autoMapBtn").setAttribute("class", "btn fightBtn btn-success");
else
document.getElementById("autoMapBtn").setAttribute("class", "btn fightBtn btn-danger");
//auto portal setting, hide until player has unlocked the balance challenge
(game.challenges.Balance.filter()) ? turnOn("AutoPortal") : turnOff("AutoPortal");
//if custom auto portal is not selected, remove the custom value settingsbox
(autoTrimpSettings.AutoPortal.selected == "Custom") ? turnOn("CustomAutoPortal") : turnOff("CustomAutoPortal");
//if HeHr is not selected, remove HeliumHourChallenge settingsbox
(autoTrimpSettings.AutoPortal.selected == "Helium Per Hour" || autoTrimpSettings.AutoPortal.selected == "Custom") ? turnOn("HeliumHourChallenge") : turnOff("HeliumHourChallenge");
//if HeHr is not selected, remove HeHrDontPortalBefore settingsbox
(autoTrimpSettings.AutoPortal.selected == "Helium Per Hour") ? turnOn("HeHrDontPortalBefore") : turnOff("HeHrDontPortalBefore");
//if HeHr is not selected, remove HeHr buffer settingsbox
(autoTrimpSettings.AutoPortal.selected == "Helium Per Hour") ? turnOn("HeliumHrBuffer") : turnOff("HeliumHrBuffer");
//update dropdown selections:
document.getElementById('AutoPortal').value = autoTrimpSettings.AutoPortal.selected;
document.getElementById('HeliumHourChallenge').value = autoTrimpSettings.HeliumHourChallenge.selected;
document.getElementById('AutoGoldenUpgrades').value = autoTrimpSettings.AutoGoldenUpgrades.selected;
//document.getElementById('Prestige').value = autoTrimpSettings.Prestige.selected; //dont update this, dynamic prestige takes it over and is handled elsewhere.
//stop disable farming from needing a refresh
if(getPageSetting('DisableFarm'))
shouldFarm = false;
//if player has selected arbalest or gambeson but doesn't have them unlocked, just unselect it for them! It's magic!
if(document.getElementById('Prestige').selectedIndex > 11 && game.global.slowDone == false) {
document.getElementById('Prestige').selectedIndex = 11;
autoTrimpSettings.Prestige.selected = "Bestplate";
}
//make sure value buttons are set accurately.
for (var setting in autoTrimpSettings) {
if (autoTrimpSettings[setting].type == 'value') {
var elem = document.getElementById(autoTrimpSettings[setting].id);
if (elem != null) elem.textContent = autoTrimpSettings[setting].name + ': ' + ((autoTrimpSettings[setting].value > -1) ? prettify(autoTrimpSettings[setting].value) : 'Infinite');
}
}
}
//buncha update stuff i wrote but ended up not needing:
/*
for (var setting in autoTrimpSettings) {
var btn = autoTrimpSettings[setting];
var elem = document.getElementById(setting);
if (elem == null) continue;
if (btn.type == 'boolean')
elem.setAttribute('class', 'noselect settingsBtn settingBtn' + btn.enabled);
if (btn.type == 'multitoggle') {
elem.setAttribute('class', 'noselect settingsBtn settingBtn' + btn.value);
elem.textContent = btn.name[btn.value];
}
}
*/
//Checks portal related UI settings (TODO: split into two, and move the validation check to NewUI)
function checkPortalSettings() {
var portalLevel = -1;
var leadCheck = false;
switch(autoTrimpSettings.AutoPortal.selected) {
case "Off":
break;
case "Custom":
portalLevel = autoTrimpSettings.CustomAutoPortal.value + 1;
leadCheck = autoTrimpSettings.HeliumHourChallenge.selected == "Lead" ? true:false;
break;
case "Balance":
portalLevel = 41;
break;
case "Decay":
portalLevel = 56;
break;
case "Electricity":
portalLevel = 82;
break;
case "Crushed":
portalLevel = 126;
break;
case "Nom":
portalLevel = 146;
break;
case "Toxicity":
portalLevel = 166;
break;
case "Lead":
portalLevel = 181;
break;
case "Watch":
portalLevel = 181;
break;
case "Corrupted":
portalLevel = 191;
break;
}
if(portalLevel == -1)
return portalLevel;
if(autoTrimpSettings.VoidMaps.value >= portalLevel)
tooltip('confirm', null, 'update', 'WARNING: Your void maps are set to complete after your autoPortal, and therefore will not be done at all! Please Change Your Settings Now. This Box Will Not Go away Until You do. Remember you can choose \'Custom\' autoPortal along with challenges for complete control over when you portal. <br><br> Estimated autoPortal level: ' + portalLevel , 'cancelTooltip()', 'Void Maps Conflict');
if((leadCheck || game.global.challengeActive == 'Lead') && (autoTrimpSettings.VoidMaps.value % 2 == 0 && portalLevel <= 181))
tooltip('confirm', null, 'update', 'WARNING: Voidmaps run during Lead on an Even zone do not receive the 2x Helium Bonus for Odd zones, and are also tougher. You should probably fix this.', 'cancelTooltip()', 'Lead Challenge Void Maps');
return portalLevel;
}
//UI startup:
//Add breeding box:
var breedbarContainer = document.querySelector('#trimps > div.row');
var addbreedTimerContainer = document.createElement("DIV");
addbreedTimerContainer.setAttribute('class', "col-xs-3");
addbreedTimerContainer.setAttribute('style','padding-left: 0;');
addbreedTimerContainer.setAttribute("onmouseover", 'tooltip(\"Hidden Next Group Breed Timer\", \"customText\", event, \"How long your next army has been breeding for, or how many anticipation stacks you will have if you send a new army now (capped at 30 obv.)\")');
addbreedTimerContainer.setAttribute("onmouseout", 'tooltip("hide")');
var addbreedTimerInside = document.createElement("DIV");
addbreedTimerInside.id='turkimpBuff';
addbreedTimerInside.setAttribute('style','display: block;');
var addbreedTimerInsideIcon = document.createElement("SPAN");
addbreedTimerInsideIcon.setAttribute('class',"icomoon icon-clock");
var addbreedTimerInsideText = document.createElement("SPAN");
addbreedTimerInsideText.id='hiddenBreedTimer';
addbreedTimerInside.appendChild(addbreedTimerInsideIcon);
addbreedTimerInside.appendChild(addbreedTimerInsideText);
addbreedTimerContainer.appendChild(addbreedTimerInside);
breedbarContainer.appendChild(addbreedTimerContainer);
//Add tooltip to current army count
var armycount = document.getElementById('trimpsFighting');
armycount.setAttribute("onmouseover", 'tooltip(\"Army Count\", \"customText\", event, \"To Fight now would add: \" + prettify(getArmyTime()) + \" seconds to the breed timer.\")');
armycount.setAttribute("onmouseout", 'tooltip("hide")');