Compare commits

...
102 Commits
Author SHA1 Message Date
TrèsAbhi 9a30af3818 fix: proper pitch limits 2025-12-20 10:26:25 -06:00
TrèsAbhi 23751fbdf3 feat: dynamic dispersion 2025-12-20 10:15:23 -06:00
TrèsAbhi db6d181f78 feat: use max stage 2025-12-20 09:59:26 -06:00
TrèsAbhi 56ca4dcc61 feat: more accents 2025-12-19 22:23:03 -06:00
TrèsAbhi d08b537721 feat: some styling 2025-12-19 21:25:55 -06:00
TrèsAbhi c1a2edb489 feat: baselayout 2025-12-19 17:55:26 -06:00
TrèsAbhi 164b7fa454 feat: api renderer 2025-12-19 17:50:59 -06:00
TrèsAbhi 428483cf4c fix: disable minifySyntax 2025-12-19 16:14:36 -06:00
TrèsAbhi 89f02eb399 minifySyntax 2025-12-19 16:11:26 -06:00
TrèsAbhi 4ce127516c minifyWhitespace 2025-12-19 16:09:27 -06:00
TrèsAbhi 6f4f487dfe minifyIdentifiers 2025-12-19 16:07:34 -06:00
TrèsAbhi 57dd60e804 feat: no minify 2025-12-19 16:01:58 -06:00
TrèsAbhi d24fd2250c feat: deploy on ue 2025-12-19 15:53:30 -06:00
TrèsAbhi e00bcdfc06 feat: latest node 2025-12-19 15:51:47 -06:00
TrèsAbhi 67dd204ee6 fix: typo 2025-12-19 15:48:07 -06:00
TrèsAbhi e130583fa4 fix: build:catalogitemaccesssor 2025-12-19 15:46:40 -06:00
TrèsAbhi 6ad20a0fcf feat: cron 2025-12-19 15:44:32 -06:00
TrèsAbhi 9fad644d7a feat: workflow 2025-12-19 15:42:38 -06:00
TrèsAbhi 8cb523dd06 fix: remove pwa 2025-12-19 15:35:50 -06:00
TrèsAbhi b50ee23a26 feat: re-install 2025-12-19 15:34:16 -06:00
TrèsAbhi a973cf699b fix: cleaner stage0 hack 2025-12-19 15:26:47 -06:00
TrèsAbhi 102abf49c4 fix: default isPump 2025-12-19 15:20:58 -06:00
TrèsAbhi 8929e503ea fix: pump times 2025-12-19 15:17:45 -06:00
TrèsAbhi a2a794eb74 fix: use order instead of group 2025-12-19 15:11:33 -06:00
TrèsAbhi 2e95f5dd95 fix: unit conversion 2025-12-19 15:09:46 -06:00
TrèsAbhi 23a42230cb feat: units 2025-12-19 15:04:35 -06:00
TrèsAbhi e66daed7ae feat: dpm 2025-12-19 14:51:18 -06:00
TrèsAbhi f2d0f68f07 feat: primary_armor 2025-12-19 14:34:17 -06:00
TrèsAbhi be4af0bf84 feat: implement some 2025-12-18 21:29:10 -06:00
TrèsAbhi 15172e8b33 fix: fetch correct stages 2025-12-18 17:00:06 -06:00
TrèsAbhi c6b7918525 feat: shells 2025-12-18 16:45:02 -06:00
TrèsAbhi 4f1c4421e5 feat: some more 2025-12-18 16:29:13 -06:00
TrèsAbhi 7b830f5a71 feat: start of more attrs 2025-12-18 16:12:01 -06:00
TrèsAbhi 6ce1135835 feat: rename a bit 2025-12-18 15:30:18 -06:00
TrèsAbhi 66eaaef6de feat: implement shell attr 2025-12-18 15:07:04 -06:00
TrèsAbhi 48fbf59036 feat: override common data 2025-12-18 13:20:35 -06:00
TrèsAbhi 0e0f4fbe9f fix: find att0 correctly 2025-12-18 13:16:20 -06:00
TrèsAbhi 6ba6e10108 feat: rename 2025-12-18 13:08:42 -06:00
TrèsAbhi cf8fa4ffb4 feat: remaining stagers 2025-12-18 12:59:12 -06:00
TrèsAbhi 2b0180dce2 Merge branch 'main' into ue 2025-12-18 12:45:10 -06:00
TrèsAbhi de8d3396b1 fix: use normalized dvpl path 2025-12-16 12:35:56 -06:00
TrèsAbhi caee848a47 Merge branch 'main' into ue 2025-12-15 22:29:11 -06:00
TrèsAbhi 4b5a511216 fix: use resolve 2025-12-15 22:26:37 -06:00
TrèsAbhi 57dacddcfd fix: use resolve 2025-12-15 22:26:14 -06:00
TrèsAbhi c27e903c31 New translations en.json (Chinese Simplified) (#187) 2025-12-15 22:24:06 -06:00
TrèsAbhi d01b7cf707 feat: shells 2025-12-14 22:00:45 -06:00
TrèsAbhi 8921f84c38 feat: verbose 2025-12-14 21:41:26 -06:00
TrèsAbhi 6830df01fa penetration_groups_upgrades 2025-12-14 21:38:18 -06:00
TrèsAbhi 476f180a1a New translations en.json (French) (#186) 2025-12-14 20:02:16 -06:00
TrèsAbhi 67da59ef41 feat: start of stages 2025-12-13 23:35:38 -06:00
TrèsAbhi 036cc9915d feat: start of atts 2025-12-13 23:10:51 -06:00
TrèsAbhi 57b6ba19f0 feat: rename 2025-12-13 22:15:48 -06:00
TrèsAbhi 32b5593d07 feat: lenient strings 2025-12-13 13:16:42 -06:00
TrèsAbhi 3b757562d2 Merge branch 'main' into ue 2025-12-10 22:52:49 -06:00
TrèsAbhi 1226ce89a7 fix: shallow testing 2025-12-10 17:46:58 -06:00
TrèsAbhi dcc8207fb6 fix: deconstructor 2025-12-10 17:31:03 -06:00
TrèsAbhi c50f40a887 fix: default 2025-12-10 17:15:35 -06:00
TrèsAbhi 85f7d420a0 feat: logs 2025-12-10 17:14:18 -06:00
TrèsAbhi 1aec1b2885 feat: add zip abilities 2025-12-10 17:13:12 -06:00
TrèsAbhi 51226c8503 Merge branch 'main' into dev 2025-12-10 16:54:49 -06:00
TrèsAbhi 4c8c2d0868 feat: auto pick localization entity 2025-12-05 21:35:58 -06:00
TrèsAbhi b2f266401f Merge branch 'main' into ue 2025-12-05 21:23:39 -06:00
TrèsAbhi 407d00b25b Update index.astro 2025-12-05 09:35:05 -06:00
TrèsAbhi fb4fb926e8 fix: add boxShadow to Giveaway component for improved styling 2025-12-04 14:22:24 -06:00
TrèsAbhi 70b0df55b0 fix: add drop-shadow filter to Giveaway component image for better visibility 2025-12-04 14:21:32 -06:00
TrèsAbhi 7e8fd40c61 fix: format minutes and seconds in Giveaway component for better readability 2025-12-04 14:20:23 -06:00
TrèsAbhi 9286104391 feat: enhance Giveaway component with skeleton loading state 2025-12-04 14:19:35 -06:00
TrèsAbhi 814192c0b0 feat: add Giveaway component for Music Box event with countdown timer 2025-12-04 14:17:53 -06:00
TrèsAbhi 8fa6f87540 fix: update disclaimer for Christmas Garage Guide 2025 2025-12-04 12:29:50 -06:00
TrèsAbhi d265f0b0a1 fix: clarify Christmas Tree ornament set requirements in Christmas Garage Guide 2025 2025-12-03 18:29:32 -06:00
TrèsAbhi 9ccaade1fc fix: clarify Christmas Tree upgrade mechanics in Christmas Garage Guide 2025 2025-12-03 18:28:56 -06:00
TrèsAbhi 2bb5bb33c0 fix: enhance clarity on Christmas Tree upgrade benefits in Christmas Garage Guide 2025 2025-12-03 18:28:03 -06:00
TrèsAbhi e456063c27 fix: clarify Music Box mechanics in Christmas Garage Guide 2025 2025-12-03 18:26:54 -06:00
TrèsAbhi 7bc25f0722 fix: clarify Music Box mechanics in Christmas Garage Guide 2025 2025-12-03 18:26:12 -06:00
TrèsAbhi 6ed991d281 fix: clarify Music Box mechanics in Christmas Garage Guide 2025 2025-12-03 18:25:02 -06:00
GonnaHetzMe 2487e0eebf Update GitHub Actions to latest versions (#185) 2025-12-03 18:22:53 -06:00
TrèsAbhi 6cc44cdfee feat: add ArticlePlug component for Christmas 2025 promotion 2025-12-03 18:12:41 -06:00
TrèsAbhi eca26e1e79 feat: enhance Christmas Garage Guide 2025 with detailed mechanics and rewards 2025-12-03 18:01:05 -06:00
TrèsAbhi 5484a15071 fix: standardize import quotes and set maxWidth for PageWrapper 2025-12-03 17:51:19 -06:00
TrèsAbhi b58ca4f594 feat: move guide to guides 2025-12-03 17:49:16 -06:00
TrèsAbhi 7708e2c1db feat: add Christmas Garage Guide 2025 and update settings 2025-12-03 17:48:29 -06:00
TrèsAbhi de77e27d50 fix: max 25 seasons 2025-12-01 17:13:26 -06:00
TrèsAbhi e159583333 fix: use repos direct 2025-12-01 17:02:54 -06:00
TrèsAbhi bfcf183a6e feat: hide warning 2025-12-01 17:01:19 -06:00
TrèsAbhi 5541eca23d feat: start of derived statistics 2025-12-01 16:51:11 -06:00
TrèsAbhi 122d65840e feat: aggregateAttributes 2025-12-01 13:09:55 -06:00
TrèsAbhi ed4b72d85c feat: upgrade stages 2025-11-30 22:26:13 -06:00
TrèsAbhi 4033e8618f feat: useAwait 2025-11-30 22:12:46 -06:00
TrèsAbhi 42cada1811 feat: move and api 2025-11-30 21:06:17 -06:00
TrèsAbhi ff7ed213c8 feat: complete 2025-11-30 21:01:53 -06:00
TrèsAbhi a0367af06b feat: start of stats 2025-11-30 20:54:36 -06:00
TrèsAbhi 58c2965c53 Merge branch 'main' into ue 2025-11-30 20:27:42 -06:00
TrèsAbhi 8c1bf450a8 fix: use map's ahs 2025-11-29 15:22:13 -06:00
TrèsAbhi 9ffc040723 feat: implement all methods 2025-11-29 15:16:09 -06:00
TrèsAbhi f33a73e1bb feat: zip reader 2025-11-29 14:34:06 -06:00
TrèsAbhi edae41409a feat: tank data 2025-11-29 14:22:32 -06:00
TrèsAbhi 383d3a36ef feat: load tank data 2025-11-28 14:21:26 -06:00
TrèsAbhi 6a958da390 feat: implement strings 2025-11-28 14:13:03 -06:00
TrèsAbhi ef154f99d5 feat: start of scraping 2025-11-28 13:51:17 -06:00
TrèsAbhi 4a20102de3 feat: base work 2025-11-28 13:19:15 -06:00
TrèsAbhi 4e170f2917 feat: port minimal files 2025-11-28 13:03:33 -06:00
TrèsAbhi a70d788f6b feat: init ue website 2025-11-28 13:00:41 -06:00
96 changed files with 2791 additions and 550 deletions

No files matched your search

+6 -5
View File
@@ -16,10 +16,11 @@ on:
- blitzkit/assets-dev
default: blitzkit/assets
archive_url:
asset_source:
type: string
required: false
description: Archive URL to download instead of Steam client
description: "Archive URL or Steam to download (example: steam:APP_ID/DEPOT_ID or zip:URL_TO_ZIP)"
default: "steam:444200/444202"
schedule:
- cron: "0 2 * * *"
@@ -64,18 +65,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- run: bun run setup
- name: AppArmor hack
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Build assets
run: bun run build:assets --all-targets --manual
run: bun run build:assets --all-targets --source=${{ github.event.inputs.asset_source || 'steam:444200/444202' }}
+2 -2
View File
@@ -32,11 +32,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
+3 -3
View File
@@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
@@ -28,7 +28,7 @@ jobs:
run: bun run build:bot
- name: Archive build
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: bot
path: dist/bot
+2 -2
View File
@@ -22,11 +22,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
+1 -1
View File
@@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
+2 -2
View File
@@ -32,11 +32,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
+2 -2
View File
@@ -32,11 +32,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
+2 -2
View File
@@ -32,11 +32,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
+2 -2
View File
@@ -24,11 +24,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
+66
View File
@@ -0,0 +1,66 @@
name: Website UE
on:
push:
workflow_dispatch:
schedule:
- cron: "0 4 * * *"
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref == 'refs/heads/main' }}
env:
WOTB_SERVER: ${{ secrets.WOTB_SERVER }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v6
with:
node-version: latest
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
- uses: actions/configure-pages@v5
- run: bun run setup
- name: Build website
run: bun run build:website
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: dist/website
deploy-github-pages:
if: ${{ github.ref == 'refs/heads/ue' }}
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build
environment:
name: Production
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+3 -3
View File
@@ -38,11 +38,11 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GH_TOKEN }}
@@ -53,7 +53,7 @@ jobs:
run: bun run build:website
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v4
with:
path: dist/website
+1 -1
View File
@@ -22,7 +22,7 @@ depots
public/sitemap*
/firebase.json
target
# packages/core/src/protos/*.ts
packages/website-ue/src/protos/*.ts
/.vercel
.astro
.vercel
+5 -2
View File
@@ -17,8 +17,6 @@
"astrojs",
"astrolib",
"atgm",
"Autoloader",
"Autoreloader",
"AYUV",
"battleresults",
"bbox",
@@ -61,10 +59,12 @@
"Ddpf",
"Ddsd",
"deadrail",
"DEBUFF",
"debugflags",
"deburr",
"decalmask",
"decompressor",
"décor",
"dedup",
"defence",
"degressive",
@@ -96,6 +96,7 @@
"gameplay",
"glsl",
"GLTF",
"GSOR",
"gtag",
"haha",
"Herdbreaker",
@@ -173,6 +174,7 @@
"ratingleaderboard",
"raycaster",
"Redirector",
"REGEN",
"Relogin",
"researchable",
"Resvg",
@@ -187,6 +189,7 @@
"searchtanks",
"SHAREDEXP",
"SKLLD",
"sluggify",
"smoothstep",
"Smri",
"Specularity",
+492 -332
View File
File diff suppressed because it is too large. Load diff
+5
View File
@@ -0,0 +1,5 @@
# BlitzKit 1.29.7
## Features
- Re-introduced the ability to deploy BlitzKit OpenTests
+57
View File
@@ -0,0 +1,57 @@
# Christmas Garage Guide 2025
This content was pre-recorded on a test server and the version you may see may not be the same. Please see [the official WoTB portal](https://wotblitz.com/) for the most up-to-date information.
The holiday season has arrived, and this year the celebrations spill directly into your garage, transforming the familiar space into a festive hub filled with activities, rewards, and seasonal flair. Instead of just offering decorations or a visual makeover, this event brings a full set of mechanics that turn everyday battles into a steady stream of progress. Whether you’re aiming for bonuses, collectibles, or new tanks, the garage is designed to make every match feel like part of a larger holiday journey.
![](https://i.imgur.com/HmbDw0x.jpeg)
## The Music Box
The familiar Snow Globes are absent this year, replaced entirely by **Music Boxes**, which act as the new way to try your luck for seasonal rewards. They behave similarly to the Snow Globes and give you a chance to obtain various items, including a shot at the brand-new **[GSOR the TANK](https://blitzkit.app/tanks/gsor-the-tank/)**. But this time around, **they do not guarantee a tank every single time.** But as a bonus, the Music Box guarantees you will not receive duplicate tanks. Once you have a tank, the Music Box will try its best to give you a different one each time.
![](https://i.imgur.com/sxYV77L.jpeg)
## Win Battles, Earn Rewards
Each victory during the event rewards you with **3 Hot Coffees**, a seasonal currency that serves as the backbone of the progression system. These coffees can be exchanged for a variety of Festive Town rewards, giving you reasons to keep pushing through battles even if you’re just casually playing.
![](https://i.imgur.com/MXGxejz.jpeg)
With the coffees, you’ll also be able to claim **2 tank certificates**, one for **tier VII** vehicles and another covering **tier IX–X** options.
The tier VII pool includes the [E 25](https://blitzkit.app/tanks/e-25), [CS-52 LIS](https://blitzkit.app/tanks/cs-52-lis), [AMX 13 57](https://blitzkit.app/tanks/amx-13-57), [Steyr WT](https://blitzkit.app/tanks/steyr-wt), [Kunze Panzer](https://blitzkit.app/tanks/kunze-panzer), and [Super Hellcat](https://blitzkit.app/tanks/super-hellcat). Meanwhile, the tier IX–X certificate gives access to higher-tier picks like the [121B](https://blitzkit.app/tanks/121b), [AMX 30 B](https://blitzkit.app/tanks/amx-30-b), [Obj. 260](https://blitzkit.app/tanks/obj-260), [Char Futur 4](https://blitzkit.app/tanks/char-futur-4), [TL-7-120](https://blitzkit.app/tanks/tl-7-120), and [Object 452K](https://blitzkit.app/tanks/object-452k).
![](https://i.imgur.com/lxr7PE9.png)
## Upgrade Your Christmas Tree
Golden tokens allow you to upgrade your Christmas Tree through **four distinct stages**, each bringing your garage closer to its fully decorated holiday form.
![](https://i.imgur.com/bcmQE8T.jpeg)
As the tree grows, additional ornament slots open up, eight in total, which appear on the left side of your screen. These slots give you more room to customize the look of your garage and make the tree feel like something you’ve built up piece by piece over the course of the event. Each new ornament adds to the atmosphere, making the progression feel both cosmetic and rewarding.
A fully decorated tree grants up to **+25% silver** per battle, turning your regular gameplay into a more profitable experience without requiring extra effort. Ensure all your ornaments come from the same set to unlock the full potential of the tree (all left, all middle, or all right).
![](https://i.imgur.com/MMbyYLn.jpeg)
## Upgrade Your Yuletide Stall
Your golden tokens can also be invested into upgrading the **Yuletide Stall**, another element of the garage that evolves as you level it up. Each upgrade unlocks new rewards, giving you incentives to distribute your tokens across different attractions instead of focusing on only one. The stall begins in a simple state, but after upgrades it transforms visually and functionally, becoming a more vibrant part of your garage.
![](https://i.imgur.com/AONZN5O.jpeg)
Each upgrade unlocks a tier worth of rewards that you can claim in exchange for Free XP, Gold, Silver, and more Hot Coffees!
![](https://i.imgur.com/8fNy0Yj.png)
## Upgrade Your Shooting Gallery
Another upgradeable area is the **Shooting Gallery**, which contributes its own set of rewards as it levels up. Enhancing the gallery expands your options for exchanging mastery badges, making those badges more useful during the event than they usually are.
![](https://i.imgur.com/Rj1WNCE.jpeg)
![](https://i.imgur.com/GAUd2uR.png)
Consider yourselves debriefed. Happy holidays!
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+7 -7
View File
@@ -1,13 +1,13 @@
{
"name": "blitzkit",
"version": "1.29.6",
"version": "2.0.0-beta.2",
"license": "BlitzKit License",
"private": true,
"scripts": {
"build:assets": "cd packages/scripts && bun run build:assets",
"build:averages": "bun --filter=@blitzkit/scripts run build:averages",
"build:bot": "cd packages/scripts && bun run build:bot",
"build:website": "cd packages/website && bun run build",
"build:website": "cd packages/website-ue && bun run build",
"build:prisma": "prisma generate",
"build:proxyclient": "cd packages/scripts && bun run build:proxyclient",
"build:catalogitemaccesssor": "cd packages/scripts && bun run build:catalogitemaccesssor",
@@ -16,26 +16,26 @@
"dev:bot": "bun run build:bot --dev && bun start:bot",
"start:bot": "bun dist/bot/main.js",
"dev:docs": "vitepress dev docs",
"dev:website": "cd packages/website && bun run dev",
"dev:website": "cd packages/website-ue && bun run dev",
"dev:app": "cd packages/app && 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",
"start:website": "bun --filter=@blitzkit/website run start",
"start:website": "bun --filter=@blitzkit/website-ue run start",
"host:docs": "vitepress preview docs",
"lint": "tsc",
"lint:website": "cd packages/website && bun run lint",
"lint:website": "cd packages/website-ue && bun run lint",
"format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"",
"update": "yarn upgrade --latest",
"tunnel": "cloudflared tunnel --url http://localhost:3000",
"discoverids": "scripts/discoverIds.ts",
"build:protos": "cd packages/scripts && bun run build:protos",
"preview:website": "cd packages/website && bun run preview",
"preview:website": "cd packages/website-ue && bun run preview",
"build:reviews": "cd packages/scripts && bun build:reviews",
"build:ids": "cd packages/scripts && bun build:ids",
"prunestrings": "cd packages/scripts && bun prunestrings",
"setup": "bun install && bun run build:prisma && bun run build:protos && bun run build:proxyclient",
"setup": "bun install && bun run build:prisma && bun run build:protos && bun run build:proxyclient && bun run build:catalogitemaccesssor",
"patchnotes": "cd packages/scripts && bun run patchnotes"
},
"type": "module",
@@ -52,7 +52,7 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
const seasonNumbers = range(
FIRST_MINIMAL_ARCHIVED_RATING_SEASON,
latestArchivedSeasonNumber + (onGoingSeason ? 1 : 0) + 1
);
).slice(-25);
function addOptions(option: SlashCommandSubcommandBuilder) {
const { strings } = translator(Locale.EnglishUS);
@@ -196,7 +196,7 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
strings.common.leagues as Record<string, string>
)[name]
),
}) satisfies APIApplicationCommandOptionChoice<string>
} satisfies APIApplicationCommandOptionChoice<string>)
)
)
.setRequired(true);
@@ -219,8 +219,8 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
const season = seasonOption
? parseInt(seasonOption)
: onGoingSeason
? latestArchivedSeasonNumber + 1
: latestArchivedSeasonNumber;
? latestArchivedSeasonNumber + 1
: latestArchivedSeasonNumber;
const isCurrentSeason = season === latestArchivedSeasonNumber + 1;
let titleName: string;
let titleImage: string | undefined;
@@ -258,7 +258,7 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
position: player.number,
clan: player.clan_tag,
nickname: player.nickname,
}) satisfies SimplifiedPlayer
} satisfies SimplifiedPlayer)
)
)
: await getArchivedRatingLeaderboard(region, season!).then(
@@ -295,7 +295,7 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
.deleted_player,
{ id: player.id }
),
}) satisfies SimplifiedPlayer
} satisfies SimplifiedPlayer)
);
}
);
@@ -349,7 +349,7 @@ export const ratingLeaderboardCommand = new Promise<CommandRegistry>(
score: player.score,
clan: player.clan_tag,
nickname: player.nickname,
}) satisfies SimplifiedPlayer
} satisfies SimplifiedPlayer)
)
)
: await getArchivedRatingLeaderboard(region, season!).then(
@@ -19,9 +19,9 @@ export function localizationObject(
(!strict || validNameRegex.test(translation)) && translation.length > 0;
if (!isValid) {
console.warn(
`Invalid localization for ${locale} (${path}): ${translation}; skipping...`
);
// console.warn(
// `Invalid localization for ${locale} (${path}): ${translation}; skipping...`
// );
return localizations;
}
-25
View File
@@ -1,25 +0,0 @@
export enum BlitzVFSSourceType {
Steam,
}
type BlitzVFSSource = {
type: BlitzVFSSourceType;
username: string;
password: string;
app: number;
os: "windows";
};
export class BlitzVFS {
constructor(private source: BlitzVFSSource) {}
async init() {
return this;
}
async file(path: string) {
return new Uint8Array();
}
}
@@ -17,7 +17,7 @@ export async function getArchivedLatestSeasonNumber() {
if (ratingInfo.detail) {
const regionsURL = (
(await fetch(
`https://api.github.com/repos/tresabhi/${assertSecret(
`https://api.github.com/repos/${assertSecret(
import.meta.env.PUBLIC_ASSET_REPO
)}/git/trees/main`
).then((response) => response.json())) as GitHubTrees
+42 -41
View File
@@ -1,49 +1,50 @@
export * from './assertSecret';
export * from './asset';
export * from './availableProvisions';
export * from './averageDefinitions';
export * from "./assertSecret";
export * from "./asset";
export * from "./availableProvisions";
export * from "./averageDefinitions";
// export * from './camouflageDefinitions';
// export * from './checkConsumableProvisionInclusivity';
export * from './coefficient';
export * from './consumableDefinitions';
export * from "./coefficient";
export * from "./consumableDefinitions";
// export * from './context';
export * from './createDefaultSkills';
export * from './degressiveStat';
export * from './discoveredIdDefinitions';
export * from './emblemURL';
export * from './equipmentDefinitions';
export * from './eventManager';
export * from './gameDefinitions';
export * from './getArchivedLatestSeasonNumber';
export * from "./createDefaultSkills";
export * from "./degressiveStat";
export * from "./discoveredIdDefinitions";
export * from "./emblemURL";
export * from "./equipmentDefinitions";
export * from "./eventManager";
export * from "./gameDefinitions";
export * from "./getArchivedLatestSeasonNumber";
// export * from './getArchivedRatingInfo';
export * from './getArchivedRatingLeaderboard';
export * from "./getArchivedRatingLeaderboard";
// export * from './getArchivedRatingMidnightLeaderboard';
export * from './getTimeDaysAgo';
export * from './isExplosive';
export * from './mapDefinitions';
export * from './modelDefinitions';
export * from './normalizeBoundingBox';
export * from "./getTimeDaysAgo";
export * from "./isExplosive";
export * from "./mapDefinitions";
export * from "./modelDefinitions";
export * from "./normalizeBoundingBox";
// export * from './parseBkni';
// export * from './patientFetch';
export * from './patientFetchJSON';
export * from './progressiveStat';
export * from './provisionDefinitions';
export * from './resolveDpm';
export * from './resolvePenetrationCoefficient';
export * from './reviews';
export * from './skillDefinitions';
export * from './sum';
export * from './tankDefinitions';
export * from './tankIcon';
export * from './tankNames';
export * from './unionBoundingBox';
export * from './uniqueGuns';
export * from './unwrapBlitzkitResponse';
export * from './votes';
export * from "./patientFetchJSON";
export * from "./progressiveStat";
export * from "./provisionDefinitions";
export * from "./resolveDpm";
export * from "./resolvePenetrationCoefficient";
export * from "./reviews";
export * from "./skillDefinitions";
export * from "./sum";
export * from "./tankDefinitions";
export * from "./tankIcon";
export * from "./tankNames";
export * from "./unionBoundingBox";
export * from "./uniqueGuns";
export * from "./unwrapBlitzkitResponse";
export * from "./votes";
// export * from './withCORSProxy';
export * from './createDefaultProvisions';
export * from './gallery';
export * from './metaSortTank';
export * from './popularTanks';
export * from './romanize';
export * from './youtubers';
export * from "./createDefaultProvisions";
export * from "./gallery";
export * from "./metaSortTank";
export * from "./popularTanks";
export * from "./romanize";
export * from "./sluggify.ts";
export * from "./youtubers";
+16
View File
@@ -0,0 +1,16 @@
import { deburr } from "lodash-es";
const nonAlphanumericRegex = /[^a-z0-9]/g;
const multipleDashesRegex = /--+/g;
const trailingDashRegex = /-$/g;
const leadingDashRegex = /^-/g;
export function sluggify(value: string) {
let slug = deburr(value).toLowerCase();
slug = slug.replaceAll(nonAlphanumericRegex, "-");
slug = slug.replaceAll(multipleDashesRegex, "-");
slug = slug.replaceAll(trailingDashRegex, "");
slug = slug.replaceAll(leadingDashRegex, "");
return slug;
}
+1 -1
View File
@@ -612,7 +612,7 @@
}
},
"rating": {
"name": "rating",
"name": "côtée",
"description": "Rating player's statistics",
"subcommands": {
"today": {
+1 -1
View File
@@ -804,7 +804,7 @@
},
"guess": {
"name": "猜测",
"button": "What could it be?",
"button": "这会是什么?",
"description": "坦克剪影小游戏",
"seo_description": "看剪影猜坦克",
"search": {
+1
View File
@@ -31,6 +31,7 @@
"steam-user": "^5.2.3",
"three": "^0.180.0",
"ts-proto": "^2.7.7",
"unzipit": "^1.4.3",
"yaml": "^2.8.1"
},
"private": true,
@@ -5,10 +5,12 @@ import { vfs } from "./constants";
export async function boosterIcons() {
console.log("Building booster icons...");
using uploader = new AssetUploader("booster icons");
const boosterFiles = (vfs.dir(`Data/Gfx/Shared/boosters`)).filter(
(file) => !file.includes("@2x.txt") && !file.startsWith("texture0")
);
const uploader = new AssetUploader("booster icons");
const boosterFiles = vfs
.dir("Data/Gfx/Shared/boosters")
.filter(
(file) => !file.includes("@2x.txt") && !file.startsWith("texture0")
);
const image = sharp(
await vfs.file(`Data/Gfx/Shared/boosters/texture0.packed.webp`)
);
+30 -9
View File
@@ -1,12 +1,33 @@
import { assertSecret } from "@blitzkit/core";
import { SteamVFS } from "../core/steam/vfs";
import { AbstractVFS } from "../core/vfs/abstract";
import { SteamVFS } from "../core/vfs/steam";
import { ZipVFS } from "../core/vfs/zip";
const APP = 444200;
const DEPOT = 444202;
const steamPattern = /steam:(\d+)\/(\d+)/;
const zipPattern = /zip:(.+)/;
export const vfs = await new SteamVFS(
assertSecret(import.meta.env.STEAM_USERNAME),
assertSecret(import.meta.env.STEAM_PASSWORD),
APP,
DEPOT
).init();
const source = Bun.argv
.find((arg) => arg.startsWith("--source="))
?.split("=")[1];
let resolved: AbstractVFS;
if (!source) {
throw new Error("No source specified");
} else if (steamPattern.test(source)) {
const [, app, depot] = source.match(steamPattern)!.map(Number);
resolved = await new SteamVFS(
assertSecret(import.meta.env.STEAM_USERNAME),
assertSecret(import.meta.env.STEAM_PASSWORD),
app,
depot
).init();
} else if (zipPattern.test(source)) {
const [, url] = source.match(zipPattern)!;
resolved = await new ZipVFS(url).init();
} else {
throw new Error("No valid source specified");
}
export const vfs = resolved;
@@ -62,7 +62,7 @@ export async function consumableProvisionIcons() {
.replace(".psd", "")
.replace(".txt", "");
if (vfs.has(`Data/${configPath}.packed.webp`)) {
if (vfs.resolve(`Data/${configPath}.packed.webp`)) {
const image = sharp(
await vfs.file(`Data/${configPath}.packed.webp`)
);
@@ -131,7 +131,7 @@ export async function consumableProvisionIcons() {
.replace(".psd", "")
.replace(".txt", "");
if (vfs.has(`Data/${configPath}.packed.webp`)) {
if (vfs.resolve(`Data/${configPath}.packed.webp`)) {
const image = sharp(
await vfs.file(`Data/${configPath}.packed.webp`)
);
@@ -534,11 +534,11 @@ const blitzModuleTypeToBlitzkit: Record<keyof BlitzModuleType, ModuleType> = {
export async function definitions() {
console.log("Building definitions...");
using uploader = new AssetUploader("definitions");
const uploader = new AssetUploader("definitions");
const gameDefinitions: GameDefinitions = {
version: (await vfs.text('Data/version.txt')).split(" ")[0],
version: (await vfs.text("Data/version.txt")).split(" ")[0],
nations: (
await vfs.yaml<AvailableNationsYaml>('Data/available_nations.yaml')
await vfs.yaml<AvailableNationsYaml>("Data/available_nations.yaml")
).available_nations,
gameModes: {},
roles: {},
@@ -561,10 +561,12 @@ export async function definitions() {
[TankClass.TANK_DESTROYER]: { skills: [] },
},
};
const nations = vfs.dir('Data/XML/item_defs/vehicles').filter((nation) => nation !== "common")
const nations = vfs
.dir("Data/XML/item_defs/vehicles")
.filter((nation) => nation !== "common");
const tankStringIdMap: Record<string, number> = {};
const optionalDevices = await vfs.xml<{ root: OptionalDevices }>(
'Data/XML/item_defs/vehicles/common/optional_devices.xml'
"Data/XML/item_defs/vehicles/common/optional_devices.xml"
);
const stringsI18n: Record<string, Record<string, string>> = {};
@@ -617,9 +619,7 @@ export async function definitions() {
const provisions: ProvisionsCommon = {};
for (const match of (
await vfs.text(
`Data/XML/item_defs/vehicles/common/consumables/list.xml`
)
await vfs.text(`Data/XML/item_defs/vehicles/common/consumables/list.xml`)
).matchAll(/<items path="(.+)\.xml"\/>/g)) {
if (match[1] === "prototypes") continue;
@@ -634,9 +634,7 @@ export async function definitions() {
}
for (const match of (
await vfs.text(
`Data/XML/item_defs/vehicles/common/provisions/list.xml`
)
await vfs.text(`Data/XML/item_defs/vehicles/common/provisions/list.xml`)
).matchAll(/<items path="(.+)\.xml"\/>/g)) {
if (match[1] === "prototypes") continue;
@@ -28,7 +28,7 @@ export async function skillIcons() {
const avatar = await vfs.xml<{ root: Avatar }>(
`Data/XML/item_defs/tankmen/avatar.xml`
);
using uploader = new AssetUploader("skill icons");
const uploader = new AssetUploader("skill icons");
for (const key in avatar.root.skills) {
const skill = avatar.root.skills[key];
+5 -2
View File
@@ -2,12 +2,15 @@ import { build } from "esbuild";
import { cp, readdir, rm } from "fs/promises";
import { argv } from "process";
const dev = argv.includes("--dev");
const projectDir = "../..";
const srcRoot = `${projectDir}/packages/bot`;
const distRoot = `${projectDir}/dist/bot`;
const modulesRoot = "../../node_modules";
const modulesRoot = dev
? "../../packages/bot/node_modules"
: "../../node_modules";
const workers = await readdir(`${srcRoot}/src/workers`);
const dev = argv.includes("--dev");
await rm(distRoot, { recursive: true, force: true });
@@ -6,7 +6,7 @@ import {
} from "@blitzkit/core";
import { Accessor, Document, Node, Scene } from "@gltf-transform/core";
import { times } from "lodash-es";
import { SteamVFS } from "../steam/vfs";
import { SteamVFS } from "../vfs/vfs";
import {
vertexAttributeGLTFName,
vertexAttributeGltfVectorSizes,
@@ -9,7 +9,7 @@ import { Document, Material, Node, Scene } from "@gltf-transform/core";
import { dedup, prune } from "@gltf-transform/functions";
import { times } from "lodash-es";
import { dirname } from "path";
import { SteamVFS } from "../../steam/vfs";
import { SteamVFS } from "../../vfs/vfs";
import { readBaseColor } from "../readBaseColor";
import { readNormal } from "../readNormal";
import { readRoughnessMetallic } from "../readRoughnessMetallic";
@@ -3,7 +3,7 @@ import { vfs } from "../../../buildAssets/constants";
export async function readTexture(path: string) {
const ddsTexturePath = path.replace(".tex", ".dx11.dds");
const isDds = vfs.has(ddsTexturePath);
const isDds = vfs.resolve(ddsTexturePath);
const resolvedTexturePath = isDds
? ddsTexturePath
: ddsTexturePath.replace(".dds", ".pvr");
+84
View File
@@ -0,0 +1,84 @@
import { readDVPL } from "@blitzkit/core";
import { XMLParser } from "fast-xml-parser";
import { normalize } from "path/posix";
import { parse } from "yaml";
export abstract class AbstractVFS {
textDecoder = new TextDecoder();
private xmlParser = new XMLParser();
abstract init(): Promise<typeof this>;
abstract dispose(): void;
abstract has(path: string): boolean;
abstract raw(path: string): Promise<Uint8Array>;
abstract paths(): string[];
resolve(path: string) {
const normalized = normalize(path);
if (this.has(normalized)) return normalized;
const dvplPath = `${normalized}.dvpl`;
if (this.has(dvplPath)) return dvplPath;
return null;
}
assert(path: string) {
const resolved = this.resolve(path);
if (resolved === null) throw new Error(`File not found: ${path}`);
return resolved;
}
async file(file: string) {
const resolved = this.assert(file);
const raw = await this.raw(resolved);
let buffer = raw;
if (resolved.endsWith(".dvpl")) {
buffer = new Uint8Array(readDVPL(Buffer.from(raw)));
}
return buffer;
}
dir(path: string) {
const parentSegments = path.split("/").length;
const children = new Set<string>();
for (const child of this.paths()) {
if (!child.startsWith(path) || child === path) continue;
const childSegments = child.split("/");
const nextSegment = childSegments[parentSegments];
children.add(nextSegment);
}
return Array.from(children);
}
async text(path: string) {
const file = await this.file(path);
return this.textDecoder.decode(file);
}
async yaml<Type>(path: string) {
const file = await this.text(path);
return parse(file) as Type;
}
async xml<Type>(path: string) {
const file = await this.text(path);
return this.xmlParser.parse(file) as Type;
}
[Symbol.dispose]() {
this.dispose();
}
}
@@ -1,8 +1,5 @@
import { readDVPL } from "@blitzkit/core/src/blitz";
import { XMLParser } from "fast-xml-parser";
import { normalize } from "path/posix";
import SteamUser, { EConnectionProtocol } from "steam-user";
import { parse } from "yaml";
import { AbstractVFS } from "./abstract";
interface SteamManifestFile {
chunks: {
@@ -33,11 +30,8 @@ interface SteamManifest {
crc_clear: number;
}
export class SteamVFS {
export class SteamVFS extends AbstractVFS {
private steam = new SteamUser({ protocol: EConnectionProtocol.TCP });
private textDecoder = new TextDecoder();
private xmlParser = new XMLParser();
private manifest: Map<string, SteamManifestFile> = new Map();
constructor(
@@ -45,7 +39,9 @@ export class SteamVFS {
private password: string,
private app: number,
private depot: number
) {}
) {
super();
}
async init() {
this.steam.logOn({
@@ -71,10 +67,8 @@ export class SteamVFS {
);
});
const paths: string[] = [];
for (const file of manifest.files) {
const path = file.filename.replaceAll("\\", "/");
paths.push(path);
this.manifest.set(path, file);
}
@@ -82,74 +76,23 @@ export class SteamVFS {
}
has(path: string) {
const normalized = normalize(path);
const dvplPath = `${normalized}.dvpl`;
return (
(this.manifest.has(dvplPath) && dvplPath) ||
(this.manifest.has(normalized) && normalized)
);
return this.manifest.has(path);
}
assert(requested: string) {
const path = this.has(requested);
if (!path) throw new Error(`File not found: ${requested}`);
return path;
}
dir(path: string) {
const parentSegments = path.split("/").length;
const children: string[] = [];
for (const child of this.manifest.keys()) {
const childSegments = child.split("/");
if (
child.startsWith(path) &&
parentSegments + 1 === childSegments.length
) {
children.push(childSegments.at(-1)!);
}
}
return children;
}
async file(requested: string) {
const path = this.assert(requested);
async raw(path: string) {
const fileManifest = this.manifest.get(path)!;
const downloaded: { type: "complete"; file: Buffer } =
// @ts-expect-error
await this.steam.downloadFile(this.app, this.depot, fileManifest);
let buffer = downloaded.file;
if (path.endsWith(".dvpl")) buffer = readDVPL(downloaded.file);
return new Uint8Array(buffer);
return new Uint8Array(downloaded.file);
}
async text(path: string) {
const file = await this.file(path);
return this.textDecoder.decode(file);
}
async yaml<Type>(path: string) {
const file = await this.text(path);
return parse(file) as Type;
}
async xml<Type>(path: string) {
const file = await this.text(path);
return this.xmlParser.parse(file) as Type;
paths() {
return Array.from(this.manifest.keys());
}
dispose() {
this.steam.logOff();
}
[Symbol.dispose]() {
this.dispose();
}
}
+38
View File
@@ -0,0 +1,38 @@
import { normalize } from "path/posix";
import { HTTPRangeReader, unzip, ZipEntry } from "unzipit";
import { AbstractVFS } from "./abstract";
export class ZipVFS extends AbstractVFS {
entries = new Map<string, ZipEntry>();
constructor(private url: string, private root = "app/") {
super();
}
async init() {
const reader = new HTTPRangeReader(this.url);
const { entries } = await unzip(reader);
for (const entry of Object.values(entries)) {
const normalized = normalize(entry.name.slice(this.root.length));
this.entries.set(normalized, entry);
}
return this;
}
has(path: string) {
return this.entries.has(path);
}
async raw(path: string) {
const arrayBuffer = await this.entries.get(path)!.arrayBuffer();
return new Uint8Array(arrayBuffer);
}
paths() {
return Array.from(this.entries.keys());
}
dispose() {}
}
+2 -1
View File
@@ -12,6 +12,7 @@ const TS_PROTO_EXECUTABLE_LOCATIONS = [
const roots = [
// "../../packages/core/src/protos",
"../../packages/closed/protos",
"../../packages/website-ue/src/protos",
];
const exec = promisify(execSync);
@@ -66,7 +67,7 @@ for (const root of roots) {
if (command.length + newLine.length < MAX_COMMAND_LENGTH) {
command += newLine;
files.pop();
console.log(` ${files.pop()}`);
} else {
break;
}
+106
View File
@@ -0,0 +1,106 @@
import node from "@astrojs/node";
import react from "@astrojs/react";
import { wrapper } from "@blitzkit/i18n";
import locales from "@blitzkit/i18n/locales.json";
import strings from "@blitzkit/i18n/strings/en.json";
import { mauve, mauveDark } from "@radix-ui/colors";
import favicons from "astro-favicons";
import { defineConfig } from "astro/config";
import packageJSON from "../../package.json";
import { tools } from "./src/core/tools/tools";
const POSSIBLE_TARGETS = ["app", "web"];
const target = process.env.PUBLIC_TARGET;
if (!target || !POSSIBLE_TARGETS.includes(target)) {
throw new Error("Invalid target");
}
export default defineConfig({
devToolbar: { enabled: false },
vite: {
server: { allowedHosts: [] },
esbuild: {
minifyIdentifiers: true,
minifySyntax: false,
minifyWhitespace: true,
},
},
output: target === "web" ? "static" : "server",
site: "https://blitzkit.app",
outDir: "../../dist/website",
prefetch: { defaultStrategy: "hover", prefetchAll: true },
// build: { concurrency: 4 },
adapter: target === "app" ? node({ mode: "standalone" }) : undefined,
integrations: [
favicons({
name: strings.common.name,
short_name: strings.common.name,
background: mauveDark.mauve1,
themes: [mauve.mauve1, mauveDark.mauve1],
appleStatusBarStyle: "black-translucent",
version: packageJSON.version,
shortcuts: Object.values(tools)
.filter((tool) => !tool.disabled && !tool.href)
.map((tool) => {
const stringId = (tool.strings ??
tool.id) as keyof typeof strings.website.tools;
return {
name: strings.website.tools[stringId].name,
name_localized: wrapper(
(strings) => strings.website.tools[stringId].name
),
description: strings.website.tools[stringId].description,
description_localized: wrapper(
(strings) => strings.website.tools[stringId].description
),
short_name: strings.website.tools[stringId].name,
short_name_localized: wrapper(
(strings) => strings.website.tools[stringId].name
),
url: `/${tool.id}`,
icon: `public/assets/tools/${tool.id}.webp`,
};
}),
manifest: {
description: strings.website.home.seo_description,
description_localized: wrapper(
(strings) => strings.website.home.seo_description
),
dir: "ltr",
categories: ["utilities", "games", "developer", "developer tools"],
id: "com.tresabhi.blitzkit",
start_url: "/",
launch_handler: { client_mode: "navigate-new" },
display: "fullscreen",
display_override: ["fullscreen", "standalone", "minimal-ui"],
lang: locales.default,
orientation: "any",
},
icons: {
windows: true,
android: true,
appleIcon: true,
appleStartup: true,
favicons: true,
yandex: true,
},
}),
react(),
],
});
+45
View File
@@ -0,0 +1,45 @@
{
"name": "@blitzkit/website-ue",
"type": "module",
"scripts": {
"dev": "PUBLIC_TARGET=web astro dev",
"build": "PUBLIC_TARGET=web astro build",
"preview": "PUBLIC_TARGET=web astro preview",
"lint": "PUBLIC_TARGET=web astro check",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/node": "^9.4.4",
"@astrojs/react": "^4.4.0",
"@astrolib/seo": "^1.0.0-beta.8",
"@blitzkit/closed": "workspace:*",
"@blitzkit/core": "workspace:*",
"@blitzkit/i18n": "workspace:*",
"@fontsource-variable/inter": "^5.2.8",
"@radix-ui/colors": "^3.0.0",
"@radix-ui/react-icons": "^1.3.2",
"@react-three/drei": "^10.7.6",
"@react-three/fiber": "^9.4.0",
"@types/lodash-es": "^4.17.12",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"@types/three": "^0.180.0",
"@vite-pwa/astro": "^1.1.0",
"astro": "^5.14.4",
"astro-favicons": "^3.1.5",
"fuzzysort": "^3.1.0",
"immer": "^10.1.3",
"lodash-es": "^4.17.21",
"quicklime": "^1.2.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-promise-suspense": "^0.3.4",
"three": "^0.180.0",
"three-stdlib": "^2.36.0",
"typescript": "^5.9.3",
"varuna": "workspace:*",
"vite": "^7.1.9",
"yaml": "^2.8.1"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

+46
View File
@@ -0,0 +1,46 @@
<svg width="426" height="426" viewBox="0 0 426 426" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M416.628 244.997L235.625 372.974C223.13 381.809 202.87 381.809 190.375 372.974L9.37173 244.997C3.1239 240.58 -3.95076e-06 234.79 0 229V196.6H426V229C426 234.79 422.876 240.58 416.628 244.997Z" fill="#0D2847"/>
<path d="M416.628 180.603L235.625 52.6262C223.13 43.7913 202.87 43.7913 190.375 52.6262L9.37172 180.603C-3.12391 189.438 -3.12391 203.762 9.37173 212.597L190.375 340.574C202.87 349.409 223.13 349.409 235.625 340.574L416.628 212.597C429.124 203.762 429.124 189.438 416.628 180.603Z" fill="#D9D9D9"/>
<path d="M416.628 180.603L235.625 52.6262C223.13 43.7913 202.87 43.7913 190.375 52.6262L9.37172 180.603C-3.12391 189.438 -3.12391 203.762 9.37173 212.597L190.375 340.574C202.87 349.409 223.13 349.409 235.625 340.574L416.628 212.597C429.124 203.762 429.124 189.438 416.628 180.603Z" fill="url(#paint0_linear_764_240)"/>
<path d="M416.628 180.603L235.625 52.6262C223.13 43.7913 202.87 43.7913 190.375 52.6262L9.37172 180.603C-3.12391 189.438 -3.12391 203.762 9.37173 212.597L190.375 340.574C202.87 349.409 223.13 349.409 235.625 340.574L416.628 212.597C429.124 203.762 429.124 189.438 416.628 180.603Z" fill="url(#paint1_linear_764_240)"/>
<g filter="url(#filter0_d_764_240)">
<path d="M197.056 150.108L201.368 153.051L290.596 213.945L306.6 202.599L310.832 199.599L289.153 184.23L288.86 177.31L335.236 182.298L351.706 170.622L359.102 165.378L288.049 158.111L286.355 118L263.968 133.871L265.867 167.722L217.292 135.762L197.056 150.108Z" fill="#111927" fill-opacity="0.5" shape-rendering="crispEdges"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M192.905 289L74.2242 204.714L70 201.714L116.393 168.767C129.906 159.17 143.124 153.539 156.048 151.875C168.971 150.211 180.919 153.275 191.893 161.069C198.702 165.905 202.718 171.006 203.941 176.372C205.165 181.658 204.302 186.506 201.354 190.918L201.692 191.158C208.978 188.301 216.935 187.286 225.563 188.113C234.247 188.9 242.613 192.151 250.66 197.866C261.803 205.779 266.398 214.825 264.446 225.004C262.551 235.142 254.96 244.929 241.672 254.366L192.905 289ZM221.999 242.08L200.456 257.38L163.905 231.422L185.448 216.123C192.007 211.465 198.473 209.23 204.846 209.42C211.22 209.529 217.193 211.562 222.764 215.519C228.392 219.516 231.31 223.797 231.521 228.364C231.732 232.85 228.558 237.422 221.999 242.08ZM165.937 205.64L146.77 219.252L114.693 196.472L133.861 182.859C140.363 178.241 146.435 175.887 152.076 175.798C157.717 175.708 163.07 177.462 168.135 181.059C173.256 184.696 175.809 188.557 175.796 192.643C175.726 196.69 172.44 201.022 165.937 205.64Z" fill="#111927" fill-opacity="0.5" shape-rendering="crispEdges"/>
<path d="M197.056 156.108L290.596 219.945L310.832 205.599L306.6 202.599L289.153 190.23L288.86 183.31L335.236 188.298L359.102 171.378L351.706 170.622L288.049 164.111L286.355 124L263.968 139.871L265.867 173.722L217.292 141.762L201.368 153.051L197.056 156.108Z" fill="#111927" fill-opacity="0.5" shape-rendering="crispEdges"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M192.905 295L70 207.714L74.2242 204.714L116.393 174.767C129.906 165.17 143.124 159.539 156.048 157.875C168.971 156.211 180.919 159.275 191.893 167.069C198.702 171.905 202.718 177.006 203.941 182.372C205.165 187.658 204.302 192.506 201.354 196.918L201.692 197.158C208.978 194.301 216.935 193.286 225.563 194.113C234.247 194.9 242.613 198.151 250.66 203.866C261.803 211.779 266.398 220.825 264.446 231.004C262.551 241.142 254.96 250.929 241.672 260.366L192.905 295ZM221.999 248.08L200.456 263.38L163.905 237.422L185.448 222.123C192.007 217.465 198.473 215.23 204.846 215.42C211.22 215.529 217.193 217.562 222.764 221.519C228.392 225.516 231.31 229.797 231.521 234.364C231.732 238.85 228.558 243.422 221.999 248.08ZM165.937 211.64L146.77 225.252L114.693 202.472L133.861 188.859C140.363 184.241 146.435 181.887 152.076 181.798C157.717 181.708 163.07 183.462 168.135 187.059C173.256 190.696 175.809 194.557 175.796 198.643C175.726 202.69 172.44 207.022 165.937 211.64Z" fill="#111927" fill-opacity="0.5" shape-rendering="crispEdges"/>
<path d="M310.832 199.599L306.6 202.599L310.832 205.599V199.599Z" fill="#111927" fill-opacity="0.5" shape-rendering="crispEdges"/>
<path d="M359.102 165.378L351.706 170.622L359.102 171.378V165.378Z" fill="#111927" fill-opacity="0.5" shape-rendering="crispEdges"/>
<path d="M201.368 153.051L197.056 150.108V156.108L201.368 153.051Z" fill="#111927" fill-opacity="0.5" shape-rendering="crispEdges"/>
<path d="M74.2242 204.714L70 201.714V207.714L74.2242 204.714Z" fill="#111927" fill-opacity="0.5" shape-rendering="crispEdges"/>
</g>
<path d="M197.056 150.108L290.596 213.945L310.832 199.599L289.153 184.23L288.86 177.31L335.236 182.298L359.102 165.378L288.049 158.111L286.355 118L263.968 133.871L265.867 167.722L217.292 135.762L197.056 150.108Z" fill="url(#paint2_linear_764_240)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M192.905 289L70 201.714L116.393 168.767C129.906 159.17 143.124 153.539 156.048 151.875C168.971 150.211 180.919 153.275 191.893 161.069C198.702 165.905 202.718 171.006 203.941 176.372C205.165 181.658 204.302 186.506 201.354 190.918L201.692 191.158C208.978 188.301 216.935 187.286 225.563 188.113C234.247 188.9 242.613 192.151 250.66 197.866C261.803 205.779 266.398 214.825 264.446 225.004C262.551 235.142 254.96 244.929 241.672 254.366L192.905 289ZM221.999 242.08L200.456 257.38L163.905 231.422L185.448 216.123C192.007 211.465 198.473 209.23 204.846 209.42C211.22 209.529 217.193 211.562 222.764 215.519C228.392 219.516 231.31 223.797 231.521 228.364C231.732 232.85 228.558 237.422 221.999 242.08ZM165.937 205.64L146.77 219.252L114.693 196.472L133.861 182.859C140.363 178.241 146.435 175.887 152.076 175.798C157.717 175.708 163.07 177.462 168.135 181.059C173.256 184.696 175.809 188.557 175.796 192.643C175.726 196.69 172.44 201.022 165.937 205.64Z" fill="url(#paint3_linear_764_240)"/>
<defs>
<filter id="filter0_d_764_240" x="66" y="116" width="297.103" height="185" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="2"/>
<feGaussianBlur stdDeviation="2"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_764_240"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_764_240" result="shape"/>
</filter>
<linearGradient id="paint0_linear_764_240" x1="213" y1="46" x2="213" y2="347.2" gradientUnits="userSpaceOnUse">
<stop stop-color="#10243E"/>
<stop offset="1" stop-color="#0F1B2D"/>
</linearGradient>
<linearGradient id="paint1_linear_764_240" x1="127.008" y1="96.51" x2="241.48" y2="334.974" gradientUnits="userSpaceOnUse">
<stop stop-color="#262A65"/>
<stop offset="1" stop-color="#104D87"/>
</linearGradient>
<linearGradient id="paint2_linear_764_240" x1="215" y1="98.5" x2="299.5" y2="210.5" gradientUnits="userSpaceOnUse">
<stop offset="0.379808" stop-color="#C2E6FF"/>
<stop offset="0.706731" stop-color="#70B8FF"/>
</linearGradient>
<linearGradient id="paint3_linear_764_240" x1="215" y1="98.5" x2="299.5" y2="210.5" gradientUnits="userSpaceOnUse">
<stop offset="0.379808" stop-color="#C2E6FF"/>
<stop offset="0.706731" stop-color="#70B8FF"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

@@ -0,0 +1,45 @@
---
import "@fontsource-variable/roboto-flex/wdth.css";
import { TextField } from "./TextField";
---
<style is:global>
@import "@radix-ui/colors/violet-dark.css";
@import "@radix-ui/colors/plum-dark.css";
.home-hero {
background-image: url(/assets/home-hero.webp);
background-size: cover;
background-position: top;
.wrapper {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: var(--space-7);
background: linear-gradient(var(--gray-a11), var(--gray-1));
padding: var(--space-9);
h1 {
font-weight: 900;
font-size: 3rem;
}
@media (max-width: 40rem) {
h1 {
font-size: 2rem;
}
}
}
}
</style>
<div class="home-hero">
<div class="wrapper">
<h1>BlitzKit 2.0</h1>
<TextField placeholder="Search..." className="search" type="search" />
</div>
</div>
@@ -0,0 +1,8 @@
input {
min-width: 0;
background-color: var(--gray-1);
border: solid 1px var(--gray-4);
color: var(--gray-12);
padding: var(--space-3) var(--space-4);
border-radius: var(--space-3);
}
@@ -0,0 +1,6 @@
import type { ComponentProps } from "react";
import "./index.css";
export function TextField(props: ComponentProps<"input">) {
return <input {...props} />;
}
@@ -0,0 +1,13 @@
import type { TankCatalogComponent } from "@protos/blitz_static_tank_component";
import type { Tanks } from "../../protos/tanks";
export abstract class AbstractAPI {
abstract tanks(): Promise<Tanks>;
abstract strings(
locale: string,
prefix?: string
): Promise<Record<string, string>>;
abstract tank(id: string): Promise<TankCatalogComponent>;
}
@@ -0,0 +1,12 @@
import { TankCatalogComponent } from "@protos/blitz_static_tank_component";
import { AbstractAPI } from "./abstract";
export class ClientAPI extends AbstractAPI {
async tank(id: string) {
const response = await fetch(`/api/tanks/${id}.pb`);
const buffer = await response.arrayBuffer();
const array = new Uint8Array(buffer);
return TankCatalogComponent.decode(array);
}
}
@@ -0,0 +1,21 @@
import type { AbstractAPI } from "./abstract";
let dynamicAPI: AbstractAPI;
if (typeof window === "undefined") {
const { ProxyClient } = await import("@blitzkit/closed");
const { ServerAPI } = await import("./server");
const proxyClient = await new ProxyClient(
import.meta.env.WOTB_SERVER
).handshake();
const metadata = await proxyClient.metadata();
dynamicAPI = new ServerAPI(metadata);
} else {
const { ClientAPI } = await import("./client");
dynamicAPI = new ClientAPI();
}
export const api = dynamicAPI;
+122
View File
@@ -0,0 +1,122 @@
import type { MetadataAccessor } from "@blitzkit/closed";
import { sluggify } from "@blitzkit/core";
import type { RemoteStorageComponent } from "@protos/blitz_static_remote_storage_component";
import { parse } from "yaml";
import type { TanksEntry } from "../../protos/tanks";
import { AbstractAPI } from "./abstract";
if (typeof window !== "undefined") {
throw new Error("ServerAPI is being evaluated in the browser");
}
interface LocalizationConfig {
namespaces: string[];
}
export class ServerAPI extends AbstractAPI {
constructor(private metadata: MetadataAccessor) {
super();
}
async strings(locale: string) {
const group = this.metadata.group("ClientConfigsEntity");
if (group.length !== 1) {
throw new RangeError(
`Don't know how to handle ${group.length} ClientConfigsEntities`
);
}
const clientConfig = this.metadata.item(group[0].id);
const localizationResources = clientConfig.LocalizationResources();
if (!localizationResources.remote_storage) {
throw new Error("Localization resources not found");
}
let remoteStorage: RemoteStorageComponent | undefined = undefined;
for (const candidateId of localizationResources.remote_storage
.remote_urls) {
const item = this.metadata.item(candidateId);
const candidate = item.RemoteStorage();
if (
remoteStorage === undefined ||
candidate.download_speed_weight > remoteStorage.download_speed_weight
) {
remoteStorage = candidate;
}
}
if (remoteStorage === undefined) {
throw new Error("No suitable production remote storage found");
}
const strings: Record<string, string> = {};
const configPath = `${remoteStorage.url}/${remoteStorage.relative_path}/config.yaml`;
try {
const config = await fetch(configPath)
.then((response) => response.text())
.then((text) => parse(text) as LocalizationConfig);
for (const namespace of config.namespaces) {
Object.assign(
strings,
await fetch(
`${remoteStorage.url}/${remoteStorage.relative_path}/${namespace}/${locale}.yaml`
)
.then((response) => response.text())
.then((text) => {
const strings: Record<string, string> = {};
const parsed = parse(text) as Record<string, string>;
for (const key in parsed) {
strings[key] = parsed[key].replaceAll('\\"', '"');
}
return strings;
})
);
}
} catch (error) {
console.warn(
`Failed to fetch config from ${configPath}. Returning empty strings. This will throw an error in production. Error:`,
error
);
}
return strings;
}
async tanks() {
const group = this.metadata.group("TankEntity");
const tanks: TanksEntry[] = [];
const strings = await this.strings("en");
for (const item of group) {
const tankCatalog = item.TankCatalog();
if (!tankCatalog.name) continue;
const name = strings[tankCatalog.name.value];
if (!name) continue;
const id = item.name;
const slug = sluggify(name);
tanks.push({ id, slug });
}
return { tanks };
}
async tank(id: string) {
const item = this.metadata.item(`TankEntity.${id}`);
const tankCatalog = item.TankCatalog();
return tankCatalog;
}
}
@@ -0,0 +1,211 @@
import { StandardSinglePrice } from "@protos/blitz_static_standard_single_price";
import { PenetrationGroup } from "@protos/blitz_static_tank_penetration_group";
import {
PenetrationGroupUpgrade,
PitchLimit,
ShellUpgrade,
ShellUpgrageSingleChange,
StageParameters,
TankAttributeChange,
TankAttributeChange_AttributeName,
TankAttributeChange_Modifier,
VisualChanges,
} from "@protos/blitz_static_tank_upgrade_single_stage";
function patch(stage0: StageParameters, stage1: StageParameters) {
if (stage1.stage_number !== ++stage0.stage_number) {
throw new Error("Change stage number must be 1 greater than base");
}
for (const attribute1 of stage1.attributes) {
let value1: number;
switch (attribute1.modifier) {
case TankAttributeChange_Modifier.MODIFIER_OVERRIDE:
value1 = attribute1.value;
break;
case TankAttributeChange_Modifier.MODIFIER_MULTIPLY:
case TankAttributeChange_Modifier.MODIFIER_ADD:
const attribute0 = stage0.attributes.find(
(attribute0) =>
attribute0.attribute_name === attribute1.attribute_name
);
if (!attribute0) {
throw new Error(
`Missing attribute ${
TankAttributeChange_AttributeName[attribute1.attribute_name]
} (${attribute1.attribute_name}) to modify`
);
}
case TankAttributeChange_Modifier.MODIFIER_MULTIPLY: {
value1 = attribute0!.value! * attribute1.value;
break;
}
case TankAttributeChange_Modifier.MODIFIER_ADD: {
value1 = attribute0!.value! + attribute1.value;
break;
}
default:
throw new Error(
`Unhandled modified ${
TankAttributeChange_Modifier[attribute1.modifier]
}`
);
}
const attribute0 = TankAttributeChange.create({
modifier: TankAttributeChange_Modifier.MODIFIER_OVERRIDE,
attribute_name: attribute1.attribute_name,
value: value1,
});
const index0 = stage0.attributes.findIndex(
(attribute) => attribute.attribute_name === attribute1.attribute_name
);
if (index0 === -1) {
stage0.attributes.push(attribute0);
} else {
stage0.attributes[index0] = attribute0;
}
}
for (const penetrationGroupUpgrade1 of stage1.penetration_groups_upgrades) {
const penetrationGroupUpgrade0 = stage0.penetration_groups_upgrades.find(
(group) => group.tank_part === penetrationGroupUpgrade1.tank_part
);
if (penetrationGroupUpgrade0) {
penetrationGroupUpgrade0.primary_armor = [
...penetrationGroupUpgrade1.primary_armor,
];
for (const penetrationGroup1 of penetrationGroupUpgrade1.penetration_groups) {
const penetrationGroup0 =
penetrationGroupUpgrade0.penetration_groups.find(
(baseGroup) => baseGroup.group_name === penetrationGroup1.group_name
);
if (penetrationGroup0) {
penetrationGroup0.common_data = penetrationGroup1.common_data;
penetrationGroup0.armor = penetrationGroup1.armor;
} else {
penetrationGroupUpgrade0.penetration_groups.push(
PenetrationGroup.create(penetrationGroup1)
);
}
}
} else {
stage0.penetration_groups_upgrades.push(
PenetrationGroupUpgrade.create(penetrationGroupUpgrade1)
);
}
}
if (stage1.modules_upgrades.length > 0) {
throw new Error("Modules upgrades not implemented");
}
for (const shellUpgrades1 of stage1.shells_upgrades) {
let shellUpgrades0 = stage0.shells_upgrades.find(
(baseShell) => baseShell.shell_id === shellUpgrades1.shell_id
);
if (shellUpgrades0) {
shellUpgrades0.shell_type = shellUpgrades1.shell_type;
for (const changedShellUpgrade of shellUpgrades1.changes) {
const shellUpgrade0 = shellUpgrades0.changes.find(
(baseShellUpgrade) =>
baseShellUpgrade.attribute_name ===
changedShellUpgrade.attribute_name
);
if (shellUpgrade0) {
shellUpgrade0.value = changedShellUpgrade.value;
} else {
shellUpgrades0.changes.push(
ShellUpgrageSingleChange.create(changedShellUpgrade)
);
}
}
shellUpgrades0.silver_price =
shellUpgrades1.silver_price === undefined
? undefined
: StandardSinglePrice.create(shellUpgrades1.silver_price);
} else {
stage0.shells_upgrades.push(ShellUpgrade.create(shellUpgrades1));
}
}
if (stage1.pump_reload_times.length > 0) {
stage0.pump_reload_times = [...stage1.pump_reload_times];
}
if (stage1.pump_reload_times.length < stage0.pump_reload_times.length) {
throw new Error(
`Pump reload times go down???? (${stage0.pump_reload_times.length} -> ${stage1.pump_reload_times.length})`
);
}
if (stage1.pitch_limits_up.length > 0 && stage0.pitch_limits_up.length > 0) {
throw new Error("Pitch limits not implemented");
}
for (const pitchLimitUp1 of stage1.pitch_limits_up) {
stage0.pitch_limits_up.push(PitchLimit.create(pitchLimitUp1));
}
if (
stage1.pitch_limits_down.length > 0 &&
stage0.pitch_limits_down.length > 0
) {
throw new Error("Pitch limits not implemented");
}
for (const pitchLimitDown1 of stage1.pitch_limits_down) {
stage0.pitch_limits_down.push(PitchLimit.create(pitchLimitDown1));
}
for (const visualChange1 of stage1.visual_changes) {
const visualChange0 = stage0.visual_changes.find(
(baseVisualChange) =>
baseVisualChange.tank_part === visualChange1.tank_part
);
if (visualChange0) {
visualChange0.name = visualChange1.name;
} else {
stage0.visual_changes.push(VisualChanges.create(visualChange1));
}
}
}
export function aggregateStageParameters(
base: StageParameters,
stages: StageParameters[]
) {
const stage0 = StageParameters.create({ ...base, stage_number: 0 });
/**
* Bug in Reforged: base stats are stage 1, so is the first upgrade. Manually
* setting it to stage 0 below and if the bug's been fixed, throw an error
* in dev mode to allow clean up in the future. Also, update the initial
* stage number to -1.
*/
if (base.stage_number === 0 && import.meta.env.DEV) {
throw new Error(
"Base stats are now stage 0. In-game bug fixed, please remove hack."
);
}
stages.forEach((stage) => patch(stage0, stage));
return stage0;
}
@@ -0,0 +1,356 @@
import type { TankCatalogComponent } from "@protos/blitz_static_tank_component";
import {
ShellUpgrageSingleChange_AttributeName,
StageParameters,
TankAttributeChange_AttributeName,
} from "@protos/blitz_static_tank_upgrade_single_stage";
import type { TankState } from "./tankState";
export type CharacteristicOutput = number | null;
type Characteristic = (helpers: {
characteristic: (name: CharacteristicName) => CharacteristicOutput;
attribute: (name: TankAttributeChange_AttributeName) => number;
attributeSafe: (name: TankAttributeChange_AttributeName) => number | null;
shell: (name: ShellUpgrageSingleChange_AttributeName) => number;
shellSafe: (name: ShellUpgrageSingleChange_AttributeName) => number | null;
state: TankState;
tank: TankCatalogComponent;
parameters: StageParameters;
}) => CharacteristicOutput;
export type CharacteristicName = keyof typeof characteristics;
export enum GunType {
Regular,
AutoLoader,
AutoReloader,
}
export const characteristics = {
gun_type({ attributeSafe, attribute }) {
const isPump =
attributeSafe(TankAttributeChange_AttributeName.ATTRIBUTE_NAME_IS_PUMP) ??
0;
if (isPump === 1) return GunType.AutoReloader;
const clipSize = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_SIZE
);
if (clipSize === 1) return GunType.Regular;
return GunType.AutoLoader;
},
clip_size({ attribute, characteristic }) {
const gunType = characteristic("gun_type")!;
if (gunType === GunType.Regular) return null;
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_SIZE
);
},
damage({ shell }) {
return shell(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_ARMOR_DAMAGE
);
},
module_damage({ shell }) {
return shell(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_MODULE_DAMAGE
);
},
penetration({ shell }) {
return shell(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_PIERCING_POWER
);
},
reload({ characteristic, attribute }) {
const gunType = characteristic("gun_type")!;
if (gunType === GunType.AutoReloader) return null;
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_RELOAD_TIME
);
},
intra_clip({ characteristic, attribute }) {
const gunType = characteristic("gun_type")!;
if (gunType === GunType.Regular) return null;
const clipRate = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_RATE
);
return 60 / clipRate;
},
dpm({ characteristic }) {
let dps: number;
const gunType = characteristic("gun_type")!;
const damage = characteristic("damage")!;
switch (gunType) {
case GunType.Regular: {
const reload = characteristic("reload")!;
dps = damage / reload;
break;
}
case GunType.AutoLoader: {
const reload = characteristic("reload")!;
const intraClip = characteristic("intra_clip")!;
const clipSize = characteristic("clip_size")!;
dps = (damage * clipSize) / (reload + (clipSize - 1) * intraClip);
break;
}
case GunType.AutoReloader: {
return -Infinity;
}
default:
throw new Error("Unknown gun type");
}
return 60 * dps;
},
caliber({ shell }) {
return shell(ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_CALIBER);
},
normalization({ shellSafe }) {
return shellSafe(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_NORMALIZATION
);
},
ricochet({ shell }) {
return shell(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_RICOCHET_ANGLE
);
},
shell_velocity({ shell }) {
return (
shell(ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_SPEED) / 100
);
},
shell_range({ shellSafe }) {
const maxDistance = shellSafe(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_MAX_DISTANCE
);
return maxDistance === null ? Infinity : maxDistance / 100;
},
shell_capacity({ shellSafe }) {
const count = shellSafe(
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_MAX_COUNT
);
return count === -1 || count === null ? Infinity : count;
},
aim_time({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_AIMING_TIME
);
},
speed_forward({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_FORWARD_MAX_SPEED
);
},
speed_backward({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_BACKWARD_MAX_SPEED
);
},
dispersion({ attribute, characteristic, state }) {
const base = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_ANGLE
);
const movement = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_VEHICLE_MOVEMENT
);
const vehicleRotation = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_VEHICLE_ROTATION
);
const turretRotation = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_TURRET_ROTATION
);
const afterShot = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_AFTER_SHOT
);
const gunDamaged = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_DISPERSION_FACTOR_WHILE_GUN_DAMAGED
);
const maxSpeed = characteristic("speed_forward") as number;
return (
(state.isGunDamaged ? gunDamaged : 1) *
(base +
(state.speed / maxSpeed) * movement +
(state.isHullTraversing ? vehicleRotation : 0) +
(state.isTurretTraversing ? turretRotation : 0) +
(state.isShooting ? afterShot : 0))
);
},
gun_depression({ parameters }) {
const pitchLimit = parameters.pitch_limits_down.find(
(pitchLimit) => pitchLimit.angle === 0
);
if (!pitchLimit) throw new Error("No angle 0 depression pitch limit found");
return pitchLimit.limit;
},
gun_elevation({ parameters }) {
const pitchLimit = parameters.pitch_limits_up.find(
(pitchLimit) => pitchLimit.angle === 0
);
if (!pitchLimit) throw new Error("No angle 0 elevation pitch limit found");
return pitchLimit.limit;
},
engine_power({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_ENGINE_POWER
);
},
weight({ attribute }) {
return attribute(TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MASS);
},
terrain_coefficient_hard({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_HARD
);
},
terrain_coefficient_medium({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_MEDIUM
);
},
terrain_coefficient_soft({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_SOFT
);
},
power_to_weight_hard() {
return -Infinity;
},
power_to_weight_medium() {
return -Infinity;
},
power_to_weight_soft() {
return -Infinity;
},
turret_traverse_speed({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TURRET_ROTATION_SPEED
);
},
hull_traverse_speed_hard() {
return -Infinity;
},
hull_traverse_speed_medium() {
return -Infinity;
},
hull_traverse_speed_soft() {
return -Infinity;
},
health({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MAX_HEALTH
);
},
fire_chance({ attribute }) {
return (
attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_FIRE_START_CHANCE
) * 100
);
},
view_range({ attribute }) {
return (
attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CIRCULAR_VISION_RADIUS
) / 100
);
},
camouflage_still({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_STILL
);
},
camouflage_moving({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_MOVING
);
},
camouflage_shooting_still({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_FACTOR_AT_SHOT
);
},
camouflage_shooting_moving() {
return -Infinity;
},
camouflage_on_fire({ attributeSafe }) {
return (
attributeSafe(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CONCEALMENT_FIRE_PENALTY
) ?? -Infinity
);
},
height() {
return -Infinity;
},
length() {
return -Infinity;
},
volume() {
return -Infinity;
},
} satisfies Record<string, Characteristic>;
@@ -0,0 +1,104 @@
import type { CharacteristicName } from "./characteristics";
export enum BetterDirection {
Higher,
Lower,
}
type CharacteristicsOrder = {
group: string;
order: (
| {
name: CharacteristicName;
decimals?: number;
units?: string;
}
| {
toy: string;
}
)[];
}[];
export const characteristicsOrder: CharacteristicsOrder = [
{
group: "firepower",
order: [
{ name: "gun_type" },
{ name: "dpm", decimals: 0, units: "hp_min" },
{ name: "damage", units: "hp" },
{ name: "module_damage", units: "hp" },
{ name: "penetration", units: "mm" },
{ name: "clip_size" },
{ name: "reload", decimals: 2, units: "s" },
{ name: "intra_clip", decimals: 2, units: "s" },
{ toy: "reload" },
{ name: "caliber", units: "mm" },
{ name: "normalization", units: "deg" },
{ name: "ricochet", units: "deg" },
{ toy: "ricochet" },
{ name: "shell_velocity", units: "m_s" },
{ name: "shell_range", units: "m" },
{ name: "shell_capacity" },
{ name: "aim_time", decimals: 1, units: "s" },
{ toy: "aim_time" },
{ name: "dispersion", decimals: 3, units: "m" },
{ name: "gun_depression", units: "deg" },
{ name: "gun_elevation", units: "deg" },
{ toy: "flexibility" },
],
},
{
group: "maneuverability",
order: [
{ name: "speed_forward", units: "km_h" },
{ name: "speed_backward", units: "km_h" },
{ name: "engine_power", units: "bhp" },
{ name: "weight", units: "t" },
{ name: "terrain_coefficient_hard" },
{ name: "terrain_coefficient_medium" },
{ name: "terrain_coefficient_soft" },
{ name: "power_to_weight_hard", units: "bhp_t" },
{ name: "power_to_weight_medium", units: "bhp_t" },
{ name: "power_to_weight_soft", units: "bhp_t" },
{ name: "turret_traverse_speed", units: "deg_s" },
{ name: "hull_traverse_speed_hard", units: "deg_s" },
{ name: "hull_traverse_speed_medium", units: "deg_s" },
{ name: "hull_traverse_speed_soft", units: "deg_s" },
{ toy: "traverse" },
],
},
{
group: "survivability",
order: [
{ name: "health", units: "hp" },
{ name: "fire_chance", units: "%" },
{ name: "view_range", units: "m" },
{ toy: "view_range" },
{ name: "camouflage_still", units: "%" },
{ name: "camouflage_moving", units: "%" },
{ name: "camouflage_shooting_still", units: "%" },
{ name: "camouflage_shooting_moving", units: "%" },
{ name: "camouflage_on_fire", units: "%" },
{ name: "height", units: "m" },
{ name: "length", units: "m" },
{ name: "volume", units: "m" },
],
},
];
@@ -0,0 +1,103 @@
import type { TankCatalogComponent } from "@protos/blitz_static_tank_component";
import {
ShellUpgrageSingleChange_AttributeName,
TankAttributeChange_AttributeName,
} from "@protos/blitz_static_tank_upgrade_single_stage";
import { aggregateStageParameters } from "./aggregateStageParameters";
import {
characteristics,
type CharacteristicName,
type CharacteristicOutput,
} from "./characteristics";
import type { TankState } from "./tankState";
export function computeCharacteristics(
tank: TankCatalogComponent,
state: TankState
) {
const parameters = aggregateStageParameters(
tank.base_stats!,
tank.upgrade_stages.slice(0, state.stage)
);
const computed: Partial<Record<CharacteristicName, CharacteristicOutput>> =
{};
function characteristic(name: CharacteristicName) {
if (name in computed) return computed[name] as CharacteristicOutput;
throw new Error(`${name} not computed yet`);
}
function attributeSafe(name: TankAttributeChange_AttributeName) {
const attribute = parameters.attributes.find(
(attribute) => attribute.attribute_name === name
);
return attribute ? attribute.value : null;
}
function attribute(name: TankAttributeChange_AttributeName) {
const attribute = attributeSafe(name);
if (attribute === null) {
throw new Error(
`Attribute ${TankAttributeChange_AttributeName[name]} (${name}) not found`
);
}
return attribute;
}
function shellSafe(name: ShellUpgrageSingleChange_AttributeName) {
const shell = parameters.shells_upgrades.find(
(shell) => shell.shell_id === state.shell
);
if (!shell) {
throw new Error(
`Shell ${ShellUpgrageSingleChange_AttributeName[name]} (${name}) not found`
);
}
const attribute = shell.changes.find(
(change) => change.attribute_name === name
);
return attribute ? attribute.value : null;
}
function shell(name: ShellUpgrageSingleChange_AttributeName) {
const attribute = shellSafe(name);
if (attribute === null) {
throw new Error(
`Shell attribute ${ShellUpgrageSingleChange_AttributeName[name]} (${name}) not found`
);
}
return attribute;
}
for (const _name in characteristics) {
const name = _name as CharacteristicName;
const value = characteristics[name]({
characteristic,
attribute,
attributeSafe,
shell,
shellSafe,
state,
tank,
parameters,
});
computed[name] = value;
}
return {
characteristics: computed as Record<
CharacteristicName,
CharacteristicOutput
>,
parameters,
};
}
@@ -0,0 +1,10 @@
export interface TankState {
stage: number;
shell: number;
speed: number;
isHullTraversing: boolean;
isTurretTraversing: boolean;
isShooting: boolean;
isGunDamaged: boolean;
}
@@ -0,0 +1,82 @@
import type { ButtonProps } from "@radix-ui/themes";
export interface Tool {
id: string;
strings?: string;
button: ButtonProps["color"];
significant?: boolean;
disabled?: boolean;
href?: string;
}
export const tools: Record<string, Tool> = {
tanks: {
id: "tanks",
strings: "tankopedia",
button: "purple",
significant: true,
},
players: {
id: "players",
disabled: true,
button: "blue",
},
compare: {
id: "compare",
button: "crimson",
},
performance: {
id: "performance",
button: "jade",
},
charts: {
id: "charts",
disabled: true,
button: "bronze",
},
playlist: {
id: "playlist",
button: "tomato",
},
mixer: {
id: "mixer",
button: "gray",
},
guess: {
id: "guess",
button: "cyan",
},
gallery: {
id: "gallery",
button: "gold",
},
session: {
id: "session",
button: "blue",
},
discord: {
id: "discord",
href: "https://discord.com/application-directory/1097673957865443370",
button: "indigo",
},
tier_list: {
id: "tier-list",
strings: "tier_list",
button: "orange",
},
embed: {
id: "embed",
button: "red",
},
api: {
id: "api",
disabled: true,
button: "bronze",
},
more: {
id: "more",
href: "https://discord.gg/nDt7AjGJQH",
button: "plum",
},
};
+19
View File
@@ -0,0 +1,19 @@
import { use } from "react";
const cache = new Map<string, Promise<unknown>>();
export function useAwait<Type>(
creator: () => Promise<Type>,
discriminator: string
) {
let promise;
if (cache.has(discriminator)) {
promise = cache.get(discriminator) as Promise<Type>;
} else {
promise = creator();
cache.set(discriminator, promise);
}
return use(promise);
}
@@ -0,0 +1,115 @@
---
import "@fontsource-variable/inter";
import type { Color } from "../pages/styles/colors/[accent].css";
interface Props {
accent: Color;
}
const { accent } = Astro.props;
const accentVariables = {
"accent-1": `var(--${accent}-1)`,
"accent-2": `var(--${accent}-2)`,
"accent-3": `var(--${accent}-3)`,
"accent-4": `var(--${accent}-4)`,
"accent-5": `var(--${accent}-5)`,
"accent-6": `var(--${accent}-6)`,
"accent-7": `var(--${accent}-7)`,
"accent-8": `var(--${accent}-8)`,
"accent-9": `var(--${accent}-9)`,
"accent-10": `var(--${accent}-10)`,
"accent-11": `var(--${accent}-11)`,
"accent-12": `var(--${accent}-12)`,
};
---
<html>
<head>
<meta charset="utf-8" />
<style is:global define:vars={accentVariables}>
@import "@radix-ui/colors/mauve-dark.css";
@import "@radix-ui/colors/mauve-alpha.css";
:root {
--accent-1: var(--amber-1);
--accent-2: var(--amber-2);
--accent-3: var(--amber-3);
--accent-4: var(--amber-4);
--accent-5: var(--amber-5);
--accent-6: var(--amber-6);
--accent-7: var(--amber-7);
--accent-8: var(--amber-8);
--accent-9: var(--amber-9);
--accent-10: var(--amber-10);
--accent-11: var(--amber-11);
--accent-12: var(--amber-12);
}
body {
--gray-1: var(--mauve-1);
--gray-2: var(--mauve-2);
--gray-3: var(--mauve-3);
--gray-4: var(--mauve-4);
--gray-5: var(--mauve-5);
--gray-6: var(--mauve-6);
--gray-7: var(--mauve-7);
--gray-8: var(--mauve-8);
--gray-9: var(--mauve-9);
--gray-10: var(--mauve-10);
--gray-11: var(--mauve-11);
--gray-12: var(--mauve-12);
--gray-a1: var(--mauve-a1);
--gray-a2: var(--mauve-a2);
--gray-a3: var(--mauve-a3);
--gray-a4: var(--mauve-a4);
--gray-a5: var(--mauve-a5);
--gray-a6: var(--mauve-a6);
--gray-a7: var(--mauve-a7);
--gray-a8: var(--mauve-a8);
--gray-a9: var(--mauve-a9);
--gray-a10: var(--mauve-a10);
--gray-a11: var(--mauve-a11);
--gray-a12: var(--mauve-a12);
--space-1: 0.25rem;
--space-2: 0.5rem;
--space-3: 0.75rem;
--space-4: 1rem;
--space-5: 1.5rem;
--space-6: 2rem;
--space-7: 2.5rem;
--space-8: 3rem;
--space-9: 4rem;
background-color: var(--gray-1);
color: var(--gray-12);
font-family: "Inter Variable", sans-serif;
display: flex;
flex-direction: column;
}
body,
h1,
h2,
h3,
h4,
h5,
h6,
p {
margin: 0;
}
a {
color: var(--accent-11);
}
</style>
</head>
<body class="dark">
<slot />
</body>
</html>
@@ -0,0 +1,58 @@
---
import "@radix-ui/colors/amber-dark.css";
import {
createProgram,
displayPartsToString,
forEachChild,
isFunctionDeclaration,
} from "typescript";
import BaseLayout from "../../layouts/BaseLayout.astro";
const root = `/src/pages/api`;
const globbed = import.meta.glob("/src/pages/api/**/*.ts", {
eager: true,
query: "?raw",
});
const paths: {
path: string;
documentation: string;
}[] = [];
for (const fullPath in globbed) {
const relativePath = `.${fullPath}`;
const path = fullPath.slice(root.length + 1, -3);
const program = createProgram([relativePath], {});
const source = program.getSourceFile(relativePath);
if (!source) throw new Error(`Could not find source for ${fullPath}`);
const checker = program.getTypeChecker();
const getter = forEachChild(source, (node) => {
if (!isFunctionDeclaration(node) || node.name?.text !== "GET") return;
return checker.getSymbolAtLocation(node.name);
});
const documentationComment = getter?.getDocumentationComment(checker);
if (!documentationComment) continue;
const documentation = displayPartsToString(documentationComment);
if (documentation.length === 0) continue;
paths.push({ path, documentation });
}
paths.sort((a, b) => a.path.localeCompare(b.path));
---
<BaseLayout accent="amber">
<h1>api</h1>
{
paths.map(({ path, documentation }) => (
<>
<h2>{path}</h2>
<p>{documentation}</p>
</>
))
}
</BaseLayout>
@@ -0,0 +1,17 @@
import { TankCatalogComponent } from "@protos/blitz_static_tank_component";
import type { APIContext, GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic";
export const getStaticPaths = (async () => {
const { tanks } = await api.tanks();
return tanks.map(({ id }) => ({ params: { id } }));
}) satisfies GetStaticPaths;
/**
* Even Noah can't save these animals.
*/
export async function GET({ params }: APIContext<never, { id: string }>) {
const tank = await api.tank(params.id);
return new Response(TankCatalogComponent.encode(tank).finish());
}
@@ -0,0 +1,8 @@
import { characteristicsOrder } from "../../../core/tankopedia/characteristicsOrder";
/**
* The naked man fears no pickpocket.
*/
export function GET() {
return Response.json(characteristicsOrder);
}
+15
View File
@@ -0,0 +1,15 @@
---
import "@radix-ui/colors/amber-dark.css";
import packageJson from "../../../../package.json";
import BaseLayout from "../layouts/BaseLayout.astro";
---
<BaseLayout accent="amber">
<!-- <HomeHero /> -->
<h1>blitzkit {packageJson.version}</h1>
<p><a href="/tanks">/tanks</a></p>
<p><a href="/api">/api</a></p>
</BaseLayout>
@@ -0,0 +1,35 @@
import * as colors from "@radix-ui/colors";
import type { APIContext, GetStaticPaths } from "astro";
const ignoreEndings = ["A", "P3", "Dark", "DarkA", "DarkP3"] as const;
const filtered = Object.keys(colors).filter(
(name) =>
!ignoreEndings.some((ending) => name.endsWith(ending)) &&
name !== "__esModule"
);
export const getStaticPaths = (() => {
return filtered.map((accent) => ({
params: { accent },
}));
}) satisfies GetStaticPaths;
export type Color = Exclude<
keyof typeof colors,
`${string}${(typeof ignoreEndings)[number]}` | "__esModule"
>;
export async function GET({ params }: APIContext<{}, { accent: Color }>) {
const palette = colors[`${params.accent}Dark`];
let content = ":root{";
for (const key in palette) {
const dashedKey = key.replace(/([a-zA-Z])(\d+)/, "$1-$2");
content += `--${dashedKey}:${palette[key as keyof typeof palette]};`;
}
content += "}";
return new Response(content);
}
@@ -0,0 +1,100 @@
import { times } from "lodash-es";
import { Suspense, useMemo } from "react";
import { api } from "../../../core/api/dynamic";
import { characteristicsOrder } from "../../../core/tankopedia/characteristicsOrder";
import { computeCharacteristics } from "../../../core/tankopedia/computeCharacteristics";
import { useAwait } from "../../../hooks/useAwait";
import { Tankopedia } from "../../../stores/tankopedia";
export function Page({ id }: { id: string }) {
return (
<Suspense fallback={null}>
<Content id={id} />
</Suspense>
);
}
function Content({ id }: { id: string }) {
const tank = useAwait(() => api.tank(id), `tank-${id}`);
Tankopedia.useInitialization(tank.upgrade_stages.length);
const protagonist = Tankopedia.use((state) => state.protagonist);
const { characteristics, parameters } = useMemo(
() => computeCharacteristics(tank, protagonist),
[protagonist]
);
return (
<>
<h1>{id}</h1>
<div style={{ display: "flex", flexWrap: "wrap" }}>
{times(tank.upgrade_stages.length + 1, (index) => (
<button
key={index}
onClick={() => {
Tankopedia.mutate((draft) => {
draft.protagonist.stage = index;
});
}}
>
Stage {index} {index === protagonist.stage && "(selected)"}
</button>
))}
</div>
<br />
<div style={{ display: "flex", flexWrap: "wrap" }}>
{parameters.shells_upgrades.map((shell) => (
<button
key={shell.shell_id}
onClick={() => {
Tankopedia.mutate((draft) => {
draft.protagonist.shell = shell.shell_id;
});
}}
>
Shell {shell.shell_id}{" "}
{shell.shell_id === protagonist.shell && "(selected)"}
</button>
))}
</div>
{characteristicsOrder.map(({ group, order }) => (
<>
<h2 key={group}>{group}</h2>
{order.map((entry) => {
if ("toy" in entry) {
return <p key={`toy-${entry.toy}`}>toy: {entry.toy}</p>;
} else {
const characteristic = characteristics[entry.name];
if (characteristic === null) return null;
let rendered: string | number;
if (Number.isFinite(characteristic)) {
if (entry.decimals === undefined) {
rendered = characteristic;
} else {
rendered = characteristic.toFixed(entry.decimals);
}
} else {
rendered = `${Math.sign(characteristic) === 1 ? "" : "-"}∞`;
}
return (
<p key={`characteristic-${entry.name}`}>
{entry.name}: {rendered} {entry.units && `${entry.units}`}
</p>
);
}
})}
</>
))}
</>
);
}
@@ -0,0 +1,22 @@
---
import "@radix-ui/colors/violet-dark.css";
import type { GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic";
import BaseLayout from "../../../layouts/BaseLayout.astro";
import { Page } from "./_index";
export const getStaticPaths = (async () => {
const { tanks } = await api.tanks();
return tanks.map((tank) => ({
params: { slug: tank.slug },
props: { id: tank.id },
}));
}) satisfies GetStaticPaths;
const { id } = Astro.props;
---
<BaseLayout accent="violet">
<Page {id} client:load />
</BaseLayout>
@@ -0,0 +1,21 @@
---
import "@radix-ui/colors/violet-dark.css";
import { api } from "../../core/api/dynamic";
import BaseLayout from "../../layouts/BaseLayout.astro";
const tanksList = await api.tanks();
---
<BaseLayout accent="violet">
<h1>tanks</h1>
{
tanksList.tanks.map(({ id, slug }) => (
<p>
<a href={`/tanks/${slug}`}>
{slug} ({id})
</a>
</p>
))
}
</BaseLayout>
@@ -0,0 +1,12 @@
syntax = "proto3";
package blitzkit;
message Tanks {
repeated TanksEntry tanks = 1;
}
message TanksEntry {
string id = 1;
string slug = 2;
}
@@ -0,0 +1,18 @@
import { Varuna } from "varuna";
import type { TankState } from "../core/tankopedia/tankState";
interface Tankopedia {
protagonist: TankState;
}
export const Tankopedia = new Varuna<Tankopedia, number>((maxStage) => ({
protagonist: {
stage: maxStage,
shell: 0,
isGunDamaged: false,
isHullTraversing: false,
isShooting: false,
isTurretTraversing: false,
speed: 0,
},
}));
+8
View File
@@ -0,0 +1,8 @@
{
"extends": ["../../tsconfig.json", "astro/tsconfigs/base"],
"compilerOptions": {
"paths": {
"@protos/*": ["../../packages/closed/protos/*"]
}
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ import { tools } from "./src/constants/tools";
const POSSIBLE_TARGETS = ["app", "web"];
const target = process.env.PUBLIC_TARGET ;
const target = process.env.PUBLIC_TARGET;
if (!target || !POSSIBLE_TARGETS.includes(target)) {
throw new Error("Invalid target");
@@ -0,0 +1,38 @@
---
import { tankIcon } from "@blitzkit/core";
import { Flex, Heading, Link, Strong, Text } from "@radix-ui/themes";
---
<Flex justify="center" px="4">
<Link
color="gray"
highContrast
style={{ display: "content" }}
href="/docs/guides/christmas-2025"
underline="none"
>
<Flex
mt="3"
px="5"
py="4"
style={{
borderRadius: "var(--radius-3)",
backgroundImage: "url(https://i.imgur.com/LRYmSkg.png)",
backgroundSize: "cover",
backgroundPosition: "center",
boxSizing: "border-box",
}}
align="center"
gap="5"
>
<img src={tankIcon(25169)} style={{ height: "min(15vw, 5rem)" }} />
<Flex direction="column">
<Heading size={{ initial: "4", sm: "6" }}>Christmas 2025</Heading>
<Text size={{ initial: "2", sm: "3" }}>
Win the <Strong>GSOR the TANK</Strong> and more!
</Text>
</Flex>
</Flex>
</Link>
</Flex>
@@ -0,0 +1,89 @@
import { Code, Flex, Heading, Link, Text } from "@radix-ui/themes";
import { useEffect, useState, type ReactNode } from "react";
import type { MaybeSkeletonComponentProps } from "../types/maybeSkeletonComponentProps";
import { InlineSkeleton } from "./InlineSkeleton";
const TIME = 1764898200 * 1000;
export function Giveaway({ skeleton }: MaybeSkeletonComponentProps) {
const [timeLeft, setTimeLeft] = useState<number>(TIME - Date.now());
useEffect(() => {
const interval = setInterval(() => {
setTimeLeft(TIME - Date.now());
}, 1000);
return () => {
clearInterval(interval);
};
}, []);
let string: ReactNode;
if (timeLeft > 0) {
const hours = Math.floor(timeLeft / (1000 * 60 * 60));
const minutes = Math.floor((timeLeft / (1000 * 60)) % 60)
.toString()
.padStart(2, "0");
const seconds = Math.floor((timeLeft / 1000) % 60)
.toString()
.padStart(2, "0");
string = (
<>
in{" "}
<Code highContrast>
{hours}h {minutes}m {seconds}s
</Code>
</>
);
} else {
string = "has ended. Come again later!";
}
return (
<Flex justify="center" px="4">
<Link
color="gray"
highContrast
style={{ display: "content" }}
href="https://discord.gg/njQdBhNS?event=1446208951136813117"
underline="none"
>
<Flex
mt="3"
px="5"
py="4"
style={{
borderRadius: "var(--radius-3)",
backgroundImage: "url(https://i.imgur.com/LRYmSkg.png)",
backgroundSize: "cover",
backgroundPosition: "center",
boxSizing: "border-box",
boxShadow: "0 0 var(--space-7) var(--blue-a5)",
}}
align="center"
gap="5"
>
<img
src="https://i.imgur.com/mvmJQgB.png"
style={{
height: "min(15vw, 5rem)",
filter: "drop-shadow(0.5rem 0.5rem 1rem #00000080)",
}}
/>
<Flex direction="column">
<Heading size={{ initial: "4", sm: "6" }}>
Music Box giveaway {!skeleton && string}{" "}
{skeleton && <InlineSkeleton width="10rem" />}
</Heading>
<Text size={{ initial: "2", sm: "3" }}>
Join the BlitzKit Discord server event
</Text>
</Flex>
</Flex>
</Link>
</Flex>
);
}
@@ -1,5 +1,5 @@
import { Markdown } from '../../../../../components/Markdown';
import { PageWrapper } from '../../../../../components/PageWrapper';
import { Markdown } from "../../../../../components/Markdown";
import { PageWrapper } from "../../../../../components/PageWrapper";
interface PageProps {
content: string;
@@ -7,7 +7,7 @@ interface PageProps {
export function Page({ content }: PageProps) {
return (
<PageWrapper>
<PageWrapper maxWidth="50rem">
<Markdown>{content}</Markdown>
</PageWrapper>
);
@@ -6,6 +6,7 @@ import { literals } from "@blitzkit/i18n/src/literals";
import { Box, Flex, Link } from "@radix-ui/themes";
import type { GetStaticPaths } from "astro";
import { AesonPlug } from "../../components/AesonPlug";
import { Giveaway } from "../../components/Giveaway";
import HomeHero from "../../components/HomeHero.astro";
import { Plugs } from "../../components/Plugs";
import ToolCard from "../../components/ToolCard.astro";