mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-07 11:46:09 -05:00
Chill Season 2022 update (2.0)
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
This folder has scripts that can be used run time for admin only actions or to prepare some data.
|
||||
|
||||
#### `create-weapon-json.ts` & `create-gear-json.ts`
|
||||
|
||||
Before using this script you need to copy some files from another repository.
|
||||
|
||||
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)
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
translationJsonFolderName,
|
||||
} from "./utils";
|
||||
|
||||
const CURRENT_SEASON = 1;
|
||||
const CURRENT_SEASON = 2;
|
||||
|
||||
type MainWeapon = typeof weapons[number];
|
||||
type SubWeapon = typeof subWeapons[number];
|
||||
|
||||
@@ -14,14 +14,14 @@ import {
|
||||
translationJsonFolderName,
|
||||
} from "./utils";
|
||||
|
||||
const CURRENT_SEASON = 1;
|
||||
const CURRENT_SEASON = 2;
|
||||
const OUTPUT_DIR_PATH = path.join(__dirname, "output");
|
||||
|
||||
const LEAN_HEAD_CODE = "Hed";
|
||||
const LEAN_CLOTHES_CODE = "Clt";
|
||||
const LEAN_SHOES_CODE = "Shs";
|
||||
|
||||
const AVAILABLE_SR_GEAR = [21010, 21011, 21015];
|
||||
const AVAILABLE_SR_GEAR = [21010, 21011, 21015, 21013];
|
||||
|
||||
async function main() {
|
||||
const allGear: Array<{
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/* eslint-disable no-console */
|
||||
import "dotenv/config";
|
||||
import { sql } from "~/db/sql";
|
||||
|
||||
sql
|
||||
.prepare(`update "User" set "customUrl" = NULL where "customUrl" like '%#%'`)
|
||||
.run();
|
||||
|
||||
console.log("Done");
|
||||
@@ -7,6 +7,7 @@ const GEAR_IMAGES_DIR_PATH = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"public",
|
||||
"static-assets",
|
||||
"img",
|
||||
"gear"
|
||||
);
|
||||
|
||||
@@ -4,36 +4,50 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import invariant from "tiny-invariant";
|
||||
import weapons from "./dicts/WeaponInfoMain.json";
|
||||
|
||||
const DIR_PATH = path.join(
|
||||
const DIR_PATH_1 = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"public",
|
||||
"static-assets",
|
||||
"img",
|
||||
"main-weapons"
|
||||
);
|
||||
|
||||
const DIR_PATH_2 = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"public",
|
||||
"static-assets",
|
||||
"img",
|
||||
"main-weapons-outlined"
|
||||
);
|
||||
const WEAPON_JSON_PATH = path.join(__dirname, "output", "weapons.json");
|
||||
|
||||
async function main() {
|
||||
const weapons = JSON.parse(fs.readFileSync(WEAPON_JSON_PATH, "utf8"));
|
||||
const files = await fs.promises.readdir(DIR_PATH);
|
||||
for (const dir of [DIR_PATH_1, DIR_PATH_2]) {
|
||||
const files = await fs.promises.readdir(dir);
|
||||
|
||||
for (const file of files) {
|
||||
// did we already replace the name
|
||||
if (file.includes(".webp") || file.includes("Lv01")) {
|
||||
// delete file
|
||||
await fs.promises.unlink(path.join(DIR_PATH, file));
|
||||
for (const file of files) {
|
||||
// skip if already replaced
|
||||
if (file.length <= 8) continue;
|
||||
|
||||
if (file.includes(".webp") || file.includes("Lv01")) {
|
||||
await fs.promises.unlink(path.join(dir, file));
|
||||
continue;
|
||||
}
|
||||
|
||||
const weapon: any = weapons.find((weapon: any) =>
|
||||
file.includes(weapon.__RowId)
|
||||
);
|
||||
|
||||
if (!weapon) {
|
||||
await fs.promises.unlink(path.join(dir, file));
|
||||
continue;
|
||||
}
|
||||
|
||||
fs.renameSync(path.join(dir, file), path.join(dir, `${weapon.Id}.png`));
|
||||
}
|
||||
|
||||
const weapon: any = weapons.find((weapon: any) =>
|
||||
file.includes(weapon.internalName)
|
||||
);
|
||||
invariant(weapon, `Could not find weapon for ${file}`);
|
||||
|
||||
fs.renameSync(
|
||||
path.join(DIR_PATH, file),
|
||||
path.join(DIR_PATH, `${weapon.id}.png`)
|
||||
);
|
||||
}
|
||||
|
||||
console.log("done with all");
|
||||
|
||||
Reference in New Issue
Block a user