From cd50ca430976af2ea99975031dc4524392897795 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 14 Aug 2024 16:27:51 -0400 Subject: [PATCH] PowerEntry parsing work --- src/engine/wpak/PowersParser.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/engine/wpak/PowersParser.java b/src/engine/wpak/PowersParser.java index dd8c4077..55d797de 100644 --- a/src/engine/wpak/PowersParser.java +++ b/src/engine/wpak/PowersParser.java @@ -30,7 +30,7 @@ public class PowersParser { byte[] fileData = Files.readAllBytes(Paths.get(powersPath)); String fileContents = new String(fileData); - // Iterate over effect entries from .wpak data + // Iterate over power entries from .wpak data Matcher matcher = POWER_REGEX.matcher(fileContents); @@ -46,15 +46,22 @@ public class PowersParser { PowerEntry powerEntry = new PowerEntry(); ArrayList powerValues = new ArrayList<>(); String[] powerEntries = powerData.trim().split("\n"); + ArrayList powerHeader = new ArrayList<>(); - for (String powerString : powerEntries) { + // Parse header - Matcher matcher = STRSPLIT_REGEX.matcher(powerString.trim()); + String headerString = powerEntries[0] + powerEntries[1]; + headerString = headerString.replace("\n", " "); - while (matcher.find()) - powerValues.add(matcher.group(1).trim()); + Matcher matcher = STRSPLIT_REGEX.matcher(headerString); + while (matcher.find()) + powerHeader.add(matcher.group(1).trim()); + + for (int x = 2; x < powerEntries.length; x++) { + // Parse key/pair values } + return powerEntry; }