Browse Source

SECOND AFTER ROLLBACK: serialize MineTimes correctly

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
bf69045b0b
  1. 23
      src/engine/objects/Mine.java

23
src/engine/objects/Mine.java

@ -63,10 +63,6 @@ public class Mine extends AbstractGameObject {
public HashMap<Guild,ArrayList<Integer>> dividedPlayers; public HashMap<Guild,ArrayList<Integer>> dividedPlayers;
public boolean hasProduced = false; public boolean hasProduced = false;
public int liveTime;
public Boolean firstThirty = true;
public static ArrayList<Mine> ChinaMines = new ArrayList<>(); public static ArrayList<Mine> ChinaMines = new ArrayList<>();
public static ArrayList<Mine> EuroMines = new ArrayList<>(); public static ArrayList<Mine> EuroMines = new ArrayList<>();
public static ArrayList<Mine> AmericaMines = new ArrayList<>(); public static ArrayList<Mine> AmericaMines = new ArrayList<>();
@ -177,7 +173,6 @@ public class Mine extends AbstractGameObject {
for (Mine mine : serverMines) { for (Mine mine : serverMines) {
Mine.mineMap.put(mine, mine.buildingID); Mine.mineMap.put(mine, mine.buildingID);
Mine.towerMap.put(mine.buildingID, mine); Mine.towerMap.put(mine.buildingID, mine);
//mine.mineType = MineProduction.LUMBER;
} }
} }
@ -194,15 +189,7 @@ public class Mine extends AbstractGameObject {
writer.putInt(mine.getObjectUUID()); writer.putInt(mine.getObjectUUID());
writer.putInt(mine.getObjectUUID()); //actually a hash of mine writer.putInt(mine.getObjectUUID()); //actually a hash of mine
writer.putString(mine.mineType.name); writer.putString(mine.mineType.name);
if(ChinaMines.contains((mine))) { writer.putString(mine.capSize + " Man ");
writer.putString("Chinese" + " {" + mine.capSize + " Man}");
} else if(AmericaMines.contains(mine)){
writer.putString("American" + " {" + mine.capSize + " Man}");
} else if(EuroMines.contains(mine)){
writer.putString("European" + " {" + mine.capSize + " Man}");
}else{
writer.putString("Unknown" + " {" + mine.capSize + " Man}");
}
writer.putInt(mine.production.hash); writer.putInt(mine.production.hash);
writer.putInt(mine.getModifiedProductionAmount()); writer.putInt(mine.getModifiedProductionAmount());
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
@ -210,13 +197,7 @@ public class Mine extends AbstractGameObject {
// Errant mines are currently open. Set time to now. // Errant mines are currently open. Set time to now.
LocalDateTime mineOpenTime;// = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0); LocalDateTime mineOpenTime = LocalDateTime.now().withHour(mine.liveHour).withMinute(mine.liveMinute).withSecond(0).withNano(0);
if(mine.firstThirty == true){
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0);
}
else{
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0).withNano(0);
}
LocalDateTime mineCloseTime = mineOpenTime.plusMinutes(30); LocalDateTime mineCloseTime = mineOpenTime.plusMinutes(30);
if(LocalDateTime.now().isAfter(mineCloseTime)){ if(LocalDateTime.now().isAfter(mineCloseTime)){

Loading…
Cancel
Save