Browse Source

additional 60 second logout timer for players who have enemies nearby and aren't in safezone

lakebane-strongholds
FatBoy-DOTC 3 months ago
parent
commit
0c9343f24d
  1. 1
      src/engine/net/client/ClientMessagePump.java
  2. 20
      src/engine/server/world/WorldServer.java

1
src/engine/net/client/ClientMessagePump.java

@ -15,6 +15,7 @@ import engine.exception.MsgSendException; @@ -15,6 +15,7 @@ import engine.exception.MsgSendException;
import engine.gameManager.*;
import engine.job.JobContainer;
import engine.job.JobScheduler;
import engine.jobs.LogoutCharacterJob;
import engine.jobs.RefreshGroupJob;
import engine.jobs.StuckJob;
import engine.math.Vector3fImmutable;

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

@ -57,6 +57,7 @@ import java.nio.file.Paths; @@ -57,6 +57,7 @@ import java.nio.file.Paths;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Timer;
@ -671,6 +672,22 @@ public class WorldServer { @@ -671,6 +672,22 @@ public class WorldServer {
delta = 60000;
}
//get additional logout timer for enemies nearby
if(!playerCharacter.isInSafeZone()){
HashSet<AbstractWorldObject> playersClose = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
boolean enemiesClose = false;
for(AbstractWorldObject awo : playersClose){
PlayerCharacter pc = (PlayerCharacter)awo;
if(!pc.guild.getNation().equals(playerCharacter.guild.getNation()))
enemiesClose = true;
}
if(enemiesClose){
delta += 60000;
}
}
playerCharacter.stopMovement(playerCharacter.getLoc());
UpdateStateMsg updateStateMsg = new UpdateStateMsg();
updateStateMsg.setPlayer(playerCharacter);
@ -688,8 +705,7 @@ public class WorldServer { @@ -688,8 +705,7 @@ public class WorldServer {
playerCharacter.getLoadedStaticObjects().clear();
LogoutCharacterJob logoutJob = new LogoutCharacterJob(playerCharacter, this);
JobContainer jc = JobScheduler.getInstance().scheduleJob(logoutJob,
System.currentTimeMillis() + delta);
JobContainer jc = JobScheduler.getInstance().scheduleJob(logoutJob, System.currentTimeMillis() + delta);
playerCharacter.getTimers().put("Logout", jc);
playerCharacter.getTimestamps().put("logout", System.currentTimeMillis());

Loading…
Cancel
Save