Proper useEquippableItem ownership checks.
This commit is contained in:
parent
c724adb5a0
commit
414cbb7773
@ -86,6 +86,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2190,6 +2191,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2254,7 +2274,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2196,6 +2197,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2260,7 +2280,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -88,6 +88,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2198,6 +2199,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2262,7 +2282,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2205,6 +2206,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
|
@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2198,6 +2199,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
|
@ -247,18 +247,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2198,6 +2199,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
|
@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2198,6 +2199,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
|
@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -90,6 +90,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2131,6 +2132,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
|
@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -85,6 +85,7 @@ import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
import org.l2jmobius.gameserver.enums.PlayerAction;
|
||||
@ -2223,6 +2224,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2283,8 +2303,8 @@ public class PlayerInstance extends Playable
|
||||
sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
|
||||
}
|
||||
}
|
||||
refreshExpertisePenalty();
|
||||
|
||||
refreshExpertisePenalty();
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -297,18 +297,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, TimeUnit.MILLISECONDS.convert(player.getAttackEndTime() - System.nanoTime(), TimeUnit.NANOSECONDS));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), TimeUnit.MILLISECONDS.convert(player.getAttackEndTime() - System.nanoTime(), TimeUnit.NANOSECONDS));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -85,6 +85,7 @@ import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
import org.l2jmobius.gameserver.enums.PlayerAction;
|
||||
@ -2134,6 +2135,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2194,8 +2214,8 @@ public class PlayerInstance extends Playable
|
||||
sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
|
||||
}
|
||||
}
|
||||
refreshExpertisePenalty();
|
||||
|
||||
refreshExpertisePenalty();
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -297,18 +297,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, TimeUnit.MILLISECONDS.convert(player.getAttackEndTime() - System.nanoTime(), TimeUnit.NANOSECONDS));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), TimeUnit.MILLISECONDS.convert(player.getAttackEndTime() - System.nanoTime(), TimeUnit.NANOSECONDS));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2169,6 +2170,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2233,7 +2253,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2169,6 +2170,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2233,7 +2253,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2167,6 +2168,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2231,7 +2251,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -247,18 +247,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2177,6 +2178,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2241,7 +2261,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2177,6 +2178,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2241,7 +2261,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -90,6 +90,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2098,6 +2099,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
|
@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
@ -2171,6 +2172,25 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
||||
{
|
||||
// Check if the item is null.
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is owned by this player.
|
||||
if (item.getOwnerId() != getObjectId())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is in the inventory.
|
||||
final ItemLocation itemLocation = item.getItemLocation();
|
||||
if ((itemLocation != ItemLocation.INVENTORY) && (itemLocation != ItemLocation.PAPERDOLL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip
|
||||
ItemInstance[] items = null;
|
||||
final boolean isEquiped = item.isEquipped();
|
||||
@ -2235,7 +2255,6 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
refreshExpertisePenalty();
|
||||
|
||||
broadcastUserInfo();
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
|
@ -258,18 +258,8 @@ public class UseItem implements IClientIncomingPacket
|
||||
}
|
||||
else if (player.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
// Check if the item is still on inventory.
|
||||
final ItemInstance equipItem = player.getInventory().getItemByObjectId(_objectId);
|
||||
if (equipItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Equip or unEquip.
|
||||
player.useEquippableItem(equipItem, false);
|
||||
}, player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
// Equip or unEquip.
|
||||
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user