From 1a7003ce590d70db0223b9d9e07de78bcff35637 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 20 Jan 2023 08:12:53 -0500 Subject: [PATCH] Serialized mine open time adjusted if the mine was claimed during this cycle. --- src/engine/objects/Mine.java | 8 ++++---- src/engine/workthreads/HourlyJobThread.java | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index d772603c..1d429f97 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -265,7 +265,6 @@ public class Mine extends AbstractGameObject { writer.putInt(mine.getObjectType().ordinal()); writer.putInt(mine.getObjectUUID()); writer.putInt(mine.getObjectUUID()); //actually a hash of mine - // writer.putInt(0x215C92BB); //this.unknown1); writer.putString(mine.mineType.name); writer.putString(mine.zoneName); writer.putInt(mine.production.hash); @@ -279,20 +278,21 @@ public class Mine extends AbstractGameObject { Guild mineOwnerGuild = mine.getOwningGuild(); // Adjust the serialized mine time based upon whether - // the Guild's mine window has passed or not. + // the Guild's mine window has passed or not and if it was claimed. // If a mine is active serialize current datetime irrespective - // of any claim + // of any claim. if (mineOwnerGuild.isErrant() == false && mine.isActive == false) { int guildWOO = mineOwnerGuild.getNation().getMineTime(); LocalDateTime guildMineTime = mineOpenTime.withHour(guildWOO); - if (mineOpenTime.isAfter(guildMineTime)) + if (mineOpenTime.isAfter(guildMineTime) || mine.wasClaimed == true) mineOpenTime = guildMineTime.plusDays(1); else mineOpenTime = guildMineTime; + // Mines } writer.putLocalDateTime(mineOpenTime); diff --git a/src/engine/workthreads/HourlyJobThread.java b/src/engine/workthreads/HourlyJobThread.java index 31505cf5..20a8af2d 100644 --- a/src/engine/workthreads/HourlyJobThread.java +++ b/src/engine/workthreads/HourlyJobThread.java @@ -113,8 +113,8 @@ public class HourlyJobThread implements Runnable { mine.wasClaimed = false; continue; - } + // Open Errant Mines if (mine.getOwningGuild().isErrant()) { @@ -132,7 +132,8 @@ public class HourlyJobThread implements Runnable { continue; } - // Close all other mines + // Close all remaining mines + if (mine.handleEndMineWindow()) Mine.setLastChange(System.currentTimeMillis());