From d04cad04841db6bb2520a77304c352b41f34996f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 21 Apr 2024 06:01:27 -0500 Subject: [PATCH] adjust mines --- src/engine/gameManager/SimulationManager.java | 34 +++++++++++++++---- src/engine/objects/Mob.java | 2 +- src/engine/workthreads/HourlyJobThread.java | 2 +- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/engine/gameManager/SimulationManager.java b/src/engine/gameManager/SimulationManager.java index ff5fd022..ff3b676d 100644 --- a/src/engine/gameManager/SimulationManager.java +++ b/src/engine/gameManager/SimulationManager.java @@ -19,8 +19,12 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.time.Duration; import java.time.Instant; +import java.time.LocalDateTime; import java.util.Collection; +import static engine.workthreads.HourlyJobThread.mineWindowClose; +import static engine.workthreads.HourlyJobThread.mineWindowOpen; + /* * This class contains all methods necessary to drive periodic * updates of the game simulation from the main _exec loop. @@ -128,7 +132,7 @@ public enum SimulationManager { if ((_minePulseTime != 0) && (System.currentTimeMillis() > _minePulseTime)) pulseMines(); - } catch (Exception e) { + } catch (Exception e) { Logger.error( "Fatal error in Mine Pulse: DISABLED. Error Message : " + e.getMessage()); @@ -228,14 +232,30 @@ public enum SimulationManager { } private void pulseMines(){ - Mine mine; - Collection mineList = DbManager.getList(Enum.GameObjectType.Mine); + for(Mine mine : Mine.getMines()) { + if (LocalDateTime.now().getHour() == 1) { + mine.wasClaimed = false; + mine.hasProduced = false; + } + + 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 (!mine.isActive && LocalDateTime.now().isAfter(openTime) && LocalDateTime.now().isBefore(closeTime)) { + mine.setActive(true); + ChatManager.chatSystemChannel(mine.getZoneName() + "'s Mine is now Active!"); + Logger.info(mine.getZoneName() + "'s Mine is now Active!"); + continue; + } - if (mineList == null) { - Logger.info("Mine List null"); - return; + if (mine.isActive && (LocalDateTime.now().isAfter(closeTime) || LocalDateTime.now().isBefore(openTime))) { + mineWindowClose(mine); + } } - _minePulseTime = System.currentTimeMillis() + CITY_PULSE; } } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 97b81dfa..bf1c924b 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1145,7 +1145,7 @@ public class Mob extends AbstractIntelligenceAgent { public void calculateAtrDefenseDamage() { if (this.charItemManager == null || this.equip == null) { - Logger.error("Player " + currentID + " missing skills or equipment"); + //Logger.error("Player " + currentID + " missing skills or equipment"); defaultAtrAndDamage(true); defaultAtrAndDamage(false); this.defenseRating = 0; diff --git a/src/engine/workthreads/HourlyJobThread.java b/src/engine/workthreads/HourlyJobThread.java index 66531fec..4c1184fe 100644 --- a/src/engine/workthreads/HourlyJobThread.java +++ b/src/engine/workthreads/HourlyJobThread.java @@ -218,7 +218,7 @@ public class HourlyJobThread implements Runnable { //Logger.info("Hourly job is now running."); - processMineWindow(); + //processMineWindow(); // Reset time-gated access to WOO slider. // *** Do this after the mines open/close!