Browse Source

any mob over level 30 has a small chance to drop glass

lakebane-master
FatBoy-DOTC 10 months ago
parent
commit
c0ec747e43
  1. 78
      src/engine/gameManager/LootManager.java
  2. 4
      src/engine/objects/ItemFactory.java

78
src/engine/gameManager/LootManager.java

@ -68,16 +68,13 @@ public enum LootManager { @@ -68,16 +68,13 @@ public enum LootManager {
public static void GenerateMobLoot(Mob mob) {
//determine if mob is in hotzone
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
//iterate the booty sets
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob);
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
RunBootySet(_bootySetMap.get(mob.bootySet), mob);
//lastly, check mobs inventory for godly or disc runes to send a server announcement
for (Item it : mob.getInventory()) {
@ -95,38 +92,33 @@ public enum LootManager { @@ -95,38 +92,33 @@ public enum LootManager {
}
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob) {
boolean hotzoneWasRan = false;
float dropRate = 1.0f;
float dropRate = NORMAL_DROP_RATE;
// Iterate all entries in this bootySet and process accordingly
if (mob.level >= 30) {
if(ThreadLocalRandom.current().nextInt(1, 20000) < mob.level) {
ItemTableEntry tableRow = ItemTableEntry.rollTable(126, ThreadLocalRandom.current().nextInt(1, 100 + 1));
if (tableRow != null) {
int itemUUID = tableRow.cacheID;
if (itemUUID != 0) {
MobLoot glassItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
}
}
}
}
for (BootySetEntry bse : entries) {
switch (bse.bootyType) {
case "GOLD":
GenerateGoldDrop(mob, bse, inHotzone);
GenerateGoldDrop(mob, bse);
break;
case "LOOT":
if (mob.getSafeZone() == false)
dropRate = LootManager.NORMAL_DROP_RATE;
if (inHotzone == true)
dropRate = LootManager.HOTZONE_DROP_RATE;
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
// Generate hotzone loot if in hotzone
// Only one bite at the hotzone apple per bootyset.
if (inHotzone == true && hotzoneWasRan == false)
if (_genTables.containsKey(bse.genTable + 1) && ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) {
GenerateLootDrop(mob, bse.genTable + 1, true); //generate loot drop from hotzone table
hotzoneWasRan = true;
}
GenerateLootDrop(mob, bse.genTable); //generate normal loot drop
break;
case "ITEM":
GenerateInventoryDrop(mob, bse);
@ -135,7 +127,7 @@ public enum LootManager { @@ -135,7 +127,7 @@ public enum LootManager {
}
}
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob) {
if (mob == null || _genTables.containsKey(genTableID) == false)
return null;
@ -160,7 +152,7 @@ public enum LootManager { @@ -160,7 +152,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) { //52 = player character
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
itemTableRoll = TableRoll(mob.level, inHotzone);
itemTableRoll = TableRoll(mob.level);
}
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
if (tableRow == null)
@ -182,7 +174,7 @@ public enum LootManager { @@ -182,7 +174,7 @@ public enum LootManager {
if(selectedRow.pModTable != 0){
try {
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll);
outItem.setIsID(false);
} catch (Exception e) {
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
@ -190,7 +182,7 @@ public enum LootManager { @@ -190,7 +182,7 @@ public enum LootManager {
}
if(selectedRow.sModTable != 0){
try {
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll);
outItem.setIsID(false);
} catch (Exception e) {
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
@ -199,7 +191,7 @@ public enum LootManager { @@ -199,7 +191,7 @@ public enum LootManager {
return outItem;
}
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll) {
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
@ -216,7 +208,7 @@ public enum LootManager { @@ -216,7 +208,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) {
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
prefixTableRoll = TableRoll(mob.level, inHotzone);
prefixTableRoll = TableRoll(mob.level);
}
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
@ -231,7 +223,7 @@ public enum LootManager { @@ -231,7 +223,7 @@ public enum LootManager {
return inItem;
}
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll) {
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
@ -248,7 +240,7 @@ public enum LootManager { @@ -248,7 +240,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) {
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
suffixTableRoll = TableRoll(mob.level, inHotzone);
suffixTableRoll = TableRoll(mob.level);
}
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
@ -263,7 +255,7 @@ public enum LootManager { @@ -263,7 +255,7 @@ public enum LootManager {
return inItem;
}
public static int TableRoll(int mobLevel, Boolean inHotzone) {
public static int TableRoll(int mobLevel) {
if (mobLevel > 65)
mobLevel = 65;
@ -278,15 +270,12 @@ public enum LootManager { @@ -278,15 +270,12 @@ public enum LootManager {
if (min < 70)
min = 70;
if (inHotzone)
min += mobLevel;
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
return roll;
}
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse, Boolean inHotzone) {
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse) {
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
@ -301,10 +290,7 @@ public enum LootManager { @@ -301,10 +290,7 @@ public enum LootManager {
int low = bse.lowGold;
int gold = ThreadLocalRandom.current().nextInt(low, high + 1);
if (inHotzone == true)
gold = (int) (gold * HOTZONE_GOLD_RATE);
else
gold = (int) (gold * NORMAL_GOLD_RATE);
gold = (int) (gold * NORMAL_GOLD_RATE);
if (gold > 0) {
MobLoot goldAmount = new MobLoot(mob, gold);
@ -313,11 +299,11 @@ public enum LootManager { @@ -313,11 +299,11 @@ public enum LootManager {
}
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
public static void GenerateLootDrop(Mob mob, int tableID) {
try {
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
MobLoot toAdd = getGenTableItem(tableID, mob);
if (toAdd != null)
mob.getCharItemManager().addItemToInventory(toAdd);

4
src/engine/objects/ItemFactory.java

@ -707,7 +707,7 @@ public class ItemFactory { @@ -707,7 +707,7 @@ public class ItemFactory {
if (rollPrefix < 80) {
int randomPrefix = LootManager.TableRoll(vendor.getLevel(), false);
int randomPrefix = LootManager.TableRoll(vendor.getLevel());
prefixEntry = ModTableEntry.rollTable(prefixTypeTable.modTableID, randomPrefix);
if (prefixEntry != null)
@ -722,7 +722,7 @@ public class ItemFactory { @@ -722,7 +722,7 @@ public class ItemFactory {
if (rollSuffix < 80 || prefixEntry == null) {
int randomSuffix = LootManager.TableRoll(vendor.getLevel(), false);
int randomSuffix = LootManager.TableRoll(vendor.getLevel());
suffixEntry = ModTableEntry.rollTable(suffixTypeTable.modTableID, randomSuffix);
if (suffixEntry != null)

Loading…
Cancel
Save