Browse Source

HashSets for starters.

feature-config-parsing2
MagicBot 5 months ago
parent
commit
1e0372c40d
  1. 2
      src/engine/ConfigParsing/EffectEntry/Condition.java
  2. 12
      src/engine/ConfigParsing/EffectEntry/EffectEntry.java
  3. 2
      src/engine/ConfigParsing/EffectEntry/Mod.java
  4. 14
      src/engine/ConfigParsing/EffectsData/EffectData.java
  5. 9
      src/engine/ConfigParsing/EffectsParser.java

2
src/engine/ConfigParsing/EffectsData/Condition.java → src/engine/ConfigParsing/EffectEntry/Condition.java

@ -1,4 +1,4 @@
package engine.ConfigParsing.EffectsData; package engine.ConfigParsing.EffectEntry;
public class Condition { public class Condition {
public String type; public String type;

12
src/engine/ConfigParsing/EffectEntry/EffectEntry.java

@ -0,0 +1,12 @@
package engine.ConfigParsing.EffectEntry;
import java.util.HashSet;
public class EffectEntry {
public String id;
public String name;
public int icon;
public HashSet<String> sources;
public HashSet<String> mods;
public HashSet<String> conditions;
}

2
src/engine/ConfigParsing/EffectsData/Mod.java → src/engine/ConfigParsing/EffectEntry/Mod.java

@ -1,4 +1,4 @@
package engine.ConfigParsing.EffectsData; package engine.ConfigParsing.EffectEntry;
import engine.mbEnums; import engine.mbEnums;

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

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

9
src/engine/ConfigParsing/EffectsParser.java

@ -6,10 +6,9 @@
// Magicbane Emulator Project © 2013 - 2024 // Magicbane Emulator Project © 2013 - 2024
// www.magicbane.com // www.magicbane.com
package engine.ConfigParsing; package engine.ConfigParsing;
import engine.ConfigParsing.EffectsData.EffectData; import engine.ConfigParsing.EffectEntry.EffectEntry;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import java.io.IOException; import java.io.IOException;
@ -24,7 +23,7 @@ import java.util.regex.Pattern;
public class EffectsParser { public class EffectsParser {
public static String EffectsPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Effects.cfg"; public static String EffectsPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Effects.cfg";
public static HashMap<String, EffectData> effect_data = new HashMap<>(); public static HashMap<String, EffectEntry> effect_data = new HashMap<>();
private static final Pattern EFFECT_REGEX = Pattern.compile("<EFFECTBEGIN>(.+?)</EFFECTEND>", Pattern.DOTALL); private static final Pattern EFFECT_REGEX = Pattern.compile("<EFFECTBEGIN>(.+?)</EFFECTEND>", Pattern.DOTALL);
private static final Pattern SOURCE_REGEX = Pattern.compile("<SOURCEBEGIN>(.+?)</SOURCEEND>", Pattern.DOTALL); private static final Pattern SOURCE_REGEX = Pattern.compile("<SOURCEBEGIN>(.+?)</SOURCEEND>", Pattern.DOTALL);
private static final Pattern MODS_REGEX = Pattern.compile("<MODSBEGIN>(.+?)</MODSEND>", Pattern.DOTALL); private static final Pattern MODS_REGEX = Pattern.compile("<MODSBEGIN>(.+?)</MODSEND>", Pattern.DOTALL);
@ -43,4 +42,8 @@ public class EffectsParser {
} }
private static void parseEffectEntry(String effectEntry) {
}
} }

Loading…
Cancel
Save