|
|
@ -11,10 +11,7 @@ package engine.db.handlers; |
|
|
|
|
|
|
|
|
|
|
|
import engine.Enum; |
|
|
|
import engine.Enum; |
|
|
|
import engine.gameManager.DbManager; |
|
|
|
import engine.gameManager.DbManager; |
|
|
|
import engine.objects.AbstractGameObject; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.objects.Building; |
|
|
|
|
|
|
|
import engine.objects.City; |
|
|
|
|
|
|
|
import engine.objects.Zone; |
|
|
|
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.sql.*; |
|
|
|
import java.sql.*; |
|
|
@ -98,21 +95,11 @@ public class dbCityHandler extends dbHandlerBase { |
|
|
|
public Integer GET_CAPITAL_CITY_COUNT() { |
|
|
|
public Integer GET_CAPITAL_CITY_COUNT() { |
|
|
|
|
|
|
|
|
|
|
|
int cityCount = 0; |
|
|
|
int cityCount = 0; |
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
for(Realm realm : Realm._realms.values()){ |
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_city;")) { |
|
|
|
if(realm.isRuled()) |
|
|
|
|
|
|
|
|
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(rs.next()){ |
|
|
|
|
|
|
|
if(rs.getInt("isNpc") == 0) |
|
|
|
|
|
|
|
if(DbManager.BuildingQueries.GET_BUILDINGBYUUID(rs.getInt("treeOfLifeUUID")).getRank() == 8) |
|
|
|
|
|
|
|
cityCount ++; |
|
|
|
cityCount ++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
|
|
|
Logger.error(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return cityCount; |
|
|
|
return cityCount; |
|
|
|
} |
|
|
|
} |
|
|
|
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) { |
|
|
|
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) { |
|
|
|