Collections.shuffle(objects);
for (int i = 0; i < maxItemsToDrop; i++) {
if (!objects.isEmpty()) {
final Pair<RPObject, RPSlot> object = objects.remove(0);
if (object.first() instanceof StackableItem) {
final StackableItem item = (StackableItem) object.first();
// We won't drop the full quantity, but only a
// percentage.
// Get a random percentage between 25 % and 75 % to drop
final double percentage = (Rand.rand(50) + 25) / 100.0;
final int quantityToDrop = (int) Math.round(item.getQuantity()
* percentage);
if (quantityToDrop > 0) {
final StackableItem itemToDrop = item.splitOff(quantityToDrop);
new ItemLogger().splitOff(player, item, itemToDrop, quantityToDrop);
new ItemLogger().equipAction(player, itemToDrop,
new String[]{"slot", player.getName(), object.second().getName()},
new String[]{"slot", player.getName(), "content"});
corpse.add(itemToDrop);