|
|
@ -100,7 +100,8 @@ public enum LootManager { |
|
|
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); |
|
|
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); |
|
|
|
DispatchMessage.dispatchMsgToAll(chatMsg); |
|
|
|
DispatchMessage.dispatchMsgToAll(chatMsg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (it.getEnchants().isEmpty() == true) |
|
|
|
|
|
|
|
it.setIsID(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -116,9 +117,11 @@ public enum LootManager { |
|
|
|
GenerateGoldDrop(mob, bse, inHotzone); |
|
|
|
GenerateGoldDrop(mob, bse, inHotzone); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "LOOT": |
|
|
|
case "LOOT": |
|
|
|
|
|
|
|
//always run base table loot drop
|
|
|
|
GenerateLootDrop(mob, bse.lootTable, bse.dropChance, multiplier); //generate normal loot drop
|
|
|
|
GenerateLootDrop(mob, bse.lootTable, bse.dropChance, multiplier); //generate normal loot drop
|
|
|
|
|
|
|
|
|
|
|
|
if (inHotzone) |
|
|
|
if (inHotzone) |
|
|
|
|
|
|
|
//run another iteration for the hotzone table if in hotzone
|
|
|
|
if (generalItemTables.containsKey(bse.lootTable + 1)) |
|
|
|
if (generalItemTables.containsKey(bse.lootTable + 1)) |
|
|
|
GenerateLootDrop(mob, bse.lootTable + 1, bse.dropChance, multiplier); //generate loot drop from hotzone table
|
|
|
|
GenerateLootDrop(mob, bse.lootTable + 1, bse.dropChance, multiplier); //generate loot drop from hotzone table
|
|
|
|
break; |
|
|
|
break; |
|
|
@ -132,20 +135,22 @@ public enum LootManager { |
|
|
|
|
|
|
|
|
|
|
|
public static MobLoot getGenTableItem(int genTableID, Mob mob) { |
|
|
|
public static MobLoot getGenTableItem(int genTableID, Mob mob) { |
|
|
|
|
|
|
|
|
|
|
|
if (genTableID == 0 || mob == null || generalItemTables.containsKey(genTableID) == false) |
|
|
|
if (mob == null || generalItemTables.containsKey(genTableID) == false) |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
MobLoot outItem; |
|
|
|
MobLoot outItem; |
|
|
|
int genRoll; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
//gets the 1-320 roll for this mob
|
|
|
|
//gets the 1-320 roll for this mob
|
|
|
|
|
|
|
|
|
|
|
|
int roll2 = TableRoll(mob.level); |
|
|
|
int roll2 = TableRoll(mob.level); |
|
|
@ -193,14 +198,24 @@ 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) |
|
|
|
|
|
|
|
return inItem; |
|
|
|
|
|
|
|
|
|
|
|
ModTypeTable prefixTable = modTypeTables.get(selectedRow.pModTable); |
|
|
|
ModTypeTable prefixTable = modTypeTables.get(selectedRow.pModTable); |
|
|
|
|
|
|
|
if(prefixTable == null) |
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
return inItem; |
|
|
|
|
|
|
|
|
|
|
|
ModTableRow prefixMod = prefixModTable.getRowForRange(TableRoll(mob.level)); |
|
|
|
ModTableRow prefixMod = prefixModTable.getRowForRange(TableRoll(mob.level)); |
|
|
|
|
|
|
|
if(prefixMod == null) |
|
|
|
|
|
|
|
return inItem; |
|
|
|
|
|
|
|
|
|
|
|
if (prefixMod != null && prefixMod.action.length() > 0) { |
|
|
|
if (prefixMod != null && prefixMod.action.length() > 0) { |
|
|
|
inItem.setPrefix(prefixMod.action); |
|
|
|
inItem.setPrefix(prefixMod.action); |
|
|
@ -219,13 +234,24 @@ 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) |
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
return inItem; |
|
|
|
|
|
|
|
|
|
|
|
ModTableRow suffixMod = suffixModTable.getRowForRange(TableRoll(mob.level)); |
|
|
|
ModTableRow suffixMod = suffixModTable.getRowForRange(TableRoll(mob.level)); |
|
|
|
|
|
|
|
if(suffixMod == null) |
|
|
|
|
|
|
|
return inItem; |
|
|
|
|
|
|
|
|
|
|
|
if (suffixMod != null && suffixMod.action.length() > 0) { |
|
|
|
if (suffixMod != null && suffixMod.action.length() > 0) { |
|
|
|
inItem.setSuffix(suffixMod.action); |
|
|
|
inItem.setSuffix(suffixMod.action); |
|
|
@ -246,7 +272,8 @@ public enum LootManager { |
|
|
|
if (max > 319) |
|
|
|
if (max > 319) |
|
|
|
max = 319; |
|
|
|
max = 319; |
|
|
|
|
|
|
|
|
|
|
|
int min = (int) (4.469 * mobLevel - 3.469); |
|
|
|
int min = (int) (2.089 * mobLevel + 22.14); |
|
|
|
|
|
|
|
|
|
|
|
int roll = ThreadLocalRandom.current().nextInt(max - min) + min; |
|
|
|
int roll = ThreadLocalRandom.current().nextInt(max - min) + min; |
|
|
|
|
|
|
|
|
|
|
|
return roll; |
|
|
|
return roll; |
|
|
@ -256,7 +283,7 @@ public enum LootManager { |
|
|
|
|
|
|
|
|
|
|
|
int chanceRoll = ThreadLocalRandom.current().nextInt(99) + 1; |
|
|
|
int chanceRoll = ThreadLocalRandom.current().nextInt(99) + 1; |
|
|
|
|
|
|
|
|
|
|
|
//early exit, failed to hit minimum chance roll OR booty was generated from mob's death
|
|
|
|
//early exit, failed to hit minimum chance roll
|
|
|
|
|
|
|
|
|
|
|
|
if (chanceRoll > bse.dropChance) |
|
|
|
if (chanceRoll > bse.dropChance) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -270,7 +297,7 @@ public enum LootManager { |
|
|
|
if (inHotzone == true) |
|
|
|
if (inHotzone == true) |
|
|
|
gold = (int) (gold * HOTZONE_GOLD_RATE); |
|
|
|
gold = (int) (gold * HOTZONE_GOLD_RATE); |
|
|
|
else |
|
|
|
else |
|
|
|
gold = (int) (NORMAL_GOLD_RATE); |
|
|
|
gold = (int) (gold * NORMAL_GOLD_RATE); |
|
|
|
|
|
|
|
|
|
|
|
if (gold > 0) { |
|
|
|
if (gold > 0) { |
|
|
|
MobLoot goldAmount = new MobLoot(mob, gold); |
|
|
|
MobLoot goldAmount = new MobLoot(mob, gold); |
|
|
@ -292,9 +319,6 @@ public enum LootManager { |
|
|
|
MobLoot toAdd = getGenTableItem(tableID, mob); |
|
|
|
MobLoot toAdd = getGenTableItem(tableID, mob); |
|
|
|
|
|
|
|
|
|
|
|
if (toAdd != null) { |
|
|
|
if (toAdd != null) { |
|
|
|
if (toAdd.getPrefix() == null && toAdd.getSuffix() == null) |
|
|
|
|
|
|
|
toAdd.setIsID(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mob.getCharItemManager().addItemToInventory(toAdd); |
|
|
|
mob.getCharItemManager().addItemToInventory(toAdd); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
@ -313,20 +337,17 @@ public enum LootManager { |
|
|
|
if (me.getDropChance() == 0) |
|
|
|
if (me.getDropChance() == 0) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
float equipmentRoll = ThreadLocalRandom.current().nextInt(101); |
|
|
|
float equipmentRoll = ThreadLocalRandom.current().nextInt(99) + 1; |
|
|
|
float dropChance = me.getDropChance() * 100; |
|
|
|
float dropChance = me.getDropChance() * 100; |
|
|
|
|
|
|
|
|
|
|
|
if (equipmentRoll <= (dropChance * multiplier)) { |
|
|
|
if (equipmentRoll > (dropChance * multiplier)) |
|
|
|
|
|
|
|
continue; |
|
|
|
MobLoot ml = new MobLoot(mob, me.getItemBase(), false); |
|
|
|
MobLoot ml = new MobLoot(mob, me.getItemBase(), false); |
|
|
|
|
|
|
|
if (ml != null) |
|
|
|
if (ml.getPrefix().isEmpty() == true && ml.getSuffix().isEmpty() == true) |
|
|
|
|
|
|
|
ml.setIsID(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mob.getCharItemManager().addItemToInventory(ml); |
|
|
|
mob.getCharItemManager().addItemToInventory(ml); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void GenerateItemLootDrop(Mob mob, BootySetEntry bse, float multiplier) { |
|
|
|
public static void GenerateItemLootDrop(Mob mob, BootySetEntry bse, float multiplier) { |
|
|
|
|
|
|
|
|
|
|
@ -337,10 +358,10 @@ public enum LootManager { |
|
|
|
if (chanceRoll > bse.dropChance * multiplier) |
|
|
|
if (chanceRoll > bse.dropChance * multiplier) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
MobLoot disc = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true); |
|
|
|
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true); |
|
|
|
|
|
|
|
|
|
|
|
if (disc != null) |
|
|
|
if (lootItem != null) |
|
|
|
mob.getCharItemManager().addItemToInventory(disc); |
|
|
|
mob.getCharItemManager().addItemToInventory(lootItem); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void AddGenTableRow(int tableID, GenTableRow row) { |
|
|
|
public static void AddGenTableRow(int tableID, GenTableRow row) { |
|
|
|