Browse Source

Serialized mine open time adjusted if the mine was claimed during this cycle.

master
MagicBot 2 years ago
parent
commit
1a7003ce59
  1. 8
      src/engine/objects/Mine.java
  2. 5
      src/engine/workthreads/HourlyJobThread.java

8
src/engine/objects/Mine.java

@ -265,7 +265,6 @@ public class Mine extends AbstractGameObject {
writer.putInt(mine.getObjectType().ordinal()); writer.putInt(mine.getObjectType().ordinal());
writer.putInt(mine.getObjectUUID()); writer.putInt(mine.getObjectUUID());
writer.putInt(mine.getObjectUUID()); //actually a hash of mine writer.putInt(mine.getObjectUUID()); //actually a hash of mine
// writer.putInt(0x215C92BB); //this.unknown1);
writer.putString(mine.mineType.name); writer.putString(mine.mineType.name);
writer.putString(mine.zoneName); writer.putString(mine.zoneName);
writer.putInt(mine.production.hash); writer.putInt(mine.production.hash);
@ -279,20 +278,21 @@ public class Mine extends AbstractGameObject {
Guild mineOwnerGuild = mine.getOwningGuild(); Guild mineOwnerGuild = mine.getOwningGuild();
// Adjust the serialized mine time based upon whether // Adjust the serialized mine time based upon whether
// the Guild's mine window has passed or not. // the Guild's mine window has passed or not and if it was claimed.
// If a mine is active serialize current datetime irrespective // If a mine is active serialize current datetime irrespective
// of any claim // of any claim.
if (mineOwnerGuild.isErrant() == false && mine.isActive == false) { if (mineOwnerGuild.isErrant() == false && mine.isActive == false) {
int guildWOO = mineOwnerGuild.getNation().getMineTime(); int guildWOO = mineOwnerGuild.getNation().getMineTime();
LocalDateTime guildMineTime = mineOpenTime.withHour(guildWOO); LocalDateTime guildMineTime = mineOpenTime.withHour(guildWOO);
if (mineOpenTime.isAfter(guildMineTime)) if (mineOpenTime.isAfter(guildMineTime) || mine.wasClaimed == true)
mineOpenTime = guildMineTime.plusDays(1); mineOpenTime = guildMineTime.plusDays(1);
else else
mineOpenTime = guildMineTime; mineOpenTime = guildMineTime;
// Mines
} }
writer.putLocalDateTime(mineOpenTime); writer.putLocalDateTime(mineOpenTime);

5
src/engine/workthreads/HourlyJobThread.java

@ -113,8 +113,8 @@ public class HourlyJobThread implements Runnable {
mine.wasClaimed = false; mine.wasClaimed = false;
continue; continue;
} }
// Open Errant Mines // Open Errant Mines
if (mine.getOwningGuild().isErrant()) { if (mine.getOwningGuild().isErrant()) {
@ -132,7 +132,8 @@ public class HourlyJobThread implements Runnable {
continue; continue;
} }
// Close all other mines // Close all remaining mines
if (mine.handleEndMineWindow()) if (mine.handleEndMineWindow())
Mine.setLastChange(System.currentTimeMillis()); Mine.setLastChange(System.currentTimeMillis());

Loading…
Cancel
Save