Compare commits

...
Author SHA1 Message Date
tresabhi d75a51660e feat: default sln file 2025-04-14 17:26:59 -05:00
tresabhi ac1323a463 feat: some things 2025-04-08 16:25:35 -05:00
tresabhi 292f7aeac0 feat: some more discoveries 2025-04-06 22:49:47 -05:00
tresabhi 1ee232d104 feat: start work on dynamic armor 2025-04-06 10:44:26 -05:00
tresabhi 1d301bf2fb Merge branch 'main' into ue 2025-04-05 22:15:05 -05:00
tresabhi 2a8ca6d36f Merge branch 'main' into ue 2025-04-05 17:18:36 -05:00
tresabhi ed5d2e3ff4 feat: more maps 2025-04-02 16:00:18 -05:00
tresabhi b2684e3152 fix: name 2025-04-01 21:59:00 -05:00
tresabhi d078454711 fix: depot 2025-04-01 21:56:23 -05:00
tresabhi 6aae1c8ee0 go go crazy! 2025-04-01 21:49:16 -05:00
tresabhi a560a37a56 feat: deploy 2025-04-01 21:48:36 -05:00
tresabhi 41486f84d4 fix: full export 2025-04-01 21:22:36 -05:00
tresabhi 29b12c7c28 fix: build only 2025-04-01 21:17:57 -05:00
tresabhi 2a3583a474 fix: cancel 2025-04-01 21:12:39 -05:00
tresabhi eb5e2a935c feat: more more more! 2025-04-01 21:12:06 -05:00
tresabhi 75f6f133ca feat: new website builder 2025-04-01 21:09:08 -05:00
tresabhi f26711bad9 feat: protos 2025-04-01 21:04:38 -05:00
tresabhi a8dc3313cf feat: mirrors 2025-04-01 21:03:39 -05:00
tresabhi 8087752172 feat: mirros 2025-04-01 15:32:37 -05:00
tresabhi cb03a86cce feat: proper assembly 2025-03-29 21:15:55 -05:00
tresabhi 838ce7f35d feat: model api 2025-03-29 20:26:32 -05:00
tresabhi e6f9b07b20 feat: modules list and translations 2025-03-29 19:29:29 -05:00
tresabhi 8afc334aa7 Merge branch 'main' into ue 2025-03-29 18:13:37 -05:00
tresabhi c7017a7a15 feat: cards 2025-03-23 19:07:37 -05:00
tresabhi f1462162f4 fix: persistent cam angle 2025-03-23 18:21:11 -05:00
tresabhi da4c2ece32 feat: better starting angle 2025-03-23 17:51:56 -05:00
tresabhi 80325aa3b2 feat: more fluid 2025-03-23 17:50:26 -05:00
tresabhi 3b937a6f35 feat: outlines 2025-03-23 17:41:38 -05:00
tresabhi 7a8f88f224 feat: safer drag 2025-03-23 17:22:42 -05:00
tresabhi 5982fdde8c feat: dragger 2025-03-23 17:18:42 -05:00
tresabhi dcd7ce61f7 feat: some manual disecting 2025-03-22 20:24:00 -05:00
tresabhi 43021c4945 feat: dissect event 2025-03-22 20:10:05 -05:00
tresabhi 4b24cf313b Merge branch 'ue' of https://github.com/tresabhi/blitzkit into ue 2025-03-22 18:44:01 -05:00
tresabhi d785588cf9 feat: some updates 2025-03-22 18:43:59 -05:00
TrèsAbhi dd9b34ea34 Update Unpacker.cs 2025-03-21 20:00:00 -05:00
tresabhi 7605e1d6f2 feat: new tab 2025-03-21 19:30:37 -05:00
tresabhi 7f056500ca fix: enable 2025-03-21 18:57:13 -05:00
tresabhi 0c37550c05 feat: outlines 2025-03-21 18:55:24 -05:00
tresabhi 1d928e8b72 feat: enabled 2025-03-21 18:08:53 -05:00
tresabhi 9e2465a6e3 fix: double blobbing 2025-03-21 16:51:03 -05:00
tresabhi b061bfd267 feat: prettier pretty log 2025-03-21 16:41:53 -05:00
tresabhi a90e5e20ea feat: but binary size after path 2025-03-21 16:33:34 -05:00
tresabhi 5fcade3efa feat: fill 2025-03-21 16:23:27 -05:00
tresabhi f1bb5736c0 feat: 4 chars 2025-03-21 16:22:14 -05:00
tresabhi 9b45f21457 feat: all pretty log 2025-03-21 16:20:39 -05:00
tresabhi 62fb80dddc feat: all collisions 2025-03-21 16:15:56 -05:00
tresabhi ff0cac84e1 feat: chassis mangler 2025-03-21 15:49:58 -05:00
tresabhi cbd2c2a719 feat: more rendering 2025-03-20 22:07:37 -05:00
tresabhi 5b16e22750 feat: some armor rendering 2025-03-20 21:48:17 -05:00
tresabhi 3a32624823 feat: build only 2025-03-20 20:13:14 -05:00
tresabhi 46374a7a26 feat: some hero code 2025-03-20 12:33:36 -05:00
tresabhi b856268ee0 feat: the thing 2025-03-20 12:17:05 -05:00
tresabhi e60bbc03d2 feat: separate armors 2025-03-20 11:59:24 -05:00
tresabhi 30b18f60be fix: optional static paths 2025-03-20 01:00:20 -05:00
tresabhi 754dff72b9 feat: smaller padding 2025-03-20 00:55:36 -05:00
tresabhi ef7655ab5d fix: color types 2025-03-20 00:53:47 -05:00
tresabhi 9491e7651a fix: types 2025-03-20 00:50:24 -05:00
tresabhi cccd96a021 feat: max file count 2025-03-20 00:21:27 -05:00
tresabhi 16a54ea291 feat: max file count 2025-03-20 00:20:05 -05:00
tresabhi f5c00643e4 feat: armors 2025-03-20 00:18:00 -05:00
tresabhi 652f36ba6c feat: hull model 2025-03-19 20:08:28 -05:00
tresabhi e1957daa5c feat: meta 2025-03-19 19:53:03 -05:00
tresabhi 222fda0c91 fix: i just realized the gallery is going bye bye 2025-03-19 19:48:26 -05:00
tresabhi c9467d68ae feat: in house icons 2025-03-19 19:36:05 -05:00
tresabhi d64f04b2c8 feat: icons 2025-03-19 19:27:47 -05:00
tresabhi a98f0e84d5 feat: gradient 2025-03-19 18:53:48 -05:00
tresabhi 6319e438b1 feat: make it compile! 2025-03-19 01:01:19 -05:00
tresabhi 90a64d4ccf fix: typo 2025-03-19 00:56:41 -05:00
tresabhi cb339eab5f more desc 2025-03-19 00:50:08 -05:00
tresabhi e6a92e2114 softer buttons 2025-03-19 00:49:23 -05:00
tresabhi 4bfc89302f feat: test button 2025-03-19 00:48:35 -05:00
tresabhi 6611088ccb feat: slugs 2025-03-19 00:24:25 -05:00
tresabhi 8d4933dd60 feat: some more apis 2025-03-18 23:53:52 -05:00
tresabhi 4b5ee9db09 feat: api docs 2025-03-18 23:04:08 -05:00
tresabhi cc3aa976db feat: comments 2025-03-18 18:32:14 -05:00
tresabhi 9fb4607bba Merge branch 'main' into ue 2025-03-18 17:41:22 -05:00
tresabhi 6f8790d148 gotta play it safe 2025-03-18 17:35:56 -05:00
tresabhi 57d63ea1d7 gotta go fast 2025-03-18 17:26:09 -05:00
tresabhi 35894f39cf feat: name fetching 2025-03-06 23:05:18 -06:00
tresabhi 18d762c41b fix: format 2025-03-06 21:55:42 -06:00
tresabhi 6ca74e2b83 feat: include change size 2025-03-06 21:55:27 -06:00
tresabhi 56ca3e5ed4 feat: background gray messages 2025-03-06 21:54:20 -06:00
tresabhi 2c059cdc59 feat: blue for no changes 2025-03-06 21:52:00 -06:00
tresabhi b0d7a49b16 feat: missing icon handling 2025-03-06 21:49:17 -06:00
tresabhi 9dfa5a7693 feat: smart uploader 2025-03-06 21:46:05 -06:00
tresabhi e79ed0cf85 feat: texture exporter 2025-03-06 19:41:55 -06:00
tresabhi f52460e98b feat: collision rendering 2025-03-05 12:15:52 -06:00
tresabhi 6a91e86b07 feat: handle duplicates 2025-03-05 11:52:39 -06:00
tresabhi 1fce9c1c88 fix: include all tanks 2025-03-05 10:03:03 -06:00
tresabhi 6e8fdcfeef fix: parrellel safe changes 2025-03-05 09:56:49 -06:00
tresabhi 2fffd512ac feat: include slugs in both 2025-03-05 09:52:09 -06:00
tresabhi 16b3a59f88 feat: slugs back in tanks 2025-03-05 09:51:02 -06:00
tresabhi ba36c600c4 feat: show ms 2025-03-05 00:12:10 -06:00
tresabhi 9fbdaaf87f feat: enable commiting 2025-03-05 00:10:00 -06:00
tresabhi 553c9d552b feat: human ids 2025-03-05 00:07:25 -06:00
tresabhi 1b017aad48 feat: seo ids list 2025-03-04 23:02:26 -06:00
tresabhi 74fefe6291 feat: let the damn thing compile 2025-03-04 22:55:45 -06:00
tresabhi 5d81b7ff5a Merge branch 'main' into ue 2025-03-04 22:45:27 -06:00
tresabhi 789578f2b3 incomplete stuff 2025-03-03 16:07:39 -06:00
tresabhi 0864825513 feat: names 2025-03-01 23:08:22 -06:00
tresabhi 6f11fb4a70 fix: delete after 2025-03-01 21:54:23 -06:00
tresabhi 1567f8270c fix: use escape 2025-03-01 21:51:45 -06:00
tresabhi 0b5d019dc8 feat: delete right after 2025-03-01 21:46:48 -06:00
tresabhi 932a04a398 feat: pre bundled 2025-03-01 21:46:17 -06:00
tresabhi 05c0839936 feat: file list 2025-03-01 21:38:06 -06:00
tresabhi 95ae891212 fix: provider 2025-03-01 21:34:39 -06:00
tresabhi 3aea04b6cb fix: remove filelist 2025-02-25 18:29:42 -06:00
tresabhi 1d28768bb7 feat: ini 2025-02-25 18:28:08 -06:00
tresabhi 14d9794f57 feat: try only pak0 2025-02-25 18:15:40 -06:00
tresabhi 9cd38db684 feat: include protos 2025-02-25 18:09:22 -06:00
tresabhi 6a5af32f6c feat: unpacker full 2025-02-25 18:03:38 -06:00
tresabhi af0b430927 feat: some unpacking 2025-02-25 17:55:05 -06:00
tresabhi 8c7f851692 feat: commit 2025-02-25 17:23:25 -06:00
tresabhi 57a2daa5e4 feat: hull collision mesh 2025-02-25 15:36:34 -06:00
tresabhi 63d27aec64 feat: canon interface 2025-02-25 15:15:03 -06:00
tresabhi 90c5c16b00 feat: some texture mounting 2025-02-02 22:22:10 -06:00
tresabhi 4d94205547 feat: some material things 2025-02-02 21:55:17 -06:00
tresabhi 31ff50ffd8 feat: custom gltf 2025-02-02 13:39:37 -06:00
tresabhi 22e4553720 feat: export 2025-02-02 00:54:07 -06:00
tresabhi 8b268cb647 feat: hull mesh 2025-02-02 00:25:47 -06:00
tresabhi 168a955380 feat: use nuget package 2025-02-01 22:05:27 -06:00
tresabhi 37ec987a32 feat: use nuget package 2025-02-01 22:04:58 -06:00
tresabhi 37b5d1c6e8 feat: implement mappeduobject 2025-02-01 22:01:06 -06:00
tresabhi 09abbbadc9 feat: more mapping 2025-02-01 21:51:43 -06:00
tresabhi 8b0f95c53d feat: more shit 2025-02-01 21:21:12 -06:00
tresabhi 920ef6e5c4 feat: extract tank mangle logic 2025-01-30 12:54:37 -06:00
tresabhi 6829ff921d feat: mangle crew healths 2025-01-30 12:49:15 -06:00
tresabhi c6f4a13abc feat: some healths 2025-01-30 11:31:55 -06:00
tresabhi 67f312075a feat: more proto 2025-01-29 19:14:46 -06:00
tresabhi 5881b5b533 feat: parsing 2025-01-28 19:56:34 -06:00
tresabhi aa4da2ac4e feat: maps 2025-01-28 19:53:15 -06:00
tresabhi d6c1e8069d feat: parsing 2025-01-28 19:52:49 -06:00
tresabhi 74a8df6842 feat: rename cli 2025-01-28 12:59:59 -06:00
tresabhi 157fa0c1dd feat: protos 2025-01-28 12:55:02 -06:00
tresabhi 0139dd45c9 feat: dir api 2025-01-27 22:17:13 -06:00
tresabhi 9546bf5bb7 feat: oh my lord i did it 2025-01-27 17:25:40 -06:00
tresabhi 1714028e83 feat: start of tank proto 2025-01-26 21:51:35 -06:00
tresabhi d178c458df feat: remove stuff 2025-01-26 21:17:25 -06:00
tresabhi 415aebfd74 fix: use debug 2025-01-26 17:05:53 -06:00
tresabhi 68fd8fcfc5 feat: exergize globs 2025-01-26 17:03:49 -06:00
tresabhi 4c16af918d fix: override 2025-01-26 13:12:03 -06:00
tresabhi b16601704f feat: sort hd and non-hd 2025-01-26 13:11:40 -06:00
tresabhi 3a2aa135a1 feat: archive vfs 2025-01-26 12:39:23 -06:00
tresabhi 6a43773b55 fix: use oodle prefix 2025-01-26 12:36:38 -06:00
tresabhi fa5132aba5 fix: log 2025-01-26 12:35:03 -06:00
tresabhi c21a2bf58b fix: await 2025-01-26 12:28:53 -06:00
tresabhi 55ef1ecbd8 feat: oodle 2025-01-26 12:28:14 -06:00
tresabhi 3883eddd5d feat: memory 2025-01-26 12:11:40 -06:00
tresabhi 40dd752cb7 feat: stream 2025-01-25 23:59:10 -06:00
tresabhi 3c6ae546f6 feat: dlc 2025-01-25 23:51:18 -06:00
tresabhi 51fe0fe41f feat: default ini parser 2025-01-25 23:27:39 -06:00
tresabhi 1957d960aa feat: agonostic dll 2025-01-25 22:44:50 -06:00
tresabhi 7098395323 feat: some unpacker stuff 2025-01-25 22:17:41 -06:00
tresabhi 57287cea3a fix: uh lol hide that 2025-01-25 21:50:32 -06:00
tresabhi 9158f0bb79 fix: use custom dir 2025-01-25 21:48:33 -06:00
tresabhi 55e5298ba6 fix: use dotnet 9 2025-01-25 21:46:14 -06:00
tresabhi fcc34f7942 fix: cd 2025-01-25 21:45:08 -06:00
tresabhi b70d65f37b feat: more 2025-01-25 21:42:25 -06:00
tresabhi 693c3f42a6 fix: regex 2025-01-25 21:21:52 -06:00
tresabhi eab868db05 fix: no s in paks 2025-01-25 21:18:30 -06:00
tresabhi 5a9c463457 fix: indent 2025-01-25 21:16:15 -06:00
tresabhi 8119cdbb36 feat: regex 2025-01-25 21:15:03 -06:00
tresabhi 8ce7a205f1 fix: app flag 2025-01-25 21:09:43 -06:00
tresabhi e943a1af82 feat: test of cron 2025-01-25 21:07:56 -06:00
tresabhi e4cb8b3116 feat: read 2025-01-25 14:24:18 -06:00
tresabhi 4afc413d8b feat: vfs 2025-01-25 13:49:28 -06:00
tresabhi df93c986f9 feat: first proof of concept of reading 2025-01-25 13:20:55 -06:00
tresabhi 6f9336d067 featL include as submodule 2025-01-25 12:04:48 -06:00
tresabhi 82af101f9c feat: pathing 2025-01-23 21:43:54 -06:00
tresabhi 8e4f4c39bb feat: start on cli 2025-01-20 22:16:15 -06:00
211 changed files with 38160 additions and 5717 deletions

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.30.6",
"commands": [
"dotnet-csharpier"
],
"rollForward": false
}
}
}
+1
View File
@@ -0,0 +1 @@
/submodules/
+3
View File
@@ -0,0 +1,3 @@
{
"tabWidth": 2
}
-149
View File
@@ -1,149 +0,0 @@
name: Build Assets
on:
push:
branches: main
workflow_dispatch:
inputs:
cdn_branch:
type: string
required: false
default: main
description: What CDN branch to write to
zip_url:
type: string
required: false
description: ZIP URL to download instead of Steam client
zip_root:
type: string
required: false
description: Root dir of ZIP which houses the executable and Data dir
schedule:
- cron: '0 2 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.cdn_branch }}
cancel-in-progress: true
env:
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
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: ${{ secrets.PUBLIC_ASSET_REPO }}
PUBLIC_ASSET_BRANCH: ${{ github.event.inputs.cdn_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
jobs:
download_client:
name: Download client
runs-on: ubuntu-latest
steps:
- name: (ZIP) Maximize build space
if: github.event.inputs.zip_url != ''
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: 'true'
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- name: (Steam) Setup bun
uses: oven-sh/setup-bun@v1
if: github.event.inputs.zip_url == ''
- name: (Steam) Install dependencies
if: github.event.inputs.zip_url == ''
run: bun install
- name: (Steam) Setup DepotDownloader
if: github.event.inputs.zip_url == ''
run: bun run setup:depotdownloader
- name: (Steam) Download client
if: github.event.inputs.zip_url == ''
run: |
chmod +x ./temp/depotDownloader/DepotDownloader
./temp/depotDownloader/DepotDownloader -q -os windows -app 444200 -username ${{ secrets.DEPOT_DOWNLOADER_USERNAME }} -password "${{ secrets.DEPOT_DOWNLOADER_PASSWORD }}"
- name: (Steam) Apply patches
if: github.event.inputs.zip_url == ''
run: bun setup:patches --depot
- name: (ZIP) Download client
if: github.event.inputs.zip_url != ''
env:
ZIP_URL: ${{ github.event.inputs.zip_url }}
ZIP_ROOT: ${{ github.event.inputs.zip_root }}
run: |
wget -q -O client.zip $ZIP_URL
unzip -q client.zip -d client
rm client.zip
mkdir -p depots/444202/0
mv client/$ZIP_ROOT/* depots/444202/0
- name: Archive depots
uses: actions/upload-artifact@v4
with:
name: depots
path: depots
build_assets:
name: Build assets
runs-on: ubuntu-latest
needs: download_client
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Lint
run: bun run lint:website
- name: Download depots
uses: actions/download-artifact@v4
with:
name: depots
path: depots
- name: AppArmor hack
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Start server and build assets
run: |
bun dev:website --verbosepa &
SERVER_PID=$!
bun run build:assets --all-targets --depot --production
kill $SERVER_PID || true
+106 -8
View File
@@ -14,12 +14,12 @@ permissions:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref == 'refs/heads/main' }} cancel-in-progress: true
env: env:
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }} PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
PUBLIC_ASSET_BRANCH: ${{ secrets.PUBLIC_ASSET_BRANCH }} # PUBLIC_ASSET_BRANCH: ${{ secrets.PUBLIC_ASSET_BRANCH }}
PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }} PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }}
ALLOW_ROBOTS: true ALLOW_ROBOTS: true
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }} WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
@@ -28,6 +28,15 @@ env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }} WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }} WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
DEPOT_DOWNLOADER_USERNAME: ${{ secrets.DEPOT_DOWNLOADER_USERNAME }}
DEPOT_DOWNLOADER_PASSWORD: ${{ secrets.DEPOT_DOWNLOADER_PASSWORD }}
STEAM_OS: windows
STEAM_APP: 3341250
STEAM_DEPOT: 3341251
PUBLIC_ASSET_BRANCH: ue
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }} PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }}
jobs: jobs:
@@ -35,23 +44,80 @@ jobs:
name: Build name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1 - name: Setup bun
- uses: actions/configure-pages@v5 uses: oven-sh/setup-bun@v1
- name: Install dependencies - name: Configure pages
uses: actions/configure-pages@v5
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0
- name: Download Steam Depot
run: |
mkdir -p temp
echo "Downloading..."
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/SteamRE/DepotDownloader/releases/latest | \
grep -i "linux-x64" | \
grep "browser_download_url" | \
cut -d '"' -f 4)
curl -L "$DOWNLOAD_URL" -o temp/depotDownloader.zip
echo "Unzipping..."
unzip temp/depotDownloader.zip -d temp/depotDownloader
echo "Download complete; files:"
ls temp/depotDownloader
- name: Download dependencies
run: bun install run: bun install
- name: Build website - name: Restore dependencies
run: bun run build:website run: |
cd src/BlitzKit.CLI
dotnet restore
- name: Download client
run: |
chmod +x temp/depotDownloader/DepotDownloader
temp/depotDownloader/DepotDownloader \
-username "${{ env.DEPOT_DOWNLOADER_USERNAME }}" \
-password "${{ env.DEPOT_DOWNLOADER_PASSWORD }}" \
-os ${{ env.STEAM_OS }} \
-app ${{ env.STEAM_APP }} \
-depot ${{ env.STEAM_DEPOT }} \
-dir temp/depot \
-filelist filelist.txt
- name: Download containers
run: |
cd src/BlitzKit.CLI
dotnet run unpack ../../temp/depot
- name: Run API and build website
run: |
cd src/BlitzKit.CLI
dotnet run api --depot --verbosepa &
SERVER_PID=$!
cd ../..
bun run buildonly:website
kill $SERVER_PID || true
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
name: build
path: dist/website path: dist/website
deploy-github-pages: deploy-github-pages:
@@ -67,3 +133,35 @@ jobs:
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment
uses: actions/deploy-pages@v4 uses: actions/deploy-pages@v4
deploy-vercel:
if: ${{ github.ref != 'refs/heads/main' }}
name: Deploy to Vercel
runs-on: ubuntu-latest
needs: build
environment:
name: Preview
url: ${{ steps.url.outputs.url }}
steps:
- uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build
path: .vercel/output/
- name: Install Vercel CLI
run: bun install --global vercel
- name: Deploy Project Artifacts to Vercel
shell: bash
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | tee deploy.log
- name: Set preview url
id: url
run: echo "url=$(tail -1 deploy.log)">> $GITHUB_OUTPUT
+490 -1
View File
@@ -1,3 +1,5 @@
# src/BlitzKit.CLI/Protos
node_modules node_modules
_node_modules _node_modules
package-lock.json package-lock.json
@@ -27,4 +29,491 @@ target
/.vercel /.vercel
/.astro /.astro
.vercel .vercel
/src
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from `dotnet new gitignore`
# dotenv files
.env
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
# REMOVING THIS BECAUSE IT IGNORES PACKAGES LOL
# **/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
.idea/
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# Vim temporary swap files
*.swp
+6
View File
@@ -1,3 +1,9 @@
[submodule "submodules/blitzkit-closed"] [submodule "submodules/blitzkit-closed"]
path = submodules/blitzkit-closed path = submodules/blitzkit-closed
url = https://github.com/tresabhi/blitzkit-closed url = https://github.com/tresabhi/blitzkit-closed
[submodule "submodules/CUE4Parse"]
path = submodules/CUE4Parse
url = https://github.com/FabianFG/CUE4Parse
[submodule "submodules/UAssetAPI"]
path = submodules/UAssetAPI
url = https://github.com/atenfyr/UAssetAPI
+1
View File
@@ -0,0 +1 @@
/submodules/
+17 -1
View File
@@ -12,6 +12,7 @@
"APAC", "APAC",
"apcr", "apcr",
"applypatches", "applypatches",
"arrayfy",
"artefacts", "artefacts",
"astrojs", "astrojs",
"astrolib", "astrolib",
@@ -72,6 +73,10 @@
"dxgi", "dxgi",
"echarts", "echarts",
"Everytime", "Everytime",
"Exergizable",
"Exergize",
"Exergizing",
"Exergy",
"FASTNAME", "FASTNAME",
"flexdirection", "flexdirection",
"FOURCC", "FOURCC",
@@ -118,12 +123,14 @@
"NEGATIVEX", "NEGATIVEX",
"NEGATIVEY", "NEGATIVEY",
"NEGATIVEZ", "NEGATIVEZ",
"Newtonsoft",
"NITROPAY", "NITROPAY",
"nivo", "nivo",
"nmatname", "nmatname",
"noout", "noout",
"normalmap", "normalmap",
"oneof", "oneof",
"Oodle",
"oopsies", "oopsies",
"Oopsy", "Oopsy",
"opentest", "opentest",
@@ -131,16 +138,19 @@
"outdir", "outdir",
"outfile", "outfile",
"ownedtanks", "ownedtanks",
"paks",
"partytown", "partytown",
"PIXELFORMAT", "PIXELFORMAT",
"playerachievements", "playerachievements",
"playerinfo", "playerinfo",
"playform", "playform",
"Playtest",
"pngjs", "pngjs",
"POSITIVEX", "POSITIVEX",
"POSITIVEY", "POSITIVEY",
"POSITIVEZ", "POSITIVEZ",
"precompute", "precompute",
"preforged",
"Promisable", "Promisable",
"proto", "proto",
"protobuf", "protobuf",
@@ -148,6 +158,7 @@
"Pyogenics", "Pyogenics",
"ratingleaderboard", "ratingleaderboard",
"raycaster", "raycaster",
"regen",
"researchable", "researchable",
"Resvg", "Resvg",
"rizz", "rizz",
@@ -185,7 +196,9 @@
"tresabhi", "tresabhi",
"tungstentip", "tungstentip",
"TYPELESS", "TYPELESS",
"uasset",
"ubjson", "ubjson",
"uexp",
"Unicum", "Unicum",
"UNLOCALIZED", "UNLOCALIZED",
"UNORM", "UNORM",
@@ -193,7 +206,9 @@
"Unregistering", "Unregistering",
"unrotate", "unrotate",
"unwrapper", "unwrapper",
"Usmap",
"vercel", "vercel",
"Verts",
"vickers", "vickers",
"vitepress", "vitepress",
"Vovko", "Vovko",
@@ -221,5 +236,6 @@
"deno.unstable": false, "deno.unstable": false,
"cSpell.enableFiletypes": ["glsl", "proto3"], "cSpell.enableFiletypes": ["glsl", "proto3"],
"typescript.tsdk": "node_modules\\typescript\\lib", "typescript.tsdk": "node_modules\\typescript\\lib",
"liveServer.settings.multiRootWorkspaceName": "blitzkit" "liveServer.settings.multiRootWorkspaceName": "blitzkit",
"dotnet.defaultSolution": "blitzkit.sln"
} }
+41
View File
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/blitzkit.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/blitzkit.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/blitzkit.sln"
],
"problemMatcher": "$msCompile"
}
]
}
+29
View File
@@ -0,0 +1,29 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlitzKit.CLI", "src\BlitzKit.CLI\BlitzKit.CLI.csproj", "{65351C93-2DB4-8401-3BE1-C253571187A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{65351C93-2DB4-8401-3BE1-C253571187A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65351C93-2DB4-8401-3BE1-C253571187A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65351C93-2DB4-8401-3BE1-C253571187A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65351C93-2DB4-8401-3BE1-C253571187A1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{65351C93-2DB4-8401-3BE1-C253571187A1} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {70DA613E-E0B8-4525-93DB-3BF91568E845}
EndGlobalSection
EndGlobal
BIN
View File
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
`Blitz/Config/DefaultGameplayTags.ini` seems to have an exhaustive list of all maps, tanks, sets, game modes, legendary camouflages, consumables, skills, quick commands, UI components, etc.
`Blitz/Config/DefaultGame.ini` seems to have all locales under the name of "Cultures"
`Blitz/Config/DefaultDlc.ini` contains DLC info; essentially extra `pak` containers
`Blitz/Content/TanksStuff/Common/DT_TankClasses.uasset` seems to have all tank classes
`C:\Users\coola\AppData\Local\Blitz\Saved\PersistentDownloadDir\http\dl-wotblitz-gc.wargaming.net\dlc\p14y73c7_p5e_b10gg3RS_big_play\ue_localizations\development\general` has all localization files
`Blitz/Config/DefaultBzBattleSettings.ini` contains all modules that can take damage when a tank takes fall damage
`Blitz/Config/DefaultLocalizationFetcher.ini` has a list of all locales
`Blitz/Content/TanksStuff/Dev/DT_DAVATanks.uasset` has all DAVA-UE tank mappings
+1
View File
@@ -0,0 +1 @@
Blitz/Content/Paks/pakchunk0-Windows.pak
+8 -3
View File
@@ -13,6 +13,7 @@
"build:averages": "bun --filter=@blitzkit/scripts run build:averages", "build:averages": "bun --filter=@blitzkit/scripts run build:averages",
"build:bot": "cd packages/scripts && bun run build:bot", "build:bot": "cd packages/scripts && bun run build:bot",
"build:website": "bun build:prisma --no-hints && cd packages/website && bun run build", "build:website": "bun build:prisma --no-hints && cd packages/website && bun run build",
"buildonly:website": "bun build:prisma --no-hints && cd packages/website && bun run buildonly",
"build:prisma": "prisma generate", "build:prisma": "prisma generate",
"build:sitemap": "bun scripts/sitemap.ts", "build:sitemap": "bun scripts/sitemap.ts",
"build:docs": "vitepress build docs", "build:docs": "vitepress build docs",
@@ -21,7 +22,6 @@
"start:bot": "bun dist/bot/main.js", "start:bot": "bun dist/bot/main.js",
"dev:docs": "vitepress dev docs", "dev:docs": "vitepress dev docs",
"dev:website": "cd packages/website && bun run dev", "dev:website": "cd packages/website && bun run dev",
"dev:api": "bun --filter=@blitzkit/api run dev",
"setup:depotdownloader": "bun --filter=@blitzkit/scripts run setup:depotdownloader", "setup:depotdownloader": "bun --filter=@blitzkit/scripts run setup:depotdownloader",
"setup:patches": "bun --filter=@blitzkit/scripts run setup:patches", "setup:patches": "bun --filter=@blitzkit/scripts run setup:patches",
"start:website": "bun --filter=@blitzkit/website run start", "start:website": "bun --filter=@blitzkit/website run start",
@@ -32,11 +32,16 @@
"update": "yarn upgrade --latest", "update": "yarn upgrade --latest",
"tunnel": "cloudflared tunnel --url http://localhost:3000", "tunnel": "cloudflared tunnel --url http://localhost:3000",
"discoverids": "scripts/discoverIds.ts", "discoverids": "scripts/discoverIds.ts",
"build:protos": "bun packages/scripts/src/protos.ts", "protos": "rm -rf src/BlitzKit.CLI/Protos && mkdir -p src/BlitzKit.CLI/Protos && protoc packages/core/src/protos/*.proto --csharp_out=src/BlitzKit.CLI/Protos && bun packages/scripts/src/protos.ts",
"preview:website": "cd packages/website && bun run preview", "preview:website": "cd packages/website && bun run preview",
"build:reviews": "cd packages/scripts && bun build:reviews", "build:reviews": "cd packages/scripts && bun build:reviews",
"build:ids": "cd packages/scripts && bun build:ids", "build:ids": "cd packages/scripts && bun build:ids",
"prunestrings": "cd packages/scripts && bun prunestrings" "prunestrings": "cd packages/scripts && bun prunestrings",
"dev:cli:unpack": "cd src/BlitzKit.CLI && dotnet run unpack \"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest\" --no-overwrite",
"mangle": "cd src/BlitzKit.CLI && dotnet run mangle",
"mangle2": "cd src/BlitzKit.CLI && dotnet run mangle2",
"api": "cd src/BlitzKit.CLI && dotnet run api",
"dev:api": "cd src/BlitzKit.CLI && dotnet watch run api"
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
+5
View File
@@ -46,4 +46,9 @@ export * from './votes';
export * from './createDefaultProvisions'; export * from './createDefaultProvisions';
export * from './metaSortTank'; export * from './metaSortTank';
export * from './romanize'; export * from './romanize';
export * from './tank';
export * from './tankArmor';
export * from './tankModel';
export * from './tanks';
export * from './tanksFull';
export * from './youtubers'; export * from './youtubers';
+7
View File
@@ -0,0 +1,7 @@
import { fetchPB } from '../protobuf';
import { Tank } from '../protos';
import { asset } from './asset';
export function fetchTank(id: string) {
return fetchPB(asset(`tanks/${id}/meta.pb`), Tank);
}
+7
View File
@@ -0,0 +1,7 @@
import { fetchPB } from '../protobuf';
import { TankArmor } from '../protos';
import { asset } from './asset';
export function fetchTankArmor(id: string) {
return fetchPB(asset(`tanks/${id}/armor.pb`), TankArmor);
}
+7
View File
@@ -0,0 +1,7 @@
import { fetchPB } from '../protobuf';
import { TankModel } from '../protos';
import { asset } from './asset';
export function fetchTankModel(id: string) {
return fetchPB(asset(`tanks/${id}/model.pb`), TankModel);
}
+7
View File
@@ -0,0 +1,7 @@
import { fetchPB } from '../protobuf';
import { Tanks } from '../protos';
import { asset } from './asset';
export function fetchTanks() {
return fetchPB(asset('definitions/tanks.pb'), Tanks);
}
+7
View File
@@ -0,0 +1,7 @@
import { fetchPB } from '../protobuf';
import { TanksFull } from '../protos';
import { asset } from './asset';
export function fetchTanksFull() {
return fetchPB(asset('definitions/tanks-full.pb'), TanksFull);
}
@@ -1,343 +0,0 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/camouflage_definitions.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { I18nString, createBaseI18nString } from "./i18n";
export const protobufPackage = "blitzkit";
export interface CamouflageDefinitions {
camouflages: { [key: number]: Camouflage };
}
export interface CamouflageDefinitions_CamouflagesEntry {
key: number;
value: Camouflage | undefined;
}
export interface Camouflage {
id: number;
name: I18nString;
tank_name?: I18nString | undefined;
tank_name_full?: I18nString | undefined;
}
function createBaseCamouflageDefinitions(): CamouflageDefinitions {
return { camouflages: {} };
}
export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = {
encode(message: CamouflageDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.camouflages).forEach(([key, value]) => {
CamouflageDefinitions_CamouflagesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): CamouflageDefinitions {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCamouflageDefinitions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = CamouflageDefinitions_CamouflagesEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.camouflages[entry1.key] = entry1.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): CamouflageDefinitions {
return {
camouflages: isObject(object.camouflages)
? Object.entries(object.camouflages).reduce<{ [key: number]: Camouflage }>((acc, [key, value]) => {
acc[globalThis.Number(key)] = Camouflage.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: CamouflageDefinitions): unknown {
const obj: any = {};
if (message.camouflages) {
const entries = Object.entries(message.camouflages);
if (entries.length > 0) {
obj.camouflages = {};
entries.forEach(([k, v]) => {
obj.camouflages[k] = Camouflage.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>(base?: I): CamouflageDefinitions {
return CamouflageDefinitions.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>(object: I): CamouflageDefinitions {
const message = createBaseCamouflageDefinitions();
message.camouflages = Object.entries(object.camouflages ?? {}).reduce<{ [key: number]: Camouflage }>(
(acc, [key, value]) => {
if (value !== undefined) {
acc[globalThis.Number(key)] = Camouflage.fromPartial(value);
}
return acc;
},
{},
);
return message;
},
};
function createBaseCamouflageDefinitions_CamouflagesEntry(): CamouflageDefinitions_CamouflagesEntry {
return { key: 0, value: createBaseCamouflage() };
}
export const CamouflageDefinitions_CamouflagesEntry: MessageFns<CamouflageDefinitions_CamouflagesEntry> = {
encode(message: CamouflageDefinitions_CamouflagesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
Camouflage.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): CamouflageDefinitions_CamouflagesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCamouflageDefinitions_CamouflagesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = Camouflage.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): CamouflageDefinitions_CamouflagesEntry {
return {
key: globalThis.Number(assertSet("CamouflageDefinitions_CamouflagesEntry.key", object.key)),
value: Camouflage.fromJSON(assertSet("CamouflageDefinitions_CamouflagesEntry.value", object.value)),
};
},
toJSON(message: CamouflageDefinitions_CamouflagesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = Camouflage.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<CamouflageDefinitions_CamouflagesEntry>, I>>(
base?: I,
): CamouflageDefinitions_CamouflagesEntry {
return CamouflageDefinitions_CamouflagesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<CamouflageDefinitions_CamouflagesEntry>, I>>(
object: I,
): CamouflageDefinitions_CamouflagesEntry {
const message = createBaseCamouflageDefinitions_CamouflagesEntry();
message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null)
? Camouflage.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseCamouflage(): Camouflage {
return { id: 0, name: createBaseI18nString(), tank_name: undefined, tank_name_full: undefined };
}
export const Camouflage: MessageFns<Camouflage> = {
encode(message: Camouflage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== 0) {
writer.uint32(8).uint32(message.id);
}
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(18).fork()).join();
}
if (message.tank_name !== undefined) {
I18nString.encode(message.tank_name, writer.uint32(26).fork()).join();
}
if (message.tank_name_full !== undefined) {
I18nString.encode(message.tank_name_full, writer.uint32(34).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Camouflage {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCamouflage();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.name = I18nString.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.tank_name = I18nString.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.tank_name_full = I18nString.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Camouflage {
return {
id: globalThis.Number(assertSet("Camouflage.id", object.id)),
name: I18nString.fromJSON(assertSet("Camouflage.name", object.name)),
tank_name: isSet(object.tank_name) ? I18nString.fromJSON(object.tank_name) : undefined,
tank_name_full: isSet(object.tank_name_full) ? I18nString.fromJSON(object.tank_name_full) : undefined,
};
},
toJSON(message: Camouflage): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
}
if (message.tank_name !== undefined) {
obj.tank_name = I18nString.toJSON(message.tank_name);
}
if (message.tank_name_full !== undefined) {
obj.tank_name_full = I18nString.toJSON(message.tank_name_full);
}
return obj;
},
create<I extends Exact<DeepPartial<Camouflage>, I>>(base?: I): Camouflage {
return Camouflage.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Camouflage>, I>>(object: I): Camouflage {
const message = createBaseCamouflage();
message.id = object.id ?? 0;
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: createBaseI18nString();
message.tank_name = (object.tank_name !== undefined && object.tank_name !== null)
? I18nString.fromPartial(object.tank_name)
: undefined;
message.tank_name_full = (object.tank_name_full !== undefined && object.tank_name_full !== null)
? I18nString.fromPartial(object.tank_name_full)
: undefined;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isObject(value: any): boolean {
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
@@ -1,883 +0,0 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/consumable_definitions.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { I18nString, createBaseI18nString } from "./i18n";
export const protobufPackage = "blitzkit";
export enum ConsumableTankCategoryFilterCategory {
CLIP = 0,
}
export function consumableTankCategoryFilterCategoryFromJSON(object: any): ConsumableTankCategoryFilterCategory {
switch (object) {
case 0:
case "CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP":
return ConsumableTankCategoryFilterCategory.CLIP;
default:
throw new globalThis.Error(
"Unrecognized enum value " + object + " for enum ConsumableTankCategoryFilterCategory",
);
}
}
export function consumableTankCategoryFilterCategoryToJSON(object: ConsumableTankCategoryFilterCategory): string {
switch (object) {
case ConsumableTankCategoryFilterCategory.CLIP:
return "CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP";
default:
throw new globalThis.Error(
"Unrecognized enum value " + object + " for enum ConsumableTankCategoryFilterCategory",
);
}
}
export interface ConsumableDefinitions {
consumables: { [key: number]: Consumable };
}
export interface ConsumableDefinitions_ConsumablesEntry {
key: number;
value: Consumable | undefined;
}
export interface Consumable {
id: number;
name: I18nString;
cooldown: number;
duration?: number | undefined;
game_mode_exclusive: boolean;
include: ConsumableTankFilter[];
exclude: ConsumableTankFilter[];
}
export interface ConsumableTankFilter {
filter_type?:
| { $case: "tiers"; value: ConsumableTankTierFilter }
| { $case: "ids"; value: ConsumableTankIdsFilter }
| { $case: "categories"; value: ConsumableTankCategoryFilter }
| { $case: "nations"; value: ConsumableTankNationFilter }
| undefined;
}
export interface ConsumableTankTierFilter {
min: number;
max: number;
}
export interface ConsumableTankIdsFilter {
ids: number[];
}
export interface ConsumableTankCategoryFilter {
categories: ConsumableTankCategoryFilterCategory[];
}
export interface ConsumableTankNationFilter {
nations: string[];
}
function createBaseConsumableDefinitions(): ConsumableDefinitions {
return { consumables: {} };
}
export const ConsumableDefinitions: MessageFns<ConsumableDefinitions> = {
encode(message: ConsumableDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.consumables).forEach(([key, value]) => {
ConsumableDefinitions_ConsumablesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableDefinitions {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableDefinitions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = ConsumableDefinitions_ConsumablesEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.consumables[entry1.key] = entry1.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ConsumableDefinitions {
return {
consumables: isObject(object.consumables)
? Object.entries(object.consumables).reduce<{ [key: number]: Consumable }>((acc, [key, value]) => {
acc[globalThis.Number(key)] = Consumable.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: ConsumableDefinitions): unknown {
const obj: any = {};
if (message.consumables) {
const entries = Object.entries(message.consumables);
if (entries.length > 0) {
obj.consumables = {};
entries.forEach(([k, v]) => {
obj.consumables[k] = Consumable.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<ConsumableDefinitions>, I>>(base?: I): ConsumableDefinitions {
return ConsumableDefinitions.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ConsumableDefinitions>, I>>(object: I): ConsumableDefinitions {
const message = createBaseConsumableDefinitions();
message.consumables = Object.entries(object.consumables ?? {}).reduce<{ [key: number]: Consumable }>(
(acc, [key, value]) => {
if (value !== undefined) {
acc[globalThis.Number(key)] = Consumable.fromPartial(value);
}
return acc;
},
{},
);
return message;
},
};
function createBaseConsumableDefinitions_ConsumablesEntry(): ConsumableDefinitions_ConsumablesEntry {
return { key: 0, value: createBaseConsumable() };
}
export const ConsumableDefinitions_ConsumablesEntry: MessageFns<ConsumableDefinitions_ConsumablesEntry> = {
encode(message: ConsumableDefinitions_ConsumablesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
Consumable.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableDefinitions_ConsumablesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableDefinitions_ConsumablesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = Consumable.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ConsumableDefinitions_ConsumablesEntry {
return {
key: globalThis.Number(assertSet("ConsumableDefinitions_ConsumablesEntry.key", object.key)),
value: Consumable.fromJSON(assertSet("ConsumableDefinitions_ConsumablesEntry.value", object.value)),
};
},
toJSON(message: ConsumableDefinitions_ConsumablesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = Consumable.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<ConsumableDefinitions_ConsumablesEntry>, I>>(
base?: I,
): ConsumableDefinitions_ConsumablesEntry {
return ConsumableDefinitions_ConsumablesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ConsumableDefinitions_ConsumablesEntry>, I>>(
object: I,
): ConsumableDefinitions_ConsumablesEntry {
const message = createBaseConsumableDefinitions_ConsumablesEntry();
message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null)
? Consumable.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseConsumable(): Consumable {
return {
id: 0,
name: createBaseI18nString(),
cooldown: 0,
duration: undefined,
game_mode_exclusive: false,
include: [],
exclude: [],
};
}
export const Consumable: MessageFns<Consumable> = {
encode(message: Consumable, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== 0) {
writer.uint32(8).uint32(message.id);
}
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(18).fork()).join();
}
if (message.cooldown !== 0) {
writer.uint32(24).uint32(message.cooldown);
}
if (message.duration !== undefined && message.duration !== undefined) {
writer.uint32(37).float(message.duration);
}
if (message.game_mode_exclusive !== false) {
writer.uint32(40).bool(message.game_mode_exclusive);
}
for (const v of message.include) {
ConsumableTankFilter.encode(v!, writer.uint32(50).fork()).join();
}
for (const v of message.exclude) {
ConsumableTankFilter.encode(v!, writer.uint32(58).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Consumable {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumable();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.name = I18nString.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.cooldown = reader.uint32();
continue;
}
case 4: {
if (tag !== 37) {
break;
}
message.duration = reader.float();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.game_mode_exclusive = reader.bool();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.include.push(ConsumableTankFilter.decode(reader, reader.uint32()));
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.exclude.push(ConsumableTankFilter.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Consumable {
return {
id: globalThis.Number(assertSet("Consumable.id", object.id)),
name: I18nString.fromJSON(assertSet("Consumable.name", object.name)),
cooldown: globalThis.Number(assertSet("Consumable.cooldown", object.cooldown)),
duration: isSet(object.duration) ? globalThis.Number(object.duration) : undefined,
game_mode_exclusive: globalThis.Boolean(assertSet("Consumable.game_mode_exclusive", object.game_mode_exclusive)),
include: globalThis.Array.isArray(object?.include)
? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e))
: [],
exclude: globalThis.Array.isArray(object?.exclude)
? object.exclude.map((e: any) => ConsumableTankFilter.fromJSON(e))
: [],
};
},
toJSON(message: Consumable): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
}
if (message.cooldown !== 0) {
obj.cooldown = Math.round(message.cooldown);
}
if (message.duration !== undefined && message.duration !== undefined) {
obj.duration = message.duration;
}
if (message.game_mode_exclusive !== false) {
obj.game_mode_exclusive = message.game_mode_exclusive;
}
if (message.include?.length) {
obj.include = message.include.map((e) => ConsumableTankFilter.toJSON(e));
}
if (message.exclude?.length) {
obj.exclude = message.exclude.map((e) => ConsumableTankFilter.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<Consumable>, I>>(base?: I): Consumable {
return Consumable.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Consumable>, I>>(object: I): Consumable {
const message = createBaseConsumable();
message.id = object.id ?? 0;
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: createBaseI18nString();
message.cooldown = object.cooldown ?? 0;
message.duration = object.duration ?? undefined;
message.game_mode_exclusive = object.game_mode_exclusive ?? false;
message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
message.exclude = object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
return message;
},
};
function createBaseConsumableTankFilter(): ConsumableTankFilter {
return { filter_type: undefined };
}
export const ConsumableTankFilter: MessageFns<ConsumableTankFilter> = {
encode(message: ConsumableTankFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
switch (message.filter_type?.$case) {
case "tiers":
ConsumableTankTierFilter.encode(message.filter_type.value, writer.uint32(10).fork()).join();
break;
case "ids":
ConsumableTankIdsFilter.encode(message.filter_type.value, writer.uint32(18).fork()).join();
break;
case "categories":
ConsumableTankCategoryFilter.encode(message.filter_type.value, writer.uint32(26).fork()).join();
break;
case "nations":
ConsumableTankNationFilter.encode(message.filter_type.value, writer.uint32(34).fork()).join();
break;
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankFilter {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankFilter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.filter_type = { $case: "tiers", value: ConsumableTankTierFilter.decode(reader, reader.uint32()) };
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.filter_type = { $case: "ids", value: ConsumableTankIdsFilter.decode(reader, reader.uint32()) };
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.filter_type = {
$case: "categories",
value: ConsumableTankCategoryFilter.decode(reader, reader.uint32()),
};
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.filter_type = { $case: "nations", value: ConsumableTankNationFilter.decode(reader, reader.uint32()) };
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ConsumableTankFilter {
return {
filter_type: isSet(object.tiers)
? { $case: "tiers", value: ConsumableTankTierFilter.fromJSON(object.tiers) }
: isSet(object.ids)
? { $case: "ids", value: ConsumableTankIdsFilter.fromJSON(object.ids) }
: isSet(object.categories)
? { $case: "categories", value: ConsumableTankCategoryFilter.fromJSON(object.categories) }
: isSet(object.nations)
? { $case: "nations", value: ConsumableTankNationFilter.fromJSON(object.nations) }
: undefined,
};
},
toJSON(message: ConsumableTankFilter): unknown {
const obj: any = {};
if (message.filter_type?.$case === "tiers") {
obj.tiers = ConsumableTankTierFilter.toJSON(message.filter_type.value);
}
if (message.filter_type?.$case === "ids") {
obj.ids = ConsumableTankIdsFilter.toJSON(message.filter_type.value);
}
if (message.filter_type?.$case === "categories") {
obj.categories = ConsumableTankCategoryFilter.toJSON(message.filter_type.value);
}
if (message.filter_type?.$case === "nations") {
obj.nations = ConsumableTankNationFilter.toJSON(message.filter_type.value);
}
return obj;
},
create<I extends Exact<DeepPartial<ConsumableTankFilter>, I>>(base?: I): ConsumableTankFilter {
return ConsumableTankFilter.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ConsumableTankFilter>, I>>(object: I): ConsumableTankFilter {
const message = createBaseConsumableTankFilter();
if (
object.filter_type?.$case === "tiers" &&
object.filter_type?.value !== undefined &&
object.filter_type?.value !== null
) {
message.filter_type = { $case: "tiers", value: ConsumableTankTierFilter.fromPartial(object.filter_type.value) };
}
if (
object.filter_type?.$case === "ids" &&
object.filter_type?.value !== undefined &&
object.filter_type?.value !== null
) {
message.filter_type = { $case: "ids", value: ConsumableTankIdsFilter.fromPartial(object.filter_type.value) };
}
if (
object.filter_type?.$case === "categories" &&
object.filter_type?.value !== undefined &&
object.filter_type?.value !== null
) {
message.filter_type = {
$case: "categories",
value: ConsumableTankCategoryFilter.fromPartial(object.filter_type.value),
};
}
if (
object.filter_type?.$case === "nations" &&
object.filter_type?.value !== undefined &&
object.filter_type?.value !== null
) {
message.filter_type = {
$case: "nations",
value: ConsumableTankNationFilter.fromPartial(object.filter_type.value),
};
}
return message;
},
};
function createBaseConsumableTankTierFilter(): ConsumableTankTierFilter {
return { min: 0, max: 0 };
}
export const ConsumableTankTierFilter: MessageFns<ConsumableTankTierFilter> = {
encode(message: ConsumableTankTierFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.min !== 0) {
writer.uint32(8).uint32(message.min);
}
if (message.max !== 0) {
writer.uint32(16).uint32(message.max);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankTierFilter {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankTierFilter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.min = reader.uint32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.max = reader.uint32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ConsumableTankTierFilter {
return {
min: globalThis.Number(assertSet("ConsumableTankTierFilter.min", object.min)),
max: globalThis.Number(assertSet("ConsumableTankTierFilter.max", object.max)),
};
},
toJSON(message: ConsumableTankTierFilter): unknown {
const obj: any = {};
if (message.min !== 0) {
obj.min = Math.round(message.min);
}
if (message.max !== 0) {
obj.max = Math.round(message.max);
}
return obj;
},
create<I extends Exact<DeepPartial<ConsumableTankTierFilter>, I>>(base?: I): ConsumableTankTierFilter {
return ConsumableTankTierFilter.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ConsumableTankTierFilter>, I>>(object: I): ConsumableTankTierFilter {
const message = createBaseConsumableTankTierFilter();
message.min = object.min ?? 0;
message.max = object.max ?? 0;
return message;
},
};
function createBaseConsumableTankIdsFilter(): ConsumableTankIdsFilter {
return { ids: [] };
}
export const ConsumableTankIdsFilter: MessageFns<ConsumableTankIdsFilter> = {
encode(message: ConsumableTankIdsFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
writer.uint32(10).fork();
for (const v of message.ids) {
writer.uint32(v);
}
writer.join();
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankIdsFilter {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankIdsFilter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag === 8) {
message.ids.push(reader.uint32());
continue;
}
if (tag === 10) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.ids.push(reader.uint32());
}
continue;
}
break;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ConsumableTankIdsFilter {
return { ids: globalThis.Array.isArray(object?.ids) ? object.ids.map((e: any) => globalThis.Number(e)) : [] };
},
toJSON(message: ConsumableTankIdsFilter): unknown {
const obj: any = {};
if (message.ids?.length) {
obj.ids = message.ids.map((e) => Math.round(e));
}
return obj;
},
create<I extends Exact<DeepPartial<ConsumableTankIdsFilter>, I>>(base?: I): ConsumableTankIdsFilter {
return ConsumableTankIdsFilter.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ConsumableTankIdsFilter>, I>>(object: I): ConsumableTankIdsFilter {
const message = createBaseConsumableTankIdsFilter();
message.ids = object.ids?.map((e) => e) || [];
return message;
},
};
function createBaseConsumableTankCategoryFilter(): ConsumableTankCategoryFilter {
return { categories: [] };
}
export const ConsumableTankCategoryFilter: MessageFns<ConsumableTankCategoryFilter> = {
encode(message: ConsumableTankCategoryFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
writer.uint32(10).fork();
for (const v of message.categories) {
writer.int32(v);
}
writer.join();
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankCategoryFilter {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankCategoryFilter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag === 8) {
message.categories.push(reader.int32() as any);
continue;
}
if (tag === 10) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.categories.push(reader.int32() as any);
}
continue;
}
break;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ConsumableTankCategoryFilter {
return {
categories: globalThis.Array.isArray(object?.categories)
? object.categories.map((e: any) => consumableTankCategoryFilterCategoryFromJSON(e))
: [],
};
},
toJSON(message: ConsumableTankCategoryFilter): unknown {
const obj: any = {};
if (message.categories?.length) {
obj.categories = message.categories.map((e) => consumableTankCategoryFilterCategoryToJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<ConsumableTankCategoryFilter>, I>>(base?: I): ConsumableTankCategoryFilter {
return ConsumableTankCategoryFilter.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ConsumableTankCategoryFilter>, I>>(object: I): ConsumableTankCategoryFilter {
const message = createBaseConsumableTankCategoryFilter();
message.categories = object.categories?.map((e) => e) || [];
return message;
},
};
function createBaseConsumableTankNationFilter(): ConsumableTankNationFilter {
return { nations: [] };
}
export const ConsumableTankNationFilter: MessageFns<ConsumableTankNationFilter> = {
encode(message: ConsumableTankNationFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.nations) {
writer.uint32(10).string(v!);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankNationFilter {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankNationFilter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.nations.push(reader.string());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ConsumableTankNationFilter {
return {
nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [],
};
},
toJSON(message: ConsumableTankNationFilter): unknown {
const obj: any = {};
if (message.nations?.length) {
obj.nations = message.nations;
}
return obj;
},
create<I extends Exact<DeepPartial<ConsumableTankNationFilter>, I>>(base?: I): ConsumableTankNationFilter {
return ConsumableTankNationFilter.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ConsumableTankNationFilter>, I>>(object: I): ConsumableTankNationFilter {
const message = createBaseConsumableTankNationFilter();
message.nations = object.nations?.map((e) => e) || [];
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isObject(value: any): boolean {
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
@@ -1,578 +0,0 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/equipment_definitions.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { I18nString, createBaseI18nString } from "./i18n";
export const protobufPackage = "blitzkit";
export interface EquipmentDefinitions {
presets: { [key: string]: EquipmentPreset };
equipments: { [key: number]: Equipment };
}
export interface EquipmentDefinitions_PresetsEntry {
key: string;
value: EquipmentPreset | undefined;
}
export interface EquipmentDefinitions_EquipmentsEntry {
key: number;
value: Equipment | undefined;
}
export interface Equipment {
name: I18nString;
description: I18nString;
}
export interface EquipmentPreset {
slots: EquipmentSlot[];
}
export interface EquipmentSlot {
left: number;
right: number;
}
function createBaseEquipmentDefinitions(): EquipmentDefinitions {
return { presets: {}, equipments: {} };
}
export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
encode(message: EquipmentDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.presets).forEach(([key, value]) => {
EquipmentDefinitions_PresetsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
Object.entries(message.equipments).forEach(([key, value]) => {
EquipmentDefinitions_EquipmentsEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = EquipmentDefinitions_PresetsEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.presets[entry1.key] = entry1.value;
}
continue;
}
case 2: {
if (tag !== 18) {
break;
}
const entry2 = EquipmentDefinitions_EquipmentsEntry.decode(reader, reader.uint32());
if (entry2.value !== undefined) {
message.equipments[entry2.key] = entry2.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentDefinitions {
return {
presets: isObject(object.presets)
? Object.entries(object.presets).reduce<{ [key: string]: EquipmentPreset }>((acc, [key, value]) => {
acc[key] = EquipmentPreset.fromJSON(value);
return acc;
}, {})
: {},
equipments: isObject(object.equipments)
? Object.entries(object.equipments).reduce<{ [key: number]: Equipment }>((acc, [key, value]) => {
acc[globalThis.Number(key)] = Equipment.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: EquipmentDefinitions): unknown {
const obj: any = {};
if (message.presets) {
const entries = Object.entries(message.presets);
if (entries.length > 0) {
obj.presets = {};
entries.forEach(([k, v]) => {
obj.presets[k] = EquipmentPreset.toJSON(v);
});
}
}
if (message.equipments) {
const entries = Object.entries(message.equipments);
if (entries.length > 0) {
obj.equipments = {};
entries.forEach(([k, v]) => {
obj.equipments[k] = Equipment.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentDefinitions>, I>>(base?: I): EquipmentDefinitions {
return EquipmentDefinitions.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<EquipmentDefinitions>, I>>(object: I): EquipmentDefinitions {
const message = createBaseEquipmentDefinitions();
message.presets = Object.entries(object.presets ?? {}).reduce<{ [key: string]: EquipmentPreset }>(
(acc, [key, value]) => {
if (value !== undefined) {
acc[key] = EquipmentPreset.fromPartial(value);
}
return acc;
},
{},
);
message.equipments = Object.entries(object.equipments ?? {}).reduce<{ [key: number]: Equipment }>(
(acc, [key, value]) => {
if (value !== undefined) {
acc[globalThis.Number(key)] = Equipment.fromPartial(value);
}
return acc;
},
{},
);
return message;
},
};
function createBaseEquipmentDefinitions_PresetsEntry(): EquipmentDefinitions_PresetsEntry {
return { key: "", value: createBaseEquipmentPreset() };
}
export const EquipmentDefinitions_PresetsEntry: MessageFns<EquipmentDefinitions_PresetsEntry> = {
encode(message: EquipmentDefinitions_PresetsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
EquipmentPreset.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions_PresetsEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions_PresetsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = EquipmentPreset.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentDefinitions_PresetsEntry {
return {
key: globalThis.String(assertSet("EquipmentDefinitions_PresetsEntry.key", object.key)),
value: EquipmentPreset.fromJSON(assertSet("EquipmentDefinitions_PresetsEntry.value", object.value)),
};
},
toJSON(message: EquipmentDefinitions_PresetsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
}
if (message.value !== undefined) {
obj.value = EquipmentPreset.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentDefinitions_PresetsEntry>, I>>(
base?: I,
): EquipmentDefinitions_PresetsEntry {
return EquipmentDefinitions_PresetsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<EquipmentDefinitions_PresetsEntry>, I>>(
object: I,
): EquipmentDefinitions_PresetsEntry {
const message = createBaseEquipmentDefinitions_PresetsEntry();
message.key = object.key ?? "";
message.value = (object.value !== undefined && object.value !== null)
? EquipmentPreset.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseEquipmentDefinitions_EquipmentsEntry(): EquipmentDefinitions_EquipmentsEntry {
return { key: 0, value: createBaseEquipment() };
}
export const EquipmentDefinitions_EquipmentsEntry: MessageFns<EquipmentDefinitions_EquipmentsEntry> = {
encode(message: EquipmentDefinitions_EquipmentsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
Equipment.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions_EquipmentsEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions_EquipmentsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = Equipment.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentDefinitions_EquipmentsEntry {
return {
key: globalThis.Number(assertSet("EquipmentDefinitions_EquipmentsEntry.key", object.key)),
value: Equipment.fromJSON(assertSet("EquipmentDefinitions_EquipmentsEntry.value", object.value)),
};
},
toJSON(message: EquipmentDefinitions_EquipmentsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = Equipment.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentDefinitions_EquipmentsEntry>, I>>(
base?: I,
): EquipmentDefinitions_EquipmentsEntry {
return EquipmentDefinitions_EquipmentsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<EquipmentDefinitions_EquipmentsEntry>, I>>(
object: I,
): EquipmentDefinitions_EquipmentsEntry {
const message = createBaseEquipmentDefinitions_EquipmentsEntry();
message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null)
? Equipment.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseEquipment(): Equipment {
return { name: createBaseI18nString(), description: createBaseI18nString() };
}
export const Equipment: MessageFns<Equipment> = {
encode(message: Equipment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(10).fork()).join();
}
if (message.description !== undefined) {
I18nString.encode(message.description, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Equipment {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipment();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = I18nString.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.description = I18nString.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Equipment {
return {
name: I18nString.fromJSON(assertSet("Equipment.name", object.name)),
description: I18nString.fromJSON(assertSet("Equipment.description", object.description)),
};
},
toJSON(message: Equipment): unknown {
const obj: any = {};
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
}
if (message.description !== undefined) {
obj.description = I18nString.toJSON(message.description);
}
return obj;
},
create<I extends Exact<DeepPartial<Equipment>, I>>(base?: I): Equipment {
return Equipment.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Equipment>, I>>(object: I): Equipment {
const message = createBaseEquipment();
message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name)
: createBaseI18nString();
message.description = (object.description !== undefined && object.description !== null)
? I18nString.fromPartial(object.description)
: createBaseI18nString();
return message;
},
};
function createBaseEquipmentPreset(): EquipmentPreset {
return { slots: [] };
}
export const EquipmentPreset: MessageFns<EquipmentPreset> = {
encode(message: EquipmentPreset, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.slots) {
EquipmentSlot.encode(v!, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentPreset {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentPreset();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.slots.push(EquipmentSlot.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentPreset {
return {
slots: globalThis.Array.isArray(object?.slots) ? object.slots.map((e: any) => EquipmentSlot.fromJSON(e)) : [],
};
},
toJSON(message: EquipmentPreset): unknown {
const obj: any = {};
if (message.slots?.length) {
obj.slots = message.slots.map((e) => EquipmentSlot.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentPreset>, I>>(base?: I): EquipmentPreset {
return EquipmentPreset.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<EquipmentPreset>, I>>(object: I): EquipmentPreset {
const message = createBaseEquipmentPreset();
message.slots = object.slots?.map((e) => EquipmentSlot.fromPartial(e)) || [];
return message;
},
};
function createBaseEquipmentSlot(): EquipmentSlot {
return { left: 0, right: 0 };
}
export const EquipmentSlot: MessageFns<EquipmentSlot> = {
encode(message: EquipmentSlot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.left !== 0) {
writer.uint32(8).uint32(message.left);
}
if (message.right !== 0) {
writer.uint32(16).uint32(message.right);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentSlot {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentSlot();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.left = reader.uint32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.right = reader.uint32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentSlot {
return {
left: globalThis.Number(assertSet("EquipmentSlot.left", object.left)),
right: globalThis.Number(assertSet("EquipmentSlot.right", object.right)),
};
},
toJSON(message: EquipmentSlot): unknown {
const obj: any = {};
if (message.left !== 0) {
obj.left = Math.round(message.left);
}
if (message.right !== 0) {
obj.right = Math.round(message.right);
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentSlot>, I>>(base?: I): EquipmentSlot {
return EquipmentSlot.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<EquipmentSlot>, I>>(object: I): EquipmentSlot {
const message = createBaseEquipmentSlot();
message.left = object.left ?? 0;
message.right = object.right ?? 0;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isObject(value: any): boolean {
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
+18 -12
View File
@@ -1,14 +1,20 @@
// @ts-nocheck // @ts-nocheck
export * from './average_definitions.ts'; export * from './legacy_average_definitions.ts';
export * from './camouflage_definitions.ts'; export * from './legacy_camouflage_definitions.ts';
export * from './consumable_definitions.ts'; export * from './legacy_consumable_definitions.ts';
export * from './equipment_definitions.ts'; export * from './legacy_equipment_definitions.ts';
export * from './game_definitions.ts'; export * from './legacy_game_definitions.ts';
export * from './i18n.ts'; export * from './legacy_i18n.ts';
export * from './map_definitions.ts'; export * from './legacy_map_definitions.ts';
export * from './model_definitions.ts'; export * from './legacy_model_definitions.ts';
export * from './provision_definitions.ts'; export * from './legacy_provision_definitions.ts';
export * from './rating_leaderboard.ts'; export * from './legacy_rating_leaderboard.ts';
export * from './legacy_skill_definitions.ts';
export * from './legacy_tank_definitions.ts';
export * from './reviews.ts'; export * from './reviews.ts';
export * from './skill_definitions.ts'; export * from './tank.ts';
export * from './tank_definitions.ts'; export * from './tank_armor.ts';
export * from './tank_model.ts';
export * from './tanks.ts';
export * from './tanks_full.ts';
export * from './utils.ts';
@@ -2,7 +2,7 @@
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.2.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/average_definitions.proto // source: packages/core/src/protos/legacy_average_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -2,7 +2,7 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "packages/core/src/protos/legacy_i18n.proto";
message CamouflageDefinitions { message CamouflageDefinitions {
map<uint32, Camouflage> camouflages = 1; map<uint32, Camouflage> camouflages = 1;
@@ -0,0 +1,415 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/legacy_camouflage_definitions.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
import { I18nString, createBaseI18nString } from './legacy_i18n';
export const protobufPackage = 'blitzkit';
export interface CamouflageDefinitions {
camouflages: { [key: number]: Camouflage };
}
export interface CamouflageDefinitions_CamouflagesEntry {
key: number;
value: Camouflage | undefined;
}
export interface Camouflage {
id: number;
name: I18nString;
tank_name?: I18nString | undefined;
tank_name_full?: I18nString | undefined;
}
function createBaseCamouflageDefinitions(): CamouflageDefinitions {
return { camouflages: {} };
}
export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = {
encode(
message: CamouflageDefinitions,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
Object.entries(message.camouflages).forEach(([key, value]) => {
CamouflageDefinitions_CamouflagesEntry.encode(
{ key: key as any, value },
writer.uint32(10).fork(),
).join();
});
return writer;
},
decode(
input: BinaryReader | Uint8Array,
length?: number,
): CamouflageDefinitions {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCamouflageDefinitions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = CamouflageDefinitions_CamouflagesEntry.decode(
reader,
reader.uint32(),
);
if (entry1.value !== undefined) {
message.camouflages[entry1.key] = entry1.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): CamouflageDefinitions {
return {
camouflages: isObject(object.camouflages)
? Object.entries(object.camouflages).reduce<{
[key: number]: Camouflage;
}>((acc, [key, value]) => {
acc[globalThis.Number(key)] = Camouflage.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: CamouflageDefinitions): unknown {
const obj: any = {};
if (message.camouflages) {
const entries = Object.entries(message.camouflages);
if (entries.length > 0) {
obj.camouflages = {};
entries.forEach(([k, v]) => {
obj.camouflages[k] = Camouflage.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>(
base?: I,
): CamouflageDefinitions {
return CamouflageDefinitions.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>(
object: I,
): CamouflageDefinitions {
const message = createBaseCamouflageDefinitions();
message.camouflages = Object.entries(object.camouflages ?? {}).reduce<{
[key: number]: Camouflage;
}>((acc, [key, value]) => {
if (value !== undefined) {
acc[globalThis.Number(key)] = Camouflage.fromPartial(value);
}
return acc;
}, {});
return message;
},
};
function createBaseCamouflageDefinitions_CamouflagesEntry(): CamouflageDefinitions_CamouflagesEntry {
return { key: 0, value: createBaseCamouflage() };
}
export const CamouflageDefinitions_CamouflagesEntry: MessageFns<CamouflageDefinitions_CamouflagesEntry> =
{
encode(
message: CamouflageDefinitions_CamouflagesEntry,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
Camouflage.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(
input: BinaryReader | Uint8Array,
length?: number,
): CamouflageDefinitions_CamouflagesEntry {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCamouflageDefinitions_CamouflagesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = Camouflage.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): CamouflageDefinitions_CamouflagesEntry {
return {
key: globalThis.Number(
assertSet('CamouflageDefinitions_CamouflagesEntry.key', object.key),
),
value: Camouflage.fromJSON(
assertSet(
'CamouflageDefinitions_CamouflagesEntry.value',
object.value,
),
),
};
},
toJSON(message: CamouflageDefinitions_CamouflagesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = Camouflage.toJSON(message.value);
}
return obj;
},
create<
I extends Exact<DeepPartial<CamouflageDefinitions_CamouflagesEntry>, I>,
>(base?: I): CamouflageDefinitions_CamouflagesEntry {
return CamouflageDefinitions_CamouflagesEntry.fromPartial(
base ?? ({} as any),
);
},
fromPartial<
I extends Exact<DeepPartial<CamouflageDefinitions_CamouflagesEntry>, I>,
>(object: I): CamouflageDefinitions_CamouflagesEntry {
const message = createBaseCamouflageDefinitions_CamouflagesEntry();
message.key = object.key ?? 0;
message.value =
object.value !== undefined && object.value !== null
? Camouflage.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseCamouflage(): Camouflage {
return {
id: 0,
name: createBaseI18nString(),
tank_name: undefined,
tank_name_full: undefined,
};
}
export const Camouflage: MessageFns<Camouflage> = {
encode(
message: Camouflage,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.id !== 0) {
writer.uint32(8).uint32(message.id);
}
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(18).fork()).join();
}
if (message.tank_name !== undefined) {
I18nString.encode(message.tank_name, writer.uint32(26).fork()).join();
}
if (message.tank_name_full !== undefined) {
I18nString.encode(
message.tank_name_full,
writer.uint32(34).fork(),
).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Camouflage {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCamouflage();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.id = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.name = I18nString.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.tank_name = I18nString.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.tank_name_full = I18nString.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Camouflage {
return {
id: globalThis.Number(assertSet('Camouflage.id', object.id)),
name: I18nString.fromJSON(assertSet('Camouflage.name', object.name)),
tank_name: isSet(object.tank_name)
? I18nString.fromJSON(object.tank_name)
: undefined,
tank_name_full: isSet(object.tank_name_full)
? I18nString.fromJSON(object.tank_name_full)
: undefined,
};
},
toJSON(message: Camouflage): unknown {
const obj: any = {};
if (message.id !== 0) {
obj.id = Math.round(message.id);
}
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
}
if (message.tank_name !== undefined) {
obj.tank_name = I18nString.toJSON(message.tank_name);
}
if (message.tank_name_full !== undefined) {
obj.tank_name_full = I18nString.toJSON(message.tank_name_full);
}
return obj;
},
create<I extends Exact<DeepPartial<Camouflage>, I>>(base?: I): Camouflage {
return Camouflage.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Camouflage>, I>>(
object: I,
): Camouflage {
const message = createBaseCamouflage();
message.id = object.id ?? 0;
message.name =
object.name !== undefined && object.name !== null
? I18nString.fromPartial(object.name)
: createBaseI18nString();
message.tank_name =
object.tank_name !== undefined && object.tank_name !== null
? I18nString.fromPartial(object.tank_name)
: undefined;
message.tank_name_full =
object.tank_name_full !== undefined && object.tank_name_full !== null
? I18nString.fromPartial(object.tank_name_full)
: undefined;
return message;
},
};
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends globalThis.Array<infer U>
? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown }
? { $case: T['$case']; value?: DeepPartial<T['value']> }
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
function isObject(value: any): boolean {
return typeof value === 'object' && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
@@ -2,7 +2,7 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "packages/core/src/protos/legacy_i18n.proto";
message ConsumableDefinitions { message ConsumableDefinitions {
map<uint32, Consumable> consumables = 1; map<uint32, Consumable> consumables = 1;
File diff suppressed because it is too large. Load diff
@@ -2,7 +2,7 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "packages/core/src/protos/legacy_i18n.proto";
message EquipmentDefinitions { message EquipmentDefinitions {
map<string, EquipmentPreset> presets = 1; map<string, EquipmentPreset> presets = 1;
@@ -0,0 +1,675 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/legacy_equipment_definitions.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
import { I18nString, createBaseI18nString } from './legacy_i18n';
export const protobufPackage = 'blitzkit';
export interface EquipmentDefinitions {
presets: { [key: string]: EquipmentPreset };
equipments: { [key: number]: Equipment };
}
export interface EquipmentDefinitions_PresetsEntry {
key: string;
value: EquipmentPreset | undefined;
}
export interface EquipmentDefinitions_EquipmentsEntry {
key: number;
value: Equipment | undefined;
}
export interface Equipment {
name: I18nString;
description: I18nString;
}
export interface EquipmentPreset {
slots: EquipmentSlot[];
}
export interface EquipmentSlot {
left: number;
right: number;
}
function createBaseEquipmentDefinitions(): EquipmentDefinitions {
return { presets: {}, equipments: {} };
}
export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
encode(
message: EquipmentDefinitions,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
Object.entries(message.presets).forEach(([key, value]) => {
EquipmentDefinitions_PresetsEntry.encode(
{ key: key as any, value },
writer.uint32(10).fork(),
).join();
});
Object.entries(message.equipments).forEach(([key, value]) => {
EquipmentDefinitions_EquipmentsEntry.encode(
{ key: key as any, value },
writer.uint32(18).fork(),
).join();
});
return writer;
},
decode(
input: BinaryReader | Uint8Array,
length?: number,
): EquipmentDefinitions {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = EquipmentDefinitions_PresetsEntry.decode(
reader,
reader.uint32(),
);
if (entry1.value !== undefined) {
message.presets[entry1.key] = entry1.value;
}
continue;
}
case 2: {
if (tag !== 18) {
break;
}
const entry2 = EquipmentDefinitions_EquipmentsEntry.decode(
reader,
reader.uint32(),
);
if (entry2.value !== undefined) {
message.equipments[entry2.key] = entry2.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentDefinitions {
return {
presets: isObject(object.presets)
? Object.entries(object.presets).reduce<{
[key: string]: EquipmentPreset;
}>((acc, [key, value]) => {
acc[key] = EquipmentPreset.fromJSON(value);
return acc;
}, {})
: {},
equipments: isObject(object.equipments)
? Object.entries(object.equipments).reduce<{
[key: number]: Equipment;
}>((acc, [key, value]) => {
acc[globalThis.Number(key)] = Equipment.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: EquipmentDefinitions): unknown {
const obj: any = {};
if (message.presets) {
const entries = Object.entries(message.presets);
if (entries.length > 0) {
obj.presets = {};
entries.forEach(([k, v]) => {
obj.presets[k] = EquipmentPreset.toJSON(v);
});
}
}
if (message.equipments) {
const entries = Object.entries(message.equipments);
if (entries.length > 0) {
obj.equipments = {};
entries.forEach(([k, v]) => {
obj.equipments[k] = Equipment.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentDefinitions>, I>>(
base?: I,
): EquipmentDefinitions {
return EquipmentDefinitions.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<EquipmentDefinitions>, I>>(
object: I,
): EquipmentDefinitions {
const message = createBaseEquipmentDefinitions();
message.presets = Object.entries(object.presets ?? {}).reduce<{
[key: string]: EquipmentPreset;
}>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = EquipmentPreset.fromPartial(value);
}
return acc;
}, {});
message.equipments = Object.entries(object.equipments ?? {}).reduce<{
[key: number]: Equipment;
}>((acc, [key, value]) => {
if (value !== undefined) {
acc[globalThis.Number(key)] = Equipment.fromPartial(value);
}
return acc;
}, {});
return message;
},
};
function createBaseEquipmentDefinitions_PresetsEntry(): EquipmentDefinitions_PresetsEntry {
return { key: '', value: createBaseEquipmentPreset() };
}
export const EquipmentDefinitions_PresetsEntry: MessageFns<EquipmentDefinitions_PresetsEntry> =
{
encode(
message: EquipmentDefinitions_PresetsEntry,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
EquipmentPreset.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(
input: BinaryReader | Uint8Array,
length?: number,
): EquipmentDefinitions_PresetsEntry {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions_PresetsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = EquipmentPreset.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentDefinitions_PresetsEntry {
return {
key: globalThis.String(
assertSet('EquipmentDefinitions_PresetsEntry.key', object.key),
),
value: EquipmentPreset.fromJSON(
assertSet('EquipmentDefinitions_PresetsEntry.value', object.value),
),
};
},
toJSON(message: EquipmentDefinitions_PresetsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
}
if (message.value !== undefined) {
obj.value = EquipmentPreset.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentDefinitions_PresetsEntry>, I>>(
base?: I,
): EquipmentDefinitions_PresetsEntry {
return EquipmentDefinitions_PresetsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<
I extends Exact<DeepPartial<EquipmentDefinitions_PresetsEntry>, I>,
>(object: I): EquipmentDefinitions_PresetsEntry {
const message = createBaseEquipmentDefinitions_PresetsEntry();
message.key = object.key ?? '';
message.value =
object.value !== undefined && object.value !== null
? EquipmentPreset.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseEquipmentDefinitions_EquipmentsEntry(): EquipmentDefinitions_EquipmentsEntry {
return { key: 0, value: createBaseEquipment() };
}
export const EquipmentDefinitions_EquipmentsEntry: MessageFns<EquipmentDefinitions_EquipmentsEntry> =
{
encode(
message: EquipmentDefinitions_EquipmentsEntry,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(8).uint32(message.key);
}
if (message.value !== undefined) {
Equipment.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(
input: BinaryReader | Uint8Array,
length?: number,
): EquipmentDefinitions_EquipmentsEntry {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions_EquipmentsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = Equipment.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentDefinitions_EquipmentsEntry {
return {
key: globalThis.Number(
assertSet('EquipmentDefinitions_EquipmentsEntry.key', object.key),
),
value: Equipment.fromJSON(
assertSet('EquipmentDefinitions_EquipmentsEntry.value', object.value),
),
};
},
toJSON(message: EquipmentDefinitions_EquipmentsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = Equipment.toJSON(message.value);
}
return obj;
},
create<
I extends Exact<DeepPartial<EquipmentDefinitions_EquipmentsEntry>, I>,
>(base?: I): EquipmentDefinitions_EquipmentsEntry {
return EquipmentDefinitions_EquipmentsEntry.fromPartial(
base ?? ({} as any),
);
},
fromPartial<
I extends Exact<DeepPartial<EquipmentDefinitions_EquipmentsEntry>, I>,
>(object: I): EquipmentDefinitions_EquipmentsEntry {
const message = createBaseEquipmentDefinitions_EquipmentsEntry();
message.key = object.key ?? 0;
message.value =
object.value !== undefined && object.value !== null
? Equipment.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseEquipment(): Equipment {
return { name: createBaseI18nString(), description: createBaseI18nString() };
}
export const Equipment: MessageFns<Equipment> = {
encode(
message: Equipment,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(10).fork()).join();
}
if (message.description !== undefined) {
I18nString.encode(message.description, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Equipment {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipment();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = I18nString.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.description = I18nString.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Equipment {
return {
name: I18nString.fromJSON(assertSet('Equipment.name', object.name)),
description: I18nString.fromJSON(
assertSet('Equipment.description', object.description),
),
};
},
toJSON(message: Equipment): unknown {
const obj: any = {};
if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name);
}
if (message.description !== undefined) {
obj.description = I18nString.toJSON(message.description);
}
return obj;
},
create<I extends Exact<DeepPartial<Equipment>, I>>(base?: I): Equipment {
return Equipment.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Equipment>, I>>(
object: I,
): Equipment {
const message = createBaseEquipment();
message.name =
object.name !== undefined && object.name !== null
? I18nString.fromPartial(object.name)
: createBaseI18nString();
message.description =
object.description !== undefined && object.description !== null
? I18nString.fromPartial(object.description)
: createBaseI18nString();
return message;
},
};
function createBaseEquipmentPreset(): EquipmentPreset {
return { slots: [] };
}
export const EquipmentPreset: MessageFns<EquipmentPreset> = {
encode(
message: EquipmentPreset,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
for (const v of message.slots) {
EquipmentSlot.encode(v!, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentPreset {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentPreset();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.slots.push(EquipmentSlot.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentPreset {
return {
slots: globalThis.Array.isArray(object?.slots)
? object.slots.map((e: any) => EquipmentSlot.fromJSON(e))
: [],
};
},
toJSON(message: EquipmentPreset): unknown {
const obj: any = {};
if (message.slots?.length) {
obj.slots = message.slots.map((e) => EquipmentSlot.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentPreset>, I>>(
base?: I,
): EquipmentPreset {
return EquipmentPreset.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<EquipmentPreset>, I>>(
object: I,
): EquipmentPreset {
const message = createBaseEquipmentPreset();
message.slots =
object.slots?.map((e) => EquipmentSlot.fromPartial(e)) || [];
return message;
},
};
function createBaseEquipmentSlot(): EquipmentSlot {
return { left: 0, right: 0 };
}
export const EquipmentSlot: MessageFns<EquipmentSlot> = {
encode(
message: EquipmentSlot,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.left !== 0) {
writer.uint32(8).uint32(message.left);
}
if (message.right !== 0) {
writer.uint32(16).uint32(message.right);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentSlot {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentSlot();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.left = reader.uint32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.right = reader.uint32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): EquipmentSlot {
return {
left: globalThis.Number(assertSet('EquipmentSlot.left', object.left)),
right: globalThis.Number(assertSet('EquipmentSlot.right', object.right)),
};
},
toJSON(message: EquipmentSlot): unknown {
const obj: any = {};
if (message.left !== 0) {
obj.left = Math.round(message.left);
}
if (message.right !== 0) {
obj.right = Math.round(message.right);
}
return obj;
},
create<I extends Exact<DeepPartial<EquipmentSlot>, I>>(
base?: I,
): EquipmentSlot {
return EquipmentSlot.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<EquipmentSlot>, I>>(
object: I,
): EquipmentSlot {
const message = createBaseEquipmentSlot();
message.left = object.left ?? 0;
message.right = object.right ?? 0;
return message;
},
};
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends globalThis.Array<infer U>
? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown }
? { $case: T['$case']; value?: DeepPartial<T['value']> }
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
function isObject(value: any): boolean {
return typeof value === 'object' && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
@@ -2,7 +2,7 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "packages/core/src/protos/legacy_i18n.proto";
message GameDefinitions { message GameDefinitions {
required string version = 1; required string version = 1;
@@ -2,13 +2,13 @@
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.2.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/game_definitions.proto // source: packages/core/src/protos/legacy_game_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
import { I18nString, createBaseI18nString } from "./i18n"; import { I18nString, createBaseI18nString } from './legacy_i18n';
export const protobufPackage = "blitzkit"; export const protobufPackage = 'blitzkit';
export interface GameDefinitions { export interface GameDefinitions {
version: string; version: string;
@@ -37,28 +37,38 @@ export interface GameModeRole {
} }
function createBaseGameDefinitions(): GameDefinitions { function createBaseGameDefinitions(): GameDefinitions {
return { version: "", nations: [], gameModes: {}, roles: {} }; return { version: '', nations: [], gameModes: {}, roles: {} };
} }
export const GameDefinitions: MessageFns<GameDefinitions> = { export const GameDefinitions: MessageFns<GameDefinitions> = {
encode(message: GameDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(
if (message.version !== "") { message: GameDefinitions,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.version !== '') {
writer.uint32(10).string(message.version); writer.uint32(10).string(message.version);
} }
for (const v of message.nations) { for (const v of message.nations) {
writer.uint32(18).string(v!); writer.uint32(18).string(v!);
} }
Object.entries(message.gameModes).forEach(([key, value]) => { Object.entries(message.gameModes).forEach(([key, value]) => {
GameDefinitions_GameModesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); GameDefinitions_GameModesEntry.encode(
{ key: key as any, value },
writer.uint32(26).fork(),
).join();
}); });
Object.entries(message.roles).forEach(([key, value]) => { Object.entries(message.roles).forEach(([key, value]) => {
GameDefinitions_RolesEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); GameDefinitions_RolesEntry.encode(
{ key: key as any, value },
writer.uint32(34).fork(),
).join();
}); });
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions(); const message = createBaseGameDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
@@ -85,7 +95,10 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
break; break;
} }
const entry3 = GameDefinitions_GameModesEntry.decode(reader, reader.uint32()); const entry3 = GameDefinitions_GameModesEntry.decode(
reader,
reader.uint32(),
);
if (entry3.value !== undefined) { if (entry3.value !== undefined) {
message.gameModes[entry3.key] = entry3.value; message.gameModes[entry3.key] = entry3.value;
} }
@@ -96,7 +109,10 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
break; break;
} }
const entry4 = GameDefinitions_RolesEntry.decode(reader, reader.uint32()); const entry4 = GameDefinitions_RolesEntry.decode(
reader,
reader.uint32(),
);
if (entry4.value !== undefined) { if (entry4.value !== undefined) {
message.roles[entry4.key] = entry4.value; message.roles[entry4.key] = entry4.value;
} }
@@ -113,26 +129,36 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
fromJSON(object: any): GameDefinitions { fromJSON(object: any): GameDefinitions {
return { return {
version: globalThis.String(assertSet("GameDefinitions.version", object.version)), version: globalThis.String(
nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [], assertSet('GameDefinitions.version', object.version),
),
nations: globalThis.Array.isArray(object?.nations)
? object.nations.map((e: any) => globalThis.String(e))
: [],
gameModes: isObject(object.gameModes) gameModes: isObject(object.gameModes)
? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>((acc, [key, value]) => { ? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>(
acc[globalThis.Number(key)] = GameMode.fromJSON(value); (acc, [key, value]) => {
return acc; acc[globalThis.Number(key)] = GameMode.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
roles: isObject(object.roles) roles: isObject(object.roles)
? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => { ? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>(
acc[globalThis.Number(key)] = GameModeRole.fromJSON(value); (acc, [key, value]) => {
return acc; acc[globalThis.Number(key)] = GameModeRole.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
toJSON(message: GameDefinitions): unknown { toJSON(message: GameDefinitions): unknown {
const obj: any = {}; const obj: any = {};
if (message.version !== "") { if (message.version !== '') {
obj.version = message.version; obj.version = message.version;
} }
if (message.nations?.length) { if (message.nations?.length) {
@@ -159,23 +185,28 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
return obj; return obj;
}, },
create<I extends Exact<DeepPartial<GameDefinitions>, I>>(base?: I): GameDefinitions { create<I extends Exact<DeepPartial<GameDefinitions>, I>>(
base?: I,
): GameDefinitions {
return GameDefinitions.fromPartial(base ?? ({} as any)); return GameDefinitions.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<GameDefinitions>, I>>(object: I): GameDefinitions { fromPartial<I extends Exact<DeepPartial<GameDefinitions>, I>>(
object: I,
): GameDefinitions {
const message = createBaseGameDefinitions(); const message = createBaseGameDefinitions();
message.version = object.version ?? ""; message.version = object.version ?? '';
message.nations = object.nations?.map((e) => e) || []; message.nations = object.nations?.map((e) => e) || [];
message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{ [key: number]: GameMode }>( message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{
(acc, [key, value]) => { [key: number]: GameMode;
if (value !== undefined) { }>((acc, [key, value]) => {
acc[globalThis.Number(key)] = GameMode.fromPartial(value); if (value !== undefined) {
} acc[globalThis.Number(key)] = GameMode.fromPartial(value);
return acc; }
}, return acc;
{}, }, {});
); message.roles = Object.entries(object.roles ?? {}).reduce<{
message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => { [key: number]: GameModeRole;
}>((acc, [key, value]) => {
if (value !== undefined) { if (value !== undefined) {
acc[globalThis.Number(key)] = GameModeRole.fromPartial(value); acc[globalThis.Number(key)] = GameModeRole.fromPartial(value);
} }
@@ -189,166 +220,201 @@ function createBaseGameDefinitions_GameModesEntry(): GameDefinitions_GameModesEn
return { key: 0, value: createBaseGameMode() }; return { key: 0, value: createBaseGameMode() };
} }
export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> = { export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> =
encode(message: GameDefinitions_GameModesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { {
if (message.key !== undefined) { encode(
writer.uint32(8).uint32(message.key); message: GameDefinitions_GameModesEntry,
} writer: BinaryWriter = new BinaryWriter(),
if (message.value !== undefined) { ): BinaryWriter {
GameMode.encode(message.value, writer.uint32(18).fork()).join(); if (message.key !== undefined) {
} writer.uint32(8).uint32(message.key);
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_GameModesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_GameModesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = GameMode.decode(reader, reader.uint32());
continue;
}
} }
if ((tag & 7) === 4 || tag === 0) { if (message.value !== undefined) {
break; GameMode.encode(message.value, writer.uint32(18).fork()).join();
} }
reader.skip(tag & 7); return writer;
} },
return message;
},
fromJSON(object: any): GameDefinitions_GameModesEntry { decode(
return { input: BinaryReader | Uint8Array,
key: globalThis.Number(assertSet("GameDefinitions_GameModesEntry.key", object.key)), length?: number,
value: GameMode.fromJSON(assertSet("GameDefinitions_GameModesEntry.value", object.value)), ): GameDefinitions_GameModesEntry {
}; const reader =
}, input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_GameModesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
toJSON(message: GameDefinitions_GameModesEntry): unknown { message.key = reader.uint32();
const obj: any = {}; continue;
if (message.key !== undefined) { }
obj.key = Math.round(message.key); case 2: {
} if (tag !== 18) {
if (message.value !== undefined) { break;
obj.value = GameMode.toJSON(message.value); }
}
return obj;
},
create<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(base?: I): GameDefinitions_GameModesEntry { message.value = GameMode.decode(reader, reader.uint32());
return GameDefinitions_GameModesEntry.fromPartial(base ?? ({} as any)); continue;
}, }
fromPartial<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>( }
object: I, if ((tag & 7) === 4 || tag === 0) {
): GameDefinitions_GameModesEntry { break;
const message = createBaseGameDefinitions_GameModesEntry(); }
message.key = object.key ?? 0; reader.skip(tag & 7);
message.value = (object.value !== undefined && object.value !== null) }
? GameMode.fromPartial(object.value) return message;
: undefined; },
return message;
}, fromJSON(object: any): GameDefinitions_GameModesEntry {
}; return {
key: globalThis.Number(
assertSet('GameDefinitions_GameModesEntry.key', object.key),
),
value: GameMode.fromJSON(
assertSet('GameDefinitions_GameModesEntry.value', object.value),
),
};
},
toJSON(message: GameDefinitions_GameModesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = GameMode.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(
base?: I,
): GameDefinitions_GameModesEntry {
return GameDefinitions_GameModesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<
I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>,
>(object: I): GameDefinitions_GameModesEntry {
const message = createBaseGameDefinitions_GameModesEntry();
message.key = object.key ?? 0;
message.value =
object.value !== undefined && object.value !== null
? GameMode.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseGameDefinitions_RolesEntry(): GameDefinitions_RolesEntry { function createBaseGameDefinitions_RolesEntry(): GameDefinitions_RolesEntry {
return { key: 0, value: createBaseGameModeRole() }; return { key: 0, value: createBaseGameModeRole() };
} }
export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> = { export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> =
encode(message: GameDefinitions_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { {
if (message.key !== undefined) { encode(
writer.uint32(8).uint32(message.key); message: GameDefinitions_RolesEntry,
} writer: BinaryWriter = new BinaryWriter(),
if (message.value !== undefined) { ): BinaryWriter {
GameModeRole.encode(message.value, writer.uint32(18).fork()).join(); if (message.key !== undefined) {
} writer.uint32(8).uint32(message.key);
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_RolesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_RolesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = GameModeRole.decode(reader, reader.uint32());
continue;
}
} }
if ((tag & 7) === 4 || tag === 0) { if (message.value !== undefined) {
break; GameModeRole.encode(message.value, writer.uint32(18).fork()).join();
} }
reader.skip(tag & 7); return writer;
} },
return message;
},
fromJSON(object: any): GameDefinitions_RolesEntry { decode(
return { input: BinaryReader | Uint8Array,
key: globalThis.Number(assertSet("GameDefinitions_RolesEntry.key", object.key)), length?: number,
value: GameModeRole.fromJSON(assertSet("GameDefinitions_RolesEntry.value", object.value)), ): GameDefinitions_RolesEntry {
}; const reader =
}, input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_RolesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
toJSON(message: GameDefinitions_RolesEntry): unknown { message.key = reader.uint32();
const obj: any = {}; continue;
if (message.key !== undefined) { }
obj.key = Math.round(message.key); case 2: {
} if (tag !== 18) {
if (message.value !== undefined) { break;
obj.value = GameModeRole.toJSON(message.value); }
}
return obj;
},
create<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(base?: I): GameDefinitions_RolesEntry { message.value = GameModeRole.decode(reader, reader.uint32());
return GameDefinitions_RolesEntry.fromPartial(base ?? ({} as any)); continue;
}, }
fromPartial<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(object: I): GameDefinitions_RolesEntry { }
const message = createBaseGameDefinitions_RolesEntry(); if ((tag & 7) === 4 || tag === 0) {
message.key = object.key ?? 0; break;
message.value = (object.value !== undefined && object.value !== null) }
? GameModeRole.fromPartial(object.value) reader.skip(tag & 7);
: undefined; }
return message; return message;
}, },
};
fromJSON(object: any): GameDefinitions_RolesEntry {
return {
key: globalThis.Number(
assertSet('GameDefinitions_RolesEntry.key', object.key),
),
value: GameModeRole.fromJSON(
assertSet('GameDefinitions_RolesEntry.value', object.value),
),
};
},
toJSON(message: GameDefinitions_RolesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = GameModeRole.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(
base?: I,
): GameDefinitions_RolesEntry {
return GameDefinitions_RolesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(
object: I,
): GameDefinitions_RolesEntry {
const message = createBaseGameDefinitions_RolesEntry();
message.key = object.key ?? 0;
message.value =
object.value !== undefined && object.value !== null
? GameModeRole.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseGameMode(): GameMode { function createBaseGameMode(): GameMode {
return { name: createBaseI18nString() }; return { name: createBaseI18nString() };
} }
export const GameMode: MessageFns<GameMode> = { export const GameMode: MessageFns<GameMode> = {
encode(message: GameMode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(
message: GameMode,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.name !== undefined) { if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(10).fork()).join(); I18nString.encode(message.name, writer.uint32(10).fork()).join();
} }
@@ -356,7 +422,8 @@ export const GameMode: MessageFns<GameMode> = {
}, },
decode(input: BinaryReader | Uint8Array, length?: number): GameMode { decode(input: BinaryReader | Uint8Array, length?: number): GameMode {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameMode(); const message = createBaseGameMode();
while (reader.pos < end) { while (reader.pos < end) {
@@ -380,7 +447,9 @@ export const GameMode: MessageFns<GameMode> = {
}, },
fromJSON(object: any): GameMode { fromJSON(object: any): GameMode {
return { name: I18nString.fromJSON(assertSet("GameMode.name", object.name)) }; return {
name: I18nString.fromJSON(assertSet('GameMode.name', object.name)),
};
}, },
toJSON(message: GameMode): unknown { toJSON(message: GameMode): unknown {
@@ -396,9 +465,10 @@ export const GameMode: MessageFns<GameMode> = {
}, },
fromPartial<I extends Exact<DeepPartial<GameMode>, I>>(object: I): GameMode { fromPartial<I extends Exact<DeepPartial<GameMode>, I>>(object: I): GameMode {
const message = createBaseGameMode(); const message = createBaseGameMode();
message.name = (object.name !== undefined && object.name !== null) message.name =
? I18nString.fromPartial(object.name) object.name !== undefined && object.name !== null
: createBaseI18nString(); ? I18nString.fromPartial(object.name)
: createBaseI18nString();
return message; return message;
}, },
}; };
@@ -408,7 +478,10 @@ function createBaseGameModeRole(): GameModeRole {
} }
export const GameModeRole: MessageFns<GameModeRole> = { export const GameModeRole: MessageFns<GameModeRole> = {
encode(message: GameModeRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(
message: GameModeRole,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
writer.uint32(10).fork(); writer.uint32(10).fork();
for (const v of message.provisions) { for (const v of message.provisions) {
writer.uint32(v); writer.uint32(v);
@@ -423,7 +496,8 @@ export const GameModeRole: MessageFns<GameModeRole> = {
}, },
decode(input: BinaryReader | Uint8Array, length?: number): GameModeRole { decode(input: BinaryReader | Uint8Array, length?: number): GameModeRole {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameModeRole(); const message = createBaseGameModeRole();
while (reader.pos < end) { while (reader.pos < end) {
@@ -496,10 +570,14 @@ export const GameModeRole: MessageFns<GameModeRole> = {
return obj; return obj;
}, },
create<I extends Exact<DeepPartial<GameModeRole>, I>>(base?: I): GameModeRole { create<I extends Exact<DeepPartial<GameModeRole>, I>>(
base?: I,
): GameModeRole {
return GameModeRole.fromPartial(base ?? ({} as any)); return GameModeRole.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<GameModeRole>, I>>(object: I): GameModeRole { fromPartial<I extends Exact<DeepPartial<GameModeRole>, I>>(
object: I,
): GameModeRole {
const message = createBaseGameModeRole(); const message = createBaseGameModeRole();
message.provisions = object.provisions?.map((e) => e) || []; message.provisions = object.provisions?.map((e) => e) || [];
message.consumables = object.consumables?.map((e) => e) || []; message.consumables = object.consumables?.map((e) => e) || [];
@@ -507,21 +585,36 @@ export const GameModeRole: MessageFns<GameModeRole> = {
}, },
}; };
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin ? T export type DeepPartial<T> = T extends Builtin
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> ? T
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends globalThis.Array<infer U>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> } ? globalThis.Array<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } : T extends ReadonlyArray<infer U>
: Partial<T>; ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown }
? { $case: T['$case']; value?: DeepPartial<T['value']> }
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never; type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P export type Exact<P, I extends P> = P extends Builtin
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
function isObject(value: any): boolean { function isObject(value: any): boolean {
return typeof value === "object" && value !== null; return typeof value === 'object' && value !== null;
} }
function isSet(value: any): boolean { function isSet(value: any): boolean {
@@ -2,7 +2,7 @@
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.2.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/i18n.proto // source: packages/core/src/protos/legacy_i18n.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -2,7 +2,7 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "packages/core/src/protos/legacy_i18n.proto";
message MapDefinitions { message MapDefinitions {
map<int32, MapDefinition> maps = 1; map<int32, MapDefinition> maps = 1;
@@ -2,13 +2,13 @@
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.2.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/map_definitions.proto // source: packages/core/src/protos/legacy_map_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
import { I18nString, createBaseI18nString } from "./i18n"; import { I18nString, createBaseI18nString } from './legacy_i18n';
export const protobufPackage = "blitzkit"; export const protobufPackage = 'blitzkit';
export interface MapDefinitions { export interface MapDefinitions {
maps: { [key: number]: MapDefinition }; maps: { [key: number]: MapDefinition };
@@ -29,15 +29,22 @@ function createBaseMapDefinitions(): MapDefinitions {
} }
export const MapDefinitions: MessageFns<MapDefinitions> = { export const MapDefinitions: MessageFns<MapDefinitions> = {
encode(message: MapDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(
message: MapDefinitions,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
Object.entries(message.maps).forEach(([key, value]) => { Object.entries(message.maps).forEach(([key, value]) => {
MapDefinitions_MapsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); MapDefinitions_MapsEntry.encode(
{ key: key as any, value },
writer.uint32(10).fork(),
).join();
}); });
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMapDefinitions(); const message = createBaseMapDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
@@ -48,7 +55,10 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
break; break;
} }
const entry1 = MapDefinitions_MapsEntry.decode(reader, reader.uint32()); const entry1 = MapDefinitions_MapsEntry.decode(
reader,
reader.uint32(),
);
if (entry1.value !== undefined) { if (entry1.value !== undefined) {
message.maps[entry1.key] = entry1.value; message.maps[entry1.key] = entry1.value;
} }
@@ -66,10 +76,13 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
fromJSON(object: any): MapDefinitions { fromJSON(object: any): MapDefinitions {
return { return {
maps: isObject(object.maps) maps: isObject(object.maps)
? Object.entries(object.maps).reduce<{ [key: number]: MapDefinition }>((acc, [key, value]) => { ? Object.entries(object.maps).reduce<{ [key: number]: MapDefinition }>(
acc[globalThis.Number(key)] = MapDefinition.fromJSON(value); (acc, [key, value]) => {
return acc; acc[globalThis.Number(key)] = MapDefinition.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -88,12 +101,18 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
return obj; return obj;
}, },
create<I extends Exact<DeepPartial<MapDefinitions>, I>>(base?: I): MapDefinitions { create<I extends Exact<DeepPartial<MapDefinitions>, I>>(
base?: I,
): MapDefinitions {
return MapDefinitions.fromPartial(base ?? ({} as any)); return MapDefinitions.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<MapDefinitions>, I>>(object: I): MapDefinitions { fromPartial<I extends Exact<DeepPartial<MapDefinitions>, I>>(
object: I,
): MapDefinitions {
const message = createBaseMapDefinitions(); const message = createBaseMapDefinitions();
message.maps = Object.entries(object.maps ?? {}).reduce<{ [key: number]: MapDefinition }>((acc, [key, value]) => { message.maps = Object.entries(object.maps ?? {}).reduce<{
[key: number]: MapDefinition;
}>((acc, [key, value]) => {
if (value !== undefined) { if (value !== undefined) {
acc[globalThis.Number(key)] = MapDefinition.fromPartial(value); acc[globalThis.Number(key)] = MapDefinition.fromPartial(value);
} }
@@ -108,7 +127,10 @@ function createBaseMapDefinitions_MapsEntry(): MapDefinitions_MapsEntry {
} }
export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = { export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
encode(message: MapDefinitions_MapsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(
message: MapDefinitions_MapsEntry,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.key !== undefined) { if (message.key !== undefined) {
writer.uint32(8).int32(message.key); writer.uint32(8).int32(message.key);
} }
@@ -118,8 +140,12 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions_MapsEntry { decode(
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); input: BinaryReader | Uint8Array,
length?: number,
): MapDefinitions_MapsEntry {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMapDefinitions_MapsEntry(); const message = createBaseMapDefinitions_MapsEntry();
while (reader.pos < end) { while (reader.pos < end) {
@@ -152,8 +178,12 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
fromJSON(object: any): MapDefinitions_MapsEntry { fromJSON(object: any): MapDefinitions_MapsEntry {
return { return {
key: globalThis.Number(assertSet("MapDefinitions_MapsEntry.key", object.key)), key: globalThis.Number(
value: MapDefinition.fromJSON(assertSet("MapDefinitions_MapsEntry.value", object.value)), assertSet('MapDefinitions_MapsEntry.key', object.key),
),
value: MapDefinition.fromJSON(
assertSet('MapDefinitions_MapsEntry.value', object.value),
),
}; };
}, },
@@ -168,15 +198,20 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
return obj; return obj;
}, },
create<I extends Exact<DeepPartial<MapDefinitions_MapsEntry>, I>>(base?: I): MapDefinitions_MapsEntry { create<I extends Exact<DeepPartial<MapDefinitions_MapsEntry>, I>>(
base?: I,
): MapDefinitions_MapsEntry {
return MapDefinitions_MapsEntry.fromPartial(base ?? ({} as any)); return MapDefinitions_MapsEntry.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<MapDefinitions_MapsEntry>, I>>(object: I): MapDefinitions_MapsEntry { fromPartial<I extends Exact<DeepPartial<MapDefinitions_MapsEntry>, I>>(
object: I,
): MapDefinitions_MapsEntry {
const message = createBaseMapDefinitions_MapsEntry(); const message = createBaseMapDefinitions_MapsEntry();
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value =
? MapDefinition.fromPartial(object.value) object.value !== undefined && object.value !== null
: undefined; ? MapDefinition.fromPartial(object.value)
: undefined;
return message; return message;
}, },
}; };
@@ -186,7 +221,10 @@ function createBaseMapDefinition(): MapDefinition {
} }
export const MapDefinition: MessageFns<MapDefinition> = { export const MapDefinition: MessageFns<MapDefinition> = {
encode(message: MapDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(
message: MapDefinition,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).uint32(message.id); writer.uint32(8).uint32(message.id);
} }
@@ -197,7 +235,8 @@ export const MapDefinition: MessageFns<MapDefinition> = {
}, },
decode(input: BinaryReader | Uint8Array, length?: number): MapDefinition { decode(input: BinaryReader | Uint8Array, length?: number): MapDefinition {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMapDefinition(); const message = createBaseMapDefinition();
while (reader.pos < end) { while (reader.pos < end) {
@@ -230,8 +269,8 @@ export const MapDefinition: MessageFns<MapDefinition> = {
fromJSON(object: any): MapDefinition { fromJSON(object: any): MapDefinition {
return { return {
id: globalThis.Number(assertSet("MapDefinition.id", object.id)), id: globalThis.Number(assertSet('MapDefinition.id', object.id)),
name: I18nString.fromJSON(assertSet("MapDefinition.name", object.name)), name: I18nString.fromJSON(assertSet('MapDefinition.name', object.name)),
}; };
}, },
@@ -246,34 +285,54 @@ export const MapDefinition: MessageFns<MapDefinition> = {
return obj; return obj;
}, },
create<I extends Exact<DeepPartial<MapDefinition>, I>>(base?: I): MapDefinition { create<I extends Exact<DeepPartial<MapDefinition>, I>>(
base?: I,
): MapDefinition {
return MapDefinition.fromPartial(base ?? ({} as any)); return MapDefinition.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<MapDefinition>, I>>(object: I): MapDefinition { fromPartial<I extends Exact<DeepPartial<MapDefinition>, I>>(
object: I,
): MapDefinition {
const message = createBaseMapDefinition(); const message = createBaseMapDefinition();
message.id = object.id ?? 0; message.id = object.id ?? 0;
message.name = (object.name !== undefined && object.name !== null) message.name =
? I18nString.fromPartial(object.name) object.name !== undefined && object.name !== null
: createBaseI18nString(); ? I18nString.fromPartial(object.name)
: createBaseI18nString();
return message; return message;
}, },
}; };
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin ? T export type DeepPartial<T> = T extends Builtin
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> ? T
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends globalThis.Array<infer U>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> } ? globalThis.Array<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } : T extends ReadonlyArray<infer U>
: Partial<T>; ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown }
? { $case: T['$case']; value?: DeepPartial<T['value']> }
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never; type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P export type Exact<P, I extends P> = P extends Builtin
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
function isObject(value: any): boolean { function isObject(value: any): boolean {
return typeof value === "object" && value !== null; return typeof value === 'object' && value !== null;
} }
function isSet(value: any): boolean { function isSet(value: any): boolean {
@@ -2,6 +2,8 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/utils.proto";
message ModelDefinitions { message ModelDefinitions {
map<uint32, ModelDefinition> models = 1; map<uint32, ModelDefinition> models = 1;
} }
@@ -20,12 +22,6 @@ message Armor {
repeated uint32 spaced = 2; repeated uint32 spaced = 2;
} }
message Vector3 {
required float x = 1;
required float y = 2;
required float z = 3;
}
message InitialTurretRotation { message InitialTurretRotation {
required float yaw = 1; required float yaw = 1;
required float pitch = 2; required float pitch = 2;
@@ -2,10 +2,11 @@
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.2.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/model_definitions.proto // source: packages/core/src/protos/legacy_model_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Vector3, createBaseVector3 } from "./utils";
export const protobufPackage = "blitzkit"; export const protobufPackage = "blitzkit";
@@ -47,12 +48,6 @@ export interface Armor_ThicknessEntry {
value: number; value: number;
} }
export interface Vector3 {
x: number;
y: number;
z: number;
}
export interface InitialTurretRotation { export interface InitialTurretRotation {
yaw: number; yaw: number;
pitch: number; pitch: number;
@@ -814,98 +809,6 @@ export const Armor_ThicknessEntry: MessageFns<Armor_ThicknessEntry> = {
}, },
}; };
function createBaseVector3(): Vector3 {
return { x: 0, y: 0, z: 0 };
}
export const Vector3: MessageFns<Vector3> = {
encode(message: Vector3, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.x !== 0) {
writer.uint32(13).float(message.x);
}
if (message.y !== 0) {
writer.uint32(21).float(message.y);
}
if (message.z !== 0) {
writer.uint32(29).float(message.z);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Vector3 {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVector3();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 13) {
break;
}
message.x = reader.float();
continue;
}
case 2: {
if (tag !== 21) {
break;
}
message.y = reader.float();
continue;
}
case 3: {
if (tag !== 29) {
break;
}
message.z = reader.float();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Vector3 {
return {
x: globalThis.Number(assertSet("Vector3.x", object.x)),
y: globalThis.Number(assertSet("Vector3.y", object.y)),
z: globalThis.Number(assertSet("Vector3.z", object.z)),
};
},
toJSON(message: Vector3): unknown {
const obj: any = {};
if (message.x !== 0) {
obj.x = message.x;
}
if (message.y !== 0) {
obj.y = message.y;
}
if (message.z !== 0) {
obj.z = message.z;
}
return obj;
},
create<I extends Exact<DeepPartial<Vector3>, I>>(base?: I): Vector3 {
return Vector3.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Vector3>, I>>(object: I): Vector3 {
const message = createBaseVector3();
message.x = object.x ?? 0;
message.y = object.y ?? 0;
message.z = object.z ?? 0;
return message;
},
};
function createBaseInitialTurretRotation(): InitialTurretRotation { function createBaseInitialTurretRotation(): InitialTurretRotation {
return { yaw: 0, pitch: 0, roll: 0 }; return { yaw: 0, pitch: 0, roll: 0 };
} }
@@ -2,8 +2,8 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/consumable_definitions.proto"; import "packages/core/src/protos/legacy_consumable_definitions.proto";
import "packages/core/src/protos/i18n.proto"; import "packages/core/src/protos/legacy_i18n.proto";
message ProvisionDefinitions { message ProvisionDefinitions {
map<uint32, Provision> provisions = 1; map<uint32, Provision> provisions = 1;
@@ -2,14 +2,14 @@
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.2.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/provision_definitions.proto // source: packages/core/src/protos/legacy_provision_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
import { ConsumableTankFilter } from "./consumable_definitions"; import { ConsumableTankFilter } from './legacy_consumable_definitions';
import { I18nString, createBaseI18nString } from "./i18n"; import { I18nString, createBaseI18nString } from './legacy_i18n';
export const protobufPackage = "blitzkit"; export const protobufPackage = 'blitzkit';
export interface ProvisionDefinitions { export interface ProvisionDefinitions {
provisions: { [key: number]: Provision }; provisions: { [key: number]: Provision };
@@ -34,15 +34,25 @@ function createBaseProvisionDefinitions(): ProvisionDefinitions {
} }
export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = { export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
encode(message: ProvisionDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(
message: ProvisionDefinitions,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
Object.entries(message.provisions).forEach(([key, value]) => { Object.entries(message.provisions).forEach(([key, value]) => {
ProvisionDefinitions_ProvisionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); ProvisionDefinitions_ProvisionsEntry.encode(
{ key: key as any, value },
writer.uint32(10).fork(),
).join();
}); });
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions { decode(
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); input: BinaryReader | Uint8Array,
length?: number,
): ProvisionDefinitions {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseProvisionDefinitions(); const message = createBaseProvisionDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
@@ -53,7 +63,10 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
break; break;
} }
const entry1 = ProvisionDefinitions_ProvisionsEntry.decode(reader, reader.uint32()); const entry1 = ProvisionDefinitions_ProvisionsEntry.decode(
reader,
reader.uint32(),
);
if (entry1.value !== undefined) { if (entry1.value !== undefined) {
message.provisions[entry1.key] = entry1.value; message.provisions[entry1.key] = entry1.value;
} }
@@ -71,10 +84,12 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
fromJSON(object: any): ProvisionDefinitions { fromJSON(object: any): ProvisionDefinitions {
return { return {
provisions: isObject(object.provisions) provisions: isObject(object.provisions)
? Object.entries(object.provisions).reduce<{ [key: number]: Provision }>((acc, [key, value]) => { ? Object.entries(object.provisions).reduce<{
acc[globalThis.Number(key)] = Provision.fromJSON(value); [key: number]: Provision;
return acc; }>((acc, [key, value]) => {
}, {}) acc[globalThis.Number(key)] = Provision.fromJSON(value);
return acc;
}, {})
: {}, : {},
}; };
}, },
@@ -93,20 +108,23 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
return obj; return obj;
}, },
create<I extends Exact<DeepPartial<ProvisionDefinitions>, I>>(base?: I): ProvisionDefinitions { create<I extends Exact<DeepPartial<ProvisionDefinitions>, I>>(
base?: I,
): ProvisionDefinitions {
return ProvisionDefinitions.fromPartial(base ?? ({} as any)); return ProvisionDefinitions.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<ProvisionDefinitions>, I>>(object: I): ProvisionDefinitions { fromPartial<I extends Exact<DeepPartial<ProvisionDefinitions>, I>>(
object: I,
): ProvisionDefinitions {
const message = createBaseProvisionDefinitions(); const message = createBaseProvisionDefinitions();
message.provisions = Object.entries(object.provisions ?? {}).reduce<{ [key: number]: Provision }>( message.provisions = Object.entries(object.provisions ?? {}).reduce<{
(acc, [key, value]) => { [key: number]: Provision;
if (value !== undefined) { }>((acc, [key, value]) => {
acc[globalThis.Number(key)] = Provision.fromPartial(value); if (value !== undefined) {
} acc[globalThis.Number(key)] = Provision.fromPartial(value);
return acc; }
}, return acc;
{}, }, {});
);
return message; return message;
}, },
}; };
@@ -115,90 +133,115 @@ function createBaseProvisionDefinitions_ProvisionsEntry(): ProvisionDefinitions_
return { key: 0, value: createBaseProvision() }; return { key: 0, value: createBaseProvision() };
} }
export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitions_ProvisionsEntry> = { export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitions_ProvisionsEntry> =
encode(message: ProvisionDefinitions_ProvisionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { {
if (message.key !== undefined) { encode(
writer.uint32(8).uint32(message.key); message: ProvisionDefinitions_ProvisionsEntry,
} writer: BinaryWriter = new BinaryWriter(),
if (message.value !== undefined) { ): BinaryWriter {
Provision.encode(message.value, writer.uint32(18).fork()).join(); if (message.key !== undefined) {
} writer.uint32(8).uint32(message.key);
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions_ProvisionsEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseProvisionDefinitions_ProvisionsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.key = reader.uint32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = Provision.decode(reader, reader.uint32());
continue;
}
} }
if ((tag & 7) === 4 || tag === 0) { if (message.value !== undefined) {
break; Provision.encode(message.value, writer.uint32(18).fork()).join();
} }
reader.skip(tag & 7); return writer;
} },
return message;
},
fromJSON(object: any): ProvisionDefinitions_ProvisionsEntry { decode(
return { input: BinaryReader | Uint8Array,
key: globalThis.Number(assertSet("ProvisionDefinitions_ProvisionsEntry.key", object.key)), length?: number,
value: Provision.fromJSON(assertSet("ProvisionDefinitions_ProvisionsEntry.value", object.value)), ): ProvisionDefinitions_ProvisionsEntry {
}; const reader =
}, input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseProvisionDefinitions_ProvisionsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
toJSON(message: ProvisionDefinitions_ProvisionsEntry): unknown { message.key = reader.uint32();
const obj: any = {}; continue;
if (message.key !== undefined) { }
obj.key = Math.round(message.key); case 2: {
} if (tag !== 18) {
if (message.value !== undefined) { break;
obj.value = Provision.toJSON(message.value); }
}
return obj;
},
create<I extends Exact<DeepPartial<ProvisionDefinitions_ProvisionsEntry>, I>>( message.value = Provision.decode(reader, reader.uint32());
base?: I, continue;
): ProvisionDefinitions_ProvisionsEntry { }
return ProvisionDefinitions_ProvisionsEntry.fromPartial(base ?? ({} as any)); }
}, if ((tag & 7) === 4 || tag === 0) {
fromPartial<I extends Exact<DeepPartial<ProvisionDefinitions_ProvisionsEntry>, I>>( break;
object: I, }
): ProvisionDefinitions_ProvisionsEntry { reader.skip(tag & 7);
const message = createBaseProvisionDefinitions_ProvisionsEntry(); }
message.key = object.key ?? 0; return message;
message.value = (object.value !== undefined && object.value !== null) },
? Provision.fromPartial(object.value)
: undefined; fromJSON(object: any): ProvisionDefinitions_ProvisionsEntry {
return message; return {
}, key: globalThis.Number(
}; assertSet('ProvisionDefinitions_ProvisionsEntry.key', object.key),
),
value: Provision.fromJSON(
assertSet('ProvisionDefinitions_ProvisionsEntry.value', object.value),
),
};
},
toJSON(message: ProvisionDefinitions_ProvisionsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = Math.round(message.key);
}
if (message.value !== undefined) {
obj.value = Provision.toJSON(message.value);
}
return obj;
},
create<
I extends Exact<DeepPartial<ProvisionDefinitions_ProvisionsEntry>, I>,
>(base?: I): ProvisionDefinitions_ProvisionsEntry {
return ProvisionDefinitions_ProvisionsEntry.fromPartial(
base ?? ({} as any),
);
},
fromPartial<
I extends Exact<DeepPartial<ProvisionDefinitions_ProvisionsEntry>, I>,
>(object: I): ProvisionDefinitions_ProvisionsEntry {
const message = createBaseProvisionDefinitions_ProvisionsEntry();
message.key = object.key ?? 0;
message.value =
object.value !== undefined && object.value !== null
? Provision.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseProvision(): Provision { function createBaseProvision(): Provision {
return { id: 0, name: createBaseI18nString(), crew: undefined, game_mode_exclusive: false, include: [], exclude: [] }; return {
id: 0,
name: createBaseI18nString(),
crew: undefined,
game_mode_exclusive: false,
include: [],
exclude: [],
};
} }
export const Provision: MessageFns<Provision> = { export const Provision: MessageFns<Provision> = {
encode(message: Provision, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(
message: Provision,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).uint32(message.id); writer.uint32(8).uint32(message.id);
} }
@@ -221,7 +264,8 @@ export const Provision: MessageFns<Provision> = {
}, },
decode(input: BinaryReader | Uint8Array, length?: number): Provision { decode(input: BinaryReader | Uint8Array, length?: number): Provision {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseProvision(); const message = createBaseProvision();
while (reader.pos < end) { while (reader.pos < end) {
@@ -264,7 +308,9 @@ export const Provision: MessageFns<Provision> = {
break; break;
} }
message.include.push(ConsumableTankFilter.decode(reader, reader.uint32())); message.include.push(
ConsumableTankFilter.decode(reader, reader.uint32()),
);
continue; continue;
} }
case 7: { case 7: {
@@ -272,7 +318,9 @@ export const Provision: MessageFns<Provision> = {
break; break;
} }
message.exclude.push(ConsumableTankFilter.decode(reader, reader.uint32())); message.exclude.push(
ConsumableTankFilter.decode(reader, reader.uint32()),
);
continue; continue;
} }
} }
@@ -286,10 +334,12 @@ export const Provision: MessageFns<Provision> = {
fromJSON(object: any): Provision { fromJSON(object: any): Provision {
return { return {
id: globalThis.Number(assertSet("Provision.id", object.id)), id: globalThis.Number(assertSet('Provision.id', object.id)),
name: I18nString.fromJSON(assertSet("Provision.name", object.name)), name: I18nString.fromJSON(assertSet('Provision.name', object.name)),
crew: isSet(object.crew) ? globalThis.Number(object.crew) : undefined, crew: isSet(object.crew) ? globalThis.Number(object.crew) : undefined,
game_mode_exclusive: globalThis.Boolean(assertSet("Provision.game_mode_exclusive", object.game_mode_exclusive)), game_mode_exclusive: globalThis.Boolean(
assertSet('Provision.game_mode_exclusive', object.game_mode_exclusive),
),
include: globalThis.Array.isArray(object?.include) include: globalThis.Array.isArray(object?.include)
? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e)) ? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e))
: [], : [],
@@ -325,35 +375,55 @@ export const Provision: MessageFns<Provision> = {
create<I extends Exact<DeepPartial<Provision>, I>>(base?: I): Provision { create<I extends Exact<DeepPartial<Provision>, I>>(base?: I): Provision {
return Provision.fromPartial(base ?? ({} as any)); return Provision.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<Provision>, I>>(object: I): Provision { fromPartial<I extends Exact<DeepPartial<Provision>, I>>(
object: I,
): Provision {
const message = createBaseProvision(); const message = createBaseProvision();
message.id = object.id ?? 0; message.id = object.id ?? 0;
message.name = (object.name !== undefined && object.name !== null) message.name =
? I18nString.fromPartial(object.name) object.name !== undefined && object.name !== null
: createBaseI18nString(); ? I18nString.fromPartial(object.name)
: createBaseI18nString();
message.crew = object.crew ?? undefined; message.crew = object.crew ?? undefined;
message.game_mode_exclusive = object.game_mode_exclusive ?? false; message.game_mode_exclusive = object.game_mode_exclusive ?? false;
message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; message.include =
message.exclude = object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
message.exclude =
object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
return message; return message;
}, },
}; };
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin ? T export type DeepPartial<T> = T extends Builtin
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> ? T
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends globalThis.Array<infer U>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> } ? globalThis.Array<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } : T extends ReadonlyArray<infer U>
: Partial<T>; ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown }
? { $case: T['$case']; value?: DeepPartial<T['value']> }
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never; type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P export type Exact<P, I extends P> = P extends Builtin
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
function isObject(value: any): boolean { function isObject(value: any): boolean {
return typeof value === "object" && value !== null; return typeof value === 'object' && value !== null;
} }
function isSet(value: any): boolean { function isSet(value: any): boolean {
@@ -2,7 +2,7 @@
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.2.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/rating_leaderboard.proto // source: packages/core/src/protos/legacy_rating_leaderboard.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -2,7 +2,7 @@
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.2.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/skill_definitions.proto // source: packages/core/src/protos/legacy_skill_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -2,7 +2,7 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "packages/core/src/protos/legacy_i18n.proto";
message TankDefinitions { message TankDefinitions {
map<uint32, TankDefinition> tanks = 1; map<uint32, TankDefinition> tanks = 1;
+21
View File
@@ -0,0 +1,21 @@
syntax = "proto2";
import "packages/core/src/protos/utils.proto";
package blitzkit;
message Tank {
required string id = 1;
required string slug = 2;
required I18n name = 3;
map<string, Turret> turrets = 4;
map<string, Gun> guns = 5;
}
message Turret {
required string id = 1;
}
message Gun {
required string id = 1;
}
+509
View File
@@ -0,0 +1,509 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/tank.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { I18n, createBaseI18n } from "./utils";
export const protobufPackage = "blitzkit";
export interface Tank {
id: string;
slug: string;
name: I18n;
turrets: { [key: string]: Turret };
guns: { [key: string]: Gun };
}
export interface Tank_TurretsEntry {
key: string;
value: Turret | undefined;
}
export interface Tank_GunsEntry {
key: string;
value: Gun | undefined;
}
export interface Turret {
id: string;
}
export interface Gun {
id: string;
}
function createBaseTank(): Tank {
return { id: "", slug: "", name: createBaseI18n(), turrets: {}, guns: {} };
}
export const Tank: MessageFns<Tank> = {
encode(message: Tank, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.slug !== "") {
writer.uint32(18).string(message.slug);
}
if (message.name !== undefined) {
I18n.encode(message.name, writer.uint32(26).fork()).join();
}
Object.entries(message.turrets).forEach(([key, value]) => {
Tank_TurretsEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join();
});
Object.entries(message.guns).forEach(([key, value]) => {
Tank_GunsEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Tank {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTank();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.slug = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.name = I18n.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
const entry4 = Tank_TurretsEntry.decode(reader, reader.uint32());
if (entry4.value !== undefined) {
message.turrets[entry4.key] = entry4.value;
}
continue;
}
case 5: {
if (tag !== 42) {
break;
}
const entry5 = Tank_GunsEntry.decode(reader, reader.uint32());
if (entry5.value !== undefined) {
message.guns[entry5.key] = entry5.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Tank {
return {
id: globalThis.String(assertSet("Tank.id", object.id)),
slug: globalThis.String(assertSet("Tank.slug", object.slug)),
name: I18n.fromJSON(assertSet("Tank.name", object.name)),
turrets: isObject(object.turrets)
? Object.entries(object.turrets).reduce<{ [key: string]: Turret }>((acc, [key, value]) => {
acc[key] = Turret.fromJSON(value);
return acc;
}, {})
: {},
guns: isObject(object.guns)
? Object.entries(object.guns).reduce<{ [key: string]: Gun }>((acc, [key, value]) => {
acc[key] = Gun.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: Tank): unknown {
const obj: any = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.slug !== "") {
obj.slug = message.slug;
}
if (message.name !== undefined) {
obj.name = I18n.toJSON(message.name);
}
if (message.turrets) {
const entries = Object.entries(message.turrets);
if (entries.length > 0) {
obj.turrets = {};
entries.forEach(([k, v]) => {
obj.turrets[k] = Turret.toJSON(v);
});
}
}
if (message.guns) {
const entries = Object.entries(message.guns);
if (entries.length > 0) {
obj.guns = {};
entries.forEach(([k, v]) => {
obj.guns[k] = Gun.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<Tank>, I>>(base?: I): Tank {
return Tank.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Tank>, I>>(object: I): Tank {
const message = createBaseTank();
message.id = object.id ?? "";
message.slug = object.slug ?? "";
message.name = (object.name !== undefined && object.name !== null)
? I18n.fromPartial(object.name)
: createBaseI18n();
message.turrets = Object.entries(object.turrets ?? {}).reduce<{ [key: string]: Turret }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = Turret.fromPartial(value);
}
return acc;
}, {});
message.guns = Object.entries(object.guns ?? {}).reduce<{ [key: string]: Gun }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = Gun.fromPartial(value);
}
return acc;
}, {});
return message;
},
};
function createBaseTank_TurretsEntry(): Tank_TurretsEntry {
return { key: "", value: createBaseTurret() };
}
export const Tank_TurretsEntry: MessageFns<Tank_TurretsEntry> = {
encode(message: Tank_TurretsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
Turret.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Tank_TurretsEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTank_TurretsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = Turret.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Tank_TurretsEntry {
return {
key: globalThis.String(assertSet("Tank_TurretsEntry.key", object.key)),
value: Turret.fromJSON(assertSet("Tank_TurretsEntry.value", object.value)),
};
},
toJSON(message: Tank_TurretsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
}
if (message.value !== undefined) {
obj.value = Turret.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<Tank_TurretsEntry>, I>>(base?: I): Tank_TurretsEntry {
return Tank_TurretsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Tank_TurretsEntry>, I>>(object: I): Tank_TurretsEntry {
const message = createBaseTank_TurretsEntry();
message.key = object.key ?? "";
message.value = (object.value !== undefined && object.value !== null)
? Turret.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseTank_GunsEntry(): Tank_GunsEntry {
return { key: "", value: createBaseGun() };
}
export const Tank_GunsEntry: MessageFns<Tank_GunsEntry> = {
encode(message: Tank_GunsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
Gun.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Tank_GunsEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTank_GunsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = Gun.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Tank_GunsEntry {
return {
key: globalThis.String(assertSet("Tank_GunsEntry.key", object.key)),
value: Gun.fromJSON(assertSet("Tank_GunsEntry.value", object.value)),
};
},
toJSON(message: Tank_GunsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
}
if (message.value !== undefined) {
obj.value = Gun.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<Tank_GunsEntry>, I>>(base?: I): Tank_GunsEntry {
return Tank_GunsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Tank_GunsEntry>, I>>(object: I): Tank_GunsEntry {
const message = createBaseTank_GunsEntry();
message.key = object.key ?? "";
message.value = (object.value !== undefined && object.value !== null) ? Gun.fromPartial(object.value) : undefined;
return message;
},
};
function createBaseTurret(): Turret {
return { id: "" };
}
export const Turret: MessageFns<Turret> = {
encode(message: Turret, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Turret {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTurret();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Turret {
return { id: globalThis.String(assertSet("Turret.id", object.id)) };
},
toJSON(message: Turret): unknown {
const obj: any = {};
if (message.id !== "") {
obj.id = message.id;
}
return obj;
},
create<I extends Exact<DeepPartial<Turret>, I>>(base?: I): Turret {
return Turret.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Turret>, I>>(object: I): Turret {
const message = createBaseTurret();
message.id = object.id ?? "";
return message;
},
};
function createBaseGun(): Gun {
return { id: "" };
}
export const Gun: MessageFns<Gun> = {
encode(message: Gun, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Gun {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGun();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Gun {
return { id: globalThis.String(assertSet("Gun.id", object.id)) };
},
toJSON(message: Gun): unknown {
const obj: any = {};
if (message.id !== "") {
obj.id = message.id;
}
return obj;
},
create<I extends Exact<DeepPartial<Gun>, I>>(base?: I): Gun {
return Gun.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Gun>, I>>(object: I): Gun {
const message = createBaseGun();
message.id = object.id ?? "";
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isObject(value: any): boolean {
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
+21
View File
@@ -0,0 +1,21 @@
syntax = "proto2";
package blitzkit;
message TankArmor {
// key can only ever be "chassis", "hull", "turret", or "gun"
map<string, PenetrationGroup> groups = 1;
}
message PenetrationGroup {
// keys are mostly "armor_xyz" where xyz is an integer but sometimes can be
// things like "commander", "rightTrack", etc.
map<string, ArmorPlate> armors = 1;
}
message ArmorPlate {
// this is the thickness of the armor in millimeters
required float thickness = 1;
// this can be stuff like ArmorScreen which is spaced armor, FuelTank, etc.
required string type = 2;
}
+471
View File
@@ -0,0 +1,471 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/tank_armor.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "blitzkit";
export interface TankArmor {
/** key can only ever be "chassis", "hull", "turret", or "gun" */
groups: { [key: string]: PenetrationGroup };
}
export interface TankArmor_GroupsEntry {
key: string;
value: PenetrationGroup | undefined;
}
export interface PenetrationGroup {
/**
* keys are mostly "armor_xyz" where xyz is an integer but sometimes can be
* things like "commander", "rightTrack", etc.
*/
armors: { [key: string]: ArmorPlate };
}
export interface PenetrationGroup_ArmorsEntry {
key: string;
value: ArmorPlate | undefined;
}
export interface ArmorPlate {
/** this is the thickness of the armor in millimeters */
thickness: number;
/** this can be stuff like ArmorScreen which is spaced armor, FuelTank, etc. */
type: string;
}
function createBaseTankArmor(): TankArmor {
return { groups: {} };
}
export const TankArmor: MessageFns<TankArmor> = {
encode(message: TankArmor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.groups).forEach(([key, value]) => {
TankArmor_GroupsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TankArmor {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTankArmor();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = TankArmor_GroupsEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.groups[entry1.key] = entry1.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TankArmor {
return {
groups: isObject(object.groups)
? Object.entries(object.groups).reduce<{ [key: string]: PenetrationGroup }>((acc, [key, value]) => {
acc[key] = PenetrationGroup.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: TankArmor): unknown {
const obj: any = {};
if (message.groups) {
const entries = Object.entries(message.groups);
if (entries.length > 0) {
obj.groups = {};
entries.forEach(([k, v]) => {
obj.groups[k] = PenetrationGroup.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<TankArmor>, I>>(base?: I): TankArmor {
return TankArmor.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankArmor>, I>>(object: I): TankArmor {
const message = createBaseTankArmor();
message.groups = Object.entries(object.groups ?? {}).reduce<{ [key: string]: PenetrationGroup }>(
(acc, [key, value]) => {
if (value !== undefined) {
acc[key] = PenetrationGroup.fromPartial(value);
}
return acc;
},
{},
);
return message;
},
};
function createBaseTankArmor_GroupsEntry(): TankArmor_GroupsEntry {
return { key: "", value: createBasePenetrationGroup() };
}
export const TankArmor_GroupsEntry: MessageFns<TankArmor_GroupsEntry> = {
encode(message: TankArmor_GroupsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
PenetrationGroup.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TankArmor_GroupsEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTankArmor_GroupsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = PenetrationGroup.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TankArmor_GroupsEntry {
return {
key: globalThis.String(assertSet("TankArmor_GroupsEntry.key", object.key)),
value: PenetrationGroup.fromJSON(assertSet("TankArmor_GroupsEntry.value", object.value)),
};
},
toJSON(message: TankArmor_GroupsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
}
if (message.value !== undefined) {
obj.value = PenetrationGroup.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<TankArmor_GroupsEntry>, I>>(base?: I): TankArmor_GroupsEntry {
return TankArmor_GroupsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankArmor_GroupsEntry>, I>>(object: I): TankArmor_GroupsEntry {
const message = createBaseTankArmor_GroupsEntry();
message.key = object.key ?? "";
message.value = (object.value !== undefined && object.value !== null)
? PenetrationGroup.fromPartial(object.value)
: undefined;
return message;
},
};
function createBasePenetrationGroup(): PenetrationGroup {
return { armors: {} };
}
export const PenetrationGroup: MessageFns<PenetrationGroup> = {
encode(message: PenetrationGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.armors).forEach(([key, value]) => {
PenetrationGroup_ArmorsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): PenetrationGroup {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePenetrationGroup();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = PenetrationGroup_ArmorsEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.armors[entry1.key] = entry1.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): PenetrationGroup {
return {
armors: isObject(object.armors)
? Object.entries(object.armors).reduce<{ [key: string]: ArmorPlate }>((acc, [key, value]) => {
acc[key] = ArmorPlate.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: PenetrationGroup): unknown {
const obj: any = {};
if (message.armors) {
const entries = Object.entries(message.armors);
if (entries.length > 0) {
obj.armors = {};
entries.forEach(([k, v]) => {
obj.armors[k] = ArmorPlate.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<PenetrationGroup>, I>>(base?: I): PenetrationGroup {
return PenetrationGroup.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<PenetrationGroup>, I>>(object: I): PenetrationGroup {
const message = createBasePenetrationGroup();
message.armors = Object.entries(object.armors ?? {}).reduce<{ [key: string]: ArmorPlate }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = ArmorPlate.fromPartial(value);
}
return acc;
}, {});
return message;
},
};
function createBasePenetrationGroup_ArmorsEntry(): PenetrationGroup_ArmorsEntry {
return { key: "", value: createBaseArmorPlate() };
}
export const PenetrationGroup_ArmorsEntry: MessageFns<PenetrationGroup_ArmorsEntry> = {
encode(message: PenetrationGroup_ArmorsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
ArmorPlate.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): PenetrationGroup_ArmorsEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePenetrationGroup_ArmorsEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = ArmorPlate.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): PenetrationGroup_ArmorsEntry {
return {
key: globalThis.String(assertSet("PenetrationGroup_ArmorsEntry.key", object.key)),
value: ArmorPlate.fromJSON(assertSet("PenetrationGroup_ArmorsEntry.value", object.value)),
};
},
toJSON(message: PenetrationGroup_ArmorsEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
}
if (message.value !== undefined) {
obj.value = ArmorPlate.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<PenetrationGroup_ArmorsEntry>, I>>(base?: I): PenetrationGroup_ArmorsEntry {
return PenetrationGroup_ArmorsEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<PenetrationGroup_ArmorsEntry>, I>>(object: I): PenetrationGroup_ArmorsEntry {
const message = createBasePenetrationGroup_ArmorsEntry();
message.key = object.key ?? "";
message.value = (object.value !== undefined && object.value !== null)
? ArmorPlate.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseArmorPlate(): ArmorPlate {
return { thickness: 0, type: "" };
}
export const ArmorPlate: MessageFns<ArmorPlate> = {
encode(message: ArmorPlate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.thickness !== 0) {
writer.uint32(13).float(message.thickness);
}
if (message.type !== "") {
writer.uint32(18).string(message.type);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ArmorPlate {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseArmorPlate();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 13) {
break;
}
message.thickness = reader.float();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.type = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ArmorPlate {
return {
thickness: globalThis.Number(assertSet("ArmorPlate.thickness", object.thickness)),
type: globalThis.String(assertSet("ArmorPlate.type", object.type)),
};
},
toJSON(message: ArmorPlate): unknown {
const obj: any = {};
if (message.thickness !== 0) {
obj.thickness = message.thickness;
}
if (message.type !== "") {
obj.type = message.type;
}
return obj;
},
create<I extends Exact<DeepPartial<ArmorPlate>, I>>(base?: I): ArmorPlate {
return ArmorPlate.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ArmorPlate>, I>>(object: I): ArmorPlate {
const message = createBaseArmorPlate();
message.thickness = object.thickness ?? 0;
message.type = object.type ?? "";
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isObject(value: any): boolean {
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
+13
View File
@@ -0,0 +1,13 @@
syntax = "proto2";
import "packages/core/src/protos/utils.proto";
package blitzkit;
message TankModel {
map<string, ModuleModel> modules = 1;
}
message ModuleModel {
required Vector3 translation = 2;
}
+282
View File
@@ -0,0 +1,282 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/tank_model.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Vector3, createBaseVector3 } from "./utils";
export const protobufPackage = "blitzkit";
export interface TankModel {
modules: { [key: string]: ModuleModel };
}
export interface TankModel_ModulesEntry {
key: string;
value: ModuleModel | undefined;
}
export interface ModuleModel {
translation: Vector3;
}
function createBaseTankModel(): TankModel {
return { modules: {} };
}
export const TankModel: MessageFns<TankModel> = {
encode(message: TankModel, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.modules).forEach(([key, value]) => {
TankModel_ModulesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TankModel {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTankModel();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = TankModel_ModulesEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.modules[entry1.key] = entry1.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TankModel {
return {
modules: isObject(object.modules)
? Object.entries(object.modules).reduce<{ [key: string]: ModuleModel }>((acc, [key, value]) => {
acc[key] = ModuleModel.fromJSON(value);
return acc;
}, {})
: {},
};
},
toJSON(message: TankModel): unknown {
const obj: any = {};
if (message.modules) {
const entries = Object.entries(message.modules);
if (entries.length > 0) {
obj.modules = {};
entries.forEach(([k, v]) => {
obj.modules[k] = ModuleModel.toJSON(v);
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<TankModel>, I>>(base?: I): TankModel {
return TankModel.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankModel>, I>>(object: I): TankModel {
const message = createBaseTankModel();
message.modules = Object.entries(object.modules ?? {}).reduce<{ [key: string]: ModuleModel }>(
(acc, [key, value]) => {
if (value !== undefined) {
acc[key] = ModuleModel.fromPartial(value);
}
return acc;
},
{},
);
return message;
},
};
function createBaseTankModel_ModulesEntry(): TankModel_ModulesEntry {
return { key: "", value: createBaseModuleModel() };
}
export const TankModel_ModulesEntry: MessageFns<TankModel_ModulesEntry> = {
encode(message: TankModel_ModulesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
ModuleModel.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TankModel_ModulesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTankModel_ModulesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = ModuleModel.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TankModel_ModulesEntry {
return {
key: globalThis.String(assertSet("TankModel_ModulesEntry.key", object.key)),
value: ModuleModel.fromJSON(assertSet("TankModel_ModulesEntry.value", object.value)),
};
},
toJSON(message: TankModel_ModulesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
}
if (message.value !== undefined) {
obj.value = ModuleModel.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<TankModel_ModulesEntry>, I>>(base?: I): TankModel_ModulesEntry {
return TankModel_ModulesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TankModel_ModulesEntry>, I>>(object: I): TankModel_ModulesEntry {
const message = createBaseTankModel_ModulesEntry();
message.key = object.key ?? "";
message.value = (object.value !== undefined && object.value !== null)
? ModuleModel.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseModuleModel(): ModuleModel {
return { translation: createBaseVector3() };
}
export const ModuleModel: MessageFns<ModuleModel> = {
encode(message: ModuleModel, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.translation !== undefined) {
Vector3.encode(message.translation, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ModuleModel {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseModuleModel();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2: {
if (tag !== 18) {
break;
}
message.translation = Vector3.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ModuleModel {
return { translation: Vector3.fromJSON(assertSet("ModuleModel.translation", object.translation)) };
},
toJSON(message: ModuleModel): unknown {
const obj: any = {};
if (message.translation !== undefined) {
obj.translation = Vector3.toJSON(message.translation);
}
return obj;
},
create<I extends Exact<DeepPartial<ModuleModel>, I>>(base?: I): ModuleModel {
return ModuleModel.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ModuleModel>, I>>(object: I): ModuleModel {
const message = createBaseModuleModel();
message.translation = (object.translation !== undefined && object.translation !== null)
? Vector3.fromPartial(object.translation)
: createBaseVector3();
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isObject(value: any): boolean {
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
+7
View File
@@ -0,0 +1,7 @@
syntax = "proto2";
package blitzkit;
message Tanks {
repeated string tanks = 1;
}
+94
View File
@@ -0,0 +1,94 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/tanks.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "blitzkit";
export interface Tanks {
tanks: string[];
}
function createBaseTanks(): Tanks {
return { tanks: [] };
}
export const Tanks: MessageFns<Tanks> = {
encode(message: Tanks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.tanks) {
writer.uint32(10).string(v!);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Tanks {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTanks();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.tanks.push(reader.string());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Tanks {
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => globalThis.String(e)) : [] };
},
toJSON(message: Tanks): unknown {
const obj: any = {};
if (message.tanks?.length) {
obj.tanks = message.tanks;
}
return obj;
},
create<I extends Exact<DeepPartial<Tanks>, I>>(base?: I): Tanks {
return Tanks.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Tanks>, I>>(object: I): Tanks {
const message = createBaseTanks();
message.tanks = object.tanks?.map((e) => e) || [];
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
@@ -0,0 +1,9 @@
syntax = "proto2";
import "packages/core/src/protos/tank.proto";
package blitzkit;
message TanksFull {
repeated Tank tanks = 1;
}
+95
View File
@@ -0,0 +1,95 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/tanks_full.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Tank } from "./tank";
export const protobufPackage = "blitzkit";
export interface TanksFull {
tanks: Tank[];
}
function createBaseTanksFull(): TanksFull {
return { tanks: [] };
}
export const TanksFull: MessageFns<TanksFull> = {
encode(message: TanksFull, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.tanks) {
Tank.encode(v!, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): TanksFull {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTanksFull();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.tanks.push(Tank.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): TanksFull {
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => Tank.fromJSON(e)) : [] };
},
toJSON(message: TanksFull): unknown {
const obj: any = {};
if (message.tanks?.length) {
obj.tanks = message.tanks.map((e) => Tank.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<TanksFull>, I>>(base?: I): TanksFull {
return TanksFull.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<TanksFull>, I>>(object: I): TanksFull {
const message = createBaseTanksFull();
message.tanks = object.tanks?.map((e) => Tank.fromPartial(e)) || [];
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
+13
View File
@@ -0,0 +1,13 @@
syntax = "proto2";
package blitzkit;
message Vector3 {
required float x = 1;
required float y = 2;
required float z = 3;
}
message I18n {
map<string, string> locales = 1;
}
+310
View File
@@ -0,0 +1,310 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/utils.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "blitzkit";
export interface Vector3 {
x: number;
y: number;
z: number;
}
export interface I18n {
locales: { [key: string]: string };
}
export interface I18n_LocalesEntry {
key: string;
value: string;
}
export function createBaseVector3(): Vector3 {
return { x: 0, y: 0, z: 0 };
}
export const Vector3: MessageFns<Vector3> = {
encode(message: Vector3, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.x !== 0) {
writer.uint32(13).float(message.x);
}
if (message.y !== 0) {
writer.uint32(21).float(message.y);
}
if (message.z !== 0) {
writer.uint32(29).float(message.z);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Vector3 {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVector3();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 13) {
break;
}
message.x = reader.float();
continue;
}
case 2: {
if (tag !== 21) {
break;
}
message.y = reader.float();
continue;
}
case 3: {
if (tag !== 29) {
break;
}
message.z = reader.float();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Vector3 {
return {
x: globalThis.Number(assertSet("Vector3.x", object.x)),
y: globalThis.Number(assertSet("Vector3.y", object.y)),
z: globalThis.Number(assertSet("Vector3.z", object.z)),
};
},
toJSON(message: Vector3): unknown {
const obj: any = {};
if (message.x !== 0) {
obj.x = message.x;
}
if (message.y !== 0) {
obj.y = message.y;
}
if (message.z !== 0) {
obj.z = message.z;
}
return obj;
},
create<I extends Exact<DeepPartial<Vector3>, I>>(base?: I): Vector3 {
return Vector3.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Vector3>, I>>(object: I): Vector3 {
const message = createBaseVector3();
message.x = object.x ?? 0;
message.y = object.y ?? 0;
message.z = object.z ?? 0;
return message;
},
};
export function createBaseI18n(): I18n {
return { locales: {} };
}
export const I18n: MessageFns<I18n> = {
encode(message: I18n, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.locales).forEach(([key, value]) => {
I18n_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): I18n {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseI18n();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
const entry1 = I18n_LocalesEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.locales[entry1.key] = entry1.value;
}
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): I18n {
return {
locales: isObject(object.locales)
? Object.entries(object.locales).reduce<{ [key: string]: string }>((acc, [key, value]) => {
acc[key] = String(value);
return acc;
}, {})
: {},
};
},
toJSON(message: I18n): unknown {
const obj: any = {};
if (message.locales) {
const entries = Object.entries(message.locales);
if (entries.length > 0) {
obj.locales = {};
entries.forEach(([k, v]) => {
obj.locales[k] = v;
});
}
}
return obj;
},
create<I extends Exact<DeepPartial<I18n>, I>>(base?: I): I18n {
return I18n.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<I18n>, I>>(object: I): I18n {
const message = createBaseI18n();
message.locales = Object.entries(object.locales ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = globalThis.String(value);
}
return acc;
}, {});
return message;
},
};
function createBaseI18n_LocalesEntry(): I18n_LocalesEntry {
return { key: "", value: "" };
}
export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
encode(message: I18n_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
writer.uint32(18).string(message.value);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): I18n_LocalesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseI18n_LocalesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): I18n_LocalesEntry {
return {
key: globalThis.String(assertSet("I18n_LocalesEntry.key", object.key)),
value: globalThis.String(assertSet("I18n_LocalesEntry.value", object.value)),
};
},
toJSON(message: I18n_LocalesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
}
if (message.value !== undefined) {
obj.value = message.value;
}
return obj;
},
create<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(base?: I): I18n_LocalesEntry {
return I18n_LocalesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(object: I): I18n_LocalesEntry {
const message = createBaseI18n_LocalesEntry();
message.key = object.key ?? "";
message.value = object.value ?? "";
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isObject(value: any): boolean {
return typeof value === "object" && value !== null;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
+14
View File
@@ -0,0 +1,14 @@
{
"default": "en",
"supported": [
{ "locale": "en" },
{ "locale": "es" },
{ "locale": "fr" },
{ "locale": "ja" },
{ "locale": "pl" },
{ "locale": "pt" },
{ "locale": "ru" },
{ "locale": "uk" },
{ "locale": "zh", "blitz": "zh_Hans_SG" }
]
}
+14 -3
View File
@@ -853,7 +853,14 @@
}, },
"tools": { "tools": {
"tankopedia": { "api": {
"name": "API",
"button": "Nerd out",
"description": "BlitzKit API docs",
"seo_description": "Comprehensive documentation and detailed insights into BlitzKit's API, enabling developers to integrate and utilize advanced features for World of Tanks Blitz efficiently."
},
"tanks": {
"name": "Tankopedia", "name": "Tankopedia",
"button": "Find tanks", "button": "Find tanks",
"description": "Blitz tank encyclopedia", "description": "Blitz tank encyclopedia",
@@ -862,6 +869,10 @@
"tank_seo_description": "%s1 armor, statistics, equipment, provisions, and more. %s2 DPM, %s3hp alpha, %s4mm penetration, %s5kph top speed, %s6hp health.", "tank_seo_description": "%s1 armor, statistics, equipment, provisions, and more. %s2 DPM, %s3hp alpha, %s4mm penetration, %s5kph top speed, %s6hp health.",
"sandbox": { "sandbox": {
"dissector": {
"name": "Dissector"
},
"poses": { "poses": {
"hull_down": "Hull down", "hull_down": "Hull down",
"face_hug": "Face hug", "face_hug": "Face hug",
@@ -907,7 +918,7 @@
"element": { "element": {
"primary": "Primary", "primary": "Primary",
"spaced": "Spaced", "spaced": "Spaced",
"external": "External", "modules": "Modules",
"gap": "Gap", "gap": "Gap",
"gun": "Gun", "gun": "Gun",
"track": "Tracks" "track": "Tracks"
@@ -929,7 +940,7 @@
"name": "Static armor", "name": "Static armor",
"primary": "Primary", "primary": "Primary",
"spaced": "Spaced", "spaced": "Spaced",
"external": "External", "modules": "Modules",
"edit": { "edit": {
"label": "Edit", "label": "Edit",
"reset": "Reset" "reset": "Reset"
@@ -1,5 +1,5 @@
--- ---
import { tankopediaTool } from '../../../../constants/tools'; import { tanksTool } from '../../../../constants/tools';
import ToolLayout from '../../../../layouts/ToolLayout.astro'; import ToolLayout from '../../../../layouts/ToolLayout.astro';
import { Page } from './_index'; import { Page } from './_index';
@@ -8,7 +8,7 @@ export { getStaticPaths } from '../../index.astro';
const { locale } = Astro.params; const { locale } = Astro.params;
--- ---
<ToolLayout tool={tankopediaTool}> <ToolLayout tool={tanksTool}>
<Page {locale} client:only="react"> <Page {locale} client:only="react">
<Page {locale} slot="fallback" /> <Page {locale} slot="fallback" />
</Page> </Page>
+5
View File
@@ -23,6 +23,10 @@ export default defineConfig({
outDir: '../../dist/website', outDir: '../../dist/website',
prefetch: true, prefetch: true,
build: {
concurrency: 8,
},
integrations: [ integrations: [
react(), react(),
sitemap(), sitemap(),
@@ -31,6 +35,7 @@ export default defineConfig({
compressor(), compressor(),
playformInline(), playformInline(),
], ],
vite: { vite: {
resolve: { resolve: {
alias: { alias: {
+2
View File
@@ -6,6 +6,7 @@
"start": "astro dev", "start": "astro dev",
"lint": "astro check", "lint": "astro check",
"build": "astro check && astro build", "build": "astro check && astro build",
"buildonly": "astro build",
"preview": "astro preview", "preview": "astro preview",
"astro": "astro" "astro": "astro"
}, },
@@ -21,6 +22,7 @@
"@radix-ui/colors": "^3.0.0", "@radix-ui/colors": "^3.0.0",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
"@radix-ui/themes": "^3.1.4", "@radix-ui/themes": "^3.1.4",
"@react-three/csg": "^4.0.0",
"@react-three/drei": "^9.115.0", "@react-three/drei": "^9.115.0",
"@react-three/fiber": "^8.17.10", "@react-three/fiber": "^8.17.10",
"compare-versions": "^6.1.1", "compare-versions": "^6.1.1",
Binary file not shown.

After

Width:  |  Height:  |  Size: 706 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

@@ -0,0 +1,22 @@
import { memo } from 'react';
import { DissectorModuleCard } from './DissectorModuleCard';
import { DissectorSceneComponent } from './DissectorSceneComponent';
export const Dissector = memo(() => {
return (
<>
<DissectorModuleCard />
<group>
<DissectorSceneComponent group="hull" />
<DissectorSceneComponent group="chassis" />
<group position={[0.7, 1.6, 0]}>
<DissectorSceneComponent group="turret_01" />
<group position={[1, 0.36, 0]}>
<DissectorSceneComponent group="gun_01" />
</group>
</group>
</group>
</>
);
});
@@ -0,0 +1,32 @@
import { Card, Text } from '@radix-ui/themes';
import { Html } from '@react-three/drei';
import { useEffect, useState } from 'react';
import {
lastModuleSelect,
moduleSelectEvent,
type ModuleSelectEventData,
} from '../../../core/blitzkit/moduleSelect';
export function DissectorModuleCard() {
const [moduleSelection, setModuleSelection] = useState(lastModuleSelect);
useEffect(() => {
function handleModuleSelectEvent(event: ModuleSelectEventData) {
setModuleSelection(event);
}
return moduleSelectEvent.on(handleModuleSelectEvent);
}, []);
if (!moduleSelection.selected) return null;
return (
<group position={[0, 1, 0]}>
<Html position={moduleSelection.position}>
<Card>
<Text>{moduleSelection.module}</Text>
</Card>
</Html>
</group>
);
}
@@ -0,0 +1,266 @@
import { asset, J_HAT } from '@blitzkit/core';
import {
blueDark,
crimsonDark,
indigoDark,
mauveDark,
orangeDark,
plumDark,
purpleDark,
slateDark,
tomatoDark,
yellowDark,
} from '@radix-ui/colors';
import {
Base,
Geometry,
Subtraction,
type CSGGeometryRef,
} from '@react-three/csg';
import { useGLTF } from '@react-three/drei';
import { useThree } from '@react-three/fiber';
import { Fragment, useEffect, useRef } from 'react';
import type { Mesh } from 'three';
import {
Color,
DoubleSide,
Group,
LineBasicMaterial,
LineSegments,
Material,
MeshStandardMaterial,
Plane,
Vector3,
} from 'three';
import {
dissectEvent,
lastDissection,
type DissectEventData,
} from '../../../core/blitzkit/dissect';
import { jsxTree } from '../../../core/blitzkit/jsxTree';
import {
lastModuleSelect,
moduleSelectEvent,
type ModuleSelectEventData,
} from '../../../core/blitzkit/moduleSelect';
import { Duel } from '../../../stores/duel';
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
import { groupNameRegex } from './StaticArmorSceneComponent';
interface DissectorSceneComponentProps {
group: string;
}
const NEGATIVE_SIZE = 20;
const armorColor = new Color().multiplyScalar(2 ** -4);
const armorOutlineColor = armorColor.clone().multiplyScalar(2 ** 4.5);
const moduleColor: Record<string, Color> = {
Armor: armorColor,
ArmorScreen: armorColor,
Commander: new Color(mauveDark.mauve11),
Driver: new Color(mauveDark.mauve11),
Gunner1: new Color(mauveDark.mauve11),
Loader1: new Color(mauveDark.mauve11),
SurveyingDevice: new Color(plumDark.plum7),
Radio: new Color(slateDark.slate7),
Gun: new Color(blueDark.blue8),
FuelTank: new Color(orangeDark.orange9),
Engine: new Color(crimsonDark.crimson8),
AmmoBay: new Color(yellowDark.yellow9),
LeftTrack: new Color(purpleDark.purple5),
RightTrack: new Color(purpleDark.purple5),
TurretRotator: new Color(indigoDark.indigo7),
Transmission: new Color(tomatoDark.tomato4),
};
const moduleOutlineColor: Record<string, Color> = {
Armor: armorOutlineColor,
ArmorScreen: armorOutlineColor,
};
for (const key in moduleColor) {
if (key in moduleOutlineColor) continue;
moduleOutlineColor[key] = moduleColor[key].clone().multiplyScalar(0.5);
}
export function DissectorSceneComponent({
group,
}: DissectorSceneComponentProps) {
const tank = Duel.use((state) => state.protagonist.tank);
const gltf = useGLTF(asset(`tanks/${tank.id}/collision/${group}.glb`));
const armor = TankopediaEphemeral.use((state) => state.armor);
const groupName = group.match(groupNameRegex)![1];
const groupArmor = armor.groups[groupName];
const camera = useThree((state) => state.camera);
return jsxTree(gltf.scene, {
mesh(mesh, props) {
const csg = useRef<CSGGeometryRef>(null);
const subtractionWrapper = useRef<Group>(null);
const baseWrapper = useRef<Mesh>(null);
if (!(mesh.material instanceof Material)) {
return null;
}
const armorName = mesh.material.name;
const armorPlate = groupArmor.armors[armorName];
if (armorPlate === undefined) {
console.warn(`Missing armor: ${armorName}`);
return null;
}
const isModule =
armorPlate.type !== 'Armor' && armorPlate.type !== 'ArmorScreen';
const isTrack =
armorPlate.type === 'LeftTrack' || armorPlate.type === 'RightTrack';
if (!(armorPlate.type in moduleColor)) {
throw new TypeError(`Unhandled armor type: ${armorPlate.type}`);
}
const clippingPlane = useRef(new Plane());
const clippingPlaneInverse = useRef(new Plane());
const material = useRef(
new MeshStandardMaterial({
transparent: isTrack,
opacity: 2 ** -5,
side: DoubleSide,
color: moduleColor[armorPlate.type],
clippingPlanes: isModule ? [] : [clippingPlane.current],
}),
);
const outline = useRef<LineSegments>(null);
const outlineMaterial = useRef(
new LineBasicMaterial({
transparent: !isModule,
opacity: 2 ** -3,
side: DoubleSide,
color: moduleOutlineColor[armorPlate.type],
clippingPlanes: [clippingPlane.current],
}),
);
const outlineMaterialInverse = useRef(
new LineBasicMaterial({
transparent: !isModule,
opacity: 2 ** -6,
side: DoubleSide,
color: moduleOutlineColor[armorPlate.type],
clippingPlanes: isModule ? [] : [clippingPlaneInverse.current],
}),
);
const worldPosition = new Vector3();
useEffect(() => {
const offset = new Vector3();
function handleDissectEvent(event: DissectEventData) {
clippingPlane.current.normal
.set(0, 0, 1)
.applyAxisAngle(J_HAT, event.rotation - Math.PI / 2);
clippingPlane.current.constant = event.offset;
clippingPlaneInverse.current.copy(clippingPlane.current).negate();
if (
!subtractionWrapper.current ||
!csg.current ||
!baseWrapper.current
)
return;
baseWrapper.current.getWorldPosition(worldPosition);
offset.set(-event.offset, 0, 0).applyAxisAngle(J_HAT, event.rotation);
subtractionWrapper.current.position
.copy(worldPosition)
.add(offset)
.multiplyScalar(-1);
subtractionWrapper.current.rotation.y = event.rotation;
csg.current.update();
}
function handleModuleSelectEvent(event: ModuleSelectEventData) {
if (!isModule) return;
const isThisComponentSelected =
event.selected &&
event.group === groupName &&
event.module === armorName;
const shouldBeVisible = !event.selected || isThisComponentSelected;
material.current.transparent = !shouldBeVisible;
outlineMaterial.current.transparent = !shouldBeVisible;
}
dissectEvent.on(handleDissectEvent);
moduleSelectEvent.on(handleModuleSelectEvent);
handleDissectEvent(lastDissection);
handleModuleSelectEvent(lastModuleSelect);
return () => {
dissectEvent.off(handleDissectEvent);
moduleSelectEvent.off(handleModuleSelectEvent);
};
}, []);
return (
<Fragment key={props.key}>
<lineSegments ref={outline} material={outlineMaterial.current}>
<edgesGeometry args={[props.geometry, 45]} />
</lineSegments>
{isModule && (
<>
<mesh
material={material.current}
ref={baseWrapper}
onClick={(event) => {
if (!baseWrapper.current) return;
const isAlreadySelected =
lastModuleSelect.selected &&
lastModuleSelect.group === groupName &&
lastModuleSelect.module === armorName;
if (!isAlreadySelected) {
moduleSelectEvent.emit({
selected: true,
group: groupName,
module: armorName,
position: event.point.toArray(),
});
}
}}
onPointerDown={(event) => {
event.stopPropagation();
}}
>
<Geometry ref={csg}>
<Base geometry={props.geometry} />
<group rotation={[0, 0, 0]} ref={subtractionWrapper}>
<Subtraction position={[NEGATIVE_SIZE / 2, 0, 0]}>
<boxGeometry
args={[NEGATIVE_SIZE, NEGATIVE_SIZE, NEGATIVE_SIZE]}
/>
</Subtraction>
</group>
</Geometry>
</mesh>
</>
)}
{!isModule && (
<lineSegments material={outlineMaterialInverse.current}>
<edgesGeometry args={[props.geometry, 45]} />
</lineSegments>
)}
</Fragment>
);
},
});
}
@@ -55,7 +55,7 @@ function LayerEntry({
<Text size="2" color="gray"> <Text size="2" color="gray">
{literals( {literals(
strings.website.tools.tankopedia.sandbox.dynamic.shot_card.stats strings.website.tools.tanks.sandbox.dynamic.shot_card.stats
.ricochet_loss, .ricochet_loss,
[Math.max(-100, -50 * layer.distance).toFixed(0)], [Math.max(-100, -50 * layer.distance).toFixed(0)],
)} )}
@@ -78,7 +78,7 @@ function LayerEntry({
{literals( {literals(
angle === undefined angle === undefined
? strings.common.units.mm ? strings.common.units.mm
: strings.website.tools.tankopedia.sandbox.dynamic.shot_card : strings.website.tools.tanks.sandbox.dynamic.shot_card
.stats.thickness_and_angle, .stats.thickness_and_angle,
[ [
Math.round(layer.thicknessAngled).toLocaleString(locale), Math.round(layer.thicknessAngled).toLocaleString(locale),
@@ -89,7 +89,7 @@ function LayerEntry({
<Text size="2" color="gray"> <Text size="2" color="gray">
{literals( {literals(
strings.website.tools.tankopedia.sandbox.dynamic.shot_card.stats strings.website.tools.tanks.sandbox.dynamic.shot_card.stats
.nominal, .nominal,
[Math.round(layer.thickness).toLocaleString(locale)], [Math.round(layer.thickness).toLocaleString(locale)],
)} )}
@@ -120,7 +120,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) {
<Flex direction="column" gap="1"> <Flex direction="column" gap="1">
<Text color={inTitleColor} weight="bold"> <Text color={inTitleColor} weight="bold">
{literals( {literals(
strings.website.tools.tankopedia.sandbox.dynamic.shot_card.status[ strings.website.tools.tanks.sandbox.dynamic.shot_card.status[
shot.in.status shot.in.status
], ],
[Math.round(shot.damage).toLocaleString(locale)], [Math.round(shot.damage).toLocaleString(locale)],
@@ -130,7 +130,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) {
<Flex direction="column"> <Flex direction="column">
{shot.in.layers.map((layer, index) => { {shot.in.layers.map((layer, index) => {
const layerName = const layerName =
strings.website.tools.tankopedia.sandbox.dynamic.shot_card strings.website.tools.tanks.sandbox.dynamic.shot_card
.element[ .element[
layer.type === ArmorType.External layer.type === ArmorType.External
? layer.variant ? layer.variant
@@ -186,7 +186,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) {
<Text color={outTitleColor} weight="bold"> <Text color={outTitleColor} weight="bold">
{literals( {literals(
strings.website.tools.tankopedia.sandbox.dynamic.shot_card strings.website.tools.tanks.sandbox.dynamic.shot_card
.status[shot.out.status], .status[shot.out.status],
[Math.round(shot.damage).toLocaleString(locale)], [Math.round(shot.damage).toLocaleString(locale)],
)} )}
@@ -195,7 +195,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) {
<Flex direction="column"> <Flex direction="column">
{shot.out.layers.map((layer, index) => { {shot.out.layers.map((layer, index) => {
const layerName = const layerName =
strings.website.tools.tankopedia.sandbox.dynamic.shot_card strings.website.tools.tanks.sandbox.dynamic.shot_card
.element[ .element[
layer.type === ArmorType.External layer.type === ArmorType.External
? layer.variant ? layer.variant
@@ -1,15 +1,8 @@
import { memo, useRef } from 'react'; import { Scene } from 'three';
import { Group, Plane, Scene, Vector3 } from 'three'; import { arrayfy } from '../../../core/three/arrayfy';
import { correctZYTuple } from '../../../core/blitz/correctZYTuple';
import { nameToArmorId } from '../../../core/blitzkit/nameToArmorId';
import { resolveArmor } from '../../../core/blitzkit/resolveThickness';
import { useArmor } from '../../../hooks/useArmor';
import { useModel } from '../../../hooks/useModel';
import { useTankModelDefinition } from '../../../hooks/useTankModelDefinition';
import { useTankTransform } from '../../../hooks/useTankTransform';
import { Duel } from '../../../stores/duel'; import { Duel } from '../../../stores/duel';
import { ModelTankWrapper } from './ModelTankWrapper'; import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
import { SpacedArmorSceneComponent } from './SpacedArmorSceneComponent'; import { SpacedArmorSceneComponent } from './SpacedArmorSceneComponent/index';
export enum ArmorType { export enum ArmorType {
Primary, Primary,
@@ -21,185 +14,25 @@ interface SpacedArmorSceneProps {
scene: Scene; scene: Scene;
} }
export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => { export function SpacedArmorScene({ scene }: SpacedArmorSceneProps) {
const wrapper = useRef<Group>(null); const model = TankopediaEphemeral.use((state) => state.model);
const turretContainer = useRef<Group>(null);
const gunContainer = useRef<Group>(null);
const tank = Duel.use((state) => state.protagonist.tank);
const track = Duel.use((state) => state.protagonist.track);
const turret = Duel.use((state) => state.protagonist.turret); const turret = Duel.use((state) => state.protagonist.turret);
const gun = Duel.use((state) => state.protagonist.gun); const gun = Duel.use((state) => state.protagonist.gun);
const { gltf: armorGltf } = useArmor(tank.id); const turretTranslation = arrayfy(model.modules[turret.id].translation);
const { gltf: modelGltf } = useModel(tank.id); const gunTranslation = arrayfy(model.modules[gun.id].translation);
const armorNodes = Object.values(armorGltf.nodes);
const modelNodes = Object.values(modelGltf.nodes);
const tankModelDefinition = useTankModelDefinition();
const trackModelDefinition = tankModelDefinition.tracks[track.id];
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
const gunModelDefinition =
turretModelDefinition.guns[gun.gun_type!.value.base.id];
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
const maskOrigin =
gunModelDefinition.mask === undefined
? undefined
: gunModelDefinition.mask + hullOrigin.y + turretOrigin.y + gunOrigin.y;
const isDynamicArmorActive = Duel.use((state) =>
state.protagonist.consumables.includes(73),
);
useTankTransform(track, turret, turretContainer, gunContainer);
return ( return (
<ModelTankWrapper ref={wrapper}> <group>
<group position={hullOrigin}> <SpacedArmorSceneComponent group="hull" />
{armorNodes.map((node) => { <SpacedArmorSceneComponent group="chassis" />
const isHull = node.name.startsWith('hull_');
const isVisible = isHull;
const armorId = nameToArmorId(node.name);
const { spaced, thickness } = resolveArmor(
tankModelDefinition.armor,
armorId,
);
if ( <group position={turretTranslation}>
!isVisible || <SpacedArmorSceneComponent group={turret.id} />
thickness === undefined ||
(isDynamicArmorActive && node.name.includes('state_00')) ||
(!isDynamicArmorActive && node.name.includes('state_01'))
)
return null;
return (
<SpacedArmorSceneComponent
scene={scene}
key={node.uuid}
type={spaced ? ArmorType.Spaced : ArmorType.Primary}
thickness={thickness}
node={node}
/>
);
})}
</group> </group>
{modelNodes.map((node) => { <group position={gunTranslation}>
const isWheel = node.name.startsWith('chassis_wheel_'); <SpacedArmorSceneComponent group={gun.id} />
const isTrack = node.name.startsWith('chassis_track_');
const isVisible = isWheel || isTrack;
if (!isVisible) return null;
return (
<SpacedArmorSceneComponent
scene={scene}
key={node.uuid}
type={ArmorType.External}
thickness={trackModelDefinition.thickness}
variant="track"
node={node}
/>
);
})}
<group ref={turretContainer}>
{armorNodes.map((node) => {
const isCurrentTurret = node.name.startsWith(
`turret_${turretModelDefinition.model_id.toString().padStart(2, '0')}`,
);
const isVisible = isCurrentTurret;
const armorId = nameToArmorId(node.name);
const { spaced, thickness } = resolveArmor(
turretModelDefinition.armor,
armorId,
);
if (
!isVisible ||
thickness === undefined ||
(isDynamicArmorActive && node.name.includes('state_00')) ||
(!isDynamicArmorActive && node.name.includes('state_01'))
)
return null;
return (
<group position={hullOrigin} key={node.uuid}>
<group position={turretOrigin}>
<SpacedArmorSceneComponent
scene={scene}
key={node.uuid}
type={spaced ? ArmorType.Spaced : ArmorType.Primary}
thickness={thickness}
node={node}
/>
</group>
</group>
);
})}
<group ref={gunContainer}>
{armorNodes.map((node) => {
const isCurrentGun = node.name.startsWith(
`gun_${gunModelDefinition.model_id.toString().padStart(2, '0')}`,
);
const isVisible = isCurrentGun;
const armorId = nameToArmorId(node.name);
const { spaced, thickness } = resolveArmor(
gunModelDefinition.armor,
armorId,
);
if (
!isVisible ||
thickness === undefined ||
(isDynamicArmorActive && node.name.includes('state_00')) ||
(!isDynamicArmorActive && node.name.includes('state_01'))
)
return null;
return (
<group position={hullOrigin} key={node.uuid}>
<group position={turretOrigin.clone().add(gunOrigin)}>
<SpacedArmorSceneComponent
scene={scene}
type={spaced ? ArmorType.Spaced : ArmorType.Primary}
thickness={thickness}
node={node}
/>
</group>
</group>
);
})}
{modelNodes.map((node) => {
const gunString = `gun_${gunModelDefinition.model_id
.toString()
.padStart(2, '0')}`;
const isCurrentGun = gunModelDefinition.mask
? node.name.startsWith(gunString)
: node.name === gunString;
const isVisible = isCurrentGun;
if (!isVisible) return null;
return (
<SpacedArmorSceneComponent
scene={scene}
key={node.uuid}
type={ArmorType.External}
thickness={gunModelDefinition.thickness}
variant="gun"
node={node}
clip={
maskOrigin === undefined
? undefined
: new Plane(new Vector3(0, 0, -1), -maskOrigin)
}
/>
);
})}
</group>
</group> </group>
</ModelTankWrapper> </group>
); );
}); }
@@ -7,12 +7,12 @@ import {
Plane, Plane,
ShaderMaterial, ShaderMaterial,
} from 'three'; } from 'three';
import type { ArmorUserData, ExternalModuleVariant } from '../..';
import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment'; import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment';
import { jsxTree } from '../../../../../../core/blitzkit/jsxTree'; import { jsxTree } from '../../../../../../core/blitzkit/jsxTree';
import { Duel, type EquipmentMatrix } from '../../../../../../stores/duel'; import { Duel, type EquipmentMatrix } from '../../../../../../stores/duel';
import { TankopediaEphemeral } from '../../../../../../stores/tankopediaEphemeral'; import { TankopediaEphemeral } from '../../../../../../stores/tankopediaEphemeral';
import { ArmorType } from '../../../SpacedArmorScene'; import { ArmorType } from '../../../SpacedArmorScene';
import type { ArmorUserData, ExternalModuleVariant } from '../../_index';
import fragmentShader from './shaders/fragment.glsl?raw'; import fragmentShader from './shaders/fragment.glsl?raw';
import vertexShader from './shaders/vertex.glsl?raw'; import vertexShader from './shaders/vertex.glsl?raw';
@@ -1,24 +1,14 @@
import { isExplosive, resolvePenetrationCoefficient } from '@blitzkit/core'; import { ArmorPlate } from '@blitzkit/core';
import { useEffect } from 'react'; import type { MeshProps } from '@react-three/fiber';
import { import { Fragment } from 'react';
AdditiveBlending, import { AdditiveBlending, MeshBasicMaterial, ShaderMaterial } from 'three';
MeshBasicMaterial, import { Duel } from '../../../../../../stores/duel';
ShaderMaterial,
type Object3D,
} from 'three';
import { degToRad } from 'three/src/math/MathUtils.js';
import type { ArmorUserData } from '../..';
import { hasEquipment } from '../../../../../../core/blitzkit/hasEquipment';
import { jsxTree } from '../../../../../../core/blitzkit/jsxTree';
import { Duel, type EquipmentMatrix } from '../../../../../../stores/duel';
import { TankopediaEphemeral } from '../../../../../../stores/tankopediaEphemeral'; import { TankopediaEphemeral } from '../../../../../../stores/tankopediaEphemeral';
import { ArmorType } from '../../../SpacedArmorScene';
import fragmentShader from './shaders/fragment.glsl?raw'; import fragmentShader from './shaders/fragment.glsl?raw';
import vertexShader from './shaders/vertex.glsl?raw'; import vertexShader from './shaders/vertex.glsl?raw';
interface SpacedArmorSubSpacedProps { interface SpacedArmorSubSpacedProps extends MeshProps {
node: Object3D; armorPlate: ArmorPlate;
thickness: number;
} }
const depthWriteMaterial = new MeshBasicMaterial({ const depthWriteMaterial = new MeshBasicMaterial({
@@ -27,8 +17,8 @@ const depthWriteMaterial = new MeshBasicMaterial({
}); });
export function SpacedArmorSubSpaced({ export function SpacedArmorSubSpaced({
node, armorPlate,
thickness, ...props
}: SpacedArmorSubSpacedProps) { }: SpacedArmorSubSpacedProps) {
const tankopediaEphemeralStore = TankopediaEphemeral.useStore(); const tankopediaEphemeralStore = TankopediaEphemeral.useStore();
const duelStore = Duel.useStore(); const duelStore = Duel.useStore();
@@ -49,107 +39,89 @@ export function SpacedArmorSubSpaced({
}, },
}); });
useEffect(() => { // useEffect(() => {
function handleShellChange() { // function handleShellChange() {
const duel = duelStore.getState(); // const duel = duelStore.getState();
const tankopediaEphemeral = tankopediaEphemeralStore.getState(); // const tankopediaEphemeral = tankopediaEphemeralStore.getState();
const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell; // const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
material.uniforms.penetration.value = shell.penetration.near; // material.uniforms.penetration.value = shell.penetration.near;
material.uniforms.caliber.value = shell.caliber; // material.uniforms.caliber.value = shell.caliber;
material.uniforms.ricochet.value = degToRad( // material.uniforms.ricochet.value = degToRad(
isExplosive(shell.type) ? 90 : shell.ricochet!, // isExplosive(shell.type) ? 90 : shell.ricochet!,
); // );
material.uniforms.normalization.value = degToRad( // material.uniforms.normalization.value = degToRad(
shell.normalization ?? 0, // shell.normalization ?? 0,
); // );
} // }
async function handleProtagonistEquipmentChange( // async function handleProtagonistEquipmentChange(
equipment: EquipmentMatrix, // equipment: EquipmentMatrix,
) { // ) {
const duel = duelStore.getState(); // const duel = duelStore.getState();
const hasEnhancedArmor = await hasEquipment( // const hasEnhancedArmor = await hasEquipment(
110, // 110,
duel.protagonist.tank.equipment_preset, // duel.protagonist.tank.equipment_preset,
equipment, // equipment,
); // );
material.uniforms.thickness.value = hasEnhancedArmor // material.uniforms.thickness.value = hasEnhancedArmor
? thickness * 1.03 // ? thickness * 1.03
: thickness; // : thickness;
} // }
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) { // async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
const duel = duelStore.getState(); // const duel = duelStore.getState();
const tankopediaEphemeral = tankopediaEphemeralStore.getState(); // const tankopediaEphemeral = tankopediaEphemeralStore.getState();
const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell; // const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
const penetration = shell.penetration.near; // const penetration = shell.penetration.near;
const hasCalibratedShells = await hasEquipment( // const hasCalibratedShells = await hasEquipment(
103, // 103,
duel.antagonist.tank.equipment_preset, // duel.antagonist.tank.equipment_preset,
equipment, // equipment,
); // );
material.uniforms.penetration.value = // material.uniforms.penetration.value =
penetration * // penetration *
resolvePenetrationCoefficient(hasCalibratedShells, shell.type); // resolvePenetrationCoefficient(hasCalibratedShells, shell.type);
} // }
handleShellChange(); // handleShellChange();
handleProtagonistEquipmentChange( // handleProtagonistEquipmentChange(
duelStore.getState().protagonist.equipmentMatrix, // duelStore.getState().protagonist.equipmentMatrix,
); // );
handleAntagonistEquipmentChange( // handleAntagonistEquipmentChange(
duelStore.getState().antagonist.equipmentMatrix, // duelStore.getState().antagonist.equipmentMatrix,
); // );
const unsubscribes = [ // const unsubscribes = [
duelStore.subscribe((state) => state.antagonist.shell, handleShellChange), // duelStore.subscribe((state) => state.antagonist.shell, handleShellChange),
tankopediaEphemeralStore.subscribe( // tankopediaEphemeralStore.subscribe(
(state) => state.customShell, // (state) => state.customShell,
handleShellChange, // handleShellChange,
), // ),
duelStore.subscribe( // duelStore.subscribe(
(state) => state.protagonist.equipmentMatrix, // (state) => state.protagonist.equipmentMatrix,
handleProtagonistEquipmentChange, // handleProtagonistEquipmentChange,
), // ),
duelStore.subscribe( // duelStore.subscribe(
(state) => state.antagonist.equipmentMatrix, // (state) => state.antagonist.equipmentMatrix,
handleAntagonistEquipmentChange, // handleAntagonistEquipmentChange,
), // ),
]; // ];
return () => { // return () => {
unsubscribes.forEach((unsubscribe) => unsubscribe()); // unsubscribes.forEach((unsubscribe) => unsubscribe());
}; // };
}); // });
return ( return (
<> <Fragment>
{jsxTree( <mesh
node, {...props}
{ renderOrder={2}
mesh: { material={material}
renderOrder: 2, onClick={() => {}}
material, userData={armorPlate}
onClick() {}, />
userData: { <mesh {...props} renderOrder={5} material={depthWriteMaterial} />
type: ArmorType.Spaced, </Fragment>
thickness,
} satisfies ArmorUserData,
},
},
`${node.uuid}-exclude`,
)}
{jsxTree(
node,
{
mesh: {
renderOrder: 5,
material: depthWriteMaterial,
},
},
`${node.uuid}-include`,
)}
</>
); );
} }
@@ -1,83 +1,42 @@
import { import { asset } from '@blitzkit/core';
ShellType, import { useGLTF } from '@react-three/drei';
isExplosive,
resolvePenetrationCoefficient,
} from '@blitzkit/core';
import { useThree } from '@react-three/fiber'; import { useThree } from '@react-three/fiber';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { import { Material, MeshBasicMaterial } from 'three';
type Intersection,
MeshBasicMaterial,
Object3D,
Plane,
Quaternion,
Raycaster,
Scene,
Vector3,
} from 'three';
import { degToRad } from 'three/src/math/MathUtils.js';
import { hasEquipment } from '../../../../core/blitzkit/hasEquipment';
import { jsxTree } from '../../../../core/blitzkit/jsxTree'; import { jsxTree } from '../../../../core/blitzkit/jsxTree';
import { discardClippingPlane } from '../../../../core/three/discardClippingPlane';
import { Duel } from '../../../../stores/duel'; import { Duel } from '../../../../stores/duel';
import { import { TankopediaEphemeral } from '../../../../stores/tankopediaEphemeral';
type Shot, import { TankopediaPersistent } from '../../../../stores/tankopediaPersistent';
type ShotLayerBase, import { groupNameRegex } from '../StaticArmorSceneComponent';
type ShotLayerNonExternal,
TankopediaEphemeral,
} from '../../../../stores/tankopediaEphemeral';
import { ArmorType } from '../SpacedArmorScene';
import { SpacedArmorSubExternal } from './components/SpacedArmorSubExternal'; import { SpacedArmorSubExternal } from './components/SpacedArmorSubExternal';
import { SpacedArmorSubSpaced } from './components/SpacedArmorSubSpaced'; import { SpacedArmorSubSpaced } from './components/SpacedArmorSubSpaced';
type SpacedArmorSceneComponentProps = { interface StaticArmorSceneComponentsProp {
node: Object3D; group: string;
thickness: number; }
clip?: Plane;
scene: Scene;
} & (
| {
type: Exclude<ArmorType, ArmorType.External>;
}
| {
type: ArmorType.External;
variant: ExternalModuleVariant;
}
);
export type ExternalModuleVariant = 'gun' | 'track';
export type ArmorUserData = {
thickness: number;
} & (
| {
type: Exclude<ArmorType, ArmorType.External>;
}
| {
type: ArmorType.External;
variant: ExternalModuleVariant;
}
);
const omitMaterial = new MeshBasicMaterial({ const omitMaterial = new MeshBasicMaterial({
colorWrite: false, colorWrite: false,
depthWrite: true, depthWrite: true,
}); });
/**
* Render orders allocations:
* - 0 : core omission
* - 1-2: spaced without depth buffer write but do test to allow additive blending
* - 3-4: external with depth buffer write in first pass and read in second to simplify geometry
* - 5 : spaced depth write
*/
export function SpacedArmorSceneComponent({ export function SpacedArmorSceneComponent({
node, group,
thickness, }: StaticArmorSceneComponentsProp) {
clip,
...props
}: SpacedArmorSceneComponentProps) {
const tankopediaEphemeralStore = TankopediaEphemeral.useStore(); const tankopediaEphemeralStore = TankopediaEphemeral.useStore();
const duelStore = Duel.useStore(); const tank = Duel.use((state) => state.protagonist.tank);
const showModules = TankopediaPersistent.use((state) => state.showModules);
const showArmorScreen = TankopediaPersistent.use(
(state) => state.showArmorScreen,
);
const showArmor = TankopediaPersistent.use((state) => state.showArmor);
const gltf = useGLTF(asset(`tanks/${tank.id}/collision/${group}.glb`));
const armor = TankopediaEphemeral.use((state) => state.armor);
const groupName = group.match(groupNameRegex)![1];
const groupArmor = armor.groups[groupName];
const thicknessRange = TankopediaEphemeral.use(
(state) => state.thicknessRange,
);
const camera = useThree((state) => state.camera); const camera = useThree((state) => state.camera);
const shoot = useCallback( const shoot = useCallback(
@@ -369,20 +328,30 @@ export function SpacedArmorSceneComponent({
[camera], [camera],
); );
return ( return jsxTree(gltf.scene, {
<> mesh(mesh, props, key) {
{props.type === ArmorType.Primary && if (!(mesh.material instanceof Material)) {
jsxTree( return null;
node, }
{
mesh: { const armorName = mesh.material.name;
renderOrder: 0, const armorPlate = groupArmor.armors[armorName];
material: omitMaterial,
userData: { if (armorPlate === undefined) {
type: ArmorType.Primary, console.warn(`Missing armor: ${armorName}`);
thickness, return null;
} satisfies ArmorUserData, }
async onClick(event) {
switch (armorPlate.type) {
case 'Armor':
return (
<mesh
{...props}
key={key}
renderOrder={0}
material={omitMaterial}
userData={armorPlate}
onClick={async (event) => {
event.stopPropagation(); event.stopPropagation();
const shot = (await shoot( const shot = (await shoot(
event.point, event.point,
@@ -390,24 +359,30 @@ export function SpacedArmorSceneComponent({
true, true,
))!; ))!;
tankopediaEphemeralStore.setState({ shot }); tankopediaEphemeralStore.setState({ shot });
}, }}
}, />
}, );
node.uuid,
)}
{props.type === ArmorType.Spaced && ( case 'ArmorScreen':
<SpacedArmorSubSpaced node={node} thickness={thickness} /> return (
)} <SpacedArmorSubSpaced
{...props}
key={key}
armorPlate={armorPlate}
/>
);
{props.type === ArmorType.External && ( default:
<SpacedArmorSubExternal return null;
node={node} return (
thickness={thickness} <SpacedArmorSubExternal
variant={props.variant} node={node}
clip={clip} thickness={thickness}
/> variant={props.variant}
)} clip={clip}
</> />
); );
}
},
});
} }
@@ -1,428 +1,31 @@
import { normalizeAngleRad } from '@blitzkit/core'; import { arrayfy } from '../../../core/three/arrayfy';
import { useThree, type ThreeEvent } from '@react-three/fiber';
import { memo, useRef } from 'react';
import { Group, Plane, Vector2, Vector3 } from 'three';
import { applyPitchYawLimits } from '../../../core/blitz/applyPitchYawLimits';
import { correctZYTuple } from '../../../core/blitz/correctZYTuple';
import { hasEquipment } from '../../../core/blitzkit/hasEquipment';
import { modelTransformEvent } from '../../../core/blitzkit/modelTransform';
import { nameToArmorId } from '../../../core/blitzkit/nameToArmorId';
import { resolveArmor } from '../../../core/blitzkit/resolveThickness';
import { useArmor } from '../../../hooks/useArmor';
import { useModel } from '../../../hooks/useModel';
import { useTankModelDefinition } from '../../../hooks/useTankModelDefinition';
import { useTankTransform } from '../../../hooks/useTankTransform';
import { Duel } from '../../../stores/duel'; import { Duel } from '../../../stores/duel';
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral'; import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
import { ModelTankWrapper } from './ModelTankWrapper';
import { ArmorType } from './SpacedArmorScene';
import { StaticArmorSceneComponent } from './StaticArmorSceneComponent'; import { StaticArmorSceneComponent } from './StaticArmorSceneComponent';
interface ArmorSceneProps {
thicknessRange: ThicknessRange;
}
export interface ThicknessRange { export interface ThicknessRange {
value: number; value: number;
} }
export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => { export function StaticArmor() {
const wrapper = useRef<Group>(null); const model = TankopediaEphemeral.use((state) => state.model);
const turretContainer = useRef<Group>(null);
const gunContainer = useRef<Group>(null);
const protagonist = Duel.use((draft) => draft.protagonist);
const tank = Duel.use((state) => state.protagonist.tank);
const track = Duel.use((state) => state.protagonist.track);
const turret = Duel.use((state) => state.protagonist.turret); const turret = Duel.use((state) => state.protagonist.turret);
const gun = Duel.use((state) => state.protagonist.gun); const gun = Duel.use((state) => state.protagonist.gun);
const { gltf: armorGltf } = useArmor(tank.id); const turretTranslation = arrayfy(model.modules[turret.id].translation);
const { gltf: modelGltf } = useModel(tank.id); const gunTranslation = arrayfy(model.modules[gun.id].translation);
const armorNodes = Object.values(armorGltf.nodes);
const modelNodes = Object.values(modelGltf.nodes);
const tankModelDefinition = useTankModelDefinition();
const trackModelDefinition = tankModelDefinition.tracks[track.id];
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
const gunModelDefinition =
turretModelDefinition.guns[gun.gun_type!.value.base.id];
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
const mutateDuel = Duel.useMutation();
const canvas = useThree((state) => state.gl.domElement);
const mutateTankopediaEphemeral = TankopediaEphemeral.useMutation();
const duelStore = Duel.useStore();
const maskOrigin =
gunModelDefinition.mask === undefined
? undefined
: gunModelDefinition.mask + hullOrigin.y + turretOrigin.y + gunOrigin.y;
const showPrimaryArmor = TankopediaPersistent.use(
(state) => state.showPrimaryArmor,
);
const showSpacedArmor = TankopediaPersistent.use(
(state) => state.showSpacedArmor,
);
const showExternalModules = TankopediaPersistent.use(
(state) => state.showExternalModules,
);
const isDynamicArmorActive = Duel.use((state) =>
state.protagonist.consumables.includes(73),
);
useTankTransform(track, turret, turretContainer, gunContainer);
return ( return (
<ModelTankWrapper ref={wrapper}> <group>
<group position={hullOrigin}> <StaticArmorSceneComponent group="hull" />
{armorNodes.map((node) => { <StaticArmorSceneComponent group="chassis" />
const isHull = node.name.startsWith('hull_');
const isVisible = isHull;
const armorId = nameToArmorId(node.name);
const { spaced, thickness } = resolveArmor(
tankModelDefinition.armor,
armorId,
);
if ( <group position={turretTranslation}>
!isVisible || <StaticArmorSceneComponent group={turret.id} />
thickness === undefined ||
(!showPrimaryArmor && !spaced) ||
(!showSpacedArmor && spaced) ||
(isDynamicArmorActive && node.name.includes('state_00')) ||
(!isDynamicArmorActive && node.name.includes('state_01'))
)
return null;
return (
<StaticArmorSceneComponent
name={node.name}
thicknessRange={thicknessRange}
key={node.uuid}
type={spaced ? ArmorType.Spaced : ArmorType.Primary}
thickness={thickness}
node={node}
onPointerDown={(event) => event.stopPropagation()}
/>
);
})}
</group> </group>
{modelNodes.map((node) => { <group position={gunTranslation}>
const isWheel = node.name.startsWith('chassis_wheel_'); <StaticArmorSceneComponent group={gun.id} />
const isTrack = node.name.startsWith('chassis_track_');
const isVisible = isWheel || isTrack;
if (!isVisible || !showExternalModules) return null;
return (
<StaticArmorSceneComponent
name={node.name}
thicknessRange={thicknessRange}
key={node.uuid}
type={ArmorType.External}
thickness={trackModelDefinition.thickness}
variant="track"
node={node}
onPointerDown={(event) => event.stopPropagation()}
/>
);
})}
<group ref={turretContainer}>
{armorNodes.map((node) => {
const isCurrentTurret = node.name.startsWith(
`turret_${turretModelDefinition.model_id.toString().padStart(2, '0')}`,
);
const isVisible = isCurrentTurret;
const armorId = nameToArmorId(node.name);
const { spaced, thickness } = resolveArmor(
turretModelDefinition.armor,
armorId,
);
if (
!isVisible ||
thickness === undefined ||
(!showPrimaryArmor && !spaced) ||
(!showSpacedArmor && spaced) ||
(isDynamicArmorActive && node.name.includes('state_00')) ||
(!isDynamicArmorActive && node.name.includes('state_01'))
) {
return null;
}
const position = new Vector2();
const delta = new Vector2();
let pitch = 0;
let yaw = 0;
function onPointerDown(event: ThreeEvent<PointerEvent>) {
event.stopPropagation();
position.set(event.clientX, event.clientY);
yaw = protagonist.yaw;
pitch = protagonist.pitch;
mutateTankopediaEphemeral((draft) => {
draft.controlsEnabled = false;
});
mutateTankopediaEphemeral((draft) => {
draft.shot = undefined;
draft.highlightArmor = undefined;
});
window.addEventListener('pointermove', handlePointerMove);
window.addEventListener('pointerup', handlePointerUp);
}
async function handlePointerMove(event: PointerEvent) {
const duel = duelStore.getState();
const hasImprovedVerticalStabilizer = await hasEquipment(
122,
duel.protagonist.tank.equipment_preset,
duel.protagonist.equipmentMatrix,
);
const hasDownImprovedVerticalStabilizer = await hasEquipment(
124,
duel.protagonist.tank.equipment_preset,
duel.protagonist.equipmentMatrix,
);
const boundingRect = canvas.getBoundingClientRect();
delta.set(event.clientX, event.clientY).sub(position);
position.set(event.clientX, event.clientY);
[pitch, yaw] = applyPitchYawLimits(
pitch,
yaw + delta.x * (Math.PI / boundingRect.width),
gunModelDefinition.pitch,
turretModelDefinition.yaw,
hasImprovedVerticalStabilizer,
hasDownImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
}
function handlePointerUp() {
mutateDuel((draft) => {
draft.protagonist.pitch = normalizeAngleRad(pitch);
draft.protagonist.yaw = normalizeAngleRad(yaw);
});
mutateTankopediaEphemeral((draft) => {
draft.controlsEnabled = true;
});
window.removeEventListener('pointermove', handlePointerMove);
window.removeEventListener('pointerup', handlePointerUp);
}
return (
<group key={node.uuid} position={hullOrigin}>
<group position={turretOrigin}>
<StaticArmorSceneComponent
name={node.name}
thicknessRange={thicknessRange}
key={node.uuid}
type={spaced ? ArmorType.Spaced : ArmorType.Primary}
thickness={thickness}
node={node}
onPointerDown={onPointerDown}
/>
</group>
</group>
);
})}
<group ref={gunContainer}>
{armorNodes.map((node) => {
const isCurrentGun = node.name.startsWith(
`gun_${gunModelDefinition.model_id.toString().padStart(2, '0')}`,
);
const isVisible = isCurrentGun;
const armorId = nameToArmorId(node.name);
const { spaced, thickness } = resolveArmor(
gunModelDefinition.armor,
armorId,
);
if (
!isVisible ||
thickness === undefined ||
(!showPrimaryArmor && !spaced) ||
(!showSpacedArmor && spaced) ||
(isDynamicArmorActive && node.name.includes('state_00')) ||
(!isDynamicArmorActive && node.name.includes('state_01'))
)
return null;
const position = new Vector2();
const delta = new Vector2();
let pitch = 0;
let yaw = 0;
function onPointerDown(event: ThreeEvent<PointerEvent>) {
event.stopPropagation();
mutateTankopediaEphemeral((draft) => {
draft.controlsEnabled = false;
});
mutateTankopediaEphemeral((draft) => {
draft.shot = undefined;
draft.highlightArmor = undefined;
});
position.set(event.clientX, event.clientY);
pitch = protagonist.pitch;
yaw = protagonist.yaw;
window.addEventListener('pointermove', handlePointerMove);
window.addEventListener('pointerup', handlePointerUp);
}
async function handlePointerMove(event: PointerEvent) {
const duel = duelStore.getState();
const hasImprovedVerticalStabilizer = await hasEquipment(
122,
duel.protagonist.tank.equipment_preset,
duel.protagonist.equipmentMatrix,
);
const hasDownImprovedVerticalStabilizer = await hasEquipment(
124,
duel.protagonist.tank.equipment_preset,
duel.protagonist.equipmentMatrix,
);
const boundingRect = canvas.getBoundingClientRect();
delta.set(event.clientX, event.clientY).sub(position);
position.set(event.clientX, event.clientY);
[pitch, yaw] = applyPitchYawLimits(
pitch - delta.y * (Math.PI / boundingRect.height),
yaw + delta.x * (Math.PI / boundingRect.width),
gunModelDefinition.pitch,
turretModelDefinition.yaw,
hasImprovedVerticalStabilizer,
hasDownImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
}
function handlePointerUp() {
mutateTankopediaEphemeral((draft) => {
draft.controlsEnabled = true;
});
mutateDuel((draft) => {
draft.protagonist.pitch = normalizeAngleRad(pitch);
draft.protagonist.yaw = normalizeAngleRad(yaw);
});
window.removeEventListener('pointermove', handlePointerMove);
window.removeEventListener('pointerup', handlePointerUp);
}
return (
<group key={node.uuid} position={hullOrigin}>
<group position={turretOrigin.clone().add(gunOrigin)}>
<StaticArmorSceneComponent
name={node.name}
thicknessRange={thicknessRange}
type={spaced ? ArmorType.Spaced : ArmorType.Primary}
thickness={thickness}
node={node}
onPointerDown={onPointerDown}
/>
</group>
</group>
);
})}
{modelNodes.map((node) => {
const gunString = `gun_${gunModelDefinition.model_id
.toString()
.padStart(2, '0')}`;
const isCurrentGun = gunModelDefinition.mask
? node.name.startsWith(gunString)
: node.name === gunString;
const isVisible = isCurrentGun;
if (!isVisible || !showExternalModules) return null;
const position = new Vector2();
const delta = new Vector2();
let pitch = 0;
let yaw = 0;
function onPointerDown(event: ThreeEvent<PointerEvent>) {
event.stopPropagation();
mutateTankopediaEphemeral((draft) => {
draft.controlsEnabled = false;
});
mutateTankopediaEphemeral((draft) => {
draft.shot = undefined;
draft.highlightArmor = undefined;
});
position.set(event.clientX, event.clientY);
pitch = protagonist.pitch;
yaw = protagonist.yaw;
window.addEventListener('pointermove', handlePointerMove);
window.addEventListener('pointerup', handlePointerUp);
}
async function handlePointerMove(event: PointerEvent) {
const duel = duelStore.getState();
const hasImprovedVerticalStabilizer = await hasEquipment(
122,
duel.protagonist.tank.equipment_preset,
duel.protagonist.equipmentMatrix,
);
const hasDownImprovedVerticalStabilizer = await hasEquipment(
124,
duel.protagonist.tank.equipment_preset,
duel.protagonist.equipmentMatrix,
);
const boundingRect = canvas.getBoundingClientRect();
delta.set(event.clientX, event.clientY).sub(position);
position.set(event.clientX, event.clientY);
[pitch, yaw] = applyPitchYawLimits(
pitch - delta.y * (Math.PI / boundingRect.height),
yaw + delta.x * (Math.PI / boundingRect.width),
gunModelDefinition.pitch,
turretModelDefinition.yaw,
hasImprovedVerticalStabilizer,
hasDownImprovedVerticalStabilizer,
);
modelTransformEvent.emit({ pitch, yaw });
}
function handlePointerUp() {
mutateTankopediaEphemeral((draft) => {
draft.controlsEnabled = true;
});
mutateDuel((draft) => {
draft.protagonist.pitch = normalizeAngleRad(pitch);
draft.protagonist.yaw = normalizeAngleRad(yaw);
});
window.removeEventListener('pointermove', handlePointerMove);
window.removeEventListener('pointerup', handlePointerUp);
}
return (
<StaticArmorSceneComponent
name={node.name}
thicknessRange={thicknessRange}
key={node.uuid}
type={ArmorType.External}
thickness={gunModelDefinition.thickness}
variant="gun"
node={node}
clip={
maskOrigin === undefined
? undefined
: new Plane(new Vector3(0, 0, -1), -maskOrigin)
}
hullOrigin={hullOrigin}
turretOrigin={turretOrigin}
gunOrigin={gunOrigin}
onPointerDown={onPointerDown}
/>
);
})}
</group>
</group> </group>
</ModelTankWrapper> </group>
); );
}); }
@@ -1,272 +1,123 @@
import { I_HAT, J_HAT } from '@blitzkit/core'; import { asset } from '@blitzkit/core';
import { type MeshProps, useThree } from '@react-three/fiber'; import { useGLTF } from '@react-three/drei';
import { clamp } from 'lodash-es'; import { Fragment } from 'react/jsx-runtime';
import { useEffect, useMemo } from 'react';
import { import {
Box3,
Color, Color,
DoubleSide,
FrontSide,
LineBasicMaterial, LineBasicMaterial,
Mesh, Material,
MeshStandardMaterial, MeshStandardMaterial,
Object3D,
Plane,
Quaternion,
Vector3,
} from 'three'; } from 'three';
import { unrotateDavaVector } from '../../../core/blitz/unrotateDavaVector'; import { clamp } from 'three/src/math/MathUtils.js';
import { jsxTree } from '../../../core/blitzkit/jsxTree'; import { jsxTree } from '../../../core/blitzkit/jsxTree';
import { import { Duel } from '../../../stores/duel';
type ModelTransformEventData,
modelTransformEvent,
} from '../../../core/blitzkit/modelTransform';
import { discardClippingPlane } from '../../../core/three/discardClippingPlane';
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral'; import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
import { ArmorType } from './SpacedArmorScene'; import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
import type {
ArmorUserData,
ExternalModuleVariant,
} from './SpacedArmorSceneComponent';
import type { ThicknessRange } from './StaticArmor';
type StaticArmorSceneComponentProps = { interface StaticArmorSceneComponentsProp {
name: string; group: string;
thickness: number; }
thicknessRange: ThicknessRange;
node: Object3D;
onPointerDown?: MeshProps['onPointerDown'];
} & (
| {
type: Exclude<ArmorType, ArmorType.External>;
}
| {
type: ArmorType.External;
variant: ExternalModuleVariant;
}
) &
(
| {
clip?: undefined;
}
| {
clip: Plane;
hullOrigin: Vector3;
turretOrigin: Vector3;
gunOrigin: Vector3;
}
);
const unselectedColor = new Color(0x404040); const moduleColor = new Color(192 / 255, 192 / 255, 192 / 255);
const externalModuleColor = new Color(192 / 255, 192 / 255, 192 / 255); export const groupNameRegex = /([a-z]+)(_\d+)?/;
export function StaticArmorSceneComponent({ export function StaticArmorSceneComponent({
name, group,
thickness, }: StaticArmorSceneComponentsProp) {
thicknessRange, const tank = Duel.use((state) => state.protagonist.tank);
node, const showModules = TankopediaPersistent.use((state) => state.showModules);
onPointerDown, const showArmorScreen = TankopediaPersistent.use(
...props (state) => state.showArmorScreen,
}: StaticArmorSceneComponentProps) { );
const mutateTankopediaEphemeralStore = TankopediaEphemeral.useMutation(); const showArmor = TankopediaPersistent.use((state) => state.showArmor);
const tankopediaEphemeralStore = TankopediaEphemeral.useStore(); const gltf = useGLTF(asset(`tanks/${tank.id}/collision/${group}.glb`));
const camera = useThree((state) => state.camera); const armor = TankopediaEphemeral.use((state) => state.armor);
const x = thickness / thicknessRange.value; const groupName = group.match(groupNameRegex)![1];
const xClamped = clamp(x, 0, 1); const groupArmor = armor.groups[groupName];
let color: Color; const thicknessRange = TankopediaEphemeral.use(
let opacity: number; (state) => state.thicknessRange,
let depthWrite = true; );
switch (props.type) { return jsxTree(gltf.scene, {
case ArmorType.Primary: mesh(mesh, props, key) {
if (x > 1) { if (!(mesh.material instanceof Material)) {
color = new Color(clamp(2 - x, 0.5, 1), 0, 0); return null;
} else {
color = new Color(-((1 - x) ** 2) + 1, -(x ** 2) + 1, 0);
} }
opacity = 1;
break;
case ArmorType.Spaced: const armorName = mesh.material.name;
color = new Color( const armorPlate = groupArmor.armors[armorName];
clamp(1 - (7 / 8) * xClamped, 0, 1),
0, if (armorPlate === undefined) {
clamp(1 - (1 / 8) * xClamped, 0, 1), console.warn(`Missing armor: ${armorName}`);
return null;
}
const x = armorPlate.thickness / thicknessRange;
const xClamped = clamp(x, 0, 1);
const material = new MeshStandardMaterial();
switch (armorPlate.type) {
case 'Armor':
if (!showArmor) return null;
if (x > 1) {
material.color = new Color(clamp(2 - x, 0.5, 1), 0, 0);
} else {
material.color = new Color(-((1 - x) ** 2) + 1, -(x ** 2) + 1, 0);
}
material.opacity = 1;
break;
case 'ArmorScreen':
if (!showArmorScreen) return null;
material.color = new Color(
clamp(1 - (7 / 8) * xClamped, 0, 1),
0,
clamp(1 - (1 / 8) * xClamped, 0, 1),
);
material.opacity = clamp(x + 1 / 2, 0, 1);
break;
default:
if (!showModules) return null;
material.color = moduleColor;
material.opacity = 1 / 2;
break;
}
const outlineMaterial = new LineBasicMaterial({
color: material.color.clone(),
});
switch (armorPlate.type) {
case 'Armor':
outlineMaterial.color.multiplyScalar(0.5);
break;
case 'ArmorScreen':
outlineMaterial.color.multiplyScalar(4);
break;
default:
outlineMaterial.color.multiplyScalar(0.5);
break;
}
material.opacity = clamp(material.opacity, 0, 1);
material.transparent = material.opacity < 1;
return (
<Fragment key={key}>
<mesh {...props} material={material} />
<lineSegments material={outlineMaterial}>
<edgesGeometry args={[props.geometry, 45]} />
</lineSegments>
</Fragment>
); );
opacity = clamp(x + 1 / 2, 0, 1); },
break; });
case ArmorType.External:
color = externalModuleColor;
opacity = 1 / 8;
depthWrite = false;
break;
}
opacity = clamp(opacity, 0, 1);
const surfaceMaterial = useMemo(
() =>
new MeshStandardMaterial({
color,
opacity,
transparent: opacity < 1,
depthWrite,
...(props.clip ? { clippingPlanes: [props.clip] } : {}),
}),
[thickness],
);
const outlineMaterial = useMemo(
() =>
new LineBasicMaterial({
color: color
.clone()
.multiplyScalar(props.type === ArmorType.Spaced ? 2 ** 2 : 2 ** -1),
}),
[thickness],
);
useEffect(() => {
function handleHighlightArmor(selectedName?: string) {
if (selectedName === undefined) {
// nothing selected, go back to defaults
surfaceMaterial.opacity = opacity;
surfaceMaterial.transparent = opacity < 1;
surfaceMaterial.color = color;
surfaceMaterial.depthWrite = props.type !== ArmorType.External;
surfaceMaterial.side = FrontSide;
outlineMaterial.visible = true;
} else if (
selectedName === name ||
(name.startsWith('chassis_') && selectedName.startsWith('chassis_')) ||
(name.startsWith('gun_') &&
selectedName.startsWith('gun_') &&
!name.includes('_armor_') &&
!selectedName.includes('_armor_'))
) {
// this selected, stand out!
surfaceMaterial.opacity = 1;
surfaceMaterial.transparent = false;
surfaceMaterial.color = color;
surfaceMaterial.depthWrite = true;
surfaceMaterial.side = DoubleSide;
outlineMaterial.visible = true;
} else {
// something else selected, become background
surfaceMaterial.opacity = 1 / 4;
surfaceMaterial.transparent = true;
surfaceMaterial.color = unselectedColor;
surfaceMaterial.depthWrite = props.type !== ArmorType.External;
surfaceMaterial.side = FrontSide;
outlineMaterial.visible = false;
}
surfaceMaterial.needsUpdate = true;
}
const unsubscribes = [
tankopediaEphemeralStore.subscribe(
(state) => state.highlightArmor?.name,
handleHighlightArmor,
),
];
if (props.clip) {
/**
* hook inside an if statement?? don't panic! I assure you the clip prop
* never mutates :)
*/
const { clip } = props;
const gunOrigin = unrotateDavaVector(props.gunOrigin.clone());
const neckOrigin = unrotateDavaVector(props.hullOrigin.clone()).add(
unrotateDavaVector(props.turretOrigin.clone()),
);
const barrelOrigin = neckOrigin.clone().add(gunOrigin);
const distanceToBarrel = clip.distanceToPoint(barrelOrigin);
const point = new Vector3();
function handleModelTransform(data: ModelTransformEventData) {
clip.normal
.set(0, 0, -1)
.applyAxisAngle(I_HAT, data.pitch)
.applyAxisAngle(J_HAT, data.yaw ?? 0);
clip.constant = 0;
point
.copy(gunOrigin)
.applyAxisAngle(J_HAT, data.yaw ?? 0)
.add(clip.normal.multiplyScalar(-distanceToBarrel))
.add(neckOrigin);
clip.normal.normalize();
clip.constant -= clip.distanceToPoint(point);
}
modelTransformEvent.on(handleModelTransform);
unsubscribes.push(() => modelTransformEvent.off(handleModelTransform));
}
return () => {
unsubscribes.forEach((unsubscribe) => unsubscribe());
};
}, [thickness]);
return (
<>
{jsxTree(node, {
mesh: {
material: surfaceMaterial,
onPointerDown,
userData: {
type: props.type,
variant: props.type === ArmorType.External ? props.variant : 'gun',
thickness,
} satisfies ArmorUserData,
onClick(event) {
if (discardClippingPlane(event.object, event.point)) return;
event.stopPropagation();
const { editStatic } = tankopediaEphemeralStore.getState();
const bounds = new Box3().setFromObject(event.object);
const point = bounds.min
.clone()
.add(bounds.max)
.divideScalar(2)
.setY(bounds.max.y);
const cameraNormal = camera.position.clone().sub(point).normalize();
const surfaceNormal = event
.normal!.clone()
.applyQuaternion(
event.object.getWorldQuaternion(new Quaternion()),
);
const angle = surfaceNormal.angleTo(cameraNormal);
const thicknessAngled = thickness / Math.sin(Math.PI / 2 - angle);
mutateTankopediaEphemeralStore((draft) => {
draft.highlightArmor = {
type: props.type,
name,
point,
thickness,
thicknessAngled,
angle,
color: `#${color.getHexString()}`,
editingPlate: editStatic,
};
});
},
},
})}
{node instanceof Mesh && (
<lineSegments material={outlineMaterial}>
<edgesGeometry args={[node.geometry, 45]} />
</lineSegments>
)}
</>
);
} }
@@ -6,6 +6,8 @@ import { spacedArmorRenderTarget } from './components/PrimaryArmorSceneComponent
import { SpacedArmorScene } from './components/SpacedArmorScene'; import { SpacedArmorScene } from './components/SpacedArmorScene';
export const Armor = memo(() => { export const Armor = memo(() => {
return <SpacedArmorScene scene={new Scene()} />;
const [spacedArmorScene] = useState(() => new Scene()); const [spacedArmorScene] = useState(() => new Scene());
const [primaryArmorScene] = useState(() => new Scene()); const [primaryArmorScene] = useState(() => new Scene());
const spacedArmorPortal = createPortal( const spacedArmorPortal = createPortal(
@@ -0,0 +1,43 @@
import { asset, TankArmor, type Tank } from '@blitzkit/core';
import { useLoader } from '@react-three/fiber';
import { Material, MeshBasicMaterial } from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
import { randInt } from 'three/src/math/MathUtils.js';
import { jsxTree } from '../core/blitzkit/jsxTree';
interface ArmorGroupProps {
tank: Tank;
armor: TankArmor;
group: string;
}
export function ArmorGroup({ tank, armor, group }: ArmorGroupProps) {
const gltf = useLoader(
GLTFLoader,
asset(`/tanks/${tank.id}/collision/hull.glb`),
);
return jsxTree(gltf.scene, {
mesh: (mesh) => {
return {
material: new MeshBasicMaterial({
color: `rgb(${randInt(0, 255)}, ${randInt(0, 255)}, ${randInt(
0,
255,
)})`,
}),
onClick: (event) => {
if (!(mesh.material instanceof Material)) return;
event.stopPropagation();
const armorName = mesh.material.name;
const penetrationGroup = armor.groups[group];
const thickness = penetrationGroup.armors[armorName];
console.log(tank.id, armorName, penetrationGroup, thickness);
},
};
},
});
}
@@ -81,7 +81,7 @@ export function Body({ stats }: BodyProps) {
<CompareRow stats={stats} value="dpm" decimals={0} /> <CompareRow stats={stats} value="dpm" decimals={0} />
<CompareRow <CompareRow
stats={stats} stats={stats}
name={strings.website.tools.tankopedia.characteristics.values.reload} name={strings.website.tools.tanks.characteristics.values.reload}
deltaType="lowerIsBetter" deltaType="lowerIsBetter"
value={(stats) => value={(stats) =>
stats.shellReload ?? stats.shellReload ??
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff. Show more