Cookie clicker tools (visual)
目前為
// ==UserScript==
// @name Cookie clicker tools
// @namespace orteil.dashnet.org
// @version 2.001
// @description Cookie clicker tools (visual)
// @author Anton
// @match http://orteil.dashnet.org/cookieclicker/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
if (console) console.log('Cookies?');
var started = false;
var t2, t3;
var startT = function() {
t2 = setInterval(function() {
var minInvert = null, minObj = null;
for (var i in Game.ObjectsById) {
if (typeof i !== 'undefined' && i != 'undefined' && Game.ObjectsById.hasOwnProperty(i)) {
if (Game.ObjectsById[i].locked === 0) {
var interest = Game.ObjectsById[i].price / Game.ObjectsById[i].storedCps;
if (minInvert == null) {
minInvert = interest;
minObj = i;
} else if (interest < minInvert) {
minInvert = interest;
minObj = i;
}
}
}
}
if (minObj != null) {
Game.ObjectsById[minObj].buy(1);
jQuery('#versionNumber').text('Collecting ' + Beautify(Game.ObjectsById[minObj].price) + ' for ' + Game.ObjectsById[minObj].name);
}
}, 1000);
started = true;
jQuery('#versionNumber').text('Started');
}
var stopT = function() {
clearInterval(t2);
started = false;
jQuery('#versionNumber').text('Collecting gold...');
}
jQuery('#versionNumber').on("click", function() {
if (!started)
startT();
else
stopT();
});
t3 = setInterval(function() {
var golden = Game.shimmers;
if (golden.length > 0) {
for (var i in golden) {
golden[i].pop();
}
}
}, 3000);
jQuery('#versionNumber').text('Collecting gold...');
})();