From d0afd203e36feaef2d6110484ca2015ad7e48b12 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 18 Sep 2022 15:18:08 +0300 Subject: [PATCH] Parse special to weapon-params.json --- app/modules/analyzer/types.ts | 2 + app/modules/analyzer/weapon-params.json | 253 ++++++++++++++++++++++++ scripts/create-analyzer-json.ts | 44 ++++- 3 files changed, 297 insertions(+), 2 deletions(-) diff --git a/app/modules/analyzer/types.ts b/app/modules/analyzer/types.ts index 958679e21..904799f5c 100644 --- a/app/modules/analyzer/types.ts +++ b/app/modules/analyzer/types.ts @@ -5,6 +5,7 @@ import type { SubWeaponId, } from "~/modules/in-game-lists"; import type { SPECIAL_EFFECTS } from "./specialEffects"; +import type weaponParams from "./weapon-params.json"; import type abilityValues from "./ability-values.json"; export interface MainWeaponParams { @@ -101,6 +102,7 @@ export interface SubWeaponParams { export type ParamsJson = { mainWeapons: Record; subWeapons: Record; + specialWeapons: typeof weaponParams["specialWeapons"]; }; export interface Stat { diff --git a/app/modules/analyzer/weapon-params.json b/app/modules/analyzer/weapon-params.json index edf28c6c4..a53218b7b 100644 --- a/app/modules/analyzer/weapon-params.json +++ b/app/modules/analyzer/weapon-params.json @@ -1022,5 +1022,258 @@ } ] } + }, + "specialWeapons": { + "1": { + "SubSpecialSpecUpList": [ + { + "SpecUpType": "PaintRadius", + "Value": { + "High": 4, + "Low": 3.2, + "Mid": 3.6 + } + }, + { + "SpecUpType": "DistanceDamageDistanceRate", + "Value": { + "High": 1.3, + "Low": 1, + "Mid": 1.15 + } + } + ], + "SpecialDurationFrame": { + "High": 480, + "Low": 360, + "Mid": 420 + } + }, + "2": { + "MaxFieldHP": { + "High": 28800, + "Low": 24000, + "Mid": 26400 + }, + "MaxHP": { + "High": 14400, + "Low": 12000, + "Mid": 13200 + } + }, + "3": { + "InkConsume_Hook": { + "High": 0.015, + "Low": 0.04, + "Mid": 0.025 + }, + "InkConsume_PerSec": { + "High": 0.08, + "Low": 0.1, + "Mid": 0.087 + } + }, + "4": { + "SubSpecialSpecUpList": [ + { + "Value": { + "High": 3.78, + "Low": 3.15, + "Mid": 3.465 + } + }, + { + "SpecUpType": "CrossPaintRadius", + "Value": { + "High": 2, + "Low": 2, + "Mid": 2 + } + }, + { + "SpecUpType": "CrossPaintCheckLength", + "Value": { + "High": 3, + "Low": 3, + "Mid": 3 + } + } + ], + "TargetInCircleRadius": { + "High": 240, + "Low": 140, + "Mid": 190 + } + }, + "5": { + "RainyFrame": { + "High": 600, + "Low": 480, + "Mid": 540 + }, + "SpawnSpeedZSpecUp": { + "High": 1.68, + "Low": 1.12, + "Mid": 1.4 + } + }, + "6": { + "ChargeRateAutoPerFrame": { + "High": 0.01, + "Low": 0.002, + "Mid": 0.006 + } + }, + "7": { + "MaxFrame": { + "High": 216, + "Low": 160, + "Mid": 192 + }, + "MaxRadius": { + "High": 27, + "Low": 20, + "Mid": 24 + } + }, + "8": { + "RadiusMax": { + "High": 4, + "Low": 3, + "Mid": 3.5 + }, + "RadiusMin": { + "High": 1.4, + "Low": 0.8, + "Mid": 1.1 + } + }, + "9": { + "LaserFrame": { + "High": 240, + "Low": 180, + "Mid": 210 + } + }, + "10": { + "SubSpecialSpecUpList": [ + { + "Value": { + "High": 4, + "Low": 3.2, + "Mid": 3.6 + } + }, + { + "SpecUpType": "DistanceDamageDistanceRate", + "Value": { + "High": 1.3, + "Low": 1, + "Mid": 1.15 + } + }, + { + "SpecUpType": "SplashAroundVelocityMin", + "Value": { + "High": 0.52, + "Low": 0.49, + "Mid": 0.505 + } + }, + { + "SpecUpType": "SplashAroundVelocityMax", + "Value": { + "High": 0.35, + "Low": 0.33, + "Mid": 0.34 + } + }, + { + "SpecUpType": "SplashAroundPaintRadius", + "Value": { + "High": 0.7, + "Low": 0.63, + "Mid": 0.665 + } + } + ], + "SpecialTotalFrame": { + "High": 510, + "Low": 450, + "Mid": 480 + } + }, + "11": { + "SpecialTotalFrame": { + "High": 660, + "Low": 540, + "Mid": 600 + } + }, + "12": { + "SpecialTotalFrame": { + "High": 660, + "Low": 540, + "Mid": 600 + } + }, + "13": { + "SubSpecialSpecUpList": [ + { + "SpecUpType": "DistanceDamageDistanceRate", + "Value": { + "High": 1.2, + "Low": 1, + "Mid": 1.1 + } + }, + { + "SpecUpType": "PaintRadius", + "Value": { + "High": 8.4, + "Low": 7, + "Mid": 7.7 + } + }, + { + "SpecUpType": "SplashAroundVelocityMin", + "Value": { + "High": 0.6, + "Low": 0.5, + "Mid": 0.55 + } + }, + { + "SpecUpType": "SplashAroundVelocityMax", + "Value": { + "High": 0.7, + "Low": 0.6, + "Mid": 0.65 + } + }, + { + "SpecUpType": "SplashAroundPaintRadius", + "Value": { + "High": 1.2, + "Low": 1, + "Mid": 1.1 + } + } + ] + }, + "14": { + "SpawnSpeedZSpecUp": { + "High": 2.6, + "Low": 2, + "Mid": 2.3 + } + }, + "15": { + "PowerUpFrame": { + "High": 1500, + "Low": 900, + "Mid": 1200 + } + } } } diff --git a/scripts/create-analyzer-json.ts b/scripts/create-analyzer-json.ts index 4828e7d44..19424dff4 100644 --- a/scripts/create-analyzer-json.ts +++ b/scripts/create-analyzer-json.ts @@ -27,6 +27,7 @@ type TranslationArray = Array<{ language: string; key: string; value: string }>; async function main() { const mainWeaponsResult: Record = {}; const subWeaponsResult: Record = {}; + const specialWeaponsResult: any = {}; const translations: TranslationArray = []; const langDicts = await loadLangDicts(); @@ -70,6 +71,9 @@ async function main() { for (const specialWeapon of specialWeapons) { if (specialWeaponShouldBeSkipped(specialWeapon)) continue; + const rawParams = loadWeaponParamsObject(specialWeapon); + const params = parametersToSpecialWeaponResult(rawParams); + translationsToArray({ arr: translations, internalName: specialWeapon.__RowId, @@ -77,11 +81,14 @@ async function main() { type: "Special", translations: langDicts, }); + + specialWeaponsResult[specialWeapon.Id] = params; } const toFile: ParamsJson = { mainWeapons: mainWeaponsResult, subWeapons: subWeaponsResult, + specialWeapons: specialWeaponsResult, }; fs.writeFileSync( @@ -241,6 +248,37 @@ function parametersToSubWeaponResult(params: any): SubWeaponParams { }; } +function parametersToSpecialWeaponResult(params: any) { + const result: any = {}; + + for (const parentValue of Object.values(params)) { + for (const entries of Object.entries(parentValue as any)) { + const [key, value]: any = entries; + if ( + key === "SubSpecialSpecUpList" || + value.High !== value.Mid || + value.Mid !== value.Low + ) { + result[key] = value; + } + + for (const innerEntries of Object.entries(value)) { + const [innerMostKey, innerMostValue]: any = innerEntries; + if (typeof innerMostValue !== "object") continue; + if ( + innerMostKey === "SubSpecialSpecUpList" || + innerMostValue.High !== innerMostValue.Mid || + innerMostValue.Mid !== innerMostValue.Low + ) { + result[innerMostKey] = innerMostValue; + } + } + } + } + + return result; +} + function resolveSubWeaponId(weapon: MainWeapon) { const codeName = weapon.SubWeapon.replace("Work/Gyml/", "").replace( ".spl__WeaponInfoSub.gyml", @@ -399,7 +437,9 @@ function specialWeaponShouldBeSkipped(specialWeapon: SpecialWeapon) { return false; } -function loadWeaponParamsObject(weapon: MainWeapon | SubWeapon) { +function loadWeaponParamsObject( + weapon: MainWeapon | SubWeapon | SpecialWeapon +) { return JSON.parse( fs.readFileSync( path.join(__dirname, "dicts", "weapon", weaponRowIdToFileName(weapon)), @@ -408,7 +448,7 @@ function loadWeaponParamsObject(weapon: MainWeapon | SubWeapon) { )["GameParameters"]; } -function weaponRowIdToFileName(weapon: MainWeapon | SubWeapon) { +function weaponRowIdToFileName(weapon: MainWeapon | SubWeapon | SpecialWeapon) { const [category, codeName] = weapon.__RowId.split("_"); invariant(category);