Stats Vlagfarm log

Reactiescore
226
Auteur
Shinko to Kuma
Beschrijving
PP vlag overzicht
Publiek of Privé
Publiek
Werkt op pagina
vlag log
Automatisch uitvoeren
neen
Snellijstcode
javascript: $.getScript('https://media.innogamescdn.com/com_DS_NL/scripts/Vlagfarm-log_206194.js');
Super simpel scriptje, kijkt in de HUIDIGE wereld in je vlaggenlog, en berekend hoeveel grijze vlaggen je gefarmed hebt door edels te produceren. Super niche scriptje, maar handig voor de vlaggenfarmers onder ons :D

Screenshot:

unknown.png
 
Reactiescore
27
Super simpel scriptje, kijkt in de HUIDIGE wereld in je vlaggenlog, en berekend hoeveel grijze vlaggen je gefarmed hebt door edels te produceren. Super niche scriptje, maar handig voor de vlaggenfarmers onder ons :D

Screenshot:

unknown.png

Dit script werkt niet meer, iemand die er naar kan kijken?
 

Deleted User - 24028

Guest
Met toestemming van de maker post ik hier de non-obfuscated code:

JavaScript:
ScriptAPI.register('Vlagfarm log', true, 'Shinko to Kuma', 'seppe.vandenbroeck@cm.innogames.com');

if (window.location.href.indexOf('flags&mode=log') < 0) {
    //relocate
    window.location.assign(game_data.link_base_pure + "flags&mode=log&page=1");
}
if (localStorage.getItem("FlagLogShinko")) {
    temp = JSON.parse(localStorage.getItem("FlagLogShinko"));
    console.log("Loading previous data")
    flagPerType = temp.flagPerType;
    stopDate = temp.lastDate;
    stopChange = temp.lastChange;
    var skip = false;
}
else {
    var skip = false;
    var flagPerType = {
        "Resource production": 0,
        "Recruitment speed": 0,
        "Attack strength": 0,
        "Defense strength": 0,
        "Luck": 0,
        "Population capacity": 0,
        "Lower coin costs": 0,
        "Haul capacity": 0
    }
    stopDate = 0;
    stopChange = 0;
}

var langShinko = {
    "en_DK": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "en_US": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "en_UK": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "nl_NL":
    {
        "Produced nobleman": "Geproduceerde edelman",
        "Resource production": "Grondstoffenproductie",
        "Recruitment speed": "Rekruteringssnelheid",
        "Attack strength": "Aanvalssterkte",
        "Defense strength": "Verdedigingskracht",
        "Luck": "Geluk",
        "Population capacity": "Inwonersaantal",
        "Lower coin costs": "Muntkosten verlagen",
        "Haul capacity": "Buitcapaciteit",
        "Reduced package costs": "?"
    },
    "it_IT":
    {
        "Produced nobleman": "Produzione nobile",
        "Resource production": "Produzione risorse",
        "Recruitment speed": "Velocità reclutamento",
        "Attack strength": "Potenza d'attacco",
        "Defense strength": "Forza di difesa",
        "Luck": "Fortuna",
        "Population capacity": "Aumento della popolazione",
        "Lower coin costs": "Ridotti costi pacchetto",
        "Haul capacity": "Capacità bottino",
        "Reduced package costs": "?"
    },
    "pt_BR": {
        "Produced nobleman": "Nobres produzidos",
        "Resource production": "Produção de recursos",
        "Recruitment speed": "Velocidade de recrutamento",
        "Attack strength": "Força de ataque",
        "Defense strength": "Força de defesa",
        "Luck": "Sorte",
        "Population capacity": "Capacidade da população",
        "Lower coin costs": "Menores custos de moeda",
        "Haul capacity": "Capacidade de saque",
        "Reduced package costs": "?"
    },
    "pt_PT": {
        "Produced nobleman": "Nobres produzidos",
        "Resource production": "Produção de recursos",
        "Recruitment speed": "Velocidade de recrutamento",
        "Attack strength": "Força de ataque",
        "Defense strength": "Força Defesa",
        "Luck": "Sorte",
        "Population capacity": "Capacidade da população",
        "Lower coin costs": "Menores custos de moeda",
        "Haul capacity": "Capacidade de carga",
        "Reduced package costs": "?"
    },
    "sv_SE": {
        "Produced nobleman": "Producerad adelsman",
        "Resource production": "Resursproduktion",
        "Recruitment speed": "Rekryteringshastighet",
        "Attack strength": "Attackstyrka",
        "Defense strength": "Försvarsstyrka",
        "Luck": "Lycka",
        "Population capacity": "Befolkningskapacitet",
        "Lower coin costs": "Lägre myntkostnader",
        "Haul capacity": "Bärkapacitet",
        "Reduced package costs": "?"
    }

};

/**** TribalWarsLibrary.js ****/
if (typeof window.twLib === 'undefined') {
  window.twLib = {
    queues: null,
    init: function() {
      if (this.queues === null) {
        this.queues = this.queueLib.createQueues(5);
      }
    },
    queueLib: {
      maxAttempts: 3,
      Item: function (action, arg, promise = null) {
        this.action = action;
        this.arguments = arg;
        this.promise = promise;
        this.attempts = 0;
      },
      Queue: function() {
        this.list = [];
        this.working = false;
        this.length = 0;

        this.doNext = function () {
          let item = this.dequeue();
          let self = this;

          if (item.action == 'openWindow') {
            window.open(...item.arguments).addEventListener('DOMContentLoaded', function() {
              self.start();
            });
          } else {
            $[item.action](...item.arguments).done(function () {
              item.promise.resolve.apply(null, arguments);
              self.start();
            }).fail(function () {
              item.attempts += 1;
              if (item.attempts < twLib.queueLib.maxAttempts) {
                self.enqueue(item, true);
              } else {
                item.promise.reject.apply(null, arguments);
              }

              self.start();
            });
          }
        };

        this.start = function () {
          if (this.length) {
            this.working = true;
            this.doNext();
          } else {
            this.working = false;
          }
        };

        this.dequeue = function () {
          this.length -= 1;
          return this.list.shift();
        };

        this.enqueue = function (item, front = false) {
          (front) ? this.list.unshift(item) : this.list.push(item);
          this.length += 1;

          if (!this.working) {
            this.start();
          }
        };
      },
      createQueues: function(amount) {
        let arr = [];

        for (let i = 0; i < amount; i++) {
          arr[i] = new twLib.queueLib.Queue();
        }

        return arr;
      },
      addItem: function(item) {
        let leastBusyQueue = twLib.queues.map(q => q.length).reduce((next, curr) => (curr < next) ? curr : next, 0);
        twLib.queues[leastBusyQueue].enqueue(item);
      },
      orchestrator: function(type, arg) {
        let promise = $.Deferred();
        let item = new twLib.queueLib.Item(type, arg, promise);

        twLib.queueLib.addItem(item);

        return promise;
      }
    },
    ajax: function() {
      return twLib.queueLib.orchestrator('ajax', arguments);
    },
    get: function() {
      return twLib.queueLib.orchestrator('get', arguments);
    },
    post: function() {
      return twLib.queueLib.orchestrator('post', arguments);
    },
    openWindow: function() {
      let item = new twLib.queueLib.Item('openWindow', arguments);

      twLib.queueLib.addItem(item);
    }
  };

  twLib.init();
}

