catch code for loot crash

This commit is contained in:
2023-07-29 19:04:59 -05:00
parent 99fc4b8671
commit 4932ee36ea
+14 -9
View File
@@ -16,6 +16,7 @@ import engine.gameManager.ZoneManager;
import engine.net.DispatchMessage;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -47,7 +48,6 @@ public class LootManager {
}
public static void GenerateMobLoot(Mob mob, boolean fromDeath) {
try{
//determine if mob is in hotzone
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
//get multiplier form config manager
@@ -76,12 +76,13 @@ public class LootManager {
}
}
} catch(Exception e){
//TODO catch whatever went wrong
}
}
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, float multiplier, boolean inHotzone, boolean fromDeath) {
int roll; // table roll
BootySetEntry entry = null;
int setCount = 0;
try {
if (fromDeath) {
//do equipment here
if (mob.getEquip() != null) {
@@ -102,7 +103,7 @@ public class LootManager {
return;
}
for (BootySetEntry bse : entries) {
int roll;
entry = bse;
float dropChance = bse.dropChance * multiplier;
switch (bse.bootyType) {
case "GOLD":
@@ -172,11 +173,18 @@ public class LootManager {
mob.getCharItemManager().addItemToInventory(toAddHZ);
}
}
setCount++;
}catch(Exception e){
//catch crash bug
int tableID = entry.lootTable;
String bootyType = entry.bootyType;
int itemBase = entry.itemBase;
Logger.error("FAILED LOOT ROLL: TableID: " + tableID + "bootyType: " + bootyType + " itemUUID: " + itemBase);
}
}
public static MobLoot getGenTableItem(int genTableID, Mob mob) {
try {
if (genTableID == 0 || mob == null || generalItemTables.containsKey(genTableID) == false) {
return null;
}
@@ -237,9 +245,6 @@ public class LootManager {
}
}
return outItem;
}catch(Exception e){
return null;
}
}
private static int TableRoll(int mobLevel){
int max = (int)(4.882 * mobLevel + 121.0);