Browse Source

variable naming convention

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

37
src/engine/loot/LootManager.java

@ -52,14 +52,29 @@ public class LootManager {
multiplier = Float.parseFloat(ConfigManager.MB_HOTZONE_DROP_RATE.getValue()); multiplier = Float.parseFloat(ConfigManager.MB_HOTZONE_DROP_RATE.getValue());
} }
//iterate the booty sets //iterate the booty sets
for(BootySetEntry bse : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)) { 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 //check if chance roll is good
switch(bse.bootyType){
case "GOLD":
if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier)) { if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier)) {
//early exit, failed to hit minimum chance roll //early exit, failed to hit minimum chance roll
continue; break;
} }
switch(bse.bootyType){
case "GOLD":
//determine and add gold to mob inventory //determine and add gold to mob inventory
int gold = new Random().nextInt(bse.highGold - bse.lowGold) + bse.lowGold; int gold = new Random().nextInt(bse.highGold - bse.lowGold) + bse.lowGold;
if (gold > 0) { if (gold > 0) {
@ -68,6 +83,10 @@ public class LootManager {
} }
break; break;
case "LOOT": 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 //iterate the booty tables and add items to mob inventory
Item toAdd = getGenTableItem(bse.lootTable, mob); Item toAdd = getGenTableItem(bse.lootTable, mob);
if(toAdd != null) { if(toAdd != null) {
@ -88,16 +107,6 @@ public class LootManager {
break; 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){ public static Item getGenTableItem(int genTableID, Mob mob){
if(genTableID == 0 ||mob == null){ if(genTableID == 0 ||mob == null){

4
src/engine/objects/LootTable.java

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

4
src/engine/objects/Mob.java

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

Loading…
Cancel
Save