URLs = [];
baseURL = "/game.php?&screen=flags&mode=log&page=";
if ($(".paged-nav-item").length) {
    amountOfPages = parseInt($(".paged-nav-item")[$(".paged-nav-item").length - 1].href.match(/page=(\d+)/)[1]);
}
else { amountOfPages = 0; }
let width;
if ($("#contentContainer")[0]) {
    width = $("#contentContainer")[0].clientWidth;
    $("#contentContainer").eq(0).prepend(`
<div id="progressbar" class="progress-bar progress-bar-alive">
<span id="count" class="label">0/${amountOfPages.length}</span>
<div id="progress"><span id="count2" class="label" style="width: ${width}px;">0/${amountOfPages.length}</span></div>
</div>`);
}
else {
    width = $("#mobileHeader")[0].clientWidth;
    $("#mobileHeader").eq(0).prepend(`
<div id="progressbar" class="progress-bar progress-bar-alive">
<span id="count" class="label">0/${amountOfPages.length}</span>
<div id="progress"><span id="count2" class="label" style="width: ${width}px;">0/${amountOfPages.length}</span></div>
</div>`);
}
for (var i = 0; i <= amountOfPages; i++) {
    URLs.push(baseURL + i);
}

$.getAll = function (
    urls, // array of URLs
    onLoad, // called when any URL is loaded, params (index, data)
    onDone, // called when all URLs successfully loaded, no params
    onError // called when a URL load fails or if onLoad throws an exception, params (error)
  ) {
    urls.forEach((url, index) => {
      twLib.get(url).done((data) => {
          try {
            onLoad(index, data);
          } catch (e) {
            onError(e);
          }

          $("#progress").css("width", `${(index + 1) / urls.length * 100}%`);
          $("#count").text(`${(index + 1)} / ${urls.length}`);
          $("#count2").text(`${(index + 1)} / ${urls.length}`);
          console.log(`${(index + 1) / urls.length * 100}%`);
          if ((urls.length - 1) == index) onDone();
      }).fail((xhr) => {
        onError(xhr);
      });
    });
  };

$.getAll(URLs,
    (i, data) => {
        console.log("Grabbing page " + i);

        /*if ($(data).find("#recaptcha-token").outerHTML!=undefined){
            alert("Triggered captcha! Please restart the script")
            throw Error("Rip");
        }*/

        tempRows = $(data).find("table .vis> tbody > tr");
        if (i == 0) {
            //we are on first page, check what the last entry is so we can remember for next time at the end
            //storing both time, and change, so if multiple changes happen on same time, we can stop at the correct one
            lastDate = tempRows[2].children[0].innerText.trim();
            lastChange = tempRows[2].children[1].innerText.trim();
        }

        for (var j = 0; j < tempRows.length - 2; j++) {
            if (tempRows[j + 2].children[0].innerText.trim() == stopDate && tempRows[j + 2].children[1].innerText.trim() == stopChange) {
                //REACHED LAST ENTRY, SKIP THE REST
                console.log("REACHED PREVIOUS LAST ENTRY");
                i = URLs.length;
                numDone = URLs.length;
                skip = true;
                break;
            }
            else {
                // Produced nobleman
                if (tempRows[j + 2].children[4].innerText.indexOf(langShinko[game_data.locale]["Produced nobleman"]) > -1) {
                    console.log("Found a grey flag!");
                    switch (tempRows[j + 2].children[1].innerText.trim()) {
                        case langShinko[game_data.locale]["Resource production"]:
                            flagPerType["Resource production"] += 1;
                            break;
                        case langShinko[game_data.locale]["Recruitment speed"]:
                            flagPerType["Recruitment speed"] += 1;
                            break;
                        case langShinko[game_data.locale]["Attack strength"]:
                            flagPerType["Attack strength"] += 1;
                            break;
                        case langShinko[game_data.locale]["Defense strength"]:
                            flagPerType["Defense strength"] += 1;
                            break;
                        case langShinko[game_data.locale]["Luck"]:
                            flagPerType["Luck"] += 1;
                            break;
                        case langShinko[game_data.locale]["Population capacity"]:
                            flagPerType["Population capacity"] += 1;
                            break;
                        case langShinko[game_data.locale]["Lower coin costs"]:
                            flagPerType["Lower coin costs"] += 1;
                            break;
                        case langShinko[game_data.locale]["Haul capacity"]:
                            flagPerType["Haul capacity"] += 1;
                            break;
                        case langShinko[game_data.locale]["Reduced package costs"]:
                            flagPerType["Lower coin costs"] += 1;
                            break;
                        default:
                            console.log("Problem: " + tempRows[j + 2].children[1].innerText);
                            throw Error("Can't recognize this flag");
                    }
                }
            }

        }

    },
    () => {
        storeData = {};
        storeData.flagPerType = flagPerType;
        storeData.lastChange= lastChange;
        storeData.lastDate=lastDate;
        console.log(storeData);
        localStorage.setItem("FlagLogShinko", JSON.stringify(storeData));
        $("#progressbar").remove();
        var html = "";
        for (var i = 0; i < Object.keys(flagPerType).length; i++) {
            html += `
        <tr>
            <td><img src='/graphic/flags/medium/${i + 1}_1.png' title='${langShinko[game_data.locale][Object.keys(langShinko[game_data.locale])[i + 1]]}'/></td>
            <td>${flagPerType[Object.keys(flagPerType)[i]]}</td>
        </tr>`
        }
        Dialog.show("Log:", `
        <div width="100%">
            <table class="vis" width="100%">
            ${html}
            </table>
        </div>
        `);
        console.table(flagPerType);
    },
    (error) => {
        console.error(error);
    });

