Browse Source

Refactor to remove abstraction.

master
MagicBot 2 years ago
parent
commit
df1b0e3f0f
  1. 27
      src/engine/db/handlers/dbEffectsResourceCostHandler.java
  2. 1
      src/engine/objects/Item.java

27
src/engine/db/handlers/dbEffectsResourceCostHandler.java

@ -9,8 +9,14 @@
package engine.db.handlers; package engine.db.handlers;
import engine.gameManager.DbManager;
import engine.objects.EffectsResourceCosts; import engine.objects.EffectsResourceCosts;
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.ArrayList;
public class dbEffectsResourceCostHandler extends dbHandlerBase { public class dbEffectsResourceCostHandler extends dbHandlerBase {
@ -19,12 +25,23 @@ public class dbEffectsResourceCostHandler extends dbHandlerBase {
this.localClass = EffectsResourceCosts.class; this.localClass = EffectsResourceCosts.class;
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName()); this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
} }
public ArrayList<EffectsResourceCosts> GET_ALL_EFFECT_RESOURCES(String idString) { public ArrayList<EffectsResourceCosts> GET_ALL_EFFECT_RESOURCES(String idString) {
prepareCallable("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?");
setString(1, idString); ArrayList<EffectsResourceCosts> effectsResourceCosts = new ArrayList<>();
return getObjectList();
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?")) {
preparedStatement.setString(1, idString);
ResultSet rs = preparedStatement.executeQuery();
effectsResourceCosts = getObjectsFromRs(rs, 1000);
} catch (SQLException e) {
Logger.error(e);
}
return effectsResourceCosts;
} }
} }

1
src/engine/objects/Item.java

@ -1062,7 +1062,6 @@ public float getBonusPercent(ModType modType, SourceType sourceType) {
this.magicValue = this.getItemBase().getBaseValue() + calcMagicValue(); this.magicValue = this.getItemBase().getBaseValue() + calcMagicValue();
return; return;
} }
ConcurrentHashMap<String, Integer> enchantList = DbManager.EnchantmentQueries.GET_ENCHANTMENTS_FOR_ITEM(this.getObjectUUID()); ConcurrentHashMap<String, Integer> enchantList = DbManager.EnchantmentQueries.GET_ENCHANTMENTS_FOR_ITEM(this.getObjectUUID());

Loading…
Cancel
Save