Remove the DB effect loaders
Effects, modifiers, source types, effect fail conditions and item enchant values all come from Effects.cfg (4.6b). Removes dbEffectsBaseHandler, dbPowerHandler, the EffectsBase and effect modifier ResultSet constructors, EffectsBase.getFailConditions and LOAD_ENCHANT_VALUES. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e2ec8eb8a6
commit
dee936d8a5
72 files changed
-1126
No files matched your search
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.powers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.job.JobContainer;
|
||||
@@ -37,10 +36,6 @@ import engine.server.MBServerStatics;
|
||||
import engine.util.Hasher;
|
||||
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;
|
||||
import java.util.HashSet;
|
||||
@@ -95,39 +90,6 @@ public class EffectsBase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public EffectsBase(ResultSet rs) throws SQLException {
|
||||
|
||||
this.UUID = rs.getInt("ID");
|
||||
this.IDString = rs.getString("IDString");
|
||||
this.name = rs.getString("name");
|
||||
this.token = rs.getInt("Token");
|
||||
|
||||
//override tokens for some effects like Safemode that use the Action Token instead of the effect Token,
|
||||
switch (this.IDString) {
|
||||
case "INVIS-D":
|
||||
this.token = -1661751254;
|
||||
break;
|
||||
case "SafeMode":
|
||||
this.token = -1661750486;
|
||||
break;
|
||||
|
||||
}
|
||||
int flags = rs.getInt("flags");
|
||||
this.isItemEffect = ((flags & 1) != 0) ? true : false;
|
||||
this.isSpireEffect = ((flags & 2) != 0) ? true : false;
|
||||
this.ignoreMod = ((flags & 4) != 0) ? true : false;
|
||||
this.dontSave = ((flags & 8) != 0) ? true : false;
|
||||
|
||||
if (this.IDString.startsWith("PRE-"))
|
||||
this.isPrefix = true;
|
||||
else if (this.IDString.startsWith("SUF-"))
|
||||
this.isSuffix = true;
|
||||
// getFailConditions();
|
||||
}
|
||||
|
||||
public EffectsBase(EffectTemplate effectTemplate, int id) {
|
||||
|
||||
this.UUID = id;
|
||||
@@ -475,113 +437,6 @@ public class EffectsBase {
|
||||
EffectsBase.effectSourceTypeMap.get(this.token).add(EffectSourceType.GetEffectSourceType(source));
|
||||
}
|
||||
|
||||
public static void getFailConditions(HashMap<String, EffectsBase> effects) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_failcondition WHERE powerOrEffect = 'Effect';")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
PowerFailCondition failCondition = null;
|
||||
|
||||
while (rs.next()) {
|
||||
String fail = rs.getString("type");
|
||||
|
||||
|
||||
String IDString = rs.getString("IDString");
|
||||
failCondition = PowerFailCondition.valueOf(fail);
|
||||
|
||||
if (failCondition == null) {
|
||||
Logger.error("Couldn't Find FailCondition " + fail + " for " + IDString);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (EffectsBase.EffectFailConditions.get(IDString) == null) {
|
||||
EffectsBase.EffectFailConditions.put(IDString, new HashSet<>());
|
||||
}
|
||||
|
||||
EffectsBase.EffectFailConditions.get(IDString).add(failCondition);
|
||||
EffectsBase eb = effects.get(IDString);
|
||||
|
||||
switch (failCondition) {
|
||||
|
||||
case TakeDamage:
|
||||
|
||||
// dont go any further.
|
||||
|
||||
if (eb == null)
|
||||
break;
|
||||
|
||||
eb.cancelOnTakeDamage = true;
|
||||
|
||||
|
||||
eb.amount = rs.getFloat("amount");
|
||||
eb.amountRamp = rs.getFloat("ramp");
|
||||
eb.useRampAdd = rs.getBoolean("UseAddFormula");
|
||||
|
||||
String damageType1 = rs.getString("damageType1");
|
||||
String damageType2 = rs.getString("damageType2");
|
||||
String damageType3 = rs.getString("damageType3");
|
||||
|
||||
if (damageType1.isEmpty() && damageType2.isEmpty() && damageType3.isEmpty())
|
||||
break;
|
||||
|
||||
if (!EffectsBase.EffectDamageTypes.containsKey(eb.getToken()))
|
||||
EffectsBase.EffectDamageTypes.put(eb.getToken(), new HashSet<>());
|
||||
|
||||
mbEnums.DamageType dt = mbEnums.DamageType.getDamageType(damageType1);
|
||||
if (dt != null)
|
||||
EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
|
||||
|
||||
dt = mbEnums.DamageType.getDamageType(damageType2);
|
||||
if (dt != null)
|
||||
EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
|
||||
dt = mbEnums.DamageType.getDamageType(damageType3);
|
||||
if (dt != null)
|
||||
EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
|
||||
break;
|
||||
case Attack:
|
||||
eb.cancelOnAttack = true;
|
||||
break;
|
||||
case AttackSwing:
|
||||
eb.cancelOnAttackSwing = true;
|
||||
break;
|
||||
case Cast:
|
||||
eb.cancelOnCast = true;
|
||||
break;
|
||||
case CastSpell:
|
||||
eb.cancelOnCastSpell = true;
|
||||
break;
|
||||
case EquipChange:
|
||||
eb.cancelOnEquipChange = true;
|
||||
break;
|
||||
case Logout:
|
||||
eb.cancelOnLogout = true;
|
||||
break;
|
||||
case Move:
|
||||
eb.cancelOnMove = true;
|
||||
break;
|
||||
case NewCharm:
|
||||
eb.cancelOnNewCharm = true;
|
||||
break;
|
||||
case Sit:
|
||||
eb.cancelOnSit = true;
|
||||
break;
|
||||
case TerritoryClaim:
|
||||
eb.cancelOnTerritoryClaim = true;
|
||||
break;
|
||||
case UnEquip:
|
||||
eb.cancelOnUnEquip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getItemEffectsByName(String string) {
|
||||
if (EffectsBase.itemEffectsByName.containsKey(string))
|
||||
return EffectsBase.itemEffectsByName.get(string);
|
||||
|
||||
Reference in new issue
Block a user