forked from Zorn192/AutoTrimps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutoTrimps2.js
563 lines (467 loc) · 24.3 KB
/
AutoTrimps2.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
// ==UserScript==
// @name AutoTrimpsV2
// @version 2.1.6.9b-genbtc-4-2-2018
// @updateURL https://github.com/genbtc/AutoTrimps/AutoTrimps2.js
// @description Automate all the trimps!
// @author zininzinin, spindrjr, belaith, ishakaru, genBTC, Unihedron, coderPatsy, Kfro, Zeker0, Meowchan
// @include *trimps.github.io*
// @include *kongregate.com/games/GreenSatellite/trimps
// @grant none
// ==/UserScript==
var ATversion = '2.1.7.1'; //when this increases it forces users setting update to newer version format
//<script type="text/javascript" src="AutoTrimps/AutoTrimps2.js?"></script>
////////////////////////////////////////////////////////////////////////////////
//Main Loader Initialize Function (loads first, load everything else)///////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
var local = false;
//local = true;
var ver = "53";
var verDate = "11.12.18";
var changelogList = [];
changelogList.push({date: "11.12.2018", version: "", description: "New Void GU Cap.", isNew: true});
changelogList.push({date: "18.11.2018", version: "", description: "Jobs reworked." , isNew: false});
changelogList.push({date: "17.11.2018", version: "", description: "Added Income weight to Auto Allocate. Leave it at 0 unless you're deep running one of the big 3 C2s." , isNew: false});
changelogList.push({date: "14.11.2018", version: "", description: "Improved Auto Allocate fuel zones range." , isNew: false});
changelogList.push({date: "8.11.2018", version: "", description: "Improved early game.", isNew: false});
changelogList.push({date: "22.10.2018", version: "", description: "Reworked AutoAllocate, check your weights. Also BW raid setting." , isNew: false});
changelogList.push({date: "13/06/2018", version: "", description: "War was beginning ", isNew: false});
var atscript = document.getElementById('AutoTrimps-script'),
basepath = (local ? 'http://localhost:8383/Trimps%204/Trimps.github.io/AutoTrimps/' : 'https://notthat.github.io/AutoTrimps/'),
modulepath = 'modules/';
var initialized = false;
function startAT() {
//first we wait for the game to load
if((typeof game === 'undefined' || typeof loadPageVariables === 'undefined' || typeof game.options === 'undefined' || typeof game.options.menu === 'undefined' || typeof pendingLogs === 'undefined' || document.getElementById('logBtnGroup') === null)){ //game hasnt initialized yet
setTimeout(startAT, 100);
return;
}
if(!initialized){ //perform once
pendingLogs.AutoTrimps = []; //adds AT messages slot. needed before we can call debug()
initializeAutoTrimps(); //loads modules asynchronously
initialized = true;
}
//wait until all the scripts are loaded into page
if(loadedScriptAmount !== expectedScriptAmount || typeof jQuery === 'undefined'){ //jquery is a dependacy of jquery-ui, so check for it specifically here
setTimeout(startAT, 100);
return;
}
//load jQuery-UI.css
var link1 = document.createElement('link');
link1.rel = "stylesheet";
link1.type = "text/css";
link1.href = basepath + modulepath + 'jQuery-UI.css';
document.head.appendChild(link1);
//code to run on script launch:
if (!local) printChangelog();
equipLowDmgShield();
equipMainShield();
if(game.global.mapsActive) currMap = getCurrentMapObject();
trimpsRealMax = game.resources.trimps.realMax();
oncePerZoneCode();
AutoPerks.firstRun(); //set some things up on loading. click Allocate does everything else
//HTML For adding a 5th tab to the message window
var ATbutton = document.createElement("button");
ATbutton.innerHTML = 'AutoTrimps';
ATbutton.setAttribute('id', 'AutoTrimpsFilter');
ATbutton.setAttribute('type', 'button');
ATbutton.setAttribute('onclick', "filterMessage2('AutoTrimps')");
ATbutton.setAttribute('class', "btn btn-success logFlt");
//
var tab = document.createElement("DIV");
tab.setAttribute('class', 'btn-group');
tab.setAttribute('role', 'group');
tab.appendChild(ATbutton);
document.getElementById('logBtnGroup').appendChild(tab);
//if (game.achievements.zones.finished < 8) //z60
// printLowerLevelPlayerNotice();
//Set some game ars after we load.
game.global.addonUser = true;
game.global.autotrimps = true;
heirloomCache = game.global.heirloomsExtra.length;
MODULESdefault = JSON.parse(JSON.stringify(MODULES));
//Start guiLoop
setInterval(guiLoop, runInterval*10);
setInterval(pauseRemovalLoop, runInterval); //TODO: this cleaner. hookup to game maybe?
//hook up into load() - load game function
load = (function() {
var cached_function = load;
return function() {
var result = cached_function.apply(this, arguments);
oncePerZoneCode();
return result;
};
})();
//hook up into runGameLoop()
runGameLoop = (function(makeUp, now) {
var cached_function = runGameLoop;
return function(makeUp, now) {
var result = cached_function.apply(this, arguments);
ATLoop(makeUp);
return result;
};
})();
//hook up into activateClicked() (confirm portal/respec button) to save autoperks calculated settings
activateClicked = (function(makeUp, now) {
var cached_function = activateClicked;
return function(makeUp, now) {
if(typeof autoTrimpSettings.APCheckBoxes !== 'undefined' && autoTrimpSettings.APCheckBoxes.userSaveATSettings){ //save relevant AT settings
setPageSetting('TillWeHaveAmalg', autoTrimpSettings.APValueBoxes.amalGoal); //amal goal
setPageSetting('NoCoordBuyStartZ', (autoTrimpSettings.APValueBoxes.amalZone - autoTrimpSettings.APValueBoxes.coordsBehind)); //start no coord buy
setPageSetting('FuelFromZ', AutoPerks.fuelStartZone); //fuel start zone
setPageSetting('FuelToZ', AutoPerks.fuelEndZone); //fuel end zone
setPageSetting('FuelUntilAmal', false); //fuel until amalgamator
}
if(!portalWindowOpen && getPageSetting('BuyJobsNew')){ //respeccing mid-run - fire all miners
var wasPaused = false;
if (game.options.menu.pauseGame.enabled){ //cant fire while paused
wasPaused = true;
toggleSetting('pauseGame');
}
var old = preBuy2();
game.global.firing = true;
if(game.jobs["Miner"].owned > 0){
game.global.buyAmt = game.jobs["Miner"].owned;
buyJob("Miner", true, true);
}
if(game.jobs["Farmer"].owned > 0){
game.global.buyAmt = game.jobs["Farmer"].owned;
buyJob("Farmer", true, true);
}
if(game.jobs["Lumberjack"].owned > 0){
game.global.buyAmt = game.jobs["Lumberjack"].owned;
buyJob("Lumberjack", true, true);
}
postBuy2(old);
if(wasPaused)
toggleSetting('pauseGame');
}
if(portalWindowOpen && getPageSetting('AutoHeirlooms')) //portalling, run autoheirloom
autoHeirlooms();
var result = cached_function.apply(this, arguments);
return result;
};
})();
debug('AutoTrimps loaded!');
}
//This should redirect the script to wherever its being mirrored from.
if (atscript !== null) {
basepath = atscript.src.replace(/AutoTrimps2\.js$/, '');
}
//This could potentially do something one day. like: read localhost url from tampermonkey.
// AKA do certain things when matched on a certain url.
//if (atscript.src.includes('localhost')) {;};
var loadedScriptAmount = 0;
var expectedScriptAmount = 0;
function ATscriptLoad(pathname, modulename) {
if (modulename == null) debug("Wrong Syntax. Script could not be loaded. Try ATscriptLoad(modulepath, 'example.js'); ");
var script = document.createElement('script');
if (pathname == null) pathname = '';
script.src = basepath + pathname + modulename + '.js';
script.id = modulename + '_MODULE';
script.onload = function(){loadedScriptAmount++;};
expectedScriptAmount++;
//script.setAttribute('crossorigin',"use-credentials");
//script.setAttribute('crossorigin',"anonymous");
document.head.appendChild(script);
}
ATscriptLoad(modulepath, 'utils'); //Load stuff needed to load other stuff:
//This starts up after game is loaded
function initializeAutoTrimps() {
loadPageVariables(); //get autoTrimpSettings
ATscriptLoad('','SettingsGUI'); //populate Settings GUI
ATscriptLoad('','Graphs'); //populate Graphs
//Load modules:
ATmoduleList = ['chat', 'jQuery', 'jQuery-UI', 'query', 'portal', 'upgrades', 'heirlooms', 'buildings', 'jobs', 'equipment', 'gather', 'stance', 'maps', 'breedtimer', 'magmite', 'other', 'import-export', 'perks', 'fight-info', 'performance', 'ATcalc'];
for (var m in ATmoduleList)
ATscriptLoad(modulepath, ATmoduleList[m]);
//debug('AutoTrimps v' + ATversion + ' ' + ver + ' Loaded!', '*spinner3');
debug('AutoTrimps v' + ATversion + ' ' + ver);
}
function assembleChangelog(date,version,description,isNew) {
return (isNew)
? (`<b class="AutoEggs">${date} ${version} </b><b style="background-color:#32CD32"> New:</b> ${description}<br>`)
: (`<b>${date} ${version} </b> ${description}<br>`);
}
function printChangelog() {
var body="";
for (var i in changelogList) {
var $item = changelogList[i];
var result = assembleChangelog($item.date,$item.version,$item.description,$item.isNew);
body+=result;
}
var footer =
'<b>Ongoing Development</b> - <u>Report any bugs/problems please</u>!\
<br>Talk with the dev: <b>Meowchan_#0720</b> @ <a target="#" href="https://discord.gg/W2Ajv4j">AutoTrimps Discord Channel</a>'
, action = 'cancelTooltip()'
, title = "AutoTrimps - Meowchan's Fork<br>" + "v" + ver + " " + verDate
, acceptBtnText = "Thank you for playing AutoTrimps!"
, hideCancel = true;
tooltip('confirm', null, 'update', body+footer, action, title, acceptBtnText, null, hideCancel);
}
function printLowerLevelPlayerNotice() {
tooltip('confirm', null, 'update', 'The fact that it works at all is misleading new players into thinking its perfect. Its not. If your highest zone is under z60, you have not unlocked the stats required, and have not experienced the full meta with its various paradigm shifts. If you are just starting, my advice is to play along naturally and use AutoTrimps as a tool, not a crutch. Play with the settings as if it was the game, Dont expect to go unattended, if AT chooses wrong, and make the RIGHT choice yourself. Additionally, its not coded to run one-time challenges for you, only repeatable ones for helium. During this part of the game, content is king - automating literally removes the fun of the game. If you find that many flaws in the automation exist for you, level up. Keep in mind the challenge of maintaining the code is that it has to work for everyone. AT cant see the future and doesnt run simulations, it exists only in the present moment. Post any suggestions on how it can be better, or volunteer to adapt the code, or produce some sort of low-level player guide with what youve learned.<br>Happy scripting! -genBTC','cancelTooltip()', '<b>LowLevelPlayer Notes:</b><br><b>PSA: </b><u>AutoTrimps was not designed for new/low-level players.</u>', "I understand I am on my own and I Accept and Continue.", null, true);
}
////////////////////////////////////////
//Global Main vars /////////////////////
////////////////////////////////////////
////////////////////////////////////////
var ATrunning = true; //status var
var ATmessageLogTabVisible = true; //show an AutoTrimps tab after Story/Loot/Unlocks/Combat message Log Container
var enableDebug = true; //Spam console.log with debug info
var autoTrimpSettings = {};
var MODULES = {};
var MODULESdefault = {};
var ATMODULES = {};
var ATmoduleList = [];
var sugarEventAT = false; //enable pumpkin imps
var bestBuilding;
var scienceNeeded;
var metalNeeded;
var woodNeeded;
var foodNeeded;
var hiddenBreedTimer;
var hiddenBreedTimerLast;
var preBuyAmt;
var preBuyFiring;
var preBuyTooltip;
var preBuymaxSplit;
var currentworld = 0;
var aWholeNewWorld = false;
var heirloomFlag = false;
var heirloomCache;
var magmiteSpenderChanged = false;
var oblitMultAT = 1;
var coordMultAT = 1;
var windMult = 1;
var poisonMultFixed=0.05;
var poisonMult = 1;
var threshold=1;
var DHratio = 0;
var formattedRatio = "";
var nextZoneDHratio = 0;
var maxAnti;
var attacksPerSecondAT;
var wantedAnticipation = maxAnti;
var highestPrestigeOwned = 0;
var allowBuyingCoords = true;
var lastCell = -1;
var bsZone;
var holdingBack = false;
var trimpsRealMax;
var PRaidStartZone = 999;
var highCritChance;
var highCritDamage;
var highATK;
var highPB;
var lowCritChance;
var lowCritDamage;
var lowATK;
var lowPB;
var lowShieldName = "LowDmgShield"; //edit these to change the names used (visual only).
var highShieldName = "HighDmgShield";
var wantGoodShield = true; //we want to only swap shield maximum once per loop
var goodBadShieldRatio = 1;
var lastFluffDmg = 1;
var currMap;
var statusMsg = "";
var ASMode;
var expectedPortalZone = 0;
var ATmakeUp = false;
var ATMaxVoids = 0;
function pauseRemovalLoop(){
var wrapper = document.getElementById("wrapper");
var chatFrame = document.getElementById("chatFrame");
var iFrame = document.getElementById("chatIFrame");
var settingsRow = document.getElementById("settingsRow");
//chat related stuff:
/*
//dont know why wrapper started shrinking on me
wrapper.style.width = '100vw';
//multiple screen changing buttons set wrapper display to block. chat functionality changes it to flex, so reset to flex every loop
if(wrapper.style.display === "block")
wrapper.style.display = "flex";
//this is ugly but best i found so far. problem is the settingsRow when it opens and closes
if(iFrame) {
var height = (document.getElementById("wrapper").clientHeight - document.getElementById("settingsRow").clientHeight) + 'px';
iFrame.style.height = height;
chatFrame.style.height = height;
}
//putting this here so that innerWrapper width gets set to fill screen when if screen changed not through chatFrame resize
updateInnerWrapperWidth();
//$(document).ready(function() {
// $("#innerWrapper").width($("#wrapper").width() - $("#chatIFrame").width());
//});
//if(chatFrame) chatFrame.style.height = (document.getElementById("wrapper").clientHeight - document.getElementById("settingsRow").clientHeight) + 'px';
*/
//fix portal screen
var portalWrapper = document.getElementById("portalWrapper");
portalWrapper.style["overflow-y"] = "auto";
var titleRow = document.getElementById("titleRow");
titleRow.style.position = "relative";
if(!getPageSetting('PauseMsgsVisible')){
var pauseMsgs = document.getElementsByClassName('pauseMsg');
var log = document.getElementById('log');
for (var x = 0; x < pauseMsgs.length; x++)
log.removeChild(pauseMsgs[x]);
}
}
function ATLoop(makeUp){ //makeUp = true when game is in catchup mode, so we can skip some unnecessary visuals
//debug((countHeliumSpent() + game.global.heliumLeftover + game.resources.helium.owned - game.global.totalHeliumEarned).toExponential(2));
if (!ATrunning) return;
if(loadedScriptAmount !== expectedScriptAmount){ //ATLoop can sometime pass starting checks due to asynchronous nature, so check again just in case
debug("Error: A Module was not loaded, " + loadedScriptAmount + " out of " + expectedScriptAmount);
debug(ATmoduleList);
return;
}
gatherInfo(); //stores graphs data, do this even with AT paused for graph only users.
if(getPageSetting('PauseScript') || game.options.menu.pauseGame.enabled){
if(getPageSetting('PauseScript'))
updateAutoMapsStatus("", "AT paused", true);
return;
}
ATmakeUp = makeUp;
trimpsRealMax = game.resources.trimps.realMax();
hiddenBreedTimer = game.jobs.Amalgamator.owned > 0 ? Math.floor((getGameTime() - game.global.lastSoldierSentAt) / 1000) : Math.floor(game.global.lastBreedTime / 1000);
if(hiddenBreedTimer != hiddenBreedTimerLast && typeof addbreedTimerInsideText !== 'undefined'){
if (!makeUp) addbreedTimerInsideText.textContent = hiddenBreedTimer + 's'; //add breed time for next army;
hiddenBreedTimerLast = hiddenBreedTimer;
}
wantGoodShield = true;
maxAnti = game.portal.Anticipation.level > 0 ? (game.talents.patience.purchased ? 45 : 30) : 0;
if(game.global.mapsActive) currMap = getCurrentMapObject();
attacksPerSecondAT = calcAttacksPerSecond();
expectedPortalZone = autoTrimpSettings.AutoPortal.selected !== "Custom" ? 0 : getPageSetting('CustomAutoPortal') + (game.global.challengeActive == "Daily" ? getPageSetting('AutoFinishDailyNew') : 0);
bsZone = (0.5*game.talents.blacksmith.purchased + 0.25*game.talents.blacksmith2.purchased + 0.15*game.talents.blacksmith3.purchased)*(game.global.highestLevelCleared + 1);
aWholeNewWorld = currentworld != game.global.world;
currentworld = game.global.world;
if ((game.global.world == 1 && aWholeNewWorld) || (!heirloomsShown && heirloomFlag) || (heirloomCache != game.global.heirloomsExtra.length)){
if (getPageSetting('AutoHeirlooms')) autoHeirlooms();
heirloomCache = game.global.heirloomsExtra.length;
highestPrestigeOwned = 0;
}
heirloomFlag = heirloomsShown;
if(ATMaxVoids < game.global.totalVoidMaps) ATMaxVoids = game.global.totalVoidMaps; //used by graphs
//Stuff to do Every new Zone
if (aWholeNewWorld) {
//Stuff to do Every new Portal
if(game.global.world === 1){
if (getPageSetting('AutoAllocatePerks')==2) lootdump();
zonePostpone = 0;
PRaidStartZone = 999;
ATMaxVoids = 0;
}
oncePerZoneCode();
}
setScienceNeeded(); //determine how much science is needed
var AS = getPageSetting('AutoStance');
if(AS < 2) statusMsg = "Advancing";
else if(AS == 2) statusMsg = "DE";
else statusMsg = "Push";
if (getPageSetting('ExitSpireCell') >0 || getPageSetting('ExitSpireCellDailyC2') >0) exitSpireCell(); //"Exit Spire After Cell" (other.js)
if (getPageSetting('BuyUpgradesNew') != 0) buyUpgrades();
autoGoldenUpgradesAT();
if (getPageSetting('BuyBuildingsNew')==1) { buyBuildings(); buyStorage(); }
else if (getPageSetting('BuyBuildingsNew')==2) buyBuildings();
else if (getPageSetting('BuyBuildingsNew')==3) buyStorage();
if (getPageSetting('BuyJobsNew')) buyJobs();
if (getPageSetting('ManualGather2')) manualLabor(); //"Auto Gather/Build" (gather.js)
autoMap(); //automaps() is in charge of maps combat
updateAutoMapsStatus("", statusMsg, true); //update status
if (autoTrimpSettings.AutoPortal.selected != "Off") autoPortal(); //"Auto Portal" (hidden until level 40) (portal.js)
if (aWholeNewWorld && getPageSetting('AutoRoboTrimp')) autoRoboTrimp(); //"AutoRoboTrimp" (other.js)
if (aWholeNewWorld && getPageSetting('FinishC2')>0 && game.global.runningChallengeSquared) finishChallengeSquared(); // "Finish Challenge2" (other.js)
if (getPageSetting('AutoStance')>0) autoStance(); //autostance() is in charge of world combat
equipSelectedShield(wantGoodShield);
if(!game.global.Geneticistassist && game.jobs.Geneticist.locked === 0) breedAT(); //autogeneticistassist unlocks after clearing cell 80 of bw 4 (z170)
if (getPageSetting('UseAutoGen')) autoGenerator(); //"Auto Generator ON" (magmite.js)
if (getPageSetting('AutoMagmiteSpender2')==2 && !magmiteSpenderChanged) autoMagmiteSpender(); //Auto Magmite Spender (magmite.js)
if (getPageSetting('AutoNatureTokens')) autoNatureTokens(); //Nature (other.js)
//Runs any user provided scripts
if (userscriptOn) userscripts();
return;
}
function resetMoreFarming(){
moreFarmingReset = false;
nextCacheCounter = "";
LMCDone = 0;
LWCDone = 0;
LSCDone = 0;
}
function oncePerZoneCode(){
// Auto-close dialogues.
switch (document.getElementById('tipTitle').innerHTML) {
case 'The Improbability': // Breaking the Planet
case 'Corruption': // Corruption / True Corruption
case 'Spire': // Spire
case 'The Magma': // Magma
cancelTooltip();
}
if (getPageSetting('AutoEggs')) easterEggClicked();
//used for farming mode
resetMoreFarming();
//used for spire LWC
LWCDoneAmount = 0;
oblitMultAT = game.global.challengeActive == "Obliterated" ? calcOblitMult(game.global.world) : 1;
coordMultAT = game.global.challengeActive == "Coordinate" ? calcCoordMult(game.global.world) : 1;
lastCell = -1;
highCritChance = getPlayerCritChance();
highCritDamage = getPlayerCritDamageMult();
highATK = calcHeirloomBonus("Shield", "trimpAttack", 1);
highPB = (game.heirlooms.Shield.plaguebringer.currentBonus > 0 ? game.heirlooms.Shield.plaguebringer.currentBonus / 100 : 0);
lowCritChance = getPlayerCritChance();
lowCritDamage = getPlayerCritDamageMult();
lowATK = 1;
lowPB = 0;
if (Fluffy.isActive()) lastFluffDmg = Fluffy.getDamageModifier(); //expensive, so calculate once per zone
AutoMapsCoordOverride = false;
maxCoords = -1;
if(game.options.menu.ctrlGigas.enabled === 1) game.options.menu.ctrlGigas.enabled = 0; //stops tooltip from showing when buying gigas (hopefully)
setTitle(); //Set the browser title
buildWorldArray();
setEmptyStats(); //also clears graph data
maxAnti = game.portal.Anticipation.level > 0 ? (game.talents.patience.purchased ? 45 : 30) : 0;
if(game.global.mapsActive)
currMap = getCurrentMapObject();
attacksPerSecondAT = calcAttacksPerSecond();
expectedPortalZone = autoTrimpSettings.AutoPortal.selected !== "Custom" ? 0 : getPageSetting('CustomAutoPortal') + (game.global.challengeActive == "Daily" ? getPageSetting('AutoFinishDailyNew') : 0);
bsZone = (0.5*game.talents.blacksmith.purchased + 0.25*game.talents.blacksmith2.purchased + 0.15*game.talents.blacksmith3.purchased)*(game.global.highestLevelCleared + 1);
calcBaseDamageinB();
}
function calcOblitMult(zone){
return Math.pow(10,12) * Math.pow(10, Math.floor(zone / 10));
}
function calcCoordMult(zone){
var num = 1;
for (var i = 0; i < zone; i++)
num = Math.ceil(num * 1.25);
return num;
}
//GUI Updates happen on this thread, every 1000ms
function guiLoop() {
updateCustomButtons();
MODULESdefault = JSON.parse(JSON.stringify(MODULES));
//Store the diff of our custom MODULES vars in the localStorage bin.
safeSetItems('storedMODULES', JSON.stringify(compareModuleVars()));
//Swiffy UI/Display tab
if(getPageSetting('EnhanceGrids'))
MODULES["fightinfo"].Update();
if(typeof MODULES !== 'undefined' && typeof MODULES["performance"] !== 'undefined' && MODULES["performance"].isAFK)
MODULES["performance"].UpdateAFKOverlay();
}
// Userscript loader. write your own!
//Copy and paste this function named userscripts() into the JS Dev console. (F12)
var userscriptOn = true; //controls the looping of userscripts and can be self-disabled
var globalvar0,globalvar1,globalvar2,globalvar3,globalvar4,globalvar5,globalvar6,globalvar7,globalvar8,globalvar9;
//left blank intentionally. the user will provide this. blank global vars are included as an example
function userscripts()
{
//insert code here:
}
//test.
function throwErrorfromMain() {
throw new Error("We have successfully read the thrown error message out of the main file");
}
//Magic Numbers
var runInterval = 100; //How often to loop through logic
startAT();