Browse Source

Remove from equip before changing slot.

combat-2
MagicBot 8 months ago
parent
commit
c6f451bce1
  1. 4
      src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java
  2. 4
      src/engine/objects/CharacterItemManager.java

4
src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java

@ -58,8 +58,10 @@ public class TransferItemFromEquipToInventoryHandler extends AbstractClientMsgHa
if (!item.validForEquip(origin, player, itemManager)) if (!item.validForEquip(origin, player, itemManager))
return true; return true;
if (item.containerType == Enum.ItemContainerType.EQUIPPED) if (item.containerType == Enum.ItemContainerType.EQUIPPED) {
itemManager.equipped.remove(item.equipSlot);
itemManager.moveItemToInventory(item); itemManager.moveItemToInventory(item);
}
int ItemType = item.getObjectType().ordinal(); int ItemType = item.getObjectType().ordinal();
int ItemID = item.getObjectUUID(); int ItemID = item.getObjectUUID();

4
src/engine/objects/CharacterItemManager.java

@ -46,7 +46,7 @@ public class CharacterItemManager {
private final ConcurrentHashMap<Integer, Integer> itemIDtoType = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); private final ConcurrentHashMap<Integer, Integer> itemIDtoType = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
// Mapping of all items equipped in this Manager // Mapping of all items equipped in this Manager
// Key = Item Slot // Key = Item Slot
private final ConcurrentHashMap<Enum.EquipSlotType, Item> equipped = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); public final ConcurrentHashMap<Enum.EquipSlotType, Item> equipped = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private final HashSet<Item> inventory = new HashSet<>(); private final HashSet<Item> inventory = new HashSet<>();
private final HashSet<Item> bank = new HashSet<>(); private final HashSet<Item> bank = new HashSet<>();
private final HashSet<Item> vault = new HashSet<>(); private final HashSet<Item> vault = new HashSet<>();
@ -1691,8 +1691,6 @@ public class CharacterItemManager {
} }
private synchronized void remItemFromLists(Item i) { private synchronized void remItemFromLists(Item i) {
this.equipped.remove(i.equipSlot);
this.vault.remove(i); this.vault.remove(i);
this.bank.remove(i); this.bank.remove(i);
this.inventory.remove(i); this.inventory.remove(i);

Loading…
Cancel
Save