-
-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathgames.html
More file actions
619 lines (536 loc) · 23 KB
/
games.html
File metadata and controls
619 lines (536 loc) · 23 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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spam Power - Social Stream Ninja</title>
<link rel="icon" href="./favicon.ico" />
<style>
body {
margin: 0;
padding: 0;
background: #0a0a0a;
overflow: hidden;
font-family: 'Arial', sans-serif;
color: white;
}
body.chroma {
background: #00ff00;
}
body.darkmode {
background: #000000;
}
#game-container {
position: relative;
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#power-core {
position: relative;
width: 300px;
height: 300px;
border-radius: 50%;
background: radial-gradient(circle at center,
rgba(255, 255, 255, 0.2) 0%,
rgba(0, 150, 255, 0.3) 30%,
rgba(0, 50, 150, 0.5) 60%,
rgba(0, 0, 50, 0.8) 100%);
box-shadow: 0 0 50px rgba(0, 150, 255, 0.5);
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
#power-level {
font-size: 72px;
font-weight: bold;
text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
z-index: 10;
}
#progress-ring {
position: absolute;
width: 320px;
height: 320px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#progress-ring svg {
transform: rotate(-90deg);
overflow:visible;
}
#progress-ring circle {
fill: none;
stroke-width: 20;
stroke-linecap: round;
}
#progress-bg {
stroke: rgba(255, 255, 255, 0.1);
}
#progress-fill {
stroke: #00ff88;
stroke-dasharray: 1005;
stroke-dashoffset: 1005;
transition: stroke-dashoffset 0.5s ease;
}
.power-particle {
position: absolute;
width: 4px;
height: 4px;
background: #00ff88;
border-radius: 50%;
pointer-events: none;
animation: float-up 2s ease-out forwards;
}
@keyframes float-up {
0% {
opacity: 1;
transform: translate(0, 0) scale(1);
}
100% {
opacity: 0;
transform: translate(var(--dx), -200px) scale(0);
}
}
#stats {
position: absolute;
top: 20px;
left: 20px;
background: rgba(0, 0, 0, 0.8);
padding: 15px 20px;
border-radius: 10px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.stat-line {
margin: 5px 0;
font-size: 16px;
}
#goal-display {
position: absolute;
top: 20px;
right: 20px;
background: rgba(0, 0, 0, 0.8);
padding: 15px 20px;
border-radius: 10px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
text-align: center;
}
#goal-text {
font-size: 24px;
font-weight: bold;
color: #00ff88;
margin-bottom: 5px;
}
#multiplier {
position: absolute;
bottom: 100px;
left: 50%;
transform: translateX(-50%);
font-size: 36px;
font-weight: bold;
color: #ffaa00;
text-shadow: 0 0 20px rgba(255, 170, 0, 0.8);
opacity: 0;
transition: opacity 0.3s ease;
}
#win-animation {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 120px;
font-weight: bold;
color: #00ff88;
text-shadow: 0 0 40px rgba(0, 255, 136, 0.8);
opacity: 0;
pointer-events: none;
animation: win-burst 2s ease-out;
}
@keyframes win-burst {
0% {
opacity: 0;
transform: translate(-50%, -50%) scale(0.5);
}
50% {
opacity: 1;
transform: translate(-50%, -50%) scale(1.2);
}
100% {
opacity: 0;
transform: translate(-50%, -50%) scale(1.5);
}
}
.message-burst {
position: absolute;
padding: 8px 15px;
background: rgba(0, 255, 136, 0.2);
border: 1px solid rgba(0, 255, 136, 0.5);
border-radius: 20px;
font-size: 14px;
pointer-events: none;
animation: burst-fade 1s ease-out forwards;
}
@keyframes burst-fade {
0% {
opacity: 1;
transform: translate(0, 0) scale(1);
}
100% {
opacity: 0;
transform: translate(var(--burst-x), var(--burst-y)) scale(0.5);
}
}
#instructions {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 15px 30px;
border-radius: 10px;
text-align: center;
font-size: 16px;
}
#instructions strong {
color: #00ff88;
font-size: 18px;
}
</style>
</head>
<body>
<div id="game-container">
<div id="stats">
<div class="stat-line">Messages/sec: <span id="msg-rate">0</span></div>
<div class="stat-line">Peak Rate: <span id="peak-rate">0</span></div>
<div class="stat-line">Total Power: <span id="total-power">0</span></div>
<div class="stat-line">Win Streak: <span id="win-streak">0</span></div>
</div>
<div id="goal-display">
<div id="goal-text">GOAL: <span id="goal-value">100</span></div>
<div>Time: <span id="timer">60</span>s</div>
</div>
<div id="power-core">
<div id="power-level">0</div>
</div>
<div id="progress-ring">
<svg width="320" height="320">
<circle id="progress-bg" cx="160" cy="160" r="160"></circle>
<circle id="progress-fill" cx="160" cy="160" r="160"></circle>
</svg>
</div>
<div id="multiplier">x1</div>
<div id="win-animation">WIN!</div>
<div id="instructions">
<div><strong>⚡ Spam Power - How to Play:</strong></div>
<div>Chat spams to build power! The more everyone chats, the higher the power grows!</div>
<div style="margin-top: 5px; font-size: 14px; opacity: 0.8;">Goal increases based on your community's peak activity</div>
</div>
</div>
<script>
// URL parameters
const urlParams = new URLSearchParams(window.location.search);
const sessionId = urlParams.get('session') || urlParams.get('room') || 'test';
const password = urlParams.get('password') || 'false';
const lanonly = urlParams.has('lanonly') ? '&lanonly' : '';
// Apply theme settings from URL parameters
if (urlParams.has('chroma')) {
document.body.classList.add('chroma');
} else if (urlParams.has('darkmode')) {
document.body.classList.add('darkmode');
}
// Game state
let gameState = {
power: 0,
goal: 100,
timeLeft: 60,
messagesPerSecond: 0,
peakRate: 0,
totalPower: 0,
winStreak: 0,
multiplier: 1,
isActive: false,
messageTimestamps: [],
lastWinTime: 0
};
// Load historical data
const historicalData = {
peakActivity: parseInt(localStorage.getItem('spamPowerPeakActivity') || '10'),
totalWins: parseInt(localStorage.getItem('spamPowerTotalWins') || '0'),
bestStreak: parseInt(localStorage.getItem('spamPowerBestStreak') || '0'),
averageWinRate: parseFloat(localStorage.getItem('spamPowerAvgWinRate') || '10'),
recentGoals: JSON.parse(localStorage.getItem('spamPowerRecentGoals') || '[]')
};
// Calculate dynamic goal based on history
function calculateDynamicGoal() {
let baseGoal = 100;
// Increase based on peak activity
if (historicalData.peakActivity > 20) {
baseGoal = Math.floor(historicalData.peakActivity * 5);
}
// Adjust based on recent performance
if (historicalData.recentGoals.length > 0) {
const avgGoal = historicalData.recentGoals.reduce((a, b) => a + b, 0) / historicalData.recentGoals.length;
baseGoal = Math.floor(avgGoal * 1.1); // 10% harder each time
}
// Add streak bonus difficulty
baseGoal += gameState.winStreak * 20;
// Ensure reasonable bounds
return Math.max(50, Math.min(baseGoal, 1000));
}
// Initialize game
function initGame() {
gameState.goal = calculateDynamicGoal();
gameState.power = 0;
gameState.timeLeft = 60;
gameState.isActive = true;
gameState.multiplier = 1;
updateDisplay();
startTimer();
}
// Update display
function updateDisplay() {
document.getElementById('power-level').textContent = Math.floor(gameState.power);
document.getElementById('goal-value').textContent = gameState.goal;
document.getElementById('timer').textContent = gameState.timeLeft;
document.getElementById('msg-rate').textContent = gameState.messagesPerSecond.toFixed(1);
document.getElementById('peak-rate').textContent = gameState.peakRate.toFixed(1);
document.getElementById('total-power').textContent = gameState.totalPower;
document.getElementById('win-streak').textContent = gameState.winStreak;
// Update progress ring
const progressPercent = Math.min(gameState.power / gameState.goal, 1);
const circumference = 2 * Math.PI * 160;
const offset = circumference - (progressPercent * circumference);
document.getElementById('progress-fill').style.strokeDashoffset = offset;
// Update core intensity based on power
const intensity = Math.min(gameState.power / gameState.goal, 1);
const core = document.getElementById('power-core');
core.style.boxShadow = `0 0 ${50 + intensity * 100}px rgba(0, ${150 + intensity * 105}, 255, ${0.5 + intensity * 0.5})`;
core.style.transform = `scale(${1 + intensity * 0.2})`;
// Color change as approaching goal
if (progressPercent > 0.8) {
document.getElementById('progress-fill').style.stroke = '#ffaa00';
} else if (progressPercent > 0.5) {
document.getElementById('progress-fill').style.stroke = '#00ffff';
} else {
document.getElementById('progress-fill').style.stroke = '#00ff88';
}
}
// Timer
function startTimer() {
const timerInterval = setInterval(() => {
if (!gameState.isActive) {
clearInterval(timerInterval);
return;
}
gameState.timeLeft--;
document.getElementById('timer').textContent = gameState.timeLeft;
if (gameState.timeLeft <= 0) {
clearInterval(timerInterval);
endGame(false);
}
// Check win condition
if (gameState.power >= gameState.goal) {
clearInterval(timerInterval);
endGame(true);
}
}, 1000);
}
// Calculate messages per second
function updateMessageRate() {
const now = Date.now();
gameState.messageTimestamps = gameState.messageTimestamps.filter(t => now - t < 1000);
gameState.messagesPerSecond = gameState.messageTimestamps.length;
if (gameState.messagesPerSecond > gameState.peakRate) {
gameState.peakRate = gameState.messagesPerSecond;
if (gameState.peakRate > historicalData.peakActivity) {
historicalData.peakActivity = gameState.peakRate;
localStorage.setItem('spamPowerPeakActivity', gameState.peakRate.toString());
}
}
// Update multiplier based on message rate
if (gameState.messagesPerSecond >= 10) {
gameState.multiplier = 3;
document.getElementById('multiplier').textContent = 'x3';
document.getElementById('multiplier').style.opacity = '1';
} else if (gameState.messagesPerSecond >= 5) {
gameState.multiplier = 2;
document.getElementById('multiplier').textContent = 'x2';
document.getElementById('multiplier').style.opacity = '1';
} else {
gameState.multiplier = 1;
document.getElementById('multiplier').style.opacity = '0';
}
}
// Handle incoming messages (compatible with Social Stream format)
function processData(data) {
if (!gameState.isActive) return;
// Handle different data formats from Social Stream
if (data && data.content) {
data = data.content;
}
if (!data || !data.chatmessage || !data.chatname) return;
// Track message timestamp
gameState.messageTimestamps.push(Date.now());
updateMessageRate();
// Add power with multiplier
const powerGain = 1 * gameState.multiplier;
gameState.power += powerGain;
gameState.totalPower += powerGain;
// Create particle effect
createPowerParticle();
// Create message burst
createMessageBurst(data.chatname || 'Anonymous');
updateDisplay();
}
// Particle effects
function createPowerParticle() {
const particle = document.createElement('div');
particle.className = 'power-particle';
const angle = Math.random() * Math.PI * 2;
const distance = 150 + Math.random() * 50;
const x = Math.cos(angle) * distance;
const y = Math.sin(angle) * distance;
particle.style.setProperty('--dx', x + 'px');
particle.style.left = '50%';
particle.style.top = '50%';
particle.style.transform = 'translate(-50%, -50%)';
document.getElementById('power-core').appendChild(particle);
setTimeout(() => particle.remove(), 2000);
}
// Message burst effect
function createMessageBurst(username) {
const burst = document.createElement('div');
burst.className = 'message-burst';
burst.textContent = username;
const angle = Math.random() * Math.PI * 2;
const distance = 200 + Math.random() * 100;
const x = Math.cos(angle) * distance;
const y = Math.sin(angle) * distance;
burst.style.setProperty('--burst-x', x + 'px');
burst.style.setProperty('--burst-y', y + 'px');
burst.style.left = '50%';
burst.style.top = '50%';
burst.style.transform = 'translate(-50%, -50%)';
document.getElementById('game-container').appendChild(burst);
setTimeout(() => burst.remove(), 1000);
}
// End game
function endGame(won) {
gameState.isActive = false;
if (won) {
// Show win animation
const winAnim = document.getElementById('win-animation');
winAnim.style.animation = 'none';
setTimeout(() => {
winAnim.style.animation = 'win-burst 2s ease-out';
}, 10);
// Update streak
const now = Date.now();
if (now - gameState.lastWinTime < 300000) { // 5 minutes
gameState.winStreak++;
} else {
gameState.winStreak = 1;
}
gameState.lastWinTime = now;
// Update historical data
historicalData.totalWins++;
historicalData.averageWinRate = (historicalData.averageWinRate + gameState.messagesPerSecond) / 2;
historicalData.recentGoals.push(gameState.goal);
if (historicalData.recentGoals.length > 5) {
historicalData.recentGoals.shift();
}
if (gameState.winStreak > historicalData.bestStreak) {
historicalData.bestStreak = gameState.winStreak;
}
// Save to localStorage
localStorage.setItem('spamPowerTotalWins', historicalData.totalWins.toString());
localStorage.setItem('spamPowerAvgWinRate', historicalData.averageWinRate.toString());
localStorage.setItem('spamPowerRecentGoals', JSON.stringify(historicalData.recentGoals));
localStorage.setItem('spamPowerBestStreak', historicalData.bestStreak.toString());
} else {
gameState.winStreak = 0;
}
// Restart after delay
setTimeout(() => {
initGame();
}, 3000);
}
// Setup iframe communication (same as petrace.html)
const iframe = document.createElement("iframe");
iframe.src = `https://vdo.socialstream.ninja/?ln&salt=vdo.ninja¬mobile&password=${encodeURIComponent(password)}${lanonly}&solo&view=${sessionId}&novideo&noaudio&label=dock&cleanoutput&room=${sessionId}`;
iframe.style.width = "0px";
iframe.style.height = "0px";
iframe.style.position = "fixed";
iframe.style.left = "-100px";
iframe.style.top = "-100px";
iframe.id = "frame1";
document.body.appendChild(iframe);
// Listen for messages
window.addEventListener("message", function(e) {
if (e.source !== iframe.contentWindow) return;
if ("dataReceived" in e.data) {
if ("overlayNinja" in e.data.dataReceived) {
processData(e.data.dataReceived.overlayNinja);
}
}
});
// Handle WebSocket connection if server parameters are provided
if (urlParams.has('server')) {
const socketserver = new WebSocket(urlParams.get('server'));
socketserver.onopen = function() {
socketserver.send(JSON.stringify({ join: sessionId.split(",")[0], out: 2, in: 1 }));
};
socketserver.onmessage = function(event) {
if (!event.data) return;
try { processData(JSON.parse(event.data)); } catch (e) {}
};
}
// Optional: Extension relay via server2/server3
(function setupExtensionSocket(){
if (!(urlParams.has('server2') || urlParams.has('server3'))) return;
const serverURL = urlParams.has('server2') ? (urlParams.get('server2') || 'wss://io.socialstream.ninja/extension') : (urlParams.get('server3') || 'wss://io.socialstream.ninja/extension');
let socket = null; let attempts = 1;
function connect(){
if (socket){ socket.onclose=null; try{socket.close();}catch(e){} }
socket = new WebSocket(serverURL);
socket.onopen = function(){ attempts = 1; socket.send(JSON.stringify({ join: sessionId.split(',')[0], out:3, in:4 })); };
socket.onclose = function(){ setTimeout(connect, 100*attempts++); };
socket.onerror = function(){ try{socket.close();}catch(e){} };
socket.addEventListener('message', function(event){
if (!event.data) return;
try{ const data = JSON.parse(event.data); processData(data); if (data.get){ socket.send(JSON.stringify({callback:{get:data.get,result:true}})); } }catch(e){}
});
}
connect();
})();
// Demo mode
if (urlParams.has('demo')) {
setInterval(() => {
if (gameState.isActive && Math.random() < 0.3) {
processData({
chatname: ['DemoUser', 'TestBot', 'Spammer', 'ChatHero', 'PowerPlayer'][Math.floor(Math.random() * 5)],
chatmessage: ['GO!', 'POWER!', '⚡', 'SPAM!', 'ENERGY!'][Math.floor(Math.random() * 5)]
});
}
}, 200);
}
// Start game
initGame();
// Update rate display
setInterval(updateMessageRate, 100);
</script>
</body>
</html>