/ ‘grepolis.user.js’

This commit is contained in:
2014-08-07 21:50:33 +02:00
parent 864d93588d
commit 427f2ef900

View File

@ -10,7 +10,7 @@
// //
// @match http://*.grepolis.com/game/* // @match http://*.grepolis.com/game/*
// //
// @version 1.1.46 // @version 1.1.47
// @updateURL http://git.javil.eu/jan/userscripts/raw/master/grepolis.user.js // @updateURL http://git.javil.eu/jan/userscripts/raw/master/grepolis.user.js
// ==/UserScript== // ==/UserScript==
@ -82,21 +82,7 @@
for(var town_id in farm_ids) { for(var town_id in farm_ids) {
console.log("prepare town " + town_id); console.log("prepare town " + town_id);
townCount++; townCount++;
var town_id_c = town_id; getFarmsFor(town_id, townCount);
setTimeout(function() {
console.log("get farms for town " + town_id_c);
HelperTown.townSwitch(town_id_c);
HelperTown.handleInfoWindowJumpToTownClick();
setTimeout(function() {
console.log("getting farms for town " + town_id_c);
var farmtowns = $(".farmtown_owned_on_same_island");
$.each(farmtowns, function(f, farmtown) {
var farmtownId = farmtown["id"].split("_")[2];
console.log("got farm " + farmtownId + " for town " + town_id_c);
farm_ids[town_id_c].push(+farmtownId);
});
}, 1800);
}, townCount*2200);
} }
setTimeout(function() { setTimeout(function() {
@ -121,6 +107,23 @@
} }
}, 15000); }, 15000);
function getFarmsFor(xTownId, xTownCount) {
setTimeout(function() {
console.log("get farms for town " + xTownId);
HelperTown.townSwitch(xTownId);
HelperTown.handleInfoWindowJumpToTownClick();
setTimeout(function() {
console.log("getting farms for town " + xTownId);
var farmtowns = $(".farmtown_owned_on_same_island");
$.each(farmtowns, function(f, farmtown) {
var farmtownId = farmtown["id"].split("_")[2];
console.log("got farm " + farmtownId + " for town " + xTownId);
farm_ids[xTownId].push(+farmtownId);
});
}, 1800);
}, xTownCount*2200);
}
function log(xText) { function log(xText) {
var date = new Date(); // Timestamp to prepend var date = new Date(); // Timestamp to prepend
var timestamp = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toJSON(); var timestamp = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toJSON();