Op die manier kan een andere scripter het probleem misschien oplossen :)[/spoiler]
 
Reactiescore
571
Met toestemming van de maker post ik hier de non-obfuscated code:

JavaScript:
ScriptAPI.register('Vlagfarm log', true, 'Shinko to Kuma', 'seppe.vandenbroeck@cm.innogames.com');

if (window.location.href.indexOf('flags&mode=log') < 0) {
    //relocate
    window.location.assign(game_data.link_base_pure + "flags&mode=log&page=1");
}
if (localStorage.getItem("FlagLogShinko")) {
    temp = JSON.parse(localStorage.getItem("FlagLogShinko"));
    console.log("Loading previous data")
    flagPerType = temp.flagPerType;
    stopDate = temp.lastDate;
    stopChange = temp.lastChange;
    var skip = false;
}
else {
    var skip = false;
    var flagPerType = {
        "Resource production": 0,
        "Recruitment speed": 0,
        "Attack strength": 0,
        "Defense strength": 0,
        "Luck": 0,
        "Population capacity": 0,
        "Lower coin costs": 0,
        "Haul capacity": 0
    }
    stopDate = 0;
    stopChange = 0;
}

var langShinko = {
    "en_DK": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "en_US": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "en_UK": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "nl_NL":
    {
        "Produced nobleman": "Geproduceerde edelman",
        "Resource production": "Grondstoffenproductie",
        "Recruitment speed": "Rekruteringssnelheid",
        "Attack strength": "Aanvalssterkte",
        "Defense strength": "Verdedigingskracht",
        "Luck": "Geluk",
        "Population capacity": "Inwonersaantal",
        "Lower coin costs": "Muntkosten verlagen",
        "Haul capacity": "Buitcapaciteit",
        "Reduced package costs": "?"
    },
    "it_IT":
    {
        "Produced nobleman": "Produzione nobile",
        "Resource production": "Produzione risorse",
        "Recruitment speed": "Velocità reclutamento",
        "Attack strength": "Potenza d'attacco",
        "Defense strength": "Forza di difesa",
        "Luck": "Fortuna",
        "Population capacity": "Aumento della popolazione",
        "Lower coin costs": "Ridotti costi pacchetto",
        "Haul capacity": "Capacità bottino",
        "Reduced package costs": "?"
    },
    "pt_BR": {
        "Produced nobleman": "Nobres produzidos",
        "Resource production": "Produção de recursos",
        "Recruitment speed": "Velocidade de recrutamento",
        "Attack strength": "Força de ataque",
        "Defense strength": "Força de defesa",
        "Luck": "Sorte",
        "Population capacity": "Capacidade da população",
        "Lower coin costs": "Menores custos de moeda",
        "Haul capacity": "Capacidade de saque",
        "Reduced package costs": "?"
    },
    "pt_PT": {
        "Produced nobleman": "Nobres produzidos",
        "Resource production": "Produção de recursos",
        "Recruitment speed": "Velocidade de recrutamento",
        "Attack strength": "Força de ataque",
        "Defense strength": "Força Defesa",
        "Luck": "Sorte",
        "Population capacity": "Capacidade da população",
        "Lower coin costs": "Menores custos de moeda",
        "Haul capacity": "Capacidade de carga",
        "Reduced package costs": "?"
    },
    "sv_SE": {
        "Produced nobleman": "Producerad adelsman",
        "Resource production": "Resursproduktion",
        "Recruitment speed": "Rekryteringshastighet",
        "Attack strength": "Attackstyrka",
        "Defense strength": "Försvarsstyrka",
        "Luck": "Lycka",
        "Population capacity": "Befolkningskapacitet",
        "Lower coin costs": "Lägre myntkostnader",
        "Haul capacity": "Bärkapacitet",
        "Reduced package costs": "?"
    }

};

/**** TribalWarsLibrary.js ****/
if (typeof window.twLib === 'undefined') {
  window.twLib = {
    queues: null,
    init: function() {
      if (this.queues === null) {
        this.queues = this.queueLib.createQueues(5);
      }
    },
    queueLib: {
      maxAttempts: 3,
      Item: function (action, arg, promise = null) {
        this.action = action;
        this.arguments = arg;
        this.promise = promise;
        this.attempts = 0;
      },
      Queue: function() {
        this.list = [];
        this.working = false;
        this.length = 0;

        this.doNext = function () {
          let item = this.dequeue();
          let self = this;

          if (item.action == 'openWindow') {
            window.open(...item.arguments).addEventListener('DOMContentLoaded', function() {
              self.start();
            });
          } else {
            $[item.action](...item.arguments).done(function () {
              item.promise.resolve.apply(null, arguments);
              self.start();
            }).fail(function () {
              item.attempts += 1;
              if (item.attempts < twLib.queueLib.maxAttempts) {
                self.enqueue(item, true);
              } else {
                item.promise.reject.apply(null, arguments);
              }

              self.start();
            });
          }
        };

        this.start = function () {
          if (this.length) {
            this.working = true;
            this.doNext();
          } else {
            this.working = false;
          }
        };

        this.dequeue = function () {
          this.length -= 1;
          return this.list.shift();
        };

        this.enqueue = function (item, front = false) {
          (front) ? this.list.unshift(item) : this.list.push(item);
          this.length += 1;

          if (!this.working) {
            this.start();
          }
        };
      },
      createQueues: function(amount) {
        let arr = [];

        for (let i = 0; i < amount; i++) {
          arr[i] = new twLib.queueLib.Queue();
        }

        return arr;
      },
      addItem: function(item) {
        let leastBusyQueue = twLib.queues.map(q => q.length).reduce((next, curr) => (curr < next) ? curr : next, 0);
        twLib.queues[leastBusyQueue].enqueue(item);
      },
      orchestrator: function(type, arg) {
        let promise = $.Deferred();
        let item = new twLib.queueLib.Item(type, arg, promise);

        twLib.queueLib.addItem(item);

        return promise;
      }
    },
    ajax: function() {
      return twLib.queueLib.orchestrator('ajax', arguments);
    },
    get: function() {
      return twLib.queueLib.orchestrator('get', arguments);
    },
    post: function() {
      return twLib.queueLib.orchestrator('post', arguments);
    },
    openWindow: function() {
      let item = new twLib.queueLib.Item('openWindow', arguments);

      twLib.queueLib.addItem(item);
    }
  };

  twLib.init();
}

