Browse Source

Formatting cleanup.

master
MagicBot 1 year ago
parent
commit
ae8eef640b
  1. 53
      src/engine/gameManager/LootManager.java

53
src/engine/gameManager/LootManager.java

@ -89,7 +89,7 @@ public enum LootManager {
//lastly, check mobs inventory for godly or disc runes to send a server announcement //lastly, check mobs inventory for godly or disc runes to send a server announcement
if (!fromDeath) { if (!fromDeath)
for (Item it : mob.getInventory()) { for (Item it : mob.getInventory()) {
ItemBase ib = it.getItemBase(); ItemBase ib = it.getItemBase();
@ -101,7 +101,7 @@ public enum LootManager {
DispatchMessage.dispatchMsgToAll(chatMsg); DispatchMessage.dispatchMsgToAll(chatMsg);
} }
} }
}
} }
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, float multiplier, boolean inHotzone, boolean fromDeath) { private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, float multiplier, boolean inHotzone, boolean fromDeath) {
@ -126,6 +126,7 @@ public enum LootManager {
GenerateLootDrop(mob, bse.lootTable, bse.dropChance, multiplier, false); //generate normal loot drop GenerateLootDrop(mob, bse.lootTable, bse.dropChance, multiplier, false); //generate normal loot drop
// Generate hotzone loot if in hotzone // Generate hotzone loot if in hotzone
// Only one bite at the hotzone apple per bootyset.
if (inHotzone == true && hotzoneWasRan == false) if (inHotzone == true && hotzoneWasRan == false)
if (generalItemTables.containsKey(bse.lootTable + 1) && ThreadLocalRandom.current().nextInt(100) <= HOTZONE_DROP_RATE) { if (generalItemTables.containsKey(bse.lootTable + 1) && ThreadLocalRandom.current().nextInt(100) <= HOTZONE_DROP_RATE) {
@ -151,17 +152,18 @@ public enum LootManager {
int genRoll = new Random().nextInt(99) + 1; int genRoll = new Random().nextInt(99) + 1;
GenTableRow selectedRow = generalItemTables.get(genTableID).getRowForRange(genRoll); GenTableRow selectedRow = generalItemTables.get(genTableID).getRowForRange(genRoll);
if (selectedRow == null) if (selectedRow == null)
return null; return null;
int itemTableId = selectedRow.itemTableID; int itemTableId = selectedRow.itemTableID;
if(itemTables.containsKey(itemTableId) == false) if (itemTables.containsKey(itemTableId) == false)
return null; return null;
//gets the 1-320 roll for this mob //gets the 1-320 roll for this mob
int roll2 = TableRoll(mob.level,inHotzone); int roll2 = TableRoll(mob.level, inHotzone);
ItemTableRow tableRow = itemTables.get(itemTableId).getRowForRange(roll2); ItemTableRow tableRow = itemTables.get(itemTableId).getRowForRange(roll2);
@ -181,13 +183,16 @@ public enum LootManager {
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false); outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
Enum.ItemType outType = outItem.getItemBase().getType(); Enum.ItemType outType = outItem.getItemBase().getType();
outItem.setIsID(true); outItem.setIsID(true);
if (outType.ordinal() == Enum.ItemType.WEAPON.ordinal() || outType.ordinal() == Enum.ItemType.ARMOR.ordinal() || outType.ordinal() == Enum.ItemType.JEWELRY.ordinal()) { if (outType.ordinal() == Enum.ItemType.WEAPON.ordinal() || outType.ordinal() == Enum.ItemType.ARMOR.ordinal() || outType.ordinal() == Enum.ItemType.JEWELRY.ordinal()) {
if (outItem.getItemBase().isGlass() == false) { if (outItem.getItemBase().isGlass() == false) {
try { try {
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone); outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
} catch (Exception e) { } catch (Exception e) {
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName()); Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
} }
try { try {
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone); outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
} catch (Exception e) { } catch (Exception e) {
@ -206,23 +211,26 @@ public enum LootManager {
if (prefixChanceRoll < prefixChance) { if (prefixChanceRoll < prefixChance) {
GenTableRow selectedRow = generalItemTables.get(genTableID).getRowForRange(genRoll); GenTableRow selectedRow = generalItemTables.get(genTableID).getRowForRange(genRoll);
if(selectedRow == null)
if (selectedRow == null)
return inItem; return inItem;
ModTypeTable prefixTable = modTypeTables.get(selectedRow.pModTable); ModTypeTable prefixTable = modTypeTables.get(selectedRow.pModTable);
if(prefixTable == null)
if (prefixTable == null)
return inItem; return inItem;
int prefixroll = ThreadLocalRandom.current().nextInt(99) + 1; int prefixroll = ThreadLocalRandom.current().nextInt(99) + 1;
if (modTables.get(prefixTable.getRowForRange(prefixroll).modTableID) != null) { if (modTables.get(prefixTable.getRowForRange(prefixroll).modTableID) != null) {
ModTable prefixModTable = modTables.get(prefixTable.getRowForRange(prefixroll).modTableID); ModTable prefixModTable = modTables.get(prefixTable.getRowForRange(prefixroll).modTableID);
if(prefixModTable == null)
if (prefixModTable == null)
return inItem; return inItem;
ModTableRow prefixMod = prefixModTable.getRowForRange(TableRoll(mob.level, inHotzone)); ModTableRow prefixMod = prefixModTable.getRowForRange(TableRoll(mob.level, inHotzone));
if(prefixMod == null)
if (prefixMod == null)
return inItem; return inItem;
if (prefixMod != null && prefixMod.action.length() > 0) { if (prefixMod != null && prefixMod.action.length() > 0) {
@ -243,23 +251,27 @@ public enum LootManager {
if (suffixChanceRoll < suffixChance) { if (suffixChanceRoll < suffixChance) {
GenTableRow selectedRow = generalItemTables.get(genTableID).getRowForRange(genRoll); GenTableRow selectedRow = generalItemTables.get(genTableID).getRowForRange(genRoll);
if(selectedRow == null)
if (selectedRow == null)
return inItem; return inItem;
int suffixroll = ThreadLocalRandom.current().nextInt(99) + 1; int suffixroll = ThreadLocalRandom.current().nextInt(99) + 1;
ModTypeTable suffixTable = modTypeTables.get(selectedRow.sModTable); ModTypeTable suffixTable = modTypeTables.get(selectedRow.sModTable);
if(suffixTable == null)
if (suffixTable == null)
return inItem; return inItem;
if (modTables.get(suffixTable.getRowForRange(suffixroll).modTableID) != null) { if (modTables.get(suffixTable.getRowForRange(suffixroll).modTableID) != null) {
ModTable suffixModTable = modTables.get(suffixTable.getRowForRange(suffixroll).modTableID); ModTable suffixModTable = modTables.get(suffixTable.getRowForRange(suffixroll).modTableID);
if(suffixModTable == null)
if (suffixModTable == null)
return inItem; return inItem;
ModTableRow suffixMod = suffixModTable.getRowForRange(TableRoll(mob.level, inHotzone)); ModTableRow suffixMod = suffixModTable.getRowForRange(TableRoll(mob.level, inHotzone));
if(suffixMod == null)
if (suffixMod == null)
return inItem; return inItem;
if (suffixMod != null && suffixMod.action.length() > 0) { if (suffixMod != null && suffixMod.action.length() > 0) {
@ -282,12 +294,13 @@ public enum LootManager {
if (max > 319) if (max > 319)
max = 319; max = 319;
int min = (int)(4.469 * mobLevel - 3.469); int min = (int) (4.469 * mobLevel - 3.469);
if(min < 70)
if (min < 70)
min = 70; min = 70;
if(inHotzone){
if (inHotzone)
min += mobLevel; min += mobLevel;
}
int roll = ThreadLocalRandom.current().nextInt(max - min) + min; int roll = ThreadLocalRandom.current().nextInt(max - min) + min;
@ -296,7 +309,7 @@ public enum LootManager {
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse, Boolean inHotzone) { public static void GenerateGoldDrop(Mob mob, BootySetEntry bse, Boolean inHotzone) {
int chanceRoll = ThreadLocalRandom.current().nextInt(99) + 1; int chanceRoll = ThreadLocalRandom.current().nextInt(100);
//early exit, failed to hit minimum chance roll //early exit, failed to hit minimum chance roll
@ -327,9 +340,9 @@ public enum LootManager {
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone); MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
if (toAdd != null) { if (toAdd != null)
mob.getCharItemManager().addItemToInventory(toAdd); mob.getCharItemManager().addItemToInventory(toAdd);
}
} catch (Exception e) { } catch (Exception e) {
//TODO chase down loot generation error, affects roughly 2% of drops //TODO chase down loot generation error, affects roughly 2% of drops
int i = 0; int i = 0;

Loading…
Cancel
Save