diff --git a/src/engine/wpak/PowersParser.java b/src/engine/wpak/PowersParser.java index 47197685..2420a50b 100644 --- a/src/engine/wpak/PowersParser.java +++ b/src/engine/wpak/PowersParser.java @@ -23,10 +23,10 @@ import java.util.regex.Pattern; public class PowersParser { - private static String powersPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Powers.cfg"; private static final Pattern POWER_REGEX = Pattern.compile("(?<=POWERBEGIN)(.+?)(?=POWEREND)", Pattern.DOTALL); private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*"); private static final Pattern CONDITION_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL); + private static final String powersPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Powers.cfg"; public static void parseWpakFile() throws IOException { @@ -203,7 +203,6 @@ public class PowersParser { equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(args.get(0)); equipmentPreReq.skill = args.get(1).replaceAll("\"", ""); - ; equipmentPreReq.level = Integer.parseInt(args.get(2)); powerEntry.equipmentPreReq = equipmentPreReq; break; @@ -289,6 +288,15 @@ public class PowersParser { } } + // Parse power conditions + + String[] conditions = conditionString.toString().split("\n"); + + for (String condition : conditions) { + String[] parameters = condition.trim().split("\\s+"); + powerEntry.conditions.put(parameters[0], Float.parseFloat(parameters[1])); + } + } catch (Exception e) { Logger.error(powerEntry.power_id + " " + e); } diff --git a/src/engine/wpak/data/PowerEntry.java b/src/engine/wpak/data/PowerEntry.java index 718d1700..190f947c 100644 --- a/src/engine/wpak/data/PowerEntry.java +++ b/src/engine/wpak/data/PowerEntry.java @@ -12,6 +12,7 @@ import engine.mbEnums; import java.util.ArrayList; import java.util.EnumSet; +import java.util.HashMap; public class PowerEntry { public String power_id; @@ -64,5 +65,6 @@ public class PowerEntry { public ArrayList targetEffectPrereqs = new ArrayList<>(); public boolean canCastWhileFlying = false; public boolean isProjectile = false; + public HashMap conditions = new HashMap<>(); }