Handler created for equip message.

This commit is contained in:
2024-03-08 13:39:38 -05:00
parent caf708bed6
commit 20cb8ef94d
4 changed files with 27 additions and 29 deletions
+5 -6
View File
@@ -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();
}