Browse Source

mines open and close

lakebane-new
FatBoy-DOTC 5 months ago
parent
commit
ef62c2bb39
  1. 2
      src/engine/objects/Mine.java
  2. 23
      src/engine/workthreads/HalfHourlyJobThread.java

2
src/engine/objects/Mine.java

@ -189,7 +189,7 @@ public class Mine extends AbstractGameObject { @@ -189,7 +189,7 @@ public class Mine extends AbstractGameObject {
Guild mineNatonGuild = mine.getOwningGuild().getNation();
writer.putLocalDateTime(mineOpenTime);
writer.putLocalDateTime(mineOpenTime.plusHours(1));
writer.putLocalDateTime(mineOpenTime.plusMinutes(30));
writer.put(mine.isActive ? (byte) 0x01 : (byte) 0x00);
Building mineTower = BuildingManager.getBuilding(mine.buildingID);

23
src/engine/workthreads/HalfHourlyJobThread.java

@ -41,18 +41,8 @@ public class HalfHourlyJobThread implements Runnable { @@ -41,18 +41,8 @@ public class HalfHourlyJobThread implements Runnable {
ArrayList<Mine> mines = Mine.getMines();
for (Mine mine : mines) {
if (LocalDateTime.now().getHour() == 1400) {
mine.wasClaimed = false;
}
try {
// Open Errant Mines
if (mine.getOwningGuild().isEmptyGuild()) {
HalfHourlyJobThread.mineWindowOpen(mine);
continue;
}
// Open Mines owned by nations having their WOO
// set to the current mine window.
@ -62,7 +52,8 @@ public class HalfHourlyJobThread implements Runnable { @@ -62,7 +52,8 @@ public class HalfHourlyJobThread implements Runnable {
}
// Close the mine if it reaches this far
LocalDateTime openTime = LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute);
if(LocalDateTime.now().plusMinutes(1).isAfter(openTime.plusMinutes(30)))
mineWindowClose(mine);
} catch (Exception e) {
@ -101,6 +92,10 @@ public class HalfHourlyJobThread implements Runnable { @@ -101,6 +92,10 @@ public class HalfHourlyJobThread implements Runnable {
if (mineBuilding.getRank() > 0) {
mine.setActive(false);
mine.lastClaimer = null;
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.guildName + " has defended the mine in " + mine.getParentZone().getParent().getName() + ". The mine is no longer active.");
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
return true;
}
@ -112,6 +107,10 @@ public class HalfHourlyJobThread implements Runnable { @@ -112,6 +107,10 @@ public class HalfHourlyJobThread implements Runnable {
mine.lastClaimer = null;
mine.updateGuildOwner(null);
mine.setActive(true);
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.getParentZone().getParent().getName() + " Was not claimed, the battle rages on!");
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
return false;
}
@ -163,7 +162,7 @@ public class HalfHourlyJobThread implements Runnable { @@ -163,7 +162,7 @@ public class HalfHourlyJobThread implements Runnable {
} catch (Exception e) {
Logger.info(e.getMessage() + " for Mine " + mine.getObjectUUID());
}
if (mine.wasClaimed == true)
if (mine.wasClaimed == false)
mine.wasClaimed = false;
}
}

Loading…
Cancel
Save