Browse Source

Refactored poweractions

feature-config-usage
MagicBot 4 months ago
parent
commit
82cefce424
  1. 16
      src/engine/powers/poweractions/CreateMobPowerAction.java
  2. 7
      src/engine/powers/poweractions/TransformPowerAction.java
  3. 2
      src/engine/wpak/PowerActionParser.java

16
src/engine/powers/poweractions/CreateMobPowerAction.java

@ -22,9 +22,9 @@ import engine.net.client.msg.PetMsg;
import engine.objects.*; import engine.objects.*;
import engine.powers.ActionsBase; import engine.powers.ActionsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.wpak.data.PowerAction;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -33,19 +33,11 @@ public class CreateMobPowerAction extends AbstractPowerAction {
private int mobID; private int mobID;
private int mobLevel; private int mobLevel;
public CreateMobPowerAction(ResultSet rs) throws SQLException { public CreateMobPowerAction(PowerAction rs) throws SQLException {
super(rs); super(rs);
this.mobID = rs.getInt("mobID"); this.mobID = rs.petRace;
this.mobLevel = rs.getInt("mobLevel"); this.mobLevel = rs.petLevel;
}
public int getMobID() {
return this.mobID;
}
public int getMobLevel() {
return this.mobLevel;
} }
@Override @Override

7
src/engine/powers/poweractions/TransformPowerAction.java

@ -16,9 +16,8 @@ import engine.objects.AbstractWorldObject;
import engine.powers.ActionsBase; import engine.powers.ActionsBase;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.wpak.data.PowerAction;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
@ -27,10 +26,10 @@ public class TransformPowerAction extends AbstractPowerAction {
private String effectID; private String effectID;
private EffectsBase effect; private EffectsBase effect;
public TransformPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException { public TransformPowerAction(PowerAction rs, HashMap<String, EffectsBase> effects) {
super(rs); super(rs);
this.effectID = rs.getString("effectID"); this.effectID = rs.effects.get(0).effect_id;
this.effect = effects.get(this.effectID); this.effect = effects.get(this.effectID);
} }

2
src/engine/wpak/PowerActionParser.java

@ -93,8 +93,8 @@ public class PowerActionParser {
powerAction.effects.add(effect); powerAction.effects.add(effect);
break; break;
case "CreateMob": case "CreateMob":
powerAction.petLevel = Integer.parseInt(headerIterator.next());
powerAction.petRace = Integer.parseInt(headerIterator.next()); powerAction.petRace = Integer.parseInt(headerIterator.next());
powerAction.petLevel = Integer.parseInt(headerIterator.next());
break; break;
case "DamageOverTime": case "DamageOverTime":
effect = new Effect(); effect = new Effect();

Loading…
Cancel
Save