# Quick Reference: RR3 Asset Extraction ## When Assets Arrive From Discord ### Step 1: Extract .z Files (Linux/Unix) ```bash cd RR3CommunityServer/Tools chmod +x batch_extract_z_assets.sh ./batch_extract_z_assets.sh /path/to/discord/assets /path/to/extracted ``` ### Step 2: Extract .z Files (Windows) ```powershell cd RR3CommunityServer\Tools .\extract_z_asset.ps1 -InputFile "C:\discord\assets\sprites_0.etc.dds.z" ``` ### Step 3: List All Extracted Files ```bash ls -lh /path/to/extracted/*.dds ``` ### Step 4: Import to Server Database ```bash cd RR3CommunityServer/RR3CommunityServer dotnet run # Use API to list assets curl http://localhost:5143/api/AssetManagement/list ``` ## Common Commands ### Extract Single File ```bash # Linux/Unix ./extract_z_asset.sh sprites_0.etc.dds.z # Windows .\extract_z_asset.ps1 -InputFile "sprites_0.etc.dds.z" ``` ### Batch Extract Directory ```bash # Linux/Unix ./batch_extract_z_assets.sh /assets/directory # Windows (need to create batch version or use WSL) wsl bash batch_extract_z_assets.sh /mnt/c/assets/directory ``` ### Pack Modified Asset ```bash # Linux/Unix ./pack_z_asset.sh modified_sprite.dds # Windows (use API) curl -X POST http://localhost:5143/api/AssetManagement/pack \ -H "Content-Type: application/json" \ -d '{"fileName": "modified_sprite.dds"}' ``` ## File Locations ``` RR3CommunityServer/ ├── Tools/ │ ├── extract_z_asset.sh ← Use this for single files │ ├── batch_extract_z_assets.sh ← Use this for directories │ ├── pack_z_asset.sh ← Use this to create .z files │ └── extract_z_asset.ps1 ← Windows version ├── Assets/ ← Put .z files here │ ├── raw/ ← Original .z files │ └── extracted/ ← Extracted DDS textures └── ASSET_EXTRACTION_GUIDE.md ← Full documentation ``` ## Troubleshooting ### Scripts won't run (Linux) ```bash chmod +x *.sh ``` ### Python not found ```bash # Ubuntu/Debian sudo apt install python3 # RedHat/CentOS sudo yum install python3 ``` ### "No ZLIB blocks found" File is corrupted or not a .z file. Check with: ```bash hexdump -C file.z | head # Should see: 78 9c or 78 da ``` ## Custom Content Workflow ``` 1. Get PNG → 2. Convert to DDS → 3. Pack to .z → 4. Upload to server ↓ ↓ ↓ ↓ GIMP/PS AMD Compressor pack_z_asset.sh API POST ``` ## Important Notes - **Backup originals** before modifying - **.z files** are ZLIB compressed (not ZIP!) - **DDS format**: ETC2_RGBA (Android), BC3 (PC) - **File size**: Assets can be 1-100 MB each - **Server path**: Configure `AssetBasePath` in appsettings.json ## Quick Test ```bash # Download test file (if available) wget https://example.com/test_sprite.z # Extract ./extract_z_asset.sh test_sprite.z # Verify it's DDS file test_sprite.dds # Output should be: DDS image data, ... # Repack ./pack_z_asset.sh test_sprite.dds # Compare sizes ls -lh test_sprite.* ``` ## API Endpoints (Server Running) ```bash # List all assets curl http://localhost:5143/api/AssetManagement/list # Extract via API curl -X POST http://localhost:5143/api/AssetManagement/extract \ -H "Content-Type: application/json" \ -d '{"fileName": "sprites_0.etc.dds.z"}' # Batch extract via API curl -X POST http://localhost:5143/api/AssetManagement/batch-extract \ -H "Content-Type: application/json" \ -d '{"inputDirectory": "raw_assets"}' ``` ## When You're Drunk 🍺 ```bash # Just run this and everything will be extracted: cd RR3CommunityServer/Tools chmod +x batch_extract_z_assets.sh ./batch_extract_z_assets.sh /path/where/discord/gave/you/files # Done! Check the "extracted" folder. ``` --- **Need help?** Check `ASSET_EXTRACTION_GUIDE.md` for complete documentation.