|
|
@ -984,41 +984,46 @@ public class CharacterItemManager { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public synchronized boolean moveItemToInventory(Item i) { |
|
|
|
public synchronized boolean moveItemToInventory(Item item) { |
|
|
|
|
|
|
|
|
|
|
|
boolean fromEquip = false; |
|
|
|
boolean fromEquip = false; |
|
|
|
synchronized (this) { |
|
|
|
synchronized (this) { |
|
|
|
|
|
|
|
|
|
|
|
//Skip if NOT in vault.
|
|
|
|
//Skip if NOT in vault.
|
|
|
|
if (i.containerType != Enum.ItemContainerType.VAULT) |
|
|
|
if (item.containerType != Enum.ItemContainerType.VAULT) |
|
|
|
if (this.doesCharOwnThisItem(i.getObjectUUID()) == false) |
|
|
|
if (this.doesCharOwnThisItem(item.getObjectUUID()) == false) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
// Only valid from bank, equip and vault
|
|
|
|
// Only valid from bank, equip and vault
|
|
|
|
if (!bankContains(i) && !equippedContains(i) && !vaultContains(i)) |
|
|
|
if (!bankContains(item) && !equippedContains(item) && !vaultContains(item)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (equippedContains(i)) { |
|
|
|
if (equippedContains(item)) { |
|
|
|
fromEquip = true; |
|
|
|
fromEquip = true; |
|
|
|
ItemBase ib = i.getItemBase(); |
|
|
|
ItemBase ib = item.getItemBase(); |
|
|
|
if (ib != null && ib.getType().equals(ItemType.GOLD)) |
|
|
|
if (ib != null && ib.getType().equals(ItemType.GOLD)) |
|
|
|
this.absCharacter.cancelOnUnEquip(); |
|
|
|
this.absCharacter.cancelOnUnEquip(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Clear equipment of item.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.absCharacter.charItemManager.equipped.remove(item.equipSlot); |
|
|
|
|
|
|
|
|
|
|
|
// check to see what type of AbstractCharacter subclass we have stored
|
|
|
|
// check to see what type of AbstractCharacter subclass we have stored
|
|
|
|
|
|
|
|
|
|
|
|
if (this.absCharacter.getClass() == PlayerCharacter.class) { |
|
|
|
if (this.absCharacter.getClass() == PlayerCharacter.class) { |
|
|
|
if (!i.moveItemToInventory((PlayerCharacter) this.absCharacter)) |
|
|
|
if (!item.moveItemToInventory((PlayerCharacter) this.absCharacter)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} else if (!i.moveItemToInventory((NPC) this.absCharacter)) |
|
|
|
} else if (!item.moveItemToInventory((NPC) this.absCharacter)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
// remove it from other lists:
|
|
|
|
// remove it from other lists:
|
|
|
|
this.remItemFromLists(i); |
|
|
|
this.remItemFromLists(item); |
|
|
|
|
|
|
|
|
|
|
|
// add to Inventory
|
|
|
|
// add to Inventory
|
|
|
|
this.inventory.add(i); |
|
|
|
this.inventory.add(item); |
|
|
|
i.addToCache(); |
|
|
|
item.addToCache(); |
|
|
|
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); |
|
|
|
this.itemIDtoType.put(item.getObjectUUID(), item.getObjectType().ordinal()); |
|
|
|
|
|
|
|
|
|
|
|
calculateWeights(); |
|
|
|
calculateWeights(); |
|
|
|
} |
|
|
|
} |
|
|
|