Drip Runner trial: IAP hand-off, seeded runs with server replay check, self-funding POL pool (refuel ad share + hangar spends), chapter drips, threshold payouts via faucet (dry run), tester allowlist + briefing page, admin page, e2e test
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>Drip Runner · admin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800;900&family=Manrope:wght@400;600;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/site.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap" style="max-width:1100px">
|
||||
<p class="logo" style="font-size:28px">Drip<span>Runner</span> <span style="font:800 12px var(--display);color:var(--muted);letter-spacing:.2em">ADMIN</span></p>
|
||||
<p class="muted" id="links"></p>
|
||||
<h2>Pool</h2>
|
||||
<div class="grid" id="pool"></div>
|
||||
<h2>Faucet</h2>
|
||||
<div class="grid" id="faucet"></div>
|
||||
<p style="margin-top:10px"><button class="btn ghost" id="tick" type="button">Run the faucet now</button> <span class="muted" id="tickOut"></span></p>
|
||||
|
||||
<h2>Settings</h2>
|
||||
<form id="settings" class="card" style="max-width:none">
|
||||
<div class="row">
|
||||
<div><label>Drip per first clear (POL)</label><input name="dripPol" type="number" step="0.001" min="0"></div>
|
||||
<div><label>Daily cap on drips (POL)</label><input name="dailyCapPol" type="number" step="0.01" min="0"></div>
|
||||
<div><label>Payout threshold (POL)</label><input name="thresholdPol" type="number" step="0.01" min="0"></div>
|
||||
<div><label>Seed float (POL, on purpose)</label><input name="seedPol" type="number" step="0.01" min="0"></div>
|
||||
<div><label>Pool share of ad spend (%)</label><input name="poolSharePct" type="number" step="1" min="0" max="100"></div>
|
||||
<div><label>Credits per visit</label><input name="creditsPerVisit" type="number" step="1" min="0"></div>
|
||||
<div><label>USD per credit</label><input name="usdPerCredit" type="number" step="0.001" min="0"></div>
|
||||
<div><label>USD per POL fallback</label><input name="usdPerPolFallback" type="number" step="0.001" min="0"></div>
|
||||
<div><label>Low balance alert (POL)</label><input name="lowBalancePol" type="number" step="0.1" min="0"></div>
|
||||
<div><label>Who may sign in</label><select name="signups"><option value="testers">testers only</option><option value="open">any IAP member</option><option value="closed">nobody</option></select></div>
|
||||
<div><label>Shield core (POL)</label><input name="item_shield" type="number" step="0.001" min="0"></div>
|
||||
<div><label>Slow field (POL)</label><input name="item_slow" type="number" step="0.001" min="0"></div>
|
||||
<div><label>Drip magnet (drips)</label><input name="item_magnet" type="number" step="1" min="0"></div>
|
||||
<div><label>Courier Mk II (drips)</label><input name="item_ship" type="number" step="1" min="0"></div>
|
||||
</div>
|
||||
<label>Testers (one per line: IAP email or member id)</label>
|
||||
<textarea name="testers" rows="6"></textarea>
|
||||
<p style="margin-top:10px"><button class="btn" type="submit">Save settings</button> <span class="muted" id="saveOut"></span></p>
|
||||
</form>
|
||||
|
||||
<h2>Players</h2><div class="scroll"><table id="players"></table></div>
|
||||
<h2>Refuels (income)</h2><div class="scroll"><table id="refuels"></table></div>
|
||||
<h2>Drips granted</h2><div class="scroll"><table id="drips"></table></div>
|
||||
<h2>Hangar spends (back to the pool)</h2><div class="scroll"><table id="spends"></table></div>
|
||||
<h2>Payouts</h2><div class="scroll"><table id="payouts"></table></div>
|
||||
<h2>Recent runs</h2><div class="scroll"><table id="runs"></table></div>
|
||||
</div>
|
||||
<script src="/admin.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,41 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (id) { return document.getElementById(id); };
|
||||
var KEY = new URLSearchParams(location.search).get('key') || ''; try { if (KEY) sessionStorage.setItem('dr.admin', KEY); else KEY = sessionStorage.getItem('dr.admin') || ''; } catch (e) {}
|
||||
if (new URLSearchParams(location.search).get('key')) history.replaceState(null, '', '/admin');
|
||||
function api(p, body) { return fetch(p, { method: body ? 'POST' : 'GET', headers: { 'Content-Type': 'application/json', 'X-Admin-Key': KEY }, body: body ? JSON.stringify(body) : undefined }).then(function (r) { return r.json(); }); }
|
||||
var esc = function (s) { return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]; }); };
|
||||
var ct = function (ts) { return ts ? new Date(ts).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) : ''; };
|
||||
var f4 = function (n) { return Number(n || 0).toFixed(4); };
|
||||
function stat(label, val) { return '<div class="stat"><small>' + label + '</small><b>' + val + '</b></div>'; }
|
||||
function table(id, cols, rows) { var h = '<tr>' + cols.map(function (c) { return '<th>' + c[0] + '</th>'; }).join('') + '</tr>'; if (!rows.length) h += '<tr><td colspan="' + cols.length + '" class="muted">nothing yet</td></tr>'; rows.forEach(function (r) { h += '<tr>' + cols.map(function (c) { var v = typeof c[1] === 'function' ? c[1](r) : r[c[1]]; return '<td' + (c[2] ? ' class="num"' : '') + '>' + (v == null ? '' : v) + '</td>'; }).join('') + '</tr>'; }); $(id).innerHTML = h; }
|
||||
var S = null;
|
||||
function load() {
|
||||
return api('/api/admin/state').then(function (d) {
|
||||
if (d.error) { document.body.innerHTML = '<p style="padding:40px">' + esc(d.error) + '</p>'; return; }
|
||||
S = d; var p = d.pool;
|
||||
$('links').innerHTML = 'Tester page: <a href="' + esc(d.curtain) + '">' + esc(d.curtain) + '</a> · POL $' + f4(d.usdPerPol) + ' (from the IAP contract)';
|
||||
$('pool').innerHTML = stat('Available now', f4(p.available) + ' POL') + stat('In from refuels', f4(p.in)) + stat('Back from spends', f4(p.spends)) + stat('Out as drips', f4(p.out)) + stat('Seed float', f4(p.seed)) + stat('Granted today', f4(p.grantedToday) + ' / ' + f4(p.dailyCapPol));
|
||||
var f = d.faucet; $('faucet').innerHTML = stat('Mode', f.enabled ? (f.dryRun ? 'DRY RUN' : 'LIVE') : 'off') + stat('Wallet', f.address ? f.address.slice(0, 8) + '…' + f.address.slice(-6) : '–') + stat('Balance', f.balance != null ? f4(f.balance) + ' POL' : '–') + stat('Last check', ct(f.checkedAt) || '–') + stat('Last tick', f.lastTick ? esc(JSON.stringify(f.lastTick)) : '–');
|
||||
var s = d.settings, form = $('settings');
|
||||
['dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { form.elements[k].value = s[k]; });
|
||||
form.elements.item_shield.value = s.itemPol.shield; form.elements.item_slow.value = s.itemPol.slow; form.elements.item_magnet.value = s.itemDrips.magnet; form.elements.item_ship.value = s.itemDrips.ship;
|
||||
form.elements.testers.value = (s.testers || []).join('\n');
|
||||
table('players', [['Member', function (r) { return '#' + r.memberId + (r.username ? ' @' + esc(r.username) : '') + '<br><span class="muted">' + esc(r.email || '') + '</span>'; }], ['Wallet', function (r) { return r.wallet ? r.wallet.slice(0, 6) + '…' + r.wallet.slice(-4) : '<span style="color:var(--sig)">none</span>'; }], ['Chapter', 'chapter', 1], ['Drips', 'bank', 1], ['Best', 'best', 1], ['Runs', 'runs', 1], ['Armed', function (r) { return Object.keys(r.items || {}).join(', '); }], ['Last seen', function (r) { return ct(r.lastSeen); }]], d.players);
|
||||
table('refuels', [['When', function (r) { return ct(r.ts); }], ['Member', function (r) { return '#' + r.memberId + (r.username ? ' @' + esc(r.username) : ''); }], ['Campaign', 'campaignId'], ['Credits', 'credits', 1], ['Ad $', function (r) { return f4(r.usd); }, 1], ['Share $', function (r) { return f4(r.share); }, 1], ['POL to pool', function (r) { return f4(r.pol); }, 1], ['Via', 'via']], d.refuels);
|
||||
table('drips', [['When', function (r) { return ct(r.ts); }], ['Member', function (r) { return '#' + r.memberId + (r.username ? ' @' + esc(r.username) : ''); }], ['Chapter', 'chapter', 1], ['POL', function (r) { return f4(r.pol); }, 1]], d.drips);
|
||||
table('spends', [['When', function (r) { return ct(r.ts); }], ['Member', function (r) { return '#' + r.memberId + (r.username ? ' @' + esc(r.username) : ''); }], ['Item', 'item'], ['POL', function (r) { return f4(r.pol); }, 1]], d.spends);
|
||||
table('payouts', [['When', function (r) { return ct(r.ts); }], ['Member', function (r) { return '#' + r.memberId + (r.username ? ' @' + esc(r.username) : ''); }], ['Wallet', function (r) { return r.wallet ? r.wallet.slice(0, 6) + '…' + r.wallet.slice(-4) : ''; }], ['POL', function (r) { return f4(r.pol); }, 1], ['Status', function (r) { return esc(r.status) + (r.error ? ' · ' + esc(r.error) : ''); }], ['Tx', function (r) { return r.tx ? '<a href="https://polygonscan.com/tx/' + esc(r.tx) + '" target="_blank" rel="noopener">' + r.tx.slice(0, 10) + '…</a>' : ''; }]], d.payouts);
|
||||
table('runs', [['Started', function (r) { return ct(r.startedAt); }], ['Member', function (r) { return '#' + r.memberId; }], ['Chapter', function (r) { return r.chapter + (r.cleared && r.cleared.length ? ' (cleared ' + r.cleared.join(',') + ')' : ''); }], ['Drips', 'drips', 1], ['Refused', 'bad', 1], ['Refuels', 'refuels', 1], ['Status', function (r) { return esc(r.status) + (r.flagged ? ' · <span style="color:var(--sig)">FLAGGED</span>' : ''); }], ['t', function (r) { return Math.round(r.t) + ' s'; }, 1]], d.runs);
|
||||
});
|
||||
}
|
||||
$('settings').addEventListener('submit', function (e) {
|
||||
e.preventDefault(); var f = e.target.elements; var body = {};
|
||||
['dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { body[k] = f[k].value; });
|
||||
body.itemPol = { shield: Number(f.item_shield.value), slow: Number(f.item_slow.value) }; body.itemDrips = { magnet: Number(f.item_magnet.value), ship: Number(f.item_ship.value) };
|
||||
body.testers = f.testers.value.split(/\r?\n/).map(function (x) { return x.trim(); }).filter(Boolean);
|
||||
api('/api/admin/settings', body).then(function (r) { $('saveOut').textContent = r.ok ? 'Saved.' : (r.error || 'Failed'); load(); });
|
||||
});
|
||||
$('tick').addEventListener('click', function () { $('tickOut').textContent = 'running…'; api('/api/admin/faucet/tick', {}).then(function (r) { $('tickOut').textContent = JSON.stringify(r); load(); }); });
|
||||
load();
|
||||
})();
|
||||
@@ -0,0 +1,54 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>Drip Runner · tester briefing</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800;900&family=Manrope:wght@400;600;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="stylesheet" href="/site.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<p class="logo">Drip<span>Runner</span></p>
|
||||
<p style="margin-top:8px"><span class="chip sig">closed trial</span> <span class="chip">InstantAdPay members only</span></p>
|
||||
<p>Thanks for testing. Drip Runner is a small game that pays real POL, and the POL comes from the ads you watch inside it. You are here to find out whether that loop feels good and whether it holds up. Nothing is polished yet, so say what you see.</p>
|
||||
|
||||
<div class="card">
|
||||
<h1>Get in</h1>
|
||||
<ol class="steps">
|
||||
<li><div><b>Sign in to InstantAdPay first</b>Open <a href="https://instantadpay.com/my" target="_blank" rel="noopener">instantadpay.com/my</a> in this same browser and sign in the usual way (email code).</div></li>
|
||||
<li><div><b>Then tap this button</b>InstantAdPay signs you across. No new account, no new password.<br><a class="btn" style="margin-top:10px" href="https://instantadpay.com/api/my/driprunner">Open Drip Runner</a></div></li>
|
||||
<li><div><b>Have a wallet on your IAP account</b>You can play without one, but POL payouts go to the wallet on file at InstantAdPay. Link it under Wallet on your IAP dashboard.</div></li>
|
||||
</ol>
|
||||
<p class="muted">If you see "not on the tester list", your IAP account has not been added yet. Tell Marty which username you use.</p>
|
||||
</div>
|
||||
|
||||
<h2>How it plays</h2>
|
||||
<ul>
|
||||
<li><b>Tap to hop.</b> The courier drops when you do nothing and hops when you tap. Space bar works on a computer.</li>
|
||||
<li><b>Gold drips</b> are the score. <b>Magenta bots</b> end the run. From chapter 2, <b>orange firewalls</b> have to be threaded through the gap.</li>
|
||||
<li><b>Fuel</b> drains all the time. Every drip tops it up a little. Empty tank, run over.</li>
|
||||
<li><b>Chapters.</b> Each chapter has a drip goal for one run. Clear it and you move up. The first time you clear a chapter, a drip of POL lands in your game balance.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Where the POL comes from</h2>
|
||||
<ul>
|
||||
<li>When a run ends you can <b>refuel</b> instead of restarting. Refuel opens a real InstantAdPay verified visit: a member's page, a short timer, a quick icon check. Then your run continues where it died, fuel full.</li>
|
||||
<li>That visit is paid for by the advertiser. A share of it goes into the game's <b>POL pool</b>, and the pool is the only thing chapter drips are paid from. No refuels, no pool, no POL. That is the whole experiment.</li>
|
||||
<li>Your <b>game balance</b> pays out to your wallet once it reaches the threshold shown on the Balance screen. Payouts run every couple of minutes, and the transaction link shows up in your history.</li>
|
||||
<li>In the <b>hangar</b>, drips buy the magnet and the Mk II courier. The shield and the slow field cost POL, taken from your game balance before it pays out.</li>
|
||||
</ul>
|
||||
|
||||
<h2>What to tell Marty</h2>
|
||||
<ul>
|
||||
<li>Did the refuel work the first time, and did the run really continue where it stopped?</li>
|
||||
<li>Did the sponsor page load inside the refuel screen, or did you get a blank frame?</li>
|
||||
<li>Did a chapter drip show up in your balance after your first clear? If it said the pool was empty, say so, that is expected until refuels have happened.</li>
|
||||
<li>Anything on your phone that looked wrong: text cut off, buttons you could not reach, a run that ended for no reason.</li>
|
||||
<li>Honest one: would you refuel again just to keep a run alive?</li>
|
||||
</ul>
|
||||
<p class="muted">Amounts are trial placeholders and can change during the test. Nothing here is a promise of income.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,149 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover,user-scalable=no">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>Drip Runner</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800;900&family=Manrope:wght@400;600;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<style>
|
||||
:root{color-scheme:dark;--page:#050912;--ink:#EEF3FA;--ink2:#AFC0D8;--muted:#6E82A3;--cyan:#22D3EE;--cyan2:#8FF0FF;--gold:#FFC24B;--gold2:#FFE9A8;--bot:#FF3B7A;--sig:#FF6A1A;--ok:#34D399;--violet:#8B5CF6;--panel:#0E172D;--panel2:#141F3A;--line:#24365F;
|
||||
--display:"Orbitron","Segoe UI",system-ui,sans-serif;--body:"Manrope","Segoe UI",system-ui,sans-serif;--mono:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace}
|
||||
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
|
||||
html,body{height:100%}
|
||||
body{margin:0;background:var(--page);color:var(--ink);font:15px/1.5 var(--body);overflow:hidden;background-image:radial-gradient(ellipse 60% 50% at 50% 0%,rgba(34,211,238,.10),transparent 60%),radial-gradient(ellipse 40% 40% at 90% 100%,rgba(255,106,26,.08),transparent 60%)}
|
||||
.frame{position:fixed;inset:0;display:grid;place-items:center}
|
||||
.phone{position:relative;width:100%;height:100%;background:#050912;overflow:hidden}
|
||||
@media (min-width:700px) and (min-height:700px){.frame{padding:16px}.phone{max-width:430px;max-height:900px;border:3px solid #1A2540;border-radius:40px;box-shadow:0 40px 90px -30px rgba(0,0,0,.95),0 0 80px -20px rgba(34,211,238,.25)}}
|
||||
canvas#game{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}
|
||||
.hud{position:absolute;left:0;right:0;top:0;padding:calc(12px + env(safe-area-inset-top,0px)) 14px 0;display:grid;grid-template-columns:1fr auto 1fr;align-items:start;gap:10px;pointer-events:none;z-index:4;opacity:0;transition:opacity .3s}
|
||||
.hud.on{opacity:1}
|
||||
.hud .st{font:700 20px var(--display);letter-spacing:.04em;line-height:1;font-variant-numeric:tabular-nums}
|
||||
.hud .st small{display:block;font:700 9px var(--body);letter-spacing:.16em;text-transform:uppercase;color:var(--muted);margin-bottom:3px}
|
||||
.hud .st.gold{color:var(--gold);text-shadow:0 0 14px rgba(255,194,75,.6)}.hud .st.cy{color:var(--cyan2);text-align:center;text-shadow:0 0 14px rgba(34,211,238,.6)}.hud .st.r{text-align:right;color:var(--ink2)}
|
||||
.fuel{grid-column:1/-1;margin-top:6px;height:8px;border-radius:4px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);overflow:hidden}
|
||||
.fuel i{display:block;height:100%;width:100%;border-radius:4px;background:linear-gradient(90deg,var(--sig),var(--gold) 40%,var(--cyan));box-shadow:0 0 12px rgba(34,211,238,.5);transition:width .15s linear}
|
||||
.fuel.low i{background:linear-gradient(90deg,var(--bot),var(--sig));animation:blink .5s steps(2) infinite}
|
||||
@keyframes blink{50%{opacity:.35}}
|
||||
.goal{grid-column:1/-1;font:600 11px var(--body);color:var(--ink2);display:flex;justify-content:space-between;margin-top:2px}.goal b{color:var(--gold)}
|
||||
.pill{position:absolute;left:50%;transform:translateX(-50%);top:50%;z-index:5;pointer-events:none;font:800 22px var(--display);letter-spacing:.1em;text-transform:uppercase;color:#fff;text-shadow:0 0 20px var(--cyan);opacity:0;transition:opacity .2s;white-space:nowrap}
|
||||
.pill.on{opacity:1;animation:pop .9s ease-out}
|
||||
@keyframes pop{0%{transform:translate(-50%,10px) scale(.7)}30%{transform:translate(-50%,0) scale(1.1)}100%{transform:translate(-50%,-30px) scale(1)}}
|
||||
.mute{position:absolute;right:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px));z-index:6;width:38px;height:38px;border-radius:50%;border:1px solid var(--line);background:rgba(14,23,45,.7);color:var(--ink2);font:700 13px var(--mono);display:grid;place-items:center;cursor:pointer}
|
||||
.ov{position:absolute;inset:0;z-index:8;display:flex;flex-direction:column;justify-content:center;padding:calc(20px + env(safe-area-inset-top,0px)) 18px calc(20px + env(safe-area-inset-bottom,0px));background:rgba(5,9,18,.55);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
|
||||
.ov[hidden]{display:none!important}
|
||||
.ov.lobby{justify-content:space-between;background:linear-gradient(180deg,rgba(5,9,18,.15),rgba(5,9,18,.75) 60%,#050912)}
|
||||
.logo{font:900 42px/1 var(--display);letter-spacing:.06em;text-transform:uppercase;text-align:center;margin-top:10vh;background:linear-gradient(180deg,#fff 0%,var(--cyan2) 45%,var(--cyan) 60%,#0EA5C9 100%);-webkit-background-clip:text;background-clip:text;color:transparent;filter:drop-shadow(0 0 22px rgba(34,211,238,.55));animation:hum 3s ease-in-out infinite}
|
||||
.logo span{display:block;background:linear-gradient(180deg,var(--gold2),var(--gold) 55%,#E08A00);-webkit-background-clip:text;background-clip:text;color:transparent;filter:drop-shadow(0 0 22px rgba(255,194,75,.5))}
|
||||
@keyframes hum{50%{filter:drop-shadow(0 0 34px rgba(34,211,238,.8))}}
|
||||
.tag{text-align:center;color:var(--ink2);font-size:13px;margin-top:10px}
|
||||
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:14px 0 10px}
|
||||
.stat{background:linear-gradient(180deg,rgba(20,31,58,.9),rgba(14,23,45,.9));border:1px solid var(--line);border-radius:12px;padding:10px 8px;text-align:center;position:relative;overflow:hidden}
|
||||
.stat small{display:block;font:700 9px var(--body);letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}.stat b{font:800 20px var(--display);font-variant-numeric:tabular-nums}
|
||||
.stat b.gold{color:var(--gold)}.stat b.cy{color:var(--cyan2)}.stat b.ok{color:var(--ok)}
|
||||
.pool{font:600 11px var(--mono);color:var(--muted);text-align:center;margin-bottom:6px}.pool b{color:var(--ink2)}
|
||||
.btn{display:block;width:100%;margin-top:10px;padding:14px 12px;border-radius:12px;border:0;cursor:pointer;font:800 16px var(--display);letter-spacing:.12em;text-transform:uppercase;color:#07101F;position:relative;background:linear-gradient(180deg,var(--cyan2),var(--cyan) 55%,#0EA5C9);box-shadow:0 0 0 1px rgba(255,255,255,.25) inset,0 8px 28px -8px rgba(34,211,238,.8)}
|
||||
.btn:active{transform:translateY(1px)}
|
||||
.btn.sig{background:linear-gradient(180deg,#FFB088,var(--sig) 55%,#D44E00);color:#fff;box-shadow:0 0 0 1px rgba(255,255,255,.2) inset,0 8px 28px -8px rgba(255,106,26,.8)}
|
||||
.btn.gold{background:linear-gradient(180deg,var(--gold2),var(--gold) 55%,#E08A00);box-shadow:0 0 0 1px rgba(255,255,255,.25) inset,0 8px 28px -8px rgba(255,194,75,.8)}
|
||||
.btn.ghost{background:rgba(14,23,45,.7);border:1px solid var(--line);color:var(--ink2);font-size:13px;padding:11px;box-shadow:none}
|
||||
.btn[disabled]{opacity:.45;pointer-events:none}
|
||||
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.row2 .btn{margin-top:10px}
|
||||
.member{margin-top:12px;text-align:center;font:600 11px var(--mono);color:var(--muted)}.member i{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--ok);box-shadow:0 0 8px var(--ok);margin-right:6px;vertical-align:1px}.member i.no{background:var(--sig);box-shadow:0 0 8px var(--sig)}
|
||||
.card{background:linear-gradient(180deg,rgba(20,31,58,.96),rgba(14,23,45,.98));border:1px solid var(--line);border-radius:18px;padding:22px 18px;text-align:center;box-shadow:0 30px 70px -20px rgba(0,0,0,.9),0 0 60px -20px rgba(34,211,238,.35);position:relative;overflow:hidden}
|
||||
.card:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:linear-gradient(90deg,transparent,var(--cyan),var(--gold),transparent)}
|
||||
.card .eyebrow{font:700 10px var(--body);letter-spacing:.2em;text-transform:uppercase;color:var(--cyan)}
|
||||
.card h2{font:900 26px/1.05 var(--display);letter-spacing:.05em;text-transform:uppercase;margin:8px 0 4px;text-wrap:balance}
|
||||
.card .big{font:900 46px/1 var(--display);margin:12px 0 2px;font-variant-numeric:tabular-nums;background:linear-gradient(180deg,var(--gold2),var(--gold) 60%,#E08A00);-webkit-background-clip:text;background-clip:text;color:transparent;filter:drop-shadow(0 0 18px rgba(255,194,75,.5))}
|
||||
.card .big small{font:700 13px var(--mono);color:var(--ink2);margin-left:6px;-webkit-text-fill-color:var(--ink2)}
|
||||
.card .big.dim{opacity:.3}
|
||||
.card p{font-size:13px;color:var(--ink2);margin:6px 0 0}
|
||||
.chip{display:inline-block;font:700 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;padding:3px 8px;border-radius:5px;border:1px solid var(--line);color:var(--ink2);margin-top:10px}
|
||||
.chip.ok{color:var(--ok);border-color:rgba(52,211,153,.4);background:rgba(52,211,153,.08)}.chip.sig{color:var(--sig);border-color:rgba(255,106,26,.4);background:rgba(255,106,26,.08)}.chip.gold{color:var(--gold);border-color:rgba(255,194,75,.4);background:rgba(255,194,75,.08)}
|
||||
.sheet{background:linear-gradient(180deg,rgba(20,31,58,.97),rgba(14,23,45,.98));border:1px solid var(--line);border-radius:18px;padding:16px 14px;max-height:100%;display:flex;flex-direction:column;gap:8px;overflow:auto}
|
||||
.sheet h3{font:900 18px var(--display);letter-spacing:.1em;text-transform:uppercase;margin:2px 2px 4px;display:flex;justify-content:space-between;align-items:center}.sheet h3 .bal{font:700 11px var(--mono);color:var(--gold)}
|
||||
.item{display:grid;grid-template-columns:46px 1fr auto;gap:10px;align-items:center;background:rgba(5,9,18,.5);border:1px solid var(--line);border-radius:12px;padding:8px 10px;text-align:left}
|
||||
.item.owned{border-color:rgba(52,211,153,.45)}
|
||||
.item .ic{width:46px;height:46px;border-radius:11px;background:radial-gradient(circle at 30% 30%,#2A4A7A,#0E1730);display:grid;place-items:center}
|
||||
.item .ic i{display:block;width:28px;height:13px;border-radius:7px;background:#F3F6FB;box-shadow:0 0 12px var(--cyan)}
|
||||
.item .ic.gold i{background:var(--gold);width:16px;height:16px;border-radius:50%;box-shadow:0 0 12px var(--gold)}
|
||||
.item .ic.sig i{background:var(--sig);width:18px;height:18px;border-radius:5px;transform:rotate(45deg);box-shadow:0 0 12px var(--sig)}
|
||||
.item .ic.vi i{background:var(--violet);width:18px;height:18px;border-radius:50% 50% 4px 4px;box-shadow:0 0 12px var(--violet)}
|
||||
.item b{font-size:13px;display:block}.item small{color:var(--muted);font-size:11px;display:block}
|
||||
.buy{font:800 11px var(--mono);white-space:nowrap;padding:8px 10px;border-radius:9px;border:1px solid rgba(255,194,75,.45);background:rgba(255,194,75,.1);color:var(--gold);cursor:pointer}
|
||||
.buy.pol{border-color:rgba(52,211,153,.45);background:rgba(52,211,153,.1);color:var(--ok)}
|
||||
.buy.own{border-color:rgba(52,211,153,.45);background:rgba(52,211,153,.1);color:var(--ok);pointer-events:none}
|
||||
.buy.no{opacity:.4;pointer-events:none}
|
||||
.led{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:var(--ink2);padding:7px 2px;border-top:1px solid var(--line)}.led:first-child{border-top:0}.led .m{font:700 12px var(--mono);color:var(--gold);white-space:nowrap}.led .m.ok{color:var(--ok)}.led .m.neg{color:var(--sig)}.led a{color:var(--cyan2)}
|
||||
.prog{height:8px;background:rgba(255,255,255,.08);border-radius:4px;overflow:hidden;margin-top:8px}.prog i{display:block;height:100%;background:linear-gradient(90deg,var(--cyan),var(--gold));box-shadow:0 0 10px rgba(255,194,75,.5)}
|
||||
.toast{position:absolute;left:50%;bottom:calc(70px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:20;background:var(--panel2);border:1px solid var(--line);color:var(--ink);font-size:12px;padding:8px 12px;border-radius:10px;opacity:0;transition:opacity .2s;pointer-events:none;max-width:92%;text-align:center}
|
||||
.toast.on{opacity:1}
|
||||
.tapdesk{position:absolute;bottom:calc(14px + env(safe-area-inset-bottom,0px));left:14px;z-index:5;font:600 10px var(--body);letter-spacing:.14em;text-transform:uppercase;color:var(--muted);pointer-events:none}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="frame"><div class="phone" id="phone">
|
||||
<canvas id="game"></canvas>
|
||||
<div class="hud" id="hud">
|
||||
<div class="st gold"><small>Drips</small><span id="hDrips">0</span></div>
|
||||
<div class="st cy"><small>Chapter</small><span id="hChap">1</span></div>
|
||||
<div class="st r"><small>Best</small><span id="hBest">0</span></div>
|
||||
<div class="fuel" id="fuel"><i id="fuelBar"></i></div>
|
||||
<div class="goal"><span>Chapter goal</span><span><b id="hGoalN">0</b> / <span id="hGoal">20</span> drips</span></div>
|
||||
</div>
|
||||
<div class="pill" id="pill"></div>
|
||||
<div class="tapdesk" id="tapdesk" hidden>tap · click · space</div>
|
||||
<button class="mute" id="mute" type="button" title="Sound">♪</button>
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<div class="ov lobby" id="ovLobby" hidden>
|
||||
<div><div class="logo">Drip<span>Runner</span></div><div class="tag">Hop the network. Bank the drips. Get paid in POL.</div></div>
|
||||
<div>
|
||||
<div class="stats">
|
||||
<div class="stat"><small>Chapter</small><b class="cy" id="lChap">1</b></div>
|
||||
<div class="stat"><small>Drips</small><b class="gold" id="lDrips">0</b></div>
|
||||
<div class="stat"><small>Balance</small><b class="ok" id="lPol">0.000</b></div>
|
||||
</div>
|
||||
<div class="pool" id="lPool"></div>
|
||||
<button class="btn" id="bPlay" type="button">Play</button>
|
||||
<div class="row2"><button class="btn ghost" id="bHangar" type="button">Hangar</button><button class="btn ghost" id="bBalance" type="button">Balance</button></div>
|
||||
<div class="member" id="lMember"><i></i>connecting…</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ov" id="ovLoad"><div class="card"><div class="eyebrow">Drip Runner</div><h2 id="loadTitle">Connecting…</h2><p id="loadText">Checking your InstantAdPay sign-in.</p><a class="btn" id="loadBtn" href="/" hidden>Tester page</a></div></div>
|
||||
|
||||
<div class="ov" id="ovClear" hidden><div class="card">
|
||||
<div class="eyebrow" id="cEyebrow">Chapter cleared</div><h2 id="cTitle">Banked 20 drips</h2>
|
||||
<div class="big" id="cBig">+0.010<small>POL</small></div><p id="cText"></p><span class="chip ok" id="cChip"></span>
|
||||
<button class="btn gold" id="bNext" type="button">Next chapter</button><button class="btn ghost" id="bLobby1" type="button">Back to lobby</button>
|
||||
</div></div>
|
||||
|
||||
<div class="ov" id="ovOver" hidden><div class="card">
|
||||
<div class="eyebrow" id="oEyebrow">Out of fuel</div><h2 id="oTitle">Run over</h2><p id="oText"></p>
|
||||
<button class="btn sig" id="bRefuel" type="button">Refuel · sponsor page</button><span class="chip sig" id="oChip">verified visit on InstantAdPay · pays your fuel</span>
|
||||
<div class="row2"><button class="btn ghost" id="bRestart" type="button">Restart</button><button class="btn ghost" id="bLobby2" type="button">Lobby</button></div>
|
||||
</div></div>
|
||||
|
||||
<div class="ov" id="ovHangar" hidden><div class="sheet">
|
||||
<h3>Hangar <span class="bal" id="hgBal"></span></h3>
|
||||
<div class="item" id="itMagnet"><div class="ic gold"><i></i></div><div><b>Drip magnet</b><small>pulls drips toward you, whole next run</small></div><button class="buy" data-buy="magnet" type="button"></button></div>
|
||||
<div class="item" id="itShip"><div class="ic"><i></i></div><div><b>Courier Mk II</b><small>lighter hull, tighter hops, gold trail</small></div><button class="buy" data-buy="ship" type="button"></button></div>
|
||||
<div class="item" id="itShield"><div class="ic sig"><i></i></div><div><b>Shield core</b><small>survive one hit next run · paid from your POL balance</small></div><button class="buy pol" data-buy="shield" type="button"></button></div>
|
||||
<div class="item" id="itSlow"><div class="ic vi"><i></i></div><div><b>Slow field</b><small>bots crawl for the first 15 s · paid from your POL balance</small></div><button class="buy pol" data-buy="slow" type="button"></button></div>
|
||||
<p style="font-size:11px;color:var(--muted);margin:4px 2px 0">POL spent here goes back into the pool that pays everyone's chapter drips.</p>
|
||||
<button class="btn ghost" id="bLobby3" type="button">Back</button>
|
||||
</div></div>
|
||||
|
||||
<div class="ov" id="ovBal" hidden><div class="sheet">
|
||||
<h3>Balance</h3>
|
||||
<div class="card" style="padding:14px;text-align:left"><div class="eyebrow">Game balance</div><div class="big" style="font-size:36px;margin:4px 0 0"><span id="bPol">0.000</span><small>POL</small></div><p id="bNote"></p><div class="prog"><i id="bProg" style="width:0%"></i></div></div>
|
||||
<div id="ledger"></div>
|
||||
<p style="font-size:11px;color:var(--muted);margin:4px 2px 0" id="bWallet"></p>
|
||||
<button class="btn ghost" id="bLobby4" type="button">Back</button>
|
||||
</div></div>
|
||||
</div></div>
|
||||
<script src="/spawn.js"></script>
|
||||
<script src="/play.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
/* Drip Runner client. The server owns the run (seed, drip claims, chapter clears, money);
|
||||
this file draws it, takes taps, and reports what happened. */
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (id) { return document.getElementById(id); };
|
||||
var canvas = $('game'), ctx = canvas.getContext('2d');
|
||||
var W = 390, H = 760, DPR = 1, floorY = H - DRSpawn.FLOOR;
|
||||
var player = { x: 100, y: 300, vy: 0, r: 13, tilt: 0 };
|
||||
var ME = null, P = null, BAL = null, POOL = null, IAP = 'https://instantadpay.com';
|
||||
var R = null; // the live run
|
||||
var muted = false; try { muted = localStorage.getItem('dr.muted') === '1'; } catch (e) {}
|
||||
|
||||
function api(path, body) {
|
||||
return fetch(path, body ? { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) } : {}).then(function (r) { return r.json().then(function (j) { j._status = r.status; return j; }); });
|
||||
}
|
||||
function resize() { var r = $('phone').getBoundingClientRect(); W = Math.max(300, Math.round(r.width)); H = Math.max(500, Math.round(r.height)); DPR = Math.min(2, window.devicePixelRatio || 1); canvas.width = W * DPR; canvas.height = H * DPR; ctx.setTransform(DPR, 0, 0, DPR, 0, 0); floorY = H - DRSpawn.FLOOR; player.x = W * DRSpawn.PX; buildLayers(); }
|
||||
window.addEventListener('resize', resize);
|
||||
|
||||
/* ---------- audio ---------- */
|
||||
var AC = null; function ac() { if (muted) return null; try { if (!AC) AC = new (window.AudioContext || window.webkitAudioContext)(); if (AC.state === 'suspended') AC.resume(); return AC; } catch (e) { return null; } }
|
||||
function tone(f, d, type, g, slide) { var a = ac(); if (!a) return; var o = a.createOscillator(), v = a.createGain(); o.type = type || 'square'; o.frequency.setValueAtTime(f, a.currentTime); if (slide) o.frequency.exponentialRampToValueAtTime(slide, a.currentTime + d); v.gain.setValueAtTime(g || .05, a.currentTime); v.gain.exponentialRampToValueAtTime(.0001, a.currentTime + d); o.connect(v); v.connect(a.destination); o.start(); o.stop(a.currentTime + d); }
|
||||
var sfx = { hop: function () { tone(300, .09, 'square', .04, 520); }, coin: function () { tone(880, .08, 'sine', .05, 1320); setTimeout(function () { tone(1320, .1, 'sine', .04, 1760); }, 40); }, crash: function () { tone(180, .35, 'sawtooth', .08, 40); }, clear: function () { [523, 659, 784, 1047].forEach(function (f, i) { setTimeout(function () { tone(f, .18, 'triangle', .06); }, i * 90); }); }, shield: function () { tone(200, .2, 'triangle', .06, 600); }, buy: function () { tone(660, .08, 'sine', .04, 990); } };
|
||||
$('mute').textContent = muted ? '×' : '♪';
|
||||
$('mute').addEventListener('click', function () { muted = !muted; try { localStorage.setItem('dr.muted', muted ? '1' : '0'); } catch (e) {} $('mute').textContent = muted ? '×' : '♪'; });
|
||||
|
||||
/* ---------- sprites ---------- */
|
||||
function sprite(sz, draw) { var c = document.createElement('canvas'); c.width = sz * 2; c.height = sz * 2; var x = c.getContext('2d'); x.scale(2, 2); draw(x, sz); return c; }
|
||||
var dripSpr = sprite(36, function (x, s) { var c = s / 2; var g = x.createRadialGradient(c, c, 2, c, c, c); g.addColorStop(0, 'rgba(255,194,75,.9)'); g.addColorStop(.35, 'rgba(255,194,75,.35)'); g.addColorStop(1, 'rgba(255,194,75,0)'); x.fillStyle = g; x.fillRect(0, 0, s, s); var d = x.createRadialGradient(c - 3, c - 3, 1, c, c, 8); d.addColorStop(0, '#FFF4CC'); d.addColorStop(.5, '#FFC24B'); d.addColorStop(1, '#D97706'); x.fillStyle = d; x.beginPath(); x.arc(c, c, 8, 0, 6.283); x.fill(); x.strokeStyle = 'rgba(255,255,255,.7)'; x.lineWidth = 1.2; x.beginPath(); x.arc(c, c, 5.5, 3.6, 5.2); x.stroke(); });
|
||||
var botSpr = sprite(56, function (x, s) { var c = s / 2; var g = x.createRadialGradient(c, c, 4, c, c, c); g.addColorStop(0, 'rgba(255,59,122,.7)'); g.addColorStop(.4, 'rgba(255,59,122,.25)'); g.addColorStop(1, 'rgba(255,59,122,0)'); x.fillStyle = g; x.fillRect(0, 0, s, s); x.translate(c, c); x.fillStyle = '#FF3B7A'; for (var i = 0; i < 4; i++) { x.rotate(Math.PI / 2); x.beginPath(); x.moveTo(0, -9); x.lineTo(5, -20); x.lineTo(-5, -20); x.closePath(); x.fill(); } var b = x.createLinearGradient(-10, -10, 10, 10); b.addColorStop(0, '#FF7AA6'); b.addColorStop(1, '#B3123F'); x.fillStyle = b; x.fillRect(-10, -10, 20, 20); x.fillStyle = '#070C18'; x.fillRect(-5, -5, 10, 10); x.fillStyle = '#FFE1EB'; x.fillRect(-2, -2, 4, 4); });
|
||||
function shipSpr(gold) { return sprite(64, function (x, s) { var c = s / 2; x.translate(c, c); var glow = gold ? '255,194,75' : '34,211,238'; var g = x.createRadialGradient(0, 0, 4, 0, 0, c); g.addColorStop(0, 'rgba(' + glow + ',.55)'); g.addColorStop(1, 'rgba(' + glow + ',0)'); x.fillStyle = g; x.fillRect(-c, -c, s, s); var h = x.createLinearGradient(0, -10, 0, 10); h.addColorStop(0, '#FFFFFF'); h.addColorStop(.5, '#DCE6F5'); h.addColorStop(1, '#8FA3C4'); x.fillStyle = h; x.beginPath(); x.moveTo(-16, -8); x.lineTo(10, -9); x.quadraticCurveTo(22, -6, 22, 0); x.quadraticCurveTo(22, 6, 10, 9); x.lineTo(-16, 8); x.quadraticCurveTo(-20, 0, -16, -8); x.fill(); x.fillStyle = gold ? '#FFC24B' : '#22D3EE'; x.beginPath(); x.arc(9, 0, 4, 0, 6.283); x.fill(); x.fillStyle = '#fff'; x.beginPath(); x.arc(8, -1, 1.5, 0, 6.283); x.fill(); x.fillStyle = gold ? '#E08A00' : '#0EA5C9'; x.fillRect(-14, -3, 8, 6); x.fillStyle = '#4E5F7A'; x.fillRect(-12, -12, 10, 4); x.fillRect(-12, 8, 10, 4); }); }
|
||||
var shipA = shipSpr(false), shipB = shipSpr(true);
|
||||
|
||||
/* ---------- background layers ---------- */
|
||||
var stars = [], nodes = [], cols = [];
|
||||
function buildLayers() { stars = []; for (var i = 0; i < 70; i++) stars.push({ x: Math.random() * W, y: Math.random() * (H - 60), s: Math.random() * 1.4 + .3, a: Math.random() }); nodes = []; for (var j = 0; j < 14; j++) nodes.push({ x: Math.random() * W, y: 80 + Math.random() * (H - 200), r: 2 + Math.random() * 2 }); cols = []; for (var k = 0; k < 6; k++) cols.push({ x: Math.random() * W, w: 30 + Math.random() * 60, h: 40 + Math.random() * 90, a: .05 + Math.random() * .08 }); }
|
||||
|
||||
/* ---------- ui helpers ---------- */
|
||||
function hideAll() { ['ovLobby', 'ovClear', 'ovOver', 'ovHangar', 'ovBal', 'ovLoad'].forEach(function (id) { $(id).hidden = true; }); }
|
||||
function show(id) { hideAll(); $(id).hidden = false; }
|
||||
var toastT = null; function toast(m) { $('toast').textContent = m; $('toast').classList.add('on'); clearTimeout(toastT); toastT = setTimeout(function () { $('toast').classList.remove('on'); }, 2600); }
|
||||
function pill(m) { var p = $('pill'); p.textContent = m; p.classList.remove('on'); void p.offsetWidth; p.classList.add('on'); setTimeout(function () { p.classList.remove('on'); }, 900); }
|
||||
var hudCache = {}; function setHud() { if (!R) return; var v = { d: R.drips, c: R.chapter, b: Math.max(P.best, R.drips), g: R.chapDrips, gg: R.goal }; if (v.d !== hudCache.d) $('hDrips').textContent = v.d; if (v.c !== hudCache.c) $('hChap').textContent = v.c; if (v.b !== hudCache.b) $('hBest').textContent = v.b; if (v.g !== hudCache.g) $('hGoalN').textContent = v.g; if (v.gg !== hudCache.gg) $('hGoal').textContent = v.gg; hudCache = v; $('fuelBar').style.width = Math.max(0, R.fuel) + '%'; $('fuel').classList.toggle('low', R.fuel < 22); }
|
||||
function f3(n) { return Number(n || 0).toFixed(3); }
|
||||
|
||||
/* ---------- lobby / me ---------- */
|
||||
function loadMe() { return api('/api/me').then(function (r) { if (r._status !== 200) throw r; ME = r.me; P = r.player; BAL = r.balance; POOL = r.pool; IAP = r.iap || IAP; return r; }); }
|
||||
function lobby() {
|
||||
R = null; $('hud').classList.remove('on'); $('tapdesk').hidden = true;
|
||||
$('lChap').textContent = P.chapter; $('lDrips').textContent = P.bank.toLocaleString(); $('lPol').textContent = f3(BAL.unpaid);
|
||||
$('lPool').innerHTML = 'POL pool <b>' + f3(POOL.available) + '</b> · today’s cap left <b>' + f3(POOL.capLeft) + '</b> · a chapter drip is <b>' + f3(POOL.dripPol) + '</b>';
|
||||
$('lMember').innerHTML = '<i class="' + (ME.wallet ? '' : 'no') + '"></i>InstantAdPay · ' + (ME.username ? '@' + ME.username : '#' + ME.memberId) + ' · ' + (ME.wallet ? ME.wallet.slice(0, 6) + '…' + ME.wallet.slice(-4) : 'no wallet on file');
|
||||
show('ovLobby');
|
||||
}
|
||||
|
||||
/* ---------- the run ---------- */
|
||||
function newRun() {
|
||||
ac();
|
||||
return api('/api/run/start', { W: W, H: H }).then(function (r) {
|
||||
if (r._status !== 200) { toast(r.error || 'Could not start a run.'); return; }
|
||||
R = { id: r.runId, seed: r.seed, speed: r.speed, chapter: r.chapter, goal: r.goal, on: true, paused: false, t: 0, dist: 0, drips: 0, chapDrips: 0, fuel: 100, ents: [], parts: [], shake: 0, inv: 2, shield: !!r.armed.shield, magnet: !!r.armed.magnet, slow: r.armed.slow ? 15 : 0, ship: r.ship, refuels: 0, pending: [], consumed: { d: 0, b: 0, g: 0 }, lastFlush: 0, W: W, H: H };
|
||||
makeGens(); player.y = floorY - 120; player.vy = 0; hudCache = {}; setHud(); $('hud').classList.add('on'); $('tapdesk').hidden = !matchMedia('(min-width:700px)').matches; hideAll();
|
||||
if (R.magnet) toast('Drip magnet on'); if (R.shield) toast('Shield core armed');
|
||||
});
|
||||
}
|
||||
function makeGens() { R.gen = { d: DRSpawn.drips(R.seed, R.W, R.H), b: DRSpawn.bots(R.seed, R.chapter, R.H), g: DRSpawn.gates(R.seed, R.chapter, R.H) }; R.next = { d: R.gen.d(), b: R.gen.b(), g: R.gen.g() }; for (var i = 0; i < R.consumed.d; i++) R.next.d = R.gen.d(); for (var j = 0; j < R.consumed.b; j++) R.next.b = R.gen.b(); for (var k = 0; k < R.consumed.g; k++) R.next.g = R.gen.g(); }
|
||||
function spawn() {
|
||||
while (R.next.d.t <= R.t) { var g = R.next.d; for (var i = 0; i < g.drips.length; i++) { var d = g.drips[i]; R.ents.push({ k: 'd', i: d.i, x: d.x0 - (R.t - g.t) * R.speed, y: d.y, r: 9, ph: Math.random() * 6 }); } R.next.d = R.gen.d(); R.consumed.d++; }
|
||||
while (R.next.b.t <= R.t) { var b = R.next.b; R.ents.push({ k: 'b', x: R.W + 60 - (R.t - b.t) * R.speed, y: b.y, r: 15, amp: b.amp, ph: b.ph, rot: 0 }); R.next.b = R.gen.b(); R.consumed.b++; }
|
||||
while (R.next.g.t <= R.t) { var q = R.next.g; if (R.chapter >= 2) R.ents.push({ k: 'g', x: R.W + 60 - (R.t - q.t) * R.speed, y: q.y, gap: q.gap, w: 34 }); R.next.g = R.gen.g(); R.consumed.g++; }
|
||||
}
|
||||
function hop() { if (!R || !R.on || R.paused) return; player.vy = -(R.ship === 2 ? 500 : 520); sfx.hop(); burst(player.x - 12, player.y + 4, 4, R.ship === 2 ? '255,194,75' : '34,211,238', 60); }
|
||||
canvas.addEventListener('pointerdown', function (e) { e.preventDefault(); ac(); hop(); });
|
||||
window.addEventListener('keydown', function (e) { if (e.code === 'Space' || e.code === 'ArrowUp') { if (R && R.on && !R.paused) { e.preventDefault(); hop(); } } });
|
||||
function burst(x, y, n, rgb, sp) { if (!R) return; for (var i = 0; i < n; i++) { var a = Math.random() * 6.283, s = sp * (.4 + Math.random()); R.parts.push({ x: x, y: y, vx: Math.cos(a) * s, vy: Math.sin(a) * s, l: .5 + Math.random() * .4, c: rgb, r: 1.5 + Math.random() * 2 }); } }
|
||||
|
||||
function flush(goal) {
|
||||
if (!R) return Promise.resolve({});
|
||||
var evs = R.pending; R.pending = []; R.lastFlush = R.t;
|
||||
if (!evs.length && !goal) return Promise.resolve({});
|
||||
return api('/api/run/events', { runId: R.id, t: R.t, events: evs, goal: !!goal }).then(function (r) {
|
||||
if (r._status !== 200) { if (r.over && R) { R.on = false; } toast(r.error || 'Sync problem'); return r; }
|
||||
if (R) { R.drips = r.drips; R.chapDrips = r.chapDrips; R.goal = r.goal; if (r.refused) toast('Server refused ' + r.refused + ' drip' + (r.refused > 1 ? 's' : '') + ' (' + (r.why || []).join(',') + ')'); }
|
||||
return r;
|
||||
}).catch(function () { R && (R.pending = evs.concat(R.pending)); return {}; });
|
||||
}
|
||||
|
||||
function update(dt) {
|
||||
if (!R || !R.on || R.paused) return; R.t += dt; var sp = R.speed; R.dist += sp * dt; if (R.slow > 0) R.slow -= dt; if (R.inv > 0) R.inv -= dt;
|
||||
R.fuel -= dt * 2.4; if (R.fuel <= 0) { R.fuel = 0; return over('Out of fuel', 'The tank is dry.'); }
|
||||
player.vy += 1500 * dt; if (player.vy > 900) player.vy = 900; player.y += player.vy * dt;
|
||||
if (player.y > floorY - player.r) { player.y = floorY - player.r; if (player.vy > 200) burst(player.x, player.y + 8, 3, '34,211,238', 40); player.vy = 0; }
|
||||
if (player.y < 70) { player.y = 70; player.vy = 0; }
|
||||
player.tilt += ((player.vy / 900) * .6 - player.tilt) * Math.min(1, dt * 10);
|
||||
spawn();
|
||||
var ents = R.ents, i;
|
||||
for (i = ents.length - 1; i >= 0; i--) { var e = ents[i]; var es = e.k === 'b' && R.slow > 0 ? sp * .45 : sp; e.x -= es * dt;
|
||||
if (e.k === 'd') { e.ph += dt * 4; if (R.magnet) { var dx = player.x - e.x, dy = player.y - e.y, dd = Math.hypot(dx, dy); if (dd < 150) { e.x += dx / dd * 420 * dt; e.y += dy / dd * 420 * dt; } }
|
||||
if (Math.hypot(player.x - e.x, player.y - e.y) < player.r + e.r + 2) { ents.splice(i, 1); R.drips++; R.chapDrips++; R.fuel = Math.min(100, R.fuel + 3.5); sfx.coin(); burst(e.x, e.y, 8, '255,194,75', 140); R.pending.push({ k: 'd', i: e.i, t: Math.round(R.t * 1000) / 1000 });
|
||||
if (R.chapDrips >= R.goal) return cleared(); continue; } }
|
||||
if (e.k === 'b') { e.rot += dt * 3; var by = e.y + (e.amp ? Math.sin(R.t * 2 + e.ph) * e.amp : 0); e.cy = by; if (R.inv <= 0 && Math.hypot(player.x - e.x, player.y - by) < player.r + e.r - 2) { if (R.shield) { R.shield = false; R.inv = 1.5; ents.splice(i, 1); sfx.shield(); burst(e.x, by, 20, '255,106,26', 220); pill('Shield!'); R.shake = .25; continue; } return crash(e.x, by); } }
|
||||
if (e.k === 'g') { if (R.inv <= 0 && player.x + player.r > e.x && player.x - player.r < e.x + e.w && (player.y - player.r < e.y || player.y + player.r > e.y + e.gap)) { if (R.shield) { R.shield = false; R.inv = 1.5; sfx.shield(); pill('Shield!'); R.shake = .25; } else return crash(player.x, player.y); } }
|
||||
if (e.x < -90) ents.splice(i, 1); }
|
||||
var ps = R.parts; for (i = ps.length - 1; i >= 0; i--) { var p = ps[i]; p.l -= dt; p.x += p.vx * dt; p.y += p.vy * dt; p.vy += 300 * dt; if (p.l <= 0) ps.splice(i, 1); }
|
||||
if (R.shake > 0) R.shake -= dt;
|
||||
if (Math.random() < .9) R.parts.push({ x: player.x - 16, y: player.y + (Math.random() - .5) * 6, vx: -sp * .5 - 40, vy: (Math.random() - .5) * 30, l: .3, c: R.ship === 2 ? '255,194,75' : '34,211,238', r: 2 + Math.random() * 2 });
|
||||
if (R.t - R.lastFlush > 2.5 && R.pending.length) flush(false);
|
||||
setHud();
|
||||
}
|
||||
function crash(x, y) { sfx.crash(); burst(x, y, 36, '255,59,122', 260); burst(x, y, 14, '255,255,255', 160); R.shake = .5; over('Courier hit', 'A bot got you.'); }
|
||||
function over(title, why) {
|
||||
R.paused = true; flush(false);
|
||||
setTimeout(function () { if (!R) return; $('oEyebrow').textContent = title; $('oTitle').textContent = 'Run over at ' + R.drips; $('oText').textContent = why + ' Refuel with a sponsor visit and keep this run, drips and chapter progress intact.'; $('bRefuel').hidden = false; $('oChip').hidden = false; show('ovOver'); }, 450);
|
||||
}
|
||||
function cleared() {
|
||||
R.paused = true; pill('Verifying…');
|
||||
flush(true).then(function (r) {
|
||||
if (!R) return;
|
||||
if (!r.cleared) { R.paused = false; if (r.short) toast('Server count says ' + r.short + ' more to go'); return; }
|
||||
var c = r.cleared; sfx.clear(); burst(player.x, player.y, 40, '255,194,75', 220);
|
||||
$('cEyebrow').textContent = 'Chapter ' + c.chapter + ' cleared'; $('cTitle').textContent = 'Banked ' + (R.goal) + ' drips';
|
||||
var m = Math.floor(c.playTime / 60), s = c.playTime % 60; var tm = m + ':' + (s < 10 ? '0' : '') + s;
|
||||
$('cBig').innerHTML = '+' + f3(c.pol) + '<small>POL</small>'; $('cBig').classList.toggle('dim', !c.pol);
|
||||
var why = { paid: 'First clear, verified. Added to your game balance.', replay: c.first ? 'Verified.' : 'You cleared this one before. Only the first clear pays.', pool: 'The POL pool is empty right now. Refuel visits fill it, so this clear counts but pays nothing.', cap: 'Today’s pool cap is spent. Chapter counts, no POL today.', flagged: 'This run was flagged by the server check, so it pays nothing.' };
|
||||
$('cText').textContent = why[c.reason] || ''; $('cChip').className = 'chip ' + (c.pol ? 'ok' : 'sig'); $('cChip').textContent = (c.pol ? 'verified' : c.reason) + ' · ' + tm + ' play time';
|
||||
R.chapter = c.next; R.goal = c.nextGoal; R.chapDrips = 0; if (r.pool != null) POOL.available = r.pool;
|
||||
setTimeout(function () { show('ovClear'); }, 500);
|
||||
});
|
||||
}
|
||||
$('bNext').addEventListener('click', function () { if (!R) return; R.paused = false; R.inv = 1.5; hideAll(); });
|
||||
$('bRestart').addEventListener('click', function () { endRun().then(newRun); });
|
||||
function endRun() { var id = R && R.id; R = null; hideAll(); return id ? api('/api/run/end', { runId: id }).catch(function () {}) : Promise.resolve(); }
|
||||
['bLobby1', 'bLobby2'].forEach(function (id) { $(id).addEventListener('click', function () { endRun().then(loadMe).then(lobby); }); });
|
||||
['bLobby3', 'bLobby4'].forEach(function (id) { $(id).addEventListener('click', function () { loadMe().then(lobby); }); });
|
||||
$('bPlay').addEventListener('click', function () { newRun(); });
|
||||
|
||||
/* ---------- refuel: hand the run to InstantAdPay and come back ---------- */
|
||||
function snapshot(nonce) {
|
||||
var s = { runId: R.id, nonce: nonce, seed: R.seed, speed: R.speed, chapter: R.chapter, goal: R.goal, t: R.t, dist: R.dist, drips: R.drips, chapDrips: R.chapDrips, ents: R.ents.map(function (e) { var o = {}; for (var k in e) if (k !== 'cy') o[k] = e[k]; return o; }), consumed: R.consumed, y: player.y, shield: R.shield, magnet: R.magnet, slow: R.slow, ship: R.ship, refuels: R.refuels, pending: R.pending, W: R.W, H: R.H, at: Date.now() };
|
||||
try { sessionStorage.setItem('dr.snap', JSON.stringify(s)); } catch (e) {}
|
||||
}
|
||||
$('bRefuel').addEventListener('click', function () {
|
||||
if (!R) return; $('bRefuel').disabled = true;
|
||||
api('/api/refuel/start', { runId: R.id }).then(function (r) {
|
||||
$('bRefuel').disabled = false;
|
||||
if (r._status !== 200) return toast(r.error || 'Refuel is not available right now.');
|
||||
snapshot(r.nonce); location.href = r.url;
|
||||
});
|
||||
});
|
||||
function tryResume(q) {
|
||||
var snap = null; try { snap = JSON.parse(sessionStorage.getItem('dr.snap') || 'null'); } catch (e) {}
|
||||
if (!snap || snap.runId !== q.get('resume')) { toast('That run could not be restored.'); return lobby(); }
|
||||
return api('/api/refuel/resume', { runId: snap.runId, nonce: q.get('n') || snap.nonce, receipt: q.get('r') || '', none: q.get('none') === '1' }).then(function (r) {
|
||||
try { sessionStorage.removeItem('dr.snap'); } catch (e) {}
|
||||
R = { id: snap.runId, seed: snap.seed, speed: snap.speed, chapter: snap.chapter, goal: snap.goal, on: true, paused: true, t: snap.t, dist: snap.dist, drips: snap.drips, chapDrips: snap.chapDrips, fuel: 0, ents: snap.ents, parts: [], shake: 0, inv: 3, shield: snap.shield, magnet: snap.magnet, slow: snap.slow, ship: snap.ship, refuels: snap.refuels, pending: snap.pending || [], consumed: snap.consumed, lastFlush: snap.t, W: snap.W, H: snap.H };
|
||||
if (R.W !== W || R.H !== H) { var sx = W / R.W, sy = H / R.H; R.ents.forEach(function (e) { e.x *= sx; e.y *= sy; }); }
|
||||
makeGens(); player.y = snap.y; player.vy = 0; hudCache = {}; $('hud').classList.add('on'); hideAll();
|
||||
if (!r.ok) { $('oEyebrow').textContent = r.reason === 'none' ? 'No sponsor pages right now' : 'Visit not verified'; $('oTitle').textContent = 'Run over at ' + R.drips; $('oText').textContent = r.reason === 'none' ? 'InstantAdPay had no verified-visit page for you at the moment. Restart, or try refuelling again later.' : 'The visit did not complete, so the tank stays empty. Refuel again or restart.'; $('bRefuel').hidden = r.reason === 'none'; $('oChip').hidden = r.reason === 'none'; setHud(); return show('ovOver'); }
|
||||
R.fuel = 100; R.refuels++; R.ents = R.ents.filter(function (e) { return e.k === 'd' || e.x > player.x + 260; }); if (r.pool != null) POOL.available = r.pool;
|
||||
setHud(); var n = 3; pill('Refuelled · ' + n); var iv = setInterval(function () { n--; if (n <= 0) { clearInterval(iv); pill('Go'); if (R) R.paused = false; if (R && R.pending.length) flush(false); } else pill('' + n); }, 800);
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- hangar / balance ---------- */
|
||||
function hangar() {
|
||||
show('ovHangar'); $('hgBal').textContent = P.bank.toLocaleString() + ' drips · ' + f3(BAL.unpaid) + ' POL';
|
||||
var pr = P.prices;
|
||||
set('itMagnet', 'magnet', P.items.magnet, P.bank >= pr.drips.magnet, pr.drips.magnet + ' drips', 'armed');
|
||||
set('itShip', 'ship', P.items.ship, P.bank >= pr.drips.ship, pr.drips.ship + ' drips', 'owned');
|
||||
set('itShield', 'shield', P.items.shield, BAL.unpaid >= pr.pol.shield, f3(pr.pol.shield) + ' POL', 'armed');
|
||||
set('itSlow', 'slow', P.items.slow, BAL.unpaid >= pr.pol.slow, f3(pr.pol.slow) + ' POL', 'armed');
|
||||
function set(id, key, own, can, label, ownLabel) { var it = $(id), b = it.querySelector('.buy'); it.classList.toggle('owned', !!own); b.className = 'buy' + (/POL/.test(label) ? ' pol' : '') + (own ? ' own' : (can ? '' : ' no')); b.textContent = own ? ownLabel : label; }
|
||||
}
|
||||
$('ovHangar').addEventListener('click', function (e) { var b = e.target.closest('[data-buy]'); if (!b) return; b.disabled = true;
|
||||
api('/api/hangar/buy', { item: b.dataset.buy }).then(function (r) { b.disabled = false; if (r._status !== 200) return toast(r.error || 'Could not buy that.'); P = r.player; BAL = r.balance; sfx.buy(); toast('Paid ' + r.paid); hangar(); }); });
|
||||
function balance() {
|
||||
show('ovBal'); api('/api/balance').then(function (b) { BAL = b;
|
||||
$('bPol').textContent = f3(b.unpaid); var pct = Math.min(100, b.unpaid / b.threshold * 100); $('bProg').style.width = pct + '%';
|
||||
$('bNote').textContent = 'Pays to your wallet at ' + b.threshold + ' POL. ' + pct.toFixed(0) + '% of the way. Paid so far: ' + f3(b.paidTotal) + ' POL.';
|
||||
var h = ''; if (!b.history.length) h = '<div class="led"><span>No drips yet. Clear a chapter.</span><span class="m">0.000</span></div>';
|
||||
b.history.forEach(function (l) { var cls = l.kind === 'payout' ? (l.status === 'paid' ? 'm ok' : l.status === 'failed' ? 'm neg' : 'm') : (l.pol < 0 ? 'm neg' : 'm'); h += '<div class="led"><span>' + esc(l.label) + (l.tx ? ' · <a href="https://polygonscan.com/tx/' + esc(l.tx) + '" target="_blank" rel="noopener">tx</a>' : '') + '</span><span class="' + cls + '">' + (l.kind === 'payout' ? '' : (l.pol < 0 ? '' : '+')) + f3(l.pol) + '</span></div>'; });
|
||||
$('ledger').innerHTML = h;
|
||||
$('bWallet').textContent = b.wallet ? 'Wallet: ' + b.wallet + ' (from your InstantAdPay account).' : 'No wallet on your InstantAdPay account yet. Link one there or payouts cannot be sent.';
|
||||
});
|
||||
}
|
||||
function esc(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]; }); }
|
||||
$('bHangar').addEventListener('click', hangar); $('bBalance').addEventListener('click', balance);
|
||||
|
||||
/* ---------- draw ---------- */
|
||||
function draw() {
|
||||
ctx.clearRect(0, 0, W, H); var t = R ? R.t : performance.now() / 1000, dist = R ? R.dist : performance.now() * .05;
|
||||
var bg = ctx.createLinearGradient(0, 0, 0, H); bg.addColorStop(0, '#03060E'); bg.addColorStop(.6, '#0A1327'); bg.addColorStop(1, '#101C3C'); ctx.fillStyle = bg; ctx.fillRect(0, 0, W, H);
|
||||
var s2 = ctx.createRadialGradient(W * .5, H * .85, 10, W * .5, H * .85, W * .9); s2.addColorStop(0, 'rgba(34,211,238,.12)'); s2.addColorStop(1, 'rgba(34,211,238,0)'); ctx.fillStyle = s2; ctx.fillRect(0, 0, W, H);
|
||||
ctx.save(); if (R && R.shake > 0) ctx.translate((Math.random() - .5) * R.shake * 24, (Math.random() - .5) * R.shake * 24);
|
||||
var i; for (i = 0; i < stars.length; i++) { var st = stars[i]; var sx = ((st.x - dist * .15) % W + W) % W; ctx.globalAlpha = .35 + .5 * Math.abs(Math.sin(t * 1.5 + st.a * 6)); ctx.fillStyle = '#CFE3FF'; ctx.fillRect(sx, st.y, st.s, st.s); } ctx.globalAlpha = 1;
|
||||
for (i = 0; i < cols.length; i++) { var c = cols[i]; var cx = ((c.x - dist * .3) % (W + 120) + W + 120) % (W + 120) - 60; ctx.fillStyle = 'rgba(31,111,235,' + c.a + ')'; ctx.fillRect(cx, floorY - c.h, c.w, c.h); ctx.fillStyle = 'rgba(143,240,255,' + c.a * 1.5 + ')'; for (var wy = floorY - c.h + 8; wy < floorY - 6; wy += 12) for (var wx = cx + 5; wx < cx + c.w - 5; wx += 10) if (((wx * 7 + wy * 3) | 0) % 5 < 2) ctx.fillRect(wx, wy, 4, 5); }
|
||||
ctx.lineWidth = 1; for (i = 0; i < nodes.length; i++) { var n = nodes[i]; n.sx = ((n.x - dist * .55) % (W + 80) + W + 80) % (W + 80) - 40; }
|
||||
for (i = 0; i < nodes.length; i++) { var a = nodes[i]; for (var j = i + 1; j < nodes.length; j++) { var b = nodes[j], dd = Math.hypot(a.sx - b.sx, a.y - b.y); if (dd < 150) { ctx.strokeStyle = 'rgba(34,211,238,' + (0.16 * (1 - dd / 150)) + ')'; ctx.beginPath(); ctx.moveTo(a.sx, a.y); ctx.lineTo(b.sx, b.y); ctx.stroke(); } } }
|
||||
for (i = 0; i < nodes.length; i++) { var q = nodes[i]; ctx.fillStyle = 'rgba(143,240,255,.5)'; ctx.beginPath(); ctx.arc(q.sx, q.y, q.r, 0, 6.283); ctx.fill(); }
|
||||
ctx.strokeStyle = 'rgba(34,211,238,.08)'; var gx = -(dist * .8 % 44); for (var x = gx; x < W; x += 44) { ctx.beginPath(); ctx.moveTo(x, 60); ctx.lineTo(x, floorY); ctx.stroke(); } for (var y = 60; y < floorY; y += 44) { ctx.beginPath(); ctx.moveTo(0, y); ctx.lineTo(W, y); ctx.stroke(); }
|
||||
var fg = ctx.createLinearGradient(0, floorY, 0, H); fg.addColorStop(0, '#0E1B3B'); fg.addColorStop(1, '#060B18'); ctx.fillStyle = fg; ctx.fillRect(0, floorY, W, H - floorY);
|
||||
var rail = ctx.createLinearGradient(0, floorY - 6, 0, floorY + 6); rail.addColorStop(0, 'rgba(34,211,238,0)'); rail.addColorStop(.5, 'rgba(143,240,255,.9)'); rail.addColorStop(1, 'rgba(34,211,238,0)'); ctx.fillStyle = rail; ctx.fillRect(0, floorY - 6, W, 12);
|
||||
ctx.strokeStyle = 'rgba(34,211,238,.35)'; ctx.lineWidth = 2; ctx.setLineDash([26, 18]); ctx.lineDashOffset = -(dist * 1.6 % 44); ctx.beginPath(); ctx.moveTo(0, floorY + 26); ctx.lineTo(W, floorY + 26); ctx.stroke(); ctx.setLineDash([]);
|
||||
ctx.fillStyle = 'rgba(255,106,26,.5)'; for (var fx = -(dist * 2.2 % 60); fx < W; fx += 60) ctx.fillRect(fx, floorY + 48, 22, 3);
|
||||
if (!R) { ctx.restore(); return; }
|
||||
for (i = 0; i < R.ents.length; i++) { var e = R.ents[i];
|
||||
if (e.k === 'g') { var gg = ctx.createLinearGradient(e.x, 0, e.x + e.w, 0); gg.addColorStop(0, '#FF6A1A'); gg.addColorStop(.5, '#FFB088'); gg.addColorStop(1, '#D44E00'); ctx.fillStyle = gg; ctx.fillRect(e.x, 60, e.w, e.y - 60); ctx.fillRect(e.x, e.y + e.gap, e.w, floorY - e.y - e.gap); ctx.fillStyle = 'rgba(0,0,0,.35)'; for (var sy = 64 + (dist % 24); sy < e.y - 4; sy += 24) ctx.fillRect(e.x, sy, e.w, 8); for (sy = e.y + e.gap + 4 + (dist % 24); sy < floorY - 4; sy += 24) ctx.fillRect(e.x, sy, e.w, 8); ctx.fillStyle = '#FFE1CC'; ctx.shadowColor = '#FF6A1A'; ctx.shadowBlur = 18; ctx.fillRect(e.x - 3, e.y - 4, e.w + 6, 4); ctx.fillRect(e.x - 3, e.y + e.gap, e.w + 6, 4); ctx.shadowBlur = 0; }
|
||||
else if (e.k === 'd') { var dy = e.y + Math.sin(e.ph) * 3, sc = 1 + Math.sin(e.ph * 1.3) * .08; ctx.drawImage(dripSpr, e.x - 18 * sc, dy - 18 * sc, 36 * sc, 36 * sc); }
|
||||
else { ctx.save(); ctx.translate(e.x, e.cy || e.y); ctx.rotate(e.rot); if (R.slow > 0) ctx.globalAlpha = .75; ctx.drawImage(botSpr, -28, -28, 56, 56); ctx.restore(); } }
|
||||
for (i = 0; i < R.parts.length; i++) { var p = R.parts[i]; ctx.globalAlpha = Math.max(0, Math.min(1, p.l * 2)); ctx.fillStyle = 'rgb(' + p.c + ')'; ctx.beginPath(); ctx.arc(p.x, p.y, p.r, 0, 6.283); ctx.fill(); } ctx.globalAlpha = 1;
|
||||
ctx.save(); ctx.translate(player.x, player.y); ctx.rotate(player.tilt); if (R.inv > 0 && Math.floor(R.t * 12) % 2 === 0) ctx.globalAlpha = .45;
|
||||
if (R.magnet) { ctx.strokeStyle = 'rgba(255,194,75,.35)'; ctx.lineWidth = 1.5; ctx.setLineDash([4, 6]); ctx.beginPath(); ctx.arc(0, 0, 150, 0, 6.283); ctx.stroke(); ctx.setLineDash([]); }
|
||||
ctx.drawImage(R.ship === 2 ? shipB : shipA, -32, -32, 64, 64);
|
||||
if (R.shield) { ctx.strokeStyle = 'rgba(255,106,26,.85)'; ctx.lineWidth = 2; ctx.shadowColor = '#FF6A1A'; ctx.shadowBlur = 14; ctx.beginPath(); ctx.arc(0, 0, 22, 0, 6.283); ctx.stroke(); ctx.shadowBlur = 0; }
|
||||
ctx.restore();
|
||||
if (R.slow > 0) { ctx.fillStyle = 'rgba(139,92,246,' + Math.min(.12, R.slow * .03) + ')'; ctx.fillRect(0, 0, W, H); }
|
||||
ctx.restore();
|
||||
}
|
||||
var last = performance.now(); function loop(now) { var dt = Math.min(.033, (now - last) / 1000); last = now; update(dt); draw(); requestAnimationFrame(loop); }
|
||||
|
||||
/* ---------- boot ---------- */
|
||||
resize(); requestAnimationFrame(loop);
|
||||
loadMe().then(function () {
|
||||
var q = new URLSearchParams(location.search);
|
||||
if (q.get('resume')) { history.replaceState(null, '', '/play'); return tryResume(q); }
|
||||
lobby();
|
||||
}).catch(function (r) {
|
||||
$('loadTitle').textContent = 'Sign in first'; $('loadText').textContent = (r && r.error) || 'Open Drip Runner from your InstantAdPay dashboard.'; var b = $('loadBtn'); b.hidden = false; b.textContent = 'Open through InstantAdPay'; b.href = (r && r.iap) || IAP + '/api/my/driprunner';
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,34 @@
|
||||
:root{color-scheme:dark;--page:#050912;--ink:#EEF3FA;--ink2:#AFC0D8;--muted:#6E82A3;--cyan:#22D3EE;--cyan2:#8FF0FF;--gold:#FFC24B;--gold2:#FFE9A8;--bot:#FF3B7A;--sig:#FF6A1A;--ok:#34D399;--violet:#8B5CF6;--panel:#0E172D;--panel2:#141F3A;--line:#24365F;
|
||||
--display:"Orbitron","Segoe UI",system-ui,sans-serif;--body:"Manrope","Segoe UI",system-ui,sans-serif;--mono:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace}
|
||||
*{box-sizing:border-box}
|
||||
body{margin:0;background:var(--page);color:var(--ink);font:15px/1.55 var(--body);padding:0 16px 48px;
|
||||
background-image:radial-gradient(ellipse 60% 50% at 50% 0%,rgba(34,211,238,.10),transparent 60%),radial-gradient(ellipse 40% 40% at 90% 100%,rgba(255,106,26,.08),transparent 60%),radial-gradient(ellipse 40% 40% at 5% 90%,rgba(139,92,246,.10),transparent 60%)}
|
||||
body.plain{display:grid;place-items:center;min-height:100vh}
|
||||
.wrap{max-width:760px;margin:0 auto;padding-top:28px}
|
||||
.logo{font:900 40px/1 var(--display);letter-spacing:.06em;text-transform:uppercase;background:linear-gradient(180deg,#fff,var(--cyan2) 45%,var(--cyan) 60%,#0EA5C9);-webkit-background-clip:text;background-clip:text;color:transparent;filter:drop-shadow(0 0 22px rgba(34,211,238,.45));margin:0}
|
||||
.logo span{background:linear-gradient(180deg,var(--gold2),var(--gold) 55%,#E08A00);-webkit-background-clip:text;background-clip:text;color:transparent}
|
||||
h1{font:900 26px/1.1 var(--display);letter-spacing:.05em;text-transform:uppercase;margin:0 0 10px}
|
||||
h2{font:800 15px/1.2 var(--display);letter-spacing:.12em;text-transform:uppercase;color:var(--cyan);margin:26px 0 8px}
|
||||
p{margin:0 0 10px;color:var(--ink2)}
|
||||
.card{background:linear-gradient(180deg,rgba(20,31,58,.96),rgba(14,23,45,.98));border:1px solid var(--line);border-radius:18px;padding:20px 18px;box-shadow:0 30px 70px -20px rgba(0,0,0,.9);max-width:560px;margin:14px 0}
|
||||
.btn{display:inline-block;padding:13px 18px;border-radius:12px;border:0;cursor:pointer;font:800 14px var(--display);letter-spacing:.1em;text-transform:uppercase;color:#07101F;text-decoration:none;background:linear-gradient(180deg,var(--cyan2),var(--cyan) 55%,#0EA5C9);box-shadow:0 0 0 1px rgba(255,255,255,.25) inset,0 8px 28px -8px rgba(34,211,238,.8)}
|
||||
.btn.sig{background:linear-gradient(180deg,#FFB088,var(--sig) 55%,#D44E00);color:#fff}
|
||||
.btn.ghost{background:rgba(14,23,45,.7);border:1px solid var(--line);color:var(--ink2);box-shadow:none}
|
||||
ol,ul{color:var(--ink2);padding-left:22px;margin:0 0 10px}li{margin:6px 0}
|
||||
.steps{display:grid;gap:10px;counter-reset:s;padding:0;list-style:none;margin:0 0 16px}
|
||||
.steps li{display:grid;grid-template-columns:34px 1fr;gap:12px;align-items:start;background:rgba(5,9,18,.5);border:1px solid var(--line);border-radius:12px;padding:12px 12px}
|
||||
.steps li:before{counter-increment:s;content:counter(s);width:34px;height:34px;border-radius:50%;display:grid;place-items:center;font:800 14px var(--display);color:#07101F;background:linear-gradient(180deg,var(--gold2),var(--gold))}
|
||||
.steps b{display:block;color:var(--ink);font-weight:800;margin-bottom:2px}
|
||||
.k{font:700 11px var(--mono);padding:2px 7px;border:1px solid var(--line);border-radius:5px;color:var(--ink);background:var(--panel)}
|
||||
.chip{display:inline-block;font:700 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;padding:3px 8px;border-radius:5px;border:1px solid var(--line);color:var(--ink2)}
|
||||
.chip.ok{color:var(--ok);border-color:rgba(52,211,153,.4)}.chip.sig{color:var(--sig);border-color:rgba(255,106,26,.4)}.chip.gold{color:var(--gold);border-color:rgba(255,194,75,.4)}
|
||||
.muted{color:var(--muted);font-size:13px}
|
||||
table{width:100%;border-collapse:collapse;font-size:12px}th,td{text-align:left;padding:6px 6px;border-bottom:1px solid var(--line);vertical-align:top}th{color:var(--muted);font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-size:10px}
|
||||
.num{text-align:right;font-family:var(--mono)}
|
||||
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
|
||||
.stat{background:rgba(5,9,18,.5);border:1px solid var(--line);border-radius:12px;padding:10px 12px}.stat small{display:block;font:700 9px var(--body);letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}.stat b{font:800 20px var(--display);font-variant-numeric:tabular-nums}
|
||||
input,select,textarea{background:#070C18;border:1px solid var(--line);color:var(--ink);border-radius:8px;padding:8px 10px;font:13px var(--body);width:100%}
|
||||
label{display:block;font-size:12px;color:var(--muted);margin:8px 0 4px}
|
||||
.row{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}
|
||||
.scroll{overflow-x:auto}
|
||||
a{color:var(--cyan2)}
|
||||
Reference in New Issue
Block a user