Db methods moved to db system.
This commit is contained in:
@@ -11,13 +11,11 @@ package engine.powers;
|
||||
|
||||
import engine.Enum.PowerCategoryType;
|
||||
import engine.Enum.PowerTargetType;
|
||||
import engine.objects.PreparedStatementShared;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PowersBase {
|
||||
|
||||
@@ -340,57 +338,6 @@ public class PowersBase {
|
||||
this.monsterTypeRestrictions.add(ct);
|
||||
}
|
||||
|
||||
public static ArrayList<PowersBase> getAllPowersBase() {
|
||||
PreparedStatementShared ps = null;
|
||||
ArrayList<PowersBase> out = new ArrayList<>();
|
||||
try {
|
||||
ps = new PreparedStatementShared("SELECT * FROM static_power_powerbase");
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
PowersBase toAdd = new PowersBase(rs);
|
||||
out.add(toAdd);
|
||||
}
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
Logger.error( e.toString());
|
||||
} finally {
|
||||
ps.release();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
public static void getFailConditions(HashMap<String, PowersBase> powers) {
|
||||
PreparedStatementShared ps = null;
|
||||
try {
|
||||
ps = new PreparedStatementShared("SELECT IDString, type FROM static_power_failcondition where powerOrEffect = 'Power'");
|
||||
ResultSet rs = ps.executeQuery();
|
||||
String type, IDString; PowersBase pb;
|
||||
while (rs.next()) {
|
||||
type = rs.getString("type");
|
||||
IDString = rs.getString("IDString");
|
||||
pb = powers.get(IDString);
|
||||
if (pb != null) {
|
||||
switch (type) {
|
||||
case "CastSpell":
|
||||
pb.cancelOnCastSpell = true;
|
||||
break;
|
||||
case "TakeDamage":
|
||||
pb.cancelOnTakeDamage = true;
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
Logger.error("null power for Grief " + IDString);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
Logger.error( e.toString());
|
||||
} finally {
|
||||
ps.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
|
||||
Reference in New Issue
Block a user