Skip to content

Commit

Permalink
feat: add avialable maps
Browse files Browse the repository at this point in the history
  • Loading branch information
voodee committed Nov 29, 2021
1 parent eb72add commit fd1c8f5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Farmers World Bot Free

## Video instruction

https://youtu.be/D028TAAe5H8

## Instalation guide
Expand All @@ -17,9 +18,17 @@ https://youtu.be/D028TAAe5H8
- If energy is less than 200 and food more than 20, it makes an exchange.
- If the strength of the mining tool is less than half, it is repaired. Make sure you have enough gold in your account.

## Changelog

### 29/11/2021

- Added the ability to select maps for mining. #4
- Improved the setting of pauses in the game. #4

## Support

_Any problems? [Submit an issue](https://github.com/SmartBotBlack/farmers-world-bot/issues/new) or send message in telegram [@smartbotofficial](https://t.me/smartbotofficial) or email [[email protected]]([email protected])!_

### Official site

https://smartbot.black
31 changes: 24 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
(async () => {
// Maps on which you can collect resources
// 1 — Mining
// 2 — Chiken
// 3 — Plant
// 4 — Cow
const availableMaps = [1, 2, 3, 4];
// Delay between moving to the next map (5sec)
const delayNextMap = 5 * 1000;
// Delay after map selection (5sec)
const delayAfterMapSelect = 5 * 1000;
// Delay after mine (1sec)
const delayAfterMine = 1 * 1000;
// Delay before repair begins (10sec)
const delayBeforeRepair = 10 * 1000;
// Delay after repair begins (1sec)
const delayAfterRepair = 1 * 1000;

const mapBtn = document.querySelector(".navbar-group--icon[alt='Map']");
mapBtn.click();

while (1) {
for (let mapId = 0; mapId < 4; ++mapId) {
await new Promise((res) => setTimeout(res, 5e3));
if (!availableMaps.includes(mapId + 1)) continue;

await new Promise((res) => setTimeout(res, delayNextMap));

const map = document.querySelectorAll(".map-container-bg")[mapId];

if (map.style.filter === "grayscale(1)") continue;

map.click();

await new Promise((res) => setTimeout(res, 5e3));
await new Promise((res) => setTimeout(res, delayAfterMapSelect));

for (const [indexItem, item] of document
.querySelectorAll(".vertical-carousel-container img")
Expand All @@ -33,11 +52,11 @@
) {
buttonMine.click();

await new Promise((res) => setTimeout(res, 1e3));
await new Promise((res) => setTimeout(res, delayAfterMine));

// If map with mining
if (mapId === 0) {
await new Promise((res) => setTimeout(res, 1e4));
await new Promise((res) => setTimeout(res, delayBeforeRepair));

// Repair instruments
const buttonRepair = document.querySelectorAll(
Expand All @@ -51,12 +70,10 @@
quality < 0.5
) {
buttonRepair.click();
await new Promise((res) => setTimeout(res, 1e3));
await new Promise((res) => setTimeout(res, delayAfterRepair));
}
}

await new Promise((res) => setTimeout(res, 1e4));

const currentEnergy = +document.querySelectorAll(
".resource-number div"
)[3].innerText;
Expand Down

0 comments on commit fd1c8f5

Please sign in to comment.