Droplists randomization and maximum drop occurrences setting.

This commit is contained in:
MobiusDev
2017-10-06 13:43:12 +00:00
parent cf80bffbde
commit 8c1c7f2fc3
15 changed files with 160 additions and 30 deletions

View File

@@ -604,10 +604,21 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable
return null;
}
// randomize drop order
Collections.shuffle(dropList);
final int levelDifference = victim.getLevel() - killer.getLevel();
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
Collection<ItemHolder> calculatedDrops = null;
for (DropHolder dropItem : dropList)
{
// check if maximum drop occurrences have been reached
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100))
{
continue;
}
// check level gap that may prevent drop this item
final double levelGapChanceToDrop;
if (dropItem.getItemId() == Inventory.ADENA_ID)
@@ -637,6 +648,10 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable
}
// finally
if (dropItem.getChance() < 100)
{
dropOccurrenceCounter--;
}
calculatedDrops.add(drop);
}