Files
lakebane/src/engine/devcmd/cmds/simulateBootyCmd.java
T

161 lines
6.6 KiB
Java
Raw Normal View History

package engine.devcmd.cmds;
2023-04-08 17:15:34 -05:00
import engine.Enum;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.*;
import engine.objects.*;
import java.util.ArrayList;
2023-04-08 17:15:34 -05:00
public class simulateBootyCmd extends AbstractDevCmd {
public simulateBootyCmd() {
super("simulatebooty");
}
2023-04-08 17:15:34 -05:00
@Override
2023-04-08 17:15:34 -05:00
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (pc == null) {
return;
}
2023-04-08 17:15:34 -05:00
String newline = "\r\n ";
2023-04-08 17:15:34 -05:00
try {
int targetID = Integer.parseInt(words[0]);
Building b = BuildingManager.getBuilding(targetID);
if (b == null)
throwbackError(pc, "Building with ID " + targetID
+ " not found");
else
target = b;
} catch (Exception e) {
}
2023-04-08 17:15:34 -05:00
if (target == null) {
throwbackError(pc, "Target is unknown or of an invalid type."
+ newline + "Type ID: 0x"
+ pc.getLastTargetType().toString()
+ " Table ID: " + pc.getLastTargetID());
return;
}
2023-04-08 17:15:34 -05:00
Enum.GameObjectType objType = target.getObjectType();
2023-04-08 17:15:34 -05:00
int objectUUID = target.getObjectUUID();
String output;
2023-04-08 17:15:34 -05:00
2023-04-08 17:54:53 -05:00
output = "Booty Simulation:" + newline;
2023-04-08 15:33:51 -05:00
switch (objType) {
case Building:
2023-04-08 17:15:34 -05:00
break;
case PlayerCharacter:
2023-04-08 17:15:34 -05:00
break;
case NPC:
2023-04-08 17:15:34 -05:00
break;
2023-04-08 17:15:34 -05:00
case Mob:
Mob mob = (Mob) target;
2023-04-08 17:54:53 -05:00
output += "Name: " + mob.getName() + newline;
int minRollRange = mob.getLevel() + 0 + mob.getParentZone().minLvl;
2023-04-08 21:49:17 -05:00
int maxRollRange = (mob.getLevel() * 2) + 120 + (mob.getParentZone().maxLvl * 2);
2023-04-08 17:54:53 -05:00
output += "Roll Range: " + minRollRange + " - " + maxRollRange + newline;
2023-04-08 21:49:17 -05:00
output += "Special Loot:" + newline;
if(mob.bootySet != 0) {
for (BootySetEntry entry : NPCManager._bootySetMap.get(mob.bootySet)) {
ItemBase item = ItemBase.getItemBase(entry.itemBase);
if (item != null) {
output += "[" + entry.bootyType + "] " + item.getName() + " [Chance] " + entry.dropChance + newline;
}
}
}
2023-04-07 21:41:03 -05:00
ArrayList<Item> GlassItems = new ArrayList<Item>();
ArrayList<Item> Resources = new ArrayList<Item>();
ArrayList<Item> Runes = new ArrayList<Item>();
ArrayList<Item> Contracts = new ArrayList<Item>();
ArrayList<Item> Offerings = new ArrayList<Item>();
ArrayList<Item> OtherDrops = new ArrayList<Item>();
2023-04-07 22:04:39 -05:00
int failures = 0;
2023-04-08 17:18:35 -05:00
for (int i = 0; i < 100; ++i) {
2023-04-08 17:15:34 -05:00
2023-04-07 22:04:39 -05:00
try {
2023-04-08 17:15:34 -05:00
mob.loadInventory();
for (Item lootItem : mob.getCharItemManager().getInventory()) {
switch (lootItem.getItemBase().getType()) {
case CONTRACT: //CONTRACT
Contracts.add(lootItem);
break;
case OFFERING: //OFFERING
Offerings.add(lootItem);
break;
case RESOURCE: //RESOURCE
Resources.add(lootItem);
break;
case RUNE: //RUNE
Runes.add(lootItem);
break;
case WEAPON: //WEAPON
if (lootItem.getItemBase().isGlass()) {
GlassItems.add(lootItem);
} else {
OtherDrops.add(lootItem);
2023-04-08 21:49:17 -05:00
if(lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") ||lootItem.getName().toLowerCase().contains("bell")){
output += lootItem.getName() + newline;
}
2023-04-07 22:04:39 -05:00
}
break;
default:
OtherDrops.add(lootItem);
2023-04-08 21:49:17 -05:00
if(lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") ||lootItem.getName().toLowerCase().contains("bell")){
output += lootItem.getName() + newline;
}
break;
}
2023-04-07 22:04:39 -05:00
}
} catch (Exception ex) {
failures++;
}
}
2023-04-08 17:54:53 -05:00
int respawnTime = mob.getMobBase().getSpawnTime();
if(mob.spawnTime > 0){
respawnTime = mob.spawnTime;
}
2023-04-08 21:49:17 -05:00
output += "MobBase BootySet: " + mob.getMobBase().bootySet + newline;
output += "Mob BootySet: " + mob.bootySet + newline;
2023-04-08 17:54:53 -05:00
output += "Tables Rolled On: " + newline;
for(BootySetEntry entry : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)){
2023-04-08 18:05:46 -05:00
output += "[" + entry.bootyType + "] " + entry.lootTable + newline;
2023-04-08 17:54:53 -05:00
}
output += "Time Required To Gain Simulated Booty: " + respawnTime * 100 + " Seconds" + newline;
output += "GLASS DROPS: " + GlassItems.size() + newline;
2023-04-08 21:49:17 -05:00
output += "RUNE DROPS: " + Runes.size()+ newline;
output += "CONTRACTS DROPS: " + Contracts.size()+ newline;
output += "RESOURCE DROPS: " + Resources.size()+ newline;
2023-04-08 17:20:57 -05:00
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
output += "OTHER ITEMS DROPPED: " + OtherDrops.size() + newline;
output += "FAILED ROLLS: " + failures + newline;
2023-04-08 17:15:34 -05:00
break;
}
throwbackInfo(pc, output);
}
2023-04-08 17:15:34 -05:00
@Override
protected String _getHelpString() {
2023-04-08 17:15:34 -05:00
return "Gets information on an Object.";
}
2023-04-08 17:15:34 -05:00
@Override
protected String _getUsageString() {
2023-04-08 17:15:34 -05:00
return "' /info targetID'";
}
2023-04-08 17:15:34 -05:00
}