URLs = [];
baseURL = "/game.php?&screen=flags&mode=log&page=";
if ($(".paged-nav-item").length) {
    amountOfPages = parseInt($(".paged-nav-item")[$(".paged-nav-item").length - 1].href.match(/page=(\d+)/)[1]);
}
else { amountOfPages = 0; }
let width;
if ($("#contentContainer")[0]) {
    width = $("#contentContainer")[0].clientWidth;
    $("#contentContainer").eq(0).prepend(`
<div id="progressbar" class="progress-bar progress-bar-alive">
<span id="count" class="label">0/${amountOfPages.length}</span>
<div id="progress"><span id="count2" class="label" style="width: ${width}px;">0/${amountOfPages.length}</span></div>
</div>`);
}
else {
    width = $("#mobileHeader")[0].clientWidth;
    $("#mobileHeader").eq(0).prepend(`
<div id="progressbar" class="progress-bar progress-bar-alive">
<span id="count" class="label">0/${amountOfPages.length}</span>
<div id="progress"><span id="count2" class="label" style="width: ${width}px;">0/${amountOfPages.length}</span></div>
</div>`);
}
for (var i = 0; i <= amountOfPages; i++) {
    URLs.push(baseURL + i);
}

$.getAll = function (
    urls, // array of URLs
    onLoad, // called when any URL is loaded, params (index, data)
    onDone, // called when all URLs successfully loaded, no params
    onError // called when a URL load fails or if onLoad throws an exception, params (error)
  ) {
    urls.forEach((url, index) => {
      twLib.get(url).done((data) => {
          try {
            onLoad(index, data);
          } catch (e) {
            onError(e);
          }

          $("#progress").css("width", `${(index + 1) / urls.length * 100}%`);
          $("#count").text(`${(index + 1)} / ${urls.length}`);
          $("#count2").text(`${(index + 1)} / ${urls.length}`);
          console.log(`${(index + 1) / urls.length * 100}%`);
          if ((urls.length - 1) == index) onDone();
      }).fail((xhr) => {
        onError(xhr);
      });
    });
  };

$.getAll(URLs,
    (i, data) => {
        console.log("Grabbing page " + i);

        /*if ($(data).find("#recaptcha-token").outerHTML!=undefined){
            alert("Triggered captcha! Please restart the script")
            throw Error("Rip");
        }*/

        tempRows = $(data).find("table .vis> tbody > tr");
        if (i == 0) {
            //we are on first page, check what the last entry is so we can remember for next time at the end
            //storing both time, and change, so if multiple changes happen on same time, we can stop at the correct one
            lastDate = tempRows[2].children[0].innerText.trim();
            lastChange = tempRows[2].children[1].innerText.trim();
        }

        for (var j = 0; j < tempRows.length - 2; j++) {
            if (tempRows[j + 2].children[0].innerText.trim() == stopDate && tempRows[j + 2].children[1].innerText.trim() == stopChange) {
                //REACHED LAST ENTRY, SKIP THE REST
                console.log("REACHED PREVIOUS LAST ENTRY");
                i = URLs.length;
                numDone = URLs.length;
                skip = true;
                break;
            }
            else {
                // Produced nobleman
                if (tempRows[j + 2].children[4].innerText.indexOf(langShinko[game_data.locale]["Produced nobleman"]) > -1) {
                    console.log("Found a grey flag!");
                    switch (tempRows[j + 2].children[1].innerText.trim()) {
                        case langShinko[game_data.locale]["Resource production"]:
                            flagPerType["Resource production"] += 1;
                            break;
                        case langShinko[game_data.locale]["Recruitment speed"]:
                            flagPerType["Recruitment speed"] += 1;
                            break;
                        case langShinko[game_data.locale]["Attack strength"]:
                            flagPerType["Attack strength"] += 1;
                            break;
                        case langShinko[game_data.locale]["Defense strength"]:
                            flagPerType["Defense strength"] += 1;
                            break;
                        case langShinko[game_data.locale]["Luck"]:
                            flagPerType["Luck"] += 1;
                            break;
                        case langShinko[game_data.locale]["Population capacity"]:
                            flagPerType["Population capacity"] += 1;
                            break;
                        case langShinko[game_data.locale]["Lower coin costs"]:
                            flagPerType["Lower coin costs"] += 1;
                            break;
                        case langShinko[game_data.locale]["Haul capacity"]:
                            flagPerType["Haul capacity"] += 1;
                            break;
                        case langShinko[game_data.locale]["Reduced package costs"]:
                            flagPerType["Lower coin costs"] += 1;
                            break;
                        default:
                            console.log("Problem: " + tempRows[j + 2].children[1].innerText);
                            throw Error("Can't recognize this flag");
                    }
                }
            }

        }

    },
    () => {
        storeData = {};
        storeData.flagPerType = flagPerType;
        storeData.lastChange= lastChange;
        storeData.lastDate=lastDate;
        console.log(storeData);
        localStorage.setItem("FlagLogShinko", JSON.stringify(storeData));
        $("#progressbar").remove();
        var html = "";
        for (var i = 0; i < Object.keys(flagPerType).length; i++) {
            html += `
        <tr>
            <td><img src='/graphic/flags/medium/${i + 1}_1.png' title='${langShinko[game_data.locale][Object.keys(langShinko[game_data.locale])[i + 1]]}'/></td>
            <td>${flagPerType[Object.keys(flagPerType)[i]]}</td>
        </tr>`
        }
        Dialog.show("Log:", `
        <div width="100%">
            <table class="vis" width="100%">
            ${html}
            </table>
        </div>
        `);
        console.table(flagPerType);
    },
    (error) => {
        console.error(error);
    });

Op die manier kan een andere scripter het probleem misschien oplossen :)[/spoiler]
*maakster
 
Reactiescore
1.257
Met toestemming van de maker post ik hier de non-obfuscated code:

