Gear ids and translations

This commit is contained in:
Kalle 2022-08-28 18:05:36 +03:00
parent 3c67aeac63
commit ea9fda5cb5
6 changed files with 326 additions and 3 deletions

View File

@ -0,0 +1,23 @@
export const headGearIds = [
1, 1000, 1002, 1003, 1005, 1012, 1020, 1021, 1028, 1036, 2008, 3001, 3003,
3008, 3009, 3011, 3012, 3016, 3021, 3025, 3026, 3027, 4004, 4008, 4015, 4016,
4017, 5001, 5004, 5007, 5008, 6001, 6003, 6004, 7007, 7012, 7013, 7014, 8005,
8008, 8011, 8014, 8016, 9003, 9007, 9009,
] as const;
export const clothesGearIds = [
1001, 1004, 1005, 1006, 1013, 1014, 1015, 1016, 1018, 1019, 1020, 1021, 1035,
1062, 1066, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1082, 1083,
1084, 1085, 1088, 1091, 2004, 3000, 3001, 3006, 3008, 3009, 4004, 4005, 4009,
4010, 5000, 5001, 5006, 5014, 5015, 5019, 5023, 5045, 5046, 5047, 5048, 5049,
5050, 5051, 5054, 6000, 6008, 7001, 7010, 7016, 7017, 7018, 8000, 8003, 8005,
8012, 8017, 8018, 8019, 8020, 8024, 8025, 8030, 8031, 8033, 8034, 8036, 8040,
9010, 9011, 10006, 10012,
] as const;
export const shoesGearIds = [
1000, 1008, 1009, 1021, 1022, 1024, 2000, 2001, 2004, 2005, 2016, 2017, 2018,
2042, 2043, 2045, 3001, 3004, 3013, 3020, 3022, 3023, 3024, 3025, 4000, 4001,
4007, 4008, 4009, 4011, 4012, 4015, 4016, 4017, 4021, 4022, 5000, 5001, 6000,
6001, 6006, 6007, 6012, 6021, 7002, 8010, 8013, 8014,
] as const;

View File

@ -1,4 +1,5 @@
export { stages } from "./stages";
export { modes, modesShort } from "./modes";
export { weaponIds } from "./weapon-ids";
export { headGearIds, clothesGearIds, shoesGearIds } from "./gear-ids";
export type { ModeShort, Stage } from "./types";

178
public/locales/en/gear.json Normal file
View File

