Browse Source

Debug code added

feature-config-parsing2
MagicBot 4 months ago
parent
commit
a81f90238b
  1. 80
      src/engine/wpak/PowersParser.java

80
src/engine/wpak/PowersParser.java

@ -9,6 +9,7 @@
package engine.wpak; package engine.wpak;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import org.pmw.tinylog.Logger;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -43,48 +44,57 @@ public class PowersParser {
private static PowerEntry parsePowerEntry(String powerData) { private static PowerEntry parsePowerEntry(String powerData) {
PowerEntry powerEntry = new PowerEntry(); PowerEntry powerEntry = new PowerEntry();
String[] powerEntries = powerData.trim().split("\n");
ArrayList<String> powerHeader = new ArrayList<>(); try {
// Parse header String[] powerEntries = powerData.trim().split("\n");
ArrayList<String> powerHeader = new ArrayList<>();
String headerString = powerEntries[0];
headerString = headerString.replace("\n", " "); // Parse header
Matcher matcher = STRSPLIT_REGEX.matcher(headerString); String headerString = powerEntries[0];
headerString = headerString.replace("\n", " ");
while (matcher.find())
powerHeader.add(matcher.group().trim()); Matcher matcher = STRSPLIT_REGEX.matcher(headerString);
powerEntry.power_id = powerHeader.get(0); while (matcher.find())
powerEntry.power_name = powerHeader.get(1).replaceAll("\"", ""); powerHeader.add(matcher.group().trim());
powerEntry.power_type = powerHeader.get(2);
powerEntry.skill_id = Integer.parseInt(powerHeader.get(3)); powerEntry.power_id = powerHeader.get(0);
powerEntry.skill_name = powerHeader.get(4).replaceAll("\"", ""); powerEntry.power_name = powerHeader.get(1).replaceAll("\"", "");
powerEntry.target_type = powerHeader.get(5); powerEntry.power_type = powerHeader.get(2);
powerEntry.range = Integer.parseInt(powerHeader.get(6)); powerEntry.skill_id = Integer.parseInt(powerHeader.get(3));
powerEntry.radiusType = powerHeader.get(7); powerEntry.skill_name = powerHeader.get(4).replaceAll("\"", "");
powerEntry.radius = Integer.parseInt(powerHeader.get(8)); powerEntry.target_type = powerHeader.get(5);
powerEntry.groupReq = powerHeader.get(9); powerEntry.range = Integer.parseInt(powerHeader.get(6));
powerEntry.costType = powerHeader.get(10); powerEntry.radiusType = powerHeader.get(7);
powerEntry.cost = Float.parseFloat(powerHeader.get(11)); powerEntry.radius = Integer.parseInt(powerHeader.get(8));
powerEntry.unknown01 = Integer.parseInt(powerHeader.get(12)); powerEntry.groupReq = powerHeader.get(9);
powerEntry.unknown02 = Integer.parseInt(powerHeader.get(13)); powerEntry.costType = powerHeader.get(10);
powerEntry.cast_time = Float.parseFloat(powerHeader.get(14)); powerEntry.cost = Float.parseFloat(powerHeader.get(11));
powerEntry.cool_down = Float.parseFloat(powerHeader.get(15)); powerEntry.unknown01 = Integer.parseInt(powerHeader.get(12));
powerEntry.recycle_time = Float.parseFloat(powerHeader.get(16)); powerEntry.unknown02 = Integer.parseInt(powerHeader.get(13));
powerEntry.unknown03 = Integer.parseInt(powerHeader.get(17)); powerEntry.cast_time = Float.parseFloat(powerHeader.get(14));
powerEntry.combatRequirement = powerHeader.get(18); powerEntry.cool_down = Float.parseFloat(powerHeader.get(15));
powerEntry.unknown04 = Integer.parseInt(powerHeader.get(19)); powerEntry.recycle_time = Float.parseFloat(powerHeader.get(16));
powerEntry.unknown05 = Integer.parseInt(powerHeader.get(20)); powerEntry.unknown03 = Integer.parseInt(powerHeader.get(17));
powerEntry.targetRequirement = powerHeader.get(21); powerEntry.combatRequirement = powerHeader.get(18);
powerEntry.unknown04 = Integer.parseInt(powerHeader.get(19));
powerEntry.unknown05 = Integer.parseInt(powerHeader.get(20));
powerEntry.targetRequirement = powerHeader.get(21);
for (int x = 2; x < powerEntries.length; x++) { for (int x = 2; x < powerEntries.length; x++) {
// Parse key/pair values // Parse key/pair values
// via switch // via switch
} }
} catch (Exception e) {
Logger.error(powerEntry.power_id);
}
return powerEntry; return powerEntry;
} }

Loading…
Cancel
Save