Why, when using the Shard drop system ...
Say you have 28 whips on your (not noted) and you are killed it will drop all 28 whips and you'll see all 28 whips but if you exit the region and re-enter you only see 3 :| :s
Code:
public void sendFloorItem(int id, int amount, int x, int y)
{
sendCoords(x, y);
p.write(new RSBuffer().createPacket(44, Type.FIXED).putLEShortA(id).putShort(amount).put(0).toPacket());
}
public void sendFloorItemRemoval(int id, int x, int y)
{
sendCoords(x, y);
p.write(new RSBuffer().createPacket(156, Type.FIXED).putS(0).putShort(id).toPacket());
}
Code:
Queue<FloorItem> itemsToRemove = new LinkedList<FloorItem>();
for (FloorItem item : floorItems)
{
if (item.isSpawn())
continue;
if (System.currentTimeMillis() > item.getDroppedAt() + HIDE_FOR && item.getDroppedBy() != null)
{
item.resetOwner();
hideDrop(item);
showDrop(item);
} else if (System.currentTimeMillis() > item.getDroppedAt() + STAY_FOR)
{
itemsToRemove.add(item);
hideDrop(item);
}
}
for (FloorItem r : itemsToRemove)
{
floorItems.remove(r);
}
Code:
public void newDrop(FloorItem i, Player p)
{
floorItems.add(i);
p.getActionSender().sendFloorItem(i.getId(), i.getAmount(), i.getX(), i.getY());
}
public void hideDrop(FloorItem i)
{
for (Player p : players)
{
if (p == null)
continue;
if (!p.isActive() || p.isDisconnected())
continue;
if (i.getHeight() != p.getHeightLevel())
continue;
if(p.withinDistance(i.getX(), i.getY(), 60))
{
p.getActionSender().sendFloorItemRemoval(i.getId(), i.getX(), i.getY());
}
}
}
public void showDrop(FloorItem i)
{
for (Player p : players)
{
if (p == null)
continue;
if (!p.isActive() || p.isDisconnected())
continue;
if (i.getHeight() != p.getHeightLevel())
continue;
if(p.withinDistance(i.getX(), i.getY(), 60))
{
p.getActionSender().sendFloorItem(i.getId(), i.getAmount(), i.getX(), i.getY());
}
}
}
public void reload(Player p)
{
for (FloorItem item : floorItems)
{
if (item.getDroppedBy() .equals(p) || item.getDroppedBy() == null)
{
hideDrop(item);
showDrop(item);
}
}
}
Help Please, Thanks <3