From 1b5b904a8f544b4e84d27a7953667d25880c4585 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 17 Aug 2024 14:51:18 -0400 Subject: [PATCH] Support for multiple power enrties. --- src/engine/wpak/PowerData.java | 15 +++++++++++++++ src/engine/wpak/PowerEntry.java | 6 +++--- src/engine/wpak/PowersParser.java | 10 +++++++--- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 src/engine/wpak/PowerData.java diff --git a/src/engine/wpak/PowerData.java b/src/engine/wpak/PowerData.java new file mode 100644 index 00000000..e325485c --- /dev/null +++ b/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; +} diff --git a/src/engine/wpak/PowerEntry.java b/src/engine/wpak/PowerEntry.java index bddef277..4e83d03c 100644 --- a/src/engine/wpak/PowerEntry.java +++ b/src/engine/wpak/PowerEntry.java @@ -8,11 +8,11 @@ package engine.wpak; -public class PowerEntry { +import java.util.ArrayList; +public class PowerEntry { public String power_id; - public String power; - public String power_type; + public ArrayList powers = new ArrayList<>(); public int icon; public String powerbase; public String target_type; diff --git a/src/engine/wpak/PowersParser.java b/src/engine/wpak/PowersParser.java index 0c5bc193..0bd3c1a3 100644 --- a/src/engine/wpak/PowersParser.java +++ b/src/engine/wpak/PowersParser.java @@ -67,9 +67,13 @@ public class PowersParser { if (powerHeader.size() != 22) Logger.error(powerEntry.power_id); - powerEntry.power = powerHeader.get(1).replaceAll("\"", ""); - powerEntry.power_type = powerHeader.get(2); - powerEntry.icon = Integer.parseInt(powerHeader.get(3)); + PowerData power = new PowerData(); + + 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.target_type = powerHeader.get(5); powerEntry.range = Integer.parseInt(powerHeader.get(6));