Results 1 to 1 of 1
  1. #1
    JulianTifflor
    JulianTifflor is offline
    Guest
    Join Date
    2012 Oct
    Posts
    1
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Grepolis Town Farmer

    Hello PGC,

    here is a little Farmer i wrote for grepolis that i want to share with you:

    Code:
    function Claimer(towns) {
      this.towns = towns;
      this.claim_lvls = [5, 10, 20, 40, 90, 180, 240, 480]
      this.claim_moral = [6, 10, 12, 20, 24, 40, 48, 80]
      this.claim_level = 1;
      this.time_for_farm_town = {min: 1500, max: 2500};
      this.time_for_island_overview = {min: 2000, max: 3000};
      this.time_for_player_town = {min: 4000, max: 5000};
      this.time_for_claim = {min: 80000, max: 120000};
      this.pause_time = {min: 1200000, max: 2400000};
      this.running = false;
      this.away = false;
      this.ajax = new window.GPAjax(window.Layout, false);
      this.claims = 0;
      this.total_claims = 0;
      this.pause_every = {min: 4, max: 6};
    }
    
    Claimer.prototype.claim = function() {
      var obj = this;
      this.away = false;
      obj.claimTown(0);
      
      this.total_claims += 1;
      this.claims -= 1;
      if (this.running) {
        var timeout = this.random(this.time_for_claim);
        if (this.claims <= 0) {
          this.claims = this.random(this.pause_every);
          this.away = true;
          timeout = this.random(this.pause_time);
        }
        this.stopID = setTimeout(function() { obj.claim() }, this.claim_lvls[this.claim_level] * 60 * 1000 + this.random(this.time_for_claim));
      }
    }
    
    Claimer.prototype.claimTown = function(town_id) {
      if (town_id >= this.towns.length) {
        return;
      }
      var town = this.towns[town_id];
      var obj = this;
      this.ajax.get('island_info', 'index', {island_id: town.island, town_id: town.town}, false, function(context, data, flags){
        var now = Timestamp.now();
        var farm_towns = data.json.farm_town_list.filter(function(ft) { return ft.rel == 1 && (ft.loot == null || ft.loot < now) });
        setTimeout(function(){ obj.claimAllFarmTowns(farm_towns, town_id) }, obj.random(obj.time_for_island_overview))
      });
    }
    
    Claimer.prototype.claimAllFarmTowns = function(farm_towns, town_id) {
      var obj = this;
      if (farm_towns.length <= 0) {
        setTimeout(function() { obj.claimTown(town_id + 1) }, this.random(this.time_for_player_town));
      }
      var next = farm_towns.pop();
      this.ajax.get('farm_town_info', 'claim_info', {id: next.id}, false, function(context, data, flag){
        setTimeout(function() {
          var ct = 'normal';
          if (next.mood && next.mood - obj.claim_moral[obj.claim_level] >= 80) {
            ct = 'double';
          }
          var oldTown = window.Game.townId;
          window.Game.townId = obj.towns[town_id].town;
          obj.ajax.post('farm_town_info', 'claim_load', {target_id: next.id, claim_type: ct, time: obj.claim_lvls[obj.claim_level] * 60}, false, function(context, data, flag) {
            setTimeout(function() { obj.claimAllFarmTowns(farm_towns, town_id); }, obj.random(obj.time_for_farm_town));
          });
          window.Game.townId = oldTown;
        }, obj.random(obj.time_for_farm_town));
      });
    }
    
    Claimer.prototype.start = function() {
      this.claims = this.random(this.pause_every);
      this.running = true;
      this.claim();
    }
    
    Claimer.prototype.stop = function() {
      clearTimeout(this.stopID);
      this.running = false;
    }
    
    Claimer.prototype.random = function(p) {
      return p.min + Math.floor(Math.random()*(p.max - p.min));
    }
    
    mytowns = [{island: 123456, town: 12345}];
    c = new Claimer(mytowns);
    c.start();
    Only catch is you have to update the list of your cities manually (see the mytowns array). As this script tries to mimic human behaviour (at least to some extend it may not be the fastest one around, but it may help you get past any heuristic InnoGames might have setup).

  2. The Following User Says Thank You to JulianTifflor For This Useful Post:


Similar Threads

  1. Grepolis 2.0
    By jordansoulas in forum Browser Games
    Replies: 2
    Last Post: 2014-03-26, 06:48 AM
  2. [Help] Car Town Facebook
    By fujiwarataku in forum Browser Games
    Replies: 3
    Last Post: 2012-09-27, 04:32 PM
  3. [Source] Grepolis Bot ver.2
    By Grooguz in forum VB, .NET Framework
    Replies: 3
    Last Post: 2012-08-15, 12:00 AM
  4. Grepolis Troop Calculator
    By The.Black.Knigh in forum Browser Games
    Replies: 3
    Last Post: 2012-05-15, 06:26 PM
  5. [Source] Grepolis Bot ver.1
    By Grooguz in forum VB, .NET Framework
    Replies: 1
    Last Post: 2011-12-15, 06:01 PM
Visitors found this page by searching for:

grepolis 80000 flags

grepolis town_id

grepolis new-obj

grepolis standalone offline pc game

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •