Browse Source

Effects.cfg parser

feature-config-parsing
FatBoy-DOTC 5 months ago
parent
commit
f81a1acb20
  1. 6
      src/engine/ConfigParsing/EffectsData/EffectData.java
  2. 6
      src/engine/ConfigParsing/EffectsParser.java

6
src/engine/ConfigParsing/EffectsData/EffectData.java

@ -1,12 +1,14 @@
package engine.ConfigParsing.EffectsData; package engine.ConfigParsing.EffectsData;
import engine.mbEnums;
import java.util.ArrayList; import java.util.ArrayList;
public class EffectData { public class EffectData {
public String id; public String id;
public String name; public String name;
public int icon; public int icon;
public ArrayList<String> sources; public ArrayList<mbEnums.EffectSourceType> sources;
public ArrayList<Mod> mods; public ArrayList<mbEnums.ModType> mods;
public ArrayList<String> conditions; public ArrayList<String> conditions;
} }

6
src/engine/ConfigParsing/EffectsParser.java

@ -12,6 +12,8 @@ import engine.ConfigParsing.EffectsData.Condition;
import engine.ConfigParsing.EffectsData.EffectData; import engine.ConfigParsing.EffectsData.EffectData;
import engine.ConfigParsing.EffectsData.Mod; import engine.ConfigParsing.EffectsData.Mod;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import engine.mbEnums;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
@ -82,7 +84,7 @@ public class EffectsParser {
for(String line : lines) { for(String line : lines) {
if (line.contains("SOURCEBEGIN")) if (line.contains("SOURCEBEGIN"))
{ {
data.sources.add(lines.get(index + 1).replace(" ", "")); data.sources.add(mbEnums.EffectSourceType.valueOf(lines.get(index + 1).replace(" ", "")));
} }
index++; index++;
} }
@ -105,7 +107,7 @@ public class EffectsParser {
GenerateModValues(mod, lines.get(index + extra).replace(" ", "").replace(" ", "").split(" ")); GenerateModValues(mod, lines.get(index + extra).replace(" ", "").replace(" ", "").split(" "));
extra++; extra++;
} }
data.mods.add(mod); data.mods.add(mbEnums.ModType.valueOf(mod.type));
} }
index++; index++;
} }

Loading…
Cancel
Save