From 050e0ffd578320e5c98ee27317bd6baa8fc44526 Mon Sep 17 00:00:00 2001 From: Daan Vanden Bosch Date: Wed, 1 Jan 2020 14:26:14 +0100 Subject: [PATCH] Added Vol Opt part 2. --- assets/npcs/{VolOpt.nj => VolOptPart2.nj} | Bin assets/npcs/{VolOpt.xvm => VolOptPart2.xvm} | Bin assets_generation/update_ephinea_data.ts | 22 ++++++++++-------- src/core/Logger.ts | 1 + src/core/data_formats/parsing/quest/index.ts | 6 ++--- .../data_formats/parsing/quest/npc_types.ts | 18 ++++++++++++-- .../controllers/NpcCountsController.ts | 7 ++++-- 7 files changed, 37 insertions(+), 17 deletions(-) rename assets/npcs/{VolOpt.nj => VolOptPart2.nj} (100%) rename assets/npcs/{VolOpt.xvm => VolOptPart2.xvm} (100%) diff --git a/assets/npcs/VolOpt.nj b/assets/npcs/VolOptPart2.nj similarity index 100% rename from assets/npcs/VolOpt.nj rename to assets/npcs/VolOptPart2.nj diff --git a/assets/npcs/VolOpt.xvm b/assets/npcs/VolOptPart2.xvm similarity index 100% rename from assets/npcs/VolOpt.xvm rename to assets/npcs/VolOptPart2.xvm diff --git a/assets_generation/update_ephinea_data.ts b/assets_generation/update_ephinea_data.ts index 44e420ef..9a0259c8 100644 --- a/assets_generation/update_ephinea_data.ts +++ b/assets_generation/update_ephinea_data.ts @@ -1,5 +1,4 @@ import { readdirSync, readFileSync, statSync, writeFileSync } from "fs"; -import Logger from "js-logger"; import { ASSETS_DIR, RESOURCE_DIR } from "."; import { BufferCursor } from "../src/core/data_formats/cursor/BufferCursor"; import { ItemPmt, parse_item_pmt } from "../src/core/data_formats/parsing/itempmt"; @@ -13,14 +12,15 @@ import { Endianness } from "../src/core/data_formats/Endianness"; import { ItemTypeDto } from "../src/core/dto/ItemTypeDto"; import { QuestDto } from "../src/hunt_optimizer/dto/QuestDto"; import { BoxDropDto, EnemyDropDto } from "../src/hunt_optimizer/dto/drops"; +import { LogLevel, LogManager } from "../src/core/Logger"; -const logger = Logger.get("assets_generation/update_ephinea_data"); +const logger = LogManager.get("assets_generation/update_ephinea_data"); -Logger.useDefaults({ defaultLevel: Logger.ERROR }); -logger.setLevel(Logger.INFO); -Logger.get("static/update_drops_ephinea").setLevel(Logger.INFO); -Logger.get("core/data_formats/parsing/quest").setLevel(Logger.OFF); -Logger.get("core/data_formats/parsing/quest/bin").setLevel(Logger.OFF); +LogManager.default_level = LogLevel.Error; +logger.level = LogLevel.Info; +LogManager.get("static/update_drops_ephinea").level = LogLevel.Info; +LogManager.get("core/data_formats/parsing/quest").level = LogLevel.Off; +LogManager.get("core/data_formats/parsing/quest/bin").level = LogLevel.Off; /** * Used by static data generation scripts. @@ -331,7 +331,7 @@ function load_item_pt(): ItemPt { switch (npc) { case NpcType.Dragon: case NpcType.DeRolLe: - case NpcType.VolOpt: + case NpcType.VolOptPart2: case NpcType.DarkFalz: case NpcType.BarbaRay: case NpcType.GolDragon: @@ -739,7 +739,7 @@ function get_enemy_type(episode: Episode, index: number): NpcType | undefined { NpcType.Dragon, NpcType.DeRolLe, - NpcType.VolOpt, + NpcType.VolOptPart2, NpcType.DarkFalz, undefined, @@ -954,8 +954,10 @@ function npc_type_to_pt_index(type: NpcType): number | undefined { return 29; case NpcType.Dubswitch: return undefined; - case NpcType.VolOpt: + case NpcType.VolOptPart1: return 46; + case NpcType.VolOptPart2: + return undefined; // Episode I Ruins diff --git a/src/core/Logger.ts b/src/core/Logger.ts index 8f712275..85b47c70 100644 --- a/src/core/Logger.ts +++ b/src/core/Logger.ts @@ -8,6 +8,7 @@ export enum LogLevel { Info, Warn, Error, + Off, } export const LogLevels = enum_values(LogLevel); diff --git a/src/core/data_formats/parsing/quest/index.ts b/src/core/data_formats/parsing/quest/index.ts index 8e91f08d..2ea76db9 100644 --- a/src/core/data_formats/parsing/quest/index.ts +++ b/src/core/data_formats/parsing/quest/index.ts @@ -492,10 +492,10 @@ function get_npc_type(episode: number, { type_id, scale, roaming, area_id }: Dat return NpcType.GalGryphon; case `${0x0c1}, 1`: return NpcType.DeRolLe; - // TODO: - // case `${0x0C2}, 1`: return NpcType.VolOptPart1; + case `${0x0c2}, 1`: + return NpcType.VolOptPart1; case `${0x0c5}, 1`: - return NpcType.VolOpt; + return NpcType.VolOptPart2; case `${0x0c8}, 1`: return NpcType.DarkFalz; case `${0x0ca}, 2`: diff --git a/src/core/data_formats/parsing/quest/npc_types.ts b/src/core/data_formats/parsing/quest/npc_types.ts index e0d08ff9..5a0fd94b 100644 --- a/src/core/data_formats/parsing/quest/npc_types.ts +++ b/src/core/data_formats/parsing/quest/npc_types.ts @@ -75,7 +75,8 @@ export enum NpcType { Canadine, Canane, Dubswitch, - VolOpt, + VolOptPart1, + VolOptPart2, // Episode I Ruins @@ -976,8 +977,21 @@ define_npc_type_data( true, ); define_npc_type_data( - NpcType.VolOpt, + NpcType.VolOptPart1, + "Vol Opt (Part 1)", "Vol Opt", + "Vol Opt ver.2", + 1, + true, + undefined, + [13], + 0x0c2, + 0, + true, +); +define_npc_type_data( + NpcType.VolOptPart2, + "Vol Opt (Part 2)", "Vol Opt", "Vol Opt ver.2", 1, diff --git a/src/quest_editor/controllers/NpcCountsController.ts b/src/quest_editor/controllers/NpcCountsController.ts index 48dede72..22098352 100644 --- a/src/quest_editor/controllers/NpcCountsController.ts +++ b/src/quest_editor/controllers/NpcCountsController.ts @@ -25,8 +25,11 @@ export class NpcCountsController extends Controller { const npc_counts = new Map(); for (const npc of npcs) { - const val = npc_counts.get(npc.type) || 0; - npc_counts.set(npc.type, val + 1); + // Don't count Vol Opt twice. + if (npc.type !== NpcType.VolOptPart2) { + const val = npc_counts.get(npc.type) || 0; + npc_counts.set(npc.type, val + 1); + } } const extra_canadines = (npc_counts.get(NpcType.Canane) || 0) * 8;