Removed ordering junk
This commit is contained in:
@@ -47,7 +47,6 @@ public class CharacterItemManager {
|
||||
private final HashSet<Item> inventory = new HashSet<>();
|
||||
private final HashSet<Item> bank = new HashSet<>();
|
||||
private final HashSet<Item> vault = new HashSet<>();
|
||||
private final HashSet<Enum.EquipSlotType> equipOrder = new HashSet<>();
|
||||
public Item goldVault;
|
||||
private Account account;
|
||||
private Item goldInventory;
|
||||
@@ -182,10 +181,8 @@ public class CharacterItemManager {
|
||||
|
||||
switch (i.containerType) {
|
||||
case EQUIPPED:
|
||||
if (this.equipped.containsValue(i) == false) {
|
||||
if (this.equipped.containsValue(i) == false)
|
||||
this.equipped.put(i.equipSlot, i);
|
||||
addEquipOrder(i.equipSlot);
|
||||
}
|
||||
break;
|
||||
case BANK:
|
||||
if (i.template.item_type.equals(ItemType.GOLD))
|
||||
@@ -875,14 +872,6 @@ public class CharacterItemManager {
|
||||
return this.goldVault;
|
||||
}
|
||||
|
||||
public void addEquipOrder(Enum.EquipSlotType slot) {
|
||||
synchronized (this.equipOrder) {
|
||||
if (this.equipOrder.contains(slot))
|
||||
this.equipOrder.remove(slot);
|
||||
this.equipOrder.add(slot);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean doesCharOwnThisItem(int itemID) {
|
||||
return this.itemIDtoType.containsKey(itemID);
|
||||
}
|
||||
@@ -1311,8 +1300,6 @@ public class CharacterItemManager {
|
||||
|
||||
i.addToCache();
|
||||
|
||||
addEquipOrder(slot);
|
||||
|
||||
//calculateWeights();
|
||||
}
|
||||
|
||||
@@ -1622,7 +1609,7 @@ public class CharacterItemManager {
|
||||
// make sure current player has item in inventory
|
||||
if (lootItem.template.item_type.equals(ItemType.GOLD) && lootItem.getObjectUUID() != this.getGoldInventory().getObjectUUID() && !(this.absCharacter.getObjectType().equals(GameObjectType.Mob)))
|
||||
return null;
|
||||
else if (!this.inventory.contains(lootItem) && !this.getEquippedList().contains(lootItem) && !lootItem.template.item_type.equals(ItemType.GOLD))
|
||||
else if (!this.inventory.contains(lootItem) && !this.equipped.containsValue(lootItem) && !lootItem.template.item_type.equals(ItemType.GOLD))
|
||||
return null;
|
||||
|
||||
// get weight of item
|
||||
@@ -1882,27 +1869,6 @@ public class CharacterItemManager {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Item> getEquippedList() {
|
||||
ArrayList<Item> ret = new ArrayList<>();
|
||||
synchronized (this.equipOrder) {
|
||||
synchronized (this.equipped) {
|
||||
for (Enum.EquipSlotType slot : this.equipOrder) {
|
||||
if (this.equipped.containsKey(slot))
|
||||
ret.add(this.equipped.get(slot));
|
||||
}
|
||||
if (ret.size() != this.equipped.size())
|
||||
//missed adding some items, figure out what.
|
||||
for (Enum.EquipSlotType slot : this.equipped.keySet()) {
|
||||
if (!(this.equipOrder.contains(slot))) {
|
||||
this.equipOrder.add(slot);
|
||||
ret.add(this.equipped.get(slot));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Item getEquipped(Enum.EquipSlotType slot) {
|
||||
synchronized (this.equipped) {
|
||||
return this.equipped.get(slot);
|
||||
@@ -2547,33 +2513,8 @@ public class CharacterItemManager {
|
||||
|
||||
public synchronized void clearEquip() {
|
||||
|
||||
ArrayList<Item> equipCopy = new ArrayList<>(this.getEquippedList());
|
||||
Iterator<Item> ii = equipCopy.iterator();
|
||||
while (ii.hasNext()) {
|
||||
Item itm = ii.next();
|
||||
this.getEquippedList().remove(itm);
|
||||
this.delete(itm);
|
||||
}
|
||||
}
|
||||
this.equipped.clear();
|
||||
|
||||
public byte getEquipVer() {
|
||||
return this.equipVer;
|
||||
}
|
||||
|
||||
public void incEquipVer() {
|
||||
this.equipVer++;
|
||||
}
|
||||
|
||||
public void incInventoryVer() {
|
||||
this.equipVer++;
|
||||
}
|
||||
|
||||
public void incBankVer() {
|
||||
this.equipVer++;
|
||||
}
|
||||
|
||||
public void incVaultVer() {
|
||||
this.equipVer++;
|
||||
}
|
||||
|
||||
public int getTradeID() {
|
||||
|
||||
@@ -448,11 +448,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
} else
|
||||
writer.putInt(0);
|
||||
|
||||
|
||||
ArrayList<Item> equipped = playerCharacter.charItemManager.getEquippedList();
|
||||
|
||||
writer.putInt(equipped.size());
|
||||
for (Item item : equipped) {
|
||||
writer.putInt(playerCharacter.charItemManager.equipped.size());
|
||||
for (Item item : playerCharacter.charItemManager.equipped.values()) {
|
||||
Item._serializeForClientMsg(item, writer);
|
||||
}
|
||||
writer.putInt(playerCharacter.getRank());
|
||||
|
||||
Reference in New Issue
Block a user