-
Notifications
You must be signed in to change notification settings - Fork 0
/
CookieMarketAutoSeller.js
206 lines (169 loc) · 5.45 KB
/
CookieMarketAutoSeller.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
// ==UserScript==
// @name Cookie Auto Stonks Auto Seller
// namespace http://thebladeroden.com/
// @version 1.0
// @description Cookie Auto Stonks Auto Seller
// @author TheBladeRoden
// @match https://orteil.dashnet.org/cookieclicker/
// @homepageURL https://github.com/thebladeroden/Cookie-Stonks
// @supportURL https://github.com/thebladeroden/Cookie-Stonks/issues
// @updateURL https://raw.githubusercontent.com/suicidejerk/Cookie-Stonks/master/cookieStonks.user.js
// @icon https://raw.githubusercontent.com/suicidejerk/Cookie-Stonks/main/cookieDollar.png
// @license MIT
// @grant none
// @include https://orteil.dashnet.org/cookieclicker/*
// ==/UserScript==
console.log("Is it even starting to load?");
Game.registerMod
//Game.LoadMod('https://klattmose.github.io/CookieClicker/' + (0 ? 'Beta/' : '') + 'CCSE.js');*/
/*const readyCheck = setInterval(() => {
const Game = unsafeWindow.Game;
if (typeof Game !== 'undefined' && typeof Game.ready !== 'undefined' && Game.ready) {
//Game.LoadMod('https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonster.js');
//var stockMarket = Game.Objects['Bank'].minigame;
clearInterval(readyCheck);
}
}, 1000);*/
/*let stockMarket = Game.Objects['Bank'].minigame;
function setstockMarket() {
stockMarket = Game.Objects['Bank'].minigame;
}
function getBankLevel() {
return Game.Objects['Bank'].level;
}
function getGoodsCount() {
if (Game.Objects['Bank'].minigameLoaded)
return stockMarket.goodsById.length;
else
return 0;
}*/
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
delayedLoading();
async function delayedLoading() {
await sleep(2000);
console.log("It");
await sleep(2000);
console.log("Will");
await sleep(2000);
console.log("Now");
await sleep(2000);
console.log("Load");
{
let i = 0;
while (i < 10) {
console.log("Task cycle working"+i);
task(i);
i++;
}
}
}
async function task(i) {
let stockMarket = Game.Objects['Bank'].minigame;
console.log('Is this working at all?');
for(let i = 0; i < 16/*sm.goodsById.length*/; i++) {
console.log(stockMarket.goodsById[i].icon);
}
await sleep(1000);
}
/*function task(i) {
setTimeout(function() {
let stockMarket = Game.Objects['Bank'].minigame;
console.log('Is this working at all?');
for(let i = 0; i < 16/*sm.goodsById.length*//*; i++) {
console.log(stockMarket.goodsById[i].icon);
}
}, 5000 * i);
}*/
/*function task(i) {
setTimeout(function() {
//var id = 0;
// console.log(i);
for(var id = 0; id < 16/*M.goodsById.length*///; id++){
//let id = iG;
// let mySymbol = getMySymbol(id);
//let me=M.goodsById[id];
// console.log('Is this working at all?' + id + iG);
// console.log('me: '+me.name+' id: '+id+' iG: '+iG);
// }
//console.log('Updating prices!');
// }, 5000 * i);
//}*/
/*function getMySymbol(id) {
console.log('Here its working');
let me=M.goodsById[id];
console.log('Heres where it breaks');
let mySymbol = me.symbol;
return mySymbol(id);
}*/
/*function getMyID(id) {
return id;
}
function getCurrentValue(id, value) {
}
/*const sleep = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
/*Use like so*/
/*async function timeSensitiveAction(){ //must be async func
//do something here
await sleep(5000) //wait 5 seconds
console.log('Is sleeping working?');
//continue on...
}
timeSensitiveAction();
/* will test later
function getMyID(id, bankLevel) {
return id;
}
function getCurrentValue(id, value, bankLevel) {
//console.log('The id for getCurrentValue is') + id;
let restingValue = getRestingValue(id, bankLevel);
let currentValue = (((parseFloat(value.replace('$', '')) / restingValue * 100).toFixed(2))* restingValue)/100;
//console.log('The current value is ' + value + ' and ' + currentValue);
return currentValue;
}
for(var iG = 0; iG < M.goodsById.length; iG++) {
var good = M.goodsById[iG];
var conf = IdleTrading.config.goods[iG];
var price = Math.round(100 * M.getGoodPrice(good)) / 100;
var stock = good.stock;
if (IdleTrading.config.autoSell && conf.sellThresh != -1) {
if (price >= conf.sellThresh && stock > 0) {
M.sellGood(iG, 10000);
if (good.stock != stock) {
Game.Notify('Selling ' + good.name, 'The price was ' + price + '$ per unit', goodIcons[iG], false);
}
}
}
if (IdleTrading.config.autoBuy && conf.buyThresh != -1) {
if (price <= conf.buyThresh) {
M.buyGood(iG, 10000);
if (good.stock != stock) {
Game.Notify('Buying ' + good.name, 'The price was ' + price + '$ per unit', goodIcons[iG], false);
}
}
}
if(price < conf.minPrice) conf.minPrice = price;
if(price > conf.maxPrice) conf.maxPrice = price;
}
M.tradeTooltip=function(id,n)
{
return function(){
var me=M.goodsById[id];
var icon=me.icon||[0,0];
var val=M.getGoodPrice(me)
var cost=Game.cookiesPsRawHighest*val;
var buyOrSell=n>0;
var overhead=1;
var stock=me.stock;
var maxStock=M.getGoodMaxStock(me);
if (buyOrSell) overhead*=1+0.01*(20*Math.pow(0.95,M.brokers));
cost*=overhead;
if (n==10000) n=Math.floor(Game.cookies/cost);
else if (n==-10000) n=me.stock;
n=Math.abs(n);
if (buyOrSell) n=Math.min(n,maxStock-stock);
if (!buyOrSell) n=Math.min(n,stock);
*/