From deab274ba2d5c5a880257df8542f69dbf39b17f8 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 5 Sep 2024 15:36:38 -0400 Subject: [PATCH] Refactored poweractions --- src/engine/powers/poweractions/BlockPowerAction.java | 6 ++---- src/engine/powers/poweractions/ClaimMinePowerAction.java | 6 ++---- .../powers/poweractions/ClearAggroPowerAction.java | 6 ++---- .../powers/poweractions/ClearNearbyAggroPowerAction.java | 6 ++---- src/engine/powers/poweractions/CreateMobPowerAction.java | 4 +--- src/engine/powers/poweractions/InvisPowerAction.java | 8 ++++---- src/engine/powers/poweractions/MobRecallPowerAction.java | 9 +++------ src/engine/powers/poweractions/OpenGatePowerAction.java | 6 ++---- src/engine/powers/poweractions/RecallPowerAction.java | 6 ++---- src/engine/powers/poweractions/ResurrectPowerAction.java | 6 ++---- .../powers/poweractions/RunegateTeleportPowerAction.java | 6 ++---- .../powers/poweractions/SimpleDamagePowerAction.java | 6 ++---- .../powers/poweractions/SpireDisablePowerAction.java | 6 ++---- src/engine/powers/poweractions/StealPowerAction.java | 5 ++--- src/engine/powers/poweractions/SummonPowerAction.java | 6 ++---- src/engine/powers/poweractions/TreeChokePowerAction.java | 6 ++---- 16 files changed, 34 insertions(+), 64 deletions(-) diff --git a/src/engine/powers/poweractions/BlockPowerAction.java b/src/engine/powers/poweractions/BlockPowerAction.java index 0ae43341..9a85c94c 100644 --- a/src/engine/powers/poweractions/BlockPowerAction.java +++ b/src/engine/powers/poweractions/BlockPowerAction.java @@ -14,14 +14,12 @@ import engine.objects.AbstractCharacter; import engine.objects.AbstractWorldObject; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class BlockPowerAction extends AbstractPowerAction { - public BlockPowerAction(ResultSet rs) throws SQLException { + public BlockPowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/ClaimMinePowerAction.java b/src/engine/powers/poweractions/ClaimMinePowerAction.java index b67dbb8a..3c51acdd 100644 --- a/src/engine/powers/poweractions/ClaimMinePowerAction.java +++ b/src/engine/powers/poweractions/ClaimMinePowerAction.java @@ -15,14 +15,12 @@ import engine.mbEnums; import engine.objects.*; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class ClaimMinePowerAction extends AbstractPowerAction { - public ClaimMinePowerAction(ResultSet rs) throws SQLException { + public ClaimMinePowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/ClearAggroPowerAction.java b/src/engine/powers/poweractions/ClearAggroPowerAction.java index 7333d722..9db10289 100644 --- a/src/engine/powers/poweractions/ClearAggroPowerAction.java +++ b/src/engine/powers/poweractions/ClearAggroPowerAction.java @@ -16,14 +16,12 @@ import engine.objects.AbstractWorldObject; import engine.objects.Mob; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class ClearAggroPowerAction extends AbstractPowerAction { - public ClearAggroPowerAction(ResultSet rs) throws SQLException { + public ClearAggroPowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/ClearNearbyAggroPowerAction.java b/src/engine/powers/poweractions/ClearNearbyAggroPowerAction.java index 4fb86784..76f7af8d 100644 --- a/src/engine/powers/poweractions/ClearNearbyAggroPowerAction.java +++ b/src/engine/powers/poweractions/ClearNearbyAggroPowerAction.java @@ -15,14 +15,12 @@ import engine.objects.AbstractCharacter; import engine.objects.AbstractWorldObject; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class ClearNearbyAggroPowerAction extends AbstractPowerAction { - public ClearNearbyAggroPowerAction(ResultSet rs) throws SQLException { + public ClearNearbyAggroPowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/CreateMobPowerAction.java b/src/engine/powers/poweractions/CreateMobPowerAction.java index 4e19fa23..13f26576 100644 --- a/src/engine/powers/poweractions/CreateMobPowerAction.java +++ b/src/engine/powers/poweractions/CreateMobPowerAction.java @@ -25,15 +25,13 @@ import engine.powers.PowersBase; import engine.wpak.data.PowerAction; import org.pmw.tinylog.Logger; -import java.sql.SQLException; - public class CreateMobPowerAction extends AbstractPowerAction { private int mobID; private int mobLevel; - public CreateMobPowerAction(PowerAction rs) throws SQLException { + public CreateMobPowerAction(PowerAction rs) { super(rs); this.mobID = rs.petRace; diff --git a/src/engine/powers/poweractions/InvisPowerAction.java b/src/engine/powers/poweractions/InvisPowerAction.java index f213da91..02a43f63 100644 --- a/src/engine/powers/poweractions/InvisPowerAction.java +++ b/src/engine/powers/poweractions/InvisPowerAction.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,11 @@ public class InvisPowerAction extends AbstractPowerAction { private String effectID; private EffectsBase effect; - public InvisPowerAction(ResultSet rs, HashMap effects) throws SQLException { + public InvisPowerAction(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/powers/poweractions/MobRecallPowerAction.java b/src/engine/powers/poweractions/MobRecallPowerAction.java index 0b7cddcc..373704af 100644 --- a/src/engine/powers/poweractions/MobRecallPowerAction.java +++ b/src/engine/powers/poweractions/MobRecallPowerAction.java @@ -14,17 +14,14 @@ import engine.math.Vector3fImmutable; import engine.mbEnums.GameObjectType; import engine.objects.AbstractCharacter; import engine.objects.AbstractWorldObject; -import engine.objects.Mob; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class MobRecallPowerAction extends AbstractPowerAction { - public MobRecallPowerAction(ResultSet rs) throws SQLException { + public MobRecallPowerAction(PowerAction rs) { super(rs); } @@ -41,7 +38,7 @@ public class MobRecallPowerAction extends AbstractPowerAction { MovementManager.translocate(awoac, awoac.getBindLoc()); if (awoac.getObjectType() == GameObjectType.Mob) { //MobAI.setAwake((Mob)awoac,true); - ((Mob) awoac).setCombatTarget(null); + (awoac).setCombatTarget(null); } diff --git a/src/engine/powers/poweractions/OpenGatePowerAction.java b/src/engine/powers/poweractions/OpenGatePowerAction.java index 2812049b..6a3c304a 100644 --- a/src/engine/powers/poweractions/OpenGatePowerAction.java +++ b/src/engine/powers/poweractions/OpenGatePowerAction.java @@ -19,16 +19,14 @@ import engine.objects.Building; import engine.objects.Runegate; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class OpenGatePowerAction extends AbstractPowerAction { /** * ResultSet Constructor */ - public OpenGatePowerAction(ResultSet rs) throws SQLException { + public OpenGatePowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/RecallPowerAction.java b/src/engine/powers/poweractions/RecallPowerAction.java index 340b6261..81bae0a1 100644 --- a/src/engine/powers/poweractions/RecallPowerAction.java +++ b/src/engine/powers/poweractions/RecallPowerAction.java @@ -25,14 +25,12 @@ import engine.objects.PlayerCharacter; import engine.powers.ActionsBase; import engine.powers.PowersBase; import engine.server.MBServerStatics; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class RecallPowerAction extends AbstractPowerAction { - public RecallPowerAction(ResultSet rs) throws SQLException { + public RecallPowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/ResurrectPowerAction.java b/src/engine/powers/poweractions/ResurrectPowerAction.java index b21e8de8..8b3c4c68 100644 --- a/src/engine/powers/poweractions/ResurrectPowerAction.java +++ b/src/engine/powers/poweractions/ResurrectPowerAction.java @@ -14,14 +14,12 @@ import engine.objects.AbstractCharacter; import engine.objects.AbstractWorldObject; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class ResurrectPowerAction extends AbstractPowerAction { - public ResurrectPowerAction(ResultSet rs) throws SQLException { + public ResurrectPowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/RunegateTeleportPowerAction.java b/src/engine/powers/poweractions/RunegateTeleportPowerAction.java index 1f1940fc..048e8372 100644 --- a/src/engine/powers/poweractions/RunegateTeleportPowerAction.java +++ b/src/engine/powers/poweractions/RunegateTeleportPowerAction.java @@ -17,9 +17,7 @@ import engine.net.client.msg.PromptRecallMsg; import engine.objects.*; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; import static engine.math.FastMath.sqr; import static engine.math.FastMath.sqrt; @@ -29,7 +27,7 @@ public class RunegateTeleportPowerAction extends AbstractPowerAction { /** * ResultSet Constructor */ - public RunegateTeleportPowerAction(ResultSet rs) throws SQLException { + public RunegateTeleportPowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/SimpleDamagePowerAction.java b/src/engine/powers/poweractions/SimpleDamagePowerAction.java index 1c16c146..f410d029 100644 --- a/src/engine/powers/poweractions/SimpleDamagePowerAction.java +++ b/src/engine/powers/poweractions/SimpleDamagePowerAction.java @@ -14,16 +14,14 @@ import engine.objects.AbstractCharacter; import engine.objects.AbstractWorldObject; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class SimpleDamagePowerAction extends AbstractPowerAction { private int simpleDamage; - public SimpleDamagePowerAction(ResultSet rs) throws SQLException { + public SimpleDamagePowerAction(PowerAction rs) { super(rs); this.simpleDamage = rs.getInt("simpleDamage"); diff --git a/src/engine/powers/poweractions/SpireDisablePowerAction.java b/src/engine/powers/poweractions/SpireDisablePowerAction.java index a92a3492..e1f032a0 100644 --- a/src/engine/powers/poweractions/SpireDisablePowerAction.java +++ b/src/engine/powers/poweractions/SpireDisablePowerAction.java @@ -19,16 +19,14 @@ import engine.objects.Building; import engine.objects.PlayerCharacter; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class SpireDisablePowerAction extends AbstractPowerAction { /** * ResultSet Constructor */ - public SpireDisablePowerAction(ResultSet rs) throws SQLException { + public SpireDisablePowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/StealPowerAction.java b/src/engine/powers/poweractions/StealPowerAction.java index 9260e4c2..02c366f4 100644 --- a/src/engine/powers/poweractions/StealPowerAction.java +++ b/src/engine/powers/poweractions/StealPowerAction.java @@ -22,9 +22,8 @@ import engine.objects.*; import engine.powers.ActionsBase; import engine.powers.PowersBase; import engine.server.MBServerStatics; +import engine.wpak.data.PowerAction; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.concurrent.ThreadLocalRandom; import static engine.math.FastMath.sqr; @@ -35,7 +34,7 @@ public class StealPowerAction extends AbstractPowerAction { /** * ResultSet Constructor */ - public StealPowerAction(ResultSet rs) throws SQLException { + public StealPowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/SummonPowerAction.java b/src/engine/powers/poweractions/SummonPowerAction.java index 283bca54..4d4a8876 100644 --- a/src/engine/powers/poweractions/SummonPowerAction.java +++ b/src/engine/powers/poweractions/SummonPowerAction.java @@ -23,16 +23,14 @@ import engine.objects.PlayerCharacter; import engine.objects.Zone; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class SummonPowerAction extends AbstractPowerAction { /** * ResultSet Constructor */ - public SummonPowerAction(ResultSet rs) throws SQLException { + public SummonPowerAction(PowerAction rs) { super(rs); } diff --git a/src/engine/powers/poweractions/TreeChokePowerAction.java b/src/engine/powers/poweractions/TreeChokePowerAction.java index d99be3c2..1bcdd8eb 100644 --- a/src/engine/powers/poweractions/TreeChokePowerAction.java +++ b/src/engine/powers/poweractions/TreeChokePowerAction.java @@ -14,14 +14,12 @@ import engine.objects.AbstractCharacter; import engine.objects.AbstractWorldObject; import engine.powers.ActionsBase; import engine.powers.PowersBase; - -import java.sql.ResultSet; -import java.sql.SQLException; +import engine.wpak.data.PowerAction; public class TreeChokePowerAction extends AbstractPowerAction { - public TreeChokePowerAction(ResultSet rs) throws SQLException { + public TreeChokePowerAction(PowerAction rs) { super(rs); }