Browse Source

bane live processing with vulnerable buildings

combat-2
FatBoy-DOTC 6 months ago
parent
commit
aa0621bb02
  1. 19
      src/engine/objects/Bane.java
  2. 3
      src/engine/server/world/WorldServer.java
  3. 11
      src/engine/workthreads/HourlyJobThread.java

19
src/engine/objects/Bane.java

@ -340,6 +340,8 @@ public final class Bane { @@ -340,6 +340,8 @@ public final class Bane {
return newBane;
}
public static boolean isStarted = false;
//Call this to prematurely end a bane
public SiegePhase getSiegePhase() {
@ -639,4 +641,21 @@ public final class Bane { @@ -639,4 +641,21 @@ public final class Bane {
return cityUUID;
}
public void startBane(){
City city = this.getCity();
if(city == null)
return;
this.isStarted = true; //flag the bane as started
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(city.loc,mbEnums.CityBoundsType.ZONE.halfExtents + 64,MBServerStatics.MASK_BUILDING)){
Building building = (Building)awo;
if(building == null)
continue;
if(building.protectionState.equals(ProtectionState.UNDERSIEGE) == false)
building.protectionState = ProtectionState.UNDERSIEGE;
}
}
}

3
src/engine/server/world/WorldServer.java

@ -476,6 +476,9 @@ public class WorldServer { @@ -476,6 +476,9 @@ public class WorldServer {
Logger.info("Processing mine window.");
HourlyJobThread.processMineWindow();
Logger.info("Processing Banes...");
HourlyJobThread.processBanes();
// Calculate bootstrap time and rest boot time to current time.
Duration bootDuration = Duration.between(LocalDateTime.now(), bootTime);

11
src/engine/workthreads/HourlyJobThread.java

@ -18,6 +18,7 @@ import engine.net.MessageDispatcher; @@ -18,6 +18,7 @@ import engine.net.MessageDispatcher;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.*;
import engine.server.world.WorldServer;
import org.joda.time.DateTime;
import org.pmw.tinylog.Logger;
import java.time.LocalDateTime;
@ -279,10 +280,20 @@ public class HourlyJobThread implements Runnable { @@ -279,10 +280,20 @@ public class HourlyJobThread implements Runnable {
Logger.error("missing city map");
}
processBanes();
// Log metrics to console
Logger.info(WorldServer.getUptimeString());
Logger.info(SimulationManager.getPopulationString());
Logger.info(MessageDispatcher.getNetstatString());
Logger.info(PurgeOprhans.recordsDeleted.toString() + "orphaned items deleted");
}
public static void processBanes(){
//handle banes
for(Bane bane : Bane.banes.values()){
if(bane.getLiveDate() != null && DateTime.now().isAfter(bane.getLiveDate().minusMinutes(1)) && bane.isStarted == false)
bane.startBane();
}
}
}

Loading…
Cancel
Save