mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
add compatibility for string game mode ids
This commit is contained in:
1 parent
84f950ade4
commit
347efa75fe
22 files changed
+394
-740
No files matched your search
@@ -45,14 +45,13 @@ const consumableDefinitions = await api.consumableDefinitions();
|
||||
const provisionDefinitions = await api.provisionDefinitions();
|
||||
const tankDefinitions = await api.tankDefinitions();
|
||||
|
||||
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);
|
||||
@@ -63,7 +62,7 @@ for (const tankIdString in tankDefinitions.tanks) {
|
||||
}
|
||||
|
||||
const gameModeRoles: {
|
||||
gameModeId: number;
|
||||
gameModeId: string;
|
||||
consumables: number[];
|
||||
provisions: number[];
|
||||
}[] = [];
|
||||
@@ -72,8 +71,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>();
|
||||
|
||||
@@ -116,7 +114,7 @@ for (const gameModeIdString in gameModeRoleSets) {
|
||||
}
|
||||
|
||||
gameModeRoles.push({
|
||||
gameModeId: gameModeId,
|
||||
gameModeId: gameModeIdString,
|
||||
consumables: Array.from(consumables.values()),
|
||||
provisions: Array.from(provisions.values()),
|
||||
});
|
||||
|
||||
@@ -25,8 +25,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