Browse Source

login crash bug

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
f26e8e4559
  1. 11
      src/engine/objects/CharacterItemManager.java
  2. 2
      src/engine/server/login/LoginServerMsgHandler.java

11
src/engine/objects/CharacterItemManager.java

@ -1257,15 +1257,22 @@ public class CharacterItemManager {
} }
if(ItemBase.getItemBase(i.getItemBaseID()).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { if(ItemBase.getItemBase(i.getItemBaseID()).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
int count = i.getNumOfItems(); int count = i.getNumOfItems();
ArrayList<Item> purge = new ArrayList<>();
for(Item item : this.inventory){ for(Item item : this.inventory){
if(item.getItemBaseID() == i.getItemBaseID()){ if(item.getItemBaseID() == i.getItemBaseID()){
if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(i.getItemBaseID())){ if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(i.getItemBaseID())){
this.junk(item); purge.add(item);
count += item.getNumOfItems(); 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.inventory.add(i);
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());

2
src/engine/server/login/LoginServerMsgHandler.java

@ -351,7 +351,7 @@ public class LoginServerMsgHandler implements NetMsgHandler {
this.sendCharacterSelectScreen(session, true); this.sendCharacterSelectScreen(session, true);
return; return;
} }
pc.setLevel((short)10); pc.level = 10;
MobLoot conc = new MobLoot(pc, ItemBase.getItemBase(980066),false); MobLoot conc = new MobLoot(pc, ItemBase.getItemBase(980066),false);
//player.getCharItemManager().addItemToInventory(conc); //player.getCharItemManager().addItemToInventory(conc);
pc.getCharItemManager().addItemToInventory(conc.promoteToItem(pc),1); pc.getCharItemManager().addItemToInventory(conc.promoteToItem(pc),1);

Loading…
Cancel
Save