Browse Source

PowerEntry parsing work

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

15
src/engine/wpak/PowersParser.java

@ -30,7 +30,7 @@ public class PowersParser {
byte[] fileData = Files.readAllBytes(Paths.get(powersPath)); byte[] fileData = Files.readAllBytes(Paths.get(powersPath));
String fileContents = new String(fileData); 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); Matcher matcher = POWER_REGEX.matcher(fileContents);
@ -46,15 +46,22 @@ public class PowersParser {
PowerEntry powerEntry = new PowerEntry(); PowerEntry powerEntry = new PowerEntry();
ArrayList<String> powerValues = new ArrayList<>(); ArrayList<String> powerValues = new ArrayList<>();
String[] powerEntries = powerData.trim().split("\n"); 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", " ");
Matcher matcher = STRSPLIT_REGEX.matcher(headerString);
while (matcher.find()) while (matcher.find())
powerValues.add(matcher.group(1).trim()); powerHeader.add(matcher.group(1).trim());
for (int x = 2; x < powerEntries.length; x++) {
// Parse key/pair values
} }
return powerEntry; return powerEntry;
} }

Loading…
Cancel
Save