From b351d7c1ae2228e96578366a7104b0db45f0cd84 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 15 Jun 2024 15:01:47 -0500 Subject: [PATCH] enrollment officer system --- src/engine/net/client/msg/VendorDialogMsg.java | 9 +++++++++ src/engine/objects/PlayerCharacter.java | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/engine/net/client/msg/VendorDialogMsg.java b/src/engine/net/client/msg/VendorDialogMsg.java index 1ced6074..016665a3 100644 --- a/src/engine/net/client/msg/VendorDialogMsg.java +++ b/src/engine/net/client/msg/VendorDialogMsg.java @@ -96,6 +96,15 @@ public class VendorDialogMsg extends ClientNetMsg { return; } + + if(npc.contractUUID == 1502040){ //enrollment officer + if(!playerCharacter.getTimestamps().containsKey("lastBoxFlag")) + playerCharacter.getTimestamps().put("lastBoxFlag",System.currentTimeMillis() - 1000); + + if(playerCharacter.getTimestamps().get("lastBoxFlag") + 10000 > System.currentTimeMillis()) + PlayerCharacter.unboxPlayer(playerCharacter); + } + // Restrict disc trainers to only characters who have // tht disc applied. diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index dbc023be..4409f2b2 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4834,7 +4834,21 @@ public class PlayerCharacter extends AbstractCharacter { } } } + public static void unboxPlayer(PlayerCharacter player){ + String machineID = player.getClientConnection().machineID; + ArrayList sameMachine = new ArrayList<>(); + for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){ + if(!pc.equals(player) && pc. isActive && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(machineID)){ + sameMachine.add(pc); + } + } + + for(PlayerCharacter pc : sameMachine) + pc.isBoxed = true; + player.isBoxed = false; + + } public static boolean checkIfBoxed(PlayerCharacter player){ String machineID = player.getClientConnection().machineID; ArrayList sameMachine = new ArrayList<>();