Power Conditions parsed

This commit is contained in:
2024-08-19 11:10:55 -04:00
parent 41a9c19001
commit ff6d236ea7
2 changed files with 12 additions and 2 deletions
+10 -2
View File
@@ -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);
}
+2
View File
@@ -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<EffectPreReq> targetEffectPrereqs = new ArrayList<>();
public boolean canCastWhileFlying = false;
public boolean isProjectile = false;
public HashMap<String, Float> conditions = new HashMap<>();
}