2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.db.handlers ;
2023-05-21 08:36:39 -04:00
import engine.gameManager.DbManager ;
2024-04-05 07:59:44 -04:00
import engine.mbEnums ;
2022-04-30 09:41:17 -04:00
import engine.objects.BuildingLocation ;
2023-05-21 08:36:39 -04:00
import org.pmw.tinylog.Logger ;
2022-04-30 09:41:17 -04:00
2023-05-21 08:36:39 -04:00
import java.sql.Connection ;
import java.sql.PreparedStatement ;
import java.sql.ResultSet ;
import java.sql.SQLException ;
2022-04-30 09:41:17 -04:00
import java.util.ArrayList ;
public class dbBuildingLocationHandler extends dbHandlerBase {
2023-05-23 10:27:03 -04:00
public dbBuildingLocationHandler ( ) {
this . localClass = BuildingLocation . class ;
2024-04-05 07:59:44 -04:00
this . localObjectType = mbEnums . GameObjectType . valueOf ( this . localClass . getSimpleName ( ) ) ;
2023-05-23 10:27:03 -04:00
}
2022-04-30 09:41:17 -04:00
2023-05-23 10:27:03 -04:00
public ArrayList < BuildingLocation > LOAD_BUILDING_LOCATIONS ( ) {
2023-04-24 15:37:30 -04:00
2023-05-23 10:27:03 -04:00
ArrayList < BuildingLocation > buildingLocations = new ArrayList < > ( ) ;
2023-05-21 08:36:39 -04:00
2023-05-23 10:27:03 -04:00
try ( Connection connection = DbManager . getConnection ( ) ;
2025-11-01 21:05:46 -05:00
PreparedStatement preparedStatement = connection . prepareStatement ( " SELECT `MIN(ID)`,`BuildingID`,`slot`,`MIN(type)`,`MIN(unknown)`,`MIN(locX)`,`MIN(locY)`,`MIN(locZ)`,`MIN(w)`,`MIN(rotX)`,`MIN(rotY)`,`MIN(rotZ)` FROM static_building_location " +
" WHERE type IN (6, 8) " +
2025-11-01 21:02:24 -05:00
" GROUP BY BuildingID, slot " +
" ORDER BY BuildingID, slot ASC; " ) ) {
2023-05-21 08:36:39 -04:00
2023-05-23 10:27:03 -04:00
ResultSet rs = preparedStatement . executeQuery ( ) ;
buildingLocations = getObjectsFromRs ( rs , 20 ) ;
2023-05-21 08:36:39 -04:00
2023-05-23 10:27:03 -04:00
} catch ( SQLException e ) {
Logger . error ( e ) ;
return buildingLocations ;
}
2023-05-21 08:36:39 -04:00
2023-05-23 10:27:03 -04:00
return buildingLocations ;
}
2022-04-30 09:41:17 -04:00
}