From 7dca9d3244cadc3851016b9f3a6b63825ad5aa4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 9 Jun 2025 11:19:27 -0500 Subject: [PATCH 01/71] Update tankModels.ts --- packages/scripts/src/buildAssets/tankModels.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/scripts/src/buildAssets/tankModels.ts b/packages/scripts/src/buildAssets/tankModels.ts index 95901857a..e7c365497 100644 --- a/packages/scripts/src/buildAssets/tankModels.ts +++ b/packages/scripts/src/buildAssets/tankModels.ts @@ -32,9 +32,6 @@ export async function tankModels() { if (tankKey.includes('tutorial_bot')) continue; const id = toUniqueId(nation, tank.id); - - if (id !== 21777) continue; - const parameters = await readYAMLDVPL( `${DATA}/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`, ); From c6121fd4bdc470e473429f22fa65a2d5955106ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 25 Jun 2025 19:47:21 -0500 Subject: [PATCH 02/71] fix: add base --- .github/workflows/assets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/assets.yml b/.github/workflows/assets.yml index 0bef7af52..a4a37d28b 100644 --- a/.github/workflows/assets.yml +++ b/.github/workflows/assets.yml @@ -53,6 +53,7 @@ env: PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }} PUBLIC_ASSET_FAST_USER: blitzkit PUBLIC_ASSET_FAST_REPO: assets + PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }} jobs: download_client: From 51089a3e91a3961b56bd6af68f6a0d9eb054b3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 26 Jun 2025 09:55:23 -0500 Subject: [PATCH 03/71] Update tankModels.ts --- packages/scripts/src/buildAssets/tankModels.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/scripts/src/buildAssets/tankModels.ts b/packages/scripts/src/buildAssets/tankModels.ts index e7c365497..5a5895ca2 100644 --- a/packages/scripts/src/buildAssets/tankModels.ts +++ b/packages/scripts/src/buildAssets/tankModels.ts @@ -40,8 +40,6 @@ export async function tankModels() { parameters.resourcesPath.blitzModelPath.replace(/\.sc2$/, ''), ); - await writeFile('../../temp/model.glb', await nodeIO.writeBinary(model)); - changes.push({ path: `3d/tanks/models/${id}.glb`, content: Buffer.from(await nodeIO.writeBinary(model)), From 5197ebb6a707886b92361ec038e23aa435475ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 26 Jun 2025 10:21:07 -0500 Subject: [PATCH 04/71] Update Party3.astro --- packages/website/src/components/Party3.astro | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/website/src/components/Party3.astro b/packages/website/src/components/Party3.astro index 415e5b90d..294a81602 100644 --- a/packages/website/src/components/Party3.astro +++ b/packages/website/src/components/Party3.astro @@ -10,7 +10,6 @@ const PUBLIC_GOOGLE_TAG_MANAGER_ID = assertSecret( - - -{/* nitro ads */} -{ - /* - -*/ -} From cc25535c344c39d4213a38249d84329c6292bdc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 26 Jun 2025 10:26:13 -0500 Subject: [PATCH 08/71] Update Party3.astro --- packages/website/src/components/Party3.astro | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/website/src/components/Party3.astro b/packages/website/src/components/Party3.astro index 642387742..81575655e 100644 --- a/packages/website/src/components/Party3.astro +++ b/packages/website/src/components/Party3.astro @@ -1,8 +1,3 @@ ---- -import { assertSecret } from '@blitzkit/core'; ---- - -{/* google analytics */} - From 3de0c40ce341b84f20a00e3d81d101d9baec36c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 11 Jul 2025 12:27:57 -0500 Subject: [PATCH 10/71] fix: retry host --- .github/workflows/host-bot.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/host-bot.yml b/.github/workflows/host-bot.yml index d23865d31..edca72a1e 100644 --- a/.github/workflows/host-bot.yml +++ b/.github/workflows/host-bot.yml @@ -29,18 +29,24 @@ jobs: steps: - uses: oven-sh/setup-bun@v1 - # with: - # bun-version: 1.1.33 - name: Download release assets run: | - DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ + until DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ | grep "browser_download_url.*bot.zip" \ | cut -d : -f 2,3 \ - | tr -d \") - curl -L -o bot.zip $DOWNLOAD_URL + | tr -d \"); do + echo "Retrying in 5s..."; sleep 5 + done + + echo "Got URL: $DOWNLOAD_URL" + + until curl -L -o bot.zip "$DOWNLOAD_URL"; do + echo "Download failed, retrying in 5s..."; sleep 5 + done + mkdir -p dist/bot - unzip bot.zip -d dist/bot + unzip -o bot.zip -d dist/bot - name: Install sharp run: bun init -y && bun add sharp From b4b1f4e9162bcafa4b7f8273c453d9dd573b9031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 11 Jul 2025 12:28:50 -0500 Subject: [PATCH 11/71] feat: cleaner logging --- packages/scripts/src/core/github/commitMultipleFiles.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/scripts/src/core/github/commitMultipleFiles.ts b/packages/scripts/src/core/github/commitMultipleFiles.ts index 2b9804671..50655485b 100644 --- a/packages/scripts/src/core/github/commitMultipleFiles.ts +++ b/packages/scripts/src/core/github/commitMultipleFiles.ts @@ -73,12 +73,13 @@ export async function commitMultipleFiles( } if (diff.status === DiffStatus.Unchanged) { - console.log(`🔵 (${diff.change.toLocaleString()}B) ${change.path}`); + // just don't bother + // console.log(`🔵 (${diff.change.toLocaleString()}B) ${change.path}`); } else { console.log( `${ diff.status === DiffStatus.New ? '🟢' : '🟡' - } (+${diff.change.toLocaleString()}B) ${change.path}`, + } (${diff.change > 0 ? '+' : ''}${diff.change.toLocaleString()}B) ${change.path}`, ); changes.push(change); } From c1efc501343c57dfd831459017f2eeeef9ffe367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 11 Jul 2025 12:31:10 -0500 Subject: [PATCH 12/71] feat: disable popular tanks --- packages/scripts/src/buildAssets/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/scripts/src/buildAssets/index.ts b/packages/scripts/src/buildAssets/index.ts index 51483a711..dac11ccf7 100644 --- a/packages/scripts/src/buildAssets/index.ts +++ b/packages/scripts/src/buildAssets/index.ts @@ -21,7 +21,6 @@ import { gameModeBanners } from './gameModeBanners'; import { glossary } from './glossary'; import { migration } from './migration'; import { moduleIcons } from './moduleIcons'; -import { popularTanks } from './popularTanks'; import { shellIcons } from './shellIcons'; import { skillIcons } from './skillIcons'; import { tankArmors } from './tankArmors'; @@ -47,7 +46,7 @@ const methods = [ boosterIcons, tankIcons, blitzkitTankIcons, - popularTanks, + // popularTanks, glossary, ]; From 6b9fd1d392a2da324c605c2e5dd8f68c62cb4849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 11 Jul 2025 12:34:33 -0500 Subject: [PATCH 13/71] fix: time out handling --- .../scripts/src/buildAssets/blitzkitTankIcons.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/scripts/src/buildAssets/blitzkitTankIcons.ts b/packages/scripts/src/buildAssets/blitzkitTankIcons.ts index c2cb2f6f1..2170aac46 100644 --- a/packages/scripts/src/buildAssets/blitzkitTankIcons.ts +++ b/packages/scripts/src/buildAssets/blitzkitTankIcons.ts @@ -7,7 +7,6 @@ import { FileChange } from '../core/github/commitMultipleFiles'; export async function blitzkitTankIcons() { console.log('Building blitzkit tank icons...'); - console.log('Starting website dev server...'); const browser = await launch(); const page = await browser.newPage(); const tanks = Object.values((await fetchTankDefinitions()).tanks); @@ -19,12 +18,14 @@ export async function blitzkitTankIcons() { width: BLITZKIT_TANK_ICON_SIZE.width - 1, height: BLITZKIT_TANK_ICON_SIZE.height, }); - await page.goto(`http://localhost:4321/api/tankopedia/tank-icon/${id}/`, { - waitUntil: 'networkidle0', - }); - if (index === 0) { - console.log('Dev server started!'); + try { + await page.goto(`http://localhost:4321/api/tankopedia/tank-icon/${id}/`, { + waitUntil: 'networkidle0', + }); + } catch (error) { + console.error(`${id} ${name} time out`, error); + continue; } const screenshot = await page.screenshot({ From 8afafdeece51c992418d1c2f3080ca0ec6d3b49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 11 Jul 2025 18:10:46 -0500 Subject: [PATCH 14/71] Update host-bot.yml --- .github/workflows/host-bot.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/host-bot.yml b/.github/workflows/host-bot.yml index edca72a1e..442b14c37 100644 --- a/.github/workflows/host-bot.yml +++ b/.github/workflows/host-bot.yml @@ -32,17 +32,17 @@ jobs: - name: Download release assets run: | - until DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ - | grep "browser_download_url.*bot.zip" \ - | cut -d : -f 2,3 \ - | tr -d \"); do - echo "Retrying in 5s..."; sleep 5 - done - - echo "Got URL: $DOWNLOAD_URL" - - until curl -L -o bot.zip "$DOWNLOAD_URL"; do - echo "Download failed, retrying in 5s..."; sleep 5 + while true; do + DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ + | grep "browser_download_url.*bot.zip" \ + | cut -d : -f 2,3 \ + | tr -d \") + if curl -fL -o bot.zip "$DOWNLOAD_URL"; then + break + else + echo "Download failed, retrying in 5s..." + sleep 5 + fi done mkdir -p dist/bot From 64ec98149694af4bf09e3f3dafaed63dc63338b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 11 Jul 2025 18:11:54 -0500 Subject: [PATCH 15/71] Update host-bot.yml --- .github/workflows/host-bot.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/host-bot.yml b/.github/workflows/host-bot.yml index 442b14c37..e479db0bd 100644 --- a/.github/workflows/host-bot.yml +++ b/.github/workflows/host-bot.yml @@ -34,20 +34,20 @@ jobs: run: | while true; do DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ - | grep "browser_download_url.*bot.zip" \ - | cut -d : -f 2,3 \ - | tr -d \") - if curl -fL -o bot.zip "$DOWNLOAD_URL"; then - break + | jq -r '.assets[] | select(.name | endswith("bot.zip")) | .browser_download_url') + + if [[ -n "$DOWNLOAD_URL" ]]; then + if curl -fL -o bot.zip "$DOWNLOAD_URL"; then + break + else + echo "Download failed, retrying in 5s..." + fi else - echo "Download failed, retrying in 5s..." - sleep 5 + echo "Download URL not found, retrying in 5s..." fi + sleep 5 done - mkdir -p dist/bot - unzip -o bot.zip -d dist/bot - - name: Install sharp run: bun init -y && bun add sharp From 9dd057d59467be605d9b3cff27294b14ba9d2ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 11 Jul 2025 18:13:13 -0500 Subject: [PATCH 16/71] Update host-bot.yml --- .github/workflows/host-bot.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/host-bot.yml b/.github/workflows/host-bot.yml index e479db0bd..6588976a0 100644 --- a/.github/workflows/host-bot.yml +++ b/.github/workflows/host-bot.yml @@ -48,6 +48,9 @@ jobs: sleep 5 done + mkdir -p dist/bot + unzip bot.zip -d dist/bot + - name: Install sharp run: bun init -y && bun add sharp From 02ce6ba8d909db04ef3671ff3f61d41aa1ab8581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sat, 12 Jul 2025 12:46:40 -0500 Subject: [PATCH 17/71] Update index.tsx --- packages/website/src/components/TankCard/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/src/components/TankCard/index.tsx b/packages/website/src/components/TankCard/index.tsx index a0b366f82..ae508629a 100644 --- a/packages/website/src/components/TankCard/index.tsx +++ b/packages/website/src/components/TankCard/index.tsx @@ -80,7 +80,7 @@ export const TankCard = forwardRef( > {unwrap(tank.name)} From c7a7bbb809cce5322c0b9b30f3aabccf89d175ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:41:44 -0500 Subject: [PATCH 18/71] Update host-bot.yml --- .github/workflows/host-bot.yml | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/host-bot.yml b/.github/workflows/host-bot.yml index 6588976a0..447319d46 100644 --- a/.github/workflows/host-bot.yml +++ b/.github/workflows/host-bot.yml @@ -30,25 +30,14 @@ jobs: steps: - uses: oven-sh/setup-bun@v1 - - name: Download release assets - run: | - while true; do - DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ - | jq -r '.assets[] | select(.name | endswith("bot.zip")) | .browser_download_url') - - if [[ -n "$DOWNLOAD_URL" ]]; then - if curl -fL -o bot.zip "$DOWNLOAD_URL"; then - break - else - echo "Download failed, retrying in 5s..." - fi - else - echo "Download URL not found, retrying in 5s..." - fi - sleep 5 - done - - mkdir -p dist/bot + - name: Download release assets + run: | + DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ + | grep "browser_download_url.*bot.zip" \ + | cut -d : -f 2,3 \ + | tr -d \") + curl -L -o bot.zip $DOWNLOAD_URL + mkdir -p dist/bot unzip bot.zip -d dist/bot - name: Install sharp From a6d66b94f5bd401e05ea1bf44d26f45c6ec5c400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:43:27 -0500 Subject: [PATCH 19/71] Update host-bot.yml --- .github/workflows/host-bot.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/host-bot.yml b/.github/workflows/host-bot.yml index 447319d46..d23865d31 100644 --- a/.github/workflows/host-bot.yml +++ b/.github/workflows/host-bot.yml @@ -29,15 +29,17 @@ jobs: steps: - uses: oven-sh/setup-bun@v1 + # with: + # bun-version: 1.1.33 - - name: Download release assets - run: | - DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ - | grep "browser_download_url.*bot.zip" \ - | cut -d : -f 2,3 \ - | tr -d \") - curl -L -o bot.zip $DOWNLOAD_URL - mkdir -p dist/bot + - name: Download release assets + run: | + DOWNLOAD_URL=$(curl -s https://api.github.com/repos/blitzkit/blitzkit/releases/latest \ + | grep "browser_download_url.*bot.zip" \ + | cut -d : -f 2,3 \ + | tr -d \") + curl -L -o bot.zip $DOWNLOAD_URL + mkdir -p dist/bot unzip bot.zip -d dist/bot - name: Install sharp From 3b7fe0b114b60ef4933fc94b8dd40c0213d9870b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 15 Jul 2025 11:17:37 -0500 Subject: [PATCH 20/71] Update averages.yml --- .github/workflows/averages.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/averages.yml b/.github/workflows/averages.yml index b17fa7423..383d4c4a4 100644 --- a/.github/workflows/averages.yml +++ b/.github/workflows/averages.yml @@ -14,6 +14,17 @@ env: PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} PUBLIC_ASSET_FAST_USER: ${{ secrets.PUBLIC_ASSET_FAST_USER }} PUBLIC_ASSET_FAST_REPO: ${{ secrets.PUBLIC_ASSET_FAST_REPO }} + PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }} + ALLOW_ROBOTS: 'true' + WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }} + PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }} + PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }} + GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }} + WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }} + PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }} + PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }} + PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }} jobs: build: From eedd4b3f27d1f66cb051e0930c10a8f2663a3451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 15 Jul 2025 23:36:03 -0500 Subject: [PATCH 21/71] Update rating-eu.yml --- .github/workflows/rating-eu.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/rating-eu.yml b/.github/workflows/rating-eu.yml index 6f583e7c6..a0957134e 100644 --- a/.github/workflows/rating-eu.yml +++ b/.github/workflows/rating-eu.yml @@ -27,4 +27,15 @@ jobs: PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} PUBLIC_ASSET_FAST_USER: ${{ secrets.PUBLIC_ASSET_FAST_USER }} PUBLIC_ASSET_FAST_REPO: ${{ secrets.PUBLIC_ASSET_FAST_REPO }} + PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }} + ALLOW_ROBOTS: 'true' + WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }} + PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }} + PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }} + GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }} + WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }} + PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }} + PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }} + PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }} run: bun build:ratingleaderboard --region=eu From 9ed4a856bf36d2ffb8a26e43ea2380f73193a9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 15 Jul 2025 23:36:36 -0500 Subject: [PATCH 22/71] Update rating-asia.yml --- .github/workflows/rating-asia.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/rating-asia.yml b/.github/workflows/rating-asia.yml index cc81278ab..5735713a9 100644 --- a/.github/workflows/rating-asia.yml +++ b/.github/workflows/rating-asia.yml @@ -27,4 +27,15 @@ jobs: PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} PUBLIC_ASSET_FAST_USER: ${{ secrets.PUBLIC_ASSET_FAST_USER }} PUBLIC_ASSET_FAST_REPO: ${{ secrets.PUBLIC_ASSET_FAST_REPO }} + PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }} + ALLOW_ROBOTS: 'true' + WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }} + PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }} + PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }} + GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }} + WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }} + PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }} + PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }} + PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }} run: bun build:ratingleaderboard --region=asia From 2e8cac885c2930c36f4cd4cbd644bdedcca0611f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 15 Jul 2025 23:37:10 -0500 Subject: [PATCH 23/71] Update rating-na.yml --- .github/workflows/rating-na.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/rating-na.yml b/.github/workflows/rating-na.yml index 0b070d938..310b216bc 100644 --- a/.github/workflows/rating-na.yml +++ b/.github/workflows/rating-na.yml @@ -27,4 +27,15 @@ jobs: PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} PUBLIC_ASSET_FAST_USER: ${{ secrets.PUBLIC_ASSET_FAST_USER }} PUBLIC_ASSET_FAST_REPO: ${{ secrets.PUBLIC_ASSET_FAST_REPO }} + PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }} + ALLOW_ROBOTS: 'true' + WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }} + PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }} + PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }} + GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }} + WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }} + PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }} + PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }} + PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }} run: bun build:ratingleaderboard --region=com From c5cf172e42044e79985300e79512aea592add914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 15:34:22 -0500 Subject: [PATCH 24/71] fix: remove text outline, it just doesn't work --- .../HeroSection/components/TankSandbox/Title.tsx | 11 ++++------- .../src/components/Tankopedia/HeroSection/index.tsx | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title.tsx index 677e19b99..970dcd19c 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title.tsx @@ -7,7 +7,7 @@ import type { RadixColor } from '../../../../../stores/embedState'; import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral'; interface TitleProps { - outline?: boolean; + foreground?: boolean; } export const NATION_COLORS: Record< @@ -65,7 +65,7 @@ export const NATION_COLORS: Record< }, }; -export function Title({ outline }: TitleProps) { +export function Title({ foreground }: TitleProps) { const { unwrap } = useLocale(); const protagonist = Duel.use((state) => state.protagonist.tank); const disturbed = TankopediaEphemeral.use((state) => state.disturbed); @@ -103,11 +103,8 @@ export function Title({ outline }: TitleProps) { : `min(65vh, ${125 / name.length}vw)` : `min(48vh, ${75 / name.length}vw)`, whiteSpace: 'nowrap', - color: outline ? Var(`${nationColors.tint}-a2`) : color, - opacity: outline && disturbed ? 0 : 1, - WebkitTextStroke: outline - ? `${revealed ? (disturbed ? '1px' : 'min(2px, 0.2vw)') : 0} ${color}` - : undefined, + color: foreground ? Var('gray-a10') : color, + opacity: foreground && disturbed ? 0 : 1, letterSpacing: disturbed || !revealed ? 0 : '-0.03em', transition: ` letter-spacing 1.5s ${disturbed ? '' : 'cubic-bezier(.81,-2,.68,1)'}, diff --git a/packages/website/src/components/Tankopedia/HeroSection/index.tsx b/packages/website/src/components/Tankopedia/HeroSection/index.tsx index 414908bce..b51699e01 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/index.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/index.tsx @@ -136,7 +136,7 @@ export function HeroSection({ skeleton }: MaybeSkeletonComponentProps) { height: '100%', transitionDuration: '2s', opacity: revealed ? 1 : 0, - filter: disturbed ? undefined : `drop-shadow(0 0 2rem black)`, + filter: disturbed ? undefined : `drop-shadow(0 0 1rem black)`, }} > @@ -153,7 +153,7 @@ export function HeroSection({ skeleton }: MaybeSkeletonComponentProps) { - + <Title foreground /> </Flex> </Flex> ); From d7af7e19dd8555f3b4ff7df70521501a6111e9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 15:36:46 -0500 Subject: [PATCH 25/71] fix: integrated navbar --- packages/website/src/components/Navbar.astro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/website/src/components/Navbar.astro b/packages/website/src/components/Navbar.astro index 4074100fc..923f34c9b 100644 --- a/packages/website/src/components/Navbar.astro +++ b/packages/website/src/components/Navbar.astro @@ -17,7 +17,7 @@ export interface Props { integrated?: boolean; } -const { integrated } = Astro.props; +const { integrated = false } = Astro.props; const toolsFiltered = TOOLS.filter((tool) => !('href' in tool)); const { locale } = Astro.params; const branchName = resolveBranchName(locale); @@ -47,7 +47,7 @@ const strings = getStrings(locale); height: 100%; } - .navbar[data-expanded='false'] .content { + .navbar[data-expanded='false'][data-integrated='false'] .content { background-color: var(--black-a8); backdrop-filter: blur(4rem); box-shadow: var(--shadow-3); @@ -87,6 +87,7 @@ const strings = getStrings(locale); direction="column" align="center" data-expanded="false" + data-integrated={`${integrated}`} className="navbar" width="100%" top="0" From e84e15daf4c2164dc7f521ddbd4e4c460ef39ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:07:47 -0500 Subject: [PATCH 26/71] fix: missing navbar background images --- packages/website/src/components/Navbar.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/src/components/Navbar.astro b/packages/website/src/components/Navbar.astro index 923f34c9b..90d0b9a3b 100644 --- a/packages/website/src/components/Navbar.astro +++ b/packages/website/src/components/Navbar.astro @@ -233,7 +233,7 @@ const strings = getStrings(locale); <Box style={{ borderRadius: Var('radius-2'), - backgroundImage: `url(/assets/images/${tool.id}.webp)`, + backgroundImage: `url(/assets/images/tools/${tool.id}.webp)`, backgroundSize: '200%', backgroundPosition: 'right center', }} From f8b4f9372a6af13bd481c51c833499b6d693ffd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:09:08 -0500 Subject: [PATCH 27/71] fix: stop equipment definitions fetch spam --- packages/website/src/core/blitzkit/hasEquipment.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/website/src/core/blitzkit/hasEquipment.ts b/packages/website/src/core/blitzkit/hasEquipment.ts index 854af3f77..cba049c4c 100644 --- a/packages/website/src/core/blitzkit/hasEquipment.ts +++ b/packages/website/src/core/blitzkit/hasEquipment.ts @@ -1,12 +1,12 @@ -import { fetchEquipmentDefinitions } from '@blitzkit/core'; import type { EquipmentMatrix } from '../../stores/duel'; +import { awaitableEquipmentDefinitions } from '../awaitables/equipmentDefinitions'; export async function hasEquipment( id: number, equipmentPreset: string, equipmentMatrix: EquipmentMatrix, ) { - const equipmentDefinitions = await fetchEquipmentDefinitions(); + const equipmentDefinitions = await awaitableEquipmentDefinitions; const preset = equipmentDefinitions.presets[equipmentPreset]; return preset.slots.some((slot, index) => { const row = Math.floor(index / 3); From 93665df223c8c13e644808e9233f071c6beb9b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:11:16 -0500 Subject: [PATCH 28/71] feat: scrollable hero --- .../website/src/components/Tankopedia/HeroSection/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/src/components/Tankopedia/HeroSection/index.tsx b/packages/website/src/components/Tankopedia/HeroSection/index.tsx index b51699e01..e3dcc394d 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/index.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/index.tsx @@ -103,7 +103,7 @@ export function HeroSection({ skeleton }: MaybeSkeletonComponentProps) { transitionDuration: '1s', background: isFullScreen ? 'black' : undefined, }} - height={disturbed && !isFullScreen ? 'calc(100svh - 6rem)' : '100vh'} + height={!isFullScreen ? 'calc(100svh - 6rem)' : '100vh'} maxHeight={isFullScreen ? undefined : '60rem'} maxWidth={isFullScreen ? undefined : '120rem'} flexGrow="1" From af699ff5b7d3b4e3d9d1c83106071355d4bda168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:15:08 -0500 Subject: [PATCH 29/71] fix: guns don't appear transparent when moved far away from camera --- .../HeroSection/components/TankSandbox/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/index.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/index.tsx index 7133ca8a0..6ec1684d7 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/index.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/index.tsx @@ -39,11 +39,11 @@ interface TankSandboxProps { naked?: boolean; } -export const forNear0 = 20; -export const fogFar0 = 25; +export const forNear0 = 30; +export const fogFar0 = 50; export const forNear1 = 0; export const fogFar1 = 0; -export const fogAnimationTime = 1.5; +export const fogAnimationTime = 2.5; export const TankSandbox = forwardRef<HTMLCanvasElement, TankSandboxProps>( ({ thicknessRange, naked }, ref) => { @@ -74,7 +74,7 @@ export const TankSandbox = forwardRef<HTMLCanvasElement, TankSandboxProps>( const interval = setInterval(() => { const t = (Date.now() - t0) / 1000; const x = t / fogAnimationTime; - const y = Math.cbrt(-2 * Math.abs(x - 0.5)) + 1; + const y = Math.sin(Math.PI * x); const near = forNear0 + (forNear1 - forNear0) * y; const far = fogFar0 + (fogFar1 - fogFar0) * y; From fcd084a86f65ba8107a2ee5c63838d2135076ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:26:58 -0500 Subject: [PATCH 30/71] fix: tankopedia compare acknoledge selected shell --- .../components/InfoWithDelta.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx index 00747503d..b54f5739a 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx @@ -65,6 +65,11 @@ export function InfoWithDelta({ : (stats[props.value] as number); const delta = useDelta(uhWhatDoICallThisVariable); const protagonistTank = Duel.use((state) => state.protagonist.tank); + const shellIndex = Duel.use((state) => + state.protagonist.gun.gun_type!.value.base.shells.indexOf( + state.protagonist.shell, + ), + ); const others = useMemo(() => { const defaultSkills = createDefaultSkills(skillDefinitions); @@ -86,6 +91,10 @@ export function InfoWithDelta({ provisionDefinitions, ); + if (member.gun.gun_type!.value.base.shells[shellIndex] === undefined) { + return undefined; + } + return tankCharacteristics( { applyDynamicArmor: false, @@ -98,7 +107,7 @@ export function InfoWithDelta({ engine: member.engine, gun: member.gun, equipmentMatrix: member.equipmentMatrix, - shell: member.shell, + shell: member.gun.gun_type!.value.base.shells[shellIndex], stockEngine: tank.engines[0], stockGun: tank.turrets[0].guns[0], stockTrack: tank.tracks[0], @@ -115,14 +124,16 @@ export function InfoWithDelta({ ); }) .filter((tank) => { + if (tank === undefined) return false; + const othersValue = typeof props.value === 'function' ? props.value(tank)! : (tank[props.value] as number); return othersValue !== undefined; - }); - }, [relativeAgainst]); + }) as TankCharacteristics[]; + }, [relativeAgainst, shellIndex]); const betterTanks = others.filter((tank) => { const othersValue = typeof props.value === 'function' From 0e6b0087ce652c780bbb1d3d3faa93576ba98f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:27:43 -0500 Subject: [PATCH 31/71] fix: tankopedia compare acknoledge selected equipment --- .../Characteristics/components/InfoWithDelta.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx index b54f5739a..a5f74676e 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx @@ -70,6 +70,9 @@ export function InfoWithDelta({ state.protagonist.shell, ), ); + const equipmentMatrix = Duel.use( + (state) => state.protagonist.equipmentMatrix, + ); const others = useMemo(() => { const defaultSkills = createDefaultSkills(skillDefinitions); @@ -106,7 +109,7 @@ export function InfoWithDelta({ provisions: member.provisions, engine: member.engine, gun: member.gun, - equipmentMatrix: member.equipmentMatrix, + equipmentMatrix: equipmentMatrix, shell: member.gun.gun_type!.value.base.shells[shellIndex], stockEngine: tank.engines[0], stockGun: tank.turrets[0].guns[0], @@ -133,7 +136,7 @@ export function InfoWithDelta({ return othersValue !== undefined; }) as TankCharacteristics[]; - }, [relativeAgainst, shellIndex]); + }, [relativeAgainst, shellIndex, equipmentMatrix]); const betterTanks = others.filter((tank) => { const othersValue = typeof props.value === 'function' From 17755641a16d5c22298e82bec459778e8ba60255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:31:21 -0500 Subject: [PATCH 32/71] feat: sorting by he shell penetratoin --- packages/i18n/strings/en.json | 1 + .../src/components/TankSearch/components/Card.tsx | 3 +++ .../src/components/TankSearch/components/Sort.tsx | 1 + packages/website/src/components/TankSearch/index.tsx | 10 ++++++++++ .../src/stores/tankopediaPersistent/constants.ts | 1 + 5 files changed, 16 insertions(+) diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index caa25ce0f..65bdf40fc 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -790,6 +790,7 @@ "fire.caliber": "caliber", "fire.standardPenetration": "standard penetration", "fire.premiumPenetration": "premium penetration", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "damage", "fire.moduleDamage": "module damage", "fire.shellVelocity": "shell velocity", diff --git a/packages/website/src/components/TankSearch/components/Card.tsx b/packages/website/src/components/TankSearch/components/Card.tsx index f5531692a..34d9234ec 100644 --- a/packages/website/src/components/TankSearch/components/Card.tsx +++ b/packages/website/src/components/TankSearch/components/Card.tsx @@ -27,6 +27,7 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) { const gun = turret.guns.at(-1)!; const shell0 = gun.gun_type!.value.base.shells[0]; const shell1 = gun.gun_type!.value.base.shells[1]; + const shell2 = gun.gun_type!.value.base.shells[2]; const tracks = tank.tracks.at(-1)!; const engine = tank.engines.at(-1)!; const tankModelDefinition = modelDefinitions.models[tank.id]; @@ -57,6 +58,8 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) { return shell0.penetration.near.toFixed(0); case 'fire.premiumPenetration': return shell1 ? shell1.penetration.near.toFixed(0) : '--'; + case 'fire.tertiaryPenetration': + return shell1 ? shell2.penetration.near.toFixed(0) : '--'; case 'fire.shellVelocity': return shell0.velocity.toFixed(0); case 'fire.shellCapacity': diff --git a/packages/website/src/components/TankSearch/components/Sort.tsx b/packages/website/src/components/TankSearch/components/Sort.tsx index 7a43836a5..8a201c849 100644 --- a/packages/website/src/components/TankSearch/components/Sort.tsx +++ b/packages/website/src/components/TankSearch/components/Sort.tsx @@ -63,6 +63,7 @@ export function Sort() { <Item by="fire.caliber" /> <Item by="fire.standardPenetration" /> <Item by="fire.premiumPenetration" /> + <Item by="fire.tertiaryPenetration" /> <Item by="fire.damage" /> <Item by="fire.moduleDamage" /> <Item by="fire.shellVelocity" /> diff --git a/packages/website/src/components/TankSearch/index.tsx b/packages/website/src/components/TankSearch/index.tsx index 0d03cc671..1c8245725 100644 --- a/packages/website/src/components/TankSearch/index.tsx +++ b/packages/website/src/components/TankSearch/index.tsx @@ -238,6 +238,16 @@ export const TankSearch = memo<TankSearchProps>( ); break; + case 'fire.tertiaryPenetration': + sorted = filtered.sort( + (a, b) => + (a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[2] + ?.penetration.near ?? 0) - + (b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[2] + ?.penetration.near ?? 0), + ); + break; + case 'fire.damage': sorted = filtered.sort( (a, b) => diff --git a/packages/website/src/stores/tankopediaPersistent/constants.ts b/packages/website/src/stores/tankopediaPersistent/constants.ts index 49bc4bda1..52f03f645 100644 --- a/packages/website/src/stores/tankopediaPersistent/constants.ts +++ b/packages/website/src/stores/tankopediaPersistent/constants.ts @@ -14,6 +14,7 @@ export const SORT_UNITS: Record<TankopediaSortBy, string | undefined> = { 'fire.gunDepression': '°', 'fire.gunElevation': '°', 'fire.premiumPenetration': 'mm', + 'fire.tertiaryPenetration': 'mm', 'fire.reload': 's', 'fire.shellVelocity': 'm/s', 'fire.shellRange': 'm', From 4bc255a6247462ca0982860465af7a6a16851a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:36:23 -0500 Subject: [PATCH 33/71] fix: clear filters no longer shows up after searching and clearing the search bar --- .../components/TankSearch/components/SearchBar.tsx | 14 ++------------ .../website/src/components/TankSearch/index.tsx | 2 +- packages/website/src/stores/tankFilters.ts | 4 ++-- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/website/src/components/TankSearch/components/SearchBar.tsx b/packages/website/src/components/TankSearch/components/SearchBar.tsx index cdf39eb1f..5d65bcbc9 100644 --- a/packages/website/src/components/TankSearch/components/SearchBar.tsx +++ b/packages/website/src/components/TankSearch/components/SearchBar.tsx @@ -21,27 +21,17 @@ export function SearchBar({ topResult, skeleton, onSelect }: SearchBarProps) { const input = useRef<HTMLInputElement>(null); const performSearch = useCallback( debounce(() => { - // tankFiltersStore.setState({ searching: false }); $tankFilters.setKey('searching', false); if (!input.current) return; const sanitized = input.current.value.trim(); - // tankFiltersStore.setState({ - // search: sanitized.length === 0 ? undefined : sanitized, - // }); - $tankFilters.setKey( - 'search', - sanitized.length === 0 ? undefined : sanitized, - ); + $tankFilters.setKey('search', sanitized.length === 0 ? null : sanitized); }, 500), [], ); const handleChange = useCallback(() => { - // if (!tankFiltersStore.getState().searching) { - // tankFiltersStore.setState({ searching: true }); - // } if (!tankFilters.searching) { $tankFilters.setKey('searching', true); } @@ -69,7 +59,7 @@ export function SearchBar({ topResult, skeleton, onSelect }: SearchBarProps) { <TextField.Root variant="classic" disabled={skeleton} - defaultValue={tankFilters.search} + defaultValue={tankFilters.search ?? undefined} style={{ flex: 1 }} ref={input} placeholder={strings.website.common.tank_search.search_bar_hint} diff --git a/packages/website/src/components/TankSearch/index.tsx b/packages/website/src/components/TankSearch/index.tsx index 1c8245725..58559fe76 100644 --- a/packages/website/src/components/TankSearch/index.tsx +++ b/packages/website/src/components/TankSearch/index.tsx @@ -60,7 +60,7 @@ export const TankSearch = memo<TankSearchProps>( const tankFilters = useStore($tankFilters); const tankopediaSort = useStore($tankopediaSort); const tanksFiltered = useMemo(() => { - if (tankFilters.search === undefined) { + if (tankFilters.search === null) { const filtered = awaitedTanksDefinitionsArray.filter((tank) => filterTank(tankFilters, tank), ); diff --git a/packages/website/src/stores/tankFilters.ts b/packages/website/src/stores/tankFilters.ts index a2ba14df9..14eaac227 100644 --- a/packages/website/src/stores/tankFilters.ts +++ b/packages/website/src/stores/tankFilters.ts @@ -18,7 +18,7 @@ export interface TankFilters { classes: TankClass[]; types: TankType[]; testing: 'include' | 'exclude' | 'only'; - search?: string; + search: string | null; searching: boolean; gunType: CaseType<GunDefinition>[]; shells: [ShellType | null, ShellType | null, ShellType | null]; @@ -30,7 +30,7 @@ export const initialTankFilters: TankFilters = { classes: [], types: [], testing: 'include', - search: undefined, + search: null, searching: false, gunType: [], shells: [null, null, null], From 4858f31da4157b6845228dedcc8082d834382123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:42:22 -0500 Subject: [PATCH 34/71] feat: logs --- docs/changelogs/1.27.12.md | 18 ++++++++++++++++++ package.json | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 docs/changelogs/1.27.12.md diff --git a/docs/changelogs/1.27.12.md b/docs/changelogs/1.27.12.md new file mode 100644 index 000000000..05ecc0f58 --- /dev/null +++ b/docs/changelogs/1.27.12.md @@ -0,0 +1,18 @@ +# BlitzKit 1.27.12 + +This update only affects the website. + +## Features + +- Added the ability to sort by HE shell penetration +- The Tankopedia compare bars now account for equipment and selected shells +- Made the hero section of the Tankopedia a bit shorter to show users that the page is scrollable + +## Fixes + +- The "Clear filters" button no longer shows up after clearing the search bar +- Guns for some tanks no longer go transparent when far away from the camera +- The dynamic armor tab no longer lags and flickers when rotating the turret of a tank +- Reimplemented the missing tool backgrounds in the navigation bar hamburger menu +- The navigation bar now properly goes transparent for pages that request like the Tankopedia pages +- Removed the tank name text outline because it doesn't work on most devices diff --git a/package.json b/package.json index 30dbbe6d9..e91c5e6a9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "blitzkit", "private": true, - "version": "1.27.11", + "version": "1.27.12", "description": "🎉 Tools for everything World of Tanks Blitz", "type": "module", "types": "./types.d.ts", From 275ddcc7a617f0264f9aa81ac499a47c6fcb00e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:54:42 -0500 Subject: [PATCH 35/71] New Crowdin updates (#157) --- packages/i18n/strings/es.json | 1 + packages/i18n/strings/fr.json | 1 + packages/i18n/strings/ja.json | 1 + packages/i18n/strings/pl.json | 3 ++- packages/i18n/strings/pt.json | 1 + packages/i18n/strings/ru.json | 1 + packages/i18n/strings/uk.json | 15 ++++++++------- packages/i18n/strings/zh.json | 35 ++++++++++++++++++----------------- 8 files changed, 33 insertions(+), 25 deletions(-) diff --git a/packages/i18n/strings/es.json b/packages/i18n/strings/es.json index 6ba418653..bbc9f70ce 100644 --- a/packages/i18n/strings/es.json +++ b/packages/i18n/strings/es.json @@ -698,6 +698,7 @@ "fire.caliber": "calibre", "fire.standardPenetration": "penetración estándar", "fire.premiumPenetration": "penetración prémium", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "daño", "fire.moduleDamage": "daño al módulo", "fire.shellVelocity": "velocidad del proyectil", diff --git a/packages/i18n/strings/fr.json b/packages/i18n/strings/fr.json index d183a3ade..c8df1fee6 100644 --- a/packages/i18n/strings/fr.json +++ b/packages/i18n/strings/fr.json @@ -698,6 +698,7 @@ "fire.caliber": "caliber", "fire.standardPenetration": "standard penetration", "fire.premiumPenetration": "premium penetration", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "damage", "fire.moduleDamage": "module damage", "fire.shellVelocity": "shell velocity", diff --git a/packages/i18n/strings/ja.json b/packages/i18n/strings/ja.json index a73997df6..bd3efe151 100644 --- a/packages/i18n/strings/ja.json +++ b/packages/i18n/strings/ja.json @@ -698,6 +698,7 @@ "fire.caliber": "砲口径", "fire.standardPenetration": "通常弾貫通力", "fire.premiumPenetration": "課金弾貫通力", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "ダメージ", "fire.moduleDamage": "モジュールダメージ", "fire.shellVelocity": "弾速", diff --git a/packages/i18n/strings/pl.json b/packages/i18n/strings/pl.json index b95971eda..6fdf2de7e 100644 --- a/packages/i18n/strings/pl.json +++ b/packages/i18n/strings/pl.json @@ -380,7 +380,7 @@ }, "embeds": { "name": "osadzenie", - "description": "Jak działa osadzanie" + "description": "Jak działają osadzone" }, "introduction": { "name": "wprowadzenie", @@ -698,6 +698,7 @@ "fire.caliber": "caliber", "fire.standardPenetration": "standard penetration", "fire.premiumPenetration": "premium penetration", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "damage", "fire.moduleDamage": "module damage", "fire.shellVelocity": "shell velocity", diff --git a/packages/i18n/strings/pt.json b/packages/i18n/strings/pt.json index 7e4567e19..a4eeac78c 100644 --- a/packages/i18n/strings/pt.json +++ b/packages/i18n/strings/pt.json @@ -698,6 +698,7 @@ "fire.caliber": "calibre", "fire.standardPenetration": "penetração padrão", "fire.premiumPenetration": "penetração premium", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "dano", "fire.moduleDamage": "dano a módulos", "fire.shellVelocity": "velocidade do projétil", diff --git a/packages/i18n/strings/ru.json b/packages/i18n/strings/ru.json index ef6a4ee65..15f0ff429 100644 --- a/packages/i18n/strings/ru.json +++ b/packages/i18n/strings/ru.json @@ -698,6 +698,7 @@ "fire.caliber": "калибр", "fire.standardPenetration": "базовое пробитие", "fire.premiumPenetration": "улучшенное пробитие ", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "урон", "fire.moduleDamage": "урон по модулям", "fire.shellVelocity": "скорость снаряда", diff --git a/packages/i18n/strings/uk.json b/packages/i18n/strings/uk.json index 11abffc29..3d39e23a5 100644 --- a/packages/i18n/strings/uk.json +++ b/packages/i18n/strings/uk.json @@ -2,7 +2,7 @@ "test": { "default": "тест", "long": "This is a long test string. You MUST NEVER see this in the UI. My favorite fruit is %s1 because it has the color of %s2. I like it so much that I will say its name 3 times! %s1! %s1! %s1! Once again, it's %s2, not %s3.", - "fox": "The quick brown fox jumps over the lazy dog." + "fox": "Швидка бура лисиця перестрибує через лінивого собаку." }, "common": { "units": { @@ -12,7 +12,7 @@ "hp": "%s1хп", "x": "х%s1", "percentage": "%s1%", - "deg_s": "%s1°/s" + "deg_s": "%s1°/с" }, "gun_types": { "auto_loader": "Магазинна система заряджання", @@ -413,10 +413,10 @@ } }, "debug": { - "name": "debug", - "description": "Debug information about the bot", + "name": "налагодження", + "description": "Інформація про налагодження бота", "body": { - "title": "# Debug\n\n", + "title": "# Налагодження\n\n", "version": "Версія", "shard": { "label": "Уламок", @@ -499,7 +499,7 @@ }, "embed": { "title": "Невірний обліковий запис?", - "description": "Use the command again and select a username from the search results." + "description": "Використайте команду ще раз і виберіть ім'я користувача з результатів пошуку." } }, "search_clans": { @@ -508,7 +508,7 @@ "options": { "limit": { "name": "ліміт", - "description": "The max number of clan results (default: %s1)" + "description": "Максимальна кількість результатів клану (за замовчуванням: %s1)" } }, "body": { @@ -698,6 +698,7 @@ "fire.caliber": "калібр", "fire.standardPenetration": "базове пробиття", "fire.premiumPenetration": "преміум пробиття", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "шкода", "fire.moduleDamage": "шкода по модулях", "fire.shellVelocity": "швидкість польоту снаряда", diff --git a/packages/i18n/strings/zh.json b/packages/i18n/strings/zh.json index 1339e35ae..bfd828d71 100644 --- a/packages/i18n/strings/zh.json +++ b/packages/i18n/strings/zh.json @@ -41,15 +41,15 @@ "preview": "预览" }, "locales": { - "en": "英文", - "es": "西班牙文", - "pt": "葡萄牙文", - "ru": "俄文", - "uk": "乌克兰文", + "en": "英语", + "es": "西班牙语", + "pt": "葡萄牙语", + "ru": "俄语", + "uk": "乌克兰语", "zh": "中文", - "ja": "日文", - "fr": "法文", - "pl": "波兰文" + "ja": "日语", + "fr": "法语", + "pl": "波兰语" }, "wn8_percentile": { "0": "非常差", @@ -283,7 +283,7 @@ "name": "阶级", "description": "阶级", "choices": { - "tier": "%s1- %s2 级" + "tier": "%s1阶 - %s2" } } }, @@ -494,7 +494,7 @@ "accounts_linked": "帐号已绑定", "no_role_permissions": { "title": "%s1 验证失败", - "description": "我没有管理角色的权限。" + "description": "我没有管理身份的权限。" } }, "embed": { @@ -517,7 +517,7 @@ } }, "search_players": { - "name": "搜索玩家", + "name": "搜索-玩家", "description": "搜索玩家", "options": { "limit": { @@ -578,7 +578,7 @@ "description": "一段时间内的快速统计" }, "owned_tanks": { - "name": "已擁有的戰車", + "name": "已拥有的战车", "description": "显示该阶级中所有您已拥有的战车", "body": { "title": "# %s1 所拥有的 %s2 阶战车\n\n" @@ -589,8 +589,8 @@ "description": "检查机器人是否拥有运行所需的权限", "body": { "title": "# 权限\n\n%s1", - "view_channels": "查看頻道:需要找到重新整理按鈕使用的訊息", - "read_message_history": "讀取歷史訊息: 需要找到訊息以重新整理", + "view_channels": "查看频道:需要找到重新整理按钮使用的讯息", + "read_message_history": "读取消息历史: 需要找到消息以刷新", "attach_files": "附加文件:需要将图像添加到基于图像的命令", "external_emojis": "外部表情符号:需要添加国家旗帜和战车类别" } @@ -698,6 +698,7 @@ "fire.caliber": "口径", "fire.standardPenetration": "标准炮弹穿透力", "fire.premiumPenetration": "加值炮弹穿透力", + "fire.tertiaryPenetration": "tertiary penetration", "fire.damage": "炮弹伤害值", "fire.moduleDamage": "模组伤害值", "fire.shellVelocity": "炮弹飞行速度", @@ -796,9 +797,9 @@ }, "ricochet": { "angle": "角度", - "normalization": "轉正", + "normalization": "转正", "effective_angle": "有效角度", - "armor": "裝甲", + "armor": "装甲", "no_ricochet": "高爆弹不会跳弹" }, "view_range": { @@ -854,7 +855,7 @@ "track": "履带" }, "status": { - "penetration": "%s1生命值 擊穿", + "penetration": "%s1生命值 击穿", "blocked": "抵挡伤害", "ricochet": "跳弹", "splash": "%s1生命值 溅射" From 20f7119854a23eab041f2aa50ef02e9bc0653431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 28 Jul 2025 12:19:29 -0500 Subject: [PATCH 36/71] New translations en.json (Russian) (#158) --- packages/i18n/strings/ru.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/i18n/strings/ru.json b/packages/i18n/strings/ru.json index 15f0ff429..384db3c5e 100644 --- a/packages/i18n/strings/ru.json +++ b/packages/i18n/strings/ru.json @@ -697,8 +697,8 @@ "fire.reload": "перезарядка", "fire.caliber": "калибр", "fire.standardPenetration": "базовое пробитие", - "fire.premiumPenetration": "улучшенное пробитие ", - "fire.tertiaryPenetration": "tertiary penetration", + "fire.premiumPenetration": "премиумное пробитие ", + "fire.tertiaryPenetration": "пробитие третьего снаряда", "fire.damage": "урон", "fire.moduleDamage": "урон по модулям", "fire.shellVelocity": "скорость снаряда", From 83b7de77de2a08b8628988613e07856cf88b6c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 13:40:30 -0500 Subject: [PATCH 37/71] feat: start of assault shells --- .../core/src/protos/tank_definitions.proto | 10 + .../scripts/src/buildAssets/definitions.ts | 1324 +++++++++-------- 2 files changed, 684 insertions(+), 650 deletions(-) diff --git a/packages/core/src/protos/tank_definitions.proto b/packages/core/src/protos/tank_definitions.proto index 7e10afba7..043cd7bd4 100644 --- a/packages/core/src/protos/tank_definitions.proto +++ b/packages/core/src/protos/tank_definitions.proto @@ -157,6 +157,16 @@ message GunDefinitionBase { required float dispersion_damaged = 13; repeated Unlock unlocks = 14; required uint32 shell_capacity = 15; + optional AssaultRanges assault_ranges = 16; +} + +message AssaultRanges { + repeated AssaultRange ranges = 1; +} + +message AssaultRange { + required float distance = 1; + required float factor = 2; } message ShellDefinition { diff --git a/packages/scripts/src/buildAssets/definitions.ts b/packages/scripts/src/buildAssets/definitions.ts index 917f94b65..e47ade458 100644 --- a/packages/scripts/src/buildAssets/definitions.ts +++ b/packages/scripts/src/buildAssets/definitions.ts @@ -274,6 +274,15 @@ interface VehicleDefinitions { pumpGunReloadTimes?: string; clip?: { count: number; rate: number }; models: { undamaged: string }; + extras?: { + trayShell?: { + kinds: string; + sectors: Record< + string, + { id: number; distance: number; factor: number }[] + >; + }; + }; }; }; }; @@ -561,11 +570,6 @@ export async function definitions() { (nations) => nations.filter((nation) => nation !== 'common'), ); const tankStringIdMap: Record<string, number> = {}; - const stringsCache = await fetch( - 'https://stufficons.wgcdn.co/localizations/en.yaml', - ) - .then((response) => response.text()) - .then((string) => parseYaml(string) as BlitzStrings); const optionalDevices = await readXMLDVPL<{ root: OptionalDevices }>( `${DATA}/XML/item_defs/vehicles/common/optional_devices.xml`, ); @@ -573,6 +577,11 @@ export async function definitions() { await Promise.all( SUPPORTED_LOCALES.map(async (locale) => { + if (locale !== 'en') { + stringsI18n[locale] = {}; + return; + } + const blitzLocale = SUPPORTED_LOCALE_BLITZ_MAP[locale]; const cache = await fetch( `https://stufficons.wgcdn.co/localizations/${blitzLocale}.yaml`, @@ -723,39 +732,37 @@ export async function definitions() { const slugRequesters = new Map<string, { id: number; key: string }[]>(); const idToNation: Record<number, string> = {}; - await Promise.all( - nations.map(async (nation) => { - const tankList = await readXMLDVPL<{ root: VehicleDefinitionList }>( - `${DATA}/XML/item_defs/vehicles/${nation}/list.xml`, - ); + for (const nation of nations) { + const tankList = await readXMLDVPL<{ root: VehicleDefinitionList }>( + `${DATA}/XML/item_defs/vehicles/${nation}/list.xml`, + ); - for (const tankKey in tankList.root) { - if (botPattern.test(tankKey)) continue; + for (const tankKey in tankList.root) { + if (botPattern.test(tankKey)) continue; - const tank = tankList.root[tankKey]; - const tankId = toUniqueId(nation, tank.id); - const name = ( - (tank.shortUserString - ? getString(tank.shortUserString) - : undefined) ?? getString(tank.userString) - ).locales.en; + const tank = tankList.root[tankKey]; + const tankId = toUniqueId(nation, tank.id); - let slug = deburr(name).toLowerCase(); - slug = slug.replaceAll(nonAlphanumericRegex, '-'); - slug = slug.replaceAll(multipleDashesRegex, '-'); - slug = slug.replaceAll(trailingDashRegex, ''); - slug = slug.replaceAll(leadingDashRegex, ''); + const name = ( + (tank.shortUserString ? getString(tank.shortUserString) : undefined) ?? + getString(tank.userString) + ).locales.en; - idToNation[tankId] = nation; + let slug = deburr(name).toLowerCase(); + slug = slug.replaceAll(nonAlphanumericRegex, '-'); + slug = slug.replaceAll(multipleDashesRegex, '-'); + slug = slug.replaceAll(trailingDashRegex, ''); + slug = slug.replaceAll(leadingDashRegex, ''); - if (slugRequesters.has(slug)) { - slugRequesters.get(slug)!.push({ id: tankId, key: tankKey }); - } else { - slugRequesters.set(slug, [{ id: tankId, key: tankKey }]); - } + idToNation[tankId] = nation; + + if (slugRequesters.has(slug)) { + slugRequesters.get(slug)!.push({ id: tankId, key: tankKey }); + } else { + slugRequesters.set(slug, [{ id: tankId, key: tankKey }]); } - }), - ); + } + } const slugs = new Map<number, string>(); @@ -807,687 +814,703 @@ export async function definitions() { } }); - await Promise.all( - nations.map(async (nation) => { - const tankList = await readXMLDVPL<{ root: VehicleDefinitionList }>( - `${DATA}/XML/item_defs/vehicles/${nation}/list.xml`, + for (const nation of nations) { + const tankList = await readXMLDVPL<{ root: VehicleDefinitionList }>( + `${DATA}/XML/item_defs/vehicles/${nation}/list.xml`, + ); + const turretList = await readXMLDVPL<{ + root: TurretDefinitionsList; + }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/turrets.xml`); + const gunList = await readXMLDVPL<{ + root: GunDefinitionsList; + }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/guns.xml`); + const shellList = await readXMLDVPL<{ + root: ShellDefinitionsList; + }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/shells.xml`); + const enginesList = await readXMLDVPL<{ + root: EngineDefinitionsList; + }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/engines.xml`); + const chassisList = await readXMLDVPL<{ + root: ChassisDefinitionsList; + }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/chassis.xml`); + + function resolveUnlocks(unlocks?: BlitzModuleType) { + if (!unlocks) return []; + + return Object.entries(unlocks) + .map(([type, list]) => + (Array.isArray(list) ? list : [list]).map((item) => { + const typeTyped = type as keyof BlitzModuleType; + let rawId: number; + + if (typeTyped === 'chassis') { + rawId = chassisList.root.ids[item['#text']]; + } else if (typeTyped === 'engine') { + rawId = enginesList.root.ids[item['#text']]; + } else if (typeTyped === 'gun') { + rawId = gunList.root.ids[item['#text']]; + } else if (typeTyped === 'turret') { + rawId = turretList.root.ids[item['#text']]; + } else if (typeTyped === 'vehicle') { + rawId = tankList.root[item['#text']].id; + } + + return { + id: toUniqueId(nation, rawId!), + type: blitzModuleTypeToBlitzkit[typeTyped], + cost: { + type: + typeof item.cost === 'number' + ? 'xp' + : item.cost.split(':')[0], + value: + typeof item.cost === 'number' + ? item.cost + : Number(item.cost.split(':')[1]), + }, + } satisfies Unlock; + }), + ) + .flat(); + } + + for (const tankKey in tankList.root) { + if (botPattern.test(tankKey)) continue; + + const gunXps = new Map<number, ResearchCost>(); + const turretXps = new Map<number, ResearchCost>(); + const engineXps = new Map<number, ResearchCost>(); + const trackXps = new Map<number, ResearchCost>(); + const tank = tankList.root[tankKey]; + let tankPrice: TankPrice; + const tankDefinition = await readXMLDVPL<{ root: VehicleDefinitions }>( + `${DATA}/XML/item_defs/vehicles/${nation}/${tankKey}.xml`, ); - const turretList = await readXMLDVPL<{ - root: TurretDefinitionsList; - }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/turrets.xml`); - const gunList = await readXMLDVPL<{ - root: GunDefinitionsList; - }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/guns.xml`); - const shellList = await readXMLDVPL<{ - root: ShellDefinitionsList; - }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/shells.xml`); - const enginesList = await readXMLDVPL<{ - root: EngineDefinitionsList; - }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/engines.xml`); - const chassisList = await readXMLDVPL<{ - root: ChassisDefinitionsList; - }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/chassis.xml`); + const tankParameters = await readYAMLDVPL<TankParameters>( + `${DATA}/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`, + ); + const turretOrigin = tankDefinition.root.hull.turretPositions.turret + .split(' ') + .map(Number) as Vector3Tuple; + const tankId = toUniqueId(nation, tank.id); - function resolveUnlocks(unlocks?: BlitzModuleType) { - if (!unlocks) return []; + const tankTags = tank.tags.split(' '); + const hullArmor: Armor = { spaced: [], thickness: {} }; + const equipment = tankDefinition.root.optDevicePreset; + tankStringIdMap[`${nation}:${tankKey}`] = tankId; + const slug = slugs.get(tankId); - return Object.entries(unlocks) - .map(([type, list]) => - (Array.isArray(list) ? list : [list]).map((item) => { - const typeTyped = type as keyof BlitzModuleType; - let rawId: number; - - if (typeTyped === 'chassis') { - rawId = chassisList.root.ids[item['#text']]; - } else if (typeTyped === 'engine') { - rawId = enginesList.root.ids[item['#text']]; - } else if (typeTyped === 'gun') { - rawId = gunList.root.ids[item['#text']]; - } else if (typeTyped === 'turret') { - rawId = turretList.root.ids[item['#text']]; - } else if (typeTyped === 'vehicle') { - rawId = tankList.root[item['#text']].id; - } - - return { - id: toUniqueId(nation, rawId!), - type: blitzModuleTypeToBlitzkit[typeTyped], - cost: { - type: - typeof item.cost === 'number' - ? 'xp' - : item.cost.split(':')[0], - value: - typeof item.cost === 'number' - ? item.cost - : Number(item.cost.split(':')[1]), - }, - } satisfies Unlock; - }), - ) - .flat(); + if (slug === undefined) { + throw new Error( + `Could not find slug for ${nation}/${tankKey} (${tankId})`, + ); } - for (const tankKey in tankList.root) { - if (botPattern.test(tankKey)) continue; + if (tank.sellPrice) { + tankPrice = { + type: TankPriceType.GOLD, + value: tank.sellPrice['#text'] * 2, + }; + } else if (typeof tank.price === 'number') { + tankPrice = { + type: TankPriceType.CREDITS, + value: tank.price, + }; + } else { + tankPrice = { + type: TankPriceType.CREDITS, + value: tank.price['#text'] * 400, + }; + } - const gunXps = new Map<number, ResearchCost>(); - const turretXps = new Map<number, ResearchCost>(); - const engineXps = new Map<number, ResearchCost>(); - const trackXps = new Map<number, ResearchCost>(); - const tank = tankList.root[tankKey]; - let tankPrice: TankPrice; - const tankDefinition = await readXMLDVPL<{ root: VehicleDefinitions }>( - `${DATA}/XML/item_defs/vehicles/${nation}/${tankKey}.xml`, + Object.keys(tankDefinition.root.hull.armor) + .filter((name) => name.startsWith('armor_')) + .forEach((name) => { + const armorIdString = name.match(/armor_(\d+)/)?.[1]; + + if (armorIdString === undefined) { + throw new SyntaxError(`Invalid armor id: ${name}`); + } + + const armorId = parseInt(armorIdString); + const armorRaw = tankDefinition.root.hull.armor[name]; + + if (typeof armorRaw === 'number') { + hullArmor.thickness[armorId] = armorRaw; + } else { + if (!hullArmor.spaced) hullArmor.spaced = []; + hullArmor.thickness[armorId] = armorRaw['#text']; + hullArmor.spaced.push(armorId); + } + }); + const crew: Crew[] = []; + const fixedCamouflage = tankTags.includes('eventCamouflage_user'); + const totalUnlocks: UnlocksListing[] = []; + + Object.entries(tankDefinition.root.crew).forEach(([crewKey, value]) => { + let entry: Crew; + const index = crew.findIndex( + ({ type }) => blitzkitCrewTypeToBlitz[type] === crewKey, ); - const tankParameters = await readYAMLDVPL<TankParameters>( - `${DATA}/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`, - ); - const turretOrigin = tankDefinition.root.hull.turretPositions.turret + if (index === -1) { + if (crewKey === '#text') return; + entry = { + type: blitzCrewTypeToBlitzkit[crewKey as BlitzCrewType], + count: 0, + substitute: [], + }; + crew.push(entry); + } else { + entry = crew[index]; + } + + if (typeof value === 'string') { + entry.count++; + + if (value !== '') { + entry.substitute = value.split(/\n| /).map((member) => { + return blitzCrewTypeToBlitzkit[member.trim() as BlitzCrewType]; + }); + } + } else { + if (entry.count === undefined) { + entry.count = value.length; + } else { + entry.count += value.length; + } + } + }); + + const camouflages = camouflagesXmlEntries + .filter(([, camo]) => { + if (!camo.vehicleFilter.include) return false; + if (camo.unlockCostCategory !== 'legendary-skins-gold') return false; + + const includeArray = Array.isArray(camo.vehicleFilter.include) + ? camo.vehicleFilter.include + : [camo.vehicleFilter.include]; + + return includeArray.some((filter) => { + if ('vehicle' in filter && filter.vehicle?.name) { + return filter.vehicle.name === `${nation}:${tankKey}`; + } + + return false; + }); + }) + .map(([, camo]) => camo.id); + + tankDefinitions.tanks[tankId] = { + ancestors: [], + successors: [], + id: tankId, + roles: {}, + camouflages: camouflages, + fixed_camouflage: fixedCamouflage, + crew, + weight: tankDefinition.root.hull.weight, + health: tankDefinition.root.hull.maxHealth, + speed_forwards: tankDefinition.root.speedLimits.forward, + speed_backwards: tankDefinition.root.speedLimits.backward, + equipment_preset: + typeof equipment === 'string' ? equipment : equipment.at(-1)!, + max_consumables: tankDefinition.root.consumableSlots, + max_provisions: tankDefinition.root.provisionSlots, + name: + (tank.shortUserString + ? getString(tank.shortUserString) + : undefined) ?? getString(tank.userString), + slug, + nation, + type: tankTags.includes('collectible') + ? TankType.COLLECTOR + : (typeof tank.price === 'number' ? false : 'gold' in tank.price) + ? TankType.PREMIUM + : TankType.RESEARCHABLE, + tier: tank.level, + class: blitzTankClassToBlitzkit[tankTags[0] as BlitzTankClass], + testing: tankTags.includes('testTank'), + deprecated: tankTags.includes('deprecated'), + price: tankPrice, + camouflage_still: tankDefinition.root.invisibility.still, + camouflage_moving: tankDefinition.root.invisibility.moving, + camouflage_onFire: tankDefinition.root.invisibility.firePenalty, + turrets: [], + engines: [], + tracks: [], + }; + + if (tank.combatRole) { + Object.entries(tank.combatRole).forEach(([gameMode, role]) => { + const id = Object.entries(gameModeNativeNames).find( + ([key]) => key.toLowerCase() === gameMode.toLowerCase(), + )?.[1]; + + if (id === undefined) { + throw new Error( + `Unknown game mode in tank ${tankKey}: ${gameMode}`, + ); + } + + tankDefinitions.tanks[tankId].roles[id] = combatRoles[role].id; + }); + } + + modelDefinitions.models[tankId] = { + armor: hullArmor, + turret_origin: vector3TupleToBlitzkit(turretOrigin), + initial_turret_rotation: tankDefinition.root.hull.turretInitialRotation + ? { + yaw: tankDefinition.root.hull.turretInitialRotation.yaw, + pitch: tankDefinition.root.hull.turretInitialRotation.pitch, + roll: tankDefinition.root.hull.turretInitialRotation.roll, + } + : undefined, + bounding_box: { + min: vector3TupleToBlitzkit(tankParameters.collision.hull.bbox.min), + max: vector3TupleToBlitzkit(tankParameters.collision.hull.bbox.max), + }, + turrets: {}, + tracks: {}, + }; + + Object.keys(tankDefinition.root.chassis).forEach((key) => { + const track = tankDefinition.root.chassis[key]; + const trackId = toUniqueId(nation, chassisList.root.ids[key]); + const terrainResistances = track.terrainResistance + .split(' ') + .map(Number); + const trackArmorRaw = track.armor.leftTrack; + const hullOrigin = track.hullPosition .split(' ') .map(Number) as Vector3Tuple; - const tankId = toUniqueId(nation, tank.id); - const tankTags = tank.tags.split(' '); - const hullArmor: Armor = { spaced: [], thickness: {} }; - const equipment = tankDefinition.root.optDevicePreset; - tankStringIdMap[`${nation}:${tankKey}`] = tankId; - const slug = slugs.get(tankId); - if (slug === undefined) { - throw new Error( - `Could not find slug for ${nation}/${tankKey} (${tankId})`, - ); - } - - if (tank.sellPrice) { - tankPrice = { - type: TankPriceType.GOLD, - value: tank.sellPrice['#text'] * 2, - }; - } else if (typeof tank.price === 'number') { - tankPrice = { - type: TankPriceType.CREDITS, - value: tank.price, - }; - } else { - tankPrice = { - type: TankPriceType.CREDITS, - value: tank.price['#text'] * 400, - }; - } - - Object.keys(tankDefinition.root.hull.armor) - .filter((name) => name.startsWith('armor_')) - .forEach((name) => { - const armorIdString = name.match(/armor_(\d+)/)?.[1]; - - if (armorIdString === undefined) { - throw new SyntaxError(`Invalid armor id: ${name}`); - } - - const armorId = parseInt(armorIdString); - const armorRaw = tankDefinition.root.hull.armor[name]; - - if (typeof armorRaw === 'number') { - hullArmor.thickness[armorId] = armorRaw; - } else { - if (!hullArmor.spaced) hullArmor.spaced = []; - hullArmor.thickness[armorId] = armorRaw['#text']; - hullArmor.spaced.push(armorId); - } - }); - const crew: Crew[] = []; - const fixedCamouflage = tankTags.includes('eventCamouflage_user'); - const totalUnlocks: UnlocksListing[] = []; - - Object.entries(tankDefinition.root.crew).forEach(([crewKey, value]) => { - let entry: Crew; - const index = crew.findIndex( - ({ type }) => blitzkitCrewTypeToBlitz[type] === crewKey, - ); - if (index === -1) { - if (crewKey === '#text') return; - entry = { - type: blitzCrewTypeToBlitzkit[crewKey as BlitzCrewType], - count: 0, - substitute: [], - }; - crew.push(entry); - } else { - entry = crew[index]; - } - - if (typeof value === 'string') { - entry.count++; - - if (value !== '') { - entry.substitute = value.split(/\n| /).map((member) => { - return blitzCrewTypeToBlitzkit[member.trim() as BlitzCrewType]; - }); - } - } else { - if (entry.count === undefined) { - entry.count = value.length; - } else { - entry.count += value.length; - } - } + totalUnlocks.push(track.unlocks); + tankDefinitions.tanks[tankId].tracks.push({ + id: trackId, + weight: track.weight, + name: getString(track.userString), + traverse_speed: track.rotationSpeed, + dispersion_move: track.shotDispersionFactors.vehicleMovement, + dispersion_traverse: track.shotDispersionFactors.vehicleRotation, + resistance_hard: terrainResistances[0], + resistance_medium: terrainResistances[1], + resistance_soft: terrainResistances[2], + tier: track.level, + unlocks: resolveUnlocks(track.unlocks), }); - const camouflages = camouflagesXmlEntries - .filter(([, camo]) => { - if (!camo.vehicleFilter.include) return false; - if (camo.unlockCostCategory !== 'legendary-skins-gold') - return false; - - const includeArray = Array.isArray(camo.vehicleFilter.include) - ? camo.vehicleFilter.include - : [camo.vehicleFilter.include]; - - return includeArray.some((filter) => { - if ('vehicle' in filter && filter.vehicle?.name) { - return filter.vehicle.name === `${nation}:${tankKey}`; - } - - return false; - }); - }) - .map(([, camo]) => camo.id); - - tankDefinitions.tanks[tankId] = { - ancestors: [], - successors: [], - id: tankId, - roles: {}, - camouflages: camouflages, - fixed_camouflage: fixedCamouflage, - crew, - weight: tankDefinition.root.hull.weight, - health: tankDefinition.root.hull.maxHealth, - speed_forwards: tankDefinition.root.speedLimits.forward, - speed_backwards: tankDefinition.root.speedLimits.backward, - equipment_preset: - typeof equipment === 'string' ? equipment : equipment.at(-1)!, - max_consumables: tankDefinition.root.consumableSlots, - max_provisions: tankDefinition.root.provisionSlots, - name: - (tank.shortUserString - ? getString(tank.shortUserString) - : undefined) ?? getString(tank.userString), - slug, - nation, - type: tankTags.includes('collectible') - ? TankType.COLLECTOR - : (typeof tank.price === 'number' ? false : 'gold' in tank.price) - ? TankType.PREMIUM - : TankType.RESEARCHABLE, - tier: tank.level, - class: blitzTankClassToBlitzkit[tankTags[0] as BlitzTankClass], - testing: tankTags.includes('testTank'), - deprecated: tankTags.includes('deprecated'), - price: tankPrice, - camouflage_still: tankDefinition.root.invisibility.still, - camouflage_moving: tankDefinition.root.invisibility.moving, - camouflage_onFire: tankDefinition.root.invisibility.firePenalty, - turrets: [], - engines: [], - tracks: [], + modelDefinitions.models[tankId].tracks[trackId] = { + thickness: + typeof trackArmorRaw === 'number' + ? trackArmorRaw + : trackArmorRaw['#text'], + origin: vector3TupleToBlitzkit(hullOrigin), }; + }); - if (tank.combatRole) { - Object.entries(tank.combatRole).forEach(([gameMode, role]) => { - const id = Object.entries(gameModeNativeNames).find( - ([key]) => key.toLowerCase() === gameMode.toLowerCase(), - )?.[1]; + Object.keys(tankDefinition.root.engines).forEach((engineKey) => { + const engine = tankDefinition.root.engines[engineKey]; + const engineListEntry = enginesList.root.shared[engineKey]; + const engineId = toUniqueId(nation, enginesList.root.ids[engineKey]); - if (id === undefined) { - throw new Error( - `Unknown game mode in tank ${tankKey}: ${gameMode}`, - ); - } + totalUnlocks.push(engine.unlocks); + tankDefinitions.tanks[tankId].engines.push({ + id: engineId, + name: getString(engineListEntry.userString), + fire_chance: engineListEntry.fireStartingChance, + tier: engineListEntry.level, + weight: engineListEntry.weight, + power: engineListEntry.power, + unlocks: resolveUnlocks(engine.unlocks), + }); + }); - tankDefinitions.tanks[tankId].roles[id] = combatRoles[role].id; - }); - } - - modelDefinitions.models[tankId] = { - armor: hullArmor, - turret_origin: vector3TupleToBlitzkit(turretOrigin), - initial_turret_rotation: tankDefinition.root.hull - .turretInitialRotation - ? { - yaw: tankDefinition.root.hull.turretInitialRotation.yaw, - pitch: tankDefinition.root.hull.turretInitialRotation.pitch, - roll: tankDefinition.root.hull.turretInitialRotation.roll, - } - : undefined, - bounding_box: { - min: vector3TupleToBlitzkit(tankParameters.collision.hull.bbox.min), - max: vector3TupleToBlitzkit(tankParameters.collision.hull.bbox.max), - }, - turrets: {}, - tracks: {}, - }; - - Object.keys(tankDefinition.root.chassis).forEach((key) => { - const track = tankDefinition.root.chassis[key]; - const trackId = toUniqueId(nation, chassisList.root.ids[key]); - const terrainResistances = track.terrainResistance + Object.keys(tankDefinition.root.turrets0).forEach( + (turretKey, turretIndex) => { + const turret = tankDefinition.root.turrets0[turretKey]; + const turretModel = Number( + parsePath(turret.models.undamaged).name.split('_')[1], + ); + const turretId = toUniqueId(nation, turretList.root.ids[turretKey]); + const turretYaw = ( + typeof turret.yawLimits === 'string' + ? turret.yawLimits + : turret.yawLimits.at(-1)! + ) .split(' ') - .map(Number); - const trackArmorRaw = track.armor.leftTrack; - const hullOrigin = track.hullPosition + .map(Number) as [number, number]; + const gunOrigin = ( + typeof turret.gunPosition === 'string' + ? turret.gunPosition + : turret.gunPosition[0] + ) .split(' ') .map(Number) as Vector3Tuple; + const turretArmor: Armor = { thickness: {}, spaced: [] }; - totalUnlocks.push(track.unlocks); - tankDefinitions.tanks[tankId].tracks.push({ - id: trackId, - weight: track.weight, - name: getString(track.userString), - traverse_speed: track.rotationSpeed, - dispersion_move: track.shotDispersionFactors.vehicleMovement, - dispersion_traverse: track.shotDispersionFactors.vehicleRotation, - resistance_hard: terrainResistances[0], - resistance_medium: terrainResistances[1], - resistance_soft: terrainResistances[2], - tier: track.level, - unlocks: resolveUnlocks(track.unlocks), + totalUnlocks.push(turret.unlocks); + Object.keys(turret.armor) + .filter((name) => name.startsWith('armor_')) + .forEach((name) => { + const armorIdString = name.match(/armor_(\d+)/)?.[1]; + + if (armorIdString === undefined) { + throw new SyntaxError(`Invalid armor id: ${name}`); + } + + const armorId = parseInt(armorIdString); + const armorRaw = turret.armor[name]; + + if (typeof armorRaw === 'number') { + turretArmor.thickness[armorId] = armorRaw; + } else { + if (!turretArmor.spaced) turretArmor.spaced = []; + turretArmor.thickness[armorId] = armorRaw['#text']; + turretArmor.spaced.push(armorId); + } + }); + + turret.userString; + + tankDefinitions.tanks[tankId].turrets.push({ + id: turretId, + traverse_speed: turret.rotationSpeed, + name: getString(turret.userString), + tier: turret.level, + guns: [], + health: turret.maxHealth, + view_range: turret.circularVisionRadius, + weight: turret.weight, + unlocks: resolveUnlocks(turret.unlocks), }); - modelDefinitions.models[tankId].tracks[trackId] = { - thickness: - typeof trackArmorRaw === 'number' - ? trackArmorRaw - : trackArmorRaw['#text'], - origin: vector3TupleToBlitzkit(hullOrigin), + modelDefinitions.models[tankId].turrets[turretId] = { + armor: turretArmor, + gun_origin: vector3TupleToBlitzkit(gunOrigin), + model_id: turretModel, + yaw: + -turretYaw[0] + turretYaw[1] === 360 + ? undefined + : { min: turretYaw[0], max: turretYaw[1] }, + guns: {}, + bounding_box: { + min: vector3TupleToBlitzkit( + tankParameters.collision[ + parsePath(turret.hitTester.collisionModel).name.toLowerCase() + ].bbox.min, + ), + max: vector3TupleToBlitzkit( + tankParameters.collision[ + parsePath(turret.hitTester.collisionModel).name.toLowerCase() + ].bbox.max, + ), + }, }; - }); - Object.keys(tankDefinition.root.engines).forEach((engineKey) => { - const engine = tankDefinition.root.engines[engineKey]; - const engineListEntry = enginesList.root.shared[engineKey]; - const engineId = toUniqueId(nation, enginesList.root.ids[engineKey]); - - totalUnlocks.push(engine.unlocks); - tankDefinitions.tanks[tankId].engines.push({ - id: engineId, - name: getString(engineListEntry.userString), - fire_chance: engineListEntry.fireStartingChance, - tier: engineListEntry.level, - weight: engineListEntry.weight, - power: engineListEntry.power, - unlocks: resolveUnlocks(engine.unlocks), - }); - }); - - Object.keys(tankDefinition.root.turrets0).forEach( - (turretKey, turretIndex) => { - const turret = tankDefinition.root.turrets0[turretKey]; - const turretModel = Number( - parsePath(turret.models.undamaged).name.split('_')[1], - ); - const turretId = toUniqueId(nation, turretList.root.ids[turretKey]); - const turretYaw = ( - typeof turret.yawLimits === 'string' - ? turret.yawLimits - : turret.yawLimits.at(-1)! + Object.keys(turret.guns).forEach((gunKey, gunIndex) => { + const gun = turret.guns[gunKey]; + const gunId = toUniqueId(nation, gunList.root.ids[gunKey]); + const gunListEntry = gunList.root.shared[gunKey]; + const pitchLimitsRaw = gun.pitchLimits ?? gunListEntry.pitchLimits; + const gunPitch = ( + typeof pitchLimitsRaw === 'string' + ? pitchLimitsRaw + : pitchLimitsRaw.at(-1)! ) .split(' ') .map(Number) as [number, number]; - const gunOrigin = ( - typeof turret.gunPosition === 'string' - ? turret.gunPosition - : turret.gunPosition[0] - ) - .split(' ') - .map(Number) as Vector3Tuple; - const turretArmor: Armor = { thickness: {}, spaced: [] }; + const gunModel = Number( + parsePath(gun.models.undamaged).name.split('_')[1], + ); + const gunName = getString(gunListEntry.userString); + const gunType = + 'clip' in gun + ? gun.pumpGunMode + ? 'autoReloader' + : 'autoLoader' + : 'regular'; + // const gunReload = gun.reloadTime; + // const shellReloads = + const gunClipCount = gunType === 'regular' ? 1 : gun.clip!.count; + const front = gun.extraPitchLimits?.front + ? gun.extraPitchLimits.front.split(' ').map(Number) + : undefined; + const back = gun.extraPitchLimits?.back + ? gun.extraPitchLimits.back.split(' ').map(Number) + : undefined; + const transition = gun.extraPitchLimits?.transition + ? typeof gun.extraPitchLimits.transition === 'number' + ? gun.extraPitchLimits.transition + : gun.extraPitchLimits.transition.at(-1)! + : undefined; + const gunArmor: Armor = { thickness: {}, spaced: [] }; + const shotDispersionFactors = + gun.shotDispersionFactors ?? gunListEntry.shotDispersionFactors; + const maskName = `gun_${gunModel.toString().padStart(2, '0')}`; + const maskEnabled = + tankParameters.maskSlice?.[maskName]?.enabled ?? false; + let mask: number | undefined; - totalUnlocks.push(turret.unlocks); - Object.keys(turret.armor) + if (gun.extras?.trayShell) { + const kinds = gun.extras.trayShell.kinds + .split(' ') + .map((string) => { + const trimmed = string.trim(); + + if (trimmed in blitzShellKindToBlitzkit) { + return blitzShellKindToBlitzkit[trimmed as ShellKind]; + } + + throw new SyntaxError(`Invalid shell kind: ${trimmed}`); + }); + const sectorNames = Object.keys(gun.extras.trayShell.sectors); + + if (sectorNames.length !== 1 || sectorNames[0] !== 'sector') { + throw new SyntaxError('Invalid tray shell sector'); + } + + const sector = gun.extras.trayShell.sectors.sector; + + gun.assault_ranges = { + ranges: sector.map((value) => ({ + factor: value.factor, + distance: value.distance, + })), + }; + } + + if (maskEnabled) { + const maskRaw = tankParameters.maskSlice![maskName]!; + mask = maskRaw.planePosition[1]; + } else { + mask = undefined; + } + + totalUnlocks.push(gun.unlocks); + Object.keys(gun.armor) .filter((name) => name.startsWith('armor_')) .forEach((name) => { const armorIdString = name.match(/armor_(\d+)/)?.[1]; - if (armorIdString === undefined) { throw new SyntaxError(`Invalid armor id: ${name}`); } - const armorId = parseInt(armorIdString); - const armorRaw = turret.armor[name]; - + const armorRaw = gun.armor[name]; if (typeof armorRaw === 'number') { - turretArmor.thickness[armorId] = armorRaw; + gunArmor.thickness[armorId] = armorRaw; } else { - if (!turretArmor.spaced) turretArmor.spaced = []; - turretArmor.thickness[armorId] = armorRaw['#text']; - turretArmor.spaced.push(armorId); + if (!gunArmor.spaced) gunArmor.spaced = []; + gunArmor.thickness[armorId] = armorRaw['#text']; + gunArmor.spaced.push(armorId); } }); - turret.userString; + const base = { + id: gunId, + weight: gunListEntry.weight, + rotation_speed: gunListEntry.rotationSpeed, + name: gunName, + tier: gunListEntry.level, + shells: [], + camouflage_loss: + typeof gun.invisibilityFactorAtShot === 'number' + ? gun.invisibilityFactorAtShot + : gun.invisibilityFactorAtShot.at(-1)!, + aim_time: gun.aimingTime ?? gunListEntry.aimingTime, + dispersion_base: + gun.shotDispersionRadius ?? gunListEntry.shotDispersionRadius, + dispersion_damaged: shotDispersionFactors.whileGunDamaged, + dispersion_shot: shotDispersionFactors.afterShot, + dispersion_traverse: shotDispersionFactors.turretRotation, + unlocks: resolveUnlocks(gun.unlocks), + shell_capacity: gun.maxAmmo ?? gunListEntry.maxAmmo, + } satisfies GunDefinitionBase; - tankDefinitions.tanks[tankId].turrets.push({ - id: turretId, - traverse_speed: turret.rotationSpeed, - name: getString(turret.userString), - tier: turret.level, - guns: [], - health: turret.maxHealth, - view_range: turret.circularVisionRadius, - weight: turret.weight, - unlocks: resolveUnlocks(turret.unlocks), - }); + tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({ + gun_type: + gunType === 'regular' + ? { + $case: 'regular', + value: { + base, + extension: { reload: gun.reloadTime }, + }, + } + : gunType === 'autoReloader' + ? { + $case: 'auto_reloader', + value: { + base, + extension: { + intra_clip: 60 / gun.clip!.rate, + shell_count: gunClipCount, + shell_reloads: gun + .pumpGunReloadTimes!.split(' ') + .map(Number), + }, + }, + } + : { + $case: 'auto_loader', + value: { + base, + extension: { + intra_clip: 60 / gun.clip!.rate, + clip_reload: gun.reloadTime, + shell_count: gunClipCount, + }, + }, + }, + } satisfies GunDefinition); - modelDefinitions.models[tankId].turrets[turretId] = { - armor: turretArmor, - gun_origin: vector3TupleToBlitzkit(gunOrigin), - model_id: turretModel, - yaw: - -turretYaw[0] + turretYaw[1] === 360 - ? undefined - : { min: turretYaw[0], max: turretYaw[1] }, - guns: {}, - bounding_box: { - min: vector3TupleToBlitzkit( - tankParameters.collision[ - parsePath( - turret.hitTester.collisionModel, - ).name.toLowerCase() - ].bbox.min, - ), - max: vector3TupleToBlitzkit( - tankParameters.collision[ - parsePath( - turret.hitTester.collisionModel, - ).name.toLowerCase() - ].bbox.max, - ), + modelDefinitions.models[tankId].turrets[turretId].guns[gunId] = { + armor: gunArmor, + model_id: gunModel, + mask, + thickness: + gun.armor.gun === undefined + ? 0 + : typeof gun.armor.gun === 'number' + ? gun.armor.gun + : gun.armor.gun['#text'], + pitch: { + min: gunPitch[0], + max: gunPitch[1], + + front: front + ? { + min: front[0], + max: front[1], + range: front[2], + } + : undefined, + back: back + ? { + min: back[0], + max: back[1], + range: back[2], + } + : undefined, + transition, }, }; - Object.keys(turret.guns).forEach((gunKey, gunIndex) => { - const gun = turret.guns[gunKey]; - const gunId = toUniqueId(nation, gunList.root.ids[gunKey]); - const gunListEntry = gunList.root.shared[gunKey]; - const pitchLimitsRaw = - gun.pitchLimits ?? gunListEntry.pitchLimits; - const gunPitch = ( - typeof pitchLimitsRaw === 'string' - ? pitchLimitsRaw - : pitchLimitsRaw.at(-1)! - ) + Object.keys(gunListEntry.shots).forEach((shellKey) => { + const gunShellEntry = gunListEntry.shots[shellKey]; + const shell = shellList.root[shellKey]; + const shellId = toUniqueId(nation, shell.id); + const shellName = getString(shell.userString); + const penetrationRaw = gunShellEntry.piercingPower .split(' ') - .map(Number) as [number, number]; - const gunModel = Number( - parsePath(gun.models.undamaged).name.split('_')[1], - ); - const gunName = getString(gunListEntry.userString); - const gunType = - 'clip' in gun - ? gun.pumpGunMode - ? 'autoReloader' - : 'autoLoader' - : 'regular'; - // const gunReload = gun.reloadTime; - // const shellReloads = - const gunClipCount = gunType === 'regular' ? 1 : gun.clip!.count; - const front = gun.extraPitchLimits?.front - ? gun.extraPitchLimits.front.split(' ').map(Number) - : undefined; - const back = gun.extraPitchLimits?.back - ? gun.extraPitchLimits.back.split(' ').map(Number) - : undefined; - const transition = gun.extraPitchLimits?.transition - ? typeof gun.extraPitchLimits.transition === 'number' - ? gun.extraPitchLimits.transition - : gun.extraPitchLimits.transition.at(-1)! - : undefined; - const gunArmor: Armor = { thickness: {}, spaced: [] }; - const shotDispersionFactors = - gun.shotDispersionFactors ?? gunListEntry.shotDispersionFactors; - const maskName = `gun_${gunModel.toString().padStart(2, '0')}`; - const maskEnabled = - tankParameters.maskSlice?.[maskName]?.enabled ?? false; - let mask: number | undefined; + .filter((penetrationString) => penetrationString !== '') + .map(Number); - if (maskEnabled) { - const maskRaw = tankParameters.maskSlice![maskName]!; - mask = maskRaw.planePosition[1]; - } else { - mask = undefined; - } - - totalUnlocks.push(gun.unlocks); - Object.keys(gun.armor) - .filter((name) => name.startsWith('armor_')) - .forEach((name) => { - const armorIdString = name.match(/armor_(\d+)/)?.[1]; - if (armorIdString === undefined) { - throw new SyntaxError(`Invalid armor id: ${name}`); - } - const armorId = parseInt(armorIdString); - const armorRaw = gun.armor[name]; - if (typeof armorRaw === 'number') { - gunArmor.thickness[armorId] = armorRaw; - } else { - if (!gunArmor.spaced) gunArmor.spaced = []; - gunArmor.thickness[armorId] = armorRaw['#text']; - gunArmor.spaced.push(armorId); - } - }); - - const base = { - id: gunId, - weight: gunListEntry.weight, - rotation_speed: gunListEntry.rotationSpeed, - name: gunName, - tier: gunListEntry.level, - shells: [], - camouflage_loss: - typeof gun.invisibilityFactorAtShot === 'number' - ? gun.invisibilityFactorAtShot - : gun.invisibilityFactorAtShot.at(-1)!, - aim_time: gun.aimingTime ?? gunListEntry.aimingTime, - dispersion_base: - gun.shotDispersionRadius ?? gunListEntry.shotDispersionRadius, - dispersion_damaged: shotDispersionFactors.whileGunDamaged, - dispersion_shot: shotDispersionFactors.afterShot, - dispersion_traverse: shotDispersionFactors.turretRotation, - unlocks: resolveUnlocks(gun.unlocks), - shell_capacity: gun.maxAmmo ?? gunListEntry.maxAmmo, - } satisfies GunDefinitionBase; - - tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({ - gun_type: - gunType === 'regular' - ? { - $case: 'regular', - value: { - base, - extension: { reload: gun.reloadTime }, - }, - } - : gunType === 'autoReloader' - ? { - $case: 'auto_reloader', - value: { - base, - extension: { - intra_clip: 60 / gun.clip!.rate, - shell_count: gunClipCount, - shell_reloads: gun - .pumpGunReloadTimes!.split(' ') - .map(Number), - }, - }, - } - : { - $case: 'auto_loader', - value: { - base, - extension: { - intra_clip: 60 / gun.clip!.rate, - clip_reload: gun.reloadTime, - shell_count: gunClipCount, - }, - }, - }, - } satisfies GunDefinition); - - modelDefinitions.models[tankId].turrets[turretId].guns[gunId] = { - armor: gunArmor, - model_id: gunModel, - mask, - thickness: - gun.armor.gun === undefined - ? 0 - : typeof gun.armor.gun === 'number' - ? gun.armor.gun - : gun.armor.gun['#text'], - pitch: { - min: gunPitch[0], - max: gunPitch[1], - - front: front - ? { - min: front[0], - max: front[1], - range: front[2], - } + tankDefinitions.tanks[tankId].turrets[turretIndex].guns[ + gunIndex + ].gun_type!.value.base.shells.push({ + id: shellId, + name: shellName, + velocity: gunShellEntry.speed, + armor_damage: shell.damage.armor, + module_damage: shell.damage.devices, + caliber: shell.caliber, + normalization: shell.normalizationAngle, + ricochet: shell.ricochetAngle, + type: blitzShellKindToBlitzkit[shell.kind], + explosion_radius: + shell.kind === 'HIGH_EXPLOSIVE' + ? (shell.explosionRadius ?? 0) : undefined, - back: back - ? { - min: back[0], - max: back[1], - range: back[2], - } - : undefined, - transition, + icon: shell.icon, + penetration: { + near: penetrationRaw[0], + far: penetrationRaw[1], }, - }; - - Object.keys(gunListEntry.shots).forEach((shellKey) => { - const gunShellEntry = gunListEntry.shots[shellKey]; - const shell = shellList.root[shellKey]; - const shellId = toUniqueId(nation, shell.id); - const shellName = getString(shell.userString); - const penetrationRaw = gunShellEntry.piercingPower - .split(' ') - .filter((penetrationString) => penetrationString !== '') - .map(Number); - - tankDefinitions.tanks[tankId].turrets[turretIndex].guns[ - gunIndex - ].gun_type!.value.base.shells.push({ - id: shellId, - name: shellName, - velocity: gunShellEntry.speed, - armor_damage: shell.damage.armor, - module_damage: shell.damage.devices, - caliber: shell.caliber, - normalization: shell.normalizationAngle, - ricochet: shell.ricochetAngle, - type: blitzShellKindToBlitzkit[shell.kind], - explosion_radius: - shell.kind === 'HIGH_EXPLOSIVE' - ? (shell.explosionRadius ?? 0) - : undefined, - icon: shell.icon, - penetration: { - near: penetrationRaw[0], - far: penetrationRaw[1], - }, - range: gunShellEntry.maxDistance, - }); + range: gunShellEntry.maxDistance, }); }); - }, - ); + }); + }, + ); - totalUnlocks.forEach((unlocks) => { - if (unlocks === undefined) return; + totalUnlocks.forEach((unlocks) => { + if (unlocks === undefined) return; - Object.entries(unlocks).forEach(([key, value]) => { - (Array.isArray(value) ? value : [value]).forEach((vehicle) => { - switch (key as keyof BlitzModuleType) { - case 'vehicle': { - const tankListEntry = tankList.root[vehicle['#text']]; - const currentTank = tankDefinitions.tanks[tankId]; - const successorId = toUniqueId(nation, tankListEntry.id); + Object.entries(unlocks).forEach(([key, value]) => { + (Array.isArray(value) ? value : [value]).forEach((vehicle) => { + switch (key as keyof BlitzModuleType) { + case 'vehicle': { + const tankListEntry = tankList.root[vehicle['#text']]; + const currentTank = tankDefinitions.tanks[tankId]; + const successorId = toUniqueId(nation, tankListEntry.id); - tankXps.set(successorId, parseResearchCost(vehicle.cost)); + tankXps.set(successorId, parseResearchCost(vehicle.cost)); - if (currentTank.successors === undefined) { - currentTank.successors = []; - } - if (!currentTank.successors!.includes(successorId)) { - currentTank.successors!.push(successorId); - } - break; + if (currentTank.successors === undefined) { + currentTank.successors = []; } - - case 'gun': { - gunXps.set( - toUniqueId(nation, gunList.root.ids[vehicle['#text']]), - parseResearchCost(vehicle.cost), - ); - break; - } - - case 'turret': { - turretXps.set( - toUniqueId(nation, turretList.root.ids[vehicle['#text']]), - parseResearchCost(vehicle.cost), - ); - break; - } - - case 'engine': { - engineXps.set( - toUniqueId(nation, enginesList.root.ids[vehicle['#text']]), - parseResearchCost(vehicle.cost), - ); - break; - } - - case 'chassis': { - trackXps.set( - toUniqueId(nation, chassisList.root.ids[vehicle['#text']]), - parseResearchCost(vehicle.cost), - ); - break; + if (!currentTank.successors!.includes(successorId)) { + currentTank.successors!.push(successorId); } + break; } - }); + + case 'gun': { + gunXps.set( + toUniqueId(nation, gunList.root.ids[vehicle['#text']]), + parseResearchCost(vehicle.cost), + ); + break; + } + + case 'turret': { + turretXps.set( + toUniqueId(nation, turretList.root.ids[vehicle['#text']]), + parseResearchCost(vehicle.cost), + ); + break; + } + + case 'engine': { + engineXps.set( + toUniqueId(nation, enginesList.root.ids[vehicle['#text']]), + parseResearchCost(vehicle.cost), + ); + break; + } + + case 'chassis': { + trackXps.set( + toUniqueId(nation, chassisList.root.ids[vehicle['#text']]), + parseResearchCost(vehicle.cost), + ); + break; + } + } }); }); + }); - Object.values(tankDefinitions.tanks[tankId].turrets).forEach( - (turret) => { - turret.research_cost = turretXps.get(turret.id); + Object.values(tankDefinitions.tanks[tankId].turrets).forEach((turret) => { + turret.research_cost = turretXps.get(turret.id); - Object.values(turret.guns).forEach((gunRaw) => { - gunRaw.gun_type!.value.base.research_cost = gunXps.get( - gunRaw.gun_type!.value.base.id, - ); - }); - }, - ); - - Object.values(tankDefinitions.tanks[tankId].engines).forEach( - (engine) => { - engine.research_cost = engineXps.get(engine.id); - }, - ); - - Object.values(tankDefinitions.tanks[tankId].tracks).forEach((track) => { - track.research_cost = trackXps.get(track.id); + Object.values(turret.guns).forEach((gunRaw) => { + gunRaw.gun_type!.value.base.research_cost = gunXps.get( + gunRaw.gun_type!.value.base.id, + ); }); - } - }), - ); + }); + + Object.values(tankDefinitions.tanks[tankId].engines).forEach((engine) => { + engine.research_cost = engineXps.get(engine.id); + }); + + Object.values(tankDefinitions.tanks[tankId].tracks).forEach((track) => { + track.research_cost = trackXps.get(track.id); + }); + } + } Object.values(tankDefinitions.tanks).forEach((tank) => { tank.research_cost = tankXps.get(tank.id); @@ -1769,6 +1792,7 @@ export async function definitions() { }; }); + return; await commitAssets('definitions', [ { content: GameDefinitions.encode(gameDefinitions).finish(), From 40e4e0a274576acad72e335440b4d35a7c0089a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 13:44:14 -0500 Subject: [PATCH 38/71] feat: start of assault shells --- packages/core/src/protos/tank_definitions.ts | 553 +++++++++++------- .../scripts/src/buildAssets/definitions.ts | 11 +- 2 files changed, 356 insertions(+), 208 deletions(-) diff --git a/packages/core/src/protos/tank_definitions.ts b/packages/core/src/protos/tank_definitions.ts index 40e3026a3..8fcd2b37b 100644 --- a/packages/core/src/protos/tank_definitions.ts +++ b/packages/core/src/protos/tank_definitions.ts @@ -270,7 +270,7 @@ export interface TankDefinition { crew: Crew[]; health: number; nation: string; - name: I18nString; + name: I18nString | undefined; type: TankType; max_consumables: number; max_provisions: number; @@ -281,7 +281,7 @@ export interface TankDefinition { turrets: TurretDefinition[]; engines: EngineDefinition[]; tracks: TrackDefinition[]; - price: TankPrice; + price: TankPrice | undefined; research_cost?: ResearchCost | undefined; speed_forwards: number; speed_backwards: number; @@ -317,7 +317,7 @@ export interface TankPrice { export interface TrackDefinition { id: number; tier: number; - name: I18nString; + name: I18nString | undefined; weight: number; traverse_speed: number; research_cost?: ResearchCost | undefined; @@ -331,7 +331,7 @@ export interface TrackDefinition { export interface EngineDefinition { id: number; - name: I18nString; + name: I18nString | undefined; research_cost?: ResearchCost | undefined; tier: number; fire_chance: number; @@ -346,7 +346,7 @@ export interface TurretDefinition { view_range: number; traverse_speed: number; research_cost?: ResearchCost | undefined; - name: I18nString; + name: I18nString | undefined; tier: number; weight: number; guns: GunDefinition[]; @@ -362,8 +362,8 @@ export interface GunDefinition { } export interface GunDefinitionRegular { - base: GunDefinitionBase; - extension: GunDefinitionRegularProperties; + base: GunDefinitionBase | undefined; + extension: GunDefinitionRegularProperties | undefined; } export interface GunDefinitionRegularProperties { @@ -371,8 +371,8 @@ export interface GunDefinitionRegularProperties { } export interface GunDefinitionAutoLoader { - base: GunDefinitionBase; - extension: GunDefinitionAutoLoaderProperties; + base: GunDefinitionBase | undefined; + extension: GunDefinitionAutoLoaderProperties | undefined; } export interface GunDefinitionAutoLoaderProperties { @@ -382,8 +382,8 @@ export interface GunDefinitionAutoLoaderProperties { } export interface GunDefinitionAutoReloader { - base: GunDefinitionBase; - extension: GunDefinitionAutoReloaderProperties; + base: GunDefinitionBase | undefined; + extension: GunDefinitionAutoReloaderProperties | undefined; } export interface GunDefinitionAutoReloaderProperties { @@ -397,7 +397,7 @@ export interface GunDefinitionBase { rotation_speed: number; research_cost?: ResearchCost | undefined; weight: number; - name: I18nString; + name: I18nString | undefined; tier: number; shells: ShellDefinition[]; camouflage_loss: number; @@ -408,17 +408,27 @@ export interface GunDefinitionBase { dispersion_damaged: number; unlocks: Unlock[]; shell_capacity: number; + assault_ranges?: AssaultRanges | undefined; +} + +export interface AssaultRanges { + ranges: AssaultRange[]; +} + +export interface AssaultRange { + distance: number; + factor: number; } export interface ShellDefinition { id: number; - name: I18nString; + name: I18nString | undefined; velocity: number; armor_damage: number; module_damage: number; caliber: number; icon: string; - penetration: ShellPenetration; + penetration: ShellPenetration | undefined; type: ShellType; normalization?: number | undefined; ricochet?: number | undefined; @@ -434,7 +444,7 @@ export interface ShellPenetration { export interface Unlock { id: number; type: ModuleType; - cost: UnlockCost; + cost: UnlockCost | undefined; } export interface UnlockCost { @@ -448,7 +458,7 @@ export interface Crew { substitute: CrewType[]; } -export function createBaseTankDefinitions(): TankDefinitions { +function createBaseTankDefinitions(): TankDefinitions { return { tanks: {} }; } @@ -530,13 +540,13 @@ export const TankDefinitions: MessageFns<TankDefinitions> = { }, }; -export function createBaseTankDefinitions_TanksEntry(): TankDefinitions_TanksEntry { - return { key: 0, value: createBaseTankDefinition() }; +function createBaseTankDefinitions_TanksEntry(): TankDefinitions_TanksEntry { + return { key: 0, value: undefined }; } export const TankDefinitions_TanksEntry: MessageFns<TankDefinitions_TanksEntry> = { encode(message: TankDefinitions_TanksEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== 0) { writer.uint32(8).uint32(message.key); } if (message.value !== undefined) { @@ -579,14 +589,14 @@ export const TankDefinitions_TanksEntry: MessageFns<TankDefinitions_TanksEntry> fromJSON(object: any): TankDefinitions_TanksEntry { return { - key: globalThis.Number(assertSet("TankDefinitions_TanksEntry.key", object.key)), - value: TankDefinition.fromJSON(assertSet("TankDefinitions_TanksEntry.value", object.value)), + key: isSet(object.key) ? globalThis.Number(object.key) : 0, + value: isSet(object.value) ? TankDefinition.fromJSON(object.value) : undefined, }; }, toJSON(message: TankDefinitions_TanksEntry): unknown { const obj: any = {}; - if (message.key !== undefined) { + if (message.key !== 0) { obj.key = Math.round(message.key); } if (message.value !== undefined) { @@ -603,12 +613,12 @@ export const TankDefinitions_TanksEntry: MessageFns<TankDefinitions_TanksEntry> message.key = object.key ?? 0; message.value = (object.value !== undefined && object.value !== null) ? TankDefinition.fromPartial(object.value) - : createBaseTankDefinition(); + : undefined; return message; }, }; -export function createBaseTankDefinition(): TankDefinition { +function createBaseTankDefinition(): TankDefinition { return { id: 0, slug: "", @@ -620,7 +630,7 @@ export function createBaseTankDefinition(): TankDefinition { crew: [], health: 0, nation: "", - name: createBaseI18nString(), + name: undefined, type: 0, max_consumables: 0, max_provisions: 0, @@ -631,7 +641,7 @@ export function createBaseTankDefinition(): TankDefinition { turrets: [], engines: [], tracks: [], - price: createBaseTankPrice(), + price: undefined, research_cost: undefined, speed_forwards: 0, speed_backwards: 0, @@ -1035,15 +1045,15 @@ export const TankDefinition: MessageFns<TankDefinition> = { fromJSON(object: any): TankDefinition { return { - id: globalThis.Number(assertSet("TankDefinition.id", object.id)), - slug: globalThis.String(assertSet("TankDefinition.slug", object.slug)), + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + slug: isSet(object.slug) ? globalThis.String(object.slug) : "", roles: isObject(object.roles) ? Object.entries(object.roles).reduce<{ [key: number]: number }>((acc, [key, value]) => { acc[globalThis.Number(key)] = Number(value); return acc; }, {}) : {}, - fixed_camouflage: globalThis.Boolean(assertSet("TankDefinition.fixed_camouflage", object.fixed_camouflage)), + fixed_camouflage: isSet(object.fixed_camouflage) ? globalThis.Boolean(object.fixed_camouflage) : false, camouflages: globalThis.Array.isArray(object?.camouflages) ? object.camouflages.map((e: any) => globalThis.Number(e)) : [], @@ -1053,19 +1063,17 @@ export const TankDefinition: MessageFns<TankDefinition> = { successors: globalThis.Array.isArray(object?.successors) ? object.successors.map((e: any) => globalThis.Number(e)) : [], - crew: globalThis.Array.isArray(object?.crew) - ? object.crew.map((e: any) => Crew.fromJSON(e)) - : [], - health: globalThis.Number(assertSet("TankDefinition.health", object.health)), - nation: globalThis.String(assertSet("TankDefinition.nation", object.nation)), - name: I18nString.fromJSON(assertSet("TankDefinition.name", object.name)), - type: tankTypeFromJSON(assertSet("TankDefinition.type", object.type)), - max_consumables: globalThis.Number(assertSet("TankDefinition.max_consumables", object.max_consumables)), - max_provisions: globalThis.Number(assertSet("TankDefinition.max_provisions", object.max_provisions)), - tier: globalThis.Number(assertSet("TankDefinition.tier", object.tier)), - class: tankClassFromJSON(assertSet("TankDefinition.class", object.class)), - testing: globalThis.Boolean(assertSet("TankDefinition.testing", object.testing)), - deprecated: globalThis.Boolean(assertSet("TankDefinition.deprecated", object.deprecated)), + crew: globalThis.Array.isArray(object?.crew) ? object.crew.map((e: any) => Crew.fromJSON(e)) : [], + health: isSet(object.health) ? globalThis.Number(object.health) : 0, + nation: isSet(object.nation) ? globalThis.String(object.nation) : "", + name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, + type: isSet(object.type) ? tankTypeFromJSON(object.type) : 0, + max_consumables: isSet(object.max_consumables) ? globalThis.Number(object.max_consumables) : 0, + max_provisions: isSet(object.max_provisions) ? globalThis.Number(object.max_provisions) : 0, + tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, + class: isSet(object.class) ? tankClassFromJSON(object.class) : 0, + testing: isSet(object.testing) ? globalThis.Boolean(object.testing) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, turrets: globalThis.Array.isArray(object?.turrets) ? object.turrets.map((e: any) => TurretDefinition.fromJSON(e)) : [], @@ -1075,15 +1083,15 @@ export const TankDefinition: MessageFns<TankDefinition> = { tracks: globalThis.Array.isArray(object?.tracks) ? object.tracks.map((e: any) => TrackDefinition.fromJSON(e)) : [], - price: TankPrice.fromJSON(assertSet("TankDefinition.price", object.price)), + price: isSet(object.price) ? TankPrice.fromJSON(object.price) : undefined, research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - speed_forwards: globalThis.Number(assertSet("TankDefinition.speed_forwards", object.speed_forwards)), - speed_backwards: globalThis.Number(assertSet("TankDefinition.speed_backwards", object.speed_backwards)), - camouflage_still: globalThis.Number(assertSet("TankDefinition.camouflage_still", object.camouflage_still)), - camouflage_moving: globalThis.Number(assertSet("TankDefinition.camouflage_moving", object.camouflage_moving)), - camouflage_onFire: globalThis.Number(assertSet("TankDefinition.camouflage_onFire", object.camouflage_onFire)), - equipment_preset: globalThis.String(assertSet("TankDefinition.equipment_preset", object.equipment_preset)), - weight: globalThis.Number(assertSet("TankDefinition.weight", object.weight)), + speed_forwards: isSet(object.speed_forwards) ? globalThis.Number(object.speed_forwards) : 0, + speed_backwards: isSet(object.speed_backwards) ? globalThis.Number(object.speed_backwards) : 0, + camouflage_still: isSet(object.camouflage_still) ? globalThis.Number(object.camouflage_still) : 0, + camouflage_moving: isSet(object.camouflage_moving) ? globalThis.Number(object.camouflage_moving) : 0, + camouflage_onFire: isSet(object.camouflage_onFire) ? globalThis.Number(object.camouflage_onFire) : 0, + equipment_preset: isSet(object.equipment_preset) ? globalThis.String(object.equipment_preset) : "", + weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, }; }, @@ -1210,7 +1218,7 @@ export const TankDefinition: MessageFns<TankDefinition> = { message.nation = object.nation ?? ""; message.name = (object.name !== undefined && object.name !== null) ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + : undefined; message.type = object.type ?? 0; message.max_consumables = object.max_consumables ?? 0; message.max_provisions = object.max_provisions ?? 0; @@ -1223,7 +1231,7 @@ export const TankDefinition: MessageFns<TankDefinition> = { message.tracks = object.tracks?.map((e) => TrackDefinition.fromPartial(e)) || []; message.price = (object.price !== undefined && object.price !== null) ? TankPrice.fromPartial(object.price) - : createBaseTankPrice(); + : undefined; message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) ? ResearchCost.fromPartial(object.research_cost) : undefined; @@ -1238,16 +1246,16 @@ export const TankDefinition: MessageFns<TankDefinition> = { }, }; -export function createBaseTankDefinition_RolesEntry(): TankDefinition_RolesEntry { +function createBaseTankDefinition_RolesEntry(): TankDefinition_RolesEntry { return { key: 0, value: 0 }; } export const TankDefinition_RolesEntry: MessageFns<TankDefinition_RolesEntry> = { encode(message: TankDefinition_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== undefined) { + if (message.key !== 0) { writer.uint32(8).uint32(message.key); } - if (message.value !== undefined) { + if (message.value !== 0) { writer.uint32(16).uint32(message.value); } return writer; @@ -1287,17 +1295,17 @@ export const TankDefinition_RolesEntry: MessageFns<TankDefinition_RolesEntry> = fromJSON(object: any): TankDefinition_RolesEntry { return { - key: globalThis.Number(assertSet("TankDefinition_RolesEntry.key", object.key)), - value: globalThis.Number(assertSet("TankDefinition_RolesEntry.value", object.value)), + key: isSet(object.key) ? globalThis.Number(object.key) : 0, + value: isSet(object.value) ? globalThis.Number(object.value) : 0, }; }, toJSON(message: TankDefinition_RolesEntry): unknown { const obj: any = {}; - if (message.key !== undefined) { + if (message.key !== 0) { obj.key = Math.round(message.key); } - if (message.value !== undefined) { + if (message.value !== 0) { obj.value = Math.round(message.value); } return obj; @@ -1314,7 +1322,7 @@ export const TankDefinition_RolesEntry: MessageFns<TankDefinition_RolesEntry> = }, }; -export function createBaseResearchCost(): ResearchCost { +function createBaseResearchCost(): ResearchCost { return { research_cost_type: undefined }; } @@ -1413,7 +1421,7 @@ export const ResearchCost: MessageFns<ResearchCost> = { }, }; -export function createBaseResearchCostSeasonalTokens(): ResearchCostSeasonalTokens { +function createBaseResearchCostSeasonalTokens(): ResearchCostSeasonalTokens { return { season: 0, tokens: 0 }; } @@ -1462,8 +1470,8 @@ export const ResearchCostSeasonalTokens: MessageFns<ResearchCostSeasonalTokens> fromJSON(object: any): ResearchCostSeasonalTokens { return { - season: globalThis.Number(assertSet("ResearchCostSeasonalTokens.season", object.season)), - tokens: globalThis.Number(assertSet("ResearchCostSeasonalTokens.tokens", object.tokens)), + season: isSet(object.season) ? globalThis.Number(object.season) : 0, + tokens: isSet(object.tokens) ? globalThis.Number(object.tokens) : 0, }; }, @@ -1489,7 +1497,7 @@ export const ResearchCostSeasonalTokens: MessageFns<ResearchCostSeasonalTokens> }, }; -export function createBaseTankPrice(): TankPrice { +function createBaseTankPrice(): TankPrice { return { type: 0, value: 0 }; } @@ -1538,8 +1546,8 @@ export const TankPrice: MessageFns<TankPrice> = { fromJSON(object: any): TankPrice { return { - type: tankPriceTypeFromJSON(assertSet("TankPrice.type", object.type)), - value: globalThis.Number(assertSet("TankPrice.value", object.value)), + type: isSet(object.type) ? tankPriceTypeFromJSON(object.type) : 0, + value: isSet(object.value) ? globalThis.Number(object.value) : 0, }; }, @@ -1565,11 +1573,11 @@ export const TankPrice: MessageFns<TankPrice> = { }, }; -export function createBaseTrackDefinition(): TrackDefinition { +function createBaseTrackDefinition(): TrackDefinition { return { id: 0, tier: 0, - name: createBaseI18nString(), + name: undefined, weight: 0, traverse_speed: 0, research_cost: undefined, @@ -1737,19 +1745,17 @@ export const TrackDefinition: MessageFns<TrackDefinition> = { fromJSON(object: any): TrackDefinition { return { - id: globalThis.Number(assertSet("TrackDefinition.id", object.id)), - tier: globalThis.Number(assertSet("TrackDefinition.tier", object.tier)), - name: I18nString.fromJSON(assertSet("TrackDefinition.name", object.name)), - weight: globalThis.Number(assertSet("TrackDefinition.weight", object.weight)), - traverse_speed: globalThis.Number(assertSet("TrackDefinition.traverse_speed", object.traverse_speed)), + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, + name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, + weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, + traverse_speed: isSet(object.traverse_speed) ? globalThis.Number(object.traverse_speed) : 0, research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - dispersion_move: globalThis.Number(assertSet("TrackDefinition.dispersion_move", object.dispersion_move)), - dispersion_traverse: globalThis.Number( - assertSet("TrackDefinition.dispersion_traverse", object.dispersion_traverse), - ), - resistance_hard: globalThis.Number(assertSet("TrackDefinition.resistance_hard", object.resistance_hard)), - resistance_medium: globalThis.Number(assertSet("TrackDefinition.resistance_medium", object.resistance_medium)), - resistance_soft: globalThis.Number(assertSet("TrackDefinition.resistance_soft", object.resistance_soft)), + dispersion_move: isSet(object.dispersion_move) ? globalThis.Number(object.dispersion_move) : 0, + dispersion_traverse: isSet(object.dispersion_traverse) ? globalThis.Number(object.dispersion_traverse) : 0, + resistance_hard: isSet(object.resistance_hard) ? globalThis.Number(object.resistance_hard) : 0, + resistance_medium: isSet(object.resistance_medium) ? globalThis.Number(object.resistance_medium) : 0, + resistance_soft: isSet(object.resistance_soft) ? globalThis.Number(object.resistance_soft) : 0, unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], }; }, @@ -1804,7 +1810,7 @@ export const TrackDefinition: MessageFns<TrackDefinition> = { message.tier = object.tier ?? 0; message.name = (object.name !== undefined && object.name !== null) ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + : undefined; message.weight = object.weight ?? 0; message.traverse_speed = object.traverse_speed ?? 0; message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) @@ -1820,10 +1826,10 @@ export const TrackDefinition: MessageFns<TrackDefinition> = { }, }; -export function createBaseEngineDefinition(): EngineDefinition { +function createBaseEngineDefinition(): EngineDefinition { return { id: 0, - name: createBaseI18nString(), + name: undefined, research_cost: undefined, tier: 0, fire_chance: 0, @@ -1944,13 +1950,13 @@ export const EngineDefinition: MessageFns<EngineDefinition> = { fromJSON(object: any): EngineDefinition { return { - id: globalThis.Number(assertSet("EngineDefinition.id", object.id)), - name: I18nString.fromJSON(assertSet("EngineDefinition.name", object.name)), + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - tier: globalThis.Number(assertSet("EngineDefinition.tier", object.tier)), - fire_chance: globalThis.Number(assertSet("EngineDefinition.fire_chance", object.fire_chance)), - power: globalThis.Number(assertSet("EngineDefinition.power", object.power)), - weight: globalThis.Number(assertSet("EngineDefinition.weight", object.weight)), + tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, + fire_chance: isSet(object.fire_chance) ? globalThis.Number(object.fire_chance) : 0, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], }; }, @@ -1992,7 +1998,7 @@ export const EngineDefinition: MessageFns<EngineDefinition> = { message.id = object.id ?? 0; message.name = (object.name !== undefined && object.name !== null) ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + : undefined; message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) ? ResearchCost.fromPartial(object.research_cost) : undefined; @@ -2005,14 +2011,14 @@ export const EngineDefinition: MessageFns<EngineDefinition> = { }, }; -export function createBaseTurretDefinition(): TurretDefinition { +function createBaseTurretDefinition(): TurretDefinition { return { id: 0, health: 0, view_range: 0, traverse_speed: 0, research_cost: undefined, - name: createBaseI18nString(), + name: undefined, tier: 0, weight: 0, guns: [], @@ -2153,14 +2159,14 @@ export const TurretDefinition: MessageFns<TurretDefinition> = { fromJSON(object: any): TurretDefinition { return { - id: globalThis.Number(assertSet("TurretDefinition.id", object.id)), - health: globalThis.Number(assertSet("TurretDefinition.health", object.health)), - view_range: globalThis.Number(assertSet("TurretDefinition.view_range", object.view_range)), - traverse_speed: globalThis.Number(assertSet("TurretDefinition.traverse_speed", object.traverse_speed)), + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + health: isSet(object.health) ? globalThis.Number(object.health) : 0, + view_range: isSet(object.view_range) ? globalThis.Number(object.view_range) : 0, + traverse_speed: isSet(object.traverse_speed) ? globalThis.Number(object.traverse_speed) : 0, research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - name: I18nString.fromJSON(assertSet("TurretDefinition.name", object.name)), - tier: globalThis.Number(assertSet("TurretDefinition.tier", object.tier)), - weight: globalThis.Number(assertSet("TurretDefinition.weight", object.weight)), + name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, + tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, + weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, guns: globalThis.Array.isArray(object?.guns) ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) : [], unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], }; @@ -2215,7 +2221,7 @@ export const TurretDefinition: MessageFns<TurretDefinition> = { : undefined; message.name = (object.name !== undefined && object.name !== null) ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + : undefined; message.tier = object.tier ?? 0; message.weight = object.weight ?? 0; message.guns = object.guns?.map((e) => GunDefinition.fromPartial(e)) || []; @@ -2224,7 +2230,7 @@ export const TurretDefinition: MessageFns<TurretDefinition> = { }, }; -export function createBaseGunDefinition(): GunDefinition { +function createBaseGunDefinition(): GunDefinition { return { gun_type: undefined }; } @@ -2344,8 +2350,8 @@ export const GunDefinition: MessageFns<GunDefinition> = { }, }; -export function createBaseGunDefinitionRegular(): GunDefinitionRegular { - return { base: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionRegularProperties() }; +function createBaseGunDefinitionRegular(): GunDefinitionRegular { + return { base: undefined, extension: undefined }; } export const GunDefinitionRegular: MessageFns<GunDefinitionRegular> = { @@ -2393,8 +2399,8 @@ export const GunDefinitionRegular: MessageFns<GunDefinitionRegular> = { fromJSON(object: any): GunDefinitionRegular { return { - base: GunDefinitionBase.fromJSON(assertSet("GunDefinitionRegular.base", object.base)), - extension: GunDefinitionRegularProperties.fromJSON(assertSet("GunDefinitionRegular.extension", object.extension)), + base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, + extension: isSet(object.extension) ? GunDefinitionRegularProperties.fromJSON(object.extension) : undefined, }; }, @@ -2416,15 +2422,15 @@ export const GunDefinitionRegular: MessageFns<GunDefinitionRegular> = { const message = createBaseGunDefinitionRegular(); message.base = (object.base !== undefined && object.base !== null) ? GunDefinitionBase.fromPartial(object.base) - : createBaseGunDefinitionBase(); + : undefined; message.extension = (object.extension !== undefined && object.extension !== null) ? GunDefinitionRegularProperties.fromPartial(object.extension) - : createBaseGunDefinitionRegularProperties(); + : undefined; return message; }, }; -export function createBaseGunDefinitionRegularProperties(): GunDefinitionRegularProperties { +function createBaseGunDefinitionRegularProperties(): GunDefinitionRegularProperties { return { reload: 0 }; } @@ -2461,7 +2467,7 @@ export const GunDefinitionRegularProperties: MessageFns<GunDefinitionRegularProp }, fromJSON(object: any): GunDefinitionRegularProperties { - return { reload: globalThis.Number(assertSet("GunDefinitionRegularProperties.reload", object.reload)) }; + return { reload: isSet(object.reload) ? globalThis.Number(object.reload) : 0 }; }, toJSON(message: GunDefinitionRegularProperties): unknown { @@ -2484,8 +2490,8 @@ export const GunDefinitionRegularProperties: MessageFns<GunDefinitionRegularProp }, }; -export function createBaseGunDefinitionAutoLoader(): GunDefinitionAutoLoader { - return { base: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionAutoLoaderProperties() }; +function createBaseGunDefinitionAutoLoader(): GunDefinitionAutoLoader { + return { base: undefined, extension: undefined }; } export const GunDefinitionAutoLoader: MessageFns<GunDefinitionAutoLoader> = { @@ -2533,10 +2539,8 @@ export const GunDefinitionAutoLoader: MessageFns<GunDefinitionAutoLoader> = { fromJSON(object: any): GunDefinitionAutoLoader { return { - base: GunDefinitionBase.fromJSON(assertSet("GunDefinitionAutoLoader.base", object.base)), - extension: GunDefinitionAutoLoaderProperties.fromJSON( - assertSet("GunDefinitionAutoLoader.extension", object.extension), - ), + base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, + extension: isSet(object.extension) ? GunDefinitionAutoLoaderProperties.fromJSON(object.extension) : undefined, }; }, @@ -2558,15 +2562,15 @@ export const GunDefinitionAutoLoader: MessageFns<GunDefinitionAutoLoader> = { const message = createBaseGunDefinitionAutoLoader(); message.base = (object.base !== undefined && object.base !== null) ? GunDefinitionBase.fromPartial(object.base) - : createBaseGunDefinitionBase(); + : undefined; message.extension = (object.extension !== undefined && object.extension !== null) ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) - : createBaseGunDefinitionAutoLoaderProperties(); + : undefined; return message; }, }; -export function createBaseGunDefinitionAutoLoaderProperties(): GunDefinitionAutoLoaderProperties { +function createBaseGunDefinitionAutoLoaderProperties(): GunDefinitionAutoLoaderProperties { return { clip_reload: 0, intra_clip: 0, shell_count: 0 }; } @@ -2626,9 +2630,9 @@ export const GunDefinitionAutoLoaderProperties: MessageFns<GunDefinitionAutoLoad fromJSON(object: any): GunDefinitionAutoLoaderProperties { return { - clip_reload: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.clip_reload", object.clip_reload)), - intra_clip: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.intra_clip", object.intra_clip)), - shell_count: globalThis.Number(assertSet("GunDefinitionAutoLoaderProperties.shell_count", object.shell_count)), + clip_reload: isSet(object.clip_reload) ? globalThis.Number(object.clip_reload) : 0, + intra_clip: isSet(object.intra_clip) ? globalThis.Number(object.intra_clip) : 0, + shell_count: isSet(object.shell_count) ? globalThis.Number(object.shell_count) : 0, }; }, @@ -2662,8 +2666,8 @@ export const GunDefinitionAutoLoaderProperties: MessageFns<GunDefinitionAutoLoad }, }; -export function createBaseGunDefinitionAutoReloader(): GunDefinitionAutoReloader { - return { base: createBaseGunDefinitionBase(), extension: createBaseGunDefinitionAutoReloaderProperties() }; +function createBaseGunDefinitionAutoReloader(): GunDefinitionAutoReloader { + return { base: undefined, extension: undefined }; } export const GunDefinitionAutoReloader: MessageFns<GunDefinitionAutoReloader> = { @@ -2711,10 +2715,8 @@ export const GunDefinitionAutoReloader: MessageFns<GunDefinitionAutoReloader> = fromJSON(object: any): GunDefinitionAutoReloader { return { - base: GunDefinitionBase.fromJSON(assertSet("GunDefinitionAutoReloader.base", object.base)), - extension: GunDefinitionAutoReloaderProperties.fromJSON( - assertSet("GunDefinitionAutoReloader.extension", object.extension), - ), + base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, + extension: isSet(object.extension) ? GunDefinitionAutoReloaderProperties.fromJSON(object.extension) : undefined, }; }, @@ -2736,15 +2738,15 @@ export const GunDefinitionAutoReloader: MessageFns<GunDefinitionAutoReloader> = const message = createBaseGunDefinitionAutoReloader(); message.base = (object.base !== undefined && object.base !== null) ? GunDefinitionBase.fromPartial(object.base) - : createBaseGunDefinitionBase(); + : undefined; message.extension = (object.extension !== undefined && object.extension !== null) ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) - : createBaseGunDefinitionAutoReloaderProperties(); + : undefined; return message; }, }; -export function createBaseGunDefinitionAutoReloaderProperties(): GunDefinitionAutoReloaderProperties { +function createBaseGunDefinitionAutoReloaderProperties(): GunDefinitionAutoReloaderProperties { return { shell_reloads: [], intra_clip: 0, shell_count: 0 }; } @@ -2819,8 +2821,8 @@ export const GunDefinitionAutoReloaderProperties: MessageFns<GunDefinitionAutoRe shell_reloads: globalThis.Array.isArray(object?.shell_reloads) ? object.shell_reloads.map((e: any) => globalThis.Number(e)) : [], - intra_clip: globalThis.Number(assertSet("GunDefinitionAutoReloaderProperties.intra_clip", object.intra_clip)), - shell_count: globalThis.Number(assertSet("GunDefinitionAutoReloaderProperties.shell_count", object.shell_count)), + intra_clip: isSet(object.intra_clip) ? globalThis.Number(object.intra_clip) : 0, + shell_count: isSet(object.shell_count) ? globalThis.Number(object.shell_count) : 0, }; }, @@ -2854,13 +2856,13 @@ export const GunDefinitionAutoReloaderProperties: MessageFns<GunDefinitionAutoRe }, }; -export function createBaseGunDefinitionBase(): GunDefinitionBase { +function createBaseGunDefinitionBase(): GunDefinitionBase { return { id: 0, rotation_speed: 0, research_cost: undefined, weight: 0, - name: createBaseI18nString(), + name: undefined, tier: 0, shells: [], camouflage_loss: 0, @@ -2871,6 +2873,7 @@ export function createBaseGunDefinitionBase(): GunDefinitionBase { dispersion_damaged: 0, unlocks: [], shell_capacity: 0, + assault_ranges: undefined, }; } @@ -2921,6 +2924,9 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { if (message.shell_capacity !== 0) { writer.uint32(120).uint32(message.shell_capacity); } + if (message.assault_ranges !== undefined) { + AssaultRanges.encode(message.assault_ranges, writer.uint32(130).fork()).join(); + } return writer; }, @@ -3051,6 +3057,14 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { message.shell_capacity = reader.uint32(); continue; } + case 16: { + if (tag !== 130) { + break; + } + + message.assault_ranges = AssaultRanges.decode(reader, reader.uint32()); + continue; + } } if ((tag & 7) === 4 || tag === 0) { break; @@ -3062,27 +3076,24 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { fromJSON(object: any): GunDefinitionBase { return { - id: globalThis.Number(assertSet("GunDefinitionBase.id", object.id)), - rotation_speed: globalThis.Number(assertSet("GunDefinitionBase.rotation_speed", object.rotation_speed)), + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + rotation_speed: isSet(object.rotation_speed) ? globalThis.Number(object.rotation_speed) : 0, research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - weight: globalThis.Number(assertSet("GunDefinitionBase.weight", object.weight)), - name: I18nString.fromJSON(assertSet("GunDefinitionBase.name", object.name)), - tier: globalThis.Number(assertSet("GunDefinitionBase.tier", object.tier)), + weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, + name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, + tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, shells: globalThis.Array.isArray(object?.shells) ? object.shells.map((e: any) => ShellDefinition.fromJSON(e)) : [], - camouflage_loss: globalThis.Number(assertSet("GunDefinitionBase.camouflage_loss", object.camouflage_loss)), - aim_time: globalThis.Number(assertSet("GunDefinitionBase.aim_time", object.aim_time)), - dispersion_base: globalThis.Number(assertSet("GunDefinitionBase.dispersion_base", object.dispersion_base)), - dispersion_traverse: globalThis.Number( - assertSet("GunDefinitionBase.dispersion_traverse", object.dispersion_traverse), - ), - dispersion_shot: globalThis.Number(assertSet("GunDefinitionBase.dispersion_shot", object.dispersion_shot)), - dispersion_damaged: globalThis.Number( - assertSet("GunDefinitionBase.dispersion_damaged", object.dispersion_damaged), - ), + camouflage_loss: isSet(object.camouflage_loss) ? globalThis.Number(object.camouflage_loss) : 0, + aim_time: isSet(object.aim_time) ? globalThis.Number(object.aim_time) : 0, + dispersion_base: isSet(object.dispersion_base) ? globalThis.Number(object.dispersion_base) : 0, + dispersion_traverse: isSet(object.dispersion_traverse) ? globalThis.Number(object.dispersion_traverse) : 0, + dispersion_shot: isSet(object.dispersion_shot) ? globalThis.Number(object.dispersion_shot) : 0, + dispersion_damaged: isSet(object.dispersion_damaged) ? globalThis.Number(object.dispersion_damaged) : 0, unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], - shell_capacity: globalThis.Number(assertSet("GunDefinitionBase.shell_capacity", object.shell_capacity)), + shell_capacity: isSet(object.shell_capacity) ? globalThis.Number(object.shell_capacity) : 0, + assault_ranges: isSet(object.assault_ranges) ? AssaultRanges.fromJSON(object.assault_ranges) : undefined, }; }, @@ -3133,6 +3144,9 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { if (message.shell_capacity !== 0) { obj.shell_capacity = Math.round(message.shell_capacity); } + if (message.assault_ranges !== undefined) { + obj.assault_ranges = AssaultRanges.toJSON(message.assault_ranges); + } return obj; }, @@ -3149,7 +3163,7 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { message.weight = object.weight ?? 0; message.name = (object.name !== undefined && object.name !== null) ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + : undefined; message.tier = object.tier ?? 0; message.shells = object.shells?.map((e) => ShellDefinition.fromPartial(e)) || []; message.camouflage_loss = object.camouflage_loss ?? 0; @@ -3160,24 +3174,163 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { message.dispersion_damaged = object.dispersion_damaged ?? 0; message.unlocks = object.unlocks?.map((e) => Unlock.fromPartial(e)) || []; message.shell_capacity = object.shell_capacity ?? 0; + message.assault_ranges = (object.assault_ranges !== undefined && object.assault_ranges !== null) + ? AssaultRanges.fromPartial(object.assault_ranges) + : undefined; return message; }, }; -export function createBaseShellDefinition(): ShellDefinition { +function createBaseAssaultRanges(): AssaultRanges { + return { ranges: [] }; +} + +export const AssaultRanges: MessageFns<AssaultRanges> = { + encode(message: AssaultRanges, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ranges) { + AssaultRange.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AssaultRanges { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAssaultRanges(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.ranges.push(AssaultRange.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AssaultRanges { + return { + ranges: globalThis.Array.isArray(object?.ranges) ? object.ranges.map((e: any) => AssaultRange.fromJSON(e)) : [], + }; + }, + + toJSON(message: AssaultRanges): unknown { + const obj: any = {}; + if (message.ranges?.length) { + obj.ranges = message.ranges.map((e) => AssaultRange.toJSON(e)); + } + return obj; + }, + + create<I extends Exact<DeepPartial<AssaultRanges>, I>>(base?: I): AssaultRanges { + return AssaultRanges.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<AssaultRanges>, I>>(object: I): AssaultRanges { + const message = createBaseAssaultRanges(); + message.ranges = object.ranges?.map((e) => AssaultRange.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAssaultRange(): AssaultRange { + return { distance: 0, factor: 0 }; +} + +export const AssaultRange: MessageFns<AssaultRange> = { + encode(message: AssaultRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.distance !== 0) { + writer.uint32(13).float(message.distance); + } + if (message.factor !== 0) { + writer.uint32(21).float(message.factor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AssaultRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAssaultRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + + message.distance = reader.float(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + + message.factor = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AssaultRange { + return { + distance: isSet(object.distance) ? globalThis.Number(object.distance) : 0, + factor: isSet(object.factor) ? globalThis.Number(object.factor) : 0, + }; + }, + + toJSON(message: AssaultRange): unknown { + const obj: any = {}; + if (message.distance !== 0) { + obj.distance = message.distance; + } + if (message.factor !== 0) { + obj.factor = message.factor; + } + return obj; + }, + + create<I extends Exact<DeepPartial<AssaultRange>, I>>(base?: I): AssaultRange { + return AssaultRange.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<AssaultRange>, I>>(object: I): AssaultRange { + const message = createBaseAssaultRange(); + message.distance = object.distance ?? 0; + message.factor = object.factor ?? 0; + return message; + }, +}; + +function createBaseShellDefinition(): ShellDefinition { return { id: 0, - name: createBaseI18nString(), + name: undefined, velocity: 0, armor_damage: 0, module_damage: 0, caliber: 0, icon: "", - penetration: createBaseShellPenetration(), + penetration: undefined, type: 0, - normalization: undefined, - ricochet: undefined, - explosion_radius: undefined, + normalization: 0, + ricochet: 0, + explosion_radius: 0, range: 0, }; } @@ -3211,13 +3364,13 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { if (message.type !== 0) { writer.uint32(72).int32(message.type); } - if (message.normalization !== undefined && message.normalization !== undefined) { + if (message.normalization !== undefined && message.normalization !== 0) { writer.uint32(85).float(message.normalization); } - if (message.ricochet !== undefined && message.ricochet !== undefined) { + if (message.ricochet !== undefined && message.ricochet !== 0) { writer.uint32(93).float(message.ricochet); } - if (message.explosion_radius !== undefined && message.explosion_radius !== undefined) { + if (message.explosion_radius !== undefined && message.explosion_radius !== 0) { writer.uint32(101).float(message.explosion_radius); } if (message.range !== 0) { @@ -3348,19 +3501,19 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { fromJSON(object: any): ShellDefinition { return { - id: globalThis.Number(assertSet("ShellDefinition.id", object.id)), - name: I18nString.fromJSON(assertSet("ShellDefinition.name", object.name)), - velocity: globalThis.Number(assertSet("ShellDefinition.velocity", object.velocity)), - armor_damage: globalThis.Number(assertSet("ShellDefinition.armor_damage", object.armor_damage)), - module_damage: globalThis.Number(assertSet("ShellDefinition.module_damage", object.module_damage)), - caliber: globalThis.Number(assertSet("ShellDefinition.caliber", object.caliber)), - icon: globalThis.String(assertSet("ShellDefinition.icon", object.icon)), - penetration: ShellPenetration.fromJSON(assertSet("ShellDefinition.penetration", object.penetration)), - type: shellTypeFromJSON(assertSet("ShellDefinition.type", object.type)), - normalization: isSet(object.normalization) ? globalThis.Number(object.normalization) : undefined, - ricochet: isSet(object.ricochet) ? globalThis.Number(object.ricochet) : undefined, - explosion_radius: isSet(object.explosion_radius) ? globalThis.Number(object.explosion_radius) : undefined, - range: globalThis.Number(assertSet("ShellDefinition.range", object.range)), + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, + velocity: isSet(object.velocity) ? globalThis.Number(object.velocity) : 0, + armor_damage: isSet(object.armor_damage) ? globalThis.Number(object.armor_damage) : 0, + module_damage: isSet(object.module_damage) ? globalThis.Number(object.module_damage) : 0, + caliber: isSet(object.caliber) ? globalThis.Number(object.caliber) : 0, + icon: isSet(object.icon) ? globalThis.String(object.icon) : "", + penetration: isSet(object.penetration) ? ShellPenetration.fromJSON(object.penetration) : undefined, + type: isSet(object.type) ? shellTypeFromJSON(object.type) : 0, + normalization: isSet(object.normalization) ? globalThis.Number(object.normalization) : 0, + ricochet: isSet(object.ricochet) ? globalThis.Number(object.ricochet) : 0, + explosion_radius: isSet(object.explosion_radius) ? globalThis.Number(object.explosion_radius) : 0, + range: isSet(object.range) ? globalThis.Number(object.range) : 0, }; }, @@ -3393,13 +3546,13 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { if (message.type !== 0) { obj.type = shellTypeToJSON(message.type); } - if (message.normalization !== undefined && message.normalization !== undefined) { + if (message.normalization !== undefined && message.normalization !== 0) { obj.normalization = message.normalization; } - if (message.ricochet !== undefined && message.ricochet !== undefined) { + if (message.ricochet !== undefined && message.ricochet !== 0) { obj.ricochet = message.ricochet; } - if (message.explosion_radius !== undefined && message.explosion_radius !== undefined) { + if (message.explosion_radius !== undefined && message.explosion_radius !== 0) { obj.explosion_radius = message.explosion_radius; } if (message.range !== 0) { @@ -3416,7 +3569,7 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { message.id = object.id ?? 0; message.name = (object.name !== undefined && object.name !== null) ? I18nString.fromPartial(object.name) - : createBaseI18nString(); + : undefined; message.velocity = object.velocity ?? 0; message.armor_damage = object.armor_damage ?? 0; message.module_damage = object.module_damage ?? 0; @@ -3424,17 +3577,17 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { message.icon = object.icon ?? ""; message.penetration = (object.penetration !== undefined && object.penetration !== null) ? ShellPenetration.fromPartial(object.penetration) - : createBaseShellPenetration(); + : undefined; message.type = object.type ?? 0; - message.normalization = object.normalization ?? undefined; - message.ricochet = object.ricochet ?? undefined; - message.explosion_radius = object.explosion_radius ?? undefined; + message.normalization = object.normalization ?? 0; + message.ricochet = object.ricochet ?? 0; + message.explosion_radius = object.explosion_radius ?? 0; message.range = object.range ?? 0; return message; }, }; -export function createBaseShellPenetration(): ShellPenetration { +function createBaseShellPenetration(): ShellPenetration { return { near: 0, far: 0 }; } @@ -3483,8 +3636,8 @@ export const ShellPenetration: MessageFns<ShellPenetration> = { fromJSON(object: any): ShellPenetration { return { - near: globalThis.Number(assertSet("ShellPenetration.near", object.near)), - far: globalThis.Number(assertSet("ShellPenetration.far", object.far)), + near: isSet(object.near) ? globalThis.Number(object.near) : 0, + far: isSet(object.far) ? globalThis.Number(object.far) : 0, }; }, @@ -3510,8 +3663,8 @@ export const ShellPenetration: MessageFns<ShellPenetration> = { }, }; -export function createBaseUnlock(): Unlock { - return { id: 0, type: 0, cost: createBaseUnlockCost() }; +function createBaseUnlock(): Unlock { + return { id: 0, type: 0, cost: undefined }; } export const Unlock: MessageFns<Unlock> = { @@ -3570,9 +3723,9 @@ export const Unlock: MessageFns<Unlock> = { fromJSON(object: any): Unlock { return { - id: globalThis.Number(assertSet("Unlock.id", object.id)), - type: moduleTypeFromJSON(assertSet("Unlock.type", object.type)), - cost: UnlockCost.fromJSON(assertSet("Unlock.cost", object.cost)), + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + type: isSet(object.type) ? moduleTypeFromJSON(object.type) : 0, + cost: isSet(object.cost) ? UnlockCost.fromJSON(object.cost) : undefined, }; }, @@ -3599,12 +3752,12 @@ export const Unlock: MessageFns<Unlock> = { message.type = object.type ?? 0; message.cost = (object.cost !== undefined && object.cost !== null) ? UnlockCost.fromPartial(object.cost) - : createBaseUnlockCost(); + : undefined; return message; }, }; -export function createBaseUnlockCost(): UnlockCost { +function createBaseUnlockCost(): UnlockCost { return { type: "", value: 0 }; } @@ -3653,8 +3806,8 @@ export const UnlockCost: MessageFns<UnlockCost> = { fromJSON(object: any): UnlockCost { return { - type: globalThis.String(assertSet("UnlockCost.type", object.type)), - value: globalThis.Number(assertSet("UnlockCost.value", object.value)), + type: isSet(object.type) ? globalThis.String(object.type) : "", + value: isSet(object.value) ? globalThis.Number(object.value) : 0, }; }, @@ -3680,7 +3833,7 @@ export const UnlockCost: MessageFns<UnlockCost> = { }, }; -export function createBaseCrew(): Crew { +function createBaseCrew(): Crew { return { type: 0, count: 0, substitute: [] }; } @@ -3752,8 +3905,8 @@ export const Crew: MessageFns<Crew> = { fromJSON(object: any): Crew { return { - type: crewTypeFromJSON(assertSet("Crew.type", object.type)), - count: globalThis.Number(assertSet("Crew.count", object.count)), + type: isSet(object.type) ? crewTypeFromJSON(object.type) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, substitute: globalThis.Array.isArray(object?.substitute) ? object.substitute.map((e: any) => crewTypeFromJSON(e)) : [], @@ -3807,14 +3960,6 @@ 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; diff --git a/packages/scripts/src/buildAssets/definitions.ts b/packages/scripts/src/buildAssets/definitions.ts index e47ade458..d69607cfa 100644 --- a/packages/scripts/src/buildAssets/definitions.ts +++ b/packages/scripts/src/buildAssets/definitions.ts @@ -1,5 +1,6 @@ import { Armor, + AssaultRanges, BlitzTankClass, CamouflageDefinitions, Consumable, @@ -1251,6 +1252,7 @@ export async function definitions() { const maskEnabled = tankParameters.maskSlice?.[maskName]?.enabled ?? false; let mask: number | undefined; + let assault_ranges: AssaultRanges | undefined; if (gun.extras?.trayShell) { const kinds = gun.extras.trayShell.kinds @@ -1272,7 +1274,7 @@ export async function definitions() { const sector = gun.extras.trayShell.sectors.sector; - gun.assault_ranges = { + assault_ranges = { ranges: sector.map((value) => ({ factor: value.factor, distance: value.distance, @@ -1325,6 +1327,7 @@ export async function definitions() { dispersion_traverse: shotDispersionFactors.turretRotation, unlocks: resolveUnlocks(gun.unlocks), shell_capacity: gun.maxAmmo ?? gunListEntry.maxAmmo, + assault_ranges, } satisfies GunDefinitionBase; tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({ @@ -1408,7 +1411,7 @@ export async function definitions() { tankDefinitions.tanks[tankId].turrets[turretIndex].guns[ gunIndex - ].gun_type!.value.base.shells.push({ + ].gun_type!.value.base!.shells.push({ id: shellId, name: shellName, velocity: gunShellEntry.speed, @@ -1496,8 +1499,8 @@ export async function definitions() { turret.research_cost = turretXps.get(turret.id); Object.values(turret.guns).forEach((gunRaw) => { - gunRaw.gun_type!.value.base.research_cost = gunXps.get( - gunRaw.gun_type!.value.base.id, + gunRaw.gun_type!.value.base!.research_cost = gunXps.get( + gunRaw.gun_type!.value.base!.id, ); }); }); From 81e480f9831e41c52398a066ccb553ecb72a94ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 13:44:55 -0500 Subject: [PATCH 39/71] fix: remove debug code --- packages/scripts/src/buildAssets/definitions.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/scripts/src/buildAssets/definitions.ts b/packages/scripts/src/buildAssets/definitions.ts index d69607cfa..94be82e5d 100644 --- a/packages/scripts/src/buildAssets/definitions.ts +++ b/packages/scripts/src/buildAssets/definitions.ts @@ -578,11 +578,6 @@ export async function definitions() { await Promise.all( SUPPORTED_LOCALES.map(async (locale) => { - if (locale !== 'en') { - stringsI18n[locale] = {}; - return; - } - const blitzLocale = SUPPORTED_LOCALE_BLITZ_MAP[locale]; const cache = await fetch( `https://stufficons.wgcdn.co/localizations/${blitzLocale}.yaml`, @@ -1795,7 +1790,6 @@ export async function definitions() { }; }); - return; await commitAssets('definitions', [ { content: GameDefinitions.encode(gameDefinitions).finish(), From ba97a9f28b85b72dfa62a2d2ca71a0a6f5a8512a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:07:21 -0500 Subject: [PATCH 40/71] feat: some implementation --- .../core/src/protos/tank_definitions.proto | 1 + packages/core/src/protos/tank_definitions.ts | 2278 ++++++++++------- .../scripts/src/buildAssets/definitions.ts | 3 +- .../components/InfoWithDelta.tsx | 1 + .../components/Characteristics/index.tsx | 1 + .../components/SceneProps/index.tsx | 1 + .../src/core/blitzkit/tankCharacteristics.ts | 14 +- .../src/pages/[...locale]/compare/_index.tsx | 1 + .../[...locale]/tanks/[slug]/index.astro | 4 +- 9 files changed, 1422 insertions(+), 882 deletions(-) diff --git a/packages/core/src/protos/tank_definitions.proto b/packages/core/src/protos/tank_definitions.proto index 043cd7bd4..52143cbee 100644 --- a/packages/core/src/protos/tank_definitions.proto +++ b/packages/core/src/protos/tank_definitions.proto @@ -162,6 +162,7 @@ message GunDefinitionBase { message AssaultRanges { repeated AssaultRange ranges = 1; + repeated ShellType types = 2; } message AssaultRange { diff --git a/packages/core/src/protos/tank_definitions.ts b/packages/core/src/protos/tank_definitions.ts index 8fcd2b37b..d0b39185a 100644 --- a/packages/core/src/protos/tank_definitions.ts +++ b/packages/core/src/protos/tank_definitions.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/tank_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { createBaseI18nString, I18nString } from "./i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { I18nString } from './i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export enum TankPriceType { CREDITS = 0, @@ -18,24 +18,28 @@ export enum TankPriceType { export function tankPriceTypeFromJSON(object: any): TankPriceType { switch (object) { case 0: - case "TANK_PRICE_TYPE_CREDITS": + case 'TANK_PRICE_TYPE_CREDITS': return TankPriceType.CREDITS; case 1: - case "TANK_PRICE_TYPE_GOLD": + case 'TANK_PRICE_TYPE_GOLD': return TankPriceType.GOLD; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankPriceType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankPriceType', + ); } } export function tankPriceTypeToJSON(object: TankPriceType): string { switch (object) { case TankPriceType.CREDITS: - return "TANK_PRICE_TYPE_CREDITS"; + return 'TANK_PRICE_TYPE_CREDITS'; case TankPriceType.GOLD: - return "TANK_PRICE_TYPE_GOLD"; + return 'TANK_PRICE_TYPE_GOLD'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankPriceType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankPriceType', + ); } } @@ -49,34 +53,38 @@ export enum ShellType { export function shellTypeFromJSON(object: any): ShellType { switch (object) { case 0: - case "SHELL_TYPE_AP": + case 'SHELL_TYPE_AP': return ShellType.AP; case 1: - case "SHELL_TYPE_APCR": + case 'SHELL_TYPE_APCR': return ShellType.APCR; case 2: - case "SHELL_TYPE_HEAT": + case 'SHELL_TYPE_HEAT': return ShellType.HEAT; case 3: - case "SHELL_TYPE_HE": + case 'SHELL_TYPE_HE': return ShellType.HE; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ShellType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ShellType', + ); } } export function shellTypeToJSON(object: ShellType): string { switch (object) { case ShellType.AP: - return "SHELL_TYPE_AP"; + return 'SHELL_TYPE_AP'; case ShellType.APCR: - return "SHELL_TYPE_APCR"; + return 'SHELL_TYPE_APCR'; case ShellType.HEAT: - return "SHELL_TYPE_HEAT"; + return 'SHELL_TYPE_HEAT'; case ShellType.HE: - return "SHELL_TYPE_HE"; + return 'SHELL_TYPE_HE'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ShellType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ShellType', + ); } } @@ -91,39 +99,43 @@ export enum ModuleType { export function moduleTypeFromJSON(object: any): ModuleType { switch (object) { case 0: - case "MODULE_TYPE_VEHICLE": + case 'MODULE_TYPE_VEHICLE': return ModuleType.VEHICLE; case 1: - case "MODULE_TYPE_ENGINE": + case 'MODULE_TYPE_ENGINE': return ModuleType.ENGINE; case 2: - case "MODULE_TYPE_TRACKS": + case 'MODULE_TYPE_TRACKS': return ModuleType.TRACKS; case 3: - case "MODULE_TYPE_TURRET": + case 'MODULE_TYPE_TURRET': return ModuleType.TURRET; case 4: - case "MODULE_TYPE_GUN": + case 'MODULE_TYPE_GUN': return ModuleType.GUN; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ModuleType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ModuleType', + ); } } export function moduleTypeToJSON(object: ModuleType): string { switch (object) { case ModuleType.VEHICLE: - return "MODULE_TYPE_VEHICLE"; + return 'MODULE_TYPE_VEHICLE'; case ModuleType.ENGINE: - return "MODULE_TYPE_ENGINE"; + return 'MODULE_TYPE_ENGINE'; case ModuleType.TRACKS: - return "MODULE_TYPE_TRACKS"; + return 'MODULE_TYPE_TRACKS'; case ModuleType.TURRET: - return "MODULE_TYPE_TURRET"; + return 'MODULE_TYPE_TURRET'; case ModuleType.GUN: - return "MODULE_TYPE_GUN"; + return 'MODULE_TYPE_GUN'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum ModuleType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum ModuleType', + ); } } @@ -137,34 +149,38 @@ export enum TankClass { export function tankClassFromJSON(object: any): TankClass { switch (object) { case 0: - case "TANK_CLASS_LIGHT": + case 'TANK_CLASS_LIGHT': return TankClass.LIGHT; case 1: - case "TANK_CLASS_MEDIUM": + case 'TANK_CLASS_MEDIUM': return TankClass.MEDIUM; case 2: - case "TANK_CLASS_HEAVY": + case 'TANK_CLASS_HEAVY': return TankClass.HEAVY; case 3: - case "TANK_CLASS_TANK_DESTROYER": + case 'TANK_CLASS_TANK_DESTROYER': return TankClass.TANK_DESTROYER; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankClass"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankClass', + ); } } export function tankClassToJSON(object: TankClass): string { switch (object) { case TankClass.LIGHT: - return "TANK_CLASS_LIGHT"; + return 'TANK_CLASS_LIGHT'; case TankClass.MEDIUM: - return "TANK_CLASS_MEDIUM"; + return 'TANK_CLASS_MEDIUM'; case TankClass.HEAVY: - return "TANK_CLASS_HEAVY"; + return 'TANK_CLASS_HEAVY'; case TankClass.TANK_DESTROYER: - return "TANK_CLASS_TANK_DESTROYER"; + return 'TANK_CLASS_TANK_DESTROYER'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankClass"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankClass', + ); } } @@ -177,29 +193,33 @@ export enum TankType { export function tankTypeFromJSON(object: any): TankType { switch (object) { case 0: - case "TANK_TYPE_RESEARCHABLE": + case 'TANK_TYPE_RESEARCHABLE': return TankType.RESEARCHABLE; case 1: - case "TANK_TYPE_PREMIUM": + case 'TANK_TYPE_PREMIUM': return TankType.PREMIUM; case 2: - case "TANK_TYPE_COLLECTOR": + case 'TANK_TYPE_COLLECTOR': return TankType.COLLECTOR; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankType', + ); } } export function tankTypeToJSON(object: TankType): string { switch (object) { case TankType.RESEARCHABLE: - return "TANK_TYPE_RESEARCHABLE"; + return 'TANK_TYPE_RESEARCHABLE'; case TankType.PREMIUM: - return "TANK_TYPE_PREMIUM"; + return 'TANK_TYPE_PREMIUM'; case TankType.COLLECTOR: - return "TANK_TYPE_COLLECTOR"; + return 'TANK_TYPE_COLLECTOR'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum TankType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum TankType', + ); } } @@ -214,39 +234,43 @@ export enum CrewType { export function crewTypeFromJSON(object: any): CrewType { switch (object) { case 0: - case "CREW_TYPE_COMMANDER": + case 'CREW_TYPE_COMMANDER': return CrewType.COMMANDER; case 1: - case "CREW_TYPE_RADIOMAN": + case 'CREW_TYPE_RADIOMAN': return CrewType.RADIOMAN; case 2: - case "CREW_TYPE_GUNNER": + case 'CREW_TYPE_GUNNER': return CrewType.GUNNER; case 3: - case "CREW_TYPE_DRIVER": + case 'CREW_TYPE_DRIVER': return CrewType.DRIVER; case 4: - case "CREW_TYPE_LOADER": + case 'CREW_TYPE_LOADER': return CrewType.LOADER; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum CrewType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum CrewType', + ); } } export function crewTypeToJSON(object: CrewType): string { switch (object) { case CrewType.COMMANDER: - return "CREW_TYPE_COMMANDER"; + return 'CREW_TYPE_COMMANDER'; case CrewType.RADIOMAN: - return "CREW_TYPE_RADIOMAN"; + return 'CREW_TYPE_RADIOMAN'; case CrewType.GUNNER: - return "CREW_TYPE_GUNNER"; + return 'CREW_TYPE_GUNNER'; case CrewType.DRIVER: - return "CREW_TYPE_DRIVER"; + return 'CREW_TYPE_DRIVER'; case CrewType.LOADER: - return "CREW_TYPE_LOADER"; + return 'CREW_TYPE_LOADER'; default: - throw new globalThis.Error("Unrecognized enum value " + object + " for enum CrewType"); + throw new globalThis.Error( + 'Unrecognized enum value ' + object + ' for enum CrewType', + ); } } @@ -270,7 +294,7 @@ export interface TankDefinition { crew: Crew[]; health: number; nation: string; - name: I18nString | undefined; + name: I18nString; type: TankType; max_consumables: number; max_provisions: number; @@ -299,8 +323,8 @@ export interface TankDefinition_RolesEntry { export interface ResearchCost { research_cost_type?: - | { $case: "xp"; value: number } - | { $case: "seasonal_tokens"; value: ResearchCostSeasonalTokens } + | { $case: 'xp'; value: number } + | { $case: 'seasonal_tokens'; value: ResearchCostSeasonalTokens } | undefined; } @@ -355,15 +379,15 @@ export interface TurretDefinition { export interface GunDefinition { gun_type?: - | { $case: "regular"; value: GunDefinitionRegular } - | { $case: "auto_loader"; value: GunDefinitionAutoLoader } - | { $case: "auto_reloader"; value: GunDefinitionAutoReloader } + | { $case: 'regular'; value: GunDefinitionRegular } + | { $case: 'auto_loader'; value: GunDefinitionAutoLoader } + | { $case: 'auto_reloader'; value: GunDefinitionAutoReloader } | undefined; } export interface GunDefinitionRegular { - base: GunDefinitionBase | undefined; - extension: GunDefinitionRegularProperties | undefined; + base: GunDefinitionBase; + extension: GunDefinitionRegularProperties; } export interface GunDefinitionRegularProperties { @@ -371,8 +395,8 @@ export interface GunDefinitionRegularProperties { } export interface GunDefinitionAutoLoader { - base: GunDefinitionBase | undefined; - extension: GunDefinitionAutoLoaderProperties | undefined; + base: GunDefinitionBase; + extension: GunDefinitionAutoLoaderProperties; } export interface GunDefinitionAutoLoaderProperties { @@ -382,8 +406,8 @@ export interface GunDefinitionAutoLoaderProperties { } export interface GunDefinitionAutoReloader { - base: GunDefinitionBase | undefined; - extension: GunDefinitionAutoReloaderProperties | undefined; + base: GunDefinitionBase; + extension: GunDefinitionAutoReloaderProperties; } export interface GunDefinitionAutoReloaderProperties { @@ -428,7 +452,7 @@ export interface ShellDefinition { module_damage: number; caliber: number; icon: string; - penetration: ShellPenetration | undefined; + penetration: ShellPenetration; type: ShellType; normalization?: number | undefined; ricochet?: number | undefined; @@ -463,15 +487,22 @@ function createBaseTankDefinitions(): TankDefinitions { } export const TankDefinitions: MessageFns<TankDefinitions> = { - encode(message: TankDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TankDefinitions, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { Object.entries(message.tanks).forEach(([key, value]) => { - TankDefinitions_TanksEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + TankDefinitions_TanksEntry.encode( + { key: key as any, value }, + writer.uint32(10).fork(), + ).join(); }); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): TankDefinitions { - 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 = createBaseTankDefinitions(); while (reader.pos < end) { @@ -482,7 +513,10 @@ export const TankDefinitions: MessageFns<TankDefinitions> = { break; } - const entry1 = TankDefinitions_TanksEntry.decode(reader, reader.uint32()); + const entry1 = TankDefinitions_TanksEntry.decode( + reader, + reader.uint32(), + ); if (entry1.value !== undefined) { message.tanks[entry1.key] = entry1.value; } @@ -500,10 +534,12 @@ export const TankDefinitions: MessageFns<TankDefinitions> = { fromJSON(object: any): TankDefinitions { return { tanks: isObject(object.tanks) - ? Object.entries(object.tanks).reduce<{ [key: number]: TankDefinition }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = TankDefinition.fromJSON(value); - return acc; - }, {}) + ? Object.entries(object.tanks).reduce<{ + [key: number]: TankDefinition; + }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = TankDefinition.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -522,20 +558,23 @@ export const TankDefinitions: MessageFns<TankDefinitions> = { return obj; }, - create<I extends Exact<DeepPartial<TankDefinitions>, I>>(base?: I): TankDefinitions { + create<I extends Exact<DeepPartial<TankDefinitions>, I>>( + base?: I, + ): TankDefinitions { return TankDefinitions.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<TankDefinitions>, I>>(object: I): TankDefinitions { + fromPartial<I extends Exact<DeepPartial<TankDefinitions>, I>>( + object: I, + ): TankDefinitions { const message = createBaseTankDefinitions(); - message.tanks = Object.entries(object.tanks ?? {}).reduce<{ [key: number]: TankDefinition }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[globalThis.Number(key)] = TankDefinition.fromPartial(value); - } - return acc; - }, - {}, - ); + message.tanks = Object.entries(object.tanks ?? {}).reduce<{ + [key: number]: TankDefinition; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = TankDefinition.fromPartial(value); + } + return acc; + }, {}); return message; }, }; @@ -544,84 +583,99 @@ function createBaseTankDefinitions_TanksEntry(): TankDefinitions_TanksEntry { return { key: 0, value: undefined }; } -export const TankDefinitions_TanksEntry: MessageFns<TankDefinitions_TanksEntry> = { - encode(message: TankDefinitions_TanksEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== 0) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== undefined) { - TankDefinition.encode(message.value, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): TankDefinitions_TanksEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTankDefinitions_TanksEntry(); - 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 = TankDefinition.decode(reader, reader.uint32()); - continue; - } +export const TankDefinitions_TanksEntry: MessageFns<TankDefinitions_TanksEntry> = + { + encode( + message: TankDefinitions_TanksEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== 0) { + writer.uint32(8).uint32(message.key); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + TankDefinition.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): TankDefinitions_TanksEntry { - return { - key: isSet(object.key) ? globalThis.Number(object.key) : 0, - value: isSet(object.value) ? TankDefinition.fromJSON(object.value) : undefined, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TankDefinitions_TanksEntry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTankDefinitions_TanksEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } - toJSON(message: TankDefinitions_TanksEntry): unknown { - const obj: any = {}; - if (message.key !== 0) { - obj.key = Math.round(message.key); - } - if (message.value !== undefined) { - obj.value = TankDefinition.toJSON(message.value); - } - return obj; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - create<I extends Exact<DeepPartial<TankDefinitions_TanksEntry>, I>>(base?: I): TankDefinitions_TanksEntry { - return TankDefinitions_TanksEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial<I extends Exact<DeepPartial<TankDefinitions_TanksEntry>, I>>(object: I): TankDefinitions_TanksEntry { - const message = createBaseTankDefinitions_TanksEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TankDefinition.fromPartial(object.value) - : undefined; - return message; - }, -}; + message.value = TankDefinition.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TankDefinitions_TanksEntry { + return { + key: isSet(object.key) ? globalThis.Number(object.key) : 0, + value: isSet(object.value) + ? TankDefinition.fromJSON(object.value) + : undefined, + }; + }, + + toJSON(message: TankDefinitions_TanksEntry): unknown { + const obj: any = {}; + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = TankDefinition.toJSON(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<TankDefinitions_TanksEntry>, I>>( + base?: I, + ): TankDefinitions_TanksEntry { + return TankDefinitions_TanksEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TankDefinitions_TanksEntry>, I>>( + object: I, + ): TankDefinitions_TanksEntry { + const message = createBaseTankDefinitions_TanksEntry(); + message.key = object.key ?? 0; + message.value = + object.value !== undefined && object.value !== null + ? TankDefinition.fromPartial(object.value) + : undefined; + return message; + }, + }; function createBaseTankDefinition(): TankDefinition { return { id: 0, - slug: "", + slug: '', roles: {}, fixed_camouflage: false, camouflages: [], @@ -629,7 +683,7 @@ function createBaseTankDefinition(): TankDefinition { successors: [], crew: [], health: 0, - nation: "", + nation: '', name: undefined, type: 0, max_consumables: 0, @@ -648,21 +702,27 @@ function createBaseTankDefinition(): TankDefinition { camouflage_still: 0, camouflage_moving: 0, camouflage_onFire: 0, - equipment_preset: "", + equipment_preset: '', weight: 0, }; } export const TankDefinition: MessageFns<TankDefinition> = { - encode(message: TankDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TankDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } - if (message.slug !== "") { + if (message.slug !== '') { writer.uint32(18).string(message.slug); } Object.entries(message.roles).forEach(([key, value]) => { - TankDefinition_RolesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + TankDefinition_RolesEntry.encode( + { key: key as any, value }, + writer.uint32(26).fork(), + ).join(); }); if (message.fixed_camouflage !== false) { writer.uint32(40).bool(message.fixed_camouflage); @@ -688,7 +748,7 @@ export const TankDefinition: MessageFns<TankDefinition> = { if (message.health !== 0) { writer.uint32(80).uint32(message.health); } - if (message.nation !== "") { + if (message.nation !== '') { writer.uint32(90).string(message.nation); } if (message.name !== undefined) { @@ -728,7 +788,10 @@ export const TankDefinition: MessageFns<TankDefinition> = { TankPrice.encode(message.price, writer.uint32(186).fork()).join(); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(194).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(194).fork(), + ).join(); } if (message.speed_forwards !== 0) { writer.uint32(205).float(message.speed_forwards); @@ -745,7 +808,7 @@ export const TankDefinition: MessageFns<TankDefinition> = { if (message.camouflage_onFire !== 0) { writer.uint32(237).float(message.camouflage_onFire); } - if (message.equipment_preset !== "") { + if (message.equipment_preset !== '') { writer.uint32(242).string(message.equipment_preset); } if (message.weight !== 0) { @@ -755,7 +818,8 @@ export const TankDefinition: MessageFns<TankDefinition> = { }, decode(input: BinaryReader | Uint8Array, length?: number): TankDefinition { - 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 = createBaseTankDefinition(); while (reader.pos < end) { @@ -782,7 +846,10 @@ export const TankDefinition: MessageFns<TankDefinition> = { break; } - const entry3 = TankDefinition_RolesEntry.decode(reader, reader.uint32()); + const entry3 = TankDefinition_RolesEntry.decode( + reader, + reader.uint32(), + ); if (entry3.value !== undefined) { message.roles[entry3.key] = entry3.value; } @@ -943,7 +1010,9 @@ export const TankDefinition: MessageFns<TankDefinition> = { break; } - message.turrets.push(TurretDefinition.decode(reader, reader.uint32())); + message.turrets.push( + TurretDefinition.decode(reader, reader.uint32()), + ); continue; } case 21: { @@ -951,7 +1020,9 @@ export const TankDefinition: MessageFns<TankDefinition> = { break; } - message.engines.push(EngineDefinition.decode(reader, reader.uint32())); + message.engines.push( + EngineDefinition.decode(reader, reader.uint32()), + ); continue; } case 22: { @@ -1046,14 +1117,19 @@ export const TankDefinition: MessageFns<TankDefinition> = { fromJSON(object: any): TankDefinition { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, - slug: isSet(object.slug) ? globalThis.String(object.slug) : "", + slug: isSet(object.slug) ? globalThis.String(object.slug) : '', roles: isObject(object.roles) - ? Object.entries(object.roles).reduce<{ [key: number]: number }>((acc, [key, value]) => { - acc[globalThis.Number(key)] = Number(value); - return acc; - }, {}) + ? Object.entries(object.roles).reduce<{ [key: number]: number }>( + (acc, [key, value]) => { + acc[globalThis.Number(key)] = Number(value); + return acc; + }, + {}, + ) : {}, - fixed_camouflage: isSet(object.fixed_camouflage) ? globalThis.Boolean(object.fixed_camouflage) : false, + fixed_camouflage: isSet(object.fixed_camouflage) + ? globalThis.Boolean(object.fixed_camouflage) + : false, camouflages: globalThis.Array.isArray(object?.camouflages) ? object.camouflages.map((e: any) => globalThis.Number(e)) : [], @@ -1063,17 +1139,27 @@ export const TankDefinition: MessageFns<TankDefinition> = { successors: globalThis.Array.isArray(object?.successors) ? object.successors.map((e: any) => globalThis.Number(e)) : [], - crew: globalThis.Array.isArray(object?.crew) ? object.crew.map((e: any) => Crew.fromJSON(e)) : [], + crew: globalThis.Array.isArray(object?.crew) + ? object.crew.map((e: any) => Crew.fromJSON(e)) + : [], health: isSet(object.health) ? globalThis.Number(object.health) : 0, - nation: isSet(object.nation) ? globalThis.String(object.nation) : "", + nation: isSet(object.nation) ? globalThis.String(object.nation) : '', name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, type: isSet(object.type) ? tankTypeFromJSON(object.type) : 0, - max_consumables: isSet(object.max_consumables) ? globalThis.Number(object.max_consumables) : 0, - max_provisions: isSet(object.max_provisions) ? globalThis.Number(object.max_provisions) : 0, + max_consumables: isSet(object.max_consumables) + ? globalThis.Number(object.max_consumables) + : 0, + max_provisions: isSet(object.max_provisions) + ? globalThis.Number(object.max_provisions) + : 0, tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, class: isSet(object.class) ? tankClassFromJSON(object.class) : 0, - testing: isSet(object.testing) ? globalThis.Boolean(object.testing) : false, - deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + testing: isSet(object.testing) + ? globalThis.Boolean(object.testing) + : false, + deprecated: isSet(object.deprecated) + ? globalThis.Boolean(object.deprecated) + : false, turrets: globalThis.Array.isArray(object?.turrets) ? object.turrets.map((e: any) => TurretDefinition.fromJSON(e)) : [], @@ -1084,13 +1170,27 @@ export const TankDefinition: MessageFns<TankDefinition> = { ? object.tracks.map((e: any) => TrackDefinition.fromJSON(e)) : [], price: isSet(object.price) ? TankPrice.fromJSON(object.price) : undefined, - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - speed_forwards: isSet(object.speed_forwards) ? globalThis.Number(object.speed_forwards) : 0, - speed_backwards: isSet(object.speed_backwards) ? globalThis.Number(object.speed_backwards) : 0, - camouflage_still: isSet(object.camouflage_still) ? globalThis.Number(object.camouflage_still) : 0, - camouflage_moving: isSet(object.camouflage_moving) ? globalThis.Number(object.camouflage_moving) : 0, - camouflage_onFire: isSet(object.camouflage_onFire) ? globalThis.Number(object.camouflage_onFire) : 0, - equipment_preset: isSet(object.equipment_preset) ? globalThis.String(object.equipment_preset) : "", + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + speed_forwards: isSet(object.speed_forwards) + ? globalThis.Number(object.speed_forwards) + : 0, + speed_backwards: isSet(object.speed_backwards) + ? globalThis.Number(object.speed_backwards) + : 0, + camouflage_still: isSet(object.camouflage_still) + ? globalThis.Number(object.camouflage_still) + : 0, + camouflage_moving: isSet(object.camouflage_moving) + ? globalThis.Number(object.camouflage_moving) + : 0, + camouflage_onFire: isSet(object.camouflage_onFire) + ? globalThis.Number(object.camouflage_onFire) + : 0, + equipment_preset: isSet(object.equipment_preset) + ? globalThis.String(object.equipment_preset) + : '', weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, }; }, @@ -1100,7 +1200,7 @@ export const TankDefinition: MessageFns<TankDefinition> = { if (message.id !== 0) { obj.id = Math.round(message.id); } - if (message.slug !== "") { + if (message.slug !== '') { obj.slug = message.slug; } if (message.roles) { @@ -1130,7 +1230,7 @@ export const TankDefinition: MessageFns<TankDefinition> = { if (message.health !== 0) { obj.health = Math.round(message.health); } - if (message.nation !== "") { + if (message.nation !== '') { obj.nation = message.nation; } if (message.name !== undefined) { @@ -1187,7 +1287,7 @@ export const TankDefinition: MessageFns<TankDefinition> = { if (message.camouflage_onFire !== 0) { obj.camouflage_onFire = message.camouflage_onFire; } - if (message.equipment_preset !== "") { + if (message.equipment_preset !== '') { obj.equipment_preset = message.equipment_preset; } if (message.weight !== 0) { @@ -1196,14 +1296,20 @@ export const TankDefinition: MessageFns<TankDefinition> = { return obj; }, - create<I extends Exact<DeepPartial<TankDefinition>, I>>(base?: I): TankDefinition { + create<I extends Exact<DeepPartial<TankDefinition>, I>>( + base?: I, + ): TankDefinition { return TankDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<TankDefinition>, I>>(object: I): TankDefinition { + fromPartial<I extends Exact<DeepPartial<TankDefinition>, I>>( + object: I, + ): TankDefinition { const message = createBaseTankDefinition(); message.id = object.id ?? 0; - message.slug = object.slug ?? ""; - message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: number }>((acc, [key, value]) => { + message.slug = object.slug ?? ''; + message.roles = Object.entries(object.roles ?? {}).reduce<{ + [key: number]: number; + }>((acc, [key, value]) => { if (value !== undefined) { acc[globalThis.Number(key)] = globalThis.Number(value); } @@ -1215,10 +1321,11 @@ export const TankDefinition: MessageFns<TankDefinition> = { message.successors = object.successors?.map((e) => e) || []; message.crew = object.crew?.map((e) => Crew.fromPartial(e)) || []; message.health = object.health ?? 0; - message.nation = object.nation ?? ""; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.nation = object.nation ?? ''; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.type = object.type ?? 0; message.max_consumables = object.max_consumables ?? 0; message.max_provisions = object.max_provisions ?? 0; @@ -1226,21 +1333,26 @@ export const TankDefinition: MessageFns<TankDefinition> = { message.class = object.class ?? 0; message.testing = object.testing ?? false; message.deprecated = object.deprecated ?? false; - message.turrets = object.turrets?.map((e) => TurretDefinition.fromPartial(e)) || []; - message.engines = object.engines?.map((e) => EngineDefinition.fromPartial(e)) || []; - message.tracks = object.tracks?.map((e) => TrackDefinition.fromPartial(e)) || []; - message.price = (object.price !== undefined && object.price !== null) - ? TankPrice.fromPartial(object.price) - : undefined; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.turrets = + object.turrets?.map((e) => TurretDefinition.fromPartial(e)) || []; + message.engines = + object.engines?.map((e) => EngineDefinition.fromPartial(e)) || []; + message.tracks = + object.tracks?.map((e) => TrackDefinition.fromPartial(e)) || []; + message.price = + object.price !== undefined && object.price !== null + ? TankPrice.fromPartial(object.price) + : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.speed_forwards = object.speed_forwards ?? 0; message.speed_backwards = object.speed_backwards ?? 0; message.camouflage_still = object.camouflage_still ?? 0; message.camouflage_moving = object.camouflage_moving ?? 0; message.camouflage_onFire = object.camouflage_onFire ?? 0; - message.equipment_preset = object.equipment_preset ?? ""; + message.equipment_preset = object.equipment_preset ?? ''; message.weight = object.weight ?? 0; return message; }, @@ -1250,97 +1362,116 @@ function createBaseTankDefinition_RolesEntry(): TankDefinition_RolesEntry { return { key: 0, value: 0 }; } -export const TankDefinition_RolesEntry: MessageFns<TankDefinition_RolesEntry> = { - encode(message: TankDefinition_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.key !== 0) { - writer.uint32(8).uint32(message.key); - } - if (message.value !== 0) { - writer.uint32(16).uint32(message.value); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): TankDefinition_RolesEntry { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTankDefinition_RolesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.key = reader.uint32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.value = reader.uint32(); - continue; - } +export const TankDefinition_RolesEntry: MessageFns<TankDefinition_RolesEntry> = + { + encode( + message: TankDefinition_RolesEntry, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.key !== 0) { + writer.uint32(8).uint32(message.key); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== 0) { + writer.uint32(16).uint32(message.value); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): TankDefinition_RolesEntry { - return { - key: isSet(object.key) ? globalThis.Number(object.key) : 0, - value: isSet(object.value) ? globalThis.Number(object.value) : 0, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): TankDefinition_RolesEntry { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTankDefinition_RolesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } - toJSON(message: TankDefinition_RolesEntry): unknown { - const obj: any = {}; - if (message.key !== 0) { - obj.key = Math.round(message.key); - } - if (message.value !== 0) { - obj.value = Math.round(message.value); - } - return obj; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } - create<I extends Exact<DeepPartial<TankDefinition_RolesEntry>, I>>(base?: I): TankDefinition_RolesEntry { - return TankDefinition_RolesEntry.fromPartial(base ?? ({} as any)); - }, - fromPartial<I extends Exact<DeepPartial<TankDefinition_RolesEntry>, I>>(object: I): TankDefinition_RolesEntry { - const message = createBaseTankDefinition_RolesEntry(); - message.key = object.key ?? 0; - message.value = object.value ?? 0; - return message; - }, -}; + message.value = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TankDefinition_RolesEntry { + return { + key: isSet(object.key) ? globalThis.Number(object.key) : 0, + value: isSet(object.value) ? globalThis.Number(object.value) : 0, + }; + }, + + toJSON(message: TankDefinition_RolesEntry): unknown { + const obj: any = {}; + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } + return obj; + }, + + create<I extends Exact<DeepPartial<TankDefinition_RolesEntry>, I>>( + base?: I, + ): TankDefinition_RolesEntry { + return TankDefinition_RolesEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<TankDefinition_RolesEntry>, I>>( + object: I, + ): TankDefinition_RolesEntry { + const message = createBaseTankDefinition_RolesEntry(); + message.key = object.key ?? 0; + message.value = object.value ?? 0; + return message; + }, + }; function createBaseResearchCost(): ResearchCost { return { research_cost_type: undefined }; } export const ResearchCost: MessageFns<ResearchCost> = { - encode(message: ResearchCost, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ResearchCost, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { switch (message.research_cost_type?.$case) { - case "xp": + case 'xp': writer.uint32(8).uint32(message.research_cost_type.value); break; - case "seasonal_tokens": - ResearchCostSeasonalTokens.encode(message.research_cost_type.value, writer.uint32(18).fork()).join(); + case 'seasonal_tokens': + ResearchCostSeasonalTokens.encode( + message.research_cost_type.value, + writer.uint32(18).fork(), + ).join(); break; } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): ResearchCost { - 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 = createBaseResearchCost(); while (reader.pos < end) { @@ -1351,7 +1482,7 @@ export const ResearchCost: MessageFns<ResearchCost> = { break; } - message.research_cost_type = { $case: "xp", value: reader.uint32() }; + message.research_cost_type = { $case: 'xp', value: reader.uint32() }; continue; } case 2: { @@ -1360,7 +1491,7 @@ export const ResearchCost: MessageFns<ResearchCost> = { } message.research_cost_type = { - $case: "seasonal_tokens", + $case: 'seasonal_tokens', value: ResearchCostSeasonalTokens.decode(reader, reader.uint32()), }; continue; @@ -1377,44 +1508,60 @@ export const ResearchCost: MessageFns<ResearchCost> = { fromJSON(object: any): ResearchCost { return { research_cost_type: isSet(object.xp) - ? { $case: "xp", value: globalThis.Number(object.xp) } + ? { $case: 'xp', value: globalThis.Number(object.xp) } : isSet(object.seasonal_tokens) - ? { $case: "seasonal_tokens", value: ResearchCostSeasonalTokens.fromJSON(object.seasonal_tokens) } - : undefined, + ? { + $case: 'seasonal_tokens', + value: ResearchCostSeasonalTokens.fromJSON( + object.seasonal_tokens, + ), + } + : undefined, }; }, toJSON(message: ResearchCost): unknown { const obj: any = {}; - if (message.research_cost_type?.$case === "xp") { + if (message.research_cost_type?.$case === 'xp') { obj.xp = Math.round(message.research_cost_type.value); } - if (message.research_cost_type?.$case === "seasonal_tokens") { - obj.seasonal_tokens = ResearchCostSeasonalTokens.toJSON(message.research_cost_type.value); + if (message.research_cost_type?.$case === 'seasonal_tokens') { + obj.seasonal_tokens = ResearchCostSeasonalTokens.toJSON( + message.research_cost_type.value, + ); } return obj; }, - create<I extends Exact<DeepPartial<ResearchCost>, I>>(base?: I): ResearchCost { + create<I extends Exact<DeepPartial<ResearchCost>, I>>( + base?: I, + ): ResearchCost { return ResearchCost.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<ResearchCost>, I>>(object: I): ResearchCost { + fromPartial<I extends Exact<DeepPartial<ResearchCost>, I>>( + object: I, + ): ResearchCost { const message = createBaseResearchCost(); if ( - object.research_cost_type?.$case === "xp" && - object.research_cost_type?.value !== undefined && - object.research_cost_type?.value !== null - ) { - message.research_cost_type = { $case: "xp", value: object.research_cost_type.value }; - } - if ( - object.research_cost_type?.$case === "seasonal_tokens" && + object.research_cost_type?.$case === 'xp' && object.research_cost_type?.value !== undefined && object.research_cost_type?.value !== null ) { message.research_cost_type = { - $case: "seasonal_tokens", - value: ResearchCostSeasonalTokens.fromPartial(object.research_cost_type.value), + $case: 'xp', + value: object.research_cost_type.value, + }; + } + if ( + object.research_cost_type?.$case === 'seasonal_tokens' && + object.research_cost_type?.value !== undefined && + object.research_cost_type?.value !== null + ) { + message.research_cost_type = { + $case: 'seasonal_tokens', + value: ResearchCostSeasonalTokens.fromPartial( + object.research_cost_type.value, + ), }; } return message; @@ -1425,84 +1572,99 @@ function createBaseResearchCostSeasonalTokens(): ResearchCostSeasonalTokens { return { season: 0, tokens: 0 }; } -export const ResearchCostSeasonalTokens: MessageFns<ResearchCostSeasonalTokens> = { - encode(message: ResearchCostSeasonalTokens, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.season !== 0) { - writer.uint32(8).uint32(message.season); - } - if (message.tokens !== 0) { - writer.uint32(16).uint32(message.tokens); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): ResearchCostSeasonalTokens { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResearchCostSeasonalTokens(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.season = reader.uint32(); - continue; - } - case 2: { - if (tag !== 16) { - break; - } - - message.tokens = reader.uint32(); - continue; - } +export const ResearchCostSeasonalTokens: MessageFns<ResearchCostSeasonalTokens> = + { + encode( + message: ResearchCostSeasonalTokens, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.season !== 0) { + writer.uint32(8).uint32(message.season); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.tokens !== 0) { + writer.uint32(16).uint32(message.tokens); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): ResearchCostSeasonalTokens { - return { - season: isSet(object.season) ? globalThis.Number(object.season) : 0, - tokens: isSet(object.tokens) ? globalThis.Number(object.tokens) : 0, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): ResearchCostSeasonalTokens { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResearchCostSeasonalTokens(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } - toJSON(message: ResearchCostSeasonalTokens): unknown { - const obj: any = {}; - if (message.season !== 0) { - obj.season = Math.round(message.season); - } - if (message.tokens !== 0) { - obj.tokens = Math.round(message.tokens); - } - return obj; - }, + message.season = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } - create<I extends Exact<DeepPartial<ResearchCostSeasonalTokens>, I>>(base?: I): ResearchCostSeasonalTokens { - return ResearchCostSeasonalTokens.fromPartial(base ?? ({} as any)); - }, - fromPartial<I extends Exact<DeepPartial<ResearchCostSeasonalTokens>, I>>(object: I): ResearchCostSeasonalTokens { - const message = createBaseResearchCostSeasonalTokens(); - message.season = object.season ?? 0; - message.tokens = object.tokens ?? 0; - return message; - }, -}; + message.tokens = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResearchCostSeasonalTokens { + return { + season: isSet(object.season) ? globalThis.Number(object.season) : 0, + tokens: isSet(object.tokens) ? globalThis.Number(object.tokens) : 0, + }; + }, + + toJSON(message: ResearchCostSeasonalTokens): unknown { + const obj: any = {}; + if (message.season !== 0) { + obj.season = Math.round(message.season); + } + if (message.tokens !== 0) { + obj.tokens = Math.round(message.tokens); + } + return obj; + }, + + create<I extends Exact<DeepPartial<ResearchCostSeasonalTokens>, I>>( + base?: I, + ): ResearchCostSeasonalTokens { + return ResearchCostSeasonalTokens.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<ResearchCostSeasonalTokens>, I>>( + object: I, + ): ResearchCostSeasonalTokens { + const message = createBaseResearchCostSeasonalTokens(); + message.season = object.season ?? 0; + message.tokens = object.tokens ?? 0; + return message; + }, + }; function createBaseTankPrice(): TankPrice { return { type: 0, value: 0 }; } export const TankPrice: MessageFns<TankPrice> = { - encode(message: TankPrice, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TankPrice, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } @@ -1513,7 +1675,8 @@ export const TankPrice: MessageFns<TankPrice> = { }, decode(input: BinaryReader | Uint8Array, length?: number): TankPrice { - 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 = createBaseTankPrice(); while (reader.pos < end) { @@ -1565,7 +1728,9 @@ export const TankPrice: MessageFns<TankPrice> = { create<I extends Exact<DeepPartial<TankPrice>, I>>(base?: I): TankPrice { return TankPrice.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<TankPrice>, I>>(object: I): TankPrice { + fromPartial<I extends Exact<DeepPartial<TankPrice>, I>>( + object: I, + ): TankPrice { const message = createBaseTankPrice(); message.type = object.type ?? 0; message.value = object.value ?? 0; @@ -1591,7 +1756,10 @@ function createBaseTrackDefinition(): TrackDefinition { } export const TrackDefinition: MessageFns<TrackDefinition> = { - encode(message: TrackDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TrackDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -1608,7 +1776,10 @@ export const TrackDefinition: MessageFns<TrackDefinition> = { writer.uint32(45).float(message.traverse_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(50).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(50).fork(), + ).join(); } if (message.dispersion_move !== 0) { writer.uint32(61).float(message.dispersion_move); @@ -1632,7 +1803,8 @@ export const TrackDefinition: MessageFns<TrackDefinition> = { }, decode(input: BinaryReader | Uint8Array, length?: number): TrackDefinition { - 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 = createBaseTrackDefinition(); while (reader.pos < end) { @@ -1749,14 +1921,30 @@ export const TrackDefinition: MessageFns<TrackDefinition> = { tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, - traverse_speed: isSet(object.traverse_speed) ? globalThis.Number(object.traverse_speed) : 0, - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, - dispersion_move: isSet(object.dispersion_move) ? globalThis.Number(object.dispersion_move) : 0, - dispersion_traverse: isSet(object.dispersion_traverse) ? globalThis.Number(object.dispersion_traverse) : 0, - resistance_hard: isSet(object.resistance_hard) ? globalThis.Number(object.resistance_hard) : 0, - resistance_medium: isSet(object.resistance_medium) ? globalThis.Number(object.resistance_medium) : 0, - resistance_soft: isSet(object.resistance_soft) ? globalThis.Number(object.resistance_soft) : 0, - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + traverse_speed: isSet(object.traverse_speed) + ? globalThis.Number(object.traverse_speed) + : 0, + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, + dispersion_move: isSet(object.dispersion_move) + ? globalThis.Number(object.dispersion_move) + : 0, + dispersion_traverse: isSet(object.dispersion_traverse) + ? globalThis.Number(object.dispersion_traverse) + : 0, + resistance_hard: isSet(object.resistance_hard) + ? globalThis.Number(object.resistance_hard) + : 0, + resistance_medium: isSet(object.resistance_medium) + ? globalThis.Number(object.resistance_medium) + : 0, + resistance_soft: isSet(object.resistance_soft) + ? globalThis.Number(object.resistance_soft) + : 0, + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -1801,21 +1989,27 @@ export const TrackDefinition: MessageFns<TrackDefinition> = { return obj; }, - create<I extends Exact<DeepPartial<TrackDefinition>, I>>(base?: I): TrackDefinition { + create<I extends Exact<DeepPartial<TrackDefinition>, I>>( + base?: I, + ): TrackDefinition { return TrackDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<TrackDefinition>, I>>(object: I): TrackDefinition { + fromPartial<I extends Exact<DeepPartial<TrackDefinition>, I>>( + object: I, + ): TrackDefinition { const message = createBaseTrackDefinition(); message.id = object.id ?? 0; message.tier = object.tier ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.weight = object.weight ?? 0; message.traverse_speed = object.traverse_speed ?? 0; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.dispersion_move = object.dispersion_move ?? 0; message.dispersion_traverse = object.dispersion_traverse ?? 0; message.resistance_hard = object.resistance_hard ?? 0; @@ -1840,7 +2034,10 @@ function createBaseEngineDefinition(): EngineDefinition { } export const EngineDefinition: MessageFns<EngineDefinition> = { - encode(message: EngineDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: EngineDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -1848,7 +2045,10 @@ export const EngineDefinition: MessageFns<EngineDefinition> = { I18nString.encode(message.name, writer.uint32(18).fork()).join(); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(26).fork(), + ).join(); } if (message.tier !== 0) { writer.uint32(32).uint32(message.tier); @@ -1869,7 +2069,8 @@ export const EngineDefinition: MessageFns<EngineDefinition> = { }, decode(input: BinaryReader | Uint8Array, length?: number): EngineDefinition { - 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 = createBaseEngineDefinition(); while (reader.pos < end) { @@ -1952,12 +2153,18 @@ export const EngineDefinition: MessageFns<EngineDefinition> = { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, - fire_chance: isSet(object.fire_chance) ? globalThis.Number(object.fire_chance) : 0, + fire_chance: isSet(object.fire_chance) + ? globalThis.Number(object.fire_chance) + : 0, power: isSet(object.power) ? globalThis.Number(object.power) : 0, weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -1990,18 +2197,24 @@ export const EngineDefinition: MessageFns<EngineDefinition> = { return obj; }, - create<I extends Exact<DeepPartial<EngineDefinition>, I>>(base?: I): EngineDefinition { + create<I extends Exact<DeepPartial<EngineDefinition>, I>>( + base?: I, + ): EngineDefinition { return EngineDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<EngineDefinition>, I>>(object: I): EngineDefinition { + fromPartial<I extends Exact<DeepPartial<EngineDefinition>, I>>( + object: I, + ): EngineDefinition { const message = createBaseEngineDefinition(); message.id = object.id ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.tier = object.tier ?? 0; message.fire_chance = object.fire_chance ?? 0; message.power = object.power ?? 0; @@ -2027,7 +2240,10 @@ function createBaseTurretDefinition(): TurretDefinition { } export const TurretDefinition: MessageFns<TurretDefinition> = { - encode(message: TurretDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: TurretDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -2041,7 +2257,10 @@ export const TurretDefinition: MessageFns<TurretDefinition> = { writer.uint32(37).float(message.traverse_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(42).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(42).fork(), + ).join(); } if (message.name !== undefined) { I18nString.encode(message.name, writer.uint32(50).fork()).join(); @@ -2062,7 +2281,8 @@ export const TurretDefinition: MessageFns<TurretDefinition> = { }, decode(input: BinaryReader | Uint8Array, length?: number): TurretDefinition { - 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 = createBaseTurretDefinition(); while (reader.pos < end) { @@ -2161,14 +2381,24 @@ export const TurretDefinition: MessageFns<TurretDefinition> = { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, health: isSet(object.health) ? globalThis.Number(object.health) : 0, - view_range: isSet(object.view_range) ? globalThis.Number(object.view_range) : 0, - traverse_speed: isSet(object.traverse_speed) ? globalThis.Number(object.traverse_speed) : 0, - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, + view_range: isSet(object.view_range) + ? globalThis.Number(object.view_range) + : 0, + traverse_speed: isSet(object.traverse_speed) + ? globalThis.Number(object.traverse_speed) + : 0, + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, - guns: globalThis.Array.isArray(object?.guns) ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) : [], - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], + guns: globalThis.Array.isArray(object?.guns) + ? object.guns.map((e: any) => GunDefinition.fromJSON(e)) + : [], + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], }; }, @@ -2207,21 +2437,27 @@ export const TurretDefinition: MessageFns<TurretDefinition> = { return obj; }, - create<I extends Exact<DeepPartial<TurretDefinition>, I>>(base?: I): TurretDefinition { + create<I extends Exact<DeepPartial<TurretDefinition>, I>>( + base?: I, + ): TurretDefinition { return TurretDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<TurretDefinition>, I>>(object: I): TurretDefinition { + fromPartial<I extends Exact<DeepPartial<TurretDefinition>, I>>( + object: I, + ): TurretDefinition { const message = createBaseTurretDefinition(); message.id = object.id ?? 0; message.health = object.health ?? 0; message.view_range = object.view_range ?? 0; message.traverse_speed = object.traverse_speed ?? 0; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.tier = object.tier ?? 0; message.weight = object.weight ?? 0; message.guns = object.guns?.map((e) => GunDefinition.fromPartial(e)) || []; @@ -2235,23 +2471,36 @@ function createBaseGunDefinition(): GunDefinition { } export const GunDefinition: MessageFns<GunDefinition> = { - encode(message: GunDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { switch (message.gun_type?.$case) { - case "regular": - GunDefinitionRegular.encode(message.gun_type.value, writer.uint32(10).fork()).join(); + case 'regular': + GunDefinitionRegular.encode( + message.gun_type.value, + writer.uint32(10).fork(), + ).join(); break; - case "auto_loader": - GunDefinitionAutoLoader.encode(message.gun_type.value, writer.uint32(18).fork()).join(); + case 'auto_loader': + GunDefinitionAutoLoader.encode( + message.gun_type.value, + writer.uint32(18).fork(), + ).join(); break; - case "auto_reloader": - GunDefinitionAutoReloader.encode(message.gun_type.value, writer.uint32(26).fork()).join(); + case 'auto_reloader': + GunDefinitionAutoReloader.encode( + message.gun_type.value, + writer.uint32(26).fork(), + ).join(); break; } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GunDefinition { - 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 = createBaseGunDefinition(); while (reader.pos < end) { @@ -2262,7 +2511,10 @@ export const GunDefinition: MessageFns<GunDefinition> = { break; } - message.gun_type = { $case: "regular", value: GunDefinitionRegular.decode(reader, reader.uint32()) }; + message.gun_type = { + $case: 'regular', + value: GunDefinitionRegular.decode(reader, reader.uint32()), + }; continue; } case 2: { @@ -2270,7 +2522,10 @@ export const GunDefinition: MessageFns<GunDefinition> = { break; } - message.gun_type = { $case: "auto_loader", value: GunDefinitionAutoLoader.decode(reader, reader.uint32()) }; + message.gun_type = { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.decode(reader, reader.uint32()), + }; continue; } case 3: { @@ -2279,7 +2534,7 @@ export const GunDefinition: MessageFns<GunDefinition> = { } message.gun_type = { - $case: "auto_reloader", + $case: 'auto_reloader', value: GunDefinitionAutoReloader.decode(reader, reader.uint32()), }; continue; @@ -2296,53 +2551,76 @@ export const GunDefinition: MessageFns<GunDefinition> = { fromJSON(object: any): GunDefinition { return { gun_type: isSet(object.regular) - ? { $case: "regular", value: GunDefinitionRegular.fromJSON(object.regular) } + ? { + $case: 'regular', + value: GunDefinitionRegular.fromJSON(object.regular), + } : isSet(object.auto_loader) - ? { $case: "auto_loader", value: GunDefinitionAutoLoader.fromJSON(object.auto_loader) } - : isSet(object.auto_reloader) - ? { $case: "auto_reloader", value: GunDefinitionAutoReloader.fromJSON(object.auto_reloader) } - : undefined, + ? { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.fromJSON(object.auto_loader), + } + : isSet(object.auto_reloader) + ? { + $case: 'auto_reloader', + value: GunDefinitionAutoReloader.fromJSON(object.auto_reloader), + } + : undefined, }; }, toJSON(message: GunDefinition): unknown { const obj: any = {}; - if (message.gun_type?.$case === "regular") { + if (message.gun_type?.$case === 'regular') { obj.regular = GunDefinitionRegular.toJSON(message.gun_type.value); } - if (message.gun_type?.$case === "auto_loader") { + if (message.gun_type?.$case === 'auto_loader') { obj.auto_loader = GunDefinitionAutoLoader.toJSON(message.gun_type.value); } - if (message.gun_type?.$case === "auto_reloader") { - obj.auto_reloader = GunDefinitionAutoReloader.toJSON(message.gun_type.value); + if (message.gun_type?.$case === 'auto_reloader') { + obj.auto_reloader = GunDefinitionAutoReloader.toJSON( + message.gun_type.value, + ); } return obj; }, - create<I extends Exact<DeepPartial<GunDefinition>, I>>(base?: I): GunDefinition { + create<I extends Exact<DeepPartial<GunDefinition>, I>>( + base?: I, + ): GunDefinition { return GunDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<GunDefinition>, I>>(object: I): GunDefinition { + fromPartial<I extends Exact<DeepPartial<GunDefinition>, I>>( + object: I, + ): GunDefinition { const message = createBaseGunDefinition(); if ( - object.gun_type?.$case === "regular" && object.gun_type?.value !== undefined && object.gun_type?.value !== null - ) { - message.gun_type = { $case: "regular", value: GunDefinitionRegular.fromPartial(object.gun_type.value) }; - } - if ( - object.gun_type?.$case === "auto_loader" && - object.gun_type?.value !== undefined && - object.gun_type?.value !== null - ) { - message.gun_type = { $case: "auto_loader", value: GunDefinitionAutoLoader.fromPartial(object.gun_type.value) }; - } - if ( - object.gun_type?.$case === "auto_reloader" && + object.gun_type?.$case === 'regular' && object.gun_type?.value !== undefined && object.gun_type?.value !== null ) { message.gun_type = { - $case: "auto_reloader", + $case: 'regular', + value: GunDefinitionRegular.fromPartial(object.gun_type.value), + }; + } + if ( + object.gun_type?.$case === 'auto_loader' && + object.gun_type?.value !== undefined && + object.gun_type?.value !== null + ) { + message.gun_type = { + $case: 'auto_loader', + value: GunDefinitionAutoLoader.fromPartial(object.gun_type.value), + }; + } + if ( + object.gun_type?.$case === 'auto_reloader' && + object.gun_type?.value !== undefined && + object.gun_type?.value !== null + ) { + message.gun_type = { + $case: 'auto_reloader', value: GunDefinitionAutoReloader.fromPartial(object.gun_type.value), }; } @@ -2355,18 +2633,28 @@ function createBaseGunDefinitionRegular(): GunDefinitionRegular { } export const GunDefinitionRegular: MessageFns<GunDefinitionRegular> = { - encode(message: GunDefinitionRegular, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionRegular, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.base !== undefined) { GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } if (message.extension !== undefined) { - GunDefinitionRegularProperties.encode(message.extension, writer.uint32(18).fork()).join(); + GunDefinitionRegularProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionRegular { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionRegular { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinitionRegular(); while (reader.pos < end) { @@ -2385,7 +2673,10 @@ export const GunDefinitionRegular: MessageFns<GunDefinitionRegular> = { break; } - message.extension = GunDefinitionRegularProperties.decode(reader, reader.uint32()); + message.extension = GunDefinitionRegularProperties.decode( + reader, + reader.uint32(), + ); continue; } } @@ -2399,8 +2690,12 @@ export const GunDefinitionRegular: MessageFns<GunDefinitionRegular> = { fromJSON(object: any): GunDefinitionRegular { return { - base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, - extension: isSet(object.extension) ? GunDefinitionRegularProperties.fromJSON(object.extension) : undefined, + base: isSet(object.base) + ? GunDefinitionBase.fromJSON(object.base) + : undefined, + extension: isSet(object.extension) + ? GunDefinitionRegularProperties.fromJSON(object.extension) + : undefined, }; }, @@ -2415,17 +2710,23 @@ export const GunDefinitionRegular: MessageFns<GunDefinitionRegular> = { return obj; }, - create<I extends Exact<DeepPartial<GunDefinitionRegular>, I>>(base?: I): GunDefinitionRegular { + create<I extends Exact<DeepPartial<GunDefinitionRegular>, I>>( + base?: I, + ): GunDefinitionRegular { return GunDefinitionRegular.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<GunDefinitionRegular>, I>>(object: I): GunDefinitionRegular { + fromPartial<I extends Exact<DeepPartial<GunDefinitionRegular>, I>>( + object: I, + ): GunDefinitionRegular { const message = createBaseGunDefinitionRegular(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : undefined; - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionRegularProperties.fromPartial(object.extension) - : undefined; + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : undefined; + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionRegularProperties.fromPartial(object.extension) + : undefined; return message; }, }; @@ -2434,79 +2735,101 @@ function createBaseGunDefinitionRegularProperties(): GunDefinitionRegularPropert return { reload: 0 }; } -export const GunDefinitionRegularProperties: MessageFns<GunDefinitionRegularProperties> = { - encode(message: GunDefinitionRegularProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.reload !== 0) { - writer.uint32(13).float(message.reload); - } - return writer; - }, +export const GunDefinitionRegularProperties: MessageFns<GunDefinitionRegularProperties> = + { + encode( + message: GunDefinitionRegularProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.reload !== 0) { + writer.uint32(13).float(message.reload); + } + return writer; + }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionRegularProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionRegularProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 13) { - break; + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionRegularProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionRegularProperties(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + + message.reload = reader.float(); + continue; } - - message.reload = reader.float(); - continue; } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); } - if ((tag & 7) === 4 || tag === 0) { - break; + return message; + }, + + fromJSON(object: any): GunDefinitionRegularProperties { + return { + reload: isSet(object.reload) ? globalThis.Number(object.reload) : 0, + }; + }, + + toJSON(message: GunDefinitionRegularProperties): unknown { + const obj: any = {}; + if (message.reload !== 0) { + obj.reload = message.reload; } - reader.skip(tag & 7); - } - return message; - }, + return obj; + }, - fromJSON(object: any): GunDefinitionRegularProperties { - return { reload: isSet(object.reload) ? globalThis.Number(object.reload) : 0 }; - }, - - toJSON(message: GunDefinitionRegularProperties): unknown { - const obj: any = {}; - if (message.reload !== 0) { - obj.reload = message.reload; - } - return obj; - }, - - create<I extends Exact<DeepPartial<GunDefinitionRegularProperties>, I>>(base?: I): GunDefinitionRegularProperties { - return GunDefinitionRegularProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial<I extends Exact<DeepPartial<GunDefinitionRegularProperties>, I>>( - object: I, - ): GunDefinitionRegularProperties { - const message = createBaseGunDefinitionRegularProperties(); - message.reload = object.reload ?? 0; - return message; - }, -}; + create<I extends Exact<DeepPartial<GunDefinitionRegularProperties>, I>>( + base?: I, + ): GunDefinitionRegularProperties { + return GunDefinitionRegularProperties.fromPartial(base ?? ({} as any)); + }, + fromPartial< + I extends Exact<DeepPartial<GunDefinitionRegularProperties>, I>, + >(object: I): GunDefinitionRegularProperties { + const message = createBaseGunDefinitionRegularProperties(); + message.reload = object.reload ?? 0; + return message; + }, + }; function createBaseGunDefinitionAutoLoader(): GunDefinitionAutoLoader { return { base: undefined, extension: undefined }; } export const GunDefinitionAutoLoader: MessageFns<GunDefinitionAutoLoader> = { - encode(message: GunDefinitionAutoLoader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionAutoLoader, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.base !== undefined) { GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } if (message.extension !== undefined) { - GunDefinitionAutoLoaderProperties.encode(message.extension, writer.uint32(18).fork()).join(); + GunDefinitionAutoLoaderProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoLoader { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoLoader { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGunDefinitionAutoLoader(); while (reader.pos < end) { @@ -2525,7 +2848,10 @@ export const GunDefinitionAutoLoader: MessageFns<GunDefinitionAutoLoader> = { break; } - message.extension = GunDefinitionAutoLoaderProperties.decode(reader, reader.uint32()); + message.extension = GunDefinitionAutoLoaderProperties.decode( + reader, + reader.uint32(), + ); continue; } } @@ -2539,8 +2865,12 @@ export const GunDefinitionAutoLoader: MessageFns<GunDefinitionAutoLoader> = { fromJSON(object: any): GunDefinitionAutoLoader { return { - base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, - extension: isSet(object.extension) ? GunDefinitionAutoLoaderProperties.fromJSON(object.extension) : undefined, + base: isSet(object.base) + ? GunDefinitionBase.fromJSON(object.base) + : undefined, + extension: isSet(object.extension) + ? GunDefinitionAutoLoaderProperties.fromJSON(object.extension) + : undefined, }; }, @@ -2550,22 +2880,30 @@ export const GunDefinitionAutoLoader: MessageFns<GunDefinitionAutoLoader> = { obj.base = GunDefinitionBase.toJSON(message.base); } if (message.extension !== undefined) { - obj.extension = GunDefinitionAutoLoaderProperties.toJSON(message.extension); + obj.extension = GunDefinitionAutoLoaderProperties.toJSON( + message.extension, + ); } return obj; }, - create<I extends Exact<DeepPartial<GunDefinitionAutoLoader>, I>>(base?: I): GunDefinitionAutoLoader { + create<I extends Exact<DeepPartial<GunDefinitionAutoLoader>, I>>( + base?: I, + ): GunDefinitionAutoLoader { return GunDefinitionAutoLoader.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<GunDefinitionAutoLoader>, I>>(object: I): GunDefinitionAutoLoader { + fromPartial<I extends Exact<DeepPartial<GunDefinitionAutoLoader>, I>>( + object: I, + ): GunDefinitionAutoLoader { const message = createBaseGunDefinitionAutoLoader(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : undefined; - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) - : undefined; + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : undefined; + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionAutoLoaderProperties.fromPartial(object.extension) + : undefined; return message; }, }; @@ -2574,287 +2912,341 @@ function createBaseGunDefinitionAutoLoaderProperties(): GunDefinitionAutoLoaderP return { clip_reload: 0, intra_clip: 0, shell_count: 0 }; } -export const GunDefinitionAutoLoaderProperties: MessageFns<GunDefinitionAutoLoaderProperties> = { - encode(message: GunDefinitionAutoLoaderProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.clip_reload !== 0) { - writer.uint32(13).float(message.clip_reload); - } - if (message.intra_clip !== 0) { - writer.uint32(21).float(message.intra_clip); - } - if (message.shell_count !== 0) { - writer.uint32(29).float(message.shell_count); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoLoaderProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionAutoLoaderProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 13) { - break; - } - - message.clip_reload = reader.float(); - continue; - } - case 2: { - if (tag !== 21) { - break; - } - - message.intra_clip = reader.float(); - continue; - } - case 3: { - if (tag !== 29) { - break; - } - - message.shell_count = reader.float(); - continue; - } +export const GunDefinitionAutoLoaderProperties: MessageFns<GunDefinitionAutoLoaderProperties> = + { + encode( + message: GunDefinitionAutoLoaderProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.clip_reload !== 0) { + writer.uint32(13).float(message.clip_reload); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.intra_clip !== 0) { + writer.uint32(21).float(message.intra_clip); } - reader.skip(tag & 7); - } - return message; - }, + if (message.shell_count !== 0) { + writer.uint32(29).float(message.shell_count); + } + return writer; + }, - fromJSON(object: any): GunDefinitionAutoLoaderProperties { - return { - clip_reload: isSet(object.clip_reload) ? globalThis.Number(object.clip_reload) : 0, - intra_clip: isSet(object.intra_clip) ? globalThis.Number(object.intra_clip) : 0, - shell_count: isSet(object.shell_count) ? globalThis.Number(object.shell_count) : 0, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoLoaderProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionAutoLoaderProperties(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } - toJSON(message: GunDefinitionAutoLoaderProperties): unknown { - const obj: any = {}; - if (message.clip_reload !== 0) { - obj.clip_reload = message.clip_reload; - } - if (message.intra_clip !== 0) { - obj.intra_clip = message.intra_clip; - } - if (message.shell_count !== 0) { - obj.shell_count = message.shell_count; - } - return obj; - }, + message.clip_reload = reader.float(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } - create<I extends Exact<DeepPartial<GunDefinitionAutoLoaderProperties>, I>>( - base?: I, - ): GunDefinitionAutoLoaderProperties { - return GunDefinitionAutoLoaderProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial<I extends Exact<DeepPartial<GunDefinitionAutoLoaderProperties>, I>>( - object: I, - ): GunDefinitionAutoLoaderProperties { - const message = createBaseGunDefinitionAutoLoaderProperties(); - message.clip_reload = object.clip_reload ?? 0; - message.intra_clip = object.intra_clip ?? 0; - message.shell_count = object.shell_count ?? 0; - return message; - }, -}; + message.intra_clip = reader.float(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + + message.shell_count = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GunDefinitionAutoLoaderProperties { + return { + clip_reload: isSet(object.clip_reload) + ? globalThis.Number(object.clip_reload) + : 0, + intra_clip: isSet(object.intra_clip) + ? globalThis.Number(object.intra_clip) + : 0, + shell_count: isSet(object.shell_count) + ? globalThis.Number(object.shell_count) + : 0, + }; + }, + + toJSON(message: GunDefinitionAutoLoaderProperties): unknown { + const obj: any = {}; + if (message.clip_reload !== 0) { + obj.clip_reload = message.clip_reload; + } + if (message.intra_clip !== 0) { + obj.intra_clip = message.intra_clip; + } + if (message.shell_count !== 0) { + obj.shell_count = message.shell_count; + } + return obj; + }, + + create<I extends Exact<DeepPartial<GunDefinitionAutoLoaderProperties>, I>>( + base?: I, + ): GunDefinitionAutoLoaderProperties { + return GunDefinitionAutoLoaderProperties.fromPartial(base ?? ({} as any)); + }, + fromPartial< + I extends Exact<DeepPartial<GunDefinitionAutoLoaderProperties>, I>, + >(object: I): GunDefinitionAutoLoaderProperties { + const message = createBaseGunDefinitionAutoLoaderProperties(); + message.clip_reload = object.clip_reload ?? 0; + message.intra_clip = object.intra_clip ?? 0; + message.shell_count = object.shell_count ?? 0; + return message; + }, + }; function createBaseGunDefinitionAutoReloader(): GunDefinitionAutoReloader { return { base: undefined, extension: undefined }; } -export const GunDefinitionAutoReloader: MessageFns<GunDefinitionAutoReloader> = { - encode(message: GunDefinitionAutoReloader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.base !== undefined) { - GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); - } - if (message.extension !== undefined) { - GunDefinitionAutoReloaderProperties.encode(message.extension, writer.uint32(18).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoReloader { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionAutoReloader(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.base = GunDefinitionBase.decode(reader, reader.uint32()); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.extension = GunDefinitionAutoReloaderProperties.decode(reader, reader.uint32()); - continue; - } +export const GunDefinitionAutoReloader: MessageFns<GunDefinitionAutoReloader> = + { + encode( + message: GunDefinitionAutoReloader, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.base !== undefined) { + GunDefinitionBase.encode(message.base, writer.uint32(10).fork()).join(); } - if ((tag & 7) === 4 || tag === 0) { - break; + if (message.extension !== undefined) { + GunDefinitionAutoReloaderProperties.encode( + message.extension, + writer.uint32(18).fork(), + ).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): GunDefinitionAutoReloader { - return { - base: isSet(object.base) ? GunDefinitionBase.fromJSON(object.base) : undefined, - extension: isSet(object.extension) ? GunDefinitionAutoReloaderProperties.fromJSON(object.extension) : undefined, - }; - }, + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoReloader { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionAutoReloader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } - toJSON(message: GunDefinitionAutoReloader): unknown { - const obj: any = {}; - if (message.base !== undefined) { - obj.base = GunDefinitionBase.toJSON(message.base); - } - if (message.extension !== undefined) { - obj.extension = GunDefinitionAutoReloaderProperties.toJSON(message.extension); - } - return obj; - }, + message.base = GunDefinitionBase.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - create<I extends Exact<DeepPartial<GunDefinitionAutoReloader>, I>>(base?: I): GunDefinitionAutoReloader { - return GunDefinitionAutoReloader.fromPartial(base ?? ({} as any)); - }, - fromPartial<I extends Exact<DeepPartial<GunDefinitionAutoReloader>, I>>(object: I): GunDefinitionAutoReloader { - const message = createBaseGunDefinitionAutoReloader(); - message.base = (object.base !== undefined && object.base !== null) - ? GunDefinitionBase.fromPartial(object.base) - : undefined; - message.extension = (object.extension !== undefined && object.extension !== null) - ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) - : undefined; - return message; - }, -}; + message.extension = GunDefinitionAutoReloaderProperties.decode( + reader, + reader.uint32(), + ); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GunDefinitionAutoReloader { + return { + base: isSet(object.base) + ? GunDefinitionBase.fromJSON(object.base) + : undefined, + extension: isSet(object.extension) + ? GunDefinitionAutoReloaderProperties.fromJSON(object.extension) + : undefined, + }; + }, + + toJSON(message: GunDefinitionAutoReloader): unknown { + const obj: any = {}; + if (message.base !== undefined) { + obj.base = GunDefinitionBase.toJSON(message.base); + } + if (message.extension !== undefined) { + obj.extension = GunDefinitionAutoReloaderProperties.toJSON( + message.extension, + ); + } + return obj; + }, + + create<I extends Exact<DeepPartial<GunDefinitionAutoReloader>, I>>( + base?: I, + ): GunDefinitionAutoReloader { + return GunDefinitionAutoReloader.fromPartial(base ?? ({} as any)); + }, + fromPartial<I extends Exact<DeepPartial<GunDefinitionAutoReloader>, I>>( + object: I, + ): GunDefinitionAutoReloader { + const message = createBaseGunDefinitionAutoReloader(); + message.base = + object.base !== undefined && object.base !== null + ? GunDefinitionBase.fromPartial(object.base) + : undefined; + message.extension = + object.extension !== undefined && object.extension !== null + ? GunDefinitionAutoReloaderProperties.fromPartial(object.extension) + : undefined; + return message; + }, + }; function createBaseGunDefinitionAutoReloaderProperties(): GunDefinitionAutoReloaderProperties { return { shell_reloads: [], intra_clip: 0, shell_count: 0 }; } -export const GunDefinitionAutoReloaderProperties: MessageFns<GunDefinitionAutoReloaderProperties> = { - encode(message: GunDefinitionAutoReloaderProperties, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - writer.uint32(10).fork(); - for (const v of message.shell_reloads) { - writer.float(v); - } - writer.join(); - if (message.intra_clip !== 0) { - writer.uint32(21).float(message.intra_clip); - } - if (message.shell_count !== 0) { - writer.uint32(29).float(message.shell_count); - } - return writer; - }, +export const GunDefinitionAutoReloaderProperties: MessageFns<GunDefinitionAutoReloaderProperties> = + { + encode( + message: GunDefinitionAutoReloaderProperties, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.shell_reloads) { + writer.float(v); + } + writer.join(); + if (message.intra_clip !== 0) { + writer.uint32(21).float(message.intra_clip); + } + if (message.shell_count !== 0) { + writer.uint32(29).float(message.shell_count); + } + return writer; + }, - decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionAutoReloaderProperties { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGunDefinitionAutoReloaderProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag === 13) { - message.shell_reloads.push(reader.float()); - - continue; - } - - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): GunDefinitionAutoReloaderProperties { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGunDefinitionAutoReloaderProperties(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 13) { message.shell_reloads.push(reader.float()); + + continue; } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.shell_reloads.push(reader.float()); + } + + continue; + } + + break; + } + case 2: { + if (tag !== 21) { + break; + } + + message.intra_clip = reader.float(); continue; } + case 3: { + if (tag !== 29) { + break; + } + message.shell_count = reader.float(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { break; } - case 2: { - if (tag !== 21) { - break; - } - - message.intra_clip = reader.float(); - continue; - } - case 3: { - if (tag !== 29) { - break; - } - - message.shell_count = reader.float(); - continue; - } + reader.skip(tag & 7); } - if ((tag & 7) === 4 || tag === 0) { - break; + return message; + }, + + fromJSON(object: any): GunDefinitionAutoReloaderProperties { + return { + shell_reloads: globalThis.Array.isArray(object?.shell_reloads) + ? object.shell_reloads.map((e: any) => globalThis.Number(e)) + : [], + intra_clip: isSet(object.intra_clip) + ? globalThis.Number(object.intra_clip) + : 0, + shell_count: isSet(object.shell_count) + ? globalThis.Number(object.shell_count) + : 0, + }; + }, + + toJSON(message: GunDefinitionAutoReloaderProperties): unknown { + const obj: any = {}; + if (message.shell_reloads?.length) { + obj.shell_reloads = message.shell_reloads; } - reader.skip(tag & 7); - } - return message; - }, + if (message.intra_clip !== 0) { + obj.intra_clip = message.intra_clip; + } + if (message.shell_count !== 0) { + obj.shell_count = message.shell_count; + } + return obj; + }, - fromJSON(object: any): GunDefinitionAutoReloaderProperties { - return { - shell_reloads: globalThis.Array.isArray(object?.shell_reloads) - ? object.shell_reloads.map((e: any) => globalThis.Number(e)) - : [], - intra_clip: isSet(object.intra_clip) ? globalThis.Number(object.intra_clip) : 0, - shell_count: isSet(object.shell_count) ? globalThis.Number(object.shell_count) : 0, - }; - }, - - toJSON(message: GunDefinitionAutoReloaderProperties): unknown { - const obj: any = {}; - if (message.shell_reloads?.length) { - obj.shell_reloads = message.shell_reloads; - } - if (message.intra_clip !== 0) { - obj.intra_clip = message.intra_clip; - } - if (message.shell_count !== 0) { - obj.shell_count = message.shell_count; - } - return obj; - }, - - create<I extends Exact<DeepPartial<GunDefinitionAutoReloaderProperties>, I>>( - base?: I, - ): GunDefinitionAutoReloaderProperties { - return GunDefinitionAutoReloaderProperties.fromPartial(base ?? ({} as any)); - }, - fromPartial<I extends Exact<DeepPartial<GunDefinitionAutoReloaderProperties>, I>>( - object: I, - ): GunDefinitionAutoReloaderProperties { - const message = createBaseGunDefinitionAutoReloaderProperties(); - message.shell_reloads = object.shell_reloads?.map((e) => e) || []; - message.intra_clip = object.intra_clip ?? 0; - message.shell_count = object.shell_count ?? 0; - return message; - }, -}; + create< + I extends Exact<DeepPartial<GunDefinitionAutoReloaderProperties>, I>, + >(base?: I): GunDefinitionAutoReloaderProperties { + return GunDefinitionAutoReloaderProperties.fromPartial( + base ?? ({} as any), + ); + }, + fromPartial< + I extends Exact<DeepPartial<GunDefinitionAutoReloaderProperties>, I>, + >(object: I): GunDefinitionAutoReloaderProperties { + const message = createBaseGunDefinitionAutoReloaderProperties(); + message.shell_reloads = object.shell_reloads?.map((e) => e) || []; + message.intra_clip = object.intra_clip ?? 0; + message.shell_count = object.shell_count ?? 0; + return message; + }, + }; function createBaseGunDefinitionBase(): GunDefinitionBase { return { @@ -2878,7 +3270,10 @@ function createBaseGunDefinitionBase(): GunDefinitionBase { } export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { - encode(message: GunDefinitionBase, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: GunDefinitionBase, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -2886,7 +3281,10 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { writer.uint32(21).float(message.rotation_speed); } if (message.research_cost !== undefined) { - ResearchCost.encode(message.research_cost, writer.uint32(26).fork()).join(); + ResearchCost.encode( + message.research_cost, + writer.uint32(26).fork(), + ).join(); } if (message.weight !== 0) { writer.uint32(32).uint32(message.weight); @@ -2925,13 +3323,17 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { writer.uint32(120).uint32(message.shell_capacity); } if (message.assault_ranges !== undefined) { - AssaultRanges.encode(message.assault_ranges, writer.uint32(130).fork()).join(); + AssaultRanges.encode( + message.assault_ranges, + writer.uint32(130).fork(), + ).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): GunDefinitionBase { - 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 = createBaseGunDefinitionBase(); while (reader.pos < end) { @@ -3062,7 +3464,10 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { break; } - message.assault_ranges = AssaultRanges.decode(reader, reader.uint32()); + message.assault_ranges = AssaultRanges.decode( + reader, + reader.uint32(), + ); continue; } } @@ -3077,23 +3482,43 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { fromJSON(object: any): GunDefinitionBase { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, - rotation_speed: isSet(object.rotation_speed) ? globalThis.Number(object.rotation_speed) : 0, - research_cost: isSet(object.research_cost) ? ResearchCost.fromJSON(object.research_cost) : undefined, + rotation_speed: isSet(object.rotation_speed) + ? globalThis.Number(object.rotation_speed) + : 0, + research_cost: isSet(object.research_cost) + ? ResearchCost.fromJSON(object.research_cost) + : undefined, weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, tier: isSet(object.tier) ? globalThis.Number(object.tier) : 0, shells: globalThis.Array.isArray(object?.shells) ? object.shells.map((e: any) => ShellDefinition.fromJSON(e)) : [], - camouflage_loss: isSet(object.camouflage_loss) ? globalThis.Number(object.camouflage_loss) : 0, + camouflage_loss: isSet(object.camouflage_loss) + ? globalThis.Number(object.camouflage_loss) + : 0, aim_time: isSet(object.aim_time) ? globalThis.Number(object.aim_time) : 0, - dispersion_base: isSet(object.dispersion_base) ? globalThis.Number(object.dispersion_base) : 0, - dispersion_traverse: isSet(object.dispersion_traverse) ? globalThis.Number(object.dispersion_traverse) : 0, - dispersion_shot: isSet(object.dispersion_shot) ? globalThis.Number(object.dispersion_shot) : 0, - dispersion_damaged: isSet(object.dispersion_damaged) ? globalThis.Number(object.dispersion_damaged) : 0, - unlocks: globalThis.Array.isArray(object?.unlocks) ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) : [], - shell_capacity: isSet(object.shell_capacity) ? globalThis.Number(object.shell_capacity) : 0, - assault_ranges: isSet(object.assault_ranges) ? AssaultRanges.fromJSON(object.assault_ranges) : undefined, + dispersion_base: isSet(object.dispersion_base) + ? globalThis.Number(object.dispersion_base) + : 0, + dispersion_traverse: isSet(object.dispersion_traverse) + ? globalThis.Number(object.dispersion_traverse) + : 0, + dispersion_shot: isSet(object.dispersion_shot) + ? globalThis.Number(object.dispersion_shot) + : 0, + dispersion_damaged: isSet(object.dispersion_damaged) + ? globalThis.Number(object.dispersion_damaged) + : 0, + unlocks: globalThis.Array.isArray(object?.unlocks) + ? object.unlocks.map((e: any) => Unlock.fromJSON(e)) + : [], + shell_capacity: isSet(object.shell_capacity) + ? globalThis.Number(object.shell_capacity) + : 0, + assault_ranges: isSet(object.assault_ranges) + ? AssaultRanges.fromJSON(object.assault_ranges) + : undefined, }; }, @@ -3150,22 +3575,29 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { return obj; }, - create<I extends Exact<DeepPartial<GunDefinitionBase>, I>>(base?: I): GunDefinitionBase { + create<I extends Exact<DeepPartial<GunDefinitionBase>, I>>( + base?: I, + ): GunDefinitionBase { return GunDefinitionBase.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<GunDefinitionBase>, I>>(object: I): GunDefinitionBase { + fromPartial<I extends Exact<DeepPartial<GunDefinitionBase>, I>>( + object: I, + ): GunDefinitionBase { const message = createBaseGunDefinitionBase(); message.id = object.id ?? 0; message.rotation_speed = object.rotation_speed ?? 0; - message.research_cost = (object.research_cost !== undefined && object.research_cost !== null) - ? ResearchCost.fromPartial(object.research_cost) - : undefined; + message.research_cost = + object.research_cost !== undefined && object.research_cost !== null + ? ResearchCost.fromPartial(object.research_cost) + : undefined; message.weight = object.weight ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.tier = object.tier ?? 0; - message.shells = object.shells?.map((e) => ShellDefinition.fromPartial(e)) || []; + message.shells = + object.shells?.map((e) => ShellDefinition.fromPartial(e)) || []; message.camouflage_loss = object.camouflage_loss ?? 0; message.aim_time = object.aim_time ?? 0; message.dispersion_base = object.dispersion_base ?? 0; @@ -3174,9 +3606,10 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { message.dispersion_damaged = object.dispersion_damaged ?? 0; message.unlocks = object.unlocks?.map((e) => Unlock.fromPartial(e)) || []; message.shell_capacity = object.shell_capacity ?? 0; - message.assault_ranges = (object.assault_ranges !== undefined && object.assault_ranges !== null) - ? AssaultRanges.fromPartial(object.assault_ranges) - : undefined; + message.assault_ranges = + object.assault_ranges !== undefined && object.assault_ranges !== null + ? AssaultRanges.fromPartial(object.assault_ranges) + : undefined; return message; }, }; @@ -3186,7 +3619,10 @@ function createBaseAssaultRanges(): AssaultRanges { } export const AssaultRanges: MessageFns<AssaultRanges> = { - encode(message: AssaultRanges, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: AssaultRanges, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { for (const v of message.ranges) { AssaultRange.encode(v!, writer.uint32(10).fork()).join(); } @@ -3194,7 +3630,8 @@ export const AssaultRanges: MessageFns<AssaultRanges> = { }, decode(input: BinaryReader | Uint8Array, length?: number): AssaultRanges { - 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 = createBaseAssaultRanges(); while (reader.pos < end) { @@ -3219,7 +3656,9 @@ export const AssaultRanges: MessageFns<AssaultRanges> = { fromJSON(object: any): AssaultRanges { return { - ranges: globalThis.Array.isArray(object?.ranges) ? object.ranges.map((e: any) => AssaultRange.fromJSON(e)) : [], + ranges: globalThis.Array.isArray(object?.ranges) + ? object.ranges.map((e: any) => AssaultRange.fromJSON(e)) + : [], }; }, @@ -3231,12 +3670,17 @@ export const AssaultRanges: MessageFns<AssaultRanges> = { return obj; }, - create<I extends Exact<DeepPartial<AssaultRanges>, I>>(base?: I): AssaultRanges { + create<I extends Exact<DeepPartial<AssaultRanges>, I>>( + base?: I, + ): AssaultRanges { return AssaultRanges.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<AssaultRanges>, I>>(object: I): AssaultRanges { + fromPartial<I extends Exact<DeepPartial<AssaultRanges>, I>>( + object: I, + ): AssaultRanges { const message = createBaseAssaultRanges(); - message.ranges = object.ranges?.map((e) => AssaultRange.fromPartial(e)) || []; + message.ranges = + object.ranges?.map((e) => AssaultRange.fromPartial(e)) || []; return message; }, }; @@ -3246,7 +3690,10 @@ function createBaseAssaultRange(): AssaultRange { } export const AssaultRange: MessageFns<AssaultRange> = { - encode(message: AssaultRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: AssaultRange, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.distance !== 0) { writer.uint32(13).float(message.distance); } @@ -3257,7 +3704,8 @@ export const AssaultRange: MessageFns<AssaultRange> = { }, decode(input: BinaryReader | Uint8Array, length?: number): AssaultRange { - 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 = createBaseAssaultRange(); while (reader.pos < end) { @@ -3306,10 +3754,14 @@ export const AssaultRange: MessageFns<AssaultRange> = { return obj; }, - create<I extends Exact<DeepPartial<AssaultRange>, I>>(base?: I): AssaultRange { + create<I extends Exact<DeepPartial<AssaultRange>, I>>( + base?: I, + ): AssaultRange { return AssaultRange.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<AssaultRange>, I>>(object: I): AssaultRange { + fromPartial<I extends Exact<DeepPartial<AssaultRange>, I>>( + object: I, + ): AssaultRange { const message = createBaseAssaultRange(); message.distance = object.distance ?? 0; message.factor = object.factor ?? 0; @@ -3325,7 +3777,7 @@ function createBaseShellDefinition(): ShellDefinition { armor_damage: 0, module_damage: 0, caliber: 0, - icon: "", + icon: '', penetration: undefined, type: 0, normalization: 0, @@ -3336,7 +3788,10 @@ function createBaseShellDefinition(): ShellDefinition { } export const ShellDefinition: MessageFns<ShellDefinition> = { - encode(message: ShellDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ShellDefinition, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -3355,11 +3810,14 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { if (message.caliber !== 0) { writer.uint32(53).float(message.caliber); } - if (message.icon !== "") { + if (message.icon !== '') { writer.uint32(58).string(message.icon); } if (message.penetration !== undefined) { - ShellPenetration.encode(message.penetration, writer.uint32(66).fork()).join(); + ShellPenetration.encode( + message.penetration, + writer.uint32(66).fork(), + ).join(); } if (message.type !== 0) { writer.uint32(72).int32(message.type); @@ -3370,7 +3828,10 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { if (message.ricochet !== undefined && message.ricochet !== 0) { writer.uint32(93).float(message.ricochet); } - if (message.explosion_radius !== undefined && message.explosion_radius !== 0) { + if ( + message.explosion_radius !== undefined && + message.explosion_radius !== 0 + ) { writer.uint32(101).float(message.explosion_radius); } if (message.range !== 0) { @@ -3380,7 +3841,8 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { }, decode(input: BinaryReader | Uint8Array, length?: number): ShellDefinition { - 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 = createBaseShellDefinition(); while (reader.pos < end) { @@ -3447,7 +3909,10 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { break; } - message.penetration = ShellPenetration.decode(reader, reader.uint32()); + message.penetration = ShellPenetration.decode( + reader, + reader.uint32(), + ); continue; } case 9: { @@ -3504,15 +3969,25 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { id: isSet(object.id) ? globalThis.Number(object.id) : 0, name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined, velocity: isSet(object.velocity) ? globalThis.Number(object.velocity) : 0, - armor_damage: isSet(object.armor_damage) ? globalThis.Number(object.armor_damage) : 0, - module_damage: isSet(object.module_damage) ? globalThis.Number(object.module_damage) : 0, + armor_damage: isSet(object.armor_damage) + ? globalThis.Number(object.armor_damage) + : 0, + module_damage: isSet(object.module_damage) + ? globalThis.Number(object.module_damage) + : 0, caliber: isSet(object.caliber) ? globalThis.Number(object.caliber) : 0, - icon: isSet(object.icon) ? globalThis.String(object.icon) : "", - penetration: isSet(object.penetration) ? ShellPenetration.fromJSON(object.penetration) : undefined, + icon: isSet(object.icon) ? globalThis.String(object.icon) : '', + penetration: isSet(object.penetration) + ? ShellPenetration.fromJSON(object.penetration) + : undefined, type: isSet(object.type) ? shellTypeFromJSON(object.type) : 0, - normalization: isSet(object.normalization) ? globalThis.Number(object.normalization) : 0, + normalization: isSet(object.normalization) + ? globalThis.Number(object.normalization) + : 0, ricochet: isSet(object.ricochet) ? globalThis.Number(object.ricochet) : 0, - explosion_radius: isSet(object.explosion_radius) ? globalThis.Number(object.explosion_radius) : 0, + explosion_radius: isSet(object.explosion_radius) + ? globalThis.Number(object.explosion_radius) + : 0, range: isSet(object.range) ? globalThis.Number(object.range) : 0, }; }, @@ -3537,7 +4012,7 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { if (message.caliber !== 0) { obj.caliber = message.caliber; } - if (message.icon !== "") { + if (message.icon !== '') { obj.icon = message.icon; } if (message.penetration !== undefined) { @@ -3552,7 +4027,10 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { if (message.ricochet !== undefined && message.ricochet !== 0) { obj.ricochet = message.ricochet; } - if (message.explosion_radius !== undefined && message.explosion_radius !== 0) { + if ( + message.explosion_radius !== undefined && + message.explosion_radius !== 0 + ) { obj.explosion_radius = message.explosion_radius; } if (message.range !== 0) { @@ -3561,23 +4039,29 @@ export const ShellDefinition: MessageFns<ShellDefinition> = { return obj; }, - create<I extends Exact<DeepPartial<ShellDefinition>, I>>(base?: I): ShellDefinition { + create<I extends Exact<DeepPartial<ShellDefinition>, I>>( + base?: I, + ): ShellDefinition { return ShellDefinition.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<ShellDefinition>, I>>(object: I): ShellDefinition { + fromPartial<I extends Exact<DeepPartial<ShellDefinition>, I>>( + object: I, + ): ShellDefinition { const message = createBaseShellDefinition(); message.id = object.id ?? 0; - message.name = (object.name !== undefined && object.name !== null) - ? I18nString.fromPartial(object.name) - : undefined; + message.name = + object.name !== undefined && object.name !== null + ? I18nString.fromPartial(object.name) + : undefined; message.velocity = object.velocity ?? 0; message.armor_damage = object.armor_damage ?? 0; message.module_damage = object.module_damage ?? 0; message.caliber = object.caliber ?? 0; - message.icon = object.icon ?? ""; - message.penetration = (object.penetration !== undefined && object.penetration !== null) - ? ShellPenetration.fromPartial(object.penetration) - : undefined; + message.icon = object.icon ?? ''; + message.penetration = + object.penetration !== undefined && object.penetration !== null + ? ShellPenetration.fromPartial(object.penetration) + : undefined; message.type = object.type ?? 0; message.normalization = object.normalization ?? 0; message.ricochet = object.ricochet ?? 0; @@ -3592,7 +4076,10 @@ function createBaseShellPenetration(): ShellPenetration { } export const ShellPenetration: MessageFns<ShellPenetration> = { - encode(message: ShellPenetration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: ShellPenetration, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.near !== 0) { writer.uint32(13).float(message.near); } @@ -3603,7 +4090,8 @@ export const ShellPenetration: MessageFns<ShellPenetration> = { }, decode(input: BinaryReader | Uint8Array, length?: number): ShellPenetration { - 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 = createBaseShellPenetration(); while (reader.pos < end) { @@ -3652,10 +4140,14 @@ export const ShellPenetration: MessageFns<ShellPenetration> = { return obj; }, - create<I extends Exact<DeepPartial<ShellPenetration>, I>>(base?: I): ShellPenetration { + create<I extends Exact<DeepPartial<ShellPenetration>, I>>( + base?: I, + ): ShellPenetration { return ShellPenetration.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<ShellPenetration>, I>>(object: I): ShellPenetration { + fromPartial<I extends Exact<DeepPartial<ShellPenetration>, I>>( + object: I, + ): ShellPenetration { const message = createBaseShellPenetration(); message.near = object.near ?? 0; message.far = object.far ?? 0; @@ -3668,7 +4160,10 @@ function createBaseUnlock(): Unlock { } export const Unlock: MessageFns<Unlock> = { - encode(message: Unlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: Unlock, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).int32(message.id); } @@ -3682,7 +4177,8 @@ export const Unlock: MessageFns<Unlock> = { }, decode(input: BinaryReader | Uint8Array, length?: number): Unlock { - 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 = createBaseUnlock(); while (reader.pos < end) { @@ -3750,20 +4246,24 @@ export const Unlock: MessageFns<Unlock> = { const message = createBaseUnlock(); message.id = object.id ?? 0; message.type = object.type ?? 0; - message.cost = (object.cost !== undefined && object.cost !== null) - ? UnlockCost.fromPartial(object.cost) - : undefined; + message.cost = + object.cost !== undefined && object.cost !== null + ? UnlockCost.fromPartial(object.cost) + : undefined; return message; }, }; function createBaseUnlockCost(): UnlockCost { - return { type: "", value: 0 }; + return { type: '', value: 0 }; } export const UnlockCost: MessageFns<UnlockCost> = { - encode(message: UnlockCost, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.type !== "") { + encode( + message: UnlockCost, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.type !== '') { writer.uint32(10).string(message.type); } if (message.value !== 0) { @@ -3773,7 +4273,8 @@ export const UnlockCost: MessageFns<UnlockCost> = { }, decode(input: BinaryReader | Uint8Array, length?: number): UnlockCost { - 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 = createBaseUnlockCost(); while (reader.pos < end) { @@ -3806,14 +4307,14 @@ export const UnlockCost: MessageFns<UnlockCost> = { fromJSON(object: any): UnlockCost { return { - type: isSet(object.type) ? globalThis.String(object.type) : "", + type: isSet(object.type) ? globalThis.String(object.type) : '', value: isSet(object.value) ? globalThis.Number(object.value) : 0, }; }, toJSON(message: UnlockCost): unknown { const obj: any = {}; - if (message.type !== "") { + if (message.type !== '') { obj.type = message.type; } if (message.value !== 0) { @@ -3825,9 +4326,11 @@ export const UnlockCost: MessageFns<UnlockCost> = { create<I extends Exact<DeepPartial<UnlockCost>, I>>(base?: I): UnlockCost { return UnlockCost.fromPartial(base ?? ({} as any)); }, - fromPartial<I extends Exact<DeepPartial<UnlockCost>, I>>(object: I): UnlockCost { + fromPartial<I extends Exact<DeepPartial<UnlockCost>, I>>( + object: I, + ): UnlockCost { const message = createBaseUnlockCost(); - message.type = object.type ?? ""; + message.type = object.type ?? ''; message.value = object.value ?? 0; return message; }, @@ -3838,7 +4341,10 @@ function createBaseCrew(): Crew { } export const Crew: MessageFns<Crew> = { - encode(message: Crew, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + encode( + message: Crew, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.type !== 0) { writer.uint32(8).int32(message.type); } @@ -3854,7 +4360,8 @@ export const Crew: MessageFns<Crew> = { }, decode(input: BinaryReader | Uint8Array, length?: number): Crew { - 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 = createBaseCrew(); while (reader.pos < end) { @@ -3939,21 +4446,36 @@ export const Crew: MessageFns<Crew> = { }, }; -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]> } - : Partial<T>; +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 { diff --git a/packages/scripts/src/buildAssets/definitions.ts b/packages/scripts/src/buildAssets/definitions.ts index 94be82e5d..8498021e0 100644 --- a/packages/scripts/src/buildAssets/definitions.ts +++ b/packages/scripts/src/buildAssets/definitions.ts @@ -1250,7 +1250,7 @@ export async function definitions() { let assault_ranges: AssaultRanges | undefined; if (gun.extras?.trayShell) { - const kinds = gun.extras.trayShell.kinds + const types = gun.extras.trayShell.kinds .split(' ') .map((string) => { const trimmed = string.trim(); @@ -1270,6 +1270,7 @@ export async function definitions() { const sector = gun.extras.trayShell.sectors.sector; assault_ranges = { + types, ranges: sector.map((value) => ({ factor: value.factor, distance: value.distance, diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx index a5f74676e..8e7f53658 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx @@ -118,6 +118,7 @@ export function InfoWithDelta({ tank, track: member.track, turret: member.turret, + assaultDistance: 0, }, { equipmentDefinitions, diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx index 060b03ef5..ceeb805a6 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx @@ -58,6 +58,7 @@ export function Characteristics() { applyReactiveArmor: false, applyDynamicArmor: false, applySpallLiner: false, + assaultDistance: 0, }, { tankModelDefinition, diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx index 15b6a60de..1fc2632ba 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx @@ -96,6 +96,7 @@ export function SceneProps() { stockTurret: tank.turrets[0], stockTrack: tank.tracks[0], track, + assaultDistance: 0, }, { equipmentDefinitions, provisionDefinitions, tankModelDefinition }, ); diff --git a/packages/website/src/core/blitzkit/tankCharacteristics.ts b/packages/website/src/core/blitzkit/tankCharacteristics.ts index a9410cb77..c332211ac 100644 --- a/packages/website/src/core/blitzkit/tankCharacteristics.ts +++ b/packages/website/src/core/blitzkit/tankCharacteristics.ts @@ -46,6 +46,7 @@ export function tankCharacteristics( applyReactiveArmor, applyDynamicArmor, applySpallLiner, + assaultDistance, }: { tank: TankDefinition; turret: TurretDefinition; @@ -65,6 +66,7 @@ export function tankCharacteristics( applyReactiveArmor: boolean; applyDynamicArmor: boolean; applySpallLiner: boolean; + assaultDistance: number; }, { tankModelDefinition, @@ -157,6 +159,13 @@ export function tankCharacteristics( [applyDynamicArmor, -0.1], [applySpallLiner && shell.type === ShellType.HE, -0.2], ); + const assaultDamageCoefficient = + gun.gun_type!.value.base.assault_ranges && + gun.gun_type!.value.base.assault_ranges.types.includes(shell.type) + ? (gun.gun_type!.value.base.assault_ranges.ranges.find( + ({ distance }) => distance >= assaultDistance, + )?.factor ?? 0) + : 1; const moduleDamageCoefficient = coefficient([hasTungsten, 0.15]); const reloadCoefficient = (coefficient([hasGunRammer, -0.05]) * @@ -326,10 +335,11 @@ export function tankCharacteristics( stockTurret.weight + stockGun.gun_type!.value.base.weight; const resolvedEnginePower = engine.power * enginePowerCoefficient; + const damageCoefficient = armorDamageCoefficient * assaultDamageCoefficient; const dpm = resolveDpm( gun, shell, - armorDamageCoefficient, + damageCoefficient, reloadCoefficient, intraClipCoefficient, ); @@ -352,7 +362,7 @@ export function tankCharacteristics( return current; }, null)!.index : undefined; - const damage = shell.armor_damage * armorDamageCoefficient; + const damage = shell.armor_damage * damageCoefficient; const dpmEffective = gun.gun_type!.$case === 'auto_reloader' ? gun.gun_type!.value.extension.shell_reloads[0] > diff --git a/packages/website/src/pages/[...locale]/compare/_index.tsx b/packages/website/src/pages/[...locale]/compare/_index.tsx index f39e322f0..f3a4773c6 100644 --- a/packages/website/src/pages/[...locale]/compare/_index.tsx +++ b/packages/website/src/pages/[...locale]/compare/_index.tsx @@ -85,6 +85,7 @@ function Content() { member.key !== thisMember.key && member.provisions.includes(101), ), + assaultDistance: 0, }, { equipmentDefinitions: equipmentDefinitions, diff --git a/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro b/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro index 11f8567f1..5db83f641 100644 --- a/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro +++ b/packages/website/src/pages/[...locale]/tanks/[slug]/index.astro @@ -60,6 +60,7 @@ const url = import.meta.env.SITE + Astro.url.pathname; const icon = asset(`icons/tanks/big/${id}.webp`); const turret = tank.turrets.at(-1)!; const gun = turret.guns.at(-1)!; +const shell = gun.gun_type!.value.base.shells[0]; const characteristics = tankCharacteristics( { tank, @@ -74,12 +75,13 @@ const characteristics = tankCharacteristics( turret, gun, provisions: createDefaultProvisions(tank, gun, provisionDefinitions), - shell: gun.gun_type!.value.base.shells[0], + shell, stockEngine: tank.engines[0], stockGun: tank.turrets[0].guns[0], stockTurret: tank.turrets[0], stockTrack: tank.tracks[0], track: tank.tracks.at(-1)!, + assaultDistance: 0, }, { equipmentDefinitions, provisionDefinitions, tankModelDefinition }, ); From b20bb97ea33205b747601e4f165342b3b21b819d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:12:14 -0500 Subject: [PATCH 41/71] feat: reorder stuff --- packages/core/src/protos/tank_definitions.ts | 37 +++++++++++++++++-- .../website/src/components/Compare/Body.tsx | 12 +++--- .../AssaultRangesVisualizer/index.tsx | 9 +++++ .../Characteristics/components/Firepower.tsx | 20 +++++++--- 4 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx diff --git a/packages/core/src/protos/tank_definitions.ts b/packages/core/src/protos/tank_definitions.ts index d0b39185a..1861f7e4c 100644 --- a/packages/core/src/protos/tank_definitions.ts +++ b/packages/core/src/protos/tank_definitions.ts @@ -294,7 +294,7 @@ export interface TankDefinition { crew: Crew[]; health: number; nation: string; - name: I18nString; + name: I18nString | undefined; type: TankType; max_consumables: number; max_provisions: number; @@ -437,6 +437,7 @@ export interface GunDefinitionBase { export interface AssaultRanges { ranges: AssaultRange[]; + types: ShellType[]; } export interface AssaultRange { @@ -446,7 +447,7 @@ export interface AssaultRange { export interface ShellDefinition { id: number; - name: I18nString | undefined; + name: I18nString; velocity: number; armor_damage: number; module_damage: number; @@ -3615,7 +3616,7 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = { }; function createBaseAssaultRanges(): AssaultRanges { - return { ranges: [] }; + return { ranges: [], types: [] }; } export const AssaultRanges: MessageFns<AssaultRanges> = { @@ -3626,6 +3627,11 @@ export const AssaultRanges: MessageFns<AssaultRanges> = { for (const v of message.ranges) { AssaultRange.encode(v!, writer.uint32(10).fork()).join(); } + writer.uint32(18).fork(); + for (const v of message.types) { + writer.int32(v); + } + writer.join(); return writer; }, @@ -3645,6 +3651,24 @@ export const AssaultRanges: MessageFns<AssaultRanges> = { message.ranges.push(AssaultRange.decode(reader, reader.uint32())); continue; } + case 2: { + if (tag === 16) { + message.types.push(reader.int32() as any); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.types.push(reader.int32() as any); + } + + continue; + } + + break; + } } if ((tag & 7) === 4 || tag === 0) { break; @@ -3659,6 +3683,9 @@ export const AssaultRanges: MessageFns<AssaultRanges> = { ranges: globalThis.Array.isArray(object?.ranges) ? object.ranges.map((e: any) => AssaultRange.fromJSON(e)) : [], + types: globalThis.Array.isArray(object?.types) + ? object.types.map((e: any) => shellTypeFromJSON(e)) + : [], }; }, @@ -3667,6 +3694,9 @@ export const AssaultRanges: MessageFns<AssaultRanges> = { if (message.ranges?.length) { obj.ranges = message.ranges.map((e) => AssaultRange.toJSON(e)); } + if (message.types?.length) { + obj.types = message.types.map((e) => shellTypeToJSON(e)); + } return obj; }, @@ -3681,6 +3711,7 @@ export const AssaultRanges: MessageFns<AssaultRanges> = { const message = createBaseAssaultRanges(); message.ranges = object.ranges?.map((e) => AssaultRange.fromPartial(e)) || []; + message.types = object.types?.map((e) => e) || []; return message; }, }; diff --git a/packages/website/src/components/Compare/Body.tsx b/packages/website/src/components/Compare/Body.tsx index b4c0afd57..5cdfbd6a8 100644 --- a/packages/website/src/components/Compare/Body.tsx +++ b/packages/website/src/components/Compare/Body.tsx @@ -79,6 +79,12 @@ export function Body({ stats }: BodyProps) { <Table.Body> <CompareRow stats={stats} value="dpm" decimals={0} /> + <CompareRow stats={stats} value="damage" decimals={0} /> + {hasNonRegularGun && ( + <CompareRow stats={stats} indent value="clipDamage" decimals={0} /> + )} + <CompareRow stats={stats} value="moduleDamage" decimals={0} /> + <CompareRow stats={stats} value="penetration" decimals={0} /> <CompareRow stats={stats} name={strings.website.tools.tankopedia.characteristics.values.reload} @@ -105,12 +111,6 @@ export function Body({ stats }: BodyProps) { <CompareRow stats={stats} value="shells" decimals={0} /> </> )} - <CompareRow stats={stats} value="penetration" decimals={0} /> - <CompareRow stats={stats} value="damage" decimals={0} /> - {hasNonRegularGun && ( - <CompareRow stats={stats} indent value="clipDamage" decimals={0} /> - )} - <CompareRow stats={stats} value="moduleDamage" decimals={0} /> <CompareRow stats={stats} value="caliber" decimals={0} /> <CompareRow stats={stats} value="shellNormalization" decimals={0} /> <CompareRow diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx new file mode 100644 index 000000000..bdc3249d0 --- /dev/null +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -0,0 +1,9 @@ +import type { AssaultRanges } from '@blitzkit/core'; + +interface Props { + ranges: AssaultRanges; +} + +export function AssaultRangesVisualizer({ ranges }: Props) { + return null; +} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx index 1da75a991..bd6ece543 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx @@ -21,6 +21,7 @@ import { useEquipment } from '../../../../../../hooks/useEquipment'; import { useLocale } from '../../../../../../hooks/useLocale'; import { useTankModelDefinition } from '../../../../../../hooks/useTankModelDefinition'; import { Duel } from '../../../../../../stores/duel'; +import { AssaultRangesVisualizer } from './AssaultRangesVisualizer'; import { Info } from './Info'; import { InfoWithDelta } from './InfoWithDelta'; import { RicochetVisualizer } from './RicochetVisualizer'; @@ -112,6 +113,19 @@ export function Firepower({ stats }: StatsAcceptorProps) { {strings.common.gun_types[gun.gun_type!.$case]} </Info> <InfoWithDelta stats={stats} decimals={0} value="dpm" /> + <InfoWithDelta stats={stats} decimals={0} value="damage" /> + {gun.gun_type!.$case !== 'regular' && ( + <InfoWithDelta stats={stats} indent decimals={0} value="clipDamage" /> + )} + <InfoWithDelta stats={stats} decimals={0} value="moduleDamage" /> + <InfoWithDelta stats={stats} decimals={0} value="penetration" /> + + {gun.gun_type!.value.base.assault_ranges && ( + <AssaultRangesVisualizer + ranges={gun.gun_type!.value.base.assault_ranges} + /> + )} + {gun.gun_type!.$case === 'auto_reloader' && ( <InfoWithDelta stats={stats} decimals={0} indent value="dpmEffective" /> )} @@ -172,7 +186,6 @@ export function Firepower({ stats }: StatsAcceptorProps) { )} {/* <ReloadVisualizer stats={stats} /> */} - <InfoWithDelta stats={stats} decimals={0} value="penetration" /> {typeof shell.penetration !== 'number' && ( <> <InfoWithDelta @@ -240,11 +253,6 @@ export function Firepower({ stats }: StatsAcceptorProps) { </Flex> </> )} - <InfoWithDelta stats={stats} decimals={0} value="damage" /> - {gun.gun_type!.$case !== 'regular' && ( - <InfoWithDelta stats={stats} indent decimals={0} value="clipDamage" /> - )} - <InfoWithDelta stats={stats} decimals={0} value="moduleDamage" /> {isExplosive(shell.type) && ( <InfoWithDelta stats={stats} From 1e91065033a1121b0f260ffb8037a0c86d2eff1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:42:12 -0500 Subject: [PATCH 42/71] feat: assault graph --- .../AssaultRangesVisualizer/index.tsx | 71 ++++++++++++++++++- .../src/core/blitzkit/tankCharacteristics.ts | 3 +- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx index bdc3249d0..c3989b860 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -1,9 +1,78 @@ import type { AssaultRanges } from '@blitzkit/core'; +import { Box, Card, Flex, Inset, Text } from '@radix-ui/themes'; +import { clamp } from 'three/src/math/MathUtils.js'; +import { Var } from '../../../../../../../core/radix/var'; interface Props { ranges: AssaultRanges; } +const ASSAULT_RANGE_BAR_HEIGHT = '8rem'; + export function AssaultRangesVisualizer({ ranges }: Props) { - return null; + return ( + <Card variant="classic"> + <Inset> + <Flex pl="3" pt="4" direction="column" gap="5"> + <Text size="2" color="gray"> + Assault shell damage + </Text> + + <Flex> + <Box position="relative" width={Var('space-7')}> + {ranges.ranges.map((range) => ( + <Text + style={{ + position: 'absolute', + left: 0, + top: `${(1 - range.factor) * 100}%`, + transform: 'translateY(-50%)', + }} + color="gray" + size="1" + wrap="nowrap" + > + {Math.round(range.factor * 100)}% + </Text> + ))} + </Box> + + <Flex flexGrow="1" align="end" position="relative"> + {ranges.ranges.map((range, index) => ( + <> + <Box + style={{ + height: `calc(${ASSAULT_RANGE_BAR_HEIGHT} * ${range.factor})`, + backgroundColor: `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${ + clamp( + 1.5 * (range.factor - 1) + 1, + + 0, + 1, + ) * 100 + }%)`, + }} + flexGrow={`${range.distance}`} + key={index} + /> + + <Box + position="absolute" + left="0" + bottom={`${range.factor * 100}%`} + width="100%" + height="0.5px" + style={{ + transform: 'translateY(-50%)', + backgroundColor: Var('gray-12'), + }} + /> + </> + ))} + </Flex> + </Flex> + </Flex> + </Inset> + </Card> + ); } diff --git a/packages/website/src/core/blitzkit/tankCharacteristics.ts b/packages/website/src/core/blitzkit/tankCharacteristics.ts index c332211ac..954baae7f 100644 --- a/packages/website/src/core/blitzkit/tankCharacteristics.ts +++ b/packages/website/src/core/blitzkit/tankCharacteristics.ts @@ -166,7 +166,8 @@ export function tankCharacteristics( ({ distance }) => distance >= assaultDistance, )?.factor ?? 0) : 1; - const moduleDamageCoefficient = coefficient([hasTungsten, 0.15]); + const moduleDamageCoefficient = + coefficient([hasTungsten, 0.15]) * assaultDamageCoefficient; const reloadCoefficient = (coefficient([hasGunRammer, -0.05]) * coefficient([true, degressiveStat(loaderMastery)])) / From 6a92b3ae801020b502e5d2195ea02bd37f3c62f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 20:18:36 -0500 Subject: [PATCH 43/71] feat: x axis --- .../AssaultRangesVisualizer/index.tsx | 105 ++++++++++++------ 1 file changed, 71 insertions(+), 34 deletions(-) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx index c3989b860..69f2133c0 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -1,5 +1,5 @@ import type { AssaultRanges } from '@blitzkit/core'; -import { Box, Card, Flex, Inset, Text } from '@radix-ui/themes'; +import { Box, Card, Flex, Text } from '@radix-ui/themes'; import { clamp } from 'three/src/math/MathUtils.js'; import { Var } from '../../../../../../../core/radix/var'; @@ -7,18 +7,30 @@ interface Props { ranges: AssaultRanges; } -const ASSAULT_RANGE_BAR_HEIGHT = '8rem'; - export function AssaultRangesVisualizer({ ranges }: Props) { return ( - <Card variant="classic"> - <Inset> - <Flex pl="3" pt="4" direction="column" gap="5"> - <Text size="2" color="gray"> - Assault shell damage - </Text> + <Card variant="classic" style={{ aspectRatio: '1 / 1' }}> + <Flex + position="absolute" + top="0" + left="0" + width="100%" + height="100%" + direction="column" + > + <Text m="3" size="2" color="gray"> + Assault shell damage + </Text> - <Flex> + <Flex + direction="column" + p="3" + pt="5" + pr="5" + style={{ backgroundColor: Var('gray-1') }} + flexGrow="1" + > + <Flex flexGrow="1"> <Box position="relative" width={Var('space-7')}> {ranges.ranges.map((range) => ( <Text @@ -38,41 +50,66 @@ export function AssaultRangesVisualizer({ ranges }: Props) { </Box> <Flex flexGrow="1" align="end" position="relative"> - {ranges.ranges.map((range, index) => ( - <> + {ranges.ranges.map((range, index) => { + const mix = clamp(1.5 * (range.factor - 1) + 1, 0, 1) * 100; + const color0 = `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${mix}%)`; + const color1 = `color-mix(in hsl, ${Var('tomato-7')}, ${Var('jade-7')} ${mix}%)`; + + return ( <Box style={{ - height: `calc(${ASSAULT_RANGE_BAR_HEIGHT} * ${range.factor})`, - backgroundColor: `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${ - clamp( - 1.5 * (range.factor - 1) + 1, - - 0, - 1, - ) * 100 - }%)`, + height: `${range.factor * 100}%`, + background: `linear-gradient(45deg, ${color1}, ${color0})`, }} flexGrow={`${range.distance}`} key={index} /> + ); + })} - <Box - position="absolute" - left="0" - bottom={`${range.factor * 100}%`} - width="100%" - height="0.5px" - style={{ - transform: 'translateY(-50%)', - backgroundColor: Var('gray-12'), - }} - /> - </> + {ranges.ranges.map((range, index) => ( + <Box + key={index} + position="absolute" + left="0" + bottom={`${range.factor * 100}%`} + width="100%" + height="1pt" + style={{ + transform: 'translateY(50%)', + backgroundColor: Var('gray-11'), + }} + /> ))} </Flex> </Flex> + + <Flex ml="7" height={Var('space-7')}> + {ranges.ranges.map((range, index) => ( + <Box + position="relative" + key={index} + height="100%" + flexGrow={`${range.distance}`} + > + <Text + size="1" + color="gray" + mt="2" + style={{ + position: 'absolute', + right: 0, + transform: 'translateX(50%)', + writingMode: 'vertical-rl', + }} + > + {range.distance}m + </Text> + </Box> + ))} + </Flex> </Flex> - </Inset> + </Flex> </Card> ); } From 089d0e968218fab0ca1826702288faa7dc34a6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 20:40:02 -0500 Subject: [PATCH 44/71] feat: prettier --- packages/i18n/strings/en.json | 4 ++ .../AssaultRangesVisualizer/index.tsx | 50 +++++++++++++------ .../Characteristics/components/Firepower.tsx | 1 + .../src/core/blitzkit/tankCharacteristics.ts | 7 ++- 4 files changed, 47 insertions(+), 15 deletions(-) diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index 65bdf40fc..b752e8717 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -887,6 +887,10 @@ "tank_seo_description": "%s1 armor, statistics, equipment, provisions, and more. %s2 DPM, %s3hp alpha, %s4mm penetration, %s5kph top speed, %s6hp health.", "visualizers": { + "assault": { + "title": "Assault shells" + }, + "rotator": { "hull": "Hull", "turret": "Turret", diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx index 69f2133c0..503ffe64c 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -1,15 +1,33 @@ import type { AssaultRanges } from '@blitzkit/core'; +import { literals } from '@blitzkit/i18n'; import { Box, Card, Flex, Text } from '@radix-ui/themes'; import { clamp } from 'three/src/math/MathUtils.js'; +import type { TankCharacteristics } from '../../../../../../../core/blitzkit/tankCharacteristics'; import { Var } from '../../../../../../../core/radix/var'; +import { useLocale } from '../../../../../../../hooks/useLocale'; interface Props { ranges: AssaultRanges; + stats: TankCharacteristics; } -export function AssaultRangesVisualizer({ ranges }: Props) { +export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { + const maxDistance = Math.max( + ..._ranges.ranges.map((range) => range.distance), + ); + const ranges = _ranges.ranges.map((range) => ({ + factor: range.factor, + distance: range.distance, + fakeDistance: (2 / Math.PI) * Math.atan((4 * range.distance) / maxDistance), + })); + const sumFakeDistances = ranges.reduce( + (total, range) => total + range.fakeDistance, + 0, + ); + const { strings } = useLocale(); + return ( - <Card variant="classic" style={{ aspectRatio: '1 / 1' }}> + <Card mb="6" variant="classic" style={{ aspectRatio: '1 / 1' }}> <Flex position="absolute" top="0" @@ -19,7 +37,7 @@ export function AssaultRangesVisualizer({ ranges }: Props) { direction="column" > <Text m="3" size="2" color="gray"> - Assault shell damage + {strings.website.tools.tankopedia.visualizers.assault.title} </Text> <Flex @@ -31,8 +49,8 @@ export function AssaultRangesVisualizer({ ranges }: Props) { flexGrow="1" > <Flex flexGrow="1"> - <Box position="relative" width={Var('space-7')}> - {ranges.ranges.map((range) => ( + <Box position="relative" width={Var('space-8')}> + {ranges.map((range) => ( <Text style={{ position: 'absolute', @@ -44,30 +62,32 @@ export function AssaultRangesVisualizer({ ranges }: Props) { size="1" wrap="nowrap" > - {Math.round(range.factor * 100)}% + {literals(strings.common.units.hp, [ + `${Math.round(stats.damageWithoutAssault * range.factor)}`, + ])} </Text> ))} </Box> <Flex flexGrow="1" align="end" position="relative"> - {ranges.ranges.map((range, index) => { + {ranges.map((range, index) => { const mix = clamp(1.5 * (range.factor - 1) + 1, 0, 1) * 100; const color0 = `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${mix}%)`; const color1 = `color-mix(in hsl, ${Var('tomato-7')}, ${Var('jade-7')} ${mix}%)`; return ( <Box + width={`${(range.fakeDistance / sumFakeDistances) * 100}%`} + height={`${range.factor * 100}%`} style={{ - height: `${range.factor * 100}%`, background: `linear-gradient(45deg, ${color1}, ${color0})`, }} - flexGrow={`${range.distance}`} key={index} /> ); })} - {ranges.ranges.map((range, index) => ( + {ranges.map((range, index) => ( <Box key={index} position="absolute" @@ -84,13 +104,13 @@ export function AssaultRangesVisualizer({ ranges }: Props) { </Flex> </Flex> - <Flex ml="7" height={Var('space-7')}> - {ranges.ranges.map((range, index) => ( + <Flex ml="8" height={Var('space-7')}> + {ranges.map((range, index) => ( <Box position="relative" key={index} + width={`${(range.fakeDistance / sumFakeDistances) * 100}%`} height="100%" - flexGrow={`${range.distance}`} > <Text size="1" @@ -103,7 +123,9 @@ export function AssaultRangesVisualizer({ ranges }: Props) { writingMode: 'vertical-rl', }} > - {range.distance}m + {literals(strings.common.units.m, [ + `${Math.round(range.distance)}`, + ])} </Text> </Box> ))} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx index bd6ece543..a3cbb3efc 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx @@ -122,6 +122,7 @@ export function Firepower({ stats }: StatsAcceptorProps) { {gun.gun_type!.value.base.assault_ranges && ( <AssaultRangesVisualizer + stats={stats} ranges={gun.gun_type!.value.base.assault_ranges} /> )} diff --git a/packages/website/src/core/blitzkit/tankCharacteristics.ts b/packages/website/src/core/blitzkit/tankCharacteristics.ts index 954baae7f..e8e021203 100644 --- a/packages/website/src/core/blitzkit/tankCharacteristics.ts +++ b/packages/website/src/core/blitzkit/tankCharacteristics.ts @@ -336,7 +336,9 @@ export function tankCharacteristics( stockTurret.weight + stockGun.gun_type!.value.base.weight; const resolvedEnginePower = engine.power * enginePowerCoefficient; - const damageCoefficient = armorDamageCoefficient * assaultDamageCoefficient; + const damageCoefficientWithoutAssault = armorDamageCoefficient; + const damageCoefficient = + damageCoefficientWithoutAssault * assaultDamageCoefficient; const dpm = resolveDpm( gun, shell, @@ -363,6 +365,8 @@ export function tankCharacteristics( return current; }, null)!.index : undefined; + const damageWithoutAssault = + shell.armor_damage * damageCoefficientWithoutAssault; const damage = shell.armor_damage * damageCoefficient; const dpmEffective = gun.gun_type!.$case === 'auto_reloader' @@ -544,6 +548,7 @@ export function tankCharacteristics( caliber, penetration, damage, + damageWithoutAssault, clipDamage, moduleDamage, explosionRadius, From 097f2792ae52428f1cabd88889c54b54238a6be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 31 Jul 2025 20:51:54 -0500 Subject: [PATCH 45/71] feat: cursor --- .../components/Cursor.tsx | 66 +++++++++++++++++++ .../AssaultRangesVisualizer/index.tsx | 5 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor.tsx diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor.tsx new file mode 100644 index 000000000..3ed0c304a --- /dev/null +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor.tsx @@ -0,0 +1,66 @@ +import { DragHandleDots2Icon } from '@radix-ui/react-icons'; +import { Box, Flex, Text } from '@radix-ui/themes'; +import { useState } from 'react'; +import { Var } from '../../../../../../../../core/radix/var'; + +export function AssaultCursor() { + const [x, setX] = useState(0.5); + + return ( + <Box + position="absolute" + top="0" + left={`${x * 100}%`} + height="100%" + width="3pt" + style={{ + transform: 'translateX(-50%)', + backgroundColor: Var('accent-11'), + }} + > + <Flex + align="center" + direction="column" + position="absolute" + left="50%" + bottom="100%" + style={{ transform: 'translateX(-50%)', cursor: 'grab' }} + > + <Flex + align="center" + justify="center" + style={{ + width: '1.5rem', + height: '1.5rem', + backgroundColor: Var('accent-9'), + borderRadius: `50% 50% ${Var('radius-1')} ${Var('radius-1')}`, + }} + > + <Text style={{ display: 'flex' }} highContrast color="purple"> + <DragHandleDots2Icon /> + </Text> + </Flex> + + <Box + height="0.5rem" + width="2px" + style={{ + backgroundColor: Var('accent-9'), + }} + /> + </Flex> + + <Box + position="absolute" + left="50%" + top="0" + height="100%" + width="1pt" + style={{ + transform: 'translateX(-50%)', + backgroundColor: Var('accent-9'), + }} + /> + </Box> + ); +} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx index 503ffe64c..b0602c2e6 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -5,6 +5,7 @@ import { clamp } from 'three/src/math/MathUtils.js'; import type { TankCharacteristics } from '../../../../../../../core/blitzkit/tankCharacteristics'; import { Var } from '../../../../../../../core/radix/var'; import { useLocale } from '../../../../../../../hooks/useLocale'; +import { AssaultCursor } from './components/Cursor'; interface Props { ranges: AssaultRanges; @@ -43,7 +44,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { <Flex direction="column" p="3" - pt="5" + pt="8" pr="5" style={{ backgroundColor: Var('gray-1') }} flexGrow="1" @@ -101,6 +102,8 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { }} /> ))} + + <AssaultCursor /> </Flex> </Flex> From e1b5b21fae1edcb019fc2fdd7ef17c646bcd82a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:25:09 -0500 Subject: [PATCH 46/71] feat: cursor --- packages/i18n/strings/en.json | 2 +- .../components/Cursor.tsx | 66 ----------- .../components/Cursor/index.css | 7 ++ .../components/Cursor/index.tsx | 107 ++++++++++++++++++ .../AssaultRangesVisualizer/index.tsx | 80 +++++++------ .../components/InfoWithDelta.tsx | 2 +- .../components/Characteristics/index.tsx | 5 +- packages/website/src/core/blitzkit/fakeLog.ts | 7 ++ .../src/core/blitzkit/tankCharacteristics.ts | 13 +-- .../src/core/blitzkit/tankToDuelMember.ts | 1 + packages/website/src/stores/duel/index.ts | 1 + 11 files changed, 181 insertions(+), 110 deletions(-) delete mode 100644 packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor.tsx create mode 100644 packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.css create mode 100644 packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx create mode 100644 packages/website/src/core/blitzkit/fakeLog.ts diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index b752e8717..539136d13 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -1083,7 +1083,6 @@ "hull_traverse_speed": "Hull traverse speed", "camouflage": "Camouflage", "reload": "Reload", - "crewCount": "Crew count", "shellNormalization": "Normalization", "shellRicochet": "Ricochet", @@ -1097,6 +1096,7 @@ "caliber": "Caliber", "penetration": "Penetration", "damage": "Damage", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "Clipping potential", "moduleDamage": "Module damage", "explosionRadius": "Explosion radius", diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor.tsx deleted file mode 100644 index 3ed0c304a..000000000 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { DragHandleDots2Icon } from '@radix-ui/react-icons'; -import { Box, Flex, Text } from '@radix-ui/themes'; -import { useState } from 'react'; -import { Var } from '../../../../../../../../core/radix/var'; - -export function AssaultCursor() { - const [x, setX] = useState(0.5); - - return ( - <Box - position="absolute" - top="0" - left={`${x * 100}%`} - height="100%" - width="3pt" - style={{ - transform: 'translateX(-50%)', - backgroundColor: Var('accent-11'), - }} - > - <Flex - align="center" - direction="column" - position="absolute" - left="50%" - bottom="100%" - style={{ transform: 'translateX(-50%)', cursor: 'grab' }} - > - <Flex - align="center" - justify="center" - style={{ - width: '1.5rem', - height: '1.5rem', - backgroundColor: Var('accent-9'), - borderRadius: `50% 50% ${Var('radius-1')} ${Var('radius-1')}`, - }} - > - <Text style={{ display: 'flex' }} highContrast color="purple"> - <DragHandleDots2Icon /> - </Text> - </Flex> - - <Box - height="0.5rem" - width="2px" - style={{ - backgroundColor: Var('accent-9'), - }} - /> - </Flex> - - <Box - position="absolute" - left="50%" - top="0" - height="100%" - width="1pt" - style={{ - transform: 'translateX(-50%)', - backgroundColor: Var('accent-9'), - }} - /> - </Box> - ); -} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.css b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.css new file mode 100644 index 000000000..bf7e4950c --- /dev/null +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.css @@ -0,0 +1,7 @@ +#assault-cursor { + cursor: grab; +} + +#assault-cursor:active { + cursor: grabbing; +} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx new file mode 100644 index 000000000..50f7a9ff6 --- /dev/null +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx @@ -0,0 +1,107 @@ +import { DragHandleDots2Icon } from '@radix-ui/react-icons'; +import { Box, Flex, Text } from '@radix-ui/themes'; +import { useEffect, useRef, useState } from 'react'; +import { clamp } from 'three/src/math/MathUtils.js'; +import { fakeLogInverse } from '../../../../../../../../../core/blitzkit/fakeLog'; +import { Var } from '../../../../../../../../../core/radix/var'; +import { Duel } from '../../../../../../../../../stores/duel'; +import './index.css'; + +interface Props { + maxDistance: number; + maxFakeDistance: number; +} + +export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { + const [x, setX] = useState(0.5); + const cursor = useRef<HTMLDivElement>(null); + const mutateDuel = Duel.useMutation(); + + useEffect(() => { + let localX = x; + + function handlePointerDown(event: PointerEvent) { + event.preventDefault(); + + window.addEventListener('pointermove', handlePointerMove); + window.addEventListener('pointerup', handlePointerUp); + } + + function handlePointerMove(event: PointerEvent) { + const parent = cursor.current?.parentElement; + + if (!parent) return; + + const width = parent.clientWidth; + + setX((state) => { + localX = clamp(state + event.movementX / width, 0, 1); + return localX; + }); + } + + function handlePointerUp() { + mutateDuel((draft) => { + draft.protagonist.assaultDistance = + fakeLogInverse(localX * maxFakeDistance, 2) * maxDistance; + }); + + window.removeEventListener('pointermove', handlePointerMove); + window.removeEventListener('pointerup', handlePointerUp); + } + + cursor.current?.addEventListener('pointerdown', handlePointerDown); + + return () => { + cursor.current?.removeEventListener('pointerdown', handlePointerDown); + }; + }, []); + + return ( + <Box + ref={cursor} + position="absolute" + top="0" + left={`${x * 100}%`} + height="100%" + width="2pt" + id="assault-cursor" + style={{ + transform: 'translateX(-50%)', + backgroundColor: Var('accent-11'), + }} + > + <Flex + align="center" + direction="column" + position="absolute" + left="50%" + bottom="100%" + style={{ transform: 'translateX(-50%)' }} + > + <Flex + align="center" + justify="center" + style={{ + width: '1.5rem', + height: '1.5rem', + backgroundColor: Var('accent-9'), + borderRadius: `50% 50% ${Var('radius-1')} ${Var('radius-1')}`, + }} + > + <Text style={{ display: 'flex' }} highContrast color="purple"> + <DragHandleDots2Icon /> + </Text> + </Flex> + + <Box + height="0.5rem" + width="2pt" + style={{ + backgroundColor: Var('accent-11'), + }} + /> + </Flex> + </Box> + ); +} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx index b0602c2e6..0b2d8ca13 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -2,6 +2,7 @@ import type { AssaultRanges } from '@blitzkit/core'; import { literals } from '@blitzkit/i18n'; import { Box, Card, Flex, Text } from '@radix-ui/themes'; import { clamp } from 'three/src/math/MathUtils.js'; +import { fakeLog } from '../../../../../../../core/blitzkit/fakeLog'; import type { TankCharacteristics } from '../../../../../../../core/blitzkit/tankCharacteristics'; import { Var } from '../../../../../../../core/radix/var'; import { useLocale } from '../../../../../../../hooks/useLocale'; @@ -13,18 +14,14 @@ interface Props { } export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { - const maxDistance = Math.max( - ..._ranges.ranges.map((range) => range.distance), - ); + const maxDistance = _ranges.ranges.at(-1)!.distance; const ranges = _ranges.ranges.map((range) => ({ factor: range.factor, distance: range.distance, - fakeDistance: (2 / Math.PI) * Math.atan((4 * range.distance) / maxDistance), + fakeDistance: fakeLog(range.distance / maxDistance, 2), })); - const sumFakeDistances = ranges.reduce( - (total, range) => total + range.fakeDistance, - 0, - ); + const maxFakeDistance = ranges.at(-1)!.fakeDistance; + const { strings } = useLocale(); return ( @@ -51,8 +48,9 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { > <Flex flexGrow="1"> <Box position="relative" width={Var('space-8')}> - {ranges.map((range) => ( + {ranges.map((range, index) => ( <Text + key={index} style={{ position: 'absolute', left: 0, @@ -75,10 +73,14 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { const mix = clamp(1.5 * (range.factor - 1) + 1, 0, 1) * 100; const color0 = `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${mix}%)`; const color1 = `color-mix(in hsl, ${Var('tomato-7')}, ${Var('jade-7')} ${mix}%)`; + const last = ranges[index - 1]; + const lastFakeDistance = last?.fakeDistance ?? 0; + const fakeWidth = range.fakeDistance - lastFakeDistance; + const fraction = fakeWidth / ranges.at(-1)!.fakeDistance; return ( <Box - width={`${(range.fakeDistance / sumFakeDistances) * 100}%`} + width={`${fraction * 100}%`} height={`${range.factor * 100}%`} style={{ background: `linear-gradient(45deg, ${color1}, ${color0})`, @@ -103,35 +105,45 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { /> ))} - <AssaultCursor /> + <AssaultCursor + maxDistance={maxDistance} + maxFakeDistance={maxFakeDistance} + /> </Flex> </Flex> <Flex ml="8" height={Var('space-7')}> - {ranges.map((range, index) => ( - <Box - position="relative" - key={index} - width={`${(range.fakeDistance / sumFakeDistances) * 100}%`} - height="100%" - > - <Text - size="1" - color="gray" - mt="2" - style={{ - position: 'absolute', - right: 0, - transform: 'translateX(50%)', - writingMode: 'vertical-rl', - }} + {ranges.map((range, index) => { + const last = ranges[index - 1]; + const lastFakeDistance = last?.fakeDistance ?? 0; + const fakeWidth = range.fakeDistance - lastFakeDistance; + const fraction = fakeWidth / ranges.at(-1)!.fakeDistance; + + return ( + <Box + position="relative" + key={index} + width={`${fraction * 100}%`} + height="100%" > - {literals(strings.common.units.m, [ - `${Math.round(range.distance)}`, - ])} - </Text> - </Box> - ))} + <Text + size="1" + color="gray" + mt="2" + style={{ + position: 'absolute', + right: 0, + transform: 'translateX(50%)', + writingMode: 'vertical-rl', + }} + > + {literals(strings.common.units.m, [ + `${Math.round(range.distance)}`, + ])} + </Text> + </Box> + ); + })} </Flex> </Flex> </Flex> diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx index 8e7f53658..f83ba4375 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/InfoWithDelta.tsx @@ -118,7 +118,7 @@ export function InfoWithDelta({ tank, track: member.track, turret: member.turret, - assaultDistance: 0, + assaultDistance: member.assaultDistance, }, { equipmentDefinitions, diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx index ceeb805a6..5e5de9e70 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/index.tsx @@ -24,6 +24,9 @@ export function Characteristics() { const provisions = Duel.use((state) => state.protagonist.provisions); const consumables = Duel.use((state) => state.protagonist.consumables); const camouflage = Duel.use((state) => state.protagonist.camouflage); + const assaultDistance = Duel.use( + (state) => state.protagonist.assaultDistance, + ); const equipmentMatrix = Duel.use( (state) => state.protagonist.equipmentMatrix, ); @@ -58,7 +61,7 @@ export function Characteristics() { applyReactiveArmor: false, applyDynamicArmor: false, applySpallLiner: false, - assaultDistance: 0, + assaultDistance, }, { tankModelDefinition, diff --git a/packages/website/src/core/blitzkit/fakeLog.ts b/packages/website/src/core/blitzkit/fakeLog.ts new file mode 100644 index 000000000..93d44bfd0 --- /dev/null +++ b/packages/website/src/core/blitzkit/fakeLog.ts @@ -0,0 +1,7 @@ +export function fakeLog(x: number, a = 1) { + return (2 / Math.PI) * Math.atan((Math.PI * a * x) / 2); +} + +export function fakeLogInverse(y: number, a = 1) { + return (2 / (Math.PI * a)) * Math.tan((Math.PI * y) / 2); +} diff --git a/packages/website/src/core/blitzkit/tankCharacteristics.ts b/packages/website/src/core/blitzkit/tankCharacteristics.ts index e8e021203..0c152cedf 100644 --- a/packages/website/src/core/blitzkit/tankCharacteristics.ts +++ b/packages/website/src/core/blitzkit/tankCharacteristics.ts @@ -159,13 +159,12 @@ export function tankCharacteristics( [applyDynamicArmor, -0.1], [applySpallLiner && shell.type === ShellType.HE, -0.2], ); - const assaultDamageCoefficient = - gun.gun_type!.value.base.assault_ranges && - gun.gun_type!.value.base.assault_ranges.types.includes(shell.type) - ? (gun.gun_type!.value.base.assault_ranges.ranges.find( - ({ distance }) => distance >= assaultDistance, - )?.factor ?? 0) - : 1; + const assaultDamageCoefficient = gun.gun_type!.value.base.assault_ranges + ? // && gun.gun_type!.value.base.assault_ranges.types.includes(shell.type) + (gun.gun_type!.value.base.assault_ranges.ranges.find( + ({ distance }) => distance >= assaultDistance, + )?.factor ?? 0) + : 1; const moduleDamageCoefficient = coefficient([hasTungsten, 0.15]) * assaultDamageCoefficient; const reloadCoefficient = diff --git a/packages/website/src/core/blitzkit/tankToDuelMember.ts b/packages/website/src/core/blitzkit/tankToDuelMember.ts index ab0d96a92..9e6c9dc3e 100644 --- a/packages/website/src/core/blitzkit/tankToDuelMember.ts +++ b/packages/website/src/core/blitzkit/tankToDuelMember.ts @@ -40,5 +40,6 @@ export function tankToDuelMember( yaw, pitch, turret, + assaultDistance: 0, } satisfies DuelMember; } diff --git a/packages/website/src/stores/duel/index.ts b/packages/website/src/stores/duel/index.ts index 132c5d789..310e5c703 100644 --- a/packages/website/src/stores/duel/index.ts +++ b/packages/website/src/stores/duel/index.ts @@ -39,6 +39,7 @@ export interface DuelMember { provisions: number[]; camouflage: boolean; cooldownBooster: number; + assaultDistance: number; } export interface DuelStore { From a704b291fde227469d59145ad187d7936b5258fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:37:40 -0500 Subject: [PATCH 47/71] fix: consider shells --- packages/core/src/protos/tank_definitions.ts | 2 +- .../components/Cursor/index.tsx | 10 ++++++++-- .../Characteristics/components/Firepower.tsx | 2 +- .../TankSandbox/components/SceneProps/index.tsx | 5 ++++- .../src/core/blitzkit/tankCharacteristics.ts | 13 +++++++------ .../website/src/core/blitzkit/tankToDuelMember.ts | 3 ++- .../src/pages/[...locale]/compare/_index.tsx | 2 +- 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/packages/core/src/protos/tank_definitions.ts b/packages/core/src/protos/tank_definitions.ts index 1861f7e4c..e30a2de75 100644 --- a/packages/core/src/protos/tank_definitions.ts +++ b/packages/core/src/protos/tank_definitions.ts @@ -294,7 +294,7 @@ export interface TankDefinition { crew: Crew[]; health: number; nation: string; - name: I18nString | undefined; + name: I18nString; type: TankType; max_consumables: number; max_provisions: number; diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx index 50f7a9ff6..22c377b1c 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx @@ -2,7 +2,10 @@ import { DragHandleDots2Icon } from '@radix-ui/react-icons'; import { Box, Flex, Text } from '@radix-ui/themes'; import { useEffect, useRef, useState } from 'react'; import { clamp } from 'three/src/math/MathUtils.js'; -import { fakeLogInverse } from '../../../../../../../../../core/blitzkit/fakeLog'; +import { + fakeLog, + fakeLogInverse, +} from '../../../../../../../../../core/blitzkit/fakeLog'; import { Var } from '../../../../../../../../../core/radix/var'; import { Duel } from '../../../../../../../../../stores/duel'; import './index.css'; @@ -13,7 +16,10 @@ interface Props { } export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { - const [x, setX] = useState(0.5); + const assaultDistance = Duel.use( + (state) => state.protagonist.assaultDistance, + ); + const [x, setX] = useState(fakeLog(assaultDistance / maxDistance, 2)); const cursor = useRef<HTMLDivElement>(null); const mutateDuel = Duel.useMutation(); diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx index a3cbb3efc..19819e63e 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/Firepower.tsx @@ -120,7 +120,7 @@ export function Firepower({ stats }: StatsAcceptorProps) { <InfoWithDelta stats={stats} decimals={0} value="moduleDamage" /> <InfoWithDelta stats={stats} decimals={0} value="penetration" /> - {gun.gun_type!.value.base.assault_ranges && ( + {gun.gun_type!.value.base.assault_ranges?.types.includes(shell.type) && ( <AssaultRangesVisualizer stats={stats} ranges={gun.gun_type!.value.base.assault_ranges} diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx index 1fc2632ba..bc69ab476 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/SceneProps/index.tsx @@ -73,6 +73,9 @@ export function SceneProps() { const crewSkills = TankopediaEphemeral.use((state) => state.skills); const consumables = Duel.use((state) => state.protagonist.consumables); const provisions = Duel.use((state) => state.protagonist.provisions); + const assaultDistance = Duel.use( + (state) => state.protagonist.assaultDistance, + ); const equipmentMatrix = Duel.use( (state) => state.protagonist.equipmentMatrix, ); @@ -96,7 +99,7 @@ export function SceneProps() { stockTurret: tank.turrets[0], stockTrack: tank.tracks[0], track, - assaultDistance: 0, + assaultDistance, }, { equipmentDefinitions, provisionDefinitions, tankModelDefinition }, ); diff --git a/packages/website/src/core/blitzkit/tankCharacteristics.ts b/packages/website/src/core/blitzkit/tankCharacteristics.ts index 0c152cedf..e8e021203 100644 --- a/packages/website/src/core/blitzkit/tankCharacteristics.ts +++ b/packages/website/src/core/blitzkit/tankCharacteristics.ts @@ -159,12 +159,13 @@ export function tankCharacteristics( [applyDynamicArmor, -0.1], [applySpallLiner && shell.type === ShellType.HE, -0.2], ); - const assaultDamageCoefficient = gun.gun_type!.value.base.assault_ranges - ? // && gun.gun_type!.value.base.assault_ranges.types.includes(shell.type) - (gun.gun_type!.value.base.assault_ranges.ranges.find( - ({ distance }) => distance >= assaultDistance, - )?.factor ?? 0) - : 1; + const assaultDamageCoefficient = + gun.gun_type!.value.base.assault_ranges && + gun.gun_type!.value.base.assault_ranges.types.includes(shell.type) + ? (gun.gun_type!.value.base.assault_ranges.ranges.find( + ({ distance }) => distance >= assaultDistance, + )?.factor ?? 0) + : 1; const moduleDamageCoefficient = coefficient([hasTungsten, 0.15]) * assaultDamageCoefficient; const reloadCoefficient = diff --git a/packages/website/src/core/blitzkit/tankToDuelMember.ts b/packages/website/src/core/blitzkit/tankToDuelMember.ts index 9e6c9dc3e..3792b6d15 100644 --- a/packages/website/src/core/blitzkit/tankToDuelMember.ts +++ b/packages/website/src/core/blitzkit/tankToDuelMember.ts @@ -40,6 +40,7 @@ export function tankToDuelMember( yaw, pitch, turret, - assaultDistance: 0, + assaultDistance: + (gun.gun_type!.value.base.assault_ranges?.ranges[0].distance ?? 0) / 2, } satisfies DuelMember; } diff --git a/packages/website/src/pages/[...locale]/compare/_index.tsx b/packages/website/src/pages/[...locale]/compare/_index.tsx index f3a4773c6..be223f84a 100644 --- a/packages/website/src/pages/[...locale]/compare/_index.tsx +++ b/packages/website/src/pages/[...locale]/compare/_index.tsx @@ -85,7 +85,7 @@ function Content() { member.key !== thisMember.key && member.provisions.includes(101), ), - assaultDistance: 0, + assaultDistance: thisMember.assaultDistance, }, { equipmentDefinitions: equipmentDefinitions, From fca6cb23d12845524d8ec390fd7323bf4a4ea0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:19:59 -0500 Subject: [PATCH 48/71] Update youtubers.ts --- packages/core/src/blitzkit/youtubers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/blitzkit/youtubers.ts b/packages/core/src/blitzkit/youtubers.ts index e9a162c0f..0b8df03c3 100644 --- a/packages/core/src/blitzkit/youtubers.ts +++ b/packages/core/src/blitzkit/youtubers.ts @@ -4,4 +4,5 @@ export const youtubers = [ { id: 'UCxRpZqMElssTdPYDK3x7wyg', name: 'N90' }, { id: 'UC28Hc6p2MGoB5s78eHCYkQg', name: 'GuidesBlitz' }, { id: 'UCLMEfqtlwLDN-UXX21RiEww', name: 'WoT Blitz Best Replays' }, + { id: 'UC3fZbetRUFoJL0IEN7IhG0Q', name: 'EconomicsMate' }, ]; From 36738f57a969e9be883204b8c7fde90b02da4ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 20:09:50 -0500 Subject: [PATCH 49/71] fix: add mediump default --- .vscode/settings.json | 1 + .../components/PrimaryArmorSceneComponent/shaders/fragment.glsl | 2 ++ .../components/PrimaryArmorSceneComponent/shaders/vertex.glsl | 2 ++ .../components/SpacedArmorSubExternal/shaders/fragment.glsl | 2 ++ .../components/SpacedArmorSubExternal/shaders/vertex.glsl | 2 ++ .../components/SpacedArmorSubSpaced/shaders/fragment.glsl | 2 ++ .../components/SpacedArmorSubSpaced/shaders/vertex.glsl | 2 ++ .../components/TransitionSkeleton/shaders/fragment.glsl | 2 ++ .../components/TransitionSkeleton/shaders/vertex.glsl | 2 ++ 9 files changed, 17 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 185016d64..5a840472a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -109,6 +109,7 @@ "Maddoxkkm", "malum", "mantlets", + "mediump", "metallicness", "metalness", "minitelrose", diff --git a/packages/website/src/components/Armor/components/PrimaryArmorSceneComponent/shaders/fragment.glsl b/packages/website/src/components/Armor/components/PrimaryArmorSceneComponent/shaders/fragment.glsl index 916e480ec..1d7493a79 100644 --- a/packages/website/src/components/Armor/components/PrimaryArmorSceneComponent/shaders/fragment.glsl +++ b/packages/website/src/components/Armor/components/PrimaryArmorSceneComponent/shaders/fragment.glsl @@ -1,3 +1,5 @@ +precision mediump float; + #define USE_FOG #include <fog_pars_fragment> diff --git a/packages/website/src/components/Armor/components/PrimaryArmorSceneComponent/shaders/vertex.glsl b/packages/website/src/components/Armor/components/PrimaryArmorSceneComponent/shaders/vertex.glsl index d80ba8239..2c0140061 100644 --- a/packages/website/src/components/Armor/components/PrimaryArmorSceneComponent/shaders/vertex.glsl +++ b/packages/website/src/components/Armor/components/PrimaryArmorSceneComponent/shaders/vertex.glsl @@ -1,3 +1,5 @@ +precision mediump float; + #define USE_FOG #include <fog_pars_vertex> diff --git a/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubExternal/shaders/fragment.glsl b/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubExternal/shaders/fragment.glsl index ca6251f89..5d3ededb1 100644 --- a/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubExternal/shaders/fragment.glsl +++ b/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubExternal/shaders/fragment.glsl @@ -1,3 +1,5 @@ +precision mediump float; + uniform float thickness; uniform float penetration; diff --git a/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubExternal/shaders/vertex.glsl b/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubExternal/shaders/vertex.glsl index 43b37bc3c..0c9b82ba3 100644 --- a/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubExternal/shaders/vertex.glsl +++ b/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubExternal/shaders/vertex.glsl @@ -1,3 +1,5 @@ +precision mediump float; + #include <clipping_planes_pars_vertex> void main() { diff --git a/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubSpaced/shaders/fragment.glsl b/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubSpaced/shaders/fragment.glsl index 7d486d5e8..6fafe53d1 100644 --- a/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubSpaced/shaders/fragment.glsl +++ b/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubSpaced/shaders/fragment.glsl @@ -1,3 +1,5 @@ +precision mediump float; + varying vec3 vNormal; varying vec3 vViewPosition; diff --git a/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubSpaced/shaders/vertex.glsl b/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubSpaced/shaders/vertex.glsl index 82f94e255..459297160 100644 --- a/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubSpaced/shaders/vertex.glsl +++ b/packages/website/src/components/Armor/components/SpacedArmorSceneComponent/components/SpacedArmorSubSpaced/shaders/vertex.glsl @@ -1,3 +1,5 @@ +precision mediump float; + varying vec3 vNormal; varying vec3 vViewPosition; diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TransitionSkeleton/shaders/fragment.glsl b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TransitionSkeleton/shaders/fragment.glsl index 4cf3f9b1e..4a62b866a 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TransitionSkeleton/shaders/fragment.glsl +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TransitionSkeleton/shaders/fragment.glsl @@ -1,3 +1,5 @@ +precision mediump float; + #define USE_FOG #include <fog_pars_fragment> diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TransitionSkeleton/shaders/vertex.glsl b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TransitionSkeleton/shaders/vertex.glsl index d80ba8239..2c0140061 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TransitionSkeleton/shaders/vertex.glsl +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/components/TransitionSkeleton/shaders/vertex.glsl @@ -1,3 +1,5 @@ +precision mediump float; + #define USE_FOG #include <fog_pars_vertex> From 1524b9a35ddf7183c50035cfb5ded91e2e0116a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 20:11:51 -0500 Subject: [PATCH 50/71] fix: disallow robots on non-master domains --- .github/workflows/website.yml | 2 +- packages/website/src/pages/robots.txt.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 48de729b2..082dcd8b5 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -19,7 +19,7 @@ concurrency: env: PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }} PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }} - ALLOW_ROBOTS: 'true' + ALLOW_ROBOTS: ${{ secrets.ALLOW_ROBOTS }} WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }} PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }} PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }} diff --git a/packages/website/src/pages/robots.txt.ts b/packages/website/src/pages/robots.txt.ts index d37262f56..4580d71dc 100644 --- a/packages/website/src/pages/robots.txt.ts +++ b/packages/website/src/pages/robots.txt.ts @@ -1,9 +1,12 @@ import type { APIContext } from 'astro'; +const ALLOW_ROBOTS = import.meta.env.ALLOW_ROBOTS === 'true'; + export async function GET({ request }: APIContext) { const flags: Record<string, string | null> = { 'User-agent': '*', - Allow: '/', + Allow: ALLOW_ROBOTS ? '/' : null, + Disallow: ALLOW_ROBOTS ? null : '/', space: null, Sitemap: `${new URL(request.url).origin}/sitemap-index.xml`, From d8a6cac52f1a3f0f8de76044acdd4e101f89df6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 20:15:16 -0500 Subject: [PATCH 51/71] fix: align footer second row --- packages/website/src/components/Footer.astro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/website/src/components/Footer.astro b/packages/website/src/components/Footer.astro index db11b3ba7..0e6be3083 100644 --- a/packages/website/src/components/Footer.astro +++ b/packages/website/src/components/Footer.astro @@ -127,8 +127,8 @@ const strings = getStrings(locale); </Flex> </Flex> - <Flex gap="5" display={{ initial: 'flex', sm: 'none' }}> - <Flex direction="column" justify="between" align="end"> + <Flex gap="5" display={{ initial: 'flex', sm: 'none' }} width="100%"> + <Flex direction="column" gap="1" flexGrow="1" flexBasis="0" align="end"> <Text size="2" color="gray">BlitzKit</Text> { PUBLIC_ASSET_BRANCH !== 'preview' && ( @@ -140,7 +140,7 @@ const strings = getStrings(locale); <Text size="2" color="gray">CDN</Text> </Flex> - <Flex direction="column" justify="between" align="start"> + <Flex direction="column" gap="1" flexGrow="1" flexBasis="0" align="start"> <Code size="2" color="gray"> {packageJson.version} </Code> From ea744b673a6cbec74532be5ec86a8e399571467c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 20:30:39 -0500 Subject: [PATCH 52/71] feat: add progress bar to hero section --- .../TankSandbox/Title/components/Tracker.tsx | 25 +++++++++++++++++++ .../{Title.tsx => Title/index.tsx} | 24 ++++++++++-------- 2 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title/components/Tracker.tsx rename packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/{Title.tsx => Title/index.tsx} (81%) diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title/components/Tracker.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title/components/Tracker.tsx new file mode 100644 index 000000000..9448e0ac3 --- /dev/null +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title/components/Tracker.tsx @@ -0,0 +1,25 @@ +import { Box, Progress } from '@radix-ui/themes'; +import { useProgress } from '@react-three/drei'; + +interface Props { + fontSize?: string; +} + +export function Tracker({ fontSize }: Props) { + const { loaded, total } = useProgress(); + const progress = total === 0 ? 0 : (loaded / total) * 100; + + return ( + <Box + position="absolute" + left="50%" + bottom="0" + width="min(100%, 16rem)" + style={{ + transform: `translate(-50%, calc(${fontSize} / 2))`, + }} + > + <Progress color="gray" value={progress} /> + </Box> + ); +} diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title/index.tsx similarity index 81% rename from packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title.tsx rename to packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title/index.tsx index 970dcd19c..44d1b3bca 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/TankSandbox/Title/index.tsx @@ -1,10 +1,11 @@ import { TankType } from '@blitzkit/core'; import { Box, Heading } from '@radix-ui/themes'; -import { Var } from '../../../../../core/radix/var'; -import { useLocale } from '../../../../../hooks/useLocale'; -import { Duel } from '../../../../../stores/duel'; -import type { RadixColor } from '../../../../../stores/embedState'; -import { TankopediaEphemeral } from '../../../../../stores/tankopediaEphemeral'; +import { Var } from '../../../../../../core/radix/var'; +import { useLocale } from '../../../../../../hooks/useLocale'; +import { Duel } from '../../../../../../stores/duel'; +import type { RadixColor } from '../../../../../../stores/embedState'; +import { TankopediaEphemeral } from '../../../../../../stores/tankopediaEphemeral'; +import { Tracker } from './components/Tracker'; interface TitleProps { foreground?: boolean; @@ -81,6 +82,11 @@ export function Title({ foreground }: TitleProps) { : `${nationColors.text}-12`, ); const name = unwrap(protagonist.name); + const fontSize = revealed + ? disturbed + ? '2rem' + : `min(65vh, ${125 / name.length}vw)` + : `min(48vh, ${75 / name.length}vw)`; return ( <Box @@ -97,11 +103,7 @@ export function Title({ foreground }: TitleProps) { fontWeight: 900, userSelect: 'none', pointerEvents: 'none', - fontSize: revealed - ? disturbed - ? '2rem' - : `min(65vh, ${125 / name.length}vw)` - : `min(48vh, ${75 / name.length}vw)`, + fontSize, whiteSpace: 'nowrap', color: foreground ? Var('gray-a10') : color, opacity: foreground && disturbed ? 0 : 1, @@ -117,6 +119,8 @@ export function Title({ foreground }: TitleProps) { > {name} </Heading> + + {!revealed && <Tracker fontSize={fontSize} />} </Box> ); } From 1f07c2be744b64282220294145d5a0054d8a1d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 21:00:40 -0500 Subject: [PATCH 53/71] feat: better logs --- packages/website/src/core/blitzkit/fakeLog.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/website/src/core/blitzkit/fakeLog.ts b/packages/website/src/core/blitzkit/fakeLog.ts index 93d44bfd0..0cebd3fa3 100644 --- a/packages/website/src/core/blitzkit/fakeLog.ts +++ b/packages/website/src/core/blitzkit/fakeLog.ts @@ -1,7 +1,9 @@ +const GAMMA = 1.2; + export function fakeLog(x: number, a = 1) { - return (2 / Math.PI) * Math.atan((Math.PI * a * x) / 2); + return Math.sin((Math.PI / 2) * x) ** (1 / GAMMA); } export function fakeLogInverse(y: number, a = 1) { - return (2 / (Math.PI * a)) * Math.tan((Math.PI * y) / 2); + return (2 / Math.PI) * Math.asin(y ** GAMMA); } From bbe53deb98b66cb4640de41e453114fcaa38bc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 21:06:24 -0500 Subject: [PATCH 54/71] feat: logs --- docs/changelogs/1.27.13.md | 19 +++++++++++++++++++ package.json | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 docs/changelogs/1.27.13.md diff --git a/docs/changelogs/1.27.13.md b/docs/changelogs/1.27.13.md new file mode 100644 index 000000000..d9752d77f --- /dev/null +++ b/docs/changelogs/1.27.13.md @@ -0,0 +1,19 @@ +# BlitzKit 1.27.13 + +This update adds a feature for a future version of WoTB 👁️👃👁️ + +## Features + +- Added compatibility for the new mechanic for the upcoming Polish Tank Destroyers + - This code will remain dormant until the update for WoTB is released +- Added a progress bar to the hero section of the Tankopedia to show that the model is loading +- Reordered some Tankopedia statistics to bring important statistics like Damage to the very top + +## Fixes + +- The second column in the footer is now aligned on mobile devices +- Fixed an issue that stopped the armor highlighting from working on the Kiwi browser and on older devices + +## Technical Changes + +- Removed permissions for robots to crawl non-blitzkit.app domains diff --git a/package.json b/package.json index e91c5e6a9..f4b001d2b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "blitzkit", "private": true, - "version": "1.27.12", + "version": "1.27.13", "description": "🎉 Tools for everything World of Tanks Blitz", "type": "module", "types": "./types.d.ts", From 993083665bed760309f297d1cf3b007e95a70baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 21:52:34 -0500 Subject: [PATCH 55/71] fix: types --- .../core/src/protos/camouflage_definitions.ts | 322 +++++++++++------- packages/core/src/protos/tank_definitions.ts | 12 +- 2 files changed, 203 insertions(+), 131 deletions(-) diff --git a/packages/core/src/protos/camouflage_definitions.ts b/packages/core/src/protos/camouflage_definitions.ts index 1533bfd11..49336ed41 100644 --- a/packages/core/src/protos/camouflage_definitions.ts +++ b/packages/core/src/protos/camouflage_definitions.ts @@ -5,10 +5,10 @@ // source: packages/core/src/protos/camouflage_definitions.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; -import { createBaseI18nString, I18nString } from "./i18n"; +import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; +import { createBaseI18nString, I18nString } from './i18n'; -export const protobufPackage = "blitzkit"; +export const protobufPackage = 'blitzkit'; export interface CamouflageDefinitions { camouflages: { [key: number]: Camouflage }; @@ -22,8 +22,8 @@ export interface CamouflageDefinitions_CamouflagesEntry { export interface Camouflage { id: number; name: I18nString; - tank_name?: I18nString | undefined; - tank_name_full?: I18nString | undefined; + tank_name?: I18nString; + tank_name_full?: I18nString; } export function createBaseCamouflageDefinitions(): CamouflageDefinitions { @@ -31,15 +31,25 @@ export function createBaseCamouflageDefinitions(): CamouflageDefinitions { } export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = { - encode(message: CamouflageDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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(); + 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); + 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) { @@ -50,7 +60,10 @@ export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = { break; } - const entry1 = CamouflageDefinitions_CamouflagesEntry.decode(reader, reader.uint32()); + const entry1 = CamouflageDefinitions_CamouflagesEntry.decode( + reader, + reader.uint32(), + ); if (entry1.value !== undefined) { message.camouflages[entry1.key] = entry1.value; } @@ -68,10 +81,12 @@ export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = { 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; - }, {}) + ? Object.entries(object.camouflages).reduce<{ + [key: number]: Camouflage; + }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = Camouflage.fromJSON(value); + return acc; + }, {}) : {}, }; }, @@ -90,20 +105,23 @@ export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = { return obj; }, - create<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>(base?: I): CamouflageDefinitions { + 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 { + 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; - }, - {}, - ); + 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; }, }; @@ -112,90 +130,116 @@ export function createBaseCamouflageDefinitions_CamouflagesEntry(): CamouflageDe 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; - } +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 ((tag & 7) === 4 || tag === 0) { - break; + if (message.value !== undefined) { + Camouflage.encode(message.value, writer.uint32(18).fork()).join(); } - reader.skip(tag & 7); - } - return message; - }, + return writer; + }, - fromJSON(object: any): CamouflageDefinitions_CamouflagesEntry { - return { - key: globalThis.Number(assertSet("CamouflageDefinitions_CamouflagesEntry.key", object.key)), - value: Camouflage.fromJSON(assertSet("CamouflageDefinitions_CamouflagesEntry.value", object.value)), - }; - }, + 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; + } - 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; - }, + message.key = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } - 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) - : createBaseCamouflage(); - return message; - }, -}; + 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) + : createBaseCamouflage(); + return message; + }, + }; export function createBaseCamouflage(): Camouflage { - return { id: 0, name: createBaseI18nString(), tank_name: undefined, tank_name_full: undefined }; + 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 { + encode( + message: Camouflage, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } @@ -206,13 +250,17 @@ export const Camouflage: MessageFns<Camouflage> = { 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(); + 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); + 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) { @@ -261,10 +309,14 @@ export const Camouflage: MessageFns<Camouflage> = { 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, + 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, }; }, @@ -288,37 +340,57 @@ export const Camouflage: MessageFns<Camouflage> = { 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 { + 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; + 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; +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>; +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 { diff --git a/packages/core/src/protos/tank_definitions.ts b/packages/core/src/protos/tank_definitions.ts index e30a2de75..3a4365730 100644 --- a/packages/core/src/protos/tank_definitions.ts +++ b/packages/core/src/protos/tank_definitions.ts @@ -305,7 +305,7 @@ export interface TankDefinition { turrets: TurretDefinition[]; engines: EngineDefinition[]; tracks: TrackDefinition[]; - price: TankPrice | undefined; + price: TankPrice; research_cost?: ResearchCost | undefined; speed_forwards: number; speed_backwards: number; @@ -341,7 +341,7 @@ export interface TankPrice { export interface TrackDefinition { id: number; tier: number; - name: I18nString | undefined; + name: I18nString; weight: number; traverse_speed: number; research_cost?: ResearchCost | undefined; @@ -355,7 +355,7 @@ export interface TrackDefinition { export interface EngineDefinition { id: number; - name: I18nString | undefined; + name: I18nString; research_cost?: ResearchCost | undefined; tier: number; fire_chance: number; @@ -370,7 +370,7 @@ export interface TurretDefinition { view_range: number; traverse_speed: number; research_cost?: ResearchCost | undefined; - name: I18nString | undefined; + name: I18nString; tier: number; weight: number; guns: GunDefinition[]; @@ -421,7 +421,7 @@ export interface GunDefinitionBase { rotation_speed: number; research_cost?: ResearchCost | undefined; weight: number; - name: I18nString | undefined; + name: I18nString; tier: number; shells: ShellDefinition[]; camouflage_loss: number; @@ -469,7 +469,7 @@ export interface ShellPenetration { export interface Unlock { id: number; type: ModuleType; - cost: UnlockCost | undefined; + cost: UnlockCost; } export interface UnlockCost { From 43aee373ea9f3ae81a05d9651a48ca99df425232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 22:14:08 -0500 Subject: [PATCH 56/71] Update youtubers.ts --- packages/core/src/blitzkit/youtubers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/blitzkit/youtubers.ts b/packages/core/src/blitzkit/youtubers.ts index 0b8df03c3..d8986559f 100644 --- a/packages/core/src/blitzkit/youtubers.ts +++ b/packages/core/src/blitzkit/youtubers.ts @@ -5,4 +5,5 @@ export const youtubers = [ { id: 'UC28Hc6p2MGoB5s78eHCYkQg', name: 'GuidesBlitz' }, { id: 'UCLMEfqtlwLDN-UXX21RiEww', name: 'WoT Blitz Best Replays' }, { id: 'UC3fZbetRUFoJL0IEN7IhG0Q', name: 'EconomicsMate' }, + { id: 'UCtsUVwBlhEnUunAKLn2dtsg', name: 'Megalion' }, ]; From 7471567147c7be992c95530282b34922747e7bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 22:24:26 -0500 Subject: [PATCH 57/71] Update youtubers.ts --- packages/core/src/blitzkit/youtubers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/blitzkit/youtubers.ts b/packages/core/src/blitzkit/youtubers.ts index d8986559f..b9f8d46f3 100644 --- a/packages/core/src/blitzkit/youtubers.ts +++ b/packages/core/src/blitzkit/youtubers.ts @@ -5,5 +5,5 @@ export const youtubers = [ { id: 'UC28Hc6p2MGoB5s78eHCYkQg', name: 'GuidesBlitz' }, { id: 'UCLMEfqtlwLDN-UXX21RiEww', name: 'WoT Blitz Best Replays' }, { id: 'UC3fZbetRUFoJL0IEN7IhG0Q', name: 'EconomicsMate' }, - { id: 'UCtsUVwBlhEnUunAKLn2dtsg', name: 'Megalion' }, + { id: 'UCtsUVwBlhEnUunAKLn2dtsg', name: 'Megalion69' }, ]; From 2033fab21a8d0cd7974f6938667d78e193b62771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 22:24:59 -0500 Subject: [PATCH 58/71] New Crowdin updates (#159) * New translations en.json (French) * New translations en.json (Spanish) * New translations en.json (Japanese) * New translations en.json (Polish) * New translations en.json (Portuguese) * New translations en.json (Russian) * New translations en.json (Ukrainian) * New translations en.json (Chinese Simplified) --- packages/i18n/strings/es.json | 4 ++++ packages/i18n/strings/fr.json | 4 ++++ packages/i18n/strings/ja.json | 4 ++++ packages/i18n/strings/pl.json | 4 ++++ packages/i18n/strings/pt.json | 4 ++++ packages/i18n/strings/ru.json | 4 ++++ packages/i18n/strings/uk.json | 4 ++++ packages/i18n/strings/zh.json | 4 ++++ 8 files changed, 32 insertions(+) diff --git a/packages/i18n/strings/es.json b/packages/i18n/strings/es.json index bbc9f70ce..b0614d71c 100644 --- a/packages/i18n/strings/es.json +++ b/packages/i18n/strings/es.json @@ -787,6 +787,9 @@ "tank_seo_title": "%s1 - Nivel %s2 %s3 %s4 | %s5 Tankopedia | World of Tanks Blitz (WoTB)", "tank_seo_description": "%s1 blindaje, estadisticas, equipamiento, proviciones y mas.\n%s2 DPM, %3hp alfa, %s4mm penetracion, %s5kph velocidad maxima, %s6 hp salud", "visualizers": { + "assault": { + "title": "Assault shells" + }, "rotator": { "hull": "Hull", "turret": "Turret", @@ -976,6 +979,7 @@ "caliber": "Calibre", "penetration": "Penetración", "damage": "Daño", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "Clipping potential", "moduleDamage": "Daño a módulos", "explosionRadius": "Radio de Explosión", diff --git a/packages/i18n/strings/fr.json b/packages/i18n/strings/fr.json index c8df1fee6..38a9bbb5f 100644 --- a/packages/i18n/strings/fr.json +++ b/packages/i18n/strings/fr.json @@ -787,6 +787,9 @@ "tank_seo_title": "%s1 - Tier %s2 %s3 %s4 | %s5 Tankopedia | World of Tanks Blitz (WoTB)", "tank_seo_description": "%s1 armor, statistics, equipment, provisions, and more. %s2 DPM, %s3hp alpha, %s4mm penetration, %s5kph top speed, %s6hp health.", "visualizers": { + "assault": { + "title": "Assault shells" + }, "rotator": { "hull": "Hull", "turret": "Turret", @@ -976,6 +979,7 @@ "caliber": "Caliber", "penetration": "Penetration", "damage": "Dégâts", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "Clipping potential", "moduleDamage": "Module damage", "explosionRadius": "Explosion radius", diff --git a/packages/i18n/strings/ja.json b/packages/i18n/strings/ja.json index bd3efe151..209598c11 100644 --- a/packages/i18n/strings/ja.json +++ b/packages/i18n/strings/ja.json @@ -787,6 +787,9 @@ "tank_seo_title": "%s1 - Tier %s2 %s3 %s4 | %s5 Tankopedia | World of Tanks Blitz (WoTB)", "tank_seo_description": "%s1 armor, statistics, equipment, provisions, and more. %s2 DPM, %s3hp alpha, %s4mm penetration, %s5kph top speed, %s6hp health.", "visualizers": { + "assault": { + "title": "Assault shells" + }, "rotator": { "hull": "Hull", "turret": "Turret", @@ -976,6 +979,7 @@ "caliber": "口径", "penetration": "貫通力", "damage": "ダメージ", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "弾倉火力", "moduleDamage": "モジュールダメージ", "explosionRadius": "爆風半径", diff --git a/packages/i18n/strings/pl.json b/packages/i18n/strings/pl.json index 6fdf2de7e..9f8ea28a5 100644 --- a/packages/i18n/strings/pl.json +++ b/packages/i18n/strings/pl.json @@ -787,6 +787,9 @@ "tank_seo_title": "%s1 - Tier %s2 %s3 %s4 | %s5 Tankopedia | World of Tanks Blitz (WoTB)", "tank_seo_description": "%s1 armor, statistics, equipment, provisions, and more. %s2 DPM, %s3hp alpha, %s4mm penetration, %s5kph top speed, %s6hp health.", "visualizers": { + "assault": { + "title": "Assault shells" + }, "rotator": { "hull": "Hull", "turret": "Turret", @@ -976,6 +979,7 @@ "caliber": "Caliber", "penetration": "Penetration", "damage": "Uszkodzenia", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "Clipping potential", "moduleDamage": "Module damage", "explosionRadius": "Explosion radius", diff --git a/packages/i18n/strings/pt.json b/packages/i18n/strings/pt.json index a4eeac78c..ff7844c75 100644 --- a/packages/i18n/strings/pt.json +++ b/packages/i18n/strings/pt.json @@ -787,6 +787,9 @@ "tank_seo_title": "%s1 - Nível %s2 %s3 %s4 | %s5 Tanquepedia | World of Tanks Blitz (WoTB)", "tank_seo_description": "%s1 blindagem, estatísticas, equipamentos, provisões e mais. %s2 DPM, %s3hp alfa, %s4mm de penetração, %s5km/h velocidade máxima, %s6hp vida.", "visualizers": { + "assault": { + "title": "Assault shells" + }, "rotator": { "hull": "Hull", "turret": "Turret", @@ -976,6 +979,7 @@ "caliber": "Calibre", "penetration": "Penetração", "damage": "Dano", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "Potencial de clipe", "moduleDamage": "Dano a módulos", "explosionRadius": "Raio de Explosão", diff --git a/packages/i18n/strings/ru.json b/packages/i18n/strings/ru.json index 384db3c5e..7ec10e078 100644 --- a/packages/i18n/strings/ru.json +++ b/packages/i18n/strings/ru.json @@ -787,6 +787,9 @@ "tank_seo_title": "%s1 - %s4 %s3 %s2 уровня | Танкопедия %s5 | World of Tanks Blitz (WoTB)", "tank_seo_description": "%s1 броня, статистика, оборудование, снабжение и многое другое. %s2 УВМ, %s3hp альфа, %s4mm пробитие, %s5км/ч лучшая скорость, %s6hp здоровье.", "visualizers": { + "assault": { + "title": "Assault shells" + }, "rotator": { "hull": "Корпус", "turret": "Башня", @@ -976,6 +979,7 @@ "caliber": "Калибр", "penetration": "Пробитие", "damage": "Урон", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "Урон с барабана", "moduleDamage": "Урон по модулям", "explosionRadius": "Разлет осколков", diff --git a/packages/i18n/strings/uk.json b/packages/i18n/strings/uk.json index 3d39e23a5..7c927025a 100644 --- a/packages/i18n/strings/uk.json +++ b/packages/i18n/strings/uk.json @@ -787,6 +787,9 @@ "tank_seo_title": "%s1 - Рівень %s2 %s3 %s4 | %s5 Танкопедія | WoT Blitz", "tank_seo_description": "%s1 броня, характеристики, обладнання, амуніція та більше. %s2 шкода на хвилину, %s3 разова шкода, %s4 мм пробиття, %s5 км/год максимальна швидкість, %s6 міцність.", "visualizers": { + "assault": { + "title": "Assault shells" + }, "rotator": { "hull": "Hull", "turret": "Turret", @@ -976,6 +979,7 @@ "caliber": "Калібр", "penetration": "Бронепробиття", "damage": "Шкода", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "Clipping potential", "moduleDamage": "Шкода по модулях", "explosionRadius": "Радіус розльоту уламків", diff --git a/packages/i18n/strings/zh.json b/packages/i18n/strings/zh.json index bfd828d71..fedec6ac4 100644 --- a/packages/i18n/strings/zh.json +++ b/packages/i18n/strings/zh.json @@ -787,6 +787,9 @@ "tank_seo_title": "%s1 - %s2 阶 %s3 %s4 | %s5 战车百科 | 战车世界闪击战 (WoTB)", "tank_seo_description": "%s1 装甲,统计设备,装备,供给等。 %s2 每分钟伤害, %s3生命值, %s4毫米穿透, %s5kph 最高速度, %s6hp 生命值。", "visualizers": { + "assault": { + "title": "Assault shells" + }, "rotator": { "hull": "车体", "turret": "炮塔", @@ -976,6 +979,7 @@ "caliber": "口径", "penetration": "穿深", "damage": "伤害", + "damageWithoutAssault": "Damage without assault shells", "clipDamage": "弹匣伤害期望值", "moduleDamage": "模组伤害", "explosionRadius": "溅射半径", From 5cab394cedc17b3cb190bd3bc5054ef755a9dd99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 4 Aug 2025 22:34:05 -0500 Subject: [PATCH 59/71] Update index.tsx --- .../AssaultRangesVisualizer/components/Cursor/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx index 22c377b1c..21f07e417 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx @@ -34,6 +34,8 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { } function handlePointerMove(event: PointerEvent) { + event.preventDefault(); + const parent = cursor.current?.parentElement; if (!parent) return; From e3f131cdfd08c6071e4f4479e0c7d02d94d0aa53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 5 Aug 2025 08:52:02 -0500 Subject: [PATCH 60/71] Update and rename LICENSE to LICENSE.md (#160) --- LICENSE | 661 ----------------------------------------------------- LICENSE.md | 24 ++ 2 files changed, 24 insertions(+), 661 deletions(-) delete mode 100644 LICENSE create mode 100644 LICENSE.md diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0ad25db4b..000000000 --- a/LICENSE +++ /dev/null @@ -1,661 +0,0 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -<https://www.gnu.org/licenses/>. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..eb54667dd --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,24 @@ +# BlitzKit License + +Version 1.0, August 5th, 2025. Copyright (c) TrèsAbhi. + +Permission is hereby granted to anyone to: + +- Fork, clone, and download the contents of this repository. +- Modify the code locally in private. +- Use and run the code **only for personal, non-public testing and educational purposes**. + +The following restrictions apply: + +- You may **not** deploy, host, or make this project or any derivative publicly accessible. +- You may **not** share screenshots, recordings, or any form of media from this project unless you intend to merge your changes back into BlitzKit. +- You may **not** use this project or its contents in any public or commercial product. +- You may **not** redistribute modified or unmodified versions of this project. + +Contributions: +- You are encouraged to propose changes or improvements via pull requests to the original BlitzKit repository. +- Any such contributions will be considered under the same license terms unless explicitly stated otherwise. + +Violations of this license may result in revocation of usage rights and takedown requests. + +For questions or licensing inquiries, contact support@blitzkit.app. From 072e9134336150cf0e613be2c2d54c3fdbd9b6ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 5 Aug 2025 12:09:31 -0500 Subject: [PATCH 61/71] feat: existing forks --- LICENSE.md | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index eb54667dd..456d31ebb 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,12 +1,12 @@ # BlitzKit License -Version 1.0, August 5th, 2025. Copyright (c) TrèsAbhi. +Version 1.1, August 5th, 2025. Copyright (c) TrèsAbhi. Permission is hereby granted to anyone to: - Fork, clone, and download the contents of this repository. - Modify the code locally in private. -- Use and run the code **only for personal, non-public testing and educational purposes**. +- Use and run the code **only for personal, non-public testing, or educational purposes**. The following restrictions apply: @@ -16,9 +16,35 @@ The following restrictions apply: - You may **not** redistribute modified or unmodified versions of this project. Contributions: + - You are encouraged to propose changes or improvements via pull requests to the original BlitzKit repository. - Any such contributions will be considered under the same license terms unless explicitly stated otherwise. Violations of this license may result in revocation of usage rights and takedown requests. For questions or licensing inquiries, contact support@blitzkit.app. + +## Notes on Existing Forks + +All forks fall under these categories: + +- If your fork was made from commit `8462901` (Apr 17, 2023) or between commits `2958124` (Jul 3, 2023) and `85e483e` (Jul 13, 2024), your fork falls under the **MIT license**. +- If your fork was made from commits between `5646093` (Jul 13, 2024) and `e3f131c` (Aug 5, 2025), your fork falls under the **AGPL-3.0 license**. +- If your fork was made between commit `f7c356d` (Apr 17, 2023) and `2958124` (Jul 3, 2023), your fork falls under **a default exclusive copyright**. +- If your fork was made from commits between `e3f131c` (Aug 5, 2025) and today, your fork falls under **this license**. + +MIT and AGPL-3.0 licensed fork owners: + +- You may continue to use your fork of BlitzKit under the corresponding license. +- You may upgrade your fork up to commit `5cab394` (Aug 4, 2025) and keep the AGPL-3.0 license. +- You may upgrade to commit `e3f131c` (Aug 5, 2025) or beyond but have to **switch to this license** where all rules apply. + - If you upgrade to commit `e3f131c` (Aug 5, 2025) or beyond, you must retract all public deployments of BlitzKit. + - Existing screenshots, recordings, or any form of media can remain. + +Default exclusive copyright fork owners: + +- You may continue to use their forks under the AGPL-3.0 license as no license was applied to BlitzKit at the time of forking. + +BlitzKit licensed fork owners: + +- You may continue to upgrade to the latest commits only under the conditions of this license. From 31b628049a8e711e0baad892db06a3abccd92a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 6 Aug 2025 12:04:31 -0500 Subject: [PATCH 62/71] fix: key --- package.json | 1 + .../src/components/TankSearch/components/FilterControl.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/package.json b/package.json index f4b001d2b..96ce8518f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "start:bot": "bun dist/bot/main.js", "dev:docs": "vitepress dev docs", "dev:website": "cd packages/website && bun run dev", + "dev": "bun run dev:website", "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", diff --git a/packages/website/src/components/TankSearch/components/FilterControl.tsx b/packages/website/src/components/TankSearch/components/FilterControl.tsx index 189c3893f..66cfce18d 100644 --- a/packages/website/src/components/TankSearch/components/FilterControl.tsx +++ b/packages/website/src/components/TankSearch/components/FilterControl.tsx @@ -84,6 +84,7 @@ function ShellFilter({ index, premium }: { index: number; premium?: boolean }) { return ( <IconButton + key={shellType} value={`${shellType}`} radius="none" variant={selected ? 'solid' : 'soft'} From 9368d058f2cabb93f152411c21bca0ef6ef183ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 6 Aug 2025 12:10:31 -0500 Subject: [PATCH 63/71] fix: mobile cursor --- docs/changelogs/1.27.14.md | 5 +++++ package.json | 2 +- .../components/Cursor/index.tsx | 12 ++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 docs/changelogs/1.27.14.md diff --git a/docs/changelogs/1.27.14.md b/docs/changelogs/1.27.14.md new file mode 100644 index 000000000..a2856f0ee --- /dev/null +++ b/docs/changelogs/1.27.14.md @@ -0,0 +1,5 @@ +# BlitzKit 1.27.14 + +## Fixes + +- Optimized the rendering of the shells in the Tankopedia search diff --git a/package.json b/package.json index 96ce8518f..9a2e054de 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "blitzkit", "private": true, - "version": "1.27.13", + "version": "1.27.14", "description": "🎉 Tools for everything World of Tanks Blitz", "type": "module", "types": "./types.d.ts", diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx index 21f07e417..7c67c5017 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx @@ -25,25 +25,30 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { useEffect(() => { let localX = x; + let lastX = 0; function handlePointerDown(event: PointerEvent) { event.preventDefault(); + lastX = event.clientX; + window.addEventListener('pointermove', handlePointerMove); window.addEventListener('pointerup', handlePointerUp); } function handlePointerMove(event: PointerEvent) { event.preventDefault(); - + const parent = cursor.current?.parentElement; if (!parent) return; const width = parent.clientWidth; + const movementX = event.clientX - lastX; + lastX = event.clientX; setX((state) => { - localX = clamp(state + event.movementX / width, 0, 1); + localX = clamp(state + movementX / width, 0, 1); return localX; }); } @@ -62,6 +67,8 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { return () => { cursor.current?.removeEventListener('pointerdown', handlePointerDown); + window.removeEventListener('pointermove', handlePointerMove); + window.removeEventListener('pointerup', handlePointerUp); }; }, []); @@ -75,6 +82,7 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { width="2pt" id="assault-cursor" style={{ + touchAction: 'none', transform: 'translateX(-50%)', backgroundColor: Var('accent-11'), }} From 8f9e537a5ee4f92eed01a9414cfe7d2bc9a671d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 6 Aug 2025 12:12:18 -0500 Subject: [PATCH 64/71] feat: logs --- docs/changelogs/1.27.14.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelogs/1.27.14.md b/docs/changelogs/1.27.14.md index a2856f0ee..cff532b8e 100644 --- a/docs/changelogs/1.27.14.md +++ b/docs/changelogs/1.27.14.md @@ -1,5 +1,8 @@ # BlitzKit 1.27.14 +This is the 14th path for `1.12`, making it the new longest lasting version beating the previous record of `1.15.13`! + ## Fixes - Optimized the rendering of the shells in the Tankopedia search +- The Assault Shells cursor now works on iOS devices From 3c51f4f94a5a6bc826ca86f7c42042245bfa8df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 6 Aug 2025 15:59:54 -0500 Subject: [PATCH 65/71] Update 1.27.14.md --- docs/changelogs/1.27.14.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelogs/1.27.14.md b/docs/changelogs/1.27.14.md index cff532b8e..4e2d3782d 100644 --- a/docs/changelogs/1.27.14.md +++ b/docs/changelogs/1.27.14.md @@ -1,6 +1,6 @@ # BlitzKit 1.27.14 -This is the 14th path for `1.12`, making it the new longest lasting version beating the previous record of `1.15.13`! +This is the 14th patch for `1.12`, making it the new longest lasting version beating the previous record of `1.15.13`! ## Fixes From 19a2492555961bf718d12cdc3ce49368d482de82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 7 Aug 2025 11:39:28 -0500 Subject: [PATCH 66/71] fix: >1 factor --- docs/changelogs/1.27.15.md | 7 +++++++ package.json | 2 +- .../components/AssaultRangesVisualizer/index.tsx | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 docs/changelogs/1.27.15.md diff --git a/docs/changelogs/1.27.15.md b/docs/changelogs/1.27.15.md new file mode 100644 index 000000000..65a42d1f5 --- /dev/null +++ b/docs/changelogs/1.27.15.md @@ -0,0 +1,7 @@ +# BlitzKit 1.27.15 + +I did not see this coming + +## Fixes + +- The Assault Shell graph now supports damage factors of above 100% now diff --git a/package.json b/package.json index 9a2e054de..ea5120699 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "blitzkit", "private": true, - "version": "1.27.14", + "version": "1.27.15", "description": "🎉 Tools for everything World of Tanks Blitz", "type": "module", "types": "./types.d.ts", diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx index 0b2d8ca13..f6fa2c03e 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -21,6 +21,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { fakeDistance: fakeLog(range.distance / maxDistance, 2), })); const maxFakeDistance = ranges.at(-1)!.fakeDistance; + const maxFactor = ranges[0].factor; const { strings } = useLocale(); @@ -81,7 +82,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { return ( <Box width={`${fraction * 100}%`} - height={`${range.factor * 100}%`} + height={`${(range.factor / maxFactor) * 100}%`} style={{ background: `linear-gradient(45deg, ${color1}, ${color0})`, }} From af13e3f184a34368dd4abf31e906fda7827ee910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 7 Aug 2025 12:11:16 -0500 Subject: [PATCH 67/71] feat: squishy low --- .../components/Cursor/index.tsx | 8 ++++---- .../AssaultRangesVisualizer/index.tsx | 18 +++++++++++------- packages/website/src/core/blitzkit/fakeLog.ts | 12 ++++++++++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx index 7c67c5017..2e6f62f82 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx @@ -3,8 +3,8 @@ import { Box, Flex, Text } from '@radix-ui/themes'; import { useEffect, useRef, useState } from 'react'; import { clamp } from 'three/src/math/MathUtils.js'; import { - fakeLog, - fakeLogInverse, + fakeLogSquishyHigh, + fakeLogSquishyHighInverse, } from '../../../../../../../../../core/blitzkit/fakeLog'; import { Var } from '../../../../../../../../../core/radix/var'; import { Duel } from '../../../../../../../../../stores/duel'; @@ -19,7 +19,7 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { const assaultDistance = Duel.use( (state) => state.protagonist.assaultDistance, ); - const [x, setX] = useState(fakeLog(assaultDistance / maxDistance, 2)); + const [x, setX] = useState(fakeLogSquishyHigh(assaultDistance / maxDistance)); const cursor = useRef<HTMLDivElement>(null); const mutateDuel = Duel.useMutation(); @@ -56,7 +56,7 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { function handlePointerUp() { mutateDuel((draft) => { draft.protagonist.assaultDistance = - fakeLogInverse(localX * maxFakeDistance, 2) * maxDistance; + fakeLogSquishyHighInverse(localX * maxFakeDistance) * maxDistance; }); window.removeEventListener('pointermove', handlePointerMove); diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx index f6fa2c03e..cdd089725 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -2,7 +2,10 @@ import type { AssaultRanges } from '@blitzkit/core'; import { literals } from '@blitzkit/i18n'; import { Box, Card, Flex, Text } from '@radix-ui/themes'; import { clamp } from 'three/src/math/MathUtils.js'; -import { fakeLog } from '../../../../../../../core/blitzkit/fakeLog'; +import { + fakeLogSquishyHigh, + fakeLogSquishyLow, +} from '../../../../../../../core/blitzkit/fakeLog'; import type { TankCharacteristics } from '../../../../../../../core/blitzkit/tankCharacteristics'; import { Var } from '../../../../../../../core/radix/var'; import { useLocale } from '../../../../../../../hooks/useLocale'; @@ -18,7 +21,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { const ranges = _ranges.ranges.map((range) => ({ factor: range.factor, distance: range.distance, - fakeDistance: fakeLog(range.distance / maxDistance, 2), + fakeDistance: fakeLogSquishyHigh(range.distance / maxDistance), })); const maxFakeDistance = ranges.at(-1)!.fakeDistance; const maxFactor = ranges[0].factor; @@ -55,8 +58,8 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { style={{ position: 'absolute', left: 0, - top: `${(1 - range.factor) * 100}%`, - transform: 'translateY(-50%)', + bottom: `${fakeLogSquishyLow(range.factor / maxFactor) * 100}%`, + transform: 'translateY(50%)', }} color="gray" size="1" @@ -71,7 +74,8 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { <Flex flexGrow="1" align="end" position="relative"> {ranges.map((range, index) => { - const mix = clamp(1.5 * (range.factor - 1) + 1, 0, 1) * 100; + const mix = + clamp(2 * (range.factor / maxFactor - 1) + 1, 0, 1) * 100; const color0 = `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${mix}%)`; const color1 = `color-mix(in hsl, ${Var('tomato-7')}, ${Var('jade-7')} ${mix}%)`; const last = ranges[index - 1]; @@ -82,7 +86,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { return ( <Box width={`${fraction * 100}%`} - height={`${(range.factor / maxFactor) * 100}%`} + height={`${fakeLogSquishyLow(range.factor / maxFactor) * 100}%`} style={{ background: `linear-gradient(45deg, ${color1}, ${color0})`, }} @@ -96,7 +100,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { key={index} position="absolute" left="0" - bottom={`${range.factor * 100}%`} + bottom={`${fakeLogSquishyLow(range.factor / maxFactor) * 100}%`} width="100%" height="1pt" style={{ diff --git a/packages/website/src/core/blitzkit/fakeLog.ts b/packages/website/src/core/blitzkit/fakeLog.ts index 0cebd3fa3..1f40ef3e8 100644 --- a/packages/website/src/core/blitzkit/fakeLog.ts +++ b/packages/website/src/core/blitzkit/fakeLog.ts @@ -1,9 +1,17 @@ const GAMMA = 1.2; -export function fakeLog(x: number, a = 1) { +export function fakeLogSquishyHigh(x: number) { return Math.sin((Math.PI / 2) * x) ** (1 / GAMMA); } -export function fakeLogInverse(y: number, a = 1) { +export function fakeLogSquishyHighInverse(y: number) { return (2 / Math.PI) * Math.asin(y ** GAMMA); } + +export function fakeLogSquishyLow(x: number) { + return x ** 2; +} + +export function fakeLogSquishyLowInverse(y: number) { + return y ** (1 / 2); +} From 1e7acc2775a9b78dc1e698b05f68ab3849715f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 8 Aug 2025 08:50:10 -0500 Subject: [PATCH 68/71] New translations en.json (Ukrainian) (#161) --- packages/i18n/strings/uk.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/i18n/strings/uk.json b/packages/i18n/strings/uk.json index 7c927025a..3a7b9847e 100644 --- a/packages/i18n/strings/uk.json +++ b/packages/i18n/strings/uk.json @@ -531,16 +531,16 @@ } }, "rating_leaderboard": { - "name": "rating-leaderboard", - "description": "Rating battles statistics", + "name": "таблиця рейтингу", + "description": "Статистика рейтингових боїв", "subcommands": { "neighbors": { "name": "neighbors", "description": "Neighboring players on the leaderboard" }, "league": { - "name": "league", - "description": "Top players of a league" + "name": "ліга", + "description": "Найкращий гравець ліги" } }, "options": { @@ -549,8 +549,8 @@ "description": "" }, "season": { - "name": "season", - "description": "Season number (default: current)", + "name": "сезон", + "description": "Базова інформація про гравця", "choices": { "current": "%s1 (current)" } @@ -578,14 +578,14 @@ "description": "Коротка статистика за період" }, "owned_tanks": { - "name": "owned-tanks", - "description": "Shows all own tanks in a tier", + "name": "отримані танки", + "description": "Показує всі ваші танки даного рівня", "body": { "title": "# %s1's owned tier %s2 tanks\n\n" } }, "permissions": { - "name": "permissions", + "name": "дозволи", "description": "Checks wether the bot has the required permissions to function", "body": { "title": "# Permissions\n\n%s1", @@ -615,7 +615,7 @@ }, "player_info": { "name": "player-info", - "description": "Basic information about a player", + "description": "Базова інформація про гравця", "body": { "title": "%s1's information", "nickname": "Нік", @@ -635,7 +635,7 @@ "description": "Today's rating statistics" }, "season": { - "name": "season", + "name": "сезон", "description": "This season's rating statistics" } }, From 60025365c422af104ba87383b8b411ebd2c72452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Tue, 12 Aug 2025 09:15:20 -0500 Subject: [PATCH 69/71] Update robots.txt.ts --- packages/website/src/pages/robots.txt.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/src/pages/robots.txt.ts b/packages/website/src/pages/robots.txt.ts index 4580d71dc..e056aa4a8 100644 --- a/packages/website/src/pages/robots.txt.ts +++ b/packages/website/src/pages/robots.txt.ts @@ -1,6 +1,6 @@ import type { APIContext } from 'astro'; -const ALLOW_ROBOTS = import.meta.env.ALLOW_ROBOTS === 'true'; +const ALLOW_ROBOTS = import.meta.env.ALLOW_ROBOTS; export async function GET({ request }: APIContext) { const flags: Record<string, string | null> = { From 7bdaf9ca93d5886fce47a462ff3dd355619d28a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 14 Aug 2025 10:27:44 -0500 Subject: [PATCH 70/71] Update 1.27.14.md --- docs/changelogs/1.27.14.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelogs/1.27.14.md b/docs/changelogs/1.27.14.md index 4e2d3782d..fa56a08b7 100644 --- a/docs/changelogs/1.27.14.md +++ b/docs/changelogs/1.27.14.md @@ -1,6 +1,6 @@ # BlitzKit 1.27.14 -This is the 14th patch for `1.12`, making it the new longest lasting version beating the previous record of `1.15.13`! +This is the 14th patch for `1.27`, making it the new longest lasting version beating the previous record of `1.15.13`! ## Fixes From 54c7b6b4761e2cfcfffe9097ec3af3d8d747df22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 15 Aug 2025 12:38:14 -0500 Subject: [PATCH 71/71] feat: update closed --- submodules/blitzkit-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/blitzkit-closed b/submodules/blitzkit-closed index 89dc337d2..4fc49ba2c 160000 --- a/submodules/blitzkit-closed +++ b/submodules/blitzkit-closed @@ -1 +1 @@ -Subproject commit 89dc337d2713dd4aaa8319d01c544f9e08756127 +Subproject commit 4fc49ba2c58ac0df827441de095516a1ee94ffc6