Browse Source

null pointer evasion

master
FatBoy-DOTC 1 year ago
parent
commit
57a38303f8
  1. 8
      src/engine/loot/LootManager.java

8
src/engine/loot/LootManager.java

@ -123,7 +123,7 @@ public class LootManager { @@ -123,7 +123,7 @@ public class LootManager {
//iterate the booty tables and add items to mob inventory
MobLoot toAdd = getGenTableItem(bse.lootTable, mob);
if (toAdd != null) {
if(toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix().isEmpty() == true){
if(toAdd.getPrefix() != null && toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix()!= null && toAdd.getSuffix().isEmpty() == true){
toAdd.setIsID(true);
}
mob.getCharItemManager().addItemToInventory(toAdd);
@ -133,7 +133,7 @@ public class LootManager { @@ -133,7 +133,7 @@ public class LootManager {
int lootTableID = bse.lootTable + 1;
MobLoot toAddHZ = getGenTableItem(lootTableID, mob);
if (toAddHZ != null)
if(toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix().isEmpty() == true){
if(toAdd.getPrefix() != null && toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix()!= null && toAdd.getSuffix().isEmpty() == true){
toAdd.setIsID(true);
}
mob.getCharItemManager().addItemToInventory(toAddHZ);
@ -169,6 +169,7 @@ public class LootManager { @@ -169,6 +169,7 @@ public class LootManager {
public static MobLoot getGenTableItem(int genTableID, Mob mob) {
try {
if (genTableID == 0 || mob == null || generalItemTables.containsKey(genTableID) == false) {
return null;
}
@ -229,6 +230,9 @@ public class LootManager { @@ -229,6 +230,9 @@ public class LootManager {
}
}
return outItem;
}catch(Exception e){
return null;
}
}
private static int TableRoll(int mobLevel){
int max = (int)(4.882 * mobLevel + 121.0);

Loading…
Cancel
Save