JavaScript:
ScriptAPI.register('Vlagfarm log', true, 'Shinko to Kuma', 'seppe.vandenbroeck@cm.innogames.com');

if (window.location.href.indexOf('flags&mode=log') < 0) {
    //relocate
    window.location.assign(game_data.link_base_pure + "flags&mode=log&page=1");
}
if (localStorage.getItem("FlagLogShinko")) {
    temp = JSON.parse(localStorage.getItem("FlagLogShinko"));
    console.log("Loading previous data")
    flagPerType = temp.flagPerType;
    stopDate = temp.lastDate;
    stopChange = temp.lastChange;
    var skip = false;
}
else {
    var skip = false;
    var flagPerType = {
        "Resource production": 0,
        "Recruitment speed": 0,
        "Attack strength": 0,
        "Defense strength": 0,
        "Luck": 0,
        "Population capacity": 0,
        "Lower coin costs": 0,
        "Haul capacity": 0
    }
    stopDate = 0;
    stopChange = 0;
}

var langShinko = {
    "en_DK": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "en_US": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "en_UK": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "nl_NL":
    {
        "Produced nobleman": "Geproduceerde edelman",
        "Resource production": "Grondstoffenproductie",
        "Recruitment speed": "Rekruteringssnelheid",
        "Attack strength": "Aanvalssterkte",
        "Defense strength": "Verdedigingskracht",
        "Luck": "Geluk",
        "Population capacity": "Inwonersaantal",
        "Lower coin costs": "Muntkosten verlagen",
        "Haul capacity": "Buitcapaciteit",
        "Reduced package costs": "?"
    },
    "it_IT":
    {
        "Produced nobleman": "Produzione nobile",
        "Resource production": "Produzione risorse",
        "Recruitment speed": "Velocità reclutamento",
        "Attack strength": "Potenza d'attacco",
        "Defense strength": "Forza di difesa",
        "Luck": "Fortuna",
        "Population capacity": "Aumento della popolazione",
        "Lower coin costs": "Ridotti costi pacchetto",
        "Haul capacity": "Capacità bottino",
        "Reduced package costs": "?"
    },
    "pt_BR": {
        "Produced nobleman": "Nobres produzidos",
        "Resource production": "Produção de recursos",
        "Recruitment speed": "Velocidade de recrutamento",
        "Attack strength": "Força de ataque",
        "Defense strength": "Força de defesa",
        "Luck": "Sorte",
        "Population capacity": "Capacidade da população",
        "Lower coin costs": "Menores custos de moeda",
        "Haul capacity": "Capacidade de saque",
        "Reduced package costs": "?"
    },
    "pt_PT": {
        "Produced nobleman": "Nobres produzidos",
        "Resource production": "Produção de recursos",
        "Recruitment speed": "Velocidade de recrutamento",
        "Attack strength": "Força de ataque",
        "Defense strength": "Força Defesa",
        "Luck": "Sorte",
        "Population capacity": "Capacidade da população",
        "Lower coin costs": "Menores custos de moeda",
        "Haul capacity": "Capacidade de carga",
        "Reduced package costs": "?"
    },
    "sv_SE": {
        "Produced nobleman": "Producerad adelsman",
        "Resource production": "Resursproduktion",
        "Recruitment speed": "Rekryteringshastighet",
        "Attack strength": "Attackstyrka",
        "Defense strength": "Försvarsstyrka",
        "Luck": "Lycka",
        "Population capacity": "Befolkningskapacitet",
        "Lower coin costs": "Lägre myntkostnader",
        "Haul capacity": "Bärkapacitet",
        "Reduced package costs": "?"
    }

};

/**** TribalWarsLibrary.js ****/
if (typeof window.twLib === 'undefined') {
  window.twLib = {
    queues: null,
    init: function() {
      if (this.queues === null) {
        this.queues = this.queueLib.createQueues(5);
      }
    },
    queueLib: {
      maxAttempts: 3,
      Item: function (action, arg, promise = null) {
        this.action = action;
        this.arguments = arg;
        this.promise = promise;
        this.attempts = 0;
      },
      Queue: function() {
        this.list = [];
        this.working = false;
        this.length = 0;

        this.doNext = function () {
          let item = this.dequeue();
          let self = this;

          if (item.action == 'openWindow') {
            window.open(...item.arguments).addEventListener('DOMContentLoaded', function() {
              self.start();
            });
          } else {
            $[item.action](...item.arguments).done(function () {
              item.promise.resolve.apply(null, arguments);
              self.start();
            }).fail(function () {
              item.attempts += 1;
              if (item.attempts < twLib.queueLib.maxAttempts) {
                self.enqueue(item, true);
              } else {
                item.promise.reject.apply(null, arguments);
              }

              self.start();
            });
          }
        };

        this.start = function () {
          if (this.length) {
            this.working = true;
            this.doNext();
          } else {
            this.working = false;
          }
        };

        this.dequeue = function () {
          this.length -= 1;
          return this.list.shift();
        };

        this.enqueue = function (item, front = false) {
          (front) ? this.list.unshift(item) : this.list.push(item);
          this.length += 1;

          if (!this.working) {
            this.start();
          }
        };
      },
      createQueues: function(amount) {
        let arr = [];

        for (let i = 0; i < amount; i++) {
          arr[i] = new twLib.queueLib.Queue();
        }

        return arr;
      },
      addItem: function(item) {
        let leastBusyQueue = twLib.queues.map(q => q.length).reduce((next, curr) => (curr < next) ? curr : next, 0);
        twLib.queues[leastBusyQueue].enqueue(item);
      },
      orchestrator: function(type, arg) {
        let promise = $.Deferred();
        let item = new twLib.queueLib.Item(type, arg, promise);

        twLib.queueLib.addItem(item);

        return promise;
      }
    },
    ajax: function() {
      return twLib.queueLib.orchestrator('ajax', arguments);
    },
    get: function() {
      return twLib.queueLib.orchestrator('get', arguments);
    },
    post: function() {
      return twLib.queueLib.orchestrator('post', arguments);
    },
    openWindow: function() {
      let item = new twLib.queueLib.Item('openWindow', arguments);

      twLib.queueLib.addItem(item);
    }
  };

  twLib.init();
}

