|
|
@ -15,6 +15,9 @@ import engine.server.MBServerStatics; |
|
|
|
import engine.util.ThreadUtils; |
|
|
|
import engine.util.ThreadUtils; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.Duration; |
|
|
|
|
|
|
|
import java.time.Instant; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class MobileFSMManager { |
|
|
|
public class MobileFSMManager { |
|
|
|
|
|
|
|
|
|
|
@ -23,6 +26,8 @@ public class MobileFSMManager { |
|
|
|
private volatile boolean alive; |
|
|
|
private volatile boolean alive; |
|
|
|
private long timeOfKill = -1; |
|
|
|
private long timeOfKill = -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Duration executionTime; |
|
|
|
|
|
|
|
|
|
|
|
private MobileFSMManager() { |
|
|
|
private MobileFSMManager() { |
|
|
|
|
|
|
|
|
|
|
|
Runnable worker = new Runnable() { |
|
|
|
Runnable worker = new Runnable() { |
|
|
@ -67,6 +72,7 @@ public class MobileFSMManager { |
|
|
|
//Load zone threshold once.
|
|
|
|
//Load zone threshold once.
|
|
|
|
|
|
|
|
|
|
|
|
long mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD; |
|
|
|
long mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD; |
|
|
|
|
|
|
|
Instant startTime; |
|
|
|
|
|
|
|
|
|
|
|
while (alive) { |
|
|
|
while (alive) { |
|
|
|
|
|
|
|
|
|
|
@ -74,6 +80,8 @@ public class MobileFSMManager { |
|
|
|
|
|
|
|
|
|
|
|
if (System.currentTimeMillis() > mobPulse) { |
|
|
|
if (System.currentTimeMillis() > mobPulse) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startTime = Instant.now(); |
|
|
|
|
|
|
|
|
|
|
|
for (Zone zone : ZoneManager.getAllZones()) { |
|
|
|
for (Zone zone : ZoneManager.getAllZones()) { |
|
|
|
|
|
|
|
|
|
|
|
for (Mob mob : zone.zoneMobSet) { |
|
|
|
for (Mob mob : zone.zoneMobSet) { |
|
|
@ -88,6 +96,7 @@ public class MobileFSMManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.executionTime = Duration.between(startTime, Instant.now()); |
|
|
|
mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD; |
|
|
|
mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|