mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
Compare commits
154
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f355cb9f76 | ||
|
|
e42576b005 | ||
|
|
f68198475e | ||
|
|
896ae20dce | ||
|
|
b8fdc5424d | ||
|
|
204c3eacc1 | ||
|
|
4d0f21e10b | ||
|
|
d3202e8607 | ||
|
|
a438eb704f | ||
|
|
1569de4475 | ||
|
|
0f022f8295 | ||
|
|
75c21a5129 | ||
|
|
5092d43e8e | ||
|
|
56d5d5e956 | ||
|
|
70eca3293b | ||
|
|
4f7ee54ef7 | ||
|
|
269df9586d | ||
|
|
3152c18840 | ||
|
|
52630596b8 | ||
|
|
7e184b8be0 | ||
|
|
877ba9408d | ||
|
|
8dc9a6b46d | ||
|
|
b3e439669b | ||
|
|
08c909fbe2 | ||
|
|
a44e2e9866 | ||
|
|
bae2f253bc | ||
|
|
d485a463dd | ||
|
|
3da1ed4d6c | ||
|
|
051e9ec74a | ||
|
|
486171f4db | ||
|
|
72de42a9ab | ||
|
|
404e6625c0 | ||
|
|
32e4bf3fd2 | ||
|
|
0d1088fefb | ||
|
|
1a17d607fb | ||
|
|
dcda627518 | ||
|
|
c130da7f0e | ||
|
|
e2df4d35b8 | ||
|
|
7739dbd0a3 | ||
|
|
9b7aa13d61 | ||
|
|
84ecaec5d3 | ||
|
|
01a5f1bd47 | ||
|
|
de0433ca02 | ||
|
|
cf76ae7136 | ||
|
|
ea21636c4e | ||
|
|
dafa834d28 | ||
|
|
f1a1c78588 | ||
|
|
14d16e5daf | ||
|
|
b52c1fc2d9 | ||
|
|
f45b24f7ab | ||
|
|
6ae175e5e0 | ||
|
|
0df27c38a1 | ||
|
|
e27cc3f6ed | ||
|
|
968c3957d0 | ||
|
|
577d2323a8 | ||
|
|
625c6cc649 | ||
|
|
9bc753b512 | ||
|
|
fb34e6ce2f | ||
|
|
f882ea29e2 | ||
|
|
62f68f1f10 | ||
|
|
8c9a41d72b | ||
|
|
5bda754b6e | ||
|
|
c5bb537bf2 | ||
|
|
c59779bedb | ||
|
|
5059e382b3 | ||
|
|
953570461c | ||
|
|
6d527a7170 | ||
|
|
ffd74de79f | ||
|
|
7c9ef9e5e0 | ||
|
|
cd10d9ab4a | ||
|
|
578d4a3ff2 | ||
|
|
0cd01fa258 | ||
|
|
21b37ced8d | ||
|
|
81856276b0 | ||
|
|
389052c692 | ||
|
|
09edd39a06 | ||
|
|
5c3077033e | ||
|
|
ef84d5b3b5 | ||
|
|
d29f91afbc | ||
|
|
ab87282103 | ||
|
|
408417ca68 | ||
|
|
b171ce2011 | ||
|
|
58d0d92d4f | ||
|
|
754f39f623 | ||
|
|
10c8ac95a4 | ||
|
|
b367866a22 | ||
|
|
b26c5137f3 | ||
|
|
13cda7aec0 | ||
|
|
d1b8bfe244 | ||
|
|
734db0957e | ||
|
|
050cb7a834 | ||
|
|
6dbcbc2afc | ||
|
|
484cb8fcb5 | ||
|
|
e09b407e61 | ||
|
|
b8742bae66 | ||
|
|
af58b4614d | ||
|
|
db6c4679b7 | ||
|
|
8169dfd85d | ||
|
|
e6d7f78ea4 | ||
|
|
f1f29b85b7 | ||
|
|
f587bc0983 | ||
|
|
7ef4e0b9af | ||
|
|
b52919ebfe | ||
|
|
84290b1c0e | ||
|
|
24297dcae8 | ||
|
|
c7ee3dbf7e | ||
|
|
dd769a9aa5 | ||
|
|
645cfacecb | ||
|
|
d2041d0ee6 | ||
|
|
ed7dd76ee5 | ||
|
|
bc2b9f1267 | ||
|
|
851a1108d2 | ||
|
|
f09663e1c0 | ||
|
|
6a05f11001 | ||
|
|
36e8a20cd5 | ||
|
|
7630cc52d3 | ||
|
|
23d2ca9a42 | ||
|
|
6e759e52c9 | ||
|
|
85883cd2c5 | ||
|
|
9e4d9c7968 | ||
|
|
9968b2c83d | ||
|
|
be0804ae59 | ||
|
|
129a2c52f9 | ||
|
|
996c9c05df | ||
|
|
36dbb24572 | ||
|
|
aaae8fb8ff | ||
|
|
e5e747f7a0 | ||
|
|
487d149587 | ||
|
|
48c4a4c76d | ||
|
|
33ebbbeb65 | ||
|
|
1a7a1223d5 | ||
|
|
9813459310 | ||
|
|
94c3608ca7 | ||
|
|
7e9be14a9a | ||
|
|
5f773931bc | ||
|
|
b2fd85a5b0 | ||
|
|
b060e65af5 | ||
|
|
8a3e57637d | ||
|
|
90ad923672 | ||
|
|
59108d7637 | ||
|
|
f85d097c16 | ||
|
|
ed92440b94 | ||
|
|
d41d45abae | ||
|
|
32a7db238b | ||
|
|
2dc23ba09d | ||
|
|
30522bfda0 | ||
|
|
ed31f40876 | ||
|
|
6ad64c9bd9 | ||
|
|
bd7c952478 | ||
|
|
f7180f0e1a | ||
|
|
b0611d7d72 | ||
|
|
244968bbbf | ||
|
|
fd8448b0a6 | ||
|
|
17c54be1c8 |
No files matched your search
@@ -1,83 +0,0 @@
|
||||
name: Assets
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: production
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
asset_repo:
|
||||
type: choice
|
||||
required: false
|
||||
description: What asset repo to write to
|
||||
options:
|
||||
- blitzkit/assets
|
||||
- blitzkit/assets-preview
|
||||
- blitzkit/assets-dev
|
||||
default: blitzkit/assets
|
||||
|
||||
asset_source:
|
||||
type: string
|
||||
required: false
|
||||
description: "Archive URL or Steam to download (example: steam:APP_ID/DEPOT_ID or zip:URL_TO_ZIP)"
|
||||
default: "steam:444200/444202"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.asset_repo }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
VIDEOS_SHEET: ${{ secrets.VIDEOS_SHEET }}
|
||||
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
||||
WOTB_DLC_CDN: ${{ secrets.WOTB_DLC_CDN }}
|
||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||
PUBLIC_ASSET_REPO: ${{ github.event.inputs.asset_repo != '' && github.event.inputs.asset_repo || secrets.PUBLIC_ASSET_REPO }}
|
||||
PUBLIC_ASSET_BRANCH: ${{ secrets.PUBLIC_ASSET_BRANCH }}
|
||||
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
||||
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
|
||||
PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }}
|
||||
ALLOW_ROBOTS: true
|
||||
PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }}
|
||||
PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }}
|
||||
PUBLIC_PATREON_CLIENT_ID: ${{ secrets.PUBLIC_PATREON_CLIENT_ID }}
|
||||
PUBLIC_PATREON_REDIRECT_URI: ${{ secrets.PUBLIC_PATREON_REDIRECT_URI }}
|
||||
PATREON_CLIENT_SECRET: ${{ secrets.PATREON_CLIENT_SECRET }}
|
||||
PUBLIC_NITROPAY_ID: ${{ secrets.PUBLIC_NITROPAY_ID }}
|
||||
PUBLIC_DEBUG_MISSING_I18N: false
|
||||
PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }}
|
||||
PUBLIC_ASSET_FAST_USER: blitzkit
|
||||
PUBLIC_ASSET_FAST_REPO: assets
|
||||
PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }}
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
|
||||
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
|
||||
|
||||
jobs:
|
||||
build_assets:
|
||||
name: Build assets
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
- uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GH_TOKEN }}
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
|
||||
- run: bun run setup
|
||||
|
||||
- name: AppArmor hack
|
||||
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
|
||||
|
||||
- name: Install patches
|
||||
run: bun run setup:patches --source=${{ github.event.inputs.asset_source || 'steam:444200/444202' }}
|
||||
|
||||
- name: Build assets
|
||||
run: bun run build:assets --all-targets --source=${{ github.event.inputs.asset_source || 'steam:444200/444202' }}
|
||||
@@ -1,54 +0,0 @@
|
||||
name: Averages
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 8 * * *"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
|
||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||
PUBLIC_ASSET_FAST_USER: ${{ secrets.PUBLIC_ASSET_FAST_USER }}
|
||||
PUBLIC_ASSET_FAST_REPO: ${{ secrets.PUBLIC_ASSET_FAST_REPO }}
|
||||
PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }}
|
||||
ALLOW_ROBOTS: "true"
|
||||
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
||||
PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }}
|
||||
PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }}
|
||||
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
||||
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
|
||||
PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }}
|
||||
PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }}
|
||||
PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }}
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
- uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GH_TOKEN }}
|
||||
- run: bun run setup
|
||||
|
||||
- name: Build averages
|
||||
env:
|
||||
PUBLIC_ASSET_BRANCH: main
|
||||
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
||||
|
||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
VIDEOS_SHEET: ${{ secrets.VIDEOS_SHEET }}
|
||||
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||
run: bun run build:averages --production
|
||||
@@ -0,0 +1,45 @@
|
||||
name: Discover IDs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: production
|
||||
|
||||
schedule:
|
||||
- cron: 0 */6 * * *
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
discover:
|
||||
name: Discover IDs
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: production
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- name: Setup bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Discover IDs
|
||||
run: bun run discover-ids
|
||||
env:
|
||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||
GH_TOKEN: ${{ secrets.IDS_TOKEN }}
|
||||
@@ -1,38 +0,0 @@
|
||||
name: Reviews
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: 0 0 * * 2
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
PUBLIC_ASSET_BRANCH: ${{ secrets.PUBLIC_ASSET_BRANCH }}
|
||||
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
|
||||
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
- uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GH_TOKEN }}
|
||||
- run: bun run setup
|
||||
|
||||
- name: Find reviews
|
||||
run: bun run build:reviews
|
||||
@@ -0,0 +1,169 @@
|
||||
name: Website
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
schedule:
|
||||
- cron: "0 4 * * *"
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: Branch
|
||||
|
||||
type: choice
|
||||
required: true
|
||||
default: production
|
||||
|
||||
options:
|
||||
- production
|
||||
- main
|
||||
|
||||
environment:
|
||||
description: Environment
|
||||
|
||||
type: choice
|
||||
required: true
|
||||
default: production
|
||||
|
||||
options:
|
||||
- development
|
||||
- beta
|
||||
- production
|
||||
- preview
|
||||
- opentest
|
||||
|
||||
client_provider:
|
||||
description: Client provider
|
||||
|
||||
type: choice
|
||||
required: true
|
||||
default: steam
|
||||
|
||||
options:
|
||||
- steam
|
||||
- zip
|
||||
- wgpkg
|
||||
|
||||
client_source:
|
||||
description: Client source
|
||||
|
||||
type: string
|
||||
required: true
|
||||
default: 444200/windows
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ inputs.environment || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# client
|
||||
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
|
||||
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
|
||||
CLIENT_PROVIDER: ${{ inputs.client_provider || 'steam' }}
|
||||
CLIENT_SOURCE: ${{ inputs.client_source || '444200/windows' }}
|
||||
CLIENT_DIR: ../../temp/game
|
||||
|
||||
# blitzkit
|
||||
PUBLIC_ENVIRONMENT: ${{ inputs.environment || 'production' }}
|
||||
PUBLIC_PROMOTE_OPENTEST: false
|
||||
PUBLIC_STATIC_ASSET_BASE: https://assets.blitzkit.app
|
||||
PUBLIC_GUIDE_WEBSITE: https://guidesblitz.com
|
||||
|
||||
# blitz
|
||||
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
||||
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
||||
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
|
||||
|
||||
# google
|
||||
PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }}
|
||||
|
||||
# wargaming
|
||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build website
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
chunk: [default, api]
|
||||
|
||||
steps:
|
||||
- name: Free disk space
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.branch || 'production' }}
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- name: Setup bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Setup protoc
|
||||
uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- name: Setup CLIs
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y aria2 libarchive-tools
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
- name: Download Client
|
||||
run: bun run download-client
|
||||
|
||||
- name: Build
|
||||
run: bun run --bun build
|
||||
env:
|
||||
CHUNK: ${{ matrix.chunk }}
|
||||
|
||||
- name: Upload artifact
|
||||
id: upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: chunk-${{ matrix.chunk }}
|
||||
path: dist/website
|
||||
|
||||
- name: Trigger deployment
|
||||
|
||||
if: ${{ github.ref == 'refs/heads/production' }}
|
||||
|
||||
env:
|
||||
TOKEN: ${{ secrets.GH_NODE_DEPLOY_TOKEN }}
|
||||
CHUNK: ${{ matrix.chunk }}
|
||||
|
||||
run: |
|
||||
ENV_FILE="environments/${PUBLIC_ENVIRONMENT}.json"
|
||||
TARGET_REPO=$(jq -r ".nodes.\"$CHUNK\"" "$ENV_FILE")
|
||||
|
||||
if [ "$TARGET_REPO" == "null" ] || [ -z "$TARGET_REPO" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
"https://api.github.com/repos/$TARGET_REPO/dispatches" \
|
||||
-d "{
|
||||
\"event_type\": \"deploy-pages\",
|
||||
\"client_payload\": {
|
||||
\"source_repo\": \"${{ github.repository }}\",
|
||||
\"run_id\": \"${{ github.run_id }}\",
|
||||
\"artifact_id\": \"${{ steps.upload.outputs.artifact-id }}\",
|
||||
\"chunk\": \"$CHUNK\"
|
||||
}
|
||||
}"
|
||||
@@ -1,72 +0,0 @@
|
||||
name: Website
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
schedule:
|
||||
- cron: "0 4 * * *"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref == 'refs/heads/main' }}
|
||||
|
||||
env:
|
||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||
PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }}
|
||||
ALLOW_ROBOTS: ${{ secrets.ALLOW_ROBOTS }}
|
||||
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
||||
PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }}
|
||||
PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }}
|
||||
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
||||
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
|
||||
PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }}
|
||||
PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }}
|
||||
PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }}
|
||||
PUBLIC_GUIDE_WEBSITE: ${{ secrets.PUBLIC_GUIDE_WEBSITE }}
|
||||
SERVICING: ${{ secrets.SERVICING }}
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build website
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
- uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GH_TOKEN }}
|
||||
- uses: actions/configure-pages@v6
|
||||
- run: bun run setup
|
||||
|
||||
- name: Build website
|
||||
run: bun run build:website
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v5
|
||||
with:
|
||||
path: dist/website
|
||||
|
||||
deploy-github-pages:
|
||||
if: ${{ github.ref == 'refs/heads/production' }}
|
||||
name: Deploy to GitHub Pages
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
environment:
|
||||
name: Production
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v5
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
node_modules
|
||||
_node_modules
|
||||
package-lock.json
|
||||
*.env
|
||||
.env
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/playwright/.cache/
|
||||
|
||||
@@ -24,20 +24,18 @@ If you intend to contribute to the code, note that you may need to check out sen
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Name | Source | BlitzKit Default | Memo |
|
||||
| ------------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `PUBLIC_WARGAMING_APPLICATION_ID` | [Wargaming Developer's Room](https://developers.wargaming.net/) | | Application ID needed to communicate with Wargaming APIs. |
|
||||
| `PUBLIC_PROMOTE_OPENTEST` | | `false` | Optional boolean dictating whether the website advertises [the opentest subdomain of BlitzKit](https://opentest.blitzkit.app/). |
|
||||
| `ALLOW_ROBOTS` | | `true` | Toggles between `Allow: /` and `Disallow: /` in the website's `/robots.txt`. This is usually `false` for all BlitzKit's subdomains. |
|
||||
| `WOTB_GLOSSARY`, `WOTB_GLOSSARY_DOMAIN`, `WOTB_GLOSSARY_PATH` | | | |
|
||||
| `PUBLIC_GOOGLE_TAG_MANAGER_ID` | [Google Tag Manager](https://tagmanager.google.com/) | `G-GL2JVHCGPQ` | Google Tag Manager's unique identifier for analytical purposes. |
|
||||
| `PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID` | [Google Analytics](https://analytics.google.com/) | `430711767` | Google Analytics' unique property ID for [BlitzKit's apex domain](https://blitzkit.app/) and subdomains. |
|
||||
| `GOOGLE_APPLICATION_CREDENTIALS` | [Google Cloud](https://cloud.google.com/) | | Google Cloud's API key, primarily used for ranking popular tanks and finding relevant tank review videos in Tankopedia. |
|
||||
| `PUBLIC_DISCORD_SERVER_ID` | [BlitzKit Discord Server](https://discord.gg/nDt7AjGJQH) | `734786591205359697` | BlitzKit Discord Server's id. |
|
||||
| `PUBLIC_ASSET_BASE` | [blitzkit/assets](https://github.com/blitzkit/assets) | `https://blitzkit.github.io/assets` | The root domain and path that serves the external assets like tank models and icons. |
|
||||
| `PUBLIC_BRANCH` | | `main` | The branch that the website is operating on. This is completely nominal. |
|
||||
| `PUBLIC_GUIDE_WEBSITE` | [GuidesBlitz](https://guidesblitz.com/) | `https://guidesblitz.com` | The website that serves the encyclopedia-like content in BlitzKit. |
|
||||
| `SERVICING` | | `false` | Wether the website is down for servicing. |
|
||||
| `GH_TOKEN` | [GitHub Fine-Grained Tokens](https://github.com/settings/personal-access-tokens) | | The GitHub API key used for checking out private submodules and pushing content to the asset repository. |
|
||||
| `DATABASE_URL` | [CockroachDB](https://www.cockroachlabs.com/) | | The CockroachDB-SQL database URL used to link Wargaming and Discord users. |
|
||||
| `WOTB_DLC_CDN` | | | |
|
||||
| Name | Source | BlitzKit Default | Memo |
|
||||
| ------------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `PUBLIC_WARGAMING_APPLICATION_ID` | [Wargaming Developer's Room](https://developers.wargaming.net/) | | Application ID needed to communicate with Wargaming APIs. |
|
||||
| `PUBLIC_PROMOTE_OPENTEST` | | `false` | Optional boolean dictating whether the website advertises [the opentest subdomain of BlitzKit](https://opentest.blitzkit.app/). |
|
||||
| `WOTB_GLOSSARY`, `WOTB_GLOSSARY_DOMAIN`, `WOTB_GLOSSARY_PATH` | | | |
|
||||
| `PUBLIC_GOOGLE_TAG_MANAGER_ID` | [Google Tag Manager](https://tagmanager.google.com/) | `G-GL2JVHCGPQ` | Google Tag Manager's unique identifier for analytical purposes. |
|
||||
| `PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID` | [Google Analytics](https://analytics.google.com/) | `430711767` | Google Analytics' unique property ID for [BlitzKit's apex domain](https://blitzkit.app/) and subdomains. |
|
||||
| `GOOGLE_APPLICATION_CREDENTIALS` | [Google Cloud](https://cloud.google.com/) | | Google Cloud's API key, primarily used for ranking popular tanks and finding relevant tank review videos in Tankopedia. |
|
||||
| `PUBLIC_DISCORD_SERVER_ID` | [BlitzKit Discord Server](https://discord.gg/nDt7AjGJQH) | `734786591205359697` | BlitzKit Discord Server's id. |
|
||||
| `PUBLIC_ASSET_BASE` | [blitzkit/assets](https://github.com/blitzkit/assets) | `https://blitzkit.github.io/assets` | The root domain and path that serves the external assets like tank models and icons. |
|
||||
| `PUBLIC_GUIDE_WEBSITE` | [GuidesBlitz](https://guidesblitz.com/) | `https://guidesblitz.com` | The website that serves the encyclopedia-like content in BlitzKit. |
|
||||
| `SERVICING` | | `false` | Wether the website is down for servicing. |
|
||||
| `GH_TOKEN` | [GitHub Fine-Grained Tokens](https://github.com/settings/personal-access-tokens) | | The GitHub API key used for checking out private submodules and pushing content to the asset repository. |
|
||||
| `DATABASE_URL` | [CockroachDB](https://www.cockroachlabs.com/) | | The CockroachDB-SQL database URL used to link Wargaming and Discord users. |
|
||||
| `WOTB_DLC_CDN` | | | |
|
||||
@@ -5,6 +5,7 @@
|
||||
"": {
|
||||
"name": "blitzkit",
|
||||
"dependencies": {
|
||||
"@gltf-transform/extensions": "^4.4.2",
|
||||
"lz4js": "^0.2.0",
|
||||
"sharp": "^0.34.5",
|
||||
"typescript": "^5.9.3",
|
||||
@@ -29,7 +30,7 @@
|
||||
"@octokit/plugin-throttling": "^11.0.1",
|
||||
"@octokit/rest": "^22.0.0",
|
||||
"@types/adm-zip": "^0.5.7",
|
||||
"@types/bun": "^1.3.1",
|
||||
"@types/bun": "^1.3.14",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/lz4js": "^0.2.1",
|
||||
"@types/three": "^0.180.0",
|
||||
@@ -62,7 +63,7 @@
|
||||
"@gltf-transform/functions": "^4.2.1",
|
||||
"@octokit/plugin-throttling": "^11.0.2",
|
||||
"@octokit/rest": "^22.0.0",
|
||||
"@types/bun": "^1.3.0",
|
||||
"@types/bun": "^1.3.14",
|
||||
"@types/decompress": "^4.2.7",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/lz4js": "^0.2.1",
|
||||
@@ -77,6 +78,7 @@
|
||||
"fast-xml-parser": "^5.2.5",
|
||||
"googleapis": "^162.0.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"lz4-napi": "^2.9.1",
|
||||
"progress": "^2.0.3",
|
||||
"puppeteer": "^24.22.3",
|
||||
"sharp": "^0.34.4",
|
||||
@@ -106,6 +108,8 @@
|
||||
"@blitzkit/core": "workspace:*",
|
||||
"@blitzkit/i18n": "workspace:*",
|
||||
"@fontsource/inter": "^5.2.8",
|
||||
"@gltf-transform/core": "^4.4.2",
|
||||
"@gltf-transform/functions": "^4.4.2",
|
||||
"@radix-ui/colors": "^3.0.0",
|
||||
"@radix-ui/react-icons": "^1.3.2",
|
||||
"@radix-ui/themes": "^3.2.1",
|
||||
@@ -141,6 +145,40 @@
|
||||
},
|
||||
},
|
||||
"packages": {
|
||||
"@antoniomuso/lz4-napi-android-arm-eabi": ["@antoniomuso/[email protected]", "", { "os": "android", "cpu": "arm" }, "sha512-KcRvkSOymDvxFDT9AGFBc7g+J/Xv4qExMMHhtxjZ45qE2sEIVCXoSFmyLDiVVKztkVzoV24VXPPRLOa4WQOi2Q=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-android-arm64": ["@antoniomuso/[email protected]", "", { "os": "android", "cpu": "arm64" }, "sha512-BNiddtI+5Z83w1jIufTFhTPrtxMVKb0UPezTq47XIE/7vkB6y5mHSWSlcHqEIFFIg2/PVdqyqec1CXv0bkpCPA=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-darwin-arm64": ["@antoniomuso/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-nhLu+8g8Q6Yqd0rxRn4JkCMJBUs6mByiyT3Mhha2EgorsA2txx18JKm9qLhnXpDgFGWc94tLEVHqzDk0tLD9yA=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-darwin-x64": ["@antoniomuso/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-DqkN1D/IrqOaUBppCP7BrF9j5Usb6RqFyz16kf3SHPDxLG7pmemgwXmGWpcNrKQfp4Shx1VkbFWA61gMyE1+uw=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-freebsd-x64": ["@antoniomuso/[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-ORtZ27l+j0yDgPMgt9q/j10LCchtKS44gFohEWl8fokgr5rzDAYAtMyQZzHV8sqE2LUWHAU3Gk6Wh9s1GRl9ow=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-linux-arm-gnueabihf": ["@antoniomuso/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-GBZgQ/rY0AzjZA4jOKFXmLQKVPGXglVZ3U7SLcCu2nmuHTO73vsqiPeAHnYu7/org1km7yw3ii6XFlBRzyNKIA=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-linux-arm64-gnu": ["@antoniomuso/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-9lvGts14KHNT4pc9lKYUPI1PRdBkfbyT4HCjyDk8fJJzEG9ryvLvyhTeFr/IVpJOFmkSodZw1nxJMQDT5+zvlQ=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-linux-arm64-musl": ["@antoniomuso/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-SsidKyLRHGB/rrgic+N7ZxFjjl+Cbav2sbuSj4AJsc37oVhyjzbiI5EEL9Rl+zL4ajL0d3utG3UbIUooThhykQ=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-linux-ppc64-gnu": ["@antoniomuso/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-1Joz9RmBLiLIfI5Gk/wmJI/WwQy74prKDhLcCPFoa/FcTOJavJAopAzs1MQdnM7nGklEPOpKZWmKHZz1yQ4LMQ=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-linux-riscv64-gnu": ["@antoniomuso/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-3z6jSvhEpnSMlubcHwSn6W8Xziq5LYSuIcSpSo7wTEOopnr6GNnKcH2uTPFsRiqC/aC2TLpm17ktXbYTrYL7jg=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-linux-s390x-gnu": ["@antoniomuso/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-wtQg/ikF1JutKdWfUdGXvR0LG+eG49mS01luwJXG6sg40DX737T3BAsbjM9Fccvif5jQwC+KmzP8+tvxy2eMtQ=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-linux-x64-gnu": ["@antoniomuso/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-Vw7vb3i1Q6QU2sI5GdgZdi4cVwN2xZ44Gw/WawIxCno1gX39VIF/j8T1pYwS7Dc67NeoA37LsYIPb3h49CiRRA=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-linux-x64-musl": ["@antoniomuso/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-oZVrvOPjnI7c07v1lx6HMLFi8xlW9WS0pHmkaisldybNUWmNI6vR44KoqBctGCFplvF5YVMK2xPs3W04UGzF8w=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-openharmony-arm64": ["@antoniomuso/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-mkDQv6C0JbMbCDn070Dv67SWfkDy8uD6DkqUT373LHjdaEXj/0eK2gAVykKyPdnC1RBhONgUCaV4HQOp63oH8Q=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-win32-arm64-msvc": ["@antoniomuso/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-EBsN9YzV3xpSPr6h/t6ntBetpdtO0nZw9o4sZ1vNOfLJ8FMdHxHiY7FonzhEyTnc4N3x3yMqPudD6zLVy/oNXg=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-win32-ia32-msvc": ["@antoniomuso/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-Fqe2JmcfjvVrC+BHjHPzoiIzNgjHpQvDO7duMbJh5fW9VvF7pKkjRAPDwhtFhkU/fBLVQywq5WbsFqtJ3pYG/w=="],
|
||||
|
||||
"@antoniomuso/lz4-napi-win32-x64-msvc": ["@antoniomuso/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-N6bAJ4pcYfbiuysHNyEl6uVnYxl0CBboPeA6Iz1GQWJb6mp8J/z4+E8bTvasMuRhIhEW5F6X+oJIwmOwSzHoIQ=="],
|
||||
|
||||
"@apideck/better-ajv-errors": ["@apideck/[email protected]", "", { "dependencies": { "json-schema": "^0.4.0", "jsonpointer": "^5.0.0", "leven": "^3.1.0" }, "peerDependencies": { "ajv": ">=8" } }, "sha512-P+ZygBLZtkp0qqOAJJVX4oX/sFo5JR3eBWwwuqHHhK0GIgQOKWrAfiAaWX0aArHkRWHMuggFEgAZNxVPwPZYaA=="],
|
||||
|
||||
"@astrojs/check": ["@astrojs/[email protected]", "", { "dependencies": { "@astrojs/language-server": "^2.15.0", "chokidar": "^4.0.1", "kleur": "^4.1.5", "yargs": "^17.7.2" }, "peerDependencies": { "typescript": "^5.0.0" }, "bin": { "astro-check": "dist/bin.js" } }, "sha512-IOheHwCtpUfvogHHsvu0AbeRZEnjJg3MopdLddkJE70mULItS/Vh37BHcI00mcOJcH1vhD3odbpvWokpxam7xA=="],
|
||||
@@ -453,11 +491,11 @@
|
||||
|
||||
"@fontsource/inter": ["@fontsource/[email protected]", "", {}, "sha512-P6r5WnJoKiNVV+zvW2xM13gNdFhAEpQ9dQJHt3naLvfg+LkF2ldgSLiF4T41lf1SQCM9QmkqPTn4TH568IRagg=="],
|
||||
|
||||
"@gltf-transform/core": ["@gltf-transform/core@4.2.1", "", { "dependencies": { "property-graph": "^3.0.0" } }, "sha512-qKhrQ29KJ9K6sz7xGoGRllqPBlROjPJMQPvCLBOfgMPH3S/Ph5E0e6fD5WmwTY5QPyBsDMRqKd1Vl0ncThTXGw=="],
|
||||
"@gltf-transform/core": ["@gltf-transform/core@4.4.2", "", { "dependencies": { "property-graph": "^4.1.0" } }, "sha512-qsWKwNSwK+2s834Mt4xbYcyHqCrgNFP7hIv5s487JxebngRfDgelpghNF+kSswGb2/NuapasfK3UViFoSJJoMg=="],
|
||||
|
||||
"@gltf-transform/extensions": ["@gltf-transform/extensions@4.2.1", "", { "dependencies": { "@gltf-transform/core": "^4.2.1", "ktx-parse": "^1.0.1" } }, "sha512-ieHSJU9qvb3ucWDxgHFcff+C7fLtFPa6G0Wtc/ki7GsN6Rh7o9eoyqi7Ggj2LO4i3ynCwLLPb/onbJKw2fBtsA=="],
|
||||
"@gltf-transform/extensions": ["@gltf-transform/extensions@4.4.2", "", { "dependencies": { "@gltf-transform/core": "^4.4.2", "ktx-parse": "^1.1.0" } }, "sha512-HJH1FM+edC5eNvl6xO0SOXJ/j/3oDoIpSu150OTdJaLBoM3TgCCGIfh4wyhgWAqZrkvgHKVGiZKxcKV5LkgPCQ=="],
|
||||
|
||||
"@gltf-transform/functions": ["@gltf-transform/functions@4.2.1", "", { "dependencies": { "@gltf-transform/core": "^4.2.1", "@gltf-transform/extensions": "^4.2.1", "ktx-parse": "^1.0.1", "ndarray": "^1.0.19", "ndarray-lanczos": "^0.3.0", "ndarray-pixels": "^5.0.1" } }, "sha512-hFCI80N6zt7yHlqXbzlYEYQbFwK+2OOZNvacrRtrWiCWKI0k1Ad5+nZFsmuIZZV03aXb5XG6UF7JINT3wETS1Q=="],
|
||||
"@gltf-transform/functions": ["@gltf-transform/functions@4.4.2", "", { "dependencies": { "@gltf-transform/core": "^4.4.2", "@gltf-transform/extensions": "^4.4.2", "ktx-parse": "^1.1.0", "ndarray": "^1.0.19", "ndarray-lanczos": "^0.3.0", "ndarray-pixels": "^5.0.1" } }, "sha512-dclXgv9TshMaWBqPDUYd4xTwBQ2PpuR8p0Y9pokrRzGQDUPXRP6lTDzbqT0UmEmxFSvRyPJjvOWUmzeiRafpvw=="],
|
||||
|
||||
"@img/colour": ["@img/[email protected]", "", {}, "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw=="],
|
||||
|
||||
@@ -857,7 +895,7 @@
|
||||
|
||||
"@types/babel__traverse": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="],
|
||||
|
||||
"@types/bun": ["@types/[email protected].9", "", { "dependencies": { "bun-types": "1.3.9" } }, "sha512-KQ571yULOdWJiMH+RIWIOZ7B2RXQGpL1YQrBtLIV3FqDcCu6FsbFUBwhdKUlCKUpS3PJDsHlJ1QKlpxoVR+xtw=="],
|
||||
"@types/bun": ["@types/[email protected].14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
|
||||
|
||||
"@types/bytebuffer": ["@types/[email protected]", "", { "dependencies": { "@types/long": "^3.0.0", "@types/node": "*" } }, "sha512-lV4YLiolMdD4upDmr4vnfiwV/FN9Jg33eNTSFMkHqyMKqTIAn5TmFTYsARwXwUXeFU7yzRpECmWV1SOhIvdkRQ=="],
|
||||
|
||||
@@ -1073,7 +1111,7 @@
|
||||
|
||||
"buffer-from": ["[email protected]", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="],
|
||||
|
||||
"bun-types": ["[email protected].9", "", { "dependencies": { "@types/node": "*" } }, "sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg=="],
|
||||
"bun-types": ["[email protected].14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
|
||||
|
||||
"bytebuffer": ["[email protected]", "", { "dependencies": { "long": "~3" } }, "sha512-IuzSdmADppkZ6DlpycMkm8l9zeEq16fWtLvunEwFiYciR/BHo4E8/xs5piFquG+Za8OWmMqHF8zuRviz2LHvRQ=="],
|
||||
|
||||
@@ -1661,6 +1699,8 @@
|
||||
|
||||
"lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
|
||||
|
||||
"lz4-napi": ["[email protected]", "", { "optionalDependencies": { "@antoniomuso/lz4-napi-android-arm-eabi": "2.9.1", "@antoniomuso/lz4-napi-android-arm64": "2.9.1", "@antoniomuso/lz4-napi-darwin-arm64": "2.9.1", "@antoniomuso/lz4-napi-darwin-x64": "2.9.1", "@antoniomuso/lz4-napi-freebsd-x64": "2.9.1", "@antoniomuso/lz4-napi-linux-arm-gnueabihf": "2.9.1", "@antoniomuso/lz4-napi-linux-arm64-gnu": "2.9.1", "@antoniomuso/lz4-napi-linux-arm64-musl": "2.9.1", "@antoniomuso/lz4-napi-linux-ppc64-gnu": "2.9.1", "@antoniomuso/lz4-napi-linux-riscv64-gnu": "2.9.1", "@antoniomuso/lz4-napi-linux-s390x-gnu": "2.9.1", "@antoniomuso/lz4-napi-linux-x64-gnu": "2.9.1", "@antoniomuso/lz4-napi-linux-x64-musl": "2.9.1", "@antoniomuso/lz4-napi-openharmony-arm64": "2.9.1", "@antoniomuso/lz4-napi-win32-arm64-msvc": "2.9.1", "@antoniomuso/lz4-napi-win32-ia32-msvc": "2.9.1", "@antoniomuso/lz4-napi-win32-x64-msvc": "2.9.1" } }, "sha512-VjY1TAUQa3bo8j4vCcpQ0RBXh4mbC1OFHWH9rpOvx8qLYwaZTEzwxW/648ufD2cmz5/pFfPLDkX6N8+TqI9BYQ=="],
|
||||
|
||||
"lz4js": ["[email protected]", "", {}, "sha512-gY2Ia9Lm7Ep8qMiuGRhvUq0Q7qUereeldZPP1PMEJxPtEWHJLqw9pgX68oHajBH0nzJK4MaZEA/YNV3jT8u8Bg=="],
|
||||
|
||||
"lzma": ["[email protected]", "", { "bin": { "lzma.js": "bin/lzma.js" } }, "sha512-DcfiawQ1avYbW+hsILhF38IKAlnguc/fjHrychs9hdxe4qLykvhT5VTGNs5YRWgaNePh7NTxGD4uv4gKsRomCQ=="],
|
||||
@@ -1927,7 +1967,7 @@
|
||||
|
||||
"prompts": ["[email protected]", "", { "dependencies": { "kleur": "^3.0.3", "sisteransi": "^1.0.5" } }, "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q=="],
|
||||
|
||||
"property-graph": ["property-graph@3.0.0", "", {}, "sha512-TnzxUsttmGtw+OiU0LDw+0FlMbJ8vV8pOjyDI7+Kdni4Tj0hW5BFh7TatQu7Y68hcvvFmiFOHilKShsA4R82fA=="],
|
||||
"property-graph": ["property-graph@4.1.0", "", {}, "sha512-AvPcP7XECNWy4LGmFQ77k7un4lSKM4eS29PTvW4ck95uYeLxXPWJM7hLuBqK91FaHqCcgJvIUCuNJjjxKE7VKQ=="],
|
||||
|
||||
"property-information": ["[email protected]", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="],
|
||||
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"words": [
|
||||
"gamemodes",
|
||||
"Tankopedia"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
# BlitzKit 1.31.0
|
||||
|
||||
This update massively upgrades BlitzKit's graphical fidelity (while making it faster) and updates the way BlitzKit deploys updates, speeding up future versions.
|
||||
|
||||
## Features
|
||||
|
||||
- Improved the performance of the Tank Sandbox in Tankopedia
|
||||
- Reduced the number of lights by 25%
|
||||
- Reduced the resolution of shadows by 50%
|
||||
- Improved the graphical fidelity of tanks in the Tankopedia
|
||||
- Added soft contact shadows below tanks
|
||||
- Added sky and ground reflected lighting to the top and bottom of tanks
|
||||
- Removed the fog that used to darken tanks when zoomed far away
|
||||
- Made BlitzKitLand™ fade out circularly to hide the sharp edges
|
||||
- Pointed the lights 1.5m above the ground
|
||||
- This genuinely makes BlitzKit almost photo-realistic in my opinion
|
||||
- Non-PBR tanks are now lit up brighter to accommodate for their dark textures
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fixed a bug where the ambient occlusion map (a measure of how dark a part of a tank gets due to low light bounces) was applied to the color of the tank directly, making many tanks appear dark even in direct light
|
||||
- Tanks with chinese characters now generate urls through transliteration
|
||||
|
||||
## Known Issues
|
||||
|
||||
- The flags found behind the selected tank in the tech tree section of the Tankopedia is offset incorrectly
|
||||
|
||||
## Technical Features
|
||||
|
||||
- BlitzKit can now calculate and store performance statistics and account details for up 10,000,000,000 players
|
||||
- This will help make the BlitzKit Performance tool more accurate, and play well with an upcoming, unannounced major feature
|
||||
|
||||
## Technical Changes
|
||||
|
||||
- The `production` branch now deploys updates to `blitzkit.app` instead of the `main` branch
|
||||
- `robots.txt` now disables indexing of BlitzKit variants based on the environment
|
||||
- The website is now compiled in "chunks" of which the `api` chunk now takes on the task of mangling what was previously stored in `assets3`
|
||||
- `assets3` will be removed in `1.31.1`, please migrate to the new `api` if you use any BlitzKit assets
|
||||
- Removed the `bot` and `app` packages
|
||||
- Removed Prisma
|
||||
@@ -0,0 +1,3 @@
|
||||
# BlitzKit 1.31.1
|
||||
|
||||
This update adds capabilities to release BlitzKit OpenTest and Preview.
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"robots": false,
|
||||
"canonical": "https://blitzkit.app",
|
||||
|
||||
"paths": {
|
||||
"default": null,
|
||||
"api": null
|
||||
},
|
||||
"nodes": {
|
||||
"default": "blitzkit/deploy-node-beta.blitzkit.app",
|
||||
"api": "blitzkit/deploy-node-api.beta.blitzkit.app"
|
||||
},
|
||||
"aliases": {
|
||||
"api": "https://api.beta.blitzkit.app",
|
||||
"static": "https://static.beta.blitzkit.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"robots": false,
|
||||
"canonical": "https://blitzkit.app",
|
||||
|
||||
"paths": {
|
||||
"default": null,
|
||||
"api": "api"
|
||||
},
|
||||
"nodes": {},
|
||||
"aliases": {
|
||||
"api": "/api",
|
||||
"static": "https://static.blitzkit.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"robots": false,
|
||||
"canonical": "https://blitzkit.app",
|
||||
|
||||
"paths": {
|
||||
"default": null,
|
||||
"api": null
|
||||
},
|
||||
"nodes": {
|
||||
"default": "blitzkit/deploy-node-opentest.blitzkit.app",
|
||||
"api": "blitzkit/deploy-node-api.opentest.blitzkit.app"
|
||||
},
|
||||
"aliases": {
|
||||
"api": "https://api.opentest.blitzkit.app",
|
||||
"static": "https://static.opentest.blitzkit.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"robots": false,
|
||||
"canonical": "https://blitzkit.app",
|
||||
|
||||
"paths": {
|
||||
"default": null,
|
||||
"api": null
|
||||
},
|
||||
"nodes": {
|
||||
"default": "blitzkit/deploy-node-preview.blitzkit.app",
|
||||
"api": "blitzkit/deploy-node-api.preview.blitzkit.app"
|
||||
},
|
||||
"aliases": {
|
||||
"api": "https://api.preview.blitzkit.app",
|
||||
"static": "https://static.preview.blitzkit.app"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"robots": true,
|
||||
"canonical": "https://blitzkit.app",
|
||||
|
||||
"paths": {
|
||||
"default": null,
|
||||
"api": null
|
||||
},
|
||||
"nodes": {
|
||||
"default": "blitzkit/deploy-node-blitzkit.app",
|
||||
"api": "blitzkit/deploy-node-api.blitzkit.app"
|
||||
},
|
||||
"aliases": {
|
||||
"api": "https://api.blitzkit.app",
|
||||
"static": "https://static.blitzkit.app"
|
||||
}
|
||||
}
|
||||
+8
-2
@@ -1,16 +1,22 @@
|
||||
{
|
||||
"name": "blitzkit",
|
||||
"version": "1.30.8",
|
||||
"version": "1.31.1",
|
||||
"license": "BlitzKit License",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "cd packages/website && bun run dev"
|
||||
"dev": "cd packages/website && bun run dev",
|
||||
"build": "cd packages/website && bun run build",
|
||||
"discover-ids": "cd packages/scripts && bun run discover-ids",
|
||||
"build-protos": "cd packages/scripts && bun run build-protos",
|
||||
"record-performance": "cd packages/scripts && bun run record-performance",
|
||||
"download-client": "cd packages/scripts && bun run download-client"
|
||||
},
|
||||
"type": "module",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@gltf-transform/extensions": "^4.4.2",
|
||||
"lz4js": "^0.2.0",
|
||||
"sharp": "^0.34.5",
|
||||
"typescript": "^5.9.3"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"@octokit/plugin-throttling": "^11.0.1",
|
||||
"@octokit/rest": "^22.0.0",
|
||||
"@types/adm-zip": "^0.5.7",
|
||||
"@types/bun": "^1.3.1",
|
||||
"@types/bun": "^1.3.14",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/lz4js": "^0.2.1",
|
||||
"@types/three": "^0.180.0",
|
||||
|
||||
@@ -4,8 +4,8 @@ import type { BlitzGlossary } from "../types";
|
||||
export async function fetchGlossary(locale: string) {
|
||||
const response = await fetch(
|
||||
`${assertSecret(
|
||||
import.meta.env.WOTB_GLOSSARY_DOMAIN
|
||||
)}/${locale}${assertSecret(import.meta.env.WOTB_GLOSSARY_PATH)}`
|
||||
import.meta.env.WOTB_GLOSSARY_DOMAIN,
|
||||
)}/${locale}${assertSecret(import.meta.env.WOTB_GLOSSARY_PATH)}`,
|
||||
);
|
||||
return (await response.json()) as BlitzGlossary;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { LEAGUES } from "./rating";
|
||||
|
||||
export function getLeagueFromScore(score: number) {
|
||||
return LEAGUES.find(({ minScore }) => score >= minScore)!;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
import { context } from "../blitzkit/context";
|
||||
import { patientFetch } from "../blitzkit/patientFetch";
|
||||
import type { RatingLeague, RatingReward } from "./rating";
|
||||
import type { Region } from "./regions";
|
||||
import { regionToRegionSubdomain } from "./regionToRegionSubdomain";
|
||||
|
||||
export type RatingInfo =
|
||||
| {
|
||||
detail: undefined;
|
||||
|
||||
title: string;
|
||||
icon: string | null;
|
||||
start_at: string;
|
||||
finish_at: string;
|
||||
current_season: number;
|
||||
updated_at: string;
|
||||
count: number;
|
||||
|
||||
rewards: RatingReward[];
|
||||
leagues: RatingLeague[];
|
||||
}
|
||||
| { detail: { error: string } };
|
||||
|
||||
const cache: Partial<Record<Region, RatingInfo>> = {};
|
||||
|
||||
export async function getRatingInfo(region: Region) {
|
||||
if (cache[region]) return cache[region]!;
|
||||
|
||||
const response = await patientFetch(
|
||||
context === "website"
|
||||
? `/api/${region}/rating/current/info`
|
||||
: `https://${regionToRegionSubdomain(
|
||||
region
|
||||
)}.wotblitz.com/en/api/rating-leaderboards/season/`,
|
||||
undefined
|
||||
);
|
||||
const data = (await response.json()) as RatingInfo;
|
||||
|
||||
cache[region] = data;
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
import { context } from "../blitzkit/context";
|
||||
import { patientFetch } from "../blitzkit/patientFetch";
|
||||
import type { RatingPlayer } from "../statistics";
|
||||
import type { LeagueTop } from "./rating";
|
||||
import type { Region } from "./regions";
|
||||
import { regionToRegionSubdomain } from "./regionToRegionSubdomain";
|
||||
|
||||
export async function getRatingLeague(
|
||||
region: Region,
|
||||
league: number,
|
||||
usePatientFetcher = false
|
||||
) {
|
||||
const fetcher = (url: string) =>
|
||||
usePatientFetcher
|
||||
? patientFetch(url, undefined, { cache: "no-store" })
|
||||
: fetch(url, { cache: "no-store" });
|
||||
const response = await fetcher(
|
||||
context === "website"
|
||||
? `/api/${region}/rating/current/league/${league}`
|
||||
: `https://${regionToRegionSubdomain(
|
||||
region
|
||||
)}.wotblitz.com/en/api/rating-leaderboards/league/${league}/top/`
|
||||
);
|
||||
const json = await response.json();
|
||||
|
||||
return context === "website"
|
||||
? (json as RatingPlayer[])
|
||||
: (json as LeagueTop).result;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { patientFetch } from "../blitzkit/patientFetch";
|
||||
import { withCORSProxy } from "../blitzkit/withCORSProxy";
|
||||
import type { RatingNeighbors } from "./rating";
|
||||
import type { Region } from "./regions";
|
||||
import { regionToRegionSubdomain } from "./regionToRegionSubdomain";
|
||||
|
||||
export async function getRatingNeighbors(
|
||||
region: Region,
|
||||
id: number,
|
||||
count: number,
|
||||
usePatientFetcher = false
|
||||
) {
|
||||
const fetcher = (url: string) =>
|
||||
usePatientFetcher
|
||||
? patientFetch(url, undefined, { cache: "no-store" })
|
||||
: fetch(url, { cache: "no-store" });
|
||||
const response = await fetcher(
|
||||
withCORSProxy(
|
||||
`https://${regionToRegionSubdomain(
|
||||
region
|
||||
)}.wotblitz.com/en/api/rating-leaderboards/user/${id}/?neighbors=${count}`
|
||||
)
|
||||
);
|
||||
const json = (await response.json()) as RatingNeighbors;
|
||||
|
||||
return json;
|
||||
}
|
||||
@@ -10,13 +10,8 @@ export * from "./getAccountAchievements";
|
||||
export * from "./getAccountInfo";
|
||||
export * from "./getClanAccountInfo";
|
||||
export * from "./getClanInfo";
|
||||
export * from "./getLeagueFromScore";
|
||||
export * from "./getRatingInfo";
|
||||
export * from "./getRatingLeague";
|
||||
export * from "./getRatingNeighbors";
|
||||
export * from "./getTankStats";
|
||||
export * from "./idToRegion";
|
||||
export * from "./isOnGoingRatingSeason";
|
||||
export * from "./isValidBlitzId";
|
||||
export * from "./nations";
|
||||
export * from "./normalizeExtra";
|
||||
@@ -28,6 +23,5 @@ export * from "./regions";
|
||||
export * from "./regionSubdomainToRegion";
|
||||
export * from "./regionToRegionSubdomain";
|
||||
export * from "./searchClansAcrossRegions";
|
||||
export * from "./searchCurrentRatingPlayers";
|
||||
export * from "./searchPlayersAcrossRegions";
|
||||
export * from "./toUniqueId";
|
||||
@@ -1,6 +0,0 @@
|
||||
import { getRatingInfo } from "./getRatingInfo";
|
||||
|
||||
export async function isOnGoingRatingSeason() {
|
||||
const ratingInfo = await getRatingInfo("com");
|
||||
return ratingInfo.detail === undefined;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
import { context } from "../blitzkit/context";
|
||||
import { type Region } from "./regions";
|
||||
import { regionToRegionSubdomain } from "./regionToRegionSubdomain";
|
||||
|
||||
type CurrentRatingPlayerSearch = Record<
|
||||
number,
|
||||
{
|
||||
spa_id: number;
|
||||
nickname: string;
|
||||
clan_tag: string;
|
||||
} & (
|
||||
| {
|
||||
skip: true;
|
||||
}
|
||||
| {
|
||||
skip: false;
|
||||
mmr: number;
|
||||
season_number: number;
|
||||
calibrationBattlesLeft: number;
|
||||
number: number;
|
||||
updated_at: string;
|
||||
neighbors: [];
|
||||
}
|
||||
)
|
||||
>;
|
||||
|
||||
export async function searchCurrentRatingPlayers(region: Region, name: string) {
|
||||
const encodedSearch = encodeURIComponent(name);
|
||||
const response = await fetch(
|
||||
context === "website"
|
||||
? `/api/${region}/rating/current/search/${encodedSearch}`
|
||||
: `https://${regionToRegionSubdomain(
|
||||
region
|
||||
)}.wotblitz.com/en/api/rating-leaderboards/search/?prefix=${encodedSearch}`,
|
||||
{ cache: "no-store" }
|
||||
);
|
||||
const accountList = (await response.json()) as CurrentRatingPlayerSearch;
|
||||
|
||||
return accountList;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { environmentConfig } from "@blitzkit/core";
|
||||
|
||||
export function alias(alias: string, path: string) {
|
||||
const environment = environmentConfig();
|
||||
|
||||
if (!(alias in environment.aliases)) {
|
||||
throw new Error(`Invalid alias "${alias}"`);
|
||||
}
|
||||
|
||||
const base = environment.aliases[alias];
|
||||
|
||||
return `${base}${path}`;
|
||||
}
|
||||
@@ -1,5 +1,25 @@
|
||||
import { GameDefinitions } from "../../protos";
|
||||
import {
|
||||
CamouflageDefinitions,
|
||||
ConsumableDefinitions,
|
||||
EquipmentDefinitions,
|
||||
Gallery,
|
||||
GameDefinitions,
|
||||
MapDefinitions,
|
||||
ModelDefinitions,
|
||||
ProvisionDefinitions,
|
||||
SkillDefinitions,
|
||||
TankDefinitions,
|
||||
} from "@blitzkit/core";
|
||||
|
||||
export abstract class BlitzKitAPI {
|
||||
abstract game(): Promise<GameDefinitions>;
|
||||
abstract skillDefinitions(): Promise<SkillDefinitions>;
|
||||
abstract provisionDefinitions(): Promise<ProvisionDefinitions>;
|
||||
abstract consumableDefinitions(): Promise<ConsumableDefinitions>;
|
||||
abstract equipmentDefinitions(): Promise<EquipmentDefinitions>;
|
||||
abstract mapDefinitions(): Promise<MapDefinitions>;
|
||||
abstract modelDefinitions(): Promise<ModelDefinitions>;
|
||||
abstract camouflageDefinitions(): Promise<CamouflageDefinitions>;
|
||||
abstract tankDefinitions(): Promise<TankDefinitions>;
|
||||
abstract gameDefinitions(): Promise<GameDefinitions>;
|
||||
abstract galleryDefinitions(): Promise<Gallery>;
|
||||
}
|
||||
@@ -1,9 +1,69 @@
|
||||
import { alias } from "@blitzkit/core";
|
||||
import { fetchPB } from "../../protobuf";
|
||||
import { GameDefinitions } from "../../protos";
|
||||
import {
|
||||
CamouflageDefinitions,
|
||||
ConsumableDefinitions,
|
||||
EquipmentDefinitions,
|
||||
Gallery,
|
||||
GameDefinitions,
|
||||
MapDefinitions,
|
||||
ModelDefinitions,
|
||||
ProvisionDefinitions,
|
||||
SkillDefinitions,
|
||||
TankDefinitions,
|
||||
} from "../../protos";
|
||||
import { BlitzKitAPI } from "./base";
|
||||
|
||||
export class ClientBlitzKitAPI extends BlitzKitAPI {
|
||||
game() {
|
||||
return fetchPB("/api/definitions/game.pb", GameDefinitions);
|
||||
gameDefinitions() {
|
||||
return fetchPB(alias("api", "/definitions/game.pb"), GameDefinitions);
|
||||
}
|
||||
|
||||
consumableDefinitions() {
|
||||
return fetchPB(
|
||||
alias("api", "/definitions/consumables.pb"),
|
||||
ConsumableDefinitions,
|
||||
);
|
||||
}
|
||||
|
||||
tankDefinitions() {
|
||||
return fetchPB(alias("api", "/definitions/tanks.pb"), TankDefinitions);
|
||||
}
|
||||
|
||||
camouflageDefinitions() {
|
||||
return fetchPB(
|
||||
alias("api", "/definitions/camouflage.pb"),
|
||||
CamouflageDefinitions,
|
||||
);
|
||||
}
|
||||
|
||||
provisionDefinitions() {
|
||||
return fetchPB(
|
||||
alias("api", "/definitions/provisions.pb"),
|
||||
ProvisionDefinitions,
|
||||
);
|
||||
}
|
||||
|
||||
modelDefinitions() {
|
||||
return fetchPB(alias("api", "/definitions/models.pb"), ModelDefinitions);
|
||||
}
|
||||
|
||||
skillDefinitions() {
|
||||
return fetchPB(alias("api", "/definitions/skills.pb"), SkillDefinitions);
|
||||
}
|
||||
|
||||
equipmentDefinitions() {
|
||||
return fetchPB(
|
||||
alias("api", "/definitions/equipment.pb"),
|
||||
EquipmentDefinitions,
|
||||
);
|
||||
}
|
||||
|
||||
galleryDefinitions() {
|
||||
return fetchPB(alias("api", "/definitions/gallery.pb"), Gallery);
|
||||
}
|
||||
|
||||
mapDefinitions() {
|
||||
return fetchPB(alias("api", "/definitions/maps.pb"), MapDefinitions);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export * from "./base";
|
||||
export * from "./client";
|
||||
export * from "./server";
|
||||
@@ -1,69 +0,0 @@
|
||||
import {
|
||||
AbstractVFS,
|
||||
AvailableNationsYaml,
|
||||
SquadBattleTypeStylesYaml,
|
||||
} from "@blitzkit/core";
|
||||
import { GameDefinitions } from "../../protos";
|
||||
import { BlitzKitAPI } from "./base";
|
||||
|
||||
export class ServerBlitzKitAPI extends BlitzKitAPI {
|
||||
vfs: AbstractVFS;
|
||||
|
||||
constructor(vfs: AbstractVFS) {
|
||||
super();
|
||||
|
||||
this.vfs = vfs;
|
||||
}
|
||||
|
||||
async game() {
|
||||
const versionFile = await this.vfs.text("Data/version.txt");
|
||||
const version = versionFile.split(" ")[0];
|
||||
|
||||
const availableNations = await this.vfs.yaml<AvailableNationsYaml>(
|
||||
"Data/available_nations.yaml",
|
||||
);
|
||||
const nations = availableNations.available_nations;
|
||||
|
||||
const game: GameDefinitions = {
|
||||
version,
|
||||
nations,
|
||||
gameModes: {},
|
||||
roles: {},
|
||||
};
|
||||
|
||||
const squadBattleTypeStyles =
|
||||
await this.vfs.yaml<SquadBattleTypeStylesYaml>(
|
||||
`Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml`,
|
||||
);
|
||||
|
||||
for (const match of squadBattleTypeStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g,
|
||||
)) {
|
||||
const id = Number(match[1]);
|
||||
const name = getString(match[2]);
|
||||
|
||||
gameModeNativeNames[match[3]] = id;
|
||||
game.gameModes[id] = {
|
||||
name,
|
||||
};
|
||||
}
|
||||
|
||||
Object.entries(combatRoles).forEach(([, value]) => {
|
||||
gameDefinitions.roles[value.id] = { provisions: [], consumables: [] };
|
||||
|
||||
value.default_abilities.forEach((ability) => {
|
||||
if (ability in consumableNativeNames) {
|
||||
gameDefinitions.roles[value.id].consumables.push(
|
||||
consumableNativeNames[ability],
|
||||
);
|
||||
} else if (ability in provisionNativeNames) {
|
||||
gameDefinitions.roles[value.id].provisions.push(
|
||||
provisionNativeNames[ability],
|
||||
);
|
||||
} else throw new Error(`Unknown ability ${ability}`);
|
||||
});
|
||||
});
|
||||
|
||||
return game;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
import {
|
||||
BlitzCrewType,
|
||||
BlitzModuleType,
|
||||
BlitzStrings,
|
||||
BlitzTankClass,
|
||||
BlitzTankFilterDefinitionCategory,
|
||||
CamouflagesXml,
|
||||
CamouflagesYaml,
|
||||
CombatRolesYaml,
|
||||
ConsumablesCommon,
|
||||
ConsumableTankCategoryFilterCategory,
|
||||
CrewType,
|
||||
I18nString,
|
||||
MapsYaml,
|
||||
ModuleType,
|
||||
OptionalDevices,
|
||||
OptionalDeviceSlots,
|
||||
ProvisionsCommon,
|
||||
ShellKind,
|
||||
ShellType,
|
||||
SquadBattleTypeStylesYaml,
|
||||
TankClass,
|
||||
TankmenAvatar,
|
||||
toUniqueId,
|
||||
VehicleDefinitionList,
|
||||
} from "@blitzkit/core";
|
||||
import { AbstractVFS } from "@blitzkit/core/src/blitzkit/vfs/abstract";
|
||||
import { SUPPORTED_LOCALE_BLITZ_MAP } from "@blitzkit/i18n";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { parse as parseYaml } from "yaml";
|
||||
import { BlitzKitAPI } from "../base";
|
||||
|
||||
export abstract class ServerBlitzKitAPI0 extends BlitzKitAPI {
|
||||
protected vfs: AbstractVFS;
|
||||
|
||||
protected nationSlugDiscriminators = {
|
||||
china: "cn",
|
||||
european: "eu",
|
||||
france: "fr",
|
||||
germany: "de",
|
||||
japan: "jp",
|
||||
other: "ot",
|
||||
uk: "gb",
|
||||
usa: "us",
|
||||
ussr: "ru",
|
||||
};
|
||||
protected blitzModuleTypeToBlitzkit: Record<
|
||||
keyof BlitzModuleType,
|
||||
ModuleType
|
||||
> = {
|
||||
chassis: ModuleType.MODULE_TYPE_TRACKS,
|
||||
engine: ModuleType.MODULE_TYPE_ENGINE,
|
||||
gun: ModuleType.MODULE_TYPE_GUN,
|
||||
turret: ModuleType.MODULE_TYPE_TURRET,
|
||||
vehicle: ModuleType.MODULE_TYPE_VEHICLE,
|
||||
};
|
||||
protected blitzkitCrewTypeToBlitz: Record<CrewType, BlitzCrewType> = {
|
||||
[CrewType.CREW_TYPE_COMMANDER]: "commander",
|
||||
[CrewType.CREW_TYPE_DRIVER]: "driver",
|
||||
[CrewType.CREW_TYPE_GUNNER]: "gunner",
|
||||
[CrewType.CREW_TYPE_LOADER]: "loader",
|
||||
[CrewType.CREW_TYPE_RADIOMAN]: "radioman",
|
||||
};
|
||||
protected blitzCrewTypeToBlitzkit: Record<BlitzCrewType, CrewType> = {
|
||||
commander: CrewType.CREW_TYPE_COMMANDER,
|
||||
driver: CrewType.CREW_TYPE_DRIVER,
|
||||
gunner: CrewType.CREW_TYPE_GUNNER,
|
||||
loader: CrewType.CREW_TYPE_LOADER,
|
||||
radioman: CrewType.CREW_TYPE_RADIOMAN,
|
||||
};
|
||||
protected blitzTankClassToBlitzkit: Record<BlitzTankClass, TankClass> = {
|
||||
lightTank: TankClass.TANK_CLASS_LIGHT,
|
||||
"AT-SPG": TankClass.TANK_CLASS_TANK_DESTROYER,
|
||||
heavyTank: TankClass.TANK_CLASS_HEAVY,
|
||||
mediumTank: TankClass.TANK_CLASS_MEDIUM,
|
||||
};
|
||||
protected blitzShellKindToBlitzkit: Record<ShellKind, ShellType> = {
|
||||
ARMOR_PIERCING: ShellType.SHELL_TYPE_AP,
|
||||
ARMOR_PIERCING_CR: ShellType.SHELL_TYPE_APCR,
|
||||
HIGH_EXPLOSIVE: ShellType.SHELL_TYPE_HE,
|
||||
HOLLOW_CHARGE: ShellType.SHELL_TYPE_HEAT,
|
||||
};
|
||||
protected blitzTankFilterDefinitionCategoryToBlitzkit: Record<
|
||||
BlitzTankFilterDefinitionCategory,
|
||||
ConsumableTankCategoryFilterCategory
|
||||
> = {
|
||||
clip: ConsumableTankCategoryFilterCategory.CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP,
|
||||
};
|
||||
|
||||
protected botPattern = /^.+((tutorial_bot(\d+)?)|(TU))$/;
|
||||
|
||||
protected stringsI18n: Record<string, Record<string, string>> = {};
|
||||
protected nationsDir?: string[];
|
||||
protected tankStringIdMap: Record<string, number> = {};
|
||||
protected consumablesCommon: ConsumablesCommon = {};
|
||||
protected provisionsCommon: ProvisionsCommon = {};
|
||||
|
||||
// TODO: suffix with "yaml"s and "xml"s
|
||||
protected optionalDevices?: { root: OptionalDevices };
|
||||
protected optionalDeviceSlots?: { root: OptionalDeviceSlots };
|
||||
protected tankmenAvatar?: { root: TankmenAvatar };
|
||||
protected mapsYaml?: MapsYaml;
|
||||
protected camouflagesXml?: { root: CamouflagesXml };
|
||||
protected camouflagesYaml?: CamouflagesYaml;
|
||||
protected squadBattleTypeStyles?: SquadBattleTypeStylesYaml;
|
||||
protected gameTypeSelectorStyles?: SquadBattleTypeStylesYaml;
|
||||
protected combatRoles?: CombatRolesYaml;
|
||||
protected tierEqualizer?: string[][];
|
||||
|
||||
constructor(vfs: AbstractVFS) {
|
||||
super();
|
||||
this.vfs = vfs;
|
||||
}
|
||||
|
||||
async init() {
|
||||
console.log("Initializing virtual file system...");
|
||||
await this.vfs.init();
|
||||
|
||||
console.log("Fetching game data...");
|
||||
this.nationsDir = await this.vfs
|
||||
.dir("Data/XML/item_defs/vehicles")
|
||||
.then((files) => files.filter((nation) => nation !== "common"));
|
||||
|
||||
this.optionalDevices = await this.vfs.xml<{ root: OptionalDevices }>(
|
||||
"Data/XML/item_defs/vehicles/common/optional_devices.xml",
|
||||
);
|
||||
this.optionalDeviceSlots = await this.vfs.xml<{
|
||||
root: OptionalDeviceSlots;
|
||||
}>("Data/XML/item_defs/vehicles/common/optional_device_slots.xml");
|
||||
this.tankmenAvatar = await this.vfs.xml<{ root: TankmenAvatar }>(
|
||||
"Data/XML/item_defs/tankmen/avatar.xml",
|
||||
);
|
||||
this.mapsYaml = await this.vfs.yaml<MapsYaml>("Data/maps.yaml");
|
||||
this.camouflagesXml = await this.vfs.xml<{ root: CamouflagesXml }>(
|
||||
"Data/XML/item_defs/vehicles/common/camouflages.xml",
|
||||
);
|
||||
this.camouflagesYaml = await this.vfs.yaml<CamouflagesYaml>(
|
||||
"Data/camouflages.yaml",
|
||||
);
|
||||
this.squadBattleTypeStyles = await this.vfs.yaml<SquadBattleTypeStylesYaml>(
|
||||
`Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml`,
|
||||
);
|
||||
this.gameTypeSelectorStyles =
|
||||
await this.vfs.yaml<SquadBattleTypeStylesYaml>(
|
||||
`Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`,
|
||||
);
|
||||
this.combatRoles = await this.vfs.yaml<CombatRolesYaml>(
|
||||
`Data/XML/item_defs/vehicles/common/combat_roles.yaml`,
|
||||
);
|
||||
this.tierEqualizer = await this.vfs.csv(
|
||||
// spell:disable-next-line
|
||||
`Data/XML/item_defs/vehicles/common/tier_equializer.csv`,
|
||||
{ delimiter: ";" },
|
||||
);
|
||||
|
||||
console.log("Fetching game localizations...");
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
locales.supported = [locales.supported[0]];
|
||||
}
|
||||
|
||||
let fetchedLocalizations = 0;
|
||||
await Promise.all(
|
||||
locales.supported.map(async ({ locale }) => {
|
||||
const blitzLocale = SUPPORTED_LOCALE_BLITZ_MAP[locale];
|
||||
const cache = await fetch(
|
||||
`https://stufficons.wgcdn.co/localizations/${blitzLocale}.yaml`,
|
||||
)
|
||||
.then((response) => response.text())
|
||||
.then((string) => parseYaml(string) as BlitzStrings);
|
||||
const preInstalled = await this.vfs.yaml<BlitzStrings>(
|
||||
`Data/Strings/${blitzLocale}.yaml`,
|
||||
);
|
||||
|
||||
this.stringsI18n[locale] = {
|
||||
...cache,
|
||||
...preInstalled,
|
||||
};
|
||||
|
||||
console.log(
|
||||
`Fetched localizations for ${locale} (${++fetchedLocalizations}/${locales.supported.length})`,
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
console.log("Fetching consumable and provision data...");
|
||||
|
||||
for (const match of (
|
||||
await this.vfs.text(
|
||||
`Data/XML/item_defs/vehicles/common/consumables/list.xml`,
|
||||
)
|
||||
).matchAll(/<items path="(.+)\.xml"\/>/g)) {
|
||||
if (match[1] === "prototypes") continue;
|
||||
|
||||
Object.assign(
|
||||
this.consumablesCommon,
|
||||
(
|
||||
await this.vfs.xml<{ root: ConsumablesCommon }>(
|
||||
`Data/XML/item_defs/vehicles/common/consumables/${match[1]}.xml`,
|
||||
)
|
||||
).root,
|
||||
);
|
||||
}
|
||||
|
||||
for (const match of (
|
||||
await this.vfs.text(
|
||||
`Data/XML/item_defs/vehicles/common/provisions/list.xml`,
|
||||
)
|
||||
).matchAll(/<items path="(.+)\.xml"\/>/g)) {
|
||||
if (match[1] === "prototypes") continue;
|
||||
|
||||
Object.assign(
|
||||
this.provisionsCommon,
|
||||
(
|
||||
await this.vfs.xml<{ root: ConsumablesCommon }>(
|
||||
`Data/XML/item_defs/vehicles/common/provisions/${match[1]}.xml`,
|
||||
)
|
||||
).root,
|
||||
);
|
||||
}
|
||||
|
||||
for (const nation of this.nationsDir!) {
|
||||
const tankList = await this.vfs.xml<{ root: VehicleDefinitionList }>(
|
||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
||||
);
|
||||
|
||||
for (const tankKey in tankList.root) {
|
||||
if (this.botPattern.test(tankKey)) continue;
|
||||
|
||||
const tank = tankList.root[tankKey];
|
||||
const tankId = toUniqueId(nation, tank.id);
|
||||
|
||||
this.tankStringIdMap[`${nation}:${tankKey}`] = tankId;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected getString(name: string) {
|
||||
const collection: Record<string, string> = {
|
||||
[locales.default]: this.stringsI18n[locales.default][name],
|
||||
};
|
||||
|
||||
for (const { locale } of locales.supported) {
|
||||
const localizedString = this.stringsI18n[locale][name];
|
||||
|
||||
if (
|
||||
localizedString === undefined ||
|
||||
localizedString === collection[locales.default]
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
collection[locale] = localizedString;
|
||||
}
|
||||
|
||||
return { locales: collection } satisfies I18nString;
|
||||
}
|
||||
}
|
||||
|
||||
export function Cache(disableInDev = false) {
|
||||
const cache = new WeakMap<object, Map<string, Promise<unknown>>>();
|
||||
|
||||
return function <This, Arguments extends any[], Return>(
|
||||
target: (this: This, ...args: Arguments) => Promise<Return>,
|
||||
// TODO: evaluate if we need context to make the error trace easier
|
||||
// context: ClassMethodDecoratorContext<
|
||||
// This,
|
||||
// (this: This, ...args: Arguments) => Promise<Return>
|
||||
// >,
|
||||
) {
|
||||
return async function replacementMethod(this: This, ...args: Arguments) {
|
||||
const key = args.join("-");
|
||||
let thisCache: Map<string, Promise<Return>>;
|
||||
|
||||
if (cache.has(this as object)) {
|
||||
thisCache = cache.get(this as object) as Map<string, Promise<Return>>;
|
||||
} else {
|
||||
thisCache = new Map();
|
||||
cache.set(this as object, thisCache);
|
||||
}
|
||||
|
||||
const disabled = disableInDev && import.meta.env.DEV;
|
||||
|
||||
if (thisCache.has(key) && !disabled) {
|
||||
return thisCache.get(key)!;
|
||||
}
|
||||
|
||||
const promise = (async () => {
|
||||
try {
|
||||
return await target.apply(this, args);
|
||||
} catch (error) {
|
||||
thisCache!.delete(key);
|
||||
throw error;
|
||||
}
|
||||
})();
|
||||
|
||||
thisCache.set(key, promise);
|
||||
|
||||
return promise;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { Avatar, fetchGlossary, Gallery } from "@blitzkit/core";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { extname } from "path";
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI9 } from "./9_gameDefinitions";
|
||||
|
||||
export abstract class ServerBlitzKitAPI10 extends ServerBlitzKitAPI9 {
|
||||
@Cache()
|
||||
async galleryDefinitions() {
|
||||
const avatars: Record<string, { avatar: Avatar; url: string }> = {};
|
||||
|
||||
await Promise.all(
|
||||
locales.supported.map(async (supported) => {
|
||||
const glossary = await fetchGlossary(
|
||||
supported.blitz ?? supported.locale,
|
||||
);
|
||||
|
||||
console.log(
|
||||
`Found ${Object.keys(glossary).length} things for ${supported.locale}`,
|
||||
);
|
||||
|
||||
for (const key in glossary) {
|
||||
const glossaryEntry = glossary[key];
|
||||
|
||||
if (
|
||||
!key.startsWith("avatar") ||
|
||||
key.endsWith("_part") ||
|
||||
glossaryEntry.image_url === null
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key in avatars) {
|
||||
avatars[key].avatar.name!.locales[supported.locale] =
|
||||
glossaryEntry.title;
|
||||
} else {
|
||||
const extension = extname(glossaryEntry.image_url);
|
||||
|
||||
avatars[key] = {
|
||||
url: glossaryEntry.image_url,
|
||||
avatar: {
|
||||
id: key,
|
||||
name: { locales: { [supported.locale]: glossaryEntry.title } },
|
||||
extension,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
const gallery: Gallery = { avatars: [] };
|
||||
|
||||
await Promise.all(
|
||||
Object.entries(avatars).map(async ([key, { url, avatar }]) => {
|
||||
if (!(locales.default in avatars[key].avatar.name!.locales)) {
|
||||
console.warn(`Avatar ${key} has no ${locales.default} name`);
|
||||
return;
|
||||
}
|
||||
|
||||
gallery.avatars.push(avatar);
|
||||
}),
|
||||
);
|
||||
|
||||
return gallery;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,718 @@
|
||||
import {
|
||||
AssaultRanges,
|
||||
BlitzCrewType,
|
||||
BlitzModuleType,
|
||||
BlitzTankClass,
|
||||
ChassisDefinitionsList,
|
||||
Crew,
|
||||
EngineDefinitionsList,
|
||||
Equalizer,
|
||||
GunDefinition,
|
||||
GunDefinitionsList,
|
||||
ModuleType,
|
||||
ResearchCost,
|
||||
ShellDefinitionsList,
|
||||
ShellKind,
|
||||
sluggify,
|
||||
TankDefinitions,
|
||||
TankPrice,
|
||||
TankPriceType,
|
||||
TankType,
|
||||
toUniqueId,
|
||||
TurretDefinitionsList,
|
||||
Unlock,
|
||||
UnlocksListing,
|
||||
VehicleDefinitionList,
|
||||
VehicleDefinitions,
|
||||
} from "@blitzkit/core";
|
||||
import { Cache, ServerBlitzKitAPI0 } from "./0_base";
|
||||
|
||||
export abstract class ServerBlitzKitAPI1 extends ServerBlitzKitAPI0 {
|
||||
private parseResearchCost(raw: number | string) {
|
||||
if (typeof raw === "number") {
|
||||
return {
|
||||
research_cost_type: { $case: "xp", value: raw },
|
||||
} satisfies ResearchCost;
|
||||
} else {
|
||||
return {
|
||||
research_cost_type: {
|
||||
$case: "seasonal_tokens",
|
||||
value: {
|
||||
season: Number(/prx_season_(\d+):\d+/.exec(raw)![1]),
|
||||
tokens: Number(/prx_season_\d+:(\d+)/.exec(raw)![1]),
|
||||
},
|
||||
},
|
||||
} satisfies ResearchCost;
|
||||
}
|
||||
}
|
||||
|
||||
@Cache()
|
||||
async tankDefinitions() {
|
||||
const tankDefinitions = TankDefinitions.create();
|
||||
|
||||
const gameModeNativeNames: Record<string, number> = {};
|
||||
const squadBattleTypeGameModeNativeNameMatches =
|
||||
this.squadBattleTypeStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g,
|
||||
);
|
||||
const gameTypeGameModeNativeNameMatches =
|
||||
this.gameTypeSelectorStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/eGameMode\.([a-zA-Z]+) -> "~res:\/Gfx\/UI\/Hangar\/GameTypes\/battle-type_([^"]+)"/g,
|
||||
);
|
||||
|
||||
for (const match of squadBattleTypeGameModeNativeNameMatches) {
|
||||
const id = Number(match[1]);
|
||||
gameModeNativeNames[match[3]] = id;
|
||||
}
|
||||
|
||||
for (const match of gameTypeGameModeNativeNameMatches) {
|
||||
Object.entries(gameModeNativeNames).forEach(([key, value]) => {
|
||||
if (key.toLowerCase() === match[2].toLowerCase()) {
|
||||
gameModeNativeNames[match[1]] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const slugRequesters = new Map<string, { id: number; key: string }[]>();
|
||||
const idToNation: Record<number, string> = {};
|
||||
|
||||
for (const nation of this.nationsDir!) {
|
||||
const tankList = await this.vfs.xml<{ root: VehicleDefinitionList }>(
|
||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
||||
);
|
||||
|
||||
for (const tankKey in tankList.root) {
|
||||
if (this.botPattern.test(tankKey)) continue;
|
||||
|
||||
const tank = tankList.root[tankKey];
|
||||
const tankId = toUniqueId(nation, tank.id);
|
||||
|
||||
const name = (
|
||||
(tank.shortUserString
|
||||
? this.getString(tank.shortUserString)
|
||||
: undefined) ?? this.getString(tank.userString)
|
||||
).locales.en;
|
||||
|
||||
let slug = sluggify(name);
|
||||
|
||||
idToNation[tankId] = nation;
|
||||
|
||||
if (slugRequesters.has(slug)) {
|
||||
slugRequesters.get(slug)!.push({ id: tankId, key: tankKey });
|
||||
} else {
|
||||
slugRequesters.set(slug, [{ id: tankId, key: tankKey }]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const slugs = new Map<number, string>();
|
||||
|
||||
slugRequesters.forEach((requesters, slug) => {
|
||||
if (requesters.length === 1) {
|
||||
slugs.set(requesters[0].id, slug);
|
||||
return;
|
||||
}
|
||||
|
||||
console.warn(
|
||||
`Multiple tanks share slug ${slug}: ${requesters
|
||||
.map(({ key }) => key)
|
||||
.join(", ")}`,
|
||||
);
|
||||
|
||||
if (requesters.length !== 2) {
|
||||
throw new Error("Unresolvable number of duplicates :(");
|
||||
}
|
||||
|
||||
const nonCanonical = requesters.find(({ key }) => key.endsWith("TUR"));
|
||||
|
||||
if (nonCanonical === undefined) {
|
||||
console.log("Using nations to discriminate");
|
||||
// both are non-tutorial tanks, will have to discriminate using nation
|
||||
|
||||
requesters.forEach(({ id, key }) => {
|
||||
const nation = idToNation[id];
|
||||
const discriminator =
|
||||
this.nationSlugDiscriminators[
|
||||
nation as keyof typeof this.nationSlugDiscriminators
|
||||
];
|
||||
|
||||
console.log(`Solution: ${key} -> ${slug}-${discriminator}`);
|
||||
slugs.set(id, `${slug}-${discriminator}`);
|
||||
});
|
||||
} else {
|
||||
console.log("Using tutorial bot suffix to discriminate");
|
||||
|
||||
const canonical = requesters.find(({ key }) => !key.endsWith("TUR"));
|
||||
|
||||
if (canonical === undefined) {
|
||||
throw new Error(
|
||||
"Two tutorial bots share the same slug? The world is truly broken.",
|
||||
);
|
||||
}
|
||||
|
||||
console.log(`Solution: ${canonical.key} -> ${slug}`);
|
||||
slugs.set(canonical.id, slug);
|
||||
console.log(`Solution: ${nonCanonical.key} -> ${slug}-tur`);
|
||||
slugs.set(nonCanonical.id, `${slug}-tur`);
|
||||
}
|
||||
});
|
||||
|
||||
const tankXps = new Map<number, ResearchCost>();
|
||||
|
||||
for (const nation of this.nationsDir!) {
|
||||
const tankList = await this.vfs.xml<{ root: VehicleDefinitionList }>(
|
||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
||||
);
|
||||
const turretList = await this.vfs.xml<{
|
||||
root: TurretDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/turrets.xml`);
|
||||
const gunList = await this.vfs.xml<{
|
||||
root: GunDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/guns.xml`);
|
||||
const shellList = await this.vfs.xml<{
|
||||
root: ShellDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/shells.xml`);
|
||||
const enginesList = await this.vfs.xml<{
|
||||
root: EngineDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/engines.xml`);
|
||||
const chassisList = await this.vfs.xml<{
|
||||
root: ChassisDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/chassis.xml`);
|
||||
|
||||
function resolveUnlocks(
|
||||
blitzModuleTypeToBlitzkit: Record<keyof BlitzModuleType, ModuleType>,
|
||||
unlocks?: BlitzModuleType,
|
||||
) {
|
||||
if (!unlocks) return [];
|
||||
|
||||
return Object.entries(unlocks)
|
||||
.map(([type, list]) =>
|
||||
(Array.isArray(list) ? list : [list]).map((item) => {
|
||||
const typeTyped = type as keyof BlitzModuleType;
|
||||
let rawId: number;
|
||||
|
||||
if (typeTyped === "chassis") {
|
||||
rawId = chassisList.root.ids[item["#text"]];
|
||||
} else if (typeTyped === "engine") {
|
||||
rawId = enginesList.root.ids[item["#text"]];
|
||||
} else if (typeTyped === "gun") {
|
||||
rawId = gunList.root.ids[item["#text"]];
|
||||
} else if (typeTyped === "turret") {
|
||||
rawId = turretList.root.ids[item["#text"]];
|
||||
} else if (typeTyped === "vehicle") {
|
||||
rawId = tankList.root[item["#text"]].id;
|
||||
}
|
||||
|
||||
return {
|
||||
id: toUniqueId(nation, rawId!),
|
||||
type: blitzModuleTypeToBlitzkit[typeTyped],
|
||||
cost: {
|
||||
type:
|
||||
typeof item.cost === "number"
|
||||
? "xp"
|
||||
: item.cost.split(":")[0],
|
||||
value:
|
||||
typeof item.cost === "number"
|
||||
? item.cost
|
||||
: Number(item.cost.split(":")[1]),
|
||||
},
|
||||
} satisfies Unlock;
|
||||
}),
|
||||
)
|
||||
.flat();
|
||||
}
|
||||
|
||||
for (const tankKey in tankList.root) {
|
||||
if (this.botPattern.test(tankKey)) continue;
|
||||
|
||||
const gunXps = new Map<number, ResearchCost>();
|
||||
const turretXps = new Map<number, ResearchCost>();
|
||||
const engineXps = new Map<number, ResearchCost>();
|
||||
const trackXps = new Map<number, ResearchCost>();
|
||||
const tank = tankList.root[tankKey];
|
||||
let tankPrice: TankPrice;
|
||||
const tankDefinition = await this.vfs.xml<{ root: VehicleDefinitions }>(
|
||||
`Data/XML/item_defs/vehicles/${nation}/${tankKey}.xml`,
|
||||
);
|
||||
const tankId = toUniqueId(nation, tank.id);
|
||||
|
||||
const tankTags = tank.tags.split(" ");
|
||||
const equipment = tankDefinition.root.optDevicePreset;
|
||||
|
||||
const slug = slugs.get(tankId);
|
||||
|
||||
if (slug === undefined) {
|
||||
throw new Error(
|
||||
`Could not find slug for ${nation}/${tankKey} (${tankId})`,
|
||||
);
|
||||
}
|
||||
|
||||
if (tank.sellPrice) {
|
||||
tankPrice = {
|
||||
type: TankPriceType.TANK_PRICE_TYPE_GOLD,
|
||||
value: tank.sellPrice["#text"] * 2,
|
||||
};
|
||||
} else if (typeof tank.price === "number") {
|
||||
tankPrice = {
|
||||
type: TankPriceType.TANK_PRICE_TYPE_CREDITS,
|
||||
value: tank.price,
|
||||
};
|
||||
} else {
|
||||
tankPrice = {
|
||||
type: TankPriceType.TANK_PRICE_TYPE_CREDITS,
|
||||
value: tank.price["#text"] * 400,
|
||||
};
|
||||
}
|
||||
|
||||
const crew: Crew[] = [];
|
||||
const fixedCamouflage = tankTags.includes("eventCamouflage_user");
|
||||
const totalUnlocks: UnlocksListing[] = [];
|
||||
|
||||
for (const crewKey in tankDefinition.root.crew) {
|
||||
const value = tankDefinition.root.crew[crewKey as BlitzCrewType];
|
||||
let entry: Crew;
|
||||
const index = crew.findIndex(
|
||||
({ type }) => this.blitzkitCrewTypeToBlitz[type] === crewKey,
|
||||
);
|
||||
if (index === -1) {
|
||||
if (crewKey === "#text") continue;
|
||||
entry = {
|
||||
type: this.blitzCrewTypeToBlitzkit[crewKey as BlitzCrewType],
|
||||
count: 0,
|
||||
substitute: [],
|
||||
};
|
||||
crew.push(entry);
|
||||
} else {
|
||||
entry = crew[index];
|
||||
}
|
||||
|
||||
if (typeof value === "string") {
|
||||
entry.count++;
|
||||
|
||||
if (value !== "") {
|
||||
entry.substitute = value.split(/\n| /).map((member) => {
|
||||
return this.blitzCrewTypeToBlitzkit[
|
||||
member.trim() as BlitzCrewType
|
||||
];
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (entry.count === undefined) {
|
||||
entry.count = value.length;
|
||||
} else {
|
||||
entry.count += value.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const camouflages = Object.entries(
|
||||
this.camouflagesXml!.root.camouflages,
|
||||
)
|
||||
.filter(([, camo]) => {
|
||||
if (!camo.vehicleFilter.include) return false;
|
||||
if (camo.unlockCostCategory !== "legendary-skins-gold")
|
||||
return false;
|
||||
|
||||
const includeArray = Array.isArray(camo.vehicleFilter.include)
|
||||
? camo.vehicleFilter.include
|
||||
: [camo.vehicleFilter.include];
|
||||
|
||||
return includeArray.some((filter) => {
|
||||
if ("vehicle" in filter && filter.vehicle?.name) {
|
||||
return filter.vehicle.name === `${nation}:${tankKey}`;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
})
|
||||
.map(([, camo]) => camo.id);
|
||||
|
||||
let equalizerEntry = this.tierEqualizer!.find(
|
||||
(line) => line[0] === `${nation}:${tankKey}`,
|
||||
);
|
||||
|
||||
let equalizer: Equalizer | undefined;
|
||||
|
||||
if (equalizerEntry) {
|
||||
const [health, penetration, module_health, damage, armor] =
|
||||
equalizerEntry?.slice(1).map(Number);
|
||||
equalizer = { health, penetration, module_health, damage, armor };
|
||||
}
|
||||
|
||||
tankDefinitions.tanks[tankId] = {
|
||||
ancestors: [],
|
||||
successors: [],
|
||||
id: tankId,
|
||||
dev_name: tankKey,
|
||||
roles: {},
|
||||
camouflages: camouflages,
|
||||
fixed_camouflage: fixedCamouflage,
|
||||
crew,
|
||||
weight: tankDefinition.root.hull.weight,
|
||||
health: tankDefinition.root.hull.maxHealth,
|
||||
speed_forwards: tankDefinition.root.speedLimits.forward,
|
||||
speed_backwards: tankDefinition.root.speedLimits.backward,
|
||||
equipment_preset:
|
||||
typeof equipment === "string" ? equipment : equipment.at(-1)!,
|
||||
max_consumables: tankDefinition.root.consumableSlots,
|
||||
max_provisions: tankDefinition.root.provisionSlots,
|
||||
name:
|
||||
(tank.shortUserString
|
||||
? this.getString(tank.shortUserString)
|
||||
: undefined) ?? this.getString(tank.userString),
|
||||
slug,
|
||||
nation,
|
||||
type: tankTags.includes("collectible")
|
||||
? TankType.TANK_TYPE_COLLECTOR
|
||||
: (typeof tank.price === "number" ? false : "gold" in tank.price)
|
||||
? TankType.TANK_TYPE_PREMIUM
|
||||
: TankType.TANK_TYPE_RESEARCHABLE,
|
||||
tier: tank.level,
|
||||
class: this.blitzTankClassToBlitzkit[tankTags[0] as BlitzTankClass],
|
||||
testing: tankTags.includes("testTank"),
|
||||
deprecated: tankTags.includes("deprecated"),
|
||||
price: tankPrice,
|
||||
camouflage_still: tankDefinition.root.invisibility.still,
|
||||
camouflage_moving: tankDefinition.root.invisibility.moving,
|
||||
camouflage_on_fire: tankDefinition.root.invisibility.firePenalty,
|
||||
turrets: [],
|
||||
engines: [],
|
||||
tracks: [],
|
||||
equalizer,
|
||||
};
|
||||
|
||||
if (tank.combatRole) {
|
||||
Object.entries(tank.combatRole).forEach(([gameMode, role]) => {
|
||||
const id = Object.entries(gameModeNativeNames).find(
|
||||
([key]) => key.toLowerCase() === gameMode.toLowerCase(),
|
||||
)?.[1];
|
||||
|
||||
if (id === undefined) {
|
||||
throw new Error(
|
||||
`Unknown game mode in tank ${tankKey}: ${gameMode}`,
|
||||
);
|
||||
}
|
||||
|
||||
tankDefinitions.tanks[tankId].roles[id] =
|
||||
this.combatRoles![role].id;
|
||||
});
|
||||
}
|
||||
|
||||
Object.keys(tankDefinition.root.chassis).forEach((key) => {
|
||||
const track = tankDefinition.root.chassis[key];
|
||||
const trackId = toUniqueId(nation, chassisList.root.ids[key]);
|
||||
const terrainResistances = track.terrainResistance
|
||||
.split(" ")
|
||||
.map(Number);
|
||||
|
||||
totalUnlocks.push(track.unlocks);
|
||||
tankDefinitions.tanks[tankId].tracks.push({
|
||||
id: trackId,
|
||||
weight: track.weight,
|
||||
name: this.getString(track.userString),
|
||||
traverse_speed: track.rotationSpeed,
|
||||
dispersion_move: track.shotDispersionFactors.vehicleMovement,
|
||||
dispersion_traverse: track.shotDispersionFactors.vehicleRotation,
|
||||
resistance_hard: terrainResistances[0],
|
||||
resistance_medium: terrainResistances[1],
|
||||
resistance_soft: terrainResistances[2],
|
||||
tier: track.level,
|
||||
unlocks: resolveUnlocks(
|
||||
this.blitzModuleTypeToBlitzkit,
|
||||
track.unlocks,
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
Object.keys(tankDefinition.root.engines).forEach((engineKey) => {
|
||||
const engine = tankDefinition.root.engines[engineKey];
|
||||
const engineListEntry = enginesList.root.shared[engineKey];
|
||||
const engineId = toUniqueId(nation, enginesList.root.ids[engineKey]);
|
||||
|
||||
totalUnlocks.push(engine.unlocks);
|
||||
tankDefinitions.tanks[tankId].engines.push({
|
||||
id: engineId,
|
||||
name: this.getString(engineListEntry.userString),
|
||||
fire_chance: engineListEntry.fireStartingChance,
|
||||
tier: engineListEntry.level,
|
||||
weight: engineListEntry.weight,
|
||||
power: engineListEntry.power,
|
||||
unlocks: resolveUnlocks(
|
||||
this.blitzModuleTypeToBlitzkit,
|
||||
engine.unlocks,
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
let turretIndex = 0;
|
||||
for (const turretKey in tankDefinition.root.turrets0) {
|
||||
const turret = tankDefinition.root.turrets0[turretKey];
|
||||
const turretId = toUniqueId(nation, turretList.root.ids[turretKey]);
|
||||
|
||||
totalUnlocks.push(turret.unlocks);
|
||||
|
||||
tankDefinitions.tanks[tankId].turrets.push({
|
||||
id: turretId,
|
||||
traverse_speed: turret.rotationSpeed,
|
||||
name: this.getString(turret.userString),
|
||||
tier: turret.level,
|
||||
guns: [],
|
||||
health: turret.maxHealth,
|
||||
view_range: turret.circularVisionRadius,
|
||||
weight: turret.weight,
|
||||
unlocks: resolveUnlocks(
|
||||
this.blitzModuleTypeToBlitzkit,
|
||||
turret.unlocks,
|
||||
),
|
||||
});
|
||||
|
||||
let gunIndex = 0;
|
||||
for (const gunKey in turret.guns) {
|
||||
const gun = turret.guns[gunKey];
|
||||
const gunId = toUniqueId(nation, gunList.root.ids[gunKey]);
|
||||
const gunListEntry = gunList.root.shared[gunKey];
|
||||
const gunName = this.getString(gunListEntry.userString);
|
||||
const gunType =
|
||||
"clip" in gun
|
||||
? gun.pumpGunMode
|
||||
? "autoReloader"
|
||||
: "autoLoader"
|
||||
: "regular";
|
||||
const gunClipCount = gunType === "regular" ? 1 : gun.clip!.count;
|
||||
const shotDispersionFactors =
|
||||
gun.shotDispersionFactors ?? gunListEntry.shotDispersionFactors;
|
||||
let assault_ranges: AssaultRanges | undefined;
|
||||
|
||||
if (gun.extras?.trayShell) {
|
||||
const types = gun.extras.trayShell.kinds
|
||||
.split(" ")
|
||||
.map((string) => {
|
||||
const trimmed = string.trim();
|
||||
|
||||
if (trimmed in this.blitzShellKindToBlitzkit) {
|
||||
return this.blitzShellKindToBlitzkit[trimmed as ShellKind];
|
||||
}
|
||||
|
||||
throw new SyntaxError(`Invalid shell kind: ${trimmed}`);
|
||||
});
|
||||
const sectorNames = Object.keys(gun.extras.trayShell.sectors);
|
||||
|
||||
if (sectorNames.length !== 1 || sectorNames[0] !== "sector") {
|
||||
throw new SyntaxError("Invalid tray shell sector");
|
||||
}
|
||||
|
||||
const sector = gun.extras.trayShell.sectors.sector;
|
||||
|
||||
assault_ranges = {
|
||||
types,
|
||||
ranges: sector.map((value) => ({
|
||||
factor: value.factor,
|
||||
distance: value.distance,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
totalUnlocks.push(gun.unlocks);
|
||||
|
||||
tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({
|
||||
id: gunId,
|
||||
weight: gunListEntry.weight,
|
||||
rotation_speed: gunListEntry.rotationSpeed,
|
||||
name: gunName,
|
||||
tier: gunListEntry.level,
|
||||
shells: [],
|
||||
camouflage_loss:
|
||||
typeof gun.invisibilityFactorAtShot === "number"
|
||||
? gun.invisibilityFactorAtShot
|
||||
: gun.invisibilityFactorAtShot.at(-1)!,
|
||||
aim_time: gun.aimingTime ?? gunListEntry.aimingTime,
|
||||
dispersion_base:
|
||||
gun.shotDispersionRadius ?? gunListEntry.shotDispersionRadius,
|
||||
dispersion_damaged: shotDispersionFactors.whileGunDamaged,
|
||||
dispersion_shot: shotDispersionFactors.afterShot,
|
||||
dispersion_traverse: shotDispersionFactors.turretRotation,
|
||||
unlocks: resolveUnlocks(
|
||||
this.blitzModuleTypeToBlitzkit,
|
||||
gun.unlocks,
|
||||
),
|
||||
shell_capacity: gun.maxAmmo ?? gunListEntry.maxAmmo,
|
||||
assault_ranges,
|
||||
burst:
|
||||
gun.burst && gun.burst.count > 1
|
||||
? {
|
||||
count: gun.burst.count,
|
||||
interval: 60 / gun.burst.rate,
|
||||
}
|
||||
: undefined,
|
||||
gun_type:
|
||||
gunType === "regular"
|
||||
? {
|
||||
$case: "regular",
|
||||
value: {
|
||||
reload: gun.reloadTime,
|
||||
},
|
||||
}
|
||||
: gunType === "autoReloader"
|
||||
? {
|
||||
$case: "auto_reloader",
|
||||
value: {
|
||||
intra_clip: 60 / gun.clip!.rate,
|
||||
shell_count: gunClipCount,
|
||||
shell_reloads: gun
|
||||
.pumpGunReloadTimes!.split(" ")
|
||||
.map(Number),
|
||||
},
|
||||
}
|
||||
: {
|
||||
$case: "auto_loader",
|
||||
value: {
|
||||
intra_clip: 60 / gun.clip!.rate,
|
||||
clip_reload: gun.reloadTime,
|
||||
shell_count: gunClipCount,
|
||||
},
|
||||
},
|
||||
} satisfies GunDefinition);
|
||||
|
||||
for (const shellKey in gunListEntry.shots) {
|
||||
const gunShellEntry = gunListEntry.shots[shellKey];
|
||||
const shell = shellList.root[shellKey];
|
||||
const shellId = toUniqueId(nation, shell.id);
|
||||
const shellName = this.getString(shell.userString);
|
||||
const penetrationRaw = gunShellEntry.piercingPower
|
||||
.split(" ")
|
||||
.filter((penetrationString) => penetrationString !== "")
|
||||
.map(Number);
|
||||
|
||||
tankDefinitions.tanks[tankId].turrets[turretIndex].guns[
|
||||
gunIndex
|
||||
].shells.push({
|
||||
id: shellId,
|
||||
name: shellName,
|
||||
velocity: gunShellEntry.speed,
|
||||
armor_damage: shell.damage.armor,
|
||||
module_damage: shell.damage.devices,
|
||||
caliber: shell.caliber,
|
||||
normalization: shell.normalizationAngle,
|
||||
ricochet: shell.ricochetAngle,
|
||||
type: this.blitzShellKindToBlitzkit[shell.kind],
|
||||
explosion_radius:
|
||||
shell.kind === "HIGH_EXPLOSIVE"
|
||||
? (shell.explosionRadius ?? 0)
|
||||
: undefined,
|
||||
icon: shell.icon,
|
||||
penetration: {
|
||||
near: penetrationRaw[0],
|
||||
far: penetrationRaw[1],
|
||||
},
|
||||
range: gunShellEntry.maxDistance,
|
||||
});
|
||||
}
|
||||
|
||||
gunIndex++;
|
||||
}
|
||||
|
||||
turretIndex++;
|
||||
}
|
||||
|
||||
for (const unlocks of totalUnlocks) {
|
||||
if (unlocks === undefined) continue;
|
||||
|
||||
for (const key in unlocks) {
|
||||
const value = unlocks[key as keyof BlitzModuleType];
|
||||
|
||||
for (const vehicle of Array.isArray(value) ? value : [value]) {
|
||||
switch (key as keyof BlitzModuleType) {
|
||||
case "vehicle": {
|
||||
const tankListEntry = tankList.root[vehicle["#text"]];
|
||||
const currentTank = tankDefinitions.tanks[tankId];
|
||||
const successorId = toUniqueId(nation, tankListEntry.id);
|
||||
|
||||
tankXps.set(
|
||||
successorId,
|
||||
this.parseResearchCost(vehicle.cost),
|
||||
);
|
||||
|
||||
if (currentTank.successors === undefined) {
|
||||
currentTank.successors = [];
|
||||
}
|
||||
if (!currentTank.successors!.includes(successorId)) {
|
||||
currentTank.successors!.push(successorId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "gun": {
|
||||
gunXps.set(
|
||||
toUniqueId(nation, gunList.root.ids[vehicle["#text"]]),
|
||||
this.parseResearchCost(vehicle.cost),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case "turret": {
|
||||
turretXps.set(
|
||||
toUniqueId(nation, turretList.root.ids[vehicle["#text"]]),
|
||||
this.parseResearchCost(vehicle.cost),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case "engine": {
|
||||
engineXps.set(
|
||||
toUniqueId(nation, enginesList.root.ids[vehicle["#text"]]),
|
||||
this.parseResearchCost(vehicle.cost),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case "chassis": {
|
||||
trackXps.set(
|
||||
toUniqueId(nation, chassisList.root.ids[vehicle["#text"]]),
|
||||
this.parseResearchCost(vehicle.cost),
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.values(tankDefinitions.tanks[tankId].turrets).forEach(
|
||||
(turret) => {
|
||||
turret.research_cost = turretXps.get(turret.id);
|
||||
|
||||
Object.values(turret.guns).forEach((gunRaw) => {
|
||||
gunRaw.research_cost = gunXps.get(gunRaw.id);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Object.values(tankDefinitions.tanks[tankId].engines).forEach(
|
||||
(engine) => {
|
||||
engine.research_cost = engineXps.get(engine.id);
|
||||
},
|
||||
);
|
||||
|
||||
Object.values(tankDefinitions.tanks[tankId].tracks).forEach((track) => {
|
||||
track.research_cost = trackXps.get(track.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Object.values(tankDefinitions.tanks).forEach((tank) => {
|
||||
tank.research_cost = tankXps.get(tank.id);
|
||||
});
|
||||
|
||||
Object.values(tankDefinitions.tanks).forEach((tank) => {
|
||||
tank.successors?.forEach((predecessorId) => {
|
||||
if (
|
||||
!tankDefinitions.tanks[predecessorId].ancestors?.includes(tank.id)
|
||||
) {
|
||||
tankDefinitions.tanks[predecessorId].ancestors?.push(tank.id);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return tankDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { CamouflageDefinitions } from "@blitzkit/core";
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI1 } from "./1_tankDefinitions";
|
||||
|
||||
export abstract class ServerBlitzKitAPI2 extends ServerBlitzKitAPI1 {
|
||||
@Cache()
|
||||
async camouflageDefinitions() {
|
||||
const camouflageDefinitions = CamouflageDefinitions.create();
|
||||
|
||||
for (const camoKey in this.camouflagesXml!.root.camouflages) {
|
||||
const camo = this.camouflagesXml!.root.camouflages[camoKey];
|
||||
|
||||
const yamlEntry = this.camouflagesYaml![camoKey];
|
||||
const fullName = yamlEntry.userString
|
||||
? this.getString(yamlEntry.userString)
|
||||
: undefined;
|
||||
const shortName = yamlEntry.shortUserString
|
||||
? this.getString(yamlEntry.shortUserString)
|
||||
: undefined;
|
||||
const resolvedTankName = shortName ?? fullName;
|
||||
const resolvedTankNameFull =
|
||||
resolvedTankName === fullName ? undefined : fullName;
|
||||
|
||||
camouflageDefinitions.camouflages[camo.id] = {
|
||||
id: camo.id,
|
||||
name: this.getString(camo.userString),
|
||||
tank_name: resolvedTankName,
|
||||
tank_name_full: resolvedTankNameFull,
|
||||
};
|
||||
}
|
||||
|
||||
return camouflageDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
import {
|
||||
Armor,
|
||||
BlitzCrewType,
|
||||
ChassisDefinitionsList,
|
||||
Crew,
|
||||
EngineDefinitionsList,
|
||||
GunDefinitionsList,
|
||||
ModelDefinitions,
|
||||
ResearchCost,
|
||||
TankParameters,
|
||||
toUniqueId,
|
||||
TurretDefinitionsList,
|
||||
Vector3,
|
||||
VehicleDefinitionArmor,
|
||||
VehicleDefinitionList,
|
||||
VehicleDefinitions,
|
||||
} from "@blitzkit/core";
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI2 } from "./2_camouflageDefinitions";
|
||||
import { parse as parsePath } from "path";
|
||||
import { Vector3Tuple } from "three";
|
||||
|
||||
export abstract class ServerBlitzKitAPI3 extends ServerBlitzKitAPI2 {
|
||||
private vector3TupleToBlitzkit(tuple: Vector3Tuple) {
|
||||
return { x: tuple[0], y: tuple[1], z: tuple[2] } satisfies Vector3;
|
||||
}
|
||||
|
||||
private assignArmor(
|
||||
raw: VehicleDefinitionArmor[string],
|
||||
id: number,
|
||||
armor: Armor,
|
||||
) {
|
||||
if (typeof raw === "number") {
|
||||
armor.thickness[id] = raw;
|
||||
} else if (Array.isArray(raw)) {
|
||||
armor.thickness[id] = raw.at(-1)!;
|
||||
} else {
|
||||
if (!armor.spaced) armor.spaced = [];
|
||||
armor.thickness[id] = raw["#text"];
|
||||
armor.spaced.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Cache()
|
||||
async modelDefinitions() {
|
||||
const modelDefinitions = ModelDefinitions.create();
|
||||
|
||||
for (const nation of this.nationsDir!) {
|
||||
const tankList = await this.vfs.xml<{ root: VehicleDefinitionList }>(
|
||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
||||
);
|
||||
const turretList = await this.vfs.xml<{
|
||||
root: TurretDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/turrets.xml`);
|
||||
const gunList = await this.vfs.xml<{
|
||||
root: GunDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/guns.xml`);
|
||||
const enginesList = await this.vfs.xml<{
|
||||
root: EngineDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/engines.xml`);
|
||||
const chassisList = await this.vfs.xml<{
|
||||
root: ChassisDefinitionsList;
|
||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/chassis.xml`);
|
||||
|
||||
for (const tankKey in tankList.root) {
|
||||
if (this.botPattern.test(tankKey)) continue;
|
||||
|
||||
const gunXps = new Map<number, ResearchCost>();
|
||||
const turretXps = new Map<number, ResearchCost>();
|
||||
const engineXps = new Map<number, ResearchCost>();
|
||||
const trackXps = new Map<number, ResearchCost>();
|
||||
const tank = tankList.root[tankKey];
|
||||
const tankDefinition = await this.vfs.xml<{ root: VehicleDefinitions }>(
|
||||
`Data/XML/item_defs/vehicles/${nation}/${tankKey}.xml`,
|
||||
);
|
||||
const tankParameters = await this.vfs.yaml<TankParameters>(
|
||||
`Data/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`,
|
||||
);
|
||||
const turretOrigin = tankDefinition.root.hull.turretPositions.turret
|
||||
.split(" ")
|
||||
.map(Number) as Vector3Tuple;
|
||||
const tankId = toUniqueId(nation, tank.id);
|
||||
|
||||
const hullArmor: Armor = { spaced: [], thickness: {} };
|
||||
this.tankStringIdMap[`${nation}:${tankKey}`] = tankId;
|
||||
|
||||
Object.keys(tankDefinition.root.hull.armor)
|
||||
.filter((name) => name.startsWith("armor_"))
|
||||
.forEach((name) => {
|
||||
const armorIdString = name.match(/armor_(\d+)/)?.[1];
|
||||
|
||||
if (armorIdString === undefined) {
|
||||
throw new SyntaxError(`Invalid armor id: ${name}`);
|
||||
}
|
||||
|
||||
const armorId = parseInt(armorIdString);
|
||||
const armorRaw = tankDefinition.root.hull.armor[name];
|
||||
|
||||
this.assignArmor(armorRaw, armorId, hullArmor);
|
||||
});
|
||||
const crew: Crew[] = [];
|
||||
|
||||
for (const crewKey in tankDefinition.root.crew) {
|
||||
const value = tankDefinition.root.crew[crewKey as BlitzCrewType];
|
||||
let entry: Crew;
|
||||
const index = crew.findIndex(
|
||||
({ type }) => this.blitzkitCrewTypeToBlitz[type] === crewKey,
|
||||
);
|
||||
if (index === -1) {
|
||||
if (crewKey === "#text") continue;
|
||||
|
||||
entry = {
|
||||
type: this.blitzCrewTypeToBlitzkit[crewKey as BlitzCrewType],
|
||||
count: 0,
|
||||
substitute: [],
|
||||
};
|
||||
crew.push(entry);
|
||||
} else {
|
||||
entry = crew[index];
|
||||
}
|
||||
|
||||
if (typeof value === "string") {
|
||||
entry.count++;
|
||||
|
||||
if (value !== "") {
|
||||
entry.substitute = value.split(/\n| /).map((member) => {
|
||||
return this.blitzCrewTypeToBlitzkit[
|
||||
member.trim() as BlitzCrewType
|
||||
];
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (entry.count === undefined) {
|
||||
entry.count = value.length;
|
||||
} else {
|
||||
entry.count += value.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
modelDefinitions.models[tankId] = {
|
||||
armor: hullArmor,
|
||||
turret_origin: this.vector3TupleToBlitzkit(turretOrigin),
|
||||
initial_turret_rotation: tankDefinition.root.hull
|
||||
.turretInitialRotation
|
||||
? {
|
||||
yaw: tankDefinition.root.hull.turretInitialRotation.yaw,
|
||||
pitch: tankDefinition.root.hull.turretInitialRotation.pitch,
|
||||
roll: tankDefinition.root.hull.turretInitialRotation.roll,
|
||||
}
|
||||
: undefined,
|
||||
bounding_box: {
|
||||
min: this.vector3TupleToBlitzkit(
|
||||
tankParameters.collision.hull.bbox.min,
|
||||
),
|
||||
max: this.vector3TupleToBlitzkit(
|
||||
tankParameters.collision.hull.bbox.max,
|
||||
),
|
||||
},
|
||||
turrets: {},
|
||||
tracks: {},
|
||||
};
|
||||
|
||||
for (const key in tankDefinition.root.chassis) {
|
||||
const track = tankDefinition.root.chassis[key];
|
||||
const trackId = toUniqueId(nation, chassisList.root.ids[key]);
|
||||
const trackArmorRaw = track.armor.leftTrack;
|
||||
const hullOrigin = track.hullPosition
|
||||
.split(" ")
|
||||
.map(Number) as Vector3Tuple;
|
||||
|
||||
modelDefinitions.models[tankId].tracks[trackId] = {
|
||||
thickness:
|
||||
typeof trackArmorRaw === "number"
|
||||
? trackArmorRaw
|
||||
: trackArmorRaw["#text"],
|
||||
origin: this.vector3TupleToBlitzkit(hullOrigin),
|
||||
};
|
||||
}
|
||||
|
||||
Object.keys(tankDefinition.root.turrets0).forEach((turretKey) => {
|
||||
const turret = tankDefinition.root.turrets0[turretKey];
|
||||
const turretModel = Number(
|
||||
parsePath(turret.models.undamaged).name.split("_")[1],
|
||||
);
|
||||
const turretId = toUniqueId(nation, turretList.root.ids[turretKey]);
|
||||
const turretYaw = (
|
||||
typeof turret.yawLimits === "string"
|
||||
? turret.yawLimits
|
||||
: turret.yawLimits.at(-1)!
|
||||
)
|
||||
.split(" ")
|
||||
.map(Number) as [number, number];
|
||||
const gunOrigin = (
|
||||
typeof turret.gunPosition === "string"
|
||||
? turret.gunPosition
|
||||
: turret.gunPosition[0]
|
||||
)
|
||||
.split(" ")
|
||||
.map(Number) as Vector3Tuple;
|
||||
const turretArmor: Armor = { thickness: {}, spaced: [] };
|
||||
|
||||
Object.keys(turret.armor)
|
||||
.filter((name) => name.startsWith("armor_"))
|
||||
.forEach((name) => {
|
||||
const armorIdString = name.match(/armor_(\d+)/)?.[1];
|
||||
|
||||
if (armorIdString === undefined) {
|
||||
throw new SyntaxError(`Invalid armor id: ${name}`);
|
||||
}
|
||||
|
||||
const armorId = parseInt(armorIdString);
|
||||
const armorRaw = turret.armor[name];
|
||||
|
||||
this.assignArmor(armorRaw, armorId, turretArmor);
|
||||
});
|
||||
|
||||
turret.userString;
|
||||
|
||||
modelDefinitions.models[tankId].turrets[turretId] = {
|
||||
armor: turretArmor,
|
||||
gun_origin: this.vector3TupleToBlitzkit(gunOrigin),
|
||||
model_id: turretModel,
|
||||
yaw:
|
||||
-turretYaw[0] + turretYaw[1] === 360
|
||||
? undefined
|
||||
: { min: turretYaw[0], max: turretYaw[1] },
|
||||
guns: {},
|
||||
bounding_box: {
|
||||
min: this.vector3TupleToBlitzkit(
|
||||
tankParameters.collision[
|
||||
parsePath(turret.hitTester.collisionModel).name.toLowerCase()
|
||||
].bbox.min,
|
||||
),
|
||||
max: this.vector3TupleToBlitzkit(
|
||||
tankParameters.collision[
|
||||
parsePath(turret.hitTester.collisionModel).name.toLowerCase()
|
||||
].bbox.max,
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
Object.keys(turret.guns).forEach((gunKey, gunIndex) => {
|
||||
const gun = turret.guns[gunKey];
|
||||
const gunId = toUniqueId(nation, gunList.root.ids[gunKey]);
|
||||
const gunListEntry = gunList.root.shared[gunKey];
|
||||
const pitchLimitsRaw = gun.pitchLimits ?? gunListEntry.pitchLimits;
|
||||
const gunPitch = (
|
||||
typeof pitchLimitsRaw === "string"
|
||||
? pitchLimitsRaw
|
||||
: pitchLimitsRaw.at(-1)!
|
||||
)
|
||||
.split(" ")
|
||||
.map(Number) as [number, number];
|
||||
const gunModel = Number(
|
||||
parsePath(gun.models.undamaged).name.split("_")[1],
|
||||
);
|
||||
const front = gun.extraPitchLimits?.front
|
||||
? gun.extraPitchLimits.front.split(" ").map(Number)
|
||||
: undefined;
|
||||
const back = gun.extraPitchLimits?.back
|
||||
? gun.extraPitchLimits.back.split(" ").map(Number)
|
||||
: undefined;
|
||||
const transition = gun.extraPitchLimits?.transition
|
||||
? typeof gun.extraPitchLimits.transition === "number"
|
||||
? gun.extraPitchLimits.transition
|
||||
: gun.extraPitchLimits.transition.at(-1)!
|
||||
: undefined;
|
||||
const gunArmor: Armor = { thickness: {}, spaced: [] };
|
||||
const maskName = `gun_${gunModel.toString().padStart(2, "0")}`;
|
||||
const maskEnabled =
|
||||
tankParameters.maskSlice?.[maskName]?.enabled ?? false;
|
||||
let mask: number | undefined;
|
||||
|
||||
if (maskEnabled) {
|
||||
const maskRaw = tankParameters.maskSlice![maskName]!;
|
||||
mask = maskRaw.planePosition[1];
|
||||
} else {
|
||||
mask = undefined;
|
||||
}
|
||||
|
||||
Object.keys(gun.armor)
|
||||
.filter((name) => name.startsWith("armor_"))
|
||||
.forEach((name) => {
|
||||
const armorIdString = name.match(/armor_(\d+)/)?.[1];
|
||||
if (armorIdString === undefined) {
|
||||
throw new SyntaxError(`Invalid armor id: ${name}`);
|
||||
}
|
||||
const armorId = parseInt(armorIdString);
|
||||
const armorRaw = gun.armor[name];
|
||||
|
||||
this.assignArmor(armorRaw, armorId, gunArmor);
|
||||
});
|
||||
|
||||
modelDefinitions.models[tankId].turrets[turretId].guns[gunId] = {
|
||||
armor: gunArmor,
|
||||
model_id: gunModel,
|
||||
mask,
|
||||
thickness:
|
||||
gun.armor.gun === undefined
|
||||
? 0
|
||||
: typeof gun.armor.gun === "number"
|
||||
? gun.armor.gun
|
||||
: gun.armor.gun["#text"],
|
||||
pitch: {
|
||||
min: gunPitch[0],
|
||||
max: gunPitch[1],
|
||||
|
||||
front: front
|
||||
? {
|
||||
min: front[0],
|
||||
max: front[1],
|
||||
range: front[2],
|
||||
}
|
||||
: undefined,
|
||||
back: back
|
||||
? {
|
||||
min: back[0],
|
||||
max: back[1],
|
||||
range: back[2],
|
||||
}
|
||||
: undefined,
|
||||
transition,
|
||||
},
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return modelDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { MapDefinitions } from "@blitzkit/core";
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI3 } from "./3_modelDefinitions";
|
||||
|
||||
export abstract class ServerBlitzKitAPI4 extends ServerBlitzKitAPI3 {
|
||||
@Cache()
|
||||
async mapDefinitions() {
|
||||
const mapDefinitions = MapDefinitions.create();
|
||||
|
||||
for (const key in this.mapsYaml!.maps) {
|
||||
const map = this.mapsYaml!.maps[key];
|
||||
|
||||
mapDefinitions.maps[map.id] = {
|
||||
id: map.id,
|
||||
name: this.getString(`#maps:${key}:${map.localName}`),
|
||||
};
|
||||
}
|
||||
|
||||
return mapDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { EquipmentDefinitions, EquipmentSlot } from "@blitzkit/core";
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI4 } from "./4_mapDefinitions";
|
||||
|
||||
export abstract class ServerBlitzKitAPI5 extends ServerBlitzKitAPI4 {
|
||||
@Cache()
|
||||
async equipmentDefinitions() {
|
||||
const equipmentDefinitions = EquipmentDefinitions.create();
|
||||
|
||||
Object.entries(this.optionalDevices!.root).forEach(
|
||||
([optionalDeviceKey, optionalDeviceEntry]) => {
|
||||
if (optionalDeviceKey === "nextAvailableId") return;
|
||||
|
||||
equipmentDefinitions.equipments[optionalDeviceEntry.id] = {
|
||||
name: this.getString(optionalDeviceEntry.userString),
|
||||
description: this.getString(optionalDeviceEntry.description),
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
Object.entries(this.optionalDeviceSlots!.root.presets).forEach(
|
||||
([optionalDeviceSlotKey, optionalDeviceSlotEntry]) => {
|
||||
if (optionalDeviceSlotKey === "emptyPreset") return;
|
||||
|
||||
equipmentDefinitions.presets[optionalDeviceSlotKey] = {
|
||||
slots: Object.values(optionalDeviceSlotEntry)
|
||||
.map((level) => {
|
||||
return Object.values(level).map((options) => {
|
||||
return {
|
||||
left: this.optionalDevices!.root[options.device0].id,
|
||||
right: this.optionalDevices!.root[options.device1].id,
|
||||
} satisfies EquipmentSlot;
|
||||
});
|
||||
})
|
||||
.flat(),
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
return equipmentDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import {
|
||||
BlitzTankFilterDefinitionCategory,
|
||||
Consumable,
|
||||
ConsumableDefinitions,
|
||||
} from "@blitzkit/core";
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI5 } from "./5_equipmentDefinitions";
|
||||
|
||||
export abstract class ServerBlitzKitAPI6 extends ServerBlitzKitAPI5 {
|
||||
@Cache()
|
||||
async consumableDefinitions() {
|
||||
const consumableDefinitions = ConsumableDefinitions.create();
|
||||
|
||||
Object.entries(this.consumablesCommon).forEach(([key, consumable]) => {
|
||||
const entry: Consumable = {
|
||||
id: consumable.id,
|
||||
game_mode_exclusive: "gameModeFilter" in consumable,
|
||||
cooldown: consumable.script.cooldown,
|
||||
duration: consumable.script.duration,
|
||||
name: this.getString(consumable.userString),
|
||||
exclude: [],
|
||||
include: [],
|
||||
};
|
||||
consumableDefinitions.consumables[consumable.id] = entry;
|
||||
|
||||
const includeRaw = consumable.vehicleFilter?.include.vehicle;
|
||||
const excludeRaw = consumable.vehicleFilter?.exclude?.vehicle;
|
||||
|
||||
if (includeRaw) {
|
||||
entry.include = [];
|
||||
|
||||
if ("minLevel" in includeRaw) {
|
||||
entry.include.push({
|
||||
filter_type: {
|
||||
$case: "tiers",
|
||||
value: {
|
||||
min: includeRaw.minLevel,
|
||||
max: includeRaw.maxLevel,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else if ("name" in includeRaw) {
|
||||
entry.include.push({
|
||||
filter_type: {
|
||||
$case: "ids",
|
||||
value: {
|
||||
ids: includeRaw.name.split(/ +/).map((key) => {
|
||||
return this.tankStringIdMap[key];
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
} else throw new SyntaxError("Unhandled include type");
|
||||
|
||||
if (consumable.vehicleFilter?.include.nations) {
|
||||
entry.include.push({
|
||||
filter_type: {
|
||||
$case: "nations",
|
||||
value: {
|
||||
nations: consumable.vehicleFilter.include.nations.split(" "),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (excludeRaw) {
|
||||
entry.exclude = [];
|
||||
|
||||
if ("name" in excludeRaw) {
|
||||
entry.exclude!.push({
|
||||
filter_type: {
|
||||
$case: "ids",
|
||||
value: {
|
||||
ids: excludeRaw.name.split(/ +/).map((key) => {
|
||||
return this.tankStringIdMap[key];
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
} else if ("extendedTags" in excludeRaw) {
|
||||
entry.exclude!.push({
|
||||
filter_type: {
|
||||
$case: "categories",
|
||||
value: {
|
||||
categories: excludeRaw.extendedTags
|
||||
.split(" ")
|
||||
.map(
|
||||
(item) =>
|
||||
this.blitzTankFilterDefinitionCategoryToBlitzkit[
|
||||
item as BlitzTankFilterDefinitionCategory
|
||||
],
|
||||
),
|
||||
},
|
||||
},
|
||||
});
|
||||
} else throw new SyntaxError("Unhandled exclude type");
|
||||
|
||||
if (consumable.vehicleFilter?.exclude?.nations) {
|
||||
entry.exclude!.push({
|
||||
filter_type: {
|
||||
$case: "nations",
|
||||
value: {
|
||||
nations: consumable.vehicleFilter.exclude.nations.split(" "),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return consumableDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
import {
|
||||
BlitzTankFilterDefinitionCategory,
|
||||
Provision,
|
||||
ProvisionDefinitions,
|
||||
} from "@blitzkit/core";
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI6 } from "./6_consumableDefinitions";
|
||||
|
||||
export abstract class ServerBlitzKitAPI7 extends ServerBlitzKitAPI6 {
|
||||
@Cache()
|
||||
async provisionDefinitions() {
|
||||
const provisionDefinitions = ProvisionDefinitions.create();
|
||||
|
||||
Object.entries(this.provisionsCommon).forEach(([, provision]) => {
|
||||
const entry: Provision = {
|
||||
id: provision.id,
|
||||
exclude: [],
|
||||
include: [],
|
||||
game_mode_exclusive: "gameModeFilter" in provision,
|
||||
name: this.getString(provision.userString),
|
||||
};
|
||||
provisionDefinitions.provisions[provision.id] = entry;
|
||||
|
||||
const includeRaw = provision.vehicleFilter?.include.vehicle;
|
||||
const excludeRaw = provision.vehicleFilter?.exclude?.vehicle;
|
||||
|
||||
if (includeRaw) {
|
||||
entry.include = [];
|
||||
|
||||
if ("minLevel" in includeRaw) {
|
||||
entry.include.push({
|
||||
filter_type: {
|
||||
$case: "tiers",
|
||||
value: {
|
||||
min: includeRaw.minLevel,
|
||||
max: includeRaw.maxLevel,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else if ("name" in includeRaw) {
|
||||
entry.include.push({
|
||||
filter_type: {
|
||||
$case: "ids",
|
||||
value: {
|
||||
ids: includeRaw.name.split(/ +/).map((key) => {
|
||||
return this.tankStringIdMap[key];
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
} else throw new SyntaxError("Unhandled include type");
|
||||
|
||||
if (provision.vehicleFilter?.include.nations) {
|
||||
entry.include.push({
|
||||
filter_type: {
|
||||
$case: "nations",
|
||||
value: {
|
||||
nations: provision.vehicleFilter.include.nations.split(" "),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (excludeRaw) {
|
||||
entry.exclude = [];
|
||||
|
||||
if ("name" in excludeRaw) {
|
||||
entry.exclude!.push({
|
||||
filter_type: {
|
||||
$case: "ids",
|
||||
value: {
|
||||
ids: excludeRaw.name
|
||||
.split(/ +/)
|
||||
.map((key) => this.tankStringIdMap[key]),
|
||||
},
|
||||
},
|
||||
});
|
||||
} else if ("extendedTags" in excludeRaw) {
|
||||
entry.exclude!.push({
|
||||
filter_type: {
|
||||
$case: "categories",
|
||||
value: {
|
||||
categories: excludeRaw.extendedTags
|
||||
.split(" ")
|
||||
.map(
|
||||
(item) =>
|
||||
this.blitzTankFilterDefinitionCategoryToBlitzkit[
|
||||
item as BlitzTankFilterDefinitionCategory
|
||||
],
|
||||
),
|
||||
},
|
||||
},
|
||||
});
|
||||
} else throw new SyntaxError("Unhandled exclude type");
|
||||
|
||||
if (provision.vehicleFilter?.exclude?.nations) {
|
||||
entry.exclude!.push({
|
||||
filter_type: {
|
||||
$case: "nations",
|
||||
value: {
|
||||
nations: provision.vehicleFilter.exclude.nations.split(" "),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (provision.script.bonusValues?.crewLevelIncrease !== undefined) {
|
||||
provisionDefinitions.provisions[provision.id].crew =
|
||||
provision.script.bonusValues?.crewLevelIncrease;
|
||||
}
|
||||
});
|
||||
|
||||
return provisionDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { BlitzTankClass, SkillDefinitions } from "@blitzkit/core";
|
||||
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI7 } from "./7_provisionDefinitions";
|
||||
|
||||
export abstract class ServerBlitzKitAPI8 extends ServerBlitzKitAPI7 {
|
||||
@Cache()
|
||||
async skillDefinitions() {
|
||||
const skillDefinitions = SkillDefinitions.create();
|
||||
|
||||
for (const tankClass in this.tankmenAvatar!.root.skillsByClasses) {
|
||||
const skills = this.tankmenAvatar!.root.skillsByClasses[tankClass];
|
||||
|
||||
skillDefinitions.classes[
|
||||
this.blitzTankClassToBlitzkit[tankClass as BlitzTankClass]
|
||||
] = { skills: skills.split(" ") };
|
||||
}
|
||||
|
||||
return skillDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import { AvailableNationsYaml, GameDefinitions } from "@blitzkit/core";
|
||||
|
||||
import { Cache } from "./0_base";
|
||||
import { ServerBlitzKitAPI8 } from "./8_skillDefinitions";
|
||||
|
||||
export abstract class ServerBlitzKitAPI9 extends ServerBlitzKitAPI8 {
|
||||
@Cache()
|
||||
async gameDefinitions() {
|
||||
const gameDefinitions = GameDefinitions.create();
|
||||
|
||||
const consumableNativeNames: Record<string, number> = {};
|
||||
const provisionNativeNames: Record<string, number> = {};
|
||||
|
||||
Object.entries(this.consumablesCommon).forEach(([key, consumable]) => {
|
||||
consumableNativeNames[key] = consumable.id;
|
||||
});
|
||||
|
||||
Object.entries(this.provisionsCommon).forEach(([key, provision]) => {
|
||||
provisionNativeNames[key] = provision.id;
|
||||
});
|
||||
|
||||
const version = (await this.vfs.text("Data/version.txt")).split(" ")[0];
|
||||
|
||||
gameDefinitions.version = version;
|
||||
gameDefinitions.nations = (
|
||||
await this.vfs.yaml<AvailableNationsYaml>("Data/available_nations.yaml")
|
||||
).available_nations;
|
||||
|
||||
for (const match of this.squadBattleTypeStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g,
|
||||
)) {
|
||||
const id = Number(match[1]);
|
||||
const name = this.getString(match[2]);
|
||||
|
||||
gameDefinitions.gameModes[id] = {
|
||||
name,
|
||||
};
|
||||
}
|
||||
|
||||
Object.entries(this.combatRoles!).forEach(([, value]) => {
|
||||
gameDefinitions.roles[value.id] = { provisions: [], consumables: [] };
|
||||
|
||||
value.default_abilities.forEach((ability) => {
|
||||
if (ability in consumableNativeNames) {
|
||||
gameDefinitions.roles[value.id].consumables.push(
|
||||
consumableNativeNames[ability],
|
||||
);
|
||||
} else if (ability in provisionNativeNames) {
|
||||
gameDefinitions.roles[value.id].provisions.push(
|
||||
provisionNativeNames[ability],
|
||||
);
|
||||
} else throw new Error(`Unknown ability ${ability}`);
|
||||
});
|
||||
});
|
||||
|
||||
return gameDefinitions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { ServerBlitzKitAPI10 } from "@blitzkit/core/src/blitzkit/api/server/10_galleryDefinitions";
|
||||
|
||||
export class ServerBlitzKitAPI extends ServerBlitzKitAPI10 {}
|
||||
@@ -1,4 +1,4 @@
|
||||
export function assertSecret<Type>(secret?: Type) {
|
||||
export function assertSecret(secret?: string) {
|
||||
if (secret === undefined) throw new Error("Missing secret");
|
||||
return secret;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { assertSecret } from "./assertSecret";
|
||||
|
||||
export function asset(path: string) {
|
||||
return `${assertSecret(import.meta.env.PUBLIC_ASSET_BASE)}/${path}`;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { fetchPB } from '../../protobuf';
|
||||
import { AverageDefinitions } from '../../protos';
|
||||
import { asset } from '../asset';
|
||||
import { staticAsset } from "@blitzkit/core";
|
||||
import { fetchPB } from "../../protobuf";
|
||||
import { AverageDefinitions } from "../../protos";
|
||||
|
||||
export interface AverageDefinitionsManifest {
|
||||
version: 1;
|
||||
@@ -11,13 +11,7 @@ export interface AverageDefinitionsManifest {
|
||||
}
|
||||
|
||||
export async function fetchAverageDefinitions() {
|
||||
const manifestResponse = await fetch(asset('averages/manifest.json'));
|
||||
const manifestJson =
|
||||
(await manifestResponse.json()) as AverageDefinitionsManifest;
|
||||
return await fetchPB(
|
||||
asset(`averages/${manifestJson.latest}.pb`),
|
||||
AverageDefinitions,
|
||||
);
|
||||
return await fetchPB(staticAsset("averages.pb"), AverageDefinitions);
|
||||
}
|
||||
|
||||
export * from './constants';
|
||||
export * from "./constants";
|
||||
@@ -1,7 +0,0 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { CamouflageDefinitions } from '../protos';
|
||||
import { asset } from './asset';
|
||||
|
||||
export function fetchCamouflageDefinitions() {
|
||||
return fetchPB(asset('definitions/camouflages.pb'), CamouflageDefinitions);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { ConsumableDefinitions } from '../protos';
|
||||
import { asset } from './asset';
|
||||
|
||||
export function fetchConsumableDefinitions() {
|
||||
return fetchPB(asset('definitions/consumables.pb'), ConsumableDefinitions);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { asset } from './asset';
|
||||
import { staticAsset } from "@blitzkit/core";
|
||||
|
||||
export interface DiscoveredIdsDefinitions {
|
||||
time: number;
|
||||
@@ -7,6 +7,6 @@ export interface DiscoveredIdsDefinitions {
|
||||
}
|
||||
|
||||
export async function fetchDiscoveredIdsDefinitions() {
|
||||
const response = await fetch(asset('ids/manifest.json'));
|
||||
const response = await fetch(staticAsset("ids/manifest.json"));
|
||||
return response.json() as Promise<DiscoveredIdsDefinitions>;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
|
||||
interface EnvironmentConfig {
|
||||
robots: boolean;
|
||||
canonical: string;
|
||||
paths: Record<string, string | null>;
|
||||
nodes: Record<string, string>;
|
||||
aliases: Record<string, string>;
|
||||
}
|
||||
|
||||
let hasReadEnvironments = false;
|
||||
const environments: Record<string, EnvironmentConfig> = {};
|
||||
|
||||
/**
|
||||
* This is set up this way to avoid errors in runtimes where
|
||||
* `import.meta.glob` does not exist.
|
||||
*/
|
||||
function readEnvironments() {
|
||||
if (hasReadEnvironments) return;
|
||||
|
||||
hasReadEnvironments = true;
|
||||
|
||||
const glob = import.meta.glob("../../../../environments/*.json", {
|
||||
eager: true,
|
||||
import: "default",
|
||||
}) as Record<string, EnvironmentConfig>;
|
||||
const root = "../../../../environments";
|
||||
|
||||
for (const key in glob) {
|
||||
const trimmed = key.slice(root.length + 1, -5);
|
||||
|
||||
environments[trimmed] = glob[key];
|
||||
delete environments[key];
|
||||
}
|
||||
}
|
||||
|
||||
export function environmentConfig() {
|
||||
readEnvironments();
|
||||
|
||||
const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT);
|
||||
|
||||
if (!(environment in environments)) {
|
||||
throw new Error(`Invalid environment "${environment}"`);
|
||||
}
|
||||
|
||||
return environments[environment];
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { EquipmentDefinitions } from '../protos';
|
||||
import { asset } from './asset';
|
||||
|
||||
export function fetchEquipmentDefinitions() {
|
||||
return fetchPB(asset('definitions/equipment.pb'), EquipmentDefinitions);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { Gallery } from '../protos';
|
||||
import { asset } from './asset';
|
||||
|
||||
export function fetchGallery() {
|
||||
return fetchPB(asset('definitions/gallery.pb'), Gallery);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import { getRatingInfo } from "../blitz/getRatingInfo";
|
||||
import { assertSecret } from "./assertSecret";
|
||||
|
||||
interface GitHubTrees {
|
||||
tree: { path: string; url: string }[];
|
||||
}
|
||||
|
||||
let cachedLatestArchivedSeasonNumber: number | null = null;
|
||||
|
||||
export async function getArchivedLatestSeasonNumber() {
|
||||
if (cachedLatestArchivedSeasonNumber !== null) {
|
||||
return cachedLatestArchivedSeasonNumber;
|
||||
}
|
||||
|
||||
const ratingInfo = await getRatingInfo("com");
|
||||
|
||||
if (ratingInfo.detail) {
|
||||
const regionsURL = (
|
||||
(await fetch(
|
||||
`https://api.github.com/repos/${assertSecret(
|
||||
import.meta.env.PUBLIC_ASSET_REPO
|
||||
)}/git/trees/main`
|
||||
).then((response) => response.json())) as GitHubTrees
|
||||
).tree.find(({ path }) => path === "regions")!.url;
|
||||
const comURL = (
|
||||
(await fetch(regionsURL).then((response) =>
|
||||
response.json()
|
||||
)) as GitHubTrees
|
||||
).tree.find(({ path }) => path === "com")!.url;
|
||||
const ratingURL = (
|
||||
(await fetch(comURL).then((response) => response.json())) as {
|
||||
tree: [{ url: string }];
|
||||
}
|
||||
).tree[0].url;
|
||||
const latestSeason = Math.max(
|
||||
...(
|
||||
(await fetch(ratingURL).then((response) => response.json())) as {
|
||||
tree: { path: string }[];
|
||||
}
|
||||
).tree.map(({ path }) => Number(path))
|
||||
);
|
||||
|
||||
cachedLatestArchivedSeasonNumber = latestSeason;
|
||||
} else {
|
||||
cachedLatestArchivedSeasonNumber = ratingInfo.current_season - 1;
|
||||
}
|
||||
|
||||
return cachedLatestArchivedSeasonNumber;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// import { RatingInfo, Region, asset } from '@blitzkit/core';
|
||||
|
||||
// const cache: Record<
|
||||
// Region,
|
||||
// Record<
|
||||
// number,
|
||||
// RatingInfo & {
|
||||
// detail: undefined;
|
||||
// }
|
||||
// >
|
||||
// > = {
|
||||
// com: {},
|
||||
// eu: {},
|
||||
// asia: {},
|
||||
// };
|
||||
|
||||
// export async function getArchivedRatingInfo(region: Region, season: number) {
|
||||
// if (!cache[region][season]) {
|
||||
// const info = await fetch(
|
||||
// asset(`regions/${region}/rating/${season}/info.cdon.lz4`),
|
||||
// )
|
||||
// .then((response) => response.arrayBuffer())
|
||||
// .then((buffer) =>
|
||||
// superDecompress<RatingInfo & { detail: undefined }>(buffer),
|
||||
// );
|
||||
// cache[region][season] = info;
|
||||
// }
|
||||
|
||||
// return cache[region][season];
|
||||
// }
|
||||
@@ -1,23 +0,0 @@
|
||||
import type { Region } from "../blitz/regions";
|
||||
import { RatingLeaderboard } from "../protos";
|
||||
import { asset } from "./asset";
|
||||
|
||||
const cache: Record<Region, Record<number, RatingLeaderboard>> = {
|
||||
asia: {},
|
||||
eu: {},
|
||||
com: {},
|
||||
};
|
||||
|
||||
export async function getArchivedRatingLeaderboard(
|
||||
region: Region,
|
||||
season: number
|
||||
) {
|
||||
if (!cache[region][season]) {
|
||||
const info = await fetch(asset(`regions/${region}/rating/${season}.pb`))
|
||||
.then((response) => response.arrayBuffer())
|
||||
.then((buffer) => RatingLeaderboard.decode(new Uint8Array(buffer)));
|
||||
cache[region][season] = info;
|
||||
}
|
||||
|
||||
return cache[region][season];
|
||||
}
|
||||
@@ -1,39 +1,28 @@
|
||||
export * from "./alias";
|
||||
export * from "./assertSecret";
|
||||
export * from "./asset";
|
||||
export * from "./availableProvisions";
|
||||
export * from "./averageDefinitions";
|
||||
// export * from './camouflageDefinitions';
|
||||
// export * from './checkConsumableProvisionInclusivity';
|
||||
export * from "./coefficient";
|
||||
export * from "./consumableDefinitions";
|
||||
// export * from './context';
|
||||
export * from "./api";
|
||||
export * from "./createDefaultProvisions";
|
||||
export * from "./createDefaultSkills";
|
||||
export * from "./degressiveStat";
|
||||
export * from "./discoveredIdDefinitions";
|
||||
export * from "./emblemURL";
|
||||
export * from "./equipmentDefinitions";
|
||||
export * from "./environment";
|
||||
export * from "./eventManager";
|
||||
export * from "./getArchivedLatestSeasonNumber";
|
||||
export * from "./sluggify";
|
||||
export * from "./vfs";
|
||||
// export * from './getArchivedRatingInfo';
|
||||
export * from "./getArchivedRatingLeaderboard";
|
||||
// export * from './getArchivedRatingMidnightLeaderboard';
|
||||
export * from "./getTimeDaysAgo";
|
||||
export * from "./isExplosive";
|
||||
export * from "./mapDefinitions";
|
||||
export * from "./modelDefinitions";
|
||||
export * from "./metaSortTank";
|
||||
export * from "./normalizeBoundingBox";
|
||||
// export * from './parseBkni';
|
||||
// export * from './patientFetch';
|
||||
export * from "./patientFetchJSON";
|
||||
export * from "./popularTanks";
|
||||
export * from "./progressiveStat";
|
||||
export * from "./provisionDefinitions";
|
||||
export * from "./resolveDpm";
|
||||
export * from "./resolvePenetrationCoefficient";
|
||||
export * from "./reviews";
|
||||
export * from "./skillDefinitions";
|
||||
export * from "./romanize";
|
||||
export * from "./sluggify";
|
||||
export * from "./staticAsset";
|
||||
export * from "./sum";
|
||||
export * from "./tankDefinitions";
|
||||
export * from "./tankIcon";
|
||||
@@ -42,10 +31,4 @@ export * from "./unionBoundingBox";
|
||||
export * from "./uniqueGuns";
|
||||
export * from "./unwrapBlitzkitResponse";
|
||||
export * from "./votes";
|
||||
// export * from './withCORSProxy';
|
||||
export * from "./createDefaultProvisions";
|
||||
export * from "./gallery";
|
||||
export * from "./metaSortTank";
|
||||
export * from "./popularTanks";
|
||||
export * from "./romanize";
|
||||
export * from "./youtubers";
|
||||
@@ -1,7 +0,0 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { MapDefinitions } from '../protos';
|
||||
import { asset } from './asset';
|
||||
|
||||
export function fetchMapDefinitions() {
|
||||
return fetchPB(asset('definitions/maps.pb'), MapDefinitions);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { ModelDefinitions } from '../protos';
|
||||
import { asset } from './asset';
|
||||
|
||||
export function fetchModelDefinitions() {
|
||||
return fetchPB(asset('definitions/models.pb'), ModelDefinitions);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { PopularTanks } from '../protos';
|
||||
import { asset } from './asset';
|
||||
import { staticAsset } from "@blitzkit/core";
|
||||
import { fetchPB } from "../protobuf";
|
||||
import { PopularTanks } from "../protos";
|
||||
|
||||
export function fetchPopularTanks() {
|
||||
return fetchPB(asset('definitions/popular-tanks.pb'), PopularTanks);
|
||||
return fetchPB(staticAsset("definitions/popular-tanks.pb"), PopularTanks);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { ProvisionDefinitions } from '../protos';
|
||||
import { asset } from './asset';
|
||||
|
||||
export function fetchProvisionDefinitions() {
|
||||
return fetchPB(asset('definitions/provisions.pb'), ProvisionDefinitions);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { Reviews } from '../protos';
|
||||
import { asset } from './asset';
|
||||
import { staticAsset } from "@blitzkit/core";
|
||||
import { fetchPB } from "../protobuf";
|
||||
import { Reviews } from "../protos";
|
||||
|
||||
export function fetchReviews() {
|
||||
return fetchPB(asset('definitions/reviews.pb'), Reviews);
|
||||
return fetchPB(staticAsset("definitions/reviews.pb"), Reviews);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { fetchPB } from '../protobuf';
|
||||
import { SkillDefinitions } from '../protos';
|
||||
import { asset } from './asset';
|
||||
|
||||
export function fetchSkillDefinitions() {
|
||||
return fetchPB(asset('definitions/skills.pb'), SkillDefinitions);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { assertSecret } from "./assertSecret";
|
||||
|
||||
export function staticAsset(path: string) {
|
||||
return `${assertSecret(import.meta.env.PUBLIC_STATIC_ASSET_BASE)}/${path}`;
|
||||
}
|
||||
@@ -1,9 +1 @@
|
||||
import { fetchPB } from '../../protobuf';
|
||||
import { TankDefinitions } from '../../protos';
|
||||
import { asset } from '../asset';
|
||||
|
||||
export function fetchTankDefinitions() {
|
||||
return fetchPB(asset('definitions/tanks.pb'), TankDefinitions);
|
||||
}
|
||||
|
||||
export * from './constants';
|
||||
export * from "./constants";
|
||||
@@ -1,7 +1,7 @@
|
||||
import { asset } from "./asset";
|
||||
import { alias } from "@blitzkit/core";
|
||||
|
||||
export const BLITZKIT_TANK_ICON_SIZE = { width: 40 * 16, height: 30 * 16 };
|
||||
|
||||
export function tankIcon(id: number, size: "big" | "small" = "big") {
|
||||
return asset(`icons/tanks/${size}/${id}.webp`);
|
||||
return alias("api", `/tanks/${id}/icons/${size}.webp`);
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
import { BlitzKitAPI } from "@blitzkit/core";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { deburr } from "lodash-es";
|
||||
import { I18nString } from "../protos";
|
||||
import { fetchCamouflageDefinitions } from "./camouflageDefinitions";
|
||||
import { fetchTankDefinitions } from "./tankDefinitions";
|
||||
|
||||
export async function fetchTankNames() {
|
||||
export async function fetchTankNames(api: BlitzKitAPI) {
|
||||
const [tankDefinitions, camouflageDefinitions] = await Promise.all([
|
||||
fetchTankDefinitions(),
|
||||
fetchCamouflageDefinitions(),
|
||||
api.tankDefinitions(),
|
||||
api.camouflageDefinitions(),
|
||||
]);
|
||||
const tankDefinitionsArray = Object.values(tankDefinitions.tanks);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export abstract class AbstractVFS {
|
||||
|
||||
abstract has(path: string): Promise<boolean>;
|
||||
|
||||
abstract raw(path: string): Promise<Uint8Array>;
|
||||
abstract raw(path: string): Promise<Uint8Array<ArrayBuffer>>;
|
||||
|
||||
async resolve(path: string) {
|
||||
const normalized = normalize(path);
|
||||
@@ -46,7 +46,15 @@ export abstract class AbstractVFS {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
abstract dir(path: string): Promise<string[]>;
|
||||
protected abstract _dir(path: string): Promise<string[]>;
|
||||
|
||||
async dir(path: string) {
|
||||
const files = await this._dir(path);
|
||||
|
||||
return files.map((file) =>
|
||||
file.endsWith(".dvpl") ? file.slice(0, -5) : file,
|
||||
);
|
||||
}
|
||||
|
||||
async text(path: string) {
|
||||
const file = await this.file(path);
|
||||
@@ -63,7 +71,7 @@ export abstract class AbstractVFS {
|
||||
return this.xmlParser.parse(file) as Type;
|
||||
}
|
||||
|
||||
async _csv(text: string, options: Options = {}) {
|
||||
protected async _csv(text: string, options: Options = {}) {
|
||||
const parsed = parseCSV(text, options);
|
||||
return parsed;
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export * from "./abstract";
|
||||
export * from "./local";
|
||||
export * from "./mixed";
|
||||
export * from "./steam";
|
||||
export * from "./zip";
|
||||
@@ -23,7 +23,7 @@ export class LocalVFS extends AbstractVFS {
|
||||
return array;
|
||||
}
|
||||
|
||||
async dir(path: string) {
|
||||
async _dir(path: string) {
|
||||
try {
|
||||
return await readdir(`${this.base}/${path}`);
|
||||
} catch (_) {
|
||||
|
||||
@@ -35,7 +35,7 @@ export class MixedVFS extends AbstractVFS {
|
||||
throw new Error(`File not found: ${path}`);
|
||||
}
|
||||
|
||||
async dir(path: string) {
|
||||
async _dir(path: string) {
|
||||
const files = new Set<string>();
|
||||
|
||||
for (const vfs of this.vfses) {
|
||||
|
||||
@@ -89,7 +89,7 @@ export class SteamVFS extends AbstractVFS {
|
||||
return new Uint8Array(downloaded.file);
|
||||
}
|
||||
|
||||
async dir(path: string) {
|
||||
async _dir(path: string) {
|
||||
const parentSegments = path.split("/").length;
|
||||
const children = new Set<string>();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export class ZipVFS extends AbstractVFS {
|
||||
return new Uint8Array(arrayBuffer);
|
||||
}
|
||||
|
||||
async dir(path: string) {
|
||||
async _dir(path: string) {
|
||||
const parentSegments = path.split("/").length;
|
||||
const children = new Set<string>();
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { fetchTankDefinitions } from '../blitzkit';
|
||||
import type { BlitzStats } from './compositeStats/constants';
|
||||
|
||||
export async function getTierWeights(
|
||||
stats: Record<number, BlitzStats>,
|
||||
order: number[] = Object.keys(stats).map(parseInt),
|
||||
) {
|
||||
const tankDefinitions = await fetchTankDefinitions();
|
||||
const tierWeights: TierWeightsRecord = {};
|
||||
|
||||
order.forEach((id) => {
|
||||
const entry = tankDefinitions.tanks[id];
|
||||
|
||||
if (!entry) return;
|
||||
if (!tierWeights[entry.tier]) tierWeights[entry.tier] = 0;
|
||||
|
||||
tierWeights[entry.tier]! += stats[id].battles;
|
||||
});
|
||||
|
||||
return tierWeights;
|
||||
}
|
||||
export type TierWeightsRecord = Partial<Record<number, number>>;
|
||||
@@ -1,9 +1,8 @@
|
||||
export * from './calculateWN8';
|
||||
export * from './compositeStats';
|
||||
export * from './deltaBkrlBlitzStats';
|
||||
export * from './deltaTankStats';
|
||||
export * from './getBkniPercentile';
|
||||
export * from './getTierWeights';
|
||||
export * from './getWN8Percentile';
|
||||
export * from './percentiles';
|
||||
export * from './sumAllStats';
|
||||
export * from "./calculateWN8";
|
||||
export * from "./compositeStats";
|
||||
export * from "./deltaBkrlBlitzStats";
|
||||
export * from "./deltaTankStats";
|
||||
export * from "./getBkniPercentile";
|
||||
export * from "./getWN8Percentile";
|
||||
export * from "./percentiles";
|
||||
export * from "./sumAllStats";
|
||||
@@ -1,51 +0,0 @@
|
||||
import { times } from 'lodash-es';
|
||||
import { ReadStream, WriteStream } from './buffer';
|
||||
|
||||
export class DidsReadStream extends ReadStream {
|
||||
dids() {
|
||||
this.magic();
|
||||
this.header();
|
||||
return this.body();
|
||||
}
|
||||
|
||||
magic() {
|
||||
const magic = this.utf8(4);
|
||||
if (magic !== 'DIDS') {
|
||||
throw new Error(`Invalid DIDS magic number: "${magic}"`);
|
||||
}
|
||||
}
|
||||
|
||||
header() {
|
||||
return {
|
||||
version: this.uint16(),
|
||||
};
|
||||
}
|
||||
|
||||
body() {
|
||||
const count = this.uint32();
|
||||
return times(count, () => this.uint32());
|
||||
}
|
||||
}
|
||||
|
||||
export class DidsWriteStream extends WriteStream {
|
||||
dids(ids: number[]) {
|
||||
this.magic();
|
||||
this.header();
|
||||
this.body(ids);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
magic() {
|
||||
this.utf8('DIDS');
|
||||
}
|
||||
|
||||
header() {
|
||||
this.uint16(1);
|
||||
}
|
||||
|
||||
body(ids: number[]) {
|
||||
this.uint32(ids.length);
|
||||
ids.forEach((id) => this.uint32(id));
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
export * from './buffer';
|
||||
export * from './bufferToBigInt';
|
||||
export * from './dds';
|
||||
export * from './dids';
|
||||
export * from './pvr';
|
||||
export * from './rts';
|
||||
export * from './sc2';
|
||||
export * from './scg';
|
||||
export * from './scpg';
|
||||
export * from './windows';
|
||||
|
||||
export * from "./buffer";
|
||||
export * from "./bufferToBigInt";
|
||||
export * from "./dds";
|
||||
export * from "./pvr";
|
||||
export * from "./rts";
|
||||
export * from "./sc2";
|
||||
export * from "./scg";
|
||||
export * from "./scpg";
|
||||
export * from "./windows";
|
||||
@@ -0,0 +1,10 @@
|
||||
export type BlitzModuleType = {
|
||||
[key in "vehicle" | "engine" | "chassis" | "turret" | "gun"]:
|
||||
| UnlocksInner
|
||||
| UnlocksInner[];
|
||||
};
|
||||
|
||||
interface UnlocksInner {
|
||||
cost: number | string;
|
||||
"#text": number;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface BlitzStrings {
|
||||
[key: string]: string;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export type BlitzTankFilterDefinitionCategory = "clip";
|
||||
@@ -0,0 +1,33 @@
|
||||
export interface CamouflagesXml {
|
||||
camouflages: Record<
|
||||
string,
|
||||
{
|
||||
id: number;
|
||||
userString: string;
|
||||
description: string;
|
||||
category: string;
|
||||
group: string;
|
||||
kind: string;
|
||||
notInShop: boolean;
|
||||
unlockCostCategory?: string;
|
||||
vehicleFilter: {
|
||||
include?: CamouflagesInclude | CamouflagesInclude[];
|
||||
};
|
||||
script: string[] | string;
|
||||
icon?: string;
|
||||
unlockPremium?: string;
|
||||
unlockQuest?: string;
|
||||
unlockClanLevel?: number;
|
||||
unlockShopBundle?: string;
|
||||
unlockTankRank?: number;
|
||||
}
|
||||
>;
|
||||
}
|
||||
|
||||
type CamouflagesInclude =
|
||||
| {
|
||||
nations?: string;
|
||||
}
|
||||
| {
|
||||
vehicle?: { name?: string; minLevel?: number; maxLevel?: number };
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
export type CamouflagesYaml = Record<
|
||||
string,
|
||||
{
|
||||
userString?: string;
|
||||
shortUserString?: string;
|
||||
}
|
||||
>;
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface ChassisDefinitionsList {
|
||||
nextAvailableId: number;
|
||||
ids: Record<string, number>;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export type CombatRolesYaml = Record<
|
||||
string,
|
||||
{
|
||||
id: number;
|
||||
default_abilities: string[];
|
||||
}
|
||||
>;
|
||||
@@ -0,0 +1,24 @@
|
||||
import { ConsumablesVehicleFilter } from "./consumablesVehicleFilter";
|
||||
|
||||
export interface ConsumablesCommon {
|
||||
[key: string]: {
|
||||
id: number;
|
||||
userString: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
category: string;
|
||||
tags: string;
|
||||
vehicleFilter?: {
|
||||
include: { vehicle: ConsumablesVehicleFilter; nations?: string };
|
||||
exclude?: { vehicle: ConsumablesVehicleFilter; nations?: string };
|
||||
};
|
||||
script: {
|
||||
"#text": string;
|
||||
automatic?: boolean;
|
||||
cooldown: number;
|
||||
duration?: number;
|
||||
shotEffect?: string;
|
||||
bonusValues?: { [key: string]: number };
|
||||
} & Record<string, string>;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export type ConsumablesVehicleFilter =
|
||||
| { minLevel: number; maxLevel: number }
|
||||
| { name: string }
|
||||
| { extendedTags: string };
|
||||
@@ -0,0 +1,13 @@
|
||||
export interface EngineDefinitionsList {
|
||||
nextAvailableId: number;
|
||||
ids: Record<string, number>;
|
||||
shared: {
|
||||
[key: string]: {
|
||||
userString: string;
|
||||
level: number;
|
||||
fireStartingChance: number;
|
||||
weight: number;
|
||||
power: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
export interface GunDefinitionsList {
|
||||
nextAvailableId: number;
|
||||
ids: Record<string, number>;
|
||||
shared: {
|
||||
[key: string]: {
|
||||
rotationSpeed: number;
|
||||
weight: number;
|
||||
shotDispersionFactors: {
|
||||
turretRotation: number;
|
||||
afterShot: number;
|
||||
whileGunDamaged: number;
|
||||
};
|
||||
maxAmmo: number;
|
||||
aimingTime: number;
|
||||
shotDispersionRadius: number;
|
||||
userString: string;
|
||||
tags: string;
|
||||
level: number;
|
||||
pitchLimits: string;
|
||||
burst?: { count: number; rate: number };
|
||||
clip?: { count: number; rate: number };
|
||||
shots: {
|
||||
[key: string]: {
|
||||
speed: number;
|
||||
piercingPower: string;
|
||||
maxDistance: number;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,26 @@
|
||||
export * from "./availableNationsYaml";
|
||||
export * from "./blitzModuleType";
|
||||
export * from "./blitzStrings";
|
||||
export * from "./blitzTankFilterDefinitionCategory";
|
||||
export * from "./camouflagesXml";
|
||||
export * from "./camouflagesYaml";
|
||||
export * from "./chassisDefinitionsList";
|
||||
export * from "./combatRolesYaml";
|
||||
export * from "./consumablesCommon";
|
||||
export * from "./consumablesVehicleFilter";
|
||||
export * from "./engineDefinitionsList";
|
||||
export * from "./glossary";
|
||||
export * from "./gunDefinitionsList";
|
||||
export * from "./mapsYaml";
|
||||
export * from "./optionalDevices";
|
||||
export * from "./optionalDeviceSlots";
|
||||
export * from "./provisionsCommon";
|
||||
export * from "./shellDefinitionsList";
|
||||
export * from "./squadBattleTypeStylesYaml";
|
||||
export * from "./tankmenAvatar";
|
||||
export * from "./tankParameters";
|
||||
export * from "./tanksStats";
|
||||
export * from "./turretDefinitionsList";
|
||||
export * from "./vehicleDefinitionArmor";
|
||||
export * from "./vehicleDefinitionList";
|
||||
export * from "./vehicleDefinitions";
|
||||
@@ -0,0 +1,24 @@
|
||||
export interface MapsYaml {
|
||||
maps: {
|
||||
[key: string]: {
|
||||
id: number;
|
||||
tags?: string;
|
||||
localName: string;
|
||||
avaliableInTrainingRoom: boolean; // lol wg typo
|
||||
spriteFrame: number;
|
||||
supremacyPointsThreshold?: number;
|
||||
availableModes: number[];
|
||||
shadowMapsAvailable?: boolean;
|
||||
assaultRespawnPoints: {
|
||||
allies: MapAlly[];
|
||||
enemies: MapAlly[];
|
||||
};
|
||||
levels?: number[];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface MapAlly {
|
||||
respawnNumber: number;
|
||||
points: Array<number[]>;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export interface OptionalDeviceSlots {
|
||||
presets: {
|
||||
[key: string]: {
|
||||
level0: OptionalDeviceSlotRow;
|
||||
level1: OptionalDeviceSlotRow;
|
||||
level2: OptionalDeviceSlotRow;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
interface OptionalDeviceSlotRow {
|
||||
[key: string]: { device0: string; device1: string };
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export interface OptionalDevices {
|
||||
[key: string]: {
|
||||
id: number;
|
||||
userString: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
script: unknown;
|
||||
display_params: unknown;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { ConsumablesVehicleFilter } from "./consumablesVehicleFilter";
|
||||
|
||||
export interface ProvisionsCommon {
|
||||
[key: string]: {
|
||||
id: number;
|
||||
userString: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
category: string;
|
||||
tags: string;
|
||||
vehicleFilter?: {
|
||||
include: { vehicle: ConsumablesVehicleFilter; nations?: string };
|
||||
exclude?: { vehicle: ConsumablesVehicleFilter; nations?: string };
|
||||
};
|
||||
script: {
|
||||
"#text": string;
|
||||
automatic?: boolean;
|
||||
shotEffect?: string;
|
||||
bonusValues?: { [key: string]: number };
|
||||
} & Record<string, string>;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
export type ShellDefinitionsList = Record<
|
||||
string,
|
||||
{
|
||||
id: number;
|
||||
userString: string;
|
||||
icon: string;
|
||||
kind: ShellKind;
|
||||
caliber: number;
|
||||
damage: { armor: number; devices: number };
|
||||
normalizationAngle?: number;
|
||||
ricochetAngle?: number;
|
||||
explosionRadius?: number;
|
||||
}
|
||||
> & {
|
||||
icons: Record<string, string>;
|
||||
};
|
||||
|
||||
export type ShellKind =
|
||||
| "ARMOR_PIERCING"
|
||||
| "ARMOR_PIERCING_CR"
|
||||
| "HIGH_EXPLOSIVE"
|
||||
| "HOLLOW_CHARGE";
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Vector3Tuple } from "three";
|
||||
|
||||
export interface TankParameters {
|
||||
resourcesPath: {
|
||||
smallIconPath: string;
|
||||
bigIconPath: string;
|
||||
blitzModelPath: string;
|
||||
};
|
||||
collision: {
|
||||
[key: string]: {
|
||||
points: Vector3Tuple;
|
||||
bbox: {
|
||||
min: Vector3Tuple;
|
||||
max: Vector3Tuple;
|
||||
};
|
||||
averageThickness?: Record<string, number>;
|
||||
};
|
||||
};
|
||||
maskSlice?: {
|
||||
[key: string]:
|
||||
| {
|
||||
enabled: boolean;
|
||||
planePosition: Vector3Tuple;
|
||||
planeNormal: Vector3Tuple;
|
||||
planeAxis: Vector3Tuple;
|
||||
frustumConeBaseRadius: number;
|
||||
frustumConeAngleDegrees: number;
|
||||
planeSliceMode: number;
|
||||
frustumConeSliceMode: number;
|
||||
}
|
||||
| undefined;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export interface TankmenAvatar {
|
||||
roles: unknown;
|
||||
skillsByClasses: Record<string, string>;
|
||||
skills: {
|
||||
[name: string]: {
|
||||
userString: string;
|
||||
effectDescription: string;
|
||||
tipDescription: string;
|
||||
icon: SkillIcon | SkillIcon[];
|
||||
type: "continuous" | "trigger";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
interface SkillIcon {
|
||||
name: string;
|
||||
state: number;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface TurretDefinitionsList {
|
||||
nextAvailableId: number;
|
||||
ids: Record<string, number>;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export type VehicleDefinitionArmor = Record<
|
||||
string,
|
||||
number | { vehicleDamageFactor: 0; "#text": number } | number[]
|
||||
>;
|
||||
@@ -0,0 +1,16 @@
|
||||
export interface VehicleDefinitionList {
|
||||
[key: string]: {
|
||||
id: number;
|
||||
userString: string;
|
||||
shortUserString?: string;
|
||||
description: string;
|
||||
price: number | { gold: ""; "#text": number };
|
||||
sellPrice?: { gold: ""; "#text": number };
|
||||
enrichmentPermanentCost: number;
|
||||
notInShop?: boolean;
|
||||
tags: string;
|
||||
level: number;
|
||||
combatRole?: Record<string, string>;
|
||||
configurationModes: string;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
import { BlitzModuleType } from "@blitzkit/core";
|
||||
|
||||
export interface VehicleDefinitions {
|
||||
invisibility: {
|
||||
moving: number;
|
||||
still: number;
|
||||
firePenalty: number;
|
||||
};
|
||||
crew: Record<BlitzCrewType, string | string[]>;
|
||||
speedLimits: {
|
||||
forward: number;
|
||||
backward: number;
|
||||
};
|
||||
consumableSlots: number;
|
||||
provisionSlots: number;
|
||||
optDevicePreset: string | string[];
|
||||
hull: {
|
||||
armor: VehicleDefinitionArmor;
|
||||
turretPositions: { turret: string };
|
||||
turretInitialRotation?: { yaw: 0; pitch: 6.5; roll: 0 };
|
||||
maxHealth: number;
|
||||
weight: number;
|
||||
};
|
||||
chassis: {
|
||||
[key: string]: {
|
||||
unlocks: UnlocksListing;
|
||||
weight: number;
|
||||
terrainResistance: string;
|
||||
rotationSpeed: number;
|
||||
userString: string;
|
||||
shotDispersionFactors: {
|
||||
vehicleMovement: number;
|
||||
vehicleRotation: number;
|
||||
};
|
||||
level: number;
|
||||
hullPosition: string;
|
||||
armor: {
|
||||
leftTrack:
|
||||
| number
|
||||
| {
|
||||
chanceToHitByProjectile: number;
|
||||
chanceToHitByExplosion: number;
|
||||
"#text": number;
|
||||
};
|
||||
rightTrack:
|
||||
| number
|
||||
| {
|
||||
chanceToHitByProjectile: number;
|
||||
chanceToHitByExplosion: number;
|
||||
"#text": number;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
engines: {
|
||||
[key: string]: {
|
||||
unlocks: UnlocksListing;
|
||||
};
|
||||
};
|
||||
turrets0: {
|
||||
[key: string]: {
|
||||
unlocks: UnlocksListing;
|
||||
rotationSpeed: number;
|
||||
weight: number;
|
||||
circularVisionRadius: number;
|
||||
maxHealth: number;
|
||||
armor: VehicleDefinitionArmor;
|
||||
userString: string;
|
||||
level: number;
|
||||
yawLimits: string | string[];
|
||||
gunPosition: string | string[];
|
||||
models: { undamaged: string };
|
||||
hitTester: {
|
||||
collisionModel: string;
|
||||
};
|
||||
guns: {
|
||||
[key: string]: {
|
||||
unlocks: UnlocksListing;
|
||||
armor: VehicleDefinitionArmor & {
|
||||
gun?:
|
||||
| number
|
||||
| {
|
||||
chanceToHitByProjectile: number;
|
||||
chanceToHitByExplosion: number;
|
||||
"#text": number;
|
||||
};
|
||||
};
|
||||
invisibilityFactorAtShot: number | number[];
|
||||
reloadTime: number;
|
||||
aimingTime?: number;
|
||||
shotDispersionRadius: number;
|
||||
shotDispersionFactors?: {
|
||||
turretRotation: number;
|
||||
afterShot: number;
|
||||
whileGunDamaged: number;
|
||||
};
|
||||
maxAmmo: number;
|
||||
extraPitchLimits?: {
|
||||
front?: string;
|
||||
back?: string;
|
||||
transition?: number | number[];
|
||||
};
|
||||
pitchLimits?: string | string[];
|
||||
pumpGunMode?: boolean;
|
||||
pumpGunReloadTimes?: string;
|
||||
clip?: { count: number; rate: number };
|
||||
burst?: { count: number; rate: number };
|
||||
models: { undamaged: string };
|
||||
extras?: {
|
||||
trayShell?: {
|
||||
kinds: string;
|
||||
sectors: Record<
|
||||
string,
|
||||
{ id: number; distance: number; factor: number }[]
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
extras?: {
|
||||
armorsStatesController?: {
|
||||
state: [
|
||||
{
|
||||
id: 0;
|
||||
armors: string;
|
||||
type: "default";
|
||||
enabled: true;
|
||||
factorsModifiers: "";
|
||||
default: "";
|
||||
},
|
||||
{
|
||||
id: 1;
|
||||
armors: string;
|
||||
type: "default";
|
||||
enabled: false;
|
||||
factorsModifiers: "";
|
||||
},
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export type BlitzCrewType =
|
||||
| "commander"
|
||||
| "radioman"
|
||||
| "gunner"
|
||||
| "driver"
|
||||
| "loader";
|
||||
|
||||
export type UnlocksListing = BlitzModuleType | undefined;
|
||||
Loaded 100 of 348 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user