Avoid delay for self dropped items.
This commit is contained in:
parent
85759e26ca
commit
83301a78ee
@ -4355,25 +4355,21 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (_freight.getItemByObjectId(objectId) != null)
|
if (_freight.getItemByObjectId(objectId) != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
|
// Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
|
||||||
sendPacket(ActionFailed.STATIC_PACKET);
|
sendPacket(ActionFailed.STATIC_PACKET);
|
||||||
|
|
||||||
Util.handleIllegalPlayerAction(this, "Warning!! Character " + getName() + " of account " + getAccountName() + " tried to drop Freight Items", IllegalPlayerAction.PUNISH_KICK);
|
Util.handleIllegalPlayerAction(this, "Warning!! Character " + getName() + " of account " + getAccountName() + " tried to drop Freight Items", IllegalPlayerAction.PUNISH_KICK);
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final ItemInstance invitem = _inventory.getItemByObjectId(objectId);
|
final ItemInstance invitem = _inventory.getItemByObjectId(objectId);
|
||||||
final ItemInstance item = _inventory.dropItem(process, objectId, count, this, reference);
|
final ItemInstance item = _inventory.dropItem(process, objectId, count, this, reference);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
if (sendMessage)
|
if (sendMessage)
|
||||||
{
|
{
|
||||||
sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
|
sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ import org.l2jmobius.gameserver.network.serverpackets.VehicleInfo;
|
|||||||
|
|
||||||
public class PlayerKnownList extends PlayableKnownList
|
public class PlayerKnownList extends PlayableKnownList
|
||||||
{
|
{
|
||||||
private int _packetSendDelay = 0;
|
private volatile int _packetSendDelay = 0;
|
||||||
|
|
||||||
public PlayerKnownList(PlayerInstance player)
|
public PlayerKnownList(PlayerInstance player)
|
||||||
{
|
{
|
||||||
@ -107,6 +107,12 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid delay for self dropped items.
|
||||||
|
if (object.isItem())
|
||||||
|
{
|
||||||
|
_packetSendDelay = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Delay is broken down to 100ms intervals.
|
// Delay is broken down to 100ms intervals.
|
||||||
// With the random time added it gives at least 50ms between tasks.
|
// With the random time added it gives at least 50ms between tasks.
|
||||||
if (_packetSendDelay > 3000)
|
if (_packetSendDelay > 3000)
|
||||||
@ -125,7 +131,7 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (object instanceof ItemInstance)
|
if (object.isItem())
|
||||||
{
|
{
|
||||||
if (dropper != null)
|
if (dropper != null)
|
||||||
{
|
{
|
||||||
@ -136,7 +142,7 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
activeChar.sendPacket(new SpawnItem((ItemInstance) object));
|
activeChar.sendPacket(new SpawnItem((ItemInstance) object));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (object instanceof DoorInstance)
|
else if (object.isDoor())
|
||||||
{
|
{
|
||||||
if (((DoorInstance) object).getCastle() != null)
|
if (((DoorInstance) object).getCastle() != null)
|
||||||
{
|
{
|
||||||
@ -148,11 +154,7 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
}
|
}
|
||||||
activeChar.sendPacket(new DoorStatusUpdate((DoorInstance) object));
|
activeChar.sendPacket(new DoorStatusUpdate((DoorInstance) object));
|
||||||
}
|
}
|
||||||
else if (object instanceof FenceInstance)
|
else if (object.isBoat())
|
||||||
{
|
|
||||||
((FenceInstance) object).sendInfo(activeChar);
|
|
||||||
}
|
|
||||||
else if (object instanceof BoatInstance)
|
|
||||||
{
|
{
|
||||||
if (!activeChar.isInBoat() && (object != activeChar.getBoat()))
|
if (!activeChar.isInBoat() && (object != activeChar.getBoat()))
|
||||||
{
|
{
|
||||||
@ -160,15 +162,11 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
((BoatInstance) object).sendVehicleDeparture(activeChar);
|
((BoatInstance) object).sendVehicleDeparture(activeChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (object instanceof StaticObjectInstance)
|
else if (object.isNpc())
|
||||||
{
|
|
||||||
activeChar.sendPacket(new StaticObject((StaticObjectInstance) object));
|
|
||||||
}
|
|
||||||
else if (object instanceof NpcInstance)
|
|
||||||
{
|
{
|
||||||
activeChar.sendPacket(new NpcInfo((NpcInstance) object, activeChar));
|
activeChar.sendPacket(new NpcInfo((NpcInstance) object, activeChar));
|
||||||
}
|
}
|
||||||
else if (object instanceof Summon)
|
else if (object.isSummon())
|
||||||
{
|
{
|
||||||
final Summon summon = (Summon) object;
|
final Summon summon = (Summon) object;
|
||||||
|
|
||||||
@ -189,7 +187,7 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
activeChar.sendPacket(new NpcInfo(summon, activeChar));
|
activeChar.sendPacket(new NpcInfo(summon, activeChar));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (object instanceof PlayerInstance)
|
else if (object.isPlayer())
|
||||||
{
|
{
|
||||||
final PlayerInstance otherPlayer = (PlayerInstance) object;
|
final PlayerInstance otherPlayer = (PlayerInstance) object;
|
||||||
if (otherPlayer.isInBoat())
|
if (otherPlayer.isInBoat())
|
||||||
@ -229,8 +227,16 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
activeChar.sendPacket(new RecipeShopMsg(otherPlayer));
|
activeChar.sendPacket(new RecipeShopMsg(otherPlayer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (object instanceof FenceInstance)
|
||||||
|
{
|
||||||
|
((FenceInstance) object).sendInfo(activeChar);
|
||||||
|
}
|
||||||
|
else if (object instanceof StaticObjectInstance)
|
||||||
|
{
|
||||||
|
activeChar.sendPacket(new StaticObject((StaticObjectInstance) object));
|
||||||
|
}
|
||||||
|
|
||||||
if (object instanceof Creature)
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature obj = (Creature) object;
|
final Creature obj = (Creature) object;
|
||||||
|
@ -83,7 +83,6 @@ public class RequestDropItem extends GameClientPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
final ItemInstance item = player.getInventory().getItemByObjectId(_objectId);
|
final ItemInstance item = player.getInventory().getItemByObjectId(_objectId);
|
||||||
|
|
||||||
if ((item == null) || (_count == 0) || !player.validateItemManipulation(_objectId, "drop"))
|
if ((item == null) || (_count == 0) || !player.validateItemManipulation(_objectId, "drop"))
|
||||||
{
|
{
|
||||||
player.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DISCARDED);
|
player.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DISCARDED);
|
||||||
@ -115,10 +114,8 @@ public class RequestDropItem extends GameClientPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int itemId = item.getItemId();
|
|
||||||
|
|
||||||
// Cursed Weapons cannot be dropped
|
// Cursed Weapons cannot be dropped
|
||||||
if (CursedWeaponsManager.getInstance().isCursed(itemId))
|
if (CursedWeaponsManager.getInstance().isCursed(item.getItemId()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user