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();
|
||||
}
|
||||
|
||||
@@ -956,7 +956,7 @@ public class Item extends AbstractWorldObject {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected synchronized boolean equipItem(PlayerCharacter pc, byte slot) {
|
||||
protected synchronized boolean equipItem(PlayerCharacter pc, Enum.EquipSlotType slot) {
|
||||
|
||||
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
|
||||
pc.getObjectUUID(), //tableID
|
||||
@@ -964,42 +964,42 @@ public class Item extends AbstractWorldObject {
|
||||
true, //isPlayer
|
||||
false, //isAccount
|
||||
ItemContainerType.EQUIPPED,
|
||||
slot)) //Slot
|
||||
slot.ordinal())) //Slot
|
||||
|
||||
return false;
|
||||
this.zeroItem();
|
||||
this.ownerID = pc.getObjectUUID();
|
||||
this.ownerType = OwnerType.PlayerCharacter;
|
||||
this.containerType = Enum.ItemContainerType.EQUIPPED;
|
||||
this.equipSlot = EquipSlotType.values()[slot];
|
||||
this.equipSlot = slot;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected synchronized boolean equipItem(NPC npc, byte slot) {
|
||||
protected synchronized boolean equipItem(NPC npc, Enum.EquipSlotType slot) {
|
||||
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
|
||||
npc.getObjectUUID(), //UUID
|
||||
true, //isNPC
|
||||
false, //isPlayer
|
||||
false, //isAccount
|
||||
ItemContainerType.EQUIPPED,
|
||||
slot)) //Slot
|
||||
slot.ordinal())) //Slot
|
||||
|
||||
return false;
|
||||
this.zeroItem();
|
||||
this.ownerID = npc.getObjectUUID();
|
||||
this.ownerType = OwnerType.Npc;
|
||||
this.containerType = Enum.ItemContainerType.EQUIPPED;
|
||||
this.equipSlot = EquipSlotType.values()[slot];
|
||||
this.equipSlot = slot;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected synchronized boolean equipItem(Mob npc, byte slot) {
|
||||
protected synchronized boolean equipItem(Mob npc, Enum.EquipSlotType slot) {
|
||||
|
||||
this.zeroItem();
|
||||
this.ownerID = npc.getObjectUUID();
|
||||
this.ownerType = OwnerType.Mob;
|
||||
this.containerType = Enum.ItemContainerType.EQUIPPED;
|
||||
this.equipSlot = EquipSlotType.values()[slot];
|
||||
this.equipSlot = slot;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ public final class MobLoot extends Item {
|
||||
/**
|
||||
* Not implemented
|
||||
*/
|
||||
@Override
|
||||
|
||||
@Deprecated
|
||||
protected boolean equipItem(NPC npc, byte slot) {
|
||||
return false;
|
||||
@@ -248,7 +248,6 @@ public final class MobLoot extends Item {
|
||||
/**
|
||||
* Not implemented
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
protected boolean equipItem(PlayerCharacter pc, byte slot) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user