Browse Source

revert simulatebooty command

master
FatBoy-DOTC 2 years ago
parent
commit
862230008e
  1. 106
      src/engine/devcmd/cmds/simulateBootyCmd.java

106
src/engine/devcmd/cmds/simulateBootyCmd.java

@ -1,15 +1,21 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum; import engine.Enum;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.*; import engine.gameManager.*;
import engine.objects.*; import engine.objects.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom;
import static engine.loot.LootManager.getGenTableItem;
public class simulateBootyCmd extends AbstractDevCmd { public class simulateBootyCmd extends AbstractDevCmd {
public simulateBootyCmd() { public simulateBootyCmd() {
super("simulatebooty"); super("simulatebooty");
} }
@Override @Override
protected void _doCmd(PlayerCharacter pc, String[] words, AbstractGameObject target) { protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check // Arg Count Check
if (words.length != 1) { if (words.length != 1) {
this.sendUsage(pc); this.sendUsage(pc);
@ -18,19 +24,9 @@ public class simulateBootyCmd extends AbstractDevCmd {
if (pc == null) { if (pc == null) {
return; return;
} }
int iterations = 100;
String newline = "\r\n "; String newline = "\r\n ";
if(words[1].length() > 0){
try{
iterations = Integer.parseInt(words[1]);
}catch(Exception ex){
iterations = 100;
}
}
boolean isZone = false;
if(words[2].length() > 0 && words[2].toLowerCase().equals("zone")){
isZone = true;
}
try { try {
int targetID = Integer.parseInt(words[0]); int targetID = Integer.parseInt(words[0]);
Building b = BuildingManager.getBuilding(targetID); Building b = BuildingManager.getBuilding(targetID);
@ -41,6 +37,7 @@ public class simulateBootyCmd extends AbstractDevCmd {
target = b; target = b;
} catch (Exception e) { } catch (Exception e) {
} }
if (target == null) { if (target == null) {
throwbackError(pc, "Target is unknown or of an invalid type." throwbackError(pc, "Target is unknown or of an invalid type."
+ newline + "Type ID: 0x" + newline + "Type ID: 0x"
@ -48,17 +45,26 @@ public class simulateBootyCmd extends AbstractDevCmd {
+ " Table ID: " + pc.getLastTargetID()); + " Table ID: " + pc.getLastTargetID());
return; return;
} }
Enum.GameObjectType objType = target.getObjectType(); Enum.GameObjectType objType = target.getObjectType();
int objectUUID = target.getObjectUUID();
String output; String output;
output = "Booty Simulation:" + newline;
output = "Loot Simulation:" + newline;
switch (objType) { switch (objType) {
case Building: case Building:
break;
case PlayerCharacter: case PlayerCharacter:
break;
case NPC: case NPC:
default:
output += "Target is Not a Mob! Please Select a Mob to Simulate Booty" + newline;
break; break;
case Mob: case Mob:
Mob mob = (Mob) target; Mob mob = (Mob) target;
ArrayList<Item> GlassItems = new ArrayList<Item>(); ArrayList<Item> GlassItems = new ArrayList<Item>();
@ -68,18 +74,13 @@ public class simulateBootyCmd extends AbstractDevCmd {
ArrayList<Item> Offerings = new ArrayList<Item>(); ArrayList<Item> Offerings = new ArrayList<Item>();
ArrayList<Item> OtherDrops = new ArrayList<Item>(); ArrayList<Item> OtherDrops = new ArrayList<Item>();
int failures = 0; int failures = 0;
ArrayList<Item> simulatedBooty = new ArrayList<>(); for(int i = 0; i < 100; ++i) {
if(isZone == false){
//simulate individual mob booty
output += "Simulated " + iterations + " Iterations 0n " + mob.parentZone.zoneMobSet.size() + " Mobs." + newline;
simulatedBooty = simulateMobBooty(mob, iterations);
}
else {
output += "Simulated " + iterations + " Iterations 0n " + mob.getName() + newline;
simulatedBooty = simulateZoneBooty(mob.getParentZone(), iterations);
}
try { try {
for (Item lootItem : simulatedBooty) { mob.loadInventory();
for (Item lootItem : mob.getCharItemManager().getInventory()) {
ItemBase ib = lootItem.getItemBase();
int ordinal = ib.getType().ordinal();
switch (lootItem.getItemBase().getType()) { switch (lootItem.getItemBase().getType()) {
case CONTRACT: //CONTRACT case CONTRACT: //CONTRACT
Contracts.add(lootItem); Contracts.add(lootItem);
@ -108,58 +109,27 @@ public class simulateBootyCmd extends AbstractDevCmd {
} catch (Exception ex) { } catch (Exception ex) {
failures++; failures++;
} }
output += "Time Required To Gain Simulated Booty: " + mob.getMobBase().getSpawnTime() * iterations + " Seconds" + newline;
output += "Glass Drops:" + GlassItems.size() + newline;
for(Item glassItem : GlassItems){
output += glassItem.getName() + newline;
}
output += "Rune Drops:" + Runes.size() + newline;
for(Item runeItem : Runes){
output += runeItem.getName() + newline;
}
output += "Contract Drops:" + Contracts.size() + newline;
for(Item contractItem : Contracts){
output += contractItem.getName() + newline;
}
output += "Resource Drops:" + Resources.size() + newline;
for(Item resourceItem : Contracts){
output += resourceItem.getName() + 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 += "OFFERINGS DROPPED: " + Offerings.size() + newline;
output += "OTHER ITEMS DROPPED: " + OtherDrops.size() + newline; output += "OTHERS DROPPED: " + OtherDrops.size() + newline;
output += "FAILED ROLLS: " + failures + newline; output += "FAILED ROLLS: " + failures + newline;
break; break;
} }
throwbackInfo(pc, output); throwbackInfo(pc, output);
} }
@Override @Override
protected String _getHelpString() { protected String _getHelpString() {
return "simulates mob loot X amount of times for mob or zone"; return "Gets information on an Object.";
} }
@Override @Override
protected String _getUsageString() { protected String _getUsageString() {
return "' ./simluatebooty <ITERATIONS> <zone or blank>"; return "' /info targetID'";
}
public static ArrayList<Item> simulateMobBooty(Mob mob, int iterations){
ArrayList<Item> producedBooty = new ArrayList<>();
for(int i = 0; i < iterations; ++i) {
mob.loadInventory();
for (Item lootItem : mob.getCharItemManager().getInventory()) {
producedBooty.add(lootItem);
}
}
return producedBooty;
}
public static ArrayList<Item> simulateZoneBooty(Zone zone, int iterations){
ArrayList<Item> producedBooty = new ArrayList<>();
for(Mob mob : zone.zoneMobSet) {
for (int i = 0; i < iterations; ++i) {
mob.loadInventory();
for (Item lootItem : mob.getCharItemManager().getInventory()) {
producedBooty.add(lootItem);
}
}
}
return producedBooty;
} }
} }
Loading…
Cancel
Save