URLs = [];
baseURL = "/game.php?&screen=flags&mode=log&page=";
if ($(".paged-nav-item").length) {
    amountOfPages = parseInt($(".paged-nav-item")[$(".paged-nav-item").length - 1].href.match(/page=(\d+)/)[1]);
}
else { amountOfPages = 0; }
let width;
if ($("#contentContainer")[0]) {
    width = $("#contentContainer")[0].clientWidth;
    $("#contentContainer").eq(0).prepend(`
<div id="progressbar" class="progress-bar progress-bar-alive">
<span id="count" class="label">0/${amountOfPages.length}</span>
<div id="progress"><span id="count2" class="label" style="width: ${width}px;">0/${amountOfPages.length}</span></div>
</div>`);
}
else {
    width = $("#mobileHeader")[0].clientWidth;
    $("#mobileHeader").eq(0).prepend(`
<div id="progressbar" class="progress-bar progress-bar-alive">
<span id="count" class="label">0/${amountOfPages.length}</span>
<div id="progress"><span id="count2" class="label" style="width: ${width}px;">0/${amountOfPages.length}</span></div>
</div>`);
}
for (var i = 0; i <= amountOfPages; i++) {
    URLs.push(baseURL + i);
}

$.getAll = function (
    urls, // array of URLs
    onLoad, // called when any URL is loaded, params (index, data)
    onDone, // called when all URLs successfully loaded, no params
    onError // called when a URL load fails or if onLoad throws an exception, params (error)
  ) {
    urls.forEach((url, index) => {
      twLib.get(url).done((data) => {
          try {
            onLoad(index, data);
          } catch (e) {
            onError(e);
          }

          $("#progress").css("width", `${(index + 1) / urls.length * 100}%`);
          $("#count").text(`${(index + 1)} / ${urls.length}`);
          $("#count2").text(`${(index + 1)} / ${urls.length}`);
          console.log(`${(index + 1) / urls.length * 100}%`);
          if ((urls.length - 1) == index) onDone();
      }).fail((xhr) => {
        onError(xhr);
      });
    });
  };

$.getAll(URLs,
    (i, data) => {
        console.log("Grabbing page " + i);

        /*if ($(data).find("#recaptcha-token").outerHTML!=undefined){
            alert("Triggered captcha! Please restart the script")
            throw Error("Rip");
        }*/

        tempRows = $(data).find("table .vis> tbody > tr");
        if (i == 0) {
            //we are on first page, check what the last entry is so we can remember for next time at the end
            //storing both time, and change, so if multiple changes happen on same time, we can stop at the correct one
            lastDate = tempRows[2].children[0].innerText.trim();
            lastChange = tempRows[2].children[1].innerText.trim();
        }

        for (var j = 0; j < tempRows.length - 2; j++) {
            if (tempRows[j + 2].children[0].innerText.trim() == stopDate && tempRows[j + 2].children[1].innerText.trim() == stopChange) {
                //REACHED LAST ENTRY, SKIP THE REST
                console.log("REACHED PREVIOUS LAST ENTRY");
                i = URLs.length;
                numDone = URLs.length;
                skip = true;
                break;
            }
            else {
                // Produced nobleman
                if (tempRows[j + 2].children[4].innerText.indexOf(langShinko[game_data.locale]["Produced nobleman"]) > -1) {
                    console.log("Found a grey flag!");
                    switch (tempRows[j + 2].children[1].innerText.trim()) {
                        case langShinko[game_data.locale]["Resource production"]:
                            flagPerType["Resource production"] += 1;
                            break;
                        case langShinko[game_data.locale]["Recruitment speed"]:
                            flagPerType["Recruitment speed"] += 1;
                            break;
                        case langShinko[game_data.locale]["Attack strength"]:
                            flagPerType["Attack strength"] += 1;
                            break;
                        case langShinko[game_data.locale]["Defense strength"]:
                            flagPerType["Defense strength"] += 1;
                            break;
                        case langShinko[game_data.locale]["Luck"]:
                            flagPerType["Luck"] += 1;
                            break;
                        case langShinko[game_data.locale]["Population capacity"]:
                            flagPerType["Population capacity"] += 1;
                            break;
                        case langShinko[game_data.locale]["Lower coin costs"]:
                            flagPerType["Lower coin costs"] += 1;
                            break;
                        case langShinko[game_data.locale]["Haul capacity"]:
                            flagPerType["Haul capacity"] += 1;
                            break;
                        case langShinko[game_data.locale]["Reduced package costs"]:
                            flagPerType["Lower coin costs"] += 1;
                            break;
                        default:
                            console.log("Problem: " + tempRows[j + 2].children[1].innerText);
                            throw Error("Can't recognize this flag");
                    }
                }
            }

        }

    },
    () => {
        storeData = {};
        storeData.flagPerType = flagPerType;
        storeData.lastChange= lastChange;
        storeData.lastDate=lastDate;
        console.log(storeData);
        localStorage.setItem("FlagLogShinko", JSON.stringify(storeData));
        $("#progressbar").remove();
        var html = "";
        for (var i = 0; i < Object.keys(flagPerType).length; i++) {
            html += `
        <tr>
            <td><img src='/graphic/flags/medium/${i + 1}_1.png' title='${langShinko[game_data.locale][Object.keys(langShinko[game_data.locale])[i + 1]]}'/></td>
            <td>${flagPerType[Object.keys(flagPerType)[i]]}</td>
        </tr>`
        }
        Dialog.show("Log:", `
        <div width="100%">
            <table class="vis" width="100%">
            ${html}
            </table>
        </div>
        `);
        console.table(flagPerType);
    },
    (error) => {
        console.error(error);
    });

Op die manier kan een andere scripter het probleem misschien oplossen :)[/spoiler]
@r00t jij zin in hiernaar te kijken? :eek:
 
Reactiescore
48
Hey sorry, ben er nog niet aan toe gekomen. Ik zit met een hoop drukte en een aantal onverwachte zaken daar nog eens bovenop.

Mocht er nog niemand naar hebben gekeken tegen de tijd dat ik weer een paar vrije uurtjes heb, dan ga ik er alsnog naar kijken.
 
Reactiescore
1.257
Met toestemming van de maker post ik hier de non-obfuscated code:

JavaScript:
ScriptAPI.register('Vlagfarm log', true, 'Shinko to Kuma', 'seppe.vandenbroeck@cm.innogames.com');

