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