From 5f56143c5edb9e2545680687395f21d99fb4a5e7 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 29 Dec 2024 20:49:12 -0600 Subject: [PATCH] fixed bug with negative xp when setting level to 10 --- src/engine/InterestManagement/InterestManager.java | 10 +--------- src/engine/objects/PlayerCharacter.java | 9 +++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/engine/InterestManagement/InterestManager.java b/src/engine/InterestManagement/InterestManager.java index 04856949..854f0da9 100644 --- a/src/engine/InterestManagement/InterestManager.java +++ b/src/engine/InterestManagement/InterestManager.java @@ -19,10 +19,7 @@ import engine.net.AbstractNetMsg; import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.client.ClientConnection; -import engine.net.client.msg.LoadCharacterMsg; -import engine.net.client.msg.LoadStructureMsg; -import engine.net.client.msg.MoveToPointMsg; -import engine.net.client.msg.UnloadObjectsMsg; +import engine.net.client.msg.*; import engine.objects.*; import engine.server.MBServerStatics; import org.pmw.tinylog.Logger; @@ -525,11 +522,6 @@ public enum InterestManager implements Runnable { player.setDirtyLoad(true); updateStaticList(player, origin); updateMobileList(player, origin); - if(player.level < 10) { - player.setLevel((short) 10); - player.getCharItemManager().addGoldToInventory(1000,false); - player.getCharItemManager().addItemToInventory(new MobLoot(player,ItemBase.getItemBase(980066),1,false).promoteToItem(player)); - } } public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) { diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 85d89833..d7af7cfb 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4872,6 +4872,15 @@ public class PlayerCharacter extends AbstractCharacter { this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000); } + if(this.level < 10) { + this.setLevel((short) 10); + this.getCharItemManager().addGoldToInventory(1000,false); + this.getCharItemManager().addItemToInventory(new MobLoot(this,ItemBase.getItemBase(980066),1,false).promoteToItem(this)); + this.setOverFlowEXP(0); + TargetedActionMsg cmm = new TargetedActionMsg(this); + DispatchMessage.dispatchMsgToInterestArea(this, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); + } + if(this.isBoxed && !this.containsEffect(1672601862)) { PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); }