Levels by watch time: Viewer, Regular (10 h), Veteran (50 h)
Replaces the cassette-themed point levels. Watch time = our ticks + StreamElements import; points only rank the leaderboard, bits/subs do not buy a level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
024934f09f
commit
a3e862e9c2
3 changed files with 12 additions and 8 deletions
|
|
@ -24,7 +24,8 @@ everyone's points recalculate. Name to be decided (e.g. "Streamer points").
|
|||
| Emotes, commands | 0 | stats only, no farming |
|
||||
| Watch time | 5 per 5 min live (one tick updates watch time and points together; built: src/watchtime.js) | needs moderator:read:chatters (chatter list); import StreamElements' watch time once (SE key already in .env) so viewers keep their history when our bot takes over `!watchtime` |
|
||||
|
||||
Levels (cassette theme): Newcomer, Regular 500, Tape Collector 2000, Mixtape Maker 6000, Side B Legend 15000.
|
||||
Levels by watch time (ours + StreamElements import), her choice 2026-11-22: Viewer, Regular (10 h), Veteran (50 h).
|
||||
Points only rank the leaderboard; bits/subs do not buy a level.
|
||||
Balance: lurker 60/h, active chatter up to 180/h; Tier 1 sub (500) ~ 8 h watching.
|
||||
Uses: `!points`, on-stream leaderboard, level next to names in the overlay chat, spending on free Power-up uses (1).
|
||||
Rule: points earned from bits must never be exchanged for things with money value (Bits Acceptable Use Policy).
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ const VALUE = {
|
|||
streakPer: 5, streakMax: 100,
|
||||
};
|
||||
|
||||
const LEVELS = [ // cassette theme
|
||||
{ min: 0, name: 'Newcomer' }, { min: 500, name: 'Regular' }, { min: 2000, name: 'Tape Collector' },
|
||||
{ min: 6000, name: 'Mixtape Maker' }, { min: 15000, name: 'Side B Legend' },
|
||||
// Levels by watch time (our ticks + StreamElements import), not points: bits/subs do not buy a level.
|
||||
const LEVELS = [
|
||||
{ minHours: 0, name: 'Viewer' }, { minHours: 10, name: 'Regular' }, { minHours: 50, name: 'Veteran' },
|
||||
];
|
||||
const levelOf = p => [...LEVELS].reverse().find(l => p >= l.min);
|
||||
const levelOf = watchMinutes => [...LEVELS].reverse().find(l => watchMinutes >= l.minHours * 60);
|
||||
|
||||
const has = t => !!db.raw().prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name = ?").get(t);
|
||||
const all = (sql, ...a) => db.raw().prepare(sql).all(...a);
|
||||
|
|
@ -46,12 +46,15 @@ function everyone() {
|
|||
add(x, 'chat', (r.scored || 0) * VALUE.chat); add(x, 'first message', r.intro ? VALUE.intro : 0);
|
||||
}
|
||||
if (has('watch_user')) for (const r of all('SELECT user_id, user_login, user_name, ticks FROM watch_user')) {
|
||||
add(get(r.user_id, r.user_login, r.user_name), 'watching', (r.ticks || 0) * VALUE.watchTick);
|
||||
const x = get(r.user_id, r.user_login, r.user_name);
|
||||
x.watchMinutes = (x.watchMinutes || 0) + (r.ticks || 0) * 5;
|
||||
add(x, 'watching', (r.ticks || 0) * VALUE.watchTick);
|
||||
}
|
||||
// StreamElements watch time imported once (seimport.js): login + minutes, counted like our ticks
|
||||
if (has('watch_import')) for (const r of all('SELECT user_login, minutes FROM watch_import')) {
|
||||
const x = get(null, r.user_login, null);
|
||||
x.importedMinutes = (x.importedMinutes || 0) + r.minutes;
|
||||
x.watchMinutes = (x.watchMinutes || 0) + r.minutes;
|
||||
add(x, 'watching (StreamElements)', Math.floor(r.minutes / 5) * VALUE.watchTick);
|
||||
}
|
||||
if (has('stream_checkin')) for (const r of all('SELECT user_id, COUNT(*) n FROM stream_checkin GROUP BY user_id')) {
|
||||
|
|
@ -71,7 +74,7 @@ function everyone() {
|
|||
case 'watch_streak': add(x, 'watch streak', Math.min(VALUE.streakMax, r.amount * VALUE.streakPer)); break;
|
||||
}
|
||||
}
|
||||
for (const x of v.values()) x.level = levelOf(x.total);
|
||||
for (const x of v.values()) x.level = levelOf(x.watchMinutes || 0);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
.board .n { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
|
||||
/* points: the main board, twice as wide, level in its own column so the pills line up */
|
||||
.board.wide { grid-column:span 2; }
|
||||
.board.wide li { grid-template-columns:1.6rem minmax(0, 1fr) 8.5rem var(--nw, 4.6rem); }
|
||||
.board.wide li { grid-template-columns:1.6rem minmax(0, 1fr) 5.5rem var(--nw, 4.6rem); }
|
||||
.board.wide .lvl { justify-self:start; }
|
||||
@media (max-width: 700px) { .board.wide { grid-column:auto; } }
|
||||
.emotes { display:flex; flex-wrap:wrap; gap:.5rem; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue