mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
Merge branch 'main' into data-driven
This commit is contained in:
commit
4fc57d7fc1
9 files changed
+22
-22
No files matched your search
@@ -0,0 +1,3 @@
|
||||
# BlitzKit 1.31.3
|
||||
|
||||
This update updates BlitzKit to work with the game's new ID system for game modes.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blitzkit",
|
||||
"version": "1.31.2",
|
||||
"version": "1.31.3",
|
||||
"license": "BlitzKit License",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -50,10 +50,11 @@ export abstract class ServerBlitzKitAPI1 extends ServerBlitzKitAPI0 {
|
||||
async tanks() {
|
||||
const tankDefinitions = TankDefinitions.create();
|
||||
|
||||
const gameModeNativeNames: Record<string, number> = {};
|
||||
const gameModeNativeNames: Record<string, string> = {};
|
||||
|
||||
const squadBattleTypeGameModeNativeNameMatches =
|
||||
this.squadBattleTypeStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g,
|
||||
/eGameMode\.(\w+) -> "(battleType\/([a-zA-Z]+))"/g,
|
||||
);
|
||||
const gameTypeGameModeNativeNameMatches =
|
||||
this.gameTypeSelectorStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
@@ -61,8 +62,7 @@ export abstract class ServerBlitzKitAPI1 extends ServerBlitzKitAPI0 {
|
||||
);
|
||||
|
||||
for (const match of squadBattleTypeGameModeNativeNameMatches) {
|
||||
const id = Number(match[1]);
|
||||
gameModeNativeNames[match[3]] = id;
|
||||
gameModeNativeNames[match[3]] = match[1];
|
||||
}
|
||||
|
||||
for (const match of gameTypeGameModeNativeNameMatches) {
|
||||
|
||||
@@ -27,9 +27,9 @@ export abstract class ServerBlitzKitAPI9 extends ServerBlitzKitAPI8 {
|
||||
).available_nations;
|
||||
|
||||
for (const match of this.squadBattleTypeStyles!.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/"(\d+)" -> "(battleType\/([a-zA-Z]+))"/g,
|
||||
/eGameMode\.(\w+) -> "(battleType\/([a-zA-Z]+))"/g,
|
||||
)) {
|
||||
const id = Number(match[1]);
|
||||
const id = match[1];
|
||||
const name = this.getString(match[2]);
|
||||
|
||||
gameDefinitions.gameModes[id] = {
|
||||
|
||||
@@ -7,7 +7,7 @@ import "i18n.proto";
|
||||
message GameDefinitions {
|
||||
required string version = 1;
|
||||
repeated string nations = 2;
|
||||
map<uint32, GameMode> gameModes = 3;
|
||||
map<string, GameMode> gameModes = 3;
|
||||
map<uint32, GameModeRole> roles = 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ message TankDefinitions {
|
||||
message TankDefinition {
|
||||
required uint32 id = 1;
|
||||
required string slug = 2;
|
||||
map<uint32, uint32> roles = 3;
|
||||
map<string, uint32> roles = 3;
|
||||
required bool fixed_camouflage = 5;
|
||||
repeated int32 camouflages = 6;
|
||||
repeated int32 ancestors = 7;
|
||||
|
||||
@@ -42,14 +42,13 @@ const consumableDefinitions = await api.consumables();
|
||||
const provisionDefinitions = await api.provisions();
|
||||
const tankDefinitions = await api.tanks();
|
||||
|
||||
const gameModeRoleSets: Record<number, Set<number>> = {};
|
||||
const gameModeRoleSets: Record<string, Set<number>> = {};
|
||||
|
||||
for (const tankIdString in tankDefinitions.tanks) {
|
||||
const gameMode = tankDefinitions.tanks[tankIdString];
|
||||
|
||||
for (const gameModeIdString in gameMode.roles) {
|
||||
const role = gameMode.roles[gameModeIdString];
|
||||
const gameModeId = Number(gameModeIdString);
|
||||
for (const gameModeId in gameMode.roles) {
|
||||
const role = gameMode.roles[gameModeId];
|
||||
|
||||
if (gameModeId in gameModeRoleSets) {
|
||||
gameModeRoleSets[gameModeId].add(role);
|
||||
@@ -60,7 +59,7 @@ for (const tankIdString in tankDefinitions.tanks) {
|
||||
}
|
||||
|
||||
const gameModeRoles: {
|
||||
gameModeId: number;
|
||||
gameModeId: string;
|
||||
consumables: number[];
|
||||
provisions: number[];
|
||||
}[] = [];
|
||||
@@ -69,8 +68,7 @@ const allGameModeConsumables = new Set<number>();
|
||||
const allGameModeProvisions = new Set<number>();
|
||||
|
||||
for (const gameModeIdString in gameModeRoleSets) {
|
||||
const gameModeId = Number(gameModeIdString);
|
||||
const roles = gameModeRoleSets[gameModeId];
|
||||
const roles = gameModeRoleSets[gameModeIdString];
|
||||
const consumables = new Set<number>();
|
||||
const provisions = new Set<number>();
|
||||
|
||||
@@ -113,7 +111,7 @@ for (const gameModeIdString in gameModeRoleSets) {
|
||||
}
|
||||
|
||||
gameModeRoles.push({
|
||||
gameModeId: gameModeId,
|
||||
gameModeId: gameModeIdString,
|
||||
consumables: Array.from(consumables.values()),
|
||||
provisions: Array.from(provisions.values()),
|
||||
});
|
||||
|
||||
@@ -21,8 +21,7 @@ export function GameModeSection() {
|
||||
</Heading>
|
||||
|
||||
<Flex justify="center" gap="4" wrap="wrap" px="4">
|
||||
{roles.map(([key, value]) => {
|
||||
const id = Number(key);
|
||||
{roles.map(([id, value]) => {
|
||||
const gameMode = gameDefinitions.gameModes[id];
|
||||
|
||||
return (
|
||||
|
||||
@@ -17,15 +17,15 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||
const bannerMatches: { name: string; path: string }[] = [];
|
||||
|
||||
for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/eGameMode\.([a-zA-Z]+) -> "~res:([^"]+)"/g,
|
||||
/eGameMode\.(\w+) -> "~res:([^"]+)"/g,
|
||||
)) {
|
||||
bannerMatches.push({ name: match[1], path: match[2] });
|
||||
}
|
||||
|
||||
for (const match of squadBattleTypeStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/"(\d+)" -> "battleType\/([a-zA-Z]+)"/g,
|
||||
/eGameMode\.(\w+) -> "battleType\/([a-zA-Z]+)"/g,
|
||||
)) {
|
||||
const id = Number(match[1]);
|
||||
const id = match[1];
|
||||
const name = match[2];
|
||||
let path = bannerMatches.find(
|
||||
(bannerMatch) => bannerMatch.name.toLowerCase() === name.toLowerCase(),
|
||||
|
||||
Reference in new issue
Block a user