From 82cefce424aa8dbd5251f5726722cb0c95286d57 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 5 Sep 2024 15:25:29 -0400 Subject: [PATCH] Refactored poweractions --- .../poweractions/CreateMobPowerAction.java | 16 ++++------------ .../poweractions/TransformPowerAction.java | 7 +++---- src/engine/wpak/PowerActionParser.java | 2 +- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/engine/powers/poweractions/CreateMobPowerAction.java b/src/engine/powers/poweractions/CreateMobPowerAction.java index 88964b2c..4e19fa23 100644 --- a/src/engine/powers/poweractions/CreateMobPowerAction.java +++ b/src/engine/powers/poweractions/CreateMobPowerAction.java @@ -22,9 +22,9 @@ import engine.net.client.msg.PetMsg; import engine.objects.*; import engine.powers.ActionsBase; import engine.powers.PowersBase; +import engine.wpak.data.PowerAction; import org.pmw.tinylog.Logger; -import java.sql.ResultSet; import java.sql.SQLException; @@ -33,19 +33,11 @@ public class CreateMobPowerAction extends AbstractPowerAction { private int mobID; private int mobLevel; - public CreateMobPowerAction(ResultSet rs) throws SQLException { + public CreateMobPowerAction(PowerAction rs) throws SQLException { super(rs); - this.mobID = rs.getInt("mobID"); - this.mobLevel = rs.getInt("mobLevel"); - } - - public int getMobID() { - return this.mobID; - } - - public int getMobLevel() { - return this.mobLevel; + this.mobID = rs.petRace; + this.mobLevel = rs.petLevel; } @Override diff --git a/src/engine/powers/poweractions/TransformPowerAction.java b/src/engine/powers/poweractions/TransformPowerAction.java index cd4a95b3..f115e07e 100644 --- a/src/engine/powers/poweractions/TransformPowerAction.java +++ b/src/engine/powers/poweractions/TransformPowerAction.java @@ -16,9 +16,8 @@ import engine.objects.AbstractWorldObject; import engine.powers.ActionsBase; import engine.powers.EffectsBase; import engine.powers.PowersBase; +import engine.wpak.data.PowerAction; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.HashMap; @@ -27,10 +26,10 @@ public class TransformPowerAction extends AbstractPowerAction { private String effectID; private EffectsBase effect; - public TransformPowerAction(ResultSet rs, HashMap effects) throws SQLException { + public TransformPowerAction(PowerAction rs, HashMap effects) { super(rs); - this.effectID = rs.getString("effectID"); + this.effectID = rs.effects.get(0).effect_id; this.effect = effects.get(this.effectID); } diff --git a/src/engine/wpak/PowerActionParser.java b/src/engine/wpak/PowerActionParser.java index 9666194a..e022cac1 100644 --- a/src/engine/wpak/PowerActionParser.java +++ b/src/engine/wpak/PowerActionParser.java @@ -93,8 +93,8 @@ public class PowerActionParser { powerAction.effects.add(effect); break; case "CreateMob": - powerAction.petLevel = Integer.parseInt(headerIterator.next()); powerAction.petRace = Integer.parseInt(headerIterator.next()); + powerAction.petLevel = Integer.parseInt(headerIterator.next()); break; case "DamageOverTime": effect = new Effect();