diff --git a/api/redeem.php b/api/redeem.php
index d1688a8..c128786 100644
--- a/api/redeem.php
+++ b/api/redeem.php
@@ -49,6 +49,45 @@ try {
$stmt->execute([$cost, $username]);
echo json_encode(['success' => true, 'message' => '¡Eres DJ por un día! Tu nombre destacará en toda la sala.']);
+ } elseif ($item === 'vip_jump') {
+ $cost = 500;
+ $artist = $data['artist'] ?? '';
+ $song = $data['song'] ?? '';
+
+ if (empty($artist) || empty($song)) {
+ echo json_encode(['success' => false, 'error' => 'Falta artista o canción para el Salto VIP']);
+ exit;
+ }
+
+ if ($points < $cost) {
+ echo json_encode(['success' => false, 'error' => "Puntos insuficientes ($points/$cost)"]);
+ exit;
+ }
+
+ $pdo->beginTransaction();
+ try {
+ // Deduct points
+ $stmt = $pdo->prepare("UPDATE fans SET loyalty_points = loyalty_points - ? WHERE name = ?");
+ $stmt->execute([$cost, $username]);
+
+ // Insert priority request
+ $stmt = $pdo->prepare("INSERT INTO song_requests (artist, song, requester, source, is_priority) VALUES (?, ?, ?, 'vip_jump', 1)");
+ $stmt->execute([$artist, $song, $username]);
+
+ // Announce in chat
+ $ip = $_SERVER['HTTP_CF_CONNECTING_IP'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1';
+ $ip = explode(',', $ip)[0];
+ $announcement = "🚀 ¡ATENCIÓN! **$username** ha usado sus puntos VIP para que suene **$artist - $song** ¡AHORA MISMO! 🔥🎧";
+
+ $stmt = $pdo->prepare("INSERT INTO messages (username, ip_address, message, type) VALUES (?, ?, ?, ?)");
+ $stmt->execute(['Lili Bot 🤖', $ip, $announcement, 'text']);
+
+ $pdo->commit();
+ echo json_encode(['success' => true, 'message' => '¡Salto VIP exitoso! Tu canción sonará a continuación.']);
+ } catch (Exception $e) {
+ $pdo->rollBack();
+ throw $e;
+ }
} elseif ($item === 'change_color') {
// If they already have god mode, changing color might be cheaper or free?
// Let's say 100 points to change color if already bought, or free if we want.
diff --git a/index.php b/index.php
index ffbd096..4ab7c79 100644
--- a/index.php
+++ b/index.php
@@ -1893,6 +1893,28 @@ $twitter_link = "https://twitter.com/";
30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
40%, 60% { transform: translate3d(4px, 0, 0); }
}
+ @keyframes vip-flash {
+ 0% { background: #facc15; box-shadow: 0 0 10px #facc15; color: #000; }
+ 50% { background: #ff4444; box-shadow: 0 0 30px #ff4444; color: #fff; }
+ 100% { background: #facc15; box-shadow: 0 0 10px #facc15; color: #000; }
+ }
+ .vip-alert-banner {
+ display: none;
+ background: #facc15;
+ color: #000;
+ padding: 12px 20px;
+ border-radius: 16px;
+ font-weight: 900;
+ font-size: 0.9rem;
+ margin-bottom: 15px;
+ text-align: center;
+ animation: vip-flash 0.8s infinite ease-in-out;
+ border: 2px solid rgba(255,255,255,0.5);
+ cursor: pointer;
+ box-shadow: 0 10px 20px rgba(0,0,0,0.3);
+ text-transform: uppercase;
+ letter-spacing: 1px;
+ }
@@ -1955,7 +1977,10 @@ $twitter_link = "https://twitter.com/";
-
+
+ ¡SALTO VIP PENDIENTE! PONLO AHORA 🎧
+
+
LILI
@@ -2506,6 +2534,15 @@ $twitter_link = "https://twitter.com/";
2000
+
+
+
+
Salto VIP
+
Tu canción suena inmediatamente saltando la cola.
+
+
500
+
+
Cerrar Tienda
@@ -3618,11 +3655,23 @@ $twitter_link = "https://twitter.com/";
}
}
+ function scrollToRequests() {
+ const list = document.getElementById('song-requests-list');
+ if (list) {
+ list.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ list.style.animation = 'shake 0.5s ease-in-out';
+ setTimeout(() => list.style.animation = '', 600);
+ }
+ }
+
async function fetchSongRequests() {
try {
const response = await fetch('api/song_requests.php');
const result = await response.json();
+ // Check if there are priority requests
+ const hasPriority = result.success && result.requests.some(req => req.is_priority == 1);
+
// Check if current user is Guest DJ
const currentUserName = document.getElementById('user-name').value.trim();
let isGuestDj = false;
@@ -3650,6 +3699,12 @@ $twitter_link = "https://twitter.com/";
const pollControl = document.getElementById('dj-flash-poll-control');
if (pollControl) pollControl.style.display = isGuestDj ? 'block' : 'none';
+ // Show/hide VIP Alert
+ const vipAlert = document.getElementById('dj-vip-alert');
+ if (vipAlert) {
+ vipAlert.style.display = (isGuestDj && hasPriority) ? 'block' : 'none';
+ }
+
if (result.success) {
const list = document.getElementById('song-requests-list');
if (result.requests.length === 0) {
@@ -4771,6 +4826,117 @@ $twitter_link = "https://twitter.com/";
}
}
+ function promptBuyVipJump() {
+ const artist = prompt('Ingresa el ARTISTA para tu Salto VIP:');
+ if (!artist) return;
+ const song = prompt(`Ingresa la CANCIÓN de ${artist} para tu Salto VIP:`);
+ if (!song) return;
+
+ if (confirm(`¿Confirmas gastar 500 LP para que "${artist} - ${song}" suene inmediatamente?`)) {
+ redeemItem('vip_jump', null, artist, song);
+ }
+ }
+
+ async function submitVipJump() {
+ const artistInput = document.getElementById('req-artist-new');
+ const songInput = document.getElementById('req-song-new');
+ const artist = artistInput.value.trim();
+ const song = songInput.value.trim();
+ const requester = document.getElementById('user-name').value.trim();
+
+ if (!requester) {
+ alert('Por favor, ingresa tu nombre arriba para usar el Salto VIP.');
+ document.getElementById('user-name').focus();
+ return;
+ }
+
+ if (!artist || !song) {
+ alert('Por favor, ingresa el artista y la canción que quieres priorizar.');
+ return;
+ }
+
+ if (confirm(`¿Quieres usar 500 LP para que "${artist} - ${song}" suene ahora mismo?`)) {
+ const btn = document.getElementById('vip-jump-btn');
+ btn.disabled = true;
+ btn.innerHTML = '...';
+
+ try {
+ const response = await fetch('api/redeem.php', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ username: requester,
+ item: 'vip_jump',
+ artist: artist,
+ song: song
+ })
+ });
+ const result = await response.json();
+
+ if (result.success) {
+ confetti({
+ particleCount: 300,
+ spread: 120,
+ origin: { y: 0.6 },
+ colors: ['#00e676', '#facc15', '#ffffff']
+ });
+ alert(result.message);
+ artistInput.value = '';
+ songInput.value = '';
+ fetchSongRequests();
+ fetchLeaderboard();
+ } else {
+ alert('Error: ' + result.error);
+ }
+ } catch (error) {
+ console.error('VIP Jump error:', error);
+ alert('Error de conexión.');
+ } finally {
+ btn.disabled = false;
+ btn.innerHTML = ' VIP JUMP';
+ }
+ }
+ }
+
+ async function redeemItem(item, color = null, artist = null, song = null) {
+ const userName = document.getElementById('user-name').value.trim();
+ if (!userName) return;
+
+ try {
+ const response = await fetch('api/redeem.php', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ username: userName,
+ item: item,
+ color: color,
+ artist: artist,
+ song: song
+ })
+ });
+ const result = await response.json();
+
+ if (result.success) {
+ confetti({
+ particleCount: 200,
+ spread: 100,
+ origin: { y: 0.6 },
+ colors: ['#facc15', '#f472b6', '#38bdf8', '#ffffff']
+ });
+ alert(result.message);
+ closeShopModal();
+ fetchLeaderboard();
+ if (typeof fetchMessages === 'function') fetchMessages();
+ if (item === 'vip_jump') fetchSongRequests();
+ } else {
+ alert('Error: ' + result.error);
+ }
+ } catch (error) {
+ console.error('Redeem error:', error);
+ alert('Error de conexión al realizar el canje.');
+ }
+ }
+
setInterval(fetchActivePerks, 10000);
fetchActivePerks();
// --- End Radio Shop Functionality ---