Files
discordbot/blue_archive/constants.py
T

80 lines
3.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#this holds all shared constants for the blue archive gacha system##
"""Centralised constants — colours, rates, layout, and paths."""
######################################################################
from pathlib import Path
# ── Paths ───────────────────────────────────────────────────────────────────
_PKG_DIR = Path(__file__).parent
_DATA_DIR = _PKG_DIR.parent / "data"
BUNDLED_DB = _PKG_DIR / "ba_students.json"
BANNER_FILE = _DATA_DIR / "ba_banner_state.json"
ASSETS_DIR = _PKG_DIR / "assets"
BG_PATH = ASSETS_DIR / "gacha_bg.png"
GACHA_ANIM_PATH = ASSETS_DIR / "Arona_Blue_Gacha_Animation.gif"
GACHA_ANIM_DURATION = 3.5 # 195 frames × 100 ms (used to be 19.5 will be changed later)
# ── APIs ────────────────────────────────────────────────────────────────────
BANNER_API = "https://api.ennead.cc/buruaka/banner"
CHARACTER_API = "https://api.ennead.cc/buruaka/character"
PORTRAIT_CDN = "https://schaledb.com/images"
# ── Gacha rates (matching real Blue Archive) ────────────────────────────────
# Regular/Pickup: 3★ = 3.0%, 2★ = 18.5%, 1★ = 78.5%
# Fes: 3★ = 6.0%, 2★ = 18.5%, 1★ = 75.5%
# 10th pull: 3★ = 3.0%, 2★ = 97.0%, 1★ = 0% (guaranteed 2★+)
DEFAULT_RATES = (0.03, 0.185, 0.785)
PULL10_RATES = (0.03, 0.97, 0.0)
BANNER_RATES: dict[str, tuple[float, float, float]] = {
"FesGacha": (0.06, 0.185, 0.755),
}
# ── Spark & Eligma ──────────────────────────────────────────────────────────
SPARK_TARGET = 200
ELIGMA_YIELD = {1: 1, 2: 10, 3: 50}
# ── Rarity colours (frame borders, stars, card backgrounds) ─────────────────
RARITY_COLOR = {
3: (250, 210, 255), # bright purple
2: (255, 252, 160), # bright gold
1: (190, 235, 255), # bright sky blue
}
RARITY_BG = {
3: (42, 26, 54),
2: (54, 48, 26),
1: (26, 34, 54),
}
RARITY_EMBED_COLOR = {
3: 0xF0D0FF,
2: 0xFFF9A0,
1: 0xC0E8FF,
}
RARITY_LABEL = {3: "3★", 2: "2★", 1: "1★"}
RARITY_SYMBOL = {3: "◆", 2: "⬟", 1: "●"}
# ── Canvas & card layout (1920×1080) ────────────────────────────────────────
CANVAS_W, CANVAS_H = 1920, 1080
CARD_W, CARD_H = 280, 390
CARD_RADIUS = 10
GAP_X, GAP_Y = 25, 20
COLS, ROWS = 5, 2
GRID_W = COLS * CARD_W + (COLS - 1) * GAP_X # 1500
GRID_H = ROWS * CARD_H + (ROWS - 1) * GAP_Y # 800
GRID_X = (CANVAS_W - GRID_W) // 2 # 210
GRID_Y = 260
HEADER_Y = 120
FOOTER_Y = GRID_Y + GRID_H + 50
STAR_BANNER_H = 36
NAME_STRIP_H = 42
PORTRAIT_TOP = STAR_BANNER_H + 4
PORTRAIT_H = CARD_H - PORTRAIT_TOP - NAME_STRIP_H - 4
# ── Inventory display ───────────────────────────────────────────────────────
PAGE_SIZE = 10
FILTER_LABELS: dict[str, int | None] = {"All": None, "3★": 3, "2★": 2, "1★": 1}
# ── Font paths (tried in order; Pillow default used as last resort) ─────────
FONT_PATHS = [
"/usr/share/fonts/TTF/DejaVuSans.ttf",
"/usr/share/fonts/TTF/DejaVuSans-Bold.ttf",
]