Browse Source

30 minute mine windows

lakebane-master
FatBoy-DOTC 9 months ago
parent
commit
8ce7c09000
  1. 21
      src/engine/objects/Mine.java

21
src/engine/objects/Mine.java

@ -299,12 +299,24 @@ public class Mine extends AbstractGameObject { @@ -299,12 +299,24 @@ public class Mine extends AbstractGameObject {
writer.putInt(mine.production.hash);
writer.putInt(mine.getModifiedProductionAmount());
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
writer.putInt(3600); //window in seconds
writer.putInt(1800); //window in seconds
// Errant mines are currently open. Set time to now.
LocalDateTime mineOpenTime = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
LocalDateTime mineOpenTime;// = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
if(mine.firstThirty == true){
if (mine.wasClaimed == true)
mineOpenTime = mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0).plusDays(1);
else
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0);
}
else{
if (mine.wasClaimed == true)
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0).withNano(0).plusDays(1);
else
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0).withNano(0);
}
// Mine times are those of the nation not individual guild.
Guild mineNatonGuild = mine.getOwningGuild().getNation();
@ -314,10 +326,7 @@ public class Mine extends AbstractGameObject { @@ -314,10 +326,7 @@ public class Mine extends AbstractGameObject {
// If a mine is active serialize current datetime irrespective
// of any claim.
if (mineOpenTime.isAfter(LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0)) || mine.wasClaimed == true)
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0).plusDays(1);
else
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0);
writer.putLocalDateTime(mineOpenTime);
writer.putLocalDateTime(mineOpenTime.plusHours(1));

Loading…
Cancel
Save