From bd685287da42454a188277a5223492cd69709e39 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 14 Apr 2018 18:09:58 +0200 Subject: [PATCH] Use ingame notifications instead of toastr Signed-off-by: Knut Ahlers --- autocookieclicker.user.js | 56 +++++++++++++-------------------------- 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/autocookieclicker.user.js b/autocookieclicker.user.js index 9186bd5..3994c74 100644 --- a/autocookieclicker.user.js +++ b/autocookieclicker.user.js @@ -1,20 +1,17 @@ // ==UserScript== // @name Automate CookieClicker // @namespace https://luzifer.io/ -// @version 0.8.2 +// @version 0.9.0 // @description Automate everything! // @author Knut Ahlers // @source https://github.com/Luzifer/automate-cookie-clicker // @match http://orteil.dashnet.org/cookieclicker/ // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js -// @require https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js // @updateURL https://raw.githubusercontent.com/Luzifer/automate-cookie-clicker/master/autocookieclicker.user.js // @grant GM_info // @grant GM_addStyle // ==/UserScript== -GM_addStyle('@import url("https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css");'); - var blockingUpgrades = [ 69, // Destructive upgrade: "One mind" 85, // Revoke elders covenant @@ -35,7 +32,7 @@ function executeAutoActions() { if (availableUpgrades.length > 0) { debug(availableUpgrades.length + " upgrades available, buying now..."); availableUpgrades.click(); - toastr.info('Purchased ' + availableUpgrades.length + ' upgrades for you.'); + note('Purchased ' + availableUpgrades.length + ' upgrades for you.'); } // Get the top enabled purchase to be made @@ -48,7 +45,7 @@ function executeAutoActions() { if (topPurchaseCount < getMaxBuy()) { debug("Auto-Buying: " + topPurchase.find('.title:first').text()); topPurchase.click(); - toastr.info('Purchased ' + topPurchase.find('.title:first').text() + ' for you.'); + note('Purchased ' + topPurchase.find('.title:first').text() + ' for you.'); } } } @@ -81,37 +78,9 @@ function getMaxBuy() { return Math.max(Math.ceil((topPurchaseCount + 1) / purchaseSteps), 1) * purchaseSteps; } -(function() { - 'use strict'; - - // Set options for toastr - toastr.options = { - "closeButton": false, - "debug": false, - "newestOnTop": false, - "progressBar": false, - "positionClass": "toast-bottom-right", - "preventDuplicates": false, - "onclick": null, - "showDuration": "300", - "hideDuration": "1000", - "timeOut": "2000", - "extendedTimeOut": "1000", - "showEasing": "swing", - "hideEasing": "linear", - "showMethod": "fadeIn", - "hideMethod": "fadeOut" - }; - - window.checkCPS = window.setInterval(checkCPS, 1000); - - // Enable automatic purchasing of upgrades / elements - window.autoPurchase = window.setInterval(executeAutoActions, 500); - - // Startup notification - let version = GM_info.script.version; - toastr.info('Auto-CookieClicker ' + version + ' loaded.'); -})(); +func note(msg, quick = true) { + Game.Note("Auto-CookieClicker", msg, undefined, quick); +} function upgradeFilter(idx) { var onClickHandler = $(this).attr('onclick'); @@ -121,3 +90,16 @@ function upgradeFilter(idx) { var upgradeID = parseInt(onClickHandler.replace(/^.*\[([0-9]+)\].*$/, "$1")); return !blockingUpgrades.includes(upgradeID); } + +(function() { + 'use strict'; + + window.checkCPS = window.setInterval(checkCPS, 1000); + + // Enable automatic purchasing of upgrades / elements + window.autoPurchase = window.setInterval(executeAutoActions, 500); + + // Startup notification + let version = GM_info.script.version; + note('Version ' + version + ' loaded.'); +})();