forked from MagicBane/Server
r8 loot roll work
This commit is contained in:
@@ -87,7 +87,7 @@ public class simulateBootyCmd extends AbstractDevCmd {
|
||||
ArrayList<Item> Offerings = new ArrayList<Item>();
|
||||
ArrayList<Item> OtherDrops = new ArrayList<Item>();
|
||||
int failures = 0;
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
for (int i = 0; i < 1; ++i) {
|
||||
|
||||
try {
|
||||
mob.loadInventory();
|
||||
@@ -141,6 +141,9 @@ public class simulateBootyCmd extends AbstractDevCmd {
|
||||
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
||||
output += "RUNE DROPS: " + Runes.size() + newline;
|
||||
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
||||
for (Item contract : Contracts){
|
||||
output += contract.getName() + newline;
|
||||
}
|
||||
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
||||
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
||||
output += "OTHER ITEMS DROPPED: " + OtherDrops.size() + newline;
|
||||
|
||||
@@ -93,8 +93,14 @@ public class LootManager {
|
||||
break;
|
||||
case "LOOT":
|
||||
GenerateNormalLootDrop(mob,bse,multiplier);
|
||||
if (inHotzone) {
|
||||
GenerateHotzoneLootDrop(mob,bse,multiplier);
|
||||
if (inHotzone && mob.level < 80) {
|
||||
if (generalItemTables.containsKey(bse.lootTable + 1)) {
|
||||
GenerateHotzoneLootDrop(mob, bse, multiplier);
|
||||
}
|
||||
RollForGlass(mob);
|
||||
}
|
||||
if(mob.level > 80){
|
||||
RollForGlass(mob);
|
||||
}
|
||||
break;
|
||||
case "ITEM":
|
||||
@@ -166,6 +172,9 @@ public class LootManager {
|
||||
return outItem;
|
||||
}
|
||||
private static int TableRoll(int mobLevel){
|
||||
if(mobLevel > 65){
|
||||
mobLevel = 65;
|
||||
}
|
||||
int max = (int)(4.882 * mobLevel + 121.0);
|
||||
if(max > 320){
|
||||
max = 320;
|
||||
@@ -190,23 +199,33 @@ public class LootManager {
|
||||
}
|
||||
}
|
||||
public static void GenerateNormalLootDrop(Mob mob, BootySetEntry bse,float multiplier){
|
||||
int chanceRoll = ThreadLocalRandom.current().nextInt(101);
|
||||
if (chanceRoll > bse.dropChance) {
|
||||
try{
|
||||
int chanceRoll = ThreadLocalRandom.current().nextInt(100) + 1;
|
||||
if (chanceRoll > bse.dropChance * multiplier) {
|
||||
//early exit, failed to hit minimum chance roll
|
||||
return;
|
||||
}
|
||||
//iterate the booty tables and add items to mob inventory
|
||||
MobLoot toAdd = getGenTableItem(bse.lootTable, mob);
|
||||
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);
|
||||
}
|
||||
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){
|
||||
if (generalItemTables.containsKey(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);
|
||||
if (toAdd != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void RollForGlass(Mob mob){
|
||||
if (ThreadLocalRandom.current().nextInt(101) > 99) {
|
||||
int roll2 = TableRoll(mob.level);
|
||||
|
||||
Reference in New Issue
Block a user