From 2bac899cbd5062e00981c21f59918ca3f5dff4e6 Mon Sep 17 00:00:00 2001 From: suddjian Date: Fri, 20 Oct 2023 17:43:30 -0700 Subject: [PATCH] message improvement --- src/cookieclickermanager.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/cookieclickermanager.js b/src/cookieclickermanager.js index b0a2031..2e884e5 100644 --- a/src/cookieclickermanager.js +++ b/src/cookieclickermanager.js @@ -131,15 +131,11 @@ function adjustStockPortfolio() { var analysis = analyzeStockMarket(); var { toBuy, toSell } = analysis; toBuy.forEach(good => { - var $ = Beautify(good.val * good.stock); - var cookies = Beautify(Game.cookiesPsRawHighest * good.val * good.stock); - console.log(`%cCookie manager: buying ${good.symbol} at ${good.val} for $${$} (${cookies} 🍪)`, "color:sienna"); + console.log(`%cCookie manager: buying ${getStockTradeStr(good)}`, "color:sienna"); clickOn(document.getElementById(good.l.id + "_Max")); }); toSell.forEach(good => { - var $ = Beautify(good.val * good.stock); - var cookies = Beautify(Game.cookiesPsRawHighest * good.val * good.stock); - console.log(`%cCookie manager: selling ${good.symbol} at ${Beautify(good.val, 2)} for $${$} (${cookies} 🍪)`, "color:green"); + console.log(`%cCookie manager: selling ${getStockTradeStr(good)}`, "color:green"); clickOn(document.getElementById(good.l.id + "_-All")); }); } @@ -181,6 +177,12 @@ function analyzeStockMarket(buyPercentile=0.1, sellPercentile=0.3) { }; } +function getStockTradeStr(good) { + var $ = Beautify(good.val * good.stock); + var cookies = Beautify(Game.cookiesPsRawHighest * good.val * good.stock); + return `${Beautify(good.stock)} ${good.symbol} at $${Beautify(good.val, 2)} for $${$} (${cookies} 🍪)`; +} + /*:・゚✧*:・゚✧ ----- GRIMOIRE ----- *:・゚✧*:・゚✧ *:・゚✧*:・゚✧ *:・゚✧*:・゚✧ *:・゚✧*:・゚✧ *:・゚✧*:・゚✧ */ function handOfFateToBoostBuffs() { @@ -247,6 +249,7 @@ window.cookieclickerhacks = { getClickCps, getProductCps, getUpgradeCps, + getStockTradeStr, adjustStockPortfolio, analyzeStockMarket, handOfFateToBoostBuffs,