if (window.location.href.indexOf('flags&mode=log') < 0) {
    //relocate
    window.location.assign(game_data.link_base_pure + "flags&mode=log&page=1");
}
if (localStorage.getItem("FlagLogShinko")) {
    temp = JSON.parse(localStorage.getItem("FlagLogShinko"));
    console.log("Loading previous data")
    flagPerType = temp.flagPerType;
    stopDate = temp.lastDate;
    stopChange = temp.lastChange;
    var skip = false;
}
else {
    var skip = false;
    var flagPerType = {
        "Resource production": 0,
        "Recruitment speed": 0,
        "Attack strength": 0,
        "Defense strength": 0,
        "Luck": 0,
        "Population capacity": 0,
        "Lower coin costs": 0,
        "Haul capacity": 0
    }
    stopDate = 0;
    stopChange = 0;
}

var langShinko = {
    "en_DK": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "en_US": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "en_UK": {
        "Produced nobleman": "Produced nobleman",
        "Resource production": "Resource production",
        "Recruitment speed": "Recruitment speed",
        "Attack strength": "Attack strength",
        "Defense strength": "Defense strength",
        "Luck": "Luck",
        "Population capacity": "Population capacity",
        "Lower coin costs": "Lower coin costs",
        "Haul capacity": "Haul capacity",
        "Reduced package costs": "Reduced package costs"
    },
    "nl_NL":
    {
        "Produced nobleman": "Geproduceerde edelman",
        "Resource production": "Grondstoffenproductie",
        "Recruitment speed": "Rekruteringssnelheid",
        "Attack strength": "Aanvalssterkte",
        "Defense strength": "Verdedigingskracht",
        "Luck": "Geluk",
        "Population capacity": "Inwonersaantal",
        "Lower coin costs": "Muntkosten verlagen",
        "Haul capacity": "Buitcapaciteit",
        "Reduced package costs": "?"
    },
    "it_IT":
    {
        "Produced nobleman": "Produzione nobile",
        "Resource production": "Produzione risorse",
        "Recruitment speed": "Velocità reclutamento",
        "Attack strength": "Potenza d'attacco",
        "Defense strength": "Forza di difesa",
        "Luck": "Fortuna",
        "Population capacity": "Aumento della popolazione",
        "Lower coin costs": "Ridotti costi pacchetto",
        "Haul capacity": "Capacità bottino",
        "Reduced package costs": "?"
    },
    "pt_BR": {
        "Produced nobleman": "Nobres produzidos",
        "Resource production": "Produção de recursos",
        "Recruitment speed": "Velocidade de recrutamento",
        "Attack strength": "Força de ataque",
        "Defense strength": "Força de defesa",
        "Luck": "Sorte",
        "Population capacity": "Capacidade da população",
        "Lower coin costs": "Menores custos de moeda",
        "Haul capacity": "Capacidade de saque",
        "Reduced package costs": "?"
    },
    "pt_PT": {
        "Produced nobleman": "Nobres produzidos",
        "Resource production": "Produção de recursos",
        "Recruitment speed": "Velocidade de recrutamento",
        "Attack strength": "Força de ataque",
        "Defense strength": "Força Defesa",
        "Luck": "Sorte",
        "Population capacity": "Capacidade da população",
        "Lower coin costs": "Menores custos de moeda",
        "Haul capacity": "Capacidade de carga",
        "Reduced package costs": "?"
    },
    "sv_SE": {
        "Produced nobleman": "Producerad adelsman",
        "Resource production": "Resursproduktion",
        "Recruitment speed": "Rekryteringshastighet",
        "Attack strength": "Attackstyrka",
        "Defense strength": "Försvarsstyrka",
        "Luck": "Lycka",
        "Population capacity": "Befolkningskapacitet",
        "Lower coin costs": "Lägre myntkostnader",
        "Haul capacity": "Bärkapacitet",
        "Reduced package costs": "?"
    }

};

/**** TribalWarsLibrary.js ****/
if (typeof window.twLib === 'undefined') {
  window.twLib = {
    queues: null,
    init: function() {
      if (this.queues === null) {
        this.queues = this.queueLib.createQueues(5);
      }
    },
    queueLib: {
      maxAttempts: 3,
      Item: function (action, arg, promise = null) {
        this.action = action;
        this.arguments = arg;
        this.promise = promise;
        this.attempts = 0;
      },
      Queue: function() {
        this.list = [];
        this.working = false;
        this.length = 0;

        this.doNext = function () {
          let item = this.dequeue();
          let self = this;

          if (item.action == 'openWindow') {
            window.open(...item.arguments).addEventListener('DOMContentLoaded', function() {
              self.start();
            });
          } else {
            $[item.action](...item.arguments).done(function () {
              item.promise.resolve.apply(null, arguments);
              self.start();
            }).fail(function () {
              item.attempts += 1;
              if (item.attempts < twLib.queueLib.maxAttempts) {
                self.enqueue(item, true);
              } else {
                item.promise.reject.apply(null, arguments);
              }

              self.start();
            });
          }
        };

        this.start = function () {
          if (this.length) {
            this.working = true;
            this.doNext();
          } else {
            this.working = false;
          }
        };

        this.dequeue = function () {
          this.length -= 1;
          return this.list.shift();
        };

        this.enqueue = function (item, front = false) {
          (front) ? this.list.unshift(item) : this.list.push(item);
          this.length += 1;

          if (!this.working) {
            this.start();
          }
        };
      },
      createQueues: function(amount) {
        let arr = [];

        for (let i = 0; i < amount; i++) {
          arr[i] = new twLib.queueLib.Queue();
        }

        return arr;
      },
      addItem: function(item) {
        let leastBusyQueue = twLib.queues.map(q => q.length).reduce((next, curr) => (curr < next) ? curr : next, 0);
        twLib.queues[leastBusyQueue].enqueue(item);
      },
      orchestrator: function(type, arg) {
        let promise = $.Deferred();
        let item = new twLib.queueLib.Item(type, arg, promise);

        twLib.queueLib.addItem(item);

        return promise;
      }
    },
    ajax: function() {
      return twLib.queueLib.orchestrator('ajax', arguments);
    },
    get: function() {
      return twLib.queueLib.orchestrator('get', arguments);
    },
    post: function() {
      return twLib.queueLib.orchestrator('post', arguments);
    },
    openWindow: function() {
      let item = new twLib.queueLib.Item('openWindow', arguments);

      twLib.queueLib.addItem(item);
    }
  };

  twLib.init();
}