@ -0,0 +1,178 @@
{
"H_1": "White Headband",
"H_1000": "Urchins Cap",
"S_1000": "Blue Lo-Tops",
"C_1001": "Black Squideye",
"H_1002": "Takoroka Mesh",
"H_1003": "Streetstyle Cap",
"C_1004": "Rockenberg White",
"H_1005": "Squidvader Cap",
"C_1005": "Rockenberg Black",
"C_1006": "Black Tee",
"S_1008": "White 3-Straps",
"S_1009": "Red 3-Straps",
"H_1012": "Cycling Cap",
"C_1013": "Red Vector Tee",
"C_1014": "Gray Vector Tee",
"C_1015": "Blue Peaks Tee",
"C_1016": "Ivory Peaks Tee",
"C_1018": "Pirate-Stripe Tee",
"C_1019": "Sailor-Stripe Tee",
"H_1020": "Hickory Work Cap",
"C_1020": "White 8-Bit FishFry",
"H_1021": "Woolly Urchins Classic",
"C_1021": "Black 8-Bit FishFry",
"S_1021": "Wasabi Tabi",
"S_1022": "Suede Basics",
"S_1024": "Suede Bosses",
"H_1028": "Ink-Black Flap Cap",
"C_1035": "White V-Neck Tee",
"H_1036": "Wharfside Cap",
"C_1062": "Tri-Shred Tee",
"C_1066": "Annaki Choker Tee",
"C_1069": "Blue Retro Tee",
"C_1070": "Tan Retro Tee",
"C_1071": "Barazushi Wrap",
"C_1072": "Barazushi Rice Tee",
"C_1073": "Barazushi Black Tee",
"C_1074": "Barazushi Sakura Tee",
"C_1075": "Octosquid Tandem Tee",
"C_1076": "Tri-Squid Tee",
"C_1077": "Tri-Octo Tee",
"C_1082": "Pineapple Ringer",
"C_1083": "Apple Ringer",
"C_1084": "Vaporwave Tee",
"C_1085": "Duskwave Tee",
"C_1088": "Eelzebub Tee",
"C_1091": "Berry BlobMob Tee",
"S_2000": "Red Hi-Horses",
"S_2001": "Zombie Hi-Horses",
"C_2004": "Zekko Baseball LS",
"S_2004": "Hunter Hi-Tops",
"S_2005": "Red Hi-Tops",
"H_2008": "Knitted Hat",
"S_2016": "Sunset Orca Hi-Tops",
"S_2017": "Red & Black Squidkid IV",
"S_2018": "Blue & Black Squidkid IV",
"S_2042": "Force ReBoots",
"S_2043": "Tenya OctoReds",
"S_2045": "Pearl 01STERs",
"C_3000": "White Layered LS",
"H_3001": "Splash Goggles",
"C_3001": "Yellow Layered LS",
"S_3001": "Orange Arrows",
"H_3003": "Tinted Shades",
"S_3004": "Cyan Trainers",
"C_3006": "Choco Layered LS",
"H_3008": "18K Aviators",
"C_3008": "Layered Vector LS",
"H_3009": "Full-Moon Glasses",
"C_3009": "Green Tee",
"H_3011": "Half-Rim Glasses",
"H_3012": "Double Egg Shades",
"S_3013": "Arrow Pull-Ons",
"H_3016": "Swim Goggles",
"S_3020": "U Jellys",
"H_3021": "Ink-Tinted Goggles",
"S_3022": "Turbo Tabi Red",
"S_3023": "E-JECT 30XX",
"S_3024": "Slamgerine Slip-Ons",
"H_3025": "Invisifloats",
"S_3025": "Mako Bucket Hi-Tops",
"H_3026": "Moto Shades",
"H_3027": "Annaki Charms",
"S_4000": "Oyster Clogs",
"S_4001": "Choco Clogs",
"H_4004": "Bamboo Hat",
"C_4004": "Black Polo",
"C_4005": "Cycling Shirt",
"S_4007": "Neon Delta Straps",
"H_4008": "Bucket Hat",
"S_4008": "Black Flip-Flops",
"C_4009": "Rugby King 10",
"S_4009": "Snow Delta Straps",
"C_4010": "Rugby King 08",
"S_4011": "Red FishFry Sandals",
"S_4012": "Yellow FishFry Sandals",
"H_4015": "Classic Bowler",
"S_4015": "Arrow Toesies Blu",
"H_4016": "Jean Dream Bucket",
"S_4016": "BlobMob Flip-Flops",
"H_4017": "Howdy Hat",
"S_4017": "Orange Dadfoot Sandals",
"S_4021": "Pink Dadfoot Sandals",
"S_4022": "Cyan Dadfoot Sandals",
"C_5000": "Olive Ski Jacket",
"S_5000": "Trail Boots",
"H_5001": "Designer Headphones",
"C_5001": "Takoroka Nylon Vintage",
"S_5001": "Custom Trail Boots",
"H_5004": "Squidlife Headphones",
"C_5006": "Black Inky Rider",
"H_5007": "Ocho OctoPhones",
"H_5008": "Cephalo Pods",
"C_5014": "Squid Satin Jacket",
"C_5015": "Zapfish Satin Jacket",
"C_5019": "Matcha Down Jacket",
"C_5023": "Kensa Coat",
"C_5045": "Arctic Monster Parka",
"C_5046": "Barazushi Anorak",
"C_5047": "Patchwork Bomber",
"C_5048": "Airflow & Hustle Jacket",
"C_5049": "Ink-Black Paddle Jack",
"C_5050": "Orca Bolero",
"C_5051": "Cream Tundra Fleece",
"C_5054": "Dusty Field Jacket",
"C_6000": "B-ball Jersey (Home)",
"S_6000": "Moto Boots",
"H_6001": "FishFry Visor",
"S_6001": "Tan Work Boots",
"H_6003": "Takoroka Visor",
"H_6004": "Face Visor",
"S_6006": "Punk Whites",
"S_6007": "Punk Cherries",
"C_6008": "Umibozu Home Jersey",
"S_6012": "Hunting Boots",
"S_6021": "Arctic Duck Boots",
"C_7001": "Squidmark Sweat",
"S_7002": "Squid-Stitch Slip-Ons",
"H_7007": "Hockey Helmet",
"C_7010": "Annaki Blue Cuff",
"H_7012": "Winkle Stripe Helm",
"H_7013": "Party Hard Hat",
"H_7014": "Home-Team Catcher",
"C_7016": "Manatee Swag Sweat",
"C_7017": "Apex Sweater",
"C_7018": "Octo Jumper Away",
"C_8000": "Lumberjack Shirt",
"C_8003": "White Shirt",
"H_8005": "Annaki Mask",
"C_8005": "Aloha Shirt",
"H_8008": "Firefin Facemask",
"S_8010": "Annaki Habaneros",
"H_8011": "Forge Mask",
"C_8012": "Logo Aloha Shirt",
"S_8013": "Desert Chukkas",
"H_8014": "BlobMob Mask",
"S_8014": "Dark-Roast Boaties",
"H_8016": "Squidbeak Shield",
"C_8017": "Hula Punk Shirt",
"C_8018": "Octobowler Shirt",
"C_8019": "Inkfall Shirt",
"C_8020": "U Jellys",
"C_8024": "Slamgerine Slip-Ons",
"C_8025": "Mako Bucket Hi-Tops",
"C_8030": "Seahorse Shoreliner",
"C_8031": "Button-Clown Shirt",
"C_8033": "Business Animal",
"C_8034": "Fancyfish Stitch",
"C_8036": "Fashion Splash Shirt",
"C_8040": "Urban Upcycle Top",
"H_9003": "Tennis Headband",
"H_9007": "FishFry Biscuit Bandana",
"H_9009": "Squidband",
"C_9010": "Khaki Ranger Vest",
"C_9011": "Red Battlecrab Shell",
"C_10006": "Gray Hoodie",
"C_10012": "Sudadera Roja"
}

