Proper useEquippableItem ownership checks.
This commit is contained in:
+20
-1
@@ -86,6 +86,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2190,6 +2191,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2254,7 +2274,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-1
@@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2196,6 +2197,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2260,7 +2280,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-1
@@ -88,6 +88,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2198,6 +2199,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2262,7 +2282,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
@@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
|||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2205,6 +2206,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
|
|||||||
+2
-12
@@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
@@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
|||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2198,6 +2199,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
|
|||||||
+2
-12
@@ -247,18 +247,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
@@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
|||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2198,6 +2199,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
|
|||||||
+2
-12
@@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
@@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
|||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2198,6 +2199,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
|
|||||||
+2
-12
@@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
@@ -90,6 +90,7 @@ import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
|||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
import org.l2jmobius.gameserver.enums.ItemGrade;
|
import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2131,6 +2132,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
|
|||||||
+2
-12
@@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+21
-1
@@ -85,6 +85,7 @@ import org.l2jmobius.gameserver.enums.ChatType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
import org.l2jmobius.gameserver.enums.PlayerAction;
|
import org.l2jmobius.gameserver.enums.PlayerAction;
|
||||||
@@ -2223,6 +2224,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
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);
|
sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
refreshExpertisePenalty();
|
|
||||||
|
|
||||||
|
refreshExpertisePenalty();
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -297,18 +297,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), TimeUnit.MILLISECONDS.convert(player.getAttackEndTime() - System.nanoTime(), TimeUnit.NANOSECONDS));
|
||||||
// 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));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+21
-1
@@ -85,6 +85,7 @@ import org.l2jmobius.gameserver.enums.ChatType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
import org.l2jmobius.gameserver.enums.PlayerAction;
|
import org.l2jmobius.gameserver.enums.PlayerAction;
|
||||||
@@ -2134,6 +2135,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
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);
|
sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
refreshExpertisePenalty();
|
|
||||||
|
|
||||||
|
refreshExpertisePenalty();
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -297,18 +297,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), TimeUnit.MILLISECONDS.convert(player.getAttackEndTime() - System.nanoTime(), TimeUnit.NANOSECONDS));
|
||||||
// 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));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-1
@@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2169,6 +2170,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2233,7 +2253,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-1
@@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2169,6 +2170,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2233,7 +2253,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -250,18 +250,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-1
@@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2167,6 +2168,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2231,7 +2251,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -247,18 +247,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-1
@@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2177,6 +2178,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2241,7 +2261,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-1
@@ -89,6 +89,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2177,6 +2178,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2241,7 +2261,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
@@ -90,6 +90,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2098,6 +2099,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
|
|||||||
+2
-12
@@ -256,18 +256,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-1
@@ -87,6 +87,7 @@ import org.l2jmobius.gameserver.enums.GroupType;
|
|||||||
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
import org.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||||
|
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||||
import org.l2jmobius.gameserver.enums.MountType;
|
import org.l2jmobius.gameserver.enums.MountType;
|
||||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||||
@@ -2171,6 +2172,25 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public void useEquippableItem(ItemInstance item, boolean abortAttack)
|
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
|
// Equip or unEquip
|
||||||
ItemInstance[] items = null;
|
ItemInstance[] items = null;
|
||||||
final boolean isEquiped = item.isEquipped();
|
final boolean isEquiped = item.isEquipped();
|
||||||
@@ -2235,7 +2255,6 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshExpertisePenalty();
|
refreshExpertisePenalty();
|
||||||
|
|
||||||
broadcastUserInfo();
|
broadcastUserInfo();
|
||||||
|
|
||||||
final InventoryUpdate iu = new InventoryUpdate();
|
final InventoryUpdate iu = new InventoryUpdate();
|
||||||
|
|||||||
+2
-12
@@ -258,18 +258,8 @@ public class UseItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else if (player.isAttackingNow())
|
else if (player.isAttackingNow())
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
// Equip or unEquip.
|
||||||
{
|
ThreadPool.schedule(() -> player.useEquippableItem(item, false), player.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||||
// 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()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user