Browse Source

server pop on creation displays amount of realms captured

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

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

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

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

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

Loading…
Cancel
Save