From 8ce7c0900041a7947798a37b64b89d186ac1c411 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 7 Mar 2024 20:09:58 -0600 Subject: [PATCH] 30 minute mine windows --- src/engine/objects/Mine.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index df2ea260..e7ca5649 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -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 { // 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));