mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
Compare commits
480
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
830bde1169 | ||
|
|
d55c9b4cd3 | ||
|
|
2ee72b40ab | ||
|
|
878ada0d10 | ||
|
|
b285e9f1d0 | ||
|
|
c292ddcd6a | ||
|
|
81cc43bd08 | ||
|
|
f41eeba25e | ||
|
|
4e72ea567f | ||
|
|
b572ac5ea8 | ||
|
|
7e2fba35d0 | ||
|
|
e6fa17a911 | ||
|
|
a7d5bd6c75 | ||
|
|
d424679257 | ||
|
|
4248e19f68 | ||
|
|
59ef527967 | ||
|
|
39aeba0766 | ||
|
|
c6f8c1e6a5 | ||
|
|
333c310d5b | ||
|
|
c6c0e02fea | ||
|
|
028f4230e5 | ||
|
|
cf31ad8f7a | ||
|
|
9418526897 | ||
|
|
dacdc9ae53 | ||
|
|
30296d020b | ||
|
|
43b7b4159f | ||
|
|
1aeae3b93b | ||
|
|
d657cd2360 | ||
|
|
222746be26 | ||
|
|
95dd73de52 | ||
|
|
c893fa0a03 | ||
|
|
c0e7f2f00a | ||
|
|
4dce8046cb | ||
|
|
7df2425f76 | ||
|
|
e3cf2d51cc | ||
|
|
91ac93670f | ||
|
|
8a9b02e584 | ||
|
|
c16ccc4b4c | ||
|
|
5dc11473bb | ||
|
|
2213f7d032 | ||
|
|
9d12c936b4 | ||
|
|
3f54e467d8 | ||
|
|
3dd0c4916d | ||
|
|
d2ee528c52 | ||
|
|
0531fbf3ef | ||
|
|
415aab3824 | ||
|
|
f16e508e59 | ||
|
|
3299ce069e | ||
|
|
6395dd3f3d | ||
|
|
9536cd2d39 | ||
|
|
61abddc41b | ||
|
|
b23f88b8a5 | ||
|
|
007ad3be15 | ||
|
|
218684b85c | ||
|
|
2e17ed16ed | ||
|
|
173c476fb4 | ||
|
|
e12ba1e78f | ||
|
|
648344d7cc | ||
|
|
3e0130a200 | ||
|
|
fc0f77a459 | ||
|
|
9ba6d3ca56 | ||
|
|
ba017936fb | ||
|
|
ac47f11460 | ||
|
|
507e6fe7f9 | ||
|
|
965acadc3f | ||
|
|
14a2658a83 | ||
|
|
5cbe08fe1c | ||
|
|
05dd4dbd98 | ||
|
|
a348e005f7 | ||
|
|
62b629fe3a | ||
|
|
f790d07ed6 | ||
|
|
c86b269cf2 | ||
|
|
a878a7a143 | ||
|
|
76fc900a15 | ||
|
|
667d8c8f7c | ||
|
|
9cc94635a8 | ||
|
|
39ffc6ae51 | ||
|
|
4b0035345e | ||
|
|
ef7e002e8c | ||
|
|
81e17317be | ||
|
|
333866a9d6 | ||
|
|
152e0a6680 | ||
|
|
417b717b63 | ||
|
|
c134131127 | ||
|
|
516df13f62 | ||
|
|
0c8bb4be21 | ||
|
|
1f204918a5 | ||
|
|
0507f63177 | ||
|
|
0f84ae45b6 | ||
|
|
ff16a26bd8 | ||
|
|
85ddedd481 | ||
|
|
125f6c721d | ||
|
|
4bad35239b | ||
|
|
ff7716ce6c | ||
|
|
231e4aad0e | ||
|
|
632989087c | ||
|
|
bb0b932d26 | ||
|
|
3714c74394 | ||
|
|
168e85d838 | ||
|
|
666f44d9e6 | ||
|
|
595db8709b | ||
|
|
18a6f30a4b | ||
|
|
9b8d4c4e3c | ||
|
|
73de6e3521 | ||
|
|
6aa14d2faf | ||
|
|
477b9a9630 | ||
|
|
b297babde5 | ||
|
|
c854e8f7cb | ||
|
|
06832e156f | ||
|
|
22b77398ad | ||
|
|
665d5c0f2d | ||
|
|
d9b22431fa | ||
|
|
0a186399b6 | ||
|
|
d2b4cc3e7d | ||
|
|
885c260605 | ||
|
|
f8a71feb46 | ||
|
|
0cb4aadec3 | ||
|
|
f58d06b3c3 | ||
|
|
2c44bd8374 | ||
|
|
699b445f79 | ||
|
|
26bb350709 | ||
|
|
6fb51e703d | ||
|
|
7a7c73d77b | ||
|
|
f945786e2f | ||
|
|
c678830fd2 | ||
|
|
006b2fef78 | ||
|
|
26a0c1f176 | ||
|
|
403d1e7849 | ||
|
|
c9d8f6b445 | ||
|
|
73c53d6ef5 | ||
|
|
f8e8fd4016 | ||
|
|
15b29f439a | ||
|
|
fd96cd5975 | ||
|
|
66b9a9076f | ||
|
|
746c7963de | ||
|
|
ae96ae34c0 | ||
|
|
1f690d11c7 | ||
|
|
8cf3da12fa | ||
|
|
a8ae806f8b | ||
|
|
8a6841adea | ||
|
|
5e88f5a73d | ||
|
|
aa1f357538 | ||
|
|
ca270e2010 | ||
|
|
17264c1adc | ||
|
|
2627aba938 | ||
|
|
a2574efb9c | ||
|
|
d3ab4bac51 | ||
|
|
ad78e45f1b | ||
|
|
5ea7bbd6a1 | ||
|
|
2b955a281b | ||
|
|
676601b06e | ||
|
|
b81d9985ee | ||
|
|
d66d25a261 | ||
|
|
402d054b30 | ||
|
|
61d6d42742 | ||
|
|
03e06b050e | ||
|
|
cca46957bc | ||
|
|
3c92ab3a19 | ||
|
|
6c31f663f6 | ||
|
|
bd140f0eda | ||
|
|
a3d8fcb960 | ||
|
|
06304cf075 | ||
|
|
416d061df1 | ||
|
|
47c87970cd | ||
|
|
ff3ed9d656 | ||
|
|
4e9c3df5eb | ||
|
|
c100a1e655 | ||
|
|
26cc0cc723 | ||
|
|
f697f94bd5 | ||
|
|
30fa18f0fd | ||
|
|
c45af8e156 | ||
|
|
f95a6e3495 | ||
|
|
0e637d772e | ||
|
|
a834d48a38 | ||
|
|
f550386fd9 | ||
|
|
0a4b81cde4 | ||
|
|
e1cc60ea5e | ||
|
|
a40860901b | ||
|
|
f3e96718eb | ||
|
|
a00411919d | ||
|
|
b298874f0d | ||
|
|
7011d4d20f | ||
|
|
d9ce16b41a | ||
|
|
f0e0d849d5 | ||
|
|
6d2573ee95 | ||
|
|
4c77cc2282 | ||
|
|
32f6916266 | ||
|
|
3a91e082d5 | ||
|
|
2184c1c703 | ||
|
|
95ad6bade7 | ||
|
|
8bda4a5331 | ||
|
|
16c77f587a | ||
|
|
a218c791a9 | ||
|
|
dccdf55bfc | ||
|
|
1ba6e70c56 | ||
|
|
0e76184813 | ||
|
|
c674da29d5 | ||
|
|
ba4e6dfd68 | ||
|
|
980fd6e50e | ||
|
|
44e7cd7505 | ||
|
|
3a60535564 | ||
|
|
9abfeb749c | ||
|
|
0442c789f1 | ||
|
|
76dc9f0742 | ||
|
|
ff56f1441e | ||
|
|
e3db886923 | ||
|
|
249f62759e | ||
|
|
7767481633 | ||
|
|
a97b1383d8 | ||
|
|
1b224b3949 | ||
|
|
018aa33a7f | ||
|
|
4b7b8b3392 | ||
|
|
272824a72f | ||
|
|
ac02d65db0 | ||
|
|
9bcaff9fd3 | ||
|
|
7b650bf39b | ||
|
|
ee1ecb83b7 | ||
|
|
d6e37119a8 | ||
|
|
385cc3b6d2 | ||
|
|
b4936bf13b | ||
|
|
e1e9403c60 | ||
|
|
0828d50830 | ||
|
|
0817ba18bd | ||
|
|
121a80d079 | ||
|
|
932c414b0c | ||
|
|
3a38441d42 | ||
|
|
3e039d34c2 | ||
|
|
2bae132d18 | ||
|
|
bc0004574a | ||
|
|
2e208507c3 | ||
|
|
33209a6d31 | ||
|
|
13311245a5 | ||
|
|
4067357b54 | ||
|
|
fd6b69edc1 | ||
|
|
2504833a29 | ||
|
|
6d31dcb74b | ||
|
|
a149af50fd | ||
|
|
13927927b3 | ||
|
|
68edf520c5 | ||
|
|
f7933a1295 | ||
|
|
9a1c09490f | ||
|
|
c8b5c216e3 | ||
|
|
344954513a | ||
|
|
f8029bdf67 | ||
|
|
d9c7d31017 | ||
|
|
79dba0fe2c | ||
|
|
c0376182f8 | ||
|
|
8e3b5de249 | ||
|
|
44711a58c7 | ||
|
|
e7337145d2 | ||
|
|
c116b40dfc | ||
|
|
d88f7ad539 | ||
|
|
b5d61cebb3 | ||
|
|
551108e047 | ||
|
|
5feec9bf1e | ||
|
|
313691d3e9 | ||
|
|
950c99d3d7 | ||
|
|
80cc74a945 | ||
|
|
4e586253c0 | ||
|
|
08980158e4 | ||
|
|
1e917c7b89 | ||
|
|
8d3678ddcb | ||
|
|
6a58c5ea1d | ||
|
|
b9bbf22f2c | ||
|
|
c99ed0cb53 | ||
|
|
cef18d4f64 | ||
|
|
824169fc25 | ||
|
|
841b5708ae | ||
|
|
8ad110f73b | ||
|
|
0869ea09c8 | ||
|
|
0e57943d33 | ||
|
|
8b01b7c192 | ||
|
|
a7bd671309 | ||
|
|
406ad52c8d | ||
|
|
b6c4c4e852 | ||
|
|
f193d5c503 | ||
|
|
6a06cb17a3 | ||
|
|
bf218b0975 | ||
|
|
5412c479c8 | ||
|
|
ccb86ae824 | ||
|
|
001709c25c | ||
|
|
e50b8d11bf | ||
|
|
ea782af079 | ||
|
|
0ebf9f6c3d | ||
|
|
6fec467ec8 | ||
|
|
8b0f1cdfed | ||
|
|
f6008bd288 | ||
|
|
1776c8fc15 | ||
|
|
99f41b9805 | ||
|
|
d4f11fc52a | ||
|
|
750aeb39c9 | ||
|
|
0f355bc2fc | ||
|
|
6ebd3063ed | ||
|
|
b070cad92a | ||
|
|
204fbbff59 | ||
|
|
98e7760142 | ||
|
|
6c1c088d44 | ||
|
|
0b7f717057 | ||
|
|
728cb43f05 | ||
|
|
ff02f06cbc | ||
|
|
7a817cbe8c | ||
|
|
58e0876aa0 | ||
|
|
f84f846e76 | ||
|
|
ddb869e767 | ||
|
|
015d457d23 | ||
|
|
ba6a83a9cb | ||
|
|
689985ed93 | ||
|
|
bf9262f1f1 | ||
|
|
821bd363ad | ||
|
|
4a9fc65e71 | ||
|
|
81877f5abd | ||
|
|
01eed3e045 | ||
|
|
7bc423b570 | ||
|
|
dba56f8946 | ||
|
|
c1f765d5f7 | ||
|
|
7f5b5b614f | ||
|
|
5cd149b2b9 | ||
|
|
0bc2d0aaf6 | ||
|
|
1dc9a341d1 | ||
|
|
2ad1e71176 | ||
|
|
ca6973f529 | ||
|
|
323d624ec7 | ||
|
|
49f84db473 | ||
|
|
7399c402af | ||
|
|
cbfcb29691 | ||
|
|
ae616fbaf3 | ||
|
|
35275d4aa8 | ||
|
|
dda63830ec | ||
|
|
79b4f05809 | ||
|
|
b50c47b744 | ||
|
|
f7c6fdd861 | ||
|
|
47b583821e | ||
|
|
369ac113fa | ||
|
|
fc4d8b5ad0 | ||
|
|
72e1cf7d6a | ||
|
|
dd96556e2a | ||
|
|
a7ee51526a | ||
|
|
610b59f4c6 | ||
|
|
63ce327458 | ||
|
|
6ec7a50320 | ||
|
|
60a29ef2e7 | ||
|
|
52c3a0abe0 | ||
|
|
5bbe5c2720 | ||
|
|
c0c6a21e43 | ||
|
|
a7f93698a6 | ||
|
|
1a18058228 | ||
|
|
67024daa25 | ||
|
|
de6137d1a5 | ||
|
|
11e87bd519 | ||
|
|
3b4e089756 | ||
|
|
4a6f5845f9 | ||
|
|
e9684ce033 | ||
|
|
27abf1b0de | ||
|
|
f5f3f70e35 | ||
|
|
2d282a3261 | ||
|
|
a2d0d2d8c0 | ||
|
|
ea412086d4 | ||
|
|
455679a981 | ||
|
|
a21bc6174d | ||
|
|
fae1a89402 | ||
|
|
5a1a0c59f1 | ||
|
|
c98271f783 | ||
|
|
033660c2d9 | ||
|
|
1a639c51e1 | ||
|
|
1366579dd1 | ||
|
|
f5ed2c2c40 | ||
|
|
1598de9f5f | ||
|
|
6f47f5cc99 | ||
|
|
1117dcb935 | ||
|
|
01a58f9aa8 | ||
|
|
9096644d51 | ||
|
|
d42fc0e3f6 | ||
|
|
17d1526b6f | ||
|
|
db8ac195d4 | ||
|
|
c5f5f69fd6 | ||
|
|
44203223fd | ||
|
|
bdabadcd49 | ||
|
|
220e4388d4 | ||
|
|
51b2d1ce86 | ||
|
|
f3c1825c57 | ||
|
|
359dfcd102 | ||
|
|
649cdd893f | ||
|
|
0cb974acf5 | ||
|
|
9bca5dccc7 | ||
|
|
d707f1cc5d | ||
|
|
4ed4395535 | ||
|
|
0209d48475 | ||
|
|
437bee4a85 | ||
|
|
4b8e73fa57 | ||
|
|
b96f925d9a | ||
|
|
1551dc50fd | ||
|
|
daf4cef61c | ||
|
|
496e127f64 | ||
|
|
da1af66c77 | ||
|
|
01409985a2 | ||
|
|
a86ac0619a | ||
|
|
385d165512 | ||
|
|
fcfc97b964 | ||
|
|
53d05e73a6 | ||
|
|
40a1eb861d | ||
|
|
1d3cb95b89 | ||
|
|
010303a818 | ||
|
|
7281b9fed0 | ||
|
|
c5785c7ae6 | ||
|
|
698731cb9a | ||
|
|
99bae8f2c5 | ||
|
|
5034ec1aa0 | ||
|
|
be821c1f8b | ||
|
|
a364b79a9b | ||
|
|
0aa6e1e79a | ||
|
|
d2a6379131 | ||
|
|
07ce61d19f | ||
|
|
ad9f2d8609 | ||
|
|
57702d8a43 | ||
|
|
9a30af3818 | ||
|
|
23751fbdf3 | ||
|
|
db6d181f78 | ||
|
|
56ca4dcc61 | ||
|
|
d08b537721 | ||
|
|
c1a2edb489 | ||
|
|
164b7fa454 | ||
|
|
428483cf4c | ||
|
|
89f02eb399 | ||
|
|
4ce127516c | ||
|
|
6f4f487dfe | ||
|
|
57dd60e804 | ||
|
|
d24fd2250c | ||
|
|
e00bcdfc06 | ||
|
|
67dd204ee6 | ||
|
|
e130583fa4 | ||
|
|
6ad20a0fcf | ||
|
|
9fad644d7a | ||
|
|
8cb523dd06 | ||
|
|
b50ee23a26 | ||
|
|
a973cf699b | ||
|
|
102abf49c4 | ||
|
|
8929e503ea | ||
|
|
a2a794eb74 | ||
|
|
2e95f5dd95 | ||
|
|
23a42230cb | ||
|
|
e66daed7ae | ||
|
|
f2d0f68f07 | ||
|
|
be4af0bf84 | ||
|
|
15172e8b33 | ||
|
|
c6b7918525 | ||
|
|
4f1c4421e5 | ||
|
|
7b830f5a71 | ||
|
|
6ce1135835 | ||
|
|
66eaaef6de | ||
|
|
48fbf59036 | ||
|
|
0e0f4fbe9f | ||
|
|
6ba6e10108 | ||
|
|
cf8fa4ffb4 | ||
|
|
2b0180dce2 | ||
|
|
caee848a47 | ||
|
|
d01b7cf707 | ||
|
|
8921f84c38 | ||
|
|
6830df01fa | ||
|
|
67da59ef41 | ||
|
|
036cc9915d | ||
|
|
57b6ba19f0 | ||
|
|
32b5593d07 | ||
|
|
3b757562d2 | ||
|
|
4c8c2d0868 | ||
|
|
b2f266401f | ||
|
|
5541eca23d | ||
|
|
122d65840e | ||
|
|
ed4b72d85c | ||
|
|
4033e8618f | ||
|
|
42cada1811 | ||
|
|
ff7ed213c8 | ||
|
|
a0367af06b | ||
|
|
58c2965c53 | ||
|
|
edae41409a | ||
|
|
383d3a36ef | ||
|
|
6a958da390 | ||
|
|
ef154f99d5 | ||
|
|
4a20102de3 | ||
|
|
4e170f2917 | ||
|
|
a70d788f6b |
No files matched your search
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
name: proto-workflow
|
|
||||||
description: Regenerate this repository's TypeScript protobuf outputs after editing .proto schemas.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Proto Workflow
|
|
||||||
|
|
||||||
After editing any `.proto` schema in this repository, run `bun run build-protos` from the repository root. Review the generated changes and address any schema or generator errors before finishing the task.
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
name: repo-boundaries
|
|
||||||
description: Apply the user's persistent repository boundaries whenever working in their projects.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Repo Boundaries
|
|
||||||
|
|
||||||
Apply these boundaries to all work in the user's repositories:
|
|
||||||
|
|
||||||
- Read-only Git commands are allowed when useful, including status, diff, log, and show. Do not run Git commands that modify repository state.
|
|
||||||
- Never edit `bun.lock`, including regenerating or formatting it. When dependency manifests change, leave the lockfile alone; the user will update it by running `bun install`.
|
|
||||||
|
|
||||||
These are firm constraints, not preferences to revisit for a task. Continue useful work within them and explain any limitation if a requested result would require crossing either boundary.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "Repo Boundaries"
|
|
||||||
short_description: "Respect repository editing boundaries"
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
indentSize: 2
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
name: 🐞 Bug Report
|
|
||||||
description: BlitzKit is not behaving as expected.
|
|
||||||
labels: ["bug"]
|
|
||||||
type: bug
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: Thank you so much for reporting an issue! Please fill out the form below in its entirety and we'll address your issue as soon as possible.
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
attributes:
|
|
||||||
label: What happened?
|
|
||||||
description: What about BlitzKit's behavior did you find unexpected?
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: How do you reproduce the issue?
|
|
||||||
description: What steps one must follow to recreate your issue?
|
|
||||||
|
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: Branch
|
|
||||||
description: What branch of BlitzKit were you using? Please see the "Branch" section of the footer at the very bottom of any page.
|
|
||||||
options:
|
|
||||||
- Production
|
|
||||||
- Preview
|
|
||||||
- OpenTest
|
|
||||||
default: 0
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Discord username
|
|
||||||
description: Do you have a Discord account that we can reach out to for further information?
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
blank_issues_enabled: false
|
|
||||||
|
|
||||||
contact_links:
|
|
||||||
- name: 🎮 Discord Server
|
|
||||||
about: Got questions? We answer better on Discord!
|
|
||||||
url: https://discord.gg/nDt7AjGJQH
|
|
||||||
|
|
||||||
- name: ✉️ Email
|
|
||||||
about: Reach out to BlitzKit formally through email.
|
|
||||||
url: https://blitzkit.app/contact
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
name: 💡 Feature Request
|
|
||||||
description: BlitzKit could use a new idea.
|
|
||||||
labels: ["enhancement"]
|
|
||||||
type: feature
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: Thank you so much for pitching in an idea!
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
attributes:
|
|
||||||
label: What's your idea?
|
|
||||||
description: Please be descriptive and feel free to add drawings/screenshots if needed.
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "bun"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
name: Discover IDs
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: production
|
|
||||||
|
|
||||||
schedule:
|
|
||||||
- cron: 0 */6 * * *
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
discover:
|
|
||||||
name: Discover IDs
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
ref: production
|
|
||||||
submodules: recursive
|
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
|
||||||
|
|
||||||
- name: Setup bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: bun install
|
|
||||||
|
|
||||||
- name: Setup Git
|
|
||||||
run: |
|
|
||||||
git config --global user.name "github-actions[bot]"
|
|
||||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
||||||
|
|
||||||
- name: Discover IDs
|
|
||||||
run: bun run discover-ids
|
|
||||||
env:
|
|
||||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
|
||||||
GH_TOKEN: ${{ secrets.IDS_TOKEN }}
|
|
||||||
+45
-126
@@ -2,98 +2,46 @@ name: Website
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
||||||
schedule:
|
|
||||||
- cron: "0 4 * * *"
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
branch:
|
|
||||||
description: Branch
|
|
||||||
|
|
||||||
type: choice
|
|
||||||
required: true
|
|
||||||
default: production
|
|
||||||
|
|
||||||
options:
|
|
||||||
- production
|
|
||||||
- main
|
|
||||||
|
|
||||||
environment:
|
|
||||||
description: Environment
|
|
||||||
|
|
||||||
type: choice
|
|
||||||
required: true
|
|
||||||
default: production
|
|
||||||
|
|
||||||
options:
|
|
||||||
- development
|
|
||||||
- beta
|
|
||||||
- production
|
|
||||||
- preview
|
|
||||||
- opentest
|
|
||||||
|
|
||||||
client_provider:
|
|
||||||
description: Client provider
|
|
||||||
|
|
||||||
type: choice
|
|
||||||
required: true
|
|
||||||
default: steam
|
|
||||||
|
|
||||||
options:
|
|
||||||
- steam
|
|
||||||
- zip
|
|
||||||
- wgpkg
|
|
||||||
|
|
||||||
client_source:
|
|
||||||
description: Client source
|
|
||||||
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: 444200/windows
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ inputs.environment || github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# client
|
|
||||||
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
|
|
||||||
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
|
|
||||||
CLIENT_PROVIDER: ${{ inputs.client_provider || 'steam' }}
|
|
||||||
CLIENT_SOURCE: ${{ inputs.client_source || '444200/windows' }}
|
|
||||||
CLIENT_DIR: ../../temp/game
|
|
||||||
|
|
||||||
# blitzkit
|
|
||||||
PUBLIC_ENVIRONMENT: ${{ inputs.environment || 'production' }}
|
|
||||||
PUBLIC_PROMOTE_OPENTEST: false
|
|
||||||
PUBLIC_STATIC_ASSET_BASE: https://assets.blitzkit.app
|
|
||||||
PUBLIC_GUIDE_WEBSITE: https://guidesblitz.com
|
|
||||||
|
|
||||||
# blitz
|
# blitz
|
||||||
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
|
WOTB_SERVER: ${{ secrets.WOTB_SERVER }}
|
||||||
WOTB_GLOSSARY_DOMAIN: ${{ secrets.WOTB_GLOSSARY_DOMAIN }}
|
WOTB_VERSION: ${{ secrets.WOTB_VERSION }}
|
||||||
WOTB_GLOSSARY_PATH: ${{ secrets.WOTB_GLOSSARY_PATH }}
|
PUBLIC_WOTB_CLIENT: ../../temp/game
|
||||||
|
WOTB_USMAP: ../closed/blitz.usmap
|
||||||
|
|
||||||
# google
|
# google
|
||||||
PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ secrets.PUBLIC_GOOGLE_TAG_MANAGER_ID }}
|
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
|
||||||
|
PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID }}
|
||||||
|
|
||||||
# wargaming
|
# steam
|
||||||
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
|
||||||
|
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
|
||||||
|
STEAM_APP: 3341250
|
||||||
|
STEAM_OS: windows
|
||||||
|
STEAM_FINGERPRINT: Manifest_UFSFiles_Win64.txt
|
||||||
|
|
||||||
|
# debug
|
||||||
|
DOTNET_EnableDiagnostics: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build website
|
name: Build chunk ${{ matrix.chunk }}
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
chunk: [default, api]
|
chunk: [pages, api, media, models, textures]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Free disk space
|
- name: Free disk space
|
||||||
@@ -102,75 +50,46 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.branch || 'production' }}
|
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
- name: Setup bun
|
- name: Set up Bun
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: oven-sh/setup-bun@v2
|
||||||
|
|
||||||
- name: Setup protoc
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: latest
|
||||||
|
|
||||||
|
- name: Set up Dotnet
|
||||||
|
uses: actions/setup-dotnet@v5
|
||||||
|
with:
|
||||||
|
dotnet-version: 9.0.x
|
||||||
|
|
||||||
|
- name: Set up Protoc
|
||||||
uses: arduino/setup-protoc@v3
|
uses: arduino/setup-protoc@v3
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GH_TOKEN }}
|
repo-token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
- name: Setup CLIs
|
- name: Set up project
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
bun run setup
|
||||||
sudo apt-get install -y aria2 libarchive-tools
|
./scripts/setup_depot_downloader.sh
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Download Steam game
|
||||||
run: bun install
|
run: scripts/download_game.sh
|
||||||
|
|
||||||
- name: Download Client
|
- name: Enable core dumps
|
||||||
run: bun run download-client
|
run: |
|
||||||
|
ulimit -c unlimited
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: bun run --bun build
|
run: bun run build-website
|
||||||
env:
|
env:
|
||||||
CHUNK: ${{ matrix.chunk }}
|
BUILD_CHUNK: ${{ matrix.chunk }}
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
id: upload
|
uses: actions/upload-pages-artifact@v5
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: chunk-${{ matrix.chunk }}
|
name: chunk-${{ matrix.chunk }}
|
||||||
path: dist/website
|
path: ${{ matrix.chunk == 'pages' && 'dist/website' || format('dist/website/{0}', matrix.chunk) }}
|
||||||
|
|
||||||
- name: Trigger deployment
|
|
||||||
|
|
||||||
# Deploy if:
|
|
||||||
# 1. Running cron from main using content from production to target production
|
|
||||||
# 2. Running manually and targeting non-production
|
|
||||||
if: >-
|
|
||||||
${{
|
|
||||||
github.ref == 'refs/heads/production' ||
|
|
||||||
(inputs.environment != '' && inputs.environment != 'production')
|
|
||||||
}}
|
|
||||||
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.GH_NODE_DEPLOY_TOKEN }}
|
|
||||||
CHUNK: ${{ matrix.chunk }}
|
|
||||||
|
|
||||||
run: |
|
|
||||||
ENV_FILE="environments/${PUBLIC_ENVIRONMENT}.json"
|
|
||||||
TARGET_REPO=$(jq -r ".nodes.\"$CHUNK\"" "$ENV_FILE")
|
|
||||||
|
|
||||||
if [ "$TARGET_REPO" == "null" ] || [ -z "$TARGET_REPO" ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
-H "Authorization: Bearer $TOKEN" \
|
|
||||||
"https://api.github.com/repos/$TARGET_REPO/dispatches" \
|
|
||||||
-d "{
|
|
||||||
\"event_type\": \"deploy-pages\",
|
|
||||||
\"client_payload\": {
|
|
||||||
\"source_repo\": \"${{ github.repository }}\",
|
|
||||||
\"run_id\": \"${{ github.run_id }}\",
|
|
||||||
\"artifact_id\": \"${{ steps.upload.outputs.artifact-id }}\",
|
|
||||||
\"chunk\": \"$CHUNK\"
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
+4
-4
@@ -1,9 +1,7 @@
|
|||||||
packages/protos/src/*/*.ts
|
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
_node_modules
|
_node_modules
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.env
|
*.env
|
||||||
/test-results/
|
/test-results/
|
||||||
/playwright-report/
|
/playwright-report/
|
||||||
/playwright/.cache/
|
/playwright/.cache/
|
||||||
@@ -24,11 +22,12 @@ depots
|
|||||||
public/sitemap*
|
public/sitemap*
|
||||||
/firebase.json
|
/firebase.json
|
||||||
target
|
target
|
||||||
# packages/core/src/protos/*.ts
|
packages/website-ue/src/protos/*.ts
|
||||||
/.vercel
|
/.vercel
|
||||||
.astro
|
.astro
|
||||||
.vercel
|
.vercel
|
||||||
/src
|
/src
|
||||||
|
/packages/bot/src/prisma
|
||||||
dev-dist
|
dev-dist
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
@@ -54,3 +53,4 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
*.lscache
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
[submodule "packages/closed"]
|
[submodule "packages/closed"]
|
||||||
path = packages/closed
|
path = packages/closed
|
||||||
url = https://github.com/blitzkit/closed.git
|
url = https://github.com/blitzkit/closed.git
|
||||||
|
[submodule "packages/cue4parse"]
|
||||||
|
path = packages/cue4parse
|
||||||
|
url = https://github.com/tresabhi/CUE4Parse.git
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"tabWidth": 2
|
||||||
|
}
|
||||||
Vendored
-4
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"recommendations": ["astro-build.astro-vscode"],
|
|
||||||
"unwantedRecommendations": []
|
|
||||||
}
|
|
||||||
Vendored
-11
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"command": "./node_modules/.bin/astro dev",
|
|
||||||
"name": "Development server",
|
|
||||||
"request": "launch",
|
|
||||||
"type": "node-terminal"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Vendored
-263
@@ -1,263 +0,0 @@
|
|||||||
{
|
|
||||||
"cSpell.words": [
|
|
||||||
"AABBOX",
|
|
||||||
"Abhi",
|
|
||||||
"absarc",
|
|
||||||
"accountinfo",
|
|
||||||
"adsense",
|
|
||||||
"aeson",
|
|
||||||
"alphatest",
|
|
||||||
"analyticsdata",
|
|
||||||
"analyticsreporting",
|
|
||||||
"APAC",
|
|
||||||
"apcr",
|
|
||||||
"appinfo",
|
|
||||||
"applypatches",
|
|
||||||
"artefacts",
|
|
||||||
"astrojs",
|
|
||||||
"astrolib",
|
|
||||||
"atgm",
|
|
||||||
"autocrop",
|
|
||||||
"Autoloader",
|
|
||||||
"Autoreloader",
|
|
||||||
"AYUV",
|
|
||||||
"battleresults",
|
|
||||||
"bbox",
|
|
||||||
"beforeinstallprompt",
|
|
||||||
"bepaint",
|
|
||||||
"betakrieg",
|
|
||||||
"BINORMAL",
|
|
||||||
"Binormals",
|
|
||||||
"bkni",
|
|
||||||
"BKRL",
|
|
||||||
"BKRTS",
|
|
||||||
"BKRTSMANIFEST",
|
|
||||||
"bkwd",
|
|
||||||
"blitzkit",
|
|
||||||
"blitzrinth",
|
|
||||||
"blitzstars",
|
|
||||||
"bufbuild",
|
|
||||||
"cacheable",
|
|
||||||
"Callouts",
|
|
||||||
"Camo",
|
|
||||||
"Carro",
|
|
||||||
"CCPAOPTOUT",
|
|
||||||
"CDON",
|
|
||||||
"clanid",
|
|
||||||
"classname",
|
|
||||||
"cleandist",
|
|
||||||
"closedkrieg",
|
|
||||||
"cockroackdb",
|
|
||||||
"Coef",
|
|
||||||
"Combattimento",
|
|
||||||
"cooldown",
|
|
||||||
"corelations",
|
|
||||||
"corsproxy",
|
|
||||||
"CUBEMAP",
|
|
||||||
"CUBETEXCOORD",
|
|
||||||
"customperiod",
|
|
||||||
"datasource",
|
|
||||||
"Dava",
|
|
||||||
"dbid",
|
|
||||||
"Ddpf",
|
|
||||||
"Ddsd",
|
|
||||||
"deadrail",
|
|
||||||
"debugflags",
|
|
||||||
"deburr",
|
|
||||||
"decalmask",
|
|
||||||
"decompressor",
|
|
||||||
"décor",
|
|
||||||
"dedup",
|
|
||||||
"defence",
|
|
||||||
"degressive",
|
|
||||||
"depotdownloader",
|
|
||||||
"devkrieg",
|
|
||||||
"diacriticless",
|
|
||||||
"DIDS",
|
|
||||||
"donotremove",
|
|
||||||
"drei",
|
|
||||||
"Droodles",
|
|
||||||
"dvpd",
|
|
||||||
"dvpl",
|
|
||||||
"DVPLCRC",
|
|
||||||
"dvpm",
|
|
||||||
"dxgi",
|
|
||||||
"easimon",
|
|
||||||
"echarts",
|
|
||||||
"Everytime",
|
|
||||||
"FASTNAME",
|
|
||||||
"favicons",
|
|
||||||
"flexdirection",
|
|
||||||
"fontsource",
|
|
||||||
"FOURCC",
|
|
||||||
"frameloop",
|
|
||||||
"fsformat",
|
|
||||||
"Fullscreen",
|
|
||||||
"fullstats",
|
|
||||||
"fuzzysort",
|
|
||||||
"gamemode",
|
|
||||||
"gamemodes",
|
|
||||||
"gameplay",
|
|
||||||
"glsl",
|
|
||||||
"GLTF",
|
|
||||||
"GSOR",
|
|
||||||
"gtag",
|
|
||||||
"haha",
|
|
||||||
"Herdbreaker",
|
|
||||||
"Hetz",
|
|
||||||
"highp",
|
|
||||||
"iife",
|
|
||||||
"imgur",
|
|
||||||
"immer",
|
|
||||||
"Inclusivity",
|
|
||||||
"JOINTINDEX",
|
|
||||||
"JOINTWEIGHT",
|
|
||||||
"kranvagn",
|
|
||||||
"krieg",
|
|
||||||
"Leaderboard",
|
|
||||||
"leaderboards",
|
|
||||||
"lerp",
|
|
||||||
"LINEARSIZE",
|
|
||||||
"linktarget",
|
|
||||||
"lmao",
|
|
||||||
"loadouts",
|
|
||||||
"loddist",
|
|
||||||
"lods",
|
|
||||||
"lossrate",
|
|
||||||
"Maddoxkkm",
|
|
||||||
"malum",
|
|
||||||
"mantlets",
|
|
||||||
"mediump",
|
|
||||||
"metallicness",
|
|
||||||
"metalness",
|
|
||||||
"minitelrose",
|
|
||||||
"Minotauro",
|
|
||||||
"MIPMAPCOUNT",
|
|
||||||
"mišek",
|
|
||||||
"mmnow",
|
|
||||||
"modeltransform",
|
|
||||||
"MURICA",
|
|
||||||
"nanostores",
|
|
||||||
"NEGATIVEX",
|
|
||||||
"NEGATIVEY",
|
|
||||||
"NEGATIVEZ",
|
|
||||||
"networkidle",
|
|
||||||
"NITROPAY",
|
|
||||||
"nivo",
|
|
||||||
"nmatname",
|
|
||||||
"noout",
|
|
||||||
"normalmap",
|
|
||||||
"oneof",
|
|
||||||
"oopsies",
|
|
||||||
"Oopsy",
|
|
||||||
"opentest",
|
|
||||||
"OPTML",
|
|
||||||
"otemp",
|
|
||||||
"outdir",
|
|
||||||
"outfile",
|
|
||||||
"ownedtanks",
|
|
||||||
"padder",
|
|
||||||
"partytown",
|
|
||||||
"passability",
|
|
||||||
"patchnotes",
|
|
||||||
"PIXELFORMAT",
|
|
||||||
"playerachievements",
|
|
||||||
"playerinfo",
|
|
||||||
"playform",
|
|
||||||
"pngjs",
|
|
||||||
"POSITIVEX",
|
|
||||||
"POSITIVEY",
|
|
||||||
"POSITIVEZ",
|
|
||||||
"precompute",
|
|
||||||
"Promisable",
|
|
||||||
"proto",
|
|
||||||
"protobuf",
|
|
||||||
"protoc",
|
|
||||||
"protos",
|
|
||||||
"proxyclient",
|
|
||||||
"prunestrings",
|
|
||||||
"Pyogenics",
|
|
||||||
"ratingleaderboard",
|
|
||||||
"raycaster",
|
|
||||||
"Redirector",
|
|
||||||
"Relogin",
|
|
||||||
"researchable",
|
|
||||||
"Resvg",
|
|
||||||
"rizz",
|
|
||||||
"roboto",
|
|
||||||
"rtsc",
|
|
||||||
"RTSM",
|
|
||||||
"SCPG",
|
|
||||||
"scroller",
|
|
||||||
"searchclans",
|
|
||||||
"searchplayers",
|
|
||||||
"searchtanks",
|
|
||||||
"SHAREDEXP",
|
|
||||||
"SKLLD",
|
|
||||||
"sluggify",
|
|
||||||
"smoothstep",
|
|
||||||
"Smri",
|
|
||||||
"Specularity",
|
|
||||||
"SSAO",
|
|
||||||
"startcase",
|
|
||||||
"statkit",
|
|
||||||
"statsfull",
|
|
||||||
"steamapps",
|
|
||||||
"Stringifying",
|
|
||||||
"struct",
|
|
||||||
"structs",
|
|
||||||
"strvk",
|
|
||||||
"subnation",
|
|
||||||
"Synx",
|
|
||||||
"tankaverages",
|
|
||||||
"Tankerch",
|
|
||||||
"tankmen",
|
|
||||||
"tankopedia",
|
|
||||||
"tankopedias",
|
|
||||||
"tankstats",
|
|
||||||
"tauri",
|
|
||||||
"texconv",
|
|
||||||
"TEXCOORD",
|
|
||||||
"tresabhi",
|
|
||||||
"tungstentip",
|
|
||||||
"Turretless",
|
|
||||||
"TYPELESS",
|
|
||||||
"ubjson",
|
|
||||||
"Unicum",
|
|
||||||
"UNLOCALIZED",
|
|
||||||
"UNORM",
|
|
||||||
"unpickled",
|
|
||||||
"Unregistering",
|
|
||||||
"unrotate",
|
|
||||||
"unwrapper",
|
|
||||||
"userns",
|
|
||||||
"vercel",
|
|
||||||
"vickers",
|
|
||||||
"vitepress",
|
|
||||||
"Vovko",
|
|
||||||
"wargaming",
|
|
||||||
"webp",
|
|
||||||
"wgpkg",
|
|
||||||
"whitespaces",
|
|
||||||
"WHSS",
|
|
||||||
"winrate",
|
|
||||||
"wireframe",
|
|
||||||
"Woah",
|
|
||||||
"WOTB",
|
|
||||||
"wotblitz",
|
|
||||||
"wotbreplay",
|
|
||||||
"WOTINSPECTOR",
|
|
||||||
"xffn",
|
|
||||||
"xkdkw",
|
|
||||||
"XMLDVPL",
|
|
||||||
"YAMLDVPL",
|
|
||||||
"yolo",
|
|
||||||
"youtuber",
|
|
||||||
"youtubers",
|
|
||||||
"zoomable"
|
|
||||||
],
|
|
||||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
|
||||||
"cSpell.enabledFileTypes": {
|
|
||||||
"proto": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,661 +0,0 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published
|
|
||||||
by the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
# BlitzKit License
|
||||||
|
|
||||||
|
Version 1.1, August 5th, 2025. Copyright (c) TrèsAbhi.
|
||||||
|
|
||||||
|
Permission is hereby granted to anyone to:
|
||||||
|
|
||||||
|
- Fork, clone, and download the contents of this repository.
|
||||||
|
- Modify the code locally in private.
|
||||||
|
- Use and run the code **only for personal, non-public testing, or educational purposes**.
|
||||||
|
|
||||||
|
The following restrictions apply:
|
||||||
|
|
||||||
|
- You may **not** deploy, host, or make this project or any derivative publicly accessible.
|
||||||
|
- You may **not** share screenshots, recordings, or any form of media from this project unless you intend to merge your changes back into BlitzKit.
|
||||||
|
- You may **not** use this project or its contents in any public or commercial product.
|
||||||
|
- You may **not** redistribute modified or unmodified versions of this project.
|
||||||
|
|
||||||
|
Contributions:
|
||||||
|
|
||||||
|
- You are encouraged to propose changes or improvements via pull requests to the original BlitzKit repository.
|
||||||
|
- Any such contributions will be considered under the same license terms unless explicitly stated otherwise.
|
||||||
|
|
||||||
|
Violations of this license may result in revocation of usage rights and takedown requests.
|
||||||
|
|
||||||
|
For questions or licensing inquiries, contact support@blitzkit.app.
|
||||||
|
|
||||||
|
## Notes on Existing Forks
|
||||||
|
|
||||||
|
All forks fall under these categories:
|
||||||
|
|
||||||
|
- If your fork was made from commit `8462901` (Apr 17, 2023) or between commits `2958124` (Jul 3, 2023) and `85e483e` (Jul 13, 2024), your fork falls under the **MIT license**.
|
||||||
|
- If your fork was made from commits between `5646093` (Jul 13, 2024) and `e3f131c` (Aug 5, 2025), your fork falls under the **AGPL-3.0 license**.
|
||||||
|
- If your fork was made between commit `f7c356d` (Apr 17, 2023) and `2958124` (Jul 3, 2023), your fork falls under **a default exclusive copyright**.
|
||||||
|
- If your fork was made from commits between `e3f131c` (Aug 5, 2025) and today, your fork falls under **this license**.
|
||||||
|
|
||||||
|
MIT and AGPL-3.0 licensed fork owners:
|
||||||
|
|
||||||
|
- You may continue to use your fork of BlitzKit under the corresponding license.
|
||||||
|
- You may upgrade your fork up to commit `5cab394` (Aug 4, 2025) and keep the AGPL-3.0 license.
|
||||||
|
- You may upgrade to commit `e3f131c` (Aug 5, 2025) or beyond but have to **switch to this license** where all rules apply.
|
||||||
|
- If you upgrade to commit `e3f131c` (Aug 5, 2025) or beyond, you must retract all public deployments of BlitzKit.
|
||||||
|
- Existing screenshots, recordings, or any form of media can remain.
|
||||||
|
|
||||||
|
Default exclusive copyright fork owners:
|
||||||
|
|
||||||
|
- You may continue to use their forks under the AGPL-3.0 license as no license was applied to BlitzKit at the time of forking.
|
||||||
|
|
||||||
|
BlitzKit licensed fork owners:
|
||||||
|
|
||||||
|
- You may continue to upgrade to the latest commits only under the conditions of this license.
|
||||||
@@ -1,75 +1,105 @@
|
|||||||
# BlitzKit
|
# BlitzKit
|
||||||
|
|
||||||
Your Blitz experience, elevated. https://blitzkit.app/.
|
Encyclopedia for World of Tanks Blitz.
|
||||||
|
|
||||||
## Developing: Prerequisites
|
## Development
|
||||||
|
|
||||||
There's a few things you'll need to get started. If this is your first time working with BlitzKit, it's completely safe to ignore all optional prerequisites below to get things running as quickly as possible.
|
Setting up a local developer environment for BlitzKit is more complex than most projects, but this section will guide you through all the steps. If you're ever lost or confused, feel free to ask for help in [the official Discord server](https://discord.gg/nDt7AjGJQH).
|
||||||
|
|
||||||
### Bun
|
### Prerequisites
|
||||||
|
|
||||||
[Bun](https://bun.sh/) is the package manager and runtime that BlitzKit uses.
|
Before you touch any code, you'll need the following.
|
||||||
|
|
||||||
Ideally, you should also uninstall Node.js if you have it installed to avoid any cases where Node.js is used to run code instead of Bun which happens in some cases. But, this is not required and is unlikely to cause issues.
|
#### Linux
|
||||||
|
|
||||||
### Protocol Buffer
|
Because Node API for .NET doesn't resolve runtime-specific object files for libraries, the entirety of the BlitzKit project is "vendor-locked" to a single OS. GitHub Actions, responsible for BlitzKit CD/CI works best with Ubuntu, thus we must also use a Linux OS.
|
||||||
|
|
||||||
BlitzKit uses [Protocol Buffer's protoc CLI](https://protobuf.dev/installation/) to generate efficiently packed data structures to serve data to clients in place of JSON.
|
#### Windows (Optional)
|
||||||
|
|
||||||
### World of Tanks Blitz
|
...
|
||||||
|
|
||||||
You will need a local installation of [World of Tanks Blitz](https://wotblitz.com/) for BlitzKit to build off.
|
#### Bun
|
||||||
|
|
||||||
### aria2 (Optional)
|
https://bun.com/
|
||||||
|
|
||||||
If you plan to use BlitzKit's client-management CLI for BlitzKit Previews, you will need to [get aria2](https://aria2.github.io/) to speed up your downloads.
|
BlitzKit is written mostly in TypeScript, with packages fetched from NPM, managed by Bun.
|
||||||
|
|
||||||
### libarchive (Optional)
|
#### .NET
|
||||||
|
|
||||||
If you plan to use BlitzKit's client-management CLI for BlitzKit OpenTests, you will need to [get libarchive](https://www.libarchive.org/) to keep your downloads completely in-memory.
|
https://dotnet.microsoft.com/download/dotnet/9.0/
|
||||||
|
|
||||||
### Linux (Optional)
|
You'll need the .NET 9.0 SDK to build and run the interface layer between BlitzKit and your local installation of World of Tanks Blitz.
|
||||||
|
|
||||||
All work on BlitzKit is done on Linux and macOS. It is theoretically possible to work on Windows; please feel free to try and share your discoveries with us!
|
#### Protocol Buffers
|
||||||
|
|
||||||
## Developing: Setting Up
|
https://protobuf.dev/installation/
|
||||||
|
|
||||||
Start by cloning the repository and changing directories.
|
Both BlitzKit and World of Tanks Blitz encode their APIs with Protocol Buffers.
|
||||||
|
|
||||||
|
#### World of Tanks Blitz
|
||||||
|
|
||||||
|
https://store.steampowered.com/app/444200/
|
||||||
|
|
||||||
|
You'll need an up-to-date installation of World of Tanks Blitz on your computer. You may use the same installation that you play, even on a Windows partition if you dual boot.
|
||||||
|
|
||||||
|
#### UE4SS
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
#### protodump
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
#### FModel (Optional)
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
### Set Up
|
||||||
|
|
||||||
|
Now we can start installing and initiating the code of BlitzKit.
|
||||||
|
|
||||||
|
#### Cloning
|
||||||
|
|
||||||
|
BlitzKit is a massive monorepo with a lot of submodules. You'll likely not need all the branches and commit history. So, clone with depth 1.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/blitzkit/blitzkit.git
|
git clone --depth 1 https://github.com/blitzkit/blitzkit.git
|
||||||
cd blitzkit
|
cd blitzkit
|
||||||
|
git submodule update --init --recursive --depth 1
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
#### Proto Files
|
||||||
> There is a closed source submodule under `packages/closed` that you can safely ignore. This sole purpose of this submodule is to provide `dvp.ts`, a proprietary Wargaming game asset tree compression tool. You will not need this at any point.
|
|
||||||
|
|
||||||
Then, download the dependencies with Bun.
|
...
|
||||||
|
|
||||||
```bash
|
#### Mappings
|
||||||
bun install
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, compile the proto files into TypeScript.
|
...
|
||||||
|
|
||||||
```bash
|
#### Environment Variables
|
||||||
build build-protos
|
|
||||||
```
|
|
||||||
|
|
||||||
## Developing: Environment
|
...
|
||||||
|
|
||||||
Go through the different packages in the `packages` directory and clone their respective `template.env`'s to `.env` files. Follow the instructions in the `.env` files to fill them out as much as you can.
|
#### The Big One
|
||||||
|
|
||||||
## Developing: Running
|
...
|
||||||
|
|
||||||
Launching the website is as easy as running the `dev` script.
|
### Modifying The Code
|
||||||
|
|
||||||
```bash
|
This is where you can start changing things and proposing them through pull requests.
|
||||||
bun dev
|
|
||||||
```
|
|
||||||
|
|
||||||
If you ever make a change to any proto file, make sure to rebuild them.
|
#### Server
|
||||||
|
|
||||||
```bash
|
...
|
||||||
build build-protos
|
|
||||||
```
|
#### Building
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
#### Branches & Pull Requests
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
#### Updating
|
||||||
|
|
||||||
|
...
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"folders": [
|
|
||||||
{
|
|
||||||
"path": ".",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "C:/Program Files/WindowsApps/7458BE2C.WorldofTanksBlitz_11.1.256.0_x64__x4tje2y229k00/Data",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"words": [
|
||||||
|
"gltf",
|
||||||
|
"amogos",
|
||||||
|
"Tankopedia",
|
||||||
|
"uasset",
|
||||||
|
"oodle",
|
||||||
|
"blitzkit",
|
||||||
|
"webp",
|
||||||
|
"hocs",
|
||||||
|
"cooldown",
|
||||||
|
"Lods",
|
||||||
|
"Skia",
|
||||||
|
"RMAO",
|
||||||
|
"Verts",
|
||||||
|
"drei",
|
||||||
|
"frameloop",
|
||||||
|
"pointermove",
|
||||||
|
"pointerup",
|
||||||
|
"pointerdown"
|
||||||
|
],
|
||||||
|
"userWords": [
|
||||||
|
"WOTB",
|
||||||
|
"USMAP",
|
||||||
|
"favicons"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -5,10 +5,10 @@ Thank you to [Mark Greene](https://github.com/Hitjack007) for your contributions
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Combined game mode passive and active abilities into a single dropdown
|
- Combined game mode passive and active abilities into a single dropdown
|
||||||
- Added tier filters to the Guess game [Mark Greene]
|
- [Mark Greene] Added tier filters to the Guess game
|
||||||
- Changing tiers will break your streak
|
- Changing tiers will break your streak
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
- module damage is now properly shown when sorting with it in the tank search [Mark Greene]
|
- [Mark Greene] module damage is now properly shown when sorting with it in the tank search
|
||||||
- Duplicate abilities in the tank filters are now removed
|
- Duplicate abilities in the tank filters are now removed
|
||||||
@@ -4,7 +4,7 @@ Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions
|
|||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
- The turret for Centurion I is no longer offset from the body [GonnaHetzMe]
|
- [GonnaHetzMe] The turret for Centurion I is no longer offset from the body
|
||||||
- Please allow up to 24 hours for the model to update
|
- Please allow up to 24 hours for the model to update
|
||||||
- Vertical Stabilizers now give the correct 12% buff instead of 15%
|
- Vertical Stabilizers now give the correct 12% buff instead of 15%
|
||||||
- Re-ordering tanks in Compare now works once again
|
- Re-ordering tanks in Compare now works once again
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ Thank you to [Mark Greene](https://github.com/Hitjack007) for your contributions
|
|||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
- The Tankopedia now smoothly resizes when enlarging on interaction
|
- The Tankopedia now smoothly resizes when enlarging on interaction
|
||||||
- Stock turrets now correctly mount the corresponding stock gun [Mark Greene]
|
- [Mark Greene] Stock turrets now correctly mount the corresponding stock gun
|
||||||
- The consumable and provision buttons in Compare are no longer tiny
|
- The consumable and provision buttons in Compare are no longer tiny
|
||||||
@@ -5,10 +5,10 @@ Thank you to [Mark Greene](https://github.com/Hitjack007) for your contributions
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Reworked tank search filters to be far more compact to make way for new filters
|
- Reworked tank search filters to be far more compact to make way for new filters
|
||||||
- Added the ability to filter tanks by consumables [Mark Greene]
|
- [Mark Greene] Added the ability to filter tanks by consumables
|
||||||
- Added the ability to filter tanks by provisions and game-mode abilities and powers
|
- Added the ability to filter tanks by provisions and game-mode abilities and powers
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
- Consumable and provision icons in Compare are now properly sized
|
- Consumable and provision icons in Compare are now properly sized
|
||||||
- Provisions now properly affect terrain resistances [Mark Greene]
|
- [Mark Greene] Provisions now properly affect terrain resistances
|
||||||
@@ -13,11 +13,11 @@ Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions
|
|||||||
|
|
||||||
## Technical Features
|
## Technical Features
|
||||||
|
|
||||||
- Enabling dev mode now displays the tank's non-numerical id [GonnaHetzMe]
|
- [GonnaHetzMe] Enabling dev mode now displays the tank's non-numerical id
|
||||||
- The dev id and the new dev name are now copyable on click [GonnaHetzMe]
|
- [GonnaHetzMe] The dev id and the new dev name are now copyable on click
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
- Tech trees that start at tiers higher than tier 1 like the Blitz Nation ones now properly render their trees in Tankopedia [GonnaHetzMe]
|
- [GonnaHetzMe] Tech trees that start at tiers higher than tier 1 like the Blitz Nation ones now properly render their trees in Tankopedia
|
||||||
- The tank pitch/yaw inputs in the Tank Sandbox now initialize with the correct values instead of 0 [GonnaHetzMe]
|
- [GonnaHetzMe] The tank pitch/yaw inputs in the Tank Sandbox now initialize with the correct values instead of 0
|
||||||
- Large Repair Kits once again use the correct modern icon [GonnaHetzMe]
|
- [GonnaHetzMe] Large Repair Kits once again use the correct modern icon
|
||||||
@@ -4,5 +4,5 @@ Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions
|
|||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
- Tank hit points in Equalizer mode is now accurate to the game [GonnaHetzMe]
|
- [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
|
- Armor highlighting now reflects the actual thicknesses of tanks in Equalizer mode
|
||||||
@@ -4,9 +4,9 @@ Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions
|
|||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
- Tungsten shells are now properly cropped [GonnaHetzMe]
|
- [GonnaHetzMe] Tungsten shells are now properly cropped
|
||||||
- Equalizer no longer gives insanely high penetration values
|
- 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
|
- The tank reveal animation no longer repeats when you scroll away and back to the tank sandbox
|
||||||
- The RHM. Pzw.'s turret no longer has the floating plate [GonnaHetzMe]
|
- [GonnaHetzMe] The RHM. Pzw.'s turret no longer has the floating plate
|
||||||
- Please give BlitzKit up to 1 hour to update the model
|
- Please give BlitzKit up to 1 hour to update the model
|
||||||
- Tanks with inclined turret rings like the Minotauro now display the correct pitch in the tank sandbox inputs [GonnaHetzMe]
|
- [GonnaHetzMe] Tanks with inclined turret rings like the Minotauro now display the correct pitch in the tank sandbox inputs
|
||||||
@@ -4,7 +4,7 @@ Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Added tooltips to the module selector in Tankopedia [GonnaHetzMe]
|
- [GonnaHetzMe] Added tooltips to the module selector in Tankopedia
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ Thank you to [GonnaHetzMe](https://github.com/karelpak1) for your contributions
|
|||||||
- Removed tank visual and collision model caching
|
- Removed tank visual and collision model caching
|
||||||
- Guesser once again breaks streaks if not all tiers are selected
|
- Guesser once again breaks streaks if not all tiers are selected
|
||||||
- BlitzKit now properly unloads tank models from memory when visually hidden in Guesser
|
- BlitzKit now properly unloads tank models from memory when visually hidden in Guesser
|
||||||
- Tanks with complex transparency like the Herdbreaker once again handle opacity correctly [GonnaHetzMe]
|
- [GonnaHetzMe] Tanks with complex transparency like the Herdbreaker once again handle opacity correctly
|
||||||
- Pieces of tank models that have transparency now handle culling properly (they're visible from both sides) [GonnaHetzMe]
|
- [GonnaHetzMe] Pieces of tank models that have transparency now handle culling properly (they're visible from both sides)
|
||||||
- Tanks with "cardboard" textures have been fixed, thanks to better PVR file parsing [GonnaHetzMe]
|
- [GonnaHetzMe] Tanks with "cardboard" textures have been fixed, thanks to better PVR file parsing
|
||||||
- Tank icons are now scaled correctly so small tanks are now properly zoomed out in contrast to bigger ones [GonnaHetzMe]
|
- [GonnaHetzMe] Tank icons are now scaled correctly so small tanks are now properly zoomed out in contrast to bigger ones
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
- 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 [Mark Greene]
|
|
||||||
- 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
|
|
||||||
- Safari no longer crashes when unloading textures for unloaded tanks [Mark Greene]
|
|
||||||
- The gun depression transition between two constraints (like often behind tanks) now uses a gentler zoned and can never be 0
|
|
||||||
- Armor plate names in Static Armor are now properly capitalized in English and translated to other languages [Mark Greene]
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
# 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
|
|
||||||
- Updated equipments to match the game again
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
# BlitzKit 1.31.0
|
|
||||||
|
|
||||||
This update massively upgrades BlitzKit's graphical fidelity (while making it faster) and updates the way BlitzKit deploys updates, speeding up future versions.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Improved the performance of the Tank Sandbox in Tankopedia
|
|
||||||
- Reduced the number of lights by 25%
|
|
||||||
- Reduced the resolution of shadows by 50%
|
|
||||||
- Improved the graphical fidelity of tanks in the Tankopedia
|
|
||||||
- Added soft contact shadows below tanks
|
|
||||||
- Added sky and ground reflected lighting to the top and bottom of tanks
|
|
||||||
- Removed the fog that used to darken tanks when zoomed far away
|
|
||||||
- Made BlitzKitLand™ fade out circularly to hide the sharp edges
|
|
||||||
- Pointed the lights 1.5m above the ground
|
|
||||||
- This genuinely makes BlitzKit almost photo-realistic in my opinion
|
|
||||||
- Non-PBR tanks are now lit up brighter to accommodate for their dark textures
|
|
||||||
|
|
||||||
## Fixes
|
|
||||||
|
|
||||||
- Fixed a bug where the ambient occlusion map (a measure of how dark a part of a tank gets due to low light bounces) was applied to the color of the tank directly, making many tanks appear dark even in direct light
|
|
||||||
- Tanks with chinese characters now generate urls through transliteration
|
|
||||||
|
|
||||||
## Known Issues
|
|
||||||
|
|
||||||
- The flags found behind the selected tank in the tech tree section of the Tankopedia is offset incorrectly
|
|
||||||
|
|
||||||
## Technical Features
|
|
||||||
|
|
||||||
- BlitzKit can now calculate and store performance statistics and account details for up 10,000,000,000 players
|
|
||||||
- This will help make the BlitzKit Performance tool more accurate, and play well with an upcoming, unannounced major feature
|
|
||||||
|
|
||||||
## Technical Changes
|
|
||||||
|
|
||||||
- The `production` branch now deploys updates to `blitzkit.app` instead of the `main` branch
|
|
||||||
- `robots.txt` now disables indexing of BlitzKit variants based on the environment
|
|
||||||
- The website is now compiled in "chunks" of which the `api` chunk now takes on the task of mangling what was previously stored in `assets3`
|
|
||||||
- `assets3` will be removed in `1.31.1`, please migrate to the new `api` if you use any BlitzKit assets
|
|
||||||
- Removed the `bot` and `app` packages
|
|
||||||
- Removed Prisma
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# BlitzKit 1.31.1
|
|
||||||
|
|
||||||
This update adds capabilities to release BlitzKit OpenTest and Preview.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# BlitzKit 1.31.2
|
|
||||||
|
|
||||||
This update fixes an issue that occurred with Wargaming chose to declare the class of a tank in the game code with a tag that isn't the first in the list.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# BlitzKit 1.31.3
|
|
||||||
|
|
||||||
This update updates BlitzKit to work with the game's new ID system for game modes.
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
# BlitzKit 1.32.0
|
|
||||||
|
|
||||||
Thank you to [Mark Greene](https://github.com/Hitjack007) for your contributions this update.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
### Tankopedia & Armor
|
|
||||||
|
|
||||||
- Added a spall liner button to the Tankopedia beside the other equipment [Mark Greene]
|
|
||||||
- Listed track repair times in the Tankopedia [Mark Greene]
|
|
||||||
- The penetration chance is now displayed when penetration testing armor [Mark Greene]
|
|
||||||
- Added a new setting to disable automatically loading tanks in Tankopedia [Mark Greene]
|
|
||||||
|
|
||||||
### Tank Performance & Mechanics
|
|
||||||
|
|
||||||
- Added Peekaboo DPM [Mark Greene]
|
|
||||||
- Your Peekaboo DPM is lower than your normal DPM if your reload is faster than 10s as you'll have to wait for the remaining 10s for you to get unspotted before you can poke and shoot
|
|
||||||
|
|
||||||
### Tank Filters
|
|
||||||
|
|
||||||
- The test and owned tank filters are now more intuitive as clicking on them now turns the clicked option on instead of off [Mark Greene]
|
|
||||||
|
|
||||||
### Game Compatibility
|
|
||||||
|
|
||||||
- Added compatibility for tier XI tanks [Mark Greene]
|
|
||||||
|
|
||||||
## Fixes
|
|
||||||
|
|
||||||
### Tankopedia & Armor
|
|
||||||
|
|
||||||
- The armor no longer disappears when you turn on Dynamic Armor System [Mark Greene]
|
|
||||||
- Camouflage values in Tankopedia are now more descriptive when shooting [Mark Greene]
|
|
||||||
- The penetration chance is now displayed when penetration testing armor [Mark Greene]
|
|
||||||
- Listed track repair times in the Tankopedia [Mark Greene]
|
|
||||||
- Added a spall liner button to the Tankopedia beside the other equipment [Mark Greene]
|
|
||||||
- The flags in the Tankopedia tech tree are no longer offset to the top left [Mark Greene]
|
|
||||||
- The loading bar below the name of the tanks in Tankopedia is now sufficiently spaced below [Mark Greene]
|
|
||||||
- Removed the vertical sliver of pixels found to the right of the Equalizer toggle in Tankopedia
|
|
||||||
|
|
||||||
### Tank Search & Filters
|
|
||||||
|
|
||||||
- The search bar no longer redirects to a seemingly random tank when clicking enter when searching [Mark Greene]
|
|
||||||
- Tank search now properly handles the full names of tanks like the Super Pershing [Mark Greene]
|
|
||||||
- The tank search now remains consistent in order even when an added filter does not add/remove tanks from the list [Mark Greene]
|
|
||||||
- The test and owned tank filters are now more intuitive as clicking on them now turns the clicked option on instead of off [Mark Greene]
|
|
||||||
|
|
||||||
### Visuals & UI
|
|
||||||
|
|
||||||
- Removed the Beta badge from the Equalizer button [Mark Greene]
|
|
||||||
- Updated the background image for the Equalizer button to the actual banner of the new game mode
|
|
||||||
- The contact shadows on the ground no longer grow & darken when switching between tabs [Mark Greene]
|
|
||||||
- Additionally, the contact shadows stays visible at low angles [Mark Greene]
|
|
||||||
- The "Help Translate BlitzKit" text on the home page is now properly centered vertically
|
|
||||||
- The footer now says "Branch" instead of "CDN" [Mark Greene]
|
|
||||||
- The game version in the footer now displays a shorthand version instead of the entire version number [Mark Greene]
|
|
||||||
- The reload visualizer now displays just 1 decimal place [Mark Greene]
|
|
||||||
- Plot controls for the Static armor tab no longer pokes in from the right on non-Static armor tabs in some languages [Mark Greene]
|
|
||||||
- Mixer's controllers now scale better on smaller screens [Mark Greene]
|
|
||||||
- The list of available tanks in the Playlist is no longer excessively wide [Mark Greene]
|
|
||||||
|
|
||||||
### Tank Mechanics & Models
|
|
||||||
|
|
||||||
- The gun depression visualizer now properly handles the inherent tilt of tanks like the Minotauro [Mark Greene]
|
|
||||||
- When moving the tracks of tanks, the textures no longer move at different rates [Mark Greene]
|
|
||||||
|
|
||||||
### Localization
|
|
||||||
|
|
||||||
- Users with a preference on a language are once again redirected to the correct localized pages [Mark Greene]
|
|
||||||
|
|
||||||
### Session & Game Compatibility
|
|
||||||
|
|
||||||
- BlitzKit Session now properly handles tanks removed from the game [Mark Greene]
|
|
||||||
|
|
||||||
## Technical Fixes
|
|
||||||
|
|
||||||
- BlitzKit now handles the new ID system for game-modes in WoTB
|
|
||||||
- The directory which preview versions of the game are downloaded to are now created properly
|
|
||||||
- This was the last bug standing in the way of BlitzKit Previews
|
|
||||||
- Welcome back, BlitzKit Previews!
|
|
||||||
- Removed some dead code from the BlitzKit model mangler
|
|
||||||
- The player discovery loop now persists for longer than 1 iteration [Mark Greene]
|
|
||||||
- Bun is now forced to run scripts with the `--bun` flag
|
|
||||||
|
|
||||||
## Technical Features
|
|
||||||
|
|
||||||
- Added documentation to the README on setting up and developing BlitzKit locally
|
|
||||||
- Added bug report and feature request forms to GitHub
|
|
||||||
- Switched to the GNU AGPLv3 license
|
|
||||||
|
|
||||||
## Technical Fixes
|
|
||||||
|
|
||||||
- BlitzKit now handles the new ID system for game-modes in WoTB
|
|
||||||
- The directory which preview versions of the game are downloaded to are now created properly
|
|
||||||
- This was the last bug standing in the way of BlitzKit Previews
|
|
||||||
- Welcome back, BlitzKit Previews!
|
|
||||||
- Removed some dead code from the BlitzKit model mangler
|
|
||||||
- The player discovery loop now persists for longer than 1 iteration [Mark Greene]
|
|
||||||
- Bun is now forced to run scripts with the `--bun` flag
|
|
||||||
@@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
🎉 Services for everything and anything World of Tanks Blitz
|
🎉 Services for everything and anything World of Tanks Blitz
|
||||||
|
|
||||||
|
## Bot
|
||||||
|
|
||||||
|
BlitzKit is available as a Discord bot and can be [installed very easily](/guide/invite).
|
||||||
|
|
||||||
|
- Track statistics
|
||||||
|
- Find inactive players in a clan
|
||||||
|
- Lookup owned tanks
|
||||||
|
- Create embeds for streams
|
||||||
|
- Track a player/tanks statistical evolution
|
||||||
|
- ...and a variety of other similar things
|
||||||
|
|
||||||
## Website
|
## Website
|
||||||
|
|
||||||
Provides a bunch of very helpful tools; https://blitzkit.app/
|
Provides a bunch of very helpful tools; https://blitzkit.app/
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Inviting the Bot
|
||||||
|
|
||||||
|
Go to [application directory for BlitzKit](https://discord.com/application-directory/1097673957865443370) and click "Add to Server." Voila! You're ready to go.
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# Timezones
|
||||||
|
|
||||||
|
What is considered a "day's worth of games" is determined by the reset time. The reset time is generally at midnight everyday after which newer games are counted towards the next day. Reset times vary from region to region:
|
||||||
|
|
||||||
|
- North America: `UTC-5:00` (Central North American Time midnight)
|
||||||
|
- Europe: `UTC+1:00` (Central European Time midnight)
|
||||||
|
- Asia: `UTC+7:00` (Central Asia Standard Time midnight)
|
||||||
|
|
||||||
|
**Reset times are different from Blitz Stars** (Blitz Stars resets at 5:00 am locally relative to the user opening their website). Inconsistencies with Blitz Stars only occur with sleep-deprived players and players who play in the wrong region.
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Blitzkit Rating Leaderboard
|
||||||
|
|
||||||
|
A straightforward way of storing the entire World of Tanks Blitz rating leaderboard to disk.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
primary BlitzkitRatingLeaderboard {
|
||||||
|
utf8"BKRL" magic;
|
||||||
|
Header header;
|
||||||
|
primary Body<header> body;
|
||||||
|
}
|
||||||
|
|
||||||
|
Header {
|
||||||
|
uint16 version; // always 1
|
||||||
|
Format format;
|
||||||
|
uint32 count;
|
||||||
|
}
|
||||||
|
|
||||||
|
Format enum<uint8> {
|
||||||
|
Base,
|
||||||
|
Superset1,
|
||||||
|
}
|
||||||
|
|
||||||
|
Body<Header header> match<header.format> {
|
||||||
|
Base {
|
||||||
|
primary {
|
||||||
|
uint32 id;
|
||||||
|
uint16 score;
|
||||||
|
}[header.count] entries;
|
||||||
|
};
|
||||||
|
|
||||||
|
Superset1 {
|
||||||
|
primary {
|
||||||
|
uint32 id;
|
||||||
|
uint16 score;
|
||||||
|
|
||||||
|
uint32 battles;
|
||||||
|
uint32 wins;
|
||||||
|
uint32 survived;
|
||||||
|
|
||||||
|
uint32 damage;
|
||||||
|
uint32 kills;
|
||||||
|
}[header.count] entries;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Discovered Ids
|
||||||
|
|
||||||
|
```c
|
||||||
|
primary DiscoveredIds {
|
||||||
|
utf8"DIDS" magic;
|
||||||
|
Header header;
|
||||||
|
primary Body body;
|
||||||
|
}
|
||||||
|
|
||||||
|
Header {
|
||||||
|
uint16 version; // always 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Body {
|
||||||
|
uint32 count;
|
||||||
|
uint32[count] ids;
|
||||||
|
}
|
||||||
|
```
|
||||||
+170
-1
@@ -1,3 +1,172 @@
|
|||||||
# KitScore
|
# KitScore
|
||||||
|
|
||||||
Remind me to write out the linearized model!
|
## Memo
|
||||||
|
|
||||||
|
KitScore is a performance metric that makes sense. This metric can be applied to any game, virtual or real. Specific pieces of information relating directly to World of Tanks Blitz will be provided within parentheses and with a "WoTB:" prefix.
|
||||||
|
|
||||||
|
## Consumption of Observations
|
||||||
|
|
||||||
|
KitScore is driven solely by the behavior of other players and finding meaning of a new observation within a pool of condensed data based on previously observed data. Generally, we will be provided with a number of statistics (the $x_i$ of an observation) per player (WoTB: $x_\text{frags}$, $x_\text{xp}$, $x_\text{spots}$, etc.) including a target statistic (the $x_j$ of an observation) that all other statistics try to maximize (WoTB: "winrate" which we will defined later as $x_j$).
|
||||||
|
|
||||||
|
If the statistics are cumulative, they will have to be normalized (WoTB: statistics fetched from Wargaming are indeed cumulative even for a single player; $x_\text{frags}=\frac{\Sigma x_\text{frags}}{\Sigma x_\text{battles}}$, $x_\text{spots}=\frac{\Sigma x_\text{spots}}{\Sigma x_\text{battles}}$, $x_j=\frac{\Sigma x_\text{wins}}{\Sigma x_\text{battles}}$, etc.). Each player will have such average statistics, giving us many points of data to work with. If the statistics are not cumulative, then you will be dealing with multiple observations per player which will only help improve accuracy.
|
||||||
|
|
||||||
|
## It's Impossible to "Find What Makes the Metric Tick"
|
||||||
|
|
||||||
|
WN8, a widely adopted metric in the World of Tanks and World of Tanks Blitz communities is plagued with problems. One of them being that people often find and exploit "what makes the metric tick." In other words, people easily exploit the rudimentary nature of WN8 to score undeservedly high.
|
||||||
|
|
||||||
|
In WN8, the gains of some rewarding categories overshadow the losses of others though that may not necessarily be in the best interest in maximizing winrate. KitScore makes this nearly impossible as it punishes a player for scoring well solely high in a certain category. You will never exploit KitScore. Period.
|
||||||
|
|
||||||
|
## Generating Reasonable Values
|
||||||
|
|
||||||
|
TODO: there's like no runaway cases
|
||||||
|
|
||||||
|
## Symbol Interpretation
|
||||||
|
|
||||||
|
| Symbol | Interpretation |
|
||||||
|
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| $A_\text{human}$ | The human readable version of the raw score $A$. |
|
||||||
|
| $A$ | The raw KitScore. |
|
||||||
|
| $C$ | An arbitrary coefficient. |
|
||||||
|
| $I$ | The number of statistics including the target statistic. This means that there are $I-1$ entries for $x_i$ and $1$ entry for $y$ for each observation. |
|
||||||
|
| $i$ | The statistic index of where there are $I$ entries. |
|
||||||
|
| $j$ | A discriminator for the target statistic. There may never be more than $1$ entries for $j$. |
|
||||||
|
| $m$ | The degree of the polynomial regression. |
|
||||||
|
| $n$ | The number of observations. |
|
||||||
|
| $a$ | An "atomic" score which is a function of the $i$th statistic. |
|
||||||
|
| $w$ | The weight of the $i$th atomic statistic. |
|
||||||
|
|
||||||
|
## Computing the Score
|
||||||
|
|
||||||
|
The final metric $A_\text{human}$ is an arbitrarily scaled value of the raw score $A$ where $C$ is any coefficient of your liking. BlitzKit uses $C=10^3$.
|
||||||
|
|
||||||
|
$$
|
||||||
|
A_\text{human}=CA
|
||||||
|
$$
|
||||||
|
|
||||||
|
The final metric $A$ is the weighted average of individual scores $a$ which are functions of the $i$th statistic excluding the target statistic $j$ itself.
|
||||||
|
|
||||||
|
$$
|
||||||
|
A=\frac{\sum_{i \neq j} w_{i}a_{i}}{\sum_{i \neq j} w_{i}}
|
||||||
|
$$
|
||||||
|
|
||||||
|
The "atomic" score $a$ is the difference between the predicted target statistic $P_{i \leftrightarrow j}(x_i)$ acquired using a polynomial regression of degree $m$ and the actual newly observed $x_j$.
|
||||||
|
|
||||||
|
$$
|
||||||
|
a_i=x_j-P_{i \leftrightarrow j}(x_i)
|
||||||
|
$$
|
||||||
|
|
||||||
|
The polynomial regression of $m$th degree can be written as follows:
|
||||||
|
|
||||||
|
$$
|
||||||
|
P(x)=\beta_0x^0+\beta_1x^1+\beta_2x^2+\dots+\beta_mx^m
|
||||||
|
$$
|
||||||
|
|
||||||
|
Polynomial regression coefficients $\beta$ can be acquired through basic linear algebra where an $m \times m$ of constants is multiplied with $m \times 1$ of unknowns which equals another $m \times 1$ of constants.
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{bmatrix}
|
||||||
|
\sum_{k=1}^n x_i^0 & \sum_{k=1}^n x_i^1 & \sum_{k=1}^n x_i^2 & \dots & \sum_{k=1}^n x_i^m \\
|
||||||
|
\sum_{k=1}^n x_i^1 & \sum_{k=1}^n x_i^2 & \sum_{k=1}^n x_i^3 & \dots & \sum_{k=1}^n x_i^{m+1} \\
|
||||||
|
\sum_{k=1}^n x_i^2 & \sum_{k=1}^n x_i^3 & \sum_{k=1}^n x_i^4 & \dots & \sum_{k=1}^n x_i^{m+2} \\
|
||||||
|
\vdots & \vdots & \vdots & \ddots & \vdots \\
|
||||||
|
\sum_{k=1}^n x_i^m & \sum_{k=1}^n x_i^{m+1} & \sum_{k=1}^n x_i^{m+1} & \dots & \sum_{k=1}^n x_i^{2m} \\
|
||||||
|
\end{bmatrix}
|
||||||
|
|
||||||
|
\begin{bmatrix}
|
||||||
|
\beta_0 \\
|
||||||
|
\beta_1 \\
|
||||||
|
\beta_2 \\
|
||||||
|
\vdots \\
|
||||||
|
\beta_m
|
||||||
|
\end{bmatrix}
|
||||||
|
|
||||||
|
=
|
||||||
|
|
||||||
|
\begin{bmatrix}
|
||||||
|
\sum_{k=1}^n x_jx_i^0 \\
|
||||||
|
\sum_{k=1}^n x_jx_i^1 \\
|
||||||
|
\sum_{k=1}^n x_jx_i^2 \\
|
||||||
|
\vdots \\
|
||||||
|
\sum_{k=1}^n x_jx_i^m
|
||||||
|
\end{bmatrix}
|
||||||
|
```
|
||||||
|
|
||||||
|
The weight $w$ is a slice of the Pearson corelation matrix. The numerator is the corelation between the $i$th statistic and the target statistic $j$ while the denominator the sum of the corelations between the $i$th statistic and all statistics but the target statistic $j$.
|
||||||
|
|
||||||
|
$$
|
||||||
|
w_{i}=\frac{r_{i\leftrightarrow j}^2}{\sum_{i_{k}\neq j}r_{i\leftrightarrow i_{k}}^2}
|
||||||
|
$$
|
||||||
|
|
||||||
|
## Understanding the Corelation Matrix
|
||||||
|
|
||||||
|
Forming the corelation matrix will create an $I \times I$ matrix where. This matrix is best represented as a table. The example below illustrates a matrix/table for $I=4$ which includes $3$ entries for $i$ statistics and $1$ entry for the $j$ target statistic.
|
||||||
|
|
||||||
|
| | $x_1$ | $x_2$ | $x_3$ | $x_j$ |
|
||||||
|
| ----- | --------------------------- | --------------------------- | --------------------------- | --------------------------- |
|
||||||
|
| $x_1$ | $1$ | $r_{1 \leftrightarrow 2}^2$ | $r_{1 \leftrightarrow 3}^2$ | $r_{1 \leftrightarrow j}^2$ |
|
||||||
|
| $x_2$ | $r_{1 \leftrightarrow 2}^2$ | $1$ | $r_{2 \leftrightarrow 3}^2$ | $r_{2 \leftrightarrow j}^2$ |
|
||||||
|
| $x_3$ | $r_{1 \leftrightarrow 3}^2$ | $r_{2 \leftrightarrow 3}^2$ | $1$ | $r_{3 \leftrightarrow j}^2$ |
|
||||||
|
| $x_j$ | $r_{1 \leftrightarrow j}^2$ | $r_{2 \leftrightarrow j}^2$ | $r_{3 \leftrightarrow j}^2$ | $1$ |
|
||||||
|
|
||||||
|
It should not be a surprise to find $r_{i \leftrightarrow i}^2=1$ which forms a neat diagonal across the table. Note that there are many duplicates within the $I^2$ entries. The "bottom-right triangle" can be eliminated to remove redundancies leaving us with only $\frac{I(I+1)}{2}$ fields occupied.
|
||||||
|
|
||||||
|
| | $x_1$ | $x_2$ | $x_3$ | $x_j$ |
|
||||||
|
| ----- | ----- | --------------------------- | --------------------------- | --------------------------- |
|
||||||
|
| $x_1$ | $1$ | $r_{1 \leftrightarrow 2}^2$ | $r_{1 \leftrightarrow 3}^2$ | $r_{1 \leftrightarrow j}^2$ |
|
||||||
|
| $x_2$ | | $1$ | $r_{2 \leftrightarrow 3}^2$ | $r_{2 \leftrightarrow j}^2$ |
|
||||||
|
| $x_3$ | | | $1$ | $r_{3 \leftrightarrow j}^2$ |
|
||||||
|
| $x_j$ | | | | $1$ |
|
||||||
|
|
||||||
|
When programming this matrix into an array, $r_{i \leftrightarrow i}^2=1$ will be redundant. I recommend condensing the matrix into an array of size $\frac{I(I+1)}{2}+I=\frac{I(I-1)}{2}$ to avoid all redundant entries. For $I=4$, the array will look something like the one illustrated below (here, $j=4$).
|
||||||
|
|
||||||
|
$$
|
||||||
|
[r_{1 \leftrightarrow 2}^2, r_{1 \leftrightarrow 3}^2, r_{1 \leftrightarrow 4}^2, r_{2 \leftrightarrow 3}^2, r_{2 \leftrightarrow 4}^2, r_{3 \leftrightarrow 4}^2]
|
||||||
|
$$
|
||||||
|
|
||||||
|
## Understanding the Weights
|
||||||
|
|
||||||
|
Some may find the weight equation arbitrary; it evidently isn't. The goal of $w$ is to eliminate over-rewarding the same behavior represented in multiple statistics. It makes all atomic statistics concurrent by leveraging the Pearson corelation matrix.
|
||||||
|
|
||||||
|
A simplified example will clarify the idea. First, we compute a Pearson corelation matrix for $I=3$ statistics. We have $x_1$ and $x_2$, the statistics that are trying to maximize $x_j$. Reminder: a Pearson corelation matrix finds the $r$ value not only between $x_i$ and $x_j$ but also between all combinations of $x_i$ and themselves. Here, $r^2$ is calculated using polynomial regression corelation analysis to the $m$th degree.
|
||||||
|
|
||||||
|
| | $x_1$ | $x_2$ | $x_3$ | $x_j$ |
|
||||||
|
| ----- | ----- | ----------- | ----- | ----- |
|
||||||
|
| $x_1$ | $1$ | $\boxed{0}$ | $0$ | $1$ |
|
||||||
|
| $x_2$ | | $1$ | $0$ | $1$ |
|
||||||
|
| $x_3$ | | | $1$ | $1$ |
|
||||||
|
| $x_j$ | | | | $1$ |
|
||||||
|
|
||||||
|
In the case above, $r^2_{1 \leftrightarrow 2}=0$ meaning that both statistics have absolutely nothing to do with each other. Hence, the player will be awarded for optimizing both individually. And since $r^2_{1 \leftrightarrow j}=r^2_{2 \leftrightarrow j}$, they should both be rewarded equally; in other words, they should have equal weights.
|
||||||
|
|
||||||
|
$$
|
||||||
|
w_{1}=\frac{1}{1 + 0 + 0}=1
|
||||||
|
$$
|
||||||
|
|
||||||
|
$$
|
||||||
|
w_{2}=\frac{1}{0 + 1 + 0}=1
|
||||||
|
$$
|
||||||
|
|
||||||
|
$$
|
||||||
|
w_{3}=\frac{1}{0 + 0 + 1}=1
|
||||||
|
$$
|
||||||
|
|
||||||
|
Now consider a case where $x_1$ and $x_2$ are fully correlated. It would be a bad idea to reward them equally; hence, their weights suffer.
|
||||||
|
|
||||||
|
| | $x_1$ | $x_2$ | $x_3$ | $x_j$ |
|
||||||
|
| ----- | ----- | ----------- | ----- | ----- |
|
||||||
|
| $x_1$ | $1$ | $\boxed{1}$ | $0$ | $1$ |
|
||||||
|
| $x_2$ | | $1$ | $0$ | $1$ |
|
||||||
|
| $x_3$ | | | $1$ | $1$ |
|
||||||
|
| $x_j$ | | | | $1$ |
|
||||||
|
|
||||||
|
$$
|
||||||
|
w_{1}=\frac{1}{1 + 1 + 0}=0.5
|
||||||
|
$$
|
||||||
|
|
||||||
|
$$
|
||||||
|
w_{2}=\frac{1}{1 + 1 + 0}=0.5
|
||||||
|
$$
|
||||||
|
|
||||||
|
$$
|
||||||
|
w_{3}=\frac{1}{0 + 0 + 1}=1
|
||||||
|
$$
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
# BlitzKit Regular Tank Stats
|
||||||
|
|
||||||
|
A straightforward way of storing the entire World of Tanks Blitz tank statistics for players to disk.
|
||||||
|
|
||||||
|
## Manifest `manifest.rtsm`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
primary RegularTankStatisticsManifest {
|
||||||
|
utf8"RTSM" magic;
|
||||||
|
Header header;
|
||||||
|
primary Body body;
|
||||||
|
}
|
||||||
|
|
||||||
|
Header {
|
||||||
|
uint16 version; // always 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Body {
|
||||||
|
uint32 time;
|
||||||
|
uint8 base;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Chunk `*.rtsc`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
primary RegularTankStatisticsChunk {
|
||||||
|
utf8"RTSC" magic;
|
||||||
|
Header header;
|
||||||
|
primary Body body<header.playerCount>;
|
||||||
|
}
|
||||||
|
|
||||||
|
Header {
|
||||||
|
uint16 version; // always 1
|
||||||
|
uint32 playerCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
Body<uint32 playerCount> {
|
||||||
|
Player[playerCount] players;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player {
|
||||||
|
uint32 id;
|
||||||
|
uint16 tankCount;
|
||||||
|
Tank[tankCount] tanks;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tank {
|
||||||
|
uint32 id;
|
||||||
|
uint32 battleLifeTime;
|
||||||
|
uint32 lastBattleTime;
|
||||||
|
uint8 markOfMastery;
|
||||||
|
uint32 battles;
|
||||||
|
uint32 capturePoints;
|
||||||
|
uint32 damageDealt;
|
||||||
|
uint32 damageReceived;
|
||||||
|
uint32 droppedCapturePoints;
|
||||||
|
uint32 frags;
|
||||||
|
uint32 frags8p;
|
||||||
|
uint32 hits;
|
||||||
|
uint32 losses;
|
||||||
|
uint8 maxFrags;
|
||||||
|
uint16 maxXp;
|
||||||
|
uint32 shots;
|
||||||
|
uint32 spotted;
|
||||||
|
uint32 survivedBattles;
|
||||||
|
uint32 winAndSurvived;
|
||||||
|
uint32 wins;
|
||||||
|
uint32 xp;
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"csharpier": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"commands": [
|
||||||
|
"csharpier"
|
||||||
|
],
|
||||||
|
"rollForward": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"robots": false,
|
|
||||||
"canonical": "https://blitzkit.app",
|
|
||||||
|
|
||||||
"paths": {
|
|
||||||
"default": null,
|
|
||||||
"api": null
|
|
||||||
},
|
|
||||||
"nodes": {
|
|
||||||
"default": "blitzkit/deploy-node-beta.blitzkit.app",
|
|
||||||
"api": "blitzkit/deploy-node-api.beta.blitzkit.app"
|
|
||||||
},
|
|
||||||
"aliases": {
|
|
||||||
"api": "https://api.beta.blitzkit.app",
|
|
||||||
"static": "https://static.beta.blitzkit.app"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"robots": false,
|
|
||||||
"canonical": "https://blitzkit.app",
|
|
||||||
|
|
||||||
"paths": {
|
|
||||||
"default": null,
|
|
||||||
"api": "api"
|
|
||||||
},
|
|
||||||
"nodes": {},
|
|
||||||
"aliases": {
|
|
||||||
"api": "/api",
|
|
||||||
"static": "https://static.blitzkit.app"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"robots": false,
|
|
||||||
"canonical": "https://blitzkit.app",
|
|
||||||
|
|
||||||
"paths": {
|
|
||||||
"default": null,
|
|
||||||
"api": null
|
|
||||||
},
|
|
||||||
"nodes": {
|
|
||||||
"default": "blitzkit/deploy-node-opentest.blitzkit.app",
|
|
||||||
"api": "blitzkit/deploy-node-api.opentest.blitzkit.app"
|
|
||||||
},
|
|
||||||
"aliases": {
|
|
||||||
"api": "https://api.opentest.blitzkit.app",
|
|
||||||
"static": "https://static.opentest.blitzkit.app"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"robots": false,
|
|
||||||
"canonical": "https://blitzkit.app",
|
|
||||||
|
|
||||||
"paths": {
|
|
||||||
"default": null,
|
|
||||||
"api": null
|
|
||||||
},
|
|
||||||
"nodes": {
|
|
||||||
"default": "blitzkit/deploy-node-preview.blitzkit.app",
|
|
||||||
"api": "blitzkit/deploy-node-api.preview.blitzkit.app"
|
|
||||||
},
|
|
||||||
"aliases": {
|
|
||||||
"api": "https://api.preview.blitzkit.app",
|
|
||||||
"static": "https://static.preview.blitzkit.app"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"robots": true,
|
|
||||||
"canonical": "https://blitzkit.app",
|
|
||||||
|
|
||||||
"paths": {
|
|
||||||
"default": null,
|
|
||||||
"api": null
|
|
||||||
},
|
|
||||||
"nodes": {
|
|
||||||
"default": "blitzkit/deploy-node-blitzkit.app",
|
|
||||||
"api": "blitzkit/deploy-node-api.blitzkit.app"
|
|
||||||
},
|
|
||||||
"aliases": {
|
|
||||||
"api": "https://api.blitzkit.app",
|
|
||||||
"static": "https://static.blitzkit.app"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+7
-11
@@ -1,25 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "blitzkit",
|
"name": "blitzkit",
|
||||||
"version": "1.32.0",
|
"version": "2.0.0-beta.3",
|
||||||
"license": "BlitzKit License",
|
"license": "BlitzKit License",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cd packages/website && bun --bun run dev",
|
"setup": "chmod a+x scripts/*.sh && ./scripts/setup.sh",
|
||||||
"build": "cd packages/website && bun run build",
|
"dev": "./scripts/dev.sh",
|
||||||
"discover-ids": "cd packages/scripts && bun run discover-ids",
|
"build-game": "./scripts/build_game.sh",
|
||||||
"build-protos": "cd packages/scripts && bun run build-protos",
|
"build-website": "./scripts/build_website.sh",
|
||||||
"record-performance": "cd packages/scripts && bun run record-performance",
|
"discover-servers": "./scripts/discover_servers.sh"
|
||||||
"download-client": "cd packages/scripts && bun run download-client",
|
|
||||||
"clean-astro": "rm -rf packages/website/.astro packages/website/node_modules/.astro packages/website/node_modules/.vite"
|
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gltf-transform/extensions": "^4.4.2",
|
"prettier": "^3.8.3",
|
||||||
"lz4js": "^0.2.0",
|
|
||||||
"sharp": "^0.34.5",
|
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^5.9.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
Submodule packages/closed updated: f89f0e0772...45c8f7115c.
@@ -5,15 +5,15 @@
|
|||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blitzkit/i18n": "workspace:*",
|
"@blitzkit/i18n": "workspace:*",
|
||||||
"@blitzkit/protos": "workspace:*",
|
|
||||||
"@bufbuild/protobuf": "^2.9.0",
|
"@bufbuild/protobuf": "^2.9.0",
|
||||||
"@octokit/plugin-throttling": "^11.0.1",
|
"@octokit/plugin-throttling": "^11.0.1",
|
||||||
"@octokit/rest": "^22.0.0",
|
"@octokit/rest": "^22.0.0",
|
||||||
|
"@prisma/client": "^6.16.2",
|
||||||
"@types/adm-zip": "^0.5.7",
|
"@types/adm-zip": "^0.5.7",
|
||||||
"@types/bun": "^1.3.14",
|
"@types/bun": "^1.3.1",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/lz4js": "^0.2.1",
|
"@types/lz4js": "^0.2.1",
|
||||||
"@types/three": "^0.180.0",
|
"@types/three": "^0.184.1",
|
||||||
"adm-zip": "^0.5.16",
|
"adm-zip": "^0.5.16",
|
||||||
"crc": "^4.3.2",
|
"crc": "^4.3.2",
|
||||||
"dotenv": "^17.2.2",
|
"dotenv": "^17.2.2",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"pickleparser": "^0.2.1",
|
"pickleparser": "^0.2.1",
|
||||||
"protobufjs": "^7.5.4",
|
"protobufjs": "^7.5.4",
|
||||||
"three": "^0.180.0",
|
"three": "^0.184.0",
|
||||||
"ts-proto": "^2.7.7",
|
"ts-proto": "^2.7.7",
|
||||||
"yaml": "^2.8.1"
|
"yaml": "^2.8.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
export async function fetchJSON<Type>(url: string) {
|
|
||||||
const response = await fetch(url);
|
|
||||||
const json = await response.json();
|
|
||||||
return json as Type;
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
export * from "./fetchJSON";
|
|
||||||
export * from "./fetchPB";
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { ShellType } from "@blitzkit/protos";
|
|
||||||
import { ShellKind } from "../types";
|
|
||||||
|
|
||||||
export const blitzShellKindToBlitzkit: Record<ShellKind, ShellType> = {
|
|
||||||
ARMOR_PIERCING: ShellType.SHELL_TYPE_AP,
|
|
||||||
ARMOR_PIERCING_CR: ShellType.SHELL_TYPE_APCR,
|
|
||||||
HIGH_EXPLOSIVE: ShellType.SHELL_TYPE_HE,
|
|
||||||
HOLLOW_CHARGE: ShellType.SHELL_TYPE_HEAT,
|
|
||||||
};
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
export const blitzkitToBlitzShellKind: Record<ShellType, ShellKind> = {};
|
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(blitzShellKindToBlitzkit)) {
|
|
||||||
blitzkitToBlitzShellKind[value] = key as ShellKind;
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { ShellDefinition, ShellType } from "../protos";
|
||||||
|
|
||||||
export function canSplash(
|
export function canSplash(
|
||||||
type: ShellDefinition["type"],
|
type: ShellDefinition["type"],
|
||||||
): type is ShellType.SHELL_TYPE_HE {
|
): type is ShellType.SHELL_TYPE_HE {
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { TankClass, TankType } from "../protos";
|
||||||
|
import type { BlitzStats } from "../statistics";
|
||||||
|
|
||||||
|
export const TANK_TYPES = [
|
||||||
|
TankType.TANK_TYPE_RESEARCHABLE,
|
||||||
|
TankType.TANK_TYPE_PREMIUM,
|
||||||
|
TankType.TANK_TYPE_COLLECTOR,
|
||||||
|
];
|
||||||
|
|
||||||
|
export const TANK_TYPE_COMMAND_NAMES = {
|
||||||
|
[TankType.TANK_TYPE_RESEARCHABLE]: "researchable",
|
||||||
|
[TankType.TANK_TYPE_PREMIUM]: "premium",
|
||||||
|
[TankType.TANK_TYPE_COLLECTOR]: "collector",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TANK_CLASSES = [
|
||||||
|
TankClass.TANK_CLASS_LIGHT,
|
||||||
|
TankClass.TANK_CLASS_MEDIUM,
|
||||||
|
TankClass.TANK_CLASS_HEAVY,
|
||||||
|
TankClass.TANK_CLASS_TANK_DESTROYER,
|
||||||
|
];
|
||||||
|
|
||||||
|
export const emptyAllStats: BlitzStats = {
|
||||||
|
battles: 0,
|
||||||
|
capture_points: 0,
|
||||||
|
damage_dealt: 0,
|
||||||
|
damage_received: 0,
|
||||||
|
dropped_capture_points: 0,
|
||||||
|
frags: 0,
|
||||||
|
frags8p: 0,
|
||||||
|
hits: 0,
|
||||||
|
losses: 0,
|
||||||
|
max_frags: 0,
|
||||||
|
max_xp: 0,
|
||||||
|
shots: 0,
|
||||||
|
spotted: 0,
|
||||||
|
survived_battles: 0,
|
||||||
|
xp: 0,
|
||||||
|
win_and_survived: 0,
|
||||||
|
wins: 0,
|
||||||
|
};
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
import { assertSecret, EventManager } from "../blitzkit";
|
|
||||||
import { patientFetch } from "../blitzkit/patientFetch";
|
|
||||||
import type { Region } from "./regions";
|
|
||||||
|
|
||||||
const RETRY_ERRORS = ["REQUEST_LIMIT_EXCEEDED", "SOURCE_NOT_AVAILABLE"];
|
|
||||||
|
|
||||||
export const retryAbleBlitzFetchEvent = new EventManager();
|
|
||||||
export const blitzFetchQueueAvailableEvent = new EventManager();
|
|
||||||
|
|
||||||
type BlitzResponse<Data extends object> =
|
|
||||||
| {
|
|
||||||
status: "error";
|
|
||||||
error: { field: string; message: string; code: 402; value: null };
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
status: "ok";
|
|
||||||
data: Data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const MAX_CALLS_PER_SECOND = 10;
|
|
||||||
|
|
||||||
const queue: { url: string; resolve: (data: object) => void }[] = [];
|
|
||||||
let inProgress = 0;
|
|
||||||
|
|
||||||
function decrement() {
|
|
||||||
inProgress--;
|
|
||||||
blitzFetchQueueAvailableEvent.emit(undefined);
|
|
||||||
manageQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function manageQueue() {
|
|
||||||
if (queue.length > 0 && inProgress < MAX_CALLS_PER_SECOND) {
|
|
||||||
inProgress++;
|
|
||||||
|
|
||||||
const timeout = setTimeout(decrement, 1000);
|
|
||||||
const request = queue.shift()!;
|
|
||||||
const data = (await patientFetch(request.url)
|
|
||||||
.then((response) => response.json())
|
|
||||||
.catch((error) => ({ status: "error", error }))) as BlitzResponse<
|
|
||||||
typeof request.resolve
|
|
||||||
>;
|
|
||||||
|
|
||||||
if (data.status === "ok") {
|
|
||||||
request.resolve(data.data);
|
|
||||||
} else {
|
|
||||||
if (RETRY_ERRORS.includes(data.error.message)) {
|
|
||||||
retryAbleBlitzFetchEvent.emit(undefined);
|
|
||||||
clearTimeout(timeout);
|
|
||||||
setTimeout(() => {
|
|
||||||
queue.push(request);
|
|
||||||
decrement();
|
|
||||||
}, 1000 / MAX_CALLS_PER_SECOND);
|
|
||||||
} else {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
decrement();
|
|
||||||
|
|
||||||
throw new Error(`Wargaming response error status: "${data.status}"`, {
|
|
||||||
cause: `Message: "${data.error.message}"\nURL: "${request.url}"`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type FetchBlitzParams = Record<string, string | number | undefined>;
|
|
||||||
|
|
||||||
export function fetchBlitz<Data extends object>(
|
|
||||||
region: Region,
|
|
||||||
path: string,
|
|
||||||
params: FetchBlitzParams = {}
|
|
||||||
) {
|
|
||||||
return new Promise<Data>((resolve) => {
|
|
||||||
queue.push({
|
|
||||||
url: `https://api.wotblitz.${region}/wotb/${path}/?${Object.entries({
|
|
||||||
application_id: assertSecret(
|
|
||||||
import.meta.env.PUBLIC_WARGAMING_APPLICATION_ID
|
|
||||||
),
|
|
||||||
...params,
|
|
||||||
})
|
|
||||||
.filter(([_, value]) => value !== undefined)
|
|
||||||
.map(([key, value]) => `${key}=${encodeURIComponent(value!)}`)
|
|
||||||
.join("&")}`,
|
|
||||||
resolve(data) {
|
|
||||||
resolve(data as Data);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
manageQueue();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { assertSecret } from "../blitzkit";
|
|
||||||
import type { BlitzGlossary } from "../types";
|
|
||||||
|
|
||||||
export async function fetchGlossary(locale: string) {
|
|
||||||
const response = await fetch(
|
|
||||||
`${assertSecret(
|
|
||||||
import.meta.env.WOTB_GLOSSARY_DOMAIN,
|
|
||||||
)}/${locale}${assertSecret(import.meta.env.WOTB_GLOSSARY_PATH)}`,
|
|
||||||
);
|
|
||||||
return (await response.json()) as BlitzGlossary;
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import { fetchBlitz } from "./fetchBlitz";
|
|
||||||
import { normalizeIds } from "./normalizeIds";
|
|
||||||
import type { Region } from "./regions";
|
|
||||||
|
|
||||||
interface IndividualAccountAchievements {
|
|
||||||
achievements: {
|
|
||||||
[achievement: string]: number;
|
|
||||||
};
|
|
||||||
max_series: {
|
|
||||||
[achievement: string]: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AccountAchievements {
|
|
||||||
[id: number]: IndividualAccountAchievements;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getAccountAchievements<
|
|
||||||
Ids extends number | number[],
|
|
||||||
ReturnType = Ids extends number
|
|
||||||
? IndividualAccountAchievements
|
|
||||||
: IndividualAccountAchievements[],
|
|
||||||
>(region: Region, ids: Ids) {
|
|
||||||
const object = await fetchBlitz<AccountAchievements>(
|
|
||||||
region,
|
|
||||||
"account/achievements",
|
|
||||||
{ account_id: normalizeIds(ids) }
|
|
||||||
);
|
|
||||||
|
|
||||||
if (typeof ids === "number") {
|
|
||||||
return object[ids as number] as ReturnType;
|
|
||||||
} else {
|
|
||||||
return ids.map((id) => object[id]) as ReturnType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
import { BlitzStats } from "../statistics";
|
|
||||||
import { FetchBlitzParams, fetchBlitz } from "./fetchBlitz";
|
|
||||||
import { normalizeIds } from "./normalizeIds";
|
|
||||||
import { Region } from "./regions";
|
|
||||||
|
|
||||||
export interface SupplementaryStats {
|
|
||||||
WN8?: number;
|
|
||||||
tier?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ClanStats {
|
|
||||||
spotted: number;
|
|
||||||
max_frags_tank_id: number;
|
|
||||||
hits: number;
|
|
||||||
frags: number;
|
|
||||||
max_xp: number;
|
|
||||||
max_xp_tank_id: number;
|
|
||||||
wins: number;
|
|
||||||
losses: number;
|
|
||||||
capture_points: number;
|
|
||||||
battles: number;
|
|
||||||
damage_dealt: number;
|
|
||||||
damage_received: number;
|
|
||||||
max_frags: number;
|
|
||||||
shots: number;
|
|
||||||
frags8p: number;
|
|
||||||
xp: number;
|
|
||||||
win_and_survived: number;
|
|
||||||
survived_battles: number;
|
|
||||||
dropped_capture_points: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RatingStats {
|
|
||||||
spotted: number;
|
|
||||||
calibration_battles_left: number;
|
|
||||||
hits: number;
|
|
||||||
frags: number;
|
|
||||||
recalibration_start_time: number;
|
|
||||||
mm_rating: number;
|
|
||||||
wins: number;
|
|
||||||
losses: number;
|
|
||||||
is_recalibration: boolean;
|
|
||||||
capture_points: number;
|
|
||||||
battles: number;
|
|
||||||
damage_dealt: number;
|
|
||||||
damage_received: number;
|
|
||||||
shots: number;
|
|
||||||
frags8p: number;
|
|
||||||
xp: number;
|
|
||||||
win_and_survived: number;
|
|
||||||
survived_battles: number;
|
|
||||||
dropped_capture_points: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IndividualAccountInfo {
|
|
||||||
account_id: number;
|
|
||||||
created_at: number;
|
|
||||||
updated_at: number;
|
|
||||||
private: null;
|
|
||||||
last_battle_time: number;
|
|
||||||
nickname: string;
|
|
||||||
statistics: {
|
|
||||||
all: BlitzStats;
|
|
||||||
clan: ClanStats;
|
|
||||||
rating?: RatingStats;
|
|
||||||
frags: null | number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AccountInfo {
|
|
||||||
[accountId: number]: IndividualAccountInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getAccountInfo<
|
|
||||||
Ids extends number | number[],
|
|
||||||
ReturnType = Ids extends number
|
|
||||||
? IndividualAccountInfo
|
|
||||||
: IndividualAccountInfo[],
|
|
||||||
>(
|
|
||||||
region: Region,
|
|
||||||
ids: Ids,
|
|
||||||
extra: string[] = [],
|
|
||||||
params: FetchBlitzParams = {}
|
|
||||||
) {
|
|
||||||
const object = await fetchBlitz<AccountInfo>(region, "account/info", {
|
|
||||||
account_id: normalizeIds(ids),
|
|
||||||
extra: extra.length === 0 ? undefined : extra.join(","),
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (typeof ids === "number") {
|
|
||||||
return object[ids as number] as ReturnType;
|
|
||||||
} else {
|
|
||||||
return ids.map((id) => object[id]) as ReturnType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import { fetchBlitz } from "./fetchBlitz";
|
|
||||||
import { normalizeIds } from "./normalizeIds";
|
|
||||||
import type { Region } from "./regions";
|
|
||||||
|
|
||||||
type IndividualClanAccountInfo = {
|
|
||||||
account_id: number;
|
|
||||||
joined_at: number;
|
|
||||||
clan_id: number;
|
|
||||||
role: string;
|
|
||||||
account_name: string;
|
|
||||||
|
|
||||||
clan?: {
|
|
||||||
members_count: number;
|
|
||||||
name: string;
|
|
||||||
created_at: number;
|
|
||||||
tag: string;
|
|
||||||
clan_id: number;
|
|
||||||
emblem_set_id: number;
|
|
||||||
};
|
|
||||||
} | null;
|
|
||||||
|
|
||||||
interface ClanAccountInfo {
|
|
||||||
[accountId: number]: IndividualClanAccountInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getClanAccountInfo<
|
|
||||||
Ids extends number | number[],
|
|
||||||
ReturnType = Ids extends number
|
|
||||||
? IndividualClanAccountInfo
|
|
||||||
: IndividualClanAccountInfo[],
|
|
||||||
>(region: Region, ids: Ids, extra: string[] = []) {
|
|
||||||
const object = await fetchBlitz<ClanAccountInfo>(
|
|
||||||
region,
|
|
||||||
"clans/accountinfo",
|
|
||||||
{
|
|
||||||
account_id: normalizeIds(ids),
|
|
||||||
extra: extra.length === 0 ? undefined : extra.join(","),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (typeof ids === "number") {
|
|
||||||
return object[ids as number] as ReturnType;
|
|
||||||
} else {
|
|
||||||
return ids.map((id) => object[id]) as ReturnType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
import { fetchBlitz } from "./fetchBlitz";
|
|
||||||
import { normalizeIds } from "./normalizeIds";
|
|
||||||
import type { Region } from "./regions";
|
|
||||||
|
|
||||||
interface IndividualClanInfo {
|
|
||||||
recruiting_options: {
|
|
||||||
vehicles_level: number;
|
|
||||||
wins_ratio: number;
|
|
||||||
average_battles_per_day: number;
|
|
||||||
battles: number;
|
|
||||||
average_damage: number;
|
|
||||||
};
|
|
||||||
members_count: number;
|
|
||||||
name: string;
|
|
||||||
creator_name: string;
|
|
||||||
clan_id: number;
|
|
||||||
created_at: number;
|
|
||||||
updated_at: number;
|
|
||||||
leader_name: string;
|
|
||||||
members_ids: number[];
|
|
||||||
recruiting_policy: string;
|
|
||||||
tag: string;
|
|
||||||
is_clan_disbanded: boolean;
|
|
||||||
old_name: string;
|
|
||||||
emblem_set_id: number;
|
|
||||||
creator_id: number;
|
|
||||||
motto: string;
|
|
||||||
renamed_at: number;
|
|
||||||
old_tag: null;
|
|
||||||
leader_id: number;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ClanInfo {
|
|
||||||
[clanId: number]: IndividualClanInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getClanInfo<
|
|
||||||
Ids extends number | number[],
|
|
||||||
ReturnType = Ids extends number ? IndividualClanInfo : IndividualClanInfo[],
|
|
||||||
>(region: Region, ids: Ids) {
|
|
||||||
const object = await fetchBlitz<ClanInfo>(region, "clans/info", {
|
|
||||||
clan_id: normalizeIds(ids),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (typeof ids === "number") {
|
|
||||||
return object[ids as number] as ReturnType;
|
|
||||||
} else {
|
|
||||||
return ids.map((id) => object[id]) as ReturnType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { LEAGUES } from "./rating";
|
||||||
|
|
||||||
|
export function getLeagueFromScore(score: number) {
|
||||||
|
return LEAGUES.find(({ minScore }) => score >= minScore)!;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import { context } from "../blitzkit/context";
|
||||||
|
import { patientFetch } from "../blitzkit/patientFetch";
|
||||||
|
import type { RatingLeague, RatingReward } from "./rating";
|
||||||
|
import type { Region } from "./regions";
|
||||||
|
import { regionToRegionSubdomain } from "./regionToRegionSubdomain";
|
||||||
|
|
||||||
|
export type RatingInfo =
|
||||||
|
| {
|
||||||
|
detail: undefined;
|
||||||
|
|
||||||
|
title: string;
|
||||||
|
icon: string | null;
|
||||||
|
start_at: string;
|
||||||
|
finish_at: string;
|
||||||
|
current_season: number;
|
||||||
|
updated_at: string;
|
||||||
|
count: number;
|
||||||
|
|
||||||
|
rewards: RatingReward[];
|
||||||
|
leagues: RatingLeague[];
|
||||||
|
}
|
||||||
|
| { detail: { error: string } };
|
||||||
|
|
||||||
|
const cache: Partial<Record<Region, RatingInfo>> = {};
|
||||||
|
|
||||||
|
export async function getRatingInfo(region: Region) {
|
||||||
|
if (cache[region]) return cache[region]!;
|
||||||
|
|
||||||
|
const response = await patientFetch(
|
||||||
|
context === "website"
|
||||||
|
? `/api/${region}/rating/current/info`
|
||||||
|
: `https://${regionToRegionSubdomain(
|
||||||
|
region
|
||||||
|
)}.wotblitz.com/en/api/rating-leaderboards/season/`,
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
const data = (await response.json()) as RatingInfo;
|
||||||
|
|
||||||
|
cache[region] = data;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { context } from "../blitzkit/context";
|
||||||
|
import { patientFetch } from "../blitzkit/patientFetch";
|
||||||
|
import type { RatingPlayer } from "../statistics";
|
||||||
|
import type { LeagueTop } from "./rating";
|
||||||
|
import type { Region } from "./regions";
|
||||||
|
import { regionToRegionSubdomain } from "./regionToRegionSubdomain";
|
||||||
|
|
||||||
|
export async function getRatingLeague(
|
||||||
|
region: Region,
|
||||||
|
league: number,
|
||||||
|
usePatientFetcher = false
|
||||||
|
) {
|
||||||
|
const fetcher = (url: string) =>
|
||||||
|
usePatientFetcher
|
||||||
|
? patientFetch(url, undefined, { cache: "no-store" })
|
||||||
|
: fetch(url, { cache: "no-store" });
|
||||||
|
const response = await fetcher(
|
||||||
|
context === "website"
|
||||||
|
? `/api/${region}/rating/current/league/${league}`
|
||||||
|
: `https://${regionToRegionSubdomain(
|
||||||
|
region
|
||||||
|
)}.wotblitz.com/en/api/rating-leaderboards/league/${league}/top/`
|
||||||
|
);
|
||||||
|
const json = await response.json();
|
||||||
|
|
||||||
|
return context === "website"
|
||||||
|
? (json as RatingPlayer[])
|
||||||
|
: (json as LeagueTop).result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { patientFetch } from "../blitzkit/patientFetch";
|
||||||
|
import { withCORSProxy } from "../blitzkit/withCORSProxy";
|
||||||
|
import type { RatingNeighbors } from "./rating";
|
||||||
|
import type { Region } from "./regions";
|
||||||
|
import { regionToRegionSubdomain } from "./regionToRegionSubdomain";
|
||||||
|
|
||||||
|
export async function getRatingNeighbors(
|
||||||
|
region: Region,
|
||||||
|
id: number,
|
||||||
|
count: number,
|
||||||
|
usePatientFetcher = false
|
||||||
|
) {
|
||||||
|
const fetcher = (url: string) =>
|
||||||
|
usePatientFetcher
|
||||||
|
? patientFetch(url, undefined, { cache: "no-store" })
|
||||||
|
: fetch(url, { cache: "no-store" });
|
||||||
|
const response = await fetcher(
|
||||||
|
withCORSProxy(
|
||||||
|
`https://${regionToRegionSubdomain(
|
||||||
|
region
|
||||||
|
)}.wotblitz.com/en/api/rating-leaderboards/user/${id}/?neighbors=${count}`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const json = (await response.json()) as RatingNeighbors;
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import type { TanksStats } from "../types";
|
|
||||||
import { type FetchBlitzParams, fetchBlitz } from "./fetchBlitz";
|
|
||||||
import type { Region } from "./regions";
|
|
||||||
|
|
||||||
export async function getTankStats(
|
|
||||||
region: Region,
|
|
||||||
id: number,
|
|
||||||
params?: FetchBlitzParams
|
|
||||||
) {
|
|
||||||
const tankStats = await fetchBlitz<TanksStats>(region, "tanks/stats", {
|
|
||||||
account_id: id,
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
|
|
||||||
return tankStats[id];
|
|
||||||
}
|
|
||||||
@@ -1,18 +1,15 @@
|
|||||||
export * from "./blitzShellKindToBlitzkit";
|
|
||||||
export * from "./canSplash";
|
export * from "./canSplash";
|
||||||
export * from "./clans";
|
export * from "./clans";
|
||||||
export * from "./classes";
|
export * from "./classes";
|
||||||
|
export * from "./constants";
|
||||||
export * from "./equipmentPrice";
|
export * from "./equipmentPrice";
|
||||||
export * from "./fetchBlitz";
|
|
||||||
export * from "./fetchGlossary";
|
|
||||||
export * from "./generateStats";
|
export * from "./generateStats";
|
||||||
export * from "./getAccountAchievements";
|
export * from "./getLeagueFromScore";
|
||||||
export * from "./getAccountInfo";
|
export * from "./getRatingInfo";
|
||||||
export * from "./getClanAccountInfo";
|
export * from "./getRatingLeague";
|
||||||
export * from "./getClanInfo";
|
export * from "./getRatingNeighbors";
|
||||||
export * from "./getTankStats";
|
|
||||||
export * from "./idToRegion";
|
export * from "./idToRegion";
|
||||||
export * from "./isValidBlitzId";
|
export * from "./isOnGoingRatingSeason";
|
||||||
export * from "./nations";
|
export * from "./nations";
|
||||||
export * from "./normalizeExtra";
|
export * from "./normalizeExtra";
|
||||||
export * from "./normalizeIds";
|
export * from "./normalizeIds";
|
||||||
@@ -22,6 +19,5 @@ export * from "./readDVPL";
|
|||||||
export * from "./regions";
|
export * from "./regions";
|
||||||
export * from "./regionSubdomainToRegion";
|
export * from "./regionSubdomainToRegion";
|
||||||
export * from "./regionToRegionSubdomain";
|
export * from "./regionToRegionSubdomain";
|
||||||
export * from "./searchClansAcrossRegions";
|
export * from "./searchCurrentRatingPlayers";
|
||||||
export * from "./searchPlayersAcrossRegions";
|
|
||||||
export * from "./toUniqueId";
|
export * from "./toUniqueId";
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { getRatingInfo } from "./getRatingInfo";
|
||||||
|
|
||||||
|
export async function isOnGoingRatingSeason() {
|
||||||
|
const ratingInfo = await getRatingInfo("com");
|
||||||
|
return ratingInfo.detail === undefined;
|
||||||
|
}
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import { assertSecret } from "../blitzkit";
|
|
||||||
import { idToRegion } from "./idToRegion";
|
|
||||||
import { Region } from "./regions";
|
|
||||||
|
|
||||||
export async function isValidBlitzId(id: number, token?: string) {
|
|
||||||
let region: Region;
|
|
||||||
|
|
||||||
try {
|
|
||||||
region = idToRegion(id);
|
|
||||||
} catch (error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const json = await fetch(
|
|
||||||
`https://api.wotblitz.${region}/wotb/account/info/?account_id=${id}&application_id=${assertSecret(
|
|
||||||
import.meta.env.PUBLIC_WARGAMING_APPLICATION_ID
|
|
||||||
)}${
|
|
||||||
token === undefined ? "" : `&access_token=${token}`
|
|
||||||
}&fields=account_id%2C-account_id`
|
|
||||||
).then(
|
|
||||||
(response) =>
|
|
||||||
response.json() as Promise<
|
|
||||||
| {
|
|
||||||
status: "ok";
|
|
||||||
data: Record<number, {} | null>;
|
|
||||||
}
|
|
||||||
| { status: "error" }
|
|
||||||
>
|
|
||||||
);
|
|
||||||
|
|
||||||
return json.status === "ok" && json.data[id] !== null;
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
import type { ClanList } from "./clans";
|
|
||||||
import { fetchBlitz } from "./fetchBlitz";
|
|
||||||
import type { Region } from "./regions";
|
|
||||||
|
|
||||||
export async function searchClansAcrossRegions(search: string, limit = 25) {
|
|
||||||
const trimmed = search.trim();
|
|
||||||
if (trimmed.length < 3 && trimmed.length > 100) return [];
|
|
||||||
const normalizedLimit = Math.floor(limit / 3);
|
|
||||||
|
|
||||||
// TODO: remove splice once wargaming fixes the functionality of the limit felid
|
|
||||||
|
|
||||||
return (
|
|
||||||
await Promise.all([
|
|
||||||
fetchBlitz<ClanList>("com", "clans/list", {
|
|
||||||
search,
|
|
||||||
limit: normalizedLimit,
|
|
||||||
}).then((value) =>
|
|
||||||
value
|
|
||||||
.map((account) => ({
|
|
||||||
...account,
|
|
||||||
region: "com" as Region,
|
|
||||||
}))
|
|
||||||
.splice(0, normalizedLimit)
|
|
||||||
),
|
|
||||||
fetchBlitz<ClanList>("eu", "clans/list", {
|
|
||||||
search,
|
|
||||||
limit: normalizedLimit,
|
|
||||||
}).then((value) =>
|
|
||||||
value
|
|
||||||
.map((account) => ({
|
|
||||||
...account,
|
|
||||||
region: "eu" as Region,
|
|
||||||
}))
|
|
||||||
.splice(0, normalizedLimit)
|
|
||||||
),
|
|
||||||
fetchBlitz<ClanList>("asia", "clans/list", {
|
|
||||||
search,
|
|
||||||
limit: normalizedLimit,
|
|
||||||
}).then((value) =>
|
|
||||||
value
|
|
||||||
.map((account) => ({
|
|
||||||
...account,
|
|
||||||
region: "asia" as Region,
|
|
||||||
}))
|
|
||||||
.splice(0, normalizedLimit)
|
|
||||||
),
|
|
||||||
])
|
|
||||||
)
|
|
||||||
.filter(Boolean)
|
|
||||||
.flat();
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { context } from "../blitzkit/context";
|
||||||
|
import { type Region } from "./regions";
|
||||||
|
import { regionToRegionSubdomain } from "./regionToRegionSubdomain";
|
||||||
|
|
||||||
|
type CurrentRatingPlayerSearch = Record<
|
||||||
|
number,
|
||||||
|
{
|
||||||
|
spa_id: number;
|
||||||
|
nickname: string;
|
||||||
|
clan_tag: string;
|
||||||
|
} & (
|
||||||
|
| {
|
||||||
|
skip: true;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
skip: false;
|
||||||
|
mmr: number;
|
||||||
|
season_number: number;
|
||||||
|
calibrationBattlesLeft: number;
|
||||||
|
number: number;
|
||||||
|
updated_at: string;
|
||||||
|
neighbors: [];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
>;
|
||||||
|
|
||||||
|
export async function searchCurrentRatingPlayers(region: Region, name: string) {
|
||||||
|
const encodedSearch = encodeURIComponent(name);
|
||||||
|
const response = await fetch(
|
||||||
|
context === "website"
|
||||||
|
? `/api/${region}/rating/current/search/${encodedSearch}`
|
||||||
|
: `https://${regionToRegionSubdomain(
|
||||||
|
region
|
||||||
|
)}.wotblitz.com/en/api/rating-leaderboards/search/?prefix=${encodedSearch}`,
|
||||||
|
{ cache: "no-store" }
|
||||||
|
);
|
||||||
|
const accountList = (await response.json()) as CurrentRatingPlayerSearch;
|
||||||
|
|
||||||
|
return accountList;
|
||||||
|
}
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
export const usernamePattern = /^[a-zA-Z0-9_]{3,24}$/;
|
|
||||||
export const usernamePatternWithoutPosition = /[a-zA-Z0-9_]{3,24}/;
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
import { fetchBlitz } from "../fetchBlitz";
|
|
||||||
import type { Region } from "../regions";
|
|
||||||
import { usernamePattern } from "./constants";
|
|
||||||
|
|
||||||
export interface AccountListItem {
|
|
||||||
nickname: string;
|
|
||||||
account_id: number;
|
|
||||||
}
|
|
||||||
export type AccountList = AccountListItem[];
|
|
||||||
export type AccountListWithServer = (AccountListItem & {
|
|
||||||
region: Region;
|
|
||||||
})[];
|
|
||||||
|
|
||||||
export async function searchPlayersAcrossRegions(search: string, limit = 25) {
|
|
||||||
const trimmed = search.trim();
|
|
||||||
if (trimmed.length < 3 && trimmed.length > 100) return [];
|
|
||||||
const normalizedLimit = Math.floor(limit / 3);
|
|
||||||
|
|
||||||
if (usernamePattern.test(trimmed)) {
|
|
||||||
return (
|
|
||||||
await Promise.all([
|
|
||||||
fetchBlitz<AccountList>("com", "account/list", {
|
|
||||||
search,
|
|
||||||
limit: normalizedLimit,
|
|
||||||
}).then(
|
|
||||||
(value) =>
|
|
||||||
value &&
|
|
||||||
value.map((account) => ({
|
|
||||||
...account,
|
|
||||||
region: "com" as Region,
|
|
||||||
}))
|
|
||||||
),
|
|
||||||
fetchBlitz<AccountList>("eu", "account/list", {
|
|
||||||
search,
|
|
||||||
limit: normalizedLimit,
|
|
||||||
}).then(
|
|
||||||
(value) =>
|
|
||||||
value &&
|
|
||||||
value.map((account) => ({
|
|
||||||
...account,
|
|
||||||
region: "eu" as Region,
|
|
||||||
}))
|
|
||||||
),
|
|
||||||
fetchBlitz<AccountList>("asia", "account/list", {
|
|
||||||
search,
|
|
||||||
limit: normalizedLimit,
|
|
||||||
}).then(
|
|
||||||
(value) =>
|
|
||||||
value &&
|
|
||||||
value.map((account) => ({
|
|
||||||
...account,
|
|
||||||
region: "asia" as Region,
|
|
||||||
}))
|
|
||||||
),
|
|
||||||
])
|
|
||||||
)
|
|
||||||
.filter(Boolean)
|
|
||||||
.flat() as AccountListWithServer;
|
|
||||||
} else {
|
|
||||||
return [] as AccountListWithServer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export * from "./constants";
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { environmentConfig } from "@blitzkit/core";
|
|
||||||
|
|
||||||
export function alias(alias: string, path: string) {
|
|
||||||
const environment = environmentConfig();
|
|
||||||
|
|
||||||
if (!(alias in environment.aliases)) {
|
|
||||||
throw new Error(`Invalid alias "${alias}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const base = environment.aliases[alias];
|
|
||||||
|
|
||||||
return `${base}${path}`;
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
import { Strings } from "@blitzkit/i18n";
|
|
||||||
import {
|
|
||||||
CamouflageDefinitions,
|
|
||||||
ConsumableDefinitions,
|
|
||||||
EquipmentDefinitions,
|
|
||||||
Gallery,
|
|
||||||
GameDefinitions,
|
|
||||||
MapDefinitions,
|
|
||||||
ModelDefinitions,
|
|
||||||
ProvisionDefinitions,
|
|
||||||
SkillDefinitions,
|
|
||||||
TankDefinitions,
|
|
||||||
} from "@blitzkit/protos";
|
|
||||||
import { BlitzScripts } from "../../types/blitzScripts";
|
|
||||||
|
|
||||||
export abstract class AbstractBlitzKitAPI {
|
|
||||||
abstract skills(): Promise<SkillDefinitions>;
|
|
||||||
abstract provisions(): Promise<ProvisionDefinitions>;
|
|
||||||
abstract consumables(): Promise<ConsumableDefinitions>;
|
|
||||||
abstract equipment(): Promise<EquipmentDefinitions>;
|
|
||||||
abstract maps(): Promise<MapDefinitions>;
|
|
||||||
abstract models(): Promise<ModelDefinitions>;
|
|
||||||
abstract camouflages(): Promise<CamouflageDefinitions>;
|
|
||||||
abstract tanks(): Promise<TankDefinitions>;
|
|
||||||
abstract game(): Promise<GameDefinitions>;
|
|
||||||
abstract gallery(): Promise<Gallery>;
|
|
||||||
abstract scripts(): Promise<BlitzScripts>;
|
|
||||||
|
|
||||||
abstract strings(locale: string): Promise<Strings>;
|
|
||||||
|
|
||||||
async tank(id: number) {
|
|
||||||
const tanks = await this.tanks();
|
|
||||||
return tanks.tanks[id];
|
|
||||||
}
|
|
||||||
|
|
||||||
async model(id: number) {
|
|
||||||
const models = await this.models();
|
|
||||||
return models.models[id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
import { alias } from "@blitzkit/core";
|
|
||||||
import { Strings } from "@blitzkit/i18n";
|
|
||||||
import {
|
|
||||||
CamouflageDefinitions,
|
|
||||||
ConsumableDefinitions,
|
|
||||||
EquipmentDefinitions,
|
|
||||||
Gallery,
|
|
||||||
GameDefinitions,
|
|
||||||
MapDefinitions,
|
|
||||||
ModelDefinitions,
|
|
||||||
ProvisionDefinitions,
|
|
||||||
SkillDefinitions,
|
|
||||||
TankDefinitions,
|
|
||||||
} from "@blitzkit/protos";
|
|
||||||
import { fetchPB } from "../../api";
|
|
||||||
import { fetchJSON } from "../../api/fetchJSON";
|
|
||||||
import { BlitzScripts } from "../../types/blitzScripts";
|
|
||||||
import { AbstractBlitzKitAPI } from "./abstract";
|
|
||||||
|
|
||||||
export class ClientBlitzKitAPI extends AbstractBlitzKitAPI {
|
|
||||||
game() {
|
|
||||||
return fetchPB(alias("api", "/definitions/game.pb"), GameDefinitions);
|
|
||||||
}
|
|
||||||
|
|
||||||
consumables() {
|
|
||||||
return fetchPB(
|
|
||||||
alias("api", "/definitions/consumables.pb"),
|
|
||||||
ConsumableDefinitions,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
tanks() {
|
|
||||||
return fetchPB(alias("api", "/definitions/tanks.pb"), TankDefinitions);
|
|
||||||
}
|
|
||||||
|
|
||||||
camouflages() {
|
|
||||||
return fetchPB(
|
|
||||||
alias("api", "/definitions/camouflage.pb"),
|
|
||||||
CamouflageDefinitions,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
provisions() {
|
|
||||||
return fetchPB(
|
|
||||||
alias("api", "/definitions/provisions.pb"),
|
|
||||||
ProvisionDefinitions,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
models() {
|
|
||||||
return fetchPB(alias("api", "/definitions/models.pb"), ModelDefinitions);
|
|
||||||
}
|
|
||||||
|
|
||||||
skills() {
|
|
||||||
return fetchPB(alias("api", "/definitions/skills.pb"), SkillDefinitions);
|
|
||||||
}
|
|
||||||
|
|
||||||
equipment() {
|
|
||||||
return fetchPB(
|
|
||||||
alias("api", "/definitions/equipment.pb"),
|
|
||||||
EquipmentDefinitions,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
gallery() {
|
|
||||||
return fetchPB(alias("api", "/definitions/gallery.pb"), Gallery);
|
|
||||||
}
|
|
||||||
|
|
||||||
maps() {
|
|
||||||
return fetchPB(alias("api", "/definitions/maps.pb"), MapDefinitions);
|
|
||||||
}
|
|
||||||
|
|
||||||
scripts() {
|
|
||||||
return fetchJSON<BlitzScripts>(alias("api", "/definitions/scripts.json"));
|
|
||||||
}
|
|
||||||
|
|
||||||
strings(locale: string) {
|
|
||||||
return fetchJSON<Strings>(alias("api", `/strings/${locale}.json`));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import { AbstractBlitzKitAPI, AbstractVFS } from "@blitzkit/core";
|
|
||||||
|
|
||||||
export async function createDynamicAPI(vfs: () => Promise<AbstractVFS>) {
|
|
||||||
let _api: AbstractBlitzKitAPI;
|
|
||||||
|
|
||||||
if (import.meta.env.SSR) {
|
|
||||||
const { ServerBlitzKitAPI } = await import(
|
|
||||||
"@blitzkit/core/src/blitzkit/api/server/index"
|
|
||||||
);
|
|
||||||
|
|
||||||
_api = await new ServerBlitzKitAPI(await vfs()).init();
|
|
||||||
} else {
|
|
||||||
const { ClientBlitzKitAPI } = await import(
|
|
||||||
"@blitzkit/core/src/blitzkit/api/client"
|
|
||||||
);
|
|
||||||
|
|
||||||
_api = new ClientBlitzKitAPI();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _api;
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
export * from "./abstract";
|
|
||||||
export * from "./client";
|
|
||||||
export * from "./dynamic";
|
|
||||||
export * from "./server";
|
|
||||||
@@ -1,320 +0,0 @@
|
|||||||
import {
|
|
||||||
BlitzCrewType,
|
|
||||||
BlitzModuleType,
|
|
||||||
BlitzStrings,
|
|
||||||
BlitzTankClass,
|
|
||||||
BlitzTankFilterDefinitionCategory,
|
|
||||||
CamouflagesXml,
|
|
||||||
CamouflagesYaml,
|
|
||||||
CombatRolesYaml,
|
|
||||||
ConsumablesCommon,
|
|
||||||
MapsYaml,
|
|
||||||
OptionalDevices,
|
|
||||||
OptionalDeviceSlots,
|
|
||||||
ProvisionsCommon,
|
|
||||||
SquadBattleTypeStylesYaml,
|
|
||||||
TankmenAvatar,
|
|
||||||
toUniqueId,
|
|
||||||
VehicleDefinitionList,
|
|
||||||
} from "@blitzkit/core";
|
|
||||||
import { AbstractVFS } from "@blitzkit/core/src/blitzkit/vfs/abstract";
|
|
||||||
import locales from "@blitzkit/i18n/locales.json";
|
|
||||||
import {
|
|
||||||
ConsumableTankCategoryFilterCategory,
|
|
||||||
CrewType,
|
|
||||||
I18nString,
|
|
||||||
ModuleType,
|
|
||||||
TankClass,
|
|
||||||
} from "@blitzkit/protos";
|
|
||||||
import type { extname, parse } from "node:path";
|
|
||||||
import { parse as parseYaml } from "yaml";
|
|
||||||
import { AbstractBlitzKitAPI } from "../abstract";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI0 extends AbstractBlitzKitAPI {
|
|
||||||
// TODO: move most of these to their respective constructors
|
|
||||||
|
|
||||||
protected vfs: AbstractVFS;
|
|
||||||
protected parsePath?: typeof parse;
|
|
||||||
protected extname?: typeof extname;
|
|
||||||
|
|
||||||
protected nationSlugDiscriminators = {
|
|
||||||
china: "cn",
|
|
||||||
european: "eu",
|
|
||||||
france: "fr",
|
|
||||||
germany: "de",
|
|
||||||
japan: "jp",
|
|
||||||
other: "ot",
|
|
||||||
uk: "gb",
|
|
||||||
usa: "us",
|
|
||||||
ussr: "ru",
|
|
||||||
};
|
|
||||||
protected blitzModuleTypeToBlitzkit: Record<
|
|
||||||
keyof BlitzModuleType,
|
|
||||||
ModuleType
|
|
||||||
> = {
|
|
||||||
chassis: ModuleType.MODULE_TYPE_TRACKS,
|
|
||||||
engine: ModuleType.MODULE_TYPE_ENGINE,
|
|
||||||
gun: ModuleType.MODULE_TYPE_GUN,
|
|
||||||
turret: ModuleType.MODULE_TYPE_TURRET,
|
|
||||||
vehicle: ModuleType.MODULE_TYPE_VEHICLE,
|
|
||||||
};
|
|
||||||
protected blitzkitCrewTypeToBlitz: Record<CrewType, BlitzCrewType> = {
|
|
||||||
[CrewType.CREW_TYPE_COMMANDER]: "commander",
|
|
||||||
[CrewType.CREW_TYPE_DRIVER]: "driver",
|
|
||||||
[CrewType.CREW_TYPE_GUNNER]: "gunner",
|
|
||||||
[CrewType.CREW_TYPE_LOADER]: "loader",
|
|
||||||
[CrewType.CREW_TYPE_RADIOMAN]: "radioman",
|
|
||||||
};
|
|
||||||
protected blitzCrewTypeToBlitzkit: Record<BlitzCrewType, CrewType> = {
|
|
||||||
commander: CrewType.CREW_TYPE_COMMANDER,
|
|
||||||
driver: CrewType.CREW_TYPE_DRIVER,
|
|
||||||
gunner: CrewType.CREW_TYPE_GUNNER,
|
|
||||||
loader: CrewType.CREW_TYPE_LOADER,
|
|
||||||
radioman: CrewType.CREW_TYPE_RADIOMAN,
|
|
||||||
};
|
|
||||||
protected blitzTankClassToBlitzkit: Record<BlitzTankClass, TankClass> = {
|
|
||||||
lightTank: TankClass.TANK_CLASS_LIGHT,
|
|
||||||
"AT-SPG": TankClass.TANK_CLASS_TANK_DESTROYER,
|
|
||||||
heavyTank: TankClass.TANK_CLASS_HEAVY,
|
|
||||||
mediumTank: TankClass.TANK_CLASS_MEDIUM,
|
|
||||||
};
|
|
||||||
protected blitzTankFilterDefinitionCategoryToBlitzkit: Record<
|
|
||||||
BlitzTankFilterDefinitionCategory,
|
|
||||||
ConsumableTankCategoryFilterCategory
|
|
||||||
> = {
|
|
||||||
clip: ConsumableTankCategoryFilterCategory.CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP,
|
|
||||||
};
|
|
||||||
|
|
||||||
protected botPattern = /^.+((tutorial_bot(\d+)?)|(TU))$/;
|
|
||||||
|
|
||||||
protected stringsI18n: Record<string, Record<string, string>> = {};
|
|
||||||
protected nationsDir?: string[];
|
|
||||||
protected tankStringIdMap: Record<string, number> = {};
|
|
||||||
protected consumablesCommon: ConsumablesCommon = {};
|
|
||||||
protected provisionsCommon: ProvisionsCommon = {};
|
|
||||||
|
|
||||||
// TODO: suffix with "yaml"s and "xml"s
|
|
||||||
protected optionalDevices?: { root: OptionalDevices };
|
|
||||||
protected optionalDeviceSlots?: { root: OptionalDeviceSlots };
|
|
||||||
protected tankmenAvatar?: { root: TankmenAvatar };
|
|
||||||
protected mapsYaml?: MapsYaml;
|
|
||||||
protected camouflagesXml?: { root: CamouflagesXml };
|
|
||||||
protected camouflagesYaml?: CamouflagesYaml;
|
|
||||||
protected squadBattleTypeStyles?: SquadBattleTypeStylesYaml;
|
|
||||||
protected gameTypeSelectorStyles?: SquadBattleTypeStylesYaml;
|
|
||||||
protected combatRoles?: CombatRolesYaml;
|
|
||||||
protected tierEqualizer?: string[][];
|
|
||||||
|
|
||||||
constructor(vfs: AbstractVFS) {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.vfs = vfs;
|
|
||||||
}
|
|
||||||
|
|
||||||
async init() {
|
|
||||||
const { existsSync } = await import("fs");
|
|
||||||
const { readFile, writeFile, mkdir } = await import("fs/promises");
|
|
||||||
|
|
||||||
console.log("Initializing virtual file system...");
|
|
||||||
|
|
||||||
const path = await import("node:path");
|
|
||||||
|
|
||||||
this.extname = path.extname;
|
|
||||||
this.parsePath = path.parse;
|
|
||||||
|
|
||||||
await this.vfs.init();
|
|
||||||
|
|
||||||
console.log("Fetching game data...");
|
|
||||||
this.nationsDir = await this.vfs
|
|
||||||
.dir("Data/XML/item_defs/vehicles")
|
|
||||||
.then((files) => files.filter((nation) => nation !== "common"));
|
|
||||||
|
|
||||||
this.optionalDevices = await this.vfs.xml<{ root: OptionalDevices }>(
|
|
||||||
"Data/XML/item_defs/vehicles/common/optional_devices.xml",
|
|
||||||
);
|
|
||||||
this.optionalDeviceSlots = await this.vfs.xml<{
|
|
||||||
root: OptionalDeviceSlots;
|
|
||||||
}>("Data/XML/item_defs/vehicles/common/optional_device_slots.xml");
|
|
||||||
this.tankmenAvatar = await this.vfs.xml<{ root: TankmenAvatar }>(
|
|
||||||
"Data/XML/item_defs/tankmen/avatar.xml",
|
|
||||||
);
|
|
||||||
this.mapsYaml = await this.vfs.yaml<MapsYaml>("Data/maps.yaml");
|
|
||||||
this.camouflagesXml = await this.vfs.xml<{ root: CamouflagesXml }>(
|
|
||||||
"Data/XML/item_defs/vehicles/common/camouflages.xml",
|
|
||||||
);
|
|
||||||
this.camouflagesYaml = await this.vfs.yaml<CamouflagesYaml>(
|
|
||||||
"Data/camouflages.yaml",
|
|
||||||
);
|
|
||||||
this.squadBattleTypeStyles = await this.vfs.yaml<SquadBattleTypeStylesYaml>(
|
|
||||||
`Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml`,
|
|
||||||
);
|
|
||||||
this.gameTypeSelectorStyles =
|
|
||||||
await this.vfs.yaml<SquadBattleTypeStylesYaml>(
|
|
||||||
`Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`,
|
|
||||||
);
|
|
||||||
this.combatRoles = await this.vfs.yaml<CombatRolesYaml>(
|
|
||||||
`Data/XML/item_defs/vehicles/common/combat_roles.yaml`,
|
|
||||||
);
|
|
||||||
this.tierEqualizer = await this.vfs.csv(
|
|
||||||
// spell:disable-next-line
|
|
||||||
`Data/XML/item_defs/vehicles/common/tier_equializer.csv`,
|
|
||||||
{ delimiter: ";" },
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log("Fetching game localizations...");
|
|
||||||
|
|
||||||
await Promise.all(
|
|
||||||
locales.supported.map(async ({ locale }) => {
|
|
||||||
const root = "../../temp/game-strings";
|
|
||||||
const cachePath = `${root}/${locale}.json`;
|
|
||||||
|
|
||||||
if (existsSync(cachePath)) {
|
|
||||||
console.log(` Cache hit for ${locale}`);
|
|
||||||
|
|
||||||
const content = await readFile(cachePath, "utf-8");
|
|
||||||
this.stringsI18n[locale] = JSON.parse(content) as BlitzStrings;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(` Cache miss for ${locale} (this will take a while...)`);
|
|
||||||
|
|
||||||
const blitzLocale = locales.supported.find(
|
|
||||||
(l) => l.locale === locale,
|
|
||||||
)!.variant_blitz_local;
|
|
||||||
const networkStrings = (await fetch(
|
|
||||||
`https://stufficons.wgcdn.co/localizations/${blitzLocale}.yaml`,
|
|
||||||
)
|
|
||||||
.then((response) => response.text())
|
|
||||||
.then(parseYaml)) as BlitzStrings;
|
|
||||||
const localStrings = await this.vfs.yaml<BlitzStrings>(
|
|
||||||
`Data/Strings/${blitzLocale}.yaml`,
|
|
||||||
);
|
|
||||||
const combined = { ...networkStrings, ...localStrings };
|
|
||||||
|
|
||||||
await mkdir(root, { recursive: true });
|
|
||||||
await writeFile(cachePath, JSON.stringify(combined));
|
|
||||||
|
|
||||||
this.stringsI18n[locale] = combined;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log("Fetching consumable and provision data...");
|
|
||||||
|
|
||||||
for (const match of (
|
|
||||||
await this.vfs.text(
|
|
||||||
`Data/XML/item_defs/vehicles/common/consumables/list.xml`,
|
|
||||||
)
|
|
||||||
).matchAll(/<items path="(.+)\.xml"\/>/g)) {
|
|
||||||
if (match[1] === "prototypes") continue;
|
|
||||||
|
|
||||||
Object.assign(
|
|
||||||
this.consumablesCommon,
|
|
||||||
(
|
|
||||||
await this.vfs.xml<{ root: ConsumablesCommon }>(
|
|
||||||
`Data/XML/item_defs/vehicles/common/consumables/${match[1]}.xml`,
|
|
||||||
)
|
|
||||||
).root,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const match of (
|
|
||||||
await this.vfs.text(
|
|
||||||
`Data/XML/item_defs/vehicles/common/provisions/list.xml`,
|
|
||||||
)
|
|
||||||
).matchAll(/<items path="(.+)\.xml"\/>/g)) {
|
|
||||||
if (match[1] === "prototypes") continue;
|
|
||||||
|
|
||||||
Object.assign(
|
|
||||||
this.provisionsCommon,
|
|
||||||
(
|
|
||||||
await this.vfs.xml<{ root: ConsumablesCommon }>(
|
|
||||||
`Data/XML/item_defs/vehicles/common/provisions/${match[1]}.xml`,
|
|
||||||
)
|
|
||||||
).root,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const nation of this.nationsDir!) {
|
|
||||||
const tankList = await this.vfs.xml<{ root: VehicleDefinitionList }>(
|
|
||||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const tankKey in tankList.root) {
|
|
||||||
if (this.botPattern.test(tankKey)) continue;
|
|
||||||
|
|
||||||
const tank = tankList.root[tankKey];
|
|
||||||
const tankId = toUniqueId(nation, tank.id);
|
|
||||||
|
|
||||||
this.tankStringIdMap[`${nation}:${tankKey}`] = tankId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected getString(name: string) {
|
|
||||||
const collection: Record<string, string> = {
|
|
||||||
[locales.default]: this.stringsI18n[locales.default][name],
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const { locale } of locales.supported) {
|
|
||||||
const localizedString = this.stringsI18n[locale][name];
|
|
||||||
|
|
||||||
if (
|
|
||||||
localizedString === undefined ||
|
|
||||||
localizedString === collection[locales.default]
|
|
||||||
) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
collection[locale] = localizedString;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { locales: collection } satisfies I18nString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Cache(disableInDev = false) {
|
|
||||||
const cache = new WeakMap<object, Map<string, Promise<unknown>>>();
|
|
||||||
|
|
||||||
return function <This, Arguments extends any[], Return>(
|
|
||||||
target: (this: This, ...args: Arguments) => Promise<Return>,
|
|
||||||
// TODO: evaluate if we need context to make the error trace easier
|
|
||||||
// context: ClassMethodDecoratorContext<
|
|
||||||
// This,
|
|
||||||
// (this: This, ...args: Arguments) => Promise<Return>
|
|
||||||
// >,
|
|
||||||
) {
|
|
||||||
return async function replacementMethod(this: This, ...args: Arguments) {
|
|
||||||
const key = args.join("-");
|
|
||||||
let thisCache: Map<string, Promise<Return>>;
|
|
||||||
|
|
||||||
if (cache.has(this as object)) {
|
|
||||||
thisCache = cache.get(this as object) as Map<string, Promise<Return>>;
|
|
||||||
} else {
|
|
||||||
thisCache = new Map();
|
|
||||||
cache.set(this as object, thisCache);
|
|
||||||
}
|
|
||||||
|
|
||||||
const disabled = disableInDev && import.meta.env.DEV;
|
|
||||||
|
|
||||||
if (thisCache.has(key) && !disabled) {
|
|
||||||
return thisCache.get(key)!;
|
|
||||||
}
|
|
||||||
|
|
||||||
const promise = (async () => {
|
|
||||||
try {
|
|
||||||
return await target.apply(this, args);
|
|
||||||
} catch (error) {
|
|
||||||
thisCache!.delete(key);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
thisCache.set(key, promise);
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
import { fetchGlossary } from "@blitzkit/core";
|
|
||||||
import locales from "@blitzkit/i18n/locales.json";
|
|
||||||
import { Avatar, Gallery } from "@blitzkit/protos";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI9 } from "./9_game";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI10 extends ServerBlitzKitAPI9 {
|
|
||||||
@Cache()
|
|
||||||
async gallery() {
|
|
||||||
const avatars: Record<string, { avatar: Avatar; url: string }> = {};
|
|
||||||
|
|
||||||
await Promise.all(
|
|
||||||
locales.supported.map(async (supported) => {
|
|
||||||
const glossary = await fetchGlossary(
|
|
||||||
supported.variant_blitz_local ?? supported.locale,
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
`Found ${Object.keys(glossary).length} things for ${supported.locale}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const key in glossary) {
|
|
||||||
const glossaryEntry = glossary[key];
|
|
||||||
|
|
||||||
if (
|
|
||||||
!key.startsWith("avatar") ||
|
|
||||||
key.endsWith("_part") ||
|
|
||||||
glossaryEntry.image_url === null
|
|
||||||
) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key in avatars) {
|
|
||||||
avatars[key].avatar.name!.locales[supported.locale] =
|
|
||||||
glossaryEntry.title;
|
|
||||||
} else {
|
|
||||||
const extension = this.extname!(glossaryEntry.image_url);
|
|
||||||
|
|
||||||
avatars[key] = {
|
|
||||||
url: glossaryEntry.image_url,
|
|
||||||
avatar: {
|
|
||||||
id: key,
|
|
||||||
name: { locales: { [supported.locale]: glossaryEntry.title } },
|
|
||||||
extension,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const gallery: Gallery = { avatars: [] };
|
|
||||||
|
|
||||||
await Promise.all(
|
|
||||||
Object.entries(avatars).map(async ([key, { url, avatar }]) => {
|
|
||||||
if (!(locales.default in avatars[key].avatar.name!.locales)) {
|
|
||||||
console.warn(`Avatar ${key} has no ${locales.default} name`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gallery.avatars.push(avatar);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
return gallery;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import { ConsumablesCommon, OptionalDevices } from "../../../types";
|
|
||||||
import { BlitzEffectScript } from "../../../types/blitzEffectScript";
|
|
||||||
import { BlitzScripts } from "../../../types/blitzScripts";
|
|
||||||
import { AbstractVFS } from "../../vfs";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI10 } from "./10_avatars";
|
|
||||||
|
|
||||||
function assignNormalizedScript(
|
|
||||||
target: Record<string, BlitzEffectScript>,
|
|
||||||
key: number,
|
|
||||||
script?: BlitzEffectScript,
|
|
||||||
) {
|
|
||||||
if (script === undefined) return;
|
|
||||||
|
|
||||||
if (script["#text"] === "StaticFactorDevice") {
|
|
||||||
script["#text"] = script.attribute!;
|
|
||||||
}
|
|
||||||
|
|
||||||
target[key] = script;
|
|
||||||
}
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI11 extends ServerBlitzKitAPI10 {
|
|
||||||
@Cache()
|
|
||||||
async scripts() {
|
|
||||||
const scripts: BlitzScripts = {
|
|
||||||
consumables: {},
|
|
||||||
equipment: {},
|
|
||||||
provisions: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
const optionalDevices = await this.vfs.xml<{
|
|
||||||
root: OptionalDevices;
|
|
||||||
}>("Data/XML/item_defs/vehicles/common/optional_devices.xml");
|
|
||||||
|
|
||||||
for (const key in optionalDevices.root) {
|
|
||||||
const equipment = optionalDevices.root[key];
|
|
||||||
|
|
||||||
assignNormalizedScript(scripts.equipment, equipment.id, equipment.script);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function assign(
|
|
||||||
vfs: AbstractVFS,
|
|
||||||
dir: string,
|
|
||||||
target: keyof BlitzScripts,
|
|
||||||
) {
|
|
||||||
const root = `Data/XML/item_defs/vehicles/common/${dir}`;
|
|
||||||
const list = await vfs.text(`${root}/list.xml`);
|
|
||||||
const pattern = /<items path="(\w+)\.xml"\/>/gm;
|
|
||||||
|
|
||||||
for (const match of list.matchAll(pattern)) {
|
|
||||||
const group = match[1];
|
|
||||||
const path = `${root}/${group}.xml`;
|
|
||||||
const things = await vfs.xml<{ root: ConsumablesCommon }>(path);
|
|
||||||
|
|
||||||
for (const key in things.root) {
|
|
||||||
const thing = things.root[key];
|
|
||||||
|
|
||||||
assignNormalizedScript(
|
|
||||||
scripts[target],
|
|
||||||
thing.id,
|
|
||||||
things.root[key].script,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await assign(this.vfs, "consumables", "consumables");
|
|
||||||
await assign(this.vfs, "provisions", "provisions");
|
|
||||||
|
|
||||||
return scripts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { Strings } from "@blitzkit/i18n";
|
|
||||||
import locales from "@blitzkit/i18n/locales.json";
|
|
||||||
import { DeepPartial } from "@blitzkit/protos";
|
|
||||||
import { merge } from "lodash-es";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI11 } from "./11_scripts";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI12 extends ServerBlitzKitAPI11 {
|
|
||||||
private globbedStrings = import.meta.glob(
|
|
||||||
"../../../../../i18n/strings/*.json",
|
|
||||||
{ import: "default" },
|
|
||||||
);
|
|
||||||
|
|
||||||
@Cache()
|
|
||||||
async strings(locale: string) {
|
|
||||||
const localized = (await this.globbedStrings[
|
|
||||||
`../../../../../i18n/strings/${locale}.json`
|
|
||||||
]()) as DeepPartial<Strings>;
|
|
||||||
const defaults = (await this.globbedStrings[
|
|
||||||
`../../../../../i18n/strings/${locales.default}.json`
|
|
||||||
]()) as Strings;
|
|
||||||
const strings = merge({}, defaults, localized);
|
|
||||||
|
|
||||||
return strings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,740 +0,0 @@
|
|||||||
import {
|
|
||||||
BlitzCrewType,
|
|
||||||
BlitzModuleType,
|
|
||||||
blitzShellKindToBlitzkit,
|
|
||||||
BlitzTankClass,
|
|
||||||
ChassisDefinitionsList,
|
|
||||||
EngineDefinitionsList,
|
|
||||||
GunDefinitionsList,
|
|
||||||
ShellDefinitionsList,
|
|
||||||
ShellKind,
|
|
||||||
sluggify,
|
|
||||||
toUniqueId,
|
|
||||||
TurretDefinitionsList,
|
|
||||||
UnlocksListing,
|
|
||||||
VehicleDefinitionList,
|
|
||||||
VehicleDefinitions,
|
|
||||||
} from "@blitzkit/core";
|
|
||||||
import {
|
|
||||||
AssaultRanges,
|
|
||||||
Crew,
|
|
||||||
Equalizer,
|
|
||||||
GunDefinition,
|
|
||||||
ModuleType,
|
|
||||||
ResearchCost,
|
|
||||||
TankDefinitions,
|
|
||||||
TankPrice,
|
|
||||||
TankPriceType,
|
|
||||||
TankType,
|
|
||||||
Unlock,
|
|
||||||
} from "@blitzkit/protos";
|
|
||||||
import { Cache, ServerBlitzKitAPI0 } from "./0_base";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI1 extends ServerBlitzKitAPI0 {
|
|
||||||
private parseResearchCost(raw: number | string) {
|
|
||||||
if (typeof raw === "number") {
|
|
||||||
return {
|
|
||||||
research_cost_type: { $case: "xp", value: raw },
|
|
||||||
} satisfies ResearchCost;
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
research_cost_type: {
|
|
||||||
$case: "seasonal_tokens",
|
|
||||||
value: {
|
|
||||||
season: Number(/prx_season_(\d+):\d+/.exec(raw)![1]),
|
|
||||||
tokens: Number(/prx_season_\d+:(\d+)/.exec(raw)![1]),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} satisfies ResearchCost;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cache()
|
|
||||||
async tanks() {
|
|
||||||
const tankDefinitions = TankDefinitions.create();
|
|
||||||
|
|
||||||
const gameModeNativeNames: Record<string, string> = {};
|
|
||||||
|
|
||||||
const squadBattleTypeGameModeNativeNameMatches =
|
|
||||||
this.squadBattleTypeStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
|
||||||
/eGameMode\.(\w+) -> "(battleType\/([a-zA-Z]+))"/g,
|
|
||||||
);
|
|
||||||
const gameTypeGameModeNativeNameMatches =
|
|
||||||
this.gameTypeSelectorStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
|
||||||
/eGameMode\.([a-zA-Z]+) -> "~res:\/Gfx\/UI\/Hangar\/GameTypes\/battle-type_([^"]+)"/g,
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const match of squadBattleTypeGameModeNativeNameMatches) {
|
|
||||||
gameModeNativeNames[match[3]] = match[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const match of gameTypeGameModeNativeNameMatches) {
|
|
||||||
Object.entries(gameModeNativeNames).forEach(([key, value]) => {
|
|
||||||
if (key.toLowerCase() === match[2].toLowerCase()) {
|
|
||||||
gameModeNativeNames[match[1]] = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const slugRequesters = new Map<string, { id: number; key: string }[]>();
|
|
||||||
const idToNation: Record<number, string> = {};
|
|
||||||
|
|
||||||
for (const nation of this.nationsDir!) {
|
|
||||||
const tankList = await this.vfs.xml<{ root: VehicleDefinitionList }>(
|
|
||||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const tankKey in tankList.root) {
|
|
||||||
if (this.botPattern.test(tankKey)) continue;
|
|
||||||
|
|
||||||
const tank = tankList.root[tankKey];
|
|
||||||
const tankId = toUniqueId(nation, tank.id);
|
|
||||||
|
|
||||||
const name = (
|
|
||||||
(tank.shortUserString
|
|
||||||
? this.getString(tank.shortUserString)
|
|
||||||
: undefined) ?? this.getString(tank.userString)
|
|
||||||
).locales.en;
|
|
||||||
|
|
||||||
let slug = sluggify(name);
|
|
||||||
|
|
||||||
idToNation[tankId] = nation;
|
|
||||||
|
|
||||||
if (slugRequesters.has(slug)) {
|
|
||||||
slugRequesters.get(slug)!.push({ id: tankId, key: tankKey });
|
|
||||||
} else {
|
|
||||||
slugRequesters.set(slug, [{ id: tankId, key: tankKey }]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const slugs = new Map<number, string>();
|
|
||||||
|
|
||||||
slugRequesters.forEach((requesters, slug) => {
|
|
||||||
if (requesters.length === 1) {
|
|
||||||
slugs.set(requesters[0].id, slug);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.warn(
|
|
||||||
`Multiple tanks share slug ${slug}: ${requesters
|
|
||||||
.map(({ key }) => key)
|
|
||||||
.join(", ")}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (requesters.length !== 2) {
|
|
||||||
throw new Error("Unresolvable number of duplicates :(");
|
|
||||||
}
|
|
||||||
|
|
||||||
const nonCanonical = requesters.find(({ key }) => key.endsWith("TUR"));
|
|
||||||
|
|
||||||
if (nonCanonical === undefined) {
|
|
||||||
console.log("Using nations to discriminate");
|
|
||||||
// both are non-tutorial tanks, will have to discriminate using nation
|
|
||||||
|
|
||||||
requesters.forEach(({ id, key }) => {
|
|
||||||
const nation = idToNation[id];
|
|
||||||
const discriminator =
|
|
||||||
this.nationSlugDiscriminators[
|
|
||||||
nation as keyof typeof this.nationSlugDiscriminators
|
|
||||||
];
|
|
||||||
|
|
||||||
console.log(`Solution: ${key} -> ${slug}-${discriminator}`);
|
|
||||||
slugs.set(id, `${slug}-${discriminator}`);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("Using tutorial bot suffix to discriminate");
|
|
||||||
|
|
||||||
const canonical = requesters.find(({ key }) => !key.endsWith("TUR"));
|
|
||||||
|
|
||||||
if (canonical === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
"Two tutorial bots share the same slug? The world is truly broken.",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Solution: ${canonical.key} -> ${slug}`);
|
|
||||||
slugs.set(canonical.id, slug);
|
|
||||||
console.log(`Solution: ${nonCanonical.key} -> ${slug}-tur`);
|
|
||||||
slugs.set(nonCanonical.id, `${slug}-tur`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const tankXps = new Map<number, ResearchCost>();
|
|
||||||
|
|
||||||
for (const nation of this.nationsDir!) {
|
|
||||||
const tankList = await this.vfs.xml<{ root: VehicleDefinitionList }>(
|
|
||||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
|
||||||
);
|
|
||||||
const turretList = await this.vfs.xml<{
|
|
||||||
root: TurretDefinitionsList;
|
|
||||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/turrets.xml`);
|
|
||||||
const gunList = await this.vfs.xml<{
|
|
||||||
root: GunDefinitionsList;
|
|
||||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/guns.xml`);
|
|
||||||
const shellList = await this.vfs.xml<{
|
|
||||||
root: ShellDefinitionsList;
|
|
||||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/shells.xml`);
|
|
||||||
const enginesList = await this.vfs.xml<{
|
|
||||||
root: EngineDefinitionsList;
|
|
||||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/engines.xml`);
|
|
||||||
const chassisList = await this.vfs.xml<{
|
|
||||||
root: ChassisDefinitionsList;
|
|
||||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/chassis.xml`);
|
|
||||||
|
|
||||||
function resolveUnlocks(
|
|
||||||
blitzModuleTypeToBlitzkit: Record<keyof BlitzModuleType, ModuleType>,
|
|
||||||
unlocks?: BlitzModuleType,
|
|
||||||
) {
|
|
||||||
if (!unlocks) return [];
|
|
||||||
|
|
||||||
return Object.entries(unlocks)
|
|
||||||
.map(([type, list]) =>
|
|
||||||
(Array.isArray(list) ? list : [list]).map((item) => {
|
|
||||||
const typeTyped = type as keyof BlitzModuleType;
|
|
||||||
let rawId: number;
|
|
||||||
|
|
||||||
if (typeTyped === "chassis") {
|
|
||||||
rawId = chassisList.root.ids[item["#text"]];
|
|
||||||
} else if (typeTyped === "engine") {
|
|
||||||
rawId = enginesList.root.ids[item["#text"]];
|
|
||||||
} else if (typeTyped === "gun") {
|
|
||||||
rawId = gunList.root.ids[item["#text"]];
|
|
||||||
} else if (typeTyped === "turret") {
|
|
||||||
rawId = turretList.root.ids[item["#text"]];
|
|
||||||
} else if (typeTyped === "vehicle") {
|
|
||||||
rawId = tankList.root[item["#text"]].id;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: toUniqueId(nation, rawId!),
|
|
||||||
type: blitzModuleTypeToBlitzkit[typeTyped],
|
|
||||||
cost: {
|
|
||||||
type:
|
|
||||||
typeof item.cost === "number"
|
|
||||||
? "xp"
|
|
||||||
: item.cost.split(":")[0],
|
|
||||||
value:
|
|
||||||
typeof item.cost === "number"
|
|
||||||
? item.cost
|
|
||||||
: Number(item.cost.split(":")[1]),
|
|
||||||
},
|
|
||||||
} satisfies Unlock;
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.flat();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const tankKey in tankList.root) {
|
|
||||||
if (this.botPattern.test(tankKey)) continue;
|
|
||||||
|
|
||||||
const gunXps = new Map<number, ResearchCost>();
|
|
||||||
const turretXps = new Map<number, ResearchCost>();
|
|
||||||
const engineXps = new Map<number, ResearchCost>();
|
|
||||||
const trackXps = new Map<number, ResearchCost>();
|
|
||||||
const tank = tankList.root[tankKey];
|
|
||||||
let tankPrice: TankPrice;
|
|
||||||
const tankDefinition = await this.vfs.xml<{ root: VehicleDefinitions }>(
|
|
||||||
`Data/XML/item_defs/vehicles/${nation}/${tankKey}.xml`,
|
|
||||||
);
|
|
||||||
const tankId = toUniqueId(nation, tank.id);
|
|
||||||
|
|
||||||
const tankTags = tank.tags.split(" ");
|
|
||||||
const equipment = tankDefinition.root.optDevicePreset;
|
|
||||||
|
|
||||||
const slug = slugs.get(tankId);
|
|
||||||
|
|
||||||
if (slug === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
`Could not find slug for ${nation}/${tankKey} (${tankId})`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tank.sellPrice) {
|
|
||||||
tankPrice = {
|
|
||||||
type: TankPriceType.TANK_PRICE_TYPE_GOLD,
|
|
||||||
value: tank.sellPrice["#text"] * 2,
|
|
||||||
};
|
|
||||||
} else if (typeof tank.price === "number") {
|
|
||||||
tankPrice = {
|
|
||||||
type: TankPriceType.TANK_PRICE_TYPE_CREDITS,
|
|
||||||
value: tank.price,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
tankPrice = {
|
|
||||||
type: TankPriceType.TANK_PRICE_TYPE_CREDITS,
|
|
||||||
value: tank.price["#text"] * 400,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const crew: Crew[] = [];
|
|
||||||
const fixedCamouflage = tankTags.includes("eventCamouflage_user");
|
|
||||||
const totalUnlocks: UnlocksListing[] = [];
|
|
||||||
|
|
||||||
for (const crewKey in tankDefinition.root.crew) {
|
|
||||||
const value = tankDefinition.root.crew[crewKey as BlitzCrewType];
|
|
||||||
let entry: Crew;
|
|
||||||
const index = crew.findIndex(
|
|
||||||
({ type }) => this.blitzkitCrewTypeToBlitz[type] === crewKey,
|
|
||||||
);
|
|
||||||
if (index === -1) {
|
|
||||||
if (crewKey === "#text") continue;
|
|
||||||
entry = {
|
|
||||||
type: this.blitzCrewTypeToBlitzkit[crewKey as BlitzCrewType],
|
|
||||||
count: 0,
|
|
||||||
substitute: [],
|
|
||||||
};
|
|
||||||
crew.push(entry);
|
|
||||||
} else {
|
|
||||||
entry = crew[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "string") {
|
|
||||||
entry.count++;
|
|
||||||
|
|
||||||
if (value !== "") {
|
|
||||||
entry.substitute = value.split(/\n| /).map((member) => {
|
|
||||||
return this.blitzCrewTypeToBlitzkit[
|
|
||||||
member.trim() as BlitzCrewType
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (entry.count === undefined) {
|
|
||||||
entry.count = value.length;
|
|
||||||
} else {
|
|
||||||
entry.count += value.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const camouflages = Object.entries(
|
|
||||||
this.camouflagesXml!.root.camouflages,
|
|
||||||
)
|
|
||||||
.filter(([, camo]) => {
|
|
||||||
if (!camo.vehicleFilter.include) return false;
|
|
||||||
if (camo.unlockCostCategory !== "legendary-skins-gold")
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const includeArray = Array.isArray(camo.vehicleFilter.include)
|
|
||||||
? camo.vehicleFilter.include
|
|
||||||
: [camo.vehicleFilter.include];
|
|
||||||
|
|
||||||
return includeArray.some((filter) => {
|
|
||||||
if ("vehicle" in filter && filter.vehicle?.name) {
|
|
||||||
return filter.vehicle.name === `${nation}:${tankKey}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.map(([, camo]) => camo.id);
|
|
||||||
|
|
||||||
let equalizerEntry = this.tierEqualizer!.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 };
|
|
||||||
}
|
|
||||||
|
|
||||||
const blitzTankClass = tankTags.find(
|
|
||||||
(tag) => tag in this.blitzTankClassToBlitzkit,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (blitzTankClass === undefined) {
|
|
||||||
throw new Error(`Unknown tank class for ${nation}:${tankKey}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const tankClass =
|
|
||||||
this.blitzTankClassToBlitzkit[blitzTankClass as BlitzTankClass];
|
|
||||||
|
|
||||||
const canonicalFullName = this.getString(tank.userString);
|
|
||||||
const name =
|
|
||||||
(tank.shortUserString
|
|
||||||
? this.getString(tank.shortUserString)
|
|
||||||
: undefined) ?? canonicalFullName;
|
|
||||||
// only supply full name if it's different from the displayed short name to save some bytes
|
|
||||||
const name_full =
|
|
||||||
name === canonicalFullName ? undefined : canonicalFullName;
|
|
||||||
|
|
||||||
tankDefinitions.tanks[tankId] = {
|
|
||||||
ancestors: [],
|
|
||||||
successors: [],
|
|
||||||
id: tankId,
|
|
||||||
dev_name: tankKey,
|
|
||||||
roles: {},
|
|
||||||
camouflages: camouflages,
|
|
||||||
fixed_camouflage: fixedCamouflage,
|
|
||||||
crew,
|
|
||||||
weight: tankDefinition.root.hull.weight,
|
|
||||||
health: tankDefinition.root.hull.maxHealth,
|
|
||||||
speed_forwards: tankDefinition.root.speedLimits.forward,
|
|
||||||
speed_backwards: tankDefinition.root.speedLimits.backward,
|
|
||||||
equipment_preset:
|
|
||||||
typeof equipment === "string" ? equipment : equipment.at(-1)!,
|
|
||||||
max_consumables: tankDefinition.root.consumableSlots,
|
|
||||||
max_provisions: tankDefinition.root.provisionSlots,
|
|
||||||
name,
|
|
||||||
name_full,
|
|
||||||
slug,
|
|
||||||
nation,
|
|
||||||
type: tankTags.includes("collectible")
|
|
||||||
? TankType.TANK_TYPE_COLLECTOR
|
|
||||||
: (typeof tank.price === "number" ? false : "gold" in tank.price)
|
|
||||||
? TankType.TANK_TYPE_PREMIUM
|
|
||||||
: TankType.TANK_TYPE_RESEARCHABLE,
|
|
||||||
tier: tank.level,
|
|
||||||
class: tankClass,
|
|
||||||
testing: tankTags.includes("testTank"),
|
|
||||||
deprecated: tankTags.includes("deprecated"),
|
|
||||||
price: tankPrice,
|
|
||||||
camouflage_still: tankDefinition.root.invisibility.still,
|
|
||||||
camouflage_moving: tankDefinition.root.invisibility.moving,
|
|
||||||
camouflage_on_fire: tankDefinition.root.invisibility.firePenalty,
|
|
||||||
turrets: [],
|
|
||||||
engines: [],
|
|
||||||
tracks: [],
|
|
||||||
equalizer,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (tank.combatRole) {
|
|
||||||
Object.entries(tank.combatRole).forEach(([gameMode, role]) => {
|
|
||||||
const id = Object.entries(gameModeNativeNames).find(
|
|
||||||
([key]) => key.toLowerCase() === gameMode.toLowerCase(),
|
|
||||||
)?.[1];
|
|
||||||
|
|
||||||
if (id === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
`Unknown game mode in tank ${tankKey}: ${gameMode}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
tankDefinitions.tanks[tankId].roles[id] =
|
|
||||||
this.combatRoles![role].id;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(tankDefinition.root.chassis).forEach((key) => {
|
|
||||||
const track = tankDefinition.root.chassis[key];
|
|
||||||
const trackId = toUniqueId(nation, chassisList.root.ids[key]);
|
|
||||||
const terrainResistances = track.terrainResistance
|
|
||||||
.split(" ")
|
|
||||||
.map(Number);
|
|
||||||
|
|
||||||
totalUnlocks.push(track.unlocks);
|
|
||||||
tankDefinitions.tanks[tankId].tracks.push({
|
|
||||||
id: trackId,
|
|
||||||
weight: track.weight,
|
|
||||||
name: this.getString(track.userString),
|
|
||||||
traverse_speed: track.rotationSpeed,
|
|
||||||
dispersion_move: track.shotDispersionFactors.vehicleMovement,
|
|
||||||
dispersion_traverse: track.shotDispersionFactors.vehicleRotation,
|
|
||||||
resistance_hard: terrainResistances[0],
|
|
||||||
resistance_medium: terrainResistances[1],
|
|
||||||
resistance_soft: terrainResistances[2],
|
|
||||||
repair_time: track.hysteresisHealth / track.healthRegenPerSec,
|
|
||||||
tier: track.level,
|
|
||||||
unlocks: resolveUnlocks(
|
|
||||||
this.blitzModuleTypeToBlitzkit,
|
|
||||||
track.unlocks,
|
|
||||||
),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.keys(tankDefinition.root.engines).forEach((engineKey) => {
|
|
||||||
const engine = tankDefinition.root.engines[engineKey];
|
|
||||||
const engineListEntry = enginesList.root.shared[engineKey];
|
|
||||||
const engineId = toUniqueId(nation, enginesList.root.ids[engineKey]);
|
|
||||||
|
|
||||||
totalUnlocks.push(engine.unlocks);
|
|
||||||
tankDefinitions.tanks[tankId].engines.push({
|
|
||||||
id: engineId,
|
|
||||||
name: this.getString(engineListEntry.userString),
|
|
||||||
fire_chance: engineListEntry.fireStartingChance,
|
|
||||||
tier: engineListEntry.level,
|
|
||||||
weight: engineListEntry.weight,
|
|
||||||
power: engineListEntry.power,
|
|
||||||
unlocks: resolveUnlocks(
|
|
||||||
this.blitzModuleTypeToBlitzkit,
|
|
||||||
engine.unlocks,
|
|
||||||
),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
let turretIndex = 0;
|
|
||||||
for (const turretKey in tankDefinition.root.turrets0) {
|
|
||||||
const turret = tankDefinition.root.turrets0[turretKey];
|
|
||||||
const turretId = toUniqueId(nation, turretList.root.ids[turretKey]);
|
|
||||||
|
|
||||||
totalUnlocks.push(turret.unlocks);
|
|
||||||
|
|
||||||
tankDefinitions.tanks[tankId].turrets.push({
|
|
||||||
id: turretId,
|
|
||||||
traverse_speed: turret.rotationSpeed,
|
|
||||||
name: this.getString(turret.userString),
|
|
||||||
tier: turret.level,
|
|
||||||
guns: [],
|
|
||||||
health: turret.maxHealth,
|
|
||||||
view_range: turret.circularVisionRadius,
|
|
||||||
weight: turret.weight,
|
|
||||||
unlocks: resolveUnlocks(
|
|
||||||
this.blitzModuleTypeToBlitzkit,
|
|
||||||
turret.unlocks,
|
|
||||||
),
|
|
||||||
});
|
|
||||||
|
|
||||||
let gunIndex = 0;
|
|
||||||
for (const gunKey in turret.guns) {
|
|
||||||
const gun = turret.guns[gunKey];
|
|
||||||
const gunId = toUniqueId(nation, gunList.root.ids[gunKey]);
|
|
||||||
const gunListEntry = gunList.root.shared[gunKey];
|
|
||||||
const gunName = this.getString(gunListEntry.userString);
|
|
||||||
const gunType =
|
|
||||||
"clip" in gun
|
|
||||||
? gun.pumpGunMode
|
|
||||||
? "autoReloader"
|
|
||||||
: "autoLoader"
|
|
||||||
: "regular";
|
|
||||||
const gunClipCount = gunType === "regular" ? 1 : gun.clip!.count;
|
|
||||||
const shotDispersionFactors =
|
|
||||||
gun.shotDispersionFactors ?? gunListEntry.shotDispersionFactors;
|
|
||||||
let assault_ranges: AssaultRanges | undefined;
|
|
||||||
|
|
||||||
if (gun.extras?.trayShell) {
|
|
||||||
const types = gun.extras.trayShell.kinds
|
|
||||||
.split(" ")
|
|
||||||
.map((string) => {
|
|
||||||
const trimmed = string.trim();
|
|
||||||
|
|
||||||
if (trimmed in blitzShellKindToBlitzkit) {
|
|
||||||
return blitzShellKindToBlitzkit[trimmed as ShellKind];
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new SyntaxError(`Invalid shell kind: ${trimmed}`);
|
|
||||||
});
|
|
||||||
const sectorNames = Object.keys(gun.extras.trayShell.sectors);
|
|
||||||
|
|
||||||
if (sectorNames.length !== 1 || sectorNames[0] !== "sector") {
|
|
||||||
throw new SyntaxError("Invalid tray shell sector");
|
|
||||||
}
|
|
||||||
|
|
||||||
const sector = gun.extras.trayShell.sectors.sector;
|
|
||||||
|
|
||||||
assault_ranges = {
|
|
||||||
types,
|
|
||||||
ranges: sector.map((value) => ({
|
|
||||||
factor: value.factor,
|
|
||||||
distance: value.distance,
|
|
||||||
})),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
totalUnlocks.push(gun.unlocks);
|
|
||||||
|
|
||||||
tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({
|
|
||||||
id: gunId,
|
|
||||||
weight: gunListEntry.weight,
|
|
||||||
rotation_speed: gunListEntry.rotationSpeed,
|
|
||||||
name: gunName,
|
|
||||||
tier: gunListEntry.level,
|
|
||||||
shells: [],
|
|
||||||
camouflage_loss:
|
|
||||||
typeof gun.invisibilityFactorAtShot === "number"
|
|
||||||
? gun.invisibilityFactorAtShot
|
|
||||||
: gun.invisibilityFactorAtShot.at(-1)!,
|
|
||||||
aim_time: gun.aimingTime ?? gunListEntry.aimingTime,
|
|
||||||
dispersion_base:
|
|
||||||
gun.shotDispersionRadius ?? gunListEntry.shotDispersionRadius,
|
|
||||||
dispersion_damaged: shotDispersionFactors.whileGunDamaged,
|
|
||||||
dispersion_shot: shotDispersionFactors.afterShot,
|
|
||||||
dispersion_traverse: shotDispersionFactors.turretRotation,
|
|
||||||
unlocks: resolveUnlocks(
|
|
||||||
this.blitzModuleTypeToBlitzkit,
|
|
||||||
gun.unlocks,
|
|
||||||
),
|
|
||||||
shell_capacity: gun.maxAmmo ?? gunListEntry.maxAmmo,
|
|
||||||
assault_ranges,
|
|
||||||
burst:
|
|
||||||
gun.burst && gun.burst.count > 1
|
|
||||||
? {
|
|
||||||
count: gun.burst.count,
|
|
||||||
interval: 60 / gun.burst.rate,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
gun_type:
|
|
||||||
gunType === "regular"
|
|
||||||
? {
|
|
||||||
$case: "regular",
|
|
||||||
value: {
|
|
||||||
reload: gun.reloadTime,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: gunType === "autoReloader"
|
|
||||||
? {
|
|
||||||
$case: "auto_reloader",
|
|
||||||
value: {
|
|
||||||
intra_clip: 60 / gun.clip!.rate,
|
|
||||||
shell_count: gunClipCount,
|
|
||||||
shell_reloads: gun
|
|
||||||
.pumpGunReloadTimes!.split(" ")
|
|
||||||
.map(Number),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
$case: "auto_loader",
|
|
||||||
value: {
|
|
||||||
intra_clip: 60 / gun.clip!.rate,
|
|
||||||
clip_reload: gun.reloadTime,
|
|
||||||
shell_count: gunClipCount,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} satisfies GunDefinition);
|
|
||||||
|
|
||||||
for (const shellKey in gunListEntry.shots) {
|
|
||||||
const gunShellEntry = gunListEntry.shots[shellKey];
|
|
||||||
const shell = shellList.root[shellKey];
|
|
||||||
const shellId = toUniqueId(nation, shell.id);
|
|
||||||
const shellName = this.getString(shell.userString);
|
|
||||||
const penetrationRaw = gunShellEntry.piercingPower
|
|
||||||
.split(" ")
|
|
||||||
.filter((penetrationString) => penetrationString !== "")
|
|
||||||
.map(Number);
|
|
||||||
|
|
||||||
tankDefinitions.tanks[tankId].turrets[turretIndex].guns[
|
|
||||||
gunIndex
|
|
||||||
].shells.push({
|
|
||||||
id: shellId,
|
|
||||||
name: shellName,
|
|
||||||
velocity: gunShellEntry.speed,
|
|
||||||
armor_damage: shell.damage.armor,
|
|
||||||
module_damage: shell.damage.devices,
|
|
||||||
caliber: shell.caliber,
|
|
||||||
normalization: shell.normalizationAngle,
|
|
||||||
ricochet: shell.ricochetAngle,
|
|
||||||
type: blitzShellKindToBlitzkit[shell.kind],
|
|
||||||
explosion_radius:
|
|
||||||
shell.kind === "HIGH_EXPLOSIVE"
|
|
||||||
? (shell.explosionRadius ?? 0)
|
|
||||||
: undefined,
|
|
||||||
icon: shell.icon,
|
|
||||||
penetration: {
|
|
||||||
near: penetrationRaw[0],
|
|
||||||
far: penetrationRaw[1],
|
|
||||||
},
|
|
||||||
range: gunShellEntry.maxDistance,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
gunIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
turretIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const unlocks of totalUnlocks) {
|
|
||||||
if (unlocks === undefined) continue;
|
|
||||||
|
|
||||||
for (const key in unlocks) {
|
|
||||||
const value = unlocks[key as keyof BlitzModuleType];
|
|
||||||
|
|
||||||
for (const vehicle of Array.isArray(value) ? value : [value]) {
|
|
||||||
switch (key as keyof BlitzModuleType) {
|
|
||||||
case "vehicle": {
|
|
||||||
const tankListEntry = tankList.root[vehicle["#text"]];
|
|
||||||
const currentTank = tankDefinitions.tanks[tankId];
|
|
||||||
const successorId = toUniqueId(nation, tankListEntry.id);
|
|
||||||
|
|
||||||
tankXps.set(
|
|
||||||
successorId,
|
|
||||||
this.parseResearchCost(vehicle.cost),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (currentTank.successors === undefined) {
|
|
||||||
currentTank.successors = [];
|
|
||||||
}
|
|
||||||
if (!currentTank.successors!.includes(successorId)) {
|
|
||||||
currentTank.successors!.push(successorId);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "gun": {
|
|
||||||
gunXps.set(
|
|
||||||
toUniqueId(nation, gunList.root.ids[vehicle["#text"]]),
|
|
||||||
this.parseResearchCost(vehicle.cost),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "turret": {
|
|
||||||
turretXps.set(
|
|
||||||
toUniqueId(nation, turretList.root.ids[vehicle["#text"]]),
|
|
||||||
this.parseResearchCost(vehicle.cost),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "engine": {
|
|
||||||
engineXps.set(
|
|
||||||
toUniqueId(nation, enginesList.root.ids[vehicle["#text"]]),
|
|
||||||
this.parseResearchCost(vehicle.cost),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "chassis": {
|
|
||||||
trackXps.set(
|
|
||||||
toUniqueId(nation, chassisList.root.ids[vehicle["#text"]]),
|
|
||||||
this.parseResearchCost(vehicle.cost),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.values(tankDefinitions.tanks[tankId].turrets).forEach(
|
|
||||||
(turret) => {
|
|
||||||
turret.research_cost = turretXps.get(turret.id);
|
|
||||||
|
|
||||||
Object.values(turret.guns).forEach((gunRaw) => {
|
|
||||||
gunRaw.research_cost = gunXps.get(gunRaw.id);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Object.values(tankDefinitions.tanks[tankId].engines).forEach(
|
|
||||||
(engine) => {
|
|
||||||
engine.research_cost = engineXps.get(engine.id);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Object.values(tankDefinitions.tanks[tankId].tracks).forEach((track) => {
|
|
||||||
track.research_cost = trackXps.get(track.id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.values(tankDefinitions.tanks).forEach((tank) => {
|
|
||||||
tank.research_cost = tankXps.get(tank.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.values(tankDefinitions.tanks).forEach((tank) => {
|
|
||||||
tank.successors?.forEach((predecessorId) => {
|
|
||||||
if (
|
|
||||||
!tankDefinitions.tanks[predecessorId].ancestors?.includes(tank.id)
|
|
||||||
) {
|
|
||||||
tankDefinitions.tanks[predecessorId].ancestors?.push(tank.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return tankDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
import { CamouflageDefinitions } from "@blitzkit/protos";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI1 } from "./1_tanks";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI2 extends ServerBlitzKitAPI1 {
|
|
||||||
@Cache()
|
|
||||||
async camouflages() {
|
|
||||||
const camouflageDefinitions = CamouflageDefinitions.create();
|
|
||||||
|
|
||||||
for (const camoKey in this.camouflagesXml!.root.camouflages) {
|
|
||||||
const camo = this.camouflagesXml!.root.camouflages[camoKey];
|
|
||||||
|
|
||||||
const yamlEntry = this.camouflagesYaml![camoKey];
|
|
||||||
const fullName = yamlEntry.userString
|
|
||||||
? this.getString(yamlEntry.userString)
|
|
||||||
: undefined;
|
|
||||||
const shortName = yamlEntry.shortUserString
|
|
||||||
? this.getString(yamlEntry.shortUserString)
|
|
||||||
: undefined;
|
|
||||||
const resolvedTankName = shortName ?? fullName;
|
|
||||||
const resolvedTankNameFull =
|
|
||||||
resolvedTankName === fullName ? undefined : fullName;
|
|
||||||
|
|
||||||
camouflageDefinitions.camouflages[camo.id] = {
|
|
||||||
id: camo.id,
|
|
||||||
name: this.getString(camo.userString),
|
|
||||||
tank_name: resolvedTankName,
|
|
||||||
tank_name_full: resolvedTankNameFull,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return camouflageDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,324 +0,0 @@
|
|||||||
import {
|
|
||||||
BlitzCrewType,
|
|
||||||
ChassisDefinitionsList,
|
|
||||||
GunDefinitionsList,
|
|
||||||
TankParameters,
|
|
||||||
toUniqueId,
|
|
||||||
TurretDefinitionsList,
|
|
||||||
VehicleDefinitionArmor,
|
|
||||||
VehicleDefinitionList,
|
|
||||||
VehicleDefinitions,
|
|
||||||
} from "@blitzkit/core";
|
|
||||||
import { Armor, Crew, ModelDefinitions, Vector3 } from "@blitzkit/protos";
|
|
||||||
import { Vector3Tuple } from "three";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI2 } from "./2_camouflages";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI3 extends ServerBlitzKitAPI2 {
|
|
||||||
private vector3TupleToBlitzkit(tuple: Vector3Tuple) {
|
|
||||||
return { x: tuple[0], y: tuple[1], z: -tuple[2] } satisfies Vector3;
|
|
||||||
}
|
|
||||||
|
|
||||||
private 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cache()
|
|
||||||
async models() {
|
|
||||||
const modelDefinitions = ModelDefinitions.create();
|
|
||||||
|
|
||||||
for (const nation of this.nationsDir!) {
|
|
||||||
const tankList = await this.vfs.xml<{ root: VehicleDefinitionList }>(
|
|
||||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
|
||||||
);
|
|
||||||
const turretList = await this.vfs.xml<{
|
|
||||||
root: TurretDefinitionsList;
|
|
||||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/turrets.xml`);
|
|
||||||
const gunList = await this.vfs.xml<{
|
|
||||||
root: GunDefinitionsList;
|
|
||||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/guns.xml`);
|
|
||||||
const chassisList = await this.vfs.xml<{
|
|
||||||
root: ChassisDefinitionsList;
|
|
||||||
}>(`Data/XML/item_defs/vehicles/${nation}/components/chassis.xml`);
|
|
||||||
|
|
||||||
for (const tankKey in tankList.root) {
|
|
||||||
if (this.botPattern.test(tankKey)) continue;
|
|
||||||
|
|
||||||
const tank = tankList.root[tankKey];
|
|
||||||
const tankDefinition = await this.vfs.xml<{ root: VehicleDefinitions }>(
|
|
||||||
`Data/XML/item_defs/vehicles/${nation}/${tankKey}.xml`,
|
|
||||||
);
|
|
||||||
const tankParameters = await this.vfs.yaml<TankParameters>(
|
|
||||||
`Data/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`,
|
|
||||||
);
|
|
||||||
const turretOrigin = tankDefinition.root.hull.turretPositions.turret
|
|
||||||
.split(" ")
|
|
||||||
.map(Number) as Vector3Tuple;
|
|
||||||
const tankId = toUniqueId(nation, tank.id);
|
|
||||||
|
|
||||||
const hullArmor: Armor = { spaced: [], thickness: {} };
|
|
||||||
this.tankStringIdMap[`${nation}:${tankKey}`] = tankId;
|
|
||||||
|
|
||||||
Object.keys(tankDefinition.root.hull.armor)
|
|
||||||
.filter((name) => name.startsWith("armor_"))
|
|
||||||
.forEach((name) => {
|
|
||||||
const armorIdString = name.match(/armor_(\d+)/)?.[1];
|
|
||||||
|
|
||||||
if (armorIdString === undefined) {
|
|
||||||
throw new SyntaxError(`Invalid armor id: ${name}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const armorId = parseInt(armorIdString);
|
|
||||||
const armorRaw = tankDefinition.root.hull.armor[name];
|
|
||||||
|
|
||||||
this.assignArmor(armorRaw, armorId, hullArmor);
|
|
||||||
});
|
|
||||||
const crew: Crew[] = [];
|
|
||||||
|
|
||||||
for (const crewKey in tankDefinition.root.crew) {
|
|
||||||
const value = tankDefinition.root.crew[crewKey as BlitzCrewType];
|
|
||||||
let entry: Crew;
|
|
||||||
const index = crew.findIndex(
|
|
||||||
({ type }) => this.blitzkitCrewTypeToBlitz[type] === crewKey,
|
|
||||||
);
|
|
||||||
if (index === -1) {
|
|
||||||
if (crewKey === "#text") continue;
|
|
||||||
|
|
||||||
entry = {
|
|
||||||
type: this.blitzCrewTypeToBlitzkit[crewKey as BlitzCrewType],
|
|
||||||
count: 0,
|
|
||||||
substitute: [],
|
|
||||||
};
|
|
||||||
crew.push(entry);
|
|
||||||
} else {
|
|
||||||
entry = crew[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "string") {
|
|
||||||
entry.count++;
|
|
||||||
|
|
||||||
if (value !== "") {
|
|
||||||
entry.substitute = value.split(/\n| /).map((member) => {
|
|
||||||
return this.blitzCrewTypeToBlitzkit[
|
|
||||||
member.trim() as BlitzCrewType
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (entry.count === undefined) {
|
|
||||||
entry.count = value.length;
|
|
||||||
} else {
|
|
||||||
entry.count += value.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
modelDefinitions.models[tankId] = {
|
|
||||||
armor: hullArmor,
|
|
||||||
turret_origin: this.vector3TupleToBlitzkit(turretOrigin),
|
|
||||||
initial_turret_rotation: tankDefinition.root.hull
|
|
||||||
.turretInitialRotation
|
|
||||||
? {
|
|
||||||
yaw: tankDefinition.root.hull.turretInitialRotation.yaw,
|
|
||||||
pitch: tankDefinition.root.hull.turretInitialRotation.pitch,
|
|
||||||
roll: tankDefinition.root.hull.turretInitialRotation.roll,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
bounding_box: {
|
|
||||||
min: this.vector3TupleToBlitzkit(
|
|
||||||
tankParameters.collision.hull.bbox.min,
|
|
||||||
),
|
|
||||||
max: this.vector3TupleToBlitzkit(
|
|
||||||
tankParameters.collision.hull.bbox.max,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
turrets: {},
|
|
||||||
tracks: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const key in tankDefinition.root.chassis) {
|
|
||||||
const track = tankDefinition.root.chassis[key];
|
|
||||||
const trackId = toUniqueId(nation, chassisList.root.ids[key]);
|
|
||||||
const trackArmorRaw = track.armor.leftTrack;
|
|
||||||
const hullOrigin = track.hullPosition
|
|
||||||
.split(" ")
|
|
||||||
.map(Number) as Vector3Tuple;
|
|
||||||
|
|
||||||
modelDefinitions.models[tankId].tracks[trackId] = {
|
|
||||||
thickness:
|
|
||||||
typeof trackArmorRaw === "number"
|
|
||||||
? trackArmorRaw
|
|
||||||
: trackArmorRaw["#text"],
|
|
||||||
origin: this.vector3TupleToBlitzkit(hullOrigin),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(tankDefinition.root.turrets0).forEach((turretKey) => {
|
|
||||||
const turret = tankDefinition.root.turrets0[turretKey];
|
|
||||||
const turretModel = Number(
|
|
||||||
this.parsePath!(turret.models.undamaged).name.split("_")[1],
|
|
||||||
);
|
|
||||||
const turretId = toUniqueId(nation, turretList.root.ids[turretKey]);
|
|
||||||
const turretYaw = (
|
|
||||||
typeof turret.yawLimits === "string"
|
|
||||||
? turret.yawLimits
|
|
||||||
: turret.yawLimits.at(-1)!
|
|
||||||
)
|
|
||||||
.split(" ")
|
|
||||||
.map(Number) as [number, number];
|
|
||||||
const gunOrigin = (
|
|
||||||
typeof turret.gunPosition === "string"
|
|
||||||
? turret.gunPosition
|
|
||||||
: turret.gunPosition[0]
|
|
||||||
)
|
|
||||||
.split(" ")
|
|
||||||
.map(Number) as Vector3Tuple;
|
|
||||||
const turretArmor: Armor = { thickness: {}, spaced: [] };
|
|
||||||
|
|
||||||
Object.keys(turret.armor)
|
|
||||||
.filter((name) => name.startsWith("armor_"))
|
|
||||||
.forEach((name) => {
|
|
||||||
const armorIdString = name.match(/armor_(\d+)/)?.[1];
|
|
||||||
|
|
||||||
if (armorIdString === undefined) {
|
|
||||||
throw new SyntaxError(`Invalid armor id: ${name}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const armorId = parseInt(armorIdString);
|
|
||||||
const armorRaw = turret.armor[name];
|
|
||||||
|
|
||||||
this.assignArmor(armorRaw, armorId, turretArmor);
|
|
||||||
});
|
|
||||||
|
|
||||||
turret.userString;
|
|
||||||
|
|
||||||
modelDefinitions.models[tankId].turrets[turretId] = {
|
|
||||||
armor: turretArmor,
|
|
||||||
gun_origin: this.vector3TupleToBlitzkit(gunOrigin),
|
|
||||||
model_id: turretModel,
|
|
||||||
yaw:
|
|
||||||
-turretYaw[0] + turretYaw[1] === 360
|
|
||||||
? undefined
|
|
||||||
: { min: turretYaw[0], max: turretYaw[1] },
|
|
||||||
guns: {},
|
|
||||||
bounding_box: {
|
|
||||||
min: this.vector3TupleToBlitzkit(
|
|
||||||
tankParameters.collision[
|
|
||||||
this.parsePath!(
|
|
||||||
turret.hitTester.collisionModel,
|
|
||||||
).name.toLowerCase()
|
|
||||||
].bbox.min,
|
|
||||||
),
|
|
||||||
max: this.vector3TupleToBlitzkit(
|
|
||||||
tankParameters.collision[
|
|
||||||
this.parsePath!(
|
|
||||||
turret.hitTester.collisionModel,
|
|
||||||
).name.toLowerCase()
|
|
||||||
].bbox.max,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.keys(turret.guns).forEach((gunKey, gunIndex) => {
|
|
||||||
const gun = turret.guns[gunKey];
|
|
||||||
const gunId = toUniqueId(nation, gunList.root.ids[gunKey]);
|
|
||||||
const gunListEntry = gunList.root.shared[gunKey];
|
|
||||||
const pitchLimitsRaw = gun.pitchLimits ?? gunListEntry.pitchLimits;
|
|
||||||
const gunPitch = (
|
|
||||||
typeof pitchLimitsRaw === "string"
|
|
||||||
? pitchLimitsRaw
|
|
||||||
: pitchLimitsRaw.at(-1)!
|
|
||||||
)
|
|
||||||
.split(" ")
|
|
||||||
.map(Number) as [number, number];
|
|
||||||
const gunModel = Number(
|
|
||||||
this.parsePath!(gun.models.undamaged).name.split("_")[1],
|
|
||||||
);
|
|
||||||
const front = gun.extraPitchLimits?.front
|
|
||||||
? gun.extraPitchLimits.front.split(" ").map(Number)
|
|
||||||
: undefined;
|
|
||||||
const back = gun.extraPitchLimits?.back
|
|
||||||
? gun.extraPitchLimits.back.split(" ").map(Number)
|
|
||||||
: undefined;
|
|
||||||
const transition = gun.extraPitchLimits?.transition
|
|
||||||
? typeof gun.extraPitchLimits.transition === "number"
|
|
||||||
? gun.extraPitchLimits.transition
|
|
||||||
: gun.extraPitchLimits.transition.at(-1)!
|
|
||||||
: undefined;
|
|
||||||
const gunArmor: Armor = { thickness: {}, spaced: [] };
|
|
||||||
const maskName = `gun_${gunModel.toString().padStart(2, "0")}`;
|
|
||||||
const maskEnabled =
|
|
||||||
tankParameters.maskSlice?.[maskName]?.enabled ?? false;
|
|
||||||
let mask: number | undefined;
|
|
||||||
|
|
||||||
if (maskEnabled) {
|
|
||||||
const maskRaw = tankParameters.maskSlice![maskName]!;
|
|
||||||
mask = maskRaw.planePosition[1];
|
|
||||||
} else {
|
|
||||||
mask = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(gun.armor)
|
|
||||||
.filter((name) => name.startsWith("armor_"))
|
|
||||||
.forEach((name) => {
|
|
||||||
const armorIdString = name.match(/armor_(\d+)/)?.[1];
|
|
||||||
if (armorIdString === undefined) {
|
|
||||||
throw new SyntaxError(`Invalid armor id: ${name}`);
|
|
||||||
}
|
|
||||||
const armorId = parseInt(armorIdString);
|
|
||||||
const armorRaw = gun.armor[name];
|
|
||||||
|
|
||||||
this.assignArmor(armorRaw, armorId, gunArmor);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelDefinitions.models[tankId].turrets[turretId].guns[gunId] = {
|
|
||||||
armor: gunArmor,
|
|
||||||
model_id: gunModel,
|
|
||||||
mask,
|
|
||||||
thickness:
|
|
||||||
gun.armor.gun === undefined
|
|
||||||
? 0
|
|
||||||
: typeof gun.armor.gun === "number"
|
|
||||||
? gun.armor.gun
|
|
||||||
: gun.armor.gun["#text"],
|
|
||||||
pitch: {
|
|
||||||
min: gunPitch[0],
|
|
||||||
max: gunPitch[1],
|
|
||||||
|
|
||||||
front: front
|
|
||||||
? {
|
|
||||||
min: front[0],
|
|
||||||
max: front[1],
|
|
||||||
range: front[2],
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
back: back
|
|
||||||
? {
|
|
||||||
min: back[0],
|
|
||||||
max: back[1],
|
|
||||||
range: back[2],
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
transition,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return modelDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import { MapDefinitions } from "@blitzkit/protos";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI3 } from "./3_models";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI4 extends ServerBlitzKitAPI3 {
|
|
||||||
@Cache()
|
|
||||||
async maps() {
|
|
||||||
const mapDefinitions = MapDefinitions.create();
|
|
||||||
|
|
||||||
for (const key in this.mapsYaml!.maps) {
|
|
||||||
const map = this.mapsYaml!.maps[key];
|
|
||||||
|
|
||||||
mapDefinitions.maps[map.id] = {
|
|
||||||
id: map.id,
|
|
||||||
name: this.getString(`#maps:${key}:${map.localName}`),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return mapDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
import { EquipmentDefinitions, EquipmentSlot } from "@blitzkit/protos";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI4 } from "./4_maps";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI5 extends ServerBlitzKitAPI4 {
|
|
||||||
@Cache()
|
|
||||||
async equipment() {
|
|
||||||
const equipmentDefinitions = EquipmentDefinitions.create();
|
|
||||||
|
|
||||||
Object.entries(this.optionalDevices!.root).forEach(
|
|
||||||
([optionalDeviceKey, optionalDeviceEntry]) => {
|
|
||||||
if (optionalDeviceKey === "nextAvailableId") return;
|
|
||||||
|
|
||||||
equipmentDefinitions.equipments[optionalDeviceEntry.id] = {
|
|
||||||
name: this.getString(optionalDeviceEntry.userString),
|
|
||||||
description: this.getString(optionalDeviceEntry.description),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Object.entries(this.optionalDeviceSlots!.root.presets).forEach(
|
|
||||||
([optionalDeviceSlotKey, optionalDeviceSlotEntry]) => {
|
|
||||||
if (optionalDeviceSlotKey === "emptyPreset") return;
|
|
||||||
|
|
||||||
equipmentDefinitions.presets[optionalDeviceSlotKey] = {
|
|
||||||
slots: Object.values(optionalDeviceSlotEntry)
|
|
||||||
.map((level) => {
|
|
||||||
return Object.values(level).map((options) => {
|
|
||||||
return {
|
|
||||||
options: [
|
|
||||||
this.optionalDevices!.root[options.device0].id,
|
|
||||||
this.optionalDevices!.root[options.device1].id,
|
|
||||||
],
|
|
||||||
} satisfies EquipmentSlot;
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.flat(),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return equipmentDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
import { BlitzTankFilterDefinitionCategory } from "@blitzkit/core";
|
|
||||||
import { Consumable, ConsumableDefinitions } from "@blitzkit/protos";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI5 } from "./5_equipments";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI6 extends ServerBlitzKitAPI5 {
|
|
||||||
@Cache()
|
|
||||||
async consumables() {
|
|
||||||
const consumableDefinitions = ConsumableDefinitions.create();
|
|
||||||
|
|
||||||
Object.entries(this.consumablesCommon).forEach(([, consumable]) => {
|
|
||||||
const entry: Consumable = {
|
|
||||||
id: consumable.id,
|
|
||||||
game_mode_exclusive: "gameModeFilter" in consumable,
|
|
||||||
name: this.getString(consumable.userString),
|
|
||||||
exclude: [],
|
|
||||||
include: [],
|
|
||||||
};
|
|
||||||
consumableDefinitions.consumables[consumable.id] = entry;
|
|
||||||
|
|
||||||
const includeRaw = consumable.vehicleFilter?.include.vehicle;
|
|
||||||
const excludeRaw = consumable.vehicleFilter?.exclude?.vehicle;
|
|
||||||
|
|
||||||
if (includeRaw) {
|
|
||||||
entry.include = [];
|
|
||||||
|
|
||||||
if ("minLevel" in includeRaw) {
|
|
||||||
entry.include.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "tiers",
|
|
||||||
value: {
|
|
||||||
min: includeRaw.minLevel,
|
|
||||||
max: includeRaw.maxLevel,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else if ("name" in includeRaw) {
|
|
||||||
entry.include.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "ids",
|
|
||||||
value: {
|
|
||||||
ids: includeRaw.name.split(/ +/).map((key) => {
|
|
||||||
return this.tankStringIdMap[key];
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else throw new SyntaxError("Unhandled include type");
|
|
||||||
|
|
||||||
if (consumable.vehicleFilter?.include.nations) {
|
|
||||||
entry.include.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "nations",
|
|
||||||
value: {
|
|
||||||
nations: consumable.vehicleFilter.include.nations.split(" "),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (excludeRaw) {
|
|
||||||
entry.exclude = [];
|
|
||||||
|
|
||||||
if ("name" in excludeRaw) {
|
|
||||||
entry.exclude!.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "ids",
|
|
||||||
value: {
|
|
||||||
ids: excludeRaw.name.split(/ +/).map((key) => {
|
|
||||||
return this.tankStringIdMap[key];
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else if ("extendedTags" in excludeRaw) {
|
|
||||||
entry.exclude!.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "categories",
|
|
||||||
value: {
|
|
||||||
categories: excludeRaw.extendedTags
|
|
||||||
.split(" ")
|
|
||||||
.map(
|
|
||||||
(item) =>
|
|
||||||
this.blitzTankFilterDefinitionCategoryToBlitzkit[
|
|
||||||
item as BlitzTankFilterDefinitionCategory
|
|
||||||
],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else throw new SyntaxError("Unhandled exclude type");
|
|
||||||
|
|
||||||
if (consumable.vehicleFilter?.exclude?.nations) {
|
|
||||||
entry.exclude!.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "nations",
|
|
||||||
value: {
|
|
||||||
nations: consumable.vehicleFilter.exclude.nations.split(" "),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return consumableDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
import { BlitzTankFilterDefinitionCategory } from "@blitzkit/core";
|
|
||||||
import { Provision, ProvisionDefinitions } from "@blitzkit/protos";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI6 } from "./6_consumables";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI7 extends ServerBlitzKitAPI6 {
|
|
||||||
@Cache()
|
|
||||||
async provisions() {
|
|
||||||
const provisionDefinitions = ProvisionDefinitions.create();
|
|
||||||
|
|
||||||
Object.entries(this.provisionsCommon).forEach(([, provision]) => {
|
|
||||||
const entry = Provision.create({
|
|
||||||
id: provision.id,
|
|
||||||
exclude: [],
|
|
||||||
include: [],
|
|
||||||
game_mode_exclusive: "gameModeFilter" in provision,
|
|
||||||
name: this.getString(provision.userString),
|
|
||||||
});
|
|
||||||
provisionDefinitions.provisions[provision.id] = entry;
|
|
||||||
|
|
||||||
const includeRaw = provision.vehicleFilter?.include.vehicle;
|
|
||||||
const excludeRaw = provision.vehicleFilter?.exclude?.vehicle;
|
|
||||||
|
|
||||||
if (includeRaw) {
|
|
||||||
entry.include = [];
|
|
||||||
|
|
||||||
if ("minLevel" in includeRaw) {
|
|
||||||
entry.include.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "tiers",
|
|
||||||
value: {
|
|
||||||
min: includeRaw.minLevel,
|
|
||||||
max: includeRaw.maxLevel,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else if ("name" in includeRaw) {
|
|
||||||
entry.include.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "ids",
|
|
||||||
value: {
|
|
||||||
ids: includeRaw.name.split(/ +/).map((key) => {
|
|
||||||
return this.tankStringIdMap[key];
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else throw new SyntaxError("Unhandled include type");
|
|
||||||
|
|
||||||
if (provision.vehicleFilter?.include.nations) {
|
|
||||||
entry.include.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "nations",
|
|
||||||
value: {
|
|
||||||
nations: provision.vehicleFilter.include.nations.split(" "),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (excludeRaw) {
|
|
||||||
entry.exclude = [];
|
|
||||||
|
|
||||||
if ("name" in excludeRaw) {
|
|
||||||
entry.exclude!.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "ids",
|
|
||||||
value: {
|
|
||||||
ids: excludeRaw.name
|
|
||||||
.split(/ +/)
|
|
||||||
.map((key) => this.tankStringIdMap[key]),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else if ("extendedTags" in excludeRaw) {
|
|
||||||
entry.exclude!.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "categories",
|
|
||||||
value: {
|
|
||||||
categories: excludeRaw.extendedTags
|
|
||||||
.split(" ")
|
|
||||||
.map(
|
|
||||||
(item) =>
|
|
||||||
this.blitzTankFilterDefinitionCategoryToBlitzkit[
|
|
||||||
item as BlitzTankFilterDefinitionCategory
|
|
||||||
],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else throw new SyntaxError("Unhandled exclude type");
|
|
||||||
|
|
||||||
if (provision.vehicleFilter?.exclude?.nations) {
|
|
||||||
entry.exclude!.push({
|
|
||||||
filter_type: {
|
|
||||||
$case: "nations",
|
|
||||||
value: {
|
|
||||||
nations: provision.vehicleFilter.exclude.nations.split(" "),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return provisionDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { BlitzTankClass } from "@blitzkit/core";
|
|
||||||
|
|
||||||
import { SkillDefinitions } from "@blitzkit/protos";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI7 } from "./7_provisions";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI8 extends ServerBlitzKitAPI7 {
|
|
||||||
@Cache()
|
|
||||||
async skills() {
|
|
||||||
const skillDefinitions = SkillDefinitions.create();
|
|
||||||
|
|
||||||
for (const tankClass in this.tankmenAvatar!.root.skillsByClasses) {
|
|
||||||
const skills = this.tankmenAvatar!.root.skillsByClasses[tankClass];
|
|
||||||
|
|
||||||
skillDefinitions.classes[
|
|
||||||
this.blitzTankClassToBlitzkit[tankClass as BlitzTankClass]
|
|
||||||
] = { skills: skills.split(" ") };
|
|
||||||
}
|
|
||||||
|
|
||||||
return skillDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import { AvailableNationsYaml } from "@blitzkit/core";
|
|
||||||
|
|
||||||
import { GameDefinitions } from "@blitzkit/protos";
|
|
||||||
import { Cache } from "./0_base";
|
|
||||||
import { ServerBlitzKitAPI8 } from "./8_skills";
|
|
||||||
|
|
||||||
export abstract class ServerBlitzKitAPI9 extends ServerBlitzKitAPI8 {
|
|
||||||
@Cache()
|
|
||||||
async game() {
|
|
||||||
const gameDefinitions = GameDefinitions.create();
|
|
||||||
|
|
||||||
const consumableNativeNames: Record<string, number> = {};
|
|
||||||
const provisionNativeNames: Record<string, number> = {};
|
|
||||||
|
|
||||||
Object.entries(this.consumablesCommon).forEach(([key, consumable]) => {
|
|
||||||
consumableNativeNames[key] = consumable.id;
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.entries(this.provisionsCommon).forEach(([key, provision]) => {
|
|
||||||
provisionNativeNames[key] = provision.id;
|
|
||||||
});
|
|
||||||
|
|
||||||
const version = (await this.vfs.text("Data/version.txt")).split(" ")[0];
|
|
||||||
|
|
||||||
gameDefinitions.version = version;
|
|
||||||
gameDefinitions.nations = (
|
|
||||||
await this.vfs.yaml<AvailableNationsYaml>("Data/available_nations.yaml")
|
|
||||||
).available_nations;
|
|
||||||
|
|
||||||
for (const match of this.squadBattleTypeStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
|
||||||
/eGameMode\.(\w+) -> "(battleType\/([a-zA-Z]+))"/g,
|
|
||||||
)) {
|
|
||||||
const id = match[1];
|
|
||||||
const name = this.getString(match[2]);
|
|
||||||
|
|
||||||
gameDefinitions.gameModes[id] = {
|
|
||||||
name,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.entries(this.combatRoles!).forEach(([, value]) => {
|
|
||||||
gameDefinitions.roles[value.id] = { provisions: [], consumables: [] };
|
|
||||||
|
|
||||||
value.default_abilities.forEach((ability) => {
|
|
||||||
if (ability in consumableNativeNames) {
|
|
||||||
gameDefinitions.roles[value.id].consumables.push(
|
|
||||||
consumableNativeNames[ability],
|
|
||||||
);
|
|
||||||
} else if (ability in provisionNativeNames) {
|
|
||||||
gameDefinitions.roles[value.id].provisions.push(
|
|
||||||
provisionNativeNames[ability],
|
|
||||||
);
|
|
||||||
} else throw new Error(`Unknown ability ${ability}`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return gameDefinitions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import { ServerBlitzKitAPI12 } from "./12_strings";
|
|
||||||
|
|
||||||
export class ServerBlitzKitAPI extends ServerBlitzKitAPI12 {}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
export function assertSecret(secret?: string) {
|
|
||||||
if (secret === undefined) throw new Error("Missing secret");
|
|
||||||
return secret;
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,12 @@
|
|||||||
import {
|
import { GunDefinition, ProvisionDefinitions, TankDefinition } from "../protos";
|
||||||
GunDefinition,
|
import { checkConsumableProvisionInclusivity } from "./checkConsumableProvisionInclusivity";
|
||||||
ProvisionDefinitions,
|
|
||||||
TankDefinition,
|
|
||||||
} from "../../../protos/src/blitzkit";
|
|
||||||
import { isTankCompatible } from "../tankopedia";
|
|
||||||
|
|
||||||
export function availableProvisions(
|
export function availableProvisions(
|
||||||
tank: TankDefinition,
|
tank: TankDefinition,
|
||||||
gun: GunDefinition,
|
gun: GunDefinition,
|
||||||
provisionDefinitions: ProvisionDefinitions,
|
provisionDefinitions: ProvisionDefinitions
|
||||||
) {
|
) {
|
||||||
return Object.values(provisionDefinitions.provisions).filter((provision) =>
|
return Object.values(provisionDefinitions.provisions).filter((provision) =>
|
||||||
isTankCompatible(tank, gun, provision.include, provision.exclude),
|
checkConsumableProvisionInclusivity(provision, tank, gun)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+8
-8
@@ -1,17 +1,17 @@
|
|||||||
import {
|
import {
|
||||||
|
Consumable,
|
||||||
ConsumableTankCategoryFilterCategory,
|
ConsumableTankCategoryFilterCategory,
|
||||||
GunDefinition,
|
GunDefinition,
|
||||||
|
Provision,
|
||||||
TankDefinition,
|
TankDefinition,
|
||||||
TankInclusivityFilter,
|
} from "../protos";
|
||||||
} from "@blitzkit/protos";
|
|
||||||
|
|
||||||
export function isTankCompatible(
|
export function checkConsumableProvisionInclusivity(
|
||||||
|
consumableProvision: Consumable | Provision,
|
||||||
tank: TankDefinition,
|
tank: TankDefinition,
|
||||||
gun: GunDefinition,
|
gun: GunDefinition,
|
||||||
include?: TankInclusivityFilter[],
|
|
||||||
exclude?: TankInclusivityFilter[],
|
|
||||||
) {
|
) {
|
||||||
const included = include?.every((rule) => {
|
const included = consumableProvision.include?.every((rule) => {
|
||||||
switch (rule.filter_type!.$case) {
|
switch (rule.filter_type!.$case) {
|
||||||
case "tiers":
|
case "tiers":
|
||||||
return (
|
return (
|
||||||
@@ -29,7 +29,7 @@ export function isTankCompatible(
|
|||||||
throw new SyntaxError("Category filtering found in include rule");
|
throw new SyntaxError("Category filtering found in include rule");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const excluded = exclude?.some((rule) => {
|
const excluded = consumableProvision.exclude?.some((rule) => {
|
||||||
switch (rule.filter_type!.$case) {
|
switch (rule.filter_type!.$case) {
|
||||||
case "tiers":
|
case "tiers":
|
||||||
return (
|
return (
|
||||||
@@ -53,5 +53,5 @@ export function isTankCompatible(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return include !== undefined && include?.length > 0 && included && !excluded;
|
return consumableProvision.include?.length > 0 && included && !excluded;
|
||||||
}
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { SkillDefinitions } from "@blitzkit/protos";
|
|
||||||
import { createDefaultSkills } from "./createDefaultSkills";
|
|
||||||
import { TankEnvironment } from "./tankEnvironment";
|
|
||||||
|
|
||||||
export function createDefaultEnvironment(skills: SkillDefinitions) {
|
|
||||||
return {
|
|
||||||
equalize: false,
|
|
||||||
distance: 0,
|
|
||||||
skills: createDefaultSkills(skills),
|
|
||||||
} satisfies TankEnvironment;
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
import {
|
import { GunDefinition, ProvisionDefinitions, TankDefinition } from '../protos';
|
||||||
GunDefinition,
|
import { availableProvisions } from './availableProvisions';
|
||||||
ProvisionDefinitions,
|
|
||||||
TankDefinition,
|
|
||||||
} from "@blitzkit/protos";
|
|
||||||
import { BlitzScripts } from "../types/blitzScripts";
|
|
||||||
import { availableProvisions } from "./availableProvisions";
|
|
||||||
|
|
||||||
const PROVISION_PREFERENCES = [
|
const PROVISION_PREFERENCES = [
|
||||||
19, // improved fuel
|
19, // improved fuel
|
||||||
@@ -19,10 +14,9 @@ function infinityFallback(value: number) {
|
|||||||
export function createDefaultProvisions(
|
export function createDefaultProvisions(
|
||||||
tank: TankDefinition,
|
tank: TankDefinition,
|
||||||
gun: GunDefinition,
|
gun: GunDefinition,
|
||||||
provisions: ProvisionDefinitions,
|
provisionDefinitions: ProvisionDefinitions,
|
||||||
scripts: BlitzScripts,
|
|
||||||
) {
|
) {
|
||||||
const provisionsList = availableProvisions(tank, gun, provisions);
|
const provisionsList = availableProvisions(tank, gun, provisionDefinitions);
|
||||||
|
|
||||||
return provisionsList
|
return provisionsList
|
||||||
.sort(
|
.sort(
|
||||||
@@ -30,11 +24,7 @@ export function createDefaultProvisions(
|
|||||||
infinityFallback(PROVISION_PREFERENCES.indexOf(a.id)) -
|
infinityFallback(PROVISION_PREFERENCES.indexOf(a.id)) -
|
||||||
infinityFallback(PROVISION_PREFERENCES.indexOf(b.id)),
|
infinityFallback(PROVISION_PREFERENCES.indexOf(b.id)),
|
||||||
)
|
)
|
||||||
.sort(
|
.sort((a, b) => (b.crew ?? 0) - (a.crew ?? 0))
|
||||||
(a, b) =>
|
|
||||||
(scripts.provisions[b.id].bonusValues?.crewLevelIncrease ?? 0) -
|
|
||||||
(scripts.provisions[a.id].bonusValues?.crewLevelIncrease ?? 0),
|
|
||||||
)
|
|
||||||
.slice(0, tank.max_provisions)
|
.slice(0, tank.max_provisions)
|
||||||
.map(({ id }) => id);
|
.map(({ id }) => id);
|
||||||
}
|
}
|
||||||
Loaded 100 of 1056 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user