wklejamy.pl website for sale. You are interested in. Please contact. wklejamy@gmail.com
Click to buy coffe
Untitled
Guest 130 15th Mar, 2023
// ==UserScript==
// @name B
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Farming Simulator
// @author You
// @include https://*.plemiona.pl/game.php?*screen=am_farm*
// @grant none
// ==/UserScript==
(function () {
'use strict';
var $ = window.jQuery;
function nextVillage() {
window.location.reload(false)
}
function getLightsInVillage() {
return parseInt($('td#light')[0].textContent);
}
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
function shouldShuffle() {
const villagesWithoutShuffle = [12,20,21,22,23,24];
const villageNumber = parseInt($('td#menu_row2_village>a')[0].text.substring(0, 3));
return !villagesWithoutShuffle.includes(villageNumber);
}
function waitInMinutes(base, offset) {
const msInOneMinute = 60 * 1000
return wait(base * msInOneMinute, offset * msInOneMinute)
}
// This function waits for [base; base + offset] miliseconds and returns resolved Promise.
function wait(base, offset) {
const ms = nextInt(base, offset)
if(ms > 60000) {
console.log(`Waiting for ${ms / 60000}mins`)
} else if ( ms > 1000) {
console.log(`Waiting for ${ms / 1000}secs`)
} else {
console.log(`Waiting for ${ms}ms`)
}
return new Promise(resolve => setTimeout(resolve, ms))
}
function nextInt(base, offset) {
const int = base + Math.floor(Math.random() * offset)
return int
}
function main() {
var arr = $('a.farm_icon_b');
var i = 0;
const minutes = 20;
const minutesRange = 30;
const ms = 1275;
const msRange = 1050;
const lightsInAttack = 1;
// if (shouldShuffle()) {
// arr = shuffle(arr);
// }
var t = setInterval(
function () {
if (i > arr.length || lightsInAttack > getLightsInVillage()) {
console.log('Koniec w wiosce.');
clearInterval(t);
}
$(arr[i++]).click();
},
ms + Math.floor(Math.random() * msRange)
);
var randomWait = minutes * 60 * 1000 + Math.floor(Math.random() * minutesRange * 60 * 1000);
console.log('Zaczynam czekać ' + randomWait / 1000 + ' s na zmianę wioski');
setTimeout(nextVillage, randomWait);
}
waitInMinutes(1,1).then(() => main())
})();
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
- купить гидроборт
Qore | 5 | 1 hour ago
- nothing special
Pure | 9 | 8 hours ago
- Untitled
Markup | 19 | 11 hours ago
- allegra
Objective-C | 14 | 19 hours ago
- Untitled
Markup | 24 | 23 hours ago
- Untitled
Markup | 16 | 23 hours ago
- Untitled
Markup | 24 | 1 day ago