|
|
|
@ -57,10 +57,10 @@ public class PowersParser {
@@ -57,10 +57,10 @@ public class PowersParser {
|
|
|
|
|
private static PowerEntry parsePowerEntry(String powerData) { |
|
|
|
|
|
|
|
|
|
PowerEntry powerEntry = new PowerEntry(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder conditionString = new StringBuilder(); |
|
|
|
|
StringBuilder powerString = new StringBuilder(); |
|
|
|
|
StringBuilder conditionBuilder = new StringBuilder(); |
|
|
|
|
StringBuilder powerBuilder = new StringBuilder(); |
|
|
|
|
String conditionString; |
|
|
|
|
String powerString; |
|
|
|
|
|
|
|
|
|
int endPos = 0; |
|
|
|
|
|
|
|
|
@ -69,23 +69,22 @@ public class PowersParser {
@@ -69,23 +69,22 @@ public class PowersParser {
|
|
|
|
|
Matcher matcher = CONDITION_REGEX.matcher(powerData); |
|
|
|
|
|
|
|
|
|
while (matcher.find()) { |
|
|
|
|
conditionString.append(matcher.group().trim()); |
|
|
|
|
powerString.append(powerData, endPos, matcher.start()); |
|
|
|
|
conditionBuilder.append(matcher.group().trim()); |
|
|
|
|
powerBuilder.append(powerData, endPos, matcher.start()); |
|
|
|
|
endPos = matcher.end(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
powerString.append(powerData.substring(endPos)); |
|
|
|
|
powerBuilder.append(powerData.substring(endPos)); |
|
|
|
|
|
|
|
|
|
// Cleanup dangling tags and lines that contain a # and leading/trailing blank lines
|
|
|
|
|
|
|
|
|
|
powerString = new StringBuilder(powerString.toString().replaceAll("CONDITIONBEGINCONDITIONEND", "")); |
|
|
|
|
powerString = new StringBuilder(powerString.toString().replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", "")); |
|
|
|
|
|
|
|
|
|
conditionString = new StringBuilder(conditionString.toString().replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", "")); |
|
|
|
|
powerString = powerBuilder.toString().replaceAll("CONDITIONBEGINCONDITIONEND", "") |
|
|
|
|
.replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", ""); |
|
|
|
|
conditionString = conditionBuilder.toString().replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", ""); |
|
|
|
|
|
|
|
|
|
// Parse header line in power data
|
|
|
|
|
|
|
|
|
|
List<String> lineData = Arrays.asList(powerString.toString().trim().split("\n")); |
|
|
|
|
List<String> lineData = Arrays.asList(powerString.trim().split("\n")); |
|
|
|
|
List<String> powerHeader = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
String headerString = lineData.get(0); |
|
|
|
@ -152,7 +151,6 @@ public class PowersParser {
@@ -152,7 +151,6 @@ public class PowersParser {
|
|
|
|
|
ActionEntry actionEntry; |
|
|
|
|
List<String> arguments; |
|
|
|
|
Matcher matcher1; |
|
|
|
|
ArrayList<String> args; |
|
|
|
|
|
|
|
|
|
switch (key) { |
|
|
|
|
case "ACTION": |
|
|
|
@ -200,14 +198,14 @@ public class PowersParser {
@@ -200,14 +198,14 @@ public class PowersParser {
|
|
|
|
|
case "EQPREREQ": |
|
|
|
|
EquipmentPreReq equipmentPreReq = new EquipmentPreReq(); |
|
|
|
|
matcher1 = STRSPLIT_REGEX.matcher(lineValues.get(1).trim()); |
|
|
|
|
args = new ArrayList<>(); |
|
|
|
|
arguments = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
while (matcher1.find()) |
|
|
|
|
args.add(matcher1.group().trim()); |
|
|
|
|
arguments.add(matcher1.group().trim()); |
|
|
|
|
|
|
|
|
|
equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(args.get(0)); |
|
|
|
|
equipmentPreReq.skill = args.get(1).replaceAll("\"", ""); |
|
|
|
|
equipmentPreReq.level = Integer.parseInt(args.get(2)); |
|
|
|
|
equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(arguments.get(0)); |
|
|
|
|
equipmentPreReq.skill = arguments.get(1).replaceAll("\"", ""); |
|
|
|
|
equipmentPreReq.level = Integer.parseInt(arguments.get(2)); |
|
|
|
|
powerEntry.equipmentPreReq = equipmentPreReq; |
|
|
|
|
break; |
|
|
|
|
case "CANCASTWHILEMOVING": |
|
|
|
@ -296,9 +294,9 @@ public class PowersParser {
@@ -296,9 +294,9 @@ public class PowersParser {
|
|
|
|
|
|
|
|
|
|
// Parse power conditions
|
|
|
|
|
|
|
|
|
|
if (!conditionString.toString().isEmpty()) { |
|
|
|
|
if (conditionString.isEmpty() == false) { |
|
|
|
|
|
|
|
|
|
String[] conditions = conditionString.toString().split("\n"); |
|
|
|
|
List<String> conditions = Arrays.asList(conditionString.split("\n")); |
|
|
|
|
|
|
|
|
|
for (String condition : conditions) { |
|
|
|
|
List<String> parameters = Arrays.asList(condition.trim().split("\\s+")); |
|
|
|
|