/** * Seeds 44 slot games from the slot-games-casino-slot-machine-master ZIP * into the all_games table. * Run with: node server/scripts/seed-slot-games.mjs */ import mysql from 'mysql2/promise'; // Provider mapping based on game code suffix function getProvider(gameCode) { if (gameCode.endsWith('YGG')) return 'Yggdrasil'; if (gameCode.endsWith('NG')) return 'NextGen'; if (gameCode.endsWith('PGD')) return 'PlayGD'; if (gameCode.includes('FireLink') || ['NorthShore','ByTheBay','ChinaStreet','GlacierGold','OlveraStreet','RiverWalk','Route66','RueRoyale'].includes(gameCode)) return 'AGS'; return 'Unknown'; } // Category mapping function getCategory(category) { if (category === 'Fish/Arcade') return 'arcade'; if (category === 'Fire Link') return 'slots'; return 'slots'; } // Game type mapping function getGameType(category) { if (category === 'Fish/Arcade') return 'arcade'; return 'slot'; } // Games extracted from Config.ts const games = [ // SLOTS - Yggdrasil { id: 5861, name: 'Wicked Circus', game_code: 'WickedCircusYGG', category: 'Slot', tag: 'hot' }, { id: 5863, name: 'Incinerator', game_code: 'IncineratorYGG', category: 'Slot', tag: 'hot' }, { id: 5864, name: 'Wild Mantra', game_code: 'WildMantraYGG', category: 'Slot', tag: 'hot' }, { id: 5865, name: 'Beauty And The Beast', game_code: 'BeautyAndBeastYGG', category: 'Slot', tag: 'hot' }, { id: 5866, name: 'Dark Joker Rizes', game_code: 'DarkJokeRizesYGG', category: 'Slot', tag: 'hot' }, { id: 5867, name: 'Zeus VS Thor', game_code: 'ZeusVSThorYGG', category: 'Slot', tag: 'hot' }, { id: 5868, name: 'Rainbow Ryan', game_code: 'RainbowRyanYGG', category: 'Slot', tag: 'hot' }, { id: 5869, name: 'Avatars Gateway Guardians', game_code: 'AvatarsGatewayGuardiansYGG', category: 'Slot', tag: 'hot' }, { id: 5990, name: 'Vikings Go Wild', game_code: 'VikingsGoWildYGG', category: 'Slot', tag: 'hot' }, { id: 5994, name: 'Penguin City', game_code: 'PenguinCityYGG', category: 'Slot', tag: 'hot' }, { id: 6141, name: 'Valley Of Gods', game_code: 'ValleyOfGodsYGG', category: 'Slot', tag: 'hot' }, { id: 6148, name: "Troll's Bridge", game_code: 'TrollsBridgeYGG', category: 'Slot', tag: 'hot' }, { id: 6155, name: 'Nirvana', game_code: 'NirvanaYGG', category: 'Slot', tag: 'hot' }, { id: 6162, name: 'Champions of Rome', game_code: 'ChampionsofRomeYGG', category: 'Slot', tag: 'hot' }, { id: 6176, name: 'Blood Moon Wilds', game_code: 'BloodMoonWildsYGG', category: 'Slot', tag: 'hot' }, { id: 6190, name: 'Pumpkin Smash', game_code: 'PumpkinSmashYGG', category: 'Slot', tag: 'hot' }, { id: 6204, name: 'Hades Gigablox', game_code: 'HadesGigabloxYGG', category: 'Slot', tag: 'hot' }, { id: 6211, name: "Hanzo's Dojo", game_code: 'HanzosDojoYGG', category: 'Slot', tag: 'hot' }, // SLOTS - NextGen { id: 5870, name: "Cleo's Heart", game_code: 'CleosHeartNG', category: 'Slot', tag: 'hot' }, { id: 5871, name: 'Clover Stones', game_code: 'CloverStonesNG', category: 'Slot', tag: 'hot' }, { id: 5872, name: 'Crazy Scientist', game_code: 'CrazyScientistNG', category: 'Slot', tag: 'hot' }, { id: 5873, name: 'Dragon Sevens', game_code: 'DragonSevensNG', category: 'Slot', tag: 'hot' }, { id: 5874, name: 'Fortune Cash', game_code: 'FortuneCashNG', category: 'Slot', tag: 'hot' }, { id: 5875, name: 'Fruit Cash', game_code: 'FruitCashNG', category: 'Slot', tag: 'hot' }, { id: 5876, name: 'Hit In Vegas', game_code: 'HitInVegasNG', category: 'Slot', tag: 'hot' }, { id: 5877, name: 'Magic Dragons', game_code: 'MagicDragonsNG', category: 'Slot', tag: 'hot' }, { id: 5878, name: 'Magic Tree', game_code: 'MagicTreeNG', category: 'Slot', tag: 'hot' }, { id: 5879, name: 'MMA Legends', game_code: 'MMALegendsNG', category: 'Slot', tag: 'hot' }, { id: 5880, name: 'Space Rocks', game_code: 'SpaceRocksNG', category: 'Slot', tag: 'hot' }, { id: 5881, name: 'Volcano Fruits', game_code: 'VolcanoFruitsNG', category: 'Slot', tag: 'hot' }, { id: 5882, name: 'Wild Buffalo', game_code: 'WildBuffaloNG', category: 'Slot', tag: 'hot' }, // FISH/ARCADE - PlayGD { id: 5859, name: 'Monster Frenzy', game_code: 'MonsterFrenzyPGD', category: 'Fish/Arcade', tag: 'new' }, { id: 5860, name: 'Aladdin Adventure', game_code: 'AladdinAdventurePGD', category: 'Fish/Arcade', tag: 'new' }, { id: 5982, name: 'Fish Hunter Ghost', game_code: 'FishHunterGhostPGD', category: 'Fish/Arcade', tag: 'new' }, { id: 5986, name: 'Fish Hunter King Kong', game_code: 'FishHunterKingKongPGD', category: 'Fish/Arcade', tag: 'new' }, // FIRE LINK - AGS { id: 5858, name: 'Ultra Blazing Fire Link', game_code: 'UltraBlazingFireLink', category: 'Fire Link', tag: 'hot' }, { id: 6057, name: 'North Shore', game_code: 'NorthShore', category: 'Fire Link', tag: 'hot' }, { id: 6092, name: 'By The Bay', game_code: 'ByTheBay', category: 'Fire Link', tag: 'hot' }, { id: 6099, name: 'China Street', game_code: 'ChinaStreet', category: 'Fire Link', tag: 'hot' }, { id: 6106, name: 'Glacier Gold', game_code: 'GlacierGold', category: 'Fire Link', tag: 'hot' }, { id: 6113, name: 'Olvera Street', game_code: 'OlveraStreet', category: 'Fire Link', tag: 'hot' }, { id: 6120, name: 'River Walk', game_code: 'RiverWalk', category: 'Fire Link', tag: 'hot' }, { id: 6127, name: 'Route 66', game_code: 'Route66', category: 'Fire Link', tag: 'hot' }, { id: 6134, name: 'Rue Royale', game_code: 'RueRoyale', category: 'Fire Link', tag: 'hot' }, ]; // Generate thumbnail URLs using a slot game image API function getThumbnailUrl(gameCode, gameName) { // Use a placeholder image service with game-themed colors const encodedName = encodeURIComponent(gameName); // Use the game screenshot images from the docs folder for the first 11 games // For others, use a themed placeholder return null; // Will be set to null - we'll use the game name as display } async function seed() { const mainUrl = process.env.DATABASE_URL; const conn = await mysql.createConnection(mainUrl); console.log('Seeding slot games from slot-games-casino-slot-machine-master...'); let inserted = 0; let skipped = 0; for (const game of games) { const provider = getProvider(game.game_code); const category = getCategory(game.category); const gameType = getGameType(game.category); const gameId = `slot-${game.game_code.toLowerCase()}`; // Check if already exists const [existing] = await conn.execute('SELECT id FROM all_games WHERE gameId = ?', [gameId]); if (existing.length > 0) { console.log(` SKIP: ${game.name} (already exists)`); skipped++; continue; } // Determine RTP based on provider let rtp = '96.00'; if (provider === 'Yggdrasil') rtp = '96.30'; if (provider === 'NextGen') rtp = '95.80'; if (provider === 'AGS') rtp = '94.50'; if (provider === 'PlayGD') rtp = '96.50'; // Determine volatility let volatility = 'medium'; if (['Incinerator', 'Vikings Go Wild', 'Hades Gigablox', 'Blood Moon Wilds'].includes(game.name)) volatility = 'high'; if (['Rainbow Ryan', 'Penguin City', 'Nirvana', 'Fruit Cash'].includes(game.name)) volatility = 'low'; await conn.execute(` INSERT INTO all_games (gameId, gameName, gameType, category, provider, rtp, volatility, paylines, reels, minBet, maxBet, hasIcon, iconUrl, gameUrl, isActive, isFeatured, playCount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `, [ gameId, game.name, gameType, category, provider, rtp, volatility, gameType === 'arcade' ? 0 : 20, gameType === 'arcade' ? 0 : 5, '0.01', '100.00', 0, // hasIcon - no icon yet null, // iconUrl - will be added later null, // gameUrl - these games need external server 1, // isActive 0, // isFeatured Math.floor(Math.random() * 50000) + 10000, // playCount ]); console.log(` INSERT: [${provider}] ${game.name} (${gameId})`); inserted++; } console.log(`\nDone! Inserted: ${inserted}, Skipped: ${skipped}`); await conn.end(); } seed().catch(e => { console.error('Error:', e.message); process.exit(1); });