Browse Source

Support for multiple power enrties.

feature-config-parsing2
MagicBot 3 months ago
parent
commit
218de2bb70
  1. 2
      src/engine/wpak/PowerData.java
  2. 2
      src/engine/wpak/PowerEntry.java
  3. 64
      src/engine/wpak/PowersParser.java

2
src/engine/wpak/PowerData.java

@ -9,7 +9,7 @@
package engine.wpak; package engine.wpak;
public class PowerData { public class PowerData {
public String power;
public String power_type; public String power_type;
public int icon; public int icon;
public String powerBase;
} }

2
src/engine/wpak/PowerEntry.java

@ -12,8 +12,8 @@ import java.util.ArrayList;
public class PowerEntry { public class PowerEntry {
public String power_id; public String power_id;
public String power;
public ArrayList<PowerData> powers = new ArrayList<>(); public ArrayList<PowerData> powers = new ArrayList<>();
public String powerbase;
public String target_type; public String target_type;
public int range; public int range;
public String areaType; public String areaType;

64
src/engine/wpak/PowersParser.java

@ -42,7 +42,7 @@ public class PowersParser {
} }
} }
private static PowerEntry parsePowerEntry(String powerData) { private static <Iterator> PowerEntry parsePowerEntry(String powerData) {
PowerEntry powerEntry = new PowerEntry(); PowerEntry powerEntry = new PowerEntry();
@ -62,36 +62,48 @@ public class PowersParser {
while (matcher.find()) while (matcher.find())
powerHeader.add(matcher.group().trim()); powerHeader.add(matcher.group().trim());
powerEntry.power_id = powerHeader.get(0); java.util.Iterator<String> iterator = powerHeader.iterator();
if (powerHeader.size() != 22) powerEntry.power_id = iterator.next();
Logger.error(powerEntry.power_id); powerEntry.power = iterator.next().replaceAll("\"", "");
PowerData power = new PowerData(); PowerData power = new PowerData();
power.power_type = iterator.next();
power.power = powerHeader.get(1).replaceAll("\"", ""); ;
power.power_type = powerHeader.get(2); power.icon = Integer.parseInt(iterator.next());
power.icon = Integer.parseInt(powerHeader.get(3)); power.powerBase = iterator.next().replaceAll("\"", "");
powerEntry.powers.add(power); powerEntry.powers.add(power);
powerEntry.powerbase = powerHeader.get(4).replaceAll("\"", ""); powerEntry.target_type = iterator.next();
powerEntry.target_type = powerHeader.get(5);
powerEntry.range = Integer.parseInt(powerHeader.get(6)); // Account for second definition
powerEntry.areaType = powerHeader.get(7);
powerEntry.areaRange = Integer.parseInt(powerHeader.get(8)); if (powerEntry.target_type.equals("SPELL") ||
powerEntry.excludeType = powerHeader.get(9); powerEntry.target_type.equals("SKILL")) {
powerEntry.costType = powerHeader.get(10); power = new PowerData();
powerEntry.cost = Float.parseFloat(powerHeader.get(11)); power.power_type = powerEntry.target_type;
powerEntry.difficulty = Integer.parseInt(powerHeader.get(12)); power.icon = Integer.parseInt(iterator.next());
powerEntry.precision = Integer.parseInt(powerHeader.get(13)); power.powerBase = iterator.next().replaceAll("\"", "");
powerEntry.init_time = Float.parseFloat(powerHeader.get(14)); powerEntry.powers.add(power);
powerEntry.release_time = Float.parseFloat(powerHeader.get(15)); powerEntry.target_type = iterator.next();
powerEntry.recycle_time = Float.parseFloat(powerHeader.get(16)); }
powerEntry.hitRollYN = Integer.parseInt(powerHeader.get(17));
powerEntry.castingMode = powerHeader.get(18); powerEntry.range = Integer.parseInt(iterator.next());
powerEntry.initAmin = Integer.parseInt(powerHeader.get(19)); powerEntry.areaType = iterator.next();
powerEntry.releaseAnim = Integer.parseInt(powerHeader.get(20)); powerEntry.areaRange = Integer.parseInt(iterator.next());
powerEntry.targetSelect = powerHeader.get(21); powerEntry.excludeType = iterator.next();
powerEntry.costType = iterator.next();
powerEntry.cost = Float.parseFloat(iterator.next());
powerEntry.difficulty = Integer.parseInt(iterator.next());
powerEntry.precision = Integer.parseInt(iterator.next());
powerEntry.init_time = Float.parseFloat(iterator.next());
powerEntry.release_time = Float.parseFloat(iterator.next());
powerEntry.recycle_time = Float.parseFloat(iterator.next());
powerEntry.hitRollYN = Integer.parseInt(iterator.next());
powerEntry.castingMode = iterator.next();
powerEntry.initAmin = Integer.parseInt(iterator.next());
powerEntry.releaseAnim = Integer.parseInt(iterator.next());
powerEntry.targetSelect = iterator.next();
for (int x = 2; x < powerEntries.length; x++) { for (int x = 2; x < powerEntries.length; x++) {

Loading…
Cancel
Save