Browse Source

better roll chance for high level vendors

lakebane-strongholds
FatBoy-DOTC 3 months ago
parent
commit
17b4232d80
  1. 7
      src/engine/gameManager/LootManager.java
  2. 41
      src/engine/objects/ItemFactory.java

7
src/engine/gameManager/LootManager.java

@ -381,7 +381,7 @@ public enum LootManager { @@ -381,7 +381,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) {
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
prefixTableRoll = TableRoll(mob.level, inHotzone);
prefixTableRoll = TableRoll(mob.level * 2, inHotzone);
}
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
@ -413,7 +413,7 @@ public enum LootManager { @@ -413,7 +413,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) {
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
suffixTableRoll = TableRoll(mob.level, inHotzone);
suffixTableRoll = TableRoll(mob.level * 2, inHotzone);
}
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
@ -430,9 +430,6 @@ public enum LootManager { @@ -430,9 +430,6 @@ public enum LootManager {
public static int TableRoll(int mobLevel, Boolean inHotzone) {
if (mobLevel > 65)
mobLevel = 65;
int max = (int) (4.882 * mobLevel + 127.0);
if (max > 319)

41
src/engine/objects/ItemFactory.java

@ -707,7 +707,7 @@ public class ItemFactory { @@ -707,7 +707,7 @@ public class ItemFactory {
if (rollPrefix < 80) {
int randomPrefix = LootManager.TableRoll(vendor.getLevel(), false);
int randomPrefix = TableRoll(vendor.getLevel());
prefixEntry = ModTableEntry.rollTable(prefixTypeTable.modTableID, randomPrefix);
if (prefixEntry != null)
@ -722,7 +722,7 @@ public class ItemFactory { @@ -722,7 +722,7 @@ public class ItemFactory {
if (rollSuffix < 80 || prefixEntry == null) {
int randomSuffix = LootManager.TableRoll(vendor.getLevel(), false);
int randomSuffix = TableRoll(vendor.getLevel());
suffixEntry = ModTableEntry.rollTable(suffixTypeTable.modTableID, randomSuffix);
if (suffixEntry != null)
@ -774,6 +774,43 @@ public class ItemFactory { @@ -774,6 +774,43 @@ public class ItemFactory {
return toRoll;
}
public static int TableRoll(int vendorLevel) {
// Calculate min and max based on mobLevel
int min = 60;
int max = 120;
switch(vendorLevel){
case 20:
min = 70;
max = 140;
break;
case 30:
min = 80;
max = 160;
break;
case 40:
min = 90;
max = 180;
break;
case 50:
min = 100;
max = 200;
break;
case 60:
min = 175;
max = 260;
break;
case 70:
min = 220;
max = 320;
break;
}
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
return roll;
}
public static MobLoot produceRandomRoll(NPC npc, PlayerCharacter pc, String prefixString, String suffixString, int itemID) {
boolean useWarehouse = false;

Loading…
Cancel
Save