|
|
@ -696,15 +696,22 @@ public class ItemFactory { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ModTypeTableEntry prefixTable = ModTypeTableEntry.rollTable(prefixMod, ThreadLocalRandom.current().nextInt(1, 100 + 1)); |
|
|
|
// Roll on the tables for this vendor
|
|
|
|
ModTypeTableEntry suffixTable = ModTypeTableEntry.rollTable(suffixMod, ThreadLocalRandom.current().nextInt(1, 100 + 1)); |
|
|
|
|
|
|
|
|
|
|
|
ModTypeTableEntry prefixTypeTable = ModTypeTableEntry.rollTable(prefixMod, ThreadLocalRandom.current().nextInt(1, 100 + 1)); |
|
|
|
|
|
|
|
ModTypeTableEntry suffixTypeTable = ModTypeTableEntry.rollTable(suffixMod, ThreadLocalRandom.current().nextInt(1, 100 + 1)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sanity check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (prefixTypeTable == null || suffixTypeTable == null) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
int rollPrefix = ThreadLocalRandom.current().nextInt(1, 100 + 1); |
|
|
|
int rollPrefix = ThreadLocalRandom.current().nextInt(1, 100 + 1); |
|
|
|
|
|
|
|
|
|
|
|
if (rollPrefix < 80) { |
|
|
|
if (rollPrefix < 80) { |
|
|
|
|
|
|
|
|
|
|
|
int randomPrefix = ThreadLocalRandom.current().nextInt(1, 100 + 1); |
|
|
|
int randomPrefix = getAdjustedRollForNPC((int) calculatedMobLevel, prefixTypeTable.minRoll, prefixTypeTable.maxRoll); |
|
|
|
prefixEntry = ModTableEntry.rollTable(prefixTable.modTableID, randomPrefix); |
|
|
|
prefixEntry = ModTableEntry.rollTable(prefixTypeTable.modTableID, randomPrefix); |
|
|
|
|
|
|
|
|
|
|
|
if (prefixEntry != null) |
|
|
|
if (prefixEntry != null) |
|
|
|
prefix = prefixEntry.action; |
|
|
|
prefix = prefixEntry.action; |
|
|
@ -715,8 +722,8 @@ public class ItemFactory { |
|
|
|
|
|
|
|
|
|
|
|
if (rollSuffix < 80) { |
|
|
|
if (rollSuffix < 80) { |
|
|
|
|
|
|
|
|
|
|
|
int randomSuffix = ThreadLocalRandom.current().nextInt(1, 100 + 1); |
|
|
|
int randomSuffix = getAdjustedRollForNPC((int) calculatedMobLevel, suffixTypeTable.minRoll, suffixTypeTable.maxRoll); |
|
|
|
suffixEntry = ModTableEntry.rollTable(suffixTable.modTableID, randomSuffix); |
|
|
|
suffixEntry = ModTableEntry.rollTable(suffixTypeTable.modTableID, randomSuffix); |
|
|
|
|
|
|
|
|
|
|
|
if (suffixEntry != null) |
|
|
|
if (suffixEntry != null) |
|
|
|
suffix = suffixEntry.action; |
|
|
|
suffix = suffixEntry.action; |
|
|
@ -763,6 +770,20 @@ public class ItemFactory { |
|
|
|
return toRoll; |
|
|
|
return toRoll; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static int getAdjustedRollForNPC(int npcLevel, int minRoll, int maxRoll) { |
|
|
|
|
|
|
|
int randomRoll; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int minValue = (npcLevel - 5) * 5; |
|
|
|
|
|
|
|
int maxValue = (npcLevel + 15) * 5; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minValue = Math.max(minRoll, Math.min(maxRoll, minValue)); |
|
|
|
|
|
|
|
maxValue = Math.max(minRoll, Math.min(maxRoll, maxValue)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
randomRoll = ThreadLocalRandom.current().nextInt(minValue, maxValue + 1); //Does not return Max, but does return min?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return randomRoll; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static MobLoot produceRandomRoll(NPC npc, PlayerCharacter pc, String prefixString, String suffixString, int itemID) { |
|
|
|
public static MobLoot produceRandomRoll(NPC npc, PlayerCharacter pc, String prefixString, String suffixString, int itemID) { |
|
|
|
|
|
|
|
|
|
|
|
boolean useWarehouse = false; |
|
|
|
boolean useWarehouse = false; |
|
|
|