Files
cobblemon-ui/cobblemon.md

32 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Cobblemon UI — Project Reference
## Stack
Phoenix 1.8 LiveView app (Elixir). Dark mode daisyUI. Docker dev setup with SSHFS mount to remote Minecraft server.
## Data Source
`.cobblemon-data/` — SSHFS mount of remote Minecraft server root (`dev.sh` mounts it). Mounted into Docker container at `/cobblemon-data`.
### Key server files
- `usercache.json` — JSON array of `{"name", "uuid", "expiresOn"}`. Maps UUIDs to player names.
- `world/pokemon/playerpartystore/<2-char-prefix>/<uuid>.dat` — NBT binary, player's party (6 slots).
- `world/pokemon/pcstore/<2-char-prefix>/<uuid>.dat` — NBT binary, player's PC boxes (30 boxes × 30 slots).
- `world/playerdata/<uuid>.dat` — vanilla Minecraft player data (not currently parsed).
**Important:** `.dat` files use 2-character UUID prefix subdirectories (e.g. `54/54e75a91-...dat`).
## App Modules
### `lib/cobblemon_ui/cobblemon_fs/`
- `cobblemon_fs.ex` — GenServer. Cached player data access. Reads from `/cobblemon-data`. Parses `usercache.json` for names. API: `list_players/0`, `get_player/1`, `get_party/1`, `get_pc/1`, `get_pokemon/2`.
- `nbt.ex` — Pure Elixir NBT decoder. Handles gzip + uncompressed. All 13 tag types.
- `pokemon.ex` — Normalizes raw NBT compound → `%{species, level, form, shiny, nature, gender, ivs, evs, moves, ...}`.
- `party_store.ex` — Parses party `.dat` → list of 6 pokemon slots.
- `pc_store.ex` — Parses PC `.dat` → list of `%{box: n, pokemon: [...]}`.
### `lib/cobblemon_ui_web/live/`
- `dashboard_live.ex` — Main LiveView. Player sidebar (names from usercache), party/PC tabs, pokemon detail panel with IV/EV bars.
### Config
- `docker-compose.yml` — Dev container. Bind mounts `.cobblemon-data``/cobblemon-data` (needs `allow_other` SSHFS).
- `dev.sh` — SSHFS mount script for `.cobblemon-data`.