init moved to configmanager.
This commit is contained in:
@@ -11,6 +11,8 @@ package engine.gameManager;
|
|||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
import engine.server.login.LoginServer;
|
import engine.server.login.LoginServer;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
|
import engine.wpak.EffectsParser;
|
||||||
|
import engine.wpak.PowersParser;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -164,6 +166,14 @@ public enum ConfigManager {
|
|||||||
Logger.info("Compiling regex");
|
Logger.info("Compiling regex");
|
||||||
|
|
||||||
regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue()));
|
regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue()));
|
||||||
|
|
||||||
|
Logger.info("Loading WPAK data");
|
||||||
|
|
||||||
|
|
||||||
|
EffectsParser.parseWpakFile();
|
||||||
|
PowersParser.parseWpakFile();
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ import engine.workthreads.DisconnectTrashTask;
|
|||||||
import engine.workthreads.HourlyJobThread;
|
import engine.workthreads.HourlyJobThread;
|
||||||
import engine.workthreads.PurgeOprhans;
|
import engine.workthreads.PurgeOprhans;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
import engine.wpak.EffectsParser;
|
|
||||||
import engine.wpak.PowersParser;
|
|
||||||
import org.pmw.tinylog.Configurator;
|
import org.pmw.tinylog.Configurator;
|
||||||
import org.pmw.tinylog.Level;
|
import org.pmw.tinylog.Level;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -95,9 +93,6 @@ public class WorldServer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectsParser.parseWpakFile();
|
|
||||||
PowersParser.parseWpakFile();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
worldServer = new WorldServer();
|
worldServer = new WorldServer();
|
||||||
|
|||||||
@@ -32,11 +32,17 @@ public class EffectsParser {
|
|||||||
private static final Pattern CONDITIONS_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
private static final Pattern CONDITIONS_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
||||||
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*"); // Regex ignores spaces within quotes
|
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*"); // Regex ignores spaces within quotes
|
||||||
|
|
||||||
public static void parseWpakFile() throws IOException {
|
public static void parseWpakFile() {
|
||||||
|
|
||||||
// Read .wpak file from disk
|
// Read .wpak file from disk
|
||||||
|
|
||||||
byte[] fileData = Files.readAllBytes(Paths.get(effectsPath));
|
byte[] fileData = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fileData = Files.readAllBytes(Paths.get(effectsPath));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
String fileContents = new String(fileData);
|
String fileContents = new String(fileData);
|
||||||
|
|
||||||
// Iterate over effect entries from .wpak data
|
// Iterate over effect entries from .wpak data
|
||||||
|
|||||||
@@ -28,11 +28,17 @@ public class PowersParser {
|
|||||||
private static final Pattern CONDITION_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
private static final Pattern CONDITION_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
||||||
private static final String powersPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Powers.cfg";
|
private static final String powersPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Powers.cfg";
|
||||||
|
|
||||||
public static void parseWpakFile() throws IOException {
|
public static void parseWpakFile() {
|
||||||
|
|
||||||
// Read .wpak file from disk
|
// Read .wpak file from disk
|
||||||
|
|
||||||
byte[] fileData = Files.readAllBytes(Paths.get(powersPath));
|
byte[] fileData = null;
|
||||||
|
try {
|
||||||
|
fileData = Files.readAllBytes(Paths.get(powersPath));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
String fileContents = new String(fileData);
|
String fileContents = new String(fileData);
|
||||||
|
|
||||||
// Iterate over power entries from .wpak data
|
// Iterate over power entries from .wpak data
|
||||||
|
|||||||
Reference in New Issue
Block a user