|
|
@ -19,8 +19,12 @@ import java.sql.ResultSet; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.Duration; |
|
|
|
import java.time.Instant; |
|
|
|
import java.time.Instant; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.Collection; |
|
|
|
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 |
|
|
|
* This class contains all methods necessary to drive periodic |
|
|
|
* updates of the game simulation from the main _exec loop. |
|
|
|
* updates of the game simulation from the main _exec loop. |
|
|
@ -128,7 +132,7 @@ public enum SimulationManager { |
|
|
|
if ((_minePulseTime != 0) |
|
|
|
if ((_minePulseTime != 0) |
|
|
|
&& (System.currentTimeMillis() > _minePulseTime)) |
|
|
|
&& (System.currentTimeMillis() > _minePulseTime)) |
|
|
|
pulseMines(); |
|
|
|
pulseMines(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Logger.error( |
|
|
|
Logger.error( |
|
|
|
"Fatal error in Mine Pulse: DISABLED. Error Message : " |
|
|
|
"Fatal error in Mine Pulse: DISABLED. Error Message : " |
|
|
|
+ e.getMessage()); |
|
|
|
+ e.getMessage()); |
|
|
@ -228,14 +232,30 @@ public enum SimulationManager { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
private void pulseMines(){ |
|
|
|
private void pulseMines(){ |
|
|
|
Mine mine; |
|
|
|
for(Mine mine : Mine.getMines()) { |
|
|
|
Collection<AbstractGameObject> mineList = DbManager.getList(Enum.GameObjectType.Mine); |
|
|
|
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) { |
|
|
|
if (mine.isActive && (LocalDateTime.now().isAfter(closeTime) || LocalDateTime.now().isBefore(openTime))) { |
|
|
|
Logger.info("Mine List null"); |
|
|
|
mineWindowClose(mine); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_minePulseTime = System.currentTimeMillis() + CITY_PULSE; |
|
|
|
_minePulseTime = System.currentTimeMillis() + CITY_PULSE; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|