-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
70 lines (62 loc) · 1.89 KB
/
index.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
(async () => {
let token;
token = "WOOD";
token = "DUBLON";
const x = 1;
const y = 1;
const PAUSE_TASK = 5 * 1000;
const PAUSE_BUTTON = 5 * 1000;
const PAUSE_WAIT_POPUP = 10 * 1000;
while (1) {
await new Promise((res) => setTimeout(res, PAUSE_TASK));
let btns = document.getElementsByClassName("button-desk");
let repairText = "Repair";
for (let i = 0; i < btns.length; i++) {
if (
btns[i].textContent.includes(repairText) &&
!btns[i].classList.value.includes("-inactive")
) {
btns[i].click();
await new Promise((res) => setTimeout(res, PAUSE_BUTTON));
}
}
const claimText = "Claim";
for (let i = 0; i < btns.length; i++) {
if (btns[i].textContent.includes(claimText)) {
btns[i].click();
await new Promise((res) => setTimeout(res, PAUSE_BUTTON));
for (let i = 0; i < btns.length; i++) {
if (btns[i].textContent.includes("OK")) {
btns[i].click();
break;
}
}
}
}
const trawlText = "Trawl";
for (let b = 0; b < btns.length; b++) {
if (
btns[b].textContent.includes(trawlText) &&
!btns[b].classList.value.includes("-inactive")
) {
btns[b].click();
await new Promise((res) => setTimeout(res, PAUSE_BUTTON));
const tiles = document.querySelectorAll(".territories__item");
for (let i = 0; i < tiles.length; i++) {
if (tiles[i].textContent.startsWith(`${x} : ${y} `)) {
tiles[i].click();
break;
}
}
await new Promise((res) => setTimeout(res, PAUSE_BUTTON));
for (let i = 0; i < btns.length; i++) {
if (btns[i].textContent.includes(token)) {
btns[i].click();
break;
}
}
await new Promise((res) => setTimeout(res, PAUSE_WAIT_POPUP));
}
}
}
})();