Browse Source

variable naming convention

master
FatBoy-DOTC 2 years ago
parent
commit
335484944f
  1. 39
      src/engine/loot/LootManager.java
  2. 4
      src/engine/objects/LootTable.java
  3. 4
      src/engine/objects/Mob.java

39
src/engine/loot/LootManager.java

@ -52,14 +52,29 @@ public class LootManager { @@ -52,14 +52,29 @@ public class LootManager {
multiplier = Float.parseFloat(ConfigManager.MB_HOTZONE_DROP_RATE.getValue());
}
//iterate the booty sets
for(BootySetEntry bse : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)) {
//check if chance roll is good
if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier)) {
//early exit, failed to hit minimum chance roll
continue;
RunBootySet(NPCManager._bootySetMap.get(mob.getMobBase().bootySet),mob,multiplier,inHotzone);
RunBootySet(NPCManager._bootySetMap.get(mob.bootySet),mob,multiplier,inHotzone);
//lastly, check mobs inventory for godly or disc runes to send a server announcement
for (Item it : mob.getInventory()) {
ItemBase ib = it.getItemBase();
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
}
}
}
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, float multiplier, boolean inHotzone){
for(BootySetEntry bse : entries) {
//check if chance roll is good
switch(bse.bootyType){
case "GOLD":
if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier)) {
//early exit, failed to hit minimum chance roll
break;
}
//determine and add gold to mob inventory
int gold = new Random().nextInt(bse.highGold - bse.lowGold) + bse.lowGold;
if (gold > 0) {
@ -68,6 +83,10 @@ public class LootManager { @@ -68,6 +83,10 @@ public class LootManager {
}
break;
case "LOOT":
if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier)) {
//early exit, failed to hit minimum chance roll
break;
}
//iterate the booty tables and add items to mob inventory
Item toAdd = getGenTableItem(bse.lootTable, mob);
if(toAdd != null) {
@ -88,16 +107,6 @@ public class LootManager { @@ -88,16 +107,6 @@ public class LootManager {
break;
}
}
//lastly, check mobs inventory for godly or disc runes to send a server announcement
for (Item it : mob.getInventory()) {
ItemBase ib = it.getItemBase();
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
}
}
}
public static Item getGenTableItem(int genTableID, Mob mob){
if(genTableID == 0 ||mob == null){

4
src/engine/objects/LootTable.java

@ -320,10 +320,10 @@ public class LootTable { @@ -320,10 +320,10 @@ public class LootTable {
ArrayList<BootySetEntry> bootySetList;
ArrayList<MobLoot> mobLootList = new ArrayList<>();
if (mob.bootySetID == 0)
if (mob.bootySet == 0)
return mobLootList;
bootySetList = NPCManager._bootySetMap.get(mob.bootySetID);
bootySetList = NPCManager._bootySetMap.get(mob.bootySet);
for (BootySetEntry bootyEntry : bootySetList)
if (ThreadLocalRandom.current().nextInt(100) < bootyEntry.dropChance) {

4
src/engine/objects/Mob.java

@ -106,7 +106,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -106,7 +106,7 @@ public class Mob extends AbstractIntelligenceAgent {
private boolean lootSync = false;
public int equipmentSetID = 0;
public int runeSetID = 0;
public int bootySetID = 0;
public int bootySet = 0;
/**
* No Id Constructor
@ -286,7 +286,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -286,7 +286,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.equipmentSetID = rs.getInt("equipmentSet");
this.runeSetID = rs.getInt("runeSet");
this.bootySetID = rs.getInt("bootySet");
this.bootySet = rs.getInt("bootySet");
if (this.contract != null)
this.equipmentSetID = this.contract.getEquipmentSet();

Loading…
Cancel
Save