Browse Source

mine closing bug

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
2067bbc6e1
  1. 19
      src/engine/gameManager/SimulationManager.java
  2. 70
      src/engine/objects/Mine.java
  3. 6
      src/engine/workthreads/HourlyJobThread.java

19
src/engine/gameManager/SimulationManager.java

@ -232,6 +232,9 @@ public enum SimulationManager {
} }
private void pulseMines(){ private void pulseMines(){
// if(LocalDateTime.now().getMinute() != 30 && LocalDateTime.now().getMinute() != 0)
// return;
for(Mine mine : Mine.getMines()) { for(Mine mine : Mine.getMines()) {
Building mineTower = BuildingManager.getBuilding(mine.getBuildingID()); Building mineTower = BuildingManager.getBuilding(mine.getBuildingID());
@ -252,23 +255,19 @@ public enum SimulationManager {
//current time is after start time and before close time, open mine window //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); mineWindowOpen(mine);
ChatManager.chatSystemChannel(mine.getParentZone().getName() + "'s Mine is now Active!");
Logger.info(mine.getParentZone().getName() + "'s Mine is now Active!");
continue; continue;
} }
if(mine.isActive) {
if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() == 0 && mine.lastClaimer == null) if (LocalDateTime.now().isAfter(closeTime.plusSeconds(10)) && mineTower.getRank() == 0 && mine.lastClaimer == null)
closeTime = closeTime.plusMinutes(30); // mine was knocked down and has no claimer, roll over closeTime = closeTime.plusMinutes(30); // mine was knocked down and has no claimer, roll over
if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() > 0) { if (LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() > 0)
mineWindowClose(mine); //mine was never knocked down, close window mineWindowClose(mine); //mine was never knocked down, close window
continue;
}
if(mine.isActive && LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() == 0 && mine.lastClaimer != null) if (LocalDateTime.now().isAfter(closeTime) && mineTower.getRank() < 1 && mine.lastClaimer != null)
mineWindowClose(mine); //mine was knocked down and was claimed, close window mineWindowClose(mine); //mine was knocked down and was claimed, close window
}
} }
_minePulseTime = System.currentTimeMillis() + CITY_PULSE; _minePulseTime = System.currentTimeMillis() + CITY_PULSE;
} }

70
src/engine/objects/Mine.java

@ -114,41 +114,41 @@ public class Mine extends AbstractGameObject {
} }
public static void SetTimes(){ public static void SetTimes(){
EuroMines.get(0).liveTime = 13; EuroMines.get(0).liveTime = 16;
EuroMines.get(1).liveTime = 13; EuroMines.get(1).liveTime = 16;
EuroMines.get(2).liveTime = 13; EuroMines.get(2).liveTime = 16;
EuroMines.get(3).liveTime = 13; EuroMines.get(3).liveTime = 16;
EuroMines.get(4).liveTime = 14; EuroMines.get(4).liveTime = 16;
EuroMines.get(5).liveTime = 14; EuroMines.get(5).liveTime = 16;
EuroMines.get(6).liveTime = 14; EuroMines.get(6).liveTime = 16;
ChinaMines.get(0).liveTime = 8; ChinaMines.get(0).liveTime = 10;
ChinaMines.get(1).liveTime = 8; ChinaMines.get(1).liveTime = 10;
ChinaMines.get(2).liveTime = 8; ChinaMines.get(2).liveTime = 10;
ChinaMines.get(3).liveTime = 9; ChinaMines.get(3).liveTime = 11;
ChinaMines.get(4).liveTime = 9; ChinaMines.get(4).liveTime = 11;
ChinaMines.get(5).liveTime = 9; ChinaMines.get(5).liveTime = 11;
ChinaMines.get(6).liveTime = 9; ChinaMines.get(6).liveTime = 11;
ChinaMines.get(7).liveTime = 9; ChinaMines.get(7).liveTime = 11;
ChinaMines.get(8).liveTime = 9; ChinaMines.get(8).liveTime = 11;
ChinaMines.get(9).liveTime = 9; ChinaMines.get(9).liveTime = 11;
ChinaMines.get(10).liveTime = 10; ChinaMines.get(10).liveTime = 12;
ChinaMines.get(11).liveTime = 10; ChinaMines.get(11).liveTime = 12;
ChinaMines.get(12).liveTime = 10; ChinaMines.get(12).liveTime = 12;
ChinaMines.get(13).liveTime = 10; ChinaMines.get(13).liveTime = 12;
AmericaMines.get(0).liveTime = 21; AmericaMines.get(0).liveTime = 23;
AmericaMines.get(1).liveTime = 21; AmericaMines.get(1).liveTime = 23;
AmericaMines.get(2).liveTime = 21; AmericaMines.get(2).liveTime = 23;
AmericaMines.get(3).liveTime = 22; AmericaMines.get(3).liveTime = 0;
AmericaMines.get(4).liveTime = 22; AmericaMines.get(4).liveTime = 0;
AmericaMines.get(5).liveTime = 22; AmericaMines.get(5).liveTime = 0;
AmericaMines.get(6).liveTime = 22; AmericaMines.get(6).liveTime = 0;
AmericaMines.get(7).liveTime = 22; AmericaMines.get(7).liveTime = 0;
AmericaMines.get(8).liveTime = 22; AmericaMines.get(8).liveTime = 0;
AmericaMines.get(9).liveTime = 22; AmericaMines.get(9).liveTime = 0;
AmericaMines.get(10).liveTime = 23; AmericaMines.get(10).liveTime = 1;
AmericaMines.get(11).liveTime = 23; AmericaMines.get(11).liveTime = 1;
AmericaMines.get(12).liveTime = 23; AmericaMines.get(12).liveTime = 1;
AmericaMines.get(13).liveTime = 23; AmericaMines.get(13).liveTime = 1;
int count = 1; int count = 1;

6
src/engine/workthreads/HourlyJobThread.java

@ -140,8 +140,8 @@ public class HourlyJobThread implements Runnable {
public static void mineWindowOpen(Mine mine) { public static void mineWindowOpen(Mine mine) {
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!");
} }
public static boolean mineWindowClose(Mine mine) { public static boolean mineWindowClose(Mine mine) {
@ -195,7 +195,7 @@ public class HourlyJobThread implements Runnable {
mineBuilding.rebuildMine(mine.capSize * 5000); mineBuilding.rebuildMine(mine.capSize * 5000);
WorldGrid.updateObject(mineBuilding); WorldGrid.updateObject(mineBuilding);
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.lastClaimer.getName() + " has claimed the mine in " + mine.getParentZone().getParent().getName() + " for " + mine.getOwningGuild().getName() + ". The mine is no longer active."); ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.lastClaimer.getName() + " has claimed the mine in " + mine.getParentZone().getName() + " for " + mine.getOwningGuild().getName() + ". The mine is no longer active.");
chatMsg.setMessageType(10); chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg); DispatchMessage.dispatchMsgToAll(chatMsg);

Loading…
Cancel
Save