|
|
|
@ -16,17 +16,14 @@ import engine.net.ByteBufferWriter;
@@ -16,17 +16,14 @@ import engine.net.ByteBufferWriter;
|
|
|
|
|
import engine.net.client.msg.ErrorPopupMsg; |
|
|
|
|
import engine.server.MBServerStatics; |
|
|
|
|
import engine.workthreads.ZergMechanicThread; |
|
|
|
|
import org.joda.time.DateTime; |
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
import java.net.UnknownHostException; |
|
|
|
|
import java.sql.ResultSet; |
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.sql.Time; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
|
|
|
|
|
|
|
import static engine.gameManager.DbManager.MineQueries; |
|
|
|
|
import static engine.gameManager.DbManager.getObject; |
|
|
|
@ -60,7 +57,8 @@ public class Mine extends AbstractGameObject {
@@ -60,7 +57,8 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
|
|
|
|
|
public boolean hasProduced = false; |
|
|
|
|
|
|
|
|
|
public int liveTime; |
|
|
|
|
public int liveHour; |
|
|
|
|
public int liveMinute; |
|
|
|
|
public Boolean firstThirty = true; |
|
|
|
|
|
|
|
|
|
public static ArrayList<Mine> ChinaMines = new ArrayList<>(); |
|
|
|
@ -115,57 +113,12 @@ public class Mine extends AbstractGameObject {
@@ -115,57 +113,12 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
|
|
|
|
|
this.production = Resource.valueOf(rs.getString("mine_resource")); |
|
|
|
|
this.lastClaimer = null; |
|
|
|
|
this.liveHour = rs.getInt("mineLiveHour"); |
|
|
|
|
this.liveMinute = rs.getInt("mineLiveMinute"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void SetTimes(){ |
|
|
|
|
try { |
|
|
|
|
EuroMines.get(0).liveTime = 19; |
|
|
|
|
EuroMines.get(1).liveTime = 19; |
|
|
|
|
EuroMines.get(2).liveTime = 20; |
|
|
|
|
EuroMines.get(3).liveTime = 20; |
|
|
|
|
EuroMines.get(4).liveTime = 21; |
|
|
|
|
EuroMines.get(5).liveTime = 21; |
|
|
|
|
EuroMines.get(6).liveTime = 22; |
|
|
|
|
}catch(Exception e){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
try{ |
|
|
|
|
ChinaMines.get(0).liveTime = 11; |
|
|
|
|
ChinaMines.get(1).liveTime = 11; |
|
|
|
|
ChinaMines.get(2).liveTime = 11; |
|
|
|
|
ChinaMines.get(3).liveTime = 12; |
|
|
|
|
ChinaMines.get(4).liveTime = 12; |
|
|
|
|
ChinaMines.get(5).liveTime = 12; |
|
|
|
|
ChinaMines.get(6).liveTime = 12; |
|
|
|
|
ChinaMines.get(7).liveTime = 12; |
|
|
|
|
ChinaMines.get(8).liveTime = 12; |
|
|
|
|
ChinaMines.get(9).liveTime = 12; |
|
|
|
|
ChinaMines.get(10).liveTime = 13; |
|
|
|
|
ChinaMines.get(11).liveTime = 13; |
|
|
|
|
ChinaMines.get(12).liveTime = 13; |
|
|
|
|
ChinaMines.get(13).liveTime = 13; |
|
|
|
|
}catch(Exception e){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
try{ |
|
|
|
|
AmericaMines.get(0).liveTime = 1; |
|
|
|
|
AmericaMines.get(1).liveTime = 2; |
|
|
|
|
AmericaMines.get(2).liveTime = 2; |
|
|
|
|
AmericaMines.get(3).liveTime = 3; |
|
|
|
|
AmericaMines.get(4).liveTime = 3; |
|
|
|
|
AmericaMines.get(5).liveTime = 3; |
|
|
|
|
AmericaMines.get(6).liveTime = 3; |
|
|
|
|
AmericaMines.get(7).liveTime = 3; |
|
|
|
|
AmericaMines.get(8).liveTime = 3; |
|
|
|
|
AmericaMines.get(9).liveTime = 3; |
|
|
|
|
AmericaMines.get(10).liveTime = 4; |
|
|
|
|
AmericaMines.get(11).liveTime = 4; |
|
|
|
|
AmericaMines.get(12).liveTime = 4; |
|
|
|
|
AmericaMines.get(13).liveTime = 5; |
|
|
|
|
}catch(Exception e){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int count = 1; |
|
|
|
|
for(Mine mine : EuroMines){ |
|
|
|
@ -306,89 +259,8 @@ public class Mine extends AbstractGameObject {
@@ -306,89 +259,8 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
//mine.mineType = MineProduction.LUMBER;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
ChinaMines.add(serverMines.get(0)); |
|
|
|
|
ChinaMines.add(serverMines.get(3)); |
|
|
|
|
ChinaMines.add(serverMines.get(6)); |
|
|
|
|
ChinaMines.add(serverMines.get(9)); |
|
|
|
|
ChinaMines.add(serverMines.get(12)); |
|
|
|
|
ChinaMines.add(serverMines.get(15)); |
|
|
|
|
ChinaMines.add(serverMines.get(18)); |
|
|
|
|
ChinaMines.add(serverMines.get(21)); |
|
|
|
|
ChinaMines.add(serverMines.get(23)); |
|
|
|
|
ChinaMines.add(serverMines.get(25)); |
|
|
|
|
ChinaMines.add(serverMines.get(27)); |
|
|
|
|
ChinaMines.add(serverMines.get(29)); |
|
|
|
|
ChinaMines.add(serverMines.get(31)); |
|
|
|
|
ChinaMines.add(serverMines.get(33)); |
|
|
|
|
}catch(Exception e){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
try{ |
|
|
|
|
AmericaMines.add(serverMines.get(1)); |
|
|
|
|
AmericaMines.add(serverMines.get(4)); |
|
|
|
|
AmericaMines.add(serverMines.get(7)); |
|
|
|
|
AmericaMines.add(serverMines.get(10)); |
|
|
|
|
AmericaMines.add(serverMines.get(13)); |
|
|
|
|
AmericaMines.add(serverMines.get(16)); |
|
|
|
|
AmericaMines.add(serverMines.get(19)); |
|
|
|
|
AmericaMines.add(serverMines.get(22)); |
|
|
|
|
AmericaMines.add(serverMines.get(24)); |
|
|
|
|
AmericaMines.add(serverMines.get(26)); |
|
|
|
|
AmericaMines.add(serverMines.get(28)); |
|
|
|
|
AmericaMines.add(serverMines.get(30)); |
|
|
|
|
AmericaMines.add(serverMines.get(32)); |
|
|
|
|
AmericaMines.add(serverMines.get(34)); |
|
|
|
|
}catch(Exception e){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
try{ |
|
|
|
|
EuroMines.add(serverMines.get(2)); |
|
|
|
|
EuroMines.add(serverMines.get(5)); |
|
|
|
|
EuroMines.add(serverMines.get(8)); |
|
|
|
|
EuroMines.add(serverMines.get(11)); |
|
|
|
|
EuroMines.add(serverMines.get(14)); |
|
|
|
|
EuroMines.add(serverMines.get(17)); |
|
|
|
|
EuroMines.add(serverMines.get(20)); |
|
|
|
|
}catch(Exception e){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetTimes(); |
|
|
|
|
for(Mine mine : EuroMines){ |
|
|
|
|
if(EuroMines.indexOf(mine) %2 == 0 ){ |
|
|
|
|
mine.firstThirty = true; |
|
|
|
|
} else{ |
|
|
|
|
mine.firstThirty = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(Mine mine : AmericaMines){ |
|
|
|
|
if(AmericaMines.indexOf(mine) %2 == 0 ){ |
|
|
|
|
mine.firstThirty = true; |
|
|
|
|
} else{ |
|
|
|
|
mine.firstThirty = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(Mine mine : ChinaMines){ |
|
|
|
|
if(ChinaMines.indexOf(mine) %2 == 0 ){ |
|
|
|
|
mine.firstThirty = true; |
|
|
|
|
} else{ |
|
|
|
|
mine.firstThirty = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
}catch(Exception e) { |
|
|
|
|
|
|
|
|
|
for(Mine mine : Mine.getMines()){ |
|
|
|
|
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(LocalDateTime.now().isAfter(closeTime)) |
|
|
|
|
mine.wasOpened = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -423,10 +295,10 @@ public class Mine extends AbstractGameObject {
@@ -423,10 +295,10 @@ public class Mine extends AbstractGameObject {
|
|
|
|
|
|
|
|
|
|
LocalDateTime mineOpenTime;// = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
|
|
|
|
|
if(mine.firstThirty == true){ |
|
|
|
|
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0); |
|
|
|
|
mineOpenTime = LocalDateTime.now().withHour(mine.liveHour).withMinute(0).withSecond(0).withNano(0); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0).withNano(0); |
|
|
|
|
mineOpenTime = LocalDateTime.now().withHour(mine.liveHour).withMinute(30).withSecond(0).withNano(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LocalDateTime mineCloseTime = mineOpenTime.plusMinutes(30); |
|
|
|
|