|
|
@ -191,19 +191,19 @@ public class CharacterItemManager { |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case BANK: |
|
|
|
case BANK: |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
this.goldBank = i; |
|
|
|
this.goldBank = i; |
|
|
|
else if (this.bank.contains(i) == false) |
|
|
|
else if (this.bank.contains(i) == false) |
|
|
|
this.bank.add(i); |
|
|
|
this.bank.add(i); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case INVENTORY: |
|
|
|
case INVENTORY: |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
this.goldInventory = i; |
|
|
|
this.goldInventory = i; |
|
|
|
else if (this.inventory.contains(i) == false) |
|
|
|
else if (this.inventory.contains(i) == false) |
|
|
|
this.inventory.add(i); |
|
|
|
this.inventory.add(i); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case VAULT: |
|
|
|
case VAULT: |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
this.goldVault = i; |
|
|
|
this.goldVault = i; |
|
|
|
else if (this.vault.contains(i) == false) |
|
|
|
else if (this.vault.contains(i) == false) |
|
|
|
this.vault.add(i); |
|
|
|
this.vault.add(i); |
|
|
@ -238,13 +238,13 @@ public class CharacterItemManager { |
|
|
|
this.equipped.put(i.equipSlot, i); |
|
|
|
this.equipped.put(i.equipSlot, i); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case BANK: |
|
|
|
case BANK: |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
this.goldBank = i; |
|
|
|
this.goldBank = i; |
|
|
|
else if (this.bank.contains(i) == false) |
|
|
|
else if (this.bank.contains(i) == false) |
|
|
|
this.bank.add(i); |
|
|
|
this.bank.add(i); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case INVENTORY: |
|
|
|
case INVENTORY: |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
this.goldInventory = i; |
|
|
|
this.goldInventory = i; |
|
|
|
else if (this.inventory.contains(i) == false) |
|
|
|
else if (this.inventory.contains(i) == false) |
|
|
|
this.inventory.add(i); |
|
|
|
this.inventory.add(i); |
|
|
@ -915,7 +915,7 @@ public class CharacterItemManager { |
|
|
|
if (i == null) |
|
|
|
if (i == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) { |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) { |
|
|
|
if (this.getGoldInventory() != null) { |
|
|
|
if (this.getGoldInventory() != null) { |
|
|
|
if (i.getObjectUUID() == this.getGoldInventory().getObjectUUID()) |
|
|
|
if (i.getObjectUUID() == this.getGoldInventory().getObjectUUID()) |
|
|
|
this.goldInventory = null; |
|
|
|
this.goldInventory = null; |
|
|
@ -945,7 +945,7 @@ public class CharacterItemManager { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private synchronized boolean junk(Item i, boolean updateInventory) { |
|
|
|
private synchronized boolean junk(Item i, boolean updateInventory) { |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) { |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) { |
|
|
|
if (this.getGoldInventory().getObjectUUID() == i.getObjectUUID()) |
|
|
|
if (this.getGoldInventory().getObjectUUID() == i.getObjectUUID()) |
|
|
|
if (DbManager.ItemQueries.UPDATE_GOLD(i, 0)) { |
|
|
|
if (DbManager.ItemQueries.UPDATE_GOLD(i, 0)) { |
|
|
|
this.getGoldInventory().setNumOfItems(0); |
|
|
|
this.getGoldInventory().setNumOfItems(0); |
|
|
@ -1000,8 +1000,7 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
if (equippedContains(item)) { |
|
|
|
if (equippedContains(item)) { |
|
|
|
fromEquip = true; |
|
|
|
fromEquip = true; |
|
|
|
ItemBase ib = item.getItemBase(); |
|
|
|
if (item.template.item_type.equals(ItemType.GOLD)) |
|
|
|
if (ib != null && ib.getType().equals(ItemType.GOLD)) |
|
|
|
|
|
|
|
this.absCharacter.cancelOnUnEquip(); |
|
|
|
this.absCharacter.cancelOnUnEquip(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1211,7 +1210,7 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
// This removes ingame item from inventory for loot.
|
|
|
|
// This removes ingame item from inventory for loot.
|
|
|
|
private synchronized boolean removeItemFromInventory(Item i) { |
|
|
|
private synchronized boolean removeItemFromInventory(Item i) { |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) { |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) { |
|
|
|
if (i.getObjectUUID() != this.getGoldInventory().getObjectUUID()) |
|
|
|
if (i.getObjectUUID() != this.getGoldInventory().getObjectUUID()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
if (!DbManager.ItemQueries.UPDATE_GOLD(this.goldInventory, 0)) { |
|
|
|
if (!DbManager.ItemQueries.UPDATE_GOLD(this.goldInventory, 0)) { |
|
|
@ -1234,7 +1233,7 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
// This adds item to inventory for loot. Validity checks already handled
|
|
|
|
// This adds item to inventory for loot. Validity checks already handled
|
|
|
|
public synchronized boolean addItemToInventory(Item i) { |
|
|
|
public synchronized boolean addItemToInventory(Item i) { |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
if (this.absCharacter.getObjectType() == GameObjectType.Mob) { |
|
|
|
if (this.absCharacter.getObjectType() == GameObjectType.Mob) { |
|
|
|
if (this.goldInventory == null) |
|
|
|
if (this.goldInventory == null) |
|
|
|
loadGoldItems(); |
|
|
|
loadGoldItems(); |
|
|
@ -1261,7 +1260,7 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
//called for adding gold of a specified amount
|
|
|
|
//called for adding gold of a specified amount
|
|
|
|
public synchronized boolean addItemToInventory(Item i, int amount) { |
|
|
|
public synchronized boolean addItemToInventory(Item i, int amount) { |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
return DbManager.ItemQueries.UPDATE_GOLD(this.getGoldInventory(), this.goldInventory.getNumOfItems() + amount); |
|
|
|
return DbManager.ItemQueries.UPDATE_GOLD(this.getGoldInventory(), this.goldInventory.getNumOfItems() + amount); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -1623,9 +1622,9 @@ public class CharacterItemManager { |
|
|
|
synchronized (lockFirst) { |
|
|
|
synchronized (lockFirst) { |
|
|
|
synchronized (lockSecond) { |
|
|
|
synchronized (lockSecond) { |
|
|
|
// make sure current player has item in inventory
|
|
|
|
// make sure current player has item in inventory
|
|
|
|
if (lootItem.getItemBase().getType().equals(ItemType.GOLD) && lootItem.getObjectUUID() != this.getGoldInventory().getObjectUUID() && !(this.absCharacter.getObjectType().equals(GameObjectType.Mob))) |
|
|
|
if (lootItem.template.item_type.equals(ItemType.GOLD) && lootItem.getObjectUUID() != this.getGoldInventory().getObjectUUID() && !(this.absCharacter.getObjectType().equals(GameObjectType.Mob))) |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
else if (!this.inventory.contains(lootItem) && !this.getEquippedList().contains(lootItem) && !lootItem.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
else if (!this.inventory.contains(lootItem) && !this.getEquippedList().contains(lootItem) && !lootItem.template.item_type.equals(ItemType.GOLD)) |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
// get weight of item
|
|
|
|
// get weight of item
|
|
|
@ -1636,10 +1635,10 @@ public class CharacterItemManager { |
|
|
|
int weight = lootItem.template.item_wt; |
|
|
|
int weight = lootItem.template.item_wt; |
|
|
|
|
|
|
|
|
|
|
|
// make sure lootingPlayer has room for item
|
|
|
|
// make sure lootingPlayer has room for item
|
|
|
|
if (!lootItem.getItemBase().getType().equals(ItemType.GOLD) && !looterItems.hasRoomInventory(weight)) |
|
|
|
if (!lootItem.template.item_type.equals(ItemType.GOLD) && !looterItems.hasRoomInventory(weight)) |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
if (lootItem.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (lootItem.template.item_type.equals(ItemType.GOLD)) |
|
|
|
if (amount != -1) { //from steal
|
|
|
|
if (amount != -1) { //from steal
|
|
|
|
int total = lootItem.getNumOfItems(); |
|
|
|
int total = lootItem.getNumOfItems(); |
|
|
|
amount = (amount > total) ? total : amount; |
|
|
|
amount = (amount > total) ? total : amount; |
|
|
@ -1702,25 +1701,25 @@ public class CharacterItemManager { |
|
|
|
* Delegates |
|
|
|
* Delegates |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public synchronized boolean bankContains(Item i) { |
|
|
|
public synchronized boolean bankContains(Item i) { |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
return (this.getGoldBank() != null && this.goldBank.getObjectUUID() == i.getObjectUUID()); |
|
|
|
return (this.getGoldBank() != null && this.goldBank.getObjectUUID() == i.getObjectUUID()); |
|
|
|
return bank.contains(i); |
|
|
|
return bank.contains(i); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public synchronized boolean inventoryContains(Item i) { |
|
|
|
public synchronized boolean inventoryContains(Item i) { |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
return (this.getGoldInventory() != null && this.goldInventory.getObjectUUID() == i.getObjectUUID()); |
|
|
|
return (this.getGoldInventory() != null && this.goldInventory.getObjectUUID() == i.getObjectUUID()); |
|
|
|
return inventory.contains(i); |
|
|
|
return inventory.contains(i); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public synchronized boolean forgeContains(Item i, NPC vendor) { |
|
|
|
public synchronized boolean forgeContains(Item i, NPC vendor) { |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
return (this.getGoldInventory() != null && this.goldInventory.getObjectUUID() == i.getObjectUUID()); |
|
|
|
return (this.getGoldInventory() != null && this.goldInventory.getObjectUUID() == i.getObjectUUID()); |
|
|
|
return vendor.getRolling().contains(i); |
|
|
|
return vendor.getRolling().contains(i); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public synchronized boolean vaultContains(Item i) { |
|
|
|
public synchronized boolean vaultContains(Item i) { |
|
|
|
if (i.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (i.template.item_type.equals(ItemType.GOLD)) |
|
|
|
return (this.getGoldVault() != null && this.goldVault.getObjectUUID() == i.getObjectUUID()); |
|
|
|
return (this.getGoldVault() != null && this.goldVault.getObjectUUID() == i.getObjectUUID()); |
|
|
|
return this.account.getVault().contains(i); |
|
|
|
return this.account.getVault().contains(i); |
|
|
|
} |
|
|
|
} |
|
|
@ -2004,13 +2003,13 @@ public class CharacterItemManager { |
|
|
|
item.zeroItem(); |
|
|
|
item.zeroItem(); |
|
|
|
item.containerType = Enum.ItemContainerType.INVENTORY; |
|
|
|
item.containerType = Enum.ItemContainerType.INVENTORY; |
|
|
|
|
|
|
|
|
|
|
|
if (item.getItemBase().getType().equals(ItemType.GOLD)) |
|
|
|
if (item.template.item_type.equals(ItemType.GOLD)) |
|
|
|
//only add gold item once
|
|
|
|
//only add gold item once
|
|
|
|
if (!corpse.hasGold()) |
|
|
|
if (!corpse.hasGold()) |
|
|
|
corpse.setHasGold(true); |
|
|
|
corpse.setHasGold(true); |
|
|
|
newInventory.add(item); |
|
|
|
newInventory.add(item); |
|
|
|
} else //item
|
|
|
|
} else //item
|
|
|
|
if (item.getItemBase().getType().equals(ItemType.GOLD)) { |
|
|
|
if (item.template.item_type.equals(ItemType.GOLD)) { |
|
|
|
int amt = item.getNumOfItems(); |
|
|
|
int amt = item.getNumOfItems(); |
|
|
|
item.setNumOfItems(0); |
|
|
|
item.setNumOfItems(0); |
|
|
|
MobLoot ml = new MobLoot(this.absCharacter, amt); |
|
|
|
MobLoot ml = new MobLoot(this.absCharacter, amt); |
|
|
|