From 458bdbd72d55336a6c6bafa3af1ec3219efb2812 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 7 Sep 2024 14:56:21 -0400 Subject: [PATCH] Track poweraction work --- .../powers/poweractions/TrackPowerAction.java | 14 +++++++------- src/engine/wpak/PowerActionParser.java | 2 +- src/engine/wpak/data/TrackEntry.java | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/engine/powers/poweractions/TrackPowerAction.java b/src/engine/powers/poweractions/TrackPowerAction.java index c9d4fdee..bd3fe4d7 100644 --- a/src/engine/powers/poweractions/TrackPowerAction.java +++ b/src/engine/powers/poweractions/TrackPowerAction.java @@ -17,8 +17,8 @@ import engine.powers.ActionsBase; import engine.powers.EffectsBase; import engine.powers.PowersBase; import engine.server.MBServerStatics; +import engine.wpak.data.PowerAction; -import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; @@ -37,14 +37,14 @@ public class TrackPowerAction extends AbstractPowerAction { private int maxTrack; private EffectsBase effect; - public TrackPowerAction(ResultSet rs, HashMap effects) throws SQLException { - super(rs); + public TrackPowerAction(PowerAction powerAction, HashMap effects) throws SQLException { + super(powerAction); - this.effectID = rs.getString("effectID"); - int flags = rs.getInt("flags"); + this.effectID = powerAction.effects.get(0).effect_id; + int flags = powerAction.getInt("flags"); this.trackPlayer = ((flags & 1024) == 1) ? true : false; this.trackCorpse = ((flags & 2048) == 1) ? true : false; - String trackFilter = rs.getString("trackFilter"); + String trackFilter = powerAction.getString("trackFilter"); this.trackAll = trackFilter.equals("All") ? true : false; this.trackDragon = trackFilter.equals("Dragon") ? true : false; this.trackGiant = trackFilter.equals("Giant") ? true : false; @@ -52,7 +52,7 @@ public class TrackPowerAction extends AbstractPowerAction { this.trackUndead = trackFilter.equals("Undead") ? true : false; this.trackVampire = trackFilter.equals("Vampire") ? true : false; - this.maxTrack = rs.getInt("maxTrack"); + this.maxTrack = powerAction.getInt("maxTrack"); this.effect = effects.get(this.effectID); } diff --git a/src/engine/wpak/PowerActionParser.java b/src/engine/wpak/PowerActionParser.java index b66f707e..67f5b298 100644 --- a/src/engine/wpak/PowerActionParser.java +++ b/src/engine/wpak/PowerActionParser.java @@ -181,7 +181,7 @@ public class PowerActionParser { trackEntry.action_id = headerIterator.next(); trackEntry.trackPlayer = Boolean.parseBoolean(headerIterator.next()); trackEntry.trackCorpse = Boolean.parseBoolean(headerIterator.next()); - trackEntry.filter = headerIterator.next(); + trackEntry.filter = mbEnums.MonsterType.valueOf(headerIterator.next()); trackEntry.min = Integer.parseInt(headerIterator.next()); trackEntry.max = Integer.parseInt(headerIterator.next()); powerAction.trackEntry = trackEntry; diff --git a/src/engine/wpak/data/TrackEntry.java b/src/engine/wpak/data/TrackEntry.java index 18bfc3cb..0502d384 100644 --- a/src/engine/wpak/data/TrackEntry.java +++ b/src/engine/wpak/data/TrackEntry.java @@ -8,12 +8,14 @@ package engine.wpak.data; +import engine.mbEnums; + public class TrackEntry { public String action_id; public Boolean trackPlayer; public Boolean trackCorpse; - public String filter; + public mbEnums.MonsterType filter; public int min; public int max; }