Browse Source

optimized equipment dropping system

master
FatBoy-DOTC 1 year ago
parent
commit
f636f4d2ec
  1. 19
      src/engine/gameManager/LootManager.java
  2. 4
      src/engine/objects/Mob.java

19
src/engine/gameManager/LootManager.java

@ -66,27 +66,25 @@ public enum LootManager {
} }
public static void GenerateMobLoot(Mob mob, boolean fromDeath) { public static void GenerateMobLoot(Mob mob) {
//determine if mob is in hotzone //determine if mob is in hotzone
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc()); boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
//iterate the booty sets //iterate the booty sets
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true) if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone, fromDeath); RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true) if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone, fromDeath); RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
//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)
for (Item it : mob.getInventory()) { for (Item it : mob.getInventory()) {
ItemBase ib = it.getItemBase(); ItemBase ib = it.getItemBase();
if(ib == null)
break;
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) { 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?"); 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.setMessageType(10);
@ -97,16 +95,11 @@ public enum LootManager {
} }
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone, boolean fromDeath) { private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
boolean hotzoneWasRan = false; boolean hotzoneWasRan = false;
float dropRate = 1.0f; float dropRate = 1.0f;
if (fromDeath) {
GenerateEquipmentDrop(mob);
return;
}
// Iterate all entries in this bootySet and process accordingly // Iterate all entries in this bootySet and process accordingly
for (BootySetEntry bse : entries) { for (BootySetEntry bse : entries) {

4
src/engine/objects/Mob.java

@ -1347,7 +1347,7 @@ public class Mob extends AbstractIntelligenceAgent {
playerAgroMap.clear(); playerAgroMap.clear();
if (!this.isPlayerGuard && this.equip != null) if (!this.isPlayerGuard && this.equip != null)
LootManager.GenerateMobLoot(this, true); LootManager.GenerateEquipmentDrop(this);
} }
try { try {
@ -1437,7 +1437,7 @@ public class Mob extends AbstractIntelligenceAgent {
if (isPlayerGuard) if (isPlayerGuard)
return; return;
LootManager.GenerateMobLoot(this, false); LootManager.GenerateMobLoot(this);
} }
@Override @Override

Loading…
Cancel
Save