forked from MagicBane/Server
Remove the DB power action list loader
Deletes ActionsBase.getActionsBase (static_power_action) and the
ResultSet constructor; the 4.9 switch (2a19a851) builds the lists from
Powers.cfg and was tested. No value change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2a19a85108
commit
17d82066d6
1 file changed
-83
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.powers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ModType;
|
||||
@@ -21,10 +20,6 @@ import engine.parsers.objects.wpak.PowerTemplate;
|
||||
import engine.powers.poweractions.AbstractPowerAction;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
@@ -59,38 +54,6 @@ public class ActionsBase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public ActionsBase(ResultSet rs, HashMap<String, AbstractPowerAction> apa) throws SQLException {
|
||||
|
||||
this.UUID = rs.getInt("ID") + ACTION_ID_OFFSET;
|
||||
this.IDString = rs.getString("powerID");
|
||||
this.effectID = rs.getString("effectID");
|
||||
this.minTrains = rs.getInt("minTrains");
|
||||
this.maxTrains = rs.getInt("maxTrains");
|
||||
this.duration = rs.getFloat("duration");
|
||||
this.ramp = rs.getFloat("ramp");
|
||||
this.addFormula = (rs.getInt("useAddFormula") == 1) ? true : false;
|
||||
this.stackType = rs.getString("stackType");
|
||||
this.stackTypeType = StackType.GetStackType(this.stackType);
|
||||
this.stackOrder = rs.getInt("stackOrder");
|
||||
this.stackPriority = rs.getString("stackPriority");
|
||||
|
||||
switch (stackPriority) {
|
||||
case "GreaterThanOrEqualTo":
|
||||
this.greaterThanEqual = true;
|
||||
break;
|
||||
case "Always":
|
||||
this.always = true;
|
||||
break;
|
||||
case "GreaterThan":
|
||||
this.greaterThan = true;
|
||||
break;
|
||||
}
|
||||
this.powerAction = apa.get(this.effectID);
|
||||
}
|
||||
|
||||
public ActionsBase(PowerTemplate.ActionEntry actionEntry, String powerID, int id, AbstractPowerAction powerAction) {
|
||||
|
||||
CurveRamp durationRamp = CurveRamp.fromCurve(actionEntry.duration_curve);
|
||||
@@ -158,52 +121,6 @@ public class ActionsBase {
|
||||
|
||||
}
|
||||
|
||||
// public static ArrayList<ActionsBase> getActionsBase(String ID) {
|
||||
// PreparedStatementShared ps = null;
|
||||
// ArrayList<ActionsBase> out = new ArrayList<ActionsBase>();
|
||||
// try {
|
||||
// ps = new PreparedStatementShared("SELECT * FROM actions where powerID = ?");
|
||||
// ps.setString(1, ID);
|
||||
// ResultSet rs = ps.executeQuery();
|
||||
// while (rs.next()) {
|
||||
// ActionsBase toAdd = new ActionsBase(rs);
|
||||
// out.add(toAdd);
|
||||
// }
|
||||
// rs.close();
|
||||
// } catch (Exception e) {
|
||||
// Logger.error("ActionsBase", e);
|
||||
// } finally {
|
||||
// ps.release();
|
||||
// }
|
||||
// return out;
|
||||
// }
|
||||
|
||||
public static void getActionsBase(HashMap<String, PowersBase> powers, HashMap<String, AbstractPowerAction> apa) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_action")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
String IDString;
|
||||
ActionsBase toAdd;
|
||||
PowersBase pb;
|
||||
|
||||
while (rs.next()) {
|
||||
IDString = rs.getString("powerID");
|
||||
pb = powers.get(IDString);
|
||||
if (pb != null) {
|
||||
toAdd = new ActionsBase(rs, apa);
|
||||
pb.getActions().add(toAdd);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.toString());
|
||||
}
|
||||
|
||||
addOpenGateActions(powers);
|
||||
}
|
||||
|
||||
public static void addOpenGateActions(HashMap<String, PowersBase> powers) {
|
||||
|
||||
int gateID = 5000;
|
||||
|
||||
Reference in new issue
Block a user