|
|
@ -13,7 +13,12 @@ import engine.Enum.GameObjectType; |
|
|
|
import engine.gameManager.DbManager; |
|
|
|
import engine.gameManager.DbManager; |
|
|
|
import engine.objects.AbstractGameObject; |
|
|
|
import engine.objects.AbstractGameObject; |
|
|
|
import engine.objects.RuneBaseEffect; |
|
|
|
import engine.objects.RuneBaseEffect; |
|
|
|
|
|
|
|
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; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
|
@ -25,34 +30,49 @@ public class dbRuneBaseEffectHandler extends dbHandlerBase { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ArrayList<RuneBaseEffect> GET_EFFECTS_FOR_RUNEBASE(int id) { |
|
|
|
public ArrayList<RuneBaseEffect> GET_EFFECTS_FOR_RUNEBASE(int id) { |
|
|
|
prepareCallable("SELECT * FROM `static_rune_baseeffect` WHERE `runeID`=?"); |
|
|
|
|
|
|
|
setInt(1, id); |
|
|
|
ArrayList<RuneBaseEffect> runeBaseEffectsList = new ArrayList<>(); |
|
|
|
return getObjectList(); |
|
|
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_rune_baseeffect` WHERE `runeID`=?")) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preparedStatement.setInt(1, id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
|
|
|
|
runeBaseEffectsList = getObjectsFromRs(rs, 250); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
|
|
|
Logger.error(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return runeBaseEffectsList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public RuneBaseEffect GET_RUNEBASE_EFFECT(int id) { |
|
|
|
public ArrayList<RuneBaseEffect> GET_ALL_RUNEBASE_EFFECTS() { |
|
|
|
|
|
|
|
|
|
|
|
if (id == 0) |
|
|
|
ArrayList<RuneBaseEffect> runeBaseEffectsList = new ArrayList<>(); |
|
|
|
return null; |
|
|
|
|
|
|
|
RuneBaseEffect runeBaseEffect = (RuneBaseEffect) DbManager.getFromCache(GameObjectType.RuneBaseEffect, id); |
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
if (runeBaseEffect != null) |
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_rune_baseeffect`;")) { |
|
|
|
return runeBaseEffect; |
|
|
|
|
|
|
|
prepareCallable("SELECT * FROM `static_rune_baseeffect` WHERE `ID` = ?"); |
|
|
|
|
|
|
|
setInt(1, id); |
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
return (RuneBaseEffect) getObjectSingle(id); |
|
|
|
runeBaseEffectsList = getObjectsFromRs(rs, 250); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
|
|
|
Logger.error(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ArrayList<RuneBaseEffect> GET_ALL_RUNEBASE_EFFECTS(){ |
|
|
|
return runeBaseEffectsList; |
|
|
|
prepareCallable("SELECT * FROM `static_rune_baseeffect`;"); |
|
|
|
|
|
|
|
return getObjectList(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//This calls from cache only. Call this AFTER caching all runebase effects;
|
|
|
|
//This calls from cache only. Call this AFTER caching all runebase effects;
|
|
|
|
|
|
|
|
|
|
|
|
public HashMap<Integer, ArrayList<RuneBaseEffect>> LOAD_BASEEFFECTS_FOR_RUNEBASE() { |
|
|
|
public HashMap<Integer, ArrayList<RuneBaseEffect>> LOAD_BASEEFFECTS_FOR_RUNEBASE() { |
|
|
|
|
|
|
|
|
|
|
|
HashMap<Integer, ArrayList<RuneBaseEffect>> runeBaseEffectSet; |
|
|
|
HashMap<Integer, ArrayList<RuneBaseEffect>> runeBaseEffectSet; |
|
|
|
runeBaseEffectSet = new HashMap<>(); |
|
|
|
runeBaseEffectSet = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (AbstractGameObject runeBaseEffect:DbManager.getList(GameObjectType.RuneBaseEffect)){ |
|
|
|
for (AbstractGameObject runeBaseEffect:DbManager.getList(GameObjectType.RuneBaseEffect)){ |
|
|
|
|
|
|
|
|
|
|
|
int runeBaseID = ((RuneBaseEffect)runeBaseEffect).getRuneBaseID(); |
|
|
|
int runeBaseID = ((RuneBaseEffect)runeBaseEffect).getRuneBaseID(); |
|
|
|