Simplified drop replacement logic.

This commit is contained in:
MobiusDevelopment 2021-10-26 11:27:01 +00:00
parent eff982c293
commit 55c18870df
42 changed files with 189 additions and 168 deletions

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -632,7 +632,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -632,7 +632,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -641,10 +641,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -680,9 +680,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -632,7 +632,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -632,7 +632,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -641,10 +641,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -680,9 +680,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -694,7 +694,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -703,10 +703,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -742,9 +742,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -694,7 +694,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -703,10 +703,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -742,9 +742,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -614,7 +614,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -694,7 +694,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -703,10 +703,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -742,9 +742,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -617,7 +617,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -709,7 +709,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -718,10 +718,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -757,9 +757,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -617,7 +617,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -709,7 +709,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -718,10 +718,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -757,9 +757,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -617,7 +617,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -709,7 +709,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -718,10 +718,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -757,9 +757,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -624,7 +624,8 @@ public class NpcData implements IXmlReader
if (dropLists != null)
{
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())

View File

@ -693,7 +693,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -702,10 +702,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -741,9 +741,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -632,7 +632,8 @@ public class NpcData implements IXmlReader
dropLists.add(new DropHolder(DropType.DROP, Inventory.LCOIN_ID, Config.LCOIN_MIN_QUANTITY, Config.LCOIN_MAX_QUANTITY, Config.LCOIN_DROP_CHANCE));
}
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
// Drop materials for random craft configuration.

View File

@ -708,7 +708,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -717,10 +717,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -756,9 +756,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)

View File

@ -632,7 +632,8 @@ public class NpcData implements IXmlReader
dropLists.add(new DropHolder(DropType.DROP, Inventory.LCOIN_ID, Config.LCOIN_MIN_QUANTITY, Config.LCOIN_MAX_QUANTITY, Config.LCOIN_DROP_CHANCE));
}
Collections.shuffle(dropLists);
// Drops are sorted by chance (high to low).
Collections.sort(dropLists, (d1, d2) -> Double.valueOf(d2.getChance()).compareTo(Double.valueOf(d1.getChance())));
for (DropHolder dropHolder : dropLists)
{
// Drop materials for random craft configuration.

View File

@ -708,7 +708,7 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
int dropOccurrenceCounter = victim.isRaid() ? Config.DROP_MAX_OCCURRENCES_RAIDBOSS : Config.DROP_MAX_OCCURRENCES_NORMAL;
List<ItemHolder> calculatedDrops = null;
List<ItemHolder> randomDrops = null;
ItemHolder replacedItem = null;
ItemHolder cachedItem = null;
if (dropOccurrenceCounter > 0)
{
for (DropHolder dropItem : dropList)
@ -717,10 +717,10 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
// items that have 100% drop chance without server rate multipliers drop normally
if ((dropOccurrenceCounter == 0) && (dropItem.getChance() < 100) && (randomDrops != null) && (calculatedDrops != null))
{
// remove a random existing drop (temporarily if not other item replaces it)
dropOccurrenceCounter++;
replacedItem = randomDrops.remove(Rnd.get(randomDrops.size()));
calculatedDrops.remove(replacedItem);
// remove highest chance item (temporarily if no other item replaces it)
cachedItem = randomDrops.remove(0);
calculatedDrops.remove(cachedItem);
dropOccurrenceCounter = 1;
}
// check level gap that may prevent to drop item
@ -756,9 +756,9 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
}
// add temporarily removed item when not replaced
if ((dropOccurrenceCounter > 0) && (replacedItem != null) && (calculatedDrops != null))
if ((dropOccurrenceCounter > 0) && (cachedItem != null) && (calculatedDrops != null))
{
calculatedDrops.add(replacedItem);
calculatedDrops.add(cachedItem);
}
// clear random drops
if (randomDrops != null)