From fed9ba42400518302ec6671da8693a7a2ced94e9 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 6 Mar 2025 18:45:24 -0600 Subject: [PATCH] PVE flag --- .../InterestManagement/InterestManager.java | 4 ++-- src/engine/devcmd/cmds/SetAdminRuneCmd.java | 2 +- src/engine/devcmd/cmds/SetBaseClassCmd.java | 2 +- src/engine/devcmd/cmds/SetLevelCmd.java | 2 +- .../devcmd/cmds/SetPromotionClassCmd.java | 2 +- src/engine/devcmd/cmds/SetRuneCmd.java | 2 +- src/engine/objects/PlayerCharacter.java | 23 +++++++++++++++---- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/engine/InterestManagement/InterestManager.java b/src/engine/InterestManagement/InterestManager.java index e44da878..69fbf62c 100644 --- a/src/engine/InterestManagement/InterestManager.java +++ b/src/engine/InterestManagement/InterestManager.java @@ -106,7 +106,7 @@ public enum InterestManager implements Runnable { origin.sendMsg(moveMsg); } - public static void reloadCharacter(AbstractCharacter absChar) { + public static void reloadCharacter(AbstractCharacter absChar, boolean fromBox) { UnloadObjectsMsg uom = new UnloadObjectsMsg(); uom.addObject(absChar); @@ -132,7 +132,7 @@ public enum InterestManager implements Runnable { if (cc == null) continue; - if (pcc.getObjectUUID() == absChar.getObjectUUID()) + if (!fromBox && pcc.getObjectUUID() == absChar.getObjectUUID()) continue; else { diff --git a/src/engine/devcmd/cmds/SetAdminRuneCmd.java b/src/engine/devcmd/cmds/SetAdminRuneCmd.java index f8df7016..396a08b7 100644 --- a/src/engine/devcmd/cmds/SetAdminRuneCmd.java +++ b/src/engine/devcmd/cmds/SetAdminRuneCmd.java @@ -62,7 +62,7 @@ public class SetAdminRuneCmd extends AbstractDevCmd { if (worked) { ChatManager.chatSayInfo(pcSender, "rune of ID " + runeID + " removed"); - InterestManager.reloadCharacter(pcSender); + InterestManager.reloadCharacter(pcSender, false); } else throwbackError(pcSender, "Failed to remove the rune of type " + runeID); diff --git a/src/engine/devcmd/cmds/SetBaseClassCmd.java b/src/engine/devcmd/cmds/SetBaseClassCmd.java index be99f8de..fa58f40b 100644 --- a/src/engine/devcmd/cmds/SetBaseClassCmd.java +++ b/src/engine/devcmd/cmds/SetBaseClassCmd.java @@ -47,7 +47,7 @@ public class SetBaseClassCmd extends AbstractDevCmd { this.setTarget(pc); //for logging ChatManager.chatSayInfo(pc, "BaseClass changed to " + classID); - InterestManager.reloadCharacter(pc); + InterestManager.reloadCharacter(pc, false); } diff --git a/src/engine/devcmd/cmds/SetLevelCmd.java b/src/engine/devcmd/cmds/SetLevelCmd.java index faf16164..4276a5fb 100644 --- a/src/engine/devcmd/cmds/SetLevelCmd.java +++ b/src/engine/devcmd/cmds/SetLevelCmd.java @@ -57,7 +57,7 @@ public class SetLevelCmd extends AbstractDevCmd { tar.setLevel((short) level); this.setTarget(tar); //for logging ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level); - InterestManager.reloadCharacter(tar); + InterestManager.reloadCharacter(tar, false); } @Override diff --git a/src/engine/devcmd/cmds/SetPromotionClassCmd.java b/src/engine/devcmd/cmds/SetPromotionClassCmd.java index f8776786..915b0047 100644 --- a/src/engine/devcmd/cmds/SetPromotionClassCmd.java +++ b/src/engine/devcmd/cmds/SetPromotionClassCmd.java @@ -42,7 +42,7 @@ public class SetPromotionClassCmd extends AbstractDevCmd { pc.setPromotionClass(classID); ChatManager.chatSayInfo(pc, "PromotionClass changed to " + classID); - InterestManager.reloadCharacter(pc); + InterestManager.reloadCharacter(pc, false); this.setTarget(pc); //for logging diff --git a/src/engine/devcmd/cmds/SetRuneCmd.java b/src/engine/devcmd/cmds/SetRuneCmd.java index 1379ab35..70ee598c 100644 --- a/src/engine/devcmd/cmds/SetRuneCmd.java +++ b/src/engine/devcmd/cmds/SetRuneCmd.java @@ -57,7 +57,7 @@ public class SetRuneCmd extends AbstractDevCmd { if (worked) { ChatManager.chatSayInfo(pcSender, "rune of ID " + runeID + " removed"); - InterestManager.reloadCharacter(pcSender); + InterestManager.reloadCharacter(pcSender, false); } else throwbackError(pcSender, "Failed to remove the rune of type " + runeID); diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 3e5ef8b9..d44b0080 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -41,7 +41,6 @@ import engine.server.MBServerStatics; import engine.server.login.LoginServer; import engine.server.login.LoginServerMsgHandler; import engine.server.world.WorldServer; -import engine.util.KeyCloneAudit; import engine.util.MiscUtils; import org.joda.time.DateTime; import org.pmw.tinylog.Logger; @@ -5202,12 +5201,14 @@ public class PlayerCharacter extends AbstractCharacter { //PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); if(!this.title.equals(CharacterTitle.PVE)){ this.title = CharacterTitle.PVE; - InterestManager.forceLoad(this); + InterestManager.setObjectDirty(this); + InterestManager.reloadCharacter(this, false); } }else { if (!this.title.equals(CharacterTitle.NONE)) { this.title = CharacterTitle.NONE; - InterestManager.forceLoad(this); + InterestManager.setObjectDirty(this); + InterestManager.reloadCharacter(this, false); } } } @@ -5258,10 +5259,22 @@ public class PlayerCharacter extends AbstractCharacter { valid = false; } if(valid) { - for (PlayerCharacter pc : sameMachine) + for (PlayerCharacter pc : sameMachine) { pc.isBoxed = true; - + if (!pc.title.equals(CharacterTitle.PVE)) { + pc.title = CharacterTitle.PVE; + InterestManager.setObjectDirty(pc); + InterestManager.reloadCharacter(pc, true); + pc.setDirtyLoad(true); + } + } player.isBoxed = false; + if (!player.title.equals(CharacterTitle.NONE)) { + player.title = CharacterTitle.NONE; + InterestManager.setObjectDirty(player); + InterestManager.reloadCharacter(player, true); + player.setDirtyLoad(true); + } if (player.containsEffect(1672601862)) { player.removeEffectBySource(EffectSourceType.DeathShroud, 41, false); }