Browse Source

Support for multiple power enrties.

feature-config-parsing2
MagicBot 3 months ago
parent
commit
1b5b904a8f
  1. 15
      src/engine/wpak/PowerData.java
  2. 6
      src/engine/wpak/PowerEntry.java
  3. 10
      src/engine/wpak/PowersParser.java

15
src/engine/wpak/PowerData.java

@ -0,0 +1,15 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2024
// www.magicbane.com
package engine.wpak;
public class PowerData {
public String power;
public String power_type;
public int icon;
}

6
src/engine/wpak/PowerEntry.java

@ -8,11 +8,11 @@
package engine.wpak; package engine.wpak;
public class PowerEntry { import java.util.ArrayList;
public class PowerEntry {
public String power_id; public String power_id;
public String power; public ArrayList<PowerData> powers = new ArrayList<>();
public String power_type;
public int icon; public int icon;
public String powerbase; public String powerbase;
public String target_type; public String target_type;

10
src/engine/wpak/PowersParser.java

@ -67,9 +67,13 @@ public class PowersParser {
if (powerHeader.size() != 22) if (powerHeader.size() != 22)
Logger.error(powerEntry.power_id); Logger.error(powerEntry.power_id);
powerEntry.power = powerHeader.get(1).replaceAll("\"", ""); PowerData power = new PowerData();
powerEntry.power_type = powerHeader.get(2);
powerEntry.icon = Integer.parseInt(powerHeader.get(3)); power.power = powerHeader.get(1).replaceAll("\"", "");
power.power_type = powerHeader.get(2);
power.icon = Integer.parseInt(powerHeader.get(3));
powerEntry.powers.add(power);
powerEntry.powerbase = powerHeader.get(4).replaceAll("\"", ""); powerEntry.powerbase = powerHeader.get(4).replaceAll("\"", "");
powerEntry.target_type = powerHeader.get(5); powerEntry.target_type = powerHeader.get(5);
powerEntry.range = Integer.parseInt(powerHeader.get(6)); powerEntry.range = Integer.parseInt(powerHeader.get(6));

Loading…
Cancel
Save