Browse Source

Effect Modifier parsing work.

feature-config-parsing2
MagicBot 3 months ago
parent
commit
975845375f
  1. 29
      src/engine/ConfigParsing/EffectsParser.java

29
src/engine/ConfigParsing/EffectsParser.java

@ -113,22 +113,31 @@ public class EffectsParser {
private static EffectModifier parseModEntry(String modData) { private static EffectModifier parseModEntry(String modData) {
EffectModifier effectModifier = new EffectModifier(); EffectModifier effectModifier = new EffectModifier();
ArrayList<String> modValues = new ArrayList<>();
String[] modEntries = modData.trim().split("\n"); String[] modEntries = modData.trim().split("\n");
effectModifier.type = mbEnums.ModType.valueOf(modEntries[0]); for (String modEntry : modEntries) {
switch (effectModifier.type) { ArrayList<String> modValues = new ArrayList<>();
case AnimOverride: Matcher matcher = STRSPLIT_REGEX.matcher(modEntry);
effectModifier.min = Integer.parseInt(modEntries[1]);
effectModifier.max = Integer.parseInt(modEntries[2]); while (matcher.find())
break; modValues.add(matcher.group(1).trim());
default:
Logger.error("Unhandled type: " + effectModifier.type); effectModifier.type = mbEnums.ModType.valueOf(modValues.get(0).trim());
break;
switch (effectModifier.type) {
case AnimOverride:
effectModifier.min = Integer.parseInt(modEntries[1]);
effectModifier.max = Integer.parseInt(modEntries[2]);
break;
default:
Logger.error("Unhandled type: " + effectModifier.type);
break;
}
} }
return effectModifier; return effectModifier;
} }

Loading…
Cancel
Save