Remove the DB power, cast prereq and power fail condition loaders

getAllPowersBase, getFailConditions, PowerPrereq.getAllPowerPrereqs and
the PowersBase/PowerPrereq ResultSet constructors. Powers come from
Powers.cfg since ac72d2c8 (tested).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-26 10:09:31 -04:00
1 parent ac72d2c8d2
commit f44f1ca138
3 files changed
-296

No files matched your search

-68
View File
@@ -9,16 +9,8 @@
package engine.powers;
import engine.gameManager.DbManager;
import engine.mbEnums.EquipSlotType;
import engine.parsers.objects.wpak.PowerTemplate;
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;
public class PowerPrereq {
@@ -35,34 +27,6 @@ public class PowerPrereq {
}
/**
* ResultSet Constructor
*/
public PowerPrereq(ResultSet rs, int type) throws SQLException {
// this.IDString = rs.getString("IDString");
if (type == 1) {
this.effect = rs.getString("messageone");
this.message = rs.getString("messagetwo");
this.mainHand = false;
this.required = false;
} else if (type == 2) {
String sl = rs.getString("messageone");
if (sl.equals("RHELD"))
this.mainHand = true;
else if (sl.equals("LHELD"))
this.mainHand = false;
this.effect = "";
this.message = rs.getString("messagetwo");
this.required = (rs.getInt("required") == 1) ? true : false;
} else { //targetEffectPrereq
this.effect = rs.getString("messageone");
this.message = "";
this.mainHand = false;
this.required = (rs.getInt("required") == 1) ? true : false;
}
}
// EFFECTPREREQ= on the caster
public PowerPrereq(PowerTemplate.EffectPrereq effectPrereq) {
@@ -90,38 +54,6 @@ public class PowerPrereq {
this.required = equipPrereq.required;
}
public static void getAllPowerPrereqs(HashMap<String, PowersBase> powers) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_powercastprereq;")) {
ResultSet rs = preparedStatement.executeQuery();
int type;
String IDString;
PowerPrereq toAdd;
PowersBase pb;
while (rs.next()) {
IDString = rs.getString("IDString");
pb = powers.get(IDString);
if (pb != null) {
type = rs.getInt("Type");
toAdd = new PowerPrereq(rs, type);
if (type == 1)
pb.getEffectPrereqs().add(toAdd);
else if (type == 2)
pb.getEquipPrereqs().add(toAdd);
else
pb.getTargetEffectPrereqs().add(toAdd);
}
}
rs.close();
} catch (Exception e) {
Logger.error(e.toString());
}
}
public String getEffect() {
return this.effect;
}