From f26e8e45596a8988a36e6037a1101466c0d4bc61 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 9 Mar 2024 20:43:03 -0600 Subject: [PATCH] login crash bug --- src/engine/objects/CharacterItemManager.java | 11 +++++++++-- src/engine/server/login/LoginServerMsgHandler.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 40d227a1..445a1942 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -1257,15 +1257,22 @@ public class CharacterItemManager { } if(ItemBase.getItemBase(i.getItemBaseID()).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { int count = i.getNumOfItems(); + ArrayList purge = new ArrayList<>(); for(Item item : this.inventory){ if(item.getItemBaseID() == i.getItemBaseID()){ if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(i.getItemBaseID())){ - this.junk(item); + purge.add(item); count += item.getNumOfItems(); } } } - i = new MobLoot(this.getOwner(),i.getItemBase(),count,false).promoteToItem((PlayerCharacter)this.getOwner()); + for(Item item : purge){ + this.removeItemFromInventory(item); + } + Item resource = new MobLoot(this.getOwner(),i.getItemBase(),count,false).promoteToItem((PlayerCharacter)this.getOwner()); + this.inventory.add(resource); + this.itemIDtoType.put(resource.getObjectUUID(), resource.getObjectType().ordinal()); + return true; } this.inventory.add(i); this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); diff --git a/src/engine/server/login/LoginServerMsgHandler.java b/src/engine/server/login/LoginServerMsgHandler.java index 29dde176..c92007e0 100644 --- a/src/engine/server/login/LoginServerMsgHandler.java +++ b/src/engine/server/login/LoginServerMsgHandler.java @@ -351,7 +351,7 @@ public class LoginServerMsgHandler implements NetMsgHandler { this.sendCharacterSelectScreen(session, true); return; } - pc.setLevel((short)10); + pc.level = 10; MobLoot conc = new MobLoot(pc, ItemBase.getItemBase(980066),false); //player.getCharItemManager().addItemToInventory(conc); pc.getCharItemManager().addItemToInventory(conc.promoteToItem(pc),1);