Compare commits

...
165 Commits
Author SHA1 Message Date
tresabhi 0a7a220af3 logs 2026-07-31 11:23:45 -05:00
tresabhi 434d1ede3c use transliteration 2026-07-31 11:21:50 -05:00
tresabhi 0f47208f5e add support for missing vfs0 dirs 2026-07-31 11:07:54 -05:00
tresabhi cb2d795461 fix url 2026-07-11 18:14:22 -05:00
tresabhi 6e934e0ff1 logs 2026-07-11 18:13:02 -05:00
tresabhi 375adadbe5 Merge branch 'main' into dev 2026-07-11 18:04:36 -05:00
tresabhi 082a756f1b auto scroll on drag in tier list 2026-07-11 18:02:49 -05:00
tresabhi 9fc8a8e2a2 more generous pitch transition zones 2026-07-11 17:41:14 -05:00
tresabhi 1413475679 bigger floor and more aggressive light decay 2026-07-11 17:38:11 -05:00
tresabhi 86504e685e softer shadows 2026-07-11 17:33:37 -05:00
tresabhi 9df81044d1 increasing lighting angle to cover larger tanks 2026-07-11 17:29:44 -05:00
tresabhi c5fd7591ea complete lighting animation even if canvas is unfocused 2026-07-11 17:29:15 -05:00
TrèsAbhi cd8e43f945 Merge pull request #256 from Hitjack007/mixer-crashing 2026-07-11 17:17:11 -05:00
tresabhi 8df112aab4 type-safe disposal 2026-07-11 17:16:52 -05:00
TrèsAbhi 94c04ce102 Merge pull request #255 from Hitjack007/external-ricochets 2026-07-11 17:14:10 -05:00
TrèsAbhi 3a170202ca Merge pull request #254 from Hitjack007/he-crash-fix 2026-07-11 17:10:49 -05:00
tresabhi 46937693a0 implement nullable refs in a type-safe manner 2026-07-11 17:09:38 -05:00
TrèsAbhi b391d0b036 Merge pull request #253 from Hitjack007/static-armor-uncapitalised-fix 2026-07-11 17:06:29 -05:00
Mark Greene 1061e003f7 Fix Safari crash on mixer texture disposal 2026-07-10 21:30:21 +12:00
Mark Greene a2b573abca fix ricochets on external modules 2026-07-10 17:51:32 +12:00
Mark Greene 4571d141e6 Fix crash on repeated HE shell clicks in Tankopedia armor viewer 2026-07-10 16:03:05 +12:00
Mark Greene d70225b03c fix static armor plate title to use localized strings
Was rendering the raw lowercase layerTypeNames key instead of resolving it through strings.website.tools.tankopedia.sandbox.dynamic.shot_card.element, same pattern already used in ShotDisplayCard.
2026-07-10 15:41:46 +12:00
tresabhi dc6c528167 logs 2026-07-05 14:06:46 -05:00
tresabhi b4d5d4c16e reduce ground brightness in static mode 2026-07-05 14:04:09 -05:00
tresabhi f2f6d4ff49 add persistent count for the number of model users to unload only when
uses drops to 0
2026-07-05 13:44:04 -05:00
tresabhi cdbb7647f0 fixed fill and clip rule naming 2026-07-05 13:41:21 -05:00
TrèsAbhi 41e40de791 New Crowdin updates (#251)
* New translations en.json (Ukrainian)

[ci skip]

* New translations en.json (Ukrainian)

[ci skip]

* New translations en.json (Ukrainian)

[ci skip]
2026-07-04 22:05:48 -05:00
tresabhi c85cd36818 logs 2026-06-28 11:11:37 -05:00
tresabhi 5d2c63fed9 clean up some renderer stuff 2026-06-26 14:05:26 -05:00
tresabhi cead140855 optimize intro naimaiton 2026-06-26 14:01:39 -05:00
tresabhi 63a0143d4f optimize scene lighting and rnederer 2026-06-26 13:58:30 -05:00
tresabhi 19f22993f1 optimize shot display animator 2026-06-26 13:31:40 -05:00
tresabhi b2eb74914f optimize lighting loop 2026-06-26 13:22:24 -05:00
TrèsAbhi 05572918b1 exit 2026-06-23 10:35:27 -05:00
TrèsAbhi 1cc8b26b16 dispose 2026-06-23 10:30:56 -05:00
TrèsAbhi a8e8d20cf1 break 2026-06-23 10:26:05 -05:00
TrèsAbhi 55deb30607 logs 2026-06-23 10:20:22 -05:00
TrèsAbhi 03b8b89a17 log 2026-06-23 10:14:37 -05:00
TrèsAbhi 3e421c7eb7 done 2026-06-23 10:11:18 -05:00
TrèsAbhi fc27caabdc dvpl 2026-06-23 10:07:54 -05:00
tresabhi 3d35fae5ce dont log 2026-06-22 20:52:51 -05:00
tresabhi f6dfc4f176 what 2026-06-22 20:32:14 -05:00
tresabhi fdbbe2f356 Update applyPatches.ts 2026-06-22 20:18:25 -05:00
tresabhi cdf2aee43f debug 2026-06-22 20:13:52 -05:00
tresabhi 56933ddfac debug 2026-06-22 20:07:55 -05:00
tresabhi 1df2e818be dirs 2026-06-22 19:57:41 -05:00
tresabhi 1e4d00ea34 source 2026-06-22 19:55:39 -05:00
tresabhi 1bde50e0a3 garbage code 2026-06-22 19:54:09 -05:00
tresabhi 88290ec1ab garbage code 2026-06-22 19:54:01 -05:00
tresabhi e8325df832 lz4js 2026-06-22 19:44:03 -05:00
tresabhi 394f28e6ed remove proxyclient 2026-06-22 19:33:52 -05:00
tresabhi f5f170bcca switch to clean dava 2026-06-22 19:32:26 -05:00
tresabhi 2ffe3fc006 set up patches 2026-06-22 19:28:02 -05:00
TrèsAbhi 406d70b5b7 New translations en.json (Ukrainian) (#250)
[ci skip]
2026-06-22 09:38:55 -05:00
TrèsAbhi f801e81c8b New Crowdin updates (#249)
* New translations en.json (Russian)

[ci skip]

* New translations en.json (Russian)

[ci skip]
2026-06-17 09:26:26 -05:00
TrèsAbhi a0e1d8cee0 New Crowdin updates (#247)
* New translations en.json (Russian)

[ci skip]

* New translations en.json (Russian)

[ci skip]

* New translations en.json (Russian)

[ci skip]

* New translations en.json (Russian)

[ci skip]
2026-06-14 09:49:53 -05:00
TrèsAbhi a9a870c3e6 New translations en.json (Russian) (#245)
[ci skip]
2026-05-22 14:52:47 -05:00
TrèsAbhi 3d061a78de Merge pull request #242 from blitzkit/fixes
Fixes
2026-05-14 22:48:01 -05:00
TrèsAbhi a188a01244 Merge branch 'main' into fixes 2026-05-14 22:47:53 -05:00
TrèsAbhi 0828722876 logs 2026-05-15 03:47:40 +00:00
TrèsAbhi 0ccd9e45d8 Merge pull request #243 from karelpak1/fix-tank-icons-riff
fix: use RIFF sprite bounds for tank icon extraction
2026-05-14 22:36:09 -05:00
TrèsAbhi 2f745a16d1 clean up 2026-05-12 18:08:02 -05:00
TrèsAbhi 100c7391fb dispose models on unload 2026-05-12 17:54:50 -05:00
TrèsAbhi 4f42a31f53 Reduce interval timing from 60fps to 200ms 2026-05-11 17:52:23 -05:00
TrèsAbhi 0b2e322112 disbale low tiers 2026-05-11 17:14:22 -05:00
TrèsAbhi 042a1afa74 remove cache from useModel 2026-05-11 16:18:54 -05:00
TrèsAbhi 3edf4a25be impossible inspect element 2026-05-10 21:55:33 -05:00
TrèsAbhi 43237c2aee Merge pull request #244 from karelpak1/feat-tankopedia-modules-tooltips
feat: add localized tooltips to tankopedia modules tree
2026-05-02 10:03:15 -05:00
GonnaHetzMeandTrèsAbhi 2fffdc3ef5 Update packages/website/src/components/Tankopedia/CharacteristicsSection/components/Modules.tsx
Co-authored-by: TrèsAbhi <[email protected]>
2026-04-30 21:58:39 +02:00
GonnaHetzMe 76e748f0ed feat: add localized tooltips to tankopedia modules tree 2026-04-29 23:03:59 +02:00
GonnaHetzMe c353119962 fix: use RIFF sprite bounds for tank icon extraction 2026-04-29 21:19:43 +02:00
TrèsAbhi 5fa4d3b242 remove aeson 2026-04-28 16:17:40 -05:00
TrèsAbhi 068e0e26b0 Merge pull request #240 from karelpak1/fix-R5G6B5 2026-04-14 11:33:37 -05:00
TrèsAbhi f6ca77f8c8 Merge pull request #241 from karelpak1/chore-bump-version 2026-04-14 11:32:55 -05:00
TrèsAbhi 4c7eda81ca Merge pull request #239 from karelpak1/fix-alphatest-culling 2026-04-14 11:32:18 -05:00
TrèsAbhi 3948af9e39 fix: implement types and simplify code 2026-04-14 11:31:16 -05:00
GonnaHetzMe aec30e1944 chore: bump github actions versions 2026-04-13 02:13:53 +02:00
GonnaHetzMe 4205b16769 fix: correct RGB565 PVR decoding 2026-04-13 02:00:12 +02:00
GonnaHetzMe 4d13803b0c feat: culling 2026-04-12 22:35:55 +02:00
GonnaHetzMe b950ac1318 fix: sc2 alphatest threshold 2026-04-12 22:17:55 +02:00
TrèsAbhi 1920be28d8 Merge branch 'main' into fixes 2026-04-09 21:17:47 -05:00
TrèsAbhi 8b00772958 feat: logs 2026-04-09 21:17:34 -05:00
TrèsAbhi e2e38dc4b3 revert 2026-04-09 21:12:16 -05:00
TrèsAbhi 455f1be041 fix: use asset for diff 2026-04-08 09:05:10 -05:00
TrèsAbhi 3e37368038 Merge pull request #236 from karelpak1/fix-pitch-quickinput
fix: correct input pitch offset for initial turret rotation
2026-04-08 08:39:25 -05:00
TrèsAbhi 4b86e20a13 New Crowdin updates (#232)
* 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)

* New translations en.json (Russian)
2026-04-08 08:38:28 -05:00
TrèsAbhi d9a14924eb Merge pull request #235 from karelpak1/fix-child-node-position
fix: position of child nodes
2026-04-08 08:38:07 -05:00
GonnaHetzMe 7d9d322405 fix: correct input pitch offset for initial turret rotation 2026-04-08 14:04:06 +02:00
GonnaHetzMe 5365044017 fix: position of child nodes 2026-04-08 08:48:53 +02:00
TrèsAbhi 069edf0847 feat: hot script 2026-04-07 17:00:35 -05:00
TrèsAbhi 2cdcf95822 fix: don't repeat reveal animation on scroll for tank sandbox 2026-04-07 16:57:04 -05:00
TrèsAbhi e43231aa97 fix: remove cue4parse 2026-04-07 16:44:03 -05:00
TrèsAbhi 0df2acd5e6 fix: equalizer in characteristics 2026-04-07 16:43:48 -05:00
TrèsAbhi 3f0b3f190a Merge pull request #234 from karelpak1/feat-riff-container 2026-04-07 16:31:47 -05:00
GonnaHetzMe 504f143ff7 fix: resolve requested changes 2026-04-07 23:15:26 +02:00
GonnaHetzMe 7cfc30c7a1 feat: add RIFF container support 2026-04-07 22:35:17 +02:00
TrèsAbhi f3ed687f00 Merge branch 'main' into fixes 2026-04-04 20:13:35 -05:00
TrèsAbhi e37575148c feat: logs 2026-04-04 20:13:25 -05:00
TrèsAbhi 2df9979f08 fix: armor highlghting in equalizer 2026-04-04 20:10:40 -05:00
TrèsAbhi c8ce26d6a7 Merge pull request #233 from karelpak1/fix-hp-equalizer 2026-04-04 19:52:21 -05:00
TrèsAbhi 898fd4bbf6 feat: simplify 2026-04-04 19:51:56 -05:00
GonnaHetzMe 744f7195dd fix: hp fix in Equalize 2026-04-05 02:14:09 +02:00
TrèsAbhi bc4f51846d Update tankCharacteristics.ts 2026-04-03 23:21:50 -05:00
TrèsAbhi ab8dc131b8 fix: don't build protos on setup 2026-04-03 22:18:39 -05:00
TrèsAbhi 684d33071e feat: logs 2026-04-03 22:15:44 -05:00
TrèsAbhi 146e68fc53 fix: penetration 2026-04-03 22:05:49 -05:00
TrèsAbhi 655b87d876 feat: compare equalize 2026-04-03 15:02:50 -05:00
TrèsAbhi 71caa2f703 fix: static 2026-04-03 14:53:14 -05:00
TrèsAbhi 99c95a4c15 fix: use code 2026-04-03 14:37:45 -05:00
TrèsAbhi 93632a7073 fix: a few missing chars 2026-04-03 14:29:23 -05:00
TrèsAbhi 297265822b feat: equal button 2026-04-03 13:04:55 -05:00
TrèsAbhi a7f799b5b6 fix: pen previwe 2026-04-03 12:59:22 -05:00
TrèsAbhi b176ec6c96 feat: penetration testing 2026-04-03 12:57:43 -05:00
TrèsAbhi 1a008a4852 feat: equalizer for visual armor sandbox 2026-04-03 12:31:46 -05:00
TrèsAbhi 145de2bbbc feat: shot card equalizer 2026-04-03 12:15:03 -05:00
TrèsAbhi 77c516a6eb feat: implement most equalizer 2026-04-03 12:08:47 -05:00
TrèsAbhi 6835004945 feat: equalizer parsing 2026-04-03 11:47:58 -05:00
TrèsAbhi e36823c159 feat: equalizer protos 2026-04-03 11:10:45 -05:00
TrèsAbhi ec6ac128f2 feat: beta badge for equializer 2026-04-03 11:05:12 -05:00
TrèsAbhi d80f47a6c8 fix: handle duplicate armor 2026-04-01 22:06:42 -05:00
TrèsAbhi 3a9af7505f fix: update to new api 2026-04-01 21:40:15 -05:00
TrèsAbhi 34ee954502 feat: local vfs 2026-04-01 21:34:44 -05:00
TrèsAbhi b9878a05a1 Merge branch 'main' into fixes 2026-04-01 21:18:12 -05:00
TrèsAbhi e9412bc404 revert: april fool's 2026-04-01 21:17:46 -05:00
TrèsAbhi 6755115c8a sick 2026-03-31 22:19:18 -05:00
TrèsAbhi e8ed4615fe what am i even doing bro 2026-03-31 22:18:03 -05:00
TrèsAbhi c55f4c311f fix: typo 2026-03-31 21:02:36 -05:00
TrèsAbhi e063970c58 feat: plug 2026-03-31 21:01:00 -05:00
TrèsAbhi fdf8580f5f feat: functionality 2026-03-31 17:15:25 -05:00
TrèsAbhi cffd37c6f1 feat: ui 2026-03-31 17:01:47 -05:00
TrèsAbhi 7419b3f29e fix: consumable times 2026-03-31 16:51:07 -05:00
TrèsAbhi e2f50871ec fix: update all 2026-03-31 14:11:45 -05:00
TrèsAbhi bdea9fdab3 fix: consistent protos 2026-03-31 13:35:47 -05:00
TrèsAbhi ae793c1c28 Merge pull request #229 from karelpak1/fix-large-repair-kit-icon 2026-03-26 20:05:56 -05:00
GonnaHetzMe 3d912036a7 fix: use proper icon for large repair kit 2026-03-27 02:03:15 +01:00
TrèsAbhi 1866077a82 Merge pull request #228 from karelpak1/feat-dev-name
Feat: dev name
2026-03-26 08:08:20 -05:00
TrèsAbhi 8345f99603 fix: use dev name directly 2026-03-26 08:06:43 -05:00
GonnaHetzMe 2ab576a37c fix: Set pointer cursor and simplify devName access 2026-03-26 09:29:35 +01:00
GonnaHetzMe 5b9ff7acb3 feat: CopyableCode styles and remove DEV name fallback 2026-03-25 17:25:52 +01:00
GonnaHetzMe 4cdb712013 feat: add CopyableCode component 2026-03-25 11:18:53 +01:00
GonnaHetzMe e6fcfdb514 Feat: dev name 2026-03-25 02:58:16 +01:00
TrèsAbhi 9df1800e10 Merge pull request #224 from karelpak1/fix-techtree
fix: include non-tier1 roots in tank tech tree routes
2026-03-24 19:31:46 -05:00
TrèsAbhi 95ba925d27 Merge pull request #226 from karelpak1/fix-yaw-pitch-inputs
fix: initialize tank quick inputs from current model transform
2026-03-24 19:29:21 -05:00
GonnaHetzMe 41882ddf23 fix: initialize tank quick inputs from current model transform 2026-03-25 01:12:06 +01:00
GonnaHetzMe fe9b543a75 fix: include non-tier1 roots in tank tech tree routes 2026-03-25 00:43:30 +01:00
TrèsAbhi 191843f972 Merge pull request #220 from blitzkit/main-i18n
New Crowdin updates
2026-03-24 09:39:43 -05:00
TrèsAbhi c1fde44809 Merge pull request #223 from blitzkit/fixes
fixes
2026-03-24 09:39:28 -05:00
TrèsAbhi 1a3517e035 feat: logs 2026-03-23 22:50:34 -05:00
TrèsAbhi afec6d9851 feat: enable all tiers 2026-03-23 22:41:34 -05:00
TrèsAbhi e3f2fd70ad fix: use turret mantlet 2026-03-23 22:36:10 -05:00
TrèsAbhi 5adbec25c4 fix: compact compare headers 2026-03-23 22:20:29 -05:00
TrèsAbhi 4ff8d77460 fix: object review videos 2026-03-23 22:13:29 -05:00
TrèsAbhi 22faa6d294 fix: stale compare indices 2026-03-23 22:07:20 -05:00
TrèsAbhi a2abfa7f85 fix: v-stabs now give 12% 2026-03-23 21:56:33 -05:00
TrèsAbhi 7b93b12fcb Merge pull request #222 from karelpak1/Position-fix 2026-03-23 19:56:17 -05:00
GonnaHetzMe ed252d5dfe Reset localTranslation for model extraction 2026-03-23 13:17:42 +01:00
TrèsAbhi c365993541 feat: remove discord bot
.
2026-03-19 09:21:58 -05:00
TrèsAbhi 30f9475208 feat: disable bot 2026-03-19 09:19:28 -05:00
TrèsAbhi 454c526666 New translations en.json (Polish) 2026-03-16 18:24:41 -05:00
TrèsAbhi e67970d2b9 New translations en.json (Polish) 2026-03-16 16:55:46 -05:00
TrèsAbhi 0f1c03d1e5 New translations en.json (Chinese Simplified) 2026-03-12 22:52:18 -05:00
tresabhi 8394f2ec1e feat: logs 2026-03-11 16:51:32 -05:00
tresabhi f14e73d811 fix: alpha clipping 2026-03-11 16:50:18 -05:00
TrèsAbhi 23e00b4199 New translations en.json (Polish) 2026-03-10 14:55:15 -05:00
TrèsAbhi 427b189a34 New Crowdin updates (#217) 2026-03-04 17:42:01 -06:00
210 changed files with 6182 additions and 4475 deletions

No files matched your search

+4
View File
@@ -73,10 +73,14 @@ jobs:
with: with:
repo-token: ${{ secrets.GH_TOKEN }} repo-token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v2 - uses: oven-sh/setup-bun@v2
- run: bun run setup - run: bun run setup
- name: AppArmor hack - name: AppArmor hack
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Install patches
run: bun run setup:patches --source=${{ github.event.inputs.asset_source || 'steam:444200/444202' }}
- name: Build assets - name: Build assets
run: bun run build:assets --all-targets --source=${{ github.event.inputs.asset_source || 'steam:444200/444202' }} run: bun run build:assets --all-targets --source=${{ github.event.inputs.asset_source || 'steam:444200/444202' }}
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
run: bun run build:bot run: bun run build:bot
- name: Archive build - name: Archive build
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v7
with: with:
name: bot name: bot
path: dist/bot path: dist/bot
-6
View File
@@ -1,13 +1,7 @@
name: Host name: Host
on: on:
push:
branches: main
schedule:
- cron: "0 */5 * * *"
workflow_dispatch: workflow_dispatch:
release:
types: [created, published, released, edited]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
+3 -3
View File
@@ -46,14 +46,14 @@ jobs:
- uses: arduino/setup-protoc@v3 - uses: arduino/setup-protoc@v3
with: with:
repo-token: ${{ secrets.GH_TOKEN }} repo-token: ${{ secrets.GH_TOKEN }}
- uses: actions/configure-pages@v5 - uses: actions/configure-pages@v6
- run: bun run setup - run: bun run setup
- name: Build website - name: Build website
run: bun run build:website run: bun run build:website
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v4 uses: actions/upload-pages-artifact@v5
with: with:
path: dist/website path: dist/website
@@ -69,4 +69,4 @@ jobs:
steps: steps:
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment
uses: actions/deploy-pages@v4 uses: actions/deploy-pages@v5
+4 -2
View File
@@ -6,6 +6,7 @@
"name": "blitzkit", "name": "blitzkit",
"dependencies": { "dependencies": {
"@prisma/client": "^6.18.0", "@prisma/client": "^6.18.0",
"lz4js": "^0.2.0",
"prisma": "^6.18.0", "prisma": "^6.18.0",
"sharp": "^0.34.5", "sharp": "^0.34.5",
"typescript": "^5.9.3", "typescript": "^5.9.3",
@@ -78,7 +79,6 @@
"dotenv": "^17.2.2", "dotenv": "^17.2.2",
"fast-xml-parser": "^5.3.2", "fast-xml-parser": "^5.3.2",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"lz4js": "^0.2.0",
"pickleparser": "^0.2.1", "pickleparser": "^0.2.1",
"protobufjs": "^7.5.4", "protobufjs": "^7.5.4",
"three": "^0.180.0", "three": "^0.180.0",
@@ -118,7 +118,6 @@
"fast-xml-parser": "^5.2.5", "fast-xml-parser": "^5.2.5",
"googleapis": "^162.0.0", "googleapis": "^162.0.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"lz4js": "^0.2.0",
"progress": "^2.0.3", "progress": "^2.0.3",
"puppeteer": "^24.22.3", "puppeteer": "^24.22.3",
"sharp": "^0.34.4", "sharp": "^0.34.4",
@@ -174,6 +173,7 @@
"react-promise-suspense": "^0.3.4", "react-promise-suspense": "^0.3.4",
"three": "^0.180.0", "three": "^0.180.0",
"three-stdlib": "^2.36.0", "three-stdlib": "^2.36.0",
"transliteration": "^2.6.1",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"urlon": "^3.1.0", "urlon": "^3.1.0",
"varuna": "workspace:*", "varuna": "workspace:*",
@@ -2428,6 +2428,8 @@
"tr46": ["[email protected]", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA=="], "tr46": ["[email protected]", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA=="],
"transliteration": ["[email protected]", "", { "bin": { "transliterate": "dist/bin/transliterate", "slugify": "dist/bin/slugify" } }, "sha512-hJ9BhrQAOnNTbpOr1MxsNjZISkn7ppvF5TKUeFmTE1mG4ZPD/XVxF0L0LUoIUCWmQyxH0gJpVtfYLAWf298U9w=="],
"trim-lines": ["[email protected]", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="], "trim-lines": ["[email protected]", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="],
"troika-three-text": ["[email protected]", "", { "dependencies": { "bidi-js": "^1.0.2", "troika-three-utils": "^0.52.4", "troika-worker-utils": "^0.52.0", "webgl-sdf-generator": "1.1.1" }, "peerDependencies": { "three": ">=0.125.0" } }, "sha512-V50EwcYGruV5rUZ9F4aNsrytGdKcXKALjEtQXIOBfhVoZU9VAqZNIoGQ3TMiooVqFAbR1w15T+f+8gkzoFzawg=="], "troika-three-text": ["[email protected]", "", { "dependencies": { "bidi-js": "^1.0.2", "troika-three-utils": "^0.52.4", "troika-worker-utils": "^0.52.0", "webgl-sdf-generator": "1.1.1" }, "peerDependencies": { "three": ">=0.125.0" } }, "sha512-V50EwcYGruV5rUZ9F4aNsrytGdKcXKALjEtQXIOBfhVoZU9VAqZNIoGQ3TMiooVqFAbR1w15T+f+8gkzoFzawg=="],
+5
View File
@@ -0,0 +1,5 @@
{
"words": [
"Tankopedia"
]
}
+5
View File
@@ -0,0 +1,5 @@
# BlitzKit 1.29.15
## Fixes
- Tanks now use alpha clipping to render translucency, fixing a lot of "ghostly" looking tanks
+18
View File
@@ -0,0 +1,18 @@
# BlitzKit 1.29.16
Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions this update.
## Fixes
- [GonnaHetzMe] The turret for Centurion I is no longer offset from the body
- Please allow up to 24 hours for the model to update
- Vertical Stabilizers now give the correct 12% buff instead of 15%
- Re-ordering tanks in Compare now works once again
- Fixed review videos from being about the Object 452K across all tanks
- Please allow up to 2 weeks for all tanks to refresh their videos
- Tanks in Mixer with oscillating turrets are not handled properly
## Features
- Headings in the Compare tool are now even more compact for mobile devices
- Enabled all tiers for the randomizer in Mixer
+23
View File
@@ -0,0 +1,23 @@
# BlitzKit 1.30.0
Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions this update.
## Features
- Added an equalizer mode for Tankopedia and Compare to preview what tank stats will look like in the upcoming Equalizer game mode
- This feature is in Beta and the stats are subject to change
- Thanks to WoTB News for sourcing data well ahead of the release of the gamemode
- Added a toggle in Tankopedia, right beneath Provisions
- Added button under the shell selector in the Tank Sandbox
- Added another toggle in the Compare table to enable equalizer for all tanks
## Technical Features
- [GonnaHetzMe] Enabling dev mode now displays the tank's non-numerical id
- [GonnaHetzMe] The dev id and the new dev name are now copyable on click
## Fixes
- [GonnaHetzMe] Tech trees that start at tiers higher than tier 1 like the Blitz Nation ones now properly render their trees in Tankopedia
- [GonnaHetzMe] The tank pitch/yaw inputs in the Tank Sandbox now initialize with the correct values instead of 0
- [GonnaHetzMe] Large Repair Kits once again use the correct modern icon
+8
View File
@@ -0,0 +1,8 @@
# BlitzKit 1.30.1
Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions this update.
## Fixes
- [GonnaHetzMe] Tank hit points in Equalizer mode is now accurate to the game
- Armor highlighting now reflects the actual thicknesses of tanks in Equalizer mode
+12
View File
@@ -0,0 +1,12 @@
# BlitzKit 1.30.2
Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions this update.
## Fixes
- [GonnaHetzMe] Tungsten shells are now properly cropped
- Equalizer no longer gives insanely high penetration values
- The tank reveal animation no longer repeats when you scroll away and back to the tank sandbox
- [GonnaHetzMe] The RHM. Pzw.'s turret no longer has the floating plate
- Please give BlitzKit up to 1 hour to update the model
- [GonnaHetzMe] Tanks with inclined turret rings like the Minotauro now display the correct pitch in the tank sandbox inputs
+18
View File
@@ -0,0 +1,18 @@
# BlitzKit 1.30.3
Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions this update.
## Features
- [GonnaHetzMe] Added tooltips to the module selector in Tankopedia
## Fixes
- Added aggressive re-rendering for the Guess mini-game's score readout to make inspect-element harder
- Removed tank visual and collision model caching
- Guesser once again breaks streaks if not all tiers are selected
- BlitzKit now properly unloads tank models from memory when visually hidden in Guesser
- [GonnaHetzMe] Tanks with complex transparency like the Herdbreaker once again handle opacity correctly
- [GonnaHetzMe] Pieces of tank models that have transparency now handle culling properly (they're visible from both sides)
- [GonnaHetzMe] Tanks with "cardboard" textures have been fixed, thanks to better PVR file parsing
- [GonnaHetzMe] Tank icons are now scaled correctly so small tanks are now properly zoomed out in contrast to bigger ones
+5
View File
@@ -0,0 +1,5 @@
# BlitzKit 1.30.4
## Fixes
- BlitzKit now correctly implements minor WoTB updates
+8
View File
@@ -0,0 +1,8 @@
# BlitzKit 1.30.5
## Features
- Reduced the amount of code that executes for every rendered frame, hopefully improving performance
- Reduced the number of lights by 20% to decrease the amount of shadow calculations
- Decreased the ground size by 80% for an equal reduction in shadow texture sizes
- Added the ability for BlitzKit to dismount the components that handled the intro lighting animation when not animating, reducing checks running every frame
+7
View File
@@ -0,0 +1,7 @@
# BlitzKit 1.30.6
## Fixes
- Tanks no longer "randomly" appear dark in Tankopedia and Mixer
- The ground is now as dark as other modes when Static Armor is selected in Tankopedia
- Fixed some naming issues with the "equal" icon, improving performance a tiny tiny bit
+20
View File
@@ -0,0 +1,20 @@
# BlitzKit 1.30.7
Thank you to [Mark Greene](https://github.com/Hitjack007) for your contributions this update.
## Features
- Dragging items in the Tier List now automatically scrolls the screen if you reach the top/bottom edge of the screen
## Fixes
- [Mark Greene] Clicking on the armor multiple times with HE no longer crashes BlitzKit
- [Mark Greene] Ricochets that later intersect with external modules no longer falsely claim a successful damaging penetration
- The lighting animation no longer stops prematurely when BlitzKit is unfocused
- The spot light angle has been increased to more evenly light up larger tanks
- BlitzKit once again uses soft shadows, reducing the pixelated shadows
- Fixed the weird patterns that formed on the tracks of tanks under self-shadows
- Increased the floor size and light decay to create the illusion that the floor is infinite
- [Mark Greene] Safari no longer crashes when unloading textures for unloaded tanks
- The gun depression transition between two constraints (like often behind tanks) now uses a gentler zoned and can never be 0
- [Mark Greene] Armor plate names in Static Armor are now properly capitalized in English and translated to other languages
+8
View File
@@ -0,0 +1,8 @@
# BlitzKit 1.30.8
Support for tanks with Chinese names.
## Fixes
- The URL generator for BlitzKit now handles names that have only Chinese characters
- The Mixed Virtual File System now handles non-existent directories correctly
+4 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "blitzkit", "name": "blitzkit",
"version": "1.29.14", "version": "1.30.8",
"license": "BlitzKit License", "license": "BlitzKit License",
"private": true, "private": true,
"scripts": { "scripts": {
@@ -21,7 +21,7 @@
"dev": "bun run dev:website", "dev": "bun run dev:website",
"dev:api": "bun --filter=@blitzkit/api run dev", "dev:api": "bun --filter=@blitzkit/api run dev",
"setup:depotdownloader": "bun --filter=@blitzkit/scripts run setup:depotdownloader", "setup:depotdownloader": "bun --filter=@blitzkit/scripts run setup:depotdownloader",
"setup:patches": "bun --filter=@blitzkit/scripts run setup:patches", "setup:patches": "mkdir -p packages/closed/node_modules && ln -sf ../../../node_modules/lz4js packages/closed/node_modules/lz4js && cd packages/scripts && bun run setup:patches",
"start:website": "bun --filter=@blitzkit/website run start", "start:website": "bun --filter=@blitzkit/website run start",
"host:docs": "vitepress preview docs", "host:docs": "vitepress preview docs",
"lint": "tsc", "lint": "tsc",
@@ -35,7 +35,7 @@
"build:reviews": "cd packages/scripts && bun build:reviews", "build:reviews": "cd packages/scripts && bun build:reviews",
"build:ids": "cd packages/scripts && bun build:ids", "build:ids": "cd packages/scripts && bun build:ids",
"prunestrings": "cd packages/scripts && bun prunestrings", "prunestrings": "cd packages/scripts && bun prunestrings",
"setup": "bun install && bun run build:prisma && bun run build:protos && bun run build:proxyclient", "setup": "bun install && bun run build:prisma",
"patchnotes": "cd packages/scripts && bun run patchnotes" "patchnotes": "cd packages/scripts && bun run patchnotes"
}, },
"type": "module", "type": "module",
@@ -44,6 +44,7 @@
], ],
"dependencies": { "dependencies": {
"@prisma/client": "^6.18.0", "@prisma/client": "^6.18.0",
"lz4js": "^0.2.0",
"prisma": "^6.18.0", "prisma": "^6.18.0",
"sharp": "^0.34.5", "sharp": "^0.34.5",
"typescript": "^5.9.3" "typescript": "^5.9.3"
+4 -4
View File
@@ -43,7 +43,7 @@ export const ownedTanksCommand = new Promise<CommandRegistry>((resolve) => {
tankStats.map(async (tankData) => ({ tankStats.map(async (tankData) => ({
tankDefinitions: (await tankDefinitions).tanks[tankData.tank_id]!, tankDefinitions: (await tankDefinitions).tanks[tankData.tank_id]!,
id: tankData.tank_id, id: tankData.tank_id,
})) })),
) )
).filter((tank) => tank.tankDefinitions?.tier === tier); ).filter((tank) => tank.tankDefinitions?.tier === tier);
const groupedTanks: Record<string, TankDefinition[]> = {}; const groupedTanks: Record<string, TankDefinition[]> = {};
@@ -69,16 +69,16 @@ export const ownedTanksCommand = new Promise<CommandRegistry>((resolve) => {
.filter((tank) => tank.tier === tier) .filter((tank) => tank.tier === tier)
.sort( .sort(
(a, b) => (a, b) =>
TANK_CLASSES.indexOf(a.class) - TANK_CLASSES.indexOf(b.class) TANK_CLASSES.indexOf(a.class) - TANK_CLASSES.indexOf(b.class),
) )
.sort( .sort(
(a, b) => (a, b) =>
awaitedGameDefinitions.nations.indexOf(a.nation) - awaitedGameDefinitions.nations.indexOf(a.nation) -
awaitedGameDefinitions.nations.indexOf(b.nation) awaitedGameDefinitions.nations.indexOf(b.nation),
) )
.map( .map(
(tank) => (tank) =>
`[${flags[tank.nation]} ${markdownEscape(unwrap(tank.name))}](<https://blitzkit.app/tanks/${tank.slug}>)` `[${flags[tank.nation]} ${markdownEscape(unwrap(tank.name!))}](<https://blitzkit.app/tanks/${tank.slug}>)`,
); );
const lines = [title, ...tankList]; const lines = [title, ...tankList];
+2 -2
View File
@@ -280,7 +280,7 @@ async function playerListing(
}} }}
> >
<img <img
alt={unwrap(tank.name)} alt={unwrap(tank.name!)}
src={await iconPng(tankIcon(tank.id))} src={await iconPng(tankIcon(tank.id))}
style={{ style={{
width: 32, width: 32,
@@ -317,7 +317,7 @@ async function playerListing(
fontSize: 16, fontSize: 16,
}} }}
> >
{unwrap(tank.name)} {unwrap(tank.name!)}
</span> </span>
</div> </div>
+47 -47
View File
@@ -35,49 +35,49 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
command: createLocalizedCommand("research") command: createLocalizedCommand("research")
.addStringOption((option) => .addStringOption((option) =>
option option
.setName(strings.bot.commands.research.options.target_tank.name) .setName(strings.bot.commands.research.options.target_tank.name!)
.setNameLocalizations( .setNameLocalizations(
localizationObject( localizationObject(
(strings) => (strings) =>
strings.bot.commands.research.options.target_tank.name, strings.bot.commands.research.options.target_tank.name,
undefined, undefined,
true true,
) ),
) )
.setDescription( .setDescription(
strings.bot.commands.research.options.target_tank.description strings.bot.commands.research.options.target_tank.description,
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
localizationObject( localizationObject(
(strings) => (strings) =>
strings.bot.commands.research.options.target_tank.description strings.bot.commands.research.options.target_tank.description,
) ),
) )
.setAutocomplete(true) .setAutocomplete(true)
.setRequired(true) .setRequired(true),
) )
.addStringOption((option) => .addStringOption((option) =>
option option
.setName(strings.bot.commands.research.options.starting_tank.name) .setName(strings.bot.commands.research.options.starting_tank.name!)
.setNameLocalizations( .setNameLocalizations(
localizationObject( localizationObject(
(strings) => (strings) =>
strings.bot.commands.research.options.starting_tank.name, strings.bot.commands.research.options.starting_tank.name,
undefined, undefined,
true true,
) ),
) )
.setDescription( .setDescription(
strings.bot.commands.research.options.starting_tank.description strings.bot.commands.research.options.starting_tank.description,
) )
.setDescriptionLocalizations( .setDescriptionLocalizations(
localizationObject( localizationObject(
(strings) => (strings) =>
strings.bot.commands.research.options.starting_tank.description strings.bot.commands.research.options.starting_tank.description,
) ),
) )
.setAutocomplete(true) .setAutocomplete(true)
.setRequired(false) .setRequired(false),
) )
.addStringOption(addUsernameChoices), .addStringOption(addUsernameChoices),
@@ -87,7 +87,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
const targetTankId = await resolveTankId( const targetTankId = await resolveTankId(
interaction.options.getString("target-tank", true), interaction.options.getString("target-tank", true),
interaction.locale, interaction.locale,
true true,
); );
const startingTankRaw = interaction.options.getString("starting-tank"); const startingTankRaw = interaction.options.getString("starting-tank");
const targetTank = awaitedTankDefinitions.tanks[targetTankId]; const targetTank = awaitedTankDefinitions.tanks[targetTankId];
@@ -99,13 +99,13 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
startingTankId = await resolveTankId( startingTankId = await resolveTankId(
startingTankRaw, startingTankRaw,
interaction.locale, interaction.locale,
true true,
); );
if (targetTankId === startingTankId) { if (targetTankId === startingTankId) {
return literals( return literals(
strings.bot.commands.research.errors.start_end_equal, strings.bot.commands.research.errors.start_end_equal,
{ tank: escapeMarkdown(unwrap(targetTank.name)) } { tank: escapeMarkdown(unwrap(targettank.name!)) },
); );
} }
@@ -113,8 +113,8 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
if (startingTank.tier > targetTank.tier) { if (startingTank.tier > targetTank.tier) {
return literals(strings.bot.commands.research.errors.unordered, { return literals(strings.bot.commands.research.errors.unordered, {
tank_1: escapeMarkdown(unwrap(startingTank.name)), tank_1: escapeMarkdown(unwrap(startingtank.name!)),
tank_2: escapeMarkdown(unwrap(targetTank.name)), tank_2: escapeMarkdown(unwrap(targettank.name!)),
}); });
} }
@@ -122,21 +122,21 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
return literals( return literals(
strings.bot.commands.research.errors.tanks_not_on_line, strings.bot.commands.research.errors.tanks_not_on_line,
{ {
tank_1: escapeMarkdown(unwrap(targetTank.name)), tank_1: escapeMarkdown(unwrap(targettank.name!)),
tank_2: escapeMarkdown(unwrap(startingTank.name)), tank_2: escapeMarkdown(unwrap(startingtank.name!)),
} },
); );
} }
} else { } else {
if (targetTank.type !== TankType.RESEARCHABLE) { if (targetTank.type !== TankType.TANK_TYPE_RESEARCHABLE) {
return literals(strings.bot.commands.research.errors.non_tech_tree, { return literals(strings.bot.commands.research.errors.non_tech_tree, {
tank: escapeMarkdown(unwrap(targetTank.name)), tank: escapeMarkdown(unwrap(targettank.name!)),
}); });
} }
if (targetTank.tier === 1) { if (targetTank.tier === 1) {
return literals(strings.bot.commands.research.errors.tier_1, { return literals(strings.bot.commands.research.errors.tier_1, {
tank: escapeMarkdown(unwrap(targetTank.name)), tank: escapeMarkdown(unwrap(targettank.name!)),
}); });
} }
@@ -149,14 +149,14 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
if (tankStats.some(({ tank_id }) => tank_id === targetTankId)) { if (tankStats.some(({ tank_id }) => tank_id === targetTankId)) {
return literals( return literals(
strings.bot.commands.research.errors.already_researched, strings.bot.commands.research.errors.already_researched,
{ tank: escapeMarkdown(unwrap(targetTank.name)) } { tank: escapeMarkdown(unwrap(targettank.name!)) },
); );
} }
const foundAncestor = targetTankAncestry.find( const foundAncestor = targetTankAncestry.find(
(id) => (id) =>
awaitedTankDefinitions.tanks[id].tier === 1 || awaitedTankDefinitions.tanks[id].tier === 1 ||
tankStats.some(({ tank_id }) => tank_id === id) tankStats.some(({ tank_id }) => tank_id === id),
); );
if (foundAncestor === undefined) { if (foundAncestor === undefined) {
@@ -168,7 +168,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
const techTreeLine = await buildTechTreeLine( const techTreeLine = await buildTechTreeLine(
startingTankId, startingTankId,
targetTankId targetTankId,
); );
const line = [...techTreeLine, startingTankId].reverse(); const line = [...techTreeLine, startingTankId].reverse();
@@ -190,7 +190,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
) { ) {
turretXps.set( turretXps.set(
turret.id, turret.id,
turret.research_cost.research_cost_type!.value turret.research_cost.research_cost_type!.value,
); );
} }
@@ -211,7 +211,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
) { ) {
engineXps.set( engineXps.set(
engine.id, engine.id,
engine.research_cost.research_cost_type!.value engine.research_cost.research_cost_type!.value,
); );
} }
}); });
@@ -223,7 +223,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
) { ) {
trackXps.set( trackXps.set(
track.id, track.id,
track.research_cost.research_cost_type!.value track.research_cost.research_cost_type!.value,
); );
} }
}); });
@@ -245,13 +245,13 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
return { return {
research: tank.research_cost!.research_cost_type!.value as number, research: tank.research_cost!.research_cost_type!.value as number,
upgrades: moduleXp, upgrades: moduleXp,
purchase: tank.price.value, purchase: tank.price!.value,
equipment: equipmentPriceMatrix[tank.tier].reduce( equipment: equipmentPriceMatrix[tank.tier].reduce(
(a, b) => a + 3 * b, (a, b) => a + 3 * b,
0 0,
), ),
}; };
}) }),
); );
const image = ( const image = (
@@ -456,7 +456,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
}} }}
> >
<img <img
alt={unwrap(tank.name)} alt={unwrap(tank.name!)}
src={TANK_ICONS[tank.class]} src={TANK_ICONS[tank.class]}
width={16} width={16}
height={16} height={16}
@@ -467,7 +467,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
color: theme.colors.textHighContrast, color: theme.colors.textHighContrast,
}} }}
> >
{unwrap(tank.name)} {unwrap(tank.name!)}
</span> </span>
</div> </div>
</div> </div>
@@ -505,9 +505,9 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
strings.bot.commands.research.body.research, strings.bot.commands.research.body.research,
{ {
cost: costs[index].research?.toLocaleString( cost: costs[index].research?.toLocaleString(
interaction.locale interaction.locale,
), ),
} },
)} )}
</span> </span>
</div> </div>
@@ -523,7 +523,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
<img <img
alt="Free XP icon" alt="Free XP icon"
src={await iconPng( src={await iconPng(
asset("icons/currencies/free-xp.webp") asset("icons/currencies/free-xp.webp"),
)} )}
width={16} width={16}
height={16} height={16}
@@ -536,7 +536,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
> >
{literals( {literals(
strings.bot.commands.research.body.upgrades, strings.bot.commands.research.body.upgrades,
{ cost: costs[index].upgrades.toLocaleString() } { cost: costs[index].upgrades.toLocaleString() },
)} )}
</span> </span>
</div> </div>
@@ -552,7 +552,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
<img <img
alt="Silver icon" alt="Silver icon"
src={await iconPng( src={await iconPng(
asset("icons/currencies/silver.webp") asset("icons/currencies/silver.webp"),
)} )}
width={16} width={16}
height={16} height={16}
@@ -567,9 +567,9 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
strings.bot.commands.research.body.purchase, strings.bot.commands.research.body.purchase,
{ {
cost: costs[index].purchase.toLocaleString( cost: costs[index].purchase.toLocaleString(
interaction.locale interaction.locale,
), ),
} },
)} )}
</span> </span>
</div> </div>
@@ -584,7 +584,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
<img <img
alt="Silver icon" alt="Silver icon"
src={await iconPng( src={await iconPng(
asset("icons/currencies/silver.webp") asset("icons/currencies/silver.webp"),
)} )}
width={16} width={16}
height={16} height={16}
@@ -599,16 +599,16 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
strings.bot.commands.research.body.equipment, strings.bot.commands.research.body.equipment,
{ {
cost: costs[index].equipment.toLocaleString( cost: costs[index].equipment.toLocaleString(
interaction.locale interaction.locale,
), ),
} },
)} )}
</span> </span>
</div> </div>
</div> </div>
</div> </div>
); );
}) }),
)} )}
</div> </div>
</CommandWrapper> </CommandWrapper>
@@ -3,14 +3,14 @@ import {
TankClass, TankClass,
TankType, TankType,
TREE_TYPE_ICONS, TREE_TYPE_ICONS,
} from '@blitzkit/core'; } from "@blitzkit/core";
import { createColors } from 'bepaint'; import { createColors } from "bepaint";
import { import {
type AccentColor, type AccentColor,
type GrayColor, type GrayColor,
PALETTES, PALETTES,
} from '../../../core/radix/radixColors'; } from "../../../core/radix/radixColors";
import { RowStat } from './RowStat'; import { RowStat } from "./RowStat";
export interface RowStatItem { export interface RowStatItem {
title: string; title: string;
@@ -21,7 +21,7 @@ export interface RowStatItem {
} }
interface RowProps { interface RowProps {
displayType?: 'tank' | 'summary'; displayType?: "tank" | "summary";
naked?: boolean; naked?: boolean;
title: string; title: string;
minimized?: boolean; minimized?: boolean;
@@ -32,7 +32,7 @@ interface RowProps {
} }
export function Row({ export function Row({
color = 'slate', color = "slate",
stats, stats,
title, title,
minimized, minimized,
@@ -49,20 +49,20 @@ export function Row({
className="session-tracker-row" className="session-tracker-row"
style={{ style={{
maxWidth: naked ? 600 : Infinity, maxWidth: naked ? 600 : Infinity,
display: 'flex', display: "flex",
flexDirection: 'column', flexDirection: "column",
borderRadius: 4, borderRadius: 4,
backgroundColor: naked backgroundColor: naked
? `${theme.appBackground2}c0` ? `${theme.appBackground2}c0`
: theme.appBackground2, : theme.appBackground2,
overflow: 'hidden', overflow: "hidden",
}} }}
> >
<div <div
style={{ style={{
display: 'flex', display: "flex",
alignItems: 'center', alignItems: "center",
justifyContent: 'center', justifyContent: "center",
padding: 8, padding: 8,
gap: 4, gap: 4,
backgroundColor: naked backgroundColor: naked
@@ -70,10 +70,14 @@ export function Row({
: theme.componentInteractive, : theme.componentInteractive,
}} }}
> >
{displayType === 'tank' && tankClass !== undefined && ( {displayType === "tank" && tankClass !== undefined && (
<img <img
alt={TankClass[tankClass]} alt={TankClass[tankClass]}
src={TREE_TYPE_ICONS[type ?? TankType.RESEARCHABLE][tankClass]} src={
TREE_TYPE_ICONS[type ?? TankType.TANK_TYPE_RESEARCHABLE][
tankClass
]
}
style={{ width: 16, height: 16 }} style={{ width: 16, height: 16 }}
/> />
)} )}
@@ -81,10 +85,10 @@ export function Row({
<span <span
style={{ style={{
color: color:
displayType === 'tank' displayType === "tank"
? type === TankType.COLLECTOR ? type === TankType.TANK_TYPE_COLLECTOR
? theme.textLowContrast_blue ? theme.textLowContrast_blue
: type === TankType.PREMIUM : type === TankType.TANK_TYPE_PREMIUM
? theme.textLowContrast_amber ? theme.textLowContrast_amber
: theme.textHighContrast : theme.textHighContrast
: theme.textLowContrast, : theme.textLowContrast,
@@ -98,7 +102,7 @@ export function Row({
<div <div
style={{ style={{
display: 'flex', display: "flex",
paddingTop: 8, paddingTop: 8,
paddingBottom: 8, paddingBottom: 8,
}} }}
@@ -109,8 +113,8 @@ export function Row({
<RowStat <RowStat
minimized={minimized} minimized={minimized}
key={index} key={index}
name={`${row.title} • ${row.career ?? '--'}`} name={`${row.title} • ${row.career ?? "--"}`}
value={row.current ?? '--'} value={row.current ?? "--"}
delta={row.delta} delta={row.delta}
percentile={row.percentile} percentile={row.percentile}
/> />
@@ -1,5 +1,5 @@
import { TankClass, TankType, TREE_TYPE_ICONS } from '@blitzkit/core'; import { TankClass, TankType, TREE_TYPE_ICONS } from "@blitzkit/core";
import { theme } from '../../../../stitches.config'; import { theme } from "../../../../stitches.config";
export interface ItemProps { export interface ItemProps {
tankClass?: TankClass; tankClass?: TankClass;
@@ -8,9 +8,9 @@ export interface ItemProps {
} }
const TREE_TYPE_COLOR = { const TREE_TYPE_COLOR = {
[TankType.RESEARCHABLE]: '', [TankType.TANK_TYPE_RESEARCHABLE]: "",
[TankType.PREMIUM]: '_amber', [TankType.TANK_TYPE_PREMIUM]: "_amber",
[TankType.COLLECTOR]: '_blue', [TankType.TANK_TYPE_COLLECTOR]: "_blue",
} as const; } as const;
export function Item({ export function Item({
@@ -21,12 +21,12 @@ export function Item({
return ( return (
<div <div
style={{ style={{
display: 'flex', display: "flex",
height: 32, height: 32,
paddingLeft: 8, paddingLeft: 8,
paddingRight: 8, paddingRight: 8,
overflow: 'hidden', overflow: "hidden",
alignItems: 'center', alignItems: "center",
borderRadius: 4, borderRadius: 4,
backgroundColor: backgroundColor:
theme.colors[`componentInteractive${TREE_TYPE_COLOR[treeType]}`], theme.colors[`componentInteractive${TREE_TYPE_COLOR[treeType]}`],
@@ -34,12 +34,12 @@ export function Item({
> >
<div <div
style={{ style={{
display: 'flex', display: "flex",
gap: 4, gap: 4,
flex: 1, flex: 1,
alignItems: 'center', alignItems: "center",
justifyContent: 'flex-start', justifyContent: "flex-start",
overflow: 'hidden', overflow: "hidden",
}} }}
> >
{tankType && ( {tankType && (
@@ -52,7 +52,7 @@ export function Item({
<span <span
style={{ style={{
fontSize: 16, fontSize: 16,
whiteSpace: 'nowrap', whiteSpace: "nowrap",
color: theme.colors[`textLowContrast${TREE_TYPE_COLOR[treeType]}`], color: theme.colors[`textLowContrast${TREE_TYPE_COLOR[treeType]}`],
}} }}
> >
@@ -6,21 +6,21 @@ import { translator } from "../localization/translator";
export async function filtersToDescription( export async function filtersToDescription(
{ nation, tier, type, class: tankClass, tank }: StatFilters, { nation, tier, type, class: tankClass, tank }: StatFilters,
locale: Locale locale: Locale,
) { ) {
const { strings, bkLocale } = translator(locale); const { strings, bkLocale } = translator(locale);
const awaitedTankDefinitions = await fetchTankDefinitions(); const awaitedTankDefinitions = await fetchTankDefinitions();
const info: string[] = []; const info: string[] = [];
// TODO: somehow localize tank names? // TODO: somehow localize tank names?
if (tank) return awaitedTankDefinitions.tanks[tank].name.locales[bkLocale]; if (tank) return awaitedTankDefinitions.tanks[tank].name!.locales[bkLocale];
if (nation) if (nation)
info.push((strings.common.nations as Record<string, string>)[nation]); info.push((strings.common.nations as Record<string, string>)[nation]);
if (tier) { if (tier) {
info.push( info.push(
literals(strings.bot.common.filters.tier, { literals(strings.bot.common.filters.tier, {
tier: TIER_ROMAN_NUMERALS[tier], tier: TIER_ROMAN_NUMERALS[tier],
}) }),
); );
} }
if (tankClass) info.push(strings.common.tank_class_short[tankClass]); if (tankClass) info.push(strings.common.tank_class_short[tankClass]);
@@ -34,12 +34,12 @@ export async function filterStats(
(filters.tier === undefined || entry.tier === filters.tier) && (filters.tier === undefined || entry.tier === filters.tier) &&
(filters.class === undefined || entry.class === filters.class) && (filters.class === undefined || entry.class === filters.class) &&
(filters.type === undefined || (filters.type === undefined ||
(filters.type === TankType.COLLECTOR && (filters.type === TankType.TANK_TYPE_COLLECTOR &&
entry.type === TankType.COLLECTOR) || entry.type === TankType.TANK_TYPE_COLLECTOR) ||
(filters.type === TankType.PREMIUM && (filters.type === TankType.TANK_TYPE_PREMIUM &&
entry.type === TankType.PREMIUM) || entry.type === TankType.TANK_TYPE_PREMIUM) ||
(filters.type === TankType.RESEARCHABLE && (filters.type === TankType.TANK_TYPE_RESEARCHABLE &&
entry.type === TankType.RESEARCHABLE)) && entry.type === TankType.TANK_TYPE_RESEARCHABLE)) &&
(filters.tank === undefined || entry.id === filters.tank) (filters.tank === undefined || entry.id === filters.tank)
); );
}); });
@@ -1,12 +1,12 @@
import { Locale, SlashCommandStringOption } from 'discord.js'; import { Locale, SlashCommandStringOption } from "discord.js";
import { translator } from '../localization/translator'; import { translator } from "../localization/translator";
import { localizationObject } from './localizationObject'; import { localizationObject } from "./localizationObject";
export function addTankChoices(option: SlashCommandStringOption) { export function addTankChoices(option: SlashCommandStringOption) {
const { strings } = translator(Locale.EnglishUS); const { strings } = translator(Locale.EnglishUS);
return option return option
.setName(strings.bot.common.options.tank.name) .setName(strings.bot.common.options.tank.name!)
.setNameLocalizations( .setNameLocalizations(
localizationObject( localizationObject(
(strings) => strings.bot.common.options.tank.name, (strings) => strings.bot.common.options.tank.name,
@@ -13,13 +13,13 @@ import {
} from "./autocompleteClan/constants"; } from "./autocompleteClan/constants";
export const tankNamesTechTreeOnly = fetchTankNames().then((names) => export const tankNamesTechTreeOnly = fetchTankNames().then((names) =>
names.filter((tank) => tank.treeType === TankType.RESEARCHABLE) names.filter((tank) => tank.treeType === TankType.TANK_TYPE_RESEARCHABLE),
); );
export async function autocompleteTanks( export async function autocompleteTanks(
interaction: AutocompleteInteraction<CacheType>, interaction: AutocompleteInteraction<CacheType>,
techTreeOnly = false, techTreeOnly = false,
fields = ["tank"] fields = ["tank"],
) { ) {
const { unwrap } = translator(interaction.locale); const { unwrap } = translator(interaction.locale);
const focusedOption = interaction.options.getFocused(true); const focusedOption = interaction.options.getFocused(true);
@@ -31,7 +31,7 @@ export async function autocompleteTanks(
go( go(
focusedOption.value, focusedOption.value,
await (techTreeOnly ? tankNamesTechTreeOnly : tankNames), await (techTreeOnly ? tankNamesTechTreeOnly : tankNames),
{ keys: SEARCH_KEYS, limit: 10 } { keys: SEARCH_KEYS, limit: 10 },
).map(async (item) => { ).map(async (item) => {
let name = unwrap(item.obj.searchableName); let name = unwrap(item.obj.searchableName);
@@ -42,7 +42,7 @@ export async function autocompleteTanks(
0, 0,
unwrap(item.obj.searchableName).length - unwrap(item.obj.searchableName).length -
overSize - overSize -
OVERFLOW_SUFFIX.length OVERFLOW_SUFFIX.length,
)}${OVERFLOW_SUFFIX}`; )}${OVERFLOW_SUFFIX}`;
} }
@@ -50,8 +50,8 @@ export async function autocompleteTanks(
name, name,
value: `${item.obj.id}`, value: `${item.obj.id}`,
} satisfies ApplicationCommandOptionChoiceData<string>; } satisfies ApplicationCommandOptionChoiceData<string>;
}) }),
) )
: [] : [],
); );
} }
-1
View File
@@ -19,7 +19,6 @@
"dotenv": "^17.2.2", "dotenv": "^17.2.2",
"fast-xml-parser": "^5.3.2", "fast-xml-parser": "^5.3.2",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"lz4js": "^0.2.0",
"pickleparser": "^0.2.1", "pickleparser": "^0.2.1",
"protobufjs": "^7.5.4", "protobufjs": "^7.5.4",
"three": "^0.180.0", "three": "^0.180.0",
+4 -2
View File
@@ -1,5 +1,7 @@
import { ShellDefinition, ShellType } from "../protos"; import { ShellDefinition, ShellType } from "../protos";
export function canSplash(type: ShellDefinition["type"]): type is ShellType.HE { export function canSplash(
return type === ShellType.HE; type: ShellDefinition["type"],
): type is ShellType.SHELL_TYPE_HE {
return type === ShellType.SHELL_TYPE_HE;
} }
+10 -10
View File
@@ -2,22 +2,22 @@ import { TankClass, TankType } from "../protos";
import type { BlitzStats } from "../statistics"; import type { BlitzStats } from "../statistics";
export const TANK_TYPES = [ export const TANK_TYPES = [
TankType.RESEARCHABLE, TankType.TANK_TYPE_RESEARCHABLE,
TankType.PREMIUM, TankType.TANK_TYPE_PREMIUM,
TankType.COLLECTOR, TankType.TANK_TYPE_COLLECTOR,
]; ];
export const TANK_TYPE_COMMAND_NAMES = { export const TANK_TYPE_COMMAND_NAMES = {
[TankType.RESEARCHABLE]: "researchable", [TankType.TANK_TYPE_RESEARCHABLE]: "researchable",
[TankType.PREMIUM]: "premium", [TankType.TANK_TYPE_PREMIUM]: "premium",
[TankType.COLLECTOR]: "collector", [TankType.TANK_TYPE_COLLECTOR]: "collector",
}; };
export const TANK_CLASSES = [ export const TANK_CLASSES = [
TankClass.LIGHT, TankClass.TANK_CLASS_LIGHT,
TankClass.MEDIUM, TankClass.TANK_CLASS_MEDIUM,
TankClass.HEAVY, TankClass.TANK_CLASS_HEAVY,
TankClass.TANK_DESTROYER, TankClass.TANK_CLASS_TANK_DESTROYER,
]; ];
export const emptyAllStats: BlitzStats = { export const emptyAllStats: BlitzStats = {
@@ -9,7 +9,7 @@ import {
export function checkConsumableProvisionInclusivity( export function checkConsumableProvisionInclusivity(
consumableProvision: Consumable | Provision, consumableProvision: Consumable | Provision,
tank: TankDefinition, tank: TankDefinition,
gun: GunDefinition gun: GunDefinition,
) { ) {
const included = consumableProvision.include?.every((rule) => { const included = consumableProvision.include?.every((rule) => {
switch (rule.filter_type!.$case) { switch (rule.filter_type!.$case) {
@@ -46,7 +46,7 @@ export function checkConsumableProvisionInclusivity(
case "categories": case "categories":
return rule.filter_type!.value.categories.some((category) => { return rule.filter_type!.value.categories.some((category) => {
switch (category) { switch (category) {
case ConsumableTankCategoryFilterCategory.CLIP: case ConsumableTankCategoryFilterCategory.CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP:
return gun.gun_type!.$case !== "regular"; return gun.gun_type!.$case !== "regular";
} }
}); });
+3 -3
View File
@@ -1,7 +1,7 @@
import { ShellDefinition, ShellType } from "../protos"; import { ShellDefinition, ShellType } from "../protos";
export function isExplosive( export function isExplosive(
type: ShellDefinition["type"] type: ShellDefinition["type"],
): type is ShellType.HEAT | ShellType.HE { ): type is ShellType.SHELL_TYPE_HEAT | ShellType.SHELL_TYPE_HE {
return type === ShellType.HEAT || type === ShellType.HE; return type === ShellType.SHELL_TYPE_HEAT || type === ShellType.SHELL_TYPE_HE;
} }
+7 -7
View File
@@ -2,27 +2,27 @@ import { TANK_CLASSES } from "../blitz/constants";
import { GameDefinitions, TankDefinition, TankType } from "../protos"; import { GameDefinitions, TankDefinition, TankType } from "../protos";
const treeTypeOrder = [ const treeTypeOrder = [
TankType.RESEARCHABLE, TankType.TANK_TYPE_RESEARCHABLE,
TankType.PREMIUM, TankType.TANK_TYPE_PREMIUM,
TankType.COLLECTOR, TankType.TANK_TYPE_COLLECTOR,
]; ];
export function metaSortTank( export function metaSortTank(
tanks: TankDefinition[], tanks: TankDefinition[],
gameDefinitions: GameDefinitions gameDefinitions: GameDefinitions,
) { ) {
return tanks return tanks
.sort((a, b) => b.tier - a.tier) .sort((a, b) => b.tier - a.tier)
.sort( .sort(
(a, b) => treeTypeOrder.indexOf(b.type) - treeTypeOrder.indexOf(a.type) (a, b) => treeTypeOrder.indexOf(b.type) - treeTypeOrder.indexOf(a.type),
) )
.sort( .sort(
(a, b) => TANK_CLASSES.indexOf(b.class) - TANK_CLASSES.indexOf(a.class) (a, b) => TANK_CLASSES.indexOf(b.class) - TANK_CLASSES.indexOf(a.class),
) )
.sort( .sort(
(a, b) => (a, b) =>
gameDefinitions.nations.indexOf(b.nation) - gameDefinitions.nations.indexOf(b.nation) -
gameDefinitions.nations.indexOf(a.nation) gameDefinitions.nations.indexOf(a.nation),
) )
.sort((a, b) => a.tier - b.tier); .sort((a, b) => a.tier - b.tier);
} }
@@ -2,8 +2,8 @@ import { BoundingBox, Vector3 } from "../protos";
export function normalizeBoundingBox(boundingBox: BoundingBox) { export function normalizeBoundingBox(boundingBox: BoundingBox) {
return { return {
x: boundingBox.max.x - boundingBox.min.x, x: boundingBox.max!.x - boundingBox.min!.x,
y: boundingBox.max.y - boundingBox.min.y, y: boundingBox.max!.y - boundingBox.min!.y,
z: boundingBox.max.z - boundingBox.min.z, z: boundingBox.max!.z - boundingBox.min!.z,
} satisfies Vector3; } satisfies Vector3;
} }
@@ -1,16 +1,21 @@
import { ShellType } from '../protos'; import { Equalizer, ShellType } from "../protos";
export function resolvePenetrationCoefficient( export function resolvePenetrationCoefficient(
calibratedShells: boolean, calibratedShells: boolean,
equalize: boolean,
type: ShellType, type: ShellType,
equalizerObj?: Equalizer,
) { ) {
if (!calibratedShells) return 1; const calibrated = calibratedShells
? type === ShellType.SHELL_TYPE_AP
? 1.08
: type === ShellType.SHELL_TYPE_APCR
? 1.05
: type === ShellType.SHELL_TYPE_HEAT
? 1.13
: 1.08
: 1;
const equalizer = (equalize ? equalizerObj?.penetration : undefined) ?? 1;
return type === ShellType.AP return calibrated * equalizer;
? 1.08
: type === ShellType.APCR
? 1.05
: type === ShellType.HEAT
? 1.13
: 1.08;
} }
@@ -1,74 +1,74 @@
import { times } from 'lodash-es'; import { times } from "lodash-es";
import { CrewType, ShellType, TankClass, TankType } from '../../protos'; import { CrewType, ShellType, TankClass, TankType } from "../../protos";
export const SHELL_NAMES: Record<ShellType, string> = { export const SHELL_NAMES: Record<ShellType, string> = {
[ShellType.AP]: 'AP', [ShellType.SHELL_TYPE_AP]: "AP",
[ShellType.APCR]: 'APCR', [ShellType.SHELL_TYPE_APCR]: "APCR",
[ShellType.HEAT]: 'HEAT', [ShellType.SHELL_TYPE_HEAT]: "HEAT",
[ShellType.HE]: 'HE', [ShellType.SHELL_TYPE_HE]: "HE",
}; };
export const CREW_MEMBER_NAMES = { export const CREW_MEMBER_NAMES = {
[CrewType.COMMANDER]: 'commander', [CrewType.CREW_TYPE_COMMANDER]: "commander",
[CrewType.DRIVER]: 'driver', [CrewType.CREW_TYPE_DRIVER]: "driver",
[CrewType.GUNNER]: 'gunner', [CrewType.CREW_TYPE_GUNNER]: "gunner",
[CrewType.LOADER]: 'loader', [CrewType.CREW_TYPE_LOADER]: "loader",
[CrewType.RADIOMAN]: 'radioman', [CrewType.CREW_TYPE_RADIOMAN]: "radioman",
} as const; } as const;
/** /**
* @deprecated use svg * @deprecated use svg
*/ */
export const TANK_ICONS: Record<TankClass, string> = { export const TANK_ICONS: Record<TankClass, string> = {
[TankClass.TANK_DESTROYER]: 'https://i.imgur.com/BIHSEH0.png', [TankClass.TANK_CLASS_TANK_DESTROYER]: "https://i.imgur.com/BIHSEH0.png",
[TankClass.LIGHT]: 'https://i.imgur.com/CSNha5V.png', [TankClass.TANK_CLASS_LIGHT]: "https://i.imgur.com/CSNha5V.png",
[TankClass.MEDIUM]: 'https://i.imgur.com/wvf3ltm.png', [TankClass.TANK_CLASS_MEDIUM]: "https://i.imgur.com/wvf3ltm.png",
[TankClass.HEAVY]: 'https://i.imgur.com/ECeqlZa.png', [TankClass.TANK_CLASS_HEAVY]: "https://i.imgur.com/ECeqlZa.png",
}; };
/** /**
* @deprecated use svg * @deprecated use svg
*/ */
export const TANK_ICONS_PREMIUM: Record<TankClass, string> = { export const TANK_ICONS_PREMIUM: Record<TankClass, string> = {
[TankClass.TANK_DESTROYER]: 'https://i.imgur.com/TCu3EdR.png', [TankClass.TANK_CLASS_TANK_DESTROYER]: "https://i.imgur.com/TCu3EdR.png",
[TankClass.LIGHT]: 'https://i.imgur.com/zdkpTRb.png', [TankClass.TANK_CLASS_LIGHT]: "https://i.imgur.com/zdkpTRb.png",
[TankClass.MEDIUM]: 'https://i.imgur.com/3z7eHX6.png', [TankClass.TANK_CLASS_MEDIUM]: "https://i.imgur.com/3z7eHX6.png",
[TankClass.HEAVY]: 'https://i.imgur.com/P3vbmyA.png', [TankClass.TANK_CLASS_HEAVY]: "https://i.imgur.com/P3vbmyA.png",
}; };
/** /**
* @deprecated use svg * @deprecated use svg
*/ */
export const TANK_ICONS_COLLECTOR: Record<TankClass, string> = { export const TANK_ICONS_COLLECTOR: Record<TankClass, string> = {
[TankClass.TANK_DESTROYER]: 'https://i.imgur.com/WTjeirB.png', [TankClass.TANK_CLASS_TANK_DESTROYER]: "https://i.imgur.com/WTjeirB.png",
[TankClass.LIGHT]: 'https://i.imgur.com/EwhtKkU.png', [TankClass.TANK_CLASS_LIGHT]: "https://i.imgur.com/EwhtKkU.png",
[TankClass.MEDIUM]: 'https://i.imgur.com/u8YDMBh.png', [TankClass.TANK_CLASS_MEDIUM]: "https://i.imgur.com/u8YDMBh.png",
[TankClass.HEAVY]: 'https://i.imgur.com/8xRf3nc.png', [TankClass.TANK_CLASS_HEAVY]: "https://i.imgur.com/8xRf3nc.png",
}; };
export const TIERS = times(10, (index) => index + 1); export const TIERS = times(10, (index) => index + 1);
export const TIER_ROMAN_NUMERALS: Record<number, string> = { export const TIER_ROMAN_NUMERALS: Record<number, string> = {
1: 'I', 1: "I",
2: 'II', 2: "II",
3: 'III', 3: "III",
4: 'IV', 4: "IV",
5: 'V', 5: "V",
6: 'VI', 6: "VI",
7: 'VII', 7: "VII",
8: 'VIII', 8: "VIII",
9: 'IX', 9: "IX",
10: 'X', 10: "X",
}; };
export const flags: Record<string, string> = { export const flags: Record<string, string> = {
ussr: '<:ussr:1218421042033197197>', ussr: "<:ussr:1218421042033197197>",
germany: '🇩🇪', germany: "🇩🇪",
usa: '🇺🇸', usa: "🇺🇸",
china: '🇨🇳', china: "🇨🇳",
uk: '🇬🇧', uk: "🇬🇧",
france: '🇫🇷', france: "🇫🇷",
japan: '🇯🇵', japan: "🇯🇵",
european: '🇪🇺', european: "🇪🇺",
other: '<:other:1218421572243558482>', other: "<:other:1218421572243558482>",
}; };
export const TREE_TYPE_ICONS: Record<TankType, Record<TankClass, string>> = { export const TREE_TYPE_ICONS: Record<TankType, Record<TankClass, string>> = {
[TankType.RESEARCHABLE]: TANK_ICONS, [TankType.TANK_TYPE_RESEARCHABLE]: TANK_ICONS,
[TankType.PREMIUM]: TANK_ICONS_PREMIUM, [TankType.TANK_TYPE_PREMIUM]: TANK_ICONS_PREMIUM,
[TankType.COLLECTOR]: TANK_ICONS_COLLECTOR, [TankType.TANK_TYPE_COLLECTOR]: TANK_ICONS_COLLECTOR,
}; };
+4 -4
View File
@@ -15,7 +15,7 @@ export async function fetchTankNames() {
tankDefinitionsArray.map(async (tank) => { tankDefinitionsArray.map(async (tank) => {
const searchableNameDeburr: I18nString = { locales: {} }; const searchableNameDeburr: I18nString = { locales: {} };
Object.entries(tank.name).forEach(([key, value]) => { Object.entries(tank.name!).forEach(([key, value]) => {
searchableNameDeburr.locales[key] = deburr(value); searchableNameDeburr.locales[key] = deburr(value);
}); });
@@ -28,8 +28,8 @@ export async function fetchTankNames() {
?.map((id) => ?.map((id) =>
locales.supported.map( locales.supported.map(
({ locale }) => ({ locale }) =>
camouflageDefinitions.camouflages[id]?.name.locales[locale] camouflageDefinitions.camouflages[id]?.name!.locales[locale],
) ),
) )
.flat() .flat()
.filter(Boolean) .filter(Boolean)
@@ -37,7 +37,7 @@ export async function fetchTankNames() {
.join(" "), .join(" "),
treeType: tank.type, treeType: tank.type,
}; };
}) }),
); );
} }
@@ -3,14 +3,14 @@ import { BoundingBox } from "../protos";
export function unionBoundingBox(a: BoundingBox, b: BoundingBox) { export function unionBoundingBox(a: BoundingBox, b: BoundingBox) {
return { return {
min: { min: {
x: Math.min(a.min.x, b.min.x), x: Math.min(a.min!.x, b.min!.x),
y: Math.min(a.min.y, b.min.y), y: Math.min(a.min!.y, b.min!.y),
z: Math.min(a.min.z, b.min.z), z: Math.min(a.min!.z, b.min!.z),
}, },
max: { max: {
x: Math.max(a.max.x, b.max.x), x: Math.max(a.max!.x, b.max!.x),
y: Math.max(a.max.y, b.max.y), y: Math.max(a.max!.y, b.max!.y),
z: Math.max(a.max.z, b.max.z), z: Math.max(a.max!.z, b.max!.z),
}, },
} satisfies BoundingBox; } satisfies BoundingBox;
} }
@@ -4,44 +4,44 @@ package blitzkit;
message AverageDefinitions { message AverageDefinitions {
map<uint32, AverageDefinitionsEntry> averages = 1; map<uint32, AverageDefinitionsEntry> averages = 1;
required Samples samples = 2; required Samples samples = 2;
required uint64 time = 3; required uint64 time = 3;
} }
message AverageDefinitionsEntry { message AverageDefinitionsEntry {
required AverageDefinitionsAllStats mu = 1; required AverageDefinitionsAllStats mu = 1;
required AverageDefinitionsAllStats sigma = 2; required AverageDefinitionsAllStats sigma = 2;
required AverageDefinitionsAllStats r = 3; required AverageDefinitionsAllStats r = 3;
required Samples samples = 4; required Samples samples = 4;
} }
message AverageDefinitionsAllStats { message AverageDefinitionsAllStats {
required float battles = 1; required float battles = 1;
required float capture_points = 2; required float capture_points = 2;
required float damage_dealt = 3; required float damage_dealt = 3;
required float damage_received = 4; required float damage_received = 4;
required float dropped_capture_points = 5; required float dropped_capture_points = 5;
required float frags = 6; required float frags = 6;
required float frags8p = 7; required float frags8p = 7;
required float hits = 8; required float hits = 8;
required float losses = 9; required float losses = 9;
required float max_frags = 10; required float max_frags = 10;
required float max_xp = 11; required float max_xp = 11;
required float shots = 12; required float shots = 12;
required float spotted = 13; required float spotted = 13;
required float survived_battles = 14; required float survived_battles = 14;
required float win_and_survived = 15; required float win_and_survived = 15;
required float wins = 16; required float wins = 16;
required float xp = 17; required float xp = 17;
required float battle_life_time = 18; required float battle_life_time = 18;
} }
message Samples { message Samples {
required uint32 d_1 = 1; required uint32 d_1 = 1;
required uint32 d_7 = 2; required uint32 d_7 = 2;
required uint32 d_30 = 3; required uint32 d_30 = 3;
required uint32 d_60 = 4; required uint32 d_60 = 4;
required uint32 d_90 = 5; required uint32 d_90 = 5;
required uint32 d_120 = 6; required uint32 d_120 = 6;
required uint32 total = 7; required uint32 total = 7;
} }
+127 -107
View File
@@ -1,8 +1,8 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/average_definitions.proto // source: average_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -11,7 +11,7 @@ export const protobufPackage = "blitzkit";
export interface AverageDefinitions { export interface AverageDefinitions {
averages: { [key: number]: AverageDefinitionsEntry }; averages: { [key: number]: AverageDefinitionsEntry };
samples: Samples; samples: Samples | undefined;
time: number; time: number;
} }
@@ -21,10 +21,10 @@ export interface AverageDefinitions_AveragesEntry {
} }
export interface AverageDefinitionsEntry { export interface AverageDefinitionsEntry {
mu: AverageDefinitionsAllStats; mu: AverageDefinitionsAllStats | undefined;
sigma: AverageDefinitionsAllStats; sigma: AverageDefinitionsAllStats | undefined;
r: AverageDefinitionsAllStats; r: AverageDefinitionsAllStats | undefined;
samples: Samples; samples: Samples | undefined;
} }
export interface AverageDefinitionsAllStats { export interface AverageDefinitionsAllStats {
@@ -58,13 +58,13 @@ export interface Samples {
total: number; total: number;
} }
export function createBaseAverageDefinitions(): AverageDefinitions { function createBaseAverageDefinitions(): AverageDefinitions {
return { averages: {}, samples: createBaseSamples(), time: 0 }; return { averages: {}, samples: undefined, time: 0 };
} }
export const AverageDefinitions: MessageFns<AverageDefinitions> = { export const AverageDefinitions: MessageFns<AverageDefinitions> = {
encode(message: AverageDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: AverageDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.averages).forEach(([key, value]) => { globalThis.Object.entries(message.averages).forEach(([key, value]: [string, AverageDefinitionsEntry]) => {
AverageDefinitions_AveragesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); AverageDefinitions_AveragesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
}); });
if (message.samples !== undefined) { if (message.samples !== undefined) {
@@ -78,7 +78,7 @@ export const AverageDefinitions: MessageFns<AverageDefinitions> = {
decode(input: BinaryReader | Uint8Array, length?: number): AverageDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): AverageDefinitions {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAverageDefinitions(); const message = createBaseAverageDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -122,20 +122,23 @@ export const AverageDefinitions: MessageFns<AverageDefinitions> = {
fromJSON(object: any): AverageDefinitions { fromJSON(object: any): AverageDefinitions {
return { return {
averages: isObject(object.averages) averages: isObject(object.averages)
? Object.entries(object.averages).reduce<{ [key: number]: AverageDefinitionsEntry }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.averages) as [string, any][]).reduce(
acc[globalThis.Number(key)] = AverageDefinitionsEntry.fromJSON(value); (acc: { [key: number]: AverageDefinitionsEntry }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = AverageDefinitionsEntry.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
samples: Samples.fromJSON(assertSet("AverageDefinitions.samples", object.samples)), samples: isSet(object.samples) ? Samples.fromJSON(object.samples) : undefined,
time: globalThis.Number(assertSet("AverageDefinitions.time", object.time)), time: isSet(object.time) ? globalThis.Number(object.time) : 0,
}; };
}, },
toJSON(message: AverageDefinitions): unknown { toJSON(message: AverageDefinitions): unknown {
const obj: any = {}; const obj: any = {};
if (message.averages) { if (message.averages) {
const entries = Object.entries(message.averages); const entries = globalThis.Object.entries(message.averages) as [string, AverageDefinitionsEntry][];
if (entries.length > 0) { if (entries.length > 0) {
obj.averages = {}; obj.averages = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -157,8 +160,8 @@ export const AverageDefinitions: MessageFns<AverageDefinitions> = {
}, },
fromPartial<I extends Exact<DeepPartial<AverageDefinitions>, I>>(object: I): AverageDefinitions { fromPartial<I extends Exact<DeepPartial<AverageDefinitions>, I>>(object: I): AverageDefinitions {
const message = createBaseAverageDefinitions(); const message = createBaseAverageDefinitions();
message.averages = Object.entries(object.averages ?? {}).reduce<{ [key: number]: AverageDefinitionsEntry }>( message.averages = (globalThis.Object.entries(object.averages ?? {}) as [string, AverageDefinitionsEntry][]).reduce(
(acc, [key, value]) => { (acc: { [key: number]: AverageDefinitionsEntry }, [key, value]: [string, AverageDefinitionsEntry]) => {
if (value !== undefined) { if (value !== undefined) {
acc[globalThis.Number(key)] = AverageDefinitionsEntry.fromPartial(value); acc[globalThis.Number(key)] = AverageDefinitionsEntry.fromPartial(value);
} }
@@ -168,19 +171,19 @@ export const AverageDefinitions: MessageFns<AverageDefinitions> = {
); );
message.samples = (object.samples !== undefined && object.samples !== null) message.samples = (object.samples !== undefined && object.samples !== null)
? Samples.fromPartial(object.samples) ? Samples.fromPartial(object.samples)
: createBaseSamples(); : undefined;
message.time = object.time ?? 0; message.time = object.time ?? 0;
return message; return message;
}, },
}; };
export function createBaseAverageDefinitions_AveragesEntry(): AverageDefinitions_AveragesEntry { function createBaseAverageDefinitions_AveragesEntry(): AverageDefinitions_AveragesEntry {
return { key: 0, value: createBaseAverageDefinitionsEntry() }; return { key: 0, value: undefined };
} }
export const AverageDefinitions_AveragesEntry: MessageFns<AverageDefinitions_AveragesEntry> = { export const AverageDefinitions_AveragesEntry: MessageFns<AverageDefinitions_AveragesEntry> = {
encode(message: AverageDefinitions_AveragesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: AverageDefinitions_AveragesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).uint32(message.key); writer.uint32(8).uint32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -191,7 +194,7 @@ export const AverageDefinitions_AveragesEntry: MessageFns<AverageDefinitions_Ave
decode(input: BinaryReader | Uint8Array, length?: number): AverageDefinitions_AveragesEntry { decode(input: BinaryReader | Uint8Array, length?: number): AverageDefinitions_AveragesEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAverageDefinitions_AveragesEntry(); const message = createBaseAverageDefinitions_AveragesEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -223,14 +226,14 @@ export const AverageDefinitions_AveragesEntry: MessageFns<AverageDefinitions_Ave
fromJSON(object: any): AverageDefinitions_AveragesEntry { fromJSON(object: any): AverageDefinitions_AveragesEntry {
return { return {
key: globalThis.Number(assertSet("AverageDefinitions_AveragesEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: AverageDefinitionsEntry.fromJSON(assertSet("AverageDefinitions_AveragesEntry.value", object.value)), value: isSet(object.value) ? AverageDefinitionsEntry.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: AverageDefinitions_AveragesEntry): unknown { toJSON(message: AverageDefinitions_AveragesEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -251,18 +254,13 @@ export const AverageDefinitions_AveragesEntry: MessageFns<AverageDefinitions_Ave
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? AverageDefinitionsEntry.fromPartial(object.value) ? AverageDefinitionsEntry.fromPartial(object.value)
: createBaseAverageDefinitionsEntry(); : undefined;
return message; return message;
}, },
}; };
export function createBaseAverageDefinitionsEntry(): AverageDefinitionsEntry { function createBaseAverageDefinitionsEntry(): AverageDefinitionsEntry {
return { return { mu: undefined, sigma: undefined, r: undefined, samples: undefined };
mu: createBaseAverageDefinitionsAllStats(),
sigma: createBaseAverageDefinitionsAllStats(),
r: createBaseAverageDefinitionsAllStats(),
samples: createBaseSamples(),
};
} }
export const AverageDefinitionsEntry: MessageFns<AverageDefinitionsEntry> = { export const AverageDefinitionsEntry: MessageFns<AverageDefinitionsEntry> = {
@@ -284,7 +282,7 @@ export const AverageDefinitionsEntry: MessageFns<AverageDefinitionsEntry> = {
decode(input: BinaryReader | Uint8Array, length?: number): AverageDefinitionsEntry { decode(input: BinaryReader | Uint8Array, length?: number): AverageDefinitionsEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAverageDefinitionsEntry(); const message = createBaseAverageDefinitionsEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -332,10 +330,10 @@ export const AverageDefinitionsEntry: MessageFns<AverageDefinitionsEntry> = {
fromJSON(object: any): AverageDefinitionsEntry { fromJSON(object: any): AverageDefinitionsEntry {
return { return {
mu: AverageDefinitionsAllStats.fromJSON(assertSet("AverageDefinitionsEntry.mu", object.mu)), mu: isSet(object.mu) ? AverageDefinitionsAllStats.fromJSON(object.mu) : undefined,
sigma: AverageDefinitionsAllStats.fromJSON(assertSet("AverageDefinitionsEntry.sigma", object.sigma)), sigma: isSet(object.sigma) ? AverageDefinitionsAllStats.fromJSON(object.sigma) : undefined,
r: AverageDefinitionsAllStats.fromJSON(assertSet("AverageDefinitionsEntry.r", object.r)), r: isSet(object.r) ? AverageDefinitionsAllStats.fromJSON(object.r) : undefined,
samples: Samples.fromJSON(assertSet("AverageDefinitionsEntry.samples", object.samples)), samples: isSet(object.samples) ? Samples.fromJSON(object.samples) : undefined,
}; };
}, },
@@ -363,21 +361,21 @@ export const AverageDefinitionsEntry: MessageFns<AverageDefinitionsEntry> = {
const message = createBaseAverageDefinitionsEntry(); const message = createBaseAverageDefinitionsEntry();
message.mu = (object.mu !== undefined && object.mu !== null) message.mu = (object.mu !== undefined && object.mu !== null)
? AverageDefinitionsAllStats.fromPartial(object.mu) ? AverageDefinitionsAllStats.fromPartial(object.mu)
: createBaseAverageDefinitionsAllStats(); : undefined;
message.sigma = (object.sigma !== undefined && object.sigma !== null) message.sigma = (object.sigma !== undefined && object.sigma !== null)
? AverageDefinitionsAllStats.fromPartial(object.sigma) ? AverageDefinitionsAllStats.fromPartial(object.sigma)
: createBaseAverageDefinitionsAllStats(); : undefined;
message.r = (object.r !== undefined && object.r !== null) message.r = (object.r !== undefined && object.r !== null)
? AverageDefinitionsAllStats.fromPartial(object.r) ? AverageDefinitionsAllStats.fromPartial(object.r)
: createBaseAverageDefinitionsAllStats(); : undefined;
message.samples = (object.samples !== undefined && object.samples !== null) message.samples = (object.samples !== undefined && object.samples !== null)
? Samples.fromPartial(object.samples) ? Samples.fromPartial(object.samples)
: createBaseSamples(); : undefined;
return message; return message;
}, },
}; };
export function createBaseAverageDefinitionsAllStats(): AverageDefinitionsAllStats { function createBaseAverageDefinitionsAllStats(): AverageDefinitionsAllStats {
return { return {
battles: 0, battles: 0,
capture_points: 0, capture_points: 0,
@@ -461,7 +459,7 @@ export const AverageDefinitionsAllStats: MessageFns<AverageDefinitionsAllStats>
decode(input: BinaryReader | Uint8Array, length?: number): AverageDefinitionsAllStats { decode(input: BinaryReader | Uint8Array, length?: number): AverageDefinitionsAllStats {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAverageDefinitionsAllStats(); const message = createBaseAverageDefinitionsAllStats();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -621,34 +619,60 @@ export const AverageDefinitionsAllStats: MessageFns<AverageDefinitionsAllStats>
fromJSON(object: any): AverageDefinitionsAllStats { fromJSON(object: any): AverageDefinitionsAllStats {
return { return {
battles: globalThis.Number(assertSet("AverageDefinitionsAllStats.battles", object.battles)), battles: isSet(object.battles) ? globalThis.Number(object.battles) : 0,
capture_points: globalThis.Number(assertSet("AverageDefinitionsAllStats.capture_points", object.capture_points)), capture_points: isSet(object.capturePoints)
damage_dealt: globalThis.Number(assertSet("AverageDefinitionsAllStats.damage_dealt", object.damage_dealt)), ? globalThis.Number(object.capturePoints)
damage_received: globalThis.Number( : isSet(object.capture_points)
assertSet("AverageDefinitionsAllStats.damage_received", object.damage_received), ? globalThis.Number(object.capture_points)
), : 0,
dropped_capture_points: globalThis.Number( damage_dealt: isSet(object.damageDealt)
assertSet("AverageDefinitionsAllStats.dropped_capture_points", object.dropped_capture_points), ? globalThis.Number(object.damageDealt)
), : isSet(object.damage_dealt)
frags: globalThis.Number(assertSet("AverageDefinitionsAllStats.frags", object.frags)), ? globalThis.Number(object.damage_dealt)
frags8p: globalThis.Number(assertSet("AverageDefinitionsAllStats.frags8p", object.frags8p)), : 0,
hits: globalThis.Number(assertSet("AverageDefinitionsAllStats.hits", object.hits)), damage_received: isSet(object.damageReceived)
losses: globalThis.Number(assertSet("AverageDefinitionsAllStats.losses", object.losses)), ? globalThis.Number(object.damageReceived)
max_frags: globalThis.Number(assertSet("AverageDefinitionsAllStats.max_frags", object.max_frags)), : isSet(object.damage_received)
max_xp: globalThis.Number(assertSet("AverageDefinitionsAllStats.max_xp", object.max_xp)), ? globalThis.Number(object.damage_received)
shots: globalThis.Number(assertSet("AverageDefinitionsAllStats.shots", object.shots)), : 0,
spotted: globalThis.Number(assertSet("AverageDefinitionsAllStats.spotted", object.spotted)), dropped_capture_points: isSet(object.droppedCapturePoints)
survived_battles: globalThis.Number( ? globalThis.Number(object.droppedCapturePoints)
assertSet("AverageDefinitionsAllStats.survived_battles", object.survived_battles), : isSet(object.dropped_capture_points)
), ? globalThis.Number(object.dropped_capture_points)
win_and_survived: globalThis.Number( : 0,
assertSet("AverageDefinitionsAllStats.win_and_survived", object.win_and_survived), frags: isSet(object.frags) ? globalThis.Number(object.frags) : 0,
), frags8p: isSet(object.frags8p) ? globalThis.Number(object.frags8p) : 0,
wins: globalThis.Number(assertSet("AverageDefinitionsAllStats.wins", object.wins)), hits: isSet(object.hits) ? globalThis.Number(object.hits) : 0,
xp: globalThis.Number(assertSet("AverageDefinitionsAllStats.xp", object.xp)), losses: isSet(object.losses) ? globalThis.Number(object.losses) : 0,
battle_life_time: globalThis.Number( max_frags: isSet(object.maxFrags)
assertSet("AverageDefinitionsAllStats.battle_life_time", object.battle_life_time), ? globalThis.Number(object.maxFrags)
), : isSet(object.max_frags)
? globalThis.Number(object.max_frags)
: 0,
max_xp: isSet(object.maxXp)
? globalThis.Number(object.maxXp)
: isSet(object.max_xp)
? globalThis.Number(object.max_xp)
: 0,
shots: isSet(object.shots) ? globalThis.Number(object.shots) : 0,
spotted: isSet(object.spotted) ? globalThis.Number(object.spotted) : 0,
survived_battles: isSet(object.survivedBattles)
? globalThis.Number(object.survivedBattles)
: isSet(object.survived_battles)
? globalThis.Number(object.survived_battles)
: 0,
win_and_survived: isSet(object.winAndSurvived)
? globalThis.Number(object.winAndSurvived)
: isSet(object.win_and_survived)
? globalThis.Number(object.win_and_survived)
: 0,
wins: isSet(object.wins) ? globalThis.Number(object.wins) : 0,
xp: isSet(object.xp) ? globalThis.Number(object.xp) : 0,
battle_life_time: isSet(object.battleLifeTime)
? globalThis.Number(object.battleLifeTime)
: isSet(object.battle_life_time)
? globalThis.Number(object.battle_life_time)
: 0,
}; };
}, },
@@ -658,16 +682,16 @@ export const AverageDefinitionsAllStats: MessageFns<AverageDefinitionsAllStats>
obj.battles = message.battles; obj.battles = message.battles;
} }
if (message.capture_points !== 0) { if (message.capture_points !== 0) {
obj.capture_points = message.capture_points; obj.capturePoints = message.capture_points;
} }
if (message.damage_dealt !== 0) { if (message.damage_dealt !== 0) {
obj.damage_dealt = message.damage_dealt; obj.damageDealt = message.damage_dealt;
} }
if (message.damage_received !== 0) { if (message.damage_received !== 0) {
obj.damage_received = message.damage_received; obj.damageReceived = message.damage_received;
} }
if (message.dropped_capture_points !== 0) { if (message.dropped_capture_points !== 0) {
obj.dropped_capture_points = message.dropped_capture_points; obj.droppedCapturePoints = message.dropped_capture_points;
} }
if (message.frags !== 0) { if (message.frags !== 0) {
obj.frags = message.frags; obj.frags = message.frags;
@@ -682,10 +706,10 @@ export const AverageDefinitionsAllStats: MessageFns<AverageDefinitionsAllStats>
obj.losses = message.losses; obj.losses = message.losses;
} }
if (message.max_frags !== 0) { if (message.max_frags !== 0) {
obj.max_frags = message.max_frags; obj.maxFrags = message.max_frags;
} }
if (message.max_xp !== 0) { if (message.max_xp !== 0) {
obj.max_xp = message.max_xp; obj.maxXp = message.max_xp;
} }
if (message.shots !== 0) { if (message.shots !== 0) {
obj.shots = message.shots; obj.shots = message.shots;
@@ -694,10 +718,10 @@ export const AverageDefinitionsAllStats: MessageFns<AverageDefinitionsAllStats>
obj.spotted = message.spotted; obj.spotted = message.spotted;
} }
if (message.survived_battles !== 0) { if (message.survived_battles !== 0) {
obj.survived_battles = message.survived_battles; obj.survivedBattles = message.survived_battles;
} }
if (message.win_and_survived !== 0) { if (message.win_and_survived !== 0) {
obj.win_and_survived = message.win_and_survived; obj.winAndSurvived = message.win_and_survived;
} }
if (message.wins !== 0) { if (message.wins !== 0) {
obj.wins = message.wins; obj.wins = message.wins;
@@ -706,7 +730,7 @@ export const AverageDefinitionsAllStats: MessageFns<AverageDefinitionsAllStats>
obj.xp = message.xp; obj.xp = message.xp;
} }
if (message.battle_life_time !== 0) { if (message.battle_life_time !== 0) {
obj.battle_life_time = message.battle_life_time; obj.battleLifeTime = message.battle_life_time;
} }
return obj; return obj;
}, },
@@ -738,7 +762,7 @@ export const AverageDefinitionsAllStats: MessageFns<AverageDefinitionsAllStats>
}, },
}; };
export function createBaseSamples(): Samples { function createBaseSamples(): Samples {
return { d_1: 0, d_7: 0, d_30: 0, d_60: 0, d_90: 0, d_120: 0, total: 0 }; return { d_1: 0, d_7: 0, d_30: 0, d_60: 0, d_90: 0, d_120: 0, total: 0 };
} }
@@ -770,7 +794,7 @@ export const Samples: MessageFns<Samples> = {
decode(input: BinaryReader | Uint8Array, length?: number): Samples { decode(input: BinaryReader | Uint8Array, length?: number): Samples {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSamples(); const message = createBaseSamples();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -842,35 +866,39 @@ export const Samples: MessageFns<Samples> = {
fromJSON(object: any): Samples { fromJSON(object: any): Samples {
return { return {
d_1: globalThis.Number(assertSet("Samples.d_1", object.d_1)), d_1: isSet(object.d1) ? globalThis.Number(object.d1) : isSet(object.d_1) ? globalThis.Number(object.d_1) : 0,
d_7: globalThis.Number(assertSet("Samples.d_7", object.d_7)), d_7: isSet(object.d7) ? globalThis.Number(object.d7) : isSet(object.d_7) ? globalThis.Number(object.d_7) : 0,
d_30: globalThis.Number(assertSet("Samples.d_30", object.d_30)), d_30: isSet(object.d30) ? globalThis.Number(object.d30) : isSet(object.d_30) ? globalThis.Number(object.d_30) : 0,
d_60: globalThis.Number(assertSet("Samples.d_60", object.d_60)), d_60: isSet(object.d60) ? globalThis.Number(object.d60) : isSet(object.d_60) ? globalThis.Number(object.d_60) : 0,
d_90: globalThis.Number(assertSet("Samples.d_90", object.d_90)), d_90: isSet(object.d90) ? globalThis.Number(object.d90) : isSet(object.d_90) ? globalThis.Number(object.d_90) : 0,
d_120: globalThis.Number(assertSet("Samples.d_120", object.d_120)), d_120: isSet(object.d120)
total: globalThis.Number(assertSet("Samples.total", object.total)), ? globalThis.Number(object.d120)
: isSet(object.d_120)
? globalThis.Number(object.d_120)
: 0,
total: isSet(object.total) ? globalThis.Number(object.total) : 0,
}; };
}, },
toJSON(message: Samples): unknown { toJSON(message: Samples): unknown {
const obj: any = {}; const obj: any = {};
if (message.d_1 !== 0) { if (message.d_1 !== 0) {
obj.d_1 = Math.round(message.d_1); obj.d1 = Math.round(message.d_1);
} }
if (message.d_7 !== 0) { if (message.d_7 !== 0) {
obj.d_7 = Math.round(message.d_7); obj.d7 = Math.round(message.d_7);
} }
if (message.d_30 !== 0) { if (message.d_30 !== 0) {
obj.d_30 = Math.round(message.d_30); obj.d30 = Math.round(message.d_30);
} }
if (message.d_60 !== 0) { if (message.d_60 !== 0) {
obj.d_60 = Math.round(message.d_60); obj.d60 = Math.round(message.d_60);
} }
if (message.d_90 !== 0) { if (message.d_90 !== 0) {
obj.d_90 = Math.round(message.d_90); obj.d90 = Math.round(message.d_90);
} }
if (message.d_120 !== 0) { if (message.d_120 !== 0) {
obj.d_120 = Math.round(message.d_120); obj.d120 = Math.round(message.d_120);
} }
if (message.total !== 0) { if (message.total !== 0) {
obj.total = Math.round(message.total); obj.total = Math.round(message.total);
@@ -926,14 +954,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
@@ -2,15 +2,15 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "i18n.proto";
message CamouflageDefinitions { message CamouflageDefinitions {
map<uint32, Camouflage> camouflages = 1; map<uint32, Camouflage> camouflages = 1;
} }
message Camouflage { message Camouflage {
required uint32 id = 1; required uint32 id = 1;
required I18nString name = 2; required I18nString name = 2;
optional I18nString tank_name = 3; optional I18nString tank_name = 3;
optional I18nString tank_name_full = 4; optional I18nString tank_name_full = 4;
} }
+140 -209
View File
@@ -1,14 +1,14 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/camouflage_definitions.proto // source: camouflage_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire'; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { createBaseI18nString, I18nString } from './i18n'; import { I18nString } from "./i18n";
export const protobufPackage = 'blitzkit'; export const protobufPackage = "blitzkit";
export interface CamouflageDefinitions { export interface CamouflageDefinitions {
camouflages: { [key: number]: Camouflage }; camouflages: { [key: number]: Camouflage };
@@ -21,36 +21,26 @@ export interface CamouflageDefinitions_CamouflagesEntry {
export interface Camouflage { export interface Camouflage {
id: number; id: number;
name: I18nString; name: I18nString | undefined;
tank_name?: I18nString; tank_name?: I18nString | undefined;
tank_name_full?: I18nString; tank_name_full?: I18nString | undefined;
} }
export function createBaseCamouflageDefinitions(): CamouflageDefinitions { function createBaseCamouflageDefinitions(): CamouflageDefinitions {
return { camouflages: {} }; return { camouflages: {} };
} }
export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = { export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = {
encode( encode(message: CamouflageDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
message: CamouflageDefinitions, globalThis.Object.entries(message.camouflages).forEach(([key, value]: [string, Camouflage]) => {
writer: BinaryWriter = new BinaryWriter(), CamouflageDefinitions_CamouflagesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
): BinaryWriter {
Object.entries(message.camouflages).forEach(([key, value]) => {
CamouflageDefinitions_CamouflagesEntry.encode(
{ key: key as any, value },
writer.uint32(10).fork(),
).join();
}); });
return writer; return writer;
}, },
decode( decode(input: BinaryReader | Uint8Array, length?: number): CamouflageDefinitions {
input: BinaryReader | Uint8Array, const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
length?: number, const end = length === undefined ? reader.len : reader.pos + length;
): CamouflageDefinitions {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCamouflageDefinitions(); const message = createBaseCamouflageDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -60,10 +50,7 @@ export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = {
break; break;
} }
const entry1 = CamouflageDefinitions_CamouflagesEntry.decode( const entry1 = CamouflageDefinitions_CamouflagesEntry.decode(reader, reader.uint32());
reader,
reader.uint32(),
);
if (entry1.value !== undefined) { if (entry1.value !== undefined) {
message.camouflages[entry1.key] = entry1.value; message.camouflages[entry1.key] = entry1.value;
} }
@@ -81,12 +68,13 @@ export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = {
fromJSON(object: any): CamouflageDefinitions { fromJSON(object: any): CamouflageDefinitions {
return { return {
camouflages: isObject(object.camouflages) camouflages: isObject(object.camouflages)
? Object.entries(object.camouflages).reduce<{ ? (globalThis.Object.entries(object.camouflages) as [string, any][]).reduce(
[key: number]: Camouflage; (acc: { [key: number]: Camouflage }, [key, value]: [string, any]) => {
}>((acc, [key, value]) => {
acc[globalThis.Number(key)] = Camouflage.fromJSON(value); acc[globalThis.Number(key)] = Camouflage.fromJSON(value);
return acc; return acc;
}, {}) },
{},
)
: {}, : {},
}; };
}, },
@@ -94,7 +82,7 @@ export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = {
toJSON(message: CamouflageDefinitions): unknown { toJSON(message: CamouflageDefinitions): unknown {
const obj: any = {}; const obj: any = {};
if (message.camouflages) { if (message.camouflages) {
const entries = Object.entries(message.camouflages); const entries = globalThis.Object.entries(message.camouflages) as [string, Camouflage][];
if (entries.length > 0) { if (entries.length > 0) {
obj.camouflages = {}; obj.camouflages = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -105,141 +93,112 @@ export const CamouflageDefinitions: MessageFns<CamouflageDefinitions> = {
return obj; return obj;
}, },
create<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>( create<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>(base?: I): CamouflageDefinitions {
base?: I,
): CamouflageDefinitions {
return CamouflageDefinitions.fromPartial(base ?? ({} as any)); return CamouflageDefinitions.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>( fromPartial<I extends Exact<DeepPartial<CamouflageDefinitions>, I>>(object: I): CamouflageDefinitions {
object: I,
): CamouflageDefinitions {
const message = createBaseCamouflageDefinitions(); const message = createBaseCamouflageDefinitions();
message.camouflages = Object.entries(object.camouflages ?? {}).reduce<{ message.camouflages = (globalThis.Object.entries(object.camouflages ?? {}) as [string, Camouflage][]).reduce(
[key: number]: Camouflage; (acc: { [key: number]: Camouflage }, [key, value]: [string, Camouflage]) => {
}>((acc, [key, value]) => { if (value !== undefined) {
if (value !== undefined) { acc[globalThis.Number(key)] = Camouflage.fromPartial(value);
acc[globalThis.Number(key)] = Camouflage.fromPartial(value); }
} return acc;
return acc; },
}, {}); {},
);
return message; return message;
}, },
}; };
export function createBaseCamouflageDefinitions_CamouflagesEntry(): CamouflageDefinitions_CamouflagesEntry { function createBaseCamouflageDefinitions_CamouflagesEntry(): CamouflageDefinitions_CamouflagesEntry {
return { key: 0, value: createBaseCamouflage() }; return { key: 0, value: undefined };
} }
export const CamouflageDefinitions_CamouflagesEntry: MessageFns<CamouflageDefinitions_CamouflagesEntry> = export const CamouflageDefinitions_CamouflagesEntry: MessageFns<CamouflageDefinitions_CamouflagesEntry> = {
{ encode(message: CamouflageDefinitions_CamouflagesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
encode( if (message.key !== 0) {
message: CamouflageDefinitions_CamouflagesEntry, writer.uint32(8).uint32(message.key);
writer: BinaryWriter = new BinaryWriter(), }
): BinaryWriter { if (message.value !== undefined) {
if (message.key !== undefined) { Camouflage.encode(message.value, writer.uint32(18).fork()).join();
writer.uint32(8).uint32(message.key); }
} return writer;
if (message.value !== undefined) { },
Camouflage.encode(message.value, writer.uint32(18).fork()).join();
}
return writer;
},
decode( decode(input: BinaryReader | Uint8Array, length?: number): CamouflageDefinitions_CamouflagesEntry {
input: BinaryReader | Uint8Array, const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
length?: number, const end = length === undefined ? reader.len : reader.pos + length;
): CamouflageDefinitions_CamouflagesEntry { const message = createBaseCamouflageDefinitions_CamouflagesEntry();
const reader = while (reader.pos < end) {
input instanceof BinaryReader ? input : new BinaryReader(input); const tag = reader.uint32();
let end = length === undefined ? reader.len : reader.pos + length; switch (tag >>> 3) {
const message = createBaseCamouflageDefinitions_CamouflagesEntry(); case 1: {
while (reader.pos < end) { if (tag !== 8) {
const tag = reader.uint32(); break;
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()); message.key = reader.uint32();
continue; continue;
}
case 2: {
if (tag !== 18) {
break;
} }
message.value = Camouflage.decode(reader, reader.uint32());
continue;
} }
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
} }
return message; if ((tag & 7) === 4 || tag === 0) {
}, break;
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) { reader.skip(tag & 7);
obj.value = Camouflage.toJSON(message.value); }
} return message;
return obj; },
},
create< fromJSON(object: any): CamouflageDefinitions_CamouflagesEntry {
I extends Exact<DeepPartial<CamouflageDefinitions_CamouflagesEntry>, I>, return {
>(base?: I): CamouflageDefinitions_CamouflagesEntry { key: isSet(object.key) ? globalThis.Number(object.key) : 0,
return CamouflageDefinitions_CamouflagesEntry.fromPartial( value: isSet(object.value) ? Camouflage.fromJSON(object.value) : undefined,
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 { toJSON(message: CamouflageDefinitions_CamouflagesEntry): unknown {
return { const obj: any = {};
id: 0, if (message.key !== 0) {
name: createBaseI18nString(), obj.key = Math.round(message.key);
tank_name: undefined, }
tank_name_full: undefined, if (message.value !== undefined) {
}; obj.value = Camouflage.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<CamouflageDefinitions_CamouflagesEntry>, I>>(
base?: I,
): CamouflageDefinitions_CamouflagesEntry {
return CamouflageDefinitions_CamouflagesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<CamouflageDefinitions_CamouflagesEntry>, I>>(
object: I,
): CamouflageDefinitions_CamouflagesEntry {
const message = createBaseCamouflageDefinitions_CamouflagesEntry();
message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null)
? Camouflage.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseCamouflage(): Camouflage {
return { id: 0, name: undefined, tank_name: undefined, tank_name_full: undefined };
} }
export const Camouflage: MessageFns<Camouflage> = { export const Camouflage: MessageFns<Camouflage> = {
encode( encode(message: Camouflage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
message: Camouflage,
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).uint32(message.id); writer.uint32(8).uint32(message.id);
} }
@@ -250,18 +209,14 @@ export const Camouflage: MessageFns<Camouflage> = {
I18nString.encode(message.tank_name, writer.uint32(26).fork()).join(); I18nString.encode(message.tank_name, writer.uint32(26).fork()).join();
} }
if (message.tank_name_full !== undefined) { if (message.tank_name_full !== undefined) {
I18nString.encode( I18nString.encode(message.tank_name_full, writer.uint32(34).fork()).join();
message.tank_name_full,
writer.uint32(34).fork(),
).join();
} }
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): Camouflage { decode(input: BinaryReader | Uint8Array, length?: number): Camouflage {
const reader = const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length;
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCamouflage(); const message = createBaseCamouflage();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -309,12 +264,16 @@ export const Camouflage: MessageFns<Camouflage> = {
fromJSON(object: any): Camouflage { fromJSON(object: any): Camouflage {
return { return {
id: globalThis.Number(assertSet('Camouflage.id', object.id)), id: isSet(object.id) ? globalThis.Number(object.id) : 0,
name: I18nString.fromJSON(assertSet('Camouflage.name', object.name)), name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
tank_name: isSet(object.tank_name) tank_name: isSet(object.tankName)
? I18nString.fromJSON(object.tankName)
: isSet(object.tank_name)
? I18nString.fromJSON(object.tank_name) ? I18nString.fromJSON(object.tank_name)
: undefined, : undefined,
tank_name_full: isSet(object.tank_name_full) tank_name_full: isSet(object.tankNameFull)
? I18nString.fromJSON(object.tankNameFull)
: isSet(object.tank_name_full)
? I18nString.fromJSON(object.tank_name_full) ? I18nString.fromJSON(object.tank_name_full)
: undefined, : undefined,
}; };
@@ -329,10 +288,10 @@ export const Camouflage: MessageFns<Camouflage> = {
obj.name = I18nString.toJSON(message.name); obj.name = I18nString.toJSON(message.name);
} }
if (message.tank_name !== undefined) { if (message.tank_name !== undefined) {
obj.tank_name = I18nString.toJSON(message.tank_name); obj.tankName = I18nString.toJSON(message.tank_name);
} }
if (message.tank_name_full !== undefined) { if (message.tank_name_full !== undefined) {
obj.tank_name_full = I18nString.toJSON(message.tank_name_full); obj.tankNameFull = I18nString.toJSON(message.tank_name_full);
} }
return obj; return obj;
}, },
@@ -340,71 +299,43 @@ export const Camouflage: MessageFns<Camouflage> = {
create<I extends Exact<DeepPartial<Camouflage>, I>>(base?: I): Camouflage { create<I extends Exact<DeepPartial<Camouflage>, I>>(base?: I): Camouflage {
return Camouflage.fromPartial(base ?? ({} as any)); return Camouflage.fromPartial(base ?? ({} as any));
}, },
fromPartial<I extends Exact<DeepPartial<Camouflage>, I>>( fromPartial<I extends Exact<DeepPartial<Camouflage>, I>>(object: I): Camouflage {
object: I,
): Camouflage {
const message = createBaseCamouflage(); const message = createBaseCamouflage();
message.id = object.id ?? 0; message.id = object.id ?? 0;
message.name = message.name = (object.name !== undefined && object.name !== null)
object.name !== undefined && object.name !== null ? I18nString.fromPartial(object.name)
? I18nString.fromPartial(object.name) : undefined;
: createBaseI18nString(); message.tank_name = (object.tank_name !== undefined && object.tank_name !== null)
message.tank_name = ? I18nString.fromPartial(object.tank_name)
object.tank_name !== undefined && object.tank_name !== null : undefined;
? I18nString.fromPartial(object.tank_name) message.tank_name_full = (object.tank_name_full !== undefined && object.tank_name_full !== null)
: undefined; ? I18nString.fromPartial(object.tank_name_full)
message.tank_name_full = : undefined;
object.tank_name_full !== undefined && object.tank_name_full !== null
? I18nString.fromPartial(object.tank_name_full)
: undefined;
return message; return message;
}, },
}; };
type Builtin = type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin export type DeepPartial<T> = T extends Builtin ? T
? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends globalThis.Array<infer U> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
? globalThis.Array<DeepPartial<U>> : T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
: T extends ReadonlyArray<infer U> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
? ReadonlyArray<DeepPartial<U>> : Partial<T>;
: T extends { $case: string; value: unknown }
? { $case: T['$case']; value?: DeepPartial<T['value']> }
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never; type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin export type Exact<P, I extends P> = P extends Builtin ? P
? P : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
function isObject(value: any): boolean { function isObject(value: any): boolean {
return typeof value === 'object' && value !== null; return typeof value === "object" && value !== null;
} }
function isSet(value: any): boolean { function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
@@ -2,28 +2,28 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "i18n.proto";
message ConsumableDefinitions { message ConsumableDefinitions {
map<uint32, Consumable> consumables = 1; map<uint32, Consumable> consumables = 1;
} }
message Consumable { message Consumable {
required uint32 id = 1; required uint32 id = 1;
required I18nString name = 2; required I18nString name = 2;
required uint32 cooldown = 3; required uint32 cooldown = 3;
optional float duration = 4; optional float duration = 4;
required bool game_mode_exclusive = 5; required bool game_mode_exclusive = 5;
repeated ConsumableTankFilter include = 6; repeated ConsumableTankFilter include = 6;
repeated ConsumableTankFilter exclude = 7; repeated ConsumableTankFilter exclude = 7;
} }
message ConsumableTankFilter { message ConsumableTankFilter {
oneof filter_type { oneof filter_type {
ConsumableTankTierFilter tiers = 1; ConsumableTankTierFilter tiers = 1;
ConsumableTankIdsFilter ids = 2; ConsumableTankIdsFilter ids = 2;
ConsumableTankCategoryFilter categories = 3; ConsumableTankCategoryFilter categories = 3;
ConsumableTankNationFilter nations = 4; ConsumableTankNationFilter nations = 4;
} }
} }
@@ -1,24 +1,24 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/consumable_definitions.proto // source: consumable_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { createBaseI18nString, I18nString } from "./i18n"; import { I18nString } from "./i18n";
export const protobufPackage = "blitzkit"; export const protobufPackage = "blitzkit";
export enum ConsumableTankCategoryFilterCategory { export enum ConsumableTankCategoryFilterCategory {
CLIP = 0, CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP = 0,
} }
export function consumableTankCategoryFilterCategoryFromJSON(object: any): ConsumableTankCategoryFilterCategory { export function consumableTankCategoryFilterCategoryFromJSON(object: any): ConsumableTankCategoryFilterCategory {
switch (object) { switch (object) {
case 0: case 0:
case "CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP": case "CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP":
return ConsumableTankCategoryFilterCategory.CLIP; return ConsumableTankCategoryFilterCategory.CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP;
default: default:
throw new globalThis.Error( throw new globalThis.Error(
"Unrecognized enum value " + object + " for enum ConsumableTankCategoryFilterCategory", "Unrecognized enum value " + object + " for enum ConsumableTankCategoryFilterCategory",
@@ -28,7 +28,7 @@ export function consumableTankCategoryFilterCategoryFromJSON(object: any): Consu
export function consumableTankCategoryFilterCategoryToJSON(object: ConsumableTankCategoryFilterCategory): string { export function consumableTankCategoryFilterCategoryToJSON(object: ConsumableTankCategoryFilterCategory): string {
switch (object) { switch (object) {
case ConsumableTankCategoryFilterCategory.CLIP: case ConsumableTankCategoryFilterCategory.CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP:
return "CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP"; return "CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP";
default: default:
throw new globalThis.Error( throw new globalThis.Error(
@@ -48,7 +48,7 @@ export interface ConsumableDefinitions_ConsumablesEntry {
export interface Consumable { export interface Consumable {
id: number; id: number;
name: I18nString; name: I18nString | undefined;
cooldown: number; cooldown: number;
duration?: number | undefined; duration?: number | undefined;
game_mode_exclusive: boolean; game_mode_exclusive: boolean;
@@ -82,13 +82,13 @@ export interface ConsumableTankNationFilter {
nations: string[]; nations: string[];
} }
export function createBaseConsumableDefinitions(): ConsumableDefinitions { function createBaseConsumableDefinitions(): ConsumableDefinitions {
return { consumables: {} }; return { consumables: {} };
} }
export const ConsumableDefinitions: MessageFns<ConsumableDefinitions> = { export const ConsumableDefinitions: MessageFns<ConsumableDefinitions> = {
encode(message: ConsumableDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: ConsumableDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.consumables).forEach(([key, value]) => { globalThis.Object.entries(message.consumables).forEach(([key, value]: [string, Consumable]) => {
ConsumableDefinitions_ConsumablesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); ConsumableDefinitions_ConsumablesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
}); });
return writer; return writer;
@@ -96,7 +96,7 @@ export const ConsumableDefinitions: MessageFns<ConsumableDefinitions> = {
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): ConsumableDefinitions {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableDefinitions(); const message = createBaseConsumableDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -124,10 +124,13 @@ export const ConsumableDefinitions: MessageFns<ConsumableDefinitions> = {
fromJSON(object: any): ConsumableDefinitions { fromJSON(object: any): ConsumableDefinitions {
return { return {
consumables: isObject(object.consumables) consumables: isObject(object.consumables)
? Object.entries(object.consumables).reduce<{ [key: number]: Consumable }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.consumables) as [string, any][]).reduce(
acc[globalThis.Number(key)] = Consumable.fromJSON(value); (acc: { [key: number]: Consumable }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = Consumable.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -135,7 +138,7 @@ export const ConsumableDefinitions: MessageFns<ConsumableDefinitions> = {
toJSON(message: ConsumableDefinitions): unknown { toJSON(message: ConsumableDefinitions): unknown {
const obj: any = {}; const obj: any = {};
if (message.consumables) { if (message.consumables) {
const entries = Object.entries(message.consumables); const entries = globalThis.Object.entries(message.consumables) as [string, Consumable][];
if (entries.length > 0) { if (entries.length > 0) {
obj.consumables = {}; obj.consumables = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -151,8 +154,8 @@ export const ConsumableDefinitions: MessageFns<ConsumableDefinitions> = {
}, },
fromPartial<I extends Exact<DeepPartial<ConsumableDefinitions>, I>>(object: I): ConsumableDefinitions { fromPartial<I extends Exact<DeepPartial<ConsumableDefinitions>, I>>(object: I): ConsumableDefinitions {
const message = createBaseConsumableDefinitions(); const message = createBaseConsumableDefinitions();
message.consumables = Object.entries(object.consumables ?? {}).reduce<{ [key: number]: Consumable }>( message.consumables = (globalThis.Object.entries(object.consumables ?? {}) as [string, Consumable][]).reduce(
(acc, [key, value]) => { (acc: { [key: number]: Consumable }, [key, value]: [string, Consumable]) => {
if (value !== undefined) { if (value !== undefined) {
acc[globalThis.Number(key)] = Consumable.fromPartial(value); acc[globalThis.Number(key)] = Consumable.fromPartial(value);
} }
@@ -164,13 +167,13 @@ export const ConsumableDefinitions: MessageFns<ConsumableDefinitions> = {
}, },
}; };
export function createBaseConsumableDefinitions_ConsumablesEntry(): ConsumableDefinitions_ConsumablesEntry { function createBaseConsumableDefinitions_ConsumablesEntry(): ConsumableDefinitions_ConsumablesEntry {
return { key: 0, value: createBaseConsumable() }; return { key: 0, value: undefined };
} }
export const ConsumableDefinitions_ConsumablesEntry: MessageFns<ConsumableDefinitions_ConsumablesEntry> = { export const ConsumableDefinitions_ConsumablesEntry: MessageFns<ConsumableDefinitions_ConsumablesEntry> = {
encode(message: ConsumableDefinitions_ConsumablesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: ConsumableDefinitions_ConsumablesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).uint32(message.key); writer.uint32(8).uint32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -181,7 +184,7 @@ export const ConsumableDefinitions_ConsumablesEntry: MessageFns<ConsumableDefini
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableDefinitions_ConsumablesEntry { decode(input: BinaryReader | Uint8Array, length?: number): ConsumableDefinitions_ConsumablesEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableDefinitions_ConsumablesEntry(); const message = createBaseConsumableDefinitions_ConsumablesEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -213,14 +216,14 @@ export const ConsumableDefinitions_ConsumablesEntry: MessageFns<ConsumableDefini
fromJSON(object: any): ConsumableDefinitions_ConsumablesEntry { fromJSON(object: any): ConsumableDefinitions_ConsumablesEntry {
return { return {
key: globalThis.Number(assertSet("ConsumableDefinitions_ConsumablesEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: Consumable.fromJSON(assertSet("ConsumableDefinitions_ConsumablesEntry.value", object.value)), value: isSet(object.value) ? Consumable.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: ConsumableDefinitions_ConsumablesEntry): unknown { toJSON(message: ConsumableDefinitions_ConsumablesEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -241,21 +244,13 @@ export const ConsumableDefinitions_ConsumablesEntry: MessageFns<ConsumableDefini
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? Consumable.fromPartial(object.value) ? Consumable.fromPartial(object.value)
: createBaseConsumable(); : undefined;
return message; return message;
}, },
}; };
export function createBaseConsumable(): Consumable { function createBaseConsumable(): Consumable {
return { return { id: 0, name: undefined, cooldown: 0, duration: 0, game_mode_exclusive: false, include: [], exclude: [] };
id: 0,
name: createBaseI18nString(),
cooldown: 0,
duration: undefined,
game_mode_exclusive: false,
include: [],
exclude: [],
};
} }
export const Consumable: MessageFns<Consumable> = { export const Consumable: MessageFns<Consumable> = {
@@ -269,7 +264,7 @@ export const Consumable: MessageFns<Consumable> = {
if (message.cooldown !== 0) { if (message.cooldown !== 0) {
writer.uint32(24).uint32(message.cooldown); writer.uint32(24).uint32(message.cooldown);
} }
if (message.duration !== undefined && message.duration !== undefined) { if (message.duration !== undefined && message.duration !== 0) {
writer.uint32(37).float(message.duration); writer.uint32(37).float(message.duration);
} }
if (message.game_mode_exclusive !== false) { if (message.game_mode_exclusive !== false) {
@@ -286,7 +281,7 @@ export const Consumable: MessageFns<Consumable> = {
decode(input: BinaryReader | Uint8Array, length?: number): Consumable { decode(input: BinaryReader | Uint8Array, length?: number): Consumable {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumable(); const message = createBaseConsumable();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -358,11 +353,15 @@ export const Consumable: MessageFns<Consumable> = {
fromJSON(object: any): Consumable { fromJSON(object: any): Consumable {
return { return {
id: globalThis.Number(assertSet("Consumable.id", object.id)), id: isSet(object.id) ? globalThis.Number(object.id) : 0,
name: I18nString.fromJSON(assertSet("Consumable.name", object.name)), name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
cooldown: globalThis.Number(assertSet("Consumable.cooldown", object.cooldown)), cooldown: isSet(object.cooldown) ? globalThis.Number(object.cooldown) : 0,
duration: isSet(object.duration) ? globalThis.Number(object.duration) : undefined, duration: isSet(object.duration) ? globalThis.Number(object.duration) : 0,
game_mode_exclusive: globalThis.Boolean(assertSet("Consumable.game_mode_exclusive", object.game_mode_exclusive)), game_mode_exclusive: isSet(object.gameModeExclusive)
? globalThis.Boolean(object.gameModeExclusive)
: isSet(object.game_mode_exclusive)
? globalThis.Boolean(object.game_mode_exclusive)
: false,
include: globalThis.Array.isArray(object?.include) include: globalThis.Array.isArray(object?.include)
? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e)) ? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e))
: [], : [],
@@ -383,11 +382,11 @@ export const Consumable: MessageFns<Consumable> = {
if (message.cooldown !== 0) { if (message.cooldown !== 0) {
obj.cooldown = Math.round(message.cooldown); obj.cooldown = Math.round(message.cooldown);
} }
if (message.duration !== undefined && message.duration !== undefined) { if (message.duration !== undefined && message.duration !== 0) {
obj.duration = message.duration; obj.duration = message.duration;
} }
if (message.game_mode_exclusive !== false) { if (message.game_mode_exclusive !== false) {
obj.game_mode_exclusive = message.game_mode_exclusive; obj.gameModeExclusive = message.game_mode_exclusive;
} }
if (message.include?.length) { if (message.include?.length) {
obj.include = message.include.map((e) => ConsumableTankFilter.toJSON(e)); obj.include = message.include.map((e) => ConsumableTankFilter.toJSON(e));
@@ -406,9 +405,9 @@ export const Consumable: MessageFns<Consumable> = {
message.id = object.id ?? 0; message.id = object.id ?? 0;
message.name = (object.name !== undefined && object.name !== null) message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name) ? I18nString.fromPartial(object.name)
: createBaseI18nString(); : undefined;
message.cooldown = object.cooldown ?? 0; message.cooldown = object.cooldown ?? 0;
message.duration = object.duration ?? undefined; message.duration = object.duration ?? 0;
message.game_mode_exclusive = object.game_mode_exclusive ?? false; message.game_mode_exclusive = object.game_mode_exclusive ?? false;
message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
message.exclude = object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; message.exclude = object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
@@ -416,7 +415,7 @@ export const Consumable: MessageFns<Consumable> = {
}, },
}; };
export function createBaseConsumableTankFilter(): ConsumableTankFilter { function createBaseConsumableTankFilter(): ConsumableTankFilter {
return { filter_type: undefined }; return { filter_type: undefined };
} }
@@ -441,7 +440,7 @@ export const ConsumableTankFilter: MessageFns<ConsumableTankFilter> = {
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankFilter { decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankFilter {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankFilter(); const message = createBaseConsumableTankFilter();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -508,14 +507,11 @@ export const ConsumableTankFilter: MessageFns<ConsumableTankFilter> = {
const obj: any = {}; const obj: any = {};
if (message.filter_type?.$case === "tiers") { if (message.filter_type?.$case === "tiers") {
obj.tiers = ConsumableTankTierFilter.toJSON(message.filter_type.value); obj.tiers = ConsumableTankTierFilter.toJSON(message.filter_type.value);
} } else if (message.filter_type?.$case === "ids") {
if (message.filter_type?.$case === "ids") {
obj.ids = ConsumableTankIdsFilter.toJSON(message.filter_type.value); obj.ids = ConsumableTankIdsFilter.toJSON(message.filter_type.value);
} } else if (message.filter_type?.$case === "categories") {
if (message.filter_type?.$case === "categories") {
obj.categories = ConsumableTankCategoryFilter.toJSON(message.filter_type.value); obj.categories = ConsumableTankCategoryFilter.toJSON(message.filter_type.value);
} } else if (message.filter_type?.$case === "nations") {
if (message.filter_type?.$case === "nations") {
obj.nations = ConsumableTankNationFilter.toJSON(message.filter_type.value); obj.nations = ConsumableTankNationFilter.toJSON(message.filter_type.value);
} }
return obj; return obj;
@@ -526,45 +522,46 @@ export const ConsumableTankFilter: MessageFns<ConsumableTankFilter> = {
}, },
fromPartial<I extends Exact<DeepPartial<ConsumableTankFilter>, I>>(object: I): ConsumableTankFilter { fromPartial<I extends Exact<DeepPartial<ConsumableTankFilter>, I>>(object: I): ConsumableTankFilter {
const message = createBaseConsumableTankFilter(); const message = createBaseConsumableTankFilter();
if ( switch (object.filter_type?.$case) {
object.filter_type?.$case === "tiers" && case "tiers": {
object.filter_type?.value !== undefined && if (object.filter_type?.value !== undefined && object.filter_type?.value !== null) {
object.filter_type?.value !== null message.filter_type = {
) { $case: "tiers",
message.filter_type = { $case: "tiers", value: ConsumableTankTierFilter.fromPartial(object.filter_type.value) }; value: ConsumableTankTierFilter.fromPartial(object.filter_type.value),
} };
if ( }
object.filter_type?.$case === "ids" && break;
object.filter_type?.value !== undefined && }
object.filter_type?.value !== null case "ids": {
) { if (object.filter_type?.value !== undefined && object.filter_type?.value !== null) {
message.filter_type = { $case: "ids", value: ConsumableTankIdsFilter.fromPartial(object.filter_type.value) }; message.filter_type = { $case: "ids", value: ConsumableTankIdsFilter.fromPartial(object.filter_type.value) };
} }
if ( break;
object.filter_type?.$case === "categories" && }
object.filter_type?.value !== undefined && case "categories": {
object.filter_type?.value !== null if (object.filter_type?.value !== undefined && object.filter_type?.value !== null) {
) { message.filter_type = {
message.filter_type = { $case: "categories",
$case: "categories", value: ConsumableTankCategoryFilter.fromPartial(object.filter_type.value),
value: ConsumableTankCategoryFilter.fromPartial(object.filter_type.value), };
}; }
} break;
if ( }
object.filter_type?.$case === "nations" && case "nations": {
object.filter_type?.value !== undefined && if (object.filter_type?.value !== undefined && object.filter_type?.value !== null) {
object.filter_type?.value !== null message.filter_type = {
) { $case: "nations",
message.filter_type = { value: ConsumableTankNationFilter.fromPartial(object.filter_type.value),
$case: "nations", };
value: ConsumableTankNationFilter.fromPartial(object.filter_type.value), }
}; break;
}
} }
return message; return message;
}, },
}; };
export function createBaseConsumableTankTierFilter(): ConsumableTankTierFilter { function createBaseConsumableTankTierFilter(): ConsumableTankTierFilter {
return { min: 0, max: 0 }; return { min: 0, max: 0 };
} }
@@ -581,7 +578,7 @@ export const ConsumableTankTierFilter: MessageFns<ConsumableTankTierFilter> = {
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankTierFilter { decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankTierFilter {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankTierFilter(); const message = createBaseConsumableTankTierFilter();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -613,8 +610,8 @@ export const ConsumableTankTierFilter: MessageFns<ConsumableTankTierFilter> = {
fromJSON(object: any): ConsumableTankTierFilter { fromJSON(object: any): ConsumableTankTierFilter {
return { return {
min: globalThis.Number(assertSet("ConsumableTankTierFilter.min", object.min)), min: isSet(object.min) ? globalThis.Number(object.min) : 0,
max: globalThis.Number(assertSet("ConsumableTankTierFilter.max", object.max)), max: isSet(object.max) ? globalThis.Number(object.max) : 0,
}; };
}, },
@@ -640,23 +637,21 @@ export const ConsumableTankTierFilter: MessageFns<ConsumableTankTierFilter> = {
}, },
}; };
export function createBaseConsumableTankIdsFilter(): ConsumableTankIdsFilter { function createBaseConsumableTankIdsFilter(): ConsumableTankIdsFilter {
return { ids: [] }; return { ids: [] };
} }
export const ConsumableTankIdsFilter: MessageFns<ConsumableTankIdsFilter> = { export const ConsumableTankIdsFilter: MessageFns<ConsumableTankIdsFilter> = {
encode(message: ConsumableTankIdsFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: ConsumableTankIdsFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
writer.uint32(10).fork();
for (const v of message.ids) { for (const v of message.ids) {
writer.uint32(v); writer.uint32(8).uint32(v!);
} }
writer.join();
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankIdsFilter { decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankIdsFilter {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankIdsFilter(); const message = createBaseConsumableTankIdsFilter();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -710,23 +705,21 @@ export const ConsumableTankIdsFilter: MessageFns<ConsumableTankIdsFilter> = {
}, },
}; };
export function createBaseConsumableTankCategoryFilter(): ConsumableTankCategoryFilter { function createBaseConsumableTankCategoryFilter(): ConsumableTankCategoryFilter {
return { categories: [] }; return { categories: [] };
} }
export const ConsumableTankCategoryFilter: MessageFns<ConsumableTankCategoryFilter> = { export const ConsumableTankCategoryFilter: MessageFns<ConsumableTankCategoryFilter> = {
encode(message: ConsumableTankCategoryFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: ConsumableTankCategoryFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
writer.uint32(10).fork();
for (const v of message.categories) { for (const v of message.categories) {
writer.int32(v); writer.uint32(8).int32(v!);
} }
writer.join();
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankCategoryFilter { decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankCategoryFilter {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankCategoryFilter(); const message = createBaseConsumableTankCategoryFilter();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -784,7 +777,7 @@ export const ConsumableTankCategoryFilter: MessageFns<ConsumableTankCategoryFilt
}, },
}; };
export function createBaseConsumableTankNationFilter(): ConsumableTankNationFilter { function createBaseConsumableTankNationFilter(): ConsumableTankNationFilter {
return { nations: [] }; return { nations: [] };
} }
@@ -798,7 +791,7 @@ export const ConsumableTankNationFilter: MessageFns<ConsumableTankNationFilter>
decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankNationFilter { decode(input: BinaryReader | Uint8Array, length?: number): ConsumableTankNationFilter {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConsumableTankNationFilter(); const message = createBaseConsumableTankNationFilter();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -865,14 +858,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
@@ -2,15 +2,15 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "i18n.proto";
message EquipmentDefinitions { message EquipmentDefinitions {
map<string, EquipmentPreset> presets = 1; map<string, EquipmentPreset> presets = 1;
map<uint32, Equipment> equipments = 2; map<uint32, Equipment> equipments = 2;
} }
message Equipment { message Equipment {
required I18nString name = 1; required I18nString name = 1;
required I18nString description = 2; required I18nString description = 2;
} }
@@ -19,6 +19,6 @@ message EquipmentPreset {
} }
message EquipmentSlot { message EquipmentSlot {
required uint32 left = 1; required uint32 left = 1;
required uint32 right = 2; required uint32 right = 2;
} }
@@ -1,12 +1,12 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/equipment_definitions.proto // source: equipment_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { createBaseI18nString, I18nString } from "./i18n"; import { I18nString } from "./i18n";
export const protobufPackage = "blitzkit"; export const protobufPackage = "blitzkit";
@@ -26,8 +26,8 @@ export interface EquipmentDefinitions_EquipmentsEntry {
} }
export interface Equipment { export interface Equipment {
name: I18nString; name: I18nString | undefined;
description: I18nString; description: I18nString | undefined;
} }
export interface EquipmentPreset { export interface EquipmentPreset {
@@ -39,16 +39,16 @@ export interface EquipmentSlot {
right: number; right: number;
} }
export function createBaseEquipmentDefinitions(): EquipmentDefinitions { function createBaseEquipmentDefinitions(): EquipmentDefinitions {
return { presets: {}, equipments: {} }; return { presets: {}, equipments: {} };
} }
export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = { export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
encode(message: EquipmentDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: EquipmentDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.presets).forEach(([key, value]) => { globalThis.Object.entries(message.presets).forEach(([key, value]: [string, EquipmentPreset]) => {
EquipmentDefinitions_PresetsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); EquipmentDefinitions_PresetsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
}); });
Object.entries(message.equipments).forEach(([key, value]) => { globalThis.Object.entries(message.equipments).forEach(([key, value]: [string, Equipment]) => {
EquipmentDefinitions_EquipmentsEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); EquipmentDefinitions_EquipmentsEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
}); });
return writer; return writer;
@@ -56,7 +56,7 @@ export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions(); const message = createBaseEquipmentDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -95,16 +95,22 @@ export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
fromJSON(object: any): EquipmentDefinitions { fromJSON(object: any): EquipmentDefinitions {
return { return {
presets: isObject(object.presets) presets: isObject(object.presets)
? Object.entries(object.presets).reduce<{ [key: string]: EquipmentPreset }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.presets) as [string, any][]).reduce(
acc[key] = EquipmentPreset.fromJSON(value); (acc: { [key: string]: EquipmentPreset }, [key, value]: [string, any]) => {
return acc; acc[key] = EquipmentPreset.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
equipments: isObject(object.equipments) equipments: isObject(object.equipments)
? Object.entries(object.equipments).reduce<{ [key: number]: Equipment }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.equipments) as [string, any][]).reduce(
acc[globalThis.Number(key)] = Equipment.fromJSON(value); (acc: { [key: number]: Equipment }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = Equipment.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -112,7 +118,7 @@ export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
toJSON(message: EquipmentDefinitions): unknown { toJSON(message: EquipmentDefinitions): unknown {
const obj: any = {}; const obj: any = {};
if (message.presets) { if (message.presets) {
const entries = Object.entries(message.presets); const entries = globalThis.Object.entries(message.presets) as [string, EquipmentPreset][];
if (entries.length > 0) { if (entries.length > 0) {
obj.presets = {}; obj.presets = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -121,7 +127,7 @@ export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
} }
} }
if (message.equipments) { if (message.equipments) {
const entries = Object.entries(message.equipments); const entries = globalThis.Object.entries(message.equipments) as [string, Equipment][];
if (entries.length > 0) { if (entries.length > 0) {
obj.equipments = {}; obj.equipments = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -137,8 +143,8 @@ export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
}, },
fromPartial<I extends Exact<DeepPartial<EquipmentDefinitions>, I>>(object: I): EquipmentDefinitions { fromPartial<I extends Exact<DeepPartial<EquipmentDefinitions>, I>>(object: I): EquipmentDefinitions {
const message = createBaseEquipmentDefinitions(); const message = createBaseEquipmentDefinitions();
message.presets = Object.entries(object.presets ?? {}).reduce<{ [key: string]: EquipmentPreset }>( message.presets = (globalThis.Object.entries(object.presets ?? {}) as [string, EquipmentPreset][]).reduce(
(acc, [key, value]) => { (acc: { [key: string]: EquipmentPreset }, [key, value]: [string, EquipmentPreset]) => {
if (value !== undefined) { if (value !== undefined) {
acc[key] = EquipmentPreset.fromPartial(value); acc[key] = EquipmentPreset.fromPartial(value);
} }
@@ -146,8 +152,8 @@ export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
}, },
{}, {},
); );
message.equipments = Object.entries(object.equipments ?? {}).reduce<{ [key: number]: Equipment }>( message.equipments = (globalThis.Object.entries(object.equipments ?? {}) as [string, Equipment][]).reduce(
(acc, [key, value]) => { (acc: { [key: number]: Equipment }, [key, value]: [string, Equipment]) => {
if (value !== undefined) { if (value !== undefined) {
acc[globalThis.Number(key)] = Equipment.fromPartial(value); acc[globalThis.Number(key)] = Equipment.fromPartial(value);
} }
@@ -159,13 +165,13 @@ export const EquipmentDefinitions: MessageFns<EquipmentDefinitions> = {
}, },
}; };
export function createBaseEquipmentDefinitions_PresetsEntry(): EquipmentDefinitions_PresetsEntry { function createBaseEquipmentDefinitions_PresetsEntry(): EquipmentDefinitions_PresetsEntry {
return { key: "", value: createBaseEquipmentPreset() }; return { key: "", value: undefined };
} }
export const EquipmentDefinitions_PresetsEntry: MessageFns<EquipmentDefinitions_PresetsEntry> = { export const EquipmentDefinitions_PresetsEntry: MessageFns<EquipmentDefinitions_PresetsEntry> = {
encode(message: EquipmentDefinitions_PresetsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: EquipmentDefinitions_PresetsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== "") {
writer.uint32(10).string(message.key); writer.uint32(10).string(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -176,7 +182,7 @@ export const EquipmentDefinitions_PresetsEntry: MessageFns<EquipmentDefinitions_
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions_PresetsEntry { decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions_PresetsEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions_PresetsEntry(); const message = createBaseEquipmentDefinitions_PresetsEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -208,14 +214,14 @@ export const EquipmentDefinitions_PresetsEntry: MessageFns<EquipmentDefinitions_
fromJSON(object: any): EquipmentDefinitions_PresetsEntry { fromJSON(object: any): EquipmentDefinitions_PresetsEntry {
return { return {
key: globalThis.String(assertSet("EquipmentDefinitions_PresetsEntry.key", object.key)), key: isSet(object.key) ? globalThis.String(object.key) : "",
value: EquipmentPreset.fromJSON(assertSet("EquipmentDefinitions_PresetsEntry.value", object.value)), value: isSet(object.value) ? EquipmentPreset.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: EquipmentDefinitions_PresetsEntry): unknown { toJSON(message: EquipmentDefinitions_PresetsEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== "") {
obj.key = message.key; obj.key = message.key;
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -236,18 +242,18 @@ export const EquipmentDefinitions_PresetsEntry: MessageFns<EquipmentDefinitions_
message.key = object.key ?? ""; message.key = object.key ?? "";
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? EquipmentPreset.fromPartial(object.value) ? EquipmentPreset.fromPartial(object.value)
: createBaseEquipmentPreset(); : undefined;
return message; return message;
}, },
}; };
export function createBaseEquipmentDefinitions_EquipmentsEntry(): EquipmentDefinitions_EquipmentsEntry { function createBaseEquipmentDefinitions_EquipmentsEntry(): EquipmentDefinitions_EquipmentsEntry {
return { key: 0, value: createBaseEquipment() }; return { key: 0, value: undefined };
} }
export const EquipmentDefinitions_EquipmentsEntry: MessageFns<EquipmentDefinitions_EquipmentsEntry> = { export const EquipmentDefinitions_EquipmentsEntry: MessageFns<EquipmentDefinitions_EquipmentsEntry> = {
encode(message: EquipmentDefinitions_EquipmentsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: EquipmentDefinitions_EquipmentsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).uint32(message.key); writer.uint32(8).uint32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -258,7 +264,7 @@ export const EquipmentDefinitions_EquipmentsEntry: MessageFns<EquipmentDefinitio
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions_EquipmentsEntry { decode(input: BinaryReader | Uint8Array, length?: number): EquipmentDefinitions_EquipmentsEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentDefinitions_EquipmentsEntry(); const message = createBaseEquipmentDefinitions_EquipmentsEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -290,14 +296,14 @@ export const EquipmentDefinitions_EquipmentsEntry: MessageFns<EquipmentDefinitio
fromJSON(object: any): EquipmentDefinitions_EquipmentsEntry { fromJSON(object: any): EquipmentDefinitions_EquipmentsEntry {
return { return {
key: globalThis.Number(assertSet("EquipmentDefinitions_EquipmentsEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: Equipment.fromJSON(assertSet("EquipmentDefinitions_EquipmentsEntry.value", object.value)), value: isSet(object.value) ? Equipment.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: EquipmentDefinitions_EquipmentsEntry): unknown { toJSON(message: EquipmentDefinitions_EquipmentsEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -318,13 +324,13 @@ export const EquipmentDefinitions_EquipmentsEntry: MessageFns<EquipmentDefinitio
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? Equipment.fromPartial(object.value) ? Equipment.fromPartial(object.value)
: createBaseEquipment(); : undefined;
return message; return message;
}, },
}; };
export function createBaseEquipment(): Equipment { function createBaseEquipment(): Equipment {
return { name: createBaseI18nString(), description: createBaseI18nString() }; return { name: undefined, description: undefined };
} }
export const Equipment: MessageFns<Equipment> = { export const Equipment: MessageFns<Equipment> = {
@@ -340,7 +346,7 @@ export const Equipment: MessageFns<Equipment> = {
decode(input: BinaryReader | Uint8Array, length?: number): Equipment { decode(input: BinaryReader | Uint8Array, length?: number): Equipment {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipment(); const message = createBaseEquipment();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -372,8 +378,8 @@ export const Equipment: MessageFns<Equipment> = {
fromJSON(object: any): Equipment { fromJSON(object: any): Equipment {
return { return {
name: I18nString.fromJSON(assertSet("Equipment.name", object.name)), name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
description: I18nString.fromJSON(assertSet("Equipment.description", object.description)), description: isSet(object.description) ? I18nString.fromJSON(object.description) : undefined,
}; };
}, },
@@ -395,15 +401,15 @@ export const Equipment: MessageFns<Equipment> = {
const message = createBaseEquipment(); const message = createBaseEquipment();
message.name = (object.name !== undefined && object.name !== null) message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name) ? I18nString.fromPartial(object.name)
: createBaseI18nString(); : undefined;
message.description = (object.description !== undefined && object.description !== null) message.description = (object.description !== undefined && object.description !== null)
? I18nString.fromPartial(object.description) ? I18nString.fromPartial(object.description)
: createBaseI18nString(); : undefined;
return message; return message;
}, },
}; };
export function createBaseEquipmentPreset(): EquipmentPreset { function createBaseEquipmentPreset(): EquipmentPreset {
return { slots: [] }; return { slots: [] };
} }
@@ -417,7 +423,7 @@ export const EquipmentPreset: MessageFns<EquipmentPreset> = {
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentPreset { decode(input: BinaryReader | Uint8Array, length?: number): EquipmentPreset {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentPreset(); const message = createBaseEquipmentPreset();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -463,7 +469,7 @@ export const EquipmentPreset: MessageFns<EquipmentPreset> = {
}, },
}; };
export function createBaseEquipmentSlot(): EquipmentSlot { function createBaseEquipmentSlot(): EquipmentSlot {
return { left: 0, right: 0 }; return { left: 0, right: 0 };
} }
@@ -480,7 +486,7 @@ export const EquipmentSlot: MessageFns<EquipmentSlot> = {
decode(input: BinaryReader | Uint8Array, length?: number): EquipmentSlot { decode(input: BinaryReader | Uint8Array, length?: number): EquipmentSlot {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseEquipmentSlot(); const message = createBaseEquipmentSlot();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -512,8 +518,8 @@ export const EquipmentSlot: MessageFns<EquipmentSlot> = {
fromJSON(object: any): EquipmentSlot { fromJSON(object: any): EquipmentSlot {
return { return {
left: globalThis.Number(assertSet("EquipmentSlot.left", object.left)), left: isSet(object.left) ? globalThis.Number(object.left) : 0,
right: globalThis.Number(assertSet("EquipmentSlot.right", object.right)), right: isSet(object.right) ? globalThis.Number(object.right) : 0,
}; };
}, },
@@ -560,14 +566,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
+4 -4
View File
@@ -2,14 +2,14 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "i18n.proto";
message Gallery { message Gallery {
repeated Avatar avatars = 1; repeated Avatar avatars = 1;
} }
message Avatar { message Avatar {
required string id = 1; required string id = 1;
required I18nString name = 2; required I18nString name = 2;
required string extension = 3; required string extension = 3;
} }
+13 -21
View File
@@ -1,12 +1,12 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/gallery.proto // source: gallery.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { createBaseI18nString, I18nString } from "./i18n"; import { I18nString } from "./i18n";
export const protobufPackage = "blitzkit"; export const protobufPackage = "blitzkit";
@@ -16,11 +16,11 @@ export interface Gallery {
export interface Avatar { export interface Avatar {
id: string; id: string;
name: I18nString; name: I18nString | undefined;
extension: string; extension: string;
} }
export function createBaseGallery(): Gallery { function createBaseGallery(): Gallery {
return { avatars: [] }; return { avatars: [] };
} }
@@ -34,7 +34,7 @@ export const Gallery: MessageFns<Gallery> = {
decode(input: BinaryReader | Uint8Array, length?: number): Gallery { decode(input: BinaryReader | Uint8Array, length?: number): Gallery {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGallery(); const message = createBaseGallery();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -80,8 +80,8 @@ export const Gallery: MessageFns<Gallery> = {
}, },
}; };
export function createBaseAvatar(): Avatar { function createBaseAvatar(): Avatar {
return { id: "", name: createBaseI18nString(), extension: "" }; return { id: "", name: undefined, extension: "" };
} }
export const Avatar: MessageFns<Avatar> = { export const Avatar: MessageFns<Avatar> = {
@@ -100,7 +100,7 @@ export const Avatar: MessageFns<Avatar> = {
decode(input: BinaryReader | Uint8Array, length?: number): Avatar { decode(input: BinaryReader | Uint8Array, length?: number): Avatar {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAvatar(); const message = createBaseAvatar();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -140,9 +140,9 @@ export const Avatar: MessageFns<Avatar> = {
fromJSON(object: any): Avatar { fromJSON(object: any): Avatar {
return { return {
id: globalThis.String(assertSet("Avatar.id", object.id)), id: isSet(object.id) ? globalThis.String(object.id) : "",
name: I18nString.fromJSON(assertSet("Avatar.name", object.name)), name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
extension: globalThis.String(assertSet("Avatar.extension", object.extension)), extension: isSet(object.extension) ? globalThis.String(object.extension) : "",
}; };
}, },
@@ -168,7 +168,7 @@ export const Avatar: MessageFns<Avatar> = {
message.id = object.id ?? ""; message.id = object.id ?? "";
message.name = (object.name !== undefined && object.name !== null) message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name) ? I18nString.fromPartial(object.name)
: createBaseI18nString(); : undefined;
message.extension = object.extension ?? ""; message.extension = object.extension ?? "";
return message; return message;
}, },
@@ -191,14 +191,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
@@ -2,13 +2,13 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "i18n.proto";
message GameDefinitions { message GameDefinitions {
required string version = 1; required string version = 1;
repeated string nations = 2; repeated string nations = 2;
map<uint32, GameMode> gameModes = 3; map<uint32, GameMode> gameModes = 3;
map<uint32, GameModeRole> roles = 4; map<uint32, GameModeRole> roles = 4;
} }
message GameMode { message GameMode {
@@ -16,6 +16,6 @@ message GameMode {
} }
message GameModeRole { message GameModeRole {
repeated uint32 provisions = 1; repeated uint32 provisions = 1;
repeated uint32 consumables = 2; repeated uint32 consumables = 2;
} }
+61 -64
View File
@@ -1,12 +1,12 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/game_definitions.proto // source: game_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { createBaseI18nString, I18nString } from "./i18n"; import { I18nString } from "./i18n";
export const protobufPackage = "blitzkit"; export const protobufPackage = "blitzkit";
@@ -28,7 +28,7 @@ export interface GameDefinitions_RolesEntry {
} }
export interface GameMode { export interface GameMode {
name: I18nString; name: I18nString | undefined;
} }
export interface GameModeRole { export interface GameModeRole {
@@ -36,7 +36,7 @@ export interface GameModeRole {
consumables: number[]; consumables: number[];
} }
export function createBaseGameDefinitions(): GameDefinitions { function createBaseGameDefinitions(): GameDefinitions {
return { version: "", nations: [], gameModes: {}, roles: {} }; return { version: "", nations: [], gameModes: {}, roles: {} };
} }
@@ -48,10 +48,10 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
for (const v of message.nations) { for (const v of message.nations) {
writer.uint32(18).string(v!); writer.uint32(18).string(v!);
} }
Object.entries(message.gameModes).forEach(([key, value]) => { globalThis.Object.entries(message.gameModes).forEach(([key, value]: [string, GameMode]) => {
GameDefinitions_GameModesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); GameDefinitions_GameModesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
}); });
Object.entries(message.roles).forEach(([key, value]) => { globalThis.Object.entries(message.roles).forEach(([key, value]: [string, GameModeRole]) => {
GameDefinitions_RolesEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); GameDefinitions_RolesEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join();
}); });
return writer; return writer;
@@ -59,7 +59,7 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions(); const message = createBaseGameDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -113,19 +113,25 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
fromJSON(object: any): GameDefinitions { fromJSON(object: any): GameDefinitions {
return { return {
version: globalThis.String(assertSet("GameDefinitions.version", object.version)), version: isSet(object.version) ? globalThis.String(object.version) : "",
nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [], nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [],
gameModes: isObject(object.gameModes) gameModes: isObject(object.gameModes)
? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.gameModes) as [string, any][]).reduce(
acc[globalThis.Number(key)] = GameMode.fromJSON(value); (acc: { [key: number]: GameMode }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = GameMode.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
roles: isObject(object.roles) roles: isObject(object.roles)
? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.roles) as [string, any][]).reduce(
acc[globalThis.Number(key)] = GameModeRole.fromJSON(value); (acc: { [key: number]: GameModeRole }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = GameModeRole.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -139,7 +145,7 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
obj.nations = message.nations; obj.nations = message.nations;
} }
if (message.gameModes) { if (message.gameModes) {
const entries = Object.entries(message.gameModes); const entries = globalThis.Object.entries(message.gameModes) as [string, GameMode][];
if (entries.length > 0) { if (entries.length > 0) {
obj.gameModes = {}; obj.gameModes = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -148,7 +154,7 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
} }
} }
if (message.roles) { if (message.roles) {
const entries = Object.entries(message.roles); const entries = globalThis.Object.entries(message.roles) as [string, GameModeRole][];
if (entries.length > 0) { if (entries.length > 0) {
obj.roles = {}; obj.roles = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -166,8 +172,8 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
const message = createBaseGameDefinitions(); const message = createBaseGameDefinitions();
message.version = object.version ?? ""; message.version = object.version ?? "";
message.nations = object.nations?.map((e) => e) || []; message.nations = object.nations?.map((e) => e) || [];
message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{ [key: number]: GameMode }>( message.gameModes = (globalThis.Object.entries(object.gameModes ?? {}) as [string, GameMode][]).reduce(
(acc, [key, value]) => { (acc: { [key: number]: GameMode }, [key, value]: [string, GameMode]) => {
if (value !== undefined) { if (value !== undefined) {
acc[globalThis.Number(key)] = GameMode.fromPartial(value); acc[globalThis.Number(key)] = GameMode.fromPartial(value);
} }
@@ -175,23 +181,26 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
}, },
{}, {},
); );
message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => { message.roles = (globalThis.Object.entries(object.roles ?? {}) as [string, GameModeRole][]).reduce(
if (value !== undefined) { (acc: { [key: number]: GameModeRole }, [key, value]: [string, GameModeRole]) => {
acc[globalThis.Number(key)] = GameModeRole.fromPartial(value); if (value !== undefined) {
} acc[globalThis.Number(key)] = GameModeRole.fromPartial(value);
return acc; }
}, {}); return acc;
},
{},
);
return message; return message;
}, },
}; };
export function createBaseGameDefinitions_GameModesEntry(): GameDefinitions_GameModesEntry { function createBaseGameDefinitions_GameModesEntry(): GameDefinitions_GameModesEntry {
return { key: 0, value: createBaseGameMode() }; return { key: 0, value: undefined };
} }
export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> = { export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> = {
encode(message: GameDefinitions_GameModesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: GameDefinitions_GameModesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).uint32(message.key); writer.uint32(8).uint32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -202,7 +211,7 @@ export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameMode
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_GameModesEntry { decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_GameModesEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_GameModesEntry(); const message = createBaseGameDefinitions_GameModesEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -234,14 +243,14 @@ export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameMode
fromJSON(object: any): GameDefinitions_GameModesEntry { fromJSON(object: any): GameDefinitions_GameModesEntry {
return { return {
key: globalThis.Number(assertSet("GameDefinitions_GameModesEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: GameMode.fromJSON(assertSet("GameDefinitions_GameModesEntry.value", object.value)), value: isSet(object.value) ? GameMode.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: GameDefinitions_GameModesEntry): unknown { toJSON(message: GameDefinitions_GameModesEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -260,18 +269,18 @@ export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameMode
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? GameMode.fromPartial(object.value) ? GameMode.fromPartial(object.value)
: createBaseGameMode(); : undefined;
return message; return message;
}, },
}; };
export function createBaseGameDefinitions_RolesEntry(): GameDefinitions_RolesEntry { function createBaseGameDefinitions_RolesEntry(): GameDefinitions_RolesEntry {
return { key: 0, value: createBaseGameModeRole() }; return { key: 0, value: undefined };
} }
export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> = { export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> = {
encode(message: GameDefinitions_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: GameDefinitions_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).uint32(message.key); writer.uint32(8).uint32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -282,7 +291,7 @@ export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry>
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_RolesEntry { decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_RolesEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameDefinitions_RolesEntry(); const message = createBaseGameDefinitions_RolesEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -314,14 +323,14 @@ export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry>
fromJSON(object: any): GameDefinitions_RolesEntry { fromJSON(object: any): GameDefinitions_RolesEntry {
return { return {
key: globalThis.Number(assertSet("GameDefinitions_RolesEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: GameModeRole.fromJSON(assertSet("GameDefinitions_RolesEntry.value", object.value)), value: isSet(object.value) ? GameModeRole.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: GameDefinitions_RolesEntry): unknown { toJSON(message: GameDefinitions_RolesEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -338,13 +347,13 @@ export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry>
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? GameModeRole.fromPartial(object.value) ? GameModeRole.fromPartial(object.value)
: createBaseGameModeRole(); : undefined;
return message; return message;
}, },
}; };
export function createBaseGameMode(): GameMode { function createBaseGameMode(): GameMode {
return { name: createBaseI18nString() }; return { name: undefined };
} }
export const GameMode: MessageFns<GameMode> = { export const GameMode: MessageFns<GameMode> = {
@@ -357,7 +366,7 @@ export const GameMode: MessageFns<GameMode> = {
decode(input: BinaryReader | Uint8Array, length?: number): GameMode { decode(input: BinaryReader | Uint8Array, length?: number): GameMode {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameMode(); const message = createBaseGameMode();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -380,7 +389,7 @@ export const GameMode: MessageFns<GameMode> = {
}, },
fromJSON(object: any): GameMode { fromJSON(object: any): GameMode {
return { name: I18nString.fromJSON(assertSet("GameMode.name", object.name)) }; return { name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined };
}, },
toJSON(message: GameMode): unknown { toJSON(message: GameMode): unknown {
@@ -398,33 +407,29 @@ export const GameMode: MessageFns<GameMode> = {
const message = createBaseGameMode(); const message = createBaseGameMode();
message.name = (object.name !== undefined && object.name !== null) message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name) ? I18nString.fromPartial(object.name)
: createBaseI18nString(); : undefined;
return message; return message;
}, },
}; };
export function createBaseGameModeRole(): GameModeRole { function createBaseGameModeRole(): GameModeRole {
return { provisions: [], consumables: [] }; return { provisions: [], consumables: [] };
} }
export const GameModeRole: MessageFns<GameModeRole> = { export const GameModeRole: MessageFns<GameModeRole> = {
encode(message: GameModeRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: GameModeRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
writer.uint32(10).fork();
for (const v of message.provisions) { for (const v of message.provisions) {
writer.uint32(v); writer.uint32(8).uint32(v!);
} }
writer.join();
writer.uint32(18).fork();
for (const v of message.consumables) { for (const v of message.consumables) {
writer.uint32(v); writer.uint32(16).uint32(v!);
} }
writer.join();
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): GameModeRole { decode(input: BinaryReader | Uint8Array, length?: number): GameModeRole {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGameModeRole(); const message = createBaseGameModeRole();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -528,14 +533,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
+30 -32
View File
@@ -1,8 +1,8 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/i18n.proto // source: i18n.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -18,13 +18,13 @@ export interface I18nString_LocalesEntry {
value: string; value: string;
} }
export function createBaseI18nString(): I18nString { function createBaseI18nString(): I18nString {
return { locales: {} }; return { locales: {} };
} }
export const I18nString: MessageFns<I18nString> = { export const I18nString: MessageFns<I18nString> = {
encode(message: I18nString, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: I18nString, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.locales).forEach(([key, value]) => { globalThis.Object.entries(message.locales).forEach(([key, value]: [string, string]) => {
I18nString_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); I18nString_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
}); });
return writer; return writer;
@@ -32,7 +32,7 @@ export const I18nString: MessageFns<I18nString> = {
decode(input: BinaryReader | Uint8Array, length?: number): I18nString { decode(input: BinaryReader | Uint8Array, length?: number): I18nString {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseI18nString(); const message = createBaseI18nString();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -60,10 +60,13 @@ export const I18nString: MessageFns<I18nString> = {
fromJSON(object: any): I18nString { fromJSON(object: any): I18nString {
return { return {
locales: isObject(object.locales) locales: isObject(object.locales)
? Object.entries(object.locales).reduce<{ [key: string]: string }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.locales) as [string, any][]).reduce(
acc[key] = String(value); (acc: { [key: string]: string }, [key, value]: [string, any]) => {
return acc; acc[key] = globalThis.String(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -71,7 +74,7 @@ export const I18nString: MessageFns<I18nString> = {
toJSON(message: I18nString): unknown { toJSON(message: I18nString): unknown {
const obj: any = {}; const obj: any = {};
if (message.locales) { if (message.locales) {
const entries = Object.entries(message.locales); const entries = globalThis.Object.entries(message.locales) as [string, string][];
if (entries.length > 0) { if (entries.length > 0) {
obj.locales = {}; obj.locales = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -87,26 +90,29 @@ export const I18nString: MessageFns<I18nString> = {
}, },
fromPartial<I extends Exact<DeepPartial<I18nString>, I>>(object: I): I18nString { fromPartial<I extends Exact<DeepPartial<I18nString>, I>>(object: I): I18nString {
const message = createBaseI18nString(); const message = createBaseI18nString();
message.locales = Object.entries(object.locales ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => { message.locales = (globalThis.Object.entries(object.locales ?? {}) as [string, string][]).reduce(
if (value !== undefined) { (acc: { [key: string]: string }, [key, value]: [string, string]) => {
acc[key] = globalThis.String(value); if (value !== undefined) {
} acc[key] = globalThis.String(value);
return acc; }
}, {}); return acc;
},
{},
);
return message; return message;
}, },
}; };
export function createBaseI18nString_LocalesEntry(): I18nString_LocalesEntry { function createBaseI18nString_LocalesEntry(): I18nString_LocalesEntry {
return { key: "", value: "" }; return { key: "", value: "" };
} }
export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = { export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
encode(message: I18nString_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: I18nString_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== "") {
writer.uint32(10).string(message.key); writer.uint32(10).string(message.key);
} }
if (message.value !== undefined) { if (message.value !== "") {
writer.uint32(18).string(message.value); writer.uint32(18).string(message.value);
} }
return writer; return writer;
@@ -114,7 +120,7 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
decode(input: BinaryReader | Uint8Array, length?: number): I18nString_LocalesEntry { decode(input: BinaryReader | Uint8Array, length?: number): I18nString_LocalesEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseI18nString_LocalesEntry(); const message = createBaseI18nString_LocalesEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -146,17 +152,17 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
fromJSON(object: any): I18nString_LocalesEntry { fromJSON(object: any): I18nString_LocalesEntry {
return { return {
key: globalThis.String(assertSet("I18nString_LocalesEntry.key", object.key)), key: isSet(object.key) ? globalThis.String(object.key) : "",
value: globalThis.String(assertSet("I18nString_LocalesEntry.value", object.value)), value: isSet(object.value) ? globalThis.String(object.value) : "",
}; };
}, },
toJSON(message: I18nString_LocalesEntry): unknown { toJSON(message: I18nString_LocalesEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== "") {
obj.key = message.key; obj.key = message.key;
} }
if (message.value !== undefined) { if (message.value !== "") {
obj.value = message.value; obj.value = message.value;
} }
return obj; return obj;
@@ -194,14 +200,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
+15 -15
View File
@@ -1,16 +1,16 @@
// @ts-nocheck // @ts-nocheck
export * from './average_definitions.ts'; export * from "./average_definitions.ts";
export * from './camouflage_definitions.ts'; export * from "./camouflage_definitions.ts";
export * from './consumable_definitions.ts'; export * from "./consumable_definitions.ts";
export * from './equipment_definitions.ts'; export * from "./equipment_definitions.ts";
export * from './gallery.ts'; export * from "./gallery.ts";
export * from './game_definitions.ts'; export * from "./game_definitions.ts";
export * from './i18n.ts'; export * from "./i18n.ts";
export * from './map_definitions.ts'; export * from "./map_definitions.ts";
export * from './model_definitions.ts'; export * from "./model_definitions.ts";
export * from './popular_tanks.ts'; export * from "./popular_tanks.ts";
export * from './provision_definitions.ts'; export * from "./provision_definitions.ts";
export * from './rating_leaderboard.ts'; export * from "./rating_leaderboard.ts";
export * from './reviews.ts'; export * from "./reviews.ts";
export * from './skill_definitions.ts'; export * from "./skill_definitions.ts";
export * from './tank_definitions.ts'; export * from "./tank_definitions.ts";
@@ -2,13 +2,13 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "i18n.proto";
message MapDefinitions { message MapDefinitions {
map<int32, MapDefinition> maps = 1; map<int32, MapDefinition> maps = 1;
} }
message MapDefinition { message MapDefinition {
required uint32 id = 1; required uint32 id = 1;
required I18nString name = 2; required I18nString name = 2;
} }
+38 -40
View File
@@ -1,12 +1,12 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/map_definitions.proto // source: map_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { createBaseI18nString, I18nString } from "./i18n"; import { I18nString } from "./i18n";
export const protobufPackage = "blitzkit"; export const protobufPackage = "blitzkit";
@@ -21,16 +21,16 @@ export interface MapDefinitions_MapsEntry {
export interface MapDefinition { export interface MapDefinition {
id: number; id: number;
name: I18nString; name: I18nString | undefined;
} }
export function createBaseMapDefinitions(): MapDefinitions { function createBaseMapDefinitions(): MapDefinitions {
return { maps: {} }; return { maps: {} };
} }
export const MapDefinitions: MessageFns<MapDefinitions> = { export const MapDefinitions: MessageFns<MapDefinitions> = {
encode(message: MapDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: MapDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.maps).forEach(([key, value]) => { globalThis.Object.entries(message.maps).forEach(([key, value]: [string, MapDefinition]) => {
MapDefinitions_MapsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); MapDefinitions_MapsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
}); });
return writer; return writer;
@@ -38,7 +38,7 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMapDefinitions(); const message = createBaseMapDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -66,10 +66,13 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
fromJSON(object: any): MapDefinitions { fromJSON(object: any): MapDefinitions {
return { return {
maps: isObject(object.maps) maps: isObject(object.maps)
? Object.entries(object.maps).reduce<{ [key: number]: MapDefinition }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.maps) as [string, any][]).reduce(
acc[globalThis.Number(key)] = MapDefinition.fromJSON(value); (acc: { [key: number]: MapDefinition }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = MapDefinition.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -77,7 +80,7 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
toJSON(message: MapDefinitions): unknown { toJSON(message: MapDefinitions): unknown {
const obj: any = {}; const obj: any = {};
if (message.maps) { if (message.maps) {
const entries = Object.entries(message.maps); const entries = globalThis.Object.entries(message.maps) as [string, MapDefinition][];
if (entries.length > 0) { if (entries.length > 0) {
obj.maps = {}; obj.maps = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -93,23 +96,26 @@ export const MapDefinitions: MessageFns<MapDefinitions> = {
}, },
fromPartial<I extends Exact<DeepPartial<MapDefinitions>, I>>(object: I): MapDefinitions { fromPartial<I extends Exact<DeepPartial<MapDefinitions>, I>>(object: I): MapDefinitions {
const message = createBaseMapDefinitions(); const message = createBaseMapDefinitions();
message.maps = Object.entries(object.maps ?? {}).reduce<{ [key: number]: MapDefinition }>((acc, [key, value]) => { message.maps = (globalThis.Object.entries(object.maps ?? {}) as [string, MapDefinition][]).reduce(
if (value !== undefined) { (acc: { [key: number]: MapDefinition }, [key, value]: [string, MapDefinition]) => {
acc[globalThis.Number(key)] = MapDefinition.fromPartial(value); if (value !== undefined) {
} acc[globalThis.Number(key)] = MapDefinition.fromPartial(value);
return acc; }
}, {}); return acc;
},
{},
);
return message; return message;
}, },
}; };
export function createBaseMapDefinitions_MapsEntry(): MapDefinitions_MapsEntry { function createBaseMapDefinitions_MapsEntry(): MapDefinitions_MapsEntry {
return { key: 0, value: createBaseMapDefinition() }; return { key: 0, value: undefined };
} }
export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = { export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
encode(message: MapDefinitions_MapsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: MapDefinitions_MapsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).int32(message.key); writer.uint32(8).int32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -120,7 +126,7 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions_MapsEntry { decode(input: BinaryReader | Uint8Array, length?: number): MapDefinitions_MapsEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMapDefinitions_MapsEntry(); const message = createBaseMapDefinitions_MapsEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -152,14 +158,14 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
fromJSON(object: any): MapDefinitions_MapsEntry { fromJSON(object: any): MapDefinitions_MapsEntry {
return { return {
key: globalThis.Number(assertSet("MapDefinitions_MapsEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: MapDefinition.fromJSON(assertSet("MapDefinitions_MapsEntry.value", object.value)), value: isSet(object.value) ? MapDefinition.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: MapDefinitions_MapsEntry): unknown { toJSON(message: MapDefinitions_MapsEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -176,13 +182,13 @@ export const MapDefinitions_MapsEntry: MessageFns<MapDefinitions_MapsEntry> = {
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? MapDefinition.fromPartial(object.value) ? MapDefinition.fromPartial(object.value)
: createBaseMapDefinition(); : undefined;
return message; return message;
}, },
}; };
export function createBaseMapDefinition(): MapDefinition { function createBaseMapDefinition(): MapDefinition {
return { id: 0, name: createBaseI18nString() }; return { id: 0, name: undefined };
} }
export const MapDefinition: MessageFns<MapDefinition> = { export const MapDefinition: MessageFns<MapDefinition> = {
@@ -198,7 +204,7 @@ export const MapDefinition: MessageFns<MapDefinition> = {
decode(input: BinaryReader | Uint8Array, length?: number): MapDefinition { decode(input: BinaryReader | Uint8Array, length?: number): MapDefinition {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMapDefinition(); const message = createBaseMapDefinition();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -230,8 +236,8 @@ export const MapDefinition: MessageFns<MapDefinition> = {
fromJSON(object: any): MapDefinition { fromJSON(object: any): MapDefinition {
return { return {
id: globalThis.Number(assertSet("MapDefinition.id", object.id)), id: isSet(object.id) ? globalThis.Number(object.id) : 0,
name: I18nString.fromJSON(assertSet("MapDefinition.name", object.name)), name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
}; };
}, },
@@ -254,7 +260,7 @@ export const MapDefinition: MessageFns<MapDefinition> = {
message.id = object.id ?? 0; message.id = object.id ?? 0;
message.name = (object.name !== undefined && object.name !== null) message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name) ? I18nString.fromPartial(object.name)
: createBaseI18nString(); : undefined;
return message; return message;
}, },
}; };
@@ -280,14 +286,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
@@ -7,17 +7,17 @@ message ModelDefinitions {
} }
message ModelDefinition { message ModelDefinition {
required Armor armor = 1; required Armor armor = 1;
required Vector3 turret_origin = 2; required Vector3 turret_origin = 2;
optional InitialTurretRotation initial_turret_rotation = 3; optional InitialTurretRotation initial_turret_rotation = 3;
map<uint32, TurretModelDefinition> turrets = 4; map<uint32, TurretModelDefinition> turrets = 4;
map<uint32, TrackModelDefinition> tracks = 5; map<uint32, TrackModelDefinition> tracks = 5;
required BoundingBox bounding_box = 6; required BoundingBox bounding_box = 6;
} }
message Armor { message Armor {
map<uint32, float> thickness = 1; map<uint32, float> thickness = 1;
repeated uint32 spaced = 2; repeated uint32 spaced = 2;
} }
message Vector3 { message Vector3 {
@@ -27,18 +27,18 @@ message Vector3 {
} }
message InitialTurretRotation { message InitialTurretRotation {
required float yaw = 1; required float yaw = 1;
required float pitch = 2; required float pitch = 2;
required float roll = 3; required float roll = 3;
} }
message TurretModelDefinition { message TurretModelDefinition {
required BoundingBox bounding_box = 1; required BoundingBox bounding_box = 1;
required Armor armor = 2; required Armor armor = 2;
required uint32 model_id = 3; required uint32 model_id = 3;
required Vector3 gun_origin = 4; required Vector3 gun_origin = 4;
map<uint32, GunModelDefinition> guns = 5; map<uint32, GunModelDefinition> guns = 5;
optional YawLimits yaw = 6; optional YawLimits yaw = 6;
} }
message YawLimits { message YawLimits {
@@ -52,28 +52,28 @@ message BoundingBox {
} }
message TrackModelDefinition { message TrackModelDefinition {
required float thickness = 1; required float thickness = 1;
required Vector3 origin = 2; required Vector3 origin = 2;
} }
message GunModelDefinition { message GunModelDefinition {
required Armor armor = 1; required Armor armor = 1;
required float thickness = 2; required float thickness = 2;
required uint32 model_id = 3; required uint32 model_id = 3;
required PitchLimits pitch = 4; required PitchLimits pitch = 4;
optional float mask = 5; optional float mask = 5;
} }
message PitchLimits { message PitchLimits {
required float min = 1; required float min = 1;
required float max = 2; required float max = 2;
optional PitchLimitsExtrema front = 3; optional PitchLimitsExtrema front = 3;
optional PitchLimitsExtrema back = 4; optional PitchLimitsExtrema back = 4;
optional float transition = 5; optional float transition = 5;
} }
message PitchLimitsExtrema { message PitchLimitsExtrema {
required float min = 1; required float min = 1;
required float max = 2; required float max = 2;
required float range = 3; required float range = 3;
} }
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -7,6 +7,6 @@ message PopularTanks {
} }
message PopularTank { message PopularTank {
required uint32 id = 1; required uint32 id = 1;
required uint32 views = 2; // views in the last 7 days required uint32 views = 2; // views in the last 7 days
} }
+8 -16
View File
@@ -1,8 +1,8 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/popular_tanks.proto // source: popular_tanks.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -19,7 +19,7 @@ export interface PopularTank {
views: number; views: number;
} }
export function createBasePopularTanks(): PopularTanks { function createBasePopularTanks(): PopularTanks {
return { tanks: [] }; return { tanks: [] };
} }
@@ -33,7 +33,7 @@ export const PopularTanks: MessageFns<PopularTanks> = {
decode(input: BinaryReader | Uint8Array, length?: number): PopularTanks { decode(input: BinaryReader | Uint8Array, length?: number): PopularTanks {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePopularTanks(); const message = createBasePopularTanks();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -79,7 +79,7 @@ export const PopularTanks: MessageFns<PopularTanks> = {
}, },
}; };
export function createBasePopularTank(): PopularTank { function createBasePopularTank(): PopularTank {
return { id: 0, views: 0 }; return { id: 0, views: 0 };
} }
@@ -96,7 +96,7 @@ export const PopularTank: MessageFns<PopularTank> = {
decode(input: BinaryReader | Uint8Array, length?: number): PopularTank { decode(input: BinaryReader | Uint8Array, length?: number): PopularTank {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePopularTank(); const message = createBasePopularTank();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -128,8 +128,8 @@ export const PopularTank: MessageFns<PopularTank> = {
fromJSON(object: any): PopularTank { fromJSON(object: any): PopularTank {
return { return {
id: globalThis.Number(assertSet("PopularTank.id", object.id)), id: isSet(object.id) ? globalThis.Number(object.id) : 0,
views: globalThis.Number(assertSet("PopularTank.views", object.views)), views: isSet(object.views) ? globalThis.Number(object.views) : 0,
}; };
}, },
@@ -172,14 +172,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
@@ -2,18 +2,18 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/consumable_definitions.proto"; import "consumable_definitions.proto";
import "packages/core/src/protos/i18n.proto"; import "i18n.proto";
message ProvisionDefinitions { message ProvisionDefinitions {
map<uint32, Provision> provisions = 1; map<uint32, Provision> provisions = 1;
} }
message Provision { message Provision {
required uint32 id = 1; required uint32 id = 1;
required I18nString name = 2; required I18nString name = 2;
optional float crew = 3; optional float crew = 3;
required bool game_mode_exclusive = 5; required bool game_mode_exclusive = 5;
repeated ConsumableTankFilter include = 6; repeated ConsumableTankFilter include = 6;
repeated ConsumableTankFilter exclude = 7; repeated ConsumableTankFilter exclude = 7;
} }
@@ -1,13 +1,13 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/provision_definitions.proto // source: provision_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { ConsumableTankFilter } from "./consumable_definitions"; import { ConsumableTankFilter } from "./consumable_definitions";
import { createBaseI18nString, I18nString } from "./i18n"; import { I18nString } from "./i18n";
export const protobufPackage = "blitzkit"; export const protobufPackage = "blitzkit";
@@ -22,20 +22,20 @@ export interface ProvisionDefinitions_ProvisionsEntry {
export interface Provision { export interface Provision {
id: number; id: number;
name: I18nString; name: I18nString | undefined;
crew?: number | undefined; crew?: number | undefined;
game_mode_exclusive: boolean; game_mode_exclusive: boolean;
include: ConsumableTankFilter[]; include: ConsumableTankFilter[];
exclude: ConsumableTankFilter[]; exclude: ConsumableTankFilter[];
} }
export function createBaseProvisionDefinitions(): ProvisionDefinitions { function createBaseProvisionDefinitions(): ProvisionDefinitions {
return { provisions: {} }; return { provisions: {} };
} }
export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = { export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
encode(message: ProvisionDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: ProvisionDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.provisions).forEach(([key, value]) => { globalThis.Object.entries(message.provisions).forEach(([key, value]: [string, Provision]) => {
ProvisionDefinitions_ProvisionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); ProvisionDefinitions_ProvisionsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
}); });
return writer; return writer;
@@ -43,7 +43,7 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseProvisionDefinitions(); const message = createBaseProvisionDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -71,10 +71,13 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
fromJSON(object: any): ProvisionDefinitions { fromJSON(object: any): ProvisionDefinitions {
return { return {
provisions: isObject(object.provisions) provisions: isObject(object.provisions)
? Object.entries(object.provisions).reduce<{ [key: number]: Provision }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.provisions) as [string, any][]).reduce(
acc[globalThis.Number(key)] = Provision.fromJSON(value); (acc: { [key: number]: Provision }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = Provision.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -82,7 +85,7 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
toJSON(message: ProvisionDefinitions): unknown { toJSON(message: ProvisionDefinitions): unknown {
const obj: any = {}; const obj: any = {};
if (message.provisions) { if (message.provisions) {
const entries = Object.entries(message.provisions); const entries = globalThis.Object.entries(message.provisions) as [string, Provision][];
if (entries.length > 0) { if (entries.length > 0) {
obj.provisions = {}; obj.provisions = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -98,8 +101,8 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
}, },
fromPartial<I extends Exact<DeepPartial<ProvisionDefinitions>, I>>(object: I): ProvisionDefinitions { fromPartial<I extends Exact<DeepPartial<ProvisionDefinitions>, I>>(object: I): ProvisionDefinitions {
const message = createBaseProvisionDefinitions(); const message = createBaseProvisionDefinitions();
message.provisions = Object.entries(object.provisions ?? {}).reduce<{ [key: number]: Provision }>( message.provisions = (globalThis.Object.entries(object.provisions ?? {}) as [string, Provision][]).reduce(
(acc, [key, value]) => { (acc: { [key: number]: Provision }, [key, value]: [string, Provision]) => {
if (value !== undefined) { if (value !== undefined) {
acc[globalThis.Number(key)] = Provision.fromPartial(value); acc[globalThis.Number(key)] = Provision.fromPartial(value);
} }
@@ -111,13 +114,13 @@ export const ProvisionDefinitions: MessageFns<ProvisionDefinitions> = {
}, },
}; };
export function createBaseProvisionDefinitions_ProvisionsEntry(): ProvisionDefinitions_ProvisionsEntry { function createBaseProvisionDefinitions_ProvisionsEntry(): ProvisionDefinitions_ProvisionsEntry {
return { key: 0, value: createBaseProvision() }; return { key: 0, value: undefined };
} }
export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitions_ProvisionsEntry> = { export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitions_ProvisionsEntry> = {
encode(message: ProvisionDefinitions_ProvisionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: ProvisionDefinitions_ProvisionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).uint32(message.key); writer.uint32(8).uint32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -128,7 +131,7 @@ export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitio
decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions_ProvisionsEntry { decode(input: BinaryReader | Uint8Array, length?: number): ProvisionDefinitions_ProvisionsEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseProvisionDefinitions_ProvisionsEntry(); const message = createBaseProvisionDefinitions_ProvisionsEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -160,14 +163,14 @@ export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitio
fromJSON(object: any): ProvisionDefinitions_ProvisionsEntry { fromJSON(object: any): ProvisionDefinitions_ProvisionsEntry {
return { return {
key: globalThis.Number(assertSet("ProvisionDefinitions_ProvisionsEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: Provision.fromJSON(assertSet("ProvisionDefinitions_ProvisionsEntry.value", object.value)), value: isSet(object.value) ? Provision.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: ProvisionDefinitions_ProvisionsEntry): unknown { toJSON(message: ProvisionDefinitions_ProvisionsEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -188,13 +191,13 @@ export const ProvisionDefinitions_ProvisionsEntry: MessageFns<ProvisionDefinitio
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? Provision.fromPartial(object.value) ? Provision.fromPartial(object.value)
: createBaseProvision(); : undefined;
return message; return message;
}, },
}; };
export function createBaseProvision(): Provision { function createBaseProvision(): Provision {
return { id: 0, name: createBaseI18nString(), crew: undefined, game_mode_exclusive: false, include: [], exclude: [] }; return { id: 0, name: undefined, crew: 0, game_mode_exclusive: false, include: [], exclude: [] };
} }
export const Provision: MessageFns<Provision> = { export const Provision: MessageFns<Provision> = {
@@ -205,7 +208,7 @@ export const Provision: MessageFns<Provision> = {
if (message.name !== undefined) { if (message.name !== undefined) {
I18nString.encode(message.name, writer.uint32(18).fork()).join(); I18nString.encode(message.name, writer.uint32(18).fork()).join();
} }
if (message.crew !== undefined && message.crew !== undefined) { if (message.crew !== undefined && message.crew !== 0) {
writer.uint32(29).float(message.crew); writer.uint32(29).float(message.crew);
} }
if (message.game_mode_exclusive !== false) { if (message.game_mode_exclusive !== false) {
@@ -222,7 +225,7 @@ export const Provision: MessageFns<Provision> = {
decode(input: BinaryReader | Uint8Array, length?: number): Provision { decode(input: BinaryReader | Uint8Array, length?: number): Provision {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseProvision(); const message = createBaseProvision();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -286,10 +289,14 @@ export const Provision: MessageFns<Provision> = {
fromJSON(object: any): Provision { fromJSON(object: any): Provision {
return { return {
id: globalThis.Number(assertSet("Provision.id", object.id)), id: isSet(object.id) ? globalThis.Number(object.id) : 0,
name: I18nString.fromJSON(assertSet("Provision.name", object.name)), name: isSet(object.name) ? I18nString.fromJSON(object.name) : undefined,
crew: isSet(object.crew) ? globalThis.Number(object.crew) : undefined, crew: isSet(object.crew) ? globalThis.Number(object.crew) : 0,
game_mode_exclusive: globalThis.Boolean(assertSet("Provision.game_mode_exclusive", object.game_mode_exclusive)), game_mode_exclusive: isSet(object.gameModeExclusive)
? globalThis.Boolean(object.gameModeExclusive)
: isSet(object.game_mode_exclusive)
? globalThis.Boolean(object.game_mode_exclusive)
: false,
include: globalThis.Array.isArray(object?.include) include: globalThis.Array.isArray(object?.include)
? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e)) ? object.include.map((e: any) => ConsumableTankFilter.fromJSON(e))
: [], : [],
@@ -307,11 +314,11 @@ export const Provision: MessageFns<Provision> = {
if (message.name !== undefined) { if (message.name !== undefined) {
obj.name = I18nString.toJSON(message.name); obj.name = I18nString.toJSON(message.name);
} }
if (message.crew !== undefined && message.crew !== undefined) { if (message.crew !== undefined && message.crew !== 0) {
obj.crew = message.crew; obj.crew = message.crew;
} }
if (message.game_mode_exclusive !== false) { if (message.game_mode_exclusive !== false) {
obj.game_mode_exclusive = message.game_mode_exclusive; obj.gameModeExclusive = message.game_mode_exclusive;
} }
if (message.include?.length) { if (message.include?.length) {
obj.include = message.include.map((e) => ConsumableTankFilter.toJSON(e)); obj.include = message.include.map((e) => ConsumableTankFilter.toJSON(e));
@@ -330,8 +337,8 @@ export const Provision: MessageFns<Provision> = {
message.id = object.id ?? 0; message.id = object.id ?? 0;
message.name = (object.name !== undefined && object.name !== null) message.name = (object.name !== undefined && object.name !== null)
? I18nString.fromPartial(object.name) ? I18nString.fromPartial(object.name)
: createBaseI18nString(); : undefined;
message.crew = object.crew ?? undefined; message.crew = object.crew ?? 0;
message.game_mode_exclusive = object.game_mode_exclusive ?? false; message.game_mode_exclusive = object.game_mode_exclusive ?? false;
message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; message.include = object.include?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
message.exclude = object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || []; message.exclude = object.exclude?.map((e) => ConsumableTankFilter.fromPartial(e)) || [];
@@ -360,14 +367,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
@@ -14,7 +14,7 @@ message RatingLeaderboardV1 {
} }
message RatingLeaderboardEntryV1 { message RatingLeaderboardEntryV1 {
required uint32 id = 1; required uint32 id = 1;
required uint32 score = 2; required uint32 score = 2;
} }
@@ -23,11 +23,11 @@ message RatingLeaderboardV2 {
} }
message RatingLeaderboardEntryV2 { message RatingLeaderboardEntryV2 {
required uint32 id = 1; required uint32 id = 1;
required uint32 score = 2; required uint32 score = 2;
required uint32 battles = 3; required uint32 battles = 3;
required uint32 wins = 4; required uint32 wins = 4;
required uint32 survived = 5; required uint32 survived = 5;
required uint32 damage = 6; required uint32 damage = 6;
required uint32 kills = 7; required uint32 kills = 7;
} }
+35 -36
View File
@@ -1,8 +1,8 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/rating_leaderboard.proto // source: rating_leaderboard.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -36,7 +36,7 @@ export interface RatingLeaderboardEntryV2 {
kills: number; kills: number;
} }
export function createBaseRatingLeaderboard(): RatingLeaderboard { function createBaseRatingLeaderboard(): RatingLeaderboard {
return { version: undefined }; return { version: undefined };
} }
@@ -55,7 +55,7 @@ export const RatingLeaderboard: MessageFns<RatingLeaderboard> = {
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboard { decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboard {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRatingLeaderboard(); const message = createBaseRatingLeaderboard();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -99,8 +99,7 @@ export const RatingLeaderboard: MessageFns<RatingLeaderboard> = {
const obj: any = {}; const obj: any = {};
if (message.version?.$case === "v1") { if (message.version?.$case === "v1") {
obj.v1 = RatingLeaderboardV1.toJSON(message.version.value); obj.v1 = RatingLeaderboardV1.toJSON(message.version.value);
} } else if (message.version?.$case === "v2") {
if (message.version?.$case === "v2") {
obj.v2 = RatingLeaderboardV2.toJSON(message.version.value); obj.v2 = RatingLeaderboardV2.toJSON(message.version.value);
} }
return obj; return obj;
@@ -111,17 +110,25 @@ export const RatingLeaderboard: MessageFns<RatingLeaderboard> = {
}, },
fromPartial<I extends Exact<DeepPartial<RatingLeaderboard>, I>>(object: I): RatingLeaderboard { fromPartial<I extends Exact<DeepPartial<RatingLeaderboard>, I>>(object: I): RatingLeaderboard {
const message = createBaseRatingLeaderboard(); const message = createBaseRatingLeaderboard();
if (object.version?.$case === "v1" && object.version?.value !== undefined && object.version?.value !== null) { switch (object.version?.$case) {
message.version = { $case: "v1", value: RatingLeaderboardV1.fromPartial(object.version.value) }; case "v1": {
} if (object.version?.value !== undefined && object.version?.value !== null) {
if (object.version?.$case === "v2" && object.version?.value !== undefined && object.version?.value !== null) { message.version = { $case: "v1", value: RatingLeaderboardV1.fromPartial(object.version.value) };
message.version = { $case: "v2", value: RatingLeaderboardV2.fromPartial(object.version.value) }; }
break;
}
case "v2": {
if (object.version?.value !== undefined && object.version?.value !== null) {
message.version = { $case: "v2", value: RatingLeaderboardV2.fromPartial(object.version.value) };
}
break;
}
} }
return message; return message;
}, },
}; };
export function createBaseRatingLeaderboardV1(): RatingLeaderboardV1 { function createBaseRatingLeaderboardV1(): RatingLeaderboardV1 {
return { entries: [] }; return { entries: [] };
} }
@@ -135,7 +142,7 @@ export const RatingLeaderboardV1: MessageFns<RatingLeaderboardV1> = {
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardV1 { decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardV1 {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRatingLeaderboardV1(); const message = createBaseRatingLeaderboardV1();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -183,7 +190,7 @@ export const RatingLeaderboardV1: MessageFns<RatingLeaderboardV1> = {
}, },
}; };
export function createBaseRatingLeaderboardEntryV1(): RatingLeaderboardEntryV1 { function createBaseRatingLeaderboardEntryV1(): RatingLeaderboardEntryV1 {
return { id: 0, score: 0 }; return { id: 0, score: 0 };
} }
@@ -200,7 +207,7 @@ export const RatingLeaderboardEntryV1: MessageFns<RatingLeaderboardEntryV1> = {
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardEntryV1 { decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardEntryV1 {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRatingLeaderboardEntryV1(); const message = createBaseRatingLeaderboardEntryV1();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -232,8 +239,8 @@ export const RatingLeaderboardEntryV1: MessageFns<RatingLeaderboardEntryV1> = {
fromJSON(object: any): RatingLeaderboardEntryV1 { fromJSON(object: any): RatingLeaderboardEntryV1 {
return { return {
id: globalThis.Number(assertSet("RatingLeaderboardEntryV1.id", object.id)), id: isSet(object.id) ? globalThis.Number(object.id) : 0,
score: globalThis.Number(assertSet("RatingLeaderboardEntryV1.score", object.score)), score: isSet(object.score) ? globalThis.Number(object.score) : 0,
}; };
}, },
@@ -259,7 +266,7 @@ export const RatingLeaderboardEntryV1: MessageFns<RatingLeaderboardEntryV1> = {
}, },
}; };
export function createBaseRatingLeaderboardV2(): RatingLeaderboardV2 { function createBaseRatingLeaderboardV2(): RatingLeaderboardV2 {
return { entries: [] }; return { entries: [] };
} }
@@ -273,7 +280,7 @@ export const RatingLeaderboardV2: MessageFns<RatingLeaderboardV2> = {
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardV2 { decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardV2 {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRatingLeaderboardV2(); const message = createBaseRatingLeaderboardV2();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -321,7 +328,7 @@ export const RatingLeaderboardV2: MessageFns<RatingLeaderboardV2> = {
}, },
}; };
export function createBaseRatingLeaderboardEntryV2(): RatingLeaderboardEntryV2 { function createBaseRatingLeaderboardEntryV2(): RatingLeaderboardEntryV2 {
return { id: 0, score: 0, battles: 0, wins: 0, survived: 0, damage: 0, kills: 0 }; return { id: 0, score: 0, battles: 0, wins: 0, survived: 0, damage: 0, kills: 0 };
} }
@@ -353,7 +360,7 @@ export const RatingLeaderboardEntryV2: MessageFns<RatingLeaderboardEntryV2> = {
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardEntryV2 { decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardEntryV2 {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRatingLeaderboardEntryV2(); const message = createBaseRatingLeaderboardEntryV2();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -425,13 +432,13 @@ export const RatingLeaderboardEntryV2: MessageFns<RatingLeaderboardEntryV2> = {
fromJSON(object: any): RatingLeaderboardEntryV2 { fromJSON(object: any): RatingLeaderboardEntryV2 {
return { return {
id: globalThis.Number(assertSet("RatingLeaderboardEntryV2.id", object.id)), id: isSet(object.id) ? globalThis.Number(object.id) : 0,
score: globalThis.Number(assertSet("RatingLeaderboardEntryV2.score", object.score)), score: isSet(object.score) ? globalThis.Number(object.score) : 0,
battles: globalThis.Number(assertSet("RatingLeaderboardEntryV2.battles", object.battles)), battles: isSet(object.battles) ? globalThis.Number(object.battles) : 0,
wins: globalThis.Number(assertSet("RatingLeaderboardEntryV2.wins", object.wins)), wins: isSet(object.wins) ? globalThis.Number(object.wins) : 0,
survived: globalThis.Number(assertSet("RatingLeaderboardEntryV2.survived", object.survived)), survived: isSet(object.survived) ? globalThis.Number(object.survived) : 0,
damage: globalThis.Number(assertSet("RatingLeaderboardEntryV2.damage", object.damage)), damage: isSet(object.damage) ? globalThis.Number(object.damage) : 0,
kills: globalThis.Number(assertSet("RatingLeaderboardEntryV2.kills", object.kills)), kills: isSet(object.kills) ? globalThis.Number(object.kills) : 0,
}; };
}, },
@@ -494,14 +501,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
+2 -2
View File
@@ -8,10 +8,10 @@ message Reviews {
message Review { message Review {
required float last_updated = 1; required float last_updated = 1;
repeated Video videos = 2; repeated Video videos = 2;
} }
message Video { message Video {
required string id = 1; required string id = 1;
required string author = 2; required string author = 2;
} }
+42 -40
View File
@@ -1,8 +1,8 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/reviews.proto // source: reviews.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -28,13 +28,13 @@ export interface Video {
author: string; author: string;
} }
export function createBaseReviews(): Reviews { function createBaseReviews(): Reviews {
return { reviews: {} }; return { reviews: {} };
} }
export const Reviews: MessageFns<Reviews> = { export const Reviews: MessageFns<Reviews> = {
encode(message: Reviews, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: Reviews, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.reviews).forEach(([key, value]) => { globalThis.Object.entries(message.reviews).forEach(([key, value]: [string, Review]) => {
Reviews_ReviewsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); Reviews_ReviewsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
}); });
return writer; return writer;
@@ -42,7 +42,7 @@ export const Reviews: MessageFns<Reviews> = {
decode(input: BinaryReader | Uint8Array, length?: number): Reviews { decode(input: BinaryReader | Uint8Array, length?: number): Reviews {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseReviews(); const message = createBaseReviews();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -70,10 +70,13 @@ export const Reviews: MessageFns<Reviews> = {
fromJSON(object: any): Reviews { fromJSON(object: any): Reviews {
return { return {
reviews: isObject(object.reviews) reviews: isObject(object.reviews)
? Object.entries(object.reviews).reduce<{ [key: number]: Review }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.reviews) as [string, any][]).reduce(
acc[globalThis.Number(key)] = Review.fromJSON(value); (acc: { [key: number]: Review }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = Review.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -81,7 +84,7 @@ export const Reviews: MessageFns<Reviews> = {
toJSON(message: Reviews): unknown { toJSON(message: Reviews): unknown {
const obj: any = {}; const obj: any = {};
if (message.reviews) { if (message.reviews) {
const entries = Object.entries(message.reviews); const entries = globalThis.Object.entries(message.reviews) as [string, Review][];
if (entries.length > 0) { if (entries.length > 0) {
obj.reviews = {}; obj.reviews = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -97,23 +100,26 @@ export const Reviews: MessageFns<Reviews> = {
}, },
fromPartial<I extends Exact<DeepPartial<Reviews>, I>>(object: I): Reviews { fromPartial<I extends Exact<DeepPartial<Reviews>, I>>(object: I): Reviews {
const message = createBaseReviews(); const message = createBaseReviews();
message.reviews = Object.entries(object.reviews ?? {}).reduce<{ [key: number]: Review }>((acc, [key, value]) => { message.reviews = (globalThis.Object.entries(object.reviews ?? {}) as [string, Review][]).reduce(
if (value !== undefined) { (acc: { [key: number]: Review }, [key, value]: [string, Review]) => {
acc[globalThis.Number(key)] = Review.fromPartial(value); if (value !== undefined) {
} acc[globalThis.Number(key)] = Review.fromPartial(value);
return acc; }
}, {}); return acc;
},
{},
);
return message; return message;
}, },
}; };
export function createBaseReviews_ReviewsEntry(): Reviews_ReviewsEntry { function createBaseReviews_ReviewsEntry(): Reviews_ReviewsEntry {
return { key: 0, value: createBaseReview() }; return { key: 0, value: undefined };
} }
export const Reviews_ReviewsEntry: MessageFns<Reviews_ReviewsEntry> = { export const Reviews_ReviewsEntry: MessageFns<Reviews_ReviewsEntry> = {
encode(message: Reviews_ReviewsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: Reviews_ReviewsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).uint32(message.key); writer.uint32(8).uint32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -124,7 +130,7 @@ export const Reviews_ReviewsEntry: MessageFns<Reviews_ReviewsEntry> = {
decode(input: BinaryReader | Uint8Array, length?: number): Reviews_ReviewsEntry { decode(input: BinaryReader | Uint8Array, length?: number): Reviews_ReviewsEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseReviews_ReviewsEntry(); const message = createBaseReviews_ReviewsEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -156,14 +162,14 @@ export const Reviews_ReviewsEntry: MessageFns<Reviews_ReviewsEntry> = {
fromJSON(object: any): Reviews_ReviewsEntry { fromJSON(object: any): Reviews_ReviewsEntry {
return { return {
key: globalThis.Number(assertSet("Reviews_ReviewsEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: Review.fromJSON(assertSet("Reviews_ReviewsEntry.value", object.value)), value: isSet(object.value) ? Review.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: Reviews_ReviewsEntry): unknown { toJSON(message: Reviews_ReviewsEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -180,12 +186,12 @@ export const Reviews_ReviewsEntry: MessageFns<Reviews_ReviewsEntry> = {
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null)
? Review.fromPartial(object.value) ? Review.fromPartial(object.value)
: createBaseReview(); : undefined;
return message; return message;
}, },
}; };
export function createBaseReview(): Review { function createBaseReview(): Review {
return { last_updated: 0, videos: [] }; return { last_updated: 0, videos: [] };
} }
@@ -202,7 +208,7 @@ export const Review: MessageFns<Review> = {
decode(input: BinaryReader | Uint8Array, length?: number): Review { decode(input: BinaryReader | Uint8Array, length?: number): Review {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseReview(); const message = createBaseReview();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -234,7 +240,11 @@ export const Review: MessageFns<Review> = {
fromJSON(object: any): Review { fromJSON(object: any): Review {
return { return {
last_updated: globalThis.Number(assertSet("Review.last_updated", object.last_updated)), last_updated: isSet(object.lastUpdated)
? globalThis.Number(object.lastUpdated)
: isSet(object.last_updated)
? globalThis.Number(object.last_updated)
: 0,
videos: globalThis.Array.isArray(object?.videos) ? object.videos.map((e: any) => Video.fromJSON(e)) : [], videos: globalThis.Array.isArray(object?.videos) ? object.videos.map((e: any) => Video.fromJSON(e)) : [],
}; };
}, },
@@ -242,7 +252,7 @@ export const Review: MessageFns<Review> = {
toJSON(message: Review): unknown { toJSON(message: Review): unknown {
const obj: any = {}; const obj: any = {};
if (message.last_updated !== 0) { if (message.last_updated !== 0) {
obj.last_updated = message.last_updated; obj.lastUpdated = message.last_updated;
} }
if (message.videos?.length) { if (message.videos?.length) {
obj.videos = message.videos.map((e) => Video.toJSON(e)); obj.videos = message.videos.map((e) => Video.toJSON(e));
@@ -261,7 +271,7 @@ export const Review: MessageFns<Review> = {
}, },
}; };
export function createBaseVideo(): Video { function createBaseVideo(): Video {
return { id: "", author: "" }; return { id: "", author: "" };
} }
@@ -278,7 +288,7 @@ export const Video: MessageFns<Video> = {
decode(input: BinaryReader | Uint8Array, length?: number): Video { decode(input: BinaryReader | Uint8Array, length?: number): Video {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVideo(); const message = createBaseVideo();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -310,8 +320,8 @@ export const Video: MessageFns<Video> = {
fromJSON(object: any): Video { fromJSON(object: any): Video {
return { return {
id: globalThis.String(assertSet("Video.id", object.id)), id: isSet(object.id) ? globalThis.String(object.id) : "",
author: globalThis.String(assertSet("Video.author", object.author)), author: isSet(object.author) ? globalThis.String(object.author) : "",
}; };
}, },
@@ -358,14 +368,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
+32 -36
View File
@@ -1,8 +1,8 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions: // versions:
// protoc-gen-ts_proto v2.2.2 // protoc-gen-ts_proto v2.11.2
// protoc v5.28.2 // protoc v5.28.2
// source: packages/core/src/protos/skill_definitions.proto // source: skill_definitions.proto
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -23,13 +23,13 @@ export interface Skill {
skills: string[]; skills: string[];
} }
export function createBaseSkillDefinitions(): SkillDefinitions { function createBaseSkillDefinitions(): SkillDefinitions {
return { classes: {} }; return { classes: {} };
} }
export const SkillDefinitions: MessageFns<SkillDefinitions> = { export const SkillDefinitions: MessageFns<SkillDefinitions> = {
encode(message: SkillDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: SkillDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.classes).forEach(([key, value]) => { globalThis.Object.entries(message.classes).forEach(([key, value]: [string, Skill]) => {
SkillDefinitions_ClassesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); SkillDefinitions_ClassesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
}); });
return writer; return writer;
@@ -37,7 +37,7 @@ export const SkillDefinitions: MessageFns<SkillDefinitions> = {
decode(input: BinaryReader | Uint8Array, length?: number): SkillDefinitions { decode(input: BinaryReader | Uint8Array, length?: number): SkillDefinitions {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSkillDefinitions(); const message = createBaseSkillDefinitions();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -65,10 +65,13 @@ export const SkillDefinitions: MessageFns<SkillDefinitions> = {
fromJSON(object: any): SkillDefinitions { fromJSON(object: any): SkillDefinitions {
return { return {
classes: isObject(object.classes) classes: isObject(object.classes)
? Object.entries(object.classes).reduce<{ [key: number]: Skill }>((acc, [key, value]) => { ? (globalThis.Object.entries(object.classes) as [string, any][]).reduce(
acc[globalThis.Number(key)] = Skill.fromJSON(value); (acc: { [key: number]: Skill }, [key, value]: [string, any]) => {
return acc; acc[globalThis.Number(key)] = Skill.fromJSON(value);
}, {}) return acc;
},
{},
)
: {}, : {},
}; };
}, },
@@ -76,7 +79,7 @@ export const SkillDefinitions: MessageFns<SkillDefinitions> = {
toJSON(message: SkillDefinitions): unknown { toJSON(message: SkillDefinitions): unknown {
const obj: any = {}; const obj: any = {};
if (message.classes) { if (message.classes) {
const entries = Object.entries(message.classes); const entries = globalThis.Object.entries(message.classes) as [string, Skill][];
if (entries.length > 0) { if (entries.length > 0) {
obj.classes = {}; obj.classes = {};
entries.forEach(([k, v]) => { entries.forEach(([k, v]) => {
@@ -92,23 +95,26 @@ export const SkillDefinitions: MessageFns<SkillDefinitions> = {
}, },
fromPartial<I extends Exact<DeepPartial<SkillDefinitions>, I>>(object: I): SkillDefinitions { fromPartial<I extends Exact<DeepPartial<SkillDefinitions>, I>>(object: I): SkillDefinitions {
const message = createBaseSkillDefinitions(); const message = createBaseSkillDefinitions();
message.classes = Object.entries(object.classes ?? {}).reduce<{ [key: number]: Skill }>((acc, [key, value]) => { message.classes = (globalThis.Object.entries(object.classes ?? {}) as [string, Skill][]).reduce(
if (value !== undefined) { (acc: { [key: number]: Skill }, [key, value]: [string, Skill]) => {
acc[globalThis.Number(key)] = Skill.fromPartial(value); if (value !== undefined) {
} acc[globalThis.Number(key)] = Skill.fromPartial(value);
return acc; }
}, {}); return acc;
},
{},
);
return message; return message;
}, },
}; };
export function createBaseSkillDefinitions_ClassesEntry(): SkillDefinitions_ClassesEntry { function createBaseSkillDefinitions_ClassesEntry(): SkillDefinitions_ClassesEntry {
return { key: 0, value: createBaseSkill() }; return { key: 0, value: undefined };
} }
export const SkillDefinitions_ClassesEntry: MessageFns<SkillDefinitions_ClassesEntry> = { export const SkillDefinitions_ClassesEntry: MessageFns<SkillDefinitions_ClassesEntry> = {
encode(message: SkillDefinitions_ClassesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: SkillDefinitions_ClassesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) { if (message.key !== 0) {
writer.uint32(8).uint32(message.key); writer.uint32(8).uint32(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -119,7 +125,7 @@ export const SkillDefinitions_ClassesEntry: MessageFns<SkillDefinitions_ClassesE
decode(input: BinaryReader | Uint8Array, length?: number): SkillDefinitions_ClassesEntry { decode(input: BinaryReader | Uint8Array, length?: number): SkillDefinitions_ClassesEntry {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSkillDefinitions_ClassesEntry(); const message = createBaseSkillDefinitions_ClassesEntry();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -151,14 +157,14 @@ export const SkillDefinitions_ClassesEntry: MessageFns<SkillDefinitions_ClassesE
fromJSON(object: any): SkillDefinitions_ClassesEntry { fromJSON(object: any): SkillDefinitions_ClassesEntry {
return { return {
key: globalThis.Number(assertSet("SkillDefinitions_ClassesEntry.key", object.key)), key: isSet(object.key) ? globalThis.Number(object.key) : 0,
value: Skill.fromJSON(assertSet("SkillDefinitions_ClassesEntry.value", object.value)), value: isSet(object.value) ? Skill.fromJSON(object.value) : undefined,
}; };
}, },
toJSON(message: SkillDefinitions_ClassesEntry): unknown { toJSON(message: SkillDefinitions_ClassesEntry): unknown {
const obj: any = {}; const obj: any = {};
if (message.key !== undefined) { if (message.key !== 0) {
obj.key = Math.round(message.key); obj.key = Math.round(message.key);
} }
if (message.value !== undefined) { if (message.value !== undefined) {
@@ -175,14 +181,12 @@ export const SkillDefinitions_ClassesEntry: MessageFns<SkillDefinitions_ClassesE
): SkillDefinitions_ClassesEntry { ): SkillDefinitions_ClassesEntry {
const message = createBaseSkillDefinitions_ClassesEntry(); const message = createBaseSkillDefinitions_ClassesEntry();
message.key = object.key ?? 0; message.key = object.key ?? 0;
message.value = (object.value !== undefined && object.value !== null) message.value = (object.value !== undefined && object.value !== null) ? Skill.fromPartial(object.value) : undefined;
? Skill.fromPartial(object.value)
: createBaseSkill();
return message; return message;
}, },
}; };
export function createBaseSkill(): Skill { function createBaseSkill(): Skill {
return { skills: [] }; return { skills: [] };
} }
@@ -196,7 +200,7 @@ export const Skill: MessageFns<Skill> = {
decode(input: BinaryReader | Uint8Array, length?: number): Skill { decode(input: BinaryReader | Uint8Array, length?: number): Skill {
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 end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSkill(); const message = createBaseSkill();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
@@ -263,14 +267,6 @@ function isSet(value: any): boolean {
return value !== null && value !== undefined; 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> { export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter; encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T; decode(input: BinaryReader | Uint8Array, length?: number): T;
+134 -124
View File
@@ -2,48 +2,58 @@ syntax = "proto2";
package blitzkit; package blitzkit;
import "packages/core/src/protos/i18n.proto"; import "i18n.proto";
message TankDefinitions { message TankDefinitions {
map<uint32, TankDefinition> tanks = 1; map<uint32, TankDefinition> tanks = 1;
} }
message TankDefinition { message TankDefinition {
required uint32 id = 1; required uint32 id = 1;
required string slug = 2; required string slug = 2;
map<uint32, uint32> roles = 3; map<uint32, uint32> roles = 3;
required bool fixed_camouflage = 5; required bool fixed_camouflage = 5;
repeated int32 camouflages = 6; repeated int32 camouflages = 6;
repeated int32 ancestors = 7; repeated int32 ancestors = 7;
repeated int32 successors = 8; repeated int32 successors = 8;
repeated Crew crew = 9; repeated Crew crew = 9;
required uint32 health = 10; required uint32 health = 10;
required string nation = 11; required string nation = 11;
required I18nString name = 12; required I18nString name = 12;
required TankType type = 13; required TankType type = 13;
required uint32 max_consumables = 14; required uint32 max_consumables = 14;
required uint32 max_provisions = 15; required uint32 max_provisions = 15;
required uint32 tier = 16; required uint32 tier = 16;
required TankClass class = 17; required TankClass class = 17;
required bool testing = 18; required bool testing = 18;
required bool deprecated = 19; required bool deprecated = 19;
repeated TurretDefinition turrets = 20; repeated TurretDefinition turrets = 20;
repeated EngineDefinition engines = 21; repeated EngineDefinition engines = 21;
repeated TrackDefinition tracks = 22; repeated TrackDefinition tracks = 22;
required TankPrice price = 23; required TankPrice price = 23;
optional ResearchCost research_cost = 24; optional ResearchCost research_cost = 24;
required float speed_forwards = 25; required float speed_forwards = 25;
required float speed_backwards = 26; required float speed_backwards = 26;
required float camouflage_still = 27; required float camouflage_still = 27;
required float camouflage_moving = 28; required float camouflage_moving = 28;
required float camouflage_onFire = 29; required float camouflage_on_fire = 29;
required string equipment_preset = 30; required string equipment_preset = 30;
required uint32 weight = 31; required uint32 weight = 31;
required string dev_name = 32;
optional Equalizer equalizer = 33;
}
message Equalizer {
required float health = 1;
required float penetration = 2;
required float module_health = 3;
required float damage = 4;
required float armor = 5;
} }
message ResearchCost { message ResearchCost {
oneof research_cost_type { oneof research_cost_type {
uint32 xp = 1; uint32 xp = 1;
ResearchCostSeasonalTokens seasonal_tokens = 2; ResearchCostSeasonalTokens seasonal_tokens = 2;
} }
} }
@@ -55,77 +65,77 @@ message ResearchCostSeasonalTokens {
enum TankPriceType { enum TankPriceType {
TANK_PRICE_TYPE_CREDITS = 0; TANK_PRICE_TYPE_CREDITS = 0;
TANK_PRICE_TYPE_GOLD = 1; TANK_PRICE_TYPE_GOLD = 1;
} }
message TankPrice { message TankPrice {
required TankPriceType type = 1; required TankPriceType type = 1;
required uint32 value = 2; required uint32 value = 2;
} }
message TrackDefinition { message TrackDefinition {
required uint32 id = 1; required uint32 id = 1;
required uint32 tier = 2; required uint32 tier = 2;
required I18nString name = 3; required I18nString name = 3;
required uint32 weight = 4; required uint32 weight = 4;
required float traverse_speed = 5; required float traverse_speed = 5;
optional ResearchCost research_cost = 6; optional ResearchCost research_cost = 6;
required float dispersion_move = 7; required float dispersion_move = 7;
required float dispersion_traverse = 8; required float dispersion_traverse = 8;
required float resistance_hard = 9; required float resistance_hard = 9;
required float resistance_medium = 10; required float resistance_medium = 10;
required float resistance_soft = 11; required float resistance_soft = 11;
repeated Unlock unlocks = 12; repeated Unlock unlocks = 12;
} }
message EngineDefinition { message EngineDefinition {
required uint32 id = 1; required uint32 id = 1;
required I18nString name = 2; required I18nString name = 2;
optional ResearchCost research_cost = 3; optional ResearchCost research_cost = 3;
required uint32 tier = 4; required uint32 tier = 4;
required float fire_chance = 5; required float fire_chance = 5;
required uint32 power = 6; required uint32 power = 6;
required uint32 weight = 7; required uint32 weight = 7;
repeated Unlock unlocks = 8; repeated Unlock unlocks = 8;
} }
message TurretDefinition { message TurretDefinition {
required uint32 id = 1; required uint32 id = 1;
required uint32 health = 2; required uint32 health = 2;
required uint32 view_range = 3; required uint32 view_range = 3;
required float traverse_speed = 4; required float traverse_speed = 4;
optional ResearchCost research_cost = 5; optional ResearchCost research_cost = 5;
required I18nString name = 6; required I18nString name = 6;
required uint32 tier = 7; required uint32 tier = 7;
required uint32 weight = 8; required uint32 weight = 8;
repeated GunDefinition guns = 9; repeated GunDefinition guns = 9;
repeated Unlock unlocks = 10; repeated Unlock unlocks = 10;
} }
message GunDefinition { message GunDefinition {
oneof gun_type { oneof gun_type {
GunDefinitionRegular regular = 1; GunDefinitionRegular regular = 1;
GunDefinitionAutoLoader auto_loader = 2; GunDefinitionAutoLoader auto_loader = 2;
GunDefinitionAutoReloader auto_reloader = 3; GunDefinitionAutoReloader auto_reloader = 3;
} }
required uint32 id = 4; required uint32 id = 4;
required float rotation_speed = 5; required float rotation_speed = 5;
optional ResearchCost research_cost = 6; optional ResearchCost research_cost = 6;
required uint32 weight = 7; required uint32 weight = 7;
required I18nString name = 8; required I18nString name = 8;
required uint32 tier = 9; required uint32 tier = 9;
repeated ShellDefinition shells = 10; repeated ShellDefinition shells = 10;
required float camouflage_loss = 11; required float camouflage_loss = 11;
required float aim_time = 12; required float aim_time = 12;
required float dispersion_base = 13; required float dispersion_base = 13;
required float dispersion_traverse = 14; required float dispersion_traverse = 14;
required float dispersion_shot = 15; required float dispersion_shot = 15;
required float dispersion_damaged = 16; required float dispersion_damaged = 16;
repeated Unlock unlocks = 17; repeated Unlock unlocks = 17;
required uint32 shell_capacity = 18; required uint32 shell_capacity = 18;
optional AssaultRanges assault_ranges = 19; optional AssaultRanges assault_ranges = 19;
optional Burst burst = 20; optional Burst burst = 20;
} }
message GunDefinitionRegular { message GunDefinitionRegular {
@@ -134,101 +144,101 @@ message GunDefinitionRegular {
message GunDefinitionAutoLoader { message GunDefinitionAutoLoader {
required float clip_reload = 1; required float clip_reload = 1;
required float intra_clip = 2; required float intra_clip = 2;
required float shell_count = 3; required float shell_count = 3;
} }
message Burst { message Burst {
required uint32 count = 1; required uint32 count = 1;
required float interval = 2; required float interval = 2;
} }
message GunDefinitionAutoReloader { message GunDefinitionAutoReloader {
repeated float shell_reloads = 1; repeated float shell_reloads = 1;
required float intra_clip = 2; required float intra_clip = 2;
required float shell_count = 3; required float shell_count = 3;
} }
message AssaultRanges { message AssaultRanges {
repeated AssaultRange ranges = 1; repeated AssaultRange ranges = 1;
repeated ShellType types = 2; repeated ShellType types = 2;
} }
message AssaultRange { message AssaultRange {
required float distance = 1; required float distance = 1;
required float factor = 2; required float factor = 2;
} }
message ShellDefinition { message ShellDefinition {
required uint32 id = 1; required uint32 id = 1;
required I18nString name = 2; required I18nString name = 2;
required uint32 velocity = 3; required uint32 velocity = 3;
required uint32 armor_damage = 4; required uint32 armor_damage = 4;
required uint32 module_damage = 5; required uint32 module_damage = 5;
required float caliber = 6; required float caliber = 6;
required string icon = 7; required string icon = 7;
required ShellPenetration penetration = 8; required ShellPenetration penetration = 8;
required ShellType type = 9; required ShellType type = 9;
optional float normalization = 10; optional float normalization = 10;
optional float ricochet = 11; optional float ricochet = 11;
optional float explosion_radius = 12; optional float explosion_radius = 12;
required uint32 range = 13; required uint32 range = 13;
} }
enum ShellType { enum ShellType {
SHELL_TYPE_AP = 0; SHELL_TYPE_AP = 0;
SHELL_TYPE_APCR = 1; SHELL_TYPE_APCR = 1;
SHELL_TYPE_HEAT = 2; SHELL_TYPE_HEAT = 2;
SHELL_TYPE_HE = 3; SHELL_TYPE_HE = 3;
} }
message ShellPenetration { message ShellPenetration {
required float near = 1; required float near = 1;
required float far = 2; required float far = 2;
} }
message Unlock { message Unlock {
required int32 id = 1; required int32 id = 1;
required ModuleType type = 2; required ModuleType type = 2;
required UnlockCost cost = 3; required UnlockCost cost = 3;
} }
message UnlockCost { message UnlockCost {
required string type = 1; required string type = 1;
required int32 value = 2; required int32 value = 2;
} }
enum ModuleType { enum ModuleType {
MODULE_TYPE_VEHICLE = 0; MODULE_TYPE_VEHICLE = 0;
MODULE_TYPE_ENGINE = 1; MODULE_TYPE_ENGINE = 1;
MODULE_TYPE_TRACKS = 2; MODULE_TYPE_TRACKS = 2;
MODULE_TYPE_TURRET = 3; MODULE_TYPE_TURRET = 3;
MODULE_TYPE_GUN = 4; MODULE_TYPE_GUN = 4;
} }
enum TankClass { enum TankClass {
TANK_CLASS_LIGHT = 0; TANK_CLASS_LIGHT = 0;
TANK_CLASS_MEDIUM = 1; TANK_CLASS_MEDIUM = 1;
TANK_CLASS_HEAVY = 2; TANK_CLASS_HEAVY = 2;
TANK_CLASS_TANK_DESTROYER = 3; TANK_CLASS_TANK_DESTROYER = 3;
} }
enum TankType { enum TankType {
TANK_TYPE_RESEARCHABLE = 0; TANK_TYPE_RESEARCHABLE = 0;
TANK_TYPE_PREMIUM = 1; TANK_TYPE_PREMIUM = 1;
TANK_TYPE_COLLECTOR = 2; TANK_TYPE_COLLECTOR = 2;
} }
message Crew { message Crew {
required CrewType type = 1; required CrewType type = 1;
required uint32 count = 2; required uint32 count = 2;
repeated CrewType substitute = 3; repeated CrewType substitute = 3;
} }
enum CrewType { enum CrewType {
CREW_TYPE_COMMANDER = 0; CREW_TYPE_COMMANDER = 0;
CREW_TYPE_RADIOMAN = 1; CREW_TYPE_RADIOMAN = 1;
CREW_TYPE_GUNNER = 2; CREW_TYPE_GUNNER = 2;
CREW_TYPE_DRIVER = 3; CREW_TYPE_DRIVER = 3;
CREW_TYPE_LOADER = 4; CREW_TYPE_LOADER = 4;
} }
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,3 @@
export function bufferToBigInt(buffer: ArrayBuffer) {
return new DataView(buffer).getBigUint64(0, true);
}
+2
View File
@@ -1,4 +1,5 @@
export * from './buffer'; export * from './buffer';
export * from './bufferToBigInt';
export * from './dds'; export * from './dds';
export * from './dids'; export * from './dids';
export * from './pvr'; export * from './pvr';
@@ -7,3 +8,4 @@ export * from './sc2';
export * from './scg'; export * from './scg';
export * from './scpg'; export * from './scpg';
export * from './windows'; export * from './windows';
+12 -12
View File
@@ -1,5 +1,5 @@
import { clamp, isEqual, times } from 'lodash-es'; import { clamp, isEqual, times } from "lodash-es";
import { ReadStream } from './buffer'; import { ReadStream } from "./buffer";
export enum PvrFlags { export enum PvrFlags {
NoFlag = 0, NoFlag = 0,
@@ -96,7 +96,7 @@ export class PvrReadStream extends ReadStream {
const header = this.header(); const header = this.header();
this.metadata(); this.metadata();
if (typeof header.pixelFormat === 'number') { if (typeof header.pixelFormat === "number") {
switch (header.pixelFormat) { switch (header.pixelFormat) {
default: default:
throw new TypeError( throw new TypeError(
@@ -142,12 +142,12 @@ export class PvrReadStream extends ReadStream {
times(pixelCount, (index) => { times(pixelCount, (index) => {
const buffer = this.consumeUint8Array(2); const buffer = this.consumeUint8Array(2);
const bufferIndex = index * 4; const bufferIndex = index * 3;
const r = ((buffer[1] & 0b11111000) >>> 3) / 31; const r = ((buffer[1] & 0b11111000) >>> 3) / 31;
const g = const g =
((buffer[1] & 0b111) << 3) | (((buffer[1] & 0b111) << 3) | ((buffer[0] & 0b11100000) >>> 5)) /
(((buffer[0] & 0b11100000) >>> 5) / 31); 63;
const b = buffer[0] & 0b11111; const b = (buffer[0] & 0b11111) / 31;
data[bufferIndex] = Math.round(clamp(r * 255, 0, 255)); data[bufferIndex] = Math.round(clamp(r * 255, 0, 255));
data[bufferIndex + 1] = Math.round(clamp(g * 255, 0, 255)); data[bufferIndex + 1] = Math.round(clamp(g * 255, 0, 255));
@@ -186,7 +186,7 @@ export class PvrReadStream extends ReadStream {
metadataSize: this.uint32(), metadataSize: this.uint32(),
}; };
if (header.version !== 'PVR\x03') throw new TypeError('Endian mismatch'); if (header.version !== "PVR\x03") throw new TypeError("Endian mismatch");
return header; return header;
} }
@@ -205,19 +205,19 @@ export class PvrReadStream extends ReadStream {
resolveBitRatePixelFormat( resolveBitRatePixelFormat(
pixelFormat: Exclude<ReturnType<typeof this.pixelFormat>, number>, pixelFormat: Exclude<ReturnType<typeof this.pixelFormat>, number>,
) { ) {
if (pixelFormat.order === 'rgba') { if (pixelFormat.order === "rgba") {
if (isEqual(pixelFormat.bitRates, [4, 4, 4, 4])) { if (isEqual(pixelFormat.bitRates, [4, 4, 4, 4])) {
return ResolvedBitRatePixelFormat.R4G4B4A4; return ResolvedBitRatePixelFormat.R4G4B4A4;
} else } else
throw new TypeError( throw new TypeError(
`Unhandled rgba bit rate ${pixelFormat.bitRates.join(', ')}`, `Unhandled rgba bit rate ${pixelFormat.bitRates.join(", ")}`,
); );
} else if (pixelFormat.order === 'rgb\0') { } else if (pixelFormat.order === "rgb\0") {
if (isEqual(pixelFormat.bitRates, [5, 6, 5, 0])) { if (isEqual(pixelFormat.bitRates, [5, 6, 5, 0])) {
return ResolvedBitRatePixelFormat.R5G6B5A0; return ResolvedBitRatePixelFormat.R5G6B5A0;
} else } else
throw new TypeError( throw new TypeError(
`Unhandled rgb bit rate ${pixelFormat.bitRates.join(', ')}`, `Unhandled rgb bit rate ${pixelFormat.bitRates.join(", ")}`,
); );
} else { } else {
throw new TypeError(`Unhandled pixel order ${pixelFormat.order}`); throw new TypeError(`Unhandled pixel order ${pixelFormat.order}`);
+4 -1
View File
@@ -15,6 +15,9 @@ type DataNode = {
qualityGroup?: string; qualityGroup?: string;
fxName?: string; fxName?: string;
textures?: Textures; textures?: Textures;
customCullMode?: number;
enabledPresets?: EnabledPresets;
properties?: Properties;
} & ( } & (
| ({ | ({
configCount: number; configCount: number;
@@ -24,7 +27,7 @@ type DataNode = {
} }
); );
interface ConfigArchive { export interface ConfigArchive {
configName: string; configName: string;
fxName: string; fxName: string;
properties: Properties; properties: Properties;
+8 -1
View File
@@ -1083,6 +1083,7 @@
"tier": "Tier", "tier": "Tier",
"type": "Type", "type": "Type",
"dev_id": "DEV: ID", "dev_id": "DEV: ID",
"dev_name": "DEV: NAME",
"purchase": "Purchase price", "purchase": "Purchase price",
"restoration": "Restoration price", "restoration": "Restoration price",
"sale": "Sale price", "sale": "Sale price",
@@ -1108,6 +1109,11 @@
"configuration": { "configuration": {
"title": "Configuration", "title": "Configuration",
"equalizer": {
"title": "Equalizer",
"equalize": "Equalize",
"beta": "Beta"
},
"modules": { "modules": {
"title": "Modules", "title": "Modules",
"stock": "Stock", "stock": "Stock",
@@ -1285,7 +1291,8 @@
}, },
"skills": { "skills": {
"clear": "Clear", "clear": "Clear",
"maximize": "Maximize" "maximize": "Maximize",
"equalize": "Equalize"
}, },
"modules": { "modules": {
"stock": "Stock", "stock": "Stock",
+18 -4
View File
@@ -320,9 +320,16 @@
} }
}, },
"commands": { "commands": {
"dead": "# Stat Commands Are Dead\n\nThe BlitzKit Discord bot used to use BlitzStars to fetch periodic statistics. BlitzStars has enabled aggressive Cloudflare protections; hence, disabling BlitzKit from using BlitzStar's API. This has impacted the following commands:\n\n- `/stats`\n- `/today`\n- `/breakdown`\n- `/evolution`\n- `/full-stats`\n\nPlease use [Aftermath](<https://amth.one/invite>) as an alternative which is completely independent of BlitzStars. BlitzKit-hosted stat commands will return in the near future.",
"replay": { "replay": {
"name": "repetición", "name": "repetición",
"description": "Mostrar resultados de la repetición" "description": "Mostrar resultados de la repetición",
"options": {
"file": {
"name": "file",
"description": "Replay file"
}
}
}, },
"research": { "research": {
"name": "desarollar", "name": "desarollar",
@@ -953,6 +960,7 @@
"tier": "Nivel", "tier": "Nivel",
"type": "Tipo", "type": "Tipo",
"dev_id": "DEV: ID", "dev_id": "DEV: ID",
"dev_name": "DEV: NAME",
"purchase": "Precio de compra", "purchase": "Precio de compra",
"restoration": "Precio de restauración", "restoration": "Precio de restauración",
"sale": "Precio de venta", "sale": "Precio de venta",
@@ -973,6 +981,11 @@
}, },
"configuration": { "configuration": {
"title": "", "title": "",
"equalizer": {
"title": "Equalizer",
"equalize": "Equalize",
"beta": "Beta"
},
"modules": { "modules": {
"title": "Módulos", "title": "Módulos",
"stock": "Base", "stock": "Base",
@@ -1005,8 +1018,8 @@
"title": "Características", "title": "Características",
"compare": { "compare": {
"label": "Comparar con", "label": "Comparar con",
"class": "Tier {tier} {class}", "class": "{tier} {class}",
"tier": "All of tier {tier}", "tier": "All tier {tier}",
"all": "Todos los tanques" "all": "Todos los tanques"
}, },
"values": { "values": {
@@ -1142,7 +1155,8 @@
}, },
"skills": { "skills": {
"clear": "Limpiar", "clear": "Limpiar",
"maximize": "Maximizar" "maximize": "Maximizar",
"equalize": "Equalize"
}, },
"modules": { "modules": {
"stock": "Base", "stock": "Base",
+18 -4
View File
@@ -320,9 +320,16 @@
} }
}, },
"commands": { "commands": {
"dead": "# Stat Commands Are Dead\n\nThe BlitzKit Discord bot used to use BlitzStars to fetch periodic statistics. BlitzStars has enabled aggressive Cloudflare protections; hence, disabling BlitzKit from using BlitzStar's API. This has impacted the following commands:\n\n- `/stats`\n- `/today`\n- `/breakdown`\n- `/evolution`\n- `/full-stats`\n\nPlease use [Aftermath](<https://amth.one/invite>) as an alternative which is completely independent of BlitzStars. BlitzKit-hosted stat commands will return in the near future.",
"replay": { "replay": {
"name": "rejouer", "name": "rejouer",
"description": "Afficher les résultats de la relecture" "description": "Afficher les résultats de la relecture",
"options": {
"file": {
"name": "file",
"description": "Replay file"
}
}
}, },
"research": { "research": {
"name": "recherche", "name": "recherche",
@@ -953,6 +960,7 @@
"tier": "Rang", "tier": "Rang",
"type": "Type", "type": "Type",
"dev_id": "DEV: ID", "dev_id": "DEV: ID",
"dev_name": "DEV: NAME",
"purchase": "Purchase price", "purchase": "Purchase price",
"restoration": "Restoration price", "restoration": "Restoration price",
"sale": "Sale price", "sale": "Sale price",
@@ -973,6 +981,11 @@
}, },
"configuration": { "configuration": {
"title": "Configuration", "title": "Configuration",
"equalizer": {
"title": "Equalizer",
"equalize": "Equalize",
"beta": "Beta"
},
"modules": { "modules": {
"title": "Modules", "title": "Modules",
"stock": "Stock", "stock": "Stock",
@@ -1005,8 +1018,8 @@
"title": "Characteristics", "title": "Characteristics",
"compare": { "compare": {
"label": "Compare against", "label": "Compare against",
"class": "Tier {tier} {class}", "class": "{tier} {class}",
"tier": "All of tier {tier}", "tier": "All tier {tier}",
"all": "All tanks" "all": "All tanks"
}, },
"values": { "values": {
@@ -1142,7 +1155,8 @@
}, },
"skills": { "skills": {
"clear": "Clear", "clear": "Clear",
"maximize": "Maximize" "maximize": "Maximize",
"equalize": "Equalize"
}, },
"modules": { "modules": {
"stock": "Stock", "stock": "Stock",
+18 -4
View File
@@ -320,9 +320,16 @@
} }
}, },
"commands": { "commands": {
"dead": "# Stat Commands Are Dead\n\nThe BlitzKit Discord bot used to use BlitzStars to fetch periodic statistics. BlitzStars has enabled aggressive Cloudflare protections; hence, disabling BlitzKit from using BlitzStar's API. This has impacted the following commands:\n\n- `/stats`\n- `/today`\n- `/breakdown`\n- `/evolution`\n- `/full-stats`\n\nPlease use [Aftermath](<https://amth.one/invite>) as an alternative which is completely independent of BlitzStars. BlitzKit-hosted stat commands will return in the near future.",
"replay": { "replay": {
"name": "replay", "name": "replay",
"description": "Display replay results" "description": "Display replay results",
"options": {
"file": {
"name": "file",
"description": "Replay file"
}
}
}, },
"research": { "research": {
"name": "研究", "name": "研究",
@@ -953,6 +960,7 @@
"tier": "Tier", "tier": "Tier",
"type": "タイプ", "type": "タイプ",
"dev_id": "DEV: ID", "dev_id": "DEV: ID",
"dev_name": "DEV: NAME",
"purchase": "購入価格", "purchase": "購入価格",
"restoration": "再購入価格", "restoration": "再購入価格",
"sale": "売却価格", "sale": "売却価格",
@@ -973,6 +981,11 @@
}, },
"configuration": { "configuration": {
"title": "構成", "title": "構成",
"equalizer": {
"title": "Equalizer",
"equalize": "Equalize",
"beta": "Beta"
},
"modules": { "modules": {
"title": "モジュール", "title": "モジュール",
"stock": "初期装備", "stock": "初期装備",
@@ -1005,8 +1018,8 @@
"title": "性能値", "title": "性能値",
"compare": { "compare": {
"label": "比較対象", "label": "比較対象",
"class": "Tier {tier} {class}", "class": "{tier} {class}",
"tier": "All of tier {tier}", "tier": "All tier {tier}",
"all": "全車輌" "all": "全車輌"
}, },
"values": { "values": {
@@ -1142,7 +1155,8 @@
}, },
"skills": { "skills": {
"clear": "クリア", "clear": "クリア",
"maximize": "最大" "maximize": "最大",
"equalize": "Equalize"
}, },
"modules": { "modules": {
"stock": "初期装備", "stock": "初期装備",
+53 -39
View File
@@ -1,6 +1,6 @@
{ {
"test": { "test": {
"default": "", "default": "test",
"long": "This is a long test string. You MUST NEVER see this in the UI. My favorite fruit is {fruit} because it has the color of {color}. I like it so much that I will say its name 3 times! {fruit}! {fruit}! {fruit}! Once again, it's {color}, not {not_color}.", "long": "This is a long test string. You MUST NEVER see this in the UI. My favorite fruit is {fruit} because it has the color of {color}. I like it so much that I will say its name 3 times! {fruit}! {fruit}! {fruit}! Once again, it's {color}, not {not_color}.",
"fox": "Szybki brązowy lis przeskoczył nad leniwym psem." "fox": "Szybki brązowy lis przeskoczył nad leniwym psem."
}, },
@@ -17,9 +17,9 @@
"plus": "+{value}" "plus": "+{value}"
}, },
"gun_types": { "gun_types": {
"auto_loader": "Auto loader", "auto_loader": "Samo ładowacz",
"auto_reloader": "Automatyczne przeładowanie", "auto_reloader": "Automatyczne przeładowanie",
"regular": "" "regular": "Regular"
}, },
"shells": { "shells": {
"ap": "AP", "ap": "AP",
@@ -28,18 +28,18 @@
"he": "OB" "he": "OB"
}, },
"player_count_period": { "player_count_period": {
"total": "Total", "total": "Łącznie",
"d_120": "Past 120 days", "d_120": "Powyżej 120 dni",
"d_90": "Past 90 days", "d_90": "Powyżej 90 dni",
"d_60": "Past 60 days", "d_60": "Powyżej 60 dni",
"d_30": "Past month", "d_30": "W ciągu miesiąca",
"d_7": "W minionym tygodniu", "d_7": "W minionym tygodniu",
"d_1": "Yesterday" "d_1": "Wczoraj"
}, },
"branches": { "branches": {
"local": "dev", "local": "dev",
"dev": "beta", "dev": "beta",
"opentest": "opentest", "opentest": "otwarty test",
"preview": "podgląd" "preview": "podgląd"
}, },
"locales": { "locales": {
@@ -80,45 +80,45 @@
}, },
"nations": { "nations": {
"ussr": "ZSRR", "ussr": "ZSRR",
"germany": "Germany", "germany": "Niemcy",
"usa": "U.S.A.", "usa": "Stany Zjednoczone.",
"china": "Chiny", "china": "Chiny",
"uk": "Wielka Brytania", "uk": "Wielka Brytania",
"france": "France", "france": "Francja",
"japan": "Japan", "japan": "Japonia",
"european": "Nacja Europejska", "european": "Nacja Europejska",
"other": "Nacja Hybrydowa" "other": "Nacja Hybrydowa"
}, },
"nations_adjectives": { "nations_adjectives": {
"ussr": "ZSRR", "ussr": "ZSRR",
"germany": "German", "germany": "Niemcy",
"usa": "Amerykański", "usa": "Amerykański",
"china": "Chiński", "china": "Chiński",
"uk": "Wielkiej Brytanii", "uk": "Wielkiej Brytanii",
"france": "Francuski", "france": "Francuski",
"japan": "Japoński", "japan": "Japoński",
"european": "European", "european": "Europa",
"other": "Hybrid" "other": "Hybryda"
}, },
"tank_class_short": { "tank_class_short": {
"-1": "unrecognized", "-1": "unrecognized",
"0": "Light", "0": "Lekki",
"1": "Medium", "1": "Średni",
"2": "Heavy", "2": "Ciężki",
"3": "TD" "3": "TD"
}, },
"tank_class_short_plural_lowercase": { "tank_class_short_plural_lowercase": {
"0": "lights", "0": "lekkie",
"1": "mediums", "1": "średnie",
"2": "heavies", "2": "ciężkie",
"3": "TDs" "3": "TDs"
}, },
"tank_class_medium": { "tank_class_medium": {
"-1": "unrecognized", "-1": "unrecognized",
"0": "Lekki", "0": "Lekki",
"1": "Medium", "1": "Średni",
"2": "Heavy", "2": "Ciężki",
"3": "Tank destroyer" "3": "Niszczyciel czołgów"
}, },
"tree_type": { "tree_type": {
"-1": "unrecognized", "-1": "unrecognized",
@@ -210,7 +210,7 @@
"good": "Dobrze", "good": "Dobrze",
"very_good": "Bardzo dobrze", "very_good": "Bardzo dobrze",
"great": "Świetne", "great": "Świetne",
"unicum": "Unikalny ", "unicum": "Unikalny",
"super_unicum": "Bardzo unikalny" "super_unicum": "Bardzo unikalny"
} }
}, },
@@ -236,7 +236,7 @@
"description": "Kariera" "description": "Kariera"
}, },
"custom": { "custom": {
"name": "Niestandardowy", "name": "custom",
"description": "Zakres niestandardowy", "description": "Zakres niestandardowy",
"options": { "options": {
"start": { "start": {
@@ -320,9 +320,16 @@
} }
}, },
"commands": { "commands": {
"dead": "# Stat Commands Are Dead\n\nThe BlitzKit Discord bot used to use BlitzStars to fetch periodic statistics. BlitzStars has enabled aggressive Cloudflare protections; hence, disabling BlitzKit from using BlitzStar's API. This has impacted the following commands:\n\n- `/stats`\n- `/today`\n- `/breakdown`\n- `/evolution`\n- `/full-stats`\n\nPlease use [Aftermath](<https://amth.one/invite>) as an alternative which is completely independent of BlitzStars. BlitzKit-hosted stat commands will return in the near future.",
"replay": { "replay": {
"name": "powtórz", "name": "powtórz",
"description": "Wyświetl wyniki powtórki" "description": "Wyświetl wyniki powtórki",
"options": {
"file": {
"name": "file",
"description": "Replay file"
}
}
}, },
"research": { "research": {
"name": "badanie", "name": "badanie",
@@ -849,7 +856,7 @@
"hull": "Hull", "hull": "Hull",
"turret": "Turret", "turret": "Turret",
"hard": "Hard", "hard": "Hard",
"medium": "Medium", "medium": "Średni",
"soft": "Soft", "soft": "Soft",
"effective": "Effective" "effective": "Effective"
}, },
@@ -953,6 +960,7 @@
"tier": "Poziom", "tier": "Poziom",
"type": "Rodzaj", "type": "Rodzaj",
"dev_id": "DEV: ID", "dev_id": "DEV: ID",
"dev_name": "DEV: NAME",
"purchase": "Purchase price", "purchase": "Purchase price",
"restoration": "Restoration price", "restoration": "Restoration price",
"sale": "Sale price", "sale": "Sale price",
@@ -973,6 +981,11 @@
}, },
"configuration": { "configuration": {
"title": "Configuration", "title": "Configuration",
"equalizer": {
"title": "Equalizer",
"equalize": "Equalize",
"beta": "Beta"
},
"modules": { "modules": {
"title": "Modules", "title": "Modules",
"stock": "Stock", "stock": "Stock",
@@ -1005,8 +1018,8 @@
"title": "Characteristics", "title": "Characteristics",
"compare": { "compare": {
"label": "Compare against", "label": "Compare against",
"class": "Tier {tier} {class}", "class": "{tier} {class}",
"tier": "All of tier {tier}", "tier": "All tier {tier}",
"all": "All tanks" "all": "All tanks"
}, },
"values": { "values": {
@@ -1059,19 +1072,19 @@
"speedBackwards": "Backwards", "speedBackwards": "Backwards",
"hardTerrainCoefficient": "Hard", "hardTerrainCoefficient": "Hard",
"hardTerrainCoefficientRaw": "Hard", "hardTerrainCoefficientRaw": "Hard",
"mediumTerrainCoefficient": "Medium", "mediumTerrainCoefficient": "Średni",
"mediumTerrainCoefficientRaw": "Medium", "mediumTerrainCoefficientRaw": "Średni",
"softTerrainCoefficient": "Soft", "softTerrainCoefficient": "Soft",
"softTerrainCoefficientRaw": "Soft", "softTerrainCoefficientRaw": "Soft",
"enginePower": "Engine power", "enginePower": "Engine power",
"powerToWeightRatioHardTerrain": "Hard", "powerToWeightRatioHardTerrain": "Hard",
"powerToWeightRatioMediumTerrain": "Medium", "powerToWeightRatioMediumTerrain": "Średni",
"powerToWeightRatioSoftTerrain": "Soft", "powerToWeightRatioSoftTerrain": "Soft",
"weight": "Weight", "weight": "Weight",
"turretTraverseSpeed": "Turret traverse speed", "turretTraverseSpeed": "Turret traverse speed",
"gunTraverseSpeed": "Gun traverse speed", "gunTraverseSpeed": "Gun traverse speed",
"hullTraverseHardTerrain": "Hard", "hullTraverseHardTerrain": "Hard",
"hullTraverseMediumTerrain": "Medium", "hullTraverseMediumTerrain": "Średni",
"hullTraverseSoftTerrain": "Soft", "hullTraverseSoftTerrain": "Soft",
"health": "Health", "health": "Health",
"fireChance": "Fire chance", "fireChance": "Fire chance",
@@ -1142,7 +1155,8 @@
}, },
"skills": { "skills": {
"clear": "Clear", "clear": "Clear",
"maximize": "Maximize" "maximize": "Maximize",
"equalize": "Equalize"
}, },
"modules": { "modules": {
"stock": "Stock", "stock": "Stock",
@@ -1174,7 +1188,7 @@
"table": { "table": {
"tanks": { "tanks": {
"header": "Tank", "header": "Tank",
"total": "Total" "total": "Łącznie"
}, },
"stats": { "stats": {
"winrate": "Śr. wygranych", "winrate": "Śr. wygranych",
@@ -1232,7 +1246,7 @@
}, },
"table": { "table": {
"tank": "Tank", "tank": "Tank",
"total": "Total", "total": "Łącznie",
"remove": "Remove" "remove": "Remove"
} }
}, },
+18 -4
View File
@@ -320,9 +320,16 @@
} }
}, },
"commands": { "commands": {
"dead": "# Stat Commands Are Dead\n\nThe BlitzKit Discord bot used to use BlitzStars to fetch periodic statistics. BlitzStars has enabled aggressive Cloudflare protections; hence, disabling BlitzKit from using BlitzStar's API. This has impacted the following commands:\n\n- `/stats`\n- `/today`\n- `/breakdown`\n- `/evolution`\n- `/full-stats`\n\nPlease use [Aftermath](<https://amth.one/invite>) as an alternative which is completely independent of BlitzStars. BlitzKit-hosted stat commands will return in the near future.",
"replay": { "replay": {
"name": "replay", "name": "replay",
"description": "Exibir resultados de replays" "description": "Exibir resultados de replays",
"options": {
"file": {
"name": "file",
"description": "Replay file"
}
}
}, },
"research": { "research": {
"name": "pesquisa", "name": "pesquisa",
@@ -953,6 +960,7 @@
"tier": "Nível", "tier": "Nível",
"type": "Tipo", "type": "Tipo",
"dev_id": "DEV: ID", "dev_id": "DEV: ID",
"dev_name": "DEV: NAME",
"purchase": "Preço de compra", "purchase": "Preço de compra",
"restoration": "Preço de recuperação", "restoration": "Preço de recuperação",
"sale": "Preço de venda", "sale": "Preço de venda",
@@ -973,6 +981,11 @@
}, },
"configuration": { "configuration": {
"title": "Configuração", "title": "Configuração",
"equalizer": {
"title": "Equalizer",
"equalize": "Equalize",
"beta": "Beta"
},
"modules": { "modules": {
"title": "Módulos", "title": "Módulos",
"stock": "Padrão", "stock": "Padrão",
@@ -1005,8 +1018,8 @@
"title": "Características", "title": "Características",
"compare": { "compare": {
"label": "Comparar com", "label": "Comparar com",
"class": "Tier {tier} {class}", "class": "{tier} {class}",
"tier": "All of tier {tier}", "tier": "All tier {tier}",
"all": "Todos os tanques" "all": "Todos os tanques"
}, },
"values": { "values": {
@@ -1142,7 +1155,8 @@
}, },
"skills": { "skills": {
"clear": "Limpar", "clear": "Limpar",
"maximize": "Maximizar" "maximize": "Maximizar",
"equalize": "Equalize"
}, },
"modules": { "modules": {
"stock": "Padrão", "stock": "Padrão",
+34 -20
View File
@@ -139,7 +139,7 @@
} }
}, },
"leagues": { "leagues": {
"diamond": "Диамантовая", "diamond": "Алмазная",
"platinum": "Платиновая", "platinum": "Платиновая",
"gold": "Золотая", "gold": "Золотая",
"silver": "Серебряная", "silver": "Серебряная",
@@ -196,7 +196,7 @@
"get_help": "Получить помощь", "get_help": "Получить помощь",
"uncaught_error": "# BlitzKit столкнулся с ошибкой!\nНам очень жаль. Не стесняйтесь и [присоединяйтесь к официальному серверу Discord](https://discord.gg/nDt7AjGJQH), чтобы получить помощь.", "uncaught_error": "# BlitzKit столкнулся с ошибкой!\nНам очень жаль. Не стесняйтесь и [присоединяйтесь к официальному серверу Discord](https://discord.gg/nDt7AjGJQH), чтобы получить помощь.",
"preview": "# Эта команда находится в тестируется\n\nВы можете получить доступ к этой команде только на [официальном сервере Discord] (https://discord.gg/nDt7AjGJQH). Команда скоро станет общедоступной.", "preview": "# Эта команда находится в тестируется\n\nВы можете получить доступ к этой команде только на [официальном сервере Discord] (https://discord.gg/nDt7AjGJQH). Команда скоро станет общедоступной.",
"query_too_small": "# Ваш поисковой запрос слишком короткий\nДлина вашего запроса должна составлять не менее 3 символов.", "query_too_small": "# Ваш поисковой слишком короткий\nДлина вашего запроса не менее 3 символов.",
"query_too_long": "# Ваш поисковой запрос слишком длинный\nДлина вашего запроса должна составлять не более 100 символов." "query_too_long": "# Ваш поисковой запрос слишком длинный\nДлина вашего запроса должна составлять не более 100 символов."
}, },
"wn8": { "wn8": {
@@ -320,9 +320,16 @@
} }
}, },
"commands": { "commands": {
"dead": "# Команды статистики мертвы\n\nБот BlitzKit использует BlitzStars для получения периодической статистики. BlitzStars включил агрессивную защиту Cloudflare; следовательно, отключив BlitzKit от использования API BlitzStar. Это повлияло на следующие команды:\n\n- `/stats`\n- `/today`\n- `/breakdown`\n- `/evolution`\n- `/full-stats`\n\nПожалуйста, используйте [Aftermath](<https://amth.one/invite>) в качестве альтернативы, которая совершенно не зависит от BlitzStars. Команда статистики BlitzKit-hosted вернется в ближайшее время.",
"replay": { "replay": {
"name": "повтор", "name": "повтор",
"description": "Показать результаты повтора" "description": "Показать результаты повтора",
"options": {
"file": {
"name": "файл",
"description": "Запись повтора"
}
}
}, },
"research": { "research": {
"name": "исследование", "name": "исследование",
@@ -344,7 +351,7 @@
"upgrades": "Улучшения: {cost}", "upgrades": "Улучшения: {cost}",
"purchase": "Покупка: {cost}", "purchase": "Покупка: {cost}",
"equipment": "Снаряжение: {cost}", "equipment": "Снаряжение: {cost}",
"estimation": "# Это приблизительная оценка!\n\nВ этот список могут входить уже исследованные танки из-за неточной информации, предоставляемой Wargaming. Попробуйте указать «стартовый-танк» в строке при использовании команды, если сможете." "estimation": "# Это приблизительная оценка!\n\nВ этот список могут входить уже исследованные танки из-за неточной информации, предоставляемой Wargaming. Попробуйте указать «стартовый танк» в строке при использовании команды, если сможете."
}, },
"errors": { "errors": {
"non_tech_tree": "# {tank} отсутствует в дереве танков\n\nВы не можете исследовать премиумный / коллекционный танк.", "non_tech_tree": "# {tank} отсутствует в дереве танков\n\nВы не можете исследовать премиумный / коллекционный танк.",
@@ -356,7 +363,7 @@
} }
}, },
"about": { "about": {
"name": "о-боте", "name": "about",
"description": "Вся необходимая информация о боте", "description": "Вся необходимая информация о боте",
"subcommands": { "subcommands": {
"commands": { "commands": {
@@ -365,7 +372,7 @@
"body": "# Команды\n\nBlitzKit предлагает следующие команды:\n\n" "body": "# Команды\n\nBlitzKit предлагает следующие команды:\n\n"
}, },
"embeds": { "embeds": {
"name": "встраиваемые-элементы", "name": "embeds",
"description": "Как работают встраиваемые элементы" "description": "Как работают встраиваемые элементы"
}, },
"introduction": { "introduction": {
@@ -377,7 +384,7 @@
"description": "Как пригласить бота" "description": "Как пригласить бота"
}, },
"timezones": { "timezones": {
"name": "часовой-пояс", "name": "timezones",
"description": "Как BlitzKit определяет и использует ваш часовой пояс" "description": "Как BlitzKit определяет и использует ваш часовой пояс"
}, },
"credits": { "credits": {
@@ -402,11 +409,11 @@
"name": "отладка", "name": "отладка",
"description": "Сведения для отладки", "description": "Сведения для отладки",
"body": { "body": {
"title": "# Отладка", "title": "# Debug\n\n",
"version": "Версия", "version": "Версия",
"shard": { "shard": {
"label": "Фрагмент", "label": "Фрагмент",
"default": "по умолчанию" "default": "default"
}, },
"uptime": "Время работы" "uptime": "Время работы"
} }
@@ -436,11 +443,11 @@
}, },
"body": { "body": {
"subtitle": "Неактивен {days}+ дней", "subtitle": "Неактивен {days}+ дней",
"listing": "{days} дней" "listing": "{days{days}"
} }
}, },
"full_stats": { "full_stats": {
"name": "полная-статистика", "name": "full-stats",
"description": "Полная игровая статистика", "description": "Полная игровая статистика",
"body": { "body": {
"cards": { "cards": {
@@ -489,7 +496,7 @@
} }
}, },
"search_clans": { "search_clans": {
"name": "поиск-кланов", "name": "search-clans",
"description": "Поиск кланов", "description": "Поиск кланов",
"options": { "options": {
"limit": { "limit": {
@@ -503,7 +510,7 @@
} }
}, },
"search_players": { "search_players": {
"name": "поиск-игроков", "name": "search-players",
"description": "Поиск игроков", "description": "Поиск игроков",
"options": { "options": {
"limit": { "limit": {
@@ -517,7 +524,7 @@
} }
}, },
"rating_leaderboard": { "rating_leaderboard": {
"name": "таблица-лидеров", "name": "rating-leaderboard",
"description": "Статистика рейтингов боёв", "description": "Статистика рейтингов боёв",
"subcommands": { "subcommands": {
"neighbors": { "neighbors": {
@@ -556,7 +563,7 @@
} }
}, },
"today": { "today": {
"name": "cегодня", "name": "today",
"description": "Танки, на которых сыграли сегодня и статистика" "description": "Танки, на которых сыграли сегодня и статистика"
}, },
"stats": { "stats": {
@@ -600,8 +607,8 @@
} }
}, },
"player_info": { "player_info": {
"name": "информация-об-игроке", "name": "player-ifor",
"description": "Основная информация о игроке", "description": "Basic information about a player",
"body": { "body": {
"title": "Информация о {name}", "title": "Информация о {name}",
"nickname": "Никнейм", "nickname": "Никнейм",
@@ -817,7 +824,7 @@
"skip": "Пропустить", "skip": "Пропустить",
"guess": "Угадать", "guess": "Угадать",
"next": "Следующий", "next": "Следующий",
"no_results": "Ничего не найденo" "no_results": "Ничего не найдено"
}, },
"stats": "{correct} / {total} правильно, серия: {streak}", "stats": "{correct} / {total} правильно, серия: {streak}",
"help": { "help": {
@@ -953,6 +960,7 @@
"tier": "Уровень", "tier": "Уровень",
"type": "Тип", "type": "Тип",
"dev_id": "DEV: ID", "dev_id": "DEV: ID",
"dev_name": "DEV: NAME",
"purchase": "Цена покупки", "purchase": "Цена покупки",
"restoration": "Цена восстановления", "restoration": "Цена восстановления",
"sale": "Цена продажи", "sale": "Цена продажи",
@@ -973,6 +981,11 @@
}, },
"configuration": { "configuration": {
"title": "Конфигурация", "title": "Конфигурация",
"equalizer": {
"title": "Уравнение",
"equalize": "Уравнять",
"beta": "Бета"
},
"modules": { "modules": {
"title": "Модули", "title": "Модули",
"stock": "Сток", "stock": "Сток",
@@ -1005,7 +1018,7 @@
"title": "Характеристики", "title": "Характеристики",
"compare": { "compare": {
"label": "Сравнивать с", "label": "Сравнивать с",
"class": "{class} {tier} уровня", "class": "{tier} {class}",
"tier": "Все {tier} уровня", "tier": "Все {tier} уровня",
"all": "Все танки" "all": "Все танки"
}, },
@@ -1142,7 +1155,8 @@
}, },
"skills": { "skills": {
"clear": "Очистить", "clear": "Очистить",
"maximize": "Максимум" "maximize": "Максимум",
"equalize": "Уравнять"
}, },
"modules": { "modules": {
"stock": "Сток", "stock": "Сток",
+38 -24
View File
@@ -1,7 +1,7 @@
{ {
"test": { "test": {
"default": "тест", "default": "тест",
"long": "{fruit}", "long": "{color}{fruit}",
"fox": "Швидка бура лисиця перестрибує через лінивого собаку." "fox": "Швидка бура лисиця перестрибує через лінивого собаку."
}, },
"common": { "common": {
@@ -23,7 +23,7 @@
}, },
"shells": { "shells": {
"ap": "ББ", "ap": "ББ",
"ap_cr": "APCR", "ap_cr": "",
"hc": "HEAT", "hc": "HEAT",
"he": "ОФ" "he": "ОФ"
}, },
@@ -320,9 +320,16 @@
} }
}, },
"commands": { "commands": {
"dead": ".",
"replay": { "replay": {
"name": "реплей", "name": "реплей",
"description": "Показати результати реплею" "description": "Показати результати реплею",
"options": {
"file": {
"name": "",
"description": "Replay filehttps://crowdin.com/editor/blitzkrieg/80/en-uk?view=side-by-side#9706"
}
}
}, },
"research": { "research": {
"name": "дослідження", "name": "дослідження",
@@ -660,7 +667,7 @@
}, },
"tank_search": { "tank_search": {
"select_dialog_title": "Знайти танк", "select_dialog_title": "Знайти танк",
"swap_dialog_title": "Swap tank", "swap_dialog_title": "Резервуар підміни",
"clear_filters": "Очистити", "clear_filters": "Очистити",
"login": "Увійдіть, щоб скористатися", "login": "Увійдіть, щоб скористатися",
"search_bar_hint": "Шукайте техніку...", "search_bar_hint": "Шукайте техніку...",
@@ -671,8 +678,8 @@
"sorting_by": "Відсортувати за {name}", "sorting_by": "Відсортувати за {name}",
"clear": "Clear", "clear": "Clear",
"tier": "Рівень {tier}", "tier": "Рівень {tier}",
"passive": "{name} (Passive)", "passive": "",
"active": "{name} (Active)", "active": "{name}{name}",
"no_tanks_found": { "no_tanks_found": {
"body": "Нічого не знайдено.", "body": "Нічого не знайдено.",
"search_again": "Спробуйте шукати заново.", "search_again": "Спробуйте шукати заново.",
@@ -735,11 +742,11 @@
}, },
"home": { "home": {
"pwa": { "pwa": {
"title": "Install the BlitzKit App", "title": "",
"new": "", "new": "",
"checking": "Checking compatibility...", "checking": "",
"instructions": "Instructions for Apple devices.", "instructions": ".",
"install": "Install", "install": "",
"dismiss": "Dismiss" "dismiss": "Dismiss"
}, },
"discord": { "discord": {
@@ -823,7 +830,7 @@
"help": { "help": {
"title": "Partially reveal tank?", "title": "Partially reveal tank?",
"description": "Reveals the tank without showing the name. This round will be considered incorrect and break your streak!", "description": "Reveals the tank without showing the name. This round will be considered incorrect and break your streak!",
"cancel": "Cancel", "cancel": "",
"reveal": "Reveal" "reveal": "Reveal"
}, },
"clear": "Clear", "clear": "Clear",
@@ -869,7 +876,7 @@
"yaw": "Yaw", "yaw": "Yaw",
"pitch": "Pitch", "pitch": "Pitch",
"min": "Min", "min": "Min",
"max": "Max" "max": "Макс"
} }
}, },
"sandbox": { "sandbox": {
@@ -901,7 +908,7 @@
"normalization": "Нормалізація", "normalization": "Нормалізація",
"ricochet": "Рикошет", "ricochet": "Рикошет",
"explosion_radius": "Радіус розльоту уламків", "explosion_radius": "Радіус розльоту уламків",
"exit": "Exit", "exit": "Вийти",
"reset": "Reset" "reset": "Reset"
}, },
"advanced": "Advanced highlighting", "advanced": "Advanced highlighting",
@@ -912,13 +919,13 @@
"external": "External", "external": "External",
"gap": "Gap", "gap": "Gap",
"gun": "Gun", "gun": "Gun",
"track": "Tracks" "track": "Гусениці"
}, },
"status": { "status": {
"penetration": "{damage}hp penetration", "penetration": "{damage} од. шкоди з пробиттям",
"blocked": "Blocked", "blocked": "Заблоковано",
"ricochet": "Рикошет", "ricochet": "Рикошет",
"splash": "{damage}hp splash" "splash": "{damage} Од"
}, },
"stats": { "stats": {
"thickness_and_angle": "{thickness}mm {angle}°", "thickness_and_angle": "{thickness}mm {angle}°",
@@ -953,6 +960,7 @@
"tier": "Рівень", "tier": "Рівень",
"type": "Вид", "type": "Вид",
"dev_id": "DEV: ID", "dev_id": "DEV: ID",
"dev_name": "DEV: NAME",
"purchase": "Purchase price", "purchase": "Purchase price",
"restoration": "Restoration price", "restoration": "Restoration price",
"sale": "Sale price", "sale": "Sale price",
@@ -973,6 +981,11 @@
}, },
"configuration": { "configuration": {
"title": "Configuration", "title": "Configuration",
"equalizer": {
"title": "Equalizer",
"equalize": "Equalize",
"beta": "Beta"
},
"modules": { "modules": {
"title": "Модулі", "title": "Модулі",
"stock": "Stock", "stock": "Stock",
@@ -1005,8 +1018,8 @@
"title": "Characteristics", "title": "Characteristics",
"compare": { "compare": {
"label": "Compare against", "label": "Compare against",
"class": "Tier {tier} {class}", "class": "{tier} {class}",
"tier": "All of tier {tier}", "tier": "All tier {tier}",
"all": "Усі танки" "all": "Усі танки"
}, },
"values": { "values": {
@@ -1035,7 +1048,7 @@
"caliber": "Калібр", "caliber": "Калібр",
"penetration": "Бронепробиття", "penetration": "Бронепробиття",
"damage": "Шкода", "damage": "Шкода",
"damageWithoutAssault": "Damage without assault shells", "damageWithoutAssault": "Шкода без урахування золотих снарядів",
"clipDamage": "Clipping potential", "clipDamage": "Clipping potential",
"moduleDamage": "Шкода по модулях", "moduleDamage": "Шкода по модулях",
"explosionRadius": "Радіус розльоту уламків", "explosionRadius": "Радіус розльоту уламків",
@@ -1044,7 +1057,7 @@
"dispersion": "Нерухомо", "dispersion": "Нерухомо",
"dispersionMoving": "У русі", "dispersionMoving": "У русі",
"dispersionHullTraversing": "Hull traversing", "dispersionHullTraversing": "Hull traversing",
"dispersionTurretTraversing": "Turret traversing", "dispersionTurretTraversing": "Обертання башти",
"dispersionShooting": "Shooting", "dispersionShooting": "Shooting",
"dispersionGunDamaged": "Gun damaged", "dispersionGunDamaged": "Gun damaged",
"gunDepression": "Depression", "gunDepression": "Depression",
@@ -1142,7 +1155,8 @@
}, },
"skills": { "skills": {
"clear": "Очистити", "clear": "Очистити",
"maximize": "Збільшити все" "maximize": "Збільшити все",
"equalize": "Equalize"
}, },
"modules": { "modules": {
"stock": "Stock", "stock": "Stock",
@@ -1160,7 +1174,7 @@
}, },
"performance": { "performance": {
"name": "Performance", "name": "Performance",
"button": "View tanks", "button": "Переглянути танки",
"description": "Tank performance statistics", "description": "Tank performance statistics",
"seo_description": "Best tanks and their performances in World of Tanks Blitz", "seo_description": "Best tanks and their performances in World of Tanks Blitz",
"estimation": { "estimation": {
@@ -1274,7 +1288,7 @@
"button": "Generate URL", "button": "Generate URL",
"title": "Generate URL", "title": "Generate URL",
"subtitle": "Search an account to track", "subtitle": "Search an account to track",
"cancel": "Cancel", "cancel": "",
"success": { "success": {
"title": "Copy URL", "title": "Copy URL",
"info": "Generated the URL for {name}. The embed will start tracking as soon as the URL is pasted. Reset at any time by right-clicking on PC or long-pressing on mobile and then selecting \"Reset\".", "info": "Generated the URL for {name}. The embed will start tracking as soon as the URL is pasted. Reset at any time by right-clicking on PC or long-pressing on mobile and then selecting \"Reset\".",
+60 -46
View File
@@ -86,8 +86,8 @@
"uk": "英国", "uk": "英国",
"france": "法国", "france": "法国",
"japan": "日本", "japan": "日本",
"european": "欧洲国家", "european": "欧盟 (E系)",
"other": "混合型国家" "other": "X系"
}, },
"nations_adjectives": { "nations_adjectives": {
"ussr": "苏联", "ussr": "苏联",
@@ -97,34 +97,34 @@
"uk": "英国", "uk": "英国",
"france": "法国", "france": "法国",
"japan": "日本", "japan": "日本",
"european": "欧洲国家", "european": "欧盟 (E系)",
"other": "混合型国家" "other": "X系"
}, },
"tank_class_short": { "tank_class_short": {
"-1": "未识别", "-1": "未识别",
"0": "轻型坦克", "0": "轻型坦克",
"1": "中型坦克", "1": "中型坦克",
"2": "重型战车", "2": "重型战车",
"3": "驱逐战车" "3": "坦克歼击车"
}, },
"tank_class_short_plural_lowercase": { "tank_class_short_plural_lowercase": {
"0": "轻型战车", "0": "轻型坦克",
"1": "中型战车", "1": "中型坦克",
"2": "重型战车", "2": "重型坦克",
"3": "驱逐战车" "3": "坦克歼击车"
}, },
"tank_class_medium": { "tank_class_medium": {
"-1": "未识别", "-1": "未识别",
"0": "轻型战车", "0": "轻型坦克",
"1": "中型战车", "1": "中型坦克",
"2": "重型战车", "2": "重型坦克",
"3": "驱逐战车" "3": "坦克歼击车"
}, },
"tree_type": { "tree_type": {
"-1": "未识别", "-1": "未识别",
"0": "科技树", "0": "科技树",
"1": "加值战车", "1": "金币车",
"2": "收藏家战车" "2": "收藏车"
}, },
"regions": { "regions": {
"normal": { "normal": {
@@ -140,8 +140,8 @@
}, },
"leagues": { "leagues": {
"diamond": "钻石", "diamond": "钻石",
"platinum": "白金", "platinum": "铂金",
"gold": "黃金", "gold": "黄金",
"silver": "白银", "silver": "白银",
"bronze": "青铜" "bronze": "青铜"
}, },
@@ -210,7 +210,7 @@
"good": "好", "good": "好",
"very_good": "非常好", "very_good": "非常好",
"great": "很好", "great": "很好",
"unicum": "極品", "unicum": "极品",
"super_unicum": "超强势玩家" "super_unicum": "超强势玩家"
} }
}, },
@@ -256,7 +256,7 @@
"description": "公会名称或标签" "description": "公会名称或标签"
}, },
"tank": { "tank": {
"name": "战车", "name": "坦克",
"description": "要获取战绩的坦克" "description": "要获取战绩的坦克"
}, },
"username": { "username": {
@@ -269,8 +269,8 @@
"description": "国别" "description": "国别"
}, },
"class": { "class": {
"name": "战车车型", "name": "坦克车型",
"description": "战车车型" "description": "坦克车型"
}, },
"type": { "type": {
"name": "战车类型", "name": "战车类型",
@@ -320,9 +320,16 @@
} }
}, },
"commands": { "commands": {
"dead": "# 统计指令现已停用\nBlitzKit Discord 机器人此前依赖 BlitzStars 获取周期性的统计数据。由于 BlitzStars 已启用严格的 Cloudflare 防护,导致 BlitzKit 无法继续使用其 API。这已导致以下指令失效:\n/统计\n/今日\n/损坏\n/演变\n/完整统计\n请使用 [Aftermath](<https://amth.one/invite>) \n作为完全独立于 BlitzStars 的替代方案。由 BlitzKit 托管的统计指令将在近期内恢复。",
"replay": { "replay": {
"name": "回放", "name": "回放",
"description": "显示重播结果" "description": "显示重播结果",
"options": {
"file": {
"name": "file",
"description": "Replay file"
}
}
}, },
"research": { "research": {
"name": "研发", "name": "研发",
@@ -420,8 +427,8 @@
"description": "玩家数据统计" "description": "玩家数据统计"
}, },
"tank": { "tank": {
"name": "战车", "name": "坦克",
"description": "战车数据统计" "description": "坦克数据统计"
} }
} }
}, },
@@ -557,15 +564,15 @@
}, },
"today": { "today": {
"name": "今日", "name": "今日",
"description": "今天玩过的战车和统计资料" "description": "今天玩过的坦克和统计数据"
}, },
"stats": { "stats": {
"name": "统计资料", "name": "统计资料",
"description": "一段时间内的快速统计" "description": "一段时间内的快速统计"
}, },
"owned_tanks": { "owned_tanks": {
"name": "已拥有的战车", "name": "已拥有的坦克",
"description": "显示该阶级中所有您已拥有的战车", "description": "在一个等级中显示所有已拥有的坦克",
"body": { "body": {
"title": "# {name} 所拥有的 {tier} 阶坦克\n\n" "title": "# {name} 所拥有的 {tier} 阶坦克\n\n"
} }
@@ -578,7 +585,7 @@
"view_channels": "查看频道:需要找到重新整理按钮使用的讯息", "view_channels": "查看频道:需要找到重新整理按钮使用的讯息",
"read_message_history": "读取消息历史: 需要找到消息以刷新", "read_message_history": "读取消息历史: 需要找到消息以刷新",
"attach_files": "附加文件:需要将图像添加到基于图像的命令", "attach_files": "附加文件:需要将图像添加到基于图像的命令",
"external_emojis": "外部表情符号:需要添加国家旗帜和战车类别" "external_emojis": "外部表情:需要添加国家旗帜和坦克等级表情"
} }
}, },
"ping": { "ping": {
@@ -595,7 +602,7 @@
}, },
"wotb": { "wotb": {
"name": "战车世界闪击战", "name": "战车世界闪击战",
"description": "测试战车世界闪击战的ping值(延迟值)" "description": "测试坦克世界闪击战的ping值(延迟值)"
} }
} }
}, },
@@ -666,7 +673,7 @@
"search_bar_hint": "搜寻战车……", "search_bar_hint": "搜寻战车……",
"recent": "最近查看的", "recent": "最近查看的",
"select_all": "全选", "select_all": "全选",
"count_singular": "1辆战车", "count_singular": "1 辆坦克",
"count_plural": "{count} 辆坦克", "count_plural": "{count} 辆坦克",
"sorting_by": "按 {name} 排序", "sorting_by": "按 {name} 排序",
"clear": "清除", "clear": "清除",
@@ -674,7 +681,7 @@
"passive": "{name} (被动)", "passive": "{name} (被动)",
"active": "{name} (主动)", "active": "{name} (主动)",
"no_tanks_found": { "no_tanks_found": {
"body": "找不到战车。", "body": "未找到坦克。",
"search_again": "请尝试重新搜索。", "search_again": "请尝试重新搜索。",
"clear_filters": "请尝试清除筛选。" "clear_filters": "请尝试清除筛选。"
}, },
@@ -688,11 +695,11 @@
"survivability.volume": "体积", "survivability.volume": "体积",
"survivability.length": "长度", "survivability.length": "长度",
"fire.dpm": "标准炮弹 每分钟伤害血量", "fire.dpm": "标准炮弹 每分钟伤害血量",
"fire.dpmPremium": "加值炮弹 每分钟伤害血量", "fire.dpmPremium": "金币炮弹 每分钟伤害值",
"fire.reload": "装填时间", "fire.reload": "装填时间",
"fire.caliber": "口径", "fire.caliber": "口径",
"fire.standardPenetration": "标准炮弹穿透力", "fire.standardPenetration": "标准炮弹穿透力",
"fire.premiumPenetration": "加值炮弹穿透力", "fire.premiumPenetration": "金币炮弹穿透力",
"fire.tertiaryPenetration": "第三种炮弹穿透力", "fire.tertiaryPenetration": "第三种炮弹穿透力",
"fire.damage": "炮弹伤害值", "fire.damage": "炮弹伤害值",
"fire.moduleDamage": "模组伤害值", "fire.moduleDamage": "模组伤害值",
@@ -743,8 +750,8 @@
"dismiss": "取消" "dismiss": "取消"
}, },
"discord": { "discord": {
"join_short": "加入超級酷的人群!", "join_short": "加入超级酷的人群!",
"join_long": "加入我們的Discord社群,和超酷的人一起聊天!", "join_long": "加入我们的Discord社群,和超酷的人一起聊天!",
"action": "Discord" "action": "Discord"
}, },
"hero": { "hero": {
@@ -758,7 +765,7 @@
"title": "其他酷炫的项目" "title": "其他酷炫的项目"
}, },
"help_translate": "请帮忙将 {name} 翻译成 {language}!", "help_translate": "请帮忙将 {name} 翻译成 {language}!",
"seo_description": "战车世界闪击战 全方位工具" "seo_description": "坦克世界闪击战 全方位工具"
}, },
"docs": { "docs": {
"patches": { "patches": {
@@ -793,7 +800,7 @@
"proceed": "继续操作" "proceed": "继续操作"
}, },
"generate": "创建游玩列表", "generate": "创建游玩列表",
"name": "遊玩列表", "name": "游玩列表",
"description": "坦克游玩列表生成器", "description": "坦克游玩列表生成器",
"seo_description": "想不到在坦克世界闪击战玩什么? 使用BlitzKit 游玩列表来获得建议!", "seo_description": "想不到在坦克世界闪击战玩什么? 使用BlitzKit 游玩列表来获得建议!",
"button": "生成", "button": "生成",
@@ -953,8 +960,9 @@
"tier": "阶级", "tier": "阶级",
"type": "战车类型", "type": "战车类型",
"dev_id": "开发参数:ID", "dev_id": "开发参数:ID",
"dev_name": "DEV: NAME",
"purchase": "购买价格", "purchase": "购买价格",
"restoration": "恢复战车价格", "restoration": "恢复坦克价格",
"sale": "出售价格", "sale": "出售价格",
"research": "研发所需经验" "research": "研发所需经验"
}, },
@@ -973,6 +981,11 @@
}, },
"configuration": { "configuration": {
"title": "配置设定", "title": "配置设定",
"equalizer": {
"title": "Equalizer",
"equalize": "Equalize",
"beta": "Beta"
},
"modules": { "modules": {
"title": "坦克模块", "title": "坦克模块",
"stock": "白板", "stock": "白板",
@@ -1005,8 +1018,8 @@
"title": "属性", "title": "属性",
"compare": { "compare": {
"label": "比较", "label": "比较",
"class": "{tier}阶 {class}", "class": "{tier} {class}",
"tier": "所有 {tier} 阶", "tier": "All tier {tier}",
"all": "所有坦克" "all": "所有坦克"
}, },
"values": { "values": {
@@ -1049,10 +1062,10 @@
"dispersionGunDamaged": "主炮损坏时", "dispersionGunDamaged": "主炮损坏时",
"gunDepression": "俯角", "gunDepression": "俯角",
"gunElevation": "仰角", "gunElevation": "仰角",
"gunFrontalDepression": "车辆前部俯角", "gunFrontalDepression": "车体前部俯角",
"gunFrontalElevation": "车辆前部仰角", "gunFrontalElevation": "车体前部仰角",
"gunRearDepression": "车辆後部俯角", "gunRearDepression": "车体后部俯角",
"gunRearElevation": "车辆後部仰角", "gunRearElevation": "车体后部仰角",
"azimuthLeft": "左射界", "azimuthLeft": "左射界",
"azimuthRight": "右射界", "azimuthRight": "右射界",
"speedForwards": "最高前进速度", "speedForwards": "最高前进速度",
@@ -1142,7 +1155,8 @@
}, },
"skills": { "skills": {
"clear": "清除", "clear": "清除",
"maximize": "最大化" "maximize": "最大化",
"equalize": "Equalize"
}, },
"modules": { "modules": {
"stock": "白板", "stock": "白板",
@@ -1252,7 +1266,7 @@
"description": "用于串流的嵌入", "description": "用于串流的嵌入",
"seo_description": "创建具有极高自订化的《坦克世界:闪击战》串流嵌入功能", "seo_description": "创建具有极高自订化的《坦克世界:闪击战》串流嵌入功能",
"coming_soon": "更多嵌入功能即将推出。", "coming_soon": "更多嵌入功能即将推出。",
"suggest": "建议与想法", "suggest": "建议与想法。",
"preview": { "preview": {
"title": "示例预览", "title": "示例预览",
"upload": "上传测试背景" "upload": "上传测试背景"
-1
View File
@@ -24,7 +24,6 @@
"fast-xml-parser": "^5.2.5", "fast-xml-parser": "^5.2.5",
"googleapis": "^162.0.0", "googleapis": "^162.0.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"lz4js": "^0.2.0",
"progress": "^2.0.3", "progress": "^2.0.3",
"puppeteer": "^24.22.3", "puppeteer": "^24.22.3",
"sharp": "^0.34.4", "sharp": "^0.34.4",
+36 -21
View File
@@ -4,7 +4,7 @@ import { mkdir, writeFile } from "fs/promises";
import { parse as parsePath } from "path"; import { parse as parsePath } from "path";
import ProgressBar from "progress"; import ProgressBar from "progress";
import { parse as parseYaml, stringify as stringifyYaml } from "yaml"; import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
import { vfs } from "./buildAssets/constants"; import { PATCHES_ROOT, vfs } from "./buildAssets/constants";
import { writeDVPL } from "./core/blitz/writeDVPL"; import { writeDVPL } from "./core/blitz/writeDVPL";
const versionTextFile = await vfs.text(`Data/version.txt`); const versionTextFile = await vfs.text(`Data/version.txt`);
@@ -20,27 +20,30 @@ let patchIndex = 1;
while (true) { while (true) {
const response = await fetch( const response = await fetch(
`${assertSecret( `${assertSecret(
import.meta.env.WOTB_DLC_CDN import.meta.env.WOTB_DLC_CDN,
)}/dlc/s${currentVersion}_${patchIndex}.yaml` )}/dlc/s${currentVersion}_${patchIndex}.yaml`,
); );
if (response.status === 200) { console.log(patchIndex, response.status)
if (!response.ok) break;
console.log(`Applying patch ${patchIndex}...`); console.log(`Applying patch ${patchIndex}...`);
const data = parseYaml(await response.text()); const data = parseYaml(await response.text());
const dvpm = await fetch( const dvpm = await fetch(
`${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${data.dx11}` `${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${data.dx11}`,
).then((response) => response.arrayBuffer()); ).then((response) => response.arrayBuffer());
const dvpd = await fetch( const dvpd = await fetch(
`${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${data.dx11.replace( `${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${data.dx11.replace(
".dvpm", ".dvpm",
".dvpd" ".dvpd",
)}` )}`,
).then((response) => response.arrayBuffer()); ).then((response) => response.arrayBuffer());
const files = await dvp(dvpm, dvpd); const files = await dvp(dvpm, dvpd);
const bar = new ProgressBar( const bar = new ProgressBar(
`Patching ${files.length} files :bar`, `Patching ${files.length} files :bar`,
files.length files.length,
); );
for (const { path, data } of files) { for (const { path, data } of files) {
@@ -49,43 +52,55 @@ while (true) {
const { dir } = parsePath(path); const { dir } = parsePath(path);
try { try {
await mkdir(`Data/${dir}`, { recursive: true }); await mkdir(`${PATCHES_ROOT}/Data/${dir}`, { recursive: true });
} catch (error) { } catch (error) {
console.warn(`Failed to make directory "${dir}"`); console.warn(`Failed to make directory "${dir}"`);
} }
const isDvpl = path.endsWith(".dvpl");
const buffer = Buffer.from(data); const buffer = Buffer.from(data);
await writeFile( await writeFile(
`Data/${path}${isDvpl ? "" : ".dvpl"}`, `${PATCHES_ROOT}/Data/${path}`,
new Uint8Array(isDvpl ? buffer : writeDVPL(buffer)) new Uint8Array(buffer),
); );
bar.tick(); bar.tick();
} }
if ("dynamicContentLocalizationsDir" in data) { console.log('patches done for patch')
console.log("Found dynamic content localizations; patching...");
if ("dynamicContentLocalizationsDir" in data) {
console.log(
`${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${
data.dynamicContentLocalizationsDir
}/en.yaml`,
);
const localizationsResponse = await fetch( const localizationsResponse = await fetch(
`${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${ `${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${
data.dynamicContentLocalizationsDir data.dynamicContentLocalizationsDir
}/en.yaml` }/en.yaml`,
); );
console.log('fetched')
const newStrings = parseYaml(await localizationsResponse.text()); const newStrings = parseYaml(await localizationsResponse.text());
const oldStrings = await vfs.yaml<Record<string, string>>( console.log('got new strings')
`Data/Strings/en.yaml` const oldStrings =
); await vfs.yaml<Record<string, string>>(`Data/Strings/en.yaml`);
console.log('got old strings')
const patchedStrings = { ...oldStrings, ...newStrings }; const patchedStrings = { ...oldStrings, ...newStrings };
const patchedContent = stringifyYaml(patchedStrings); const patchedContent = stringifyYaml(patchedStrings);
console.log('stringified')
await mkdir(`${PATCHES_ROOT}/Data/Strings`, { recursive: true });
console.log('mkdir')
await writeFile( await writeFile(
`Data/Strings/en.yaml`, `${PATCHES_ROOT}/Data/Strings/en.yaml`,
new Uint8Array(writeDVPL(Buffer.from(patchedContent))) new Uint8Array((Buffer.from(patchedContent))),
); );
console.log('file')
} }
patchIndex++; patchIndex++;
} else break;
} }
vfs.dispose()
process.exit(0);
+23 -20
View File
@@ -1,5 +1,6 @@
import { import {
AverageDefinitions, AverageDefinitions,
AverageDefinitionsAllStats,
AverageDefinitionsEntry, AverageDefinitionsEntry,
type AverageDefinitionsManifest, type AverageDefinitionsManifest,
type IndividualTankStats, type IndividualTankStats,
@@ -30,9 +31,6 @@ type OptionalSecondLevel<T> = {
}; };
}; };
type AverageDefinitionsEntrySubPartial =
OptionalSecondLevel<AverageDefinitionsEntry>;
const MINUTE = 60 * 1000; const MINUTE = 60 * 1000;
const HOUR = 60 * MINUTE; const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR; const DAY = 24 * HOUR;
@@ -47,15 +45,15 @@ const preDiscoveredIds = await fetchPreDiscoveredIds();
const playerIds: Record<Region, number[][]> = { const playerIds: Record<Region, number[][]> = {
asia: chunk( asia: chunk(
preDiscoveredIds.filter((id) => idToRegion(id) === "asia"), preDiscoveredIds.filter((id) => idToRegion(id) === "asia"),
PLAYER_IDS_PER_CALL PLAYER_IDS_PER_CALL,
), ),
com: chunk( com: chunk(
preDiscoveredIds.filter((id) => idToRegion(id) === "com"), preDiscoveredIds.filter((id) => idToRegion(id) === "com"),
PLAYER_IDS_PER_CALL PLAYER_IDS_PER_CALL,
), ),
eu: chunk( eu: chunk(
preDiscoveredIds.filter((id) => idToRegion(id) === "eu"), preDiscoveredIds.filter((id) => idToRegion(id) === "eu"),
PLAYER_IDS_PER_CALL PLAYER_IDS_PER_CALL,
), ),
}; };
let regionIndex = 0; let regionIndex = 0;
@@ -71,7 +69,7 @@ times(THREADS, async () => {
const regionIds = playerIds[region]; const regionIds = playerIds[region];
const [ids] = regionIds.splice( const [ids] = regionIds.splice(
Math.floor(Math.random() * regionIds.length), Math.floor(Math.random() * regionIds.length),
1 1,
); );
const accountInfo = await getAccountInfo(region, ids, undefined, { const accountInfo = await getAccountInfo(region, ids, undefined, {
fields: "last_battle_time,statistics.all.battles", fields: "last_battle_time,statistics.all.battles",
@@ -104,8 +102,8 @@ times(THREADS, async () => {
filteredIds.map((id) => filteredIds.map((id) =>
getTankStats(region, id, { getTankStats(region, id, {
fields: "last_battle_time,battle_life_time,all,tank_id", fields: "last_battle_time,battle_life_time,all,tank_id",
}) }),
) ),
); );
players.forEach((tanks) => { players.forEach((tanks) => {
@@ -114,7 +112,7 @@ times(THREADS, async () => {
if (!tankIds.includes(tank.tank_id)) { if (!tankIds.includes(tank.tank_id)) {
console.log( console.log(
`Found new tank: ${tank.tank_id} (${tankIds.length + 1})` `Found new tank: ${tank.tank_id} (${tankIds.length + 1})`,
); );
tankIds.push(tank.tank_id); tankIds.push(tank.tank_id);
tanksSorted[tank.tank_id] = []; tanksSorted[tank.tank_id] = [];
@@ -140,7 +138,7 @@ async function postWork() {
console.log( console.log(
`Generating statistics based on ${samples.d_120.toLocaleString()} players (${samples.total.toLocaleString()} checked in total) and ${ `Generating statistics based on ${samples.d_120.toLocaleString()} players (${samples.total.toLocaleString()} checked in total) and ${
tankIds.length tankIds.length
} tanks...` } tanks...`,
); );
using uploader = new AssetUploader("averages"); using uploader = new AssetUploader("averages");
@@ -152,7 +150,12 @@ async function postWork() {
// (tank) => Date.now() - tank.last_battle_time * 1000 <= MAX_ACTIVITY_TIME, // (tank) => Date.now() - tank.last_battle_time * 1000 <= MAX_ACTIVITY_TIME,
// ); // );
const tanks = tanksSortedEntry; const tanks = tanksSortedEntry;
const entry: AverageDefinitionsEntrySubPartial = { const entry: {
mu: Partial<Record<keyof AverageDefinitionsAllStats, number>>;
sigma: Partial<Record<keyof AverageDefinitionsAllStats, number>>;
r: Partial<Record<keyof AverageDefinitionsAllStats, number>>;
samples: Samples;
} = {
mu: {}, mu: {},
sigma: {}, sigma: {},
r: {}, r: {},
@@ -162,13 +165,13 @@ async function postWork() {
tanks.forEach((tank) => { tanks.forEach((tank) => {
const timeSinceLastActivity = Date.now() - tank.last_battle_time * 1000; const timeSinceLastActivity = Date.now() - tank.last_battle_time * 1000;
entry.samples.total++; entry.samples!.total++;
if (timeSinceLastActivity <= 120 * DAY) entry.samples.d_120++; if (timeSinceLastActivity <= 120 * DAY) entry.samples!.d_120++;
if (timeSinceLastActivity <= 90 * DAY) entry.samples.d_90++; if (timeSinceLastActivity <= 90 * DAY) entry.samples!.d_90++;
if (timeSinceLastActivity <= 60 * DAY) entry.samples.d_60++; if (timeSinceLastActivity <= 60 * DAY) entry.samples!.d_60++;
if (timeSinceLastActivity <= 30 * DAY) entry.samples.d_30++; if (timeSinceLastActivity <= 30 * DAY) entry.samples!.d_30++;
if (timeSinceLastActivity <= 7 * DAY) entry.samples.d_7++; if (timeSinceLastActivity <= 7 * DAY) entry.samples!.d_7++;
if (timeSinceLastActivity <= 1 * DAY) entry.samples.d_1++; if (timeSinceLastActivity <= 1 * DAY) entry.samples!.d_1++;
}); });
const dataWY = tanks.map((tank) => ({ const dataWY = tanks.map((tank) => ({
@@ -191,7 +194,7 @@ async function postWork() {
function sum(slicer: (data: DataPoint) => number) { function sum(slicer: (data: DataPoint) => number) {
return data.reduce( return data.reduce(
(accumulator, data) => accumulator + slicer(data), (accumulator, data) => accumulator + slicer(data),
0 0,
); );
} }
@@ -6,13 +6,15 @@ export async function boosterIcons() {
console.log("Building booster icons..."); console.log("Building booster icons...");
const uploader = new AssetUploader("booster icons"); const uploader = new AssetUploader("booster icons");
const boosterFiles = vfs const boosterFiles = await vfs
.dir("Data/Gfx/Shared/boosters") .dir("Data/Gfx/Shared/boosters")
.filter( .then((files) =>
(file) => !file.includes("@2x.txt") && !file.startsWith("texture0") files.filter(
(file) => !file.includes("@2x.txt") && !file.startsWith("texture0"),
),
); );
const image = sharp( const image = sharp(
await vfs.file(`Data/Gfx/Shared/boosters/texture0.packed.webp`) await vfs.file(`Data/Gfx/Shared/boosters/texture0.packed.webp`),
); );
for (const file of boosterFiles) { for (const file of boosterFiles) {
@@ -6,7 +6,7 @@ export async function camouflageIcons() {
using uploader = new AssetUploader("camo icons"); using uploader = new AssetUploader("camo icons");
const content = await vfs.file( const content = await vfs.file(
`Data/Gfx/UI/Hangar/IconCamouflage.packed.webp` `Data/Gfx/UI/Hangar/IconCamouflage.packed.webp`,
); );
await uploader.add({ content, path: "icons/camo.webp" }); await uploader.add({ content, path: "icons/camo.webp" });
+11 -1
View File
@@ -1,10 +1,15 @@
import { assertSecret } from "@blitzkit/core"; import { assertSecret } from "@blitzkit/core";
import { AbstractVFS } from "../core/vfs/abstract"; import { AbstractVFS } from "../core/vfs/abstract";
import { LocalVFS } from "../core/vfs/local";
import { MixedVFS } from "../core/vfs/mixed";
import { SteamVFS } from "../core/vfs/steam"; import { SteamVFS } from "../core/vfs/steam";
import { ZipVFS } from "../core/vfs/zip"; import { ZipVFS } from "../core/vfs/zip";
export const PATCHES_ROOT = "../../temp/patches";
const steamPattern = /steam:(\d+)\/(\d+)/; const steamPattern = /steam:(\d+)\/(\d+)/;
const zipPattern = /zip:(.+)/; const zipPattern = /zip:(.+)/;
const localePattern = /local:"?(.+)"?/;
const source = Bun.argv const source = Bun.argv
.find((arg) => arg.startsWith("--source=")) .find((arg) => arg.startsWith("--source="))
@@ -21,13 +26,18 @@ if (!source) {
assertSecret(import.meta.env.STEAM_USERNAME), assertSecret(import.meta.env.STEAM_USERNAME),
assertSecret(import.meta.env.STEAM_PASSWORD), assertSecret(import.meta.env.STEAM_PASSWORD),
app, app,
depot depot,
).init(); ).init();
} else if (zipPattern.test(source)) { } else if (zipPattern.test(source)) {
const [, url] = source.match(zipPattern)!; const [, url] = source.match(zipPattern)!;
resolved = await new ZipVFS(url).init(); resolved = await new ZipVFS(url).init();
} else if (localePattern.test(source)) {
const [, path] = source.match(localePattern)!;
resolved = await new LocalVFS(path).init();
} else { } else {
throw new Error("No valid source specified"); throw new Error("No valid source specified");
} }
resolved = new MixedVFS([new LocalVFS(PATCHES_ROOT), resolved]);
export const vfs = resolved; export const vfs = resolved;
@@ -1,5 +1,6 @@
import sharp from "sharp"; import sharp from "sharp";
import { AssetUploader } from "../core/github/assetUploader"; import { AssetUploader } from "../core/github/assetUploader";
import { parsePackedSpriteRect } from "../core/blitz/parsePackedSpriteRect";
import { vfs } from "./constants"; import { vfs } from "./constants";
import { ConsumablesCommon, ProvisionsCommon } from "./definitions"; import { ConsumablesCommon, ProvisionsCommon } from "./definitions";
@@ -13,31 +14,61 @@ interface Mappings {
const listItemsPattern = /<items path="(.+)\.xml"\/>/g; const listItemsPattern = /<items path="(.+)\.xml"\/>/g;
async function extractPackedIcon(
texture: sharp.Sharp,
sizes: number[],
context: string,
) {
const [left, top, width, height] = sizes;
const bounds = [left, top, width, height];
if (!bounds.every(Number.isInteger)) {
throw new Error(
`Invalid RIFF sprite bounds for ${context}: ${bounds.join(" ")}`,
);
}
const metadata = await texture.metadata();
if (metadata.width === undefined || metadata.height === undefined) {
throw new Error(`Failed to read image dimensions for ${context}`);
}
if (
left < 0 ||
top < 0 ||
width <= 0 ||
height <= 0 ||
left + width > metadata.width ||
top + height > metadata.height
) {
throw new Error(
`Out-of-bounds RIFF sprite for ${context}: ${bounds.join(" ")} in ${metadata.width}x${metadata.height}`,
);
}
return await texture.clone().extract({ left, top, width, height }).toBuffer();
}
export async function consumableProvisionIcons() { export async function consumableProvisionIcons() {
console.log("Building consumable and provision icons..."); console.log("Building consumable and provision icons...");
using uploader = new AssetUploader("consumable and provision icons"); using uploader = new AssetUploader("consumable and provision icons");
const styles = [ const styles = [
"UI/Styles/Lobby/Inventory/InventoryNormalStyles.yaml",
"UI/Styles/Lobby/Inventory/Event/InventoryBigStyles.yaml", "UI/Styles/Lobby/Inventory/Event/InventoryBigStyles.yaml",
"UI/Styles/Lobby/Inventory/Event/InventoryNormalStyles.yaml", "UI/Styles/Lobby/Inventory/Event/InventoryNormalStyles.yaml",
"UI/Styles/Lobby/Inventory/InventoryNormalStyles.yaml",
"UI/Screens3/Lobby/Inventory/Equipment/EquipmentItemImage.style.yaml", "UI/Screens3/Lobby/Inventory/Equipment/EquipmentItemImage.style.yaml",
"UI/Screens/Battle/Styles/BattleEquipmentStyles.yaml", "UI/Screens/Battle/Styles/BattleEquipmentStyles.yaml",
]; ];
const styleSheets = await Promise.all( const styleSheets = await Promise.all(
styles.map(async (path) => styles.map(async (path) =>
Object.values( Object.values((await vfs.yaml<Mappings>(`Data/${path}`)).StyleSheets),
( ),
await vfs.yaml<Mappings>(`Data/${path}`)
).StyleSheets
)
)
).then((array) => array.flat()); ).then((array) => array.flat());
for (const match of ( for (const match of (
await vfs.text( await vfs.text(`Data/XML/item_defs/vehicles/common/consumables/list.xml`)
`Data/XML/item_defs/vehicles/common/consumables/list.xml`
)
).matchAll(listItemsPattern)) { ).matchAll(listItemsPattern)) {
const consumablesCommon = await vfs.xml<{ const consumablesCommon = await vfs.xml<{
root: ConsumablesCommon; root: ConsumablesCommon;
@@ -46,13 +77,13 @@ export async function consumableProvisionIcons() {
for (const consumable of Object.values(consumablesCommon.root)) { for (const consumable of Object.values(consumablesCommon.root)) {
const styleSheet = styleSheets.find((styleSheet) => const styleSheet = styleSheets.find((styleSheet) =>
styleSheet.selectors.some((selector) => styleSheet.selectors.some((selector) =>
selector.includes(`${consumable.icon} `) selector.includes(`${consumable.icon} `),
) ),
); );
if (!styleSheet) { if (!styleSheet) {
console.warn( console.warn(
`No style sheet found for consumable ${consumable.icon}; skipping...` `No style sheet found for consumable ${consumable.icon}; skipping...`,
); );
continue; continue;
} }
@@ -62,11 +93,21 @@ export async function consumableProvisionIcons() {
.replace(".psd", "") .replace(".psd", "")
.replace(".txt", ""); .replace(".txt", "");
if (vfs.resolve(`Data/${configPath}.packed.webp`)) { if (await vfs.resolve(`Data/${configPath}.packed.webp`)) {
const image = sharp( const packedBuffer = await vfs.file(`Data/${configPath}.packed.webp`);
await vfs.file(`Data/${configPath}.packed.webp`) const consumablesTexture = sharp(packedBuffer);
); const sizes = parsePackedSpriteRect(packedBuffer);
const content = await image.trim({ threshold: 100 }).toBuffer(); let content: Buffer;
if (sizes) {
content = await extractPackedIcon(
consumablesTexture,
sizes,
`consumable ${consumable.icon}`,
);
} else {
content = await consumablesTexture.trim({ threshold: 80 }).toBuffer();
}
await uploader.add({ await uploader.add({
path: `icons/consumables/${consumable.id}.webp`, path: `icons/consumables/${consumable.id}.webp`,
@@ -78,8 +119,8 @@ export async function consumableProvisionIcons() {
`${`Data/${configPath}` `${`Data/${configPath}`
.split("/") .split("/")
.slice(0, -1) .slice(0, -1)
.join("/")}/texture0.packed.webp` .join("/")}/texture0.packed.webp`,
) ),
); );
const sizes = (await vfs.text(`Data/${configPath}.txt`)) const sizes = (await vfs.text(`Data/${configPath}.txt`))
.split("\n")[4] .split("\n")[4]
@@ -104,9 +145,7 @@ export async function consumableProvisionIcons() {
} }
for (const match of ( for (const match of (
await vfs.text( await vfs.text(`Data/XML/item_defs/vehicles/common/provisions/list.xml`)
`Data/XML/item_defs/vehicles/common/provisions/list.xml`
)
).matchAll(listItemsPattern)) { ).matchAll(listItemsPattern)) {
const provisionsCommon = await vfs.xml<{ const provisionsCommon = await vfs.xml<{
root: ProvisionsCommon; root: ProvisionsCommon;
@@ -115,13 +154,13 @@ export async function consumableProvisionIcons() {
for (const provision of Object.values(provisionsCommon.root)) { for (const provision of Object.values(provisionsCommon.root)) {
const styleSheet = styleSheets.find((styleSheet) => const styleSheet = styleSheets.find((styleSheet) =>
styleSheet.selectors.some((selector) => styleSheet.selectors.some((selector) =>
selector.includes(`${provision.icon} `) selector.includes(`${provision.icon} `),
) ),
); );
if (!styleSheet) { if (!styleSheet) {
console.warn( console.warn(
`No style sheet found for provision ${provision.icon}; skipping...` `No style sheet found for provision ${provision.icon}; skipping...`,
); );
continue; continue;
} }
@@ -131,11 +170,21 @@ export async function consumableProvisionIcons() {
.replace(".psd", "") .replace(".psd", "")
.replace(".txt", ""); .replace(".txt", "");
if (vfs.resolve(`Data/${configPath}.packed.webp`)) { if (await vfs.resolve(`Data/${configPath}.packed.webp`)) {
const image = sharp( const packedBuffer = await vfs.file(`Data/${configPath}.packed.webp`);
await vfs.file(`Data/${configPath}.packed.webp`) const provisionsTexture = sharp(packedBuffer);
); const sizes = parsePackedSpriteRect(packedBuffer);
const content = await image.trim({ threshold: 100 }).toBuffer(); let content: Buffer;
if (sizes) {
content = await extractPackedIcon(
provisionsTexture,
sizes,
`provision ${provision.icon}`,
);
} else {
content = await provisionsTexture.trim({ threshold: 80 }).toBuffer();
}
await uploader.add({ await uploader.add({
path: `icons/provisions/${provision.id}.webp`, path: `icons/provisions/${provision.id}.webp`,
@@ -147,8 +196,8 @@ export async function consumableProvisionIcons() {
`${`Data/${configPath}` `${`Data/${configPath}`
.split("/") .split("/")
.slice(0, -1) .slice(0, -1)
.join("/")}/texture0.packed.webp` .join("/")}/texture0.packed.webp`,
) ),
); );
const sizes = (await vfs.text(`Data/${configPath}.txt`)) const sizes = (await vfs.text(`Data/${configPath}.txt`))
.split("\n")[4] .split("\n")[4]
@@ -20,7 +20,7 @@ export async function currencies() {
for (const [file, name] of ICONS) { for (const [file, name] of ICONS) {
const content = await sharp( const content = await sharp(
await vfs.file(`Data/Gfx/Lobby/currency/${file}`) await vfs.file(`Data/Gfx/Lobby/currency/${file}`),
) )
.trim() .trim()
.toBuffer(); .toBuffer();
@@ -36,14 +36,14 @@ export async function currencies() {
.then((glossary) => .then((glossary) =>
Object.values(glossary) Object.values(glossary)
.entries() .entries()
.filter(([key]) => /^prx_season_\d+$/.test(`${key}`)) .filter(([key]) => /^prx_season_\d+$/.test(`${key}`)),
); );
for (const [key, item] of glossary) { for (const [key, item] of glossary) {
if (item.image_url === null) throw new Error(`No image_url for ${key}`); if (item.image_url === null) throw new Error(`No image_url for ${key}`);
const imageRaw = await fetch(item.image_url).then((response) => const imageRaw = await fetch(item.image_url).then((response) =>
response.arrayBuffer() response.arrayBuffer(),
); );
const content = await sharp(imageRaw) const content = await sharp(imageRaw)
.trim({ .trim({
+157 -133
View File
@@ -8,6 +8,7 @@ import {
ConsumableTankCategoryFilterCategory, ConsumableTankCategoryFilterCategory,
Crew, Crew,
CrewType, CrewType,
Equalizer,
EquipmentDefinitions, EquipmentDefinitions,
EquipmentSlot, EquipmentSlot,
GameDefinitions, GameDefinitions,
@@ -32,20 +33,16 @@ import {
} from "@blitzkit/core"; } from "@blitzkit/core";
import { SUPPORTED_LOCALE_BLITZ_MAP } from "@blitzkit/i18n"; import { SUPPORTED_LOCALE_BLITZ_MAP } from "@blitzkit/i18n";
import locales from "@blitzkit/i18n/locales.json"; import locales from "@blitzkit/i18n/locales.json";
import { deburr } from "lodash-es"; import { readFile } from "fs/promises";
import { parse as parsePath } from "path"; import { parse as parsePath } from "path";
import type { Vector3Tuple } from "three"; import type { Vector3Tuple } from "three";
import { slugify } from "transliteration";
import { parse as parseYaml } from "yaml"; import { parse as parseYaml } from "yaml";
import { AssetUploader } from "../core/github/assetUploader"; import { AssetUploader } from "../core/github/assetUploader";
import { vfs } from "./constants"; import { vfs } from "./constants";
import type { Avatar } from "./skillIcons"; import type { Avatar } from "./skillIcons";
import type { TankParameters } from "./tankIcons"; import type { TankParameters } from "./tankIcons";
const nonAlphanumericRegex = /[^a-z0-9]/g;
const multipleDashesRegex = /--+/g;
const trailingDashRegex = /-$/g;
const leadingDashRegex = /^-/g;
const nationSlugDiscriminators = { const nationSlugDiscriminators = {
china: "cn", china: "cn",
european: "eu", european: "eu",
@@ -81,16 +78,16 @@ const blitzTankFilterDefinitionCategoryToBlitzkit: Record<
BlitzTankFilterDefinitionCategory, BlitzTankFilterDefinitionCategory,
ConsumableTankCategoryFilterCategory ConsumableTankCategoryFilterCategory
> = { > = {
clip: ConsumableTankCategoryFilterCategory.CLIP, clip: ConsumableTankCategoryFilterCategory.CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP,
}; };
function vector3TupleToBlitzkit(tuple: Vector3Tuple) { function vector3TupleToBlitzkit(tuple: Vector3Tuple) {
return { x: tuple[0], y: tuple[1], z: tuple[2] } satisfies Vector3; return { x: tuple[0], y: tuple[1], z: tuple[2] } satisfies Vector3;
} }
const blitzTankClassToBlitzkit: Record<BlitzTankClass, TankClass> = { const blitzTankClassToBlitzkit: Record<BlitzTankClass, TankClass> = {
lightTank: TankClass.LIGHT, lightTank: TankClass.TANK_CLASS_LIGHT,
"AT-SPG": TankClass.TANK_DESTROYER, "AT-SPG": TankClass.TANK_CLASS_TANK_DESTROYER,
heavyTank: TankClass.HEAVY, heavyTank: TankClass.TANK_CLASS_HEAVY,
mediumTank: TankClass.MEDIUM, mediumTank: TankClass.TANK_CLASS_MEDIUM,
}; };
export interface BlitzStrings { export interface BlitzStrings {
[key: string]: string; [key: string]: string;
@@ -135,7 +132,7 @@ export interface ChassisDefinitionsList {
} }
type VehicleDefinitionArmor = Record< type VehicleDefinitionArmor = Record<
string, string,
number | { vehicleDamageFactor: 0; "#text": number } number | { vehicleDamageFactor: 0; "#text": number } | number[]
>; >;
interface UnlocksInner { interface UnlocksInner {
cost: number | string; cost: number | string;
@@ -149,18 +146,18 @@ type BlitzModuleType = {
type UnlocksListing = BlitzModuleType | undefined; type UnlocksListing = BlitzModuleType | undefined;
type BlitzCrewType = "commander" | "radioman" | "gunner" | "driver" | "loader"; type BlitzCrewType = "commander" | "radioman" | "gunner" | "driver" | "loader";
const blitzCrewTypeToBlitzkit: Record<BlitzCrewType, CrewType> = { const blitzCrewTypeToBlitzkit: Record<BlitzCrewType, CrewType> = {
commander: CrewType.COMMANDER, commander: CrewType.CREW_TYPE_COMMANDER,
driver: CrewType.DRIVER, driver: CrewType.CREW_TYPE_DRIVER,
gunner: CrewType.GUNNER, gunner: CrewType.CREW_TYPE_GUNNER,
loader: CrewType.LOADER, loader: CrewType.CREW_TYPE_LOADER,
radioman: CrewType.RADIOMAN, radioman: CrewType.CREW_TYPE_RADIOMAN,
}; };
const blitzkitCrewTypeToBlitz: Record<CrewType, BlitzCrewType> = { const blitzkitCrewTypeToBlitz: Record<CrewType, BlitzCrewType> = {
[CrewType.COMMANDER]: "commander", [CrewType.CREW_TYPE_COMMANDER]: "commander",
[CrewType.DRIVER]: "driver", [CrewType.CREW_TYPE_DRIVER]: "driver",
[CrewType.GUNNER]: "gunner", [CrewType.CREW_TYPE_GUNNER]: "gunner",
[CrewType.LOADER]: "loader", [CrewType.CREW_TYPE_LOADER]: "loader",
[CrewType.RADIOMAN]: "radioman", [CrewType.CREW_TYPE_RADIOMAN]: "radioman",
}; };
interface VehicleDefinitions { interface VehicleDefinitions {
invisibility: { invisibility: {
@@ -298,7 +295,7 @@ interface VehicleDefinitions {
type: "default"; type: "default";
enabled: false; enabled: false;
factorsModifiers: ""; factorsModifiers: "";
} },
]; ];
}; };
}; };
@@ -517,20 +514,36 @@ type CombatRolesYaml = Record<
>; >;
const blitzShellKindToBlitzkit: Record<ShellKind, ShellType> = { const blitzShellKindToBlitzkit: Record<ShellKind, ShellType> = {
ARMOR_PIERCING: ShellType.AP, ARMOR_PIERCING: ShellType.SHELL_TYPE_AP,
ARMOR_PIERCING_CR: ShellType.APCR, ARMOR_PIERCING_CR: ShellType.SHELL_TYPE_APCR,
HIGH_EXPLOSIVE: ShellType.HE, HIGH_EXPLOSIVE: ShellType.SHELL_TYPE_HE,
HOLLOW_CHARGE: ShellType.HEAT, HOLLOW_CHARGE: ShellType.SHELL_TYPE_HEAT,
}; };
export const botPattern = /^.+((tutorial_bot(\d+)?)|(TU))$/; export const botPattern = /^.+((tutorial_bot(\d+)?)|(TU))$/;
const blitzModuleTypeToBlitzkit: Record<keyof BlitzModuleType, ModuleType> = { const blitzModuleTypeToBlitzkit: Record<keyof BlitzModuleType, ModuleType> = {
chassis: ModuleType.TRACKS, chassis: ModuleType.MODULE_TYPE_TRACKS,
engine: ModuleType.ENGINE, engine: ModuleType.MODULE_TYPE_ENGINE,
gun: ModuleType.GUN, gun: ModuleType.MODULE_TYPE_GUN,
turret: ModuleType.TURRET, turret: ModuleType.MODULE_TYPE_TURRET,
vehicle: ModuleType.VEHICLE, vehicle: ModuleType.MODULE_TYPE_VEHICLE,
}; };
function assignArmor(
raw: VehicleDefinitionArmor[string],
id: number,
armor: Armor,
) {
if (typeof raw === "number") {
armor.thickness[id] = raw;
} else if (Array.isArray(raw)) {
armor.thickness[id] = raw.at(-1)!;
} else {
if (!armor.spaced) armor.spaced = [];
armor.thickness[id] = raw["#text"];
armor.spaced.push(id);
}
}
export async function definitions() { export async function definitions() {
console.log("Building definitions..."); console.log("Building definitions...");
@@ -555,18 +568,18 @@ export async function definitions() {
const provisionDefinitions: ProvisionDefinitions = { provisions: {} }; const provisionDefinitions: ProvisionDefinitions = { provisions: {} };
const skillDefinitions: SkillDefinitions = { const skillDefinitions: SkillDefinitions = {
classes: { classes: {
[TankClass.LIGHT]: { skills: [] }, [TankClass.TANK_CLASS_LIGHT]: { skills: [] },
[TankClass.MEDIUM]: { skills: [] }, [TankClass.TANK_CLASS_MEDIUM]: { skills: [] },
[TankClass.HEAVY]: { skills: [] }, [TankClass.TANK_CLASS_HEAVY]: { skills: [] },
[TankClass.TANK_DESTROYER]: { skills: [] }, [TankClass.TANK_CLASS_TANK_DESTROYER]: { skills: [] },
}, },
}; };
const nations = vfs const nations = await vfs
.dir("Data/XML/item_defs/vehicles") .dir("Data/XML/item_defs/vehicles")
.filter((nation) => nation !== "common"); .then((files) => files.filter((nation) => nation !== "common"));
const tankStringIdMap: Record<string, number> = {}; const tankStringIdMap: Record<string, number> = {};
const optionalDevices = await vfs.xml<{ root: OptionalDevices }>( 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>> = {}; const stringsI18n: Record<string, Record<string, string>> = {};
@@ -574,12 +587,12 @@ export async function definitions() {
locales.supported.map(async ({ locale }) => { locales.supported.map(async ({ locale }) => {
const blitzLocale = SUPPORTED_LOCALE_BLITZ_MAP[locale]; const blitzLocale = SUPPORTED_LOCALE_BLITZ_MAP[locale];
const cache = await fetch( const cache = await fetch(
`https://stufficons.wgcdn.co/localizations/${blitzLocale}.yaml` `https://stufficons.wgcdn.co/localizations/${blitzLocale}.yaml`,
) )
.then((response) => response.text()) .then((response) => response.text())
.then((string) => parseYaml(string) as BlitzStrings); .then((string) => parseYaml(string) as BlitzStrings);
const preInstalled = await vfs.yaml<BlitzStrings>( const preInstalled = await vfs.yaml<BlitzStrings>(
`Data/Strings/${blitzLocale}.yaml` `Data/Strings/${blitzLocale}.yaml`,
); );
stringsI18n[locale] = { stringsI18n[locale] = {
@@ -588,7 +601,7 @@ export async function definitions() {
}; };
console.log(`Loaded strings for ${locale}`); console.log(`Loaded strings for ${locale}`);
}) }),
); );
function getString(name: string) { function getString(name: string) {
@@ -627,9 +640,9 @@ export async function definitions() {
consumables, consumables,
( (
await vfs.xml<{ root: ConsumablesCommon }>( await vfs.xml<{ root: ConsumablesCommon }>(
`Data/XML/item_defs/vehicles/common/consumables/${match[1]}.xml` `Data/XML/item_defs/vehicles/common/consumables/${match[1]}.xml`,
) )
).root ).root,
); );
} }
@@ -642,39 +655,57 @@ export async function definitions() {
provisions, provisions,
( (
await vfs.xml<{ root: ConsumablesCommon }>( await vfs.xml<{ root: ConsumablesCommon }>(
`Data/XML/item_defs/vehicles/common/provisions/${match[1]}.xml` `Data/XML/item_defs/vehicles/common/provisions/${match[1]}.xml`,
) )
).root ).root,
); );
} }
const avatar = await vfs.xml<{ root: Avatar }>( const avatar = await vfs.xml<{ root: Avatar }>(
`Data/XML/item_defs/tankmen/avatar.xml` `Data/XML/item_defs/tankmen/avatar.xml`,
); );
const maps = await vfs.yaml<Maps>(`Data/maps.yaml`); const maps = await vfs.yaml<Maps>(`Data/maps.yaml`);
const tankXps = new Map<number, ResearchCost>(); const tankXps = new Map<number, ResearchCost>();
const camouflagesXml = await vfs.xml<{ root: CamouflagesXML }>( const camouflagesXml = await vfs.xml<{ root: CamouflagesXML }>(
`Data/XML/item_defs/vehicles/common/camouflages.xml` `Data/XML/item_defs/vehicles/common/camouflages.xml`,
); );
const camouflagesYaml = await vfs.yaml<CamouflagesYaml>( const camouflagesYaml = await vfs.yaml<CamouflagesYaml>(
`Data/camouflages.yaml` `Data/camouflages.yaml`,
); );
const camouflagesXmlEntries = Object.entries(camouflagesXml.root.camouflages); const camouflagesXmlEntries = Object.entries(camouflagesXml.root.camouflages);
const squadBattleTypeStyles = await vfs.yaml<SquadBattleTypeStyles>( const squadBattleTypeStyles = await vfs.yaml<SquadBattleTypeStyles>(
`Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml` `Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml`,
); );
const gameTypeSelectorStyles = await vfs.yaml<SquadBattleTypeStyles>( const gameTypeSelectorStyles = await vfs.yaml<SquadBattleTypeStyles>(
`Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml` `Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`,
); );
const gameModeNativeNames: Record<string, number> = {}; const gameModeNativeNames: Record<string, number> = {};
const combatRoles = await vfs.yaml<CombatRolesYaml>( const combatRoles = await vfs.yaml<CombatRolesYaml>(
`Data/XML/item_defs/vehicles/common/combat_roles.yaml` `Data/XML/item_defs/vehicles/common/combat_roles.yaml`,
); );
const consumableNativeNames: Record<string, number> = {}; const consumableNativeNames: Record<string, number> = {};
const provisionNativeNames: Record<string, number> = {}; const provisionNativeNames: Record<string, number> = {};
let equalizerDefinitions: string[][];
if (
await vfs.resolve("Data/XML/item_defs/vehicles/common/tier_equializer.csv")
) {
equalizerDefinitions = await vfs.csv(
`Data/XML/item_defs/vehicles/common/tier_equializer.csv`,
{ delimiter: ";" },
);
} else {
const stubEqualizerDefinitions = await readFile("stub/equalizer.csv").then(
(buffer) => buffer.toString(),
);
equalizerDefinitions = await vfs._csv(stubEqualizerDefinitions, {
delimiter: ";",
});
}
for (const match of squadBattleTypeStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll( for (const match of squadBattleTypeStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
/"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g /"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g,
)) { )) {
const id = Number(match[1]); const id = Number(match[1]);
const name = getString(match[2]); const name = getString(match[2]);
@@ -686,7 +717,7 @@ export async function definitions() {
} }
for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll( for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
/eGameMode\.([a-zA-Z]+) -> "~res:\/Gfx\/UI\/Hangar\/GameTypes\/battle-type_([^"]+)"/g /eGameMode\.([a-zA-Z]+) -> "~res:\/Gfx\/UI\/Hangar\/GameTypes\/battle-type_([^"]+)"/g,
)) { )) {
Object.entries(gameModeNativeNames).forEach(([key, value]) => { Object.entries(gameModeNativeNames).forEach(([key, value]) => {
if (key.toLowerCase() === match[2].toLowerCase()) { if (key.toLowerCase() === match[2].toLowerCase()) {
@@ -720,7 +751,7 @@ export async function definitions() {
for (const nation of nations) { for (const nation of nations) {
const tankList = await vfs.xml<{ root: VehicleDefinitionList }>( const tankList = await vfs.xml<{ root: VehicleDefinitionList }>(
`Data/XML/item_defs/vehicles/${nation}/list.xml` `Data/XML/item_defs/vehicles/${nation}/list.xml`,
); );
for (const tankKey in tankList.root) { for (const tankKey in tankList.root) {
@@ -734,11 +765,7 @@ export async function definitions() {
getString(tank.userString) getString(tank.userString)
).locales.en; ).locales.en;
let slug = deburr(name).toLowerCase(); let slug = slugify(name);
slug = slug.replaceAll(nonAlphanumericRegex, "-");
slug = slug.replaceAll(multipleDashesRegex, "-");
slug = slug.replaceAll(trailingDashRegex, "");
slug = slug.replaceAll(leadingDashRegex, "");
idToNation[tankId] = nation; idToNation[tankId] = nation;
@@ -761,7 +788,7 @@ export async function definitions() {
console.warn( console.warn(
`Multiple tanks share slug ${slug}: ${requesters `Multiple tanks share slug ${slug}: ${requesters
.map(({ key }) => key) .map(({ key }) => key)
.join(", ")}` .join(", ")}`,
); );
if (requesters.length !== 2) { if (requesters.length !== 2) {
@@ -791,7 +818,7 @@ export async function definitions() {
if (canonical === undefined) { if (canonical === undefined) {
throw new Error( throw new Error(
"Two tutorial bots share the same slug? The world is truly broken." "Two tutorial bots share the same slug? The world is truly broken.",
); );
} }
@@ -804,7 +831,7 @@ export async function definitions() {
for (const nation of nations) { for (const nation of nations) {
const tankList = await vfs.xml<{ root: VehicleDefinitionList }>( const tankList = await vfs.xml<{ root: VehicleDefinitionList }>(
`Data/XML/item_defs/vehicles/${nation}/list.xml` `Data/XML/item_defs/vehicles/${nation}/list.xml`,
); );
const turretList = await vfs.xml<{ const turretList = await vfs.xml<{
root: TurretDefinitionsList; root: TurretDefinitionsList;
@@ -857,7 +884,7 @@ export async function definitions() {
: Number(item.cost.split(":")[1]), : Number(item.cost.split(":")[1]),
}, },
} satisfies Unlock; } satisfies Unlock;
}) }),
) )
.flat(); .flat();
} }
@@ -872,10 +899,10 @@ export async function definitions() {
const tank = tankList.root[tankKey]; const tank = tankList.root[tankKey];
let tankPrice: TankPrice; let tankPrice: TankPrice;
const tankDefinition = await vfs.xml<{ root: VehicleDefinitions }>( const tankDefinition = await vfs.xml<{ root: VehicleDefinitions }>(
`Data/XML/item_defs/vehicles/${nation}/${tankKey}.xml` `Data/XML/item_defs/vehicles/${nation}/${tankKey}.xml`,
); );
const tankParameters = await vfs.yaml<TankParameters>( const tankParameters = await vfs.yaml<TankParameters>(
`Data/3d/Tanks/Parameters/${nation}/${tankKey}.yaml` `Data/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`,
); );
const turretOrigin = tankDefinition.root.hull.turretPositions.turret const turretOrigin = tankDefinition.root.hull.turretPositions.turret
.split(" ") .split(" ")
@@ -890,23 +917,23 @@ export async function definitions() {
if (slug === undefined) { if (slug === undefined) {
throw new Error( throw new Error(
`Could not find slug for ${nation}/${tankKey} (${tankId})` `Could not find slug for ${nation}/${tankKey} (${tankId})`,
); );
} }
if (tank.sellPrice) { if (tank.sellPrice) {
tankPrice = { tankPrice = {
type: TankPriceType.GOLD, type: TankPriceType.TANK_PRICE_TYPE_GOLD,
value: tank.sellPrice["#text"] * 2, value: tank.sellPrice["#text"] * 2,
}; };
} else if (typeof tank.price === "number") { } else if (typeof tank.price === "number") {
tankPrice = { tankPrice = {
type: TankPriceType.CREDITS, type: TankPriceType.TANK_PRICE_TYPE_CREDITS,
value: tank.price, value: tank.price,
}; };
} else { } else {
tankPrice = { tankPrice = {
type: TankPriceType.CREDITS, type: TankPriceType.TANK_PRICE_TYPE_CREDITS,
value: tank.price["#text"] * 400, value: tank.price["#text"] * 400,
}; };
} }
@@ -923,13 +950,7 @@ export async function definitions() {
const armorId = parseInt(armorIdString); const armorId = parseInt(armorIdString);
const armorRaw = tankDefinition.root.hull.armor[name]; const armorRaw = tankDefinition.root.hull.armor[name];
if (typeof armorRaw === "number") { assignArmor(armorRaw, armorId, hullArmor);
hullArmor.thickness[armorId] = armorRaw;
} else {
if (!hullArmor.spaced) hullArmor.spaced = [];
hullArmor.thickness[armorId] = armorRaw["#text"];
hullArmor.spaced.push(armorId);
}
}); });
const crew: Crew[] = []; const crew: Crew[] = [];
const fixedCamouflage = tankTags.includes("eventCamouflage_user"); const fixedCamouflage = tankTags.includes("eventCamouflage_user");
@@ -938,7 +959,7 @@ export async function definitions() {
Object.entries(tankDefinition.root.crew).forEach(([crewKey, value]) => { Object.entries(tankDefinition.root.crew).forEach(([crewKey, value]) => {
let entry: Crew; let entry: Crew;
const index = crew.findIndex( const index = crew.findIndex(
({ type }) => blitzkitCrewTypeToBlitz[type] === crewKey ({ type }) => blitzkitCrewTypeToBlitz[type] === crewKey,
); );
if (index === -1) { if (index === -1) {
if (crewKey === "#text") return; if (crewKey === "#text") return;
@@ -988,10 +1009,23 @@ export async function definitions() {
}) })
.map(([, camo]) => camo.id); .map(([, camo]) => camo.id);
let equalizerEntry = equalizerDefinitions.find(
(line) => line[0] === `${nation}:${tankKey}`,
);
let equalizer: Equalizer | undefined;
if (equalizerEntry) {
const [health, penetration, module_health, damage, armor] =
equalizerEntry?.slice(1).map(Number);
equalizer = { health, penetration, module_health, damage, armor };
}
tankDefinitions.tanks[tankId] = { tankDefinitions.tanks[tankId] = {
ancestors: [], ancestors: [],
successors: [], successors: [],
id: tankId, id: tankId,
dev_name: tankKey,
roles: {}, roles: {},
camouflages: camouflages, camouflages: camouflages,
fixed_camouflage: fixedCamouflage, fixed_camouflage: fixedCamouflage,
@@ -1011,10 +1045,10 @@ export async function definitions() {
slug, slug,
nation, nation,
type: tankTags.includes("collectible") type: tankTags.includes("collectible")
? TankType.COLLECTOR ? TankType.TANK_TYPE_COLLECTOR
: (typeof tank.price === "number" ? false : "gold" in tank.price) : (typeof tank.price === "number" ? false : "gold" in tank.price)
? TankType.PREMIUM ? TankType.TANK_TYPE_PREMIUM
: TankType.RESEARCHABLE, : TankType.TANK_TYPE_RESEARCHABLE,
tier: tank.level, tier: tank.level,
class: blitzTankClassToBlitzkit[tankTags[0] as BlitzTankClass], class: blitzTankClassToBlitzkit[tankTags[0] as BlitzTankClass],
testing: tankTags.includes("testTank"), testing: tankTags.includes("testTank"),
@@ -1022,21 +1056,22 @@ export async function definitions() {
price: tankPrice, price: tankPrice,
camouflage_still: tankDefinition.root.invisibility.still, camouflage_still: tankDefinition.root.invisibility.still,
camouflage_moving: tankDefinition.root.invisibility.moving, camouflage_moving: tankDefinition.root.invisibility.moving,
camouflage_onFire: tankDefinition.root.invisibility.firePenalty, camouflage_on_fire: tankDefinition.root.invisibility.firePenalty,
turrets: [], turrets: [],
engines: [], engines: [],
tracks: [], tracks: [],
equalizer,
}; };
if (tank.combatRole) { if (tank.combatRole) {
Object.entries(tank.combatRole).forEach(([gameMode, role]) => { Object.entries(tank.combatRole).forEach(([gameMode, role]) => {
const id = Object.entries(gameModeNativeNames).find( const id = Object.entries(gameModeNativeNames).find(
([key]) => key.toLowerCase() === gameMode.toLowerCase() ([key]) => key.toLowerCase() === gameMode.toLowerCase(),
)?.[1]; )?.[1];
if (id === undefined) { if (id === undefined) {
throw new Error( throw new Error(
`Unknown game mode in tank ${tankKey}: ${gameMode}` `Unknown game mode in tank ${tankKey}: ${gameMode}`,
); );
} }
@@ -1118,7 +1153,7 @@ export async function definitions() {
(turretKey, turretIndex) => { (turretKey, turretIndex) => {
const turret = tankDefinition.root.turrets0[turretKey]; const turret = tankDefinition.root.turrets0[turretKey];
const turretModel = Number( const turretModel = Number(
parsePath(turret.models.undamaged).name.split("_")[1] parsePath(turret.models.undamaged).name.split("_")[1],
); );
const turretId = toUniqueId(nation, turretList.root.ids[turretKey]); const turretId = toUniqueId(nation, turretList.root.ids[turretKey]);
const turretYaw = ( const turretYaw = (
@@ -1150,13 +1185,7 @@ export async function definitions() {
const armorId = parseInt(armorIdString); const armorId = parseInt(armorIdString);
const armorRaw = turret.armor[name]; const armorRaw = turret.armor[name];
if (typeof armorRaw === "number") { assignArmor(armorRaw, armorId, turretArmor);
turretArmor.thickness[armorId] = armorRaw;
} else {
if (!turretArmor.spaced) turretArmor.spaced = [];
turretArmor.thickness[armorId] = armorRaw["#text"];
turretArmor.spaced.push(armorId);
}
}); });
turret.userString; turret.userString;
@@ -1186,12 +1215,12 @@ export async function definitions() {
min: vector3TupleToBlitzkit( min: vector3TupleToBlitzkit(
tankParameters.collision[ tankParameters.collision[
parsePath(turret.hitTester.collisionModel).name.toLowerCase() parsePath(turret.hitTester.collisionModel).name.toLowerCase()
].bbox.min ].bbox.min,
), ),
max: vector3TupleToBlitzkit( max: vector3TupleToBlitzkit(
tankParameters.collision[ tankParameters.collision[
parsePath(turret.hitTester.collisionModel).name.toLowerCase() parsePath(turret.hitTester.collisionModel).name.toLowerCase()
].bbox.max ].bbox.max,
), ),
}, },
}; };
@@ -1209,7 +1238,7 @@ export async function definitions() {
.split(" ") .split(" ")
.map(Number) as [number, number]; .map(Number) as [number, number];
const gunModel = Number( const gunModel = Number(
parsePath(gun.models.undamaged).name.split("_")[1] parsePath(gun.models.undamaged).name.split("_")[1],
); );
const gunName = getString(gunListEntry.userString); const gunName = getString(gunListEntry.userString);
const gunType = const gunType =
@@ -1287,13 +1316,8 @@ export async function definitions() {
} }
const armorId = parseInt(armorIdString); const armorId = parseInt(armorIdString);
const armorRaw = gun.armor[name]; const armorRaw = gun.armor[name];
if (typeof armorRaw === "number") {
gunArmor.thickness[armorId] = armorRaw; assignArmor(armorRaw, armorId, gunArmor);
} else {
if (!gunArmor.spaced) gunArmor.spaced = [];
gunArmor.thickness[armorId] = armorRaw["#text"];
gunArmor.spaced.push(armorId);
}
}); });
tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({ tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({
@@ -1332,24 +1356,24 @@ export async function definitions() {
}, },
} }
: gunType === "autoReloader" : gunType === "autoReloader"
? { ? {
$case: "auto_reloader", $case: "auto_reloader",
value: { value: {
intra_clip: 60 / gun.clip!.rate, intra_clip: 60 / gun.clip!.rate,
shell_count: gunClipCount, shell_count: gunClipCount,
shell_reloads: gun shell_reloads: gun
.pumpGunReloadTimes!.split(" ") .pumpGunReloadTimes!.split(" ")
.map(Number), .map(Number),
},
}
: {
$case: "auto_loader",
value: {
intra_clip: 60 / gun.clip!.rate,
clip_reload: gun.reloadTime,
shell_count: gunClipCount,
},
}, },
}
: {
$case: "auto_loader",
value: {
intra_clip: 60 / gun.clip!.rate,
clip_reload: gun.reloadTime,
shell_count: gunClipCount,
},
},
} satisfies GunDefinition); } satisfies GunDefinition);
modelDefinitions.models[tankId].turrets[turretId].guns[gunId] = { modelDefinitions.models[tankId].turrets[turretId].guns[gunId] = {
@@ -1360,8 +1384,8 @@ export async function definitions() {
gun.armor.gun === undefined gun.armor.gun === undefined
? 0 ? 0
: typeof gun.armor.gun === "number" : typeof gun.armor.gun === "number"
? gun.armor.gun ? gun.armor.gun
: gun.armor.gun["#text"], : gun.armor.gun["#text"],
pitch: { pitch: {
min: gunPitch[0], min: gunPitch[0],
max: gunPitch[1], max: gunPitch[1],
@@ -1408,7 +1432,7 @@ export async function definitions() {
type: blitzShellKindToBlitzkit[shell.kind], type: blitzShellKindToBlitzkit[shell.kind],
explosion_radius: explosion_radius:
shell.kind === "HIGH_EXPLOSIVE" shell.kind === "HIGH_EXPLOSIVE"
? shell.explosionRadius ?? 0 ? (shell.explosionRadius ?? 0)
: undefined, : undefined,
icon: shell.icon, icon: shell.icon,
penetration: { penetration: {
@@ -1419,7 +1443,7 @@ export async function definitions() {
}); });
}); });
}); });
} },
); );
totalUnlocks.forEach((unlocks) => { totalUnlocks.forEach((unlocks) => {
@@ -1447,7 +1471,7 @@ export async function definitions() {
case "gun": { case "gun": {
gunXps.set( gunXps.set(
toUniqueId(nation, gunList.root.ids[vehicle["#text"]]), toUniqueId(nation, gunList.root.ids[vehicle["#text"]]),
parseResearchCost(vehicle.cost) parseResearchCost(vehicle.cost),
); );
break; break;
} }
@@ -1455,7 +1479,7 @@ export async function definitions() {
case "turret": { case "turret": {
turretXps.set( turretXps.set(
toUniqueId(nation, turretList.root.ids[vehicle["#text"]]), toUniqueId(nation, turretList.root.ids[vehicle["#text"]]),
parseResearchCost(vehicle.cost) parseResearchCost(vehicle.cost),
); );
break; break;
} }
@@ -1463,7 +1487,7 @@ export async function definitions() {
case "engine": { case "engine": {
engineXps.set( engineXps.set(
toUniqueId(nation, enginesList.root.ids[vehicle["#text"]]), toUniqueId(nation, enginesList.root.ids[vehicle["#text"]]),
parseResearchCost(vehicle.cost) parseResearchCost(vehicle.cost),
); );
break; break;
} }
@@ -1471,7 +1495,7 @@ export async function definitions() {
case "chassis": { case "chassis": {
trackXps.set( trackXps.set(
toUniqueId(nation, chassisList.root.ids[vehicle["#text"]]), toUniqueId(nation, chassisList.root.ids[vehicle["#text"]]),
parseResearchCost(vehicle.cost) parseResearchCost(vehicle.cost),
); );
break; break;
} }
@@ -1518,7 +1542,7 @@ export async function definitions() {
name: getString(optionalDeviceEntry.userString), name: getString(optionalDeviceEntry.userString),
description: getString(optionalDeviceEntry.description), description: getString(optionalDeviceEntry.description),
}; };
} },
); );
Object.entries(optionalDeviceSlots.root.presets).forEach( Object.entries(optionalDeviceSlots.root.presets).forEach(
@@ -1537,7 +1561,7 @@ export async function definitions() {
}) })
.flat(), .flat(),
}; };
} },
); );
Object.entries(consumables).forEach(([key, consumable]) => { Object.entries(consumables).forEach(([key, consumable]) => {
@@ -1620,7 +1644,7 @@ export async function definitions() {
(item) => (item) =>
blitzTankFilterDefinitionCategoryToBlitzkit[ blitzTankFilterDefinitionCategoryToBlitzkit[
item as BlitzTankFilterDefinitionCategory item as BlitzTankFilterDefinitionCategory
] ],
), ),
}, },
}, },
@@ -1718,7 +1742,7 @@ export async function definitions() {
(item) => (item) =>
blitzTankFilterDefinitionCategoryToBlitzkit[ blitzTankFilterDefinitionCategoryToBlitzkit[
item as BlitzTankFilterDefinitionCategory item as BlitzTankFilterDefinitionCategory
] ],
), ),
}, },
}, },
@@ -1749,11 +1773,11 @@ export async function definitions() {
value.default_abilities.forEach((ability) => { value.default_abilities.forEach((ability) => {
if (ability in consumableNativeNames) { if (ability in consumableNativeNames) {
gameDefinitions.roles[value.id].consumables.push( gameDefinitions.roles[value.id].consumables.push(
consumableNativeNames[ability] consumableNativeNames[ability],
); );
} else if (ability in provisionNativeNames) { } else if (ability in provisionNativeNames) {
gameDefinitions.roles[value.id].provisions.push( gameDefinitions.roles[value.id].provisions.push(
provisionNativeNames[ability] provisionNativeNames[ability],
); );
} else throw new Error(`Unknown ability ${ability}`); } else throw new Error(`Unknown ability ${ability}`);
}); });
@@ -17,15 +17,15 @@ export async function equipmentIcons() {
using uploader = new AssetUploader("equipment icons"); using uploader = new AssetUploader("equipment icons");
const optionalDevices = await vfs.xml<{ root: OptionalDevices }>( 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 mappings = await vfs.yaml<Mappings>( const mappings = await vfs.yaml<Mappings>(
`Data/UI/Screens3/Lobby/Inventory/OptionalDevices/OptionalDevicesItemImage.style.yaml` `Data/UI/Screens3/Lobby/Inventory/OptionalDevices/OptionalDevicesItemImage.style.yaml`,
); );
const image = sharp( const image = sharp(
await vfs.file( await vfs.file(
`Data/Gfx/UI/InventoryIcons/Big/OptionalDevices/texture0.packed.webp` `Data/Gfx/UI/InventoryIcons/Big/OptionalDevices/texture0.packed.webp`,
) ),
); );
for (const optionalDeviceKey in optionalDevices.root) { for (const optionalDeviceKey in optionalDevices.root) {
@@ -35,8 +35,8 @@ export async function equipmentIcons() {
const mapping = mappings.StyleSheets.find((mapping) => const mapping = mappings.StyleSheets.find((mapping) =>
mapping.selectors.includes( mapping.selectors.includes(
`.optional_device_item.${optionalDevice.icon} #Img` `.optional_device_item.${optionalDevice.icon} #Img`,
) ),
); );
if (!mapping) { if (!mapping) {
@@ -49,9 +49,7 @@ export async function equipmentIcons() {
if (configPath.startsWith("Gfx/Lobby")) { if (configPath.startsWith("Gfx/Lobby")) {
const configPathWebp = configPath.replace(".txt", ""); const configPathWebp = configPath.replace(".txt", "");
const image = sharp( const image = sharp(await vfs.file(`Data/${configPathWebp}.packed.webp`));
await vfs.file(`Data/${configPathWebp}.packed.webp`)
);
const content = await image.trim().toBuffer(); const content = await image.trim().toBuffer();
await uploader.add({ await uploader.add({
+24 -14
View File
@@ -6,20 +6,32 @@ export async function flags() {
console.log("Building flags..."); console.log("Building flags...");
using uploader = new AssetUploader("flags"); using uploader = new AssetUploader("flags");
const circleFiles = vfs.dir(`Data/Gfx/Lobby/flags`).filter( const circleFiles = await vfs
(flag) => .dir(`Data/Gfx/Lobby/flags`)
flag.startsWith("flag_profile-stat_") && .then((files) =>
!flag.endsWith("@2x.packed.webp") files.filter(
(flag) =>
flag.startsWith("flag_profile-stat_") &&
!flag.endsWith("@2x.packed.webp"),
),
); );
const scratchedFiles = vfs.dir(`Data/Gfx/Lobby/flags`).filter( const scratchedFiles = await vfs
.dir(`Data/Gfx/Lobby/flags`)
.then((files) =>
files.filter(
(flag) => (flag) =>
flag.startsWith("flag_tutor-tank_") && flag.startsWith("flag_tutor-tank_") &&
!flag.endsWith("@2x.packed.webp") !flag.endsWith("@2x.packed.webp"),
) ),
const fadedFiles = vfs.dir(`Data/Gfx/Lobby/flags`).filter( );
(flag) => const fadedFiles = await vfs
flag.startsWith("flag_filter_") && flag.endsWith("@2x.packed.webp") .dir(`Data/Gfx/Lobby/flags`)
) .then((files) =>
files.filter(
(flag) =>
flag.startsWith("flag_filter_") && flag.endsWith("@2x.packed.webp"),
),
);
for (const flag of circleFiles) { for (const flag of circleFiles) {
const image = sharp(await vfs.file(`Data/Gfx/Lobby/flags/${flag}`)); const image = sharp(await vfs.file(`Data/Gfx/Lobby/flags/${flag}`));
@@ -43,9 +55,7 @@ export async function flags() {
} }
for (const flag of fadedFiles) { for (const flag of fadedFiles) {
const content = await sharp( const content = await sharp(await vfs.file(`Data/Gfx/Lobby/flags/${flag}`))
await vfs.file(`Data/Gfx/Lobby/flags/${flag}`)
)
.trim({ .trim({
threshold: 100, threshold: 100,
background: { r: 0, g: 0, b: 0, alpha: 0 }, background: { r: 0, g: 0, b: 0, alpha: 0 },
@@ -8,35 +8,33 @@ export async function gameModeBanners() {
using uploader = new AssetUploader("game mode banners"); using uploader = new AssetUploader("game mode banners");
const gameTypeSelectorStyles = await vfs.yaml<SquadBattleTypeStyles>( const gameTypeSelectorStyles = await vfs.yaml<SquadBattleTypeStyles>(
`Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml` `Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`,
); );
const squadBattleTypeStyles = await vfs.yaml<SquadBattleTypeStyles>( const squadBattleTypeStyles = await vfs.yaml<SquadBattleTypeStyles>(
`Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml` `Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml`,
); );
const bannerMatches: { name: string; path: string }[] = []; const bannerMatches: { name: string; path: string }[] = [];
for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll( for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
/eGameMode\.([a-zA-Z]+) -> "~res:([^"]+)"/g /eGameMode\.([a-zA-Z]+) -> "~res:([^"]+)"/g,
)) { )) {
bannerMatches.push({ name: match[1], path: match[2] }); bannerMatches.push({ name: match[1], path: match[2] });
} }
for (const match of squadBattleTypeStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll( for (const match of squadBattleTypeStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
/"(\d+)" -> "battleType\/([a-zA-Z]+)"/g /"(\d+)" -> "battleType\/([a-zA-Z]+)"/g,
)) { )) {
const id = Number(match[1]); const id = Number(match[1]);
const name = match[2]; const name = match[2];
let path = bannerMatches.find( let path = bannerMatches.find(
(bannerMatch) => bannerMatch.name.toLowerCase() === name.toLowerCase() (bannerMatch) => bannerMatch.name.toLowerCase() === name.toLowerCase(),
)?.path; )?.path;
if (path === undefined) { if (path === undefined) {
path = `/Gfx/UI/Hangar/GameTypes/battle-type_${name.toLowerCase()}`; path = `/Gfx/UI/Hangar/GameTypes/battle-type_${name.toLowerCase()}`;
} }
const content = await sharp( const content = await sharp(await vfs.file(`Data${path}.packed.webp`))
await vfs.file(`Data${path}.packed.webp`)
)
.trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } }) .trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } })
.toBuffer(); .toBuffer();
+6 -6
View File
@@ -15,7 +15,7 @@ export async function glossary() {
const glossary = await fetchGlossary(supported.blitz ?? supported.locale); const glossary = await fetchGlossary(supported.blitz ?? supported.locale);
console.log( console.log(
`Found ${Object.keys(glossary).length} things for ${supported.locale}` `Found ${Object.keys(glossary).length} things for ${supported.locale}`,
); );
for (const key in glossary) { for (const key in glossary) {
@@ -30,7 +30,7 @@ export async function glossary() {
} }
if (key in avatars) { if (key in avatars) {
avatars[key].avatar.name.locales[supported.locale] = avatars[key].avatar.name!.locales[supported.locale] =
glossaryEntry.title; glossaryEntry.title;
} else { } else {
const extension = extname(glossaryEntry.image_url); const extension = extname(glossaryEntry.image_url);
@@ -45,7 +45,7 @@ export async function glossary() {
}; };
} }
} }
}) }),
); );
const gallery: Gallery = { avatars: [] }; const gallery: Gallery = { avatars: [] };
@@ -53,12 +53,12 @@ export async function glossary() {
const bar = new ProgressBar( const bar = new ProgressBar(
`Fetching avatars of ${totalCount} things :bar`, `Fetching avatars of ${totalCount} things :bar`,
totalCount totalCount,
); );
await Promise.all( await Promise.all(
Object.entries(avatars).map(async ([key, { url, avatar }]) => { Object.entries(avatars).map(async ([key, { url, avatar }]) => {
if (!(locales.default in avatars[key].avatar.name.locales)) { if (!(locales.default in avatars[key].avatar.name!.locales)) {
console.warn(`Avatar ${key} has no ${locales.default} name`); console.warn(`Avatar ${key} has no ${locales.default} name`);
bar.tick(); bar.tick();
@@ -77,7 +77,7 @@ export async function glossary() {
}); });
bar.tick(); bar.tick();
}) }),
); );
await uploader.add({ await uploader.add({
@@ -8,11 +8,13 @@ export async function migration() {
using uploader = new AssetUploader("migration map"); using uploader = new AssetUploader("migration map");
const map: Record<string, number> = {}; const map: Record<string, number> = {};
const nations = vfs.dir(`Data/XML/item_defs/vehicles`).filter((nation) => nation !== "common"); const nations = await vfs
.dir(`Data/XML/item_defs/vehicles`)
.then((files) => files.filter((nation) => nation !== "common"));
for (const nation of nations) { for (const nation of nations) {
const tankList = await vfs.xml<{ root: VehicleDefinitionList }>( const tankList = await vfs.xml<{ root: VehicleDefinitionList }>(
`Data/XML/item_defs/vehicles/${nation}/list.xml` `Data/XML/item_defs/vehicles/${nation}/list.xml`,
); );
for (const tankKey in tankList.root) { for (const tankKey in tankList.root) {
@@ -6,15 +6,20 @@ export async function moduleIcons() {
console.log("Building module icons..."); console.log("Building module icons...");
using uploader = new AssetUploader("module icons"); using uploader = new AssetUploader("module icons");
const files = vfs.dir(`Data/Gfx/UI/ModulesTechTree`).filter( const files = await vfs
(file) => !file.endsWith("@2x.packed.webp") && file.startsWith("vehicle") .dir(`Data/Gfx/UI/ModulesTechTree`)
) .then((files) =>
files.filter(
(file) =>
!file.endsWith("@2x.packed.webp") && file.startsWith("vehicle"),
),
);
for (const file of files) { for (const file of files) {
const nameRaw = file.match(/vehicle(.+)\.packed\.webp/)![1]; const nameRaw = file.match(/vehicle(.+)\.packed\.webp/)![1];
const name = nameRaw[0].toLowerCase() + nameRaw.slice(1); const name = nameRaw[0].toLowerCase() + nameRaw.slice(1);
const content = await sharp( const content = await sharp(
await vfs.file(`Data/Gfx/UI/ModulesTechTree/${file}`) await vfs.file(`Data/Gfx/UI/ModulesTechTree/${file}`),
) )
.trim() .trim()
.toBuffer(); .toBuffer();
@@ -17,7 +17,7 @@ export async function popularTanks() {
const analytics = google.analyticsdata({ version: "v1beta", auth }); const analytics = google.analyticsdata({ version: "v1beta", auth });
const report = await analytics.properties.runReport({ const report = await analytics.properties.runReport({
property: `properties/${assertSecret( property: `properties/${assertSecret(
import.meta.env.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID import.meta.env.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID,
)}`, )}`,
requestBody: { requestBody: {
dateRanges: [{ startDate: "7daysAgo", endDate: "today" }], dateRanges: [{ startDate: "7daysAgo", endDate: "today" }],
@@ -47,13 +47,13 @@ export async function popularTanks() {
row.dimensionValues[0].value && row.dimensionValues[0].value &&
row.dimensionValues[0].value !== "/tanks/" && row.dimensionValues[0].value !== "/tanks/" &&
row.metricValues && row.metricValues &&
row.metricValues[0].value row.metricValues[0].value,
) )
.map((row) => ({ .map((row) => ({
id: Number( id: Number(
row.dimensionValues![0].value!.match( row.dimensionValues![0].value!.match(
/\/tools\/tankopedia\/(\d+)\/?/ /\/tools\/tankopedia\/(\d+)\/?/,
)?.[1] )?.[1],
), ),
views: Number(row.metricValues![0].value!), views: Number(row.metricValues![0].value!),
})) }))
@@ -8,19 +8,17 @@ export async function shellIcons() {
using uploader = new AssetUploader("shell icons"); using uploader = new AssetUploader("shell icons");
const image = sharp( const image = sharp(
await vfs.file( await vfs.file(
`Data/Gfx/Shared/tank-supply/ammunition/big/texture0.packed.webp` `Data/Gfx/Shared/tank-supply/ammunition/big/texture0.packed.webp`,
) ),
); );
const files = vfs.dir( const files = await vfs
`Data/Gfx/Shared/tank-supply/ammunition/big` .dir(`Data/Gfx/Shared/tank-supply/ammunition/big`)
).filter((file) => file.endsWith("_l.txt")) .then((files) => files.filter((file) => file.endsWith("_l.txt")));
for (const file of files) { for (const file of files) {
const name = file.match(/(.+)_l\.txt/)![1]; const name = file.match(/(.+)_l\.txt/)![1];
const sizes = ( const sizes = (
await vfs.text( await vfs.text(`Data/Gfx/Shared/tank-supply/ammunition/big/${file}`)
`Data/Gfx/Shared/tank-supply/ammunition/big/${file}`
)
) )
.split("\n")[4] .split("\n")[4]
.split(" ") .split(" ")
@@ -26,7 +26,7 @@ export async function skillIcons() {
console.log("Building skill icons..."); console.log("Building skill icons...");
const avatar = await vfs.xml<{ root: Avatar }>( const avatar = await vfs.xml<{ root: Avatar }>(
`Data/XML/item_defs/tankmen/avatar.xml` `Data/XML/item_defs/tankmen/avatar.xml`,
); );
const uploader = new AssetUploader("skill icons"); const uploader = new AssetUploader("skill icons");
@@ -10,11 +10,13 @@ export async function tankArmors() {
using uploader = new AssetUploader("tank armors"); using uploader = new AssetUploader("tank armors");
const nodeIO = new NodeIO(); const nodeIO = new NodeIO();
const nations = vfs.dir(`Data/XML/item_defs/vehicles`).filter((nation) => nation !== "common"); const nations = await vfs
.dir(`Data/XML/item_defs/vehicles`)
.then((files) => files.filter((nation) => nation !== "common"));
for (const nation of nations) { for (const nation of nations) {
const tanks = await vfs.xml<{ root: VehicleDefinitionList }>( const tanks = await vfs.xml<{ root: VehicleDefinitionList }>(
`Data/XML/item_defs/vehicles/${nation}/list.xml` `Data/XML/item_defs/vehicles/${nation}/list.xml`,
); );
for (const tankKey in tanks.root) { for (const tankKey in tanks.root) {
Loaded 100 of 210 files, more files were not shown because too many files have changed in this diff. Show more