forked from MagicBane/Server
Handler created for equip message.
This commit is contained in:
@@ -1266,7 +1266,7 @@ public class CharacterItemManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equipItem(Item i, byte slot) {
|
||||
public boolean equipItem(Item i, Enum.EquipSlotType slot) {
|
||||
|
||||
synchronized (this) {
|
||||
|
||||
@@ -1275,7 +1275,6 @@ public class CharacterItemManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
Enum.EquipSlotType equipSlot = Enum.EquipSlotType.values()[slot];
|
||||
|
||||
// Item must be in inventory to equip
|
||||
if (!this.inventory.contains(i) && this.absCharacter.getObjectType() != GameObjectType.Mob)
|
||||
@@ -1284,11 +1283,11 @@ public class CharacterItemManager {
|
||||
// make sure player can equip item
|
||||
if (i.getItemBase() == null)
|
||||
return false;
|
||||
if (!i.getItemBase().canEquip(equipSlot, this, absCharacter, i) && this.absCharacter.getObjectType() != GameObjectType.Mob)
|
||||
if (!i.getItemBase().canEquip(slot, this, absCharacter, i) && this.absCharacter.getObjectType() != GameObjectType.Mob)
|
||||
return false;
|
||||
|
||||
// check to see if item is already there.
|
||||
Item old = this.equipped.get((int) slot);
|
||||
Item old = this.equipped.get(slot);
|
||||
if (old != null) {
|
||||
Logger.error("already equipped");
|
||||
return false;
|
||||
@@ -1311,11 +1310,11 @@ public class CharacterItemManager {
|
||||
this.remItemFromLists(i);
|
||||
|
||||
// add to Equipped
|
||||
this.equipped.put(Enum.EquipSlotType.values()[slot], i);
|
||||
this.equipped.put(slot, i);
|
||||
|
||||
i.addToCache();
|
||||
|
||||
addEquipOrder(slot);
|
||||
addEquipOrder(slot.ordinal());
|
||||
|
||||
//calculateWeights();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user