FGOのイベントがクッキークリッカーだと話題で、久しぶりにあけてみたら、昔書いたチートコードが動かなくなってたので、多分動くように書き直したものを置いておきます。
// 1CPSの値段 = 購入してペイするまでの時間 function calcPaySec(i) { if(!Game.ObjectsById[i]) return 0 return Game.ObjectsById[i].price / Game.ObjectsById[i].cps(Game.ObjectsById[i]) } // 購入までにかかる時間 function calcBuySec(i) { return 0 < Game.cookiesPs ? Game.ObjectsById[i].price / Game.cookiesPs : 0 } // 購入後、現在1秒で得られるクッキーを得る時間 function calcAddCookieSec(i) { return Game.cookiesPs / Game.ObjectsById[i].cps(Game.ObjectsById[i]) } // 購入〜元に戻るまでの時間 function calcTotalPaySec(i) { return calcPaySec(i) + calcBuySec(i) } // 1秒分のクッキーを得るために必要な時間 function calcTotalSec(i) { return calcTotalPaySec(i) + calcAddCookieSec(i) } // 1CPSを手に入れるための時間と値段の積 function calcPTCR(i) { return calcPaySec(i) * calcBuySec(i) } // 時刻のフォーマット function formatTime(sec) { var str = "" if(24 * 60 * 60 < sec) { str += Math.floor(sec / 24 / 60 / 60) + " Days " sec %= 24 * 60 * 60 } if(60 * 60 < sec) { str += Math.floor(sec / 60 / 60) + ":" sec %= 60 * 60 } if(60 < sec) { str += Math.floor(sec / 60) + ":" sec %= 60 } return str + Math.floor(sec) } // 色々表示 function consoleStats() { var obj = [] for(var i = 0;i < Game.ObjectsById.length;i++){ obj.push({ Name : Game.ObjectsById[i].name, PaySec : formatTime(calcPaySec(i)), BuySec : formatTime(calcBuySec(i)), AddCookieSec : formatTime(calcAddCookieSec(i)), TotalPaySec : formatTime(calcTotalPaySec(i)), Total : formatTime(calcTotalSec(i)), }) } console.table(obj) console.info(formatTime((Game.cookiesReset - Game.cookiesEarned) / Game.cookiesPs)) } // funcの最小を探す function getSmall(func) { var small = -1 var smallValue = 0 for(var i = 0;i < Game.ObjectsById.length;i++){ if(small < 0 || func(i) < smallValue) { smallValue = func(i) small = i } } return small } // 最小のものを買う function buySmall(func) { if(Game.ObjectsById[getSmall(func)].price < Game.cookies) { Game.ObjectsById[getSmall(func)].buy() return true } else { return false } } // 安物買い function buySmallObject() { if(Game.ObjectsById[getSmall(calcTotalPaySec)].price * 100 < Game.ObjectsById[getSmall(calcTotalSec)].price && Game.ObjectsById[getSmall(calcTotalPaySec)].price < Game.cookies) { Game.ObjectsById[getSmall(calcTotalPaySec)].buy() return true } else { return false } } // 最大まで買う function buyMax() { while(buySmall(calcTotalSec)){} } // Golden Cookieをクリック function clickGoldenCookie() { if(document.getElementById('goldenCookie').style.display != "none") { document.getElementById('goldenCookie').click() } } // でかクッキーをクリック function clickBigCookie() { document.getElementById('bigCookie').click() } // upgradeを買う function buyUpgrades(list, alwaysBuy) { for(var i = 0; i < list.length;i++) { // ダイアログが出るやつとか回避 if(list[i].clickFunction || Game.cookies < list[i].getPrice()) continue; if(alwaysBuy || list[i].getPrice() < Game.cookiesPs * 60) { list[i].buy() } } } // 到達している最強のObject function getMaxObjectIndex() { return Game.ObjectsById.filter(function(x){return 0 < x.amount}).length - 1 } // Objects関連Upgradesの取得 function getRelativeUpgradeList(i) { return getMatchedUpgradeList(Game.ObjectsById[i].plural) } // descと文字列マッチでUpgradeListを取得 function getMatchedUpgradeList(match) { return Game.UpgradesInStore.filter(function(u) { return 0 <= u.desc.toLowerCase().indexOf(match) }) } // 定期的にリセットする function resetGame() { if(1 < (new Date().getTime()-Game.startDate)/60/60/1000 && Game.cookiesReset < Game.cookiesEarned) { Game.Reset(true, false) } } // ツールのループメイン function executeLoop() { clickGoldenCookie() buyMax() buyUpgrades(Game.UpgradesInStore.filter(function(u) {return u.type == "cookie"}), true) buyUpgrades(getRelativeUpgradeList(getMaxObjectIndex()), true) if(0 < getMaxObjectIndex()) { buyUpgrades(getRelativeUpgradeList(getMaxObjectIndex() - 1), true) } buyUpgrades(getMatchedUpgradeList("golden cookies"), true) buyUpgrades(Game.UpgradesInStore, false) buySmallObject() resetGame() } setInterval(executeLoop, 1000) setInterval(clickBigCookie, 10)