prefix and suffix chances added to mobloot

This commit is contained in:
2023-07-16 11:35:54 -05:00
parent 68e87dabbc
commit 45fa191ef6
+23 -14
View File
@@ -179,22 +179,31 @@ public class LootManager {
Enum.ItemType outType = outItem.getItemBase().getType(); Enum.ItemType outType = outItem.getItemBase().getType();
if (outType.ordinal() == Enum.ItemType.WEAPON.ordinal() || outType.ordinal() == Enum.ItemType.ARMOR.ordinal() || outType.ordinal() == Enum.ItemType.JEWELRY.ordinal()) { if (outType.ordinal() == Enum.ItemType.WEAPON.ordinal() || outType.ordinal() == Enum.ItemType.ARMOR.ordinal() || outType.ordinal() == Enum.ItemType.JEWELRY.ordinal()) {
if (outItem.getItemBase().isGlass() == false) { if (outItem.getItemBase().isGlass() == false) {
ModTypeTable prefixTable = modTypeTables.get(selectedRow.pModTable); int prefixChance = ThreadLocalRandom.current().nextInt(101);
ModTypeTable suffixTable = modTypeTables.get(selectedRow.sModTable); if(prefixChance < mob.level) {
if (modTables.get(prefixTable.getRowForRange(100).modTableID) != null) { ModTypeTable prefixTable = modTypeTables.get(selectedRow.pModTable);
ModTable prefixModTable = modTables.get(prefixTable.getRowForRange(100).modTableID);
ModTableRow prefixMod = prefixModTable.getRowForRange(new Random().nextInt(maxRollRange) + minRollRange); int prefixroll = ThreadLocalRandom.current().nextInt(101);
if (prefixMod != null && prefixMod.action.length() > 0) { if (modTables.get(prefixTable.getRowForRange(prefixroll).modTableID) != null) {
outItem.setPrefix(prefixMod.action); ModTable prefixModTable = modTables.get(prefixTable.getRowForRange(prefixroll).modTableID);
outItem.addPermanentEnchantment(prefixMod.action, 0, prefixMod.level, true); ModTableRow prefixMod = prefixModTable.getRowForRange(new Random().nextInt(maxRollRange) + minRollRange);
if (prefixMod != null && prefixMod.action.length() > 0) {
outItem.setPrefix(prefixMod.action);
outItem.addPermanentEnchantment(prefixMod.action, 0, prefixMod.level, true);
}
} }
} }
if (modTables.get(suffixTable.getRowForRange(100).modTableID) != null) { int suffixChance = ThreadLocalRandom.current().nextInt(101);
ModTable suffixModTable = modTables.get(suffixTable.getRowForRange(100).modTableID); if(suffixChance < mob.level) {
ModTableRow suffixMod = suffixModTable.getRowForRange(new Random().nextInt(maxRollRange) + minRollRange); int suffixroll = ThreadLocalRandom.current().nextInt(101);
if (suffixMod != null && suffixMod.action.length() > 0) { ModTypeTable suffixTable = modTypeTables.get(selectedRow.sModTable);
outItem.setSuffix(suffixMod.action); if (modTables.get(suffixTable.getRowForRange(suffixroll).modTableID) != null) {
outItem.addPermanentEnchantment(suffixMod.action, 0, suffixMod.level, false); ModTable suffixModTable = modTables.get(suffixTable.getRowForRange(suffixroll).modTableID);
ModTableRow suffixMod = suffixModTable.getRowForRange(new Random().nextInt(maxRollRange) + minRollRange);
if (suffixMod != null && suffixMod.action.length() > 0) {
outItem.setSuffix(suffixMod.action);
outItem.addPermanentEnchantment(suffixMod.action, 0, suffixMod.level, false);
}
} }
} }
} }