-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
469 lines (389 loc) · 11.3 KB
/
Copy pathscript.js
File metadata and controls
469 lines (389 loc) · 11.3 KB
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
let nerd = localStorage.getItem("nerd") ? parseFloat(localStorage.getItem("nerd")) : 0;
let upgradeCount = localStorage.getItem("upgradeCount") ? parseInt(localStorage.getItem("upgradeCount")) : 0;
let npc = localStorage.getItem("npc") ? parseInt(localStorage.getItem("npc")) : 1;
const scoreElement = document.getElementById("score");
const nerdImage = document.getElementById("nerd-image");
const upgradeCountElement = document.getElementById("upgradeCount");
let upgradeInterval;
alert("WATCH THE LIVE EVENT FOR A LIMITED TIME (1/9/25)")
updateScore();
updateUpgradeCount();
nerdImage.addEventListener("click", increaseScore);
if (upgradeCount > 0) {
startUpgradeInterval();
}
function updateScore() {
scoreElement.textContent = `nerd: ${nerd.toFixed(0)}`;
}
function increaseScore() {
nerd += npc;
updateScore();
updateUpgradeCount();
localStorage.setItem("nerd", nerd);
}
function startUpgradeInterval() {
if (upgradeInterval) {
clearInterval(upgradeInterval);
}
upgradeInterval = setInterval(() => {
nerd += upgradeCount * 0.5;
updateScore();
localStorage.setItem("nerd", nerd);
}, 1000);
}
function updateUpgradeCount() {
upgradeCountElement.textContent = `per second: ${upgradeCount / 2}`;
}
function triggerConfetti() {
const defaults = {
spread: 360,
ticks: 100,
gravity: 0,
decay: 0.94,
startVelocity: 30,
};
function shoot() {
confetti({
...defaults,
particleCount: 30,
scalar: 1.2,
shapes: ["emoji"],
colors: ["#a864fd", "#29cdff", "#78ff44", "#ff718d", "#fdff6a"],
});
confetti({
...defaults,
particleCount: 20,
scalar: 2,
shapes: ["emoji"],
shapeOptions: {
emoji: {
value: "🎄",
},
},
});
}
setTimeout(shoot, 0);
setTimeout(shoot, 10);
setTimeout(shoot, 20);
}
function buyItem(price, upgradeAmount) {
if (nerd >= price) {
nerd -= price;
updateScore();
localStorage.setItem("nerd", nerd);
upgradeCount += upgradeAmount;
localStorage.setItem("upgradeCount", upgradeCount);
startUpgradeInterval();
updateUpgradeCount();
triggerConfetti();
} else {
alert("You don't have enough nerd to buy this item");
}
}
function buyLateGame(price, upgradeAmount) {
if (nerd >= price) {
nerd -= price;
updateScore();
localStorage.setItem("nerd", nerd);
upgradeCount *= upgradeAmount;
localStorage.setItem("upgradeCount", upgradeCount);
startUpgradeInterval();
updateUpgradeCount();
triggerConfetti();
} else {
alert("You don't have enough nerd to buy this item");
}
}
function buyLateGame(price, upgradeAmount) {
if (nerd >= price) {
nerd -= price;
updateScore();
localStorage.setItem("nerd", nerd);
upgradeCount *= upgradeAmount;
localStorage.setItem("upgradeCount", upgradeCount);
startUpgradeInterval();
updateUpgradeCount();
triggerConfetti();
} else {
alert("You don't have enough nerd to buy this item");
}
}
// Specific purchase functions
function buyHandfullNerd() {
buyItem(55, 2);
}
function buyBoxNerd() {
buyItem(300, 20);
}
function buyBucketNerd() {
buyItem(750, 40);
}
function buyCrateNerd() {
buyItem(20000, 80);
}
function buyVanNerd() {
buyItem(100000, 50000);
}
function buyYachtNerd() {
buyItem(1000000, 20000);
}
function buyMansionNerd() {
buyItem(10000000, 200000);
}
function buyIslandNerd() {
buyItem(100000000, 2000000);
}
function buyCountryNerd() {
buyItem(1000000000, 200000000);
}
function buyContinentNerd() {
buyItem(10000000000, 2000000000);
}
function buyPlanetNerd() {
buyItem(100000000000, 20000000000);
}
function buySolarNerd() {
buyItem(1000000000000, 200000000000);
}
function buyGalaxyNerd() {
buyItem(10000000000000, 2000000000000);
}
function buyGalaxyClusterNerd() {
buyItem(100000000000000, 20000000000000);
}
function buyUniverseNerd() {
buyItem(1000000000000000, 200000000000000);
}
function buyMultiverseNerd() {
buyLateGame(10000000000000000n, 1.1);
}
function buyOmniverseNerd() {
buyLateGame(100000000000000000n, 1.2);
}
function buyBeyondNerd() {
buyLateGame(1000000000000000000n, 3 );
}
// seasonal
function buyHolidayNerd() {
buyItem(200000,80000);
}
function buyPresentNerd() {
buyItem(1000000,400000);
}
//clicking upgrades
function buyExtraFinger(price) {
if (nerd >= price) {
nerd -= price;
npc += 1;
updateScore();
localStorage.setItem("nerd", nerd);
localStorage.setItem("npc", npc);
triggerConfetti();
} else {
alert("you don't have enough nerd to buy this item");
}
}
function buyExtraHand(price) {
if (nerd >= price) {
nerd -= price;
npc += 5;
updateScore();
localStorage.setItem("nerd", nerd);
localStorage.setItem("npc", npc);
triggerConfetti();
} else {
alert("you don't have enough nerd to buy this item");
}
}
function buyExtraPerson(price) {
if (nerd >= price) {
nerd -= price;
npc += 10;
updateScore();
localStorage.setItem("nerd", nerd);
localStorage.setItem("npc", npc);
triggerConfetti();
} else {
alert("you don't have enough nerd to buy this item");
}
}
//idk what this is lol
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request)
.then((response) => {
// The responce is in the cache
if (response) {
return response;
}
// No cache match, we attempt to fetch it from the network
return fetch(event.request);
}
)
);
});
//ples sayings
document.addEventListener('DOMContentLoaded', function() {
const sayings = [
"Slides",
"wolf den pizza!",
"read the room",
"coming to a store near you",
"barca better 🥱",
"closet productions",
"ISpyWithMyLittleRye",
"yakoob",
"playing games?",
"better than cookie clicker",
"console port when??",
"free trial ends in 1:34",
"We Live, We Love, We Lie",
"ples nerd!!!",
"gigachad",
"ples nerd mindset",
"lore?",
"give nerd!!!!!",
"Roblox ples nerd?",
"open up google classroom",
"add to home screen",
"why are you running",
"travis kelsey is a traitor",
"oh no you don’t",
"proszę cukierki",
"pneumonoultramicroscopicsilicovolcanoconiosis",
"OG fortnite???",
"If you see this take a screenshot",
"stop playing games!!!",
"ples give infinite nerds!!",
"you broke his phone",
"yes",
"no",
"maybe so",
"DJ Khaled",
"we the best music",
"Avada Kedavra!",
"flamingo",
"I'm loving it!",
"who are you???",
"ggs aiden",
"flavor update june 2070",
"erm actually... 🤓",
"What are those??",
"top fiteen myseries solved by 4 chan",
"we miss you Ibrahim🫡",
"those who know",
"chapter two???",
"gimme the loot",
"when you lose all your nerds but your lowkey just a chill guy",
"🤫🧏♂️",
"game of the year when?",
"i have nothing",
"get out",
"the dreaded return of coming soon...",
"BOY IS A NERD*",
"As seen on TV!"
];
const splashText = document.getElementById('splash-text');
splashText.textContent = sayings[Math.floor(Math.random() * sayings.length)];
});
function nerdChanged() {
switch (nerd) {
case nerd >= 1 && score <= 500: // greater than or equal to 1, or less than or equal to 500
document.querySelector("div#rankIndicator").innerHTML=`dirt`
break // so it doesn't get stuck (for good measure idk)
case nerd >= 501 && score <= 10000:
document.querySelector("div#rankIndicator").innerHTML=`metal`
break
// ...
case nerd >= 10000001:
document.querySelector("div#rankIndicator").innerHTML=`godlike`
default: // for any other case, like if score is 0 (may be unnecessary bc if the score is 0, then it wouldn't have been changed yet) or somehow negative
document.querySelector("div#rankIndicator").innerHTML=`none`
break
}
}
// Initially disable the gamble button
const gambleButton = document.getElementById('gambleButton');
gambleButton.disabled = true;
const betPercentageInput = document.getElementById('betPercentage');
// Function to validate bet percentage and toggle button state
function validateBetPercentage() {
const betPercentage = betPercentageInput.value; // Get the raw input as a string
const betPercentageNum = parseFloat(betPercentage);
// Check if the input is a valid number, an integer, and within the allowed range
if (!isNaN(betPercentageNum) && Number.isInteger(betPercentageNum) && betPercentageNum >= 0 && betPercentageNum <= 100) {
gambleButton.disabled = false; // Enable button if valid
} else {
gambleButton.disabled = true; // Disable button if invalid
}
}
// Add event listener to input field
betPercentageInput.addEventListener('input', validateBetPercentage);
// Gamble function
function gamble(betPercentage) {
// Validate bet percentage
if (betPercentage < 0 || betPercentage > 100) {
alert("invalid bet percentage.");
return; // Exit the function if invalid
}
// Calculate and round up the bet amount
const betAmount = Math.ceil(nerd * (betPercentage / 100));
// Check if the bet amount is greater than zero
if (betAmount <= 0) {
alert("bet amount must be greater than zero");
return; // Exit the function if invalid
}
// Generate a random number between 0 and 1
const outcome = Math.random();
// Determine win or lose (1/3 chance to win)
if (outcome < (1 / 3)) { // 1/3 chance
nerd += betAmount; // Win: double the bet
alert(`you won.your new score is ${nerd}.`);
} else { // 2/3 chance
nerd -= betAmount; // Lose: lose the bet amount
alert(`you lost. your new score is ${nerd}.`);
}
// Update the fucking score 🧏♂️
document.getElementById('score').textContent = nerd;
}
// Event listenerr
gambleButton.addEventListener('click', function() {
const betPercentage = parseFloat(betPercentageInput.value);
gamble(betPercentage); // Call gamble function with bet percentage
});
const cards = [
{ name: "nerd", rarity: "Common", payout: 50, chance: 0.4 },
{ name: "nerd nerd", rarity: "Uncommon", payout: 2000, chance: 0.3 },
{ name: "crazy nerd🤪",rarity: "Rare", payout: 500000, chance: 0.1 },
{ name: "diamond nerd💎", rarity: "Epic", payout: 200000, chance: 0.02 },
{ name: "chill nerd🥼👖", rarity: "Legendary", payout: 5000000000, chance: 0.01 },
{ name: "cold nerd🥶❄️💙", rarity: "Mythic", payout: 100000000000000, chance: 0.004 }
];
function openPack() {
const randomCard = getRandomCard();
alert(`you got a ${randomCard.rarity} ${randomCard.name}`);
nerd += randomCard.payout;
updateScore();
localStorage.setItem("nerd", nerd);
}
function getRandomCard() {
let randomValue = Math.random();
let cumulativeChance = 0;
for (let i = 0; i < cards.length; i++) {
cumulativeChance += cards[i].chance;
if (randomValue <= cumulativeChance) {
return cards[i];
}
}
return cards[cards.length - 1]; // Return the last card if no match found
}
function buyBasicPack() {
if (nerd >= 100000) { // check if enough nerd
nerd -= 100000; // remove🤪 the price
updateScore();
localStorage.setItem("nerd", nerd);
openPack(); // opening the packing
} else {
alert("you don't have enough nerd to buy this item");
}
}