mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
Compare commits
170
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d75a51660e | ||
|
|
ac1323a463 | ||
|
|
292f7aeac0 | ||
|
|
1ee232d104 | ||
|
|
1d301bf2fb | ||
|
|
2a8ca6d36f | ||
|
|
ed5d2e3ff4 | ||
|
|
b2684e3152 | ||
|
|
d078454711 | ||
|
|
6aae1c8ee0 | ||
|
|
a560a37a56 | ||
|
|
41486f84d4 | ||
|
|
29b12c7c28 | ||
|
|
2a3583a474 | ||
|
|
eb5e2a935c | ||
|
|
75f6f133ca | ||
|
|
f26711bad9 | ||
|
|
a8dc3313cf | ||
|
|
8087752172 | ||
|
|
cb03a86cce | ||
|
|
838ce7f35d | ||
|
|
e6f9b07b20 | ||
|
|
8afc334aa7 | ||
|
|
c7017a7a15 | ||
|
|
f1462162f4 | ||
|
|
da4c2ece32 | ||
|
|
80325aa3b2 | ||
|
|
3b937a6f35 | ||
|
|
7a8f88f224 | ||
|
|
5982fdde8c | ||
|
|
dcd7ce61f7 | ||
|
|
43021c4945 | ||
|
|
4b24cf313b | ||
|
|
d785588cf9 | ||
|
|
dd9b34ea34 | ||
|
|
7605e1d6f2 | ||
|
|
7f056500ca | ||
|
|
0c37550c05 | ||
|
|
1d928e8b72 | ||
|
|
9e2465a6e3 | ||
|
|
b061bfd267 | ||
|
|
a90e5e20ea | ||
|
|
5fcade3efa | ||
|
|
f1bb5736c0 | ||
|
|
9b45f21457 | ||
|
|
62fb80dddc | ||
|
|
ff0cac84e1 | ||
|
|
cbd2c2a719 | ||
|
|
5b16e22750 | ||
|
|
3a32624823 | ||
|
|
46374a7a26 | ||
|
|
b856268ee0 | ||
|
|
e60bbc03d2 | ||
|
|
30b18f60be | ||
|
|
754dff72b9 | ||
|
|
ef7655ab5d | ||
|
|
9491e7651a | ||
|
|
cccd96a021 | ||
|
|
16a54ea291 | ||
|
|
f5c00643e4 | ||
|
|
652f36ba6c | ||
|
|
e1957daa5c | ||
|
|
222fda0c91 | ||
|
|
c9467d68ae | ||
|
|
d64f04b2c8 | ||
|
|
a98f0e84d5 | ||
|
|
6319e438b1 | ||
|
|
90a64d4ccf | ||
|
|
cb339eab5f | ||
|
|
e6a92e2114 | ||
|
|
4bfc89302f | ||
|
|
6611088ccb | ||
|
|
8d4933dd60 | ||
|
|
4b5ee9db09 | ||
|
|
cc3aa976db | ||
|
|
9fb4607bba | ||
|
|
6f8790d148 | ||
|
|
57d63ea1d7 | ||
|
|
35894f39cf | ||
|
|
18d762c41b | ||
|
|
6ca74e2b83 | ||
|
|
56ca3e5ed4 | ||
|
|
2c059cdc59 | ||
|
|
b0d7a49b16 | ||
|
|
9dfa5a7693 | ||
|
|
e79ed0cf85 | ||
|
|
f52460e98b | ||
|
|
6a91e86b07 | ||
|
|
1fce9c1c88 | ||
|
|
6e8fdcfeef | ||
|
|
2fffd512ac | ||
|
|
16b3a59f88 | ||
|
|
ba36c600c4 | ||
|
|
9fbdaaf87f | ||
|
|
553c9d552b | ||
|
|
1b017aad48 | ||
|
|
74fefe6291 | ||
|
|
5d81b7ff5a | ||
|
|
789578f2b3 | ||
|
|
0864825513 | ||
|
|
6f11fb4a70 | ||
|
|
1567f8270c | ||
|
|
0b5d019dc8 | ||
|
|
932a04a398 | ||
|
|
05c0839936 | ||
|
|
95ae891212 | ||
|
|
3aea04b6cb | ||
|
|
1d28768bb7 | ||
|
|
14d9794f57 | ||
|
|
9cd38db684 | ||
|
|
6a5af32f6c | ||
|
|
af0b430927 | ||
|
|
8c7f851692 | ||
|
|
57a2daa5e4 | ||
|
|
63d27aec64 | ||
|
|
90c5c16b00 | ||
|
|
4d94205547 | ||
|
|
31ff50ffd8 | ||
|
|
22e4553720 | ||
|
|
8b268cb647 | ||
|
|
168a955380 | ||
|
|
37ec987a32 | ||
|
|
37b5d1c6e8 | ||
|
|
09abbbadc9 | ||
|
|
8b0f95c53d | ||
|
|
920ef6e5c4 | ||
|
|
6829ff921d | ||
|
|
c6f4a13abc | ||
|
|
67f312075a | ||
|
|
5881b5b533 | ||
|
|
aa4da2ac4e | ||
|
|
d6c1e8069d | ||
|
|
74a8df6842 | ||
|
|
157fa0c1dd | ||
|
|
0139dd45c9 | ||
|
|
9546bf5bb7 | ||
|
|
1714028e83 | ||
|
|
d178c458df | ||
|
|
415aebfd74 | ||
|
|
68fd8fcfc5 | ||
|
|
4c16af918d | ||
|
|
b16601704f | ||
|
|
3a2aa135a1 | ||
|
|
6a43773b55 | ||
|
|
fa5132aba5 | ||
|
|
c21a2bf58b | ||
|
|
55ef1ecbd8 | ||
|
|
3883eddd5d | ||
|
|
40dd752cb7 | ||
|
|
3c6ae546f6 | ||
|
|
51fe0fe41f | ||
|
|
1957d960aa | ||
|
|
7098395323 | ||
|
|
57287cea3a | ||
|
|
9158f0bb79 | ||
|
|
55e5298ba6 | ||
|
|
fcc34f7942 | ||
|
|
b70d65f37b | ||
|
|
693c3f42a6 | ||
|
|
eab868db05 | ||
|
|
5a9c463457 | ||
|
|
8119cdbb36 | ||
|
|
8ce7a205f1 | ||
|
|
e943a1af82 | ||
|
|
e4cb8b3116 | ||
|
|
4afc413d8b | ||
|
|
df93c986f9 | ||
|
|
6f9336d067 | ||
|
|
82af101f9c | ||
|
|
8e4f4c39bb |
No files matched your search
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"csharpier": {
|
||||
"version": "0.30.6",
|
||||
"commands": [
|
||||
"dotnet-csharpier"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
/submodules/
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"tabWidth": 2
|
||||
}
|
||||
@@ -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
|
||||
@@ -14,12 +14,12 @@ permissions:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref == 'refs/heads/main' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||
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 }}
|
||||
ALLOW_ROBOTS: true
|
||||
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
||||
@@ -28,6 +28,15 @@ env:
|
||||
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
||||
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 }}
|
||||
|
||||
jobs:
|
||||
@@ -35,23 +44,80 @@ jobs:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
- uses: oven-sh/setup-bun@v1
|
||||
- uses: actions/configure-pages@v5
|
||||
- name: Setup bun
|
||||
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
|
||||
|
||||
- name: Build website
|
||||
run: bun run build:website
|
||||
- name: Restore dependencies
|
||||
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
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
name: build
|
||||
path: dist/website
|
||||
|
||||
deploy-github-pages:
|
||||
@@ -67,3 +133,35 @@ jobs:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
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
@@ -1,3 +1,5 @@
|
||||
# src/BlitzKit.CLI/Protos
|
||||
|
||||
node_modules
|
||||
_node_modules
|
||||
package-lock.json
|
||||
@@ -27,4 +29,491 @@ target
|
||||
/.vercel
|
||||
/.astro
|
||||
.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
|
||||
@@ -1,3 +1,9 @@
|
||||
[submodule "submodules/blitzkit-closed"]
|
||||
path = submodules/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
|
||||
@@ -0,0 +1 @@
|
||||
/submodules/
|
||||
Vendored
+17
-1
@@ -12,6 +12,7 @@
|
||||
"APAC",
|
||||
"apcr",
|
||||
"applypatches",
|
||||
"arrayfy",
|
||||
"artefacts",
|
||||
"astrojs",
|
||||
"astrolib",
|
||||
@@ -72,6 +73,10 @@
|
||||
"dxgi",
|
||||
"echarts",
|
||||
"Everytime",
|
||||
"Exergizable",
|
||||
"Exergize",
|
||||
"Exergizing",
|
||||
"Exergy",
|
||||
"FASTNAME",
|
||||
"flexdirection",
|
||||
"FOURCC",
|
||||
@@ -118,12 +123,14 @@
|
||||
"NEGATIVEX",
|
||||
"NEGATIVEY",
|
||||
"NEGATIVEZ",
|
||||
"Newtonsoft",
|
||||
"NITROPAY",
|
||||
"nivo",
|
||||
"nmatname",
|
||||
"noout",
|
||||
"normalmap",
|
||||
"oneof",
|
||||
"Oodle",
|
||||
"oopsies",
|
||||
"Oopsy",
|
||||
"opentest",
|
||||
@@ -131,16 +138,19 @@
|
||||
"outdir",
|
||||
"outfile",
|
||||
"ownedtanks",
|
||||
"paks",
|
||||
"partytown",
|
||||
"PIXELFORMAT",
|
||||
"playerachievements",
|
||||
"playerinfo",
|
||||
"playform",
|
||||
"Playtest",
|
||||
"pngjs",
|
||||
"POSITIVEX",
|
||||
"POSITIVEY",
|
||||
"POSITIVEZ",
|
||||
"precompute",
|
||||
"preforged",
|
||||
"Promisable",
|
||||
"proto",
|
||||
"protobuf",
|
||||
@@ -148,6 +158,7 @@
|
||||
"Pyogenics",
|
||||
"ratingleaderboard",
|
||||
"raycaster",
|
||||
"regen",
|
||||
"researchable",
|
||||
"Resvg",
|
||||
"rizz",
|
||||
@@ -185,7 +196,9 @@
|
||||
"tresabhi",
|
||||
"tungstentip",
|
||||
"TYPELESS",
|
||||
"uasset",
|
||||
"ubjson",
|
||||
"uexp",
|
||||
"Unicum",
|
||||
"UNLOCALIZED",
|
||||
"UNORM",
|
||||
@@ -193,7 +206,9 @@
|
||||
"Unregistering",
|
||||
"unrotate",
|
||||
"unwrapper",
|
||||
"Usmap",
|
||||
"vercel",
|
||||
"Verts",
|
||||
"vickers",
|
||||
"vitepress",
|
||||
"Vovko",
|
||||
@@ -221,5 +236,6 @@
|
||||
"deno.unstable": false,
|
||||
"cSpell.enableFiletypes": ["glsl", "proto3"],
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||
"liveServer.settings.multiRootWorkspaceName": "blitzkit"
|
||||
"liveServer.settings.multiRootWorkspaceName": "blitzkit",
|
||||
"dotnet.defaultSolution": "blitzkit.sln"
|
||||
}
|
||||
Vendored
+41
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
Blitz/Content/Paks/pakchunk0-Windows.pak
|
||||
+8
-3
@@ -13,6 +13,7 @@
|
||||
"build:averages": "bun --filter=@blitzkit/scripts run build:averages",
|
||||
"build:bot": "cd packages/scripts && bun run build:bot",
|
||||
"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:sitemap": "bun scripts/sitemap.ts",
|
||||
"build:docs": "vitepress build docs",
|
||||
@@ -21,7 +22,6 @@
|
||||
"start:bot": "bun dist/bot/main.js",
|
||||
"dev:docs": "vitepress dev docs",
|
||||
"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:patches": "bun --filter=@blitzkit/scripts run setup:patches",
|
||||
"start:website": "bun --filter=@blitzkit/website run start",
|
||||
@@ -32,11 +32,16 @@
|
||||
"update": "yarn upgrade --latest",
|
||||
"tunnel": "cloudflared tunnel --url http://localhost:3000",
|
||||
"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",
|
||||
"build:reviews": "cd packages/scripts && bun build:reviews",
|
||||
"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",
|
||||
"dependencies": {
|
||||
|
||||
@@ -46,4 +46,9 @@ export * from './votes';
|
||||
export * from './createDefaultProvisions';
|
||||
export * from './metaSortTank';
|
||||
export * from './romanize';
|
||||
export * from './tank';
|
||||
export * from './tankArmor';
|
||||
export * from './tankModel';
|
||||
export * from './tanks';
|
||||
export * from './tanksFull';
|
||||
export * from './youtubers';
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,14 +1,20 @@
|
||||
// @ts-nocheck
|
||||
export * from './average_definitions.ts';
|
||||
export * from './camouflage_definitions.ts';
|
||||
export * from './consumable_definitions.ts';
|
||||
export * from './equipment_definitions.ts';
|
||||
export * from './game_definitions.ts';
|
||||
export * from './i18n.ts';
|
||||
export * from './map_definitions.ts';
|
||||
export * from './model_definitions.ts';
|
||||
export * from './provision_definitions.ts';
|
||||
export * from './rating_leaderboard.ts';
|
||||
export * from './legacy_average_definitions.ts';
|
||||
export * from './legacy_camouflage_definitions.ts';
|
||||
export * from './legacy_consumable_definitions.ts';
|
||||
export * from './legacy_equipment_definitions.ts';
|
||||
export * from './legacy_game_definitions.ts';
|
||||
export * from './legacy_i18n.ts';
|
||||
export * from './legacy_map_definitions.ts';
|
||||
export * from './legacy_model_definitions.ts';
|
||||
export * from './legacy_provision_definitions.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 './skill_definitions.ts';
|
||||
export * from './tank_definitions.ts';
|
||||
export * from './tank.ts';
|
||||
export * from './tank_armor.ts';
|
||||
export * from './tank_model.ts';
|
||||
export * from './tanks.ts';
|
||||
export * from './tanks_full.ts';
|
||||
export * from './utils.ts';
|
||||
File renamed without changes.
+1
-1
@@ -2,7 +2,7 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/average_definitions.proto
|
||||
// source: packages/core/src/protos/legacy_average_definitions.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
+1
-1
@@ -2,7 +2,7 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/i18n.proto";
|
||||
import "packages/core/src/protos/legacy_i18n.proto";
|
||||
|
||||
message CamouflageDefinitions {
|
||||
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;
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/i18n.proto";
|
||||
import "packages/core/src/protos/legacy_i18n.proto";
|
||||
|
||||
message ConsumableDefinitions {
|
||||
map<uint32, Consumable> consumables = 1;
|
||||
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -2,7 +2,7 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/i18n.proto";
|
||||
import "packages/core/src/protos/legacy_i18n.proto";
|
||||
|
||||
message EquipmentDefinitions {
|
||||
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;
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/i18n.proto";
|
||||
import "packages/core/src/protos/legacy_i18n.proto";
|
||||
|
||||
message GameDefinitions {
|
||||
required string version = 1;
|
||||
+160
-67
@@ -2,13 +2,13 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/game_definitions.proto
|
||||
// source: packages/core/src/protos/legacy_game_definitions.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { I18nString, createBaseI18nString } from "./i18n";
|
||||
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
||||
import { I18nString, createBaseI18nString } from './legacy_i18n';
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
export const protobufPackage = 'blitzkit';
|
||||
|
||||
export interface GameDefinitions {
|
||||
version: string;
|
||||
@@ -37,28 +37,38 @@ export interface GameModeRole {
|
||||
}
|
||||
|
||||
function createBaseGameDefinitions(): GameDefinitions {
|
||||
return { version: "", nations: [], gameModes: {}, roles: {} };
|
||||
return { version: '', nations: [], gameModes: {}, roles: {} };
|
||||
}
|
||||
|
||||
export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
encode(message: GameDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.version !== "") {
|
||||
encode(
|
||||
message: GameDefinitions,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.version !== '') {
|
||||
writer.uint32(10).string(message.version);
|
||||
}
|
||||
for (const v of message.nations) {
|
||||
writer.uint32(18).string(v!);
|
||||
}
|
||||
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]) => {
|
||||
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;
|
||||
},
|
||||
|
||||
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;
|
||||
const message = createBaseGameDefinitions();
|
||||
while (reader.pos < end) {
|
||||
@@ -85,7 +95,10 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry3 = GameDefinitions_GameModesEntry.decode(reader, reader.uint32());
|
||||
const entry3 = GameDefinitions_GameModesEntry.decode(
|
||||
reader,
|
||||
reader.uint32(),
|
||||
);
|
||||
if (entry3.value !== undefined) {
|
||||
message.gameModes[entry3.key] = entry3.value;
|
||||
}
|
||||
@@ -96,7 +109,10 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry4 = GameDefinitions_RolesEntry.decode(reader, reader.uint32());
|
||||
const entry4 = GameDefinitions_RolesEntry.decode(
|
||||
reader,
|
||||
reader.uint32(),
|
||||
);
|
||||
if (entry4.value !== undefined) {
|
||||
message.roles[entry4.key] = entry4.value;
|
||||
}
|
||||
@@ -113,26 +129,36 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
|
||||
fromJSON(object: any): GameDefinitions {
|
||||
return {
|
||||
version: globalThis.String(assertSet("GameDefinitions.version", object.version)),
|
||||
nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [],
|
||||
version: globalThis.String(
|
||||
assertSet('GameDefinitions.version', object.version),
|
||||
),
|
||||
nations: globalThis.Array.isArray(object?.nations)
|
||||
? object.nations.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
gameModes: isObject(object.gameModes)
|
||||
? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>((acc, [key, value]) => {
|
||||
? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>(
|
||||
(acc, [key, value]) => {
|
||||
acc[globalThis.Number(key)] = GameMode.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
roles: isObject(object.roles)
|
||||
? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => {
|
||||
? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>(
|
||||
(acc, [key, value]) => {
|
||||
acc[globalThis.Number(key)] = GameModeRole.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GameDefinitions): unknown {
|
||||
const obj: any = {};
|
||||
if (message.version !== "") {
|
||||
if (message.version !== '') {
|
||||
obj.version = message.version;
|
||||
}
|
||||
if (message.nations?.length) {
|
||||
@@ -159,23 +185,28 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
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));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameDefinitions>, I>>(object: I): GameDefinitions {
|
||||
fromPartial<I extends Exact<DeepPartial<GameDefinitions>, I>>(
|
||||
object: I,
|
||||
): GameDefinitions {
|
||||
const message = createBaseGameDefinitions();
|
||||
message.version = object.version ?? "";
|
||||
message.version = object.version ?? '';
|
||||
message.nations = object.nations?.map((e) => e) || [];
|
||||
message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{ [key: number]: GameMode }>(
|
||||
(acc, [key, value]) => {
|
||||
message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{
|
||||
[key: number]: GameMode;
|
||||
}>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[globalThis.Number(key)] = GameMode.fromPartial(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => {
|
||||
}, {});
|
||||
message.roles = Object.entries(object.roles ?? {}).reduce<{
|
||||
[key: number]: GameModeRole;
|
||||
}>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[globalThis.Number(key)] = GameModeRole.fromPartial(value);
|
||||
}
|
||||
@@ -189,8 +220,12 @@ function createBaseGameDefinitions_GameModesEntry(): GameDefinitions_GameModesEn
|
||||
return { key: 0, value: createBaseGameMode() };
|
||||
}
|
||||
|
||||
export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> = {
|
||||
encode(message: GameDefinitions_GameModesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> =
|
||||
{
|
||||
encode(
|
||||
message: GameDefinitions_GameModesEntry,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(8).uint32(message.key);
|
||||
}
|
||||
@@ -200,8 +235,12 @@ export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameMode
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_GameModesEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
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) {
|
||||
@@ -234,8 +273,12 @@ export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameMode
|
||||
|
||||
fromJSON(object: any): GameDefinitions_GameModesEntry {
|
||||
return {
|
||||
key: globalThis.Number(assertSet("GameDefinitions_GameModesEntry.key", object.key)),
|
||||
value: GameMode.fromJSON(assertSet("GameDefinitions_GameModesEntry.value", object.value)),
|
||||
key: globalThis.Number(
|
||||
assertSet('GameDefinitions_GameModesEntry.key', object.key),
|
||||
),
|
||||
value: GameMode.fromJSON(
|
||||
assertSet('GameDefinitions_GameModesEntry.value', object.value),
|
||||
),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -250,27 +293,34 @@ export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameMode
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(base?: I): GameDefinitions_GameModesEntry {
|
||||
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 {
|
||||
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)
|
||||
message.value =
|
||||
object.value !== undefined && object.value !== null
|
||||
? GameMode.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
function createBaseGameDefinitions_RolesEntry(): GameDefinitions_RolesEntry {
|
||||
return { key: 0, value: createBaseGameModeRole() };
|
||||
}
|
||||
|
||||
export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> = {
|
||||
encode(message: GameDefinitions_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> =
|
||||
{
|
||||
encode(
|
||||
message: GameDefinitions_RolesEntry,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(8).uint32(message.key);
|
||||
}
|
||||
@@ -280,8 +330,12 @@ export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry>
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_RolesEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
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) {
|
||||
@@ -314,8 +368,12 @@ export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry>
|
||||
|
||||
fromJSON(object: any): GameDefinitions_RolesEntry {
|
||||
return {
|
||||
key: globalThis.Number(assertSet("GameDefinitions_RolesEntry.key", object.key)),
|
||||
value: GameModeRole.fromJSON(assertSet("GameDefinitions_RolesEntry.value", object.value)),
|
||||
key: globalThis.Number(
|
||||
assertSet('GameDefinitions_RolesEntry.key', object.key),
|
||||
),
|
||||
value: GameModeRole.fromJSON(
|
||||
assertSet('GameDefinitions_RolesEntry.value', object.value),
|
||||
),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -330,25 +388,33 @@ export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry>
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(base?: I): GameDefinitions_RolesEntry {
|
||||
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 {
|
||||
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)
|
||||
message.value =
|
||||
object.value !== undefined && object.value !== null
|
||||
? GameModeRole.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
function createBaseGameMode(): GameMode {
|
||||
return { name: createBaseI18nString() };
|
||||
}
|
||||
|
||||
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) {
|
||||
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 {
|
||||
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;
|
||||
const message = createBaseGameMode();
|
||||
while (reader.pos < end) {
|
||||
@@ -380,7 +447,9 @@ export const GameMode: MessageFns<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 {
|
||||
@@ -396,7 +465,8 @@ export const GameMode: MessageFns<GameMode> = {
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameMode>, I>>(object: I): GameMode {
|
||||
const message = createBaseGameMode();
|
||||
message.name = (object.name !== undefined && object.name !== null)
|
||||
message.name =
|
||||
object.name !== undefined && object.name !== null
|
||||
? I18nString.fromPartial(object.name)
|
||||
: createBaseI18nString();
|
||||
return message;
|
||||
@@ -408,7 +478,10 @@ function createBaseGameModeRole(): 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();
|
||||
for (const v of message.provisions) {
|
||||
writer.uint32(v);
|
||||
@@ -423,7 +496,8 @@ export const GameModeRole: MessageFns<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;
|
||||
const message = createBaseGameModeRole();
|
||||
while (reader.pos < end) {
|
||||
@@ -496,10 +570,14 @@ export const GameModeRole: MessageFns<GameModeRole> = {
|
||||
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));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameModeRole>, I>>(object: I): GameModeRole {
|
||||
fromPartial<I extends Exact<DeepPartial<GameModeRole>, I>>(
|
||||
object: I,
|
||||
): GameModeRole {
|
||||
const message = createBaseGameModeRole();
|
||||
message.provisions = object.provisions?.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
|
||||
: 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]> }
|
||||
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 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;
|
||||
return typeof value === 'object' && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
File renamed without changes.
@@ -2,7 +2,7 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/i18n.proto
|
||||
// source: packages/core/src/protos/legacy_i18n.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
+1
-1
@@ -2,7 +2,7 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/i18n.proto";
|
||||
import "packages/core/src/protos/legacy_i18n.proto";
|
||||
|
||||
message MapDefinitions {
|
||||
map<int32, MapDefinition> maps = 1;
|
||||
+96
-37
@@ -2,13 +2,13 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/map_definitions.proto
|
||||
// source: packages/core/src/protos/legacy_map_definitions.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { I18nString, createBaseI18nString } from "./i18n";
|
||||
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
||||
import { I18nString, createBaseI18nString } from './legacy_i18n';
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
export const protobufPackage = 'blitzkit';
|
||||
|
||||
export interface MapDefinitions {
|
||||
maps: { [key: number]: MapDefinition };
|
||||
@@ -29,15 +29,22 @@ function createBaseMapDefinitions(): 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]) => {
|
||||
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;
|
||||
},
|
||||
|
||||
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;
|
||||
const message = createBaseMapDefinitions();
|
||||
while (reader.pos < end) {
|
||||
@@ -48,7 +55,10 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry1 = MapDefinitions_MapsEntry.decode(reader, reader.uint32());
|
||||
const entry1 = MapDefinitions_MapsEntry.decode(
|
||||
reader,
|
||||
reader.uint32(),
|
||||
);
|
||||
if (entry1.value !== undefined) {
|
||||
message.maps[entry1.key] = entry1.value;
|
||||
}
|
||||
@@ -66,10 +76,13 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
|
||||
fromJSON(object: any): MapDefinitions {
|
||||
return {
|
||||
maps: isObject(object.maps)
|
||||
? Object.entries(object.maps).reduce<{ [key: number]: MapDefinition }>((acc, [key, value]) => {
|
||||
? Object.entries(object.maps).reduce<{ [key: number]: MapDefinition }>(
|
||||
(acc, [key, value]) => {
|
||||
acc[globalThis.Number(key)] = MapDefinition.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
},
|
||||
{},
|
||||
)
|
||||
: {},
|
||||
};
|
||||
},
|
||||
@@ -88,12 +101,18 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
|
||||
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));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<MapDefinitions>, I>>(object: I): MapDefinitions {
|
||||
fromPartial<I extends Exact<DeepPartial<MapDefinitions>, I>>(
|
||||
object: I,
|
||||
): MapDefinitions {
|
||||
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) {
|
||||
acc[globalThis.Number(key)] = MapDefinition.fromPartial(value);
|
||||
}
|
||||
@@ -108,7 +127,10 @@ function createBaseMapDefinitions_MapsEntry(): 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) {
|
||||
writer.uint32(8).int32(message.key);
|
||||
}
|
||||
@@ -118,8 +140,12 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions_MapsEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
decode(
|
||||
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;
|
||||
const message = createBaseMapDefinitions_MapsEntry();
|
||||
while (reader.pos < end) {
|
||||
@@ -152,8 +178,12 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
|
||||
|
||||
fromJSON(object: any): MapDefinitions_MapsEntry {
|
||||
return {
|
||||
key: globalThis.Number(assertSet("MapDefinitions_MapsEntry.key", object.key)),
|
||||
value: MapDefinition.fromJSON(assertSet("MapDefinitions_MapsEntry.value", object.value)),
|
||||
key: globalThis.Number(
|
||||
assertSet('MapDefinitions_MapsEntry.key', object.key),
|
||||
),
|
||||
value: MapDefinition.fromJSON(
|
||||
assertSet('MapDefinitions_MapsEntry.value', object.value),
|
||||
),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -168,13 +198,18 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
|
||||
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));
|
||||
},
|
||||
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();
|
||||
message.key = object.key ?? 0;
|
||||
message.value = (object.value !== undefined && object.value !== null)
|
||||
message.value =
|
||||
object.value !== undefined && object.value !== null
|
||||
? MapDefinition.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
@@ -186,7 +221,10 @@ function createBaseMapDefinition(): 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) {
|
||||
writer.uint32(8).uint32(message.id);
|
||||
}
|
||||
@@ -197,7 +235,8 @@ export const MapDefinition: MessageFns<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;
|
||||
const message = createBaseMapDefinition();
|
||||
while (reader.pos < end) {
|
||||
@@ -230,8 +269,8 @@ export const MapDefinition: MessageFns<MapDefinition> = {
|
||||
|
||||
fromJSON(object: any): MapDefinition {
|
||||
return {
|
||||
id: globalThis.Number(assertSet("MapDefinition.id", object.id)),
|
||||
name: I18nString.fromJSON(assertSet("MapDefinition.name", object.name)),
|
||||
id: globalThis.Number(assertSet('MapDefinition.id', object.id)),
|
||||
name: I18nString.fromJSON(assertSet('MapDefinition.name', object.name)),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -246,34 +285,54 @@ export const MapDefinition: MessageFns<MapDefinition> = {
|
||||
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));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<MapDefinition>, I>>(object: I): MapDefinition {
|
||||
fromPartial<I extends Exact<DeepPartial<MapDefinition>, I>>(
|
||||
object: I,
|
||||
): MapDefinition {
|
||||
const message = createBaseMapDefinition();
|
||||
message.id = object.id ?? 0;
|
||||
message.name = (object.name !== undefined && object.name !== null)
|
||||
message.name =
|
||||
object.name !== undefined && object.name !== null
|
||||
? I18nString.fromPartial(object.name)
|
||||
: createBaseI18nString();
|
||||
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
|
||||
: 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]> }
|
||||
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 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;
|
||||
return typeof value === 'object' && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
+2
-6
@@ -2,6 +2,8 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/utils.proto";
|
||||
|
||||
message ModelDefinitions {
|
||||
map<uint32, ModelDefinition> models = 1;
|
||||
}
|
||||
@@ -20,12 +22,6 @@ message Armor {
|
||||
repeated uint32 spaced = 2;
|
||||
}
|
||||
|
||||
message Vector3 {
|
||||
required float x = 1;
|
||||
required float y = 2;
|
||||
required float z = 3;
|
||||
}
|
||||
|
||||
message InitialTurretRotation {
|
||||
required float yaw = 1;
|
||||
required float pitch = 2;
|
||||
+2
-99
@@ -2,10 +2,11 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/model_definitions.proto
|
||||
// source: packages/core/src/protos/legacy_model_definitions.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Vector3, createBaseVector3 } from "./utils";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
@@ -47,12 +48,6 @@ export interface Armor_ThicknessEntry {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface Vector3 {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
export interface InitialTurretRotation {
|
||||
yaw: 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 {
|
||||
return { yaw: 0, pitch: 0, roll: 0 };
|
||||
}
|
||||
+2
-2
@@ -2,8 +2,8 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/consumable_definitions.proto";
|
||||
import "packages/core/src/protos/i18n.proto";
|
||||
import "packages/core/src/protos/legacy_consumable_definitions.proto";
|
||||
import "packages/core/src/protos/legacy_i18n.proto";
|
||||
|
||||
message ProvisionDefinitions {
|
||||
map<uint32, Provision> provisions = 1;
|
||||
+124
-54
@@ -2,14 +2,14 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/provision_definitions.proto
|
||||
// source: packages/core/src/protos/legacy_provision_definitions.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { ConsumableTankFilter } from "./consumable_definitions";
|
||||
import { I18nString, createBaseI18nString } from "./i18n";
|
||||
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
||||
import { ConsumableTankFilter } from './legacy_consumable_definitions';
|
||||
import { I18nString, createBaseI18nString } from './legacy_i18n';
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
export const protobufPackage = 'blitzkit';
|
||||
|
||||
export interface ProvisionDefinitions {
|
||||
provisions: { [key: number]: Provision };
|
||||
@@ -34,15 +34,25 @@ function createBaseProvisionDefinitions(): 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]) => {
|
||||
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;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
decode(
|
||||
input: BinaryReader | Uint8Array,
|
||||
length?: number,
|
||||
): ProvisionDefinitions {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseProvisionDefinitions();
|
||||
while (reader.pos < end) {
|
||||
@@ -53,7 +63,10 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry1 = ProvisionDefinitions_ProvisionsEntry.decode(reader, reader.uint32());
|
||||
const entry1 = ProvisionDefinitions_ProvisionsEntry.decode(
|
||||
reader,
|
||||
reader.uint32(),
|
||||
);
|
||||
if (entry1.value !== undefined) {
|
||||
message.provisions[entry1.key] = entry1.value;
|
||||
}
|
||||
@@ -71,7 +84,9 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
|
||||
fromJSON(object: any): ProvisionDefinitions {
|
||||
return {
|
||||
provisions: isObject(object.provisions)
|
||||
? Object.entries(object.provisions).reduce<{ [key: number]: Provision }>((acc, [key, value]) => {
|
||||
? Object.entries(object.provisions).reduce<{
|
||||
[key: number]: Provision;
|
||||
}>((acc, [key, value]) => {
|
||||
acc[globalThis.Number(key)] = Provision.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
@@ -93,20 +108,23 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
|
||||
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));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<ProvisionDefinitions>, I>>(object: I): ProvisionDefinitions {
|
||||
fromPartial<I extends Exact<DeepPartial<ProvisionDefinitions>, I>>(
|
||||
object: I,
|
||||
): ProvisionDefinitions {
|
||||
const message = createBaseProvisionDefinitions();
|
||||
message.provisions = Object.entries(object.provisions ?? {}).reduce<{ [key: number]: Provision }>(
|
||||
(acc, [key, value]) => {
|
||||
message.provisions = Object.entries(object.provisions ?? {}).reduce<{
|
||||
[key: number]: Provision;
|
||||
}>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[globalThis.Number(key)] = Provision.fromPartial(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
}, {});
|
||||
return message;
|
||||
},
|
||||
};
|
||||
@@ -115,8 +133,12 @@ function createBaseProvisionDefinitions_ProvisionsEntry(): ProvisionDefinitions_
|
||||
return { key: 0, value: createBaseProvision() };
|
||||
}
|
||||
|
||||
export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitions_ProvisionsEntry> = {
|
||||
encode(message: ProvisionDefinitions_ProvisionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitions_ProvisionsEntry> =
|
||||
{
|
||||
encode(
|
||||
message: ProvisionDefinitions_ProvisionsEntry,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(8).uint32(message.key);
|
||||
}
|
||||
@@ -126,8 +148,12 @@ export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitio
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions_ProvisionsEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
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) {
|
||||
@@ -160,8 +186,12 @@ export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitio
|
||||
|
||||
fromJSON(object: any): ProvisionDefinitions_ProvisionsEntry {
|
||||
return {
|
||||
key: globalThis.Number(assertSet("ProvisionDefinitions_ProvisionsEntry.key", object.key)),
|
||||
value: Provision.fromJSON(assertSet("ProvisionDefinitions_ProvisionsEntry.value", object.value)),
|
||||
key: globalThis.Number(
|
||||
assertSet('ProvisionDefinitions_ProvisionsEntry.key', object.key),
|
||||
),
|
||||
value: Provision.fromJSON(
|
||||
assertSet('ProvisionDefinitions_ProvisionsEntry.value', object.value),
|
||||
),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -176,29 +206,42 @@ export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitio
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<ProvisionDefinitions_ProvisionsEntry>, I>>(
|
||||
base?: I,
|
||||
): ProvisionDefinitions_ProvisionsEntry {
|
||||
return ProvisionDefinitions_ProvisionsEntry.fromPartial(base ?? ({} as any));
|
||||
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 {
|
||||
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)
|
||||
message.value =
|
||||
object.value !== undefined && object.value !== null
|
||||
? Provision.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
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> = {
|
||||
encode(message: Provision, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
encode(
|
||||
message: Provision,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.id !== 0) {
|
||||
writer.uint32(8).uint32(message.id);
|
||||
}
|
||||
@@ -221,7 +264,8 @@ export const Provision: MessageFns<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;
|
||||
const message = createBaseProvision();
|
||||
while (reader.pos < end) {
|
||||
@@ -264,7 +308,9 @@ export const Provision: MessageFns<Provision> = {
|
||||
break;
|
||||
}
|
||||
|
||||
message.include.push(ConsumableTankFilter.decode(reader, reader.uint32()));
|
||||
message.include.push(
|
||||
ConsumableTankFilter.decode(reader, reader.uint32()),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
@@ -272,7 +318,9 @@ export const Provision: MessageFns<Provision> = {
|
||||
break;
|
||||
}
|
||||
|
||||
message.exclude.push(ConsumableTankFilter.decode(reader, reader.uint32()));
|
||||
message.exclude.push(
|
||||
ConsumableTankFilter.decode(reader, reader.uint32()),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -286,10 +334,12 @@ export const Provision: MessageFns<Provision> = {
|
||||
|
||||
fromJSON(object: any): Provision {
|
||||
return {
|
||||
id: globalThis.Number(assertSet("Provision.id", object.id)),
|
||||
name: I18nString.fromJSON(assertSet("Provision.name", object.name)),
|
||||
id: globalThis.Number(assertSet('Provision.id', object.id)),
|
||||
name: I18nString.fromJSON(assertSet('Provision.name', object.name)),
|
||||
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)
|
||||
? 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 {
|
||||
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();
|
||||
message.id = object.id ?? 0;
|
||||
message.name = (object.name !== undefined && object.name !== null)
|
||||
message.name =
|
||||
object.name !== undefined && object.name !== null
|
||||
? I18nString.fromPartial(object.name)
|
||||
: createBaseI18nString();
|
||||
message.crew = object.crew ?? 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)) || [];
|
||||
message.include =
|
||||
object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
|
||||
message.exclude =
|
||||
object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
|
||||
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
|
||||
: 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]> }
|
||||
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 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;
|
||||
return typeof value === 'object' && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
File renamed without changes.
+1
-1
@@ -2,7 +2,7 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/rating_leaderboard.proto
|
||||
// source: packages/core/src/protos/legacy_rating_leaderboard.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
File renamed without changes.
+1
-1
@@ -2,7 +2,7 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/skill_definitions.proto
|
||||
// source: packages/core/src/protos/legacy_skill_definitions.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
+1
-1
@@ -2,7 +2,7 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/i18n.proto";
|
||||
import "packages/core/src/protos/legacy_i18n.proto";
|
||||
|
||||
message TankDefinitions {
|
||||
map<uint32, TankDefinition> tanks = 1;
|
||||
+1009
-432
File diff suppressed because it is too large.
Load diff
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message Tanks {
|
||||
repeated string tanks = 1;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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" }
|
||||
]
|
||||
}
|
||||
@@ -853,7 +853,14 @@
|
||||
},
|
||||
|
||||
"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",
|
||||
"button": "Find tanks",
|
||||
"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.",
|
||||
|
||||
"sandbox": {
|
||||
"dissector": {
|
||||
"name": "Dissector"
|
||||
},
|
||||
|
||||
"poses": {
|
||||
"hull_down": "Hull down",
|
||||
"face_hug": "Face hug",
|
||||
@@ -907,7 +918,7 @@
|
||||
"element": {
|
||||
"primary": "Primary",
|
||||
"spaced": "Spaced",
|
||||
"external": "External",
|
||||
"modules": "Modules",
|
||||
"gap": "Gap",
|
||||
"gun": "Gun",
|
||||
"track": "Tracks"
|
||||
@@ -929,7 +940,7 @@
|
||||
"name": "Static armor",
|
||||
"primary": "Primary",
|
||||
"spaced": "Spaced",
|
||||
"external": "External",
|
||||
"modules": "Modules",
|
||||
"edit": {
|
||||
"label": "Edit",
|
||||
"reset": "Reset"
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import { tankopediaTool } from '../../../../constants/tools';
|
||||
import { tanksTool } from '../../../../constants/tools';
|
||||
import ToolLayout from '../../../../layouts/ToolLayout.astro';
|
||||
import { Page } from './_index';
|
||||
|
||||
@@ -8,7 +8,7 @@ export { getStaticPaths } from '../../index.astro';
|
||||
const { locale } = Astro.params;
|
||||
---
|
||||
|
||||
<ToolLayout tool={tankopediaTool}>
|
||||
<ToolLayout tool={tanksTool}>
|
||||
<Page {locale} client:only="react">
|
||||
<Page {locale} slot="fallback" />
|
||||
</Page>
|
||||
File renamed without changes.
File renamed without changes.
@@ -23,6 +23,10 @@ export default defineConfig({
|
||||
outDir: '../../dist/website',
|
||||
prefetch: true,
|
||||
|
||||
build: {
|
||||
concurrency: 8,
|
||||
},
|
||||
|
||||
integrations: [
|
||||
react(),
|
||||
sitemap(),
|
||||
@@ -31,6 +35,7 @@ export default defineConfig({
|
||||
compressor(),
|
||||
playformInline(),
|
||||
],
|
||||
|
||||
vite: {
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"start": "astro dev",
|
||||
"lint": "astro check",
|
||||
"build": "astro check && astro build",
|
||||
"buildonly": "astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
@@ -21,6 +22,7 @@
|
||||
"@radix-ui/colors": "^3.0.0",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@radix-ui/themes": "^3.1.4",
|
||||
"@react-three/csg": "^4.0.0",
|
||||
"@react-three/drei": "^9.115.0",
|
||||
"@react-three/fiber": "^8.17.10",
|
||||
"compare-versions": "^6.1.1",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 706 KiB |
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 280 KiB |
File renamed without changes.
@@ -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">
|
||||
{literals(
|
||||
strings.website.tools.tankopedia.sandbox.dynamic.shot_card.stats
|
||||
strings.website.tools.tanks.sandbox.dynamic.shot_card.stats
|
||||
.ricochet_loss,
|
||||
[Math.max(-100, -50 * layer.distance).toFixed(0)],
|
||||
)}
|
||||
@@ -78,7 +78,7 @@ function LayerEntry({
|
||||
{literals(
|
||||
angle === undefined
|
||||
? strings.common.units.mm
|
||||
: strings.website.tools.tankopedia.sandbox.dynamic.shot_card
|
||||
: strings.website.tools.tanks.sandbox.dynamic.shot_card
|
||||
.stats.thickness_and_angle,
|
||||
[
|
||||
Math.round(layer.thicknessAngled).toLocaleString(locale),
|
||||
@@ -89,7 +89,7 @@ function LayerEntry({
|
||||
|
||||
<Text size="2" color="gray">
|
||||
{literals(
|
||||
strings.website.tools.tankopedia.sandbox.dynamic.shot_card.stats
|
||||
strings.website.tools.tanks.sandbox.dynamic.shot_card.stats
|
||||
.nominal,
|
||||
[Math.round(layer.thickness).toLocaleString(locale)],
|
||||
)}
|
||||
@@ -120,7 +120,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) {
|
||||
<Flex direction="column" gap="1">
|
||||
<Text color={inTitleColor} weight="bold">
|
||||
{literals(
|
||||
strings.website.tools.tankopedia.sandbox.dynamic.shot_card.status[
|
||||
strings.website.tools.tanks.sandbox.dynamic.shot_card.status[
|
||||
shot.in.status
|
||||
],
|
||||
[Math.round(shot.damage).toLocaleString(locale)],
|
||||
@@ -130,7 +130,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) {
|
||||
<Flex direction="column">
|
||||
{shot.in.layers.map((layer, index) => {
|
||||
const layerName =
|
||||
strings.website.tools.tankopedia.sandbox.dynamic.shot_card
|
||||
strings.website.tools.tanks.sandbox.dynamic.shot_card
|
||||
.element[
|
||||
layer.type === ArmorType.External
|
||||
? layer.variant
|
||||
@@ -186,7 +186,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) {
|
||||
|
||||
<Text color={outTitleColor} weight="bold">
|
||||
{literals(
|
||||
strings.website.tools.tankopedia.sandbox.dynamic.shot_card
|
||||
strings.website.tools.tanks.sandbox.dynamic.shot_card
|
||||
.status[shot.out.status],
|
||||
[Math.round(shot.damage).toLocaleString(locale)],
|
||||
)}
|
||||
@@ -195,7 +195,7 @@ export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) {
|
||||
<Flex direction="column">
|
||||
{shot.out.layers.map((layer, index) => {
|
||||
const layerName =
|
||||
strings.website.tools.tankopedia.sandbox.dynamic.shot_card
|
||||
strings.website.tools.tanks.sandbox.dynamic.shot_card
|
||||
.element[
|
||||
layer.type === ArmorType.External
|
||||
? layer.variant
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
import { memo, useRef } from 'react';
|
||||
import { Group, Plane, Scene, Vector3 } from 'three';
|
||||
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 { Scene } from 'three';
|
||||
import { arrayfy } from '../../../core/three/arrayfy';
|
||||
import { Duel } from '../../../stores/duel';
|
||||
import { ModelTankWrapper } from './ModelTankWrapper';
|
||||
import { SpacedArmorSceneComponent } from './SpacedArmorSceneComponent';
|
||||
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
|
||||
import { SpacedArmorSceneComponent } from './SpacedArmorSceneComponent/index';
|
||||
|
||||
export enum ArmorType {
|
||||
Primary,
|
||||
@@ -21,185 +14,25 @@ interface SpacedArmorSceneProps {
|
||||
scene: Scene;
|
||||
}
|
||||
|
||||
export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
||||
const wrapper = useRef<Group>(null);
|
||||
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);
|
||||
export function SpacedArmorScene({ scene }: SpacedArmorSceneProps) {
|
||||
const model = TankopediaEphemeral.use((state) => state.model);
|
||||
const turret = Duel.use((state) => state.protagonist.turret);
|
||||
const gun = Duel.use((state) => state.protagonist.gun);
|
||||
const { gltf: armorGltf } = useArmor(tank.id);
|
||||
const { gltf: modelGltf } = useModel(tank.id);
|
||||
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);
|
||||
const turretTranslation = arrayfy(model.modules[turret.id].translation);
|
||||
const gunTranslation = arrayfy(model.modules[gun.id].translation);
|
||||
|
||||
return (
|
||||
<ModelTankWrapper ref={wrapper}>
|
||||
<group position={hullOrigin}>
|
||||
{armorNodes.map((node) => {
|
||||
const isHull = node.name.startsWith('hull_');
|
||||
const isVisible = isHull;
|
||||
const armorId = nameToArmorId(node.name);
|
||||
const { spaced, thickness } = resolveArmor(
|
||||
tankModelDefinition.armor,
|
||||
armorId,
|
||||
);
|
||||
<group>
|
||||
<SpacedArmorSceneComponent group="hull" />
|
||||
<SpacedArmorSceneComponent group="chassis" />
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
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 position={turretTranslation}>
|
||||
<SpacedArmorSceneComponent group={turret.id} />
|
||||
</group>
|
||||
|
||||
{modelNodes.map((node) => {
|
||||
const isWheel = node.name.startsWith('chassis_wheel_');
|
||||
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 position={gunTranslation}>
|
||||
<SpacedArmorSceneComponent group={gun.id} />
|
||||
</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>
|
||||
</ModelTankWrapper>
|
||||
);
|
||||
});
|
||||
}
|
||||
+1
-1
@@ -7,12 +7,12 @@ import {
|
||||
Plane,
|
||||
ShaderMaterial,
|
||||
} from 'three';
|
||||
import type { ArmorUserData, ExternalModuleVariant } 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 { ArmorType } from '../../../SpacedArmorScene';
|
||||
import type { ArmorUserData, ExternalModuleVariant } from '../../_index';
|
||||
import fragmentShader from './shaders/fragment.glsl?raw';
|
||||
import vertexShader from './shaders/vertex.glsl?raw';
|
||||
|
||||
|
||||
+86
-114
@@ -1,24 +1,14 @@
|
||||
import { isExplosive, resolvePenetrationCoefficient } from '@blitzkit/core';
|
||||
import { useEffect } from 'react';
|
||||
import {
|
||||
AdditiveBlending,
|
||||
MeshBasicMaterial,
|
||||
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 { ArmorPlate } from '@blitzkit/core';
|
||||
import type { MeshProps } from '@react-three/fiber';
|
||||
import { Fragment } from 'react';
|
||||
import { AdditiveBlending, MeshBasicMaterial, ShaderMaterial } from 'three';
|
||||
import { Duel } from '../../../../../../stores/duel';
|
||||
import { TankopediaEphemeral } from '../../../../../../stores/tankopediaEphemeral';
|
||||
import { ArmorType } from '../../../SpacedArmorScene';
|
||||
import fragmentShader from './shaders/fragment.glsl?raw';
|
||||
import vertexShader from './shaders/vertex.glsl?raw';
|
||||
|
||||
interface SpacedArmorSubSpacedProps {
|
||||
node: Object3D;
|
||||
thickness: number;
|
||||
interface SpacedArmorSubSpacedProps extends MeshProps {
|
||||
armorPlate: ArmorPlate;
|
||||
}
|
||||
|
||||
const depthWriteMaterial = new MeshBasicMaterial({
|
||||
@@ -27,8 +17,8 @@ const depthWriteMaterial = new MeshBasicMaterial({
|
||||
});
|
||||
|
||||
export function SpacedArmorSubSpaced({
|
||||
node,
|
||||
thickness,
|
||||
armorPlate,
|
||||
...props
|
||||
}: SpacedArmorSubSpacedProps) {
|
||||
const tankopediaEphemeralStore = TankopediaEphemeral.useStore();
|
||||
const duelStore = Duel.useStore();
|
||||
@@ -49,107 +39,89 @@ export function SpacedArmorSubSpaced({
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
function handleShellChange() {
|
||||
const duel = duelStore.getState();
|
||||
const tankopediaEphemeral = tankopediaEphemeralStore.getState();
|
||||
const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
|
||||
// useEffect(() => {
|
||||
// function handleShellChange() {
|
||||
// const duel = duelStore.getState();
|
||||
// const tankopediaEphemeral = tankopediaEphemeralStore.getState();
|
||||
// const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
|
||||
|
||||
material.uniforms.penetration.value = shell.penetration.near;
|
||||
material.uniforms.caliber.value = shell.caliber;
|
||||
material.uniforms.ricochet.value = degToRad(
|
||||
isExplosive(shell.type) ? 90 : shell.ricochet!,
|
||||
);
|
||||
material.uniforms.normalization.value = degToRad(
|
||||
shell.normalization ?? 0,
|
||||
);
|
||||
}
|
||||
async function handleProtagonistEquipmentChange(
|
||||
equipment: EquipmentMatrix,
|
||||
) {
|
||||
const duel = duelStore.getState();
|
||||
const hasEnhancedArmor = await hasEquipment(
|
||||
110,
|
||||
duel.protagonist.tank.equipment_preset,
|
||||
equipment,
|
||||
);
|
||||
material.uniforms.thickness.value = hasEnhancedArmor
|
||||
? thickness * 1.03
|
||||
: thickness;
|
||||
}
|
||||
async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
|
||||
const duel = duelStore.getState();
|
||||
const tankopediaEphemeral = tankopediaEphemeralStore.getState();
|
||||
const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
|
||||
const penetration = shell.penetration.near;
|
||||
const hasCalibratedShells = await hasEquipment(
|
||||
103,
|
||||
duel.antagonist.tank.equipment_preset,
|
||||
equipment,
|
||||
);
|
||||
// material.uniforms.penetration.value = shell.penetration.near;
|
||||
// material.uniforms.caliber.value = shell.caliber;
|
||||
// material.uniforms.ricochet.value = degToRad(
|
||||
// isExplosive(shell.type) ? 90 : shell.ricochet!,
|
||||
// );
|
||||
// material.uniforms.normalization.value = degToRad(
|
||||
// shell.normalization ?? 0,
|
||||
// );
|
||||
// }
|
||||
// async function handleProtagonistEquipmentChange(
|
||||
// equipment: EquipmentMatrix,
|
||||
// ) {
|
||||
// const duel = duelStore.getState();
|
||||
// const hasEnhancedArmor = await hasEquipment(
|
||||
// 110,
|
||||
// duel.protagonist.tank.equipment_preset,
|
||||
// equipment,
|
||||
// );
|
||||
// material.uniforms.thickness.value = hasEnhancedArmor
|
||||
// ? thickness * 1.03
|
||||
// : thickness;
|
||||
// }
|
||||
// async function handleAntagonistEquipmentChange(equipment: EquipmentMatrix) {
|
||||
// const duel = duelStore.getState();
|
||||
// const tankopediaEphemeral = tankopediaEphemeralStore.getState();
|
||||
// const shell = tankopediaEphemeral.customShell ?? duel.antagonist.shell;
|
||||
// const penetration = shell.penetration.near;
|
||||
// const hasCalibratedShells = await hasEquipment(
|
||||
// 103,
|
||||
// duel.antagonist.tank.equipment_preset,
|
||||
// equipment,
|
||||
// );
|
||||
|
||||
material.uniforms.penetration.value =
|
||||
penetration *
|
||||
resolvePenetrationCoefficient(hasCalibratedShells, shell.type);
|
||||
}
|
||||
// material.uniforms.penetration.value =
|
||||
// penetration *
|
||||
// resolvePenetrationCoefficient(hasCalibratedShells, shell.type);
|
||||
// }
|
||||
|
||||
handleShellChange();
|
||||
handleProtagonistEquipmentChange(
|
||||
duelStore.getState().protagonist.equipmentMatrix,
|
||||
);
|
||||
handleAntagonistEquipmentChange(
|
||||
duelStore.getState().antagonist.equipmentMatrix,
|
||||
);
|
||||
// handleShellChange();
|
||||
// handleProtagonistEquipmentChange(
|
||||
// duelStore.getState().protagonist.equipmentMatrix,
|
||||
// );
|
||||
// handleAntagonistEquipmentChange(
|
||||
// duelStore.getState().antagonist.equipmentMatrix,
|
||||
// );
|
||||
|
||||
const unsubscribes = [
|
||||
duelStore.subscribe((state) => state.antagonist.shell, handleShellChange),
|
||||
tankopediaEphemeralStore.subscribe(
|
||||
(state) => state.customShell,
|
||||
handleShellChange,
|
||||
),
|
||||
duelStore.subscribe(
|
||||
(state) => state.protagonist.equipmentMatrix,
|
||||
handleProtagonistEquipmentChange,
|
||||
),
|
||||
duelStore.subscribe(
|
||||
(state) => state.antagonist.equipmentMatrix,
|
||||
handleAntagonistEquipmentChange,
|
||||
),
|
||||
];
|
||||
// const unsubscribes = [
|
||||
// duelStore.subscribe((state) => state.antagonist.shell, handleShellChange),
|
||||
// tankopediaEphemeralStore.subscribe(
|
||||
// (state) => state.customShell,
|
||||
// handleShellChange,
|
||||
// ),
|
||||
// duelStore.subscribe(
|
||||
// (state) => state.protagonist.equipmentMatrix,
|
||||
// handleProtagonistEquipmentChange,
|
||||
// ),
|
||||
// duelStore.subscribe(
|
||||
// (state) => state.antagonist.equipmentMatrix,
|
||||
// handleAntagonistEquipmentChange,
|
||||
// ),
|
||||
// ];
|
||||
|
||||
return () => {
|
||||
unsubscribes.forEach((unsubscribe) => unsubscribe());
|
||||
};
|
||||
});
|
||||
// return () => {
|
||||
// unsubscribes.forEach((unsubscribe) => unsubscribe());
|
||||
// };
|
||||
// });
|
||||
|
||||
return (
|
||||
<>
|
||||
{jsxTree(
|
||||
node,
|
||||
{
|
||||
mesh: {
|
||||
renderOrder: 2,
|
||||
material,
|
||||
onClick() {},
|
||||
userData: {
|
||||
type: ArmorType.Spaced,
|
||||
thickness,
|
||||
} satisfies ArmorUserData,
|
||||
},
|
||||
},
|
||||
`${node.uuid}-exclude`,
|
||||
)}
|
||||
|
||||
{jsxTree(
|
||||
node,
|
||||
{
|
||||
mesh: {
|
||||
renderOrder: 5,
|
||||
material: depthWriteMaterial,
|
||||
},
|
||||
},
|
||||
`${node.uuid}-include`,
|
||||
)}
|
||||
</>
|
||||
<Fragment>
|
||||
<mesh
|
||||
{...props}
|
||||
renderOrder={2}
|
||||
material={material}
|
||||
onClick={() => {}}
|
||||
userData={armorPlate}
|
||||
/>
|
||||
<mesh {...props} renderOrder={5} material={depthWriteMaterial} />
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
+64
-89
@@ -1,83 +1,42 @@
|
||||
import {
|
||||
ShellType,
|
||||
isExplosive,
|
||||
resolvePenetrationCoefficient,
|
||||
} from '@blitzkit/core';
|
||||
import { asset } from '@blitzkit/core';
|
||||
import { useGLTF } from '@react-three/drei';
|
||||
import { useThree } from '@react-three/fiber';
|
||||
import { useCallback } from 'react';
|
||||
import {
|
||||
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 { Material, MeshBasicMaterial } from 'three';
|
||||
import { jsxTree } from '../../../../core/blitzkit/jsxTree';
|
||||
import { discardClippingPlane } from '../../../../core/three/discardClippingPlane';
|
||||
import { Duel } from '../../../../stores/duel';
|
||||
import {
|
||||
type Shot,
|
||||
type ShotLayerBase,
|
||||
type ShotLayerNonExternal,
|
||||
TankopediaEphemeral,
|
||||
} from '../../../../stores/tankopediaEphemeral';
|
||||
import { ArmorType } from '../SpacedArmorScene';
|
||||
import { TankopediaEphemeral } from '../../../../stores/tankopediaEphemeral';
|
||||
import { TankopediaPersistent } from '../../../../stores/tankopediaPersistent';
|
||||
import { groupNameRegex } from '../StaticArmorSceneComponent';
|
||||
import { SpacedArmorSubExternal } from './components/SpacedArmorSubExternal';
|
||||
import { SpacedArmorSubSpaced } from './components/SpacedArmorSubSpaced';
|
||||
|
||||
type SpacedArmorSceneComponentProps = {
|
||||
node: Object3D;
|
||||
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;
|
||||
}
|
||||
);
|
||||
interface StaticArmorSceneComponentsProp {
|
||||
group: string;
|
||||
}
|
||||
|
||||
const omitMaterial = new MeshBasicMaterial({
|
||||
colorWrite: false,
|
||||
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({
|
||||
node,
|
||||
thickness,
|
||||
clip,
|
||||
...props
|
||||
}: SpacedArmorSceneComponentProps) {
|
||||
group,
|
||||
}: StaticArmorSceneComponentsProp) {
|
||||
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 shoot = useCallback(
|
||||
@@ -369,20 +328,30 @@ export function SpacedArmorSceneComponent({
|
||||
[camera],
|
||||
);
|
||||
|
||||
return jsxTree(gltf.scene, {
|
||||
mesh(mesh, props, key) {
|
||||
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;
|
||||
}
|
||||
|
||||
switch (armorPlate.type) {
|
||||
case 'Armor':
|
||||
return (
|
||||
<>
|
||||
{props.type === ArmorType.Primary &&
|
||||
jsxTree(
|
||||
node,
|
||||
{
|
||||
mesh: {
|
||||
renderOrder: 0,
|
||||
material: omitMaterial,
|
||||
userData: {
|
||||
type: ArmorType.Primary,
|
||||
thickness,
|
||||
} satisfies ArmorUserData,
|
||||
async onClick(event) {
|
||||
<mesh
|
||||
{...props}
|
||||
key={key}
|
||||
renderOrder={0}
|
||||
material={omitMaterial}
|
||||
userData={armorPlate}
|
||||
onClick={async (event) => {
|
||||
event.stopPropagation();
|
||||
const shot = (await shoot(
|
||||
event.point,
|
||||
@@ -390,24 +359,30 @@ export function SpacedArmorSceneComponent({
|
||||
true,
|
||||
))!;
|
||||
tankopediaEphemeralStore.setState({ shot });
|
||||
},
|
||||
},
|
||||
},
|
||||
node.uuid,
|
||||
)}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
{props.type === ArmorType.Spaced && (
|
||||
<SpacedArmorSubSpaced node={node} thickness={thickness} />
|
||||
)}
|
||||
case 'ArmorScreen':
|
||||
return (
|
||||
<SpacedArmorSubSpaced
|
||||
{...props}
|
||||
key={key}
|
||||
armorPlate={armorPlate}
|
||||
/>
|
||||
);
|
||||
|
||||
{props.type === ArmorType.External && (
|
||||
default:
|
||||
return null;
|
||||
return (
|
||||
<SpacedArmorSubExternal
|
||||
node={node}
|
||||
thickness={thickness}
|
||||
variant={props.variant}
|
||||
clip={clip}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,428 +1,31 @@
|
||||
import { normalizeAngleRad } from '@blitzkit/core';
|
||||
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 { arrayfy } from '../../../core/three/arrayfy';
|
||||
import { Duel } from '../../../stores/duel';
|
||||
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
|
||||
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
||||
import { ModelTankWrapper } from './ModelTankWrapper';
|
||||
import { ArmorType } from './SpacedArmorScene';
|
||||
import { StaticArmorSceneComponent } from './StaticArmorSceneComponent';
|
||||
|
||||
interface ArmorSceneProps {
|
||||
thicknessRange: ThicknessRange;
|
||||
}
|
||||
|
||||
export interface ThicknessRange {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
const wrapper = useRef<Group>(null);
|
||||
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);
|
||||
export function StaticArmor() {
|
||||
const model = TankopediaEphemeral.use((state) => state.model);
|
||||
const turret = Duel.use((state) => state.protagonist.turret);
|
||||
const gun = Duel.use((state) => state.protagonist.gun);
|
||||
const { gltf: armorGltf } = useArmor(tank.id);
|
||||
const { gltf: modelGltf } = useModel(tank.id);
|
||||
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);
|
||||
const turretTranslation = arrayfy(model.modules[turret.id].translation);
|
||||
const gunTranslation = arrayfy(model.modules[gun.id].translation);
|
||||
|
||||
return (
|
||||
<ModelTankWrapper ref={wrapper}>
|
||||
<group position={hullOrigin}>
|
||||
{armorNodes.map((node) => {
|
||||
const isHull = node.name.startsWith('hull_');
|
||||
const isVisible = isHull;
|
||||
const armorId = nameToArmorId(node.name);
|
||||
const { spaced, thickness } = resolveArmor(
|
||||
tankModelDefinition.armor,
|
||||
armorId,
|
||||
);
|
||||
<group>
|
||||
<StaticArmorSceneComponent group="hull" />
|
||||
<StaticArmorSceneComponent group="chassis" />
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
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 position={turretTranslation}>
|
||||
<StaticArmorSceneComponent group={turret.id} />
|
||||
</group>
|
||||
|
||||
{modelNodes.map((node) => {
|
||||
const isWheel = node.name.startsWith('chassis_wheel_');
|
||||
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 position={gunTranslation}>
|
||||
<StaticArmorSceneComponent group={gun.id} />
|
||||
</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>
|
||||
</ModelTankWrapper>
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -1,272 +1,123 @@
|
||||
import { I_HAT, J_HAT } from '@blitzkit/core';
|
||||
import { type MeshProps, useThree } from '@react-three/fiber';
|
||||
import { clamp } from 'lodash-es';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { asset } from '@blitzkit/core';
|
||||
import { useGLTF } from '@react-three/drei';
|
||||
import { Fragment } from 'react/jsx-runtime';
|
||||
import {
|
||||
Box3,
|
||||
Color,
|
||||
DoubleSide,
|
||||
FrontSide,
|
||||
LineBasicMaterial,
|
||||
Mesh,
|
||||
Material,
|
||||
MeshStandardMaterial,
|
||||
Object3D,
|
||||
Plane,
|
||||
Quaternion,
|
||||
Vector3,
|
||||
} from 'three';
|
||||
import { unrotateDavaVector } from '../../../core/blitz/unrotateDavaVector';
|
||||
import { clamp } from 'three/src/math/MathUtils.js';
|
||||
import { jsxTree } from '../../../core/blitzkit/jsxTree';
|
||||
import {
|
||||
type ModelTransformEventData,
|
||||
modelTransformEvent,
|
||||
} from '../../../core/blitzkit/modelTransform';
|
||||
import { discardClippingPlane } from '../../../core/three/discardClippingPlane';
|
||||
import { Duel } from '../../../stores/duel';
|
||||
import { TankopediaEphemeral } from '../../../stores/tankopediaEphemeral';
|
||||
import { ArmorType } from './SpacedArmorScene';
|
||||
import type {
|
||||
ArmorUserData,
|
||||
ExternalModuleVariant,
|
||||
} from './SpacedArmorSceneComponent';
|
||||
import type { ThicknessRange } from './StaticArmor';
|
||||
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
||||
|
||||
type StaticArmorSceneComponentProps = {
|
||||
name: 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;
|
||||
}
|
||||
);
|
||||
interface StaticArmorSceneComponentsProp {
|
||||
group: string;
|
||||
}
|
||||
|
||||
const unselectedColor = new Color(0x404040);
|
||||
const externalModuleColor = new Color(192 / 255, 192 / 255, 192 / 255);
|
||||
const moduleColor = new Color(192 / 255, 192 / 255, 192 / 255);
|
||||
export const groupNameRegex = /([a-z]+)(_\d+)?/;
|
||||
|
||||
export function StaticArmorSceneComponent({
|
||||
name,
|
||||
thickness,
|
||||
thicknessRange,
|
||||
node,
|
||||
onPointerDown,
|
||||
...props
|
||||
}: StaticArmorSceneComponentProps) {
|
||||
const mutateTankopediaEphemeralStore = TankopediaEphemeral.useMutation();
|
||||
const tankopediaEphemeralStore = TankopediaEphemeral.useStore();
|
||||
const camera = useThree((state) => state.camera);
|
||||
const x = thickness / thicknessRange.value;
|
||||
const xClamped = clamp(x, 0, 1);
|
||||
let color: Color;
|
||||
let opacity: number;
|
||||
let depthWrite = true;
|
||||
group,
|
||||
}: StaticArmorSceneComponentsProp) {
|
||||
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,
|
||||
);
|
||||
|
||||
switch (props.type) {
|
||||
case ArmorType.Primary:
|
||||
if (x > 1) {
|
||||
color = new Color(clamp(2 - x, 0.5, 1), 0, 0);
|
||||
} else {
|
||||
color = new Color(-((1 - x) ** 2) + 1, -(x ** 2) + 1, 0);
|
||||
return jsxTree(gltf.scene, {
|
||||
mesh(mesh, props, key) {
|
||||
if (!(mesh.material instanceof Material)) {
|
||||
return null;
|
||||
}
|
||||
opacity = 1;
|
||||
|
||||
const armorName = mesh.material.name;
|
||||
const armorPlate = groupArmor.armors[armorName];
|
||||
|
||||
if (armorPlate === undefined) {
|
||||
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 ArmorType.Spaced:
|
||||
color = new Color(
|
||||
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),
|
||||
);
|
||||
opacity = clamp(x + 1 / 2, 0, 1);
|
||||
material.opacity = clamp(x + 1 / 2, 0, 1);
|
||||
|
||||
break;
|
||||
|
||||
case ArmorType.External:
|
||||
color = externalModuleColor;
|
||||
opacity = 1 / 8;
|
||||
depthWrite = false;
|
||||
default:
|
||||
if (!showModules) return null;
|
||||
|
||||
material.color = moduleColor;
|
||||
material.opacity = 1 / 2;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
opacity = clamp(opacity, 0, 1);
|
||||
const outlineMaterial = new LineBasicMaterial({
|
||||
color: material.color.clone(),
|
||||
});
|
||||
|
||||
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],
|
||||
);
|
||||
switch (armorPlate.type) {
|
||||
case 'Armor':
|
||||
outlineMaterial.color.multiplyScalar(0.5);
|
||||
break;
|
||||
|
||||
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;
|
||||
case 'ArmorScreen':
|
||||
outlineMaterial.color.multiplyScalar(4);
|
||||
break;
|
||||
|
||||
default:
|
||||
outlineMaterial.color.multiplyScalar(0.5);
|
||||
break;
|
||||
}
|
||||
|
||||
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]);
|
||||
material.opacity = clamp(material.opacity, 0, 1);
|
||||
material.transparent = material.opacity < 1;
|
||||
|
||||
return (
|
||||
<>
|
||||
{jsxTree(node, {
|
||||
mesh: {
|
||||
material: surfaceMaterial,
|
||||
onPointerDown,
|
||||
userData: {
|
||||
type: props.type,
|
||||
variant: props.type === ArmorType.External ? props.variant : 'gun',
|
||||
thickness,
|
||||
} satisfies ArmorUserData,
|
||||
<Fragment key={key}>
|
||||
<mesh {...props} material={material} />
|
||||
|
||||
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]} />
|
||||
<edgesGeometry args={[props.geometry, 45]} />
|
||||
</lineSegments>
|
||||
)}
|
||||
</>
|
||||
</Fragment>
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import { spacedArmorRenderTarget } from './components/PrimaryArmorSceneComponent
|
||||
import { SpacedArmorScene } from './components/SpacedArmorScene';
|
||||
|
||||
export const Armor = memo(() => {
|
||||
return <SpacedArmorScene scene={new Scene()} />;
|
||||
|
||||
const [spacedArmorScene] = useState(() => new Scene());
|
||||
const [primaryArmorScene] = useState(() => new Scene());
|
||||
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}
|
||||
name={strings.website.tools.tankopedia.characteristics.values.reload}
|
||||
name={strings.website.tools.tanks.characteristics.values.reload}
|
||||
deltaType="lowerIsBetter"
|
||||
value={(stats) =>
|
||||
stats.shellReload ??
|
||||
|
||||
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user