Files
memory-infrastructure-palace/docs/projects/Pokedex.Online/setup/gamemaster-setup.md

125 lines
5.0 KiB
Markdown

# Gamemaster Data System - Implementation Summary
## What Was Built
You now have a complete system for managing and sharing Pokemon GO gamemaster data across all apps on your site:
### 1. **Gamemaster API Server** (`server/gamemaster-api.js`)
- **7 REST endpoints** for accessing gamemaster data
- **POST /api/gamemaster/save** - Save processed data from GamemasterManager
- **GET endpoints** for pokemon, moves, raw data, and status
- **File storage** in `/server/data/gamemaster/`
- Automatic error handling and validation
### 2. **GamemasterClient** (`src/utilities/gamemaster-client.js`)
- **JavaScript client library** for accessing the API
- **Caching support** to avoid repeated requests
- **Helper methods** like `getPokemonById()` and `getMoveById()`
- **File download support** for direct browser downloads
- Works in any Vue component or JavaScript app
### 3. **Updated GamemasterManager** (`src/views/GamemasterManager.vue`)
- **New "Save to Server" button** to persist data
- **Server status section** showing available files and sizes
- **Real-time updates** after saving
- **Complete workflow**: Fetch → Process → Save → Share
### 4. **Comprehensive Documentation** (`GAMEMASTER_API.md`)
- **Full API reference** with examples
- **Client library usage guide**
- **Setup instructions**
- **Troubleshooting tips**
## Architecture
```
┌─────────────────────────────────────────────┐
│ GamemasterManager (UI) │
│ Fetch → Process → Save to Server │
└────────────────────┬────────────────────────┘
┌──────────────────────────────┐
│ Gamemaster API Server │
│ /api/gamemaster/* │
│ - Endpoints for all data │
│ - File storage/retrieval │
└────────────────┬─────────────┘
┌────────────┴────────────┐
│ │
▼ ▼
┌────────────────┐ ┌──────────────────┐
│ File Storage │ │ Other Apps │
│ /server/data/ │ │ Use GamemasterC │
│ /gamemaster │ │ Client │
└────────────────┘ └──────────────────┘
```
## How to Use
### Generate and Save Data
1. Go to `/gamemaster` in your app
2. Click "Fetch from PokeMiners"
3. Click "Process & Break Up Data"
4. Click "Save All Files to Server"
5. Data is now available to all apps
### Access from Any App
```javascript
import { gamemasterClient } from '@/utilities/gamemaster-client.js';
// Get filtered pokemon
const pokemon = await gamemasterClient.getPokemon();
// Get all forms (with costumes, events, shadows)
const allForms = await gamemasterClient.getAllForms();
// Get all moves
const moves = await gamemasterClient.getMoves();
// Check what's available
const status = await gamemasterClient.getStatus();
```
## Files Created/Modified
### New Files
- `server/gamemaster-api.js` - API server
- `server/data/gamemaster/` - Data storage directory
- `src/utilities/gamemaster-client.js` - Client library
- `GAMEMASTER_API.md` - Full documentation
### Modified Files
- `src/views/GamemasterManager.vue` - Added save/status features
- `server/oauth-proxy.js` - Integrated gamemaster API
- `README.md` - Updated with new features and workflow
## Key Features
**Centralized Data Storage** - One source of truth for gamemaster data
**Multiple Datasets** - Filtered and unmodified versions
**Real-time Access** - Any app can access latest data immediately
**Caching** - Client-side caching for performance
**Status Monitoring** - See what files are available and when they were updated
**Direct Downloads** - Download files from server or browser
**Error Handling** - Graceful fallbacks when data unavailable
**CORS Enabled** - Works across all apps on your site
## Data Types Available
1. **pokemon.json** - Base Pokemon + regional variants (Alola, Galarian, Hisuian, Paldea)
2. **pokemon-allFormsCostumes.json** - Complete dataset with all variants, costumes, shadows, events
3. **pokemon-moves.json** - All quick and charged moves
4. **latest-raw.json** - Unmodified gamemaster data from PokeMiners
## Next Steps
You can now:
- Build new Pokemon tools that use the centralized data
- Create forms/filters based on gamemaster data
- Share pokemon/move lookups across multiple pages
- Keep data in sync when PokeMiners releases updates
Just import the `GamemasterClient` and start using it!