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:
1 parent
ac72d2c8d2
commit
f44f1ca138
3 files changed
-296
No files matched your search
@@ -9,18 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.SkillReq;
|
||||
import engine.powers.PowersBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class dbSkillReqHandler extends dbHandlerBase {
|
||||
|
||||
@@ -28,52 +18,4 @@ public class dbSkillReqHandler extends dbHandlerBase {
|
||||
this.localClass = SkillReq.class;
|
||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||
}
|
||||
|
||||
public static ArrayList<PowersBase> getAllPowersBase() {
|
||||
|
||||
ArrayList<PowersBase> powerBaseList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_powerbase")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
PowersBase toAdd = new PowersBase(rs);
|
||||
powerBaseList.add(toAdd);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return powerBaseList;
|
||||
}
|
||||
|
||||
public static void getFailConditions(HashMap<String, PowersBase> powers) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT IDString, type FROM static_power_failcondition where powerOrEffect = 'Power'")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String type = rs.getString("type");
|
||||
String IDString = rs.getString("IDString");
|
||||
PowersBase pb = powers.get(IDString);
|
||||
|
||||
if (pb != null)
|
||||
switch (type) {
|
||||
case "CastSpell":
|
||||
pb.cancelOnCastSpell = true;
|
||||
break;
|
||||
case "TakeDamage":
|
||||
pb.cancelOnTakeDamage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user