View File

@ -1,8 +1,10 @@
This folder has scripts that can be used run time for admin only actions or to prepare some data.
#### `create-weapon-json.ts`
#### `create-weapon-json.ts` & `create-gear-json.ts`
Before using this script you need to copy some files from another repository.
1. Move .json files matching wanted languages from https://github.com/Leanny/leanny.github.io/tree/master/splat3/data/language to /scripts/dicts/langs
2. Move WeaponInfoMain.json from https://github.com/Leanny/leanny.github.io/blob/master/splat3/data/mush/099/WeaponInfoMain.json to /scripts/dicts
1. Copy all .json files from https://github.com/Leanny/leanny.github.io/tree/master/splat3/data/language to /scripts/dicts/langs
2. Move `WeaponInfoMain.json`, `GearInfoClothes.json`, `GearInfoShoes.json` & `GearInfoHead.json` from https://github.com/Leanny/leanny.github.io/blob/master/splat3/data/mush/099 to /scripts/dicts
(note: the path is likely to change to .../mush/latest in future)

View File

@ -0,0 +1,96 @@
import head from "./dicts/GearInfoHead.json";
import clothes from "./dicts/GearInfoClothes.json";
import shoes from "./dicts/GearInfoShoes.json";
import fs from "node:fs";
import path from "node:path";
import invariant from "tiny-invariant";
import { loadLangDicts } from "./utils";
const CURRENT_SEASON = 0;
const OUTPUT_DIR_PATH = path.join(__dirname, "output");
const LANG_JSONS_TO_CREATE = ["EUen"];
async function main() {
const allGear: Array<{
id: number;
internalName: string;
type: string;
translations: Array<{ language: string; name: string }>;
}> = [];
const langDicts = await loadLangDicts();
for (const gear of [...head, ...clothes, ...shoes]) {
if (gear.Season > CURRENT_SEASON || gear.HowToGet !== "Shop") {
continue;
}
const [type, internalName] = gear.__RowId.split("_");
invariant(type);
invariant(internalName);
allGear.push({
id: gear.Id,
type,
internalName,
translations: langDicts.map(([langCode, translations]) => {
const name = translations[internalName];
invariant(name, `Missing translation for ${internalName}`);
return {
language: langCode,
name,
};
}),
});
}
allGear.sort((a, b) => a.id - b.id);
const headGear = allGear.filter((g) => g.type === "Hed");
const clothesGear = allGear.filter((g) => g.type === "Clt");
const shoesGear = allGear.filter((g) => g.type === "Shs");
invariant(headGear.length);
invariant(clothesGear.length);
invariant(shoesGear.length);
const headIds = headGear.map((w) => w.id);
const clothesIds = clothesGear.map((w) => w.id);
const shoesIds = shoesGear.map((w) => w.id);
fs.writeFileSync(
path.join(OUTPUT_DIR_PATH, "head-ids.json"),
JSON.stringify(headIds, null, 2)
);
fs.writeFileSync(
path.join(OUTPUT_DIR_PATH, "clothes-ids.json"),
JSON.stringify(clothesIds, null, 2)
);
fs.writeFileSync(
path.join(OUTPUT_DIR_PATH, "shoes-ids.json"),
JSON.stringify(shoesIds, null, 2)
);
for (const langCode of LANG_JSONS_TO_CREATE) {
const translationsMap = Object.fromEntries(
allGear.map((gear) => {
const translation = gear.translations.find(
(t) => t.language === langCode
)?.name;
invariant(
translation,
`No translation for ${gear.internalName} in ${langCode}`
);
return [`${gear.type.charAt(0).toUpperCase()}_${gear.id}`, translation];
})
);
fs.writeFileSync(
path.join(OUTPUT_DIR_PATH, `gear-${langCode}.json`),
JSON.stringify(translationsMap, null, 2)
);
}
}
void main();

23
scripts/utils.ts Normal file
View File

@ -0,0 +1,23 @@
import path from "node:path";
import fs from "node:fs";
const LANG_DICTS_PATH = path.join(__dirname, "dicts", "langs");
export async function loadLangDicts() {
const result: Array<
[langCode: string, translations: Record<string, string>]
> = [];
const files = await fs.promises.readdir(LANG_DICTS_PATH);
for (const file of files) {
if (file === ".gitkeep") continue;
const translations = JSON.parse(
fs.readFileSync(path.join(LANG_DICTS_PATH, file), "utf8")
);
result.push([file.replace(".json", ""), translations]);
}
return result;
}