From 54c0b3d7cee21cff6a345de13c8ae845686feed1 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 23 Apr 2024 18:50:00 -0500 Subject: [PATCH] mine work --- src/engine/devcmd/cmds/PrintStatsCmd.java | 2 +- src/engine/objects/Mine.java | 14 ++++++++++++++ src/engine/workthreads/MineThread.java | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/engine/devcmd/cmds/PrintStatsCmd.java b/src/engine/devcmd/cmds/PrintStatsCmd.java index 08116843..2d8f5c96 100644 --- a/src/engine/devcmd/cmds/PrintStatsCmd.java +++ b/src/engine/devcmd/cmds/PrintStatsCmd.java @@ -76,7 +76,7 @@ public class PrintStatsCmd extends AbstractDevCmd { out += "Health Regen: " + tar.getRegenModifier(Enum.ModType.HealthRecoverRate) + newline; out += "Stamina Regen: " + tar.getRegenModifier(Enum.ModType.StaminaRecoverRate) + newline; out += "Mana Regen: " + tar.getRegenModifier(Enum.ModType.ManaRecoverRate) + newline; - + out += "Zerg Multiplier: " + tar.ZergMultiplier + newline; throwbackInfo(pc, out); } diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index db623e03..07d48e0b 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -66,6 +66,8 @@ public class Mine extends AbstractGameObject { public static ArrayList ChinaMines = new ArrayList<>(); public static ArrayList EuroMines = new ArrayList<>(); public static ArrayList AmericaMines = new ArrayList<>(); + + public boolean wasOpened = false; /** * ResultSet Constructor */ @@ -349,6 +351,16 @@ public class Mine extends AbstractGameObject { } catch (Exception e) { e.printStackTrace(); } + + for(Mine mine : Mine.getMines()){ + int minute = 0; + if (mine.firstThirty == false) + minute = 30; + LocalDateTime openTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(minute).withSecond(0); + LocalDateTime closeTime = openTime.plusMinutes(30); + if(LocalDateTime.now().isAfter(closeTime)) + mine.wasOpened = true; + } } /* @@ -585,6 +597,8 @@ public class Mine extends AbstractGameObject { if(isAc) { ZergMechanicThread.startZergThreadMine(this); } + + this.wasOpened = true; } public boolean validForMine(Resource r) { diff --git a/src/engine/workthreads/MineThread.java b/src/engine/workthreads/MineThread.java index 4c52ee0e..e9611112 100644 --- a/src/engine/workthreads/MineThread.java +++ b/src/engine/workthreads/MineThread.java @@ -45,7 +45,7 @@ public class MineThread implements Runnable { LocalDateTime closeTime = openTime.plusMinutes(30); //current time is after start time and before close time, open mine window - if (LocalDateTime.now().isAfter(openTime.minusMinutes(1)) && !mine.wasClaimed) { + if (LocalDateTime.now().isAfter(openTime.minusMinutes(1)) && !mine.wasClaimed && !mine.wasOpened) { mineWindowOpen(mine); continue; }