Browse Source

server pop on creation displays amount of realms captured

lakebane-new
FatBoy-DOTC 5 months ago
parent
commit
1c342bd566
  1. 5
      src/engine/db/handlers/dbCityHandler.java
  2. 53
      src/engine/net/client/msg/ServerInfoMsg.java

5
src/engine/db/handlers/dbCityHandler.java

@ -95,7 +95,7 @@ public class dbCityHandler extends dbHandlerBase {
return objectList; return objectList;
} }
public Integer GET_CITY_COUNT() { public Integer GET_CAPITAL_CITY_COUNT() {
int cityCount = 0; int cityCount = 0;
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
@ -105,7 +105,8 @@ public class dbCityHandler extends dbHandlerBase {
while(rs.next()){ while(rs.next()){
if(rs.getInt("isNpc") == 0) if(rs.getInt("isNpc") == 0)
cityCount++; if(DbManager.BuildingQueries.GET_BUILDINGBYUUID(rs.getInt("treeOfLifeUUID")).getRank() == 8)
cityCount++;
} }
} catch (SQLException e) { } catch (SQLException e) {

53
src/engine/net/client/msg/ServerInfoMsg.java

@ -54,20 +54,45 @@ public class ServerInfoMsg extends ClientNetMsg {
writer.putInt(WorldServer.worldMapID); writer.putInt(WorldServer.worldMapID);
writer.putString(ConfigManager.MB_WORLD_NAME.getValue()); writer.putString(ConfigManager.MB_WORLD_NAME.getValue());
int TotalTrees = 275; int TotalTrees = 21;
int currentTrees = DbManager.CityQueries.GET_CITY_COUNT(); int currentR8Trees = DbManager.CityQueries.GET_CAPITAL_CITY_COUNT();
if (currentTrees < TotalTrees * 0.2f)
writer.putInt(0); //Land Rush switch(currentR8Trees){
else if (currentTrees < TotalTrees * 0.4f) case 0:
writer.putInt(1); //Low pop case 1:
else if (currentTrees < TotalTrees * 0.6f) case 2:
writer.putInt(2); //Normal pop case 3:
else if (currentTrees < TotalTrees * 0.8f) case 4:
writer.putInt(3); //High Pop writer.putInt(0); //Land Rush
else if (currentTrees < TotalTrees) break;
writer.putInt(4); //Very overpopulated pop case 5:
else case 6:
writer.putInt(5); //Full pop case 7:
case 8:
writer.putInt(1); //Low pop
break;
case 9:
case 10:
case 11:
case 12:
writer.putInt(2); //Normal pop
break;
case 13:
case 14:
case 15:
case 16:
writer.putInt(3); //High Pop
break;
case 17:
case 18:
case 19:
case 20:
writer.putInt(4); //Very overpopulated pop
break;
default:
writer.putInt(5); //Full pop
break;
}
} }
/** /**

Loading…
Cancel
Save