forked from araemo/KittensGame
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScriptKitties.js
727 lines (625 loc) · 31.3 KB
/
ScriptKitties.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
/*
clearInterval(autoTradeZ);
var autoTradeZ = setInterval(function() {
gamePage.diplomacy.tradeAll(gamePage.diplomacy.get("zebras"));
gamePage.craftAll("alloy");
}, 200);
*/
/*
Add in an auto-trade-bcoin to buy when below [] and sell when above []
this.game.calendar.cryptoPrice;
this.game.calendar.cryptoPriceMax;
gamePage.diplomacy.sellEcoin();
gamePage.diplomacy.buyEcoin();
this.game.msg("There was a huge crypto market correction");
if (#coins > 0 && cryptoPrice > 1099) { sellCrypto(); }
if (cryptoPrice < 881) { buyCrypto; }
*/
// These control the button statuses
var autoCheck = [false, false, false, false, false, false, false, false, false, false, false];
var autoName = ['build', 'craft', 'hunt', 'trade', 'praise', 'science', 'upgrade', 'party', 'assign', 'energy', 'bcoin'];
// These will allow quick selection of the buildings which consume energy
var bldSmelter = gamePage.bld.buildingsData[15];
var bldBioLab = gamePage.bld.buildingsData[9];
var bldOilWell = gamePage.bld.buildingsData[20];
var bldFactory = gamePage.bld.buildingsData[22];
var bldCalciner = gamePage.bld.buildingsData[16];
var bldAccelerator = gamePage.bld.buildingsData[24];
// These are the assorted variables
var proVar = gamePage.resPool.energyProd;
var conVar = gamePage.resPool.energyCons;
var tickDownCounter = 1;
var deadScript = "Script is dead";
var furDerVal = 0;
var autoChoice = "farmer";
var resList = [];
var secResRatio = 0;
var steamOn = 0;
var buildings = [
["Hut", false],
["Log House", false],
["Mansion", false],
["Workshop", false],
["Factory", false],
["Catnip field", false],
["Pasture", false],
["Mine", false],
["Lumber Mill", false],
["Aqueduct", false],
["Oil Well", false],
["Quarry", false],
["Smelter", false],
["Bio Lab", false],
["Calciner", false],
["Reactor", false],
["Accelerator", false],
["Steamworks", false],
["Magneto", false],
["Library", false],
["Academy", false],
["Observatory", false],
["Barn", false],
["Harbour", false],
["Warehouse", false],
["Amphitheatre", false],
["Tradepost", false],
["Chapel", false],
["Temple", false],
["Mint", false],
["Ziggurat", false],
["Unicorn Pasture", false],
["Space Elevator", false, 0],
["Satellite", false, 0],
["Space Station", false, 0],
["Moon Outpost", false, 1],
["Moon Base", false, 1],
["Planet Cracker", false, 2],
["Hydro Fracturer", false, 2],
["Spice Refinery", false, 2],
["Research Vessel", false, 3],
["Orbital Array", false, 3],
["Sunlifter", false, 4],
["Containment Chamber", false, 4],
["Cryostation", false, 5],
["Space Beacon", false, 6],
["Terraforming Station", false, 7],
["Hydroponics", false, 7],
["Tectonic", false, 8]
];
var buildingsList = [
["hut"],
["logHouse"],
["mansion"],
["workshop"],
["factory"],
["field"],
["pasture"],
["mine"],
["lumberMill"],
["aqueduct"],
["oilWell"],
["quarry"],
["smelter"],
["biolab"],
["calciner"],
["reactor"],
["accelerator"],
["steamworks"],
["magneto"],
["library"],
["academy"],
["observatory"],
["barn"],
["harbor"],
["warehouse"],
["amphitheatre"],
["tradepost"],
["chapel"],
["temple"],
["mint"],
["ziggurat"],
["unicornPasture"],
["spaceElevator"],
["sattelite"],
["spaceStation"],
["moonOutpost"],
["moonBase"],
["planetCracker"],
["hydrofracturer"],
["spiceRefinery"],
["researchVessel"],
["orbitalArray"],
["sunlifter"],
["containmentChamber"],
["cryostation"],
["spaceBeacon"],
["terraformingStation"],
["hydroponics"],
["tectonic"]
];
var resources = [
["catnip", "wood", 50],
["wood", "beam", 175],
["minerals", "slab", 250],
["coal", "steel", 100],
["iron", "plate", 125],
["oil", "kerosene", 7500],
["uranium", "thorium", 250],
["unobtainium", "eludium", 1000]
];
var secondaryResources = [
["beam", "scaffold", 50],
["steel", "alloy", 75],
["steel", "gear", 15],
["slab", "concrate", 2500]
];
var htmlMenuAddition = '<div id="farRightColumn" class="column">' +
'<a id="scriptOptions" onclick="selectOptions()"> | ScriptKitties </a>' +
'<div id="optionSelect" style="display:none; margin-top:-475px; margin-left:-65px; width:200px" class="dialog help">' +
'<a href="#" onclick="clearOptionHelpDiv();" style="position: absolute; top: 10px; right: 15px;">close</a>' +
'<button id="killSwitch" onclick="clearInterval(clearScript()); gamePage.msg(deadScript);">Kill Switch</button> </br>' +
'<button id="efficiencyButton" onclick="kittenEfficiency()">Check Efficiency</button></br></br>' +
'<button id="autoBuild" style="color:red" onclick="autoSwitch(autoCheck[0], 0, autoName[0], \'autoBuild\');"> Auto Build </button></br>' +
'<button id="bldSelect" onclick="selectBuildings()">Select Building</button></br>' +
'<button id="autoAssign" style="color:red" onclick="autoSwitch(autoCheck[8], 8, autoName[8], \'autoAssign\')"> Auto Assign </button>' +
'<select id="autoAssignChoice" size="1" onclick="setAutoAssignValue()">' +
'<option value="woodcutter">Woodcutter</option>' +
'<option value="farmer" selected="selected">Farmer</option>' +
'<option value="scholar">Scholar</option>' +
'<option value="hunter">Hunter</option>' +
'<option value="miner">Miner</option>' +
'<option value="priest">Priest</option>' +
'<option value="geologist">Geologist</option>' +
'<option value="engineer">Engineer</option>' +
'</select></br>' +
'<button id="autoCraft" style="color:red" onclick="autoSwitch(autoCheck[1], 1, autoName[1], \'autoCraft\')"> Auto Craft </button>' +
'<select id="craftFur" size="1" onclick="setFurValue()">' +
'<option value="0" selected="selected">None</option>' +
'<option value="1">Parchment</option>' +
'<option value="2">Manuscript</option>' +
'<option value="3">Compendium</option>' +
'<option value="4">Blueprint</option>' +
'</select></br></br>' +
'<label id="secResLabel"> Secondary Craft % </label>' +
'<span id="secResSpan" title="Between 0 and 100"><input id="secResText" type="text" style="width:25px" onchange="secResRatio = this.value" value="0"></span></br></br>' +
'<button id="autoHunt" style="color:red" onclick="autoSwitch(autoCheck[2], 2, autoName[2], \'autoHunt\')"> Auto Hunt </button></br>' +
'<button id="autoTrade" style="color:red" onclick="autoSwitch(autoCheck[3], 3, autoName[3], \'autoTrade\')"> Auto Trade </button></br>' +
'<button id="autoPraise" style="color:red" onclick="autoSwitch(autoCheck[4], 4, autoName[4], \'autoPraise\')"> Auto Praise </button></br></br>' +
'<button id="autoScience" style="color:red" onclick="autoSwitch(autoCheck[5], 5, autoName[5], \'autoScience\')"> Auto Science </button></br>' +
'<button id="autoUpgrade" style="color:red" onclick="autoSwitch(autoCheck[6], 6, autoName[6], \'autoUpgrade\')"> Auto Upgrade </button></br>' +
'<button id="autoEnergy" style="color:red" onclick="autoSwitch(autoCheck[9], 9, autoName[9], \'autoEnergy\')"> Energy Control </button></br>' +
'<button id="autoParty" style="color:red" onclick="autoSwitch(autoCheck[7], 7, autoName[7], \'autoParty\')"> Auto Party </button></br>' +
'<button id="autoBCoin" style="color:red" onclick="autoSwitch(autoCheck[10], 10, autoName[10], \'autoBCoin\')"> Auto BCoin </button></br></br>' +
'</div>' +
'</div>'
$("#footerLinks").append(htmlMenuAddition);
var bldSelectAddition = '<div id="buildingSelect" style="display:none; margin-top:-400px; width:400px; -webkit-columns: 100px 2; -webkit-column-gap: 20px; -webkit-column-rule: 4px double #DE8D47;" class="dialog help">' +
'<a href="#" onclick="$(\'#spaceSelect\').toggle(); $(\'#buildingSelect\').hide();" style="position: absolute; top: 10px; left: 15px;">space</a>' +
'<a href="#" onclick="$(\'#buildingSelect\').hide();" style="position: absolute; top: 10px; right: 15px;">close</a>' +
' <br><input type="checkbox" id="hutChecker"><label for="hutChecker" onclick="$(\'.hutCheck\').click();"><b>Kitten Housing</b></label><br>' +
' <input type="checkbox" id="hutBld" class="hutCheck" onchange="verifyBuildingSelected(\'0\', \'hutBld\');"><label for="hutBld">Hut</label><br>' +
' <input type="checkbox" id="houseBld" class="hutCheck" onchange="verifyBuildingSelected(\'1\', \'houseBld\')"><label for="houseBld">Log House</label><br>' +
' <input type="checkbox" id="mansionBld" class="hutCheck" onchange="verifyBuildingSelected(\'2\', \'mansionBld\')"><label for="mansionBld">Mansion</label><br><br>' +
' <input type="checkbox" id="craftChecker"><label for="craftChecker" onclick="$(\'.craftCheck\').click();"><b>Craft Bonuses</b></label><br>' +
' <input type="checkbox" id="workshopBld" class="craftCheck" onchange="verifyBuildingSelected(\'3\', \'workshopBld\')"><label for="workshopBld">Workshop</label><br>' +
' <input type="checkbox" id="factoryBld" class="craftCheck" onchange="verifyBuildingSelected(\'4\', \'factoryBld\')"><label for="factoryBld">Factory</label><br><br>' +
' <input type="checkbox" id="prodChecker"><label for="prodChecker" onclick="$(\'.prodCheck\').click();"><b>Production</b></label><br>' +
' <input type="checkbox" id="fieldBld" class="prodCheck" onchange="verifyBuildingSelected(\'5\', \'fieldBld\')"><label for="fieldBld">Catnip Field</label><br>' +
' <input type="checkbox" id="pastureBld" class="prodCheck" onchange="verifyBuildingSelected(\'6\', \'pastureBld\')"><label for="pastureBld">Pasture/Solar</label><br>' +
' <input type="checkbox" id="mineBld" class="prodCheck" onchange="verifyBuildingSelected(\'7\', \'mineBld\')"><label for="mineBld">Mine</label><br>' +
' <input type="checkbox" id="lumberBld" class="prodCheck" onchange="verifyBuildingSelected(\'8\', \'lumberBld\')"><label for="lumberBld">Lumber Mill</label><br>' +
' <input type="checkbox" id="aqueductBld" class="prodCheck" onchange="verifyBuildingSelected(\'9\', \'aqueductBld\')"><label for="aqueductBld">Aqueduct/Hydro</label><br>' +
' <input type="checkbox" id="oilBld" class="prodCheck" onchange="verifyBuildingSelected(\'10\', \'oilBld\')"><label for="oilBld">Oil Well</label><br>' +
' <input type="checkbox" id="quarryBld" class="prodCheck" onchange="verifyBuildingSelected(\'11\', \'quarryBld\')"><label for="quarryBld">Quarry</label><br><br>' +
' <input type="checkbox" id="conversionChecker"><label for="conversionChecker" onclick="$(\'.convertCheck\').click();"><b>Conversion</b></label><br>' +
' <input type="checkbox" id="smelterBld" class="convertCheck" onchange="verifyBuildingSelected(\'12\', \'smelterBld\')"><label for="smelterBld">Smelter</label><br>' +
' <input type="checkbox" id="labBld" class="convertCheck" onchange="verifyBuildingSelected(\'13\', \'labBld\')"><label for="labBld">Bio Lab</label><br>' +
' <input type="checkbox" id="calcinerBld" class="convertCheck" onchange="verifyBuildingSelected(\'14\', \'calcinerBld\')"><label for="calcinerBld">Calciner</label><br>' +
' <input type="checkbox" id="reactorBld" class="convertCheck" onchange="verifyBuildingSelected(\'15\', \'reactorBld\')"><label for="reactorBld">Reactor</label><br>' +
' <input type="checkbox" id="acceleratorBld" class="convertCheck" onchange="verifyBuildingSelected(\'16\', \'acceleratorBld\')"><label for="acceleratorBld">Accelerator</label><br>' +
' <input type="checkbox" id="steamBld" class="convertCheck" onchange="verifyBuildingSelected(\'17\', \'steamBld\')"><label for="steamBld">Steamworks</label><br>' +
' <input type="checkbox" id="magnetoBld" class="convertCheck" onchange="verifyBuildingSelected(\'18\', \'magnetoBld\')"><label for="magnetoBld">Magneto</label><br><br>' +
' <input type="checkbox" id="scienceChecker"><label for="scienceChecker" onclick="$(\'.scienceCheck\').click();"><b>Science</b></label><br>' +
' <input type="checkbox" id="libraryBld" class="scienceCheck" onchange="verifyBuildingSelected(\'19\', \'libraryBld\')"><label for="libraryBld">Library</label><br>' +
' <input type="checkbox" id="academyBld" class="scienceCheck" onchange="verifyBuildingSelected(\'20\', \'academyBld\')"><label for="academyBld">Academy</label><br>' +
' <input type="checkbox" id="obervatoryBld" class="scienceCheck" onchange="verifyBuildingSelected(\'21\', \'obervatoryBld\')"><label for="obervatoryBld">Observatory</label><br><br>' +
' <input type="checkbox" id="storageChecker"><label for="storageChecker" onclick="$(\'.storageCheck\').click();"><b>Storage</b></label><br>' +
' <input type="checkbox" id="barnBld" class="storageCheck" onchange="verifyBuildingSelected(\'22\', \'barnBld\')"><label for="barnBld">Barn</label><br>' +
' <input type="checkbox" id="harborBld" class="storageCheck" onchange="verifyBuildingSelected(\'23\', \'harborBld\')"><label for="harborBld">Harbor</label><br>' +
' <input type="checkbox" id="warehouseBld" class="storageCheck" onchange="verifyBuildingSelected(\'24\', \'warehouseBld\')"><label for="warehouseBld">Warehouse</label><br><br>' +
' <input type="checkbox" id="otherChecker"><label for="otherChecker" onclick="$(\'.otherCheck\').click();"><b>Other</b></label><br>' +
' <input type="checkbox" id="ampBld" class="otherCheck" onchange="verifyBuildingSelected(\'25\', \'ampBld\')"><label for="ampBld">Amphitheatre/Broadcast</label><br>' +
' <input type="checkbox" id="tradeBld" class="otherCheck" onchange="verifyBuildingSelected(\'26\', \'tradeBld\')"><label for="tradeBld">Tradepost</label><br>' +
' <input type="checkbox" id="chapelBld" class="otherCheck" onchange="verifyBuildingSelected(\'27\', \'chapelBld\')"><label for="chapelBld">Chapel</label><br>' +
' <input type="checkbox" id="templeBld" class="otherCheck" onchange="verifyBuildingSelected(\'28\', \'templeBld\')"><label for="templeBld">Temple</label><br>' +
' <input type="checkbox" id="mintBld" class="otherCheck" onchange="verifyBuildingSelected(\'29\', \'mintBld\')"><label for="mintBld">Mint</label><br>' +
' <input type="checkbox" id="zigguratBld" class="otherCheck" onchange="verifyBuildingSelected(\'30\', \'zigguratBld\')"><label for="zigguratBld">Ziggurat</label><br>' +
' <input type="checkbox" id="unicBld" class="otherCheck" onchange="verifyBuildingSelected(\'31\', \'unicBld\')"><label for="unicBld">Unicorn Pasture</label><br></br>' +
'</div>'
var spaceSelectAddition = '<div id="spaceSelect" style="display:none; margin-top:-400px; width:200px" class="dialog help">' +
'<a href="#" onclick="$(\'#spaceSelect\').hide(); $(\'#buildingSelect\').toggle();" style="position: absolute; top: 10px; left: 15px;">cath</a>' +
'<a href="#" onclick="$(\'#spaceSelect\').hide();" style="position: absolute; top: 10px; right: 15px;">close</a>' +
' </br></br><input type="checkbox" id="programs" class="programs" onchange="programBuild = this.checked; console.log(this.checked);"><label for="programs">Programs</label></br></br>' +
' <input type="checkbox" id="spaceChecker"><label for="spaceChecker" onclick="$(\'.spaceCheck\').click();"><b>Space</b></label></br>' +
' <input type="checkbox" id="elevSBld" class="spaceCheck" onchange="verifyBuildingSelected(\'32\', \'elevSBld\');"><label for="elevSBld">Space Elevator</label></br>' +
' <input type="checkbox" id="satSBld" class="spaceCheck" onchange="verifyBuildingSelected(\'33\', \'satSBld\');"><label for="satSBld">Satellite</label></br>' +
' <input type="checkbox" id="statSBld" class="spaceCheck" onchange="verifyBuildingSelected(\'34\', \'statSBld\');"><label for="statSBld">Space Station</label></br></br>' +
' <input type="checkbox" id="moonChecker"><label for="moonChecker" onclick="$(\'.moonCheck\').click();"><b>Moon</b></label></br>' +
' <input type="checkbox" id="outSBld" class="moonCheck" onchange="verifyBuildingSelected(\'35\', \'outSBld\');"><label for="outSBld">Lunar Outpost</label></br>' +
' <input type="checkbox" id="baseSBld" class="moonCheck" onchange="verifyBuildingSelected(\'36\', \'baseSBld\');"><label for="baseSBld">Moon Base</label></br></br>' +
' <input type="checkbox" id="duneChecker"><label for="duneChecker" onclick="$(\'.duneCheck\').click();"><b>Dune</b></label></br>' +
' <input type="checkbox" id="crackSBld" class="duneCheck" onchange="verifyBuildingSelected(\'37\', \'crackSBld\');"><label for="crackSBld">Planet Cracker</label></br>' +
' <input type="checkbox" id="fracSBld" class="duneCheck" onchange="verifyBuildingSelected(\'38\', \'fracSBld\');"><label for="fracSBld">Hydro Fracturer</label></br>' +
' <input type="checkbox" id="spiceSBld" class="duneCheck" onchange="verifyBuildingSelected(\'39\', \'spiceSBld\');"><label for="spiceSBld">Spice Refinery</label></br></br>' +
' <input type="checkbox" id="piscineChecker"><label for="piscineChecker" onclick="$(\'piscineCheck\').click();"><b>Piscine</b></label></br>' +
' <input type="checkbox" id="reVeSBld" class="piscineCheck" onchange="verifyBuildingSelected(\'40\', \'reVeSBld\');"><label for="reVeSBld">Research Vessel</label></br>' +
' <input type="checkbox" id="orbSBld" class="piscineCheck" onchange="verifyBuildingSelected(\'41\', \'orbSBld\');"><label for="orbSBld">Orbital Array</label></br></br>' +
' <input type="checkbox" id="heliosChecker"><label for="heliosChecker" onclick="$(\'.heliosCheck\').click();"><b>Helios</b></label></br>' +
' <input type="checkbox" id="sunSBld" class="heliosCheck" onchange="verifyBuildingSelected(\'42\', \'sunSBld\');"><label for="sunSBld">Sunlifter</label></br>' +
' <input type="checkbox" id="contSBld" class="heliosCheck" onchange="verifyBuildingSelected(\'43\', \'contSBld\');"><label for="contSBld">Containment Chamber</label></br></br>' +
' <input type="checkbox" id="terminusChecker"><label for="terminusChecker" onclick="$(\'.terminusCheck\').click();"><b>Terminus</b></label></br>' +
' <input type="checkbox" id="crySBld" class="terminusCheck" onchange="verifyBuildingSelected(\'44\', \'crySBld\');"><label for="crySBld">Cryostation</label></br></br>' +
' <input type="checkbox" id="kairoChecker"><label for="kairoChecker" onclick="$(\'.kairoCheck\').click();"><b>Kairo</b></label></br>' +
' <input type="checkbox" id="beacSBld" class="kairoCheck" onchange="verifyBuildingSelected(\'45\', \'beacSBld\');"><label for="beacSBld">Space Beacon</label></br></br>' +
' <input type="checkbox" id="yarnChecker"><label for="yarnChecker" onclick="$(\'.yarnCheck\').click();"><b>Yarn</b></label></br>' +
' <input type="checkbox" id="terrSBld" class="yarnCheck" onchange="verifyBuildingSelected(\'46\', \'terrSBld\');"><label for="terrSBld">Terraforming Station</label></br>' +
' <input type="checkbox" id="hydrSBld" class="centaurusCheck" onchange="verifyBuildingSelected(\'47\', \'hydrSBld\');"><label for="hydrSBld">Hydroponics</label></br></br>' +
' <input type="checkbox" id="centaurusChecker"><label for="centaurusChecker" onclick="$(\'.centaurusCheck\').click();"><b>Centaurus System</b></label></br>' +
' <input type="checkbox" id="tecSBld" class="centaurusCheck" onchange="verifyBuildingSelected(\'48\', \'tecSBld\');"><label for="tecSBld">Tectonic</label></br></br>' +
'</div>'
function verifyBuildingSelected(buildingNumber, buildingCheckID) {
var bldIsChecked = document.getElementById(buildingCheckID).checked;
buildings[buildingNumber][1] = bldIsChecked;
}
$("#game").append(bldSelectAddition);
$("#game").append(spaceSelectAddition);
function clearOptionHelpDiv() {
$("#optionSelect").hide();
}
function selectOptions() {
$("#optionSelect").toggle();
}
function clearHelpDiv() {
$("#buildingSelect").hide();
}
function selectBuildings() {
$("#buildingSelect").toggle();
}
function setFurValue() {
furDerVal = $('#craftFur').val();
}
function setAutoAssignValue() {
autoChoice = $('#autoAssignChoice').val();
}
function autoSwitch(varCheck, varNumber, textChange, varName) {
if (varCheck == false) {
autoCheck[varNumber] = true;
gamePage.msg('Auto' + textChange + ' is now on');
document.getElementById(varName).style.color = 'black';
} else if (varCheck == true) {
autoCheck[varNumber] = false;
gamePage.msg('Auto' + textChange + ' is now off');
document.getElementById(varName).style.color = 'red';
}
}
function clearScript() {
$("#farRightColumn").remove();
$("#buildingSelect").remove();
$("#spaceSelect").remove();
$("#scriptOptions").remove();
clearInterval(runAllAutomation);
autoBuildCheck = null;
bldSelectAddition = null;
spaceSelectAddition = null;
htmlMenuAddition = null;
}
// Show current kitten efficiency in the in-game log
function kittenEfficiency() {
var timePlayed = gamePage.stats.statsCurrent[3].calculate(game);
var numberKittens = gamePage.resPool.get('kittens').value;
var curEfficiency = (numberKittens - 70) / timePlayed;
gamePage.msg("Your current efficiency is " + parseFloat(curEfficiency).toFixed(2) + " kittens per hour.");
}
/* These are the functions which are controlled by the runAllAutomation timer */
/* These are the functions which are controlled by the runAllAutomation timer */
/* These are the functions which are controlled by the runAllAutomation timer */
/* These are the functions which are controlled by the runAllAutomation timer */
/* These are the functions which are controlled by the runAllAutomation timer */
// Auto Observe Astronomical Events
function autoObserve() {
var checkObserveBtn = document.getElementById("observeBtn");
if (typeof(checkObserveBtn) != 'undefined' && checkObserveBtn != null) {
document.getElementById('observeBtn').click();
}
}
// Auto praise the sun
function autoPraise(){
if (autoCheck[4] != false && gamePage.bld.getBuildingExt('temple').meta.val > 0) {
gamePage.religion.praise();
}
}
// Build buildings automatically
function autoBuild() {
if (autoCheck[0] != false && gamePage.ui.activeTabId == 'Bonfire') {
var btn = gamePage.tabs[0].buttons;
//for (var z = 0; z < Math.min(gamePage.tabs[0].buttons.length, 32); z++) {
for (var z = 0; z < 32; z++) {
if (buildings[z][1] != false) {
if (gamePage.bld.getBuildingExt(buildingsList[z]).meta.unlocked) {
for (i = 2 ;i < gamePage.tabs[0].buttons.length; i++) {
try {
if (btn[i].model.metadata.name == buildingsList[z]) {
btn[i].controller.buyItem(btn[i].model, {}, function(result) {
if (result) {btn[i].update();}
});
}
} catch(err) {
console.log(err);
}
}
}
}
}
if (gamePage.getResourcePerTick('coal') > 0.01 && steamOn < 1) {
gamePage.bld.getBuildingExt('steamworks').meta.on = gamePage.bld.getBuildingExt('steamworks').meta.val;
steamOn = 1;
}
}
}
// Build space stuff automatically
function autoSpace() {
if (autoCheck[0] != false) {
var origTab = gamePage.ui.activeTabId;
// Build space buildings
for (var z = 32; z < buildings.length; z++) {
if (buildings[z][1] != false) {
var spBuild = gamePage.tabs[6].planetPanels[buildings[z][2]].children;
try {
for (i = 0 ;i < spBuild.length; i++) {
if (spBuild[i].model.metadata.name == buildingsList[z]) {
if (gamePage.ui.activeTabId != "Space") {
gamePage.ui.activeTabId = 'Space'; gamePage.render(); // Change the tab so that we can build
}
spBuild[i].controller.buyItem(spBuild[i].model, {}, function(result) {
if (result) {spBuild[i].update();}
});
}
}
} catch(err) {
console.log(err);
}
}
}
// Build space programs
// For me, this was throwing an exception becasue programBuild was undefined... unsure if this needs FIXME'd. -Araemo
try {
if (programBuild != false) {
var spcProg = gamePage.tabs[6].GCPanel.children;
for (var i = 0; i < spcProg.length; i++) {
if (spcProg[i].model.metadata.unlocked && spcProg[i].model.on == 0) {
try {
if (gamePage.ui.activeTabId != "Space") {
gamePage.ui.activeTabId = 'Space'; gamePage.render(); // Change the tab so that we can build
}
spcProg[i].controller.buyItem(spcProg[i].model, {}, function(result) {
if (result) {spcProg[i].update();}
});
} catch(err) {
console.log(err);
}
}
}
}
} catch(err) {}
if (origTab != gamePage.ui.activeTabId) {
gamePage.ui.activeTabId = origTab; gamePage.render();
}
}
}
// Trade automatically
function autoTrade() {
if (autoCheck[3] != false) {
var titRes = gamePage.resPool.get('titanium');
var unoRes = gamePage.resPool.get('unobtainium');
var goldResource = gamePage.resPool.get('gold');
var goldOneTwenty = gamePage.getResourcePerTick('gold') * 200;
if (goldResource.value > (goldResource.maxValue - goldOneTwenty)) {
if (unoRes.value > 5000 && gamePage.diplomacy.get('leviathans').unlocked && gamePage.diplomacy.get('leviathans').duration != 0) {
gamePage.diplomacy.tradeAll(game.diplomacy.get("leviathans"));
} else if (titRes.value < (titRes.maxValue * 0.9) && gamePage.diplomacy.get('zebras').unlocked) {
gamePage.diplomacy.tradeAll(game.diplomacy.get("zebras"), (goldOneTwenty / 15));
} else if (gamePage.diplomacy.get('dragons').unlocked) {
gamePage.diplomacy.tradeAll(game.diplomacy.get("dragons"), (goldOneTwenty / 15));
}
}
}
}
// Hunt automatically
function autoHunt() {
if (autoCheck[2] != false) {
var catpower = gamePage.resPool.get('manpower');
if (catpower.value > (catpower.maxValue - 1)) {
gamePage.village.huntAll();
}
}
}
// Craft primary resources automatically
function autoCraft() {
if (autoCheck[1] != false) {
for (var i = 0; i < resources.length; i++) {
var curRes = gamePage.resPool.get(resources[i][0]);
var resourcePerTick = gamePage.getResourcePerTick(resources[i][0], 0);
var resourcePerCraft = (resourcePerTick * 3);
if (curRes.value > (curRes.maxValue - resourcePerCraft) && gamePage.workshop.getCraft(resources[i][1]).unlocked) {
gamePage.craft(resources[i][1], (resourcePerCraft / resources[i][2]));
}
}
// Craft secondary resources automatically if primary craftable is > secondary craftable
for (var i = 0; i < secondaryResources.length; i++) {
var priRes = gamePage.resPool.get(secondaryResources[i][0]);
var secRes = gamePage.resPool.get(secondaryResources[i][1]);
var resMath = priRes.value / secondaryResources[i][2];
if (resMath > 1 && secRes.value < (priRes.value * (secResRatio / 100)) && gamePage.workshop.getCraft(secondaryResources[i][1]).unlocked) {
gamePage.craft(secondaryResources[i][1], (resMath * (secResRatio / 100)));
}
}
//Craft the fur derivatives
var furDerivatives = ['parchment', 'manuscript', 'compedium', 'blueprint'];
for (var i = 0; i < furDerVal; i++) {
// Skip crafting compendiums if blueprints are selected, unless not enough compendiums
if (!(furDerVal == 4 && i == 2 && gamePage.resPool.get('compedium').value > 25)) {
if (gamePage.workshop.getCraft(furDerivatives[i]).unlocked) {
gamePage.craftAll(furDerivatives[i]);
}
}
}
}
}
// Auto Research
function autoResearch() {
if (autoCheck[5] != false && gamePage.libraryTab.visible != false) {
var origTab = gamePage.ui.activeTabId;
gamePage.ui.activeTabId = 'Science'; gamePage.render();
var btn = gamePage.tabs[2].buttons;
for (var i = 0; i < btn.length; i++) {
if (btn[i].model.metadata.unlocked && btn[i].model.metadata.researched != true) {
try {
btn[i].controller.buyItem(btn[i].model, {}, function(result) {
if (result) {btn[i].update();}
});
} catch(err) {
console.log(err);
}
}
}
if (origTab != gamePage.ui.activeTabId) {
gamePage.ui.activeTabId = origTab; gamePage.render();
}
}
}
// Auto Workshop upgrade , tab 3
function autoWorkshop() {
if (autoCheck[6] != false && gamePage.workshopTab.visible != false) {
var origTab = gamePage.ui.activeTabId;
gamePage.ui.activeTabId = 'Workshop'; gamePage.render();
var btn = gamePage.tabs[3].buttons;
for (var i = 0; i < btn.length; i++) {
if (btn[i].model.metadata.unlocked && btn[i].model.metadata.researched != true) {
try {
btn[i].controller.buyItem(btn[i].model, {}, function(result) {
if (result) {btn[i].update();}
});
} catch(err) {
console.log(err);
}
}
}
if (origTab != gamePage.ui.activeTabId) {
gamePage.ui.activeTabId = origTab; gamePage.render();
}
}
}
// Festival automatically
function autoParty() {
if (autoCheck[7] != false && gamePage.science.get("drama").researched) {
var catpower = gamePage.resPool.get('manpower').value;
var culture = gamePage.resPool.get('culture').value;
var parchment = gamePage.resPool.get('parchment').value;
if (catpower > 1500 && culture > 5000 && parchment > 2500) {
if (gamePage.prestige.getPerk("carnivals").researched)
gamePage.village.holdFestival(1);
else if (gamePage.calendar.festivalDays = 0) {
gamePage.village.holdFestival(1);
}
}
}
}
// Auto assign new kittens to selected job
function autoAssign() {
if (autoCheck[8] != false && gamePage.village.getJob(autoChoice).unlocked) {
gamePage.village.assignJob(gamePage.village.getJob(autoChoice), 1);
}
}
// Control Energy Consumption
function energyControl() {
if (autoCheck[9] != false) {
proVar = gamePage.resPool.energyProd;
conVar = gamePage.resPool.energyCons;
if (bldAccelerator.val > bldAccelerator.on && proVar > (conVar + 3)) {
bldAccelerator.on++;
conVar++;
} else if (bldCalciner.val > bldCalciner.on && proVar > (conVar + 3)) {
bldCalciner.on++;
conVar++;
} else if (bldFactory.val > bldFactory.on && proVar > (conVar + 3)) {
bldFactory.on++;
conVar++;
} else if (bldOilWell.val > bldOilWell.on && proVar > (conVar + 3)) {
bldOilWell.on++;
conVar++;
} else if (bldBioLab.val > bldBioLab.on && proVar > (conVar + 3)) {
bldBioLab.on++;
conVar++;
} else if (bldBioLab.on > 0 && proVar < conVar) {
bldBioLab.on--;
conVar--;
} else if (bldOilWell.on > 0 && proVar < conVar) {
bldOilWell.on--;
conVar--;
} else if (bldFactory.on > 0 && proVar < conVar) {
bldFactory.on--;
conVar--;
} else if (bldCalciner.on > 0 && proVar < conVar) {
bldCalciner.on--;
conVar--;
} else if (bldAccelerator.on > 0 && proVar < conVar) {
bldAccelerator.on--;
conVar--;
}
}
}
// Auto buys and sells bcoins optimally (not yet tested)
function autoBCoin() {
if (autoCheck[10] != false && gamePage.science.get("antimatter").researched) {
// When the price is > 1100 it loses 20-30% of its value
// 880+ε is the highest it could be after an implosion
if (gamePage.calendar.cryptoPrice < 881) {
gamePage.diplomacy.buyEcoin();
this.game.msg("Bought blackcoins");
}
if (gamePage.resPool.get('blackcoin').value > 0 && gamePage.calendar.cryptoPrice > (gamePage.calendar.cryptoPriceMax - 1)) {
gamePage.diplomacy.sellEcoin();
this.game.msg("Sold blackcoins");
}
}
}
function autoNip() {
if (autoCheck[0] != false) {
if (gamePage.bld.buildingsData[0].val < 20) {
$(".btnContent:contains('Gather')").trigger("click");
}
}
}
// This function keeps track of the game's ticks and uses math to execute these functions at set times relative to the game.
clearInterval(runAllAutomation);
var runAllAutomation = setInterval(function() {
autoNip();
autoPraise();
autoBuild();
if (gamePage.timer.ticksTotal % 3 === 0) {
autoObserve();
autoCraft();
autoHunt();
autoAssign();
energyControl();
}
if (gamePage.timer.ticksTotal % 10 === 0) {
autoSpace();
}
if (gamePage.timer.ticksTotal % 25 === 0) {
autoResearch();
autoWorkshop();
autoParty();
autoTrade();
}
}, 200);