character creation population message
This commit is contained in:
@@ -95,7 +95,25 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
|
||||
return objectList;
|
||||
}
|
||||
public Integer GET_CITY_COUNT() {
|
||||
|
||||
int cityCount = 0;
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_city;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while(rs.next()){
|
||||
if(rs.getInt("isNpc") == 0)
|
||||
cityCount++;
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return cityCount;
|
||||
}
|
||||
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
|
||||
|
||||
ArrayList<City> cityList = new ArrayList<>();
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
@@ -53,15 +54,17 @@ public class ServerInfoMsg extends ClientNetMsg {
|
||||
|
||||
writer.putInt(WorldServer.worldMapID);
|
||||
writer.putString(ConfigManager.MB_WORLD_NAME.getValue());
|
||||
if (LoginServer.population < MBServerStatics.LOW_POPULATION)
|
||||
int TotalTrees = 275;
|
||||
int currentTrees = DbManager.CityQueries.GET_CITY_COUNT();
|
||||
if (currentTrees < TotalTrees * 0.2f)
|
||||
writer.putInt(0); //Land Rush
|
||||
else if (LoginServer.population < MBServerStatics.NORMAL_POPULATION)
|
||||
else if (currentTrees < TotalTrees * 0.4f)
|
||||
writer.putInt(1); //Low pop
|
||||
else if (LoginServer.population < MBServerStatics.HIGH_POPULATION)
|
||||
else if (currentTrees < TotalTrees * 0.6f)
|
||||
writer.putInt(2); //Normal pop
|
||||
else if (LoginServer.population < MBServerStatics.VERY_OVERPOPULATED_POPULATION)
|
||||
else if (currentTrees < TotalTrees * 0.8f)
|
||||
writer.putInt(3); //High Pop
|
||||
else if (LoginServer.population < MBServerStatics.FULL_POPULATION)
|
||||
else if (currentTrees < TotalTrees)
|
||||
writer.putInt(4); //Very overpopulated pop
|
||||
else
|
||||
writer.putInt(5); //Full pop
|
||||
|
||||
Reference in New Issue
Block a user