From e483280a3cdec9271d2161acdbe6fd9eb21ef767 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 7 Apr 2023 21:41:03 -0500 Subject: [PATCH] simulate booty command work --- src/engine/devcmd/cmds/simulateBootyCmd.java | 61 ++++++++++---------- src/engine/objects/Mob.java | 2 +- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/engine/devcmd/cmds/simulateBootyCmd.java b/src/engine/devcmd/cmds/simulateBootyCmd.java index 9b3692bb..b4c1ad1f 100644 --- a/src/engine/devcmd/cmds/simulateBootyCmd.java +++ b/src/engine/devcmd/cmds/simulateBootyCmd.java @@ -67,14 +67,20 @@ public class simulateBootyCmd extends AbstractDevCmd { case Mob: Mob mob = (Mob) target; - ArrayList GlassItems = new ArrayList(); - ArrayList Resources = new ArrayList(); - ArrayList Runes = new ArrayList(); - ArrayList Contracts = new ArrayList(); - ArrayList Offerings = new ArrayList(); - ArrayList OtherDrops = new ArrayList(); - ArrayListReturnedBootyList = SimulateMobLoot(mob); - for(MobLoot ml : ReturnedBootyList){ + ArrayList GlassItems = new ArrayList(); + ArrayList Resources = new ArrayList(); + ArrayList Runes = new ArrayList(); + ArrayList Contracts = new ArrayList(); + ArrayList Offerings = new ArrayList(); + ArrayList OtherDrops = new ArrayList(); + ArrayListReturnedBootyList = new ArrayList(); + for(int i = 0; i < 100; ++i) { + mob.loadInventory(); + for(Item lootItem : mob.getCharItemManager().getInventory()){ + ReturnedBootyList.add(lootItem); + } + } + for(Item ml : ReturnedBootyList){ if(ml.getItemBase().isGlass() == true){ GlassItems.add(ml); break; @@ -97,13 +103,13 @@ public class simulateBootyCmd extends AbstractDevCmd { break; } } - output += "TOTAL ITEMS DROPPED: " + ReturnedBootyList.size(); - output += "GLASS ITEMS DROPPED: " + GlassItems.size(); - output += "RESOURCE STACKS DROPPED: " + Resources.size(); - output += "RUNES DROPPED: " + Runes.size(); - output += "CONTRACTS DROPPED: " + Contracts.size(); - output += "OFFERINGS DROPPED: " + Offerings.size(); - output += "OTHERS DROPPED: " + OtherDrops.size(); + output += "TOTAL ITEMS DROPPED: " + ReturnedBootyList.size() + newline; + output += "GLASS ITEMS DROPPED: " + GlassItems.size() + newline; + output += "RESOURCE STACKS DROPPED: " + Resources.size() + newline; + output += "RUNES DROPPED: " + Runes.size() + newline; + output += "CONTRACTS DROPPED: " + Contracts.size() + newline; + output += "OFFERINGS DROPPED: " + Offerings.size() + newline; + output += "OTHERS DROPPED: " + OtherDrops.size() + newline; break; } @@ -130,21 +136,16 @@ public class simulateBootyCmd extends AbstractDevCmd { multiplier = Float.parseFloat(ConfigManager.MB_HOTZONE_DROP_RATE.getValue()); } //simulate loot 100 times - for(int i = 0; i < 100; ++i) { + for(int i = 0; i < 5; ++i) { //iterate the booty sets - ArrayList output1 = new ArrayList<>(); - ArrayList output2 = new ArrayList<>(); if (mob.getMobBase().bootySet != 0 && NPCManager._bootySetMap.containsKey(mob.getMobBase().bootySet)) { - output1 = RunBootySet(NPCManager._bootySetMap.get(mob.getMobBase().bootySet), mob, multiplier, inHotzone); - } - if (mob.bootySet != 0) { - output2 = RunBootySet(NPCManager._bootySetMap.get(mob.bootySet), mob, multiplier, inHotzone); - } - for (MobLoot lootItem : output1) { - outList.add((lootItem)); - } - for (MobLoot lootItem : output2) { - outList.add((lootItem)); + try { + ArrayList testList = RunBootySet(NPCManager._bootySetMap.get(mob.getMobBase().bootySet), mob, multiplier, inHotzone); + for (MobLoot lootItem : testList) { + outList.add((lootItem)); + } + }catch(Exception ex){ + } } } return outList; @@ -152,7 +153,6 @@ public class simulateBootyCmd extends AbstractDevCmd { private static ArrayList RunBootySet(ArrayList entries, Mob mob, float multiplier, boolean inHotzone) { ArrayList outList = new ArrayList<>(); for (BootySetEntry bse : entries) { - //check if chance roll is good switch (bse.bootyType) { case "GOLD": @@ -177,9 +177,6 @@ public class simulateBootyCmd extends AbstractDevCmd { } break; case "ITEM": - MobLoot disc = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true); - if (disc != null) - //mob.getCharItemManager().addItemToInventory(disc); break; } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 1dc0d3fe..cb371dcb 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1360,7 +1360,7 @@ public class Mob extends AbstractIntelligenceAgent { * Clears and sets the inventory of the Mob. Must be called every time the * mob is spawned or respawned. */ - private void loadInventory() { + public void loadInventory() { if (!MBServerStatics.ENABLE_MOB_LOOT) return;