URLs = [];
baseURL = "/game.php?&screen=flags&mode=log&page=";
if ($(".paged-nav-item").length) {
    amountOfPages = parseInt($(".paged-nav-item")[$(".paged-nav-item").length - 1].href.match(/page=(\d+)/)[1]);
}
else { amountOfPages = 0; }
let width;
if ($("#contentContainer")[0]) {
    width = $("#contentContainer")[0].clientWidth;
    $("#contentContainer").eq(0).prepend(`
<div id="progressbar" class="progress-bar progress-bar-alive">
<span id="count" class="label">0/${amountOfPages.length}</span>
<div id="progress"><span id="count2" class="label" style="width: ${width}px;">0/${amountOfPages.length}</span></div>
</div>`);
}
else {
    width = $("#mobileHeader")[0].clientWidth;
    $("#mobileHeader").eq(0).prepend(`
<div id="progressbar" class="progress-bar progress-bar-alive">
<span id="count" class="label">0/${amountOfPages.length}</span>
<div id="progress"><span id="count2" class="label" style="width: ${width}px;">0/${amountOfPages.length}</span></div>
</div>`);
}
for (var i = 0; i <= amountOfPages; i++) {
    URLs.push(baseURL + i);
}

$.getAll = function (
    urls, // array of URLs
    onLoad, // called when any URL is loaded, params (index, data)
    onDone, // called when all URLs successfully loaded, no params
    onError // called when a URL load fails or if onLoad throws an exception, params (error)
  ) {
    urls.forEach((url, index) => {
      twLib.get(url).done((data) => {
          try {
            onLoad(index, data);
          } catch (e) {
            onError(e);
          }

          $("#progress").css("width", `${(index + 1) / urls.length * 100}%`);
          $("#count").text(`${(index + 1)} / ${urls.length}`);
          $("#count2").text(`${(index + 1)} / ${urls.length}`);
          console.log(`${(index + 1) / urls.length * 100}%`);
          if ((urls.length - 1) == index) onDone();
      }).fail((xhr) => {
        onError(xhr);
      });
    });
  };

$.getAll(URLs,
    (i, data) => {
        console.log("Grabbing page " + i);

        /*if ($(data).find("#recaptcha-token").outerHTML!=undefined){
            alert("Triggered captcha! Please restart the script")
            throw Error("Rip");
        }*/

        tempRows = $(data).find("table .vis> tbody > tr");
        if (i == 0) {
            //we are on first page, check what the last entry is so we can remember for next time at the end
            //storing both time, and change, so if multiple changes happen on same time, we can stop at the correct one
            lastDate = tempRows[2].children[0].innerText.trim();
            lastChange = tempRows[2].children[1].innerText.trim();
        }

        for (var j = 0; j < tempRows.length - 2; j++) {
            if (tempRows[j + 2].children[0].innerText.trim() == stopDate && tempRows[j + 2].children[1].innerText.trim() == stopChange) {
                //REACHED LAST ENTRY, SKIP THE REST
                console.log("REACHED PREVIOUS LAST ENTRY");
                i = URLs.length;
                numDone = URLs.length;
                skip = true;
                break;
            }
            else {
                // Produced nobleman
                if (tempRows[j + 2].children[4].innerText.indexOf(langShinko[game_data.locale]["Produced nobleman"]) > -1) {
                    console.log("Found a grey flag!");
                    switch (tempRows[j + 2].children[1].innerText.trim()) {
                        case langShinko[game_data.locale]["Resource production"]:
                            flagPerType["Resource production"] += 1;
                            break;
                        case langShinko[game_data.locale]["Recruitment speed"]:
                            flagPerType["Recruitment speed"] += 1;
                            break;
                        case langShinko[game_data.locale]["Attack strength"]:
                            flagPerType["Attack strength"] += 1;
                            break;
                        case langShinko[game_data.locale]["Defense strength"]:
                            flagPerType["Defense strength"] += 1;
                            break;
                        case langShinko[game_data.locale]["Luck"]:
                            flagPerType["Luck"] += 1;
                            break;
                        case langShinko[game_data.locale]["Population capacity"]:
                            flagPerType["Population capacity"] += 1;
                            break;
                        case langShinko[game_data.locale]["Lower coin costs"]:
                            flagPerType["Lower coin costs"] += 1;
                            break;
                        case langShinko[game_data.locale]["Haul capacity"]:
                            flagPerType["Haul capacity"] += 1;
                            break;
                        case langShinko[game_data.locale]["Reduced package costs"]:
                            flagPerType["Lower coin costs"] += 1;
                            break;
                        default:
                            console.log("Problem: " + tempRows[j + 2].children[1].innerText);
                            throw Error("Can't recognize this flag");
                    }
                }
            }

        }

    },
    () => {
        storeData = {};
        storeData.flagPerType = flagPerType;
        storeData.lastChange= lastChange;
        storeData.lastDate=lastDate;
        console.log(storeData);
        localStorage.setItem("FlagLogShinko", JSON.stringify(storeData));
        $("#progressbar").remove();
        var html = "";
        for (var i = 0; i < Object.keys(flagPerType).length; i++) {
            html += `
        <tr>
            <td><img src='/graphic/flags/medium/${i + 1}_1.png' title='${langShinko[game_data.locale][Object.keys(langShinko[game_data.locale])[i + 1]]}'/></td>
            <td>${flagPerType[Object.keys(flagPerType)[i]]}</td>
        </tr>`
        }
        Dialog.show("Log:", `
        <div width="100%">
            <table class="vis" width="100%">
            ${html}
            </table>
        </div>
        `);
        console.table(flagPerType);
    },
    (error) => {
        console.error(error);
    });

Op die manier kan een andere scripter het probleem misschien oplossen :)[/spoiler]
Fix is zeer simpel. Tw zal weer iets aangepast hebben voor geen reden. :p
"Produced nobleman": "Geproduceerde edelman",

Veranderen naar
"Produced nobleman": "Opgeleide edelman",
 
Reactiescore
27
Kan deze fix doorgevoerd worden?
 
Reactiescore
1.257
Bovenaan