Saltar al contenido
liquid < div id="eg-gift-overlay" class="eg-hidden" role="dialog" aria-modal="true">
⚔ EMPIRES GAMES

🎁 ¡Elige tu juego de regalo!

Agregaste una Edición Horror.
Escoge 1 juego completamente gratis:

* El regalo se aplica automáticamente con descuento del 100%

< style> .eg-hidden { display: none !important; } #eg-gift-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.78); z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); animation: egFadeIn .2s ease; } @keyframes egFadeIn { from{opacity:0} to{opacity:1} } @keyframes egSlideUp { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} } #eg-gift-modal { background: #141414; border: 1px solid #2a2a2a; border-radius: 16px; max-width: 500px; width: 100%; padding: 28px 24px 20px; position: relative; box-shadow: 0 24px 60px rgba(0,0,0,.7); animation: egSlideUp .25s ease; max-height: 92vh; overflow-y: auto; } #eg-gift-close { position: absolute; top: 14px; right: 16px; background: #2a2a2a; border: none; color: #aaa; font-size: 15px; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; } #eg-gift-close:hover { background: #ff6b00; color: #fff; } #eg-gift-badge { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #ff6b00; margin-bottom: 8px; } #eg-gift-title { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 6px; line-height: 1.3; } #eg-gift-subtitle { font-size: 14px; color: #aaa; line-height: 1.5; margin-bottom: 18px; } #eg-gift-subtitle strong { color: #ff6b00; } #eg-gift-note { font-size: 11px; color: #555; text-align: center; margin-top: 14px; } #eg-gift-grid { display: grid; grid-template-columns: 1fr; gap: 10px; } #eg-gift-grid.loading { display: flex; align-items: center; justify-content: center; min-height: 100px; color: #666; font-size: 14px; } .eg-card { background: #1e1e1e; border: 2px solid #2a2a2a; border-radius: 10px; overflow: hidden; display: flex; flex-direction: row; align-items: center; transition: border-color .15s, transform .15s, box-shadow .15s; } .eg-card:hover { border-color: #ff6b00; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,107,0,.2); } .eg-card-img { width: 90px; height: 90px; flex-shrink: 0; object-fit: cover; display: block; background: #2a2a2a; border-radius: 8px 0 0 8px; } .eg-card-body { padding: 10px 10px 4px; flex: 1; } .eg-card-name { font-size: 11px; font-weight: 600; color: #f0f0f0; line-height: 1.3; margin-bottom: 3px; } .eg-card-free { font-size: 11px; font-weight: 700; color: #ff6b00; margin-bottom: 5px; } .eg-variant-sel { width: 100%; background: #2a2a2a; border: 1px solid #333; border-radius: 5px; color: #f0f0f0; font-size: 10px; padding: 3px 5px; font-family: inherit; cursor: pointer; margin-bottom: 2px; } .eg-variant-sel:focus { outline: 1px solid #ff6b00; } .eg-card-footer { padding: 8px 12px 8px 0; flex-shrink: 0; } .eg-btn { width: auto; background: #ff6b00; color: #fff; border: none; border-radius: 6px; padding: 8px 14px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .15s; white-space: nowrap; } .eg-btn:hover:not(:disabled) { background: #e05e00; } .eg-btn:disabled { background: #444; cursor: not-allowed; } @media (max-width: 420px) { #eg-gift-modal { padding: 24px 16px 16px; } } < script> (function () { 'use strict'; // ── CONFIG ──────────────────────────────────────────────────────── const HORROR_HANDLE = 'edicion-horror'; const GIFT_HANDLES = ['theforestpsn','witcher3psn','tlourepsn','mk11psn','alanwakepsn','thedivisionpsn']; const GIFT_PROP = '_empires_horror_gift'; // ── ESTADO ──────────────────────────────────────────────────────── let isOpen = false; let horrorIdsCache = null; // ── DOM ─────────────────────────────────────────────────────────── const overlay = document.getElementById('eg-gift-overlay'); const grid = document.getElementById('eg-gift-grid'); // ── MODAL ───────────────────────────────────────────────────────── function openModal(horrorVariantTitle) { if (isOpen) return; isOpen = true; overlay.classList.remove('eg-hidden'); loadGifts(horrorVariantTitle); } function closeModal() { isOpen = false; overlay.classList.add('eg-hidden'); } document.getElementById('eg-gift-close').addEventListener('click', closeModal); overlay.addEventListener('click', e => { if (e.target === overlay) closeModal(); }); // ── CARGAR REGALOS ──────────────────────────────────────────────── async function loadGifts(horrorVariantTitle) { grid.className = 'loading'; grid.textContent = '🎮 Cargando opciones...'; const handles = shuffle(GIFT_HANDLES).slice(0, 3); const products = (await Promise.all(handles.map(h => fetch(`/products/${h}.js`).then(r => r.ok ? r.json() : null).catch(() => null) ))).filter(Boolean); grid.className = ''; grid.innerHTML = ''; products.forEach(p => renderCard(p, horrorVariantTitle)); } function renderCard(product, horrorVariantTitle) { // FIX 2: Usar la imagen featured_image o images[0] correctamente // Shopify .js endpoint devuelve featured_image como string URL directamente const imgSrc = product.featured_image || ''; // FIX 3: Intentar match de variante por plataforma+licencia const matched = matchVariant(product.variants, horrorVariantTitle); const needsSel = !matched; const availableVariants = product.variants.filter(v => v.available); const card = document.createElement('div'); card.className = 'eg-card'; card.innerHTML = ` ${product.title}
${product.title}
🎁 GRATIS
${needsSel && availableVariants.length > 1 ? ` ` : ''}
`; const btn = card.querySelector('.eg-btn'); const sel = card.querySelector('.eg-variant-sel'); // Variante inicial let chosenId = matched ? matched.id : (availableVariants[0]?.id || product.variants[0]?.id); if (sel) sel.addEventListener('change', () => { chosenId = parseInt(sel.value); }); btn.addEventListener('click', async () => { if (!chosenId) return; btn.disabled = true; btn.textContent = 'Añadiendo...'; try { await removeExistingGift(); await fetch('/cart/add.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: chosenId, quantity: 1, properties: { [GIFT_PROP]: 'true', 'Regalo': '🎁 Edición Horror' } }) }); closeModal(); refreshCartUI(); } catch { btn.disabled = false; btn.textContent = 'Elegir este'; } }); grid.appendChild(card); } // ── MATCH DE VARIANTE ───────────────────────────────────────────── // Variantes exactas de Empires Games: // Plataforma: "PlayStation 4" | "PlayStation 5" // Licencia: "Primaria" | "Secundaria" // El título de variante del producto es: "PlayStation 5 / Primaria" function matchVariant(variants, horrorTitle) { if (!horrorTitle || !variants?.length) return null; const h = horrorTitle.toLowerCase(); // Detectar plataforma — texto exacto de Shopify let plat = null; if (h.includes('playstation 5')) plat = 'PlayStation 5'; else if (h.includes('playstation 4')) plat = 'PlayStation 4'; else if (h.includes('xbox')) plat = 'xbox'; // por si acaso // Detectar licencia — texto exacto de Shopify let lic = null; if (h.includes('primaria')) lic = 'Primaria'; else if (h.includes('secundaria')) lic = 'Secundaria'; // Sin info suficiente → mostrar selector if (!plat && !lic) return null; let best = null, bestScore = 0; for (const v of variants) { const vt = v.title || ''; // ej: "PlayStation 5 / Primaria" const vtLow = vt.toLowerCase(); let score = 0; // Match plataforma (peso 2) if (plat && vtLow.includes(plat.toLowerCase())) score += 2; // Match licencia (peso 1) if (lic && vtLow.includes(lic.toLowerCase())) score += 1; if (score > bestScore) { bestScore = score; best = v; } } // Auto-seleccionar solo si coincidió plataforma (score >= 2) // Si el regalo no tiene esa plataforma → mostrar selector return bestScore >= 2 ? best : null; } // ── QUITAR REGALO EXISTENTE ─────────────────────────────────────── async function removeExistingGift() { const cart = await fetch('/cart.js').then(r => r.json()); const gift = cart.items.find(i => i.properties?.[GIFT_PROP] === 'true'); if (!gift) return; await fetch('/cart/change.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: gift.key, quantity: 0 }) }); } // ── VERIFICAR CONSISTENCIA (quitar regalo si no hay horror) ─────── async function checkConsistency() { const cart = await fetch('/cart.js').then(r => r.json()); const gift = cart.items.find(i => i.properties?.[GIFT_PROP] === 'true'); if (!gift) return; const ids = await getHorrorIds(); const hasHorror = cart.items.some( i => !i.properties?.[GIFT_PROP] && ids.includes(i.product_id) ); if (!hasHorror) { await removeExistingGift(); refreshCartUI(); } } // ── IDs DE COLECCIÓN HORROR ──────────────────────────────────────── async function getHorrorIds() { if (horrorIdsCache) return horrorIdsCache; try { const r = await fetch(`/collections/${HORROR_HANDLE}/products.json?limit=250`); const d = await r.json(); horrorIdsCache = (d.products || []).map(p => p.id); } catch { horrorIdsCache = []; } return horrorIdsCache; } // ── REFRESH CART UI ─────────────────────────────────────────────── function refreshCartUI() { document.dispatchEvent(new CustomEvent('cart:refresh')); fetch('/cart.js').then(r => r.json()).then(cart => { document.querySelectorAll( '[data-cart-count],.cart-count,.header__cart-count,#CartCount,.js-cart-count' ).forEach(el => el.textContent = cart.item_count); document.querySelectorAll('cart-notification,cart-drawer').forEach(el => { if (typeof el.renderContents === 'function') el.renderContents(); if (typeof el.refresh === 'function') el.refresh(); }); }); } // ── SHUFFLE ─────────────────────────────────────────────────────── function shuffle(arr) { return [...arr].sort(() => Math.random() - .5); } // ── FIX 1: INTERCEPTAR SOLO EL ADD TO CART ─────────────────────── // No se ejecuta al cargar la página, solo cuando el usuario agrega algo const _origFetch = window.fetch; window.fetch = async function (...args) { const url = typeof args[0] === 'string' ? args[0] : (args[0]?.url || ''); const res = await _origFetch.apply(this, args); // Solo interceptar /cart/add if (/\/cart\/add(\.js)?/.test(url)) { try { const data = await res.clone().json(); // Ignorar si es el propio regalo if (data.properties?.[GIFT_PROP]) return res; const productId = data.product_id; if (!productId) return res; const ids = await getHorrorIds(); if (ids.includes(productId)) { // Construir título de variante del horror para hacer match const variantTitle = [data.option1, data.option2, data.option3] .filter(Boolean).join(' / '); setTimeout(() => openModal(variantTitle), 350); } } catch { /* noop */ } } // Interceptar eliminaciones para verificar consistencia if (/\/cart\/(change|update)(\.js)?/.test(url)) { setTimeout(() => checkConsistency(), 600); } return res; }; // Interceptar también form submit clásico (fallback) document.addEventListener('submit', e => { const f = e.target; if (!f?.action?.includes('/cart/add')) return; setTimeout(async () => { const cart = await fetch('/cart.js').then(r => r.json()); const last = cart.items[0]; if (!last || last.properties?.[GIFT_PROP]) return; const ids = await getHorrorIds(); if (ids.includes(last.product_id)) openModal(last.variant_title || ''); }, 800); }, true); })();
Descripción

De los creadores de la galardonada franquicia ''Age of Empires'', ''Age of Mythology: Retold'' va más allá de la historia y te transporta a una época mítica de conflictos entre los dioses, los monstruos y los humanos. ''Retold'', que combina los mejores elementos del aclamado ''Age of Mythology'' con modernos efectos visuales y diseños de estrategia en tiempo real, es una experiencia épica e innovadora para jugadores experimentados y novatos por igual. Protege tus dominios, lidera monstruos legendarios e invoca el poder de los dioses para acabar con tus enemigos.

Idioma: Español
Peso : 20GB

Incluye Guia Paso a Paso
Entrega en minutos

Como funciona

Juego 100% descargable, original y completo.

Primaria: juegas en cualquier usuario de tu consola y sin necesidad de conexión a internet para jugar

Secundaria: juegas en el usuario que te entreguemos y necesitas conexión a Internet para jugar

Una vez confirmado tu pago, recibiras el juego por correo electronico a los pocos minutos