Browse Source

Debug code added

feature-config-parsing2
MagicBot 4 months ago
parent
commit
502dda0b3b
  1. 23
      src/engine/wpak/PowerActionParser.java
  2. 2
      src/engine/wpak/data/PowerActionEntry.java

23
src/engine/wpak/PowerActionParser.java

@ -35,8 +35,7 @@ public class PowerActionParser {
try { try {
fileData = Files.readAllBytes(Paths.get(powerActionPath)); fileData = Files.readAllBytes(Paths.get(powerActionPath));
} catch ( } catch (IOException e) {
IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -78,19 +77,35 @@ public class PowerActionParser {
headerData.add(matcher.group().trim()); headerData.add(matcher.group().trim());
Iterator<String> headerIterator = headerData.iterator(); Iterator<String> headerIterator = headerData.iterator();
powerActionEntry.action_id = headerIterator.next(); powerActionEntry.action_id = headerIterator.next();
powerActionEntry.action_type = headerIterator.next(); powerActionEntry.action_type = headerIterator.next();
switch (powerActionEntry.action_type) {
case "RemoveEffect":
effectDescription = new EffectDescription();
effectDescription.effect_id = headerIterator.next();
powerActionEntry.effects.add(effectDescription);
case "CreateMob":
powerActionEntry.arg1 = Integer.parseInt(headerIterator.next());
powerActionEntry.arg2 = Integer.parseInt(headerIterator.next());
break;
case "ApplyEffect":
case "DeferredPower ":
while (headerIterator.hasNext()) { while (headerIterator.hasNext()) {
effectDescription = new EffectDescription(); effectDescription = new EffectDescription();
effectDescription.effect_id = headerIterator.next(); effectDescription.effect_id = headerIterator.next();
effectDescription.level = Integer.parseInt(headerIterator.next()); effectDescription.level = Integer.parseInt(headerIterator.next());
powerActionEntry.effects.add(effectDescription);
}
break;
default:
Logger.error("Unhandled type " + powerActionEntry.action_type + " for Pow4erAction: " + powerActionEntry.action_id);
break;
} }
// Process key value pairs after header // Process key value pairs after header
while (entryIterator.hasNext()) { while (entryIterator.hasNext()) {
String lineValue = entryIterator.next(); String lineValue = entryIterator.next();
String[] lineValues = lineValue.split("="); String[] lineValues = lineValue.split("=");

2
src/engine/wpak/data/PowerActionEntry.java

@ -33,5 +33,7 @@ public class PowerActionEntry {
public mbEnums.DamageType damageType; public mbEnums.DamageType damageType;
public boolean applyEffectBlank = false; public boolean applyEffectBlank = false;
public boolean wearOffEffectBlank = false; public boolean wearOffEffectBlank = false;
public int arg1;
public int arg2;
} }

Loading…
Cancel
Save