Files
DarkflameServer/migrations/dlu/mysql/64_challenges.sql
Aaron Kimbrell e213a7aeff feat: web dashboard and playground work
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch:
accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy
reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live
events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved
captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes
they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:30:43 -05:00

53 lines
2.4 KiB
SQL

/* Server-wide community challenges: reach target of a metric between starts_at and ends_at. metric_kind 0 = a player
statistic (StatisticID), 1 = a map event (IEconomyLedger::eMapEvent, optionally only lot). zones: '' for every zone.
state: 0 open, 1 completed, 2 expired (ended short of the target), 3 cancelled. milestone: the last percentage
announced. reward_items: JSON [{lot, count}] mailed to each character that contributed at least reward_min. */
CREATE TABLE IF NOT EXISTS challenges (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
description TEXT NOT NULL,
metric_kind TINYINT NOT NULL DEFAULT 0,
metric INT UNSIGNED NOT NULL,
lot INT NOT NULL DEFAULT 0,
zones TEXT NOT NULL,
target BIGINT NOT NULL,
starts_at BIGINT NOT NULL,
ends_at BIGINT NOT NULL,
include_staff TINYINT NOT NULL DEFAULT 0,
is_public TINYINT NOT NULL DEFAULT 1,
reward_coins BIGINT NOT NULL DEFAULT 0,
reward_items TEXT NOT NULL,
reward_min BIGINT NOT NULL DEFAULT 1,
state TINYINT NOT NULL DEFAULT 0,
milestone TINYINT UNSIGNED NOT NULL DEFAULT 0,
completed_at BIGINT NOT NULL DEFAULT 0,
rewarded_at BIGINT NOT NULL DEFAULT 0,
rewarded_count INT UNSIGNED NOT NULL DEFAULT 0,
created_at BIGINT NOT NULL DEFAULT 0,
created_by VARCHAR(64) NOT NULL DEFAULT '',
updated_at BIGINT NOT NULL DEFAULT 0,
updated_by VARCHAR(64) NOT NULL DEFAULT '',
INDEX challenges_state (state)
);
/* How much each character added to a challenge, counted by the world servers where the game records it. */
CREATE TABLE IF NOT EXISTS challenge_contributions (
challenge_id BIGINT UNSIGNED NOT NULL,
character_id BIGINT NOT NULL,
amount BIGINT NOT NULL DEFAULT 0,
updated_at BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (challenge_id, character_id),
INDEX challenge_contributions_character (character_id)
);
/* Rewards given for a completed challenge: one row per character (items are mailed; coins wait until claimed_at is
set by the world the character plays in). */
CREATE TABLE IF NOT EXISTS challenge_rewards (
challenge_id BIGINT UNSIGNED NOT NULL,
character_id BIGINT NOT NULL,
amount BIGINT NOT NULL DEFAULT 0,
coins BIGINT NOT NULL DEFAULT 0,
rewarded_at BIGINT NOT NULL DEFAULT 0,
claimed_at BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (challenge_id, character_id),
INDEX challenge_rewards_character (character_id, claimed_at)
);