Browse Source

mine closing bug

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
d8a8c1a9a0
  1. 42
      src/engine/gameManager/SimulationManager.java

42
src/engine/gameManager/SimulationManager.java

@ -233,10 +233,15 @@ public enum SimulationManager {
} }
private void pulseMines(){ private void pulseMines(){
for(Mine mine : Mine.getMines()) { for(Mine mine : Mine.getMines()) {
if (LocalDateTime.now().getHour() == 1) {
mine.wasClaimed = false; Building mineTower = BuildingManager.getBuilding(mine.getBuildingID());
mine.hasProduced = false;
} if(mineTower == null)
continue;
///if (LocalDateTime.now().getHour() == 1) {
// mine.wasClaimed = false;
// mine.hasProduced = false;
//}
int minute = 0; int minute = 0;
if (mine.firstThirty == false) if (mine.firstThirty == false)
@ -245,28 +250,25 @@ public enum SimulationManager {
LocalDateTime openTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(minute).withSecond(0); LocalDateTime openTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(minute).withSecond(0);
LocalDateTime closeTime = openTime.plusMinutes(30); LocalDateTime closeTime = openTime.plusMinutes(30);
//current time is after start time and before close time, open mine window
if (!mine.isActive && LocalDateTime.now().isAfter(openTime) && LocalDateTime.now().isBefore(closeTime)) { if (!mine.isActive && LocalDateTime.now().isAfter(openTime) && LocalDateTime.now().isBefore(closeTime)) {
mine.setActive(true); mine.setActive(true);
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Mine is now Active!"); ChatManager.chatSystemChannel(mine.getParentZone().getName() + "'s Mine is now Active!");
Logger.info(mine.getZoneName() + "'s Mine is now Active!"); Logger.info(mine.getParentZone().getName() + "'s Mine is now Active!");
continue; continue;
} }
//if (mine.lastClaimer == null && (LocalDateTime.now().isAfter(closeTime) || LocalDateTime.now().isBefore(openTime))) {
//mineWindowClose(mine);
//if(mine.firstThirty) {
// mine.firstThirty = false;
//}else {
// mine.liveTime += 1;
// if(mine.liveTime == 24)
// mine.liveTime = 1;
// mine.firstThirty = true;
// continue;
//}
//} if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() == 0 && mine.lastClaimer == null)
if (mine.isActive && mine.lastClaimer != null && (LocalDateTime.now().isAfter(closeTime) || LocalDateTime.now().isBefore(openTime))) { closeTime = closeTime.plusMinutes(30); // mine was knocked down and has no claimer, roll over
mineWindowClose(mine);
if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() > 0) {
mineWindowClose(mine); //mine was never knocked down, close window
continue;
} }
if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() == 0 && mine.lastClaimer != null)
mineWindowClose(mine); //mine was knocked down and was claimed, close window
} }
_minePulseTime = System.currentTimeMillis() + CITY_PULSE; _minePulseTime = System.currentTimeMillis() + CITY_PULSE;
} }

Loading…
Cancel
Save