Browse Source

PowerEntry parsing work

feature-config-parsing2
MagicBot 3 months ago
parent
commit
cd50ca4309
  1. 17
      src/engine/wpak/PowersParser.java

17
src/engine/wpak/PowersParser.java

@ -30,7 +30,7 @@ public class PowersParser { @@ -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 { @@ -46,15 +46,22 @@ public class PowersParser {
PowerEntry powerEntry = new PowerEntry();
ArrayList<String> powerValues = new ArrayList<>();
String[] powerEntries = powerData.trim().split("\n");
ArrayList<String> 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;
}

Loading…
Cancel
Save