forked from Zorn192/AutoTrimps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperformance.js
155 lines (134 loc) · 4.71 KB
/
performance.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
;(function(M, W)
{
M["performance"] = {};
M["performance"].isAFK = false; //start with AFK disabled
// Save updateLabels Trimps game functions, to restore it after we disable it.
M["performance"].updateLabels = W.updateLabels;
// Game Wrapper to insert DOM elements into
M["performance"].$wrapper = document.getElementById('wrapper');
// AFK OVERLAY CSS Style
document.head.appendChild(document.createElement('style')).innerHTML = `
.at-afk-overlay
{
position: absolute;
left: 0px;
top: 0px;
width: 100vw;
height: 100vh;
background-color: black;
color: white;
z-index: 9001;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.at-afk-overlay-disabled
{
display: none !important;
}
.at-afk-overlay-title
{
font-size: 24pt;
}
.at-afk-zone, .at-afk-helium, .at-afk-status
{
font-size: 20pt;
}
.at-afk-overlay-disable-btn
{
width: 250px;
height: 60px;
background-color: #e74c3c;
color: white;
border: 2px solid white;
text-align: center;
line-height: 60px;
font-size: 20pt;
margin-top: 25px;
}
.at-afk-overlay-disable-btn:hover
{
cursor: pointer;
background-color: #c0392b;
transition: all 300ms linear;
}`;
// The overlay
M["performance"].AFKOverlay = document.createElement('div');
M["performance"].AFKOverlay.className = 'at-afk-overlay at-afk-overlay-disabled';
// Title
var AFKOverlayTitle = document.createElement('p');
AFKOverlayTitle.innerText = 'TRIMPS - AFK';
AFKOverlayTitle.className = 'at-afk-overlay-title'
// Zone
M["performance"].AFKOverlayZone = document.createElement('p');
M["performance"].AFKOverlayZone.innerText = 'Current zone: -';
M["performance"].AFKOverlayZone.className = 'at-afk-zone'
// Helium
M["performance"].AFKOverlayHelium = document.createElement('p');
M["performance"].AFKOverlayHelium.innerText = 'Current helium: -';
M["performance"].AFKOverlayHelium.className = 'at-afk-helium'
// Status
M["performance"].AFKOverlayStatus = document.createElement('p');
M["performance"].AFKOverlayStatus.innerText = 'Status: -';
M["performance"].AFKOverlayStatus.className = 'at-afk-status'
// Disable(Back) button
M["performance"].AFKOverlayDisable = document.createElement('div');
M["performance"].AFKOverlayDisable.innerText = 'I\'m Back';
M["performance"].AFKOverlayDisable.className = 'at-afk-overlay-disable-btn'
M["performance"].AFKOverlayDisable.addEventListener('click', function()
{
M["performance"].DisableAFKMode();
});
// Bundle them together
M["performance"].AFKOverlay.appendChild(AFKOverlayTitle);
M["performance"].AFKOverlay.appendChild(M["performance"].AFKOverlayZone);
M["performance"].AFKOverlay.appendChild(M["performance"].AFKOverlayHelium);
M["performance"].AFKOverlay.appendChild(M["performance"].AFKOverlayStatus);
M["performance"].AFKOverlay.appendChild(M["performance"].AFKOverlayDisable);
// Insert the afk page, at the top level <body> tag
document.body.appendChild(M["performance"].AFKOverlay);
M["performance"].EnableAFKMode = function EnableAFKMode()
{
M["performance"].isAFK = true;
M["performance"].AFKOverlay.classList.remove('at-afk-overlay-disabled');
M["performance"].$wrapper.style.display = 'none';
//This is the whole meat - replaces the update function with nothing (means save resources)
W.updateLabels = function() {};
enableDebug = false;
}
M["performance"].DisableAFKMode = function DisableAFKMode()
{
M["performance"].isAFK = false;
M["performance"].$wrapper.style.display = 'block';
M["performance"].AFKOverlay.classList.add('at-afk-overlay-disabled');
W.updateLabels = M["performance"].updateLabels;
enableDebug = true;
}
M["performance"].UpdateAFKOverlay = function UpdateAFKOverlay()
{
M["performance"].AFKOverlayZone.innerText = 'Current Zone: ' + game.global.world;
if (game.global.universe == 1) {
M["performance"].AFKOverlayHelium.innerText = 'Current Helium: ' + prettify(Math.floor(game.resources.helium.owned));
M["performance"].AFKOverlayStatus.innerHTML = 'Current Status: ' + updateAutoMapsStatus(true)[0];
}
if (game.global.universe == 2) {
M["performance"].AFKOverlayHelium.innerText = 'Current Radon: ' + prettify(Math.floor(game.resources.radon.owned));
M["performance"].AFKOverlayStatus.innerHTML = 'Current Status: ' + RupdateAutoMapsStatus(true)[0];
}
}
})(MODULES, window);