Compare commits
166 Commits
69fea65bf9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3800c5bdad | ||
|
|
12d575a84b | ||
|
|
c14b6d7062 | ||
|
|
a7c5468cbc | ||
|
|
4da8750c60 | ||
|
|
cf40f626e6 | ||
|
|
99a826f6c9 | ||
|
|
51fe2614fa | ||
|
|
56dc094b45 | ||
|
|
520fdf7862 | ||
|
|
e2cc38686f | ||
|
|
0bcc7567bb | ||
|
|
6654785f25 | ||
|
|
99a69202b9 | ||
|
|
55bb450d27 | ||
|
|
e28d55ad58 | ||
|
|
b110bb6d01 | ||
|
|
2892b51101 | ||
|
|
871e94b298 | ||
|
|
c3ab78cc57 | ||
|
|
c7370bda03 | ||
|
|
a15d91dfe6 | ||
|
|
fecb1fddca | ||
|
|
2028f1a544 | ||
|
|
40c747a837 | ||
|
|
40a55721ab | ||
|
|
d4518a0671 | ||
|
|
74f63a7721 | ||
|
|
bd3d7fc7bd | ||
|
|
c00288e256 | ||
|
|
b5de96660a | ||
|
|
96bb05a4ba | ||
|
|
4e07fcf38b | ||
|
|
b74f8e1bb1 | ||
|
|
188365f412 | ||
|
|
824f35590b | ||
|
|
43cb84e8f4 | ||
|
|
afe8e2b32c | ||
|
|
ca38875660 | ||
|
|
8538f76b13 | ||
|
|
2a7d4c7410 | ||
|
|
ed10e58383 | ||
|
|
b65cba5ed2 | ||
|
|
afe79f1a48 | ||
|
|
0e5e39b0dc | ||
|
|
4860b6ee2a | ||
|
|
c025a38709 | ||
|
|
581ea7e349 | ||
|
|
596175cd1c | ||
|
|
1aaf353066 | ||
|
|
441def9a34 | ||
|
|
736b59b5c0 | ||
|
|
a8592aeaec | ||
|
|
8b006be138 | ||
|
|
299a806862 | ||
|
|
fb782cf5ef | ||
|
|
224f5e2ad0 | ||
|
|
96379934d7 | ||
|
|
29a5658b01 | ||
|
|
73135df7a6 | ||
|
|
57f47cc77e | ||
|
|
5d21e79be5 | ||
|
|
ff0883002b | ||
|
|
7f927741d4 | ||
|
|
3bf48546e3 | ||
|
|
6817323f8e | ||
|
|
11283118d6 | ||
|
|
6c91ec0385 | ||
|
|
39db59c71a | ||
|
|
5f643350c5 | ||
|
|
ab41797e57 | ||
|
|
e35855f472 | ||
|
|
0e5805efd2 | ||
|
|
de99b538d2 | ||
|
|
c08b5b764e | ||
|
|
d63a4bec4a | ||
|
|
b35c9b483e | ||
|
|
30ea0fad9d | ||
|
|
62d5c738f9 | ||
|
|
f0f419ff7e | ||
|
|
0494710ce0 | ||
|
|
713e24863d | ||
|
|
b3bc422f46 | ||
|
|
c0016418cc | ||
|
|
4d52c4f54d | ||
|
|
db1608fa38 | ||
|
|
4728cde771 | ||
|
|
2f6fc1ff20 | ||
|
|
9698d70164 | ||
|
|
7370fd611f | ||
|
|
f5a5ed9d8d | ||
|
|
a5d71925fc | ||
|
|
b03ba09b65 | ||
|
|
befa61e1e9 | ||
|
|
15ac3216ff | ||
|
|
2896efa8e0 | ||
|
|
588358a20f | ||
|
|
11c85d56d1 | ||
|
|
8bab26e003 | ||
|
|
bc78d2c470 | ||
|
|
2447315fd3 | ||
|
|
cde231d43c | ||
|
|
a0f8aeb791 | ||
|
|
2ca4e9d39f | ||
|
|
c71f4eb68c | ||
|
|
189d329e76 | ||
|
|
18898c7a0f | ||
|
|
f347af7eff | ||
|
|
e59d5fd4c0 | ||
|
|
62f6c27806 | ||
|
|
cc02419e8d | ||
|
|
c331e72de6 | ||
|
|
a1f8d294a3 | ||
|
|
5607f70852 | ||
|
|
eecb6c2be6 | ||
|
|
2fd3ec9ab2 | ||
|
|
cad3744a57 | ||
|
|
ffb374c81c | ||
|
|
3b905e0436 | ||
|
|
f1b5ba2a71 | ||
|
|
184854a2de | ||
|
|
f5c2cf4636 | ||
|
|
91e0eaad8e | ||
|
|
5a811d0079 | ||
|
|
8c2a5d24ec | ||
|
|
4f076165ef | ||
|
|
3a87a17017 | ||
|
|
4e63323019 | ||
|
|
8b2c4e1bdc | ||
|
|
10d717a3ba | ||
|
|
e9f50810da | ||
|
|
67697fa90e | ||
|
|
97b406c7e0 | ||
|
|
568497d09d | ||
|
|
1558bb02b4 | ||
|
|
01de6e7548 | ||
|
|
c9defa5a81 | ||
|
|
462155f07b | ||
|
|
fa46fc18d7 | ||
|
|
4239245902 | ||
|
|
b49218b45b | ||
|
|
ace9a4888e | ||
|
|
435bec7988 | ||
|
|
12146037f0 | ||
|
|
ff7b71792f | ||
|
|
2e24175ec8 | ||
|
|
18ba242647 | ||
|
|
6d1b358b7c | ||
|
|
2140bd8206 | ||
|
|
52e171cb20 | ||
|
|
74d1a43559 | ||
|
|
2d453dbc78 | ||
|
|
4baaa63430 | ||
|
|
26b6d4e7db | ||
|
|
f4dfce826b | ||
|
|
53d9f79476 | ||
|
|
ed48d18c1d | ||
|
|
f76c6d0fe5 | ||
|
|
d9feb80b2a | ||
|
|
d780115515 | ||
|
|
af3523c9bb | ||
|
|
dddffd22d5 | ||
|
|
e0d1f51bf1 | ||
|
|
6a42b91420 | ||
|
|
5773462b4c | ||
|
|
681a1a4cd0 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -10,9 +10,8 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
__pycache__/
|
__pycache__/
|
||||||
local_settings.py
|
local_settings.py
|
||||||
db.sqlite3
|
*.sqlite3
|
||||||
db.sqlite3-journal
|
*.sqlite3-journal
|
||||||
container.db.sqlite3
|
|
||||||
media
|
media
|
||||||
|
|
||||||
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
|
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
|
||||||
|
|||||||
@@ -23,6 +23,25 @@ steps:
|
|||||||
when:
|
when:
|
||||||
- event: push
|
- event: push
|
||||||
|
|
||||||
|
- name: test-two-browser-FTs
|
||||||
|
image: gitea.earthmanrpg.me/discoman/python-tdd-ci:latest
|
||||||
|
environment:
|
||||||
|
HEADLESS: 1
|
||||||
|
CELERY_BROKER_URL: redis://redis:6379/0
|
||||||
|
REDIS_URL: redis://redis:6379/1
|
||||||
|
STRIPE_SECRET_KEY:
|
||||||
|
from_secret: stripe_secret_key
|
||||||
|
STRIPE_PUBLISHABLE_KEY:
|
||||||
|
from_secret: stripe_publishable_key
|
||||||
|
commands:
|
||||||
|
- pip install -r requirements.txt
|
||||||
|
- cd ./src
|
||||||
|
- python manage.py collectstatic --noinput
|
||||||
|
- python manage.py test functional_tests --tag=two-browser
|
||||||
|
- python manage.py test functional_tests --tag=channels
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
|
||||||
- name: test-FTs
|
- name: test-FTs
|
||||||
image: gitea.earthmanrpg.me/discoman/python-tdd-ci:latest
|
image: gitea.earthmanrpg.me/discoman/python-tdd-ci:latest
|
||||||
environment:
|
environment:
|
||||||
@@ -37,7 +56,7 @@ steps:
|
|||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
- cd ./src
|
- cd ./src
|
||||||
- python manage.py collectstatic --noinput
|
- python manage.py collectstatic --noinput
|
||||||
- python manage.py test functional_tests
|
- python manage.py test functional_tests --parallel --exclude-tag=channels --exclude-tag=two-browser
|
||||||
when:
|
when:
|
||||||
- event: push
|
- event: push
|
||||||
|
|
||||||
|
|||||||
148
CLAUDE.md
Normal file
148
CLAUDE.md
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
# EarthmanRPG — Project Context
|
||||||
|
|
||||||
|
Originally built following Harry Percival's *Test-Driven Development with Python* (3rd ed., complete through ch. 25). Now an ongoing game app — EarthmanRPG — extended well beyond the book.
|
||||||
|
|
||||||
|
## Browser Integration
|
||||||
|
**Claudezilla** is installed — a Firefox extension + native host that lets Claude observe and interact with the browser directly.
|
||||||
|
|
||||||
|
### Tool names
|
||||||
|
Tools are available as `mcp__claudezilla__firefox_*`, e.g.:
|
||||||
|
- `mcp__claudezilla__firefox_screenshot` — capture current tab
|
||||||
|
- `mcp__claudezilla__firefox_navigate` — navigate to URL
|
||||||
|
- `mcp__claudezilla__firefox_get_page_state` — structured JSON (faster than screenshot)
|
||||||
|
- `mcp__claudezilla__firefox_create_window` — open new tab (returns `tabId`)
|
||||||
|
- `mcp__claudezilla__firefox_diagnose` — check connection status
|
||||||
|
- `mcp__claudezilla__firefox_set_private_mode` — disable private mode to use session cookies
|
||||||
|
|
||||||
|
All tools require a `tabId` except `firefox_create_window` and `firefox_diagnose`.
|
||||||
|
|
||||||
|
### If tools aren't available in a session
|
||||||
|
MCP servers load at session startup only. **Start a new Claude Code conversation** (hit "+" in the sidebar) — no need to reboot VSCode, just open a fresh chat. Always call `firefox_diagnose` first to confirm the connection is live.
|
||||||
|
|
||||||
|
### Correct startup sequence
|
||||||
|
1. Firefox open with Claudezilla extension active (native host must be running)
|
||||||
|
2. Open a new Claude Code conversation → tools appear as `mcp__claudezilla__firefox_*`
|
||||||
|
3. Call `firefox_diagnose` to confirm before depending on any tool
|
||||||
|
|
||||||
|
### Setup (already done — for reference)
|
||||||
|
The native messaging host requires a `.bat` wrapper on Windows (Firefox can't execute `.js` directly):
|
||||||
|
- Wrapper: `E:\ClaudeLibrary\claudezilla\host\claudezilla.bat` — contains `@echo off` / `node "%~dp0index.js" %*`
|
||||||
|
- Manifest: `C:\Users\adamc\AppData\Roaming\claudezilla\claudezilla.json` — points to the `.bat` file
|
||||||
|
- Registry: `HKCU\SOFTWARE\Mozilla\NativeMessagingHosts\claudezilla` → manifest path
|
||||||
|
- MCP server: registered in `~/.claude.json` (NOT `~/.claude/settings.json` or `~/.claude/mcp.json`) — use the CLI to register:
|
||||||
|
```
|
||||||
|
claude mcp add --scope user claudezilla "D:/Program Files/nodejs/node.exe" "E:/ClaudeLibrary/claudezilla/mcp/server.js"
|
||||||
|
```
|
||||||
|
- Permission: `mcp__claudezilla__*` in `~/.claude/settings.json` `permissions.allow`
|
||||||
|
|
||||||
|
**Config file gotcha:** The Claude Code CLI and VSCode extension read user-level MCP servers from `~/.claude.json` (home dir, single file) — NOT from `~/.claude/settings.json` or `~/.claude/mcp.json`. Always use `claude mcp add --scope user` to register; never hand-edit. Verify registration with `claude mcp list`.
|
||||||
|
|
||||||
|
**BOM gotcha:** PowerShell writes JSON files with a UTF-8 BOM, which causes `JSON.parse` to throw. Never use PowerShell `Set-Content` to write any Claude config JSON — use the Write tool or the CLI instead.
|
||||||
|
|
||||||
|
Native host: `E:\ClaudeLibrary\claudezilla\host\`. Extension: `claudezilla@boot.industries`.
|
||||||
|
|
||||||
|
## Stack
|
||||||
|
- **Python 3.13 / Django 6.0 / Django Channels** (ASGI via Daphne/uvicorn)
|
||||||
|
- **Celery + Redis** (async email, channel layer)
|
||||||
|
- **django-compressor + SCSS** (`src/static_src/scss/core.scss`)
|
||||||
|
- **Selenium** (functional tests) + Django test framework (integration/unit tests)
|
||||||
|
- **Stripe** (payment, sandbox only so far)
|
||||||
|
- **Hosting:** DigitalOcean staging (`staging.earthmanrpg.me`) | CI: Gitea + Woodpecker
|
||||||
|
|
||||||
|
## Project Layout
|
||||||
|
|
||||||
|
The app pairs follow a tripartite structure:
|
||||||
|
- **1st-person** (personal UX): `lyric` (backend — auth, user, tokens) · `dashboard` (frontend — notes, applets, wallet UI)
|
||||||
|
- **3rd-person** (game table UX): `epic` (backend — rooms, gates, role select, game logic) · `gameboard` (frontend — room listing, gameboard UI)
|
||||||
|
- **2nd-person** (inter-player events): `drama` (backend — activity streams, provenance) · `billboard` (frontend — provenance feed, embeddable in dashboard/gameboard)
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
apps/
|
||||||
|
lyric/ # auth (magic-link email), user model, token economy
|
||||||
|
dashboard/ # Notes (formerly Lists), applets, wallet UI [1st-person frontend]
|
||||||
|
epic/ # rooms, gates, role select, game logic [3rd-person backend]
|
||||||
|
gameboard/ # room listing, gameboard UI [3rd-person frontend]
|
||||||
|
drama/ # activity streams, provenance system [2nd-person backend]
|
||||||
|
billboard/ # provenance feed, embeds in dashboard/gameboard [2nd-person frontend]
|
||||||
|
api/ # REST API
|
||||||
|
applets/ # Applet model + context helpers
|
||||||
|
core/ # settings, urls, asgi, runner
|
||||||
|
static_src/ # SCSS source
|
||||||
|
templates/
|
||||||
|
functional_tests/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Template directory convention
|
||||||
|
Templates live under `templates/apps/<frontend-app>/`, not under the backend app that owns the view logic. Specifically:
|
||||||
|
- `lyric/` views → `templates/apps/dashboard/`
|
||||||
|
- `epic/` views → `templates/apps/gameboard/`
|
||||||
|
- `drama/` views → `templates/apps/billboard/`
|
||||||
|
|
||||||
|
Backend apps (`lyric`, `epic`, `drama`) have **no** `templates/` subdirectory.
|
||||||
|
|
||||||
|
## Dev Commands
|
||||||
|
```bash
|
||||||
|
# Dev server (ASGI — required for WebSockets; no npm/webpack build step)
|
||||||
|
cd src
|
||||||
|
uvicorn core.asgi:application --host 0.0.0.0 --port 8000 --reload --app-dir src
|
||||||
|
|
||||||
|
# Integration + unit tests only (from project root — targets src/apps, skips src/functional_tests)
|
||||||
|
python src/manage.py test src/apps
|
||||||
|
|
||||||
|
# Functional tests only
|
||||||
|
python src/manage.py test src/functional_tests
|
||||||
|
|
||||||
|
# All tests (integration + unit + FT)
|
||||||
|
python src/manage.py test src
|
||||||
|
```
|
||||||
|
|
||||||
|
**Test tags:** The only tag in use is `channels` — for async consumer tests that require a live Redis channel layer.
|
||||||
|
- Exclude channels tests: `python src/manage.py test src/apps --exclude-tag=channels`
|
||||||
|
- Channels tests only: `python src/manage.py test src/apps --tag=channels`
|
||||||
|
|
||||||
|
FTs are isolated by **directory path** (`src/functional_tests/`), not by tag.
|
||||||
|
|
||||||
|
Test runner is `core.runner.RobustCompressorTestRunner` — handles the Windows compressor PermissionError by deleting stale CACHE at startup + monkey-patching retry logic.
|
||||||
|
|
||||||
|
## CI/CD
|
||||||
|
- Git remote: `git@gitea:discoman/python-tdd.git` (port 222, key `~/.ssh/gitea_keys/id_ed25519_python-tdd`)
|
||||||
|
- Gitea: `https://gitea.earthmanrpg.me` | Woodpecker CI: `https://ci.earthmanrpg.me`
|
||||||
|
- Push to `main` triggers Woodpecker → deploys to staging
|
||||||
|
|
||||||
|
## SCSS Import Order
|
||||||
|
`core.scss`: `rootvars → applets → base → button-pad → dashboard → gameboard → palette-picker → room → billboard → game-kit → wallet-tokens`
|
||||||
|
|
||||||
|
## Critical Gotchas
|
||||||
|
|
||||||
|
### TransactionTestCase flushes migration data
|
||||||
|
FTs use `TransactionTestCase` which flushes migration-seeded rows. Any IT/FT `setUp` that needs `Applet` rows must call `Applet.objects.get_or_create(slug=..., defaults={...})` — never rely on migration data surviving.
|
||||||
|
|
||||||
|
### Static files in tests
|
||||||
|
`StaticLiveServerTestCase` serves via `STATICFILES_FINDERS` only — NOT from `STATIC_ROOT`. JS/CSS that lives only in `src/static/` (STATIC_ROOT, gitignored) is a silent 404 in CI. All app JS must live in `src/apps/<app>/static/` or `src/static_src/`.
|
||||||
|
|
||||||
|
### msgpack integer key bug (Django Channels)
|
||||||
|
`channels_redis` uses msgpack with `strict_map_key=True` — integer dict keys in `group_send` payloads raise `ValueError` and crash consumers. Always use `str(slot_number)` as dict keys.
|
||||||
|
|
||||||
|
### Multi-browser FTs in CI
|
||||||
|
Any FT opening a second browser must pass `FirefoxOptions` with `--headless` when `HEADLESS` env var is set. Bare `webdriver.Firefox()` crashes in headless CI with `Process unexpectedly closed with status 1`.
|
||||||
|
|
||||||
|
### Selenium + CSS text-transform
|
||||||
|
Selenium `.text` returns visually rendered text. CSS `text-transform: uppercase` causes `assertIn("Test Room", body.text)` to fail. Assert against the uppercased string or use `body.text.upper()`.
|
||||||
|
|
||||||
|
### Tooltip portal pattern
|
||||||
|
`mask-image` on grid containers clips `position: absolute` tooltips. Use `#id_tooltip_portal` (`position: fixed; z-index: 9999`) at page root. See `gameboard.js` + `wallet.js`.
|
||||||
|
|
||||||
|
### Applet menus + container-type
|
||||||
|
`container-type: inline-size` creates a containing block for all positioned descendants — applet menus must live OUTSIDE `#id_applets_container` to be viewport-fixed.
|
||||||
|
|
||||||
|
### ABU session auth
|
||||||
|
`create_pre_authenticated_session` must set `HASH_SESSION_KEY = user.get_session_auth_hash()` and hardcode `BACKEND_SESSION_KEY` to the passwordless backend string.
|
||||||
|
|
||||||
|
### Magic login email mock paths
|
||||||
|
- View tests: `apps.lyric.views.send_login_email_task.delay`
|
||||||
|
- Task unit tests: `apps.lyric.tasks.requests.post`
|
||||||
|
- FTs: mock both with `side_effect=send_login_email_task`
|
||||||
|
|
||||||
|
## Teaching Style
|
||||||
|
User prefers guided learning: describe what to type and why, let them write the code, then review together. But for now, given user's accelerated timetable, please respond with complete code snippets for user to transcribe directly.
|
||||||
@@ -20,4 +20,4 @@ RUN DJANGO_SECRET_KEY=build-dummy DJANGO_ALLOWED_HOST=localhost python manage.py
|
|||||||
RUN adduser --uid 1234 nonroot
|
RUN adduser --uid 1234 nonroot
|
||||||
|
|
||||||
USER nonroot
|
USER nonroot
|
||||||
CMD ["gunicorn", "--bind", ":8888", "core.wsgi:application"]
|
CMD ["gunicorn", "--bind", ":8888", "-k", "uvicorn.workers.UvicornWorker", "core.asgi:application"]
|
||||||
@@ -129,6 +129,7 @@
|
|||||||
image: gitea.earthmanrpg.me/discoman/gamearray:latest
|
image: gitea.earthmanrpg.me/discoman/gamearray:latest
|
||||||
state: started
|
state: started
|
||||||
recreate: true
|
recreate: true
|
||||||
|
restart_policy: unless-stopped
|
||||||
env:
|
env:
|
||||||
DJANGO_DEBUG_FALSE: "1"
|
DJANGO_DEBUG_FALSE: "1"
|
||||||
DJANGO_SECRET_KEY: "{{ secret_key.content | b64decode }}"
|
DJANGO_SECRET_KEY: "{{ secret_key.content | b64decode }}"
|
||||||
@@ -150,6 +151,7 @@
|
|||||||
image: gitea.earthmanrpg.me/discoman/gamearray:latest
|
image: gitea.earthmanrpg.me/discoman/gamearray:latest
|
||||||
state: started
|
state: started
|
||||||
recreate: true
|
recreate: true
|
||||||
|
restart_policy: unless-stopped
|
||||||
env:
|
env:
|
||||||
DJANGO_DEBUG_FALSE: "1"
|
DJANGO_DEBUG_FALSE: "1"
|
||||||
DJANGO_SECRET_KEY: "{{ secret_key.content | b64decode }}"
|
DJANGO_SECRET_KEY: "{{ secret_key.content | b64decode }}"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ docker rm gamearray 2>/dev/null || true
|
|||||||
|
|
||||||
echo "==> Starting new container..."
|
echo "==> Starting new container..."
|
||||||
docker run -d --name gamearray \
|
docker run -d --name gamearray \
|
||||||
|
--restart unless-stopped \
|
||||||
--env-file /opt/gamearray/gamearray.env \
|
--env-file /opt/gamearray/gamearray.env \
|
||||||
--network gamearray_net \
|
--network gamearray_net \
|
||||||
-p 127.0.0.1:8888:8888 \
|
-p 127.0.0.1:8888:8888 \
|
||||||
@@ -23,6 +24,7 @@ docker rm gamearray_celery 2>/dev/null || true
|
|||||||
|
|
||||||
echo "==> Starting new celery worker..."
|
echo "==> Starting new celery worker..."
|
||||||
docker run -d --name gamearray_celery \
|
docker run -d --name gamearray_celery \
|
||||||
|
--restart unless-stopped \
|
||||||
--env-file /opt/gamearray/gamearray.env \
|
--env-file /opt/gamearray/gamearray.env \
|
||||||
--network gamearray_net \
|
--network gamearray_net \
|
||||||
"$IMAGE" python -m celery -A core worker -l info
|
"$IMAGE" python -m celery -A core worker -l info
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ server {
|
|||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:8888;
|
proxy_pass http://127.0.0.1:8888;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|||||||
@@ -2,9 +2,13 @@ asgiref==3.11.0
|
|||||||
attrs==25.4.0
|
attrs==25.4.0
|
||||||
certifi==2025.11.12
|
certifi==2025.11.12
|
||||||
cffi==2.0.0
|
cffi==2.0.0
|
||||||
|
channels
|
||||||
|
channels-redis
|
||||||
charset-normalizer==3.4.4
|
charset-normalizer==3.4.4
|
||||||
coverage
|
coverage
|
||||||
|
cryptography
|
||||||
cssselect==1.3.0
|
cssselect==1.3.0
|
||||||
|
daphne
|
||||||
dj-database-url
|
dj-database-url
|
||||||
Django==6.0
|
Django==6.0
|
||||||
django-compressor
|
django-compressor
|
||||||
@@ -23,6 +27,7 @@ pycparser==2.23
|
|||||||
PySocks==1.7.1
|
PySocks==1.7.1
|
||||||
python-dotenv
|
python-dotenv
|
||||||
requests==2.32.5
|
requests==2.32.5
|
||||||
|
scipy
|
||||||
selenium==4.39.0
|
selenium==4.39.0
|
||||||
sniffio==1.3.1
|
sniffio==1.3.1
|
||||||
sortedcontainers==2.4.0
|
sortedcontainers==2.4.0
|
||||||
@@ -34,6 +39,7 @@ types-PyYAML==6.0.12.20250915
|
|||||||
typing_extensions==4.15.0
|
typing_extensions==4.15.0
|
||||||
tzdata==2025.3
|
tzdata==2025.3
|
||||||
urllib3==2.6.2
|
urllib3==2.6.2
|
||||||
|
uvicorn[standard]
|
||||||
websocket-client==1.9.0
|
websocket-client==1.9.0
|
||||||
whitenoise==6.11.0
|
whitenoise==6.11.0
|
||||||
wsproto==1.3.2
|
wsproto==1.3.2
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
celery
|
celery
|
||||||
|
cryptography
|
||||||
|
channels
|
||||||
|
channels-redis
|
||||||
cssselect==1.3.0
|
cssselect==1.3.0
|
||||||
|
daphne
|
||||||
Django==6.0
|
Django==6.0
|
||||||
dj-database-url
|
dj-database-url
|
||||||
django-compressor
|
django-compressor
|
||||||
@@ -13,5 +17,7 @@ lxml==6.0.2
|
|||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
redis
|
redis
|
||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
|
scipy
|
||||||
stripe
|
stripe
|
||||||
whitenoise==6.11.0
|
whitenoise==6.11.0
|
||||||
|
uvicorn[standard]
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ source = apps
|
|||||||
omit =
|
omit =
|
||||||
*/migrations/*
|
*/migrations/*
|
||||||
*/tests/*
|
*/tests/*
|
||||||
|
*/routing.py
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
show_missing = true
|
show_missing = true
|
||||||
0
src/apps/ap/__init__.py
Normal file
0
src/apps/ap/__init__.py
Normal file
7
src/apps/ap/apps.py
Normal file
7
src/apps/ap/apps.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class ApConfig(AppConfig):
|
||||||
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
|
name = "apps.ap"
|
||||||
|
label = "ap"
|
||||||
0
src/apps/ap/tests/__init__.py
Normal file
0
src/apps/ap/tests/__init__.py
Normal file
0
src/apps/ap/tests/integrated/__init__.py
Normal file
0
src/apps/ap/tests/integrated/__init__.py
Normal file
119
src/apps/ap/tests/integrated/test_ap_views.py
Normal file
119
src/apps/ap/tests/integrated/test_ap_views.py
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from apps.drama.models import GameEvent, record
|
||||||
|
from apps.epic.models import Room
|
||||||
|
from apps.lyric.models import User
|
||||||
|
|
||||||
|
|
||||||
|
class WebFingerTest(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="actor@test.io", username="actor")
|
||||||
|
|
||||||
|
def test_returns_jrd_for_known_user(self):
|
||||||
|
response = self.client.get(
|
||||||
|
"/.well-known/webfinger",
|
||||||
|
{"resource": "acct:actor@earthmanrpg.me"},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertEqual(response["Content-Type"], "application/jrd+json")
|
||||||
|
|
||||||
|
def test_jrd_links_to_actor_url(self):
|
||||||
|
response = self.client.get(
|
||||||
|
"/.well-known/webfinger",
|
||||||
|
{"resource": "acct:actor@earthmanrpg.me"},
|
||||||
|
)
|
||||||
|
data = json.loads(response.content)
|
||||||
|
hrefs = [link["href"] for link in data["links"]]
|
||||||
|
self.assertTrue(any("/ap/users/actor/" in href for href in hrefs))
|
||||||
|
|
||||||
|
def test_returns_404_for_unknown_user(self):
|
||||||
|
response = self.client.get(
|
||||||
|
"/.well-known/webfinger",
|
||||||
|
{"resource": "acct:nobody@earthmanrpg.me"},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 404)
|
||||||
|
|
||||||
|
def test_returns_400_for_missing_resource(self):
|
||||||
|
response = self.client.get("/.well-known/webfinger")
|
||||||
|
self.assertEqual(response.status_code, 400)
|
||||||
|
|
||||||
|
|
||||||
|
class ActorViewTest(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="actor@test.io", username="actor")
|
||||||
|
|
||||||
|
def test_returns_200_for_known_user(self):
|
||||||
|
response = self.client.get("/ap/users/actor/")
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
def test_returns_activity_json_content_type(self):
|
||||||
|
response = self.client.get("/ap/users/actor/")
|
||||||
|
self.assertEqual(response["Content-Type"], "application/activity+json")
|
||||||
|
|
||||||
|
def test_actor_has_required_fields(self):
|
||||||
|
response = self.client.get("/ap/users/actor/")
|
||||||
|
data = json.loads(response.content)
|
||||||
|
self.assertEqual(data["type"], "Person")
|
||||||
|
self.assertIn("id", data)
|
||||||
|
self.assertIn("outbox", data)
|
||||||
|
self.assertIn("publicKey", data)
|
||||||
|
|
||||||
|
def test_requires_no_authentication(self):
|
||||||
|
# AP Actor endpoints must be publicly accessible
|
||||||
|
self.client.logout()
|
||||||
|
response = self.client.get("/ap/users/actor/")
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
def test_returns_404_for_unknown_user(self):
|
||||||
|
response = self.client.get("/ap/users/nobody/")
|
||||||
|
self.assertEqual(response.status_code, 404)
|
||||||
|
|
||||||
|
|
||||||
|
class OutboxViewTest(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="actor@test.io", username="actor")
|
||||||
|
self.room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
record(
|
||||||
|
self.room, GameEvent.SLOT_FILLED, actor=self.user,
|
||||||
|
slot_number=1, token_type="coin",
|
||||||
|
token_display="Coin", renewal_days=7,
|
||||||
|
)
|
||||||
|
record(
|
||||||
|
self.room, GameEvent.ROLE_SELECTED, actor=self.user,
|
||||||
|
role="PC", slot_number=1, role_display="Player",
|
||||||
|
)
|
||||||
|
# INVITE_SENT is unsupported — should be excluded from outbox
|
||||||
|
record(self.room, GameEvent.INVITE_SENT, actor=self.user)
|
||||||
|
|
||||||
|
def test_returns_200(self):
|
||||||
|
response = self.client.get("/ap/users/actor/outbox/")
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
def test_returns_activity_json_content_type(self):
|
||||||
|
response = self.client.get("/ap/users/actor/outbox/")
|
||||||
|
self.assertEqual(response["Content-Type"], "application/activity+json")
|
||||||
|
|
||||||
|
def test_outbox_is_ordered_collection(self):
|
||||||
|
response = self.client.get("/ap/users/actor/outbox/")
|
||||||
|
data = json.loads(response.content)
|
||||||
|
self.assertEqual(data["type"], "OrderedCollection")
|
||||||
|
|
||||||
|
def test_total_items_excludes_unsupported_verbs(self):
|
||||||
|
response = self.client.get("/ap/users/actor/outbox/")
|
||||||
|
data = json.loads(response.content)
|
||||||
|
# 2 supported events (SLOT_FILLED + ROLE_SELECTED); INVITE_SENT excluded
|
||||||
|
self.assertEqual(data["totalItems"], 2)
|
||||||
|
|
||||||
|
def test_requires_no_authentication(self):
|
||||||
|
self.client.logout()
|
||||||
|
response = self.client.get("/ap/users/actor/outbox/")
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
def test_returns_404_for_unknown_user(self):
|
||||||
|
response = self.client.get("/ap/users/nobody/outbox/")
|
||||||
|
self.assertEqual(response.status_code, 404)
|
||||||
0
src/apps/ap/tests/unit/__init__.py
Normal file
0
src/apps/ap/tests/unit/__init__.py
Normal file
88
src/apps/ap/tests/unit/test_activity.py
Normal file
88
src/apps/ap/tests/unit/test_activity.py
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from apps.drama.models import GameEvent, record
|
||||||
|
from apps.epic.models import Room
|
||||||
|
from apps.lyric.models import User
|
||||||
|
|
||||||
|
|
||||||
|
BASE = "https://earthmanrpg.me"
|
||||||
|
|
||||||
|
|
||||||
|
class ToActivityTest(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="actor@test.io", username="testactor")
|
||||||
|
self.room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
|
||||||
|
def _record(self, verb, **data):
|
||||||
|
return record(self.room, verb, actor=self.user, **data)
|
||||||
|
|
||||||
|
def test_slot_filled_returns_join_gate_activity(self):
|
||||||
|
event = self._record(
|
||||||
|
GameEvent.SLOT_FILLED,
|
||||||
|
slot_number=1, token_type="coin",
|
||||||
|
token_display="Coin", renewal_days=7,
|
||||||
|
)
|
||||||
|
activity = event.to_activity(BASE)
|
||||||
|
self.assertIsNotNone(activity)
|
||||||
|
self.assertEqual(activity["type"], "earthman:JoinGate")
|
||||||
|
|
||||||
|
def test_role_selected_returns_select_role_activity(self):
|
||||||
|
event = self._record(
|
||||||
|
GameEvent.ROLE_SELECTED,
|
||||||
|
role="PC", slot_number=1, role_display="Player",
|
||||||
|
)
|
||||||
|
activity = event.to_activity(BASE)
|
||||||
|
self.assertIsNotNone(activity)
|
||||||
|
self.assertEqual(activity["type"], "earthman:SelectRole")
|
||||||
|
|
||||||
|
def test_room_created_returns_create_activity(self):
|
||||||
|
event = self._record(GameEvent.ROOM_CREATED)
|
||||||
|
activity = event.to_activity(BASE)
|
||||||
|
self.assertIsNotNone(activity)
|
||||||
|
self.assertEqual(activity["type"], "Create")
|
||||||
|
|
||||||
|
def test_unsupported_verb_returns_none(self):
|
||||||
|
event = self._record(GameEvent.INVITE_SENT)
|
||||||
|
self.assertIsNone(event.to_activity(BASE))
|
||||||
|
|
||||||
|
def test_activity_contains_actor_url(self):
|
||||||
|
event = self._record(
|
||||||
|
GameEvent.ROLE_SELECTED,
|
||||||
|
role="PC", slot_number=1, role_display="Player",
|
||||||
|
)
|
||||||
|
activity = event.to_activity(BASE)
|
||||||
|
self.assertIn(BASE, activity["actor"])
|
||||||
|
|
||||||
|
def test_activity_contains_object_url(self):
|
||||||
|
event = self._record(
|
||||||
|
GameEvent.SLOT_FILLED,
|
||||||
|
slot_number=1, token_type="coin",
|
||||||
|
token_display="Coin", renewal_days=7,
|
||||||
|
)
|
||||||
|
activity = event.to_activity(BASE)
|
||||||
|
self.assertIn(str(self.room.id), activity["object"])
|
||||||
|
|
||||||
|
|
||||||
|
class EnsureKeypairTest(TestCase):
|
||||||
|
|
||||||
|
def test_ensure_keypair_populates_both_fields(self):
|
||||||
|
user = User.objects.create(email="keys@test.io")
|
||||||
|
self.assertEqual(user.ap_public_key, "")
|
||||||
|
self.assertEqual(user.ap_private_key, "")
|
||||||
|
user.ensure_keypair()
|
||||||
|
self.assertTrue(user.ap_public_key.startswith("-----BEGIN PUBLIC KEY-----"))
|
||||||
|
self.assertTrue(user.ap_private_key.startswith("-----BEGIN PRIVATE KEY-----"))
|
||||||
|
|
||||||
|
def test_ensure_keypair_persists_to_db(self):
|
||||||
|
user = User.objects.create(email="persist@test.io")
|
||||||
|
user.ensure_keypair()
|
||||||
|
refreshed = User.objects.get(pk=user.pk)
|
||||||
|
self.assertTrue(refreshed.ap_public_key.startswith("-----BEGIN PUBLIC KEY-----"))
|
||||||
|
|
||||||
|
def test_ensure_keypair_is_idempotent(self):
|
||||||
|
user = User.objects.create(email="idem@test.io")
|
||||||
|
user.ensure_keypair()
|
||||||
|
original_pub = user.ap_public_key
|
||||||
|
user.ensure_keypair()
|
||||||
|
self.assertEqual(user.ap_public_key, original_pub)
|
||||||
10
src/apps/ap/urls.py
Normal file
10
src/apps/ap/urls.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
app_name = "ap"
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("users/<str:username>/", views.actor, name="actor"),
|
||||||
|
path("users/<str:username>/outbox/", views.outbox, name="outbox"),
|
||||||
|
]
|
||||||
83
src/apps/ap/views.py
Normal file
83
src/apps/ap/views.py
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
from django.http import HttpResponse, JsonResponse
|
||||||
|
from django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
|
from apps.lyric.models import User
|
||||||
|
|
||||||
|
|
||||||
|
AP_CONTEXT = [
|
||||||
|
"https://www.w3.org/ns/activitystreams",
|
||||||
|
{"earthman": "https://earthmanrpg.me/ns#"},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _base_url(request):
|
||||||
|
return f"{request.scheme}://{request.get_host()}"
|
||||||
|
|
||||||
|
|
||||||
|
def _ap_response(data):
|
||||||
|
return HttpResponse(
|
||||||
|
json.dumps(data),
|
||||||
|
content_type="application/activity+json",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def webfinger(request):
|
||||||
|
resource = request.GET.get("resource", "")
|
||||||
|
if not resource:
|
||||||
|
return HttpResponse(status=400)
|
||||||
|
# Expect acct:username@host
|
||||||
|
if not resource.startswith("acct:"):
|
||||||
|
return HttpResponse(status=400)
|
||||||
|
username = resource[len("acct:"):].split("@")[0]
|
||||||
|
user = get_object_or_404(User, username=username)
|
||||||
|
base = _base_url(request)
|
||||||
|
data = {
|
||||||
|
"subject": resource,
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"rel": "self",
|
||||||
|
"type": "application/activity+json",
|
||||||
|
"href": f"{base}/ap/users/{user.username}/",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
return HttpResponse(json.dumps(data), content_type="application/jrd+json")
|
||||||
|
|
||||||
|
|
||||||
|
def actor(request, username):
|
||||||
|
user = get_object_or_404(User, username=username)
|
||||||
|
user.ensure_keypair()
|
||||||
|
base = _base_url(request)
|
||||||
|
actor_url = f"{base}/ap/users/{username}/"
|
||||||
|
data = {
|
||||||
|
"@context": AP_CONTEXT,
|
||||||
|
"id": actor_url,
|
||||||
|
"type": "Person",
|
||||||
|
"preferredUsername": username,
|
||||||
|
"inbox": f"{actor_url}inbox/",
|
||||||
|
"outbox": f"{actor_url}outbox/",
|
||||||
|
"publicKey": {
|
||||||
|
"id": f"{actor_url}#main-key",
|
||||||
|
"owner": actor_url,
|
||||||
|
"publicKeyPem": user.ap_public_key,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return _ap_response(data)
|
||||||
|
|
||||||
|
|
||||||
|
def outbox(request, username):
|
||||||
|
user = get_object_or_404(User, username=username)
|
||||||
|
base = _base_url(request)
|
||||||
|
events = user.game_events.select_related("room").order_by("timestamp")
|
||||||
|
activities = [a for e in events if (a := e.to_activity(base)) is not None]
|
||||||
|
actor_url = f"{base}/ap/users/{username}/"
|
||||||
|
data = {
|
||||||
|
"@context": AP_CONTEXT,
|
||||||
|
"id": f"{actor_url}outbox/",
|
||||||
|
"type": "OrderedCollection",
|
||||||
|
"totalItems": len(activities),
|
||||||
|
"orderedItems": activities,
|
||||||
|
}
|
||||||
|
return _ap_response(data)
|
||||||
24
src/apps/applets/migrations/0005_gameboard_applet_heights.py
Normal file
24
src/apps/applets/migrations/0005_gameboard_applet_heights.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def increase_gameboard_applet_heights(apps, schema_editor):
|
||||||
|
Applet = apps.get_model('applets', 'Applet')
|
||||||
|
Applet.objects.filter(slug__in=['new-game', 'game-kit', 'wallet-payment']).update(grid_rows=3)
|
||||||
|
|
||||||
|
|
||||||
|
def revert_gameboard_applet_heights(apps, schema_editor):
|
||||||
|
Applet = apps.get_model('applets', 'Applet')
|
||||||
|
Applet.objects.filter(slug__in=['new-game', 'game-kit', 'wallet-payment']).update(grid_rows=2)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
('applets', '0004_rename_list_applet_slugs')
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(
|
||||||
|
increase_gameboard_applet_heights,
|
||||||
|
revert_gameboard_applet_heights,
|
||||||
|
)
|
||||||
|
]
|
||||||
48
src/apps/applets/migrations/0006_billboard_applets.py
Normal file
48
src/apps/applets/migrations/0006_billboard_applets.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
def seed_billboard_applets(apps, schema_editor):
|
||||||
|
Applet = apps.get_model("applets", "Applet")
|
||||||
|
for slug, name, cols, rows in [
|
||||||
|
("billboard-my-scrolls", "My Scrolls", 4, 3),
|
||||||
|
("billboard-my-contacts", "Contacts", 4, 3),
|
||||||
|
("billboard-most-recent", "Most Recent", 8, 6),
|
||||||
|
]:
|
||||||
|
Applet.objects.get_or_create(
|
||||||
|
slug=slug,
|
||||||
|
defaults={"name": name, "grid_cols": cols, "grid_rows": rows, "context": "billboard"},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def remove_billboard_applets(apps, schema_editor):
|
||||||
|
Applet = apps.get_model("applets", "Applet")
|
||||||
|
Applet.objects.filter(slug__in=[
|
||||||
|
"billboard-my-scrolls",
|
||||||
|
"billboard-my-contacts",
|
||||||
|
"billboard-most-recent",
|
||||||
|
]).delete()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("applets", "0005_gameboard_applet_heights"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="applet",
|
||||||
|
name="context",
|
||||||
|
field=models.CharField(
|
||||||
|
choices=[
|
||||||
|
("dashboard", "Dashboard"),
|
||||||
|
("gameboard", "Gameboard"),
|
||||||
|
("wallet", "Wallet"),
|
||||||
|
("billboard", "Billboard"),
|
||||||
|
],
|
||||||
|
default="dashboard",
|
||||||
|
max_length=20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.RunPython(seed_billboard_applets, remove_billboard_applets),
|
||||||
|
]
|
||||||
29
src/apps/applets/migrations/0007_fix_billboard_applets.py
Normal file
29
src/apps/applets/migrations/0007_fix_billboard_applets.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def fix_billboard_applets(apps, schema_editor):
|
||||||
|
Applet = apps.get_model("applets", "Applet")
|
||||||
|
# billboard-scroll belongs only to the billscroll page template, not the grid
|
||||||
|
Applet.objects.filter(slug="billboard-scroll").delete()
|
||||||
|
# Rename "My Contacts" → "Contacts"
|
||||||
|
Applet.objects.filter(slug="billboard-my-contacts").update(name="Contacts")
|
||||||
|
|
||||||
|
|
||||||
|
def reverse_fix_billboard_applets(apps, schema_editor):
|
||||||
|
Applet = apps.get_model("applets", "Applet")
|
||||||
|
Applet.objects.get_or_create(
|
||||||
|
slug="billboard-scroll",
|
||||||
|
defaults={"name": "Billscroll", "grid_cols": 12, "grid_rows": 6, "context": "billboard"},
|
||||||
|
)
|
||||||
|
Applet.objects.filter(slug="billboard-my-contacts").update(name="My Contacts")
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("applets", "0006_billboard_applets"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(fix_billboard_applets, reverse_fix_billboard_applets),
|
||||||
|
]
|
||||||
25
src/apps/applets/migrations/0008_game_kit_applets.py
Normal file
25
src/apps/applets/migrations/0008_game_kit_applets.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def seed_game_kit_applets(apps, schema_editor):
|
||||||
|
Applet = apps.get_model('applets', 'Applet')
|
||||||
|
for slug, name in [
|
||||||
|
('gk-trinkets', 'Trinkets'),
|
||||||
|
('gk-tokens', 'Tokens'),
|
||||||
|
('gk-decks', 'Card Decks'),
|
||||||
|
('gk-dice', 'Dice Sets'),
|
||||||
|
]:
|
||||||
|
Applet.objects.get_or_create(
|
||||||
|
slug=slug,
|
||||||
|
defaults={'name': name, 'grid_cols': 3, 'grid_rows': 3, 'context': 'game-kit'},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
('applets', '0007_fix_billboard_applets'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(seed_game_kit_applets, migrations.RunPython.noop)
|
||||||
|
]
|
||||||
@@ -4,10 +4,12 @@ class Applet(models.Model):
|
|||||||
DASHBOARD = "dashboard"
|
DASHBOARD = "dashboard"
|
||||||
GAMEBOARD = "gameboard"
|
GAMEBOARD = "gameboard"
|
||||||
WALLET = "wallet"
|
WALLET = "wallet"
|
||||||
|
BILLBOARD = "billboard"
|
||||||
CONTEXT_CHOICES = [
|
CONTEXT_CHOICES = [
|
||||||
(DASHBOARD, "Dashboard"),
|
(DASHBOARD, "Dashboard"),
|
||||||
(GAMEBOARD, "Gameboard"),
|
(GAMEBOARD, "Gameboard"),
|
||||||
(WALLET, "Wallet"),
|
(WALLET, "Wallet"),
|
||||||
|
(BILLBOARD, "Billboard"),
|
||||||
]
|
]
|
||||||
|
|
||||||
slug = models.SlugField(unique=True)
|
slug = models.SlugField(unique=True)
|
||||||
|
|||||||
42
src/apps/applets/static/apps/applets/applets.js
Normal file
42
src/apps/applets/static/apps/applets/applets.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
const initGearMenus = () => {
|
||||||
|
document.querySelectorAll('.gear-btn').forEach(gear => {
|
||||||
|
const menuId = gear.dataset.menuTarget;
|
||||||
|
|
||||||
|
gear.addEventListener('click', (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
const menu = document.getElementById(menuId);
|
||||||
|
if (!menu) return;
|
||||||
|
const opening = menu.style.display === 'none' || menu.style.display === '';
|
||||||
|
menu.style.display = opening ? 'block' : 'none';
|
||||||
|
gear.classList.toggle('active', opening);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('click', (e) => {
|
||||||
|
const menu = document.getElementById(menuId);
|
||||||
|
if (!menu || menu.style.display === 'none') return;
|
||||||
|
if (e.target.closest('.applet-menu-cancel') || !menu.contains(e.target)) {
|
||||||
|
menu.style.display = 'none';
|
||||||
|
gear.classList.remove('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', initGearMenus);
|
||||||
|
|
||||||
|
const appletContainerIds = new Set([
|
||||||
|
'id_applets_container',
|
||||||
|
'id_game_applets_container',
|
||||||
|
'id_gk_sections_container',
|
||||||
|
'id_wallet_applets_container',
|
||||||
|
]);
|
||||||
|
|
||||||
|
document.body.addEventListener('htmx:afterSwap', (e) => {
|
||||||
|
if (!e.detail.target || !appletContainerIds.has(e.detail.target.id)) return;
|
||||||
|
document.querySelectorAll('.gear-btn').forEach(gear => {
|
||||||
|
const menu = document.getElementById(gear.dataset.menuTarget);
|
||||||
|
if (menu) menu.style.display = 'none';
|
||||||
|
gear.classList.remove('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
const initGearMenus = () => {
|
|
||||||
document.querySelectorAll('.gear-btn').forEach(gear => {
|
|
||||||
const menuId = gear.dataset.menuTarget;
|
|
||||||
|
|
||||||
gear.addEventListener('click', (e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
const menu = document.getElementById(menuId);
|
|
||||||
if (!menu) return;
|
|
||||||
menu.style.display = menu.style.display === 'none' ? 'block' : 'none';
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener('click', (e) => {
|
|
||||||
const menu = document.getElementById(menuId);
|
|
||||||
if (!menu || menu.style.display === 'none') return;
|
|
||||||
if (e.target.closest('.applet-menu-cancel') || !menu.contains(e.target)) {
|
|
||||||
menu.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', initGearMenus);
|
|
||||||
0
src/apps/billboard/__init__.py
Normal file
0
src/apps/billboard/__init__.py
Normal file
6
src/apps/billboard/apps.py
Normal file
6
src/apps/billboard/apps.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class BillboardConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'apps.billboard'
|
||||||
0
src/apps/billboard/tests/__init__.py
Normal file
0
src/apps/billboard/tests/__init__.py
Normal file
0
src/apps/billboard/tests/integrated/__init__.py
Normal file
0
src/apps/billboard/tests/integrated/__init__.py
Normal file
189
src/apps/billboard/tests/integrated/test_views.py
Normal file
189
src/apps/billboard/tests/integrated/test_views.py
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from apps.applets.models import Applet
|
||||||
|
from apps.drama.models import GameEvent, ScrollPosition, record
|
||||||
|
from apps.epic.models import Room
|
||||||
|
from apps.lyric.models import User
|
||||||
|
|
||||||
|
|
||||||
|
def _seed_billboard_applets():
|
||||||
|
for slug, name, cols, rows in [
|
||||||
|
("billboard-my-scrolls", "My Scrolls", 4, 3),
|
||||||
|
("billboard-my-contacts", "Contacts", 4, 3),
|
||||||
|
("billboard-most-recent", "Most Recent", 8, 6),
|
||||||
|
]:
|
||||||
|
Applet.objects.get_or_create(
|
||||||
|
slug=slug,
|
||||||
|
defaults={"name": name, "grid_cols": cols, "grid_rows": rows, "context": "billboard"},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class BillboardViewTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="test@billboard.io")
|
||||||
|
self.client.force_login(self.user)
|
||||||
|
_seed_billboard_applets()
|
||||||
|
|
||||||
|
def test_uses_billboard_template(self):
|
||||||
|
response = self.client.get("/billboard/")
|
||||||
|
self.assertTemplateUsed(response, "apps/billboard/billboard.html")
|
||||||
|
|
||||||
|
def test_passes_applets_context(self):
|
||||||
|
response = self.client.get("/billboard/")
|
||||||
|
self.assertIn("applets", response.context)
|
||||||
|
slugs = [e["applet"].slug for e in response.context["applets"]]
|
||||||
|
self.assertIn("billboard-my-scrolls", slugs)
|
||||||
|
self.assertIn("billboard-my-contacts", slugs)
|
||||||
|
self.assertIn("billboard-most-recent", slugs)
|
||||||
|
|
||||||
|
def test_passes_my_rooms_context(self):
|
||||||
|
room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
response = self.client.get("/billboard/")
|
||||||
|
self.assertIn(room, response.context["my_rooms"])
|
||||||
|
|
||||||
|
def test_passes_recent_room_and_events(self):
|
||||||
|
room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
record(
|
||||||
|
room, GameEvent.SLOT_FILLED, actor=self.user,
|
||||||
|
slot_number=1, token_type="coin",
|
||||||
|
token_display="Coin-on-a-String", renewal_days=7,
|
||||||
|
)
|
||||||
|
response = self.client.get("/billboard/")
|
||||||
|
self.assertEqual(response.context["recent_room"], room)
|
||||||
|
self.assertEqual(len(response.context["recent_events"]), 1)
|
||||||
|
|
||||||
|
def test_recent_events_capped_at_36(self):
|
||||||
|
room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
for i in range(40):
|
||||||
|
record(
|
||||||
|
room, GameEvent.SLOT_FILLED, actor=self.user,
|
||||||
|
slot_number=1, token_type="coin",
|
||||||
|
token_display="Coin-on-a-String", renewal_days=7,
|
||||||
|
)
|
||||||
|
response = self.client.get("/billboard/")
|
||||||
|
self.assertEqual(len(response.context["recent_events"]), 36)
|
||||||
|
|
||||||
|
def test_recent_events_in_chronological_order(self):
|
||||||
|
room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
for _ in range(3):
|
||||||
|
record(
|
||||||
|
room, GameEvent.SLOT_FILLED, actor=self.user,
|
||||||
|
slot_number=1, token_type="coin",
|
||||||
|
token_display="Coin-on-a-String", renewal_days=7,
|
||||||
|
)
|
||||||
|
response = self.client.get("/billboard/")
|
||||||
|
events = response.context["recent_events"]
|
||||||
|
timestamps = [e.timestamp for e in events]
|
||||||
|
self.assertEqual(timestamps, sorted(timestamps))
|
||||||
|
|
||||||
|
def test_recent_room_is_none_when_no_events(self):
|
||||||
|
response = self.client.get("/billboard/")
|
||||||
|
self.assertIsNone(response.context["recent_room"])
|
||||||
|
self.assertEqual(list(response.context["recent_events"]), [])
|
||||||
|
|
||||||
|
|
||||||
|
class ToggleBillboardAppletsTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="test@toggle.io")
|
||||||
|
self.client.force_login(self.user)
|
||||||
|
_seed_billboard_applets()
|
||||||
|
|
||||||
|
def test_toggle_hides_unchecked_applets(self):
|
||||||
|
response = self.client.post(
|
||||||
|
reverse("billboard:toggle_applets"),
|
||||||
|
{"applets": ["billboard-my-scrolls"]},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 302)
|
||||||
|
from apps.applets.models import UserApplet
|
||||||
|
contacts = Applet.objects.get(slug="billboard-my-contacts")
|
||||||
|
ua = UserApplet.objects.get(user=self.user, applet=contacts)
|
||||||
|
self.assertFalse(ua.visible)
|
||||||
|
|
||||||
|
def test_toggle_returns_partial_on_htmx(self):
|
||||||
|
response = self.client.post(
|
||||||
|
reverse("billboard:toggle_applets"),
|
||||||
|
{"applets": ["billboard-my-scrolls"]},
|
||||||
|
HTTP_HX_REQUEST="true",
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertTemplateUsed(response, "apps/billboard/_partials/_applets.html")
|
||||||
|
|
||||||
|
|
||||||
|
class BillscrollViewTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="test@billscroll.io")
|
||||||
|
self.client.force_login(self.user)
|
||||||
|
self.room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
record(
|
||||||
|
self.room, GameEvent.SLOT_FILLED, actor=self.user,
|
||||||
|
slot_number=1, token_type="coin",
|
||||||
|
token_display="Coin-on-a-String", renewal_days=7,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_uses_room_scroll_template(self):
|
||||||
|
response = self.client.get(f"/billboard/room/{self.room.id}/scroll/")
|
||||||
|
self.assertTemplateUsed(response, "apps/billboard/room_scroll.html")
|
||||||
|
|
||||||
|
def test_passes_events_context(self):
|
||||||
|
response = self.client.get(f"/billboard/room/{self.room.id}/scroll/")
|
||||||
|
self.assertIn("events", response.context)
|
||||||
|
self.assertEqual(response.context["events"].count(), 1)
|
||||||
|
|
||||||
|
def test_passes_page_class_billscroll(self):
|
||||||
|
response = self.client.get(f"/billboard/room/{self.room.id}/scroll/")
|
||||||
|
self.assertEqual(response.context["page_class"], "page-billscroll")
|
||||||
|
|
||||||
|
def test_passes_scroll_position_zero_when_none_saved(self):
|
||||||
|
response = self.client.get(f"/billboard/room/{self.room.id}/scroll/")
|
||||||
|
self.assertEqual(response.context["scroll_position"], 0)
|
||||||
|
|
||||||
|
def test_passes_saved_scroll_position_in_context(self):
|
||||||
|
ScrollPosition.objects.create(user=self.user, room=self.room, position=250)
|
||||||
|
response = self.client.get(f"/billboard/room/{self.room.id}/scroll/")
|
||||||
|
self.assertEqual(response.context["scroll_position"], 250)
|
||||||
|
|
||||||
|
def test_scroll_renders_event_body_and_time_columns(self):
|
||||||
|
response = self.client.get(f"/billboard/room/{self.room.id}/scroll/")
|
||||||
|
self.assertContains(response, 'class="drama-event-body"')
|
||||||
|
self.assertContains(response, 'class="drama-event-time"')
|
||||||
|
|
||||||
|
|
||||||
|
class SaveScrollPositionTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="test@savescroll.io")
|
||||||
|
self.client.force_login(self.user)
|
||||||
|
self.room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
|
||||||
|
def test_post_saves_scroll_position(self):
|
||||||
|
self.client.post(
|
||||||
|
f"/billboard/room/{self.room.id}/scroll-position/",
|
||||||
|
{"position": 300},
|
||||||
|
)
|
||||||
|
sp = ScrollPosition.objects.get(user=self.user, room=self.room)
|
||||||
|
self.assertEqual(sp.position, 300)
|
||||||
|
|
||||||
|
def test_post_updates_existing_position(self):
|
||||||
|
ScrollPosition.objects.create(user=self.user, room=self.room, position=100)
|
||||||
|
self.client.post(
|
||||||
|
f"/billboard/room/{self.room.id}/scroll-position/",
|
||||||
|
{"position": 450},
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
ScrollPosition.objects.get(user=self.user, room=self.room).position, 450
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_post_returns_204(self):
|
||||||
|
response = self.client.post(
|
||||||
|
f"/billboard/room/{self.room.id}/scroll-position/",
|
||||||
|
{"position": 100},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 204)
|
||||||
|
|
||||||
|
def test_post_requires_login(self):
|
||||||
|
self.client.logout()
|
||||||
|
response = self.client.post(
|
||||||
|
f"/billboard/room/{self.room.id}/scroll-position/",
|
||||||
|
{"position": 100},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 302)
|
||||||
12
src/apps/billboard/urls.py
Normal file
12
src/apps/billboard/urls.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from apps.billboard import views
|
||||||
|
|
||||||
|
app_name = "billboard"
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("", views.billboard, name="billboard"),
|
||||||
|
path("toggle-applets", views.toggle_billboard_applets, name="toggle_applets"),
|
||||||
|
path("room/<uuid:room_id>/scroll/", views.room_scroll, name="scroll"),
|
||||||
|
path("room/<uuid:room_id>/scroll-position/", views.save_scroll_position, name="save_scroll_position"),
|
||||||
|
]
|
||||||
86
src/apps/billboard/views.py
Normal file
86
src/apps/billboard/views.py
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.db.models import Max, Q
|
||||||
|
from django.shortcuts import redirect, render
|
||||||
|
|
||||||
|
from apps.applets.models import Applet, UserApplet
|
||||||
|
from apps.applets.utils import applet_context
|
||||||
|
from apps.drama.models import GameEvent, ScrollPosition
|
||||||
|
from apps.epic.models import GateSlot, Room, RoomInvite
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url="/")
|
||||||
|
def billboard(request):
|
||||||
|
my_rooms = Room.objects.filter(
|
||||||
|
Q(owner=request.user) |
|
||||||
|
Q(gate_slots__gamer=request.user) |
|
||||||
|
Q(invites__invitee_email=request.user.email, invites__status=RoomInvite.PENDING)
|
||||||
|
).distinct().order_by("-created_at")
|
||||||
|
|
||||||
|
recent_room = (
|
||||||
|
Room.objects.filter(
|
||||||
|
Q(owner=request.user) | Q(gate_slots__gamer=request.user)
|
||||||
|
)
|
||||||
|
.annotate(last_event=Max("events__timestamp"))
|
||||||
|
.filter(last_event__isnull=False)
|
||||||
|
.order_by("-last_event")
|
||||||
|
.distinct()
|
||||||
|
.first()
|
||||||
|
)
|
||||||
|
recent_events = (
|
||||||
|
list(recent_room.events.select_related("actor").order_by("-timestamp")[:36])[::-1]
|
||||||
|
if recent_room else []
|
||||||
|
)
|
||||||
|
|
||||||
|
return render(request, "apps/billboard/billboard.html", {
|
||||||
|
"my_rooms": my_rooms,
|
||||||
|
"recent_room": recent_room,
|
||||||
|
"recent_events": recent_events,
|
||||||
|
"viewer": request.user,
|
||||||
|
"applets": applet_context(request.user, "billboard"),
|
||||||
|
"page_class": "page-billboard",
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url="/")
|
||||||
|
def toggle_billboard_applets(request):
|
||||||
|
checked = request.POST.getlist("applets")
|
||||||
|
for applet in Applet.objects.filter(context="billboard"):
|
||||||
|
UserApplet.objects.update_or_create(
|
||||||
|
user=request.user,
|
||||||
|
applet=applet,
|
||||||
|
defaults={"visible": applet.slug in checked},
|
||||||
|
)
|
||||||
|
if request.headers.get("HX-Request"):
|
||||||
|
return render(request, "apps/billboard/_partials/_applets.html", {
|
||||||
|
"applets": applet_context(request.user, "billboard"),
|
||||||
|
})
|
||||||
|
return redirect("billboard:billboard")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url="/")
|
||||||
|
def room_scroll(request, room_id):
|
||||||
|
room = Room.objects.get(id=room_id)
|
||||||
|
events = room.events.select_related("actor").all()
|
||||||
|
sp = ScrollPosition.objects.filter(user=request.user, room=room).first()
|
||||||
|
return render(request, "apps/billboard/room_scroll.html", {
|
||||||
|
"room": room,
|
||||||
|
"events": events,
|
||||||
|
"viewer": request.user,
|
||||||
|
"scroll_position": sp.position if sp else 0,
|
||||||
|
"page_class": "page-billscroll",
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url="/")
|
||||||
|
def save_scroll_position(request, room_id):
|
||||||
|
if request.method != "POST":
|
||||||
|
from django.http import HttpResponseNotAllowed
|
||||||
|
return HttpResponseNotAllowed(["POST"])
|
||||||
|
room = Room.objects.get(id=room_id)
|
||||||
|
position = int(request.POST.get("position", 0))
|
||||||
|
ScrollPosition.objects.update_or_create(
|
||||||
|
user=request.user, room=room,
|
||||||
|
defaults={"position": position},
|
||||||
|
)
|
||||||
|
from django.http import HttpResponse
|
||||||
|
return HttpResponse(status=204)
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-12 19:30
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('dashboard', '0002_rename_list_to_note'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='note',
|
||||||
|
name='owner',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notes', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='note',
|
||||||
|
name='shared_with',
|
||||||
|
field=models.ManyToManyField(blank=True, related_name='shared_notes', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
]
|
||||||
43
src/apps/dashboard/static/apps/dashboard/dashboard.js
Normal file
43
src/apps/dashboard/static/apps/dashboard/dashboard.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// console.log("apps/scripts/dashboard.js loading");
|
||||||
|
const initialize = (inputSelector) => {
|
||||||
|
// console.log("initialize called!");
|
||||||
|
const textInput = document.querySelector(inputSelector);
|
||||||
|
if (!textInput) return;
|
||||||
|
textInput.oninput = () => {
|
||||||
|
// console.log("oninput triggered");
|
||||||
|
textInput.classList.remove("is-invalid");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const bindPaletteWheel = () => {
|
||||||
|
document.querySelectorAll('.palette-scroll').forEach(el => {
|
||||||
|
el.addEventListener('wheel', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
el.scrollLeft += e.deltaY;
|
||||||
|
}, { passive: false });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const bindPaletteForms = () => {
|
||||||
|
document.querySelectorAll('form[action*="set_palette"]').forEach(form => {
|
||||||
|
form.addEventListener("submit", async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const resp = await fetch(form.action, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Accept": "application/json" },
|
||||||
|
body: new FormData(form, e.submitter),
|
||||||
|
});
|
||||||
|
if (!resp.ok) return;
|
||||||
|
const { palette } = await resp.json();
|
||||||
|
// Swap body palette class
|
||||||
|
[...document.body.classList]
|
||||||
|
.filter(c => c.startsWith("palette-"))
|
||||||
|
.forEach(c => document.body.classList.remove(c));
|
||||||
|
document.body.classList.add(palette);
|
||||||
|
// Update active swatch indicator
|
||||||
|
document.querySelectorAll(".swatch").forEach(sw => {
|
||||||
|
sw.classList.toggle("active", sw.classList.contains(palette));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
95
src/apps/dashboard/static/apps/dashboard/game-kit.js
Normal file
95
src/apps/dashboard/static/apps/dashboard/game-kit.js
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
(function () {
|
||||||
|
var btn = document.getElementById('id_kit_btn');
|
||||||
|
var dialog = document.getElementById('id_kit_bag_dialog');
|
||||||
|
if (!btn || !dialog) return;
|
||||||
|
|
||||||
|
btn.addEventListener('click', function () {
|
||||||
|
if (dialog.hasAttribute('open')) {
|
||||||
|
dialog.removeAttribute('open');
|
||||||
|
btn.classList.remove('active');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fetch(btn.dataset.kitUrl, {
|
||||||
|
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||||
|
})
|
||||||
|
.then(function (r) { return r.text(); })
|
||||||
|
.then(function (html) {
|
||||||
|
dialog.innerHTML = html;
|
||||||
|
attachCardListeners();
|
||||||
|
btn.classList.add('active');
|
||||||
|
dialog.setAttribute('open', '');
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
btn.classList.remove('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Escape key
|
||||||
|
document.addEventListener('keydown', function (e) {
|
||||||
|
if (e.key === 'Escape' && dialog.hasAttribute('open')) {
|
||||||
|
dialog.removeAttribute('open');
|
||||||
|
btn.classList.remove('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Click outside (but not on the rails button — let that flow through)
|
||||||
|
document.addEventListener('click', function (e) {
|
||||||
|
if (!dialog.hasAttribute('open')) return;
|
||||||
|
if (dialog.contains(e.target)) return;
|
||||||
|
if (e.target === btn || btn.contains(e.target)) return;
|
||||||
|
if (e.target.closest('button.token-rails')) return;
|
||||||
|
dialog.removeAttribute('open');
|
||||||
|
btn.classList.remove('active');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Inject token_id before token-rails form submits
|
||||||
|
document.addEventListener('click', function (e) {
|
||||||
|
var rails = e.target.closest('button.token-rails');
|
||||||
|
if (!rails || !window._kitTokenId) return;
|
||||||
|
var form = rails.closest('form');
|
||||||
|
if (!form) return;
|
||||||
|
var existing = form.querySelector('input[name="token_id"]');
|
||||||
|
if (existing) existing.remove();
|
||||||
|
var hidden = document.createElement('input');
|
||||||
|
hidden.type = 'hidden';
|
||||||
|
hidden.name = 'token_id';
|
||||||
|
hidden.value = window._kitTokenId;
|
||||||
|
form.appendChild(hidden);
|
||||||
|
if (dialog.hasAttribute('open')) dialog.removeAttribute('open');
|
||||||
|
});
|
||||||
|
|
||||||
|
function attachTooltip(el) {
|
||||||
|
el.addEventListener('mouseenter', function () {
|
||||||
|
var tooltip = el.querySelector('.token-tooltip');
|
||||||
|
if (!tooltip) return;
|
||||||
|
var rect = el.getBoundingClientRect();
|
||||||
|
tooltip.style.position = 'fixed';
|
||||||
|
tooltip.style.bottom = (window.innerHeight - rect.top + 8) + 'px';
|
||||||
|
tooltip.style.left = rect.left + 'px';
|
||||||
|
tooltip.style.display = 'block';
|
||||||
|
});
|
||||||
|
el.addEventListener('mouseleave', function () {
|
||||||
|
var tooltip = el.querySelector('.token-tooltip');
|
||||||
|
if (tooltip) tooltip.style.display = '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function attachCardListeners() {
|
||||||
|
dialog.querySelectorAll('.token[data-token-id]').forEach(function (card) {
|
||||||
|
card.addEventListener('click', function () {
|
||||||
|
dialog.querySelectorAll('.token[data-token-id].selected').forEach(function (c) {
|
||||||
|
c.classList.remove('selected');
|
||||||
|
});
|
||||||
|
card.classList.add('selected');
|
||||||
|
window._kitTokenId = card.dataset.tokenId;
|
||||||
|
var slot = document.querySelector('.token-slot');
|
||||||
|
if (slot) slot.classList.add('ready');
|
||||||
|
});
|
||||||
|
attachTooltip(card);
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.querySelectorAll('.kit-bag-deck').forEach(attachTooltip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}());
|
||||||
@@ -21,27 +21,7 @@ const initWallet = () => {
|
|||||||
saveBtn.hidden = false;
|
saveBtn.hidden = false;
|
||||||
cancelBtn.hidden = false;
|
cancelBtn.hidden = false;
|
||||||
const section = addBtn.closest('section');
|
const section = addBtn.closest('section');
|
||||||
const rowPx = 3 * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
section.style.setProperty('--applet-rows', '15');
|
||||||
const updateRows = () => {
|
|
||||||
const sectionTop = section.getBoundingClientRect().top;
|
|
||||||
let maxBottom = sectionTop;
|
|
||||||
for (const child of section.children) {
|
|
||||||
if (child.hidden) continue;
|
|
||||||
maxBottom = Math.max(maxBottom, child.getBoundingClientRect().bottom);
|
|
||||||
}
|
|
||||||
const padBot = parseFloat(getComputedStyle(section).paddingBottom);
|
|
||||||
const rows = Math.ceil((maxBottom - sectionTop + padBot) / rowPx) + 1;
|
|
||||||
section.style.setProperty('--applet-rows', String(rows));
|
|
||||||
};
|
|
||||||
paymentEl.on('ready', () => {
|
|
||||||
updateRows();
|
|
||||||
const stripeContainer = document.getElementById('id_stripe_payment_element');
|
|
||||||
if (stripeContainer) {
|
|
||||||
const obs = new ResizeObserver(updateRows);
|
|
||||||
obs.observe(stripeContainer);
|
|
||||||
section._stripeObs = obs;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
saveBtn.addEventListener('click', async () => {
|
saveBtn.addEventListener('click', async () => {
|
||||||
@@ -68,8 +48,7 @@ const initWallet = () => {
|
|||||||
saveBtn.hidden = true;
|
saveBtn.hidden = true;
|
||||||
cancelBtn.hidden = true;
|
cancelBtn.hidden = true;
|
||||||
const section = cancelBtn.closest('section');
|
const section = cancelBtn.closest('section');
|
||||||
section.style.setProperty('--applet-rows', '2');
|
section.style.setProperty('--applet-rows', '3');
|
||||||
if (section._stripeObs) { section._stripeObs.disconnect(); section._stripeObs = null; }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cancelBtn.addEventListener('click', () => {
|
cancelBtn.addEventListener('click', () => {
|
||||||
@@ -81,8 +60,7 @@ const initWallet = () => {
|
|||||||
saveBtn.hidden = true;
|
saveBtn.hidden = true;
|
||||||
cancelBtn.hidden = true;
|
cancelBtn.hidden = true;
|
||||||
const section = cancelBtn.closest('section');
|
const section = cancelBtn.closest('section');
|
||||||
section.style.setProperty('--applet-rows', '2');
|
section.style.setProperty('--applet-rows', '3');
|
||||||
if (section._stripeObs) { section._stripeObs.disconnect(); section._stripeObs = null; }
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// console.log("apps/scripts/dashboard.js loading");
|
|
||||||
const initialize = (inputSelector) => {
|
|
||||||
// console.log("initialize called!");
|
|
||||||
const textInput = document.querySelector(inputSelector);
|
|
||||||
if (!textInput) return;
|
|
||||||
textInput.oninput = () => {
|
|
||||||
// console.log("oninput triggered");
|
|
||||||
textInput.classList.remove("is-invalid");
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -299,11 +299,30 @@ class SetPaletteTest(TestCase):
|
|||||||
response = self.client.post("/dashboard/set_palette", data={"palette": "palette-default"})
|
response = self.client.post("/dashboard/set_palette", data={"palette": "palette-default"})
|
||||||
self.assertRedirects(response, "/", fetch_redirect_response=False)
|
self.assertRedirects(response, "/", fetch_redirect_response=False)
|
||||||
|
|
||||||
|
def test_set_palette_returns_json_when_requested(self):
|
||||||
|
response = self.client.post(
|
||||||
|
"/dashboard/set_palette",
|
||||||
|
data={"palette": "palette-sepia"},
|
||||||
|
headers={"Accept": "application/json"},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertEqual(response.json(), {"palette": "palette-sepia"})
|
||||||
|
|
||||||
|
def test_locked_palette_returns_unchanged_json(self):
|
||||||
|
response = self.client.post(
|
||||||
|
"/dashboard/set_palette",
|
||||||
|
data={"palette": "palette-nirvana"},
|
||||||
|
headers={"Accept": "application/json"},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertEqual(response.json(), {"palette": "palette-default"})
|
||||||
|
|
||||||
def test_dashboard_contains_set_palette_form(self):
|
def test_dashboard_contains_set_palette_form(self):
|
||||||
response = self.client.get(self.url)
|
response = self.client.get(self.url)
|
||||||
parsed = lxml.html.fromstring(response.content)
|
parsed = lxml.html.fromstring(response.content)
|
||||||
forms = parsed.cssselect('form[action="/dashboard/set_palette"]')
|
forms = parsed.cssselect('form[action="/dashboard/set_palette"]')
|
||||||
self.assertEqual(len(forms), 1)
|
unlocked = [p for p in response.context["palettes"] if not p["locked"]]
|
||||||
|
self.assertEqual(len(forms), len(unlocked))
|
||||||
|
|
||||||
def test_active_palette_swatch_has_active_class(self):
|
def test_active_palette_swatch_has_active_class(self):
|
||||||
response = self.client.get(self.url)
|
response = self.client.get(self.url)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class WalletViewTest(TestCase):
|
|||||||
[_] = self.parsed.cssselect("#id_coin_on_a_string")
|
[_] = self.parsed.cssselect("#id_coin_on_a_string")
|
||||||
|
|
||||||
def test_wallet_page_shows_free_token(self):
|
def test_wallet_page_shows_free_token(self):
|
||||||
[_] = self.parsed.cssselect("#id_free_token_0")
|
[_] = self.parsed.cssselect("#id_free_token")
|
||||||
|
|
||||||
def test_wallet_page_shows_payment_methods_section(self):
|
def test_wallet_page_shows_payment_methods_section(self):
|
||||||
[_] = self.parsed.cssselect("#id_add_payment_method")
|
[_] = self.parsed.cssselect("#id_add_payment_method")
|
||||||
@@ -61,7 +61,7 @@ class WalletViewAppletContextTest(TestCase):
|
|||||||
)
|
)
|
||||||
Applet.objects.get_or_create(
|
Applet.objects.get_or_create(
|
||||||
slug="wallet-payment",
|
slug="wallet-payment",
|
||||||
defaults={"name": "Payment Methods", "grid_cols": 6, "grid_rows": 2, "context": "wallet"},
|
defaults={"name": "Payment Methods", "grid_cols": 6, "grid_rows": 3, "context": "wallet"},
|
||||||
)
|
)
|
||||||
self.client.force_login(self.user)
|
self.client.force_login(self.user)
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ class ToggleWalletAppletsTest(TestCase):
|
|||||||
)[0]
|
)[0]
|
||||||
Applet.objects.get_or_create(
|
Applet.objects.get_or_create(
|
||||||
slug="wallet-payment",
|
slug="wallet-payment",
|
||||||
defaults={"name": "Payment Methods", "grid_cols": 6, "grid_rows": 2, "context": "wallet"},
|
defaults={"name": "Payment Methods", "grid_cols": 6, "grid_rows": 3, "context": "wallet"},
|
||||||
)
|
)
|
||||||
self.client.force_login(self.user)
|
self.client.force_login(self.user)
|
||||||
|
|
||||||
|
|||||||
@@ -13,4 +13,5 @@ urlpatterns = [
|
|||||||
path('wallet/toggle-applets', views.toggle_wallet_applets, name='toggle_wallet_applets'),
|
path('wallet/toggle-applets', views.toggle_wallet_applets, name='toggle_wallet_applets'),
|
||||||
path('wallet/setup-intent', views.setup_intent, name='setup_intent'),
|
path('wallet/setup-intent', views.setup_intent, name='setup_intent'),
|
||||||
path('wallet/save-payment-method', views.save_payment_method, name='save_payment_method'),
|
path('wallet/save-payment-method', views.save_payment_method, name='save_payment_method'),
|
||||||
|
path('kit-bag/', views.kit_bag, name='kit_bag'),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.db.models import Max, Q
|
from django.db.models import Max, Q
|
||||||
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
|
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
|
from django.utils import timezone
|
||||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||||
|
|
||||||
from apps.applets.models import Applet, UserApplet
|
from apps.applets.models import Applet, UserApplet
|
||||||
@@ -16,9 +17,17 @@ from apps.lyric.models import PaymentMethod, Token, User, Wallet
|
|||||||
|
|
||||||
|
|
||||||
APPLET_ORDER = ["wallet", "new-note", "my-notes", "username", "palette"]
|
APPLET_ORDER = ["wallet", "new-note", "my-notes", "username", "palette"]
|
||||||
UNLOCKED_PALETTES = frozenset(["palette-default"])
|
UNLOCKED_PALETTES = frozenset([
|
||||||
|
"palette-default",
|
||||||
|
"palette-sepia",
|
||||||
|
"palette-oblivion-light",
|
||||||
|
"palette-monochrome-dark",
|
||||||
|
])
|
||||||
PALETTES = [
|
PALETTES = [
|
||||||
{"name": "palette-default", "label": "Earthman", "locked": False},
|
{"name": "palette-default", "label": "Earthman", "locked": False},
|
||||||
|
{"name": "palette-sepia", "label": "Sepia", "locked": False},
|
||||||
|
{"name": "palette-oblivion-light", "label": "Oblivion (Light)", "locked": False},
|
||||||
|
{"name": "palette-monochrome-dark", "label": "Monochrome (Dark)", "locked": False},
|
||||||
{"name": "palette-nirvana", "label": "Nirvana", "locked": True},
|
{"name": "palette-nirvana", "label": "Nirvana", "locked": True},
|
||||||
{"name": "palette-sheol", "label": "Sheol", "locked": True},
|
{"name": "palette-sheol", "label": "Sheol", "locked": True},
|
||||||
{"name": "palette-inferno", "label": "Inferno", "locked": True},
|
{"name": "palette-inferno", "label": "Inferno", "locked": True},
|
||||||
@@ -113,6 +122,8 @@ def set_palette(request):
|
|||||||
if palette in UNLOCKED_PALETTES:
|
if palette in UNLOCKED_PALETTES:
|
||||||
request.user.palette = palette
|
request.user.palette = palette
|
||||||
request.user.save(update_fields=["palette"])
|
request.user.save(update_fields=["palette"])
|
||||||
|
if "application/json" in request.headers.get("Accept", ""):
|
||||||
|
return JsonResponse({"palette": request.user.palette})
|
||||||
return redirect("home")
|
return redirect("home")
|
||||||
|
|
||||||
@login_required(login_url="/")
|
@login_required(login_url="/")
|
||||||
@@ -146,13 +157,38 @@ def toggle_applets(request):
|
|||||||
def wallet(request):
|
def wallet(request):
|
||||||
return render(request, "apps/dashboard/wallet.html", {
|
return render(request, "apps/dashboard/wallet.html", {
|
||||||
"wallet": request.user.wallet,
|
"wallet": request.user.wallet,
|
||||||
|
"pass_token": request.user.tokens.filter(token_type=Token.PASS).first(),
|
||||||
"coin": request.user.tokens.filter(token_type=Token.COIN).first(),
|
"coin": request.user.tokens.filter(token_type=Token.COIN).first(),
|
||||||
"free_tokens": list(request.user.tokens.filter(token_type=Token.FREE)),
|
"free_tokens": list(request.user.tokens.filter(
|
||||||
|
token_type=Token.FREE, expires_at__gt=timezone.now()
|
||||||
|
).order_by("expires_at")),
|
||||||
"tithe_tokens": list(request.user.tokens.filter(token_type=Token.TITHE)),
|
"tithe_tokens": list(request.user.tokens.filter(token_type=Token.TITHE)),
|
||||||
|
"free_count": request.user.tokens.filter(
|
||||||
|
token_type=Token.FREE, expires_at__gt=timezone.now()
|
||||||
|
).count(),
|
||||||
|
"tithe_count": request.user.tokens.filter(token_type=Token.TITHE).count(),
|
||||||
"applets": applet_context(request.user, "wallet"),
|
"applets": applet_context(request.user, "wallet"),
|
||||||
"page_class": "page-wallet",
|
"page_class": "page-wallet",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url="/")
|
||||||
|
def kit_bag(request):
|
||||||
|
tokens = list(request.user.tokens.all())
|
||||||
|
free_tokens = sorted(
|
||||||
|
[t for t in tokens if t.token_type == Token.FREE and t.expires_at and t.expires_at > timezone.now()],
|
||||||
|
key=lambda t: t.expires_at,
|
||||||
|
)
|
||||||
|
tithe_tokens = [t for t in tokens if t.token_type == Token.TITHE]
|
||||||
|
return render(request, "core/_partials/_kit_bag_panel.html", {
|
||||||
|
"equipped_deck": request.user.equipped_deck,
|
||||||
|
"equipped_trinket": request.user.equipped_trinket,
|
||||||
|
"free_token": free_tokens[0] if free_tokens else None,
|
||||||
|
"free_count": len(free_tokens),
|
||||||
|
"tithe_token": tithe_tokens[0] if tithe_tokens else None,
|
||||||
|
"tithe_count": len(tithe_tokens),
|
||||||
|
})
|
||||||
|
|
||||||
@login_required(login_url="/")
|
@login_required(login_url="/")
|
||||||
def toggle_wallet_applets(request):
|
def toggle_wallet_applets(request):
|
||||||
checked = request.POST.getlist("applets")
|
checked = request.POST.getlist("applets")
|
||||||
@@ -166,6 +202,7 @@ def toggle_wallet_applets(request):
|
|||||||
return render(request, "apps/wallet/_partials/_applets.html", {
|
return render(request, "apps/wallet/_partials/_applets.html", {
|
||||||
"applets": applet_context(request.user, "wallet"),
|
"applets": applet_context(request.user, "wallet"),
|
||||||
"wallet": request.user.wallet,
|
"wallet": request.user.wallet,
|
||||||
|
"pass_token": request.user.tokens.filter(token_type=Token.PASS).first(),
|
||||||
"coin": request.user.tokens.filter(token_type=Token.COIN).first(),
|
"coin": request.user.tokens.filter(token_type=Token.COIN).first(),
|
||||||
"free_tokens": list(request.user.tokens.filter(token_type=Token.FREE)),
|
"free_tokens": list(request.user.tokens.filter(token_type=Token.FREE)),
|
||||||
"tithe_tokens": list(request.user.tokens.filter(token_type=Token.TITHE)),
|
"tithe_tokens": list(request.user.tokens.filter(token_type=Token.TITHE)),
|
||||||
|
|||||||
0
src/apps/drama/__init__.py
Normal file
0
src/apps/drama/__init__.py
Normal file
19
src/apps/drama/admin.py
Normal file
19
src/apps/drama/admin.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from apps.drama.models import GameEvent
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(GameEvent)
|
||||||
|
class GameEventAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("timestamp", "room", "actor", "verb")
|
||||||
|
list_filter = ("verb",)
|
||||||
|
readonly_fields = ("room", "actor", "verb", "data", "timestamp")
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def has_delete_permission(self, request, obj=None):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def has_change_permission(self, request, obj=None):
|
||||||
|
return False
|
||||||
6
src/apps/drama/apps.py
Normal file
6
src/apps/drama/apps.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class DramaConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'apps.drama'
|
||||||
32
src/apps/drama/migrations/0001_initial.py
Normal file
32
src/apps/drama/migrations/0001_initial.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-19 18:34
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0006_table_status_and_table_seat'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='GameEvent',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('verb', models.CharField(choices=[('room_created', 'Room created'), ('slot_reserved', 'Gate slot reserved'), ('slot_filled', 'Gate slot filled'), ('slot_returned', 'Gate slot returned'), ('slot_released', 'Gate slot released'), ('invite_sent', 'Invite sent'), ('role_select_started', 'Role select started'), ('role_selected', 'Role selected'), ('roles_revealed', 'Roles revealed')], max_length=30)),
|
||||||
|
('data', models.JSONField(default=dict)),
|
||||||
|
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('actor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='game_events', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='events', to='epic.room')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['timestamp'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
30
src/apps/drama/migrations/0002_scrollposition.py
Normal file
30
src/apps/drama/migrations/0002_scrollposition.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-24 21:36
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('drama', '0001_initial'),
|
||||||
|
('epic', '0006_table_status_and_table_seat'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ScrollPosition',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('position', models.PositiveIntegerField(default=0)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='scroll_positions', to='epic.room')),
|
||||||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='scroll_positions', to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'unique_together': {('user', 'room')},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
0
src/apps/drama/migrations/__init__.py
Normal file
0
src/apps/drama/migrations/__init__.py
Normal file
136
src/apps/drama/models.py
Normal file
136
src/apps/drama/models.py
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class GameEvent(models.Model):
|
||||||
|
# Gate phase
|
||||||
|
ROOM_CREATED = "room_created"
|
||||||
|
SLOT_RESERVED = "slot_reserved"
|
||||||
|
SLOT_FILLED = "slot_filled"
|
||||||
|
SLOT_RETURNED = "slot_returned"
|
||||||
|
SLOT_RELEASED = "slot_released"
|
||||||
|
INVITE_SENT = "invite_sent"
|
||||||
|
# Role Select phase
|
||||||
|
ROLE_SELECT_STARTED = "role_select_started"
|
||||||
|
ROLE_SELECTED = "role_selected"
|
||||||
|
ROLES_REVEALED = "roles_revealed"
|
||||||
|
|
||||||
|
VERB_CHOICES = [
|
||||||
|
(ROOM_CREATED, "Room created"),
|
||||||
|
(SLOT_RESERVED, "Gate slot reserved"),
|
||||||
|
(SLOT_FILLED, "Gate slot filled"),
|
||||||
|
(SLOT_RETURNED, "Gate slot returned"),
|
||||||
|
(SLOT_RELEASED, "Gate slot released"),
|
||||||
|
(INVITE_SENT, "Invite sent"),
|
||||||
|
(ROLE_SELECT_STARTED, "Role select started"),
|
||||||
|
(ROLE_SELECTED, "Role selected"),
|
||||||
|
(ROLES_REVEALED, "Roles revealed"),
|
||||||
|
]
|
||||||
|
|
||||||
|
room = models.ForeignKey(
|
||||||
|
"epic.Room", on_delete=models.CASCADE, related_name="events",
|
||||||
|
)
|
||||||
|
actor = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, null=True, blank=True,
|
||||||
|
on_delete=models.SET_NULL, related_name="game_events",
|
||||||
|
)
|
||||||
|
verb = models.CharField(max_length=30, choices=VERB_CHOICES)
|
||||||
|
data = models.JSONField(default=dict)
|
||||||
|
timestamp = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ["timestamp"]
|
||||||
|
|
||||||
|
def to_prose(self):
|
||||||
|
"""Return a human-readable action description (actor rendered separately in template)."""
|
||||||
|
d = self.data
|
||||||
|
if self.verb == self.SLOT_FILLED:
|
||||||
|
_token_names = {
|
||||||
|
"coin": "Coin-on-a-String", "Free": "Free Token",
|
||||||
|
"tithe": "Tithe Token", "pass": "Backstage Pass", "carte": "Carte Blanche",
|
||||||
|
}
|
||||||
|
code = d.get("token_type", "token")
|
||||||
|
token = d.get("token_display") or _token_names.get(code, code)
|
||||||
|
days = d.get("renewal_days", 7)
|
||||||
|
slot = d.get("slot_number", "?")
|
||||||
|
return f"deposits a {token} for slot {slot} (expires in {days} days)."
|
||||||
|
if self.verb == self.SLOT_RESERVED:
|
||||||
|
return "reserves a seat"
|
||||||
|
if self.verb == self.SLOT_RETURNED:
|
||||||
|
return "withdraws from the gate"
|
||||||
|
if self.verb == self.SLOT_RELEASED:
|
||||||
|
return f"releases slot {d.get('slot_number', '?')}"
|
||||||
|
if self.verb == self.ROOM_CREATED:
|
||||||
|
return "opens this room"
|
||||||
|
if self.verb == self.INVITE_SENT:
|
||||||
|
return "sends an invitation"
|
||||||
|
if self.verb == self.ROLE_SELECT_STARTED:
|
||||||
|
return "Role selection begins"
|
||||||
|
if self.verb == self.ROLE_SELECTED:
|
||||||
|
_role_names = {
|
||||||
|
"PC": "Player", "BC": "Builder", "SC": "Shepherd",
|
||||||
|
"AC": "Alchemist", "NC": "Narrator", "EC": "Economist",
|
||||||
|
}
|
||||||
|
code = d.get("role", "?")
|
||||||
|
role = d.get("role_display") or _role_names.get(code, code)
|
||||||
|
return f"elects to start as the {role}, and will enjoy affinity with this Role for the remainder of the game."
|
||||||
|
if self.verb == self.ROLES_REVEALED:
|
||||||
|
return "All roles assigned"
|
||||||
|
return self.verb
|
||||||
|
|
||||||
|
def to_activity(self, base_url):
|
||||||
|
"""Serialise this event as an AS2 Activity dict, or None if unsupported."""
|
||||||
|
if not self.actor or not self.actor.username:
|
||||||
|
return None
|
||||||
|
actor_url = f"{base_url}/ap/users/{self.actor.username}/"
|
||||||
|
room_url = f"{base_url}/gameboard/room/{self.room_id}/"
|
||||||
|
if self.verb == self.SLOT_FILLED:
|
||||||
|
return {
|
||||||
|
"type": "earthman:JoinGate",
|
||||||
|
"actor": actor_url,
|
||||||
|
"object": room_url,
|
||||||
|
"summary": self.to_prose(),
|
||||||
|
}
|
||||||
|
if self.verb == self.ROLE_SELECTED:
|
||||||
|
return {
|
||||||
|
"type": "earthman:SelectRole",
|
||||||
|
"actor": actor_url,
|
||||||
|
"object": room_url,
|
||||||
|
"summary": self.to_prose(),
|
||||||
|
}
|
||||||
|
if self.verb == self.ROOM_CREATED:
|
||||||
|
return {
|
||||||
|
"type": "Create",
|
||||||
|
"actor": actor_url,
|
||||||
|
"object": room_url,
|
||||||
|
"summary": self.to_prose(),
|
||||||
|
}
|
||||||
|
return None
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
actor = self.actor.email if self.actor else "system"
|
||||||
|
return f"[{self.timestamp:%Y-%m-%d %H:%M}] {actor} → {self.verb}"
|
||||||
|
|
||||||
|
|
||||||
|
class ScrollPosition(models.Model):
|
||||||
|
user = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, on_delete=models.CASCADE,
|
||||||
|
related_name="scroll_positions",
|
||||||
|
)
|
||||||
|
room = models.ForeignKey(
|
||||||
|
"epic.Room", on_delete=models.CASCADE,
|
||||||
|
related_name="scroll_positions",
|
||||||
|
)
|
||||||
|
position = models.PositiveIntegerField(default=0)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = [("user", "room")]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.user.email} @ {self.room.name}: {self.position}px"
|
||||||
|
|
||||||
|
|
||||||
|
def record(room, verb, actor=None, **data):
|
||||||
|
"""Record a game event in the drama log."""
|
||||||
|
return GameEvent.objects.create(room=room, actor=actor, verb=verb, data=data)
|
||||||
0
src/apps/drama/tests/__init__.py
Normal file
0
src/apps/drama/tests/__init__.py
Normal file
0
src/apps/drama/tests/integrated/__init__.py
Normal file
0
src/apps/drama/tests/integrated/__init__.py
Normal file
73
src/apps/drama/tests/integrated/test_models.py
Normal file
73
src/apps/drama/tests/integrated/test_models.py
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
from django.db import IntegrityError
|
||||||
|
|
||||||
|
from apps.drama.models import GameEvent, ScrollPosition, record
|
||||||
|
from apps.epic.models import Room
|
||||||
|
from apps.lyric.models import User
|
||||||
|
|
||||||
|
|
||||||
|
class GameEventModelTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="actor@test.io")
|
||||||
|
self.room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
|
||||||
|
def test_record_creates_game_event(self):
|
||||||
|
event = record(self.room, GameEvent.SLOT_FILLED, actor=self.user, slot_number=1, token_type="tithe")
|
||||||
|
self.assertEqual(GameEvent.objects.count(), 1)
|
||||||
|
self.assertEqual(event.room, self.room)
|
||||||
|
self.assertEqual(event.actor, self.user)
|
||||||
|
self.assertEqual(event.verb, GameEvent.SLOT_FILLED)
|
||||||
|
self.assertEqual(event.data, {"slot_number": 1, "token_type": "tithe"})
|
||||||
|
|
||||||
|
def test_record_without_actor(self):
|
||||||
|
event = record(self.room, GameEvent.ROOM_CREATED)
|
||||||
|
self.assertIsNone(event.actor)
|
||||||
|
self.assertEqual(event.verb, GameEvent.ROOM_CREATED)
|
||||||
|
|
||||||
|
def test_events_ordered_by_timestamp(self):
|
||||||
|
record(self.room, GameEvent.ROOM_CREATED)
|
||||||
|
record(self.room, GameEvent.SLOT_RESERVED, actor=self.user)
|
||||||
|
record(self.room, GameEvent.SLOT_FILLED, actor=self.user)
|
||||||
|
verbs = list(GameEvent.objects.values_list("verb", flat=True))
|
||||||
|
self.assertEqual(verbs, [
|
||||||
|
GameEvent.ROOM_CREATED,
|
||||||
|
GameEvent.SLOT_RESERVED,
|
||||||
|
GameEvent.SLOT_FILLED,
|
||||||
|
])
|
||||||
|
|
||||||
|
def test_str_includes_actor_and_verb(self):
|
||||||
|
event = record(self.room, GameEvent.ROLE_SELECTED, actor=self.user, role="PC")
|
||||||
|
self.assertIn("actor@test.io", str(event))
|
||||||
|
self.assertIn(GameEvent.ROLE_SELECTED, str(event))
|
||||||
|
|
||||||
|
def test_str_without_actor_shows_system(self):
|
||||||
|
event = record(self.room, GameEvent.ROLES_REVEALED)
|
||||||
|
self.assertIn("system", str(event))
|
||||||
|
|
||||||
|
|
||||||
|
class ScrollPositionModelTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.user = User.objects.create(email="reader@test.io")
|
||||||
|
self.room = Room.objects.create(name="Test Room", owner=self.user)
|
||||||
|
|
||||||
|
def test_can_save_scroll_position(self):
|
||||||
|
sp = ScrollPosition.objects.create(user=self.user, room=self.room, position=150)
|
||||||
|
self.assertEqual(ScrollPosition.objects.count(), 1)
|
||||||
|
self.assertEqual(sp.position, 150)
|
||||||
|
|
||||||
|
def test_default_position_is_zero(self):
|
||||||
|
sp = ScrollPosition.objects.create(user=self.user, room=self.room)
|
||||||
|
self.assertEqual(sp.position, 0)
|
||||||
|
|
||||||
|
def test_unique_per_user_and_room(self):
|
||||||
|
ScrollPosition.objects.create(user=self.user, room=self.room, position=50)
|
||||||
|
with self.assertRaises(IntegrityError):
|
||||||
|
ScrollPosition.objects.create(user=self.user, room=self.room, position=100)
|
||||||
|
|
||||||
|
def test_upsert_updates_existing_position(self):
|
||||||
|
ScrollPosition.objects.create(user=self.user, room=self.room, position=50)
|
||||||
|
ScrollPosition.objects.update_or_create(
|
||||||
|
user=self.user, room=self.room,
|
||||||
|
defaults={"position": 200},
|
||||||
|
)
|
||||||
|
self.assertEqual(ScrollPosition.objects.get(user=self.user, room=self.room).position, 200)
|
||||||
0
src/apps/epic/__init__.py
Normal file
0
src/apps/epic/__init__.py
Normal file
18
src/apps/epic/admin.py
Normal file
18
src/apps/epic/admin.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from .models import DeckVariant, TarotCard
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(DeckVariant)
|
||||||
|
class DeckVariantAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ["name", "slug", "card_count", "is_default"]
|
||||||
|
prepopulated_fields = {"slug": ["name"]}
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(TarotCard)
|
||||||
|
class TarotCardAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ["name", "deck_variant", "arcana", "suit", "number", "group", "slug"]
|
||||||
|
list_filter = ["deck_variant", "arcana", "suit"]
|
||||||
|
search_fields = ["name", "slug", "correspondence", "group"]
|
||||||
|
readonly_fields = ["slug", "correspondence", "group"]
|
||||||
|
ordering = ["deck_variant", "arcana", "suit", "number"]
|
||||||
5
src/apps/epic/apps.py
Normal file
5
src/apps/epic/apps.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class EpicConfig(AppConfig):
|
||||||
|
name = 'apps.epic'
|
||||||
82
src/apps/epic/consumers.py
Normal file
82
src/apps/epic/consumers.py
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
from channels.db import database_sync_to_async
|
||||||
|
from channels.generic.websocket import AsyncJsonWebsocketConsumer
|
||||||
|
|
||||||
|
|
||||||
|
LEVITY_ROLES = {"PC", "NC", "SC"}
|
||||||
|
GRAVITY_ROLES = {"BC", "EC", "AC"}
|
||||||
|
|
||||||
|
|
||||||
|
class RoomConsumer(AsyncJsonWebsocketConsumer):
|
||||||
|
async def connect(self):
|
||||||
|
self.room_id = self.scope["url_route"]["kwargs"]["room_id"]
|
||||||
|
self.group_name = f"room_{self.room_id}"
|
||||||
|
await self.channel_layer.group_add(self.group_name, self.channel_name)
|
||||||
|
|
||||||
|
self.cursor_group = None
|
||||||
|
user = self.scope.get("user")
|
||||||
|
if user and user.is_authenticated:
|
||||||
|
seat = await self._get_seat(user)
|
||||||
|
if seat:
|
||||||
|
if seat.role in LEVITY_ROLES:
|
||||||
|
self.cursor_group = f"cursors_{self.room_id}_levity"
|
||||||
|
elif seat.role in GRAVITY_ROLES:
|
||||||
|
self.cursor_group = f"cursors_{self.room_id}_gravity"
|
||||||
|
if self.cursor_group:
|
||||||
|
await self.channel_layer.group_add(self.cursor_group, self.channel_name)
|
||||||
|
|
||||||
|
await self.accept()
|
||||||
|
|
||||||
|
async def disconnect(self, close_code):
|
||||||
|
await self.channel_layer.group_discard(self.group_name, self.channel_name)
|
||||||
|
if self.cursor_group:
|
||||||
|
await self.channel_layer.group_discard(self.cursor_group, self.channel_name)
|
||||||
|
|
||||||
|
async def receive_json(self, content):
|
||||||
|
msg_type = content.get("type")
|
||||||
|
if msg_type == "cursor_move" and self.cursor_group:
|
||||||
|
await self.channel_layer.group_send(
|
||||||
|
self.cursor_group,
|
||||||
|
{"type": "cursor_move", "x": content.get("x"), "y": content.get("y")},
|
||||||
|
)
|
||||||
|
elif msg_type == "sig_hover" and self.cursor_group:
|
||||||
|
await self.channel_layer.group_send(
|
||||||
|
self.cursor_group,
|
||||||
|
{
|
||||||
|
"type": "sig_hover",
|
||||||
|
"card_id": content.get("card_id"),
|
||||||
|
"role": content.get("role"),
|
||||||
|
"active": content.get("active"),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
@database_sync_to_async
|
||||||
|
def _get_seat(self, user):
|
||||||
|
from apps.epic.models import TableSeat
|
||||||
|
return TableSeat.objects.filter(room_id=self.room_id, gamer=user).first()
|
||||||
|
|
||||||
|
async def gate_update(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
|
|
||||||
|
async def role_select_start(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
|
|
||||||
|
async def turn_changed(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
|
|
||||||
|
async def all_roles_filled(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
|
|
||||||
|
async def sig_select_started(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
|
|
||||||
|
async def sig_selected(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
|
|
||||||
|
async def sig_hover(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
|
|
||||||
|
async def sig_reserved(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
|
|
||||||
|
async def cursor_move(self, event):
|
||||||
|
await self.send_json(event)
|
||||||
0
src/apps/epic/forms.py
Normal file
0
src/apps/epic/forms.py
Normal file
45
src/apps/epic/migrations/0001_initial.py
Normal file
45
src/apps/epic/migrations/0001_initial.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-12 19:46
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Room',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('visibility', models.CharField(choices=[('PRIVATE', 'Private'), ('PUBLIC', 'Public'), ('INVITE ONLY', 'Invite Only')], default='PRIVATE', max_length=20)),
|
||||||
|
('gate_status', models.CharField(choices=[('GATHERING', 'Gathering'), ('OPEN', 'Open'), ('RENEWAL_DUE', 'Renewal Due')], default='GATHERING', max_length=20)),
|
||||||
|
('renewal_period', models.DurationField(blank=True, null=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('board_state', models.JSONField(default=dict)),
|
||||||
|
('seed_count', models.IntegerField(default=12)),
|
||||||
|
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owned_rooms', to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='GateSlot',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('slot_number', models.IntegerField()),
|
||||||
|
('status', models.CharField(choices=[('EMPTY', 'Empty'), ('RESERVED', 'Reserved'), ('FILLED', 'Filled')], default='EMPTY', max_length=10)),
|
||||||
|
('reserved_at', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('filled_at', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('funded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='funded_slots', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('gamer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='gate_slots', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='gate_slots', to='epic.room')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
19
src/apps/epic/migrations/0002_alter_room_renewal_period.py
Normal file
19
src/apps/epic/migrations/0002_alter_room_renewal_period.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-13 20:32
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='room',
|
||||||
|
name='renewal_period',
|
||||||
|
field=models.DurationField(blank=True, default=datetime.timedelta(days=7), null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
27
src/apps/epic/migrations/0003_roominvite.py
Normal file
27
src/apps/epic/migrations/0003_roominvite.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-13 22:19
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0002_alter_room_renewal_period'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='RoomInvite',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('invitee_email', models.EmailField(max_length=254)),
|
||||||
|
('status', models.CharField(choices=[('PENDING', 'Pending'), ('ACCEPTED', 'Accepted'), ('DECLINED', 'Declined')], default='PENDING', max_length=10)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('inviter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sent_invites', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invites', to='epic.room')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
18
src/apps/epic/migrations/0004_alter_room_gate_status.py
Normal file
18
src/apps/epic/migrations/0004_alter_room_gate_status.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-15 00:32
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0003_roominvite'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='room',
|
||||||
|
name='gate_status',
|
||||||
|
field=models.CharField(choices=[('GATHERING', 'GATHERING GAMERS'), ('OPEN', 'Open'), ('RENEWAL_DUE', 'Renewal Due')], default='GATHERING', max_length=20),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0004_alter_room_gate_status'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='gateslot',
|
||||||
|
name='debited_token_type',
|
||||||
|
field=models.CharField(max_length=8, null=True, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='gateslot',
|
||||||
|
name='debited_token_expires_at',
|
||||||
|
field=models.DateTimeField(null=True, blank=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
33
src/apps/epic/migrations/0006_table_status_and_table_seat.py
Normal file
33
src/apps/epic/migrations/0006_table_status_and_table_seat.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-17 00:14
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0005_gateslot_debited_token_fields'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='room',
|
||||||
|
name='table_status',
|
||||||
|
field=models.CharField(blank=True, choices=[('ROLE_SELECT', 'Role Select'), ('SIG_SELECT', 'Significator Select'), ('IN_GAME', 'In Game')], max_length=20, null=True),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TableSeat',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('slot_number', models.IntegerField()),
|
||||||
|
('role', models.CharField(blank=True, choices=[('PC', 'Player'), ('BC', 'Builder'), ('SC', 'Shepherd'), ('AC', 'Alchemist'), ('NC', 'Narrator'), ('EC', 'Economist')], max_length=2, null=True)),
|
||||||
|
('role_revealed', models.BooleanField(default=False)),
|
||||||
|
('seat_position', models.IntegerField(blank=True, null=True)),
|
||||||
|
('gamer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='table_seats', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='table_seats', to='epic.room')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
39
src/apps/epic/migrations/0007_tarotcard_tarotdeck.py
Normal file
39
src/apps/epic/migrations/0007_tarotcard_tarotdeck.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-24 23:33
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0006_table_status_and_table_seat'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TarotCard',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=100, unique=True)),
|
||||||
|
('arcana', models.CharField(choices=[('MAJOR', 'Major Arcana'), ('MINOR', 'Minor Arcana')], max_length=5)),
|
||||||
|
('suit', models.CharField(blank=True, choices=[('WANDS', 'Wands'), ('CUPS', 'Cups'), ('SWORDS', 'Swords'), ('PENTACLES', 'Pentacles')], max_length=10, null=True)),
|
||||||
|
('number', models.IntegerField()),
|
||||||
|
('slug', models.SlugField(unique=True)),
|
||||||
|
('keywords_upright', models.JSONField(default=list)),
|
||||||
|
('keywords_reversed', models.JSONField(default=list)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['arcana', 'suit', 'number'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TarotDeck',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('drawn_card_ids', models.JSONField(default=list)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('room', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='tarot_deck', to='epic.room')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
164
src/apps/epic/migrations/0008_seed_tarot_cards.py
Normal file
164
src/apps/epic/migrations/0008_seed_tarot_cards.py
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
MAJOR_ARCANA = [
|
||||||
|
(0, "The Fool", "the-fool", ["beginnings", "spontaneity", "freedom"], ["recklessness", "naivety", "risk"]),
|
||||||
|
(1, "The Magician", "the-magician", ["willpower", "skill", "resourcefulness"], ["manipulation", "untapped potential", "deceit"]),
|
||||||
|
(2, "The High Priestess", "the-high-priestess", ["intuition", "mystery", "inner knowledge"], ["secrets", "disconnection", "withdrawal"]),
|
||||||
|
(3, "The Empress", "the-empress", ["fertility", "abundance", "nurturing"], ["dependence", "smothering", "creative block"]),
|
||||||
|
(4, "The Emperor", "the-emperor", ["authority", "structure", "stability"], ["rigidity", "domination", "inflexibility"]),
|
||||||
|
(5, "The Hierophant", "the-hierophant", ["tradition", "conformity", "institutions"], ["rebellion", "unconventionality", "challenge"]),
|
||||||
|
(6, "The Lovers", "the-lovers", ["love", "harmony", "choice"], ["disharmony", "imbalance", "misalignment"]),
|
||||||
|
(7, "The Chariot", "the-chariot", ["control", "willpower", "victory"], ["aggression", "lack of direction", "defeat"]),
|
||||||
|
(8, "Strength", "strength", ["courage", "patience", "compassion"], ["self-doubt", "weakness", "insecurity"]),
|
||||||
|
(9, "The Hermit", "the-hermit", ["introspection", "guidance", "solitude"], ["isolation", "loneliness", "withdrawal"]),
|
||||||
|
(10, "Wheel of Fortune", "wheel-of-fortune", ["change", "cycles", "fate"], ["bad luck", "resistance", "clinging to control"]),
|
||||||
|
(11, "Justice", "justice", ["fairness", "truth", "cause and effect"], ["injustice", "dishonesty", "avoidance"]),
|
||||||
|
(12, "The Hanged Man", "the-hanged-man", ["pause", "surrender", "new perspective"], ["stalling", "resistance", "indecision"]),
|
||||||
|
(13, "Death", "death", ["endings", "transition", "transformation"], ["fear of change", "stagnation", "resistance"]),
|
||||||
|
(14, "Temperance", "temperance", ["balance", "patience", "moderation"], ["imbalance", "excess", "lack of harmony"]),
|
||||||
|
(15, "The Devil", "the-devil", ["bondage", "materialism", "shadow self"], ["detachment", "freedom", "releasing control"]),
|
||||||
|
(16, "The Tower", "the-tower", ["sudden change", "upheaval", "revelation"], ["avoidance", "fear of change", "delaying disaster"]),
|
||||||
|
(17, "The Star", "the-star", ["hope", "renewal", "inspiration"], ["despair", "insecurity", "hopelessness"]),
|
||||||
|
(18, "The Moon", "the-moon", ["illusion", "fear", "the unconscious"], ["confusion", "misinterpretation", "clarity"]),
|
||||||
|
(19, "The Sun", "the-sun", ["positivity", "success", "vitality"], ["negativity", "depression", "sadness"]),
|
||||||
|
(20, "Judgement", "judgement", ["reflection", "reckoning", "absolution"], ["self-doubt", "lack of self-awareness", "loathing"]),
|
||||||
|
(21, "The World", "the-world", ["completion", "integration", "accomplishment"], ["incompletion", "no closure", "shortcuts"]),
|
||||||
|
]
|
||||||
|
|
||||||
|
MINOR_SUITS = [
|
||||||
|
("WANDS", "wands"),
|
||||||
|
("CUPS", "cups"),
|
||||||
|
("SWORDS", "swords"),
|
||||||
|
("PENTACLES", "pentacles"),
|
||||||
|
]
|
||||||
|
|
||||||
|
MINOR_NAMES = [
|
||||||
|
(1, "Ace", "ace"),
|
||||||
|
(2, "Two", "two"),
|
||||||
|
(3, "Three", "three"),
|
||||||
|
(4, "Four", "four"),
|
||||||
|
(5, "Five", "five"),
|
||||||
|
(6, "Six", "six"),
|
||||||
|
(7, "Seven", "seven"),
|
||||||
|
(8, "Eight", "eight"),
|
||||||
|
(9, "Nine", "nine"),
|
||||||
|
(10, "Ten", "ten"),
|
||||||
|
(11, "Page", "page"),
|
||||||
|
(12, "Knight", "knight"),
|
||||||
|
(13, "Queen", "queen"),
|
||||||
|
(14, "King", "king"),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Keywords: [suit][number-1] → (upright_list, reversed_list)
|
||||||
|
MINOR_KEYWORDS = {
|
||||||
|
"WANDS": [
|
||||||
|
(["inspiration", "new venture", "spark"], ["delays", "lack of motivation", "false start"]),
|
||||||
|
(["planning", "progress", "decisions"], ["impatience", "lack of planning", "hesitation"]),
|
||||||
|
(["expansion", "foresight", "enterprise"], ["obstacles", "lack of foresight", "delays"]),
|
||||||
|
(["celebration", "harmony", "homecoming"], ["lack of support", "transience", "home conflicts"]),
|
||||||
|
(["conflict", "competition", "tension"], ["avoiding conflict", "compromise", "truce"]),
|
||||||
|
(["victory", "recognition", "progress"], ["excess pride", "lack of recognition", "fall"]),
|
||||||
|
(["challenge", "courage", "competition"], ["anxiety", "giving up", "overwhelmed"]),
|
||||||
|
(["rapid action", "adventure", "change"], ["haste", "scattered energy", "delays"]),
|
||||||
|
(["resilience", "persistence", "last stand"], ["exhaustion", "giving up", "surrender"]),
|
||||||
|
(["completion", "celebration", "travel"], ["burdens", "oppression", "carrying too much"]),
|
||||||
|
(["exploration", "enthusiasm", "adventure"], ["hasty decisions", "scattered energy", "immaturity"]),
|
||||||
|
(["energy", "passion", "adventure"], ["scattered energy", "frustration", "aggression"]),
|
||||||
|
(["confidence", "independence", "courage"], ["selfishness", "jealousy", "insecurity"]),
|
||||||
|
(["big picture", "leadership", "vision"], ["impulsiveness", "haste", "overconfidence"]),
|
||||||
|
],
|
||||||
|
"CUPS": [
|
||||||
|
(["new feelings", "intuition", "opportunity"], ["blocked creativity", "emptiness", "hesitation"]),
|
||||||
|
(["partnership", "unity", "celebration"], ["imbalance", "broken bonds", "misalignment"]),
|
||||||
|
(["creativity", "community", "abundance"], ["independence", "isolation", "looking inward"]),
|
||||||
|
(["contemplation", "apathy", "reevaluation"], ["withdrawal", "boredom", "seeking motivation"]),
|
||||||
|
(["loss", "grief", "disappointment"], ["acceptance", "moving on", "forgiveness"]),
|
||||||
|
(["nostalgia", "reunion", "joy"], ["living in the past", "naivety", "unrealistic"]),
|
||||||
|
(["illusion", "fantasy", "wishful thinking"], ["alignment", "clarity", "sobriety"]),
|
||||||
|
(["disappointment", "abandonment", "walking away"], ["hopelessness", "aimlessness", "stagnation"]),
|
||||||
|
(["contentment", "fulfilment", "satisfaction"], ["inner happiness", "materialism", "indulgence"]),
|
||||||
|
(["divine love", "bliss", "fulfilment"], ["inner happiness", "alignment", "personal values"]),
|
||||||
|
(["sensitivity", "creativity", "intuition"], ["insecurity", "emotional immaturity", "creative blocks"]),
|
||||||
|
(["compassion", "romanticism", "diplomacy"], ["moodiness", "emotional manipulation", "deception"]),
|
||||||
|
(["compassion", "empathy", "nurturing"], ["emotional insecurity", "over-giving", "neglect"]),
|
||||||
|
(["emotional maturity", "diplomacy", "wisdom"], ["manipulation", "moodiness", "coldness"]),
|
||||||
|
],
|
||||||
|
"SWORDS": [
|
||||||
|
(["raw power", "breakthrough", "clarity"], ["confusion", "brutality", "mental chaos"]),
|
||||||
|
(["difficult choices", "stalemate", "truce"], ["indecision", "lies", "confusion"]),
|
||||||
|
(["heartbreak", "sorrow", "grief"], ["recovery", "forgiveness", "moving on"]),
|
||||||
|
(["rest", "restoration", "retreat"], ["restlessness", "burnout", "illness"]),
|
||||||
|
(["defeat", "change", "transition"], ["resistance to change", "inability to move"]),
|
||||||
|
(["victory", "success", "ambition"], ["an eye for an eye", "dishonour", "manipulation"]),
|
||||||
|
(["deception", "trickery", "tactics"], ["imposter syndrome", "coming clean", "rethinking"]),
|
||||||
|
(["restriction", "isolation", "imprisonment"], ["self-limiting beliefs", "inner critic", "opening up"]),
|
||||||
|
(["anxiety", "worry", "fear"], ["recovery from anxiety", "inner turmoil", "secrets"]),
|
||||||
|
(["ruin", "painful endings", "loss"], ["recovery", "regeneration", "resisting an end"]),
|
||||||
|
(["new ideas", "mental agility", "curiosity"], ["manipulation", "all talk no action", "ruthlessness"]),
|
||||||
|
(["action", "impulsiveness", "ambition"], ["no direction", "disregard for consequences"]),
|
||||||
|
(["clarity", "directness", "structure"], ["coldness", "cruelty", "manipulation"]),
|
||||||
|
(["mental clarity", "truth", "authority"], ["abuse of power", "manipulation", "coldness"]),
|
||||||
|
],
|
||||||
|
"PENTACLES": [
|
||||||
|
(["opportunity", "new venture", "manifestation"], ["lost opportunity", "lack of planning", "scarcity"]),
|
||||||
|
(["juggling resources", "flexibility", "fun"], ["imbalance", "disorganisation", "overwhelm"]),
|
||||||
|
(["teamwork", "building", "apprenticeship"], ["lack of teamwork", "disharmony", "misalignment"]),
|
||||||
|
(["stability", "security", "conservation"], ["greed", "stinginess", "possessiveness"]),
|
||||||
|
(["isolation", "insecurity", "worry"], ["recovery from loss", "overcoming hardship"]),
|
||||||
|
(["generosity", "charity", "community"], ["strings attached", "power dynamics", "inequality"]),
|
||||||
|
(["hard work", "perseverance", "diligence"], ["lack of reward", "laziness", "low quality"]),
|
||||||
|
(["apprenticeship", "education", "skill"], ["perfectionism", "misdirected activity", "misuse"]),
|
||||||
|
(["abundance", "luxury", "self-sufficiency"], ["overindulgence", "superficiality", "materialism"]),
|
||||||
|
(["wealth", "financial security", "achievement"], ["financial failure", "greed", "lost success"]),
|
||||||
|
(["ambition", "diligence", "management"], ["underhandedness", "greediness", "unethical"]),
|
||||||
|
(["hard work", "productivity", "routine"], ["laziness", "obsession with work", "burnout"]),
|
||||||
|
(["nurturing", "practical", "abundance"], ["financial dependence", "smothering", "insecurity"]),
|
||||||
|
(["abundance", "prosperity", "security"], ["greed", "indulgence", "sensual obsession"]),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def seed_tarot_cards(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
|
||||||
|
# Major Arcana
|
||||||
|
for number, name, slug, upright, reversed_ in MAJOR_ARCANA:
|
||||||
|
TarotCard.objects.create(
|
||||||
|
name=name,
|
||||||
|
arcana="MAJOR",
|
||||||
|
suit=None,
|
||||||
|
number=number,
|
||||||
|
slug=slug,
|
||||||
|
keywords_upright=upright,
|
||||||
|
keywords_reversed=reversed_,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Minor Arcana
|
||||||
|
for suit_code, suit_slug in MINOR_SUITS:
|
||||||
|
for number, rank_name, rank_slug in MINOR_NAMES:
|
||||||
|
upright, reversed_ = MINOR_KEYWORDS[suit_code][number - 1]
|
||||||
|
TarotCard.objects.create(
|
||||||
|
name=f"{rank_name} of {suit_code.capitalize()}",
|
||||||
|
arcana="MINOR",
|
||||||
|
suit=suit_code,
|
||||||
|
number=number,
|
||||||
|
slug=f"{rank_slug}-of-{suit_slug}",
|
||||||
|
keywords_upright=upright,
|
||||||
|
keywords_reversed=reversed_,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def unseed_tarot_cards(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
TarotCard.objects.all().delete()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0007_tarotcard_tarotdeck"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(seed_tarot_cards, reverse_code=unseed_tarot_cards),
|
||||||
|
]
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-25 00:48
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0008_seed_tarot_cards'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DeckVariant',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=100, unique=True)),
|
||||||
|
('slug', models.SlugField(unique=True)),
|
||||||
|
('card_count', models.IntegerField()),
|
||||||
|
('description', models.TextField(blank=True)),
|
||||||
|
('is_default', models.BooleanField(default=False)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='tarotcard',
|
||||||
|
options={'ordering': ['deck_variant', 'arcana', 'suit', 'number']},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='correspondence',
|
||||||
|
field=models.CharField(blank=True, max_length=200),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='group',
|
||||||
|
field=models.CharField(blank=True, max_length=100),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(max_length=200),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='slug',
|
||||||
|
field=models.SlugField(max_length=120),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='suit',
|
||||||
|
field=models.CharField(blank=True, choices=[('WANDS', 'Wands'), ('CUPS', 'Cups'), ('SWORDS', 'Swords'), ('PENTACLES', 'Pentacles'), ('COINS', 'Coins')], max_length=10, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='deck_variant',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cards', to='epic.deckvariant'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='tarotdeck',
|
||||||
|
name='deck_variant',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='active_decks', to='epic.deckvariant'),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='tarotcard',
|
||||||
|
unique_together={('deck_variant', 'slug')},
|
||||||
|
),
|
||||||
|
]
|
||||||
202
src/apps/epic/migrations/0010_seed_deck_variants_and_earthman.py
Normal file
202
src/apps/epic/migrations/0010_seed_deck_variants_and_earthman.py
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
"""
|
||||||
|
Data migration:
|
||||||
|
1. Create DeckVariant records (Fiorentine Minchiate + Earthman).
|
||||||
|
2. Backfill the 78 existing TarotCards → Fiorentine Minchiate.
|
||||||
|
3. Seed all 108 Earthman cards (52 major + 56 minor).
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
# ── Earthman Major Arcana (52 cards, numbers 0–51) ──────────────────────────
|
||||||
|
# (name, slug, group, correspondence)
|
||||||
|
EARTHMAN_MAJOR = [
|
||||||
|
# ── The Schiz ──────────────────────────────────────────────────────────
|
||||||
|
(0, "The Schiz", "the-schiz", "", "The Fool / Il Matto"),
|
||||||
|
|
||||||
|
# ── The Popes ──────────────────────────────────────────────────────────
|
||||||
|
(1, "Pope I: President", "pope-i-president", "The Popes", "The Magician / Il Bagatto"),
|
||||||
|
(2, "Pope II: Tsar", "pope-ii-tsar", "The Popes", "The Popess / La Papessa"),
|
||||||
|
(3, "Pope III: Chairman", "pope-iii-chairman", "The Popes", "The Empress / L'Imperatrice"),
|
||||||
|
(4, "Pope IV: Emperor", "pope-iv-emperor", "The Popes", "The Emperor / L'Imperatore"),
|
||||||
|
(5, "Pope V: Chancellor", "pope-v-chancellor", "The Popes", "The Pope / Il Papa"),
|
||||||
|
|
||||||
|
# ── The Virtues, Implicit (cardinal / acquired) ────────────────────────
|
||||||
|
(6, "Virtue VI: Controlled Folly", "virtue-vi-controlled-folly", "The Virtues, Implicit", "Fortitude / La Fortezza"),
|
||||||
|
(7, "Virtue VII: Not-Doing", "virtue-vii-not-doing", "The Virtues, Implicit", "Justice / La Giustizia"),
|
||||||
|
(8, "Virtue VIII: Losing Self-Importance","virtue-viii-losing-self-importance","The Virtues, Implicit", "Temperance / La Temperanza"),
|
||||||
|
(9, "Virtue IX: Erasing Personal History","virtue-ix-erasing-personal-history","The Virtues, Implicit", "Prudence / La Prudenza"),
|
||||||
|
|
||||||
|
# ── Wheel ──────────────────────────────────────────────────────────────
|
||||||
|
(10, "Wheel of Fortune", "wheel-of-fortune-em", "", "La Ruota della Fortuna"),
|
||||||
|
|
||||||
|
# ── Solo cards ─────────────────────────────────────────────────────────
|
||||||
|
(11, "The Junkboat", "the-junkboat", "", "The Chariot / Il Carro"),
|
||||||
|
(12, "The Junkman", "the-junkman", "", "The Hanged Man / L'Appeso"),
|
||||||
|
(13, "Death", "death-em", "", "La Morte"),
|
||||||
|
(14, "The Traitor", "the-traitor", "", "The Devil / Il Diavolo"),
|
||||||
|
(15, "Disco Inferno", "disco-inferno", "", "The Tower / La Torre"),
|
||||||
|
(16, "Torre Terrestre", "torre-terrestre", "", "Purgatorio"),
|
||||||
|
(17, "Fantasia Celestia", "fantasia-celestia", "", "Paradiso"),
|
||||||
|
|
||||||
|
# ── The Virtues, Explicit (theological / infused) ─────────────────────
|
||||||
|
(18, "Virtue XVIII: Stalking", "virtue-xviii-stalking", "The Virtues, Explicit", "Love / Charity / La Carità"),
|
||||||
|
(19, "Virtue XIX: Intent", "virtue-xix-intent", "The Virtues, Explicit", "Hope / La Speranza"),
|
||||||
|
(20, "Virtue XX: Dreaming", "virtue-xx-dreaming", "The Virtues, Explicit", "Faith / La Fede"),
|
||||||
|
|
||||||
|
# ── The Elements, Classical ────────────────────────────────────────────
|
||||||
|
(21, "Element XXI: Fire", "element-xxi-fire", "The Elements, Classical", "Ardor [Ar]"),
|
||||||
|
(22, "Element XXII: Earth", "element-xxii-earth", "The Elements, Classical", "Ossum [Om]"),
|
||||||
|
(23, "Element XXIII: Air", "element-xxiii-air", "The Elements, Classical", "Pneuma [Pn]"),
|
||||||
|
(24, "Element XXIV: Water", "element-xxiv-water", "The Elements, Classical", "Humor [Hm]"),
|
||||||
|
|
||||||
|
# ── The Zodiac ─────────────────────────────────────────────────────────
|
||||||
|
(25, "Zodiac XXV: Aries", "zodiac-xxv-aries", "The Zodiac", "The Ram"),
|
||||||
|
(26, "Zodiac XXVI: Taurus", "zodiac-xxvi-taurus", "The Zodiac", "The Bull"),
|
||||||
|
(27, "Zodiac XXVII: Gemini", "zodiac-xxvii-gemini", "The Zodiac", "The Twins"),
|
||||||
|
(28, "Zodiac XXVIII: Cancer", "zodiac-xxviii-cancer", "The Zodiac", "The Crab"),
|
||||||
|
(29, "Zodiac XXIX: Leo", "zodiac-xxix-leo", "The Zodiac", "The Lion"),
|
||||||
|
(30, "Zodiac XXX: Virgo", "zodiac-xxx-virgo", "The Zodiac", "The Maiden"),
|
||||||
|
(31, "Zodiac XXXI: Libra", "zodiac-xxxi-libra", "The Zodiac", "The Scales"),
|
||||||
|
(32, "Zodiac XXXII: Scorpio", "zodiac-xxxii-scorpio", "The Zodiac", "The Scorpion"),
|
||||||
|
(33, "Zodiac XXXIII: Sagittarius", "zodiac-xxxiii-sagittarius", "The Zodiac", "The Archer"),
|
||||||
|
(34, "Zodiac XXXIV: Capricorn", "zodiac-xxxiv-capricorn", "The Zodiac", "The Sea-Goat"),
|
||||||
|
(35, "Zodiac XXXV: Aquarius", "zodiac-xxxv-aquarius", "The Zodiac", "The Water-Bearer"),
|
||||||
|
(36, "Zodiac XXXVI: Pisces", "zodiac-xxxvi-pisces", "The Zodiac", "The Fish"),
|
||||||
|
|
||||||
|
# ── The Elements, Absolute ─────────────────────────────────────────────
|
||||||
|
(37, "Element XXXVII: Time", "element-xxxvii-time", "The Elements, Absolute", "Tempo [Tp]"),
|
||||||
|
(38, "Element XXXVIII: Space", "element-xxxviii-space", "The Elements, Absolute", "Nexus [Nx]"),
|
||||||
|
|
||||||
|
# ── The Wanderers ──────────────────────────────────────────────────────
|
||||||
|
(39, "Wanderer XXXIX: The Polestar", "wanderer-xxxix-polestar", "The Wanderers", "The Star / Le Stelle"),
|
||||||
|
(40, "Wanderer XL: The Antichthon", "wanderer-xl-antichthon", "The Wanderers", "The Moon / La Luna"),
|
||||||
|
(41, "Wanderer XLI: The Corestar", "wanderer-xli-corestar", "The Wanderers", "The Sun / Il Sole"),
|
||||||
|
(42, "Wanderer XLII: Mercury", "wanderer-xlii-mercury", "The Wanderers", "Mercurio"),
|
||||||
|
(43, "Wanderer XLIII: Venus", "wanderer-xliii-venus", "The Wanderers", "Venere"),
|
||||||
|
(44, "Wanderer XLIV: Mars", "wanderer-xliv-mars", "The Wanderers", "Marte"),
|
||||||
|
(45, "Wanderer XLV: Jupiter", "wanderer-xlv-jupiter", "The Wanderers", "Giove"),
|
||||||
|
(46, "Wanderer XLVI: Saturn", "wanderer-xlvi-saturn", "The Wanderers", "Saturno"),
|
||||||
|
(47, "Wanderer XLVII: Uranus", "wanderer-xlvii-uranus", "The Wanderers", "Urano"),
|
||||||
|
(48, "Wanderer XLVIII: Neptune", "wanderer-xlviii-neptune", "The Wanderers", "Nettuno"),
|
||||||
|
(49, "Wanderer XLIX: The King & Queen of Hades", "wanderer-xlix-king-queen-hades", "The Wanderers", "The Binary / Plutone-Proserpina"),
|
||||||
|
|
||||||
|
# ── Finale ─────────────────────────────────────────────────────────────
|
||||||
|
(50, "The Eagle", "the-eagle", "", "Judgement / L'Angelo"),
|
||||||
|
(51, "Divine Calculus", "divine-calculus", "", "The World / Il Mondo"),
|
||||||
|
]
|
||||||
|
|
||||||
|
# ── Earthman Minor Arcana ────────────────────────────────────────────────────
|
||||||
|
# 4 suits × 14 cards. Suits: WANDS / CUPS / SWORDS / COINS
|
||||||
|
# Court cards: Jack (11) / Cavalier (12) / Queen (13) / King (14)
|
||||||
|
EARTHMAN_SUITS = [
|
||||||
|
("WANDS", "wands", "Ardor [Ar] — Fire"),
|
||||||
|
("CUPS", "cups", "Humor [Hm] — Water"),
|
||||||
|
("SWORDS","swords","Pneuma [Pn] — Air"),
|
||||||
|
("COINS", "coins", "Ossum [Om] — Stone"),
|
||||||
|
]
|
||||||
|
|
||||||
|
EARTHMAN_RANKS = [
|
||||||
|
(1, "Ace", "ace"),
|
||||||
|
(2, "2", "two"),
|
||||||
|
(3, "3", "three"),
|
||||||
|
(4, "4", "four"),
|
||||||
|
(5, "5", "five"),
|
||||||
|
(6, "6", "six"),
|
||||||
|
(7, "7", "seven"),
|
||||||
|
(8, "8", "eight"),
|
||||||
|
(9, "9", "nine"),
|
||||||
|
(10, "10", "ten"),
|
||||||
|
(11, "Jack", "jack"),
|
||||||
|
(12, "Cavalier", "cavalier"),
|
||||||
|
(13, "Queen", "queen"),
|
||||||
|
(14, "King", "king"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
# ── 1. Create DeckVariant records ────────────────────────────────────
|
||||||
|
fiorentine = DeckVariant.objects.create(
|
||||||
|
name="Fiorentine Minchiate",
|
||||||
|
slug="fiorentine-minchiate",
|
||||||
|
card_count=78,
|
||||||
|
description="Standard 78-card Minchiate deck. Alt / lite play mode.",
|
||||||
|
is_default=False,
|
||||||
|
)
|
||||||
|
earthman = DeckVariant.objects.create(
|
||||||
|
name="Earthman Deck",
|
||||||
|
slug="earthman",
|
||||||
|
card_count=108,
|
||||||
|
description=(
|
||||||
|
"Primary 108-card Earthman deck. "
|
||||||
|
"52 Major Arcana (The Schiz through Divine Calculus) "
|
||||||
|
"+ 56 Minor Arcana across Wands, Cups, Swords, Coins."
|
||||||
|
),
|
||||||
|
is_default=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── 2. Backfill existing 78 Fiorentine cards ─────────────────────────
|
||||||
|
TarotCard.objects.filter(deck_variant__isnull=True).update(
|
||||||
|
deck_variant=fiorentine
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── 3. Seed Earthman Major Arcana ────────────────────────────────────
|
||||||
|
for number, name, slug, group, correspondence in EARTHMAN_MAJOR:
|
||||||
|
TarotCard.objects.create(
|
||||||
|
deck_variant=earthman,
|
||||||
|
name=name,
|
||||||
|
arcana="MAJOR",
|
||||||
|
suit=None,
|
||||||
|
number=number,
|
||||||
|
slug=slug,
|
||||||
|
group=group,
|
||||||
|
correspondence=correspondence,
|
||||||
|
keywords_upright=[],
|
||||||
|
keywords_reversed=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── 4. Seed Earthman Minor Arcana ────────────────────────────────────
|
||||||
|
for suit_code, suit_slug, _element in EARTHMAN_SUITS:
|
||||||
|
for number, rank_name, rank_slug in EARTHMAN_RANKS:
|
||||||
|
name = f"{rank_name} of {suit_code.capitalize()}"
|
||||||
|
slug = f"{rank_slug}-of-{suit_slug}-em"
|
||||||
|
TarotCard.objects.create(
|
||||||
|
deck_variant=earthman,
|
||||||
|
name=name,
|
||||||
|
arcana="MINOR",
|
||||||
|
suit=suit_code,
|
||||||
|
number=number,
|
||||||
|
slug=slug,
|
||||||
|
group="",
|
||||||
|
correspondence="",
|
||||||
|
keywords_upright=[],
|
||||||
|
keywords_reversed=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
# Remove Earthman cards and clear FK from Fiorentine cards
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if earthman:
|
||||||
|
TarotCard.objects.filter(deck_variant=earthman).delete()
|
||||||
|
|
||||||
|
fiorentine = DeckVariant.objects.filter(slug="fiorentine-minchiate").first()
|
||||||
|
if fiorentine:
|
||||||
|
TarotCard.objects.filter(deck_variant=fiorentine).update(deck_variant=None)
|
||||||
|
|
||||||
|
DeckVariant.objects.filter(slug__in=["earthman", "fiorentine-minchiate"]).delete()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0009_deckvariant_alter_tarotcard_options_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(forward, reverse_code=reverse),
|
||||||
|
]
|
||||||
82
src/apps/epic/migrations/0011_rename_earthman_court_cards.py
Normal file
82
src/apps/epic/migrations/0011_rename_earthman_court_cards.py
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
"""
|
||||||
|
Data migration: rename Earthman court cards at positions 11 and 12.
|
||||||
|
|
||||||
|
Old naming (from 0010): Jack (11) / Cavalier (12)
|
||||||
|
New naming: Maid (11) / Jack (12)
|
||||||
|
|
||||||
|
Must rename 11 → Maid first so the "jack-of-*-em" slugs are free
|
||||||
|
before the 12s claim them.
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
SUITS = ["Wands", "Cups", "Swords", "Coins"]
|
||||||
|
|
||||||
|
|
||||||
|
def rename_court_cards(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Step 1: Jack (11) → Maid — frees up jack-of-*-em slugs
|
||||||
|
for suit in SUITS:
|
||||||
|
suit_slug = suit.lower()
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, number=11, slug=f"jack-of-{suit_slug}-em"
|
||||||
|
).update(
|
||||||
|
name=f"Maid of {suit}",
|
||||||
|
slug=f"maid-of-{suit_slug}-em",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Step 2: Cavalier (12) → Jack — takes the now-free jack-of-*-em slugs
|
||||||
|
for suit in SUITS:
|
||||||
|
suit_slug = suit.lower()
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, number=12, slug=f"cavalier-of-{suit_slug}-em"
|
||||||
|
).update(
|
||||||
|
name=f"Jack of {suit}",
|
||||||
|
slug=f"jack-of-{suit_slug}-em",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def reverse_court_cards(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Step 1: Jack (12) → Cavalier — frees up jack-of-*-em slugs
|
||||||
|
for suit in SUITS:
|
||||||
|
suit_slug = suit.lower()
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, number=12, slug=f"jack-of-{suit_slug}-em"
|
||||||
|
).update(
|
||||||
|
name=f"Cavalier of {suit}",
|
||||||
|
slug=f"cavalier-of-{suit_slug}-em",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Step 2: Maid (11) → Jack
|
||||||
|
for suit in SUITS:
|
||||||
|
suit_slug = suit.lower()
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, number=11, slug=f"maid-of-{suit_slug}-em"
|
||||||
|
).update(
|
||||||
|
name=f"Jack of {suit}",
|
||||||
|
slug=f"jack-of-{suit_slug}-em",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0010_seed_deck_variants_and_earthman"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(rename_court_cards, reverse_code=reverse_court_cards),
|
||||||
|
]
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
"""
|
||||||
|
Data migration:
|
||||||
|
1. Rename grouped Earthman major arcana to use group-relative ordinals
|
||||||
|
(e.g. "Virtue VI: Controlled Folly" → "Implicit Virtue 1: Controlled Folly").
|
||||||
|
2. Spell out Earthman minor arcana pip names 2–10
|
||||||
|
(e.g. "2 of Wands" → "Two of Wands").
|
||||||
|
|
||||||
|
Corner ranks (Roman numerals of absolute card number) are a property on the model
|
||||||
|
and are unchanged — this only affects the stored name / slug fields.
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
# ── Major arcana: (new_name, new_slug) keyed by card number ─────────────────
|
||||||
|
|
||||||
|
MAJOR_RENAMES = {
|
||||||
|
# Implicit Virtues (cards 6–9)
|
||||||
|
6: ("Implicit Virtue 1: Controlled Folly", "implicit-virtue-1-controlled-folly"),
|
||||||
|
7: ("Implicit Virtue 2: Not-Doing", "implicit-virtue-2-not-doing"),
|
||||||
|
8: ("Implicit Virtue 3: Losing Self-Importance", "implicit-virtue-3-losing-self-importance"),
|
||||||
|
9: ("Implicit Virtue 4: Erasing Personal History", "implicit-virtue-4-erasing-personal-history"),
|
||||||
|
# Explicit Virtues (cards 18–20)
|
||||||
|
18: ("Explicit Virtue 1: Stalking", "explicit-virtue-1-stalking"),
|
||||||
|
19: ("Explicit Virtue 2: Intent", "explicit-virtue-2-intent"),
|
||||||
|
20: ("Explicit Virtue 3: Dreaming", "explicit-virtue-3-dreaming"),
|
||||||
|
# Classical Elements (cards 21–24)
|
||||||
|
21: ("Classical Element 1: Fire", "classical-element-1-fire"),
|
||||||
|
22: ("Classical Element 2: Earth", "classical-element-2-earth"),
|
||||||
|
23: ("Classical Element 3: Air", "classical-element-3-air"),
|
||||||
|
24: ("Classical Element 4: Water", "classical-element-4-water"),
|
||||||
|
# Zodiac (cards 25–36)
|
||||||
|
25: ("Zodiac 1: Aries", "zodiac-1-aries"),
|
||||||
|
26: ("Zodiac 2: Taurus", "zodiac-2-taurus"),
|
||||||
|
27: ("Zodiac 3: Gemini", "zodiac-3-gemini"),
|
||||||
|
28: ("Zodiac 4: Cancer", "zodiac-4-cancer"),
|
||||||
|
29: ("Zodiac 5: Leo", "zodiac-5-leo"),
|
||||||
|
30: ("Zodiac 6: Virgo", "zodiac-6-virgo"),
|
||||||
|
31: ("Zodiac 7: Libra", "zodiac-7-libra"),
|
||||||
|
32: ("Zodiac 8: Scorpio", "zodiac-8-scorpio"),
|
||||||
|
33: ("Zodiac 9: Sagittarius", "zodiac-9-sagittarius"),
|
||||||
|
34: ("Zodiac 10: Capricorn", "zodiac-10-capricorn"),
|
||||||
|
35: ("Zodiac 11: Aquarius", "zodiac-11-aquarius"),
|
||||||
|
36: ("Zodiac 12: Pisces", "zodiac-12-pisces"),
|
||||||
|
# Absolute Elements (cards 37–38)
|
||||||
|
37: ("Absolute Element 1: Time", "absolute-element-1-time"),
|
||||||
|
38: ("Absolute Element 2: Space", "absolute-element-2-space"),
|
||||||
|
# Wanderers (cards 39–49)
|
||||||
|
39: ("Wanderer 1: The Polestar", "wanderer-1-polestar"),
|
||||||
|
40: ("Wanderer 2: The Antichthon", "wanderer-2-antichthon"),
|
||||||
|
41: ("Wanderer 3: The Corestar", "wanderer-3-corestar"),
|
||||||
|
42: ("Wanderer 4: Mercury", "wanderer-4-mercury"),
|
||||||
|
43: ("Wanderer 5: Venus", "wanderer-5-venus"),
|
||||||
|
44: ("Wanderer 6: Mars", "wanderer-6-mars"),
|
||||||
|
45: ("Wanderer 7: Jupiter", "wanderer-7-jupiter"),
|
||||||
|
46: ("Wanderer 8: Saturn", "wanderer-8-saturn"),
|
||||||
|
47: ("Wanderer 9: Uranus", "wanderer-9-uranus"),
|
||||||
|
48: ("Wanderer 10: Neptune", "wanderer-10-neptune"),
|
||||||
|
49: ("Wanderer 11: The King & Queen of Hades", "wanderer-11-king-queen-hades"),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Original (name, slug) pairs for reversal
|
||||||
|
MAJOR_ORIGINALS = {
|
||||||
|
6: ("Virtue VI: Controlled Folly", "virtue-vi-controlled-folly"),
|
||||||
|
7: ("Virtue VII: Not-Doing", "virtue-vii-not-doing"),
|
||||||
|
8: ("Virtue VIII: Losing Self-Importance", "virtue-viii-losing-self-importance"),
|
||||||
|
9: ("Virtue IX: Erasing Personal History", "virtue-ix-erasing-personal-history"),
|
||||||
|
18: ("Virtue XVIII: Stalking", "virtue-xviii-stalking"),
|
||||||
|
19: ("Virtue XIX: Intent", "virtue-xix-intent"),
|
||||||
|
20: ("Virtue XX: Dreaming", "virtue-xx-dreaming"),
|
||||||
|
21: ("Element XXI: Fire", "element-xxi-fire"),
|
||||||
|
22: ("Element XXII: Earth", "element-xxii-earth"),
|
||||||
|
23: ("Element XXIII: Air", "element-xxiii-air"),
|
||||||
|
24: ("Element XXIV: Water", "element-xxiv-water"),
|
||||||
|
25: ("Zodiac XXV: Aries", "zodiac-xxv-aries"),
|
||||||
|
26: ("Zodiac XXVI: Taurus", "zodiac-xxvi-taurus"),
|
||||||
|
27: ("Zodiac XXVII: Gemini", "zodiac-xxvii-gemini"),
|
||||||
|
28: ("Zodiac XXVIII: Cancer", "zodiac-xxviii-cancer"),
|
||||||
|
29: ("Zodiac XXIX: Leo", "zodiac-xxix-leo"),
|
||||||
|
30: ("Zodiac XXX: Virgo", "zodiac-xxx-virgo"),
|
||||||
|
31: ("Zodiac XXXI: Libra", "zodiac-xxxi-libra"),
|
||||||
|
32: ("Zodiac XXXII: Scorpio", "zodiac-xxxii-scorpio"),
|
||||||
|
33: ("Zodiac XXXIII: Sagittarius", "zodiac-xxxiii-sagittarius"),
|
||||||
|
34: ("Zodiac XXXIV: Capricorn", "zodiac-xxxiv-capricorn"),
|
||||||
|
35: ("Zodiac XXXV: Aquarius", "zodiac-xxxv-aquarius"),
|
||||||
|
36: ("Zodiac XXXVI: Pisces", "zodiac-xxxvi-pisces"),
|
||||||
|
37: ("Element XXXVII: Time", "element-xxxvii-time"),
|
||||||
|
38: ("Element XXXVIII: Space", "element-xxxviii-space"),
|
||||||
|
39: ("Wanderer XXXIX: The Polestar", "wanderer-xxxix-polestar"),
|
||||||
|
40: ("Wanderer XL: The Antichthon", "wanderer-xl-antichthon"),
|
||||||
|
41: ("Wanderer XLI: The Corestar", "wanderer-xli-corestar"),
|
||||||
|
42: ("Wanderer XLII: Mercury", "wanderer-xlii-mercury"),
|
||||||
|
43: ("Wanderer XLIII: Venus", "wanderer-xliii-venus"),
|
||||||
|
44: ("Wanderer XLIV: Mars", "wanderer-xliv-mars"),
|
||||||
|
45: ("Wanderer XLV: Jupiter", "wanderer-xlv-jupiter"),
|
||||||
|
46: ("Wanderer XLVI: Saturn", "wanderer-xlvi-saturn"),
|
||||||
|
47: ("Wanderer XLVII: Uranus", "wanderer-xlvii-uranus"),
|
||||||
|
48: ("Wanderer XLVIII: Neptune", "wanderer-xlviii-neptune"),
|
||||||
|
49: ("Wanderer XLIX: The King & Queen of Hades", "wanderer-xlix-king-queen-hades"),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Pip number → spelled-out word (slugs already use the word form, only name changes)
|
||||||
|
PIP_SPELLINGS = {
|
||||||
|
2: "Two", 3: "Three", 4: "Four", 5: "Five",
|
||||||
|
6: "Six", 7: "Seven", 8: "Eight", 9: "Nine", 10: "Ten",
|
||||||
|
}
|
||||||
|
|
||||||
|
SUITS = ["WANDS", "CUPS", "SWORDS", "COINS"]
|
||||||
|
|
||||||
|
|
||||||
|
def rename_forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
# 1. Rename grouped major arcana to group-relative ordinals
|
||||||
|
for number, (new_name, new_slug) in MAJOR_RENAMES.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=new_name, slug=new_slug)
|
||||||
|
|
||||||
|
# 2. Spell out pip names 2–10
|
||||||
|
for number, word in PIP_SPELLINGS.items():
|
||||||
|
for suit in SUITS:
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MINOR", suit=suit, number=number
|
||||||
|
).update(name=f"{word} of {suit.capitalize()}")
|
||||||
|
|
||||||
|
|
||||||
|
def rename_reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
# 1. Restore original major arcana names
|
||||||
|
for number, (old_name, old_slug) in MAJOR_ORIGINALS.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=old_name, slug=old_slug)
|
||||||
|
|
||||||
|
# 2. Restore numeric pip names (slugs unchanged)
|
||||||
|
for number, _word in PIP_SPELLINGS.items():
|
||||||
|
for suit in SUITS:
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MINOR", suit=suit, number=number
|
||||||
|
).update(name=f"{number} of {suit.capitalize()}")
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0011_rename_earthman_court_cards"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(rename_forward, reverse_code=rename_reverse),
|
||||||
|
]
|
||||||
55
src/apps/epic/migrations/0013_earthman_coins_to_pentacles.py
Normal file
55
src/apps/epic/migrations/0013_earthman_coins_to_pentacles.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
"""
|
||||||
|
Data migration: rename Earthman 4th-suit cards from COINS → PENTACLES.
|
||||||
|
|
||||||
|
Updates:
|
||||||
|
- suit field: "COINS" → "PENTACLES"
|
||||||
|
- name: "X of Coins" → "X of Pentacles"
|
||||||
|
- slug: "x-of-coins-em" → "x-of-pentacles-em"
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def coins_to_pentacles(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
cards = TarotCard.objects.filter(deck_variant=earthman, suit="COINS")
|
||||||
|
for card in cards:
|
||||||
|
card.suit = "PENTACLES"
|
||||||
|
card.name = card.name.replace(" of Coins", " of Pentacles")
|
||||||
|
card.slug = card.slug.replace("-of-coins-em", "-of-pentacles-em")
|
||||||
|
card.save(update_fields=["suit", "name", "slug"])
|
||||||
|
|
||||||
|
|
||||||
|
def pentacles_to_coins(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Only reverse cards that came from Earthman (identified by -em slug suffix)
|
||||||
|
cards = TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, suit="PENTACLES", slug__endswith="-em"
|
||||||
|
)
|
||||||
|
for card in cards:
|
||||||
|
card.suit = "COINS"
|
||||||
|
card.name = card.name.replace(" of Pentacles", " of Coins")
|
||||||
|
card.slug = card.slug.replace("-of-pentacles-em", "-of-coins-em")
|
||||||
|
card.save(update_fields=["suit", "name", "slug"])
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0012_rename_earthman_major_groups_and_pip_spellings"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(coins_to_pentacles, reverse_code=pentacles_to_coins),
|
||||||
|
]
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
"""
|
||||||
|
Data migration: rename the five Pope cards to use Arabic group-relative ordinals,
|
||||||
|
matching the convention set for other grouped major arcana.
|
||||||
|
|
||||||
|
"Pope I: President" → "Pope 1: President"
|
||||||
|
"Pope II: Tsar" → "Pope 2: Tsar"
|
||||||
|
etc.
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
POPE_RENAMES = {
|
||||||
|
1: ("Pope 1: President", "pope-1-president"),
|
||||||
|
2: ("Pope 2: Tsar", "pope-2-tsar"),
|
||||||
|
3: ("Pope 3: Chairman", "pope-3-chairman"),
|
||||||
|
4: ("Pope 4: Emperor", "pope-4-emperor"),
|
||||||
|
5: ("Pope 5: Chancellor", "pope-5-chancellor"),
|
||||||
|
}
|
||||||
|
|
||||||
|
POPE_ORIGINALS = {
|
||||||
|
1: ("Pope I: President", "pope-i-president"),
|
||||||
|
2: ("Pope II: Tsar", "pope-ii-tsar"),
|
||||||
|
3: ("Pope III: Chairman", "pope-iii-chairman"),
|
||||||
|
4: ("Pope IV: Emperor", "pope-iv-emperor"),
|
||||||
|
5: ("Pope V: Chancellor", "pope-v-chancellor"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def rename_forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
for number, (new_name, new_slug) in POPE_RENAMES.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=new_name, slug=new_slug)
|
||||||
|
|
||||||
|
|
||||||
|
def rename_reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
for number, (old_name, old_slug) in POPE_ORIGINALS.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=old_name, slug=old_slug)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0013_earthman_coins_to_pentacles"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(rename_forward, reverse_code=rename_reverse),
|
||||||
|
]
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
"""
|
||||||
|
Data migration: rename Earthman card 22 from "Classical Element 2: Earth"
|
||||||
|
to "Classical Element 2: Stone" (Stone = Ossum, the Earthman name for Earth).
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def rename_forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=22
|
||||||
|
).update(name="Classical Element 2: Stone", slug="classical-element-2-stone")
|
||||||
|
|
||||||
|
|
||||||
|
def rename_reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=22
|
||||||
|
).update(name="Classical Element 2: Earth", slug="classical-element-2-earth")
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0014_rename_earthman_popes_arabic_ordinals"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(rename_forward, reverse_code=rename_reverse),
|
||||||
|
]
|
||||||
63
src/apps/epic/migrations/0016_reorder_earthman_popes.py
Normal file
63
src/apps/epic/migrations/0016_reorder_earthman_popes.py
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
"""
|
||||||
|
Data migration: reorder the five Pope cards.
|
||||||
|
|
||||||
|
New assignment (card number → title):
|
||||||
|
1 → Chancellor 2 → President 3 → Tsar 4 → Chairman 5 → Emperor
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
POPE_RENAMES = {
|
||||||
|
1: ("Pope 1: Chancellor", "pope-1-chancellor"),
|
||||||
|
2: ("Pope 2: President", "pope-2-president"),
|
||||||
|
3: ("Pope 3: Tsar", "pope-3-tsar"),
|
||||||
|
4: ("Pope 4: Chairman", "pope-4-chairman"),
|
||||||
|
5: ("Pope 5: Emperor", "pope-5-emperor"),
|
||||||
|
}
|
||||||
|
|
||||||
|
POPE_ORIGINALS = {
|
||||||
|
1: ("Pope 1: President", "pope-1-president"),
|
||||||
|
2: ("Pope 2: Tsar", "pope-2-tsar"),
|
||||||
|
3: ("Pope 3: Chairman", "pope-3-chairman"),
|
||||||
|
4: ("Pope 4: Emperor", "pope-4-emperor"),
|
||||||
|
5: ("Pope 5: Chancellor", "pope-5-chancellor"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def rename_forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
for number, (new_name, new_slug) in POPE_RENAMES.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=new_name, slug=new_slug)
|
||||||
|
|
||||||
|
|
||||||
|
def rename_reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
for number, (old_name, old_slug) in POPE_ORIGINALS.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=old_name, slug=old_slug)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0015_rename_classical_element_earth_to_stone"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(rename_forward, reverse_code=rename_reverse),
|
||||||
|
]
|
||||||
19
src/apps/epic/migrations/0017_tableseat_significator_fk.py
Normal file
19
src/apps/epic/migrations/0017_tableseat_significator_fk.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-03-25 05:46
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0016_reorder_earthman_popes'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='tableseat',
|
||||||
|
name='significator',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='significator_seats', to='epic.tarotcard'),
|
||||||
|
),
|
||||||
|
]
|
||||||
18
src/apps/epic/migrations/0018_alter_tarotcard_suit.py
Normal file
18
src/apps/epic/migrations/0018_alter_tarotcard_suit.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-04-01 17:37
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0017_tableseat_significator_fk'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='suit',
|
||||||
|
field=models.CharField(blank=True, choices=[('WANDS', 'Wands'), ('CUPS', 'Cups'), ('SWORDS', 'Swords'), ('PENTACLES', 'Pentacles')], max_length=10, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
"""
|
||||||
|
Data migration: rename The Schiz (card 0) and the five Pope cards (cards 1–5)
|
||||||
|
in the Earthman deck.
|
||||||
|
|
||||||
|
0: "The Schiz" → "The Nomad"
|
||||||
|
1: "Pope 1: Chancellor" → "Pope 1: The Schizo"
|
||||||
|
2: "Pope 2: President" → "Pope 2: The Despot"
|
||||||
|
3: "Pope 3: Tsar" → "Pope 3: The Capitalist"
|
||||||
|
4: "Pope 4: Chairman" → "Pope 4: The Fascist"
|
||||||
|
5: "Pope 5: Emperor" → "Pope 5: The War Machine"
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
NEW_NAMES = {
|
||||||
|
0: ("The Nomad", "the-nomad"),
|
||||||
|
1: ("Pope 1: The Schizo", "pope-1-the-schizo"),
|
||||||
|
2: ("Pope 2: The Despot", "pope-2-the-despot"),
|
||||||
|
3: ("Pope 3: The Capitalist", "pope-3-the-capitalist"),
|
||||||
|
4: ("Pope 4: The Fascist", "pope-4-the-fascist"),
|
||||||
|
5: ("Pope 5: The War Machine","pope-5-the-war-machine"),
|
||||||
|
}
|
||||||
|
|
||||||
|
OLD_NAMES = {
|
||||||
|
0: ("The Schiz", "the-schiz"),
|
||||||
|
1: ("Pope 1: Chancellor", "pope-1-chancellor"),
|
||||||
|
2: ("Pope 2: President", "pope-2-president"),
|
||||||
|
3: ("Pope 3: Tsar", "pope-3-tsar"),
|
||||||
|
4: ("Pope 4: Chairman", "pope-4-chairman"),
|
||||||
|
5: ("Pope 5: Emperor", "pope-5-emperor"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def rename_forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
for number, (new_name, new_slug) in NEW_NAMES.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=new_name, slug=new_slug)
|
||||||
|
|
||||||
|
|
||||||
|
def rename_reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
for number, (old_name, old_slug) in OLD_NAMES.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=old_name, slug=old_slug)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0018_alter_tarotcard_suit"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(rename_forward, reverse_code=rename_reverse),
|
||||||
|
]
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
"""
|
||||||
|
Data migration: rename Pope cards 2–5 in the Earthman deck.
|
||||||
|
|
||||||
|
2: "Pope 2: The Despot" → "Pope 2: The Occultist"
|
||||||
|
3: "Pope 3: The Capitalist" → "Pope 3: The Despot"
|
||||||
|
4: "Pope 4: The Fascist" → "Pope 4: The Capitalist"
|
||||||
|
5: "Pope 5: The War Machine" → "Pope 5: The Fascist"
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
NEW_NAMES = {
|
||||||
|
2: ("Pope 2: The Occultist", "pope-2-the-occultist"),
|
||||||
|
3: ("Pope 3: The Despot", "pope-3-the-despot"),
|
||||||
|
4: ("Pope 4: The Capitalist","pope-4-the-capitalist"),
|
||||||
|
5: ("Pope 5: The Fascist", "pope-5-the-fascist"),
|
||||||
|
}
|
||||||
|
|
||||||
|
OLD_NAMES = {
|
||||||
|
2: ("Pope 2: The Despot", "pope-2-the-despot"),
|
||||||
|
3: ("Pope 3: The Capitalist", "pope-3-the-capitalist"),
|
||||||
|
4: ("Pope 4: The Fascist", "pope-4-the-fascist"),
|
||||||
|
5: ("Pope 5: The War Machine", "pope-5-the-war-machine"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def rename_forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
for number, (new_name, new_slug) in NEW_NAMES.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=new_name, slug=new_slug)
|
||||||
|
|
||||||
|
|
||||||
|
def rename_reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
for number, (old_name, old_slug) in OLD_NAMES.items():
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(name=old_name, slug=old_slug)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0019_rename_earthman_schiz_and_popes"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(rename_forward, reverse_code=rename_reverse),
|
||||||
|
]
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
"""
|
||||||
|
Data migration: rename/update six Earthman Major Arcana cards.
|
||||||
|
|
||||||
|
13 name: "Death" → "King Death & the Cosmic Tree"
|
||||||
|
14 name: "The Traitor" → "The Great Hunt"
|
||||||
|
15 correspondence: "The Tower / La Torre" → "The House of the Devil / Inferno"
|
||||||
|
16 correspondence: "Purgatorio" → "The Tower / La Torre / Purgatorio"
|
||||||
|
50 name/slug: "The Eagle" → "The Mould of Man"
|
||||||
|
51 name/slug: "Divine Calculus" → "The Eagle"
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
FORWARD = {
|
||||||
|
13: dict(name="King Death & the Cosmic Tree", slug="king-death-and-the-cosmic-tree"),
|
||||||
|
14: dict(name="The Great Hunt", slug="the-great-hunt"),
|
||||||
|
15: dict(correspondence="The House of the Devil / Inferno"),
|
||||||
|
16: dict(correspondence="The Tower / La Torre / Purgatorio"),
|
||||||
|
50: dict(name="The Mould of Man", slug="the-mould-of-man"),
|
||||||
|
51: dict(name="The Eagle", slug="the-eagle"),
|
||||||
|
}
|
||||||
|
|
||||||
|
REVERSE = {
|
||||||
|
13: dict(name="Death", slug="death-em"),
|
||||||
|
14: dict(name="The Traitor", slug="the-traitor"),
|
||||||
|
15: dict(correspondence="The Tower / La Torre"),
|
||||||
|
16: dict(correspondence="Purgatorio"),
|
||||||
|
50: dict(name="The Eagle", slug="the-eagle"),
|
||||||
|
51: dict(name="Divine Calculus",slug="divine-calculus"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def apply(changes):
|
||||||
|
def fn(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
# Process in sorted order so card 50 vacates "the-eagle" slug before card 51 claims it.
|
||||||
|
for number in sorted(changes):
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=number
|
||||||
|
).update(**changes[number])
|
||||||
|
return fn
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0020_rename_earthman_pope_cards_2_5"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(apply(FORWARD), reverse_code=apply(REVERSE)),
|
||||||
|
]
|
||||||
31
src/apps/epic/migrations/0022_sig_reservation.py
Normal file
31
src/apps/epic/migrations/0022_sig_reservation.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-04-06 00:02
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0021_rename_earthman_major_arcana_batch_2'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='SigReservation',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('role', models.CharField(max_length=2)),
|
||||||
|
('polarity', models.CharField(choices=[('levity', 'Levity'), ('gravity', 'Gravity')], max_length=7)),
|
||||||
|
('reserved_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('card', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sig_reservations', to='epic.tarotcard')),
|
||||||
|
('gamer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sig_reservations', to=settings.AUTH_USER_MODEL)),
|
||||||
|
('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sig_reservations', to='epic.room')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'constraints': [models.UniqueConstraint(fields=('room', 'gamer'), name='one_sig_reservation_per_gamer_per_room'), models.UniqueConstraint(fields=('room', 'card', 'polarity'), name='one_reservation_per_card_per_polarity_per_room')],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-04-06 02:22
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0022_sig_reservation'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='icon',
|
||||||
|
field=models.CharField(blank=True, default='', max_length=50),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='arcana',
|
||||||
|
field=models.CharField(choices=[('MAJOR', 'Major Arcana'), ('MINOR', 'Minor Arcana'), ('MIDDLE', 'Middle Arcana')], max_length=6),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='suit',
|
||||||
|
field=models.CharField(blank=True, choices=[('WANDS', 'Wands'), ('CUPS', 'Cups'), ('SWORDS', 'Swords'), ('PENTACLES', 'Pentacles'), ('CROWNS', 'Crowns')], max_length=10, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
"""
|
||||||
|
Data migration: rename Earthman 4th-suit cards from PENTACLES → CROWNS.
|
||||||
|
|
||||||
|
Updates for every Earthman card where suit="PENTACLES":
|
||||||
|
- suit: "PENTACLES" → "CROWNS"
|
||||||
|
- name: " of Pentacles" → " of Crowns"
|
||||||
|
- slug: "pentacles" → "crowns"
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def pentacles_to_crowns(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
for card in TarotCard.objects.filter(deck_variant=earthman, suit="PENTACLES"):
|
||||||
|
card.suit = "CROWNS"
|
||||||
|
card.name = card.name.replace(" of Pentacles", " of Crowns")
|
||||||
|
card.slug = card.slug.replace("pentacles", "crowns")
|
||||||
|
card.save(update_fields=["suit", "name", "slug"])
|
||||||
|
|
||||||
|
|
||||||
|
def crowns_to_pentacles(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
for card in TarotCard.objects.filter(deck_variant=earthman, suit="CROWNS"):
|
||||||
|
card.suit = "PENTACLES"
|
||||||
|
card.name = card.name.replace(" of Crowns", " of Pentacles")
|
||||||
|
card.slug = card.slug.replace("crowns", "pentacles")
|
||||||
|
card.save(update_fields=["suit", "name", "slug"])
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0023_tarotcard_icon_alter_tarotcard_arcana_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(pentacles_to_crowns, reverse_code=crowns_to_pentacles),
|
||||||
|
]
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
"""
|
||||||
|
Data migration: Earthman deck — court cards and major arcana icons.
|
||||||
|
|
||||||
|
1. Court cards (numbers 11–14, all suits): arcana "MINOR" → "MIDDLE"
|
||||||
|
2. Major arcana icons (stored in TarotCard.icon):
|
||||||
|
0 (Nomad) → fa-hat-cowboy-side
|
||||||
|
1 (Schizo) → fa-hat-wizard
|
||||||
|
2–51 (rest) → fa-hand-dots
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
MAJOR_ICONS = {
|
||||||
|
0: "fa-hat-cowboy-side",
|
||||||
|
1: "fa-hat-wizard",
|
||||||
|
}
|
||||||
|
DEFAULT_MAJOR_ICON = "fa-hand-dots"
|
||||||
|
|
||||||
|
|
||||||
|
def forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Court cards → MIDDLE
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MINOR", number__in=[11, 12, 13, 14]
|
||||||
|
).update(arcana="MIDDLE")
|
||||||
|
|
||||||
|
# Major arcana icons
|
||||||
|
for card in TarotCard.objects.filter(deck_variant=earthman, arcana="MAJOR"):
|
||||||
|
card.icon = MAJOR_ICONS.get(card.number, DEFAULT_MAJOR_ICON)
|
||||||
|
card.save(update_fields=["icon"])
|
||||||
|
|
||||||
|
|
||||||
|
def backward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
earthman = DeckVariant.objects.filter(slug="earthman").first()
|
||||||
|
if not earthman:
|
||||||
|
return
|
||||||
|
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MIDDLE", number__in=[11, 12, 13, 14]
|
||||||
|
).update(arcana="MINOR")
|
||||||
|
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR"
|
||||||
|
).update(icon="")
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0024_earthman_pentacles_to_crowns"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(forward, reverse_code=backward),
|
||||||
|
]
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
"""
|
||||||
|
Data migration — Earthman deck:
|
||||||
|
1. Rename three suit codes (and card names) for Earthman cards:
|
||||||
|
WANDS → BRANDS (Wands → Brands)
|
||||||
|
CUPS → GRAILS (Cups → Grails)
|
||||||
|
SWORDS → BLADES (Swords → Blades)
|
||||||
|
CROWNS stays CROWNS.
|
||||||
|
2. Copy keywords_upright / keywords_reversed from the Fiorentine Minchiate
|
||||||
|
deck to corresponding Earthman cards:
|
||||||
|
• Major: explicit number-to-number map based on card correspondences.
|
||||||
|
• Minor/Middle: same number, suit mapped (BRANDS→WANDS, GRAILS→CUPS,
|
||||||
|
BLADES→SWORDS, CROWNS→PENTACLES). Cards with no Fiorentine counterpart
|
||||||
|
stay with empty keyword lists.
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
# ── 1. Suit rename map ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
SUIT_RENAMES = {
|
||||||
|
"WANDS": "BRANDS",
|
||||||
|
"CUPS": "GRAILS",
|
||||||
|
"SWORDS": "BLADES",
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── 2. Major arcana: Earthman number → Fiorentine number ─────────────────────
|
||||||
|
# Cards without a Fiorentine counterpart are omitted (keywords stay empty).
|
||||||
|
|
||||||
|
MAJOR_KEYWORD_MAP = {
|
||||||
|
0: 0, # The Schiz → The Fool
|
||||||
|
1: 1, # Pope I (President) → The Magician
|
||||||
|
2: 2, # Pope II (Tsar) → The High Priestess
|
||||||
|
3: 3, # Pope III (Chairman) → The Empress
|
||||||
|
4: 4, # Pope IV (Emperor) → The Emperor
|
||||||
|
5: 5, # Pope V (Chancellor) → The Hierophant
|
||||||
|
6: 8, # Virtue VI (Controlled Folly) → Strength
|
||||||
|
7: 11, # Virtue VII (Not-Doing) → Justice
|
||||||
|
8: 14, # Virtue VIII (Losing Self-Importance) → Temperance
|
||||||
|
# 9: Prudence — no Fiorentine equivalent
|
||||||
|
10: 10, # Wheel of Fortune → Wheel of Fortune
|
||||||
|
11: 7, # The Junkboat → The Chariot
|
||||||
|
12: 12, # The Junkman → The Hanged Man
|
||||||
|
13: 13, # Death → Death
|
||||||
|
14: 15, # The Traitor → The Devil
|
||||||
|
15: 16, # Disco Inferno → The Tower
|
||||||
|
# 16: Torre Terrestre (Purgatory) — no equivalent
|
||||||
|
# 17: Fantasia Celestia (Paradise) — no equivalent
|
||||||
|
18: 6, # Virtue XVIII (Stalking) → The Lovers
|
||||||
|
# 19: Virtue XIX (Intent / Hope) — no equivalent
|
||||||
|
# 20: Virtue XX (Dreaming / Faith)— no equivalent
|
||||||
|
# 21–38: Classical Elements + Zodiac — no equivalents
|
||||||
|
39: 17, # Wanderer XXXIX (Polestar) → The Star
|
||||||
|
40: 18, # Wanderer XL (Antichthon) → The Moon
|
||||||
|
41: 19, # Wanderer XLI (Corestar) → The Sun
|
||||||
|
# 42–49: Planets + The Binary — no equivalents
|
||||||
|
50: 20, # The Eagle → Judgement
|
||||||
|
51: 21, # Divine Calculus → The World
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── 3. Minor suit map: Earthman (post-rename) → Fiorentine ───────────────────
|
||||||
|
|
||||||
|
MINOR_SUIT_MAP = {
|
||||||
|
"BRANDS": "WANDS",
|
||||||
|
"GRAILS": "CUPS",
|
||||||
|
"BLADES": "SWORDS",
|
||||||
|
"CROWNS": "PENTACLES",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
try:
|
||||||
|
earthman = DeckVariant.objects.get(slug="earthman")
|
||||||
|
fiorentine = DeckVariant.objects.get(slug="fiorentine-minchiate")
|
||||||
|
except DeckVariant.DoesNotExist:
|
||||||
|
return # decks not seeded — nothing to do
|
||||||
|
|
||||||
|
# ── Step 1: rename Earthman suit codes + card names ───────────────────────
|
||||||
|
for old_suit, new_suit in SUIT_RENAMES.items():
|
||||||
|
old_display = old_suit.capitalize() # e.g. "Wands"
|
||||||
|
new_display = new_suit.capitalize() # e.g. "Brands"
|
||||||
|
cards = TarotCard.objects.filter(deck_variant=earthman, suit=old_suit)
|
||||||
|
for card in cards:
|
||||||
|
card.name = card.name.replace(f" of {old_display}", f" of {new_display}")
|
||||||
|
card.suit = new_suit
|
||||||
|
card.save()
|
||||||
|
|
||||||
|
# ── Step 2: copy major arcana keywords ───────────────────────────────────
|
||||||
|
fio_major = {
|
||||||
|
card.number: card
|
||||||
|
for card in TarotCard.objects.filter(deck_variant=fiorentine, arcana="MAJOR")
|
||||||
|
}
|
||||||
|
for em_num, fio_num in MAJOR_KEYWORD_MAP.items():
|
||||||
|
fio_card = fio_major.get(fio_num)
|
||||||
|
if not fio_card:
|
||||||
|
continue
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=em_num
|
||||||
|
).update(
|
||||||
|
keywords_upright=fio_card.keywords_upright,
|
||||||
|
keywords_reversed=fio_card.keywords_reversed,
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Step 3: copy minor/middle arcana keywords ─────────────────────────────
|
||||||
|
for em_suit, fio_suit in MINOR_SUIT_MAP.items():
|
||||||
|
fio_by_number = {
|
||||||
|
card.number: card
|
||||||
|
for card in TarotCard.objects.filter(deck_variant=fiorentine, suit=fio_suit)
|
||||||
|
}
|
||||||
|
for em_card in TarotCard.objects.filter(deck_variant=earthman, suit=em_suit):
|
||||||
|
fio_card = fio_by_number.get(em_card.number)
|
||||||
|
if fio_card:
|
||||||
|
em_card.keywords_upright = fio_card.keywords_upright
|
||||||
|
em_card.keywords_reversed = fio_card.keywords_reversed
|
||||||
|
em_card.save()
|
||||||
|
|
||||||
|
|
||||||
|
def reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
|
||||||
|
try:
|
||||||
|
earthman = DeckVariant.objects.get(slug="earthman")
|
||||||
|
except DeckVariant.DoesNotExist:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Reverse suit renames
|
||||||
|
reverse_renames = {new: old for old, new in SUIT_RENAMES.items()}
|
||||||
|
for new_suit, old_suit in reverse_renames.items():
|
||||||
|
new_display = new_suit.capitalize()
|
||||||
|
old_display = old_suit.capitalize()
|
||||||
|
cards = TarotCard.objects.filter(deck_variant=earthman, suit=new_suit)
|
||||||
|
for card in cards:
|
||||||
|
card.name = card.name.replace(f" of {new_display}", f" of {old_display}")
|
||||||
|
card.suit = old_suit
|
||||||
|
card.save()
|
||||||
|
|
||||||
|
# Clear all Earthman keywords
|
||||||
|
TarotCard.objects.filter(deck_variant=earthman).update(
|
||||||
|
keywords_upright=[],
|
||||||
|
keywords_reversed=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0025_earthman_middle_arcana_and_major_icons"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(forward, reverse_code=reverse),
|
||||||
|
]
|
||||||
65
src/apps/epic/migrations/0027_tarotcard_cautions.py
Normal file
65
src/apps/epic/migrations/0027_tarotcard_cautions.py
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
"""
|
||||||
|
Schema + data migration:
|
||||||
|
1. Add `cautions` JSONField (list, default=[]) to TarotCard.
|
||||||
|
2. Seed The Schizo (Earthman MAJOR #1) with 4 rival-interaction cautions.
|
||||||
|
All other cards default to [] — the UI shows a placeholder when empty.
|
||||||
|
"""
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
SCHIZO_CAUTIONS = [
|
||||||
|
'This card will reverse into <span class="card-ref">The Pervert</span> when it'
|
||||||
|
' comes under dominion of <span class="card-ref">The Occultist</span>, which in turn'
|
||||||
|
' reverses into <span class="card-ref">Pestilence</span>.',
|
||||||
|
|
||||||
|
'This card will reverse into <span class="card-ref">The Paranoiac</span> when it'
|
||||||
|
' comes under dominion of <span class="card-ref">The Despot</span>, which in turn'
|
||||||
|
' reverses into <span class="card-ref">War</span>.',
|
||||||
|
|
||||||
|
'This card will reverse into <span class="card-ref">The Neurotic</span> when it'
|
||||||
|
' comes under dominion of <span class="card-ref">The Capitalist</span>, which in turn'
|
||||||
|
' reverses into <span class="card-ref">Famine</span>.',
|
||||||
|
|
||||||
|
'This card will reverse into <span class="card-ref">The Suicidal</span> when it'
|
||||||
|
' comes under dominion of <span class="card-ref">The Fascist</span>, which in turn'
|
||||||
|
' reverses into <span class="card-ref">Death</span>.',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def seed_schizo_cautions(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
try:
|
||||||
|
earthman = DeckVariant.objects.get(slug="earthman")
|
||||||
|
except DeckVariant.DoesNotExist:
|
||||||
|
return
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=1
|
||||||
|
).update(cautions=SCHIZO_CAUTIONS)
|
||||||
|
|
||||||
|
|
||||||
|
def clear_schizo_cautions(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
try:
|
||||||
|
earthman = DeckVariant.objects.get(slug="earthman")
|
||||||
|
except DeckVariant.DoesNotExist:
|
||||||
|
return
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=1
|
||||||
|
).update(cautions=[])
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0026_earthman_suit_renames_and_keywords"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="tarotcard",
|
||||||
|
name="cautions",
|
||||||
|
field=models.JSONField(default=list),
|
||||||
|
),
|
||||||
|
migrations.RunPython(seed_schizo_cautions, reverse_code=clear_schizo_cautions),
|
||||||
|
]
|
||||||
18
src/apps/epic/migrations/0028_alter_tarotcard_suit.py
Normal file
18
src/apps/epic/migrations/0028_alter_tarotcard_suit.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 6.0 on 2026-04-07 03:09
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0027_tarotcard_cautions'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tarotcard',
|
||||||
|
name='suit',
|
||||||
|
field=models.CharField(blank=True, choices=[('WANDS', 'Wands'), ('CUPS', 'Cups'), ('SWORDS', 'Swords'), ('PENTACLES', 'Pentacles'), ('CROWNS', 'Crowns'), ('BRANDS', 'Brands'), ('GRAILS', 'Grails'), ('BLADES', 'Blades')], max_length=10, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
61
src/apps/epic/migrations/0029_fix_schizo_cautions.py
Normal file
61
src/apps/epic/migrations/0029_fix_schizo_cautions.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
"""
|
||||||
|
Data fix: clear Schizo cautions from The Nomad (number=0) if present,
|
||||||
|
and ensure they land on The Schizo (number=1).
|
||||||
|
"""
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
SCHIZO_CAUTIONS = [
|
||||||
|
'This card will reverse into <span class="card-ref">I. The Pervert</span> when it'
|
||||||
|
' comes under dominion of <span class="card-ref">II. The Occultist</span>, which in turn'
|
||||||
|
' reverses into <span class="card-ref">II. Pestilence</span>.',
|
||||||
|
|
||||||
|
'This card will reverse into <span class="card-ref">I. The Paranoiac</span> when it'
|
||||||
|
' comes under dominion of <span class="card-ref">III. The Despot</span>, which in turn'
|
||||||
|
' reverses into <span class="card-ref">III. War</span>.',
|
||||||
|
|
||||||
|
'This card will reverse into <span class="card-ref">I. The Neurotic</span> when it'
|
||||||
|
' comes under dominion of <span class="card-ref">IV. The Capitalist</span>, which in turn'
|
||||||
|
' reverses into <span class="card-ref">IV. Famine</span>.',
|
||||||
|
|
||||||
|
'This card will reverse into <span class="card-ref">I. The Suicidal</span> when it'
|
||||||
|
' comes under dominion of <span class="card-ref">V. The Fascist</span>, which in turn'
|
||||||
|
' reverses into <span class="card-ref">V. Death</span>.',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def forward(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
try:
|
||||||
|
earthman = DeckVariant.objects.get(slug="earthman")
|
||||||
|
except DeckVariant.DoesNotExist:
|
||||||
|
return
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=0
|
||||||
|
).update(cautions=[])
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=1
|
||||||
|
).update(cautions=SCHIZO_CAUTIONS)
|
||||||
|
|
||||||
|
|
||||||
|
def reverse(apps, schema_editor):
|
||||||
|
TarotCard = apps.get_model("epic", "TarotCard")
|
||||||
|
DeckVariant = apps.get_model("epic", "DeckVariant")
|
||||||
|
try:
|
||||||
|
earthman = DeckVariant.objects.get(slug="earthman")
|
||||||
|
except DeckVariant.DoesNotExist:
|
||||||
|
return
|
||||||
|
TarotCard.objects.filter(
|
||||||
|
deck_variant=earthman, arcana="MAJOR", number=1
|
||||||
|
).update(cautions=[])
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("epic", "0028_alter_tarotcard_suit"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(forward, reverse_code=reverse),
|
||||||
|
]
|
||||||
23
src/apps/epic/migrations/0030_sigreservation_seat_fk.py
Normal file
23
src/apps/epic/migrations/0030_sigreservation_seat_fk.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('epic', '0029_fix_schizo_cautions'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='sigreservation',
|
||||||
|
name='seat',
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
related_name='sig_reservation',
|
||||||
|
to='epic.tableseat',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
0
src/apps/epic/migrations/__init__.py
Normal file
0
src/apps/epic/migrations/__init__.py
Normal file
467
src/apps/epic/models.py
Normal file
467
src/apps/epic/models.py
Normal file
@@ -0,0 +1,467 @@
|
|||||||
|
import random
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
from django.db import models
|
||||||
|
from django.db.models import UniqueConstraint
|
||||||
|
from django.db.models.signals import post_save
|
||||||
|
from django.dispatch import receiver
|
||||||
|
from django.conf import settings
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from apps.lyric.models import Token
|
||||||
|
|
||||||
|
|
||||||
|
class Room(models.Model):
|
||||||
|
GATHERING = "GATHERING"
|
||||||
|
OPEN = "OPEN"
|
||||||
|
RENEWAL_DUE = "RENEWAL_DUE"
|
||||||
|
GATE_STATUS_CHOICES = [
|
||||||
|
(GATHERING, "GATHERING GAMERS"),
|
||||||
|
(OPEN, "Open"),
|
||||||
|
(RENEWAL_DUE, "Renewal Due"),
|
||||||
|
]
|
||||||
|
|
||||||
|
PRIVATE = "PRIVATE"
|
||||||
|
PUBLIC = "PUBLIC"
|
||||||
|
INVITE_ONLY = "INVITE ONLY"
|
||||||
|
VISIBILITY_CHOICES = [
|
||||||
|
(PRIVATE, "Private"),
|
||||||
|
(PUBLIC, "Public"),
|
||||||
|
(INVITE_ONLY, "Invite Only"),
|
||||||
|
]
|
||||||
|
|
||||||
|
ROLE_SELECT = "ROLE_SELECT"
|
||||||
|
SIG_SELECT = "SIG_SELECT"
|
||||||
|
IN_GAME = "IN_GAME"
|
||||||
|
TABLE_STATUS_CHOICES = [
|
||||||
|
(ROLE_SELECT, "Role Select"),
|
||||||
|
(SIG_SELECT, "Significator Select"),
|
||||||
|
(IN_GAME, "In Game"),
|
||||||
|
]
|
||||||
|
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
name = models.CharField(max_length=200)
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="owned_rooms"
|
||||||
|
)
|
||||||
|
visibility = models.CharField(max_length=20, choices=VISIBILITY_CHOICES, default=PRIVATE)
|
||||||
|
gate_status = models.CharField(max_length=20, choices=GATE_STATUS_CHOICES, default=GATHERING)
|
||||||
|
table_status = models.CharField(
|
||||||
|
max_length=20, choices=TABLE_STATUS_CHOICES, null=True, blank=True
|
||||||
|
)
|
||||||
|
renewal_period = models.DurationField(null=True, blank=True, default=timedelta(days=7))
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
board_state = models.JSONField(default=dict)
|
||||||
|
seed_count = models.IntegerField(default=12)
|
||||||
|
|
||||||
|
|
||||||
|
class GateSlot(models.Model):
|
||||||
|
EMPTY = "EMPTY"
|
||||||
|
RESERVED = "RESERVED"
|
||||||
|
FILLED = "FILLED"
|
||||||
|
STATUS_CHOICES = [
|
||||||
|
(EMPTY, "Empty"),
|
||||||
|
(RESERVED, "Reserved"),
|
||||||
|
(FILLED, "Filled"),
|
||||||
|
]
|
||||||
|
|
||||||
|
room = models.ForeignKey(Room, on_delete=models.CASCADE, related_name="gate_slots")
|
||||||
|
slot_number = models.IntegerField()
|
||||||
|
gamer = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, null=True, blank=True,
|
||||||
|
on_delete=models.SET_NULL, related_name="gate_slots"
|
||||||
|
)
|
||||||
|
funded_by = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, null=True, blank=True,
|
||||||
|
on_delete=models.SET_NULL, related_name="funded_slots"
|
||||||
|
)
|
||||||
|
status = models.CharField(max_length=10, choices=STATUS_CHOICES, default=EMPTY)
|
||||||
|
reserved_at = models.DateTimeField(null=True, blank=True)
|
||||||
|
filled_at = models.DateTimeField(null=True, blank=True)
|
||||||
|
debited_token_type = models.CharField(max_length=8, null=True, blank=True)
|
||||||
|
debited_token_expires_at = models.DateTimeField(null=True, blank=True)
|
||||||
|
|
||||||
|
|
||||||
|
class RoomInvite(models.Model):
|
||||||
|
PENDING = "PENDING"
|
||||||
|
ACCEPTED = "ACCEPTED"
|
||||||
|
DECLINED = "DECLINED"
|
||||||
|
STATUS_CHOICES = [
|
||||||
|
(PENDING, "Pending"),
|
||||||
|
(ACCEPTED, "Accepted"),
|
||||||
|
(DECLINED, "Declined"),
|
||||||
|
]
|
||||||
|
|
||||||
|
room = models.ForeignKey(Room, on_delete=models.CASCADE, related_name="invites")
|
||||||
|
inviter = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="sent_invites"
|
||||||
|
)
|
||||||
|
invitee_email = models.EmailField()
|
||||||
|
status = models.CharField(max_length=10, choices=STATUS_CHOICES, default=PENDING)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(post_save, sender=Room)
|
||||||
|
def create_gate_slots(sender, instance, created, **kwargs):
|
||||||
|
if created:
|
||||||
|
for i in range(1, 7):
|
||||||
|
GateSlot.objects.create(room=instance, slot_number=i)
|
||||||
|
|
||||||
|
|
||||||
|
def select_token(user):
|
||||||
|
if user.is_staff:
|
||||||
|
pass_token = user.tokens.filter(token_type=Token.PASS).first()
|
||||||
|
if pass_token:
|
||||||
|
return pass_token
|
||||||
|
coin = user.tokens.filter(token_type=Token.COIN, current_room__isnull=True).first()
|
||||||
|
if coin:
|
||||||
|
return coin
|
||||||
|
free = user.tokens.filter(
|
||||||
|
token_type=Token.FREE,
|
||||||
|
expires_at__gt=timezone.now(),
|
||||||
|
).order_by("expires_at").first()
|
||||||
|
if free:
|
||||||
|
return free
|
||||||
|
return user.tokens.filter(token_type=Token.TITHE).first()
|
||||||
|
|
||||||
|
|
||||||
|
def debit_token(user, slot, token):
|
||||||
|
slot.debited_token_type = token.token_type
|
||||||
|
if token.token_type == Token.COIN:
|
||||||
|
token.current_room = slot.room
|
||||||
|
period = slot.room.renewal_period or timedelta(days=7)
|
||||||
|
token.next_ready_at = timezone.now() + period
|
||||||
|
token.save()
|
||||||
|
elif token.token_type == Token.CARTE:
|
||||||
|
pass # current_room already set in drop_token; token not consumed
|
||||||
|
elif token.token_type != Token.PASS:
|
||||||
|
slot.debited_token_expires_at = token.expires_at
|
||||||
|
token.delete()
|
||||||
|
slot.gamer = user
|
||||||
|
slot.status = GateSlot.FILLED
|
||||||
|
slot.filled_at = timezone.now()
|
||||||
|
slot.save()
|
||||||
|
|
||||||
|
room = slot.room
|
||||||
|
if not room.gate_slots.filter(status=GateSlot.EMPTY).exists():
|
||||||
|
room.gate_status = Room.OPEN
|
||||||
|
room.save()
|
||||||
|
|
||||||
|
|
||||||
|
SIG_SEAT_ORDER = ["PC", "NC", "EC", "SC", "AC", "BC"]
|
||||||
|
|
||||||
|
|
||||||
|
class TableSeat(models.Model):
|
||||||
|
PC = "PC"
|
||||||
|
BC = "BC"
|
||||||
|
SC = "SC"
|
||||||
|
AC = "AC"
|
||||||
|
NC = "NC"
|
||||||
|
EC = "EC"
|
||||||
|
ROLE_CHOICES = [
|
||||||
|
(PC, "Player"),
|
||||||
|
(BC, "Builder"),
|
||||||
|
(SC, "Shepherd"),
|
||||||
|
(AC, "Alchemist"),
|
||||||
|
(NC, "Narrator"),
|
||||||
|
(EC, "Economist"),
|
||||||
|
]
|
||||||
|
PARTNER_MAP = {PC: BC, BC: PC, SC: AC, AC: SC, NC: EC, EC: NC}
|
||||||
|
|
||||||
|
room = models.ForeignKey(Room, on_delete=models.CASCADE, related_name="table_seats")
|
||||||
|
gamer = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, null=True, blank=True,
|
||||||
|
on_delete=models.SET_NULL, related_name="table_seats"
|
||||||
|
)
|
||||||
|
slot_number = models.IntegerField()
|
||||||
|
role = models.CharField(max_length=2, choices=ROLE_CHOICES, null=True, blank=True)
|
||||||
|
role_revealed = models.BooleanField(default=False)
|
||||||
|
seat_position = models.IntegerField(null=True, blank=True)
|
||||||
|
significator = models.ForeignKey(
|
||||||
|
"TarotCard", null=True, blank=True,
|
||||||
|
on_delete=models.SET_NULL, related_name="significator_seats",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DeckVariant(models.Model):
|
||||||
|
"""A named deck variant, e.g. Earthman (108 cards) or Fiorentine Minchiate (78 cards)."""
|
||||||
|
|
||||||
|
name = models.CharField(max_length=100, unique=True)
|
||||||
|
slug = models.SlugField(unique=True)
|
||||||
|
card_count = models.IntegerField()
|
||||||
|
description = models.TextField(blank=True)
|
||||||
|
is_default = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def short_key(self):
|
||||||
|
"""First dash-separated word of slug — used as an HTML id component."""
|
||||||
|
return self.slug.split('-')[0]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.name} ({self.card_count} cards)"
|
||||||
|
|
||||||
|
|
||||||
|
class TarotCard(models.Model):
|
||||||
|
MAJOR = "MAJOR"
|
||||||
|
MINOR = "MINOR"
|
||||||
|
MIDDLE = "MIDDLE" # Earthman court cards (M/J/Q/K)
|
||||||
|
ARCANA_CHOICES = [
|
||||||
|
(MAJOR, "Major Arcana"),
|
||||||
|
(MINOR, "Minor Arcana"),
|
||||||
|
(MIDDLE, "Middle Arcana"),
|
||||||
|
]
|
||||||
|
|
||||||
|
WANDS = "WANDS"
|
||||||
|
CUPS = "CUPS"
|
||||||
|
SWORDS = "SWORDS"
|
||||||
|
PENTACLES = "PENTACLES" # Fiorentine 4th suit
|
||||||
|
CROWNS = "CROWNS" # Earthman 4th suit
|
||||||
|
BRANDS = "BRANDS" # Earthman Wands
|
||||||
|
GRAILS = "GRAILS" # Earthman Cups
|
||||||
|
BLADES = "BLADES" # Earthman Swords
|
||||||
|
SUIT_CHOICES = [
|
||||||
|
(WANDS, "Wands"),
|
||||||
|
(CUPS, "Cups"),
|
||||||
|
(SWORDS, "Swords"),
|
||||||
|
(PENTACLES, "Pentacles"),
|
||||||
|
(CROWNS, "Crowns"),
|
||||||
|
(BRANDS, "Brands"),
|
||||||
|
(GRAILS, "Grails"),
|
||||||
|
(BLADES, "Blades"),
|
||||||
|
]
|
||||||
|
|
||||||
|
deck_variant = models.ForeignKey(
|
||||||
|
DeckVariant, null=True, blank=True,
|
||||||
|
on_delete=models.CASCADE, related_name="cards",
|
||||||
|
)
|
||||||
|
name = models.CharField(max_length=200)
|
||||||
|
arcana = models.CharField(max_length=6, choices=ARCANA_CHOICES)
|
||||||
|
suit = models.CharField(max_length=10, choices=SUIT_CHOICES, null=True, blank=True)
|
||||||
|
icon = models.CharField(max_length=50, blank=True, default='') # FA icon override (e.g. major arcana)
|
||||||
|
number = models.IntegerField() # 0–21 major (Fiorentine); 0–51 major (Earthman); 1–14 minor
|
||||||
|
slug = models.SlugField(max_length=120)
|
||||||
|
correspondence = models.CharField(max_length=200, blank=True) # standard / Italian equivalent
|
||||||
|
group = models.CharField(max_length=100, blank=True) # Earthman major grouping
|
||||||
|
keywords_upright = models.JSONField(default=list)
|
||||||
|
keywords_reversed = models.JSONField(default=list)
|
||||||
|
cautions = models.JSONField(default=list)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ["deck_variant", "arcana", "suit", "number"]
|
||||||
|
unique_together = [("deck_variant", "slug")]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _to_roman(n):
|
||||||
|
if n == 0:
|
||||||
|
return '0'
|
||||||
|
val = [50, 40, 10, 9, 5, 4, 1]
|
||||||
|
syms = ['L','XL','X','IX','V','IV','I']
|
||||||
|
result = ''
|
||||||
|
for v, s in zip(val, syms):
|
||||||
|
while n >= v:
|
||||||
|
result += s
|
||||||
|
n -= v
|
||||||
|
return result
|
||||||
|
|
||||||
|
@property
|
||||||
|
def corner_rank(self):
|
||||||
|
if self.arcana == self.MAJOR:
|
||||||
|
return self._to_roman(self.number)
|
||||||
|
court = {11: 'M', 12: 'J', 13: 'Q', 14: 'K'}
|
||||||
|
return court.get(self.number, str(self.number))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name_group(self):
|
||||||
|
"""Returns 'Group N:' prefix if the name contains ': ', else ''."""
|
||||||
|
if ': ' in self.name:
|
||||||
|
return self.name.split(': ', 1)[0] + ':'
|
||||||
|
return ''
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name_title(self):
|
||||||
|
"""Returns the title after 'Group N: ', or the full name if no colon."""
|
||||||
|
if ': ' in self.name:
|
||||||
|
return self.name.split(': ', 1)[1]
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def suit_icon(self):
|
||||||
|
if self.icon:
|
||||||
|
return self.icon
|
||||||
|
if self.arcana == self.MAJOR:
|
||||||
|
return ''
|
||||||
|
return {
|
||||||
|
self.WANDS: 'fa-wand-sparkles',
|
||||||
|
self.CUPS: 'fa-trophy',
|
||||||
|
self.SWORDS: 'fa-gun',
|
||||||
|
self.PENTACLES: 'fa-star',
|
||||||
|
self.CROWNS: 'fa-crown',
|
||||||
|
self.BRANDS: 'fa-wand-sparkles',
|
||||||
|
self.GRAILS: 'fa-trophy',
|
||||||
|
self.BLADES: 'fa-gun',
|
||||||
|
}.get(self.suit, '')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def cautions_json(self):
|
||||||
|
import json
|
||||||
|
return json.dumps(self.cautions)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class TarotDeck(models.Model):
|
||||||
|
"""One shuffled deck per room, scoped to the founder's chosen DeckVariant."""
|
||||||
|
|
||||||
|
room = models.OneToOneField(Room, on_delete=models.CASCADE, related_name="tarot_deck")
|
||||||
|
deck_variant = models.ForeignKey(
|
||||||
|
DeckVariant, null=True, blank=True,
|
||||||
|
on_delete=models.SET_NULL, related_name="active_decks",
|
||||||
|
)
|
||||||
|
drawn_card_ids = models.JSONField(default=list)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def remaining_count(self):
|
||||||
|
total = self.deck_variant.card_count if self.deck_variant else 0
|
||||||
|
return total - len(self.drawn_card_ids)
|
||||||
|
|
||||||
|
def draw(self, n=1):
|
||||||
|
"""Draw n cards at random. Returns list of (TarotCard, reversed: bool) tuples."""
|
||||||
|
available = list(
|
||||||
|
TarotCard.objects.filter(deck_variant=self.deck_variant)
|
||||||
|
.exclude(id__in=self.drawn_card_ids)
|
||||||
|
)
|
||||||
|
if len(available) < n:
|
||||||
|
raise ValueError(
|
||||||
|
f"Not enough cards remaining: {len(available)} available, {n} requested"
|
||||||
|
)
|
||||||
|
drawn = random.sample(available, n)
|
||||||
|
self.drawn_card_ids = self.drawn_card_ids + [card.id for card in drawn]
|
||||||
|
self.save(update_fields=["drawn_card_ids"])
|
||||||
|
return [(card, random.choice([True, False])) for card in drawn]
|
||||||
|
|
||||||
|
def shuffle(self):
|
||||||
|
"""Reset the deck so all variant cards are available again."""
|
||||||
|
self.drawn_card_ids = []
|
||||||
|
self.save(update_fields=["drawn_card_ids"])
|
||||||
|
|
||||||
|
|
||||||
|
# ── SigReservation — provisional card hold during SIG_SELECT ──────────────────
|
||||||
|
|
||||||
|
class SigReservation(models.Model):
|
||||||
|
LEVITY = 'levity'
|
||||||
|
GRAVITY = 'gravity'
|
||||||
|
POLARITY_CHOICES = [(LEVITY, 'Levity'), (GRAVITY, 'Gravity')]
|
||||||
|
|
||||||
|
room = models.ForeignKey(Room, on_delete=models.CASCADE, related_name='sig_reservations')
|
||||||
|
gamer = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='sig_reservations'
|
||||||
|
)
|
||||||
|
seat = models.ForeignKey(
|
||||||
|
'TableSeat', null=True, blank=True,
|
||||||
|
on_delete=models.SET_NULL, related_name='sig_reservation',
|
||||||
|
)
|
||||||
|
card = models.ForeignKey(
|
||||||
|
'TarotCard', on_delete=models.CASCADE, related_name='sig_reservations'
|
||||||
|
)
|
||||||
|
role = models.CharField(max_length=2)
|
||||||
|
polarity = models.CharField(max_length=7, choices=POLARITY_CHOICES)
|
||||||
|
reserved_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
UniqueConstraint(
|
||||||
|
fields=['room', 'gamer'],
|
||||||
|
name='one_sig_reservation_per_gamer_per_room',
|
||||||
|
),
|
||||||
|
UniqueConstraint(
|
||||||
|
fields=['room', 'card', 'polarity'],
|
||||||
|
name='one_reservation_per_card_per_polarity_per_room',
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# ── Significator deck helpers ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
def sig_deck_cards(room):
|
||||||
|
"""Return 36 TarotCard objects forming the Significator deck (18 unique × 2).
|
||||||
|
|
||||||
|
PC/BC pair → BRANDS/WANDS + CROWNS Middle Arcana court cards (11–14): 8 unique
|
||||||
|
SC/AC pair → BLADES/SWORDS + GRAILS/CUPS Middle Arcana court cards (11–14): 8 unique
|
||||||
|
NC/EC pair → MAJOR arcana numbers 0 and 1: 2 unique
|
||||||
|
Total: 18 unique × 2 (levity + gravity piles) = 36 cards.
|
||||||
|
"""
|
||||||
|
deck_variant = room.owner.equipped_deck
|
||||||
|
if deck_variant is None:
|
||||||
|
return []
|
||||||
|
wands_crowns = list(TarotCard.objects.filter(
|
||||||
|
deck_variant=deck_variant,
|
||||||
|
arcana=TarotCard.MIDDLE,
|
||||||
|
suit__in=[TarotCard.WANDS, TarotCard.BRANDS, TarotCard.CROWNS],
|
||||||
|
number__in=[11, 12, 13, 14],
|
||||||
|
))
|
||||||
|
swords_cups = list(TarotCard.objects.filter(
|
||||||
|
deck_variant=deck_variant,
|
||||||
|
arcana=TarotCard.MIDDLE,
|
||||||
|
suit__in=[TarotCard.SWORDS, TarotCard.BLADES, TarotCard.CUPS, TarotCard.GRAILS],
|
||||||
|
number__in=[11, 12, 13, 14],
|
||||||
|
))
|
||||||
|
major = list(TarotCard.objects.filter(
|
||||||
|
deck_variant=deck_variant,
|
||||||
|
arcana=TarotCard.MAJOR,
|
||||||
|
number__in=[0, 1],
|
||||||
|
))
|
||||||
|
unique_cards = wands_crowns + swords_cups + major # 18 unique
|
||||||
|
return unique_cards + unique_cards # × 2 = 36
|
||||||
|
|
||||||
|
|
||||||
|
def _sig_unique_cards(room):
|
||||||
|
"""Return the 18 unique TarotCard objects that form one sig pile."""
|
||||||
|
deck_variant = room.owner.equipped_deck
|
||||||
|
if deck_variant is None:
|
||||||
|
return []
|
||||||
|
wands_crowns = list(TarotCard.objects.filter(
|
||||||
|
deck_variant=deck_variant,
|
||||||
|
arcana=TarotCard.MIDDLE,
|
||||||
|
suit__in=[TarotCard.WANDS, TarotCard.BRANDS, TarotCard.CROWNS],
|
||||||
|
number__in=[11, 12, 13, 14],
|
||||||
|
))
|
||||||
|
swords_cups = list(TarotCard.objects.filter(
|
||||||
|
deck_variant=deck_variant,
|
||||||
|
arcana=TarotCard.MIDDLE,
|
||||||
|
suit__in=[TarotCard.SWORDS, TarotCard.BLADES, TarotCard.CUPS, TarotCard.GRAILS],
|
||||||
|
number__in=[11, 12, 13, 14],
|
||||||
|
))
|
||||||
|
major = list(TarotCard.objects.filter(
|
||||||
|
deck_variant=deck_variant,
|
||||||
|
arcana=TarotCard.MAJOR,
|
||||||
|
number__in=[0, 1],
|
||||||
|
))
|
||||||
|
return wands_crowns + swords_cups + major
|
||||||
|
|
||||||
|
|
||||||
|
def levity_sig_cards(room):
|
||||||
|
"""The 18 cards available to the levity group (PC/NC/SC)."""
|
||||||
|
return _sig_unique_cards(room)
|
||||||
|
|
||||||
|
|
||||||
|
def gravity_sig_cards(room):
|
||||||
|
"""The 18 cards available to the gravity group (BC/EC/AC)."""
|
||||||
|
return _sig_unique_cards(room)
|
||||||
|
|
||||||
|
|
||||||
|
def sig_seat_order(room):
|
||||||
|
"""Return TableSeats in canonical PC→NC→EC→SC→AC→BC order."""
|
||||||
|
_order = {r: i for i, r in enumerate(SIG_SEAT_ORDER)}
|
||||||
|
seats = list(room.table_seats.all())
|
||||||
|
return sorted(seats, key=lambda s: _order.get(s.role, 99))
|
||||||
|
|
||||||
|
|
||||||
|
def active_sig_seat(room):
|
||||||
|
"""Return the first seat without a significator in canonical order, or None."""
|
||||||
|
for seat in sig_seat_order(room):
|
||||||
|
if seat.significator_id is None:
|
||||||
|
return seat
|
||||||
|
return None
|
||||||
8
src/apps/epic/routing.py
Normal file
8
src/apps/epic/routing.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from . import consumers
|
||||||
|
|
||||||
|
|
||||||
|
websocket_urlpatterns = [
|
||||||
|
path('ws/room/<uuid:room_id>/', consumers.RoomConsumer.as_asgi()),
|
||||||
|
]
|
||||||
12
src/apps/epic/static/apps/epic/gatekeeper.js
Normal file
12
src/apps/epic/static/apps/epic/gatekeeper.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
(function () {
|
||||||
|
window.addEventListener('room:gate_update', function () {
|
||||||
|
const wrapper = document.getElementById('id_gate_wrapper');
|
||||||
|
if (!wrapper) return;
|
||||||
|
|
||||||
|
fetch(wrapper.dataset.gateStatusUrl)
|
||||||
|
.then(function (r) { return r.text(); })
|
||||||
|
.then(function (html) {
|
||||||
|
wrapper.outerHTML = html;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}());
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 560">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #354a9c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
fill: #381507;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-3 {
|
||||||
|
stroke-width: 2.75px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-3, .cls-4 {
|
||||||
|
fill: none;
|
||||||
|
stroke: #381507;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-5 {
|
||||||
|
fill: #4f66d4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-6 {
|
||||||
|
fill: #4258b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-7 {
|
||||||
|
fill: #3d180d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-8 {
|
||||||
|
fill: #3a1709;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-4 {
|
||||||
|
stroke-width: 2.2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<path class="cls-5" d="M185.31,203.37l.12.54,1.16,5.4-2.22.49c-.08,8.17-.62,15.76-1.54,24.08-.26,2.33.18,7.31,3.04,7.58,4.78.44,9.33-1.88,14.1-2.1,1.59-.07,3.44-.05,4.69-.32l.98,9.54c.24,2.25,2.12,2.5,3.74,3.16,1.99.81,2.31,3.55,3.46,5.16l3.75,5.23c.62.86,1.45,1.66,2.51,1.36-.12,2.28.15,4.61.11,7.14l-.44,1.49c-1.47-.84-2.37,1.63-3.55,1.77l-16.08,1.97-21.66,2.39c4.99,1.47,9.61,1.45,14.55,2.03l23.5,2.78c.22,1.66.49.84,1.47.31,1.01,6.14,2.22,12.45,2.53,19.3,1.2,4.17.5,8.59-3.88,10.35l-3.91,2.35c.65.86,1.46,1.29,1.81,2.27,2.77,1.35,3.4,4.57,3.09,7.75,2.44,5.7,2.42,11.51,1.87,17.57l-.91,9.96c-.14,1.55-1.69,1.51-2.77,1.41l-17.57-1.6c-4.26-.39-8.71.46-12.16-2.84l-5.53-7.04c-.25.2-.35.47-.36.58,0-.11.11-.38.36-.58-.25.2-.35.47-.36.58-.28,3.07-.81,5.92-2.85,8.97l-21.21,1.95c-.12-1.76-.26-3.48-1.01-5.15l-4.42-9.91-3.75-25.3c-.14-.97-.63-1.8-1.07-2.16.43-1.73-.03-4.16-.58-6.18-1.9-4.98-3.59-9.83-4.83-15.35.18-.51-1.33-1.69-.39-2.35l1.62-1.16c1-.71-.63-1.33-.17-2.07.4-.66,1.75-.46,1.97-1.2.33-1.08-.35-2.18-1.64-2.16l-4.2.07-9.67-35.31c-.2-.75-.95-.91-1.34-1.05-.54-.19-1.5,0-1.53.93-.02.66-.64,1.72-1.09,2.78-1.2-1.34-4.74-2.35-5.46-.22l-12.57,37.25-7.39,1.96-1.8.57c-.58.18-.63,2.12,0,2.14,1.81.06,3.73-1.13,5.06.44-1.62.37-4.59.86-3.54,2.77.86,1.55,3.62.48,4.95.31l-4.78,15.62c-.24.78.03,1.76.57,2.34.4.43,1.33.72,2.04-.13,1.08-1.29,1.25-3.2,1.82-4.45.97-.38,2.22.37.73.97-.13,1.21-.23,2.19.18,3.14.23.53.84.92,2.01.61,2.71-6.4,4.7-12.72,6.8-19.73l18.11-2.9,5.96,21.86c.44,1.61,1.47,1.6,2.91,1.32,1.12-.22.51-1.69.51-2.99v-1.31c0-.37.34-.39,1.2-.31-1.04,1.12-.03,2.08.5,3.48.36.96,1.5,1.25,2.74,1.23l-.5,20.05c-.09,3.58-.56,6.95-.22,10.34l-21.98.14-2.92-9.49c2.68-4.69,5.77-9.41,3.04-13.61l-6.91,1.61c-1.59.37.86,2.08.68,2.8l-1.98,7.57c-.27,1.01.11,2.26-.46,3.03-1.37,1.88-6.3,1.61-9.49.15-1.3-2.98,1.24-7.91.16-13.45-.44-2.25-3.52-1.29-5.21-1.15l-8.08.67-6.35-5.57c.37-4.82-6.34-6.88-5.95-12.46.07-.96,1.36-1.31,1.96-2.42l5.08-9.34c.18-1.24-1.67-1.79-2.25-2.13l-3.45-1.97c-1-.57-1.54-1.46-1.61-2.3-.11-1.23,3.32-3.74,6.12-4.08l23.77-2.92c-4.84-1.4-9.6-.46-14.47-.77l-20.58-1.25-1.75-17.45c-.27-2.73-1.52-5.99.31-8.64,1.48-2.15,4.9-2.45,7.04-3.85,3.01-1.97-4.02-5.01-3.67-6.6,1.58-7.04-3.55-9.14-2.92-17.11l1.35-16.91c19.69,3.11,39.13,3.08,58.78.65,2.37-.29,3.87.88,5.27,2.25l.56.54-.56-.54-2.23,1.33c3.23,4.36,4.37,8.99,5.14,13.85l2.71,17.1,3.13,17.22c.82-.18.95-1.1.85-1.6-.94-4.55-.24-9.14-.6-13.84-.32-4.1-.56-7.97.06-12.11.92-6.26,1.04-12.4-.43-18.5-.18-.76-1.4-.95-1.7-.74.48-1.08.49-3.87,2.16-4.43l15.4-1.26,24.35-2.21ZM187.63,257.75c.4.93.52,1.9,1.14,2.91,2.36,3.88,4.35-8.06-7.31-13.58-7.5-3.55-15.29-1.54-21.1,4.83-13.04,14.31-17.28,39.69-4.52,53.8,5.7,6.31,14.78,8.03,22.8,5.87,13.32-3.6,20.27-20.17,13.32-16.11-.83,1.08-1.92.91-1.28-.45.23-1.19-.5-2.25-1.19-2.44-2.65-.75-3.54,8.1-13.46,10.47-5.92,1.42-11.86-1.51-14.55-6.83-4.2-8.32-4.34-17.68-1.05-26.64,3.45-9.39,10.35-17.68,18.54-13.94,4.41,2.01,4.83,8.81,5.68,8.88s1.2-.15,1.64-.32c.27-.1,1.75-2.67.35-6.47.34.07.6.1.97.03Z"/>
|
||||||
|
<path class="cls-6" d="M142.89,343.17l.29,2.88c.86.07,1.58.05,2.04.23.67.25,1.91,1.3,1.32,2.05-1.46,1.19-1.67,3.08-2.56,5.44l-38.54,2.82c-2.19.16-4,.22-5.07-1.87-.06.09-.12.09-.17.04l-31.82-30.7.34-.51,6.2,1.52c6.89,2.24,14.28,1.74,21.71,1.33,1.56-.09,1.37,2.99,1.43,3.85-.3,7.59-.1,14.62,2.15,21.47.05.41.41.65.83.61.39-.4.95-.17.83-.59l-.37-1.33.4-13.65c.01-.34.23-.76.19-.97-.05-.23.41-.49.79-.42,3.19,1.46,8.11,1.72,9.49-.15.56-.77.19-2.01.46-3.03l1.98-7.57c.19-.72-2.26-2.43-.68-2.8l6.91-1.61c2.74,4.2-.36,8.92-3.04,13.61l2.92,9.49,21.98-.14Z"/>
|
||||||
|
<path class="cls-6" d="M89.74,321.43c-1.43.12-3.07.88-4.9.94l-9.56.29c-.16,1.21.7,1.9-.37,2.41l-6.2-1.52-.57-.13-.57-.14c.06-.16.14-.32.15-.48l1.45-15.57,1.33-17.08,1.52-13.95,20.58,1.25c4.86.31,9.63-.63,14.47.77l-23.77,2.92c-2.8.34-6.23,2.85-6.12,4.08.07.84.61,1.73,1.61,2.3l3.45,1.97c.58.33,2.43.89,2.25,2.13l-5.08,9.34c-.6,1.11-1.89,1.46-1.96,2.42-.4,5.59,6.32,7.64,5.95,12.46l6.35,5.57Z"/>
|
||||||
|
<path class="cls-5" d="M185.31,203.37l.41.36,32.83,32.44c.15.15.23.32.17.52l-3.36-.08c-.18,0-.37-.17-.52.11-9.2-3.04-24.62.27-26.12-.81-2.61-1.89,1.62-13.42-2.11-26.59l-1.16-5.4-.12-.54Z"/>
|
||||||
|
<path class="cls-6" d="M219.09,263.48c-1.07.3-1.89-.5-2.51-1.36l-3.75-5.23c-1.15-1.61-1.47-4.34-3.46-5.16-1.62-.66-3.5-.91-3.74-3.16l-.98-9.54c2.56-.56,5.24-.75,8.24-.37l1.71-.29c.49-.08,1.13-1.43.74-1.77-.18,0-.37-.17-.52.11.15-.28.34-.11.52-.11l3.36.08c.06-.2-.01-.36-.17-.52.15.15.23.32.17.52,2.85,1.17,1.38,7.41,1.07,13.48l-.68,13.31Z"/>
|
||||||
|
<path class="cls-6" d="M137.02,209.09l5.09,4.92c1.03-.68.94-1.93,1.29-2.74.3-.21,1.51-.02,1.7.74,1.47,6.1,1.35,12.23.43,18.5-.61,4.14-.37,8.01-.06,12.11.37,4.7-.33,9.3.6,13.84.1.5-.03,1.42-.85,1.6l-3.13-17.22-2.71-17.1c-.77-4.87-1.91-9.49-5.14-13.85l2.23-1.33.56.54Z"/>
|
||||||
|
<path class="cls-1" d="M155.13,354.34l-6.55-5.25c-.5-.4-.58-1.25-1.2-1.09-.28.07-.6.17-.85.32.59-.75-.65-1.8-1.32-2.05-.47-.17-1.18-.15-2.04-.23l-.29-2.88c-.34-3.39.13-6.76.22-10.34l.5-20.05c.35-.26.61-.87,1.26-.95.44.36.93,1.18,1.07,2.16l3.75,25.3,4.42,9.91c.75,1.67.89,3.39,1.01,5.15Z"/>
|
||||||
|
<path class="cls-1" d="M218.76,272.12c.55,2.96-1.28,5.06-3.13,7.88-.92,1.4,1.16,2.13,1.36,3.36-.98.53-1.25,1.36-1.47-.31l-23.5-2.78c-4.93-.58-9.56-.56-14.55-2.03l21.66-2.39,16.08-1.97c1.17-.14,2.07-2.61,3.55-1.77Z"/>
|
||||||
|
<path class="cls-8" d="M144.88,311.82c-.66.08-.92.69-1.26.95-1.24.01-2.37-.28-2.74-1.23-.53-1.4-1.54-2.36-.5-3.48-.86-.08-1.19-.06-1.2.31v1.31c0,1.3.6,2.76-.52,2.99-1.43.29-2.47.29-2.91-1.32l-5.96-21.86-18.11,2.9c-2.1,7.01-4.09,13.33-6.8,19.73-1.17.31-1.78-.08-2.01-.61-.41-.95-.31-1.94-.18-3.14,1.5-.6.24-1.35-.73-.97-.56,1.24-.74,3.16-1.82,4.45-.71.85-1.64.57-2.04.13-.54-.58-.8-1.56-.57-2.34l4.78-15.62c-1.33.17-4.1,1.25-4.95-.31-1.05-1.92,1.92-2.4,3.54-2.77-1.34-1.57-3.26-.38-5.06-.44-.62-.02-.58-1.96,0-2.14l1.8-.57,7.39-1.96,12.57-37.25c.72-2.13,4.25-1.12,5.46.22.45-1.06,1.07-2.12,1.09-2.78.03-.94.98-1.12,1.53-.93.39.13,1.13.3,1.34,1.05l9.67,35.31,4.2-.07c1.29-.02,1.98,1.07,1.64,2.16-.23.73-1.57.54-1.97,1.2-.45.74,1.17,1.36.17,2.07l-1.62,1.16c-.93.67.57,1.85.39,2.35,1.24,5.52,2.93,10.37,4.83,15.35.55,2.02,1.01,4.45.58,6.18ZM122.28,263.01l-7.68,21.2,13.37-1.5-5.69-19.69Z"/>
|
||||||
|
<path class="cls-7" d="M187.63,257.75l-1.21-2.81c-.33-.78-.83-2.11-2.39-2.23l-.53-1.37c-.16-.41-.82-.21-1.64-.58-1.01-.56-1.29.55.06.58,2.16,2.07,3.86,4.01,4.73,6.38,1.4,3.8-.08,6.37-.35,6.47-.45.17-.81.39-1.64.32s-1.27-6.87-5.68-8.88c-8.19-3.73-15.09,4.55-18.54,13.94-3.29,8.97-3.16,18.32,1.05,26.64,2.69,5.33,8.63,8.25,14.55,6.83,9.92-2.37,10.81-11.22,13.46-10.47.69.19,1.42,1.25,1.19,2.44-.64,1.37.45,1.54,1.28.45,6.95-4.06,0,12.51-13.32,16.11-8.02,2.17-17.1.44-22.8-5.87-12.75-14.1-8.52-39.49,4.52-53.8,5.8-6.37,13.59-8.37,21.1-4.83,11.66,5.51,9.67,17.45,7.31,13.58-.61-1.01-.74-1.98-1.14-2.91ZM157.46,302.61l3.6,3.77c.64.67.95.15,1.82.3.52.09-.23-.61-.29-.93-.07-.41-1.13-.1-1.37-.35-1.17-1.26-1.91-3.37-3.77-2.78Z"/>
|
||||||
|
<path class="cls-1" d="M186.59,209.31c3.74,13.17-.49,24.7,2.11,26.59,1.5,1.08,16.92-2.22,26.12.81.15-.28.34-.11.52-.11.4.33-.25,1.68-.74,1.77l-1.71.29c-3-.38-5.68-.19-8.24.37-1.25.27-3.1.25-4.69.32-4.76.22-9.32,2.54-14.1,2.1-2.86-.26-3.3-5.24-3.04-7.58.92-8.32,1.46-15.9,1.54-24.08l2.22-.49Z"/>
|
||||||
|
<path class="cls-1" d="M102.87,335.37c-.38-.07-.84.19-.79.42.05.21-.18.63-.19.97l-.4,13.65.37,1.33c.12.42-.44.19-.83.59-.42.03-.78-.2-.83-.61-2.25-6.85-2.45-13.87-2.15-21.47-.06-.86.13-3.93-1.43-3.85-7.43.41-14.82.91-21.71-1.33,1.07-.51.21-1.2.37-2.41l9.56-.29c1.83-.06,3.48-.82,4.9-.94l8.08-.67c1.68-.14,4.77-1.1,5.21,1.15,1.08,5.55-1.46,10.47-.16,13.45Z"/>
|
||||||
|
<path class="cls-1" d="M187.63,257.75c-.37.07-.64.04-.97-.03-.88-2.38-2.57-4.31-4.73-6.38-1.35-.04-1.07-1.15-.06-.58.82.37,1.48.17,1.64.58l.53,1.37c1.56.12,2.06,1.45,2.39,2.23l1.21,2.81Z"/>
|
||||||
|
<polygon class="cls-5" points="122.28 263.01 127.97 282.71 114.6 284.21 122.28 263.01"/>
|
||||||
|
<path class="cls-1" d="M157.46,302.61c1.86-.59,2.59,1.52,3.77,2.78.23.25,1.3-.06,1.37.35.05.32.81,1.02.29.93-.87-.15-1.18.38-1.82-.3l-3.6-3.77Z"/>
|
||||||
|
<path class="cls-2" d="M210.46,277.3l6.02,1.81c1.38.43.78,2.5-.62,2.11,0,0-6.03-1.81-6.03-1.81-1.97-.86-4.17-1.86-6.07-2.91,1.33.16,5.03.6,6.7.81h0Z"/>
|
||||||
|
<path class="cls-4" d="M185.31,203.37l-24.35,2.21-15.4,1.26c-1.66.57-1.68,3.35-2.16,4.43-.36.81-.27,2.06-1.29,2.74l-5.09-4.92-.56-.54c-1.41-1.37-2.9-2.54-5.27-2.25-19.66,2.42-39.1,2.45-58.78-.65l-1.35,16.91c-.64,7.97,4.5,10.07,2.92,17.11-.36,1.59,6.68,4.62,3.67,6.6-2.14,1.4-5.56,1.7-7.04,3.85-1.83,2.66-.58,5.92-.31,8.64l1.75,17.45-1.52,13.95-1.33,17.08-1.45,15.57-.15.48"/>
|
||||||
|
<path class="cls-4" d="M185.32,203.34l.4.39,32.83,32.44c.15.15.23.32.17.52l-3.36-.08c-.18,0-.37-.17-.52.11-9.2-3.04-24.62.27-26.12-.81-2.61-1.89,1.62-13.42-2.11-26.59l-1.16-5.4-.11-.58Z"/>
|
||||||
|
<path class="cls-4" d="M213.54,317.63c2.77,1.35,3.4,4.57,3.09,7.75,2.44,5.7,2.42,11.51,1.87,17.57l-.91,9.96c-.14,1.55-1.69,1.51-2.77,1.41l-17.57-1.6c-4.26-.39-8.71.46-12.16-2.84l-5.53-7.04c-.25.2-.35.47-.36.58-.28,3.07-.81,5.92-2.85,8.97l-21.21,1.95-6.55-5.25c-.5-.4-.58-1.25-1.2-1.09-.28.07-.6.17-.85.32-1.46,1.19-1.67,3.08-2.56,5.44l-38.54,2.82c-2.19.16-4,.22-5.07-1.87-.62-.8-.65-1.96-.17-3.01-2.25-6.85-2.45-13.87-2.15-21.47-.06-.86.13-3.93-1.43-3.85-7.43.41-14.82.91-21.71-1.33l-6.2-1.52-.57-.13-.57-.14"/>
|
||||||
|
<polyline class="cls-3" points="100.19 354.76 68.38 324.06 67.57 323.28"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 9.8 KiB |
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 560">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #39170a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
fill: #6b1f65;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-3 {
|
||||||
|
fill: #852f7e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-4 {
|
||||||
|
fill: #3d1a0d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-5 {
|
||||||
|
fill: none;
|
||||||
|
stroke: #381507;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
stroke-width: 2.2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-6 {
|
||||||
|
fill: #9e3d96;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<path class="cls-6" d="M134.56,198.73c-.18.4-.63,1.06-.86,1.01l-1.53-.32,2.73,6.11c3.16,4.21,3.45,9.15,4.36,14.26l5.43,30.42-.31-26.42.69-6.77-.39-15.14c.78.13,1.2.48,1.86.21.09,1.59-.38,3.25-.01,4.91,3.95,1.89,3.31,4.73,5.82,4.74,1.17,0,3.35.51,3.8-.95.88-2.85,3.04-3.98,3.96-8.34,2.01-.62,4.59.12,5.2,2.41l2.94,4.65.47,2.59c.11.63,3.07.5,5.91,4.7.74-2.1,2.63-2.9,4.18-3.47,2.1-.76,3.81.92,5.23,2.46l1.28.36-1.2,10.28c-.16,1.36.06,4.75,1.34,5.26l12.32-1.33c1.3-.14,2.73-.73,4.27-.46-.74,2.06,2.02,3.53,2.3,4.95.63,3.15.89,5.85,3.93,7.95,1.18.81,2.14,2.65,4.4,1.82l2.14,4.34c-1.97,3.85-2.69,7.52-1.18,11.55l-7.95,3.92-9.59,1.55-24.02,4.56,31.72.18c3.86-1.21,7.59-.06,10.11,3.3-3.28,1.87-2.97,4.67-2,7.19,3.17,8.23-.69,15.5-7.22,20.39-2.27,2.33-3.26,5.96-4.66,8.69l-14.97-1.08-1.98.67c-1.17.4-1.4,6.07-1.2,10.28l-5.97.64c.01,1.31.89,2.27,1.35,3.52l-3.55,5.37c-5.53-.62-8.28,7-13.89,10.9-1.98,1.37-3.73-.25-5.2-.67-1.79-.51-3.25-.83-4.12-2.65-1.17.63-2.28.31-3.09,0-.93-.36-1.45-1.42-1.58-2.63l-1.24-12.07-.54-21.41-3.37,26.93-2.32,11.58c-1.35-.6-2.56-.79-3.93-.64-2.87.32-5.45-.38-8.31-.41-1.55-.02-1.88-1.53-3.11-3.07l2.02-2.29c-1.1-2.21-3.48-2.22-5.28-3.2-.75-.41-1.27-1.25-2.14-1.2-2.2.13.67,6.44-2.89,6.37l-6.18-.11c-.97-.02-1.52-.97-1.46-1.38l.36-2.39c-2.16-3.31-6.64-4.97-10.34-6.05l-4.61-1.35,9.71-11.1c1.03-1.17,2.56-2.27,2.2-3.91l-10.97,8.35c-4.57-1.25-8.28-3.55-8.21-8.02-.63-.81-1.9-1.86-1.64-2.9.76-2.95,3.93-2.39,4-6.01.03-1.5-1.05-2.01-2.21-3.07-1.5-1.37-2.59-3.79-4.86-4.28-1.89-.41-6.44-4.24-7.02-6.09-1.01-3.25,2.85-5.63.92-8.2l8.46-2.25,18.21-3.46.55,22.34-4.07-1.09c-.62-.17-1.15.71-1.26,1.11-.71,2.66,6.57,4.49,6.46,4.96-.06.26-.4.99-.55.77-.26-.37-.68-.81-1.29-.89l-2.57-.33c-.63-.08-1.82,2.04-.78,2.4,13.51,4.72,30.52,4.52,40.19-6.04,4.26-4.65,7-10.96,5.44-17.11-1.88-7.43-8.07-12.69-15.99-13.65,4.61-3.97,8.07-9.52,6.06-15.48s-7.82-9.61-13.78-10.33c-13.8-1.66-26.43,7.86-23.9,11.48l1.82.27c.83.77.9,1.54,1.58,1.28l2.21-.86-.14,17.59-10.69.46-11.02-.53c-3.1-.15-5.69-2.07-8.52-1.76l-2.44-19.92c-1.31-2.93-.76-6.46,2.46-7.96,3.42-1.59,4.59-3.37,5.99-2.92.03-2.33-2.37-3.38-4.36-4.69l-.32-6.53c-5.46-9.7-.92-17.59-1.51-28.43l16.23,2.03,23.56-.02,16.48-1.23c2.97-.22,5.24-1.39,7.61.8ZM185.54,293.84c2.42-3.82,5.39-7.88,3.02-9.23s-3.38,6.71-11.7,9.93c-4.18,1.62-8.99.92-12.68-1.81-3.38-2.5-5.13-6.55-6.15-11.09-3.58-15.97,6.89-36.59,18.87-32.85,6.82,2.13,4.36,12.37,8.6,8.12.92-1.52.02-3.6.33-5.64l2.51,3.38c1.54-.91,1.02-2.87.63-4.33-1.61-6.12-7.34-9.87-13.12-11.04-6.3-1.28-11.96,1.46-16.42,6.15-6.23,6.56-9.49,15.21-11.29,23.96-2.95,14.33,3.3,32.61,19.18,34.63,11.19,1.43,22.11-4.68,26.13-15.27.19-.49.04-1.09.04-1.41,0-.73-2.81-.21-2.68-.3-1.54,1.13-1.96,6.72-5.28,6.8Z"/>
|
||||||
|
<path class="cls-3" d="M74.46,278.72c1.93,2.57-1.93,4.94-.92,8.2.57,1.85,5.13,5.69,7.02,6.09,2.27.49,3.37,2.91,4.86,4.28,1.15,1.06,2.24,1.57,2.21,3.07-.07,3.62-3.24,3.06-4,6.01-.26,1.03,1.01,2.08,1.64,2.9-.07,4.47,3.65,6.77,8.21,8.02l10.97-8.35c.36,1.64-1.18,2.73-2.2,3.91l-9.71,11.1,4.61,1.35c3.7,1.08,8.18,2.75,10.34,6.05l-.36,2.39c-.06.4.49,1.36,1.46,1.38l6.18.11c3.56.07.69-6.24,2.89-6.37.86-.05,1.39.79,2.14,1.2,1.8.99,4.18.99,5.28,3.2l-2.02,2.29c1.23,1.55,1.56,3.06,3.11,3.07,2.87.03,5.44.73,8.31.41,1.37-.15,2.57.04,3.93.64l2.32-11.58,3.37-26.93.54,21.41,1.24,12.07c.12,1.21.65,2.27,1.58,2.63.81.32,1.92.64,3.09,0,.86,1.82,2.33,2.14,4.12,2.65,1.47.42,3.22,2.04,5.2.67,5.6-3.9,8.36-11.52,13.89-10.9l3.55-5.37c-.47-1.25-1.34-2.21-1.35-3.52l5.97-.64.85,18.06-.17,3.08c.67-.03,1.46-.09,2.22.11l-1.57,4.51-.4,1.16-.74-.15-9.48-.44-13.17-.04c-5.51-.02-10.81.2-15.91-2.37-4.17,3.3-8.82,3.85-13.75,4.04l-11.57.44c-4.22.16-8-1.47-12.1-2.44l-9.23-2.18-2.37-2.53-1-1.14c-.19-.22-.42.16-1.49,0l-2.88,3.29c-1.64,3.38-4.27,3.48-7.57,2.93l-8.76-1.47c-1.06-.18-1.68-1.56-2.63-2.24l-.25-10.04c-.09-3.55-2.33-6.92-2.12-10.04l.33-4.87,1.13-9.81c.44-3.77.39-7.85,0-11.53l-.45-4.37c-.88-2.66-.01-5.19,1.15-7.52l3.1-6.18c.48,0,.8.42,1.38.27Z"/>
|
||||||
|
<path class="cls-3" d="M219.05,227.87l.79.78-.21.25.6.14-.13.88-1.61,30.29-6.75,7.18,6.67,3.15,1.66,35.78c.09,1.99,0,4.05-1.49,5-.19.12-.4.28-.59.29l.1.11-.1-.11-3.17.11c-.29-.45-.37-1.65-1.08-1.62l-5.37.21c-2.72.1-5.69.2-8.32.01,1.39-2.73,2.38-6.36,4.66-8.69,6.53-4.89,10.39-12.17,7.22-20.39-.97-2.52-1.28-5.32,2-7.19-2.53-3.36-6.25-4.51-10.11-3.3l-31.72-.18,24.02-4.56,9.59-1.55,7.95-3.92c-1.51-4.02-.8-7.7,1.18-11.55l-2.14-4.34c-2.26.84-3.21-1-4.4-1.82-3.04-2.1-3.3-4.8-3.93-7.95-.28-1.42-3.04-2.89-2.3-4.95l3.85-.57,8.82.23c.74-.32,1.1.42,1.09-.02-.02-.58.56-1.21.18-1.42l2.43.46.62-.74Z"/>
|
||||||
|
<path class="cls-3" d="M188.5,197.92c-.14-.14-.26-.35-.42-.36.16.02.28.22.42.36l-.8,2.07.09,1.09-1.96.21c.42,5.17.06,10.03-.5,14.87l-1.28-.36c-1.42-1.53-3.13-3.22-5.23-2.46-1.55.57-3.44,1.37-4.18,3.47-2.84-4.2-5.79-4.07-5.91-4.7l-.47-2.59-2.94-4.65c-.61-2.29-3.19-3.03-5.2-2.41-.92,4.36-3.08,5.48-3.96,8.34-.45,1.46-2.64.96-3.8.95-2.51,0-1.87-2.85-5.82-4.74-.37-1.66.1-3.32.01-4.91-.66.27-1.08-.08-1.86-.21l.39,15.14-.69,6.77.31,26.42-5.43-30.42c-.91-5.11-1.2-10.05-4.36-14.26l-2.73-6.11,1.53.32c.22.05.68-.6.86-1.01,2.07,1.91,4.3,4.1,6.23,6.93l3.69-7.11,37.01-2.68c2.54-1.25,5.05-.41,6.58,1.69.16.02.28.22.42.36Z"/>
|
||||||
|
<path class="cls-6" d="M217.99,311.6l-.39.42-33.59,33.88-.77.03,1.57-4.51c2.75-7.94,3.11-16.57,1.63-25.15-.21-1.2,1.02-2.43,2.16-2.43l11.01.06c5.33.03,10.37-.9,15.23-2.19l3.17-.11Z"/>
|
||||||
|
<path class="cls-3" d="M219.05,227.87l-.62.74-2.43-.46c-8.06-2.53-16.09-3.31-24.73-2.08-1.96.28-2.28-4.19-1.56-5.38.71-6.92-.38-13.29-1.92-19.6l-.09-1.09.8-2.07c-.14-.14-.26-.35-.42-.36.16.02.28.22.42.36l30.55,29.94Z"/>
|
||||||
|
<path class="cls-2" d="M101.08,269.43l.04,3.58-18.21,3.46-8.46,2.25c-.58.15-.9-.27-1.38-.27l2.44-3.67c-.82-2.73-4.33-4.52-4.66-7.18,2.83-.32,5.42,1.61,8.52,1.76l11.02.53,10.69-.46Z"/>
|
||||||
|
<path class="cls-1" d="M101.08,269.43l.14-17.59-2.21.86c-.67.26-.75-.52-1.58-1.28l-1.82-.27c-2.52-3.62,10.1-13.15,23.9-11.48,5.96.72,11.76,4.34,13.78,10.33s-1.45,11.51-6.06,15.48c7.92.96,14.11,6.22,15.99,13.65,1.56,6.15-1.18,12.46-5.44,17.11-9.67,10.56-26.68,10.76-40.19,6.04-1.04-.36.15-2.48.78-2.4l2.57.33c.61.08,1.03.52,1.29.89.15.22.49-.51.55-.77.11-.47-7.17-2.29-6.46-4.96.11-.41.64-1.28,1.26-1.11l4.07,1.09-.55-22.34-.04-3.58ZM124.8,255.68c1.58-3.1.42-5.63-2.19-7.08-3.93-2.19-8.3-2.63-13.25-1.34v16.49c0,.62.35,1.06.86,1.37.26.15.45-.22,1.12-.47,5.49-1.09,10.87-3.89,13.45-8.97ZM106.69,248.96l-1.41-.03.17,8.81c.23-.03.44-.47.56-.3l.68-8.48ZM129.95,257.42c.65-1.58.8-4.23,1.16-5.86-1.76-.16-.51-1.16-.52-1.51,0-.22-.65-.01-1.42-.09,1.09,3.53.8,7.12-1.99,10.11,1.03.81,1.77-.21,1.99-.75l.77-1.9ZM133.96,284.81c.89-6.65-3.22-11.63-9.46-12.87-5.07-1.01-9.78.28-14.97,1.72l.7,23.53c5.81,1,11.07-.12,16.57-2.3,3.82-1.51,6.61-6.02,7.16-10.08ZM105.85,278.54c-.96,2.12-1.03,4.41.28,6.27.22-1.99.88-3.84-.28-6.27ZM138.89,279.18h-1.19s.2,6.6.2,6.6c.2-.03.41-.45.51-.3.97-1.95.1-4,.47-6.3Z"/>
|
||||||
|
<path class="cls-4" d="M185.54,293.84c3.32-.08,3.73-5.67,5.28-6.8-.13.1,2.68-.43,2.68.3,0,.32.14.92-.04,1.41-4.02,10.58-14.94,16.69-26.13,15.27-15.88-2.03-22.13-20.3-19.18-34.63,1.8-8.74,5.06-17.4,11.29-23.96,4.45-4.69,10.12-7.43,16.42-6.15,5.78,1.17,11.5,4.93,13.12,11.04.38,1.46.9,3.42-.63,4.33l-2.51-3.38c-.3,2.04.6,4.12-.33,5.64-4.24,4.25-1.78-5.98-8.6-8.12-11.98-3.75-22.45,16.87-18.87,32.85,1.02,4.54,2.77,8.58,6.15,11.09,3.68,2.73,8.49,3.43,12.68,1.81,8.32-3.22,9.32-11.28,11.7-9.93s-.59,5.41-3.02,9.23Z"/>
|
||||||
|
<path class="cls-2" d="M187.78,201.08c1.54,6.31,2.64,12.68,1.92,19.6-.72,1.2-.4,5.66,1.56,5.38,8.64-1.23,16.67-.45,24.73,2.08.38.2-.2.83-.18,1.42.02.44-.35-.31-1.09.02l-8.82-.23-3.85.57c-1.54-.27-2.98.32-4.27.46l-12.32,1.33c-1.29-.51-1.5-3.9-1.34-5.26l1.2-10.28c.57-4.84.93-9.7.5-14.87l1.96-.21Z"/>
|
||||||
|
<path class="cls-2" d="M200.05,310.31c2.64.19,5.6.09,8.32-.01l5.37-.21c.71-.03.79,1.17,1.08,1.62-4.86,1.29-9.9,2.22-15.23,2.19l-11.01-.06c-1.13,0-2.36,1.22-2.16,2.43,1.48,8.57,1.13,17.21-1.63,25.15-.76-.2-1.55-.15-2.22-.11l.17-3.08-.85-18.06c-.2-4.21.03-9.88,1.2-10.28l1.98-.67,14.97,1.08Z"/>
|
||||||
|
<path class="cls-6" d="M133.96,284.81c-.55,4.07-3.34,8.57-7.16,10.08-5.5,2.17-10.76,3.29-16.57,2.3l-.7-23.53c5.2-1.44,9.9-2.72,14.97-1.72,6.24,1.24,10.35,6.22,9.46,12.87Z"/>
|
||||||
|
<path class="cls-6" d="M124.8,255.68c-2.58,5.08-7.97,7.88-13.45,8.97-.67.25-.86.62-1.12.47-.51-.3-.87-.74-.87-1.37v-16.49c4.96-1.3,9.32-.85,13.25,1.34,2.61,1.45,3.76,3.98,2.19,7.08Z"/>
|
||||||
|
<path class="cls-2" d="M129.95,257.42l-.77,1.9c-.22.54-.96,1.56-1.99.75,2.79-3,3.08-6.58,1.99-10.11.77.08,1.42-.13,1.42.09,0,.36-1.24,1.36.52,1.51-.36,1.63-.51,4.27-1.16,5.86Z"/>
|
||||||
|
<path class="cls-6" d="M106.69,248.96l-.68,8.48c-.13-.17-.33.27-.56.3l-.17-8.81,1.41.03Z"/>
|
||||||
|
<path class="cls-2" d="M138.89,279.18c-.37,2.3.5,4.35-.47,6.3-.1-.15-.32.27-.51.3l-.2-6.6h1.19Z"/>
|
||||||
|
<path class="cls-2" d="M105.85,278.54c1.16,2.43.51,4.28.28,6.27-1.31-1.86-1.24-4.15-.28-6.27Z"/>
|
||||||
|
<path class="cls-5" d="M220.24,229.03l-.6-.14-1.21-.28-2.43-.46c-8.06-2.53-16.09-3.31-24.73-2.08-1.96.28-2.28-4.19-1.56-5.38.71-6.92-.38-13.29-1.92-19.6l-.09-1.09"/>
|
||||||
|
<path class="cls-5" d="M76.87,236.81c.03-2.33-2.37-3.38-4.36-4.69l-.32-6.53c-5.46-9.7-.92-17.59-1.51-28.43l16.23,2.03,23.56-.02,16.48-1.23c2.97-.22,5.24-1.39,7.61.8,2.07,1.91,4.3,4.1,6.23,6.93l3.69-7.11,37.01-2.68c2.54-1.25,5.05-.41,6.58,1.69.16.02.28.22.42.36l30.55,29.94.79.78.4.39"/>
|
||||||
|
<path class="cls-5" d="M220.24,229.03l-.13.88-1.61,30.29-6.75,7.18,6.67,3.15,1.66,35.78c.09,1.99,0,4.05-1.49,5l-.49.39-.5.31-33.59,33.88-1.17,1.19"/>
|
||||||
|
<path class="cls-5" d="M182.84,347.08l-.74-.15-9.48-.44-13.17-.04c-5.51-.02-10.81.2-15.91-2.37-4.17,3.3-8.82,3.85-13.75,4.04l-11.57.44c-4.22.16-8-1.47-12.1-2.44l-9.23-2.18-2.37-2.53"/>
|
||||||
|
<path class="cls-5" d="M182.84,347.08l.4-1.16,1.57-4.51c2.75-7.94,3.11-16.57,1.63-25.15-.21-1.2,1.02-2.43,2.16-2.43l11.01.06c5.33.03,10.37-.9,15.23-2.19l3.17-.11"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 560">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #006d30;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
fill: #00873e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-3 {
|
||||||
|
fill: none;
|
||||||
|
stroke: #381507;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
stroke-width: 2.75px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-4 {
|
||||||
|
fill: #3a160a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-5 {
|
||||||
|
fill: #3d180d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-6 {
|
||||||
|
fill: #00a04b;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<path class="cls-6" d="M153.66,195.96l-.46-.48-2.25.71,3.07,18.95.16,18.83c.02,1.82-1.11,3.58.04,5.52.86-1.54,1.21-3.1,1.51-4.81l4.63-26.09c.51-2.89.63-6.32-1.68-7.91,3.44-.33,1.92-4.68,4.63-6.02,1.06-.53,2.58-.34,3.85-.57l.57-.11.09,1.97c-1.23.02-2.43-.35-3.03.56,1.72-.21,4.69,1.64,3.78,3.07-1.78,2.8-2.55,5.21-1.44,8.53.2.59-.73,1.95-.05,2.92.42.6,1.37.66,2.45,1.35l.89,1.5c.22.37,1.97.27,1.95-.45-.06-2.39-4.42-4.98-2.14-5.98.89-.39,1.59-.33,2.08.47l3.78,6.21,3.2-1.66,6.99.65c-.45,5.85-2.86,9.72.48,15.56l8.02-1.38c4.46-.77,3.87,5.08,6.83,6.44-.37,2.19.28,4.05,1.64,6.45-6.86,3.73-8.55.88-9.78,1.54-2.84,1.52-2.36,6.78,0,8.07,2.28-5.08,5.7-2.99,8.83-5.88l3.1,3.95c.13.5-.52.62-.77.88-.49.54-1.76-.53-2.23-.28-1.18.63-.37,1.39-.08,1.77.39.5,2.4.95,4.35,1.17.61,1.74-1.58,2.73-2.4,3.52.4,2.18,3.63,1.16,5.22,1.12,1.87-.05,3.1,2.33,5.08,1.26l-.3,8.25c-7.48,2.34-14.03,3.49-21.14,4.16l-23.27,2.2c.09.33.06.66.03.83.7.61,1.85-.06,2.86-.16l30.5,2.09c2.57.18,5.12.05,7.54,1.41-6.47,3.24-11.29,0-12.25.87-.59.54-1.48,2.27-.13,2.72.91.3,1.87.35,2.3.69,1.2.95-1.2,5.83,1.12,6.74.78.3,2.4-.64,2.93.56.31.71.23,2.04-.94,2.69l-1.39,1.83c-1.39.83-1.28,1.3-1.07,2.69.24,1.57,1.51,1.36,3.53.89v3.28s4.12.29,4.12.29l.1,2.95c-4.9.84-9.59,2.46-12.77,6.65l-8.81-1.19c-7.44-1-2.19,11.29-2.46,19.21l-4.89-.16c-2.63-.09-6.35,0-7.58-2.4,1.86-2.75-1.3-5.62-.12-9.66-1.36-.25-2.17-1.48-3.52-1.43-2.58,1.83-5.92,2.68-6.55,5.79-.14.7,1.35,1.6.78,2.39-.88,1.22-5.4.29-5.27,3.28.14,3.32,3.47,1.65,4.91,3.68-1.55,1.93-3.69,4.09-5.51,5.41-.67.04-2.1-.08-2.75-.12l-7.79-.48-1.91-10.68-.87-20.54c-.02-.38.98-.89.38-1.07-.21-.06-.37-.3-.58-.52-.15-.16-.64.62-.67.95l-1.71,16.74c-.72,7.06-2.02,13.71-4.34,20.67-4.06.6-8.21-.87-12.16-2.67-.9-.41-2.41-.75-2.22-2.2.46-.15,1.4-.34,1.49-.82.06-.36.32-1.32-.43-1.33l-9.76-.09c-.43,0-.7-1.15-.36-1.47.61-.58,1.76-.61,2.03-1.46.31-.96.25-1.75.13-3.16l-14.56.05c-3.39.01-6.59.16-10.04-.64l12.59-14.11c-.78-.51-1.89.32-2.63,1.01-4.11,3.83-8.08,7.52-13.71,8.92.38-1.11,1.48-1.61,2.04-2.49l-1.39-4.29c-2.64.06-2.8-2.85-3.9-3.74-2.66-2.14-5.75-3.87-5.86-7.47-.13-4.69,5.58-4.68,4.87-7.46-1.89-.09-2.79-.22-3.53-1.67-2.76-5.4-5.55-10.74-6.13-16.95l.26-3.84c1.78-1.26,3.89-1.22,6.04-1.61l19.34-3.5c-7.89-1.44-15.42-1.63-22.88-4.1l-3.59-.27c-1.87-2.75-1.64-5.92-2.07-9l-1.2-8.62-.43-6.7c-.53-8.33-.99-6.87,3.53-10.65l3.35-2.87.41.38-.41-.38-6.25-5.77,1.99-24.45,29.01,2.92c.3,2.58-.26,4.92.22,7,.52-.09,1.76-.17,2.02.58.15.44.4.77.33,1.31l3.48,3.71c1.73,1.85,4.57,3.61,5.86,5.97,1.68,3.06,3.62,8.54,4.74,8.09.28-.11.94-.29,1.08-1.02.16-.85-.78-2.14-.85-3.37l-.49-9.68c-1.06-2.47-3.15-4.98-2.29-7.94l7.42-2.99.74-.79c.25-.26.12-.53-.1-.59-.25-.07-.86-.46-1.49.09l-.35-1.99,28.3-2.23c1.58-.12,3.1-.91,3.9,1l.46.48ZM186.99,284.59c.05-.8-.21-2.93-.89-3.46-1.03-.8-2.09-.08-2.67.96-2.92,5.19-8.02,9.43-14.12,9.6-10.92.3-16.23-12.43-14.77-24.11,1.5-12,9.42-26.8,19.63-23.04,6.4,2.36,4.16,10.81,8.14,8.64,1.03-.56,1.08-3.75.59-6.65,1.56,1.07,1.13,2.55,1.92,3.73.35.51,1.07.12,1.41-.26,1.54-1.69-1.42-11.67-11.3-14.47-18.44-5.21-31.37,21.26-30.31,39.87.46,8.02,4.55,18.71,12.73,22.74,12.45,6.13,27.46.08,33.05-12.33.29-.63.45-1.54.17-1.99s-.96-1.1-1.65-.81c-.59.25-1.21.83-1.92,1.58ZM101.07,245.27c-.97-.28-1.36,2.51-.27,3.04.84.41,1.82.3,3.43.02l-.02,15.84.52,28.42c.02,1.26-3.05.8-3.99,2.17-.37.54-.43,1.53.14,1.9.48.31,1.1.34,2.1.38l1.74.07c.21,0-.06,1.21-.78.9-1.53-.66-2.37,1.04-2.06,2.1.54,1.85,3.63,1.46,6.98.54.54.72.85,2.18,1.64,2.22.74.04,1.45-.09,1.73-.57.43-.71.32-1.49.26-2.52l13.46-1.99,15.07-1.37c.5-.05,1.21-.93,1.18-1.32-.02-.33-.33-.94-.83-.93l-6.64.11v-.92s7.21-.58,7.21-.58c.67-.05,1.07-1,1.09-1.41s-.74-1.12-1.09-1.32l-2.18-1.26c-7.01-.15-13.57.87-20.29,1.77l-6.33.85-.28-18.72c1.4-.01,2.1-.11,2.8-.21l14.99-2.18c1.84-.27,2.77-2.22,2.67-4.08-1.51-.62-2.4-.02-3.68-.25.35-1.33,1.22-1.8.93-2.28-.46-.75-.97-1.35-1.81-1.22l-16.69,2.55v-17.6c8.76-1.96,17.15-2.99,25.82-3.25.13,0,3.38-2.78,2.38-4.14-.56-.77-2.05-.63-3.18-.4-.1-1.28.99-1.47.68-1.91-.6-.86-1.04-1.38-1.97-1.52-8.39.05-16.34,1.7-24.78,2.69-.47-.45-.8-1.64-1.29-1.61-.68.04-.97.86-1.59,1.72-.59-.64-1.13-1.26-1.75-1.19-.85.11-1.69,0-1.57,1.15.13,1.23-2,1.2-2.96,1.52l-2.84.93c-1.36.44-1.02,1.83-.51,2.86l5.73-.22-1.66.49c-.18.57-.19,1.1-1.51.72Z"/>
|
||||||
|
<path class="cls-2" d="M189.09,192.96c.05.24.06.17.06-.01l.12.59,1.48,13.12.05,15.42c9.75-1.12,18.49.18,27.17,2.92l.66-.85,1.15,1.22.02.65-.12,6.48c-.06,3.28-.1,6.15-.34,9.4l-1.49,20.28c-.14,1.92.53,4.27-.65,6.12l-5.41,3.97,6.02,6.36,1.49,21.56c.37,5.41,2.59,8.94-3.33,12.4.34.27.29,1.3.03,1.53s-.16.34-.97.66c-.37,1.66-2.22,1.95-3.2,2.95l-20.55,20.92c-1.09,1.11-1.62,2.3-2.99,2.91-1.44.64-2.89,1.38-4.34,2.88l-11.83-.23-21.18-.57c-2.81-.08-5.69-.28-7.16-3.49l-2.05-.16c-3.58,7.25-10.93,5.75-18.03,6.21-3.56.23-7.24,1.2-10.75.28l-13.96-3.64c-3.32-.87-4.74-4.5-6.28-4.44-1.22.05-1.49,1.13-2.18,1.92l-3.06,3.53c-1.81,2.08-4.75,1.11-7.01.74l-7.91-1.31c-.88-.14-1.36-1.64-2.36-2.17.88-6.23-.67-11.82-2.56-17.57-.32-.99.84-5.27,1.01-8.28l.29-4.88.53-6.71.52-27.67,1.82-3.79c.68.02,1.42.1,2.03.75l-.26,3.84c.58,6.2,3.37,11.55,6.13,16.95.74,1.45,1.64,1.58,3.53,1.67.71,2.78-5.01,2.77-4.87,7.46.1,3.59,3.19,5.33,5.86,7.47,1.1.88,1.26,3.8,3.9,3.74l1.39,4.29c-.55.88-1.66,1.38-2.04,2.49,5.64-1.4,9.6-5.08,13.71-8.92.74-.69,1.84-1.52,2.63-1.01l-12.59,14.11c3.44.8,6.65.65,10.04.64l14.56-.05c.11,1.41.17,2.2-.13,3.16-.27.85-1.42.88-2.03,1.46-.33.32-.07,1.46.36,1.47l9.76.09c.76,0,.5.97.43,1.33-.08.47-1.03.66-1.49.82-.2,1.44,1.31,1.79,2.22,2.2,3.95,1.79,8.1,3.27,12.16,2.67,2.32-6.96,3.62-13.61,4.34-20.67l1.71-16.74c.03-.33.52-1.11.67-.95.21.23.36.46.58.52.6.17-.4.69-.38,1.07l.87,20.54,1.91,10.68,7.79.48c.64.04,2.08.16,2.75.12,1.82-1.32,3.96-3.47,5.51-5.41-1.45-2.03-4.77-.36-4.91-3.68-.13-2.98,4.38-2.06,5.27-3.28.57-.79-.92-1.69-.78-2.39.63-3.11,3.98-3.96,6.55-5.79,1.36-.05,2.16,1.19,3.52,1.43-1.18,4.04,1.98,6.9.12,9.66,1.23,2.39,4.95,2.31,7.58,2.4l4.89.16c.28-7.91-4.98-20.21,2.46-19.21l8.81,1.19c3.18-4.19,7.87-5.81,12.77-6.65l-.1-2.95-4.12-.29v-3.28c-2.02.46-3.28.68-3.52-.89-.21-1.38-.32-1.86,1.07-2.69l1.39-1.83c1.17-.65,1.25-1.97.94-2.69-.53-1.2-2.15-.26-2.93-.56-2.32-.9.09-5.78-1.12-6.74-.43-.34-1.39-.39-2.3-.69-1.35-.45-.46-2.18.13-2.72.95-.87,5.78,2.37,12.25-.87-2.42-1.36-4.97-1.23-7.54-1.41l-30.5-2.09c-1,.11-2.15.77-2.86.16.03-.17.07-.51-.03-.83l23.27-2.2c7.11-.67,13.66-1.83,21.14-4.16l.3-8.25c-1.98,1.07-3.21-1.31-5.08-1.26-1.6.04-4.83,1.06-5.22-1.12.82-.79,3.01-1.78,2.4-3.52-1.94-.22-3.96-.67-4.35-1.17-.3-.39-1.1-1.14.08-1.77.47-.25,1.75.82,2.23.28.24-.27.9-.39.77-.88l-3.1-3.95c-3.13,2.9-6.55.8-8.83,5.88-2.36-1.3-2.84-6.55,0-8.07,1.24-.66,2.93,2.18,9.78-1.54-1.36-2.4-2.01-4.25-1.64-6.45-2.96-1.36-2.37-7.21-6.83-6.44l-8.02,1.38c-3.34-5.83-.94-9.71-.48-15.56l-6.99-.65-3.2,1.66-3.78-6.21c-.48-.79-1.18-.86-2.08-.47-2.29,1,2.08,3.59,2.14,5.98.02.72-1.73.82-1.95.45l-.89-1.5c-1.07-.69-2.02-.75-2.45-1.35-.68-.97.25-2.32.05-2.92-1.11-3.33-.34-5.73,1.44-8.53.91-1.43-2.05-3.28-3.78-3.07.6-.91,1.8-.54,3.03-.56l-.09-1.97-.57.11.57-.11,13.46-1.04c2.81-.22,5.44-.4,7.96,0,0,.25,0,.18-.06.01Z"/>
|
||||||
|
<path class="cls-6" d="M189.09,192.96c.13-.05.29.17.44.4l29.1,30.8-.66.85c-8.68-2.74-17.43-4.04-27.17-2.92l-.05-15.42-1.48-13.12-.12-.59c0,.18-.01.25-.06.01Z"/>
|
||||||
|
<path class="cls-2" d="M121,196.71l.35,1.99c.63-.55,1.25-.16,1.49-.09.22.06.34.33.1.59l-.74.79-7.42,2.99c-.86,2.97,1.23,5.48,2.29,7.94l.49,9.68c.06,1.23,1,2.52.85,3.37-.14.73-.8.91-1.08,1.02-1.11.45-3.05-5.03-4.74-8.09-1.29-2.35-4.13-4.12-5.86-5.97l-3.48-3.71c.07-.54-.17-.88-.33-1.31-.26-.75-1.5-.67-2.02-.58-.48-2.08.07-4.42-.22-7,3.74.38,6.19,6.49,8.76,5.54,2.12-.78.47-6.55,7.47-6.94l4.09-.23Z"/>
|
||||||
|
<path class="cls-1" d="M153.66,195.96c1.59,1.69,3.16,3.44,5.02,4.72,2.32,1.59,2.2,5.02,1.68,7.91l-4.63,26.09c-.3,1.71-.65,3.27-1.51,4.81-1.16-1.94-.03-3.7-.04-5.52l-.16-18.83-3.07-18.95,2.25-.71.46.48Z"/>
|
||||||
|
<path class="cls-1" d="M73.83,272.96c-.61-.65-1.35-.72-2.03-.75l3.58-4.84-2.64-3.89,3.59.27c7.46,2.46,14.99,2.66,22.88,4.1l-19.34,3.5c-2.15.39-4.26.34-6.04,1.61Z"/>
|
||||||
|
<path class="cls-4" d="M101.07,245.27c1.32.37,1.33-.16,1.51-.72l1.66-.49-5.73.22c-.51-1.03-.85-2.41.51-2.86l2.84-.93c.97-.32,3.09-.29,2.96-1.52-.12-1.15.72-1.05,1.57-1.15.61-.08,1.16.55,1.75,1.19.62-.86.91-1.67,1.59-1.72.49-.03.82,1.16,1.29,1.61,8.43-1,16.39-2.64,24.78-2.69.93.14,1.37.67,1.97,1.52.31.44-.79.63-.68,1.91,1.13-.23,2.61-.37,3.18.4,1,1.35-2.25,4.13-2.38,4.14-8.67.26-17.05,1.29-25.81,3.25v17.6s16.68-2.55,16.68-2.55c.84-.13,1.36.47,1.81,1.22.29.47-.58.95-.93,2.28,1.28.22,2.17-.38,3.68.25.1,1.86-.83,3.81-2.67,4.08l-14.99,2.18c-.7.1-1.4.2-2.8.21l.28,18.72,6.33-.85c6.72-.9,13.28-1.91,20.29-1.77l2.18,1.26c.35.2,1.11.91,1.09,1.32s-.42,1.36-1.09,1.41l-7.21.58v.92s6.65-.11,6.65-.11c.5,0,.81.59.83.93.02.4-.69,1.28-1.18,1.32l-15.07,1.37-13.46,1.99c.07,1.03.17,1.8-.26,2.52-.29.48-.99.61-1.73.57-.79-.04-1.1-1.5-1.64-2.22-3.36.92-6.44,1.31-6.98-.54-.31-1.06.53-2.77,2.06-2.1.72.31,1-.89.78-.9l-1.74-.07c-.99-.04-1.62-.08-2.1-.38-.57-.37-.51-1.36-.14-1.9.94-1.37,4.01-.91,3.99-2.17l-.52-28.42.02-15.84c-1.61.28-2.59.39-3.43-.02-1.08-.53-.7-3.32.27-3.04Z"/>
|
||||||
|
<path class="cls-5" d="M186.99,284.59c.71-.75,1.33-1.33,1.92-1.58.69-.29,1.36.35,1.65.81s.12,1.36-.17,1.99c-5.59,12.41-20.6,18.47-33.05,12.33-8.18-4.03-12.28-14.72-12.73-22.74-1.06-18.61,11.87-45.08,30.31-39.87,9.88,2.79,12.84,12.78,11.3,14.47-.34.38-1.07.77-1.41.26-.8-1.18-.36-2.66-1.92-3.73.49,2.89.44,6.09-.59,6.65-3.98,2.17-1.74-6.28-8.14-8.64-10.22-3.76-18.14,11.04-19.63,23.04-1.45,11.68,3.85,24.41,14.77,24.11,6.1-.17,11.2-4.41,14.12-9.6.59-1.04,1.65-1.76,2.67-.96.68.53.94,2.66.89,3.46-.24,0-.82-.26-1.15.32l-2.56,4.45.51.54c1.45-1.23,3.14-4.22,3.13-4.06l.07-1.24Z"/>
|
||||||
|
<path class="cls-1" d="M186.99,284.59l-.07,1.24c0-.16-1.68,2.83-3.13,4.06l-.51-.54,2.56-4.45c.33-.57.91-.32,1.15-.32Z"/>
|
||||||
|
<path class="cls-3" d="M219.78,225.37l-1.81-.37c-8.68-2.74-17.43-4.04-27.17-2.92l-.05-15.42-1.48-13.12-.19-.58"/>
|
||||||
|
<path class="cls-3" d="M219.78,225.37l.02.65-.12,6.48c-.06,3.28-.1,6.15-.34,9.4l-1.49,20.28c-.14,1.92.53,4.27-.65,6.12l-5.41,3.97,6.02,6.36,1.49,21.56c.37,5.41,2.59,8.94-3.33,12.4-7.99.64-14.33,1.69-23.27.55-5.4-.69-.74,10.29-4.65,22.7-.68,2.15-.83,4.01.26,5.73"/>
|
||||||
|
<path class="cls-3" d="M189.15,192.95c-2.52-.41-5.15-.22-7.96,0l-13.46,1.04-.57.11c-1.27.24-2.79.05-3.85.57-2.71,1.35-1.19,5.7-4.63,6.02-1.86-1.28-3.42-3.03-5.02-4.72l-.46-.48c-.8-1.91-2.32-1.12-3.9-1l-28.3,2.23-4.09.23c-7.01.39-5.35,6.16-7.47,6.94-2.57.94-5.02-5.17-8.76-5.54l-29.01-2.92-1.99,24.45,6.25,5.77.41.38.41.37"/>
|
||||||
|
<polyline class="cls-3" points="189.15 192.95 189.53 193.36 218.63 224.15 219.78 225.37"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 560">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #39170a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
fill: none;
|
||||||
|
stroke: #381507;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
stroke-width: 2.75px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-3 {
|
||||||
|
fill: #3d180b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-4 {
|
||||||
|
fill: #a88a21;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-5 {
|
||||||
|
fill: #d3ac2c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-6 {
|
||||||
|
fill: #ffcf34;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<path class="cls-6" d="M179.77,205.02l.77,4.04c.04.21.1.45.08.59.02-.14-.04-.38-.08-.59-.85,1.19-1.1-.58-2.67-.25l.79,8.42-.89,10.4c-.41,4.82-1.24,9.97,1.41,14.45,1.05,1.78,9.63-.31,17.16-.75,1.02,1.74,4.84.68,6.63,4.83.88,2.04,2.91,3.45,3.86,5.38,1.4,2.81,2.25,5.73,4.84,7.45,1.02-.82,1.88-.07,2.66-.28l.07,6.27c.03,2.58.2,4.71-.47,6.93-.75.09-2.1-.23-2.94.31-2.87,1.83-6.08,2.33-9.57,2.78l-6.5.84-16.99.61c-3.66.13-7.28-.69-11.12,1.38l16.47,2.61,22.92,3.07,7.37.46c.9,1.94.62,4.11.83,6.29l1.64,17c.53,5.45-8.08,6.66-5.27,8.93,2.01,1.62,5.55,12.81,5.16,16.41l-2.13,19.73c-8.18,1.27-16.4,2.09-24.72,1.88l-6.37-8.74c-.46-.63-1.12-1.06-1.64-1.08-.67-.03-1.56.51-2.14,1.26l-5.23,6.74-16.53,1.49c-2.64.24-5.37.61-7.42-.64l-.56-.34c.37,0,.52-.6.99-.96.23-.18-.52-.27-.45-.87l-1.23-17.67c-.63-9.07-.23-17.95-2.92-26.95l-2.35,17.78-4.21,27.18,3.26.18c-1.16,2.56-3.95,2.42-6.56,2.51l-13.67.49-16.87,1.08c-.05-.45-.49-.46-.65-.67l-.4-.38-.4-.38-.4-.38.58-.54.2.56c2.01-.21.19-3.36.22-9.43,0-2.13-.72-4.28.05-6.44.35-.98,2.07-.69,2.87-.56.43-1.64-1.95-1.67-2.13-2.33l.95-10.42c.09-.94.1-1.71-.31-2.02-1.64-1.25-3.51.15-5.41-.22.06-.7-.29-1.6-.74-2.1-.64-.71-1.77-.71-2.91-.62l-12.92,1.07.18-1.34s-.25-1-.63-1.37l-3.78-3.63c-1.39-1.34-2.03-2.83-1.58-5.16l-3.26-3.67c-1.51-1.7-2.88-4.39-.81-6.29,1.1-.32,3.6.81,4.46-.47,2.86-4.24-1.31-5.58-.49-7.74,1.33-3.48-4.58-6-4.26-8.5l13.01-2.5c3.67-1.59,6.78-3.8,10.59-3.22l.1,32.81c0,1.01,1.11,1.93,1.68,2.01,2.03.27,1.28-3.03,2.08-6.24,2.13.46-1.02,4.51,1.57,8.01.45.61,1.46,0,1.84-.26.62-.41.57-1.41.77-2.39l1.09-.2c.09-.02.41-.44.4-.93l-.43-14.35-.45-23.53c-.01-.52-.02-1.19.34-1.48.58-.46,1.53-.32.75.63l8.86,15.58,13.62,24.51c.37.67,1.86,1.46,2.5,1.41.85-.07,1.58-1.73,1.05-2.73-.13-1.47.35-1.05,1.48-.63,1.09-.52,1.88.67,2.48.34.91-.51,1.18-1.31,1.03-2.48-1.7-13.24-2.12-26.26-1.41-39.55l.91-17.03c.05-.93-.07-1.64-.43-2.01-.49-.49-1.44-.78-1.91-.55-.75.36-1.15,1.14-1.13,2.02l.19,7.68h-.86s-.48-6.72-.48-6.72c-.08-1.09-1.4-1.77-2.14-1.88-1.31-.2-2.03,1.16-2.03,2.59l-.14,40.7c-1.18.02-.63-.49-.97-1.13-7.29-13.26-14.57-26.19-20.99-39.77-.21-.45-.86-.62-1.11-.66-.4-.05-.83.64-1.21.96l-.5-2.31c-.16-.75-1.63-1.47-2.45-.7-1.35,1.27-.5,3.3-.84,4.65-1.25-.1-.52-1.14-.93-1.47-.51-.4-1.14-.55-2.26-.76l-.37,3.69c-2.89-2.03-5.73-4.3-9.04-6.32-.72-.34-2.29.61-2.32,1.39-.03,1.15-.89,2.45.54,3.02l10.66,3.95.41,19.15-14.09-.14c-5.14-.17-9.74-2.39-14.67-4.07-.85.62-1.32,1.36-2.39.69l-1.67-18.92c-.18-2.03.78-3.84,2.65-4.71l7.42-3.44-5.93-5.13.16-5.46c-1.39-3.37-3.58-6.69-3.35-10.39l1.05-16.95c.05-.8-.56-1.46-.02-2.1s1.18.05,2.02.15l15.08,1.79,14.48.61,27.87-1.53c2.78-.15,4.85.21,6.45,2.28-.81,1.03-1.69-.01-3.26,0l4.13,7.93c4.58,11.64,3.97,31.83,8.32,46.37l-.45-23.47,1.02-30.81c-.29-.23-.77.13-1.3.05-.68-.1.4-.6.29-1.64l-.63.29.63-.29,16.21-1.53,9.43-.31c4.27-.14,8.52-1.66,12.53-.39l.66.23c-.03.16-.03.22-.03-.04ZM183.3,260.1c.11.72.67,3.38,2.19,2.35,1.76-7.21-5.95-14.22-14.14-15.14-14.41-1.63-23.52,15.84-26.38,29.41-2.46,11.72.92,27.85,11.7,33.33,3.81,1.94,8.55,3.2,12.6,2.71,17.38-2.11,23.73-18.78,19.2-17.57-1.69.45-1.96,3.32-2.63,3.58-2.37.93.71-2.54.04-4.79-.24-.81-1.17-1.31-1.71-.96-2.42,1.56-3.83,8.02-11.84,10.21-7.31,2.01-14.11-2.14-16.6-9.5-6.23-18.48,5.85-40.89,17.78-36.88,5.29,1.78,5.29,9.24,6.76,9.31,2.39.13,2.79-4.52,2.18-6.12l.85.05Z"/>
|
||||||
|
<path class="cls-5" d="M97.21,275.95c.18.35.62.79.03.98-3.81-.59-6.93,1.63-10.59,3.22l-13.01,2.5c-.32,2.5,5.59,5.02,4.26,8.5-.82,2.16,3.35,3.5.49,7.74-.86,1.28-3.37.15-4.46.47-2.07,1.9-.69,4.59.81,6.29l3.26,3.67c-.45,2.32.19,3.82,1.58,5.16l3.78,3.63c.38.37.64,1.34.63,1.37l-.18,1.34c-5.9.49-11.78-1.34-17.6-2.56,0,.16,0,.27,0,.02l-.69-.73c.06-1.46-.73-4.12-.11-5.67.88-2.2.34-3.61.48-5.56l1.71-23.37c.25-3.49-1.22-7.09-1.53-10.53,1.07.67,1.54-.07,2.39-.69,4.93,1.69,9.53,3.9,14.67,4.07l14.09.14Z"/>
|
||||||
|
<path class="cls-6" d="M83.8,320.81l12.92-1.07c1.13-.09,2.26-.09,2.91.62.45.5.8,1.4.74,2.1-.91,10.45-.01,20.93,3.56,30.87l-.58.54-36.74-35.2-.4-.41c5.82,1.22,11.7,3.05,17.6,2.56Z"/>
|
||||||
|
<path class="cls-6" d="M179.77,205.02c0,.18,0,.24.03.04l34.21,33.44-.49.54-1.92-.35c-.22-.04-.45-.09-.64-.11l-2.66-.27c-13.98-3.98-24.18.77-25.99-.65-.73-.57-.59-1.87-.82-2.93,1.42-8.61.58-16.85-.87-25.09.02-.14-.04-.38-.08-.59l-.77-4.04Z"/>
|
||||||
|
<path class="cls-5" d="M149.77,353.23l-.56-.34-3.01-2.1c-1.49-1.04-3.18-.66-3.91.8l-3.26-.18,4.21-27.18,2.35-17.78c2.69,9,2.29,17.87,2.92,26.95l1.23,17.67c-.07.59.69.68.45.87-.47.37-.62.97-.99.96l.56.34Z"/>
|
||||||
|
<path class="cls-5" d="M140.36,207.35l.63-.29c.11,1.04-.97,1.54-.29,1.64.53.08,1.01-.28,1.3-.05l-1.02,30.81.45,23.47c-4.34-14.54-3.74-34.72-8.32-46.37l-4.13-7.93c1.57-.02,2.45,1.02,3.26,0,1.15,1.48,3.05,3.31,5.03,3.99l3.08-5.27Z"/>
|
||||||
|
<path class="cls-5" d="M213.94,271.89c-1.02,3.42-5.64,5.2-4.81,6.04l3.77,3.83c.8.81.39,1.56.68,2.19l-7.37-.46-22.92-3.07-16.47-2.61c3.84-2.08,7.46-1.25,11.12-1.38l16.99-.61,6.5-.84c3.49-.45,6.7-.95,9.57-2.78.84-.53,2.19-.22,2.94-.31Z"/>
|
||||||
|
<path class="cls-5" d="M214.34,258.7c-.77.21-1.64-.54-2.66.28-2.59-1.73-3.44-4.65-4.84-7.45-.96-1.92-2.99-3.34-3.86-5.38-1.79-4.15-5.61-3.09-6.63-4.83l14.51-.85c-.03-.62-.15-1.25.1-1.89.19.02.43.07.64.11l1.92.35.49-.54.4.39c.14.14.38.23.4.39l.1.72c.48,3.66-.57,7.44-.57,11.31v7.39Z"/>
|
||||||
|
<path class="cls-1" d="M96.95,254.77l.37-3.69c1.12.21,1.75.37,2.26.76.42.33-.32,1.37.93,1.47.34-1.34-.52-3.38.84-4.65.82-.77,2.29-.05,2.45.7l.5,2.31c.37-.32.81-1.01,1.21-.96.25.03.9.2,1.11.66,6.43,13.58,13.7,26.51,20.99,39.77.33.64-.22,1.15.97,1.13l.14-40.7c0-1.44.72-2.79,2.03-2.59.75.11,2.07.79,2.14,1.88l.48,6.73h.86s-.19-7.69-.19-7.69c-.02-.88.38-1.66,1.13-2.02.47-.23,1.41.06,1.91.55.36.36.48,1.08.43,2.01l-.91,17.03c-.71,13.29-.29,26.3,1.41,39.55.15,1.17-.12,1.97-1.03,2.48-.6.34-1.39-.86-2.48-.34-1.13-.42-1.61-.84-1.48.63.53,1-.2,2.66-1.05,2.73-.63.05-2.13-.74-2.5-1.41l-13.62-24.51-8.86-15.58c.78-.95-.17-1.09-.75-.63-.36.29-.35.96-.34,1.48l.45,23.53.43,14.35c.01.49-.31.91-.4.93l-1.09.2c-.2.98-.16,1.98-.77,2.39-.38.26-1.39.87-1.84.26-2.59-3.5.56-7.55-1.57-8.01-.8,3.22-.05,6.51-2.08,6.24-.58-.08-1.68-1-1.68-2.01l-.1-32.81c.59-.19.15-.63-.03-.98l-.41-19.15c-.01-.67.09-1.35.16-2.03ZM131.61,294.87c.56.17.86.1,1.15.05l-.14-5.48h-.88s-.12,5.43-.12,5.43Z"/>
|
||||||
|
<path class="cls-3" d="M183.3,260.1l-.32-2.09c-.11-.72-1.11-1.15-.97-1.75l-3.04-3.05c-.51-.51-.92-.45-1.63-.42,2.53,1.87,4.03,4.39,5.11,7.26.61,1.6.21,6.25-2.18,6.12-1.47-.08-1.46-7.54-6.76-9.31-11.93-4-24.01,18.41-17.78,36.88,2.48,7.36,9.28,11.51,16.6,9.5,8-2.2,9.41-8.66,11.84-10.21.54-.35,1.47.15,1.71.96.66,2.24-2.41,5.72-.04,4.79.67-.26.94-3.13,2.63-3.58,4.53-1.21-1.83,15.46-19.2,17.57-4.05.49-8.79-.77-12.6-2.71-10.78-5.48-14.16-21.61-11.7-33.33,2.86-13.58,11.96-31.05,26.38-29.41,8.2.93,15.9,7.93,14.14,15.14-1.52,1.03-2.08-1.63-2.19-2.35Z"/>
|
||||||
|
<path class="cls-4" d="M180.62,209.65c1.45,8.24,2.29,16.48.87,25.09.23,1.06.09,2.35.82,2.93,1.81,1.42,12.02-3.33,25.99.65l2.66.27c.19.02.43.07.64.11-.22-.04-.45-.09-.64-.11-.26.64-.13,1.27-.1,1.89l-14.51.85c-7.53.44-16.11,2.54-17.16.75-2.65-4.48-1.82-9.62-1.41-14.45l.89-10.4-.79-8.42c1.56-.33,1.82,1.45,2.67.25.04.21.1.45.08.59Z"/>
|
||||||
|
<path class="cls-4" d="M100.37,322.45c1.9.37,3.77-1.03,5.41.22.41.31.4,1.07.31,2.02l-.95,10.42c.18.66,2.56.69,2.13,2.33-.8-.12-2.52-.42-2.87.56-.77,2.16-.04,4.31-.05,6.44-.03,6.07,1.79,9.23-.22,9.43l-.2-.56c-3.58-9.94-4.47-20.41-3.56-30.87Z"/>
|
||||||
|
<path class="cls-5" d="M96.95,254.77c-.07.68-.17,1.36-.16,2.03l-10.66-3.95c-1.43-.57-.57-1.87-.54-3.02.02-.78,1.6-1.73,2.32-1.39,3.31,2.02,6.15,4.3,9.04,6.32Z"/>
|
||||||
|
<path class="cls-4" d="M183.3,260.1l-.85-.05c-1.08-2.87-2.59-5.4-5.11-7.26.71-.03,1.12-.09,1.63.42l3.04,3.05c-.15.6.86,1.03.97,1.75l.32,2.09Z"/>
|
||||||
|
<path class="cls-4" d="M131.61,294.87l.12-5.43h.88s.14,5.47.14,5.47c-.29.05-.59.12-1.15-.05Z"/>
|
||||||
|
<path class="cls-2" d="M179.77,205.02l-.62-.2c-4-1.27-8.26.25-12.53.39l-9.43.31-16.21,1.53-.63.29-3.08,5.27c-1.99-.68-3.89-2.51-5.03-3.99-1.6-2.07-3.66-2.43-6.45-2.28l-27.87,1.53-14.48-.61-15.08-1.79c-.84-.1-1.46-.81-2.02-.15s.07,1.3.02,2.1l-1.05,16.95c-.23,3.7,1.96,7.02,3.35,10.39l-.16,5.46,5.93,5.13-7.42,3.44c-1.86.87-2.83,2.67-2.65,4.71l1.67,18.92c.3,3.43,1.78,7.04,1.53,10.53l-1.71,23.37c-.14,1.96.39,3.36-.48,5.56-.62,1.55.17,4.21.11,5.67l.69.73"/>
|
||||||
|
<path class="cls-2" d="M214.8,239.27l-1.28-.24-1.92-.35c-.22-.04-.45-.09-.64-.11l-2.66-.27c-13.98-3.98-24.18.77-25.99-.65-.73-.57-.59-1.87-.82-2.93,1.42-8.61.58-16.85-.87-25.09.02-.14-.04-.38-.08-.59l-.77-4.04"/>
|
||||||
|
<path class="cls-2" d="M104.54,355.01l-.41-1.13-.2-.56c-3.58-9.94-4.47-20.41-3.56-30.87.06-.7-.29-1.6-.74-2.1-.64-.71-1.77-.71-2.91-.62l-12.92,1.07c-5.9.49-11.78-1.34-17.6-2.56"/>
|
||||||
|
<polyline class="cls-2" points="179.8 205.06 214.01 238.49 214.41 238.88 214.8 239.27"/>
|
||||||
|
<path class="cls-2" d="M214.8,239.27l.1.72c.48,3.66-.57,7.44-.57,11.31v7.39s.07,6.27.07,6.27c.03,2.58.2,4.71-.47,6.93-1.02,3.42-5.64,5.2-4.81,6.04"/>
|
||||||
|
<polyline class="cls-2" points="66.21 318.28 66.6 318.66 103.34 353.86 103.74 354.24 104.14 354.63 104.54 355.01"/>
|
||||||
|
<path class="cls-2" d="M210.79,316.19c2.01,1.62,5.55,12.81,5.16,16.41l-2.13,19.73c-8.18,1.27-16.4,2.09-24.72,1.88l-6.37-8.74c-.46-.63-1.12-1.06-1.64-1.08-.67-.03-1.56.51-2.14,1.26l-5.23,6.74-16.53,1.49c-2.64.24-5.37.61-7.42-.64l-.56-.34-3.01-2.1c-1.49-1.04-3.18-.66-3.91.8-1.16,2.56-3.95,2.42-6.56,2.51l-13.67.49-16.87,1.08-.65-.67"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 9.6 KiB |
@@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 560">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #9b1f0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
fill: #3a160a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-3 {
|
||||||
|
fill: #e93525;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-4 {
|
||||||
|
fill: #3d180d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-5 {
|
||||||
|
fill: #c12b1c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-6 {
|
||||||
|
fill: none;
|
||||||
|
stroke: #381507;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
stroke-width: 2.2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<path class="cls-3" d="M141.35,207.84c-.15-.1-.38-.08-.57-.14-.5.53.56,1.73-.35,2.63,2.2,6.52,2.73,13.17,3.12,20.16l1.18,20.95c.3-.07.67-.04.84-.02.7-.89-.2-2.18-.08-3.4l3.51-37.22c.07-.78-.41-1.44-.5-1.88l19.5-2.14c1.96.84,1.89,4.16,2.43,5.54-.19-.36-1.21.01-1.82.21-.39.13.11.72-.4,1.5.58,10.03-3.74,18.54-4.28,28.36,3.88-6.54,14.81-30.94,15.78-31.51,1.1-.65,1.54.47,2.43.78,1.28.45,3.34-.37,3.73,1.34.25,1.09,1.66.7,2.44,1.56-.46,1.49-1.33,2.83-1.48,4.39,3.42.29,7.69-.88,11.02.3,2.37.84-.91,3.18-1.22,4.37.17,4.04,4.98,4.47,10.21,3.99.82.43.92,2.65,2.23,2.64l-4.61,3.64c4.87-.22,8.3,1.84,11.15,1.44l-.61,4.42c-.69.13-1.97-.34-2.8.24-6.06,4.22-12.42,7.63-18.95,11.04l-6.29,4.39c4.87.92,9.07-1.38,13.76-2.48,3.75-.88,7.71-1.15,11.61-1.17,1.47,0,3.02,1.79,4.47.65l-1.19,12.44c-.25,2.67-.6,5.14-1.34,7.45-.83-.98-1.63-.31-2.63.07-6.58,2.5-13.24,3.89-20.13,5l-17.39,2.78c1.75,1.3,3.52.34,5.24.34h32.08c-1.46,8.73-7.23,6.14-7.99,8.08-1.21,3.1,2.92,5.92,1.74,7.9s-3.15,3.27-4.07,5.7c2.08.02,5.13-3.57,7.39-2.41.77.39,1.39,1.77,1.11,3.19-3.36,4.96-9.42,5.44-8.61,13.35l-.74,3.75c-1.58.06-2.1,1.03-2.21,2.08l-12.24-1.78c-1.47-.21-4.87-.09-4.63,1.94l1.6,13.76c.17,1.43.76,2.77-.25,3.79l-5.27,2.54-2.14.63-1.93-1.16c-6.66,3.78-4.71,7.07-15.02,6.31l-11.95,2.56-1.39-7.83c-3.15-7.67-3.81-15.27-3.95-23.41l-.15-8.71c-.38.04-.44-.34-.87-.53l-1.62,20.27c-.21,2.63-.8,4.53-1.38,7.39l-20.37-.61c-2.55-.08-4.58-3.05-7.89-1.97-.6-2.94-2.88-3.36-5.33-3.82.34-4.53,4.71-6.78,3.51-8.96l-7.49,7.73-1.13-2.09c-1.15-2.13-1.4-5.14-4.15-6.09-.73-1.72-2.1-3.05-4.58-2.9-.17-1.75-2.45-1.79-2.86-2.71-.24-.54.43-.87-.61-.57-.2.06-3.02-3.72-3.62-7.19-3.05-.69-.25-4.22-2.63-4.24,3.16-3.19-3.84-1.11-4.81-3.41-.81-1.91-.04-3.39.74-4.96.26-.51-.56-4.29,2.44-9.1,6.33-2.1,12.4-3.33,18.8-4.23.25-.04.88.64,1.17.5.34-.16.76-.41.89-1.14l-22.09-1.45-1.42-.42c.68.2-2.27-4.82-.93-7.13,1.88-.95,4.57-.3,6.65-.77.49-.11,4.68-5.32,4.6-4.85.15-.81-.35-1.49-.9-1.62-1.08-.25-1.49,2.01-5.22,2.29-1.4.11-3.82-3.52-3.86-3.9-.09-.81.64-.76,1.09-1.56,3.25-5.81,2.03-5.22,1.61-9.67-.13-1.35-1.69-2.4-.19-3.82,2.65-2.49,5.15-5.35,6.94-8.32.25-.1.64-.51,1.11-.47l13.86,1.31c3.55-2.76,1.46-9.93,1.27-15.68l-.49-14.85c.39-.69.33-1.35.37-1.85.06-.7-.98-1.5-1.55-.94l.55-2.93.11-.58.22-1.16-.39.4.39-.34c4.32.66,9.46,1.37,13.92,1.69l14.97,1.06c3.88.27,7.66-.03,11.21,1.08.19.06.42.03.57.14ZM102.09,290.2l.93,21.66c.06,1.44-.52,3.82,1.01,4.64.98.52,2.05,1,2.45.38l1.25-1.93c.34-.52-.14-1.15.09-1.4.18-.19.64-.12.85-.03.32.12.23.16.26.39.08.53-.64.83-.5,1.16.41.96,1.63,1.3,2.11.96.43-.3,1.27-1.06,1.24-1.95l-.87-22.21c8.59-.6,16.52-3.59,22.83-8.98,7.59-6.48,9.09-17.7,2.59-25.38s-21.36-8.59-30.78-5.14c-.19-1.38-.35-2.08-.8-2.15l-2.07-.29-.32,3.56c-9.69,4.25-8.22,8.19-6.55,7.13.37-.23.75-.79,2.02-.94l-1.7,2.61c-.33.5-.28,1.36.15,1.65.29.2,1.12.33,1.58,0l4.17-3.06-.03,24.78c-1.77.34-3.13-1.12-4.55-.4-1.95.98.56,3.2,4.63,4.93ZM183.9,295.43c-2.54-1.64-4.08,8.31-13.8,10.5-5.05,1.14-10.5-1.01-13.47-5.57-4.78-7.32-5.07-16.43-2.58-24.6,3.13-10.28,10.83-20.05,19.27-15.53,5.81,3.12,2.84,9.38,6.76,8.1.76-.25,1.62-3.66.55-6.94,1.78.38,1.35,3.89,2.76,4.16,2.82.54.95-11.97-10.88-15.11-17.71-4.7-30.43,20.87-29.61,38.76.36,7.72,2.8,15.24,8.44,20.4,5.98,5.47,14.37,6.55,22.33,4.17,9.83-2.94,16.54-13.86,14.45-15.95-.52-.53-1.42-.6-1.75-.07l-.88,1.4c-.87.17-.68.78-.87.89-1.52.83,1.03-3.48-.73-4.61Z"/>
|
||||||
|
<path class="cls-5" d="M100.35,205.56l-.55,2.93c-1.08,5.75-2.71,11.68-2.27,17.86.25,3.54.85,6.96.03,10.68-8.89.06-16.45-2.38-25.75.39-.64.15-.28,1.16-.01,1.44.24.26.66-.03,1.36.22l11.41,1.34c.18.5.36.67.67.55-1.8,2.97-4.29,5.82-6.94,8.32-1.5,1.41.06,2.46.19,3.82.42,4.45,1.64,3.85-1.61,9.67-.45.81-1.18.76-1.09,1.56.04.39,2.46,4.01,3.86,3.9,3.73-.29,4.14-2.55,5.22-2.29.56.13,1.05.81.9,1.62.09-.47-4.1,4.74-4.6,4.85-2.08.48-4.77-.18-6.65.77-1.35,2.31,1.61,7.33.93,7.13l1.42.42,22.09,1.45c-.13.74-.55.98-.89,1.14-.29.14-.91-.53-1.17-.5-6.4.9-12.47,2.12-18.8,4.23-3,4.81-2.18,8.59-2.44,9.1-.78,1.57-1.55,3.04-.74,4.96.97,2.29,7.97.21,4.81,3.41,2.38.02-.42,3.55,2.63,4.24.6,3.47,3.42,7.25,3.62,7.19,1.04-.3.38.02.61.57.4.92,2.69.96,2.86,2.71,2.48-.16,3.85,1.18,4.58,2.9,2.75.95,3,3.96,4.15,6.09l1.13,2.09,7.49-7.73c1.2,2.18-3.16,4.43-3.51,8.96,2.45.45,4.73.87,5.33,3.82,3.31-1.07,5.34,1.9,7.89,1.97l20.37.61c.58-2.85,1.17-4.75,1.38-7.39l1.62-20.27c.43.19.49.57.87.53l.15,8.71c.14,8.14.8,15.74,3.95,23.41l1.39,7.83,11.95-2.56c10.32.76,8.36-2.53,15.02-6.31l1.93,1.16,2.14-.63,5.27-2.54c.4-.02.63.4.83.64.16.18-.17.6-.2,1.04l-.67,10.12c.82-.14,1.5-.45,2.27,0,2.81-6.65,3.02-13.87,2.67-21.4.15-.92-.09-2.34.39-2.85.45-.48,1.84-1.22,2.79-1.11,7.02.82,13.69.47,20.29-1.35,1.03.54,2.17.4,3.18.19.08.61.02,1.31-.5,1.83l-14.08,13.99c-3.04,3.02-6.73,5.26-9.07,8.88l-3.1,3.24c-1.03-1.01-2.03-.45-2.82-.97l-2.06,4.85-35.37-1.32c-4.34-1.79-6.54-8.04-7.73-7.92s-2.8,6.38-5.48,6.54l-10.41.64c-5.38.33-10.15.72-15.49,2.19-3.14.87-7.62.86-10.83.08-2.95-1.18-3.85-5.14-6.2-6.63-2.58.57-3.1,5.36-5.17,6.12s-15.98-.69-16.94-1.64c-1.04-1.02-1.66-2.74-1.93-4.36l-1.46-8.74c-.26-1.57-1.4-2.96-.05-5l.25-3.57c1.08-2.07.21-4.64.52-7.05l1.27-9.71c.24-1.86.5-4.12-.13-5.95l-.38-7.85c-.09-1.91-.47-3.76-.13-5.55l1.4-7.4c.42-2.24,1.09-4.38,1.82-6.51-.7-1.43-2.17-2.49-2.25-3.91l-.41-7.84-.51-7.74-.6-8.71-.3-7.65c-.86-4.02-1.08-8.37,2.47-11.45.28-.11.66-.01.92.02l30.19-31.05.84.55Z"/>
|
||||||
|
<path class="cls-5" d="M215.61,235.34c-2.85.4-6.28-1.66-11.15-1.44l4.61-3.64c-1.3,0-1.41-2.21-2.23-2.64-5.23.47-10.04.05-10.21-3.99.31-1.19,3.58-3.53,1.22-4.37-3.33-1.18-7.6,0-11.02-.3.14-1.57,1.01-2.91,1.48-4.39-.78-.86-2.19-.47-2.44-1.56-.39-1.71-2.45-.89-3.73-1.34-.89-.32-1.33-1.43-2.43-.78-.97.57-11.91,24.97-15.78,31.51.54-9.82,4.86-18.33,4.28-28.36.51-.78,0-1.37.4-1.5.61-.2,1.63-.57,1.82-.21.52,1.34,1.39,2.32,2.25,3.36l.35.42-.35-.42c2.99-4.01,4.32-9.78,6.79-11.04,1.99-1.01,6.98.63,10.05.99,2.25.26,4.67-.67,7.13.45l5.57.52c4.86.45,13.52,1.2,14.2,1.84.95.89.45,1.58.67,2.86,1.43,8.35.85,16.35-1.48,24.06Z"/>
|
||||||
|
<path class="cls-5" d="M214.27,272.31c-.4,1.25-2.02,2.41-1.74,4.07l2.61,3.32,1.18,21.98,1.27,18.14c.18,2.6-1.32,4.68-3.5,5.32-1,.22-2.14.35-3.18-.19.51-.44.48-1.12.22-2.05-4.36.28-8.77-.13-13.07-.76.11-1.05.62-2.02,2.21-2.08l.74-3.75c-.81-7.92,5.25-8.4,8.61-13.35.28-1.42-.34-2.79-1.11-3.19-2.26-1.16-5.3,2.44-7.39,2.41.92-2.43,2.85-3.65,4.07-5.7s-2.95-4.8-1.74-7.9c.76-1.94,6.53.65,7.99-8.08h-32.08c-1.72,0-3.48.96-5.24-.34l17.39-2.78c6.89-1.1,13.55-2.49,20.13-5,1-.38,1.8-1.05,2.63-.07Z"/>
|
||||||
|
<path class="cls-1" d="M148.5,208.91c.09.44.57,1.1.5,1.88l-3.51,37.22c-.12,1.22.79,2.51.08,3.4-.17-.02-.55-.05-.84.02l-1.18-20.95c-.39-6.98-.92-13.64-3.12-20.16.91-.89-.15-2.09.35-2.63.19.06.42.03.57.14,2.12,1.41,4.66,1.34,7.15,1.07Z"/>
|
||||||
|
<path class="cls-5" d="M215,239.76c-.37,2.69-1.06,4.75-4.09,5.88,0,1.06-1.32,1.19-1.19,1.7.25,1,1.38,1.43,2.04,1.7,1.6.65,5.23,1.29,5.03,3.38-1.45,1.14-3-.66-4.47-.65-3.89.02-7.85.3-11.61,1.17-4.69,1.1-8.9,3.39-13.76,2.48l6.29-4.39c6.53-3.41,12.89-6.83,18.95-11.04.83-.58,2.12-.11,2.8-.24Z"/>
|
||||||
|
<path class="cls-2" d="M102.09,290.2c-4.07-1.73-6.58-3.95-4.63-4.93,1.42-.72,2.78.75,4.55.4l.03-24.78-4.17,3.06c-.46.33-1.29.2-1.58,0-.43-.29-.48-1.15-.15-1.65l1.7-2.61c-1.27.15-1.65.71-2.02.94-1.68,1.06-3.15-2.89,6.55-7.13l.32-3.56,2.07.29c.45.06.61.77.8,2.15,9.43-3.46,24.09-2.78,30.78,5.14s5,18.9-2.59,25.38c-6.31,5.39-14.24,8.38-22.83,8.98l.87,22.21c.03.89-.81,1.65-1.24,1.95-.48.34-1.7,0-2.11-.96-.15-.34.58-.64.5-1.16-.04-.23.06-.27-.26-.39-.21-.08-.67-.16-.85.03-.23.25.25.88-.09,1.4l-1.25,1.93c-.4.62-1.47.15-2.45-.38-1.53-.82-.95-3.2-1.01-4.64l-.93-21.66ZM131.84,268.69c-.17-9.31-11.39-12.74-20.83-10.93-.29,9.08-1.11,17.3-.24,26.28,9.58-2.04,21.23-6.33,21.06-15.35Z"/>
|
||||||
|
<path class="cls-4" d="M183.9,295.43c1.76,1.14-.79,5.45.73,4.61.19-.11,0-.72.87-.89l.88-1.4c.33-.52,1.23-.45,1.75.07,2.08,2.09-4.63,13.02-14.45,15.95-7.96,2.38-16.35,1.3-22.33-4.17-5.64-5.17-8.09-12.68-8.44-20.4-.82-17.89,11.9-43.46,29.61-38.76,11.84,3.14,13.7,15.66,10.88,15.11-1.41-.27-.98-3.78-2.76-4.16,1.07,3.28.2,6.69-.55,6.94-3.93,1.28-.95-4.98-6.76-8.1-8.45-4.53-16.14,5.24-19.27,15.53-2.49,8.17-2.2,17.28,2.58,24.6,2.98,4.56,8.43,6.7,13.47,5.57,9.71-2.19,11.26-12.13,13.8-10.5ZM177.02,256.36l3.08,4.12c1.58-.8-.62-4.44-3.08-4.12Z"/>
|
||||||
|
<path class="cls-1" d="M198.07,322.14c4.3.63,8.71,1.03,13.07.76.25.92.29,1.6-.22,2.05-6.61,1.82-13.27,2.17-20.29,1.35-.95-.11-2.34.63-2.79,1.11-.48.51-.23,1.94-.39,2.85.34,7.53.14,14.75-2.67,21.4-.77-.46-1.44-.14-2.27,0l.67-10.12c.03-.44.36-.86.2-1.04-.2-.24-.43-.66-.83-.64,1.02-1.02.42-2.37.25-3.79l-1.6-13.76c-.24-2.03,3.16-2.15,4.63-1.94l12.24,1.78Z"/>
|
||||||
|
<path class="cls-1" d="M85.24,240.96c-.31.13-.49-.05-.67-.55l-11.41-1.34c-.71-.24-1.12.04-1.36-.22-.26-.28-.63-1.29.01-1.44,9.3-2.77,16.87-.34,25.75-.39.82-3.72.22-7.14-.03-10.68-.44-6.17,1.19-12.1,2.27-17.86.58-.57,1.61.24,1.55.94-.04.5.02,1.16-.37,1.85l.49,14.85c.19,5.76,2.28,12.92-1.27,15.68l-13.86-1.31c-.47-.04-.87.37-1.11.47Z"/>
|
||||||
|
<path class="cls-3" d="M131.84,268.69c.17,9.02-11.48,13.31-21.06,15.35-.87-8.98-.05-17.2.24-26.28,9.44-1.81,20.65,1.63,20.83,10.93Z"/>
|
||||||
|
<path class="cls-1" d="M177.02,256.36c2.46-.32,4.66,3.32,3.08,4.12l-3.08-4.12Z"/>
|
||||||
|
<path class="cls-6" d="M211.77,249.04c1.6.65,5.23,1.29,5.03,3.38l-1.19,12.44c-.25,2.67-.6,5.14-1.34,7.45-.4,1.25-2.02,2.41-1.74,4.07l2.61,3.32,1.18,21.98,1.27,18.14c.18,2.6-1.32,4.68-3.5,5.32-1,.22-2.14.35-3.18-.19-6.61,1.82-13.27,2.17-20.29,1.35-.95-.11-2.34.63-2.79,1.11-.48.51-.23,1.94-.39,2.85.34,7.53.14,14.75-2.67,21.4-.09.1-.19.28-.26.44l-2.06,4.85-35.37-1.32c-4.34-1.79-6.54-8.04-7.73-7.92s-2.8,6.38-5.48,6.54l-10.41.64c-5.38.33-10.15.72-15.49,2.19-3.14.87-7.62.86-10.83.08-2.95-1.18-3.85-5.14-6.2-6.63"/>
|
||||||
|
<path class="cls-6" d="M100.69,203.88c4.32.66,9.46,1.37,13.92,1.69l14.97,1.06c3.88.27,7.66-.03,11.21,1.08.19.06.42.03.57.14,2.12,1.41,4.66,1.34,7.15,1.07l19.5-2.14c1.96.84,1.89,4.16,2.43,5.54s1.39,2.32,2.25,3.36l.35.42"/>
|
||||||
|
<path class="cls-6" d="M100.68,203.82l-.39.4-.78.79-30.19,31.05c.27,1.12,1.58,1.24,2.49,1.36,9.3-2.77,16.87-.34,25.75-.39.82-3.72.22-7.14-.03-10.68-.44-6.17,1.19-12.1,2.27-17.86l.55-2.93.11-.58.22-1.16Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 560">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #0db3c8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
fill: #007988;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-3 {
|
||||||
|
fill: #0c96a8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-4 {
|
||||||
|
fill: #3a170d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-5 {
|
||||||
|
fill: none;
|
||||||
|
stroke: #381507;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
stroke-width: 2.2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-6 {
|
||||||
|
fill: #3c1b0d;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<path class="cls-1" d="M214.65,239.1l-2.58-.1c-3.79,2.1-7.73,4.08-11.61,6.32l-6.56,3.79c-2.2,1.27-5.02,2.22-6.12,5.03l12.97-3.01,11.9-1.19c.44-.63.06-1.58.21-2.2,1.11.52,3.9,1.16,3.71,3.1l-1.82,18.71c-1.5,1.84-3.42,2.56-4.11,4.45-.39.04-.84-.28-1.1-.57-.2-.23.18-1.3-.21-1.23l-13.32,2.67-24.66,3.99c2.94.91,5.47.34,8.11.31l30.61-.32c.58,0,1.24.32,1.55.45s.06,1.13-.11,1.49l-5.94,12.1-2.34,5.89c1.31.57,2.15-1.03,3.19-1.23,1.71-.34,2.18,1.87,2.29,2.91.19,1.76-.21,2.53-1.63,3.75l-3.61,3.1c-2.25,1.93-2.51,5.48-3.11,8.25l-2.36,4.83-14.21-1.65c-1.16-.13-2.3.56-2.59,1.21-1.13,2.5,3.49,19.87,1.51,29.66l2.38-.32.4,1.88c-.02,1.11-.76,2.05-1.49,2.86-.9,1-2.37.8-3.88.8l-24.17.07c-3.64.01-6.98.15-10.19-1.01l-.55-.2c.38-.35-.12-1.32,1-2.02l-3.02-10.07c-.55-1.82-.65-4.03-.68-6.05l-.38-23.49c0-.35.21-1.3-.12-1.78-.19-.26,1.36-1.02-.61-1.17l-4.19,32.02c-.53,4.08-2.01,7.72-1.64,11.98,1.56-.87,2.59-.64,3.6-.38-1.06.63-1.9,2.74-3.63,3-8.84,1.34-17.96,1.85-26.77.44l-13.88-3.27c-1.56-1.74-2.19-3.54-3.98-4.71l-6.41,7.6c-5.24-.33-10.27-1.31-15.49-2.21-2.15-4.26-.12-10.16-1.62-14.2-1.64-4.39-1.98-8.67-1.04-13.21,1.9-9.16,1.37-17.8.49-27.02-.43-4.52,3.2-9.56,5.02-12.83l.8-.58.55-.55-.55.55-.8.58c.11.87,1.36,1.26,2.07.83.33-.2.87.26,1.48-.62l30.23-5.39c1.79-.32,6.53.08,5.59-1.14-.12-.15-.41-.79-.78-.81l-16.48-.56-11.54.04c-3.89-.56-7.57.1-11.44-1.87.21,1.09-.13,1.57-.76,1.25-.22-.11-.39.11-.92.03l-2.78-19.95c-.32-2.3-1.51-5.82-.08-7.61l6.94-4.85c.64-.45.02-1.82-.8-1.97-2.71-1.37-4.11-3.91-2.9-7.27-2.45-4.5-2.75-9.25-2.39-14.17l.97-13.21c.38-5.16,5.65-2.67,12.92-.43,3.25.54,6.3-.23,9.33-1.63,8.42.55,16.41-.06,24.8-.67l16.36-1.2,8.59,1.05c.2.02.38.14.56.21-.19-.07-.37-.18-.56-.21-.54,4.1,1.56,7.36,1.72,9.19l1.11,13.13.8,17.66-.2,8.37c.25,0,.57-.14.92.02l3.92-47.24-.57.22.57-.22,19.53-1.91c1.57.6,1.43,3.49,2.12,4.44.09.12.09.4.12.6-.03-.2-.03-.48-.12-.6l-2.15.91c.17,8.51-1.44,13.81-3.15,21.63l-2.13,9.75c2.92-2.92,3.58-6.64,5.27-10.02l10.81-21.63c.85-1.69.49-4.05,3.09-4.69-.5-.7-.42-1.53-.6-2.46,1.54.33,3.13-.5,4.85.26l5.72.4,10.88,1.12,6.13.57c2.16.2,6.59-.53,8.1,2.25.4,6.45,1.14,13.48-.1,19.79l-2.24,11.36ZM168.83,303.16c-6.94.18-12.13-5.11-13.68-11.47-1.72-5.03-2.28-10.32-.88-15.55,1.12-10.54,9.73-25.45,20.19-20.69,5.19,2.36,4.68,11.87,7.33,8.34-.13.18.87-3.46,1.06-3.05-.47-1.02-.68-2.77-.56-2.97.38-.62.92-.03.9.33-.01.16.1.13.26.77.43.68.42,1.72.95,1.95,3.46,1.48,1.8-9.41-6.67-13.59-5.47-2.7-10.86-3.08-15.84-.29-7.33,4.11-11.48,11.04-14.58,18.6-3.51,8.58-5.17,17.76-2.65,26.66,1.55,5.5,3.59,11.18,8.36,15.03,6.06,4.89,14.44,6.2,22.41,3.63,13.87-4.48,18.3-21.76,11.29-15.14-.28.27.49.89.09,1.03-.25.08-.69-.15-1.14.58-.32.51.58,1.26-.3,1.42l-1.48.26,1.93-3.85c.54-1.09.15-2.4-.76-2.62-3.3-.79-4.86,10.32-16.21,10.62ZM99.04,299.48l-2.33-4.68-3.47.03c-.04,6.06,3.08,10.63,7.43,14.01,4.93,3.83,10.3,5.14,16.54,4.87,10.18-.44,19.57-6.79,21.53-16.96,1.57-8.14-2.54-15.62-9.31-19.96-7.16-4.59-16.77-5.53-20.09-10.13-1.83-2.53-1.29-5.65.09-8.51,1.08-2.23,3.67-3.76,6.68-4.4,8.68-1.84,13.61,5.15,15,4.52.46-.2,1.46-.79,1.17-1.39l-1.53-3.17c2.36.38,3.63,3.38,4.81,1.76,1.42-1.94-9.35-13.75-24.73-9.15-8.64,2.58-13.65,10.74-11.83,19.53.96,4.64,3.52,8.84,8.3,10.67l12.22,4.68c6.12,2.34,10.3,8.86,8.33,15.46-1.45,4.86-6.35,7.18-11.25,7.51-5.75.39-12.14-2.11-13.82-7.94-.66-2.3-.6-5.38-4.17-5.51-.75,4.05,1.16,6.89.42,8.75ZM103.94,315l-7.75,6.79c.97.96,1.64.88,2.27.52-.28.16,5.09-5.27,5.48-7.31Z"/>
|
||||||
|
<path class="cls-3" d="M210.63,274c-.34,2.98,4.2,2.59,4.27,3.76l2.51,42.37c.1,1.67-2.35,3.33-3.58,3.16l.11-2.9c-5.22.96-10.62.62-15.97,0l2.36-4.83c.6-2.77.86-6.32,3.11-8.25l3.61-3.1c1.42-1.22,1.82-1.99,1.63-3.75-.11-1.05-.58-3.25-2.29-2.91-1.04.2-1.88,1.81-3.19,1.23l2.34-5.89,5.94-12.1c.18-.36.42-1.36.11-1.49s-.97-.45-1.55-.45l-30.61.32c-2.64.03-5.17.59-8.11-.31l24.66-3.99,13.32-2.67c.39-.08,0,1,.21,1.23.25.29.71.61,1.1.57Z"/>
|
||||||
|
<path class="cls-1" d="M213.84,323.29c.69.99.45,1.15-.19,1.78l-17.39,17.12c-3.16,3.11-6.44,5.57-9.4,9.05-.38.45-.97.07-1.39-.06l-.4-1.88c1.94-6.68,3.23-13.66,2.17-20.91-.22-1.52-.28-2.52.82-3.51.9-.81,1.78-.11,3.06-.13l14.27-.23c3.03-.05,5.64-1.6,8.45-1.22Z"/>
|
||||||
|
<path class="cls-3" d="M69.29,278.12c.52.08.69-.14.92-.03.63.32.97-.16.76-1.25,3.87,1.96,7.55,1.31,11.44,1.87l11.54-.04,16.48.56c.38.01.66.65.78.81.93,1.22-3.8.82-5.59,1.14l-30.23,5.39c-.61.87-1.15.42-1.48.62-.71.43-1.96.04-2.07-.83l.8-.58.55-.55-.55.55.55-.55c.13-.13.21-.35.38-.39.47-.12.74-1.1.12-1.45-.29-.17-.73,0-.96-1.07-.92-1.33-3.2-2.39-3.45-4.18Z"/>
|
||||||
|
<path class="cls-3" d="M145.75,353.91l-.55-.2c-1.16-.42-2.27-1.18-3.54-1.9-1.2-.68-1.89,1.02-2.51.94-1.01-.26-2.05-.49-3.6.38-.38-4.26,1.1-7.9,1.64-11.98l4.19-32.02c1.97.15.43.91.61,1.17.33.47.11,1.42.12,1.78l.38,23.49c.03,2.02.13,4.23.68,6.05l3.02,10.07c-1.11.7-.61,1.67-1,2.02l.55.2Z"/>
|
||||||
|
<path class="cls-2" d="M181.3,203.36c.18.94.09,1.76.6,2.46-2.6.64-2.24,3-3.09,4.69l-10.81,21.63c-1.69,3.38-2.35,7.1-5.27,10.02l2.13-9.75c1.71-7.83,3.31-13.12,3.15-21.63l2.15-.91c.09.12.09.4.12.6.19,1.19.46,2.37,1.32,3.3.37-.75,1.52-.99,1.94-1.77l3.72-6.88c.54-1,.67-1.36,1.64-1.89,1.02-.56,1.31-.09,2.4.14Z"/>
|
||||||
|
<path class="cls-3" d="M147.94,207.55l.57-.22-3.92,47.24c-.34-.16-.67-.01-.92-.02l.2-8.37-.8-17.66-1.11-13.13c-.15-1.82-2.26-5.09-1.72-9.19.2.02.38.14.56.21,2.24.82,4.78.99,7.14,1.13Z"/>
|
||||||
|
<path class="cls-2" d="M214.65,239.1c-.45,2.26-2.11,3.94-3.91,5.65-.84.16-1.05.39-1.13.79-.15.82.08,1.71,1.03,1.66.76-.04,1.5.2,2.23.54-.16.62.22,1.57-.21,2.2l-11.9,1.19-12.97,3.01c1.1-2.81,3.92-3.76,6.12-5.03l6.56-3.79c3.88-2.24,7.82-4.22,11.61-6.32l2.58.1Z"/>
|
||||||
|
<path class="cls-4" d="M99.04,299.48c.73-1.86-1.18-4.7-.42-8.75,3.57.13,3.51,3.2,4.17,5.51,1.68,5.83,8.07,8.33,13.82,7.94,4.9-.33,9.79-2.65,11.25-7.51,1.97-6.6-2.21-13.11-8.33-15.46l-12.22-4.68c-4.78-1.83-7.34-6.03-8.3-10.67-1.82-8.79,3.19-16.95,11.83-19.53,15.38-4.6,26.15,7.2,24.73,9.15-1.18,1.62-2.45-1.38-4.81-1.76l1.53,3.17c.29.6-.71,1.18-1.17,1.39-1.39.62-6.32-6.36-15-4.52-3.02.64-5.61,2.16-6.68,4.4-1.38,2.86-1.93,5.98-.09,8.51,3.33,4.59,12.93,5.53,20.09,10.13,6.77,4.34,10.89,11.82,9.31,19.96-1.96,10.18-11.36,16.52-21.53,16.96-6.25.27-11.61-1.04-16.54-4.87-4.35-3.38-7.47-7.95-7.43-14.01l3.47-.03,2.33,4.68Z"/>
|
||||||
|
<path class="cls-6" d="M168.83,303.16c11.35-.3,12.91-11.42,16.21-10.62.9.22,1.3,1.53.76,2.62l-1.93,3.85,1.48-.26c.88-.16-.02-.91.3-1.42.46-.73.9-.5,1.14-.58.4-.14-.37-.76-.09-1.03,7.01-6.62,2.58,10.66-11.29,15.14-7.97,2.58-16.35,1.27-22.41-3.63-4.76-3.85-6.8-9.53-8.36-15.03-2.51-8.9-.86-18.09,2.65-26.66,3.1-7.56,7.25-14.49,14.58-18.6,4.98-2.79,10.38-2.41,15.84.29,8.47,4.18,10.13,15.07,6.67,13.59-.52-.22-.52-1.27-.95-1.95-.16-.64-.27-.62-.26-.77.02-.36-.52-.95-.9-.33-.12.2.09,1.95.56,2.97-.19-.41-1.19,3.23-1.06,3.05-2.65,3.53-2.14-5.98-7.33-8.34-10.46-4.76-19.07,10.15-20.19,20.69-1.4,5.23-.84,10.52.88,15.55,1.55,6.36,6.74,11.66,13.68,11.47Z"/>
|
||||||
|
<path class="cls-2" d="M197.98,320.39c5.36.62,10.75.96,15.97,0l-.11,2.9c-2.81-.38-5.42,1.17-8.45,1.22l-14.27.23c-1.27.02-2.16-.67-3.06.13-1.1.99-1.04,1.99-.82,3.51,1.06,7.25-.23,14.24-2.17,20.91l-2.38.32c1.98-9.79-2.64-27.16-1.51-29.66.29-.65,1.43-1.35,2.59-1.21l14.21,1.65Z"/>
|
||||||
|
<path class="cls-3" d="M103.94,315c-.39,2.04-5.76,7.47-5.48,7.31-.63.36-1.3.44-2.27-.52l7.75-6.79Z"/>
|
||||||
|
<path class="cls-5" d="M210.64,247.2c.76-.04,1.5.2,2.23.54,1.11.52,3.9,1.16,3.71,3.1l-1.82,18.71c-1.5,1.84-3.42,2.56-4.11,4.45-.34,2.98,4.2,2.59,4.27,3.76l2.51,42.37c.1,1.67-2.35,3.33-3.58,3.16-2.81-.38-5.42,1.17-8.45,1.22l-14.27.23c-1.27.02-2.16-.67-3.06.13-1.1.99-1.04,1.99-.82,3.51,1.06,7.25-.23,14.24-2.17,20.91l.4,1.88c-.02,1.11-.76,2.05-1.49,2.86-.9,1-2.37.8-3.88.8l-24.17.07c-3.64.01-6.98.15-10.19-1.01l-.55-.2c-1.16-.42-2.27-1.18-3.54-1.9-1.2-.68-1.89,1.02-2.51.94-1.06.63-1.9,2.74-3.63,3-8.84,1.34-17.96,1.85-26.77.44l-13.88-3.27c-1.56-1.74-2.19-3.54-3.98-4.71l-6.41,7.6c-5.24-.33-10.27-1.31-15.49-2.21-2.15-4.26-.12-10.16-1.62-14.2-1.64-4.39-1.98-8.67-1.04-13.21,1.9-9.16,1.37-17.8.49-27.02-.43-4.52,3.2-9.56,5.02-12.83l.8-.58.55-.55c.13-.13.21-.35.38-.39"/>
|
||||||
|
<path class="cls-5" d="M172.5,214.73l-.9-.97c-.85-.92-1.12-2.1-1.32-3.3-.03-.2-.03-.48-.12-.6-.7-.95-.55-3.83-2.12-4.44l-19.53,1.91-.57.22c-2.36-.14-4.9-.31-7.14-1.13-.19-.07-.37-.18-.56-.21l-8.59-1.05-16.36,1.2c-8.38.62-16.38,1.23-24.8.67-3.03,1.4-6.08,2.17-9.33,1.63-7.26-2.24-12.54-4.74-12.92.43l-.97,13.21c-.36,4.92-.07,9.67,2.39,14.17-1.22,3.36.19,5.9,2.9,7.27"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 8.7 KiB |
325
src/apps/epic/static/apps/epic/role-select.js
Normal file
325
src/apps/epic/static/apps/epic/role-select.js
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
var RoleSelect = (function () {
|
||||||
|
// Set to true by handleTurnChanged so that a WS turn_changed that races
|
||||||
|
// ahead of the fetch response doesn't get overridden by Tray.open().
|
||||||
|
var _turnChangedBeforeFetch = false;
|
||||||
|
|
||||||
|
// Set to true while placeCard animation is running. handleTurnChanged
|
||||||
|
// defers its work until the animation completes.
|
||||||
|
var _animationPending = false;
|
||||||
|
var _pendingTurnChange = null;
|
||||||
|
|
||||||
|
// Delay before the tray animation begins (ms). Gives the gamer a moment
|
||||||
|
// to see their pick confirmed before the tray slides in. Set to 0 by
|
||||||
|
// _testReset() so Jasmine tests don't need jasmine.clock().
|
||||||
|
var _placeCardDelay = 3000;
|
||||||
|
|
||||||
|
// Delay after the tray closes before advancing to the next turn (ms).
|
||||||
|
// Gives the gamer a moment to see their confirmed seat before the turn moves.
|
||||||
|
var _postTrayDelay = 3000;
|
||||||
|
|
||||||
|
var ROLES = [
|
||||||
|
{ code: "SC", name: "Shepherd", element: "Air" },
|
||||||
|
{ code: "PC", name: "Player", element: "Fire" },
|
||||||
|
{ code: "NC", name: "Narrator", element: "Time" },
|
||||||
|
{ code: "AC", name: "Alchemist", element: "Water" },
|
||||||
|
{ code: "BC", name: "Builder", element: "Stone" },
|
||||||
|
{ code: "EC", name: "Economist", element: "Space" },
|
||||||
|
];
|
||||||
|
|
||||||
|
function getSelectRoleUrl() {
|
||||||
|
var el = document.querySelector("[data-select-role-url]");
|
||||||
|
return el ? el.dataset.selectRoleUrl : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCsrf() {
|
||||||
|
var m = document.cookie.match(/csrftoken=([^;]+)/);
|
||||||
|
return m ? m[1] : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeFan() {
|
||||||
|
var backdrop = document.querySelector(".role-select-backdrop");
|
||||||
|
if (backdrop) backdrop.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectRole(roleCode) {
|
||||||
|
_turnChangedBeforeFetch = false; // fresh selection, reset the race flag
|
||||||
|
closeFan();
|
||||||
|
|
||||||
|
// Show the tray handle — gamer confirmed a pick, tray animation about to run
|
||||||
|
var trayWrap = document.getElementById("id_tray_wrap");
|
||||||
|
if (trayWrap) trayWrap.classList.remove("role-select-phase");
|
||||||
|
|
||||||
|
// Immediately lock the stack — do not wait for WS turn_changed
|
||||||
|
var stack = document.querySelector(".card-stack[data-starter-roles]");
|
||||||
|
if (stack) {
|
||||||
|
stack.dataset.state = "ineligible";
|
||||||
|
stack.removeEventListener("click", openFan);
|
||||||
|
var current = stack.dataset.starterRoles;
|
||||||
|
stack.dataset.starterRoles = current ? current + "," + roleCode : roleCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mark seat as actively being claimed (glow state) and swap ban → check immediately
|
||||||
|
var activePos = document.querySelector('.table-seat[data-role="' + roleCode + '"]');
|
||||||
|
if (activePos) {
|
||||||
|
activePos.classList.add('active');
|
||||||
|
var ban = activePos.querySelector('.fa-ban');
|
||||||
|
if (ban) { ban.classList.remove('fa-ban'); ban.classList.add('fa-circle-check'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Immediately fade out the gate-slot circle for the current turn's slot
|
||||||
|
var activeSlot = stack ? stack.dataset.activeSlot : null;
|
||||||
|
if (activeSlot) {
|
||||||
|
var slotCircle = document.querySelector('.gate-slot[data-slot="' + activeSlot + '"]');
|
||||||
|
if (slotCircle) slotCircle.classList.add('role-assigned');
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = getSelectRoleUrl();
|
||||||
|
if (!url) return;
|
||||||
|
|
||||||
|
// Block handleTurnChanged immediately — WS turn_changed can arrive while
|
||||||
|
// the fetch is in-flight and must be deferred until our animation completes.
|
||||||
|
_animationPending = true;
|
||||||
|
|
||||||
|
fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"X-CSRFToken": getCsrf(),
|
||||||
|
},
|
||||||
|
body: "role=" + encodeURIComponent(roleCode),
|
||||||
|
}).then(function (response) {
|
||||||
|
if (!response.ok) {
|
||||||
|
// Server rejected (role already taken) — undo optimistic update
|
||||||
|
_animationPending = false;
|
||||||
|
if (stack) {
|
||||||
|
stack.dataset.starterRoles = stack.dataset.starterRoles
|
||||||
|
.split(",").filter(function (r) { return r.trim() !== roleCode; }).join(",");
|
||||||
|
}
|
||||||
|
openFan();
|
||||||
|
} else {
|
||||||
|
// Animate the role card into the tray: open, arc-in, force-close.
|
||||||
|
// Any turn_changed that arrived while the fetch was in-flight is
|
||||||
|
// queued in _pendingTurnChange and will run after onComplete.
|
||||||
|
if (typeof Tray !== "undefined") {
|
||||||
|
setTimeout(function () {
|
||||||
|
Tray.placeCard(roleCode, function () {
|
||||||
|
// Swap ban → check, clear glow, mark seat as confirmed
|
||||||
|
var seatedPos = document.querySelector('.table-seat[data-role="' + roleCode + '"]');
|
||||||
|
if (seatedPos) {
|
||||||
|
seatedPos.classList.remove('active');
|
||||||
|
seatedPos.classList.add('role-confirmed');
|
||||||
|
}
|
||||||
|
// Hold _animationPending through the post-tray pause so any
|
||||||
|
// turn_changed WS event that arrives now is still deferred.
|
||||||
|
setTimeout(function () {
|
||||||
|
_animationPending = false;
|
||||||
|
if (_pendingTurnChange) {
|
||||||
|
var ev = _pendingTurnChange;
|
||||||
|
_pendingTurnChange = null;
|
||||||
|
handleTurnChanged(ev);
|
||||||
|
}
|
||||||
|
}, _postTrayDelay);
|
||||||
|
});
|
||||||
|
}, _placeCardDelay);
|
||||||
|
} else {
|
||||||
|
_animationPending = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStarterRoles() {
|
||||||
|
var stack = document.querySelector(".card-stack[data-starter-roles]");
|
||||||
|
if (!stack) return [];
|
||||||
|
var raw = stack.dataset.starterRoles;
|
||||||
|
return raw ? raw.split(",").map(function (s) { return s.trim(); }) : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function openFan() {
|
||||||
|
if (document.querySelector(".role-select-backdrop")) return;
|
||||||
|
|
||||||
|
var taken = getStarterRoles();
|
||||||
|
var available = ROLES.filter(function (r) { return taken.indexOf(r.code) === -1; });
|
||||||
|
|
||||||
|
var backdrop = document.createElement("div");
|
||||||
|
backdrop.className = "role-select-backdrop";
|
||||||
|
|
||||||
|
var modal = document.createElement("div");
|
||||||
|
modal.id = "id_role_select";
|
||||||
|
|
||||||
|
available.forEach(function (role) {
|
||||||
|
var card = document.createElement("div");
|
||||||
|
card.className = "card";
|
||||||
|
card.dataset.role = role.code;
|
||||||
|
|
||||||
|
var back = document.createElement("div");
|
||||||
|
back.className = "card-back";
|
||||||
|
back.textContent = "ROLE";
|
||||||
|
|
||||||
|
var front = document.createElement("div");
|
||||||
|
front.className = "card-front";
|
||||||
|
front.innerHTML = '<div class="card-role-name">' + role.name + "</div>";
|
||||||
|
|
||||||
|
card.appendChild(back);
|
||||||
|
card.appendChild(front);
|
||||||
|
|
||||||
|
card.addEventListener("mouseenter", function () {
|
||||||
|
card.classList.add("flipped");
|
||||||
|
});
|
||||||
|
card.addEventListener("mouseleave", function () {
|
||||||
|
if (!card.classList.contains("guard-active")) {
|
||||||
|
card.classList.remove("flipped");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
card.addEventListener("click", function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
card.classList.add("flipped");
|
||||||
|
card.classList.add("guard-active");
|
||||||
|
window.showGuard(
|
||||||
|
card,
|
||||||
|
"Start round 1<br>as " + role.name + " (" + role.code + ") …?",
|
||||||
|
function () { // confirm
|
||||||
|
card.classList.remove("guard-active");
|
||||||
|
selectRole(role.code);
|
||||||
|
},
|
||||||
|
function () { // dismiss (NVM / outside click)
|
||||||
|
card.classList.remove("guard-active");
|
||||||
|
card.classList.remove("flipped");
|
||||||
|
},
|
||||||
|
{ invertY: true } // modal grid: tooltip flies away from centre (upper→above, lower→below)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.appendChild(card);
|
||||||
|
});
|
||||||
|
|
||||||
|
backdrop.appendChild(modal);
|
||||||
|
backdrop.addEventListener("click", closeFan);
|
||||||
|
document.body.appendChild(backdrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
var stack = document.querySelector(".card-stack[data-state='eligible']");
|
||||||
|
if (!stack) return;
|
||||||
|
stack.addEventListener("click", openFan);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _reload = function () { window.location.reload(); };
|
||||||
|
|
||||||
|
function handleAllRolesFilled() {
|
||||||
|
var wrap = document.getElementById('id_pick_sigs_wrap');
|
||||||
|
if (wrap) wrap.style.display = '';
|
||||||
|
var stack = document.querySelector('.card-stack');
|
||||||
|
if (stack) stack.remove();
|
||||||
|
var trayWrap = document.getElementById('id_tray_wrap');
|
||||||
|
if (trayWrap) trayWrap.classList.remove('role-select-phase');
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSigSelectStarted() {
|
||||||
|
_reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleTurnChanged(event) {
|
||||||
|
// If a placeCard animation is running, defer until it completes.
|
||||||
|
if (_animationPending) {
|
||||||
|
_pendingTurnChange = event;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var active = String(event.detail.active_slot);
|
||||||
|
|
||||||
|
// Force-close tray instantly so it never obscures the next player's card-stack.
|
||||||
|
// Also set the race flag so the fetch .then() doesn't re-open if it arrives late.
|
||||||
|
_turnChangedBeforeFetch = true;
|
||||||
|
if (typeof Tray !== "undefined") Tray.forceClose();
|
||||||
|
|
||||||
|
// Hide tray handle until the next player confirms their pick
|
||||||
|
var trayWrap = document.getElementById("id_tray_wrap");
|
||||||
|
if (trayWrap) trayWrap.classList.add("role-select-phase");
|
||||||
|
|
||||||
|
// Clear any stale .active glow from hex seats
|
||||||
|
document.querySelectorAll('.table-seat.active').forEach(function (p) {
|
||||||
|
p.classList.remove('active');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sync seat icons from starter_roles so state persists without a reload
|
||||||
|
if (event.detail.starter_roles) {
|
||||||
|
var assignedRoles = event.detail.starter_roles;
|
||||||
|
document.querySelectorAll(".table-seat").forEach(function (seat) {
|
||||||
|
var role = seat.dataset.role;
|
||||||
|
if (assignedRoles.indexOf(role) !== -1) {
|
||||||
|
seat.classList.add("role-confirmed");
|
||||||
|
var ban = seat.querySelector(".fa-ban");
|
||||||
|
if (ban) { ban.classList.remove("fa-ban"); ban.classList.add("fa-circle-check"); }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Hide slot circles in turn order: slots 1..N done when N roles assigned
|
||||||
|
var assignedCount = assignedRoles.length;
|
||||||
|
document.querySelectorAll(".gate-slot[data-slot]").forEach(function (circle) {
|
||||||
|
if (parseInt(circle.dataset.slot, 10) <= assignedCount) {
|
||||||
|
circle.classList.add("role-assigned");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update active slot on the card stack so selectRole() can read it
|
||||||
|
var stack = document.querySelector(".card-stack[data-user-slots]");
|
||||||
|
if (stack) stack.dataset.activeSlot = active;
|
||||||
|
|
||||||
|
var stack = document.querySelector(".card-stack[data-user-slots]");
|
||||||
|
if (stack) {
|
||||||
|
// Sync starter-roles from server so the fan reflects actual DB state
|
||||||
|
if (event.detail.starter_roles) {
|
||||||
|
stack.dataset.starterRoles = event.detail.starter_roles.join(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update eligibility and ban icon together
|
||||||
|
var userSlots = stack.dataset.userSlots
|
||||||
|
? stack.dataset.userSlots.split(",") : [];
|
||||||
|
if (userSlots.indexOf(active) !== -1) {
|
||||||
|
stack.dataset.state = "eligible";
|
||||||
|
var ban = stack.querySelector(".fa-ban");
|
||||||
|
if (ban) ban.remove();
|
||||||
|
stack.removeEventListener("click", openFan);
|
||||||
|
stack.addEventListener("click", openFan);
|
||||||
|
} else {
|
||||||
|
stack.dataset.state = "ineligible";
|
||||||
|
stack.removeEventListener("click", openFan);
|
||||||
|
if (!stack.querySelector(".fa-ban")) {
|
||||||
|
var icon = document.createElement("i");
|
||||||
|
icon.className = "fa-solid fa-ban";
|
||||||
|
stack.appendChild(icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear any stale seat glow (JS-only; glow is only during tray animation)
|
||||||
|
document.querySelectorAll(".table-seat.active").forEach(function (s) {
|
||||||
|
s.classList.remove("active");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("room:role_select_start", init);
|
||||||
|
window.addEventListener("room:turn_changed", handleTurnChanged);
|
||||||
|
window.addEventListener("room:all_roles_filled", handleAllRolesFilled);
|
||||||
|
window.addEventListener("room:sig_select_started", handleSigSelectStarted);
|
||||||
|
|
||||||
|
if (document.readyState === "loading") {
|
||||||
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
|
} else {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
openFan: openFan,
|
||||||
|
closeFan: closeFan,
|
||||||
|
setReload: function (fn) { _reload = fn; },
|
||||||
|
// Testing hook — resets animation-pause state between Jasmine specs
|
||||||
|
_testReset: function () {
|
||||||
|
_animationPending = false;
|
||||||
|
_pendingTurnChange = null;
|
||||||
|
_placeCardDelay = 0;
|
||||||
|
_postTrayDelay = 0;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}());
|
||||||
128
src/apps/epic/static/apps/epic/room.js
Normal file
128
src/apps/epic/static/apps/epic/room.js
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
(function () {
|
||||||
|
var SCENE_W = 360, SCENE_H = 300;
|
||||||
|
|
||||||
|
function scaleTable() {
|
||||||
|
var scene = document.querySelector('.room-table-scene');
|
||||||
|
var container = document.getElementById('id_game_table');
|
||||||
|
if (!scene || !container) return;
|
||||||
|
var w = container.clientWidth, h = container.clientHeight;
|
||||||
|
if (!w || !h) return;
|
||||||
|
var scale = Math.min(w / SCENE_W, h / SCENE_H);
|
||||||
|
scene.style.transform = 'scale(' + scale + ')';
|
||||||
|
document.documentElement.style.setProperty('--table-scale', scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', scaleTable);
|
||||||
|
} else {
|
||||||
|
scaleTable();
|
||||||
|
}
|
||||||
|
window.addEventListener('resize', scaleTable);
|
||||||
|
window.addEventListener('resize:end', scaleTable);
|
||||||
|
}());
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
// Size the sig-select overlay so the card grid clears the tray handle
|
||||||
|
// (portrait: right strip 48px; landscape: bottom strip 48px) and any
|
||||||
|
// fixed gear/kit buttons that protrude further into the viewport.
|
||||||
|
// Mirrors the scaleTable() pattern — runs on load (after tray.js has
|
||||||
|
// positioned the tray) and on every resize.
|
||||||
|
function sizeSigModal() {
|
||||||
|
var overlay = document.querySelector('.sig-overlay');
|
||||||
|
if (!overlay) return;
|
||||||
|
|
||||||
|
var vw = window.innerWidth;
|
||||||
|
var vh = window.innerHeight;
|
||||||
|
var rightInset = 0;
|
||||||
|
var bottomInset = 0;
|
||||||
|
|
||||||
|
var isLandscape = vw > vh;
|
||||||
|
|
||||||
|
// Tray handle: portrait → vertical strip on right; landscape → tray is easily
|
||||||
|
// dismissed, so skip the bottomInset calculation (would over-shrink the modal).
|
||||||
|
var trayHandle = document.getElementById('id_tray_handle');
|
||||||
|
if (trayHandle && !isLandscape) {
|
||||||
|
var hr = trayHandle.getBoundingClientRect();
|
||||||
|
if (hr.width < hr.height) {
|
||||||
|
// Portrait: handle strips the right edge
|
||||||
|
rightInset = vw - hr.left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gear / kit buttons: update right inset if near right edge.
|
||||||
|
// In landscape they sit at bottom-right but are also dismissible — skip bottomInset.
|
||||||
|
document.querySelectorAll('.room-page > .gear-btn').forEach(function (btn) {
|
||||||
|
var br = btn.getBoundingClientRect();
|
||||||
|
if (br.right > vw - 30) {
|
||||||
|
rightInset = Math.max(rightInset, vw - br.left);
|
||||||
|
}
|
||||||
|
if (!isLandscape && br.bottom > vh - 30) {
|
||||||
|
bottomInset = Math.max(bottomInset, vh - br.top);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Landscape: right clears gear/kit buttons; bottom is fixed 60px for the
|
||||||
|
// kit-bag handle strip — tray is ignored so the stage has room to breathe.
|
||||||
|
// At ≥1800px the right sidebar doubles to 8rem so clear 128px.
|
||||||
|
if (isLandscape) {
|
||||||
|
var xlBreak = vw >= 1800;
|
||||||
|
rightInset = Math.max(rightInset, xlBreak ? 128 : 64);
|
||||||
|
bottomInset = 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
overlay.style.paddingRight = rightInset + 'px';
|
||||||
|
overlay.style.paddingBottom = bottomInset + 'px';
|
||||||
|
|
||||||
|
// Stage card: smaller of 40% stage width OR (80% stage height × 5/8 aspect).
|
||||||
|
// libsass can't handle cqw/cqh inside min(), so we compute it here.
|
||||||
|
var stageEl = overlay.querySelector('.sig-stage');
|
||||||
|
if (stageEl) {
|
||||||
|
var sw = stageEl.offsetWidth - 24; // subtract padding (0.75rem × 2)
|
||||||
|
var sh = stageEl.offsetHeight - 24;
|
||||||
|
if (sw > 0 && sh > 0) {
|
||||||
|
// Clamp between 90px (never tiny in landscape) and 160px (never
|
||||||
|
// dominant on very wide/tall viewports). In portrait, skip the
|
||||||
|
// floor so small modals still scale down naturally.
|
||||||
|
var cardW = Math.min(sw * 0.4, sh * 0.8 * 5 / 8, 160);
|
||||||
|
if (isLandscape) { cardW = Math.max(cardW, 90); }
|
||||||
|
overlay.style.setProperty('--sig-card-w', cardW + 'px');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', sizeSigModal);
|
||||||
|
window.addEventListener('resize', sizeSigModal);
|
||||||
|
window.addEventListener('resize:end', sizeSigModal);
|
||||||
|
}());
|
||||||
|
|
||||||
|
// Dispatch a custom 'resize:end' event 500 ms after the last 'resize' fires.
|
||||||
|
// scaleTable, sizeSigModal, and Tray._reposition all subscribe to it so they
|
||||||
|
// re-measure with settled viewport dimensions after rapid resize sequences.
|
||||||
|
(function () {
|
||||||
|
var t;
|
||||||
|
window.addEventListener('resize', function () {
|
||||||
|
clearTimeout(t);
|
||||||
|
t = setTimeout(function () { window.dispatchEvent(new Event('resize:end')); }, 500);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
const roomPage = document.querySelector('.room-page');
|
||||||
|
if (!roomPage) return;
|
||||||
|
|
||||||
|
const roomId = roomPage.dataset.roomId;
|
||||||
|
const wsScheme = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||||
|
const ws = new WebSocket(`${wsScheme}://${window.location.host}/ws/room/${roomId}/`);
|
||||||
|
window._roomSocket = ws; // exposed for sig-select.js hover broadcast
|
||||||
|
|
||||||
|
ws.onmessage = function (event) {
|
||||||
|
const data = JSON.parse(event.data);
|
||||||
|
window.dispatchEvent(new CustomEvent('room:' + data.type, { detail: data }));
|
||||||
|
};
|
||||||
|
|
||||||
|
ws.onclose = function (event) {
|
||||||
|
if (!event.wasClean) {
|
||||||
|
console.warn('Room WebSocket closed unexpectedly');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}());
|
||||||
477
src/apps/epic/static/apps/epic/sig-select.js
Normal file
477
src/apps/epic/static/apps/epic/sig-select.js
Normal file
@@ -0,0 +1,477 @@
|
|||||||
|
var SigSelect = (function () {
|
||||||
|
// Polarity → three roles in fixed left/mid/right cursor order
|
||||||
|
var POLARITY_ROLES = {
|
||||||
|
levity: ['PC', 'NC', 'SC'],
|
||||||
|
gravity: ['BC', 'EC', 'AC'],
|
||||||
|
};
|
||||||
|
|
||||||
|
var overlay, deckGrid, stage, stageCard, statBlock;
|
||||||
|
var cautionEl, cautionEffect, cautionPrev, cautionNext, cautionIndexEl;
|
||||||
|
var _flipBtn, _cautionBtn, _flipOrigLabel, _cautionOrigLabel;
|
||||||
|
var reserveUrl, userRole, userPolarity;
|
||||||
|
|
||||||
|
var _cautionData = [];
|
||||||
|
var _cautionIdx = 0;
|
||||||
|
|
||||||
|
var _focusedCardEl = null; // card currently shown in stage
|
||||||
|
var _reservedCardId = null; // card with active reservation
|
||||||
|
var _stageFrozen = false; // true after OK — stage locks on reserved card
|
||||||
|
var _requestInFlight = false;
|
||||||
|
|
||||||
|
var _floatingCursors = {}; // key: cardId+posClass → portal <i> element (hover)
|
||||||
|
var _reservedFloats = {}; // key: role → portal <i> element (thumbs-up, frozen)
|
||||||
|
var _cursorPortal = null;
|
||||||
|
|
||||||
|
function getCsrf() {
|
||||||
|
var m = document.cookie.match(/csrftoken=([^;]+)/);
|
||||||
|
return m ? m[1] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Stage ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function _populateKeywordList(listEl, csv) {
|
||||||
|
var keywords = csv ? csv.split(',').filter(Boolean) : [];
|
||||||
|
listEl.innerHTML = keywords.map(function (k) {
|
||||||
|
return '<li>' + k.trim() + '</li>';
|
||||||
|
}).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Caution tooltip ───────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function _renderCaution() {
|
||||||
|
if (_cautionData.length === 0) {
|
||||||
|
cautionEffect.innerHTML = '<em>Rival interactions pending.</em>';
|
||||||
|
cautionPrev.disabled = true;
|
||||||
|
cautionNext.disabled = true;
|
||||||
|
cautionIndexEl.textContent = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cautionEffect.innerHTML = _cautionData[_cautionIdx];
|
||||||
|
cautionPrev.disabled = (_cautionData.length <= 1);
|
||||||
|
cautionNext.disabled = (_cautionData.length <= 1);
|
||||||
|
cautionIndexEl.textContent = _cautionData.length > 1
|
||||||
|
? (_cautionIdx + 1) + ' / ' + _cautionData.length
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function _openCaution() {
|
||||||
|
if (!_focusedCardEl) return;
|
||||||
|
try {
|
||||||
|
_cautionData = JSON.parse(_focusedCardEl.dataset.cautions || '[]');
|
||||||
|
} catch (e) {
|
||||||
|
_cautionData = [];
|
||||||
|
}
|
||||||
|
_cautionIdx = 0;
|
||||||
|
_renderCaution();
|
||||||
|
_flipBtn.classList.add('btn-disabled');
|
||||||
|
_cautionBtn.classList.add('btn-disabled');
|
||||||
|
_flipBtn.textContent = '\u00D7';
|
||||||
|
_cautionBtn.textContent = '\u00D7';
|
||||||
|
stage.classList.add('sig-caution-open');
|
||||||
|
}
|
||||||
|
|
||||||
|
function _closeCaution() {
|
||||||
|
stage.classList.remove('sig-caution-open');
|
||||||
|
if (_flipBtn) {
|
||||||
|
_flipBtn.classList.remove('btn-disabled');
|
||||||
|
_cautionBtn.classList.remove('btn-disabled');
|
||||||
|
_flipBtn.textContent = _flipOrigLabel;
|
||||||
|
_cautionBtn.textContent = _cautionOrigLabel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateStage(cardEl) {
|
||||||
|
if (_stageFrozen) return;
|
||||||
|
_closeCaution();
|
||||||
|
if (!cardEl) {
|
||||||
|
stageCard.style.display = 'none';
|
||||||
|
stage.classList.remove('sig-stage--active');
|
||||||
|
_focusedCardEl = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_focusedCardEl = cardEl;
|
||||||
|
|
||||||
|
var rank = cardEl.dataset.cornerRank || '';
|
||||||
|
var icon = cardEl.dataset.suitIcon || '';
|
||||||
|
var group = cardEl.dataset.nameGroup || '';
|
||||||
|
var title = cardEl.dataset.nameTitle || '';
|
||||||
|
var arcana= cardEl.dataset.arcana || '';
|
||||||
|
var corr = cardEl.dataset.correspondence || '';
|
||||||
|
|
||||||
|
stageCard.querySelectorAll('.fan-corner-rank').forEach(function (el) { el.textContent = rank; });
|
||||||
|
stageCard.querySelectorAll('.stage-suit-icon').forEach(function (el) {
|
||||||
|
if (icon) {
|
||||||
|
el.className = 'fa-solid ' + icon + ' stage-suit-icon';
|
||||||
|
el.style.display = '';
|
||||||
|
} else {
|
||||||
|
el.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
stageCard.querySelector('.fan-card-name-group').textContent = group;
|
||||||
|
stageCard.querySelector('.fan-card-arcana').textContent = arcana;
|
||||||
|
stageCard.querySelector('.fan-card-correspondence').textContent = ''; // shown in game-kit only
|
||||||
|
|
||||||
|
var qualifier = userPolarity === 'levity' ? 'Leavened' : 'Graven';
|
||||||
|
var isMajor = arcana.toLowerCase().indexOf('major') !== -1;
|
||||||
|
// Major arcana: qualifier sits below the title — append comma so it reads as a subtitle.
|
||||||
|
stageCard.querySelector('.fan-card-name').textContent = isMajor ? title + ',' : title;
|
||||||
|
stageCard.querySelector('.sig-qualifier-above').textContent = isMajor ? '' : qualifier;
|
||||||
|
stageCard.querySelector('.sig-qualifier-below').textContent = isMajor ? qualifier : '';
|
||||||
|
|
||||||
|
// Populate stat block keyword faces and reset to upright
|
||||||
|
statBlock.classList.remove('is-reversed');
|
||||||
|
_populateKeywordList(
|
||||||
|
statBlock.querySelector('#id_stat_keywords_upright'),
|
||||||
|
cardEl.dataset.keywordsUpright
|
||||||
|
);
|
||||||
|
_populateKeywordList(
|
||||||
|
statBlock.querySelector('#id_stat_keywords_reversed'),
|
||||||
|
cardEl.dataset.keywordsReversed
|
||||||
|
);
|
||||||
|
|
||||||
|
stageCard.style.display = '';
|
||||||
|
stage.classList.add('sig-stage--active');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Focus a card (click/tap) — shows OK overlay on the card ──────────
|
||||||
|
|
||||||
|
function focusCard(cardEl) {
|
||||||
|
deckGrid.querySelectorAll('.sig-card.sig-focused').forEach(function (c) {
|
||||||
|
if (c !== cardEl) c.classList.remove('sig-focused');
|
||||||
|
});
|
||||||
|
cardEl.classList.add('sig-focused');
|
||||||
|
updateStage(cardEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Hover events ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function onCardEnter(e) {
|
||||||
|
var card = e.currentTarget;
|
||||||
|
if (!_stageFrozen) updateStage(card);
|
||||||
|
sendHover(card.dataset.cardId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onCardLeave(e) {
|
||||||
|
if (!_stageFrozen) updateStage(null);
|
||||||
|
sendHover(e.currentTarget.dataset.cardId, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Reserve / release ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function doReserve(cardEl) {
|
||||||
|
if (_requestInFlight) return;
|
||||||
|
var cardId = cardEl.dataset.cardId;
|
||||||
|
_requestInFlight = true;
|
||||||
|
fetch(reserveUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'X-CSRFToken': getCsrf() },
|
||||||
|
body: 'action=reserve&card_id=' + encodeURIComponent(cardId),
|
||||||
|
}).then(function (res) {
|
||||||
|
_requestInFlight = false;
|
||||||
|
if (res.ok) applyReservation(cardId, userRole, true);
|
||||||
|
}).catch(function () { _requestInFlight = false; });
|
||||||
|
}
|
||||||
|
|
||||||
|
function doRelease() {
|
||||||
|
if (_requestInFlight || !_reservedCardId) return;
|
||||||
|
var cardId = _reservedCardId;
|
||||||
|
_requestInFlight = true;
|
||||||
|
fetch(reserveUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'X-CSRFToken': getCsrf() },
|
||||||
|
body: 'action=release&card_id=' + encodeURIComponent(cardId),
|
||||||
|
}).then(function (res) {
|
||||||
|
_requestInFlight = false;
|
||||||
|
if (res.ok) applyReservation(cardId, userRole, false);
|
||||||
|
}).catch(function () { _requestInFlight = false; });
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Apply reservation state (local + from WS) ─────────────────────────
|
||||||
|
|
||||||
|
function _placeReservedFloat(cardId, cardEl, role) {
|
||||||
|
// Remove any pre-existing reserved float for this role (e.g. page-load replay)
|
||||||
|
if (_reservedFloats[role]) { _reservedFloats[role].remove(); }
|
||||||
|
|
||||||
|
// Retire ALL hover floats for this role — may be on a different card than reserved
|
||||||
|
var roles = POLARITY_ROLES[userPolarity] || [];
|
||||||
|
var idx = roles.indexOf(role);
|
||||||
|
var posClass = ['--left', '--mid', '--right'][idx] || '--left';
|
||||||
|
Object.keys(_floatingCursors).forEach(function (key) {
|
||||||
|
if (key.slice(-posClass.length) === posClass) {
|
||||||
|
_floatingCursors[key].remove();
|
||||||
|
var hCid = key.slice(0, key.length - posClass.length);
|
||||||
|
var hEl = deckGrid.querySelector('.sig-card[data-card-id="' + hCid + '"]');
|
||||||
|
if (hEl) {
|
||||||
|
var a = hEl.querySelector('.sig-cursor' + posClass);
|
||||||
|
if (a) a.classList.remove('active');
|
||||||
|
}
|
||||||
|
delete _floatingCursors[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var rect = cardEl.getBoundingClientRect();
|
||||||
|
var xFractions = [0.15, 0.5, 0.85];
|
||||||
|
var fc = document.createElement('i');
|
||||||
|
fc.className = 'fa-solid fa-thumbs-up sig-cursor-float sig-cursor-float--reserved';
|
||||||
|
fc.dataset.role = role;
|
||||||
|
fc.style.left = (rect.left + rect.width * xFractions[idx < 0 ? 1 : idx]) + 'px';
|
||||||
|
fc.style.top = rect.bottom + 'px';
|
||||||
|
_ensureCursorPortal().appendChild(fc);
|
||||||
|
_reservedFloats[role] = fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyReservation(cardId, role, reserved) {
|
||||||
|
var cardEl = deckGrid.querySelector('.sig-card[data-card-id="' + cardId + '"]');
|
||||||
|
if (!cardEl) return;
|
||||||
|
|
||||||
|
if (reserved) {
|
||||||
|
cardEl.dataset.reservedBy = role;
|
||||||
|
cardEl.classList.add('sig-reserved');
|
||||||
|
if (role === userRole) {
|
||||||
|
_reservedCardId = cardId;
|
||||||
|
cardEl.classList.add('sig-reserved--own');
|
||||||
|
cardEl.classList.remove('sig-focused');
|
||||||
|
// Freeze stage on this card (temporarily unfreeze to populate it)
|
||||||
|
_stageFrozen = false;
|
||||||
|
updateStage(cardEl);
|
||||||
|
_stageFrozen = true;
|
||||||
|
stage.classList.add('sig-stage--frozen');
|
||||||
|
}
|
||||||
|
// Thumbs-up float for all reservations — own role sees their own indicator too
|
||||||
|
_placeReservedFloat(cardId, cardEl, role);
|
||||||
|
} else {
|
||||||
|
delete cardEl.dataset.reservedBy;
|
||||||
|
cardEl.classList.remove('sig-reserved', 'sig-reserved--own');
|
||||||
|
if (role === userRole) {
|
||||||
|
_reservedCardId = null;
|
||||||
|
_stageFrozen = false;
|
||||||
|
stage.classList.remove('sig-stage--frozen');
|
||||||
|
}
|
||||||
|
// Remove thumbs-up float for all releases — own role included
|
||||||
|
if (_reservedFloats[role]) {
|
||||||
|
_reservedFloats[role].remove();
|
||||||
|
delete _reservedFloats[role];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Apply hover cursor (WS only — own hover is CSS :hover) ────────────
|
||||||
|
//
|
||||||
|
// Cursor icons are portaled to document root so they escape overflow/clip
|
||||||
|
// contexts in the deck grid. The in-card anchor elements only carry the
|
||||||
|
// .active class (for test assertions and the :has() z-index rule).
|
||||||
|
|
||||||
|
function _ensureCursorPortal() {
|
||||||
|
if (!_cursorPortal || !document.body.contains(_cursorPortal)) {
|
||||||
|
_cursorPortal = document.getElementById('id_sig_cursor_portal');
|
||||||
|
if (!_cursorPortal) {
|
||||||
|
_cursorPortal = document.createElement('div');
|
||||||
|
_cursorPortal.id = 'id_sig_cursor_portal';
|
||||||
|
document.body.appendChild(_cursorPortal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _cursorPortal;
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyHover(cardId, role, active) {
|
||||||
|
if (role === userRole) return;
|
||||||
|
if (_reservedFloats[role]) return; // role already has thumbs-up — ignore hover
|
||||||
|
var cardEl = deckGrid.querySelector('.sig-card[data-card-id="' + cardId + '"]');
|
||||||
|
if (!cardEl) return;
|
||||||
|
|
||||||
|
var roles = POLARITY_ROLES[userPolarity] || [];
|
||||||
|
var idx = roles.indexOf(role);
|
||||||
|
var posClass = ['--left', '--mid', '--right'][idx] || '--left';
|
||||||
|
var anchor = cardEl.querySelector('.sig-cursor' + posClass);
|
||||||
|
if (!anchor) return;
|
||||||
|
|
||||||
|
var key = cardId + posClass;
|
||||||
|
|
||||||
|
if (active) {
|
||||||
|
anchor.classList.add('active'); // kept for test assertions + :has() z-index
|
||||||
|
|
||||||
|
// Place a fixed-position clone in the portal, positioned from card bounds
|
||||||
|
var rect = cardEl.getBoundingClientRect();
|
||||||
|
var xFractions = [0.15, 0.5, 0.85];
|
||||||
|
var fc = document.createElement('i');
|
||||||
|
fc.className = 'fa-solid fa-hand-pointer sig-cursor-float';
|
||||||
|
fc.dataset.role = role;
|
||||||
|
fc.style.left = (rect.left + rect.width * xFractions[idx]) + 'px';
|
||||||
|
fc.style.top = rect.bottom + 'px';
|
||||||
|
_ensureCursorPortal().appendChild(fc);
|
||||||
|
_floatingCursors[key] = fc;
|
||||||
|
} else {
|
||||||
|
anchor.classList.remove('active');
|
||||||
|
if (_floatingCursors[key]) {
|
||||||
|
_floatingCursors[key].remove();
|
||||||
|
delete _floatingCursors[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── WS events ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
window.addEventListener('room:sig_reserved', function (e) {
|
||||||
|
if (!deckGrid) return;
|
||||||
|
applyReservation(String(e.detail.card_id), e.detail.role, e.detail.reserved);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('room:sig_hover', function (e) {
|
||||||
|
if (!deckGrid) return;
|
||||||
|
applyHover(String(e.detail.card_id), e.detail.role, e.detail.active);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ── WS send ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function sendHover(cardId, active) {
|
||||||
|
if (!window._roomSocket || window._roomSocket.readyState !== WebSocket.OPEN) return;
|
||||||
|
window._roomSocket.send(JSON.stringify({
|
||||||
|
type: 'sig_hover', card_id: cardId, role: userRole, active: active,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Init ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
overlay = document.querySelector('.sig-overlay');
|
||||||
|
if (!overlay) return;
|
||||||
|
|
||||||
|
deckGrid = overlay.querySelector('.sig-deck-grid');
|
||||||
|
stage = overlay.querySelector('.sig-stage');
|
||||||
|
stageCard = stage.querySelector('.sig-stage-card');
|
||||||
|
statBlock = stage.querySelector('.sig-stat-block');
|
||||||
|
|
||||||
|
_flipBtn = statBlock.querySelector('.sig-flip-btn');
|
||||||
|
_cautionBtn = statBlock.querySelector('.sig-caution-btn');
|
||||||
|
_flipOrigLabel = _flipBtn.textContent;
|
||||||
|
_cautionOrigLabel = _cautionBtn.textContent;
|
||||||
|
|
||||||
|
_flipBtn.addEventListener('click', function () {
|
||||||
|
if (_flipBtn.classList.contains('btn-disabled')) return;
|
||||||
|
statBlock.classList.toggle('is-reversed');
|
||||||
|
});
|
||||||
|
|
||||||
|
cautionEl = stage.querySelector('.sig-caution-tooltip');
|
||||||
|
cautionEffect = cautionEl.querySelector('.sig-caution-effect');
|
||||||
|
cautionPrev = statBlock.querySelector('.sig-caution-prev');
|
||||||
|
cautionNext = statBlock.querySelector('.sig-caution-next');
|
||||||
|
cautionIndexEl = cautionEl.querySelector('.sig-caution-index');
|
||||||
|
|
||||||
|
// Clicking the tooltip (not nav buttons) dismisses it
|
||||||
|
cautionEl.addEventListener('click', function () {
|
||||||
|
_closeCaution();
|
||||||
|
});
|
||||||
|
|
||||||
|
_cautionBtn.addEventListener('click', function () {
|
||||||
|
if (_cautionBtn.classList.contains('btn-disabled')) return;
|
||||||
|
stage.classList.contains('sig-caution-open') ? _closeCaution() : _openCaution();
|
||||||
|
});
|
||||||
|
cautionPrev.addEventListener('click', function () {
|
||||||
|
_cautionIdx = (_cautionIdx - 1 + _cautionData.length) % _cautionData.length;
|
||||||
|
_renderCaution();
|
||||||
|
});
|
||||||
|
cautionNext.addEventListener('click', function () {
|
||||||
|
_cautionIdx = (_cautionIdx + 1) % _cautionData.length;
|
||||||
|
_renderCaution();
|
||||||
|
});
|
||||||
|
|
||||||
|
reserveUrl = overlay.dataset.reserveUrl;
|
||||||
|
userRole = overlay.dataset.userRole;
|
||||||
|
userPolarity= overlay.dataset.polarity;
|
||||||
|
|
||||||
|
// Restore reservations from server-rendered JSON (page-load state).
|
||||||
|
// Deferred to 'load' so sizeSigModal() (also a 'load' listener, registered
|
||||||
|
// in room.js before this script) has already applied paddingBottom and
|
||||||
|
// --sig-card-w before _placeReservedFloat calls getBoundingClientRect().
|
||||||
|
try {
|
||||||
|
var existing = JSON.parse(overlay.dataset.reservations || '{}');
|
||||||
|
if (Object.keys(existing).length) {
|
||||||
|
var _replayReservations = function () {
|
||||||
|
Object.keys(existing).forEach(function (cardId) {
|
||||||
|
applyReservation(cardId, existing[cardId], true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
if (document.readyState === 'complete') {
|
||||||
|
_replayReservations();
|
||||||
|
} else {
|
||||||
|
window.addEventListener('load', _replayReservations, { once: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) { /* malformed JSON — ignore */ }
|
||||||
|
|
||||||
|
// Hover: update stage preview + broadcast cursor
|
||||||
|
deckGrid.querySelectorAll('.sig-card').forEach(function (card) {
|
||||||
|
card.addEventListener('mouseenter', onCardEnter);
|
||||||
|
card.addEventListener('mouseleave', onCardLeave);
|
||||||
|
card.addEventListener('touchstart', function (e) {
|
||||||
|
var card = e.currentTarget;
|
||||||
|
if (_reservedCardId) return; // locked until NVM — no preventDefault either
|
||||||
|
var reservedByOther = card.dataset.reservedBy && card.dataset.reservedBy !== userRole;
|
||||||
|
var isOwnReserved = card.classList.contains('sig-reserved--own');
|
||||||
|
if (reservedByOther || isOwnReserved) return;
|
||||||
|
// If the tap is on the OK button, let the synthetic click fire normally
|
||||||
|
if (e.target.closest('.sig-ok-btn')) return;
|
||||||
|
focusCard(card);
|
||||||
|
e.preventDefault(); // prevent ghost click on card body
|
||||||
|
}, { passive: false });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Touch outside the grid — dismiss stage preview (unfocused state only).
|
||||||
|
// Card touchstart doesn't stop propagation, so we guard with closest().
|
||||||
|
overlay.addEventListener('touchstart', function (e) {
|
||||||
|
if (_stageFrozen || !_focusedCardEl) return;
|
||||||
|
if (e.target.closest('.sig-deck-grid')) return;
|
||||||
|
deckGrid.querySelectorAll('.sig-card.sig-focused').forEach(function (c) {
|
||||||
|
c.classList.remove('sig-focused');
|
||||||
|
});
|
||||||
|
updateStage(null);
|
||||||
|
}, { passive: true });
|
||||||
|
|
||||||
|
// Click delegation: card body → focus (shows OK); OK/NVM buttons → reserve/release
|
||||||
|
deckGrid.addEventListener('click', function (e) {
|
||||||
|
if (e.target.closest('.sig-ok-btn')) {
|
||||||
|
if (_reservedCardId) return; // already holding — must NVM first
|
||||||
|
var card = e.target.closest('.sig-card');
|
||||||
|
if (card) doReserve(card);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.target.closest('.sig-nvm-btn')) {
|
||||||
|
doRelease();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var card = e.target.closest('.sig-card');
|
||||||
|
if (!card) return;
|
||||||
|
if (_reservedCardId) return; // locked until NVM
|
||||||
|
var reservedByOther = card.dataset.reservedBy && card.dataset.reservedBy !== userRole;
|
||||||
|
var isOwnReserved = card.classList.contains('sig-reserved--own');
|
||||||
|
if (reservedByOther || isOwnReserved) return;
|
||||||
|
focusCard(card);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', init);
|
||||||
|
} else {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Test API ──────────────────────────────────────────────────────────
|
||||||
|
return {
|
||||||
|
_testInit: function () {
|
||||||
|
_focusedCardEl = null;
|
||||||
|
_reservedCardId = null;
|
||||||
|
_stageFrozen = false;
|
||||||
|
_requestInFlight = false;
|
||||||
|
_cautionData = [];
|
||||||
|
_cautionIdx = 0;
|
||||||
|
Object.keys(_floatingCursors).forEach(function (k) { _floatingCursors[k].remove(); });
|
||||||
|
_floatingCursors = {};
|
||||||
|
Object.keys(_reservedFloats).forEach(function (k) { _reservedFloats[k].remove(); });
|
||||||
|
_reservedFloats = {};
|
||||||
|
_cursorPortal = null;
|
||||||
|
init();
|
||||||
|
},
|
||||||
|
_setFrozen: function (v) { _stageFrozen = v; },
|
||||||
|
_setReservedCardId: function (id) { _reservedCardId = id; },
|
||||||
|
};
|
||||||
|
}());
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user