mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
Add blacksmith repair system, community lottery, and audit fixes
Blacksmith: equipment repair with tier-based pricing, DM confirmation flow, masterwork/arena surcharges, full flavor text pools. Added to main adventure menu as option 6 (rest bumped to 7). Lottery: weekly draw (Friday 23:59 UTC), ticket purchases with 100/week cap, Fisher-Yates number generation, fixed+jackpot prize tiers, community pot funding, Thursday reminders, draw history. Audit fixes: TOCTOU in blacksmith repair costs (recompute from fresh equipment), user lock in DM slot selection, partial repair refund tracking, error logging on save failures, Fisher-Yates bias correction, communityPotDebit return value checks in draw execution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1155,6 +1155,34 @@ CREATE TABLE IF NOT EXISTS user_archetypes (
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_archetypes_user ON user_archetypes(user_id, signal_score DESC);
|
||||
|
||||
-- Lottery tickets
|
||||
CREATE TABLE IF NOT EXISTS lottery_tickets (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id TEXT NOT NULL,
|
||||
week_start DATE NOT NULL,
|
||||
numbers TEXT NOT NULL,
|
||||
match_count INTEGER DEFAULT NULL,
|
||||
prize INTEGER DEFAULT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_lottery_tickets_week ON lottery_tickets(week_start, user_id);
|
||||
|
||||
-- Lottery draw history
|
||||
CREATE TABLE IF NOT EXISTS lottery_history (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
draw_date DATE NOT NULL,
|
||||
winning_numbers TEXT NOT NULL,
|
||||
jackpot_winners INTEGER DEFAULT 0,
|
||||
jackpot_amount INTEGER DEFAULT 0,
|
||||
match4_winners INTEGER DEFAULT 0,
|
||||
match3_winners INTEGER DEFAULT 0,
|
||||
match2_winners INTEGER DEFAULT 0,
|
||||
match1_winners INTEGER DEFAULT 0,
|
||||
pot_total INTEGER NOT NULL,
|
||||
rolled_over INTEGER DEFAULT 0,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
`
|
||||
|
||||
// SeedSchedulerDefaults inserts default scheduler jobs if they don't exist.
|
||||
|
||||
Reference in New Issue
Block a user