Put what you want to use in units
Then go to collector page > press f12 > console > paste the code:
Have fun
PHP Code:
const autoCollector = {
units: [
{'spear': 0},
{'sword': 0},
{'axe': 0},
{'archer': 0},
{'light': 0},
{'marcher': 0},
{'heavy': 0},
{'knight': 0}
],
intervalId: 0,
percents: [0.62, 0.27, 0.11],
options: document.getElementsByClassName("options-container")[0].children,
setUnitAmount(name, amount) {
const element = document.getElementsByName(name)[0];
element.value = amount;
element.dispatchEvent(new Event('change'));
},
unitAvailable: function (name) {
const field = document.getElementsByName(name)[0];
const text = field.parentNode.lastChild.innerHTML;
return +(text.substr(1, text.length - 2));
},
calculateAndSetUnits: function (level) {
const percent = this.percents[level];
for (let i = 0; i < this.units.length; i++) {
const current = this.units[i];
const name = Object.keys(current);
const amount = Math.floor(current[name] * percent);
const available = this.unitAvailable(name);
this.setUnitAmount(name, Math.min(amount, available));
}
},
tick: function () {
for (let i = 0; i < this.options.length; i++) {
const element = this.options[i].lastChild.lastChild;
if (element.classList.contains("inactive-view")) {
if (element.firstChild === null)
continue;
this.calculateAndSetUnits(i);
element.lastChild.firstChild.click();
break;
}
}
},
start: function () {
if (this.intervalId !== 0)
throw new Error("Already started!");
else
this.intervalId = setInterval(() => this.tick(), 10000)
},
stop: function () {
if (this.intervalId === 0)
throw new Error("Not started yet!");
else {
clearInterval(this.intervalId);
this.intervalId = 0;
}
}
};
autoCollector.start();






