Browse Source

r8 loot roll work

master
FatBoy-DOTC 1 year ago
parent
commit
c104d9fa00
  1. 5
      src/engine/devcmd/cmds/simulateBootyCmd.java
  2. 32
      src/engine/loot/LootManager.java

5
src/engine/devcmd/cmds/simulateBootyCmd.java

@ -87,7 +87,7 @@ public class simulateBootyCmd extends AbstractDevCmd {
ArrayList<Item> Offerings = new ArrayList<Item>(); ArrayList<Item> Offerings = new ArrayList<Item>();
ArrayList<Item> OtherDrops = new ArrayList<Item>(); ArrayList<Item> OtherDrops = new ArrayList<Item>();
int failures = 0; int failures = 0;
for (int i = 0; i < 100; ++i) { for (int i = 0; i < 1; ++i) {
try { try {
mob.loadInventory(); mob.loadInventory();
@ -141,6 +141,9 @@ public class simulateBootyCmd extends AbstractDevCmd {
output += "GLASS DROPS: " + GlassItems.size() + newline; output += "GLASS DROPS: " + GlassItems.size() + newline;
output += "RUNE DROPS: " + Runes.size() + newline; output += "RUNE DROPS: " + Runes.size() + newline;
output += "CONTRACTS DROPS: " + Contracts.size() + newline; output += "CONTRACTS DROPS: " + Contracts.size() + newline;
for (Item contract : Contracts){
output += contract.getName() + newline;
}
output += "RESOURCE DROPS: " + Resources.size() + newline; output += "RESOURCE DROPS: " + Resources.size() + newline;
output += "OFFERINGS DROPPED: " + Offerings.size() + newline; output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
output += "OTHER ITEMS DROPPED: " + OtherDrops.size() + newline; output += "OTHER ITEMS DROPPED: " + OtherDrops.size() + newline;

32
src/engine/loot/LootManager.java

@ -93,8 +93,14 @@ public class LootManager {
break; break;
case "LOOT": case "LOOT":
GenerateNormalLootDrop(mob,bse,multiplier); GenerateNormalLootDrop(mob,bse,multiplier);
if (inHotzone) { if (inHotzone && mob.level < 80) {
GenerateHotzoneLootDrop(mob,bse,multiplier); if (generalItemTables.containsKey(bse.lootTable + 1)) {
GenerateHotzoneLootDrop(mob, bse, multiplier);
}
RollForGlass(mob);
}
if(mob.level > 80){
RollForGlass(mob);
} }
break; break;
case "ITEM": case "ITEM":
@ -166,6 +172,9 @@ public class LootManager {
return outItem; return outItem;
} }
private static int TableRoll(int mobLevel){ private static int TableRoll(int mobLevel){
if(mobLevel > 65){
mobLevel = 65;
}
int max = (int)(4.882 * mobLevel + 121.0); int max = (int)(4.882 * mobLevel + 121.0);
if(max > 320){ if(max > 320){
max = 320; max = 320;
@ -190,23 +199,33 @@ public class LootManager {
} }
} }
public static void GenerateNormalLootDrop(Mob mob, BootySetEntry bse,float multiplier){ public static void GenerateNormalLootDrop(Mob mob, BootySetEntry bse,float multiplier){
int chanceRoll = ThreadLocalRandom.current().nextInt(101); try{
if (chanceRoll > bse.dropChance) { int chanceRoll = ThreadLocalRandom.current().nextInt(100) + 1;
if (chanceRoll > bse.dropChance * multiplier) {
//early exit, failed to hit minimum chance roll //early exit, failed to hit minimum chance roll
return; return;
} }
//iterate the booty tables and add items to mob inventory //iterate the booty tables and add items to mob inventory
MobLoot toAdd = getGenTableItem(bse.lootTable, mob); MobLoot toAdd = getGenTableItem(bse.lootTable, mob);
if (toAdd != null) { if (toAdd != null) {
if (toAdd.getPrefix() != null && toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix() != null && toAdd.getSuffix().isEmpty() == true) { if(toAdd.getPrefix() == null && toAdd.getSuffix() == null){
toAdd.setIsID(true); toAdd.setIsID(true);
} }
mob.getCharItemManager().addItemToInventory(toAdd); mob.getCharItemManager().addItemToInventory(toAdd);
} }
} }
catch(Exception e){
//TODO chase down loot generation error, affects roughly 2% of drops
int i = 0;
}
}
public static void GenerateHotzoneLootDrop(Mob mob, BootySetEntry bse, float multiplier){ public static void GenerateHotzoneLootDrop(Mob mob, BootySetEntry bse, float multiplier){
if (generalItemTables.containsKey(bse.lootTable + 1)) {
int lootTableID = bse.lootTable + 1; int lootTableID = bse.lootTable + 1;
int chanceRoll = ThreadLocalRandom.current().nextInt(100) + 1;
if (chanceRoll > bse.dropChance * multiplier) {
//early exit, failed to hit minimum chance roll
return;
}
MobLoot toAdd = getGenTableItem(lootTableID, mob); MobLoot toAdd = getGenTableItem(lootTableID, mob);
if (toAdd != null) { if (toAdd != null) {
if (toAdd.getPrefix() != null && toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix() != null && toAdd.getSuffix().isEmpty() == true) { if (toAdd.getPrefix() != null && toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix() != null && toAdd.getSuffix().isEmpty() == true) {
@ -215,7 +234,6 @@ public class LootManager {
mob.getCharItemManager().addItemToInventory(toAdd); mob.getCharItemManager().addItemToInventory(toAdd);
} }
} }
}
public static void RollForGlass(Mob mob){ public static void RollForGlass(Mob mob){
if (ThreadLocalRandom.current().nextInt(101) > 99) { if (ThreadLocalRandom.current().nextInt(101) > 99) {
int roll2 = TableRoll(mob.level); int roll2 = TableRoll(mob.level);

Loading…
Cancel
Save