Project cleanup pre merge.

This commit is contained in:
2023-07-15 09:23:48 -04:00
parent 134b651df8
commit 9bbdef224d
747 changed files with 99704 additions and 101200 deletions
+96 -96
View File
@@ -29,101 +29,6 @@ public abstract class AbstractDevCmd {
this.rsult = "";
}
/**
* This function is called by the DevCmdManager. Method splits argString
* into a String array and then calls the subclass specific _doCmd method.
*/
public void doCmd(PlayerCharacter pcSender, String argString,
AbstractGameObject target) {
String[] args = argString.split(" ");
if (pcSender == null) {
return;
}
if (args.length > 0 && args[0].equalsIgnoreCase("?")) {
this.sendHelp(pcSender);
this.sendUsage(pcSender);
} else {
this.tr = target;
this._doCmd(pcSender, args, target);
}
}
protected abstract void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target);
/**
* Returns the string sent to the client that displays how to use this
* command.
*/
public final String getUsageString() {
return "Usage: " + this._getUsageString();
}
protected abstract String _getUsageString();
/**
* Returns the string sent to the client that displays what this command
* does.
*/
public final String getHelpString() {
return this.getMainCmdString() + ": " + this._getHelpString();
}
protected abstract String _getHelpString();
public final ArrayList<String> getCmdStrings() {
return cmdStrings;
}
public final String getMainCmdString() {
return this.cmdStrings.get(0);
}
protected void addCmdString(String cmdString) {
String lowercase = cmdString.toLowerCase();
this.cmdStrings.add(lowercase);
}
public void setTarget(AbstractGameObject ago) {
this.tr = ago;
}
public AbstractGameObject getTarget() {
return this.tr;
}
public void setResult(String result) {
this.rsult = result;
}
public String getResult() {
return this.rsult;
}
/*
* Helper functions
*/
protected void sendUsage(PlayerCharacter pc) {
this.throwbackError(pc, this.getUsageString());
}
protected void sendHelp(PlayerCharacter pc) {
this.throwbackError(pc, this.getHelpString());
}
protected void throwbackError(PlayerCharacter pc, String msgText) {
ChatManager.chatSystemError(pc, msgText);
}
protected void throwbackInfo(PlayerCharacter pc, String msgText) {
ChatManager.chatSystemInfo(pc, msgText);
}
/*
* Misc tools/helpers
*/
@@ -137,7 +42,7 @@ public abstract class AbstractDevCmd {
ChatManager.chatSystemError(
pc,
"Command Failed. Could not find building of ID "
+ targetID);
+ targetID);
return null;
}
return b;
@@ -178,4 +83,99 @@ public abstract class AbstractDevCmd {
}
}
/**
* This function is called by the DevCmdManager. Method splits argString
* into a String array and then calls the subclass specific _doCmd method.
*/
public void doCmd(PlayerCharacter pcSender, String argString,
AbstractGameObject target) {
String[] args = argString.split(" ");
if (pcSender == null) {
return;
}
if (args.length > 0 && args[0].equalsIgnoreCase("?")) {
this.sendHelp(pcSender);
this.sendUsage(pcSender);
} else {
this.tr = target;
this._doCmd(pcSender, args, target);
}
}
protected abstract void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target);
/**
* Returns the string sent to the client that displays how to use this
* command.
*/
public final String getUsageString() {
return "Usage: " + this._getUsageString();
}
protected abstract String _getUsageString();
/**
* Returns the string sent to the client that displays what this command
* does.
*/
public final String getHelpString() {
return this.getMainCmdString() + ": " + this._getHelpString();
}
protected abstract String _getHelpString();
public final ArrayList<String> getCmdStrings() {
return cmdStrings;
}
public final String getMainCmdString() {
return this.cmdStrings.get(0);
}
protected void addCmdString(String cmdString) {
String lowercase = cmdString.toLowerCase();
this.cmdStrings.add(lowercase);
}
public AbstractGameObject getTarget() {
return this.tr;
}
public void setTarget(AbstractGameObject ago) {
this.tr = ago;
}
public String getResult() {
return this.rsult;
}
public void setResult(String result) {
this.rsult = result;
}
/*
* Helper functions
*/
protected void sendUsage(PlayerCharacter pc) {
this.throwbackError(pc, this.getUsageString());
}
protected void sendHelp(PlayerCharacter pc) {
this.throwbackError(pc, this.getHelpString());
}
protected void throwbackError(PlayerCharacter pc, String msgText) {
ChatManager.chatSystemError(pc, msgText);
}
protected void throwbackInfo(PlayerCharacter pc, String msgText) {
ChatManager.chatSystemInfo(pc, msgText);
}
}
+85 -85
View File
@@ -22,106 +22,106 @@ import engine.server.MBServerStatics;
public class AddBuildingCmd extends AbstractDevCmd {
public AddBuildingCmd() {
public AddBuildingCmd() {
super("addbuilding");
// super("addbuilding", MBServerStatics.ACCESS_GROUP_DESIGNER_UP, 0, false, true);
this.addCmdString("building");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 2) {
this.sendUsage(pc);
return;
}
// Arg Count Check
if (words.length != 2) {
this.sendUsage(pc);
return;
}
int ID;
int rank;
Blueprint blueprint;
try {
ID = Integer.parseInt(words[0]);
rank = Integer.parseInt(words[1]);
} catch (Exception e) {
throwbackError(pc, "Invalid addBuilding Command. Need Building ID and rank.");
return; // NaN
}
if (ID < 1) {
throwbackError(pc,
"Invalid addBuilding Command. Invalid Building ID.");
return;
}
Vector3f rot = new Vector3f(0.0f, 0.0f, 0.0f);
float w = 1f;
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
int ID;
int rank;
Blueprint blueprint;
if (zone == null) {
throwbackError(pc, "Failed to find zone to place building in.");
return;
}
try {
ID = Integer.parseInt(words[0]);
rank = Integer.parseInt(words[1]);
} catch (Exception e) {
throwbackError(pc, "Invalid addBuilding Command. Need Building ID and rank.");
return; // NaN
}
if (ID < 1) {
throwbackError(pc,
"Invalid addBuilding Command. Invalid Building ID.");
return;
}
Vector3f rot = new Vector3f(0.0f, 0.0f, 0.0f);
float w = 1f;
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
blueprint = Blueprint.getBlueprint(ID);
if ((blueprint != null) && (rank > blueprint.getMaxRank())) {
throwbackError(pc, rank + " is not a valid rank for this building");
return;
}
Building likeBuilding = DbManager.BuildingQueries.GET_BUILDING_BY_MESH(ID);
if (likeBuilding != null) {
rot = likeBuilding.getRot();
w = likeBuilding.getw();
}
String buildingName = "";
int blueprintUUID = 0;
Vector3fImmutable localLoc = ZoneManager.worldToLocal(pc.getLoc(), zone);
if (localLoc == null)
return;
if (blueprint != null) {
buildingName = blueprint.getName();
blueprintUUID = blueprint.getBlueprintUUID();
}
Building building = DbManager.BuildingQueries.
CREATE_BUILDING(
zone.getObjectUUID(), 0, buildingName, ID,
localLoc, 1.0f, 0, ProtectionState.PROTECTED, 0, rank,
null, blueprintUUID, w, rot.y);
if (zone == null) {
throwbackError(pc, "Failed to find zone to place building in.");
return;
}
if (building == null) {
throwbackError(pc, "Failed to add building.");
return;
}
blueprint = Blueprint.getBlueprint(ID);
building.setRot(rot);
building.setw(w);
if ((blueprint != null) && (rank > blueprint.getMaxRank())) {
throwbackError(pc, rank + " is not a valid rank for this building");
return;
}
building.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
WorldGrid.addObject(building, pc);
ChatManager.chatSayInfo(pc,
"Building with ID " + building.getObjectUUID() + " added");
Building likeBuilding = DbManager.BuildingQueries.GET_BUILDING_BY_MESH(ID);
this.setResult(String.valueOf(building.getObjectUUID()));
if (likeBuilding != null) {
rot = likeBuilding.getRot();
w = likeBuilding.getw();
}
}
String buildingName = "";
int blueprintUUID = 0;
@Override
protected String _getHelpString() {
return "Creates a building of type 'buildingID' at the location your character is standing.";
}
Vector3fImmutable localLoc = ZoneManager.worldToLocal(pc.getLoc(), zone);
@Override
protected String _getUsageString() {
return "' /addbuilding buildingID rank' || ' /building buildingID rank'";
}
if (localLoc == null)
return;
if (blueprint != null) {
buildingName = blueprint.getName();
blueprintUUID = blueprint.getBlueprintUUID();
}
Building building = DbManager.BuildingQueries.
CREATE_BUILDING(
zone.getObjectUUID(), 0, buildingName, ID,
localLoc, 1.0f, 0, ProtectionState.PROTECTED, 0, rank,
null, blueprintUUID, w, rot.y);
if (building == null) {
throwbackError(pc, "Failed to add building.");
return;
}
building.setRot(rot);
building.setw(w);
building.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
WorldGrid.addObject(building, pc);
ChatManager.chatSayInfo(pc,
"Building with ID " + building.getObjectUUID() + " added");
this.setResult(String.valueOf(building.getObjectUUID()));
}
@Override
protected String _getHelpString() {
return "Creates a building of type 'buildingID' at the location your character is standing.";
}
@Override
protected String _getUsageString() {
return "' /addbuilding buildingID rank' || ' /building buildingID rank'";
}
}
+41 -42
View File
@@ -17,61 +17,60 @@ import engine.objects.PlayerCharacter;
/**
* @author Eighty
*
*/
public class AddGoldCmd extends AbstractDevCmd {
public AddGoldCmd() {
public AddGoldCmd() {
super("addgold");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
Item gold = pc.getCharItemManager().getGoldInventory();
int curAmt;
if (gold == null)
curAmt = 0;
else
curAmt = gold.getNumOfItems();
Item gold = pc.getCharItemManager().getGoldInventory();
int curAmt;
if (gold == null)
curAmt = 0;
else
curAmt = gold.getNumOfItems();
int amt;
try {
amt = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
return;
}
if (amt < 1 || amt > 10000000) {
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
return;
} else if ((curAmt + amt) > 10000000) {
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
return;
}
int amt;
try {
amt = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
return;
}
if (amt < 1 || amt > 10000000) {
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
return;
} else if ((curAmt + amt) > 10000000) {
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
return;
}
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
throwbackError(pc, "Failed to add gold to inventory");
return;
}
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
throwbackError(pc, "Failed to add gold to inventory");
return;
}
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
pc.getCharItemManager().updateInventory();
}
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
pc.getCharItemManager().updateInventory();
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "adds gold to inventory";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /addGold quantity'";
}
}
}
+66 -67
View File
@@ -20,92 +20,91 @@ import org.pmw.tinylog.Logger;
/**
* @author Eighty
*
*/
public class AddMobCmd extends AbstractDevCmd {
public AddMobCmd() {
public AddMobCmd() {
super("mob");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (words[0].equals("all")){
if (words[0].equals("all")) {
for (AbstractGameObject mobbaseAGO: DbManager.getList(GameObjectType.MobBase)){
MobBase mb = (MobBase)mobbaseAGO;
int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob( loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, true, zone, null,0, "", 1);
if (mob != null) {
mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID()));
} else {
throwbackError(pc, "Failed to create mob of type " + loadID);
Logger.error( "Failed to create mob of type "
+ loadID);
}
}
return;
}
for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
MobBase mb = (MobBase) mobbaseAGO;
int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, true, zone, null, 0, "", 1);
if (mob != null) {
mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID()));
} else {
throwbackError(pc, "Failed to create mob of type " + loadID);
Logger.error("Failed to create mob of type "
+ loadID);
}
}
return;
}
int loadID;
try {
loadID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied type " + words[0]
+ " failed to parse to an Integer");
return;
} catch (Exception e) {
throwbackError(pc,
"An unknown exception occurred when trying to use mob command for type "
+ words[0]);
return; // NaN
}
int loadID;
try {
loadID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied type " + words[0]
+ " failed to parse to an Integer");
return;
} catch (Exception e) {
throwbackError(pc,
"An unknown exception occurred when trying to use mob command for type "
+ words[0]);
return; // NaN
}
if (zone == null) {
throwbackError(pc, "Failed to find zone to place mob in.");
return;
}
if (zone == null) {
throwbackError(pc, "Failed to find zone to place mob in.");
return;
}
if (zone.isPlayerCity()) {
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
return;
}
if (zone.isPlayerCity()) {
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
return;
}
Mob mob = Mob.createMob( loadID, pc.getLoc(),
null, true, zone, null,0, "", 1);
if (mob != null) {
mob.updateDatabase();
ChatManager.chatSayInfo(pc,
"Mob with ID " + mob.getDBID() + " added");
this.setResult(String.valueOf(mob.getDBID()));
} else {
throwbackError(pc, "Failed to create mob of type " + loadID);
Logger.error("Failed to create mob of type "
+ loadID);
}
}
Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, true, zone, null, 0, "", 1);
if (mob != null) {
mob.updateDatabase();
ChatManager.chatSayInfo(pc,
"Mob with ID " + mob.getDBID() + " added");
this.setResult(String.valueOf(mob.getDBID()));
} else {
throwbackError(pc, "Failed to create mob of type " + loadID);
Logger.error("Failed to create mob of type "
+ loadID);
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Creates a Mob of type 'mobID' at the location your character is standing";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /mob mobID'";
}
}
}
+66 -67
View File
@@ -18,91 +18,90 @@ import org.pmw.tinylog.Logger;
/**
* @author Eighty
*
*/
public class AddNPCCmd extends AbstractDevCmd {
public AddNPCCmd() {
public AddNPCCmd() {
super("npc");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
int contractID;
String name = "";
int level = 0;
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
int contractID;
String name = "";
int level = 0;
if (words.length < 2) {
this.sendUsage(pc);
return;
}
try {
contractID = Integer.parseInt(words[0]);
level = Integer.parseInt(words[1]);
if (words.length < 2) {
this.sendUsage(pc);
return;
}
try {
contractID = Integer.parseInt(words[0]);
level = Integer.parseInt(words[1]);
for (int i = 2; i < words.length; i++) {
name += words[i];
if (i + 1 < words.length)
name += "";
}
for (int i = 2; i < words.length; i++) {
name += words[i];
if (i + 1 < words.length)
name += "";
}
} catch (NumberFormatException e) {
throwbackError(pc,
"Failed to parse supplied contractID or level to an Integer.");
return; // NaN
}
} catch (NumberFormatException e) {
throwbackError(pc,
"Failed to parse supplied contractID or level to an Integer.");
return; // NaN
}
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
if (contract == null || level < 1 || level > 75) {
throwbackError(pc,
"Invalid addNPC Command. Need contract ID, and level");
return; // NaN
}
if (contract == null || level < 1 || level > 75) {
throwbackError(pc,
"Invalid addNPC Command. Need contract ID, and level");
return; // NaN
}
// Pick a random name
if (name.isEmpty())
name = NPCManager.getPirateName(contract.getMobbaseID());
// Pick a random name
if (name.isEmpty())
name = NPCManager.getPirateName(contract.getMobbaseID());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) {
throwbackError(pc, "Failed to find zone to place npc in.");
return;
}
if (zone == null) {
throwbackError(pc, "Failed to find zone to place npc in.");
return;
}
if (target != null)
if (target.getObjectType() == GameObjectType.Building){
Building parentBuilding = (Building)target;
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
return;
}
if (target != null)
if (target.getObjectType() == GameObjectType.Building) {
Building parentBuilding = (Building) target;
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
return;
}
NPC npc = NPC.createNPC(name, contractID,
pc.getLoc(), null, true, zone, (short) level, null);
NPC npc = NPC.createNPC(name, contractID,
pc.getLoc(), null, true, zone, (short) level, null);
if (npc != null) {
WorldGrid.addObject(npc, pc);
ChatManager.chatSayInfo(pc,
"NPC with ID " + npc.getDBID() + " added");
this.setResult(String.valueOf(npc.getDBID()));
} else {
throwbackError(pc, "Failed to create npc of contract type "
+ contractID);
Logger.error(
"Failed to create npc of contract type " + contractID);
}
}
if (npc != null) {
WorldGrid.addObject(npc, pc);
ChatManager.chatSayInfo(pc,
"NPC with ID " + npc.getDBID() + " added");
this.setResult(String.valueOf(npc.getDBID()));
} else {
throwbackError(pc, "Failed to create npc of contract type "
+ contractID);
Logger.error(
"Failed to create npc of contract type " + contractID);
}
}
@Override
protected String _getHelpString() {
return "Creates an NPC of type 'npcID' at the location your character is standing";
}
@Override
protected String _getHelpString() {
return "Creates an NPC of type 'npcID' at the location your character is standing";
}
@Override
protected String _getUsageString() {
return "' /npc npcID level name'";
}
@Override
protected String _getUsageString() {
return "' /npc npcID level name'";
}
}
+117 -119
View File
@@ -26,133 +26,131 @@ import java.util.HashSet;
public class ApplyBonusCmd extends AbstractDevCmd {
public ApplyBonusCmd() {
super("applybonus");
}
public ApplyBonusCmd() {
super("applybonus");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
String action = words[0];
PowerActionType actionType = null;
HashMap<String,HashSet<String>> appliedMods = new HashMap<>();
try{
if (action.equals("all") == false)
for (PowerActionType powerActionType : PowerActionType.values()){
if (powerActionType.name().equalsIgnoreCase(action) == false)
continue;
actionType = powerActionType;
break;
}
}catch(Exception e){
this.throwbackError(pcSender, "Invalid power Action type for " + action);
this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
return;
}
if (action.equals("all") == false)
if (actionType == null){
this.throwbackError(pcSender, "Invalid power Action type for " + action);
this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
return;
}
for (PowersBase pb : PowersManager.powersBaseByIDString.values()){
if (pb.getActions() == null || pb.getActions().isEmpty())
continue;
for (ActionsBase ab: pb.getActions()){
if (ab.getPowerAction() == null)
continue;
if (action.equals("all") == false)
if (ab.getPowerAction().getType().equalsIgnoreCase(action) == false)
continue;
String effect1 = "";
String effect2 = "";
ChatManager.chatSystemInfo(pcSender,"Applying Power " + pb.getName() + " : " +pb.getDescription());
if (ab.getPowerAction().getEffectsBase() == null){
try {
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ThreadUtils.sleep(500);
continue;
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
String action = words[0];
PowerActionType actionType = null;
HashMap<String, HashSet<String>> appliedMods = new HashMap<>();
try {
if (action.equals("all") == false)
for (PowerActionType powerActionType : PowerActionType.values()) {
if (powerActionType.name().equalsIgnoreCase(action) == false)
continue;
actionType = powerActionType;
break;
}
} catch (Exception e) {
this.throwbackError(pcSender, "Invalid power Action type for " + action);
this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
return;
}
if (action.equals("all") == false)
if (actionType == null) {
this.throwbackError(pcSender, "Invalid power Action type for " + action);
this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
return;
}
for (PowersBase pb : PowersManager.powersBaseByIDString.values()) {
if (pb.getActions() == null || pb.getActions().isEmpty())
continue;
for (ActionsBase ab : pb.getActions()) {
if (ab.getPowerAction() == null)
continue;
if (action.equals("all") == false)
if (ab.getPowerAction().getType().equalsIgnoreCase(action) == false)
continue;
String effect1 = "";
String effect2 = "";
ChatManager.chatSystemInfo(pcSender, "Applying Power " + pb.getName() + " : " + pb.getDescription());
if (ab.getPowerAction().getEffectsBase() == null) {
try {
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ThreadUtils.sleep(500);
continue;
}
if (ab.getPowerAction().getEffectsBase().getModifiers() == null || ab.getPowerAction().getEffectsBase().getModifiers().isEmpty()) {
try {
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
continue;
}
boolean run = true;
for (AbstractEffectModifier mod : ab.getPowerAction().getEffectsBase().getModifiers()) {
if (appliedMods.containsKey(mod.modType.name()) == false) {
appliedMods.put(mod.modType.name(), new HashSet<>());
}
if (ab.getPowerAction().getEffectsBase().getModifiers() == null || ab.getPowerAction().getEffectsBase().getModifiers().isEmpty()){
try {
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
continue;
}
boolean run = true;
for (AbstractEffectModifier mod : ab.getPowerAction().getEffectsBase().getModifiers()){
if (appliedMods.containsKey(mod.modType.name()) == false){
appliedMods.put(mod.modType.name(), new HashSet<>());
}
// if (appliedMods.get(mod.modType.name()).contains(mod.sourceType.name())){
// continue;
// }
appliedMods.get(mod.modType.name()).add(mod.sourceType.name());
try{
try {
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch(Exception e){
Logger.error(e);
}
break;
}
}
}
}
appliedMods.get(mod.modType.name()).add(mod.sourceType.name());
try {
try {
PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (Exception e) {
Logger.error(e);
}
break;
@Override
protected String _getUsageString() {
return "' /bounds'";
}
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
}
}
}
private String getActionTypes(){
String output = "";
for (PowerActionType actionType : PowerActionType.values()){
output += actionType.name() + " | ";
}
return output.substring(0, output.length() -3);
}
@Override
protected String _getUsageString() {
return "' /bounds'";
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
private String getActionTypes() {
String output = "";
for (PowerActionType actionType : PowerActionType.values()) {
output += actionType.name() + " | ";
}
return output.substring(0, output.length() - 3);
}
}
+95 -100
View File
@@ -21,129 +21,124 @@ import engine.powers.PowersBase;
import java.util.ArrayList;
/**
*
* @author Eighty
*
*/
public class ApplyStatModCmd extends AbstractDevCmd {
public ApplyStatModCmd() {
private static int cnt = 0;
public ApplyStatModCmd() {
super("applystatmod");
}
private static int cnt = 0;
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (args.length < 1) {
// if(args.length < 2) {
this.sendUsage(pcSender);
return;
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if(args.length < 1) {
// if(args.length < 2) {
this.sendUsage(pcSender);
return;
}
if(!(target instanceof AbstractCharacter)) {
this.sendHelp(pcSender);
return;
}
if (!(target instanceof AbstractCharacter)) {
this.sendHelp(pcSender);
return;
}
this.setTarget(pcSender); //for logging
int spellID;
int powerAction = 0;
if (args[0].toLowerCase().contains("all")){
int spellID;
int powerAction = 0;
if (args[0].toLowerCase().contains("all")) {
int amount = 0;
if (args.length == 1) {
amount = ApplyStatModCmd.cnt;
ApplyStatModCmd.cnt++;
} else {
amount = Integer.valueOf(args[1]);
ApplyStatModCmd.cnt = amount+1;
}
int amount = 0;
if (args.length == 1) {
amount = ApplyStatModCmd.cnt;
ApplyStatModCmd.cnt++;
} else {
amount = Integer.valueOf(args[1]);
ApplyStatModCmd.cnt = amount + 1;
}
ArrayList<PowersBase> pbList = new ArrayList<>();
pbList.add(PowersManager.getPowerByToken(429047968));
pbList.add(PowersManager.getPowerByToken(429768864));
pbList.add(PowersManager.getPowerByToken(428458144));
pbList.add(PowersManager.getPowerByToken(428677994));
pbList.add(PowersManager.getPowerByToken(431874079));
pbList.add(PowersManager.getPowerByToken(431081336));
ArrayList<PowersBase> pbList = new ArrayList<>();
pbList.add(PowersManager.getPowerByToken(429047968));
pbList.add(PowersManager.getPowerByToken(429768864));
pbList.add(PowersManager.getPowerByToken(428458144));
pbList.add(PowersManager.getPowerByToken(428677994));
pbList.add(PowersManager.getPowerByToken(431874079));
pbList.add(PowersManager.getPowerByToken(431081336));
for (PowersBase pb : pbList) {
if (amount <= 0) {
if (pb.getToken() == 428677994)
powerAction = 1;
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
continue;
} else if (amount > 9999 || amount < 21) {
ChatManager.chatSystemInfo(pcSender, "Amount must be between 21 and 9999 inclusive.");
return;
}
if (pb.getToken() == 428677994) {
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
}
if (pb.getToken() == 428677994)
powerAction = 1;
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
}
return;
}
if (args[0].toLowerCase().contains("con")) {
spellID = 429047968; //Blessing of Health
} else if (args[0].toLowerCase().contains("str")) {
spellID = 429768864; //Blessing of Might
} else if (args[0].toLowerCase().contains("dex")) {
spellID = 428458144; //Blessing of Dexterity
} else if (args[0].toLowerCase().contains("int")) {
spellID = 428677994; //Bard Spi - TODO
powerAction = 1;
} else if (args[0].toLowerCase().contains("spi")) {
spellID = 428677994; //Bard Spi
} else {
ChatManager.chatSystemInfo(pcSender, "No valid stat found.");
return;
}
PowersBase pb = PowersManager.getPowerByToken(spellID);
for (PowersBase pb:pbList){
if(amount <= 0) {
if (pb.getToken() ==428677994)
powerAction = 1;
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
continue;
} else if(amount > 9999 || amount < 21) {
ChatManager.chatSystemInfo(pcSender, "Amount must be between 21 and 9999 inclusive.");
return;
}
int amount = 0;
if (args.length == 1) {
amount = ApplyStatModCmd.cnt;
ApplyStatModCmd.cnt++;
} else {
amount = Integer.valueOf(args[1]);
ApplyStatModCmd.cnt = amount + 1;
}
// int amount = Integer.valueOf(args[1]);
if (amount <= 0) {
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
return;
} else if (amount > 9999 || amount < 21) {
ChatManager.chatSystemInfo(pcSender, "Amount must be between 21 and 9999 inclusive.");
return;
}
if (pb.getToken() ==428677994){
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
}
if (pb.getToken() ==428677994)
powerAction = 1;
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
}
return;
}
if(args[0].toLowerCase().contains("con")) {
spellID = 429047968; //Blessing of Health
} else if(args[0].toLowerCase().contains("str")) {
spellID = 429768864; //Blessing of Might
} else if(args[0].toLowerCase().contains("dex")) {
spellID = 428458144; //Blessing of Dexterity
} else if(args[0].toLowerCase().contains("int")) {
spellID = 428677994; //Bard Spi - TODO
powerAction = 1;
} else if(args[0].toLowerCase().contains("spi")) {
spellID = 428677994; //Bard Spi
} else{
ChatManager.chatSystemInfo(pcSender, "No valid stat found.");
return;
}
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
}
PowersBase pb = PowersManager.getPowerByToken(spellID);
int amount = 0;
if (args.length == 1) {
amount = ApplyStatModCmd.cnt;
ApplyStatModCmd.cnt++;
} else {
amount = Integer.valueOf(args[1]);
ApplyStatModCmd.cnt = amount+1;
}
// int amount = Integer.valueOf(args[1]);
if(amount <= 0) {
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
return;
} else if(amount > 9999 || amount < 21) {
ChatManager.chatSystemInfo(pcSender, "Amount must be between 21 and 9999 inclusive.");
return;
}
PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /applystatmod <stat> [trains]'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "You must be targeting a player!";
}
}
}
+98 -101
View File
@@ -20,111 +20,108 @@ import org.pmw.tinylog.Logger;
public class AuditFailedItemsCmd extends AbstractDevCmd {
public AuditFailedItemsCmd() {
super("faileditems");
}
public AuditFailedItemsCmd() {
super("faileditems");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (ItemProductionManager.FailedItems.isEmpty())
return;
Logger.info("Auditing Item production Failed Items");
String newLine = "\r\n";
String auditFailedItem = "Failed Item Name | Prefix | Suffix | NPC | Contract | Player | ";
for (ProducedItem failedItem: ItemProductionManager.FailedItems){
String npcName = "";
String playerName ="";
String contractName = "";
String prefix = "";
String suffix = "";
String itemName = "";
NPC npc = NPC.getFromCache(failedItem.getNpcUID());
if (npc == null){
npcName = "null";
contractName = "null";
}else{
npcName = npc.getName();
if (npc.getContract() != null)
contractName = npc.getContract().getName();
}
PlayerCharacter roller = PlayerCharacter.getFromCache(failedItem.getPlayerID());
if (roller == null)
playerName = "null";
else
playerName = roller.getName();
ItemBase ib = ItemBase.getItemBase(failedItem.getItemBaseID());
if (ib != null){
itemName = ib.getName();
}
if (failedItem.isRandom() == false){
if (failedItem.getPrefix().isEmpty() == false){
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getPrefix());
if (pa != null){
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()){
if (aem.modType.equals(ModType.ItemName)){
prefix = aem.getString1();
break;
}
}
}
}
if (failedItem.getSuffix().isEmpty() == false){
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getSuffix());
if (pa != null){
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()){
if (aem.modType.equals(ModType.ItemName)){
suffix = aem.getString1();
break;
}
}
}
}
}else{
prefix = "random";
}
auditFailedItem += newLine;
auditFailedItem += itemName + " | "+prefix + " | "+suffix + " | "+ failedItem.getNpcUID() + ":" +npcName + " | "+contractName + " | "+failedItem.getPlayerID() + ":" +playerName;
}
Logger.info(auditFailedItem);
ItemProductionManager.FailedItems.clear();
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
@Override
protected String _getUsageString() {
return "' /bounds'";
}
if (ItemProductionManager.FailedItems.isEmpty())
return;
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
Logger.info("Auditing Item production Failed Items");
}
String newLine = "\r\n";
String auditFailedItem = "Failed Item Name | Prefix | Suffix | NPC | Contract | Player | ";
for (ProducedItem failedItem : ItemProductionManager.FailedItems) {
String npcName = "";
String playerName = "";
String contractName = "";
String prefix = "";
String suffix = "";
String itemName = "";
NPC npc = NPC.getFromCache(failedItem.getNpcUID());
if (npc == null) {
npcName = "null";
contractName = "null";
} else {
npcName = npc.getName();
if (npc.getContract() != null)
contractName = npc.getContract().getName();
}
PlayerCharacter roller = PlayerCharacter.getFromCache(failedItem.getPlayerID());
if (roller == null)
playerName = "null";
else
playerName = roller.getName();
ItemBase ib = ItemBase.getItemBase(failedItem.getItemBaseID());
if (ib != null) {
itemName = ib.getName();
}
if (failedItem.isRandom() == false) {
if (failedItem.getPrefix().isEmpty() == false) {
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getPrefix());
if (pa != null) {
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
if (aem.modType.equals(ModType.ItemName)) {
prefix = aem.getString1();
break;
}
}
}
}
if (failedItem.getSuffix().isEmpty() == false) {
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getSuffix());
if (pa != null) {
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
if (aem.modType.equals(ModType.ItemName)) {
suffix = aem.getString1();
break;
}
}
}
}
} else {
prefix = "random";
}
auditFailedItem += newLine;
auditFailedItem += itemName + " | " + prefix + " | " + suffix + " | " + failedItem.getNpcUID() + ":" + npcName + " | " + contractName + " | " + failedItem.getPlayerID() + ":" + playerName;
}
Logger.info(auditFailedItem);
ItemProductionManager.FailedItems.clear();
}
@Override
protected String _getUsageString() {
return "' /bounds'";
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
}
+27 -28
View File
@@ -20,52 +20,51 @@ import engine.objects.Zone;
public class AuditHeightMapCmd extends AbstractDevCmd {
public AuditHeightMapCmd() {
public AuditHeightMapCmd() {
super("auditheightmap");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
int count = Integer.parseInt(words[0]);
long start = System.currentTimeMillis();
for (int i = 0; i<count;i++){
int count = Integer.parseInt(words[0]);
long start = System.currentTimeMillis();
for (int i = 0; i < count; i++) {
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y);
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y );
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
if (currentZone != null && currentZone.getHeightMap() != null) {
float altitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
float outsetAltitude = HeightMap.getOutsetHeight(altitude, currentZone, pcSender.getLoc());
}
if (currentZone != null && currentZone.getHeightMap() != null){
float altitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
float outsetAltitude = HeightMap.getOutsetHeight(altitude, currentZone, pcSender.getLoc());
}
}
long end = System.currentTimeMillis();
}
long end = System.currentTimeMillis();
long delta = end - start;
long delta = end - start;
this.throwbackInfo(pcSender, "Audit Heightmap took " + delta + " ms to run " + count + " times!");
this.throwbackInfo(pcSender, "Audit Heightmap took " + delta + " ms to run " + count + " times!");
}
}
@Override
protected String _getUsageString() {
return "' /auditmobs [zone.UUID]'";
}
@Override
protected String _getUsageString() {
return "' /auditmobs [zone.UUID]'";
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
}
}
+62 -63
View File
@@ -17,90 +17,89 @@ import engine.objects.Zone;
public class AuditMobsCmd extends AbstractDevCmd {
public AuditMobsCmd() {
public AuditMobsCmd() {
super("auditmobs");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null) return;
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
//get Zone to check mobs against
//get Zone to check mobs against
Zone zone;
Zone zone;
if (words.length == 2){
if (words[0].equals("all")){
int plusplus = 0;
int count = Integer.parseInt(words[1]);
for (Zone zoneMicro: ZoneManager.getAllZones()){
int size = zoneMicro.zoneMobSet.size();
if (words.length == 2) {
if (words[0].equals("all")) {
int plusplus = 0;
int count = Integer.parseInt(words[1]);
for (Zone zoneMicro : ZoneManager.getAllZones()) {
int size = zoneMicro.zoneMobSet.size();
if (size >= count){
plusplus++;
throwbackInfo(pcSender, zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
System.out.println(zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
}
if (size >= count) {
plusplus++;
throwbackInfo(pcSender, zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
System.out.println(zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
}
}
throwbackInfo(pcSender," there are " +plusplus + " zones with at least " + count + " mobs in each.");
}
return;
}
if (words.length > 1) {
this.sendUsage(pcSender);
return;
} else if (words.length == 1) {
int uuid;
try {
uuid = Integer.parseInt(words[0]);
zone = ZoneManager.getZoneByUUID(uuid);
} catch (NumberFormatException e) {
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
}
} else
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
}
throwbackInfo(pcSender, " there are " + plusplus + " zones with at least " + count + " mobs in each.");
}
return;
}
if (words.length > 1) {
this.sendUsage(pcSender);
return;
} else if (words.length == 1) {
int uuid;
try {
uuid = Integer.parseInt(words[0]);
zone = ZoneManager.getZoneByUUID(uuid);
} catch (NumberFormatException e) {
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
}
} else
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
if (zone == null) {
throwbackError(pcSender, "Unable to find the zone");
return;
}
if (zone == null) {
throwbackError(pcSender, "Unable to find the zone");
return;
}
//get list of mobs for zone
//get list of mobs for zone
if (zone.zoneMobSet.isEmpty()) {
throwbackError(pcSender, "No mobs found for this zone.");
return;
}
if (zone.zoneMobSet.isEmpty()) {
throwbackError(pcSender, "No mobs found for this zone.");
return;
}
// ConcurrentHashMap<Integer, Mob> spawnMap = Mob.getSpawnMap();
//ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap();
// ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap();
// ConcurrentHashMap<Integer, Mob> spawnMap = Mob.getSpawnMap();
//ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap();
// ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap();
throwbackInfo(pcSender, zone.getName() + ", numMobs: " + zone.zoneMobSet.size());
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
throwbackInfo(pcSender, zone.getName() + ", numMobs: " + zone.zoneMobSet.size());
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
//mob not found in spawn map, check respawn
boolean inRespawn = false;
//mob not found in spawn map, check respawn
boolean inRespawn = false;
}
}
@Override
protected String _getUsageString() {
return "' /auditmobs [zone.UUID]'";
}
@Override
protected String _getUsageString() {
return "' /auditmobs [zone.UUID]'";
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
}
}
+48 -48
View File
@@ -17,61 +17,61 @@ import engine.objects.PlayerCharacter;
public class BoundsCmd extends AbstractDevCmd {
public BoundsCmd() {
public BoundsCmd() {
super("bounds");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (target == null || !target.getObjectType().equals(GameObjectType.Building)){
this.throwbackError(pcSender, "No Building Selected");
return;
}
Building building = (Building)target;
if (building.getBounds() == null){
this.throwbackInfo(pcSender, "No valid Bounds for building UUID " + building.getObjectUUID());
return;
}
float topLeftX = building.getLoc().x - building.getBounds().getHalfExtents().x;
float topLeftY = building.getLoc().z - building.getBounds().getHalfExtents().y;
float topRightX = building.getLoc().x + building.getBounds().getHalfExtents().x;
float topRightY = building.getLoc().z - building.getBounds().getHalfExtents().y;
float bottomLeftX = building.getLoc().x - building.getBounds().getHalfExtents().x;
float bottomLeftY = building.getLoc().z + building.getBounds().getHalfExtents().y;
float bottomRightX = building.getLoc().x + building.getBounds().getHalfExtents().x;
float bottomRightY = building.getLoc().z + building.getBounds().getHalfExtents().y;
String newLine = "\r\n ";
String output = "Bounds Information for Building UUID " + building.getObjectUUID();
output += newLine;
output+= "Top Left : " + topLeftX + " , " + topLeftY + newLine;
output+= "Top Right : " + topRightX + " , " + topRightY + newLine;
output+= "Bottom Left : " + bottomLeftX + " , " + bottomLeftY + newLine;
output+= "Bottom Right : " + bottomRightX + " , " + bottomRightY + newLine;
this.throwbackInfo(pcSender, output);
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (target == null || !target.getObjectType().equals(GameObjectType.Building)) {
this.throwbackError(pcSender, "No Building Selected");
return;
}
}
Building building = (Building) target;
if (building.getBounds() == null) {
this.throwbackInfo(pcSender, "No valid Bounds for building UUID " + building.getObjectUUID());
return;
}
float topLeftX = building.getLoc().x - building.getBounds().getHalfExtents().x;
float topLeftY = building.getLoc().z - building.getBounds().getHalfExtents().y;
float topRightX = building.getLoc().x + building.getBounds().getHalfExtents().x;
float topRightY = building.getLoc().z - building.getBounds().getHalfExtents().y;
float bottomLeftX = building.getLoc().x - building.getBounds().getHalfExtents().x;
float bottomLeftY = building.getLoc().z + building.getBounds().getHalfExtents().y;
float bottomRightX = building.getLoc().x + building.getBounds().getHalfExtents().x;
float bottomRightY = building.getLoc().z + building.getBounds().getHalfExtents().y;
String newLine = "\r\n ";
String output = "Bounds Information for Building UUID " + building.getObjectUUID();
output += newLine;
output += "Top Left : " + topLeftX + " , " + topLeftY + newLine;
output += "Top Right : " + topRightX + " , " + topRightY + newLine;
output += "Bottom Left : " + bottomLeftX + " , " + bottomLeftY + newLine;
output += "Bottom Right : " + bottomRightX + " , " + bottomRightY + newLine;
this.throwbackInfo(pcSender, output);
@Override
protected String _getUsageString() {
return "' /bounds'";
}
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
@Override
protected String _getUsageString() {
return "' /bounds'";
}
@Override
protected String _getHelpString() {
return "Audits all the mobs in a zone.";
}
}
+74 -74
View File
@@ -19,96 +19,96 @@ import engine.util.MiscUtils;
public class ChangeNameCmd extends AbstractDevCmd {
public ChangeNameCmd() {
super("changename");
}
public ChangeNameCmd() {
super("changename");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Vector3fImmutable loc = null;
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Vector3fImmutable loc = null;
// Arg Count Check
if (words.length < 2) {
this.sendUsage(pc);
return;
}
// Arg Count Check
if (words.length < 2) {
this.sendUsage(pc);
return;
}
String oldFirst = words[0];
String newFirst = words[1];
String newLast = "";
if (words.length > 2) {
newLast = words[2];
for (int i=3; i<words.length; i++)
newLast += ' ' + words[i];
}
String oldFirst = words[0];
String newFirst = words[1];
String newLast = "";
if (words.length > 2) {
newLast = words[2];
for (int i = 3; i < words.length; i++)
newLast += ' ' + words[i];
}
//verify new name length
if (newFirst.length() < 3) {
this.throwbackError(pc, "Error: First name is incorrect length. Must be between 3 and 15 characters");
return;
}
//verify new name length
if (newFirst.length() < 3) {
this.throwbackError(pc, "Error: First name is incorrect length. Must be between 3 and 15 characters");
return;
}
//verify old name length
if (newLast.length() > 50) {
this.throwbackError(pc, "Error: Last name is incorrect length. Must be no more than 50 characters");
return;
}
//verify old name length
if (newLast.length() > 50) {
this.throwbackError(pc, "Error: Last name is incorrect length. Must be no more than 50 characters");
return;
}
// Check if firstname is valid
if (MiscUtils.checkIfFirstNameInvalid(newFirst)) {
this.throwbackError(pc, "Error: First name is not allowed");
return;
}
// Check if firstname is valid
if (MiscUtils.checkIfFirstNameInvalid(newFirst)) {
this.throwbackError(pc, "Error: First name is not allowed");
return;
}
//get the world ID we're modifying for
//get the world ID we're modifying for
//test if first name is unique, unless new and old first name are equal.
if (!(oldFirst.equals(newFirst))) {
if (!DbManager.PlayerCharacterQueries.IS_CHARACTER_NAME_UNIQUE(newFirst)) {
this.throwbackError(pc, "Error: First name is not unique.");
return;
}
}
//test if first name is unique, unless new and old first name are equal.
if (!(oldFirst.equals(newFirst))) {
if (!DbManager.PlayerCharacterQueries.IS_CHARACTER_NAME_UNIQUE(newFirst)) {
this.throwbackError(pc, "Error: First name is not unique.");
return;
}
}
//tests passed, update name in database
if (!DbManager.PlayerCharacterQueries.UPDATE_NAME(oldFirst, newFirst, newLast)) {
this.throwbackError(pc, "Error: Database failed to update the name.");
return;
}
//tests passed, update name in database
if (!DbManager.PlayerCharacterQueries.UPDATE_NAME(oldFirst, newFirst, newLast)) {
this.throwbackError(pc, "Error: Database failed to update the name.");
return;
}
//Finally update player ingame
PlayerCharacter pcTar = null;
try {
pcTar = SessionManager
.getPlayerCharacterByLowerCaseName(words[0]);
pcTar.setFirstName(newFirst);
pcTar.setLastName(newLast);
this.setTarget(pcTar); //for logging
//Finally update player ingame
PlayerCharacter pcTar = null;
try {
pcTar = SessionManager
.getPlayerCharacterByLowerCaseName(words[0]);
pcTar.setFirstName(newFirst);
pcTar.setLastName(newLast);
this.setTarget(pcTar); //for logging
//specify if last name is ascii characters only
String lastAscii = newLast.replaceAll("[^\\p{ASCII}]", "");
pcTar.setAsciiLastName(lastAscii.equals(newLast));
} catch (Exception e) {
this.throwbackError(pc, "Database was updated but ingame character failed to update.");
return;
}
//specify if last name is ascii characters only
String lastAscii = newLast.replaceAll("[^\\p{ASCII}]", "");
pcTar.setAsciiLastName(lastAscii.equals(newLast));
} catch (Exception e) {
this.throwbackError(pc, "Database was updated but ingame character failed to update.");
return;
}
String out = oldFirst + " was changed to " + newFirst + (newLast.isEmpty() ? "." : (' ' + newLast + '.'));
this.throwbackInfo(pc, out);
String out = oldFirst + " was changed to " + newFirst + (newLast.isEmpty() ? "." : (' ' + newLast + '.'));
this.throwbackInfo(pc, out);
}
}
@Override
protected String _getHelpString() {
return "Changes the name of a player";
}
@Override
protected String _getHelpString() {
return "Changes the name of a player";
}
@Override
protected String _getUsageString() {
return "'./changename oldFirstName newFirstName newLastName'";
}
@Override
protected String _getUsageString() {
return "'./changename oldFirstName newFirstName newLastName'";
}
}
+26 -31
View File
@@ -7,9 +7,6 @@
// www.magicbane.com
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
@@ -27,44 +24,42 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
*
* @author Eighty
*
*/
public class CombatMessageCmd extends AbstractDevCmd {
public CombatMessageCmd() {
public CombatMessageCmd() {
super("cm");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (pcSender == null)
return;
if (args.length != 1) {
this.sendUsage(pcSender);
return;
}
int num = 0;
try {
num = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
throwbackError(pcSender, "Supplied message number " + args[0] + " failed to parse to an Integer");
return;
}
TargetedActionMsg.un2cnt = num;
throwbackInfo(pcSender, "CombatMessage set to " + num);
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (pcSender == null)
return;
if (args.length != 1) {
this.sendUsage(pcSender);
return;
}
int num = 0;
try {
num = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
throwbackError(pcSender, "Supplied message number " + args[0] + " failed to parse to an Integer");
return;
}
TargetedActionMsg.un2cnt = num;
throwbackInfo(pcSender, "CombatMessage set to " + num);
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /cm [cmNumber]'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Sets the combat message to the supplied integer value";
}
}
}
+28 -29
View File
@@ -17,49 +17,48 @@ import engine.objects.PlayerCharacter;
/**
* @author Eighty
*
*/
public class CreateItemCmd extends AbstractDevCmd {
public CreateItemCmd() {
public CreateItemCmd() {
super("createitem");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2) {
this.sendUsage(pc);
return;
}
int id;
id = ItemBase.getIDByName(words[0]);
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2) {
this.sendUsage(pc);
return;
}
int id;
id = ItemBase.getIDByName(words[0]);
if (id == 0)
id = Integer.parseInt(words[0]);
if (id == 7){
this.throwbackInfo(pc, "use /addgold to add gold.....");
return;
}
if (id == 0)
id = Integer.parseInt(words[0]);
if (id == 7) {
this.throwbackInfo(pc, "use /addgold to add gold.....");
return;
}
int size = 1;
int size = 1;
if(words.length < 3) {
size = Integer.parseInt(words[1]);
}
if (words.length < 3) {
size = Integer.parseInt(words[1]);
}
ItemFactory.fillInventory(pc, id, size);
ItemFactory.fillInventory(pc, id, size);
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Fill your inventory with items";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /createitem <ItembaseID> <quantity>'";
}
}
}
+78 -79
View File
@@ -17,107 +17,106 @@ import engine.objects.PlayerCharacter;
public class DebugCmd extends AbstractDevCmd {
public DebugCmd() {
super("debug");
// super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
}
public DebugCmd() {
super("debug");
// super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
}
private static void toggleDebugTimer(PlayerCharacter pc, String name, int num, int duration, boolean toggle) {
if (toggle) {
DebugTimerJob dtj = new DebugTimerJob(pc, name, num, duration);
pc.renewTimer(name, dtj, duration);
} else
pc.cancelTimer(name);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2) {
this.sendUsage(pc);
return;
}
if (pc == null)
return;
if (pc == null)
return;
//pc.setDebug must use bit sizes: 1, 2, 4, 8, 16, 32
//pc.setDebug must use bit sizes: 1, 2, 4, 8, 16, 32
String command = words[0].toLowerCase();
boolean toggle = (words[1].toLowerCase().equals("on")) ? true : false;
String command = words[0].toLowerCase();
boolean toggle = (words[1].toLowerCase().equals("on")) ? true : false;
switch (command) {
case "magictrek":
pc.RUN_MAGICTREK = toggle;
switch (command) {
case "magictrek":
pc.RUN_MAGICTREK = toggle;
break;
case "combat":
pc.setDebug(64, toggle);
break;
case "combat":
pc.setDebug(64, toggle);
break;
case "health":
toggleDebugTimer(pc, "Debug_Health", 1, 1000, toggle);
break;
case "health":
toggleDebugTimer(pc, "Debug_Health", 1, 1000, toggle);
break;
case "mana":
toggleDebugTimer(pc, "Debug_Mana", 2, 1000, toggle);
break;
case "mana":
toggleDebugTimer(pc, "Debug_Mana", 2, 1000, toggle);
break;
case "stamina":
toggleDebugTimer(pc, "Debug_Stamina", 3, 500, toggle);
break;
case "stamina":
toggleDebugTimer(pc, "Debug_Stamina", 3, 500, toggle);
break;
case "spells":
pc.setDebug(16, toggle);
break;
case "spells":
pc.setDebug(16, toggle);
break;
case "damageabsorber":
pc.setDebug(2, toggle);
break;
case "damageabsorber":
pc.setDebug(2, toggle);
break;
case "recast":
case "recycle":
pc.setDebug(4, toggle);
break;
case "recast":
case "recycle":
pc.setDebug(4, toggle);
break;
case "seeinvis":
pc.setDebug(8, toggle);
break;
case "seeinvis":
pc.setDebug(8, toggle);
break;
case "movement":
pc.setDebug(1, toggle);
break;
case "movement":
pc.setDebug(1, toggle);
break;
case "noaggro":
pc.setDebug(32, toggle);
break;
case "noaggro":
pc.setDebug(32, toggle);
break;
// case "loot":
// MBServerStatics.debugLoot = toggle;
// break;
break;
// case "loot":
// MBServerStatics.debugLoot = toggle;
// break;
default:
String output = "Debug for " + command + " not found.";
throwbackError(pc, output);
return;
}
default:
String output = "Debug for " + command + " not found.";
throwbackError(pc, output);
return;
}
setTarget(pc); //for logging
setTarget(pc); //for logging
String output = "Debug for " + command + " turned " + ((toggle) ? "on." : "off.");
throwbackInfo(pc, output);
}
String output = "Debug for " + command + " turned " + ((toggle) ? "on." : "off.");
throwbackInfo(pc, output);
}
@Override
protected String _getHelpString() {
return "Runs debug commands";
@Override
protected String _getHelpString() {
return "Runs debug commands";
}
}
@Override
protected String _getUsageString() {
return "'./Debug command on/off'";
}
private static void toggleDebugTimer(PlayerCharacter pc, String name, int num, int duration, boolean toggle) {
if (toggle) {
DebugTimerJob dtj = new DebugTimerJob(pc, name, num, duration);
pc.renewTimer(name, dtj, duration);
} else
pc.cancelTimer(name);
}
@Override
protected String _getUsageString() {
return "'./Debug command on/off'";
}
}
+28 -29
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -17,42 +16,42 @@ import engine.objects.PlayerCharacter;
public class DebugMeleeSyncCmd extends AbstractDevCmd {
public DebugMeleeSyncCmd() {
public DebugMeleeSyncCmd() {
super("debugmeleesync");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
String s = words[0].toLowerCase();
String s = words[0].toLowerCase();
if (s.equals("on")) {
pc.setDebug(64, true);
ChatManager.chatSayInfo(pc, "Melee Sync Debug ON");
} else if (s.equals("off")) {
pc.setDebug(64, false);
ChatManager.chatSayInfo(pc, "Melee Sync Debug OFF");
} else {
this.sendUsage(pc);
}
}
if (s.equals("on")) {
pc.setDebug(64, true);
ChatManager.chatSayInfo(pc, "Melee Sync Debug ON");
} else if (s.equals("off")) {
pc.setDebug(64, false);
ChatManager.chatSayInfo(pc, "Melee Sync Debug OFF");
} else {
this.sendUsage(pc);
}
}
@Override
protected String _getHelpString() {
return "Turns on/off melee sync debugging.";
@Override
protected String _getHelpString() {
return "Turns on/off melee sync debugging.";
}
}
@Override
protected String _getUsageString() {
return "'./debugmeleesync on|off'";
@Override
protected String _getUsageString() {
return "'./debugmeleesync on|off'";
}
}
}
+21 -21
View File
@@ -20,35 +20,35 @@ import engine.objects.PlayerCharacter;
*/
public class DecachePlayerCmd extends AbstractDevCmd {
public DecachePlayerCmd() {
public DecachePlayerCmd() {
super("decacheplayer");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if(words.length < 1) {
this.sendUsage(pc);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 1) {
this.sendUsage(pc);
}
int objectUUID = Integer.parseInt(words[0]);
int objectUUID = Integer.parseInt(words[0]);
if(DbManager.inCache(Enum.GameObjectType.PlayerCharacter, objectUUID)) {
this.setTarget(PlayerCharacter.getFromCache(objectUUID)); //for logging
PlayerCharacter.getFromCache(objectUUID).removeFromCache();
} else {
this.sendHelp(pc);
}
}
if (DbManager.inCache(Enum.GameObjectType.PlayerCharacter, objectUUID)) {
this.setTarget(PlayerCharacter.getFromCache(objectUUID)); //for logging
PlayerCharacter.getFromCache(objectUUID).removeFromCache();
} else {
this.sendHelp(pc);
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "No player found. Please make sure the table ID is correct.";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /decacheplayer <UUID>'";
}
}
}
+36 -43
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -18,56 +17,50 @@ import engine.objects.PlayerCharacter;
public class DespawnCmd extends AbstractDevCmd {
public DespawnCmd() {
public DespawnCmd() {
super("debugmob");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (pc == null) {
return;
}
Mob mob = null;
if (target != null && target.getObjectType().equals(GameObjectType.Mob))
mob = (Mob)target;
if (mob == null)
mob = Mob.getFromCache(Integer.parseInt(words[1]));
if (mob == null)
return;
if (words[0].equalsIgnoreCase("respawn")){
mob.respawn();
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Respawned");
}else if (words[0].equalsIgnoreCase("despawn")){
mob.despawn();
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Despawned");
}
}
if (pc == null) {
return;
}
@Override
protected String _getHelpString() {
return "Gets distance from a target.";
}
Mob mob = null;
@Override
protected String _getUsageString() {
return "' /distance'";
if (target != null && target.getObjectType().equals(GameObjectType.Mob))
mob = (Mob) target;
}
if (mob == null)
mob = Mob.getFromCache(Integer.parseInt(words[1]));
if (mob == null)
return;
if (words[0].equalsIgnoreCase("respawn")) {
mob.respawn();
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Respawned");
} else if (words[0].equalsIgnoreCase("despawn")) {
mob.despawn();
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Despawned");
}
}
@Override
protected String _getHelpString() {
return "Gets distance from a target.";
}
@Override
protected String _getUsageString() {
return "' /distance'";
}
}
+35 -38
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -18,51 +17,49 @@ import engine.objects.PlayerCharacter;
public class DistanceCmd extends AbstractDevCmd {
public DistanceCmd() {
public DistanceCmd() {
super("distance");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (pc == null) {
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target == null || !(target instanceof AbstractWorldObject)) {
throwbackError(pc, "No target found.");
return;
}
AbstractWorldObject awoTarget = (AbstractWorldObject)target;
Vector3fImmutable pcLoc = pc.getLoc();
Vector3fImmutable tarLoc = awoTarget.getLoc();
String out = "Distance: " + pcLoc.distance(tarLoc) +
"\r\nYour Loc: " + pcLoc.x + 'x' + pcLoc.y + 'x' + pcLoc.z +
"\r\nTarget Loc: " + tarLoc.x + 'x' + tarLoc.y + 'x' + tarLoc.z;
throwbackInfo(pc, out);
}
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (pc == null) {
return;
}
@Override
protected String _getHelpString() {
return "Gets distance from a target.";
if (target == null || !(target instanceof AbstractWorldObject)) {
throwbackError(pc, "No target found.");
return;
}
}
AbstractWorldObject awoTarget = (AbstractWorldObject) target;
@Override
protected String _getUsageString() {
return "' /distance'";
Vector3fImmutable pcLoc = pc.getLoc();
Vector3fImmutable tarLoc = awoTarget.getLoc();
String out = "Distance: " + pcLoc.distance(tarLoc) +
"\r\nYour Loc: " + pcLoc.x + 'x' + pcLoc.y + 'x' + pcLoc.z +
"\r\nTarget Loc: " + tarLoc.x + 'x' + tarLoc.y + 'x' + tarLoc.z;
throwbackInfo(pc, out);
}
}
@Override
protected String _getHelpString() {
return "Gets distance from a target.";
}
@Override
protected String _getUsageString() {
return "' /distance'";
}
}
+27 -29
View File
@@ -17,47 +17,45 @@ import engine.objects.PlayerCharacter;
import engine.powers.EffectsBase;
/**
*
* @author Eighty
*
*/
public class EffectCmd extends AbstractDevCmd {
public EffectCmd() {
public EffectCmd() {
super("effect");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
int ID = 0;
int token = 0;
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
int ID = 0;
int token = 0;
if (args.length != 2) {
this.sendUsage(pcSender);
return;
}
ID = Integer.parseInt(args[0]);
token = Integer.parseInt(args[1]);
if (args.length != 2) {
this.sendUsage(pcSender);
return;
}
ID = Integer.parseInt(args[0]);
token = Integer.parseInt(args[1]);
EffectsBase eb = PowersManager.setEffectToken(ID, token);
if (eb == null) {
throwbackError(pcSender, "Unable to find EffectsBase " + ID
+ " to modify.");
return;
}
ChatManager.chatSayInfo(pcSender,
"EffectsBase with ID " + ID + " changed token to " + token);
}
EffectsBase eb = PowersManager.setEffectToken(ID, token);
if (eb == null) {
throwbackError(pcSender, "Unable to find EffectsBase " + ID
+ " to modify.");
return;
}
ChatManager.chatSayInfo(pcSender,
"EffectsBase with ID " + ID + " changed token to " + token);
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /effect EffectsBaseID Token'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Temporarily places the effect token with the corresponding EffectsBase on the server";
}
}
}
+57 -58
View File
@@ -14,75 +14,74 @@ import engine.objects.*;
public class EnchantCmd extends AbstractDevCmd {
public EnchantCmd() {
public EnchantCmd() {
super("enchant");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
int rank = 0;
if (words.length < 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
int rank = 0;
if (words.length < 1) {
this.sendUsage(pc);
return;
}
try{
rank = Integer.parseInt(words[0]);
}catch(Exception e){
try {
rank = Integer.parseInt(words[0]);
} catch (Exception e) {
}
}
Item item;
if (target == null || target instanceof Item)
item = (Item) target;
else {
throwbackError(pc, "Must have an item targeted");
return;
}
Item item;
if (target == null || target instanceof Item)
item = (Item) target;
else {
throwbackError(pc, "Must have an item targeted");
return;
}
CharacterItemManager cim = pc.getCharItemManager();
if (cim == null) {
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
return;
}
CharacterItemManager cim = pc.getCharItemManager();
if (cim == null) {
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
return;
}
if (words[0].equals("clear")) {
item.clearEnchantments();
cim.updateInventory();
this.setResult(String.valueOf(item.getObjectUUID()));
} else {
int cnt = words.length;
for (int i = 1; i < cnt; i++) {
String enchant = words[i];
boolean valid = true;
for (Effect eff : item.getEffects().values()) {
if (eff.getEffectsBase().getIDString().equals(enchant)) {
throwbackError(pc, "This item already has that enchantment");
return;
}
}
if (valid) {
item.addPermanentEnchantmentForDev(enchant, rank);
this.setResult(String.valueOf(item.getObjectUUID()));
} else
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.');
}
cim.updateInventory();
}
}
if (words[0].equals("clear")) {
item.clearEnchantments();
cim.updateInventory();
this.setResult(String.valueOf(item.getObjectUUID()));
} else {
int cnt = words.length;
for (int i=1;i<cnt;i++) {
String enchant = words[i];
boolean valid = true;
for (Effect eff: item.getEffects().values()){
if (eff.getEffectsBase().getIDString().equals(enchant)){
throwbackError(pc,"This item already has that enchantment");
return;
}
}
if (valid) {
item.addPermanentEnchantmentForDev(enchant, rank);
this.setResult(String.valueOf(item.getObjectUUID()));
} else
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.');
}
cim.updateInventory();
}
}
@Override
protected String _getHelpString() {
return "Enchants an item with a prefix and suffix";
}
@Override
protected String _getHelpString() {
return "Enchants an item with a prefix and suffix";
}
@Override
protected String _getUsageString() {
return "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
}
@Override
protected String _getUsageString() {
return "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
}
}
+68 -68
View File
@@ -22,90 +22,90 @@ import java.util.HashSet;
public class FindBuildingsCmd extends AbstractDevCmd {
public FindBuildingsCmd() {
public FindBuildingsCmd() {
super("findBuildings");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
try {
Vector3fImmutable searchPt = pc.getLoc();
float range = 50.0f;
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
try {
Vector3fImmutable searchPt = pc.getLoc();
float range = 50.0f;
// Arg Count Check
// Valid arg count is 0,1,2,3
if (words.length == 0) {
// Use Player's loc and default range
// Arg Count Check
// Valid arg count is 0,1,2,3
if (words.length == 0) {
// Use Player's loc and default range
} else if (words.length == 1) {
// Use Player's loc and specified range
range = Float.valueOf(words[0]);
} else if (words.length == 1) {
// Use Player's loc and specified range
range = Float.valueOf(words[0]);
} else if (words.length == 2) {
// Use specified loc and default range
searchPt = new Vector3fImmutable(Float.valueOf(words[0]),
searchPt.y,
Float.valueOf(words[1]));
} else if (words.length == 2) {
// Use specified loc and default range
searchPt = new Vector3fImmutable(Float.valueOf(words[0]),
searchPt.y,
Float.valueOf(words[1]));
} else if (words.length == 3) {
// Use specified loc and specified range
searchPt = new Vector3fImmutable(Float.valueOf(words[0]),
searchPt.y,
Float.valueOf(words[1]));
range = Float.valueOf(words[2]);
} else if (words.length == 3) {
// Use specified loc and specified range
searchPt = new Vector3fImmutable(Float.valueOf(words[0]),
searchPt.y,
Float.valueOf(words[1]));
range = Float.valueOf(words[2]);
} else {
this.sendUsage(pc);
return;
}
} else {
this.sendUsage(pc);
return;
}
String s = "";
String s = "";
HashSet<AbstractWorldObject> container = WorldGrid.getObjectsInRangePartial(
searchPt, range, MBServerStatics.MASK_BUILDING);
HashSet<AbstractWorldObject> container = WorldGrid.getObjectsInRangePartial(
searchPt, range, MBServerStatics.MASK_BUILDING);
s += "Found " + container.size();
s += " buildings within " + range;
s += " units of [" + searchPt.toString() + ']';
throwbackInfo(pc, s);
s += "Found " + container.size();
s += " buildings within " + range;
s += " units of [" + searchPt.toString() + ']';
throwbackInfo(pc, s);
int index = 0;
for (AbstractWorldObject awo : container) {
Building b = (Building) awo;
int index = 0;
for (AbstractWorldObject awo : container) {
Building b = (Building) awo;
s = index + ")";
s += " ObjectID: " + awo.getObjectUUID() + ']';
s += " -> Name: " + b.getSimpleName();
if (b.getBlueprint() == null) {
s += " No Blueprint";
} else {
s += " Blueprint UUID: " + b.getBlueprint().getMeshForRank(0);
}
s += "[" + ((Building) awo).getBlueprintUUID() + ']';
s = index + ")";
s += " ObjectID: " + awo.getObjectUUID() + ']';
s += " -> Name: " + b.getSimpleName();
if (b.getBlueprint() == null) {
s += " No Blueprint";
} else {
s += " Blueprint UUID: " + b.getBlueprint().getMeshForRank(0);
}
s += "[" + ((Building) awo).getBlueprintUUID() + ']';
throwbackInfo(pc, s);
++index;
}
throwbackInfo(pc, s);
++index;
}
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: '" + words
+ "' failed to parse to a Float.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to findBuildings with data: '"
+ words + '\'');
}
}
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: '" + words
+ "' failed to parse to a Float.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to findBuildings with data: '"
+ words + '\'');
}
}
@Override
protected String _getHelpString() {
return "Sets your character's Mana to 'amount'";
}
@Override
protected String _getHelpString() {
return "Sets your character's Mana to 'amount'";
}
@Override
protected String _getUsageString() {
return "' /findBuildings [lat long] [range]'";
}
@Override
protected String _getUsageString() {
return "' /findBuildings [lat long] [range]'";
}
}
+31 -34
View File
@@ -15,54 +15,51 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
*
* @author Eighty
*
*/
public class FlashMsgCmd extends AbstractDevCmd {
public FlashMsgCmd() {
public FlashMsgCmd() {
super("flash");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (args.length != 1 || args[0].isEmpty()) {
this.sendUsage(pcSender);
return;
}
ChatManager.chatSystemFlash(args[0]);
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (args.length != 1 || args[0].isEmpty()) {
this.sendUsage(pcSender);
return;
}
ChatManager.chatSystemFlash(args[0]);
}
/**
* This function is called by the DevCmdManager. Override to avoid splitting
* argString into String array, since flash displays full String as message,
* then calls the subclass specific _doCmd method.
*
*/
/**
* This function is called by the DevCmdManager. Override to avoid splitting
* argString into String array, since flash displays full String as message,
* then calls the subclass specific _doCmd method.
*/
@Override
public void doCmd(PlayerCharacter pcSender, String argString,
AbstractGameObject target) {
String[] args = new String[1];
args[0] = argString;
@Override
public void doCmd(PlayerCharacter pcSender, String argString,
AbstractGameObject target) {
String[] args = new String[1];
args[0] = argString;
if (pcSender == null) {
return;
}
if (pcSender == null) {
return;
}
this._doCmd(pcSender, args, target);
}
this._doCmd(pcSender, args, target);
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /flash message'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Flashes system message to all players";
}
}
}
+61 -62
View File
@@ -7,79 +7,78 @@ import engine.math.Vector3fImmutable;
import engine.objects.*;
public class GateInfoCmd extends AbstractDevCmd {
public GateInfoCmd() {
public GateInfoCmd() {
super("gateinfo");
}
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter player, String[] args,
AbstractGameObject target) {
Building targetBuilding;
String outString;
Runegate runeGate;
Blueprint blueprint;
String newline = "\r\n ";
targetBuilding = (Building)target;
if (targetBuilding.getObjectType() != GameObjectType.Building) {
throwbackInfo(player, "GateInfo: target must be a Building");
throwbackInfo(player, "Found" + targetBuilding.getObjectType().toString());
return;
}
// AbstractDevCmd Overridden methods
blueprint = Blueprint._meshLookup.get(targetBuilding.getMeshUUID());
@Override
protected void _doCmd(PlayerCharacter player, String[] args,
AbstractGameObject target) {
if (blueprint == null ||
(blueprint.getBuildingGroup() != BuildingGroup.RUNEGATE)){
throwbackInfo(player, "showgate: target must be a Runegate");
return;
}
Building targetBuilding;
String outString;
Runegate runeGate;
Blueprint blueprint;
String newline = "\r\n ";
targetBuilding = (Building) target;
runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
outString = "RungateType: " + runeGate.gateBuilding.getName();
outString += newline;
outString += "Portal State:";
outString += newline;
for (Portal portal : runeGate.getPortals()) {
outString += "Portal: " + portal.portalType.name();
outString += " Active: " + portal.isActive();
outString += " Dest: " + portal.targetGate.getName();
outString += newline;
outString += " Origin: " + portal.getPortalLocation().x + 'x';
outString += " " + portal.getPortalLocation().y + 'y';
outString += newline;
Vector3fImmutable offset = portal.getPortalLocation().subtract(targetBuilding.getLoc());
outString += " Offset: " + offset.x + "x " + offset.z + 'y';
outString += newline;
outString += newline;
}
outString += newline;
throwbackInfo(player, outString);
if (targetBuilding.getObjectType() != GameObjectType.Building) {
throwbackInfo(player, "GateInfo: target must be a Building");
throwbackInfo(player, "Found" + targetBuilding.getObjectType().toString());
return;
}
@Override
protected String _getHelpString() {
return "Displays a runegate's gate status";
}
blueprint = Blueprint._meshLookup.get(targetBuilding.getMeshUUID());
@Override
protected String _getUsageString() {
if (blueprint == null ||
(blueprint.getBuildingGroup() != BuildingGroup.RUNEGATE)) {
throwbackInfo(player, "showgate: target must be a Runegate");
return;
}
runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
outString = "RungateType: " + runeGate.gateBuilding.getName();
outString += newline;
outString += "Portal State:";
outString += newline;
for (Portal portal : runeGate.getPortals()) {
outString += "Portal: " + portal.portalType.name();
outString += " Active: " + portal.isActive();
outString += " Dest: " + portal.targetGate.getName();
outString += newline;
outString += " Origin: " + portal.getPortalLocation().x + 'x';
outString += " " + portal.getPortalLocation().y + 'y';
outString += newline;
Vector3fImmutable offset = portal.getPortalLocation().subtract(targetBuilding.getLoc());
outString += " Offset: " + offset.x + "x " + offset.z + 'y';
outString += newline;
outString += newline;
}
outString += newline;
throwbackInfo(player, outString);
}
@Override
protected String _getHelpString() {
return "Displays a runegate's gate status";
}
@Override
protected String _getUsageString() {
return "/gateinfo <target runegate> \n";
}
}
}
+17 -17
View File
@@ -17,36 +17,36 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
*
* @author Eighty
*
*/
public class GetBankCmd extends AbstractDevCmd {
public GetBankCmd() {
public GetBankCmd() {
super("getbank");
}
@Override
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (pcSender == null) return;
AbstractGameObject target) {
if (pcSender == null)
return;
ClientConnection cc = SessionManager.getClientConnection(pcSender);
if (cc == null) return;
ClientConnection cc = SessionManager.getClientConnection(pcSender);
if (cc == null)
return;
VendorDialogMsg.getBank(pcSender, null, cc);
this.setTarget(pcSender); //for logging
}
VendorDialogMsg.getBank(pcSender, null, cc);
this.setTarget(pcSender); //for logging
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /getbank'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Opens bank window";
}
}
}
+12 -12
View File
@@ -16,25 +16,25 @@ import engine.objects.PlayerCharacter;
public class GetCacheCountCmd extends AbstractDevCmd {
public GetCacheCountCmd() {
public GetCacheCountCmd() {
super("getcachecount");
this.addCmdString("getcachecount");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
DbManager.printCacheCount(pcSender);
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
DbManager.printCacheCount(pcSender);
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /getcachecount'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Get a count of the objects in the cache";
}
}
}
+17 -24
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.InterestManagement.HeightMap;
@@ -41,7 +40,7 @@ public class GetHeightCmd extends AbstractDevCmd {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
this.throwbackInfo(pc, "Water Level : " + zone.getSeaLevel());
this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()) );
this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()));
if (end)
return;
@@ -62,9 +61,9 @@ public class GetHeightCmd extends AbstractDevCmd {
//find the next parents heightmap if the currentzone heightmap is null.
while (heightMap == null){
while (heightMap == null) {
if (currentZone == ZoneManager.getSeaFloor()){
if (currentZone == ZoneManager.getSeaFloor()) {
this.throwbackInfo(pc, "Could not find a heightmap to get height.");
break;
}
@@ -76,9 +75,9 @@ public class GetHeightCmd extends AbstractDevCmd {
}
if ( (heightMap == null) || (currentZone == ZoneManager.getSeaFloor()) ) {
this.throwbackInfo(pc, currentZone.getName() + " has no heightmap " );
this.throwbackInfo(pc, "Current altitude: " + currentZone.absY );
if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor())) {
this.throwbackInfo(pc, currentZone.getName() + " has no heightmap ");
this.throwbackInfo(pc, "Current altitude: " + currentZone.absY);
return;
}
@@ -88,8 +87,6 @@ public class GetHeightCmd extends AbstractDevCmd {
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
@@ -99,10 +96,11 @@ public class GetHeightCmd extends AbstractDevCmd {
Vector2f parentZoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone.getParent());
this.throwbackInfo(pc, "Parent Zone Location from Bottom Left : " + parentZoneLoc);
if ((parentZone != null ) && (parentZone.getHeightMap() != null)) {
if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
parentGrid = parentZone.getHeightMap().getGridSquare( parentLoc);
} else parentGrid = new Vector2f(-1,-1);
parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
} else
parentGrid = new Vector2f(-1, -1);
gridSquare = heightMap.getGridSquare(zoneLoc);
gridOffset = HeightMap.getGridOffset(gridSquare);
@@ -110,7 +108,7 @@ public class GetHeightCmd extends AbstractDevCmd {
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
this.throwbackInfo(pc, currentZone.getName());
this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y );
this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y);
this.throwbackInfo(pc, "Grid Offset: " + gridOffset.x + " , " + gridOffset.y);
this.throwbackInfo(pc, "Parent Grid: " + parentGrid.x + " , " + parentGrid.y);
@@ -126,15 +124,15 @@ public class GetHeightCmd extends AbstractDevCmd {
float realWorldAltitude = interaltitude + currentZone.getWorldAltitude();
//OUTSET
if (parentZone != null){
if (parentZone != null) {
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
float bucketScaleX = 100/parentXRadius;
float bucketScaleZ = 200/parentZRadius;
float bucketScaleX = 100 / parentXRadius;
float bucketScaleZ = 200 / parentZRadius;
float outsideGridSizeX = 1 - bucketScaleX; //32/256
float outsideGridSizeZ = 1 - bucketScaleZ;
@@ -143,7 +141,7 @@ public class GetHeightCmd extends AbstractDevCmd {
double scale;
if (offsetX > outsideGridSizeX && offsetX > offsetZ){
if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
@@ -164,7 +162,7 @@ public class GetHeightCmd extends AbstractDevCmd {
outsetALt += currentZone.getParent().getAbsY();
realWorldAltitude = outsetALt;
}else if (offsetZ > outsideGridSizeZ){
} else if (offsetZ > outsideGridSizeZ) {
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
@@ -184,8 +182,6 @@ public class GetHeightCmd extends AbstractDevCmd {
realWorldAltitude = outsetALt;
}
}
@@ -196,7 +192,7 @@ public class GetHeightCmd extends AbstractDevCmd {
strMod += 1f;
float radius = 0;
switch (pc.getRaceID()){
switch (pc.getRaceID()) {
case 2017:
radius = 3.1415927f;
case 2000:
@@ -210,14 +206,11 @@ public class GetHeightCmd extends AbstractDevCmd {
strMod -= .5f;
realWorldAltitude += strMod;
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
}
@Override
+31 -30
View File
@@ -15,43 +15,44 @@ import engine.objects.PlayerCharacter;
public class GetMemoryCmd extends AbstractDevCmd {
public GetMemoryCmd() {
public GetMemoryCmd() {
super("getmemory");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null) return;
public static String getMemoryOutput(long memory) {
String out = "";
if (memory > 1073741824)
return (memory / 1073741824) + "GB";
else if (memory > 1048576)
return (memory / 1048576) + "MB";
else if (memory > 1024)
return (memory / 1048576) + "KB";
else
return memory + "B";
}
String hSize = getMemoryOutput(Runtime.getRuntime().totalMemory());
String mhSize = getMemoryOutput(Runtime.getRuntime().maxMemory());
String fhSize = getMemoryOutput(Runtime.getRuntime().freeMemory());
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
String out = "Heap Size: " + hSize + ", Max Heap Size: " + mhSize + ", Free Heap Size: " + fhSize;
throwbackInfo(pcSender, out);
}
String hSize = getMemoryOutput(Runtime.getRuntime().totalMemory());
String mhSize = getMemoryOutput(Runtime.getRuntime().maxMemory());
String fhSize = getMemoryOutput(Runtime.getRuntime().freeMemory());
public static String getMemoryOutput(long memory) {
String out = "";
if (memory > 1073741824)
return (memory / 1073741824) + "GB";
else if (memory > 1048576)
return (memory / 1048576) + "MB";
else if (memory > 1024)
return (memory / 1048576) + "KB";
else
return memory + "B";
}
String out = "Heap Size: " + hSize + ", Max Heap Size: " + mhSize + ", Free Heap Size: " + fhSize;
throwbackInfo(pcSender, out);
}
@Override
protected String _getUsageString() {
return "' /getmemory'";
}
@Override
protected String _getUsageString() {
return "' /getmemory'";
}
@Override
protected String _getHelpString() {
return "lists memory usage";
}
@Override
protected String _getHelpString() {
return "lists memory usage";
}
}
+20 -21
View File
@@ -18,42 +18,41 @@ import engine.objects.PlayerCharacter;
/**
* @author Eighty
*
*/
public class GetMobBaseLoot extends AbstractDevCmd {
public GetMobBaseLoot() {
public GetMobBaseLoot() {
super("mobbaseloot");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target.getObjectType() != GameObjectType.Mob){
this.throwbackError(pc, "Must be targeting a Valid Mob For this Command.");
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target.getObjectType() != GameObjectType.Mob) {
this.throwbackError(pc, "Must be targeting a Valid Mob For this Command.");
return;
}
Mob mob = (Mob)target;
for (MobLootBase mlb : MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID())){
Mob mob = (Mob) target;
for (MobLootBase mlb : MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID())) {
this.throwbackInfo(pc, "LootTable11 = " + mlb.getLootTableID() + "\rn ");
this.throwbackInfo(pc, "Chance = " + mlb.getChance() + "\rn ");
this.throwbackInfo(pc, "LootTable11 = " + mlb.getLootTableID() + "\rn ");
this.throwbackInfo(pc, "Chance = " + mlb.getChance() + "\rn ");
}
}
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Copies a Mob of type 'mobID' with optional new name";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /mob mobID [name]'";
}
}
}
+34 -33
View File
@@ -17,47 +17,48 @@ import engine.objects.Zone;
public class GetOffsetCmd extends AbstractDevCmd {
public GetOffsetCmd() {
public GetOffsetCmd() {
super("getoffset");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null) return;
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
Zone zone = null;
try {
int loadID = Integer.parseInt(words[0]);
zone = ZoneManager.getZoneByZoneID(loadID);
if (zone == null) {
throwbackError(pcSender, "Error: can't find the zone of ID " + loadID + '.');
return;
}
} catch (Exception e) {
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
}
Zone zone = null;
try {
int loadID = Integer.parseInt(words[0]);
zone = ZoneManager.getZoneByZoneID(loadID);
if (zone == null) {
throwbackError(pcSender, "Error: can't find the zone of ID " + loadID + '.');
return;
}
} catch (Exception e) {
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
}
if (zone == null) {
throwbackError(pcSender, "Error: can't find the zone you're in.");
return;
}
if (zone == null) {
throwbackError(pcSender, "Error: can't find the zone you're in.");
return;
}
float difX = pcSender.getLoc().x - zone.absX;
float difY = pcSender.getLoc().y - zone.absY;
float difZ = pcSender.getLoc().z - zone.absZ;
float difX = pcSender.getLoc().x - zone.absX;
float difY = pcSender.getLoc().y - zone.absY;
float difZ = pcSender.getLoc().z - zone.absZ;
throwbackInfo(pcSender, zone.getName() + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
}
throwbackInfo(pcSender, zone.getName() + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
}
@Override
protected String _getUsageString() {
return "'./getoffset [zoneID]'";
}
@Override
protected String _getUsageString() {
return "'./getoffset [zoneID]'";
}
@Override
protected String _getHelpString() {
return "lists offset from center of zone";
}
@Override
protected String _getHelpString() {
return "lists offset from center of zone";
}
}
+17 -16
View File
@@ -16,27 +16,28 @@ import engine.objects.PlayerCharacter;
public class GetRuneDropRateCmd extends AbstractDevCmd {
public GetRuneDropRateCmd() {
public GetRuneDropRateCmd() {
super("getrunedroprate");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null) return;
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
String out = "Depracated";
throwbackInfo(pcSender, out);
}
String out = "Depracated";
throwbackInfo(pcSender, out);
}
@Override
protected String _getUsageString() {
return "' /getrunedroprate'";
}
@Override
protected String _getUsageString() {
return "' /getrunedroprate'";
}
@Override
protected String _getHelpString() {
return "lists drop rates for runes and contracts in non-hotzone.";
}
@Override
protected String _getHelpString() {
return "lists drop rates for runes and contracts in non-hotzone.";
}
}
+17 -15
View File
@@ -18,30 +18,32 @@ import engine.objects.PlayerCharacter;
public class GetVaultCmd extends AbstractDevCmd {
public GetVaultCmd() {
public GetVaultCmd() {
super("getvault");
}
@Override
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (pcSender == null) return;
AbstractGameObject target) {
if (pcSender == null)
return;
ClientConnection cc = SessionManager.getClientConnection(pcSender);
if (cc == null) return;
ClientConnection cc = SessionManager.getClientConnection(pcSender);
if (cc == null)
return;
VendorDialogMsg.getVault(pcSender, null, cc);
this.setTarget(pcSender); //for logging
}
VendorDialogMsg.getVault(pcSender, null, cc);
this.setTarget(pcSender); //for logging
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /getvault'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Opens account vault";
}
}
}
+36 -35
View File
@@ -19,48 +19,49 @@ import java.util.ArrayList;
public class GetZoneCmd extends AbstractDevCmd {
public GetZoneCmd() {
public GetZoneCmd() {
super("getzone");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null) return;
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
if (words.length != 1) {
this.sendUsage(pcSender);
return;
}
if (words.length != 1) {
this.sendUsage(pcSender);
return;
}
ArrayList<Zone> allIn = new ArrayList<>();
switch (words[0].toLowerCase()) {
case "all":
throwbackInfo(pcSender, "All zones currently in");
allIn = ZoneManager.getAllZonesIn(pcSender.getLoc());
break;
case "smallest":
throwbackInfo(pcSender, "Smallest zone currently in");
Zone zone = ZoneManager.findSmallestZone(pcSender.getLoc());
allIn.add(zone);
break;
default:
this.sendUsage(pcSender);
return;
}
ArrayList<Zone> allIn = new ArrayList<>();
switch (words[0].toLowerCase()) {
case "all":
throwbackInfo(pcSender, "All zones currently in");
allIn = ZoneManager.getAllZonesIn(pcSender.getLoc());
break;
case "smallest":
throwbackInfo(pcSender, "Smallest zone currently in");
Zone zone = ZoneManager.findSmallestZone(pcSender.getLoc());
allIn.add(zone);
break;
default:
this.sendUsage(pcSender);
return;
}
for (Zone zone : allIn)
throwbackInfo(pcSender, zone.getName() + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.getLoadNum());
}
for (Zone zone : allIn)
throwbackInfo(pcSender, zone.getName() + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.getLoadNum());
}
@Override
protected String _getUsageString() {
return "' /getzone smallest/all'";
}
@Override
protected String _getUsageString() {
return "' /getzone smallest/all'";
}
@Override
protected String _getHelpString() {
return "lists what zones a player is in";
}
@Override
protected String _getHelpString() {
return "lists what zones a player is in";
}
}
+50 -48
View File
@@ -18,65 +18,67 @@ import engine.objects.Zone;
public class GetZoneMobsCmd extends AbstractDevCmd {
public GetZoneMobsCmd() {
public GetZoneMobsCmd() {
super("getzonemobs");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null) return;
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
int loadID = 0;
if (words.length == 1) {
try {
loadID = Integer.parseInt(words[0]);
} catch (Exception e) {}
}
int loadID = 0;
if (words.length == 1) {
try {
loadID = Integer.parseInt(words[0]);
} catch (Exception e) {
}
}
//find the zone
Zone zone = null;
if (loadID != 0) {
zone = ZoneManager.getZoneByZoneID(loadID);
if (zone == null)
zone = ZoneManager.getZoneByUUID(loadID);
} else
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
//find the zone
Zone zone = null;
if (loadID != 0) {
zone = ZoneManager.getZoneByZoneID(loadID);
if (zone == null)
zone = ZoneManager.getZoneByUUID(loadID);
} else
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
if (zone == null) {
if (loadID != 0)
throwbackError(pcSender, "Error: can't find the zone of ID " + loadID + '.');
else
throwbackError(pcSender, "Error: can't find the zone you are in.");
return;
}
if (zone == null) {
if (loadID != 0)
throwbackError(pcSender, "Error: can't find the zone of ID " + loadID + '.');
else
throwbackError(pcSender, "Error: can't find the zone you are in.");
return;
}
//get all mobs for the zone
//get all mobs for the zone
throwbackInfo(pcSender, zone.getName() + " (" + zone.getLoadNum() + ") " + zone.getObjectUUID());
throwbackInfo(pcSender, zone.getName() + " (" + zone.getLoadNum() + ") " + zone.getObjectUUID());
for (Mob m : zone.zoneMobSet) {
for (Mob m : zone.zoneMobSet) {
if (m != null) {
String out = m.getName() + '(' + m.getDBID() + "): ";
if (m.isAlive())
out += m.getLoc().x + "x" + m.getLoc().z + "; isAlive: " + m.isAlive();
else
out += " isAlive: " + m.isAlive();
throwbackInfo(pcSender, out);
} else
throwbackInfo(pcSender, "Unknown (" + m.getDBID() + "): not loaded");
}
}
if (m != null) {
String out = m.getName() + '(' + m.getDBID() + "): ";
if (m.isAlive())
out += m.getLoc().x + "x" + m.getLoc().z + "; isAlive: " + m.isAlive();
else
out += " isAlive: " + m.isAlive();
throwbackInfo(pcSender, out);
} else
throwbackInfo(pcSender, "Unknown (" + m.getDBID() + "): not loaded");
}
}
@Override
protected String _getUsageString() {
return "' /getzonemobs [zoneID]'";
}
@Override
protected String _getUsageString() {
return "' /getzonemobs [zoneID]'";
}
@Override
protected String _getHelpString() {
return "lists all mobs for a zone";
}
@Override
protected String _getHelpString() {
return "lists all mobs for a zone";
}
}
+74 -75
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -19,90 +18,90 @@ import engine.objects.PlayerCharacter;
public class GotoBoundsCmd extends AbstractDevCmd {
public GotoBoundsCmd() {
public GotoBoundsCmd() {
super("gotobounds");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
String corner = words[0];
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
if (target == null || !target.getObjectType().equals(GameObjectType.Building)){
this.throwbackError(player, "No Building Selected");
return;
}
Building building = (Building)target;
if (building.getBounds() == null){
this.throwbackInfo(player, "No valid Bounds for building UUID " + building.getObjectUUID());
return;
}
float x = building.getBounds().getHalfExtents().x;
float z = building.getBounds().getHalfExtents().y;
if (building.getBlueprint() != null){
x = building.getBlueprint().getExtents().x;
z = building.getBlueprint().getExtents().y;
}
float topLeftX = building.getLoc().x - x;
float topLeftY = building.getLoc().z -z;
float topRightX = building.getLoc().x + x;
float topRightY = building.getLoc().z - z;
float bottomLeftX = building.getLoc().x - x;
float bottomLeftY = building.getLoc().z + z;
float bottomRightX = building.getLoc().x +x;
float bottomRightY = building.getLoc().z + z;
switch (corner){
case "topleft":
targetLoc = new Vector3fImmutable(topLeftX, 0, topLeftY);
break;
case "topright":
targetLoc = new Vector3fImmutable(topRightX, 0, topRightY);
break;
case "bottomleft":
targetLoc = new Vector3fImmutable(bottomLeftX, 0, bottomLeftY);
break;
case "bottomright":
targetLoc = new Vector3fImmutable(bottomRightX, 0, bottomRightY);
break;
default:
this.throwbackInfo(player, "wrong corner name. use topleft , topright , bottomleft , bottomright");
return;
}
targetLoc = Vector3fImmutable.transform(building.getLoc(),targetLoc , building.getBounds().getRotationDegrees());
// Teleport player
String corner = words[0];
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
if (targetLoc == Vector3fImmutable.ZERO) {
this.throwbackError(player, "Failed to locate UUID");
return;
}
if (target == null || !target.getObjectType().equals(GameObjectType.Building)) {
this.throwbackError(player, "No Building Selected");
return;
}
player.teleport(targetLoc);
Building building = (Building) target;
}
if (building.getBounds() == null) {
this.throwbackInfo(player, "No valid Bounds for building UUID " + building.getObjectUUID());
return;
}
float x = building.getBounds().getHalfExtents().x;
float z = building.getBounds().getHalfExtents().y;
@Override
protected String _getHelpString() {
if (building.getBlueprint() != null) {
x = building.getBlueprint().getExtents().x;
z = building.getBlueprint().getExtents().y;
}
float topLeftX = building.getLoc().x - x;
float topLeftY = building.getLoc().z - z;
float topRightX = building.getLoc().x + x;
float topRightY = building.getLoc().z - z;
float bottomLeftX = building.getLoc().x - x;
float bottomLeftY = building.getLoc().z + z;
float bottomRightX = building.getLoc().x + x;
float bottomRightY = building.getLoc().z + z;
switch (corner) {
case "topleft":
targetLoc = new Vector3fImmutable(topLeftX, 0, topLeftY);
break;
case "topright":
targetLoc = new Vector3fImmutable(topRightX, 0, topRightY);
break;
case "bottomleft":
targetLoc = new Vector3fImmutable(bottomLeftX, 0, bottomLeftY);
break;
case "bottomright":
targetLoc = new Vector3fImmutable(bottomRightX, 0, bottomRightY);
break;
default:
this.throwbackInfo(player, "wrong corner name. use topleft , topright , bottomleft , bottomright");
return;
}
targetLoc = Vector3fImmutable.transform(building.getLoc(), targetLoc, building.getBounds().getRotationDegrees());
// Teleport player
if (targetLoc == Vector3fImmutable.ZERO) {
this.throwbackError(player, "Failed to locate UUID");
return;
}
player.teleport(targetLoc);
}
@Override
protected String _getHelpString() {
return "Teleports player to a UUID";
}
}
@Override
protected String _getUsageString() {
return "' /gotoobj <UID>'";
@Override
protected String _getUsageString() {
return "' /gotoobj <UID>'";
}
}
}
+130 -131
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -22,161 +21,161 @@ import java.util.concurrent.ThreadLocalRandom;
public class GotoCmd extends AbstractDevCmd {
public GotoCmd() {
public GotoCmd() {
super("goto");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Vector3fImmutable loc = null;
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Vector3fImmutable loc = null;
// Arg Count Check
// Arg Count Check
if (target != null && words[0].isEmpty()){
AbstractWorldObject targetAgo = (AbstractWorldObject)target;
pc.teleport(targetAgo.getLoc());
return;
}
if (target != null && words[0].isEmpty()) {
AbstractWorldObject targetAgo = (AbstractWorldObject) target;
pc.teleport(targetAgo.getLoc());
return;
}
if (words[0].isEmpty()){
this.sendUsage(pc);
return;
}
if (words[0].isEmpty()) {
this.sendUsage(pc);
return;
}
if (words[0].equalsIgnoreCase("playground")){
if (target instanceof AbstractCharacter){
loc = new Vector3fImmutable(63276,0,-54718);
}
if (words[0].equalsIgnoreCase("playground")) {
if (target instanceof AbstractCharacter) {
loc = new Vector3fImmutable(63276, 0, -54718);
}
if (loc != null)
pc.teleport(loc);
if (loc != null)
pc.teleport(loc);
return;
}
if (words[0].equalsIgnoreCase("coc")){
if (target instanceof AbstractCharacter){
loc = new Vector3fImmutable(98561.656f,0,-13353.778f);
}
return;
}
if (loc != null)
pc.teleport(loc);
if (words[0].equalsIgnoreCase("coc")) {
if (target instanceof AbstractCharacter) {
loc = new Vector3fImmutable(98561.656f, 0, -13353.778f);
}
return;
}
if (loc != null)
pc.teleport(loc);
String cityName = "";
for (String partial: words){
cityName += partial + ' ';
}
return;
}
cityName = cityName.substring(0, cityName.length() - 1);
String cityName = "";
for (String partial : words) {
cityName += partial + ' ';
}
for (AbstractGameObject cityAgo: DbManager.getList(GameObjectType.City)){
City city = (City)cityAgo;
if (city == null)
continue;
if (!city.getCityName().equalsIgnoreCase(cityName))
continue;
Zone zone = city.getParent();
if (zone != null){
if (zone.isNPCCity() || zone.isPlayerCity())
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else
loc = zone.getLoc();
cityName = cityName.substring(0, cityName.length() - 1);
int random = ThreadLocalRandom.current().nextInt(5);
if (random == 1)
break;
}
}
for (AbstractGameObject cityAgo : DbManager.getList(GameObjectType.City)) {
City city = (City) cityAgo;
if (city == null)
continue;
if (!city.getCityName().equalsIgnoreCase(cityName))
continue;
Zone zone = city.getParent();
if (zone != null) {
if (zone.isNPCCity() || zone.isPlayerCity())
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else
loc = zone.getLoc();
if (loc == null){
for (AbstractGameObject zoneAgo: DbManager.getList(GameObjectType.Zone)){
Zone zone = (Zone)zoneAgo;
if (zone == null)
continue;
if (!zone.getName().equalsIgnoreCase(cityName))
continue;
if (zone != null){
if (zone.isNPCCity() || zone.isPlayerCity())
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else
loc = zone.getLoc();
int random = ThreadLocalRandom.current().nextInt(5);
if (random == 1)
break;
}
}
int random = ThreadLocalRandom.current().nextInt(5);
if (random == 1)
break;
}
}
}
if (loc == null && words.length == 1){
if (loc == null) {
for (AbstractGameObject zoneAgo : DbManager.getList(GameObjectType.Zone)) {
Zone zone = (Zone) zoneAgo;
if (zone == null)
continue;
if (!zone.getName().equalsIgnoreCase(cityName))
continue;
if (zone != null) {
if (zone.isNPCCity() || zone.isPlayerCity())
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else
loc = zone.getLoc();
try {
PlayerCharacter pcDest = SessionManager
.getPlayerCharacterByLowerCaseName(words[0]);
if (pcDest == null){
this.throwbackError(pc, "Player or Zone not found by name: "
+ words[0]);
this.throwbackInfo(pc, "If you have spaces in the zone name, replace them with '_'");
return;
}
int random = ThreadLocalRandom.current().nextInt(5);
if (random == 1)
break;
}
}
}
if (loc == null && words.length == 1) {
if (pcDest.getCombinedName().equals(pc.getCombinedName())) {
this
.throwbackError(pc,
"Cannot goto yourself. Well, you can, but you wont go anywhere.");
return;
}
try {
PlayerCharacter pcDest = SessionManager
.getPlayerCharacterByLowerCaseName(words[0]);
if (pcDest == null) {
this.throwbackError(pc, "Player or Zone not found by name: "
+ words[0]);
this.throwbackInfo(pc, "If you have spaces in the zone name, replace them with '_'");
return;
}
loc = pcDest.getLoc();
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to goto a character named '"
+ words[0] + '\'');
return;
}
if (pcDest.getCombinedName().equals(pc.getCombinedName())) {
this
.throwbackError(pc,
"Cannot goto yourself. Well, you can, but you wont go anywhere.");
return;
}
}
if (loc == null) { // lat lon mode
if (words.length != 2) {
throwbackError(pc, this.getUsageString());
return;
}
float lat = 0.0f, lon = 0.0f;
String latLong = '\'' + words[0] + ", " + words[1] + '\'';
loc = pcDest.getLoc();
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to goto a character named '"
+ words[0] + '\'');
return;
}
try {
lat = Float.parseFloat(words[0]);
lon = Float.parseFloat(words[1]);
loc = new Vector3fImmutable(lat, 0f, -lon);
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied LatLong: " + latLong
+ " failed to parse to Floats");
return;
}
if (loc == null) { // lat lon mode
if (words.length != 2) {
throwbackError(pc, this.getUsageString());
return;
}
float lat = 0.0f, lon = 0.0f;
String latLong = '\'' + words[0] + ", " + words[1] + '\'';
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to goto LatLong of "
+ latLong);
return;
}
}
if (loc != null) {
pc.teleport(loc);
}
}
try {
lat = Float.parseFloat(words[0]);
lon = Float.parseFloat(words[1]);
loc = new Vector3fImmutable(lat, 0f, -lon);
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied LatLong: " + latLong
+ " failed to parse to Floats");
return;
@Override
protected String _getHelpString() {
return "Alters your characters position TO 'lat' and 'long', or TO the position of 'characterName'. This does not transport you BY 'lat' and 'long', but rather TO 'lat' and 'long' ";
}
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to goto LatLong of "
+ latLong);
return;
}
}
if (loc != null) {
pc.teleport(loc);
}
}
@Override
protected String _getUsageString() {
return "'[ /goto lat lon] || [ /goto characterName] || [/goto zoneName \replace spaces with `_`]`";
}
@Override
protected String _getHelpString() {
return "Alters your characters position TO 'lat' and 'long', or TO the position of 'characterName'. This does not transport you BY 'lat' and 'long', but rather TO 'lat' and 'long' ";
}
@Override
protected String _getUsageString() {
return "'[ /goto lat lon] || [ /goto characterName] || [/goto zoneName \replace spaces with `_`]`";
}
}
+60 -61
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum;
@@ -18,86 +17,86 @@ import engine.objects.*;
public class GotoObj extends AbstractDevCmd {
public GotoObj() {
public GotoObj() {
super("gotoobj");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
int uuid;
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
Enum.DbObjectType objectType;
int uuid;
Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
Enum.DbObjectType objectType;
try {
uuid = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
this.throwbackError(player, "Failed to parse UUID" + e.toString());
return;
}
try {
uuid = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
this.throwbackError(player, "Failed to parse UUID" + e.toString());
return;
}
objectType = DbManager.BuildingQueries.GET_UID_ENUM(uuid);
objectType = DbManager.BuildingQueries.GET_UID_ENUM(uuid);
switch (objectType) {
switch (objectType) {
case NPC:
NPC npc = (NPC) DbManager.getFromCache(Enum.GameObjectType.NPC, uuid);
case NPC:
NPC npc = (NPC) DbManager.getFromCache(Enum.GameObjectType.NPC, uuid);
if (npc != null)
targetLoc = npc.getLoc();
break;
case MOB:
Mob mob = (Mob) DbManager.getFromCache(Enum.GameObjectType.Mob, uuid);
if (npc != null)
targetLoc = npc.getLoc();
break;
case MOB:
Mob mob = (Mob) DbManager.getFromCache(Enum.GameObjectType.Mob, uuid);
if (mob != null)
targetLoc = mob.getLoc();
break;
case CHARACTER:
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, uuid);
if (mob != null)
targetLoc = mob.getLoc();
break;
case CHARACTER:
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, uuid);
if (playerCharacter != null)
targetLoc = playerCharacter.getLoc();
break;
case BUILDING:
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
if (playerCharacter != null)
targetLoc = playerCharacter.getLoc();
break;
case BUILDING:
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
if (building != null)
targetLoc = building.getLoc();
break;
case ZONE:
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, uuid);
if (building != null)
targetLoc = building.getLoc();
break;
case ZONE:
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, uuid);
if (zone != null)
targetLoc = zone.getLoc();
break;
case CITY:
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, uuid);
if (zone != null)
targetLoc = zone.getLoc();
break;
case CITY:
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, uuid);
if (city != null)
targetLoc = city.getLoc();
break;
}
// Teleport player
if (city != null)
targetLoc = city.getLoc();
break;
}
// Teleport player
if (targetLoc == Vector3fImmutable.ZERO) {
this.throwbackError(player, "Failed to locate UUID");
return;
}
if (targetLoc == Vector3fImmutable.ZERO) {
this.throwbackError(player, "Failed to locate UUID");
return;
}
player.teleport(targetLoc);
player.teleport(targetLoc);
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Teleports player to a UUID";
}
}
@Override
protected String _getUsageString() {
return "' /gotoobj <UID>'";
@Override
protected String _getUsageString() {
return "' /gotoobj <UID>'";
}
}
}
+17 -18
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.ai.MobileFSMManager;
@@ -18,30 +17,30 @@ import engine.objects.PlayerCharacter;
public class HeartbeatCmd extends AbstractDevCmd {
public HeartbeatCmd() {
public HeartbeatCmd() {
super("heartbeat");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
this.throwbackInfo(pc, "Heartbeat : " + SimulationManager.executionTime.toMillis() + "ms");
this.throwbackInfo(pc, "Heartbeat Max: " + SimulationManager.executionMax.toMillis() + "ms");
this.throwbackInfo(pc, "Heartbeat : " + SimulationManager.executionTime.toMillis() + "ms");
this.throwbackInfo(pc, "Heartbeat Max: " + SimulationManager.executionMax.toMillis() + "ms");
this.throwbackInfo(pc, "FSM: " + MobileFSMManager.executionTime.toMillis() + "ms");
this.throwbackInfo(pc, "FSM max: " + MobileFSMManager.executionMax.toMillis() + "ms");
this.throwbackInfo(pc, "FSM: " + MobileFSMManager.executionTime.toMillis() + "ms");
this.throwbackInfo(pc, "FSM max: " + MobileFSMManager.executionMax.toMillis() + "ms");
}
}
@Override
protected String _getHelpString() {
return "Displays simulation metrics";
}
@Override
protected String _getHelpString() {
return "Displays simulation metrics";
}
@Override
protected String _getUsageString() {
return "' ./heartbeat";
}
@Override
protected String _getUsageString() {
return "' ./heartbeat";
}
}
+16 -16
View File
@@ -16,14 +16,14 @@ import engine.objects.PlayerCharacter;
public class HelpCmd extends AbstractDevCmd {
public HelpCmd() {
super("help");
this.addCmdString("list");
}
public HelpCmd() {
super("help");
this.addCmdString("list");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (pcSender == null)
return;
if (pcSender.getAccount() == null)
@@ -42,18 +42,18 @@ public class HelpCmd extends AbstractDevCmd {
first = charLimit;
charLimit += 500;
last = charLimit;
}
this.throwbackInfo(pcSender, commands.substring(first));
}
}
this.throwbackInfo(pcSender, commands.substring(first));
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /help' || ' /list'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Displays help info and lists all commands accessible for the player's access level.";
}
}
}
+1 -1
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -63,6 +62,7 @@ public class HotzoneCmd extends AbstractDevCmd {
return;
}
@Override
protected String _getHelpString() {
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
+467 -468
View File
@@ -26,515 +26,514 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* @author
*
*/
public class InfoCmd extends AbstractDevCmd {
public InfoCmd() {
super("info");
}
public InfoCmd() {
super("info");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (pc == null) {
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (pc == null) {
return;
}
String newline = "\r\n ";
String newline = "\r\n ";
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) {
}
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) {
}
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;
}
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;
}
GameObjectType objType = target.getObjectType();
int objectUUID = target.getObjectUUID();
String output;
GameObjectType objType = target.getObjectType();
int objectUUID = target.getObjectUUID();
String output;
output = "Target Information:" + newline;
output += StringUtils.addWS("UUID: " + objectUUID, 20);
output += newline;
output += "Type: " + target.getClass().getSimpleName();
output += " [0x" + objType.toString() + ']';
output = "Target Information:" + newline;
output += StringUtils.addWS("UUID: " + objectUUID, 20);
output += newline;
output += "Type: " + target.getClass().getSimpleName();
output += " [0x" + objType.toString() + ']';
if (target instanceof AbstractWorldObject) {
AbstractWorldObject targetAWO = (AbstractWorldObject) target;
Vector3fImmutable targetLoc = targetAWO.getLoc();
output += newline;
output += StringUtils.addWS("Lat: " + targetLoc.x, 20);
output += "Lon: " + -targetLoc.z;
output += newline;
output += StringUtils.addWS("Alt: " + targetLoc.y, 20);
output += newline;
output += "Rot: " + targetAWO.getRot().y;
output += newline;
double radian = 0;
if (targetAWO.getBounds() != null && targetAWO.getBounds().getQuaternion() != null)
radian = targetAWO.getBounds().getQuaternion().angleY;
int degrees = (int) Math.toDegrees(radian);
output += "Degrees: " + degrees;
output += newline;
}
switch (objType) {
case Building:
Building targetBuilding = (Building) target;
output += StringUtils.addWS("Lac: "
+ targetBuilding.getw(), 20);
output += "Blueprint : ";
output += targetBuilding.getBlueprintUUID();
output += newline;
output += " MeshUUID : ";
output += targetBuilding.getMeshUUID();
output += newline;
if (targetBuilding.getBlueprintUUID() != 0)
output += ' ' + targetBuilding.getBlueprint().getName();
output += newline;
output += targetBuilding.getBlueprint() != null ? targetBuilding.getBlueprint().getBuildingGroup().name(): " no building group";
output += newline;
output += "EffectFlags: " + targetBuilding.getEffectFlags();
output += newline;
output += StringUtils.addWS("rank: " + targetBuilding.getRank(),
20);
output += "HP: " + targetBuilding.getHealth() + '/'
+ targetBuilding.getMaxHitPoints();
output += newline;
output += "Scale: (" + targetBuilding.getMeshScale().getX();
output += ", " + targetBuilding.getMeshScale().getY();
output += ", " + targetBuilding.getMeshScale().getZ() + ')';
output += newline;
output += "Owner UID: " + targetBuilding.getOwnerUUID();
output += (targetBuilding.isOwnerIsNPC() ? " (NPC)" : " (PC)");
output += newline;
output += "ProtectionState: " + targetBuilding.getProtectionState().name();
output += newline;
if (targetBuilding.getUpgradeDateTime() != null) {
output += targetBuilding.getUpgradeDateTime().toString();
output += newline;
}
Guild guild = targetBuilding.getGuild();
Guild nation = null;
String guildId = "-1";
String nationId = "-1";
String gTag = "";
String nTag = "";
if (guild != null) {
int id = guild.getObjectUUID();
if (id == 0) {
guildId = id + " [" + guild.hashCode() + ']';
} else
guildId = Integer.toString(id);
gTag = guild.getGuildTag().summarySentence();
nation = guild.getNation();
if (nation != null) {
id = nation.getObjectUUID();
if (id == 0) {
nationId = id + " [" + nation.hashCode() + ']';
} else {
nationId = Integer.toString(id);
}
nTag = nation.getGuildTag().summarySentence();
}
}
output += StringUtils.addWS("Guild UID: " + guildId, 20);
if (gTag.length() > 0)
output += "Guild crest: " + gTag;
output += newline;
output += StringUtils.addWS("Nation UID: " + nationId, 20);
if (nTag.length() > 0) {
output += "Nation crest: " + nTag;
}
output+= newline;
if (targetBuilding.getBlueprint() != null){
if(targetBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.MINE){
Mine mine = Mine.getMineFromTower(targetBuilding.getObjectUUID());
if (mine != null){
output+= newline;
output+= "Mine active: " + mine.getIsActive();
output+= newline;
output+= "Was claimed: " + mine.wasClaimed;
output+= newline;
output+= "Mine Type: "+mine.getMineType().name;
output+= newline;
output+= "Expansion : " + mine.isExpansion();
output+= newline;
output+= "Production type: " +mine.getProduction().name();
}
}
output += newline;
if (targetBuilding.maintDateTime != null){
output += targetBuilding.maintDateTime.toString();
output+= newline;
}
}
output += "Reserve : " + targetBuilding.reserve;
output+= newline;
output += "Strongbox : " + targetBuilding.getStrongboxValue();
output+= newline;
// List hirelings
if (targetBuilding.getHirelings().isEmpty() == false) {
output += newline;
output += "Hirelings List: name / slot / floor";
for (AbstractCharacter npc : targetBuilding.getHirelings().keySet()) {
if (npc.getObjectType() != GameObjectType.NPC)
continue;
output += newline + npc.getName() + " slot " + targetBuilding.getHirelings().get(npc);
output += newline + "location " + npc.getLoc();
}
}
ArrayList<BuildingRegions> tempList = BuildingRegions._staticRegions.get(targetBuilding.getMeshUUID());
output+= newline;
output+= "Building Regions: Size - " + tempList.size();
output+= newline;
output+= "Building Regions from Bounds: Size - " + targetBuilding.getBounds().getRegions().size();
output+= newline;
for (Regions regions: targetBuilding.getBounds().getRegions()){
//TODO ADD REGION INFO
}
break;
case PlayerCharacter:
output += newline;
PlayerCharacter targetPC = (PlayerCharacter) target;
output += StringUtils.addWS("Name: " + targetPC.getName(), 20);
output += newline;
output += "InSession : " + SessionManager.getPlayerCharacterByID(target.getObjectUUID()) != null ? " true " : " false";
output += newline;
output += "RaceType: " + targetPC.getRace().getRaceType().name();
output += newline;
output += "Race: " + targetPC.getRace().getName();
output += newline;
output += "Safe:" + targetPC.inSafeZone();
output+= newline;
output+= "Experience : " + targetPC.getExp();
if (target instanceof AbstractWorldObject) {
AbstractWorldObject targetAWO = (AbstractWorldObject) target;
Vector3fImmutable targetLoc = targetAWO.getLoc();
output += newline;
output += "OverFlowExperience : " + targetPC.getOverFlowEXP();
output += StringUtils.addWS("Lat: " + targetLoc.x, 20);
output += "Lon: " + -targetLoc.z;
output += newline;
output += StringUtils.addWS("Level: "
+ targetPC.getLevel() + " (" +
TargetColor.getCon(targetPC, pc).toString() + ')', 20);
output += StringUtils.addWS("Alt: " + targetLoc.y, 20);
output += newline;
output += "Rot: " + targetAWO.getRot().y;
output += newline;
double radian = 0;
Account acpc = SessionManager.getAccount(pc);
Account ac = SessionManager.getAccount(targetPC);
if (acpc != null && ac != null) {
output += "Account ID: " + ac.getObjectUUID();
if (targetAWO.getBounds() != null && targetAWO.getBounds().getQuaternion() != null)
radian = targetAWO.getBounds().getQuaternion().angleY;
int degrees = (int) Math.toDegrees(radian);
output += "Degrees: " + degrees;
output += newline;
}
switch (objType) {
case Building:
Building targetBuilding = (Building) target;
output += StringUtils.addWS("Lac: "
+ targetBuilding.getw(), 20);
output += "Blueprint : ";
output += targetBuilding.getBlueprintUUID();
output += newline;
output += "Access Level: " + ac.status.name();
} else
output += "Account ID: UNKNOWN";
output += newline;
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
output += newline;
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
output += newline;
output += "ALTITUDE :"+ targetPC.getAltitude();
output += newline;
output += "BuildingID :"+ targetPC.getInBuildingID();
output += newline;
output += "inBuilding :"+ targetPC.getInBuilding();
output += newline;
output += "inFloor :"+ targetPC.getInFloorID();
output += newline;
output += " MeshUUID : ";
output += targetBuilding.getMeshUUID();
output += newline;
BaseClass baseClass = targetPC.getBaseClass();
if (targetBuilding.getBlueprintUUID() != 0)
output += ' ' + targetBuilding.getBlueprint().getName();
if (baseClass != null)
output += StringUtils.addWS("Class: " + baseClass.getName(), 20);
else
output += StringUtils.addWS("", 20);
output += newline;
output += targetBuilding.getBlueprint() != null ? targetBuilding.getBlueprint().getBuildingGroup().name() : " no building group";
PromotionClass promotionClass = targetPC.getPromotionClass();
if (promotionClass != null) {
output += "Pro. Class: " + promotionClass.getName();
} else {
output += "Pro. Class: ";
}
output += newline;
output += "EffectFlags: " + targetBuilding.getEffectFlags();
output += newline;
output += StringUtils.addWS("rank: " + targetBuilding.getRank(),
20);
output += "HP: " + targetBuilding.getHealth() + '/'
+ targetBuilding.getMaxHitPoints();
output += newline;
output += "Scale: (" + targetBuilding.getMeshScale().getX();
output += ", " + targetBuilding.getMeshScale().getY();
output += ", " + targetBuilding.getMeshScale().getZ() + ')';
output += newline;
output += "Owner UID: " + targetBuilding.getOwnerUUID();
output += (targetBuilding.isOwnerIsNPC() ? " (NPC)" : " (PC)");
output += newline;
output += "ProtectionState: " + targetBuilding.getProtectionState().name();
output += newline;
output += newline;
output += "====Guild Info====";
output += newline;
if (targetPC.getGuild() != null){
output += "Name: " + targetPC.getGuild().getName();
output += newline;
output += "State: " + targetPC.getGuild().getGuildState();
output += newline;
output += "Realms Owned:" +targetPC.getGuild().getRealmsOwned();
output += newline;
output += "====Nation====";
output += newline;
output += "Nation Name: " + targetPC.getGuild().getNation().getName();
output += newline;
output += "Nation State: " + targetPC.getGuild().getNation().getGuildState();
output += newline;
output += "Realms Owned:" +targetPC.getGuild().getNation().getRealmsOwned();
output += newline;
output += "Guild Rank:" +(GuildStatusController.getRank(targetPC.getGuildStatus()) + targetPC.getGuild().getRealmsOwnedFlag());
}
if (targetBuilding.getUpgradeDateTime() != null) {
output += targetBuilding.getUpgradeDateTime().toString();
output += newline;
}
output += newline;
output += "Movement State: " + targetPC.getMovementState().name();
output += newline;
output += "Movement Speed: " + targetPC.getSpeed();
Guild guild = targetBuilding.getGuild();
Guild nation = null;
String guildId = "-1";
String nationId = "-1";
String gTag = "";
String nTag = "";
output += "Altitude : " + targetPC.getLoc().y;
if (guild != null) {
int id = guild.getObjectUUID();
output += "Swimming : " + targetPC.isSwimming();
output += newline;
output += "isMoving : " + targetPC.isMoving();
if (id == 0) {
guildId = id + " [" + guild.hashCode() + ']';
} else
guildId = Integer.toString(id);
break;
gTag = guild.getGuildTag().summarySentence();
nation = guild.getNation();
case NPC:
NPC targetNPC = (NPC) target;
output += "databaseID: " + targetNPC.getDBID() + newline;
output += "Name: " + targetNPC.getName();
output += newline;
output += StringUtils.addWS("Level: " + targetNPC.getLevel(), 20);
if (nation != null) {
id = nation.getObjectUUID();
if (id == 0) {
nationId = id + " [" + nation.hashCode() + ']';
} else {
nationId = Integer.toString(id);
}
nTag = nation.getGuildTag().summarySentence();
}
}
output += StringUtils.addWS("Guild UID: " + guildId, 20);
MobBase mobBase;
if (gTag.length() > 0)
output += "Guild crest: " + gTag;
if (targetNPC.getContract() == null)
mobBase = targetNPC.getMobBase();
else
mobBase = MobBase.getMobBase(targetNPC.getContract().getMobbaseID());
output += newline;
output += StringUtils.addWS("Nation UID: " + nationId, 20);
if (mobBase != null) {
output += "Mobbbase: " + mobBase.getObjectUUID();
output += newline;
output += "Flags: " + mobBase.getFlags().toString();
}
if (nTag.length() > 0) {
output += "Nation crest: " + nTag;
}
output += newline;
output += "Spawn: (" + targetNPC.getBindLoc().getX();
output += ", " + targetNPC.getBindLoc().getY();
output += ", " + targetNPC.getBindLoc().getZ() + ')';
output += newline;
output += "ContractID: " + targetNPC.getContractID();
output += newline;
output += "InventorySet: " + targetNPC.getContract().inventorySet;
output += newline;
output += targetNPC.getContract().getAllowedBuildings().toString();
output += newline;
output += "Extra Rune: " + targetNPC.getContract().getExtraRune();
output += newline;
output += newline;
output += "isTrainer: " + targetNPC.getContract().isTrainer();
output += newline;
output += "Buy Cost: " + targetNPC.getBuyPercent();
output += "\tSell Cost: " + targetNPC.getSellPercent();
output += newline;
output += "fromInit: " + targetNPC.isStatic();
output += newline;
if (mobBase != null) {
output += newline;
output += "Slottable: " + targetNPC.getContract().getAllowedBuildings().toString();
output += newline;
output += "EquipSet: " + targetNPC.getEquipmentSetID();
output += newline;
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
}
if (targetBuilding.getBlueprint() != null) {
if (targetNPC.region != null) {
output += newline;
output += "Region found: " + "Building : " + targetNPC.region.parentBuildingID + newline;
output += "building level : " + targetNPC.region.level + newline;
output += "building room : " + targetNPC.region.room + newline;
} else {
output += newline;
output += "No region was found.";
}
if (targetBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.MINE) {
Mine mine = Mine.getMineFromTower(targetBuilding.getObjectUUID());
if (targetNPC.getBuilding() != null) {
output += newline;
output += "Building : " + targetNPC.getBuilding();
} else {
output += newline;
output += "No building found.";
}
break;
case Mob:
Mob targetMob = (Mob) target;
output += "databaseID: " + targetMob.getDBID() + newline;
output += "Name: " + targetMob.getName();
output += newline;
output += StringUtils.addWS("Level: " + targetMob.getLevel(), 20);
mobBase = targetMob.getMobBase();
if (mobBase != null)
output += "RaceID: " + mobBase.getObjectUUID();
else
output += "RaceID: " + targetMob.getLoadID();
output += newline;
try {
output += "notEnemy: " + targetMob.notEnemy.toString();
output += newline;
output += "enemy: " + targetMob.enemy.toString();
output += newline;
}
catch(Exception ex){
//who cares its info
}
output += "Spawn: (" + targetMob.getBindLoc().getX();
output += ", " + targetMob.getBindLoc().getY();
output += ", " + targetMob.getBindLoc().getZ() + ')';
output += newline;
if (targetMob.isPet()) {
output += "isPet: true";
output+= newline;
if (targetMob.isSummonedPet())
output += "isSummonedPet: true";
else output += "isSummonedPet: false";
PlayerCharacter owner = targetMob.getOwner();
if (owner != null)
output += " owner: " + owner.getObjectUUID();
output += newline;
output += "assist: " + targetMob.assist() + " resting: " + targetMob.isSit();
output += newline;
}
if (targetMob.getMobBase() != null) {
output += "Mobbase: " + targetMob.getMobBase().getObjectUUID();
output += newline;
output += "Flags: " + targetMob.getMobBase().getFlags().toString();
output += newline;
if (mine != null) {
output += newline;
output += "Mine active: " + mine.getIsActive();
output += newline;
output += "Was claimed: " + mine.wasClaimed;
output += newline;
output += "Mine Type: " + mine.getMineType().name;
output += newline;
output += "Expansion : " + mine.isExpansion();
output += newline;
output += "Production type: " + mine.getProduction().name();
}
if (targetMob.isMob()) {
output += "SpawnRadius: " + targetMob.getSpawnRadius();
output += newline;
output += "Spawn Timer: " + targetMob.getSpawnTimeAsString();
output += newline;
}
output += StringUtils.addWS("isAlive: "
+ targetMob.isAlive(), 20);
output += newline;
//output += "Mob State: " + targetMob.state.name();
}
}
output += newline;
output += newline;
output += "Speed : " + targetMob.getSpeed();
output += newline;
output += "EquipSet: " + targetMob.equipmentSetID;
output += newline;
try {
output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
} catch(Exception ex){
//who cares
}
output += newline;
output += "isMoving : " + targetMob.isMoving();
if (targetMob.region != null) {
output += newline;
output += "BuildingID : " + targetMob.region.parentBuildingID;
output += "building level : " + targetMob.region.level;
output += "building room : " + targetMob.region.room;
}
if (targetMob.building != null) {
output += "Building Name: " + targetMob.building.getName() + newline;
output += "BuildingID : " + targetMob.building + newline;
output += "Bind Loc : " + targetMob.getBindLoc() + newline;
output += "Curr Loc : " + targetMob.getLoc() + newline;
}else{
output += newline;
output += "No building found.";
}
break;
case Item: //intentional passthrough
case MobLoot:
Item item = (Item) target;
ItemBase itemBase = item.getItemBase();
output += StringUtils.addWS("ItemBase: " + itemBase.getUUID(), 20);
output += "Weight: " + itemBase.getWeight();
output += newline;
DecimalFormat df = new DecimalFormat("###,###,###,###,##0");
output += StringUtils.addWS("Qty: "
+ df.format(item.getNumOfItems()), 20);
output += "Charges: " + item.getChargesRemaining()
+ '/' + item.getChargesMax();
output += newline;
output += "Name: " + itemBase.getName();
output += newline;
output += item.getContainerInfo();
if (targetBuilding.maintDateTime != null) {
output += targetBuilding.maintDateTime.toString();
output += newline;
}
}
throwbackInfo(pc, output);
output += "Reserve : " + targetBuilding.reserve;
output += newline;
output += "Strongbox : " + targetBuilding.getStrongboxValue();
output += newline;
output = "Effects:" + newline;
ConcurrentHashMap<String, Effect> effects = item.getEffects();
for (String name : effects.keySet()) {
Effect eff = effects.get(name);
output+= eff.getEffectsBase().getIDString();
output+= newline;
// output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
}
// List hirelings
break;
}
if (targetBuilding.getHirelings().isEmpty() == false) {
throwbackInfo(pc, output);
}
output += newline;
output += "Hirelings List: name / slot / floor";
@Override
protected String _getHelpString() {
return "Gets information on an Object.";
}
for (AbstractCharacter npc : targetBuilding.getHirelings().keySet()) {
@Override
protected String _getUsageString() {
return "' /info targetID'";
}
if (npc.getObjectType() != GameObjectType.NPC)
continue;
output += newline + npc.getName() + " slot " + targetBuilding.getHirelings().get(npc);
output += newline + "location " + npc.getLoc();
}
}
ArrayList<BuildingRegions> tempList = BuildingRegions._staticRegions.get(targetBuilding.getMeshUUID());
output += newline;
output += "Building Regions: Size - " + tempList.size();
output += newline;
output += "Building Regions from Bounds: Size - " + targetBuilding.getBounds().getRegions().size();
output += newline;
for (Regions regions : targetBuilding.getBounds().getRegions()) {
//TODO ADD REGION INFO
}
break;
case PlayerCharacter:
output += newline;
PlayerCharacter targetPC = (PlayerCharacter) target;
output += StringUtils.addWS("Name: " + targetPC.getName(), 20);
output += newline;
output += "InSession : " + SessionManager.getPlayerCharacterByID(target.getObjectUUID()) != null ? " true " : " false";
output += newline;
output += "RaceType: " + targetPC.getRace().getRaceType().name();
output += newline;
output += "Race: " + targetPC.getRace().getName();
output += newline;
output += "Safe:" + targetPC.inSafeZone();
output += newline;
output += "Experience : " + targetPC.getExp();
output += newline;
output += "OverFlowExperience : " + targetPC.getOverFlowEXP();
output += newline;
output += StringUtils.addWS("Level: "
+ targetPC.getLevel() + " (" +
TargetColor.getCon(targetPC, pc).toString() + ')', 20);
Account acpc = SessionManager.getAccount(pc);
Account ac = SessionManager.getAccount(targetPC);
if (acpc != null && ac != null) {
output += "Account ID: " + ac.getObjectUUID();
output += newline;
output += "Access Level: " + ac.status.name();
} else
output += "Account ID: UNKNOWN";
output += newline;
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
output += newline;
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
output += newline;
output += "ALTITUDE :" + targetPC.getAltitude();
output += newline;
output += "BuildingID :" + targetPC.getInBuildingID();
output += newline;
output += "inBuilding :" + targetPC.getInBuilding();
output += newline;
output += "inFloor :" + targetPC.getInFloorID();
output += newline;
BaseClass baseClass = targetPC.getBaseClass();
if (baseClass != null)
output += StringUtils.addWS("Class: " + baseClass.getName(), 20);
else
output += StringUtils.addWS("", 20);
PromotionClass promotionClass = targetPC.getPromotionClass();
if (promotionClass != null) {
output += "Pro. Class: " + promotionClass.getName();
} else {
output += "Pro. Class: ";
}
output += newline;
output += "====Guild Info====";
output += newline;
if (targetPC.getGuild() != null) {
output += "Name: " + targetPC.getGuild().getName();
output += newline;
output += "State: " + targetPC.getGuild().getGuildState();
output += newline;
output += "Realms Owned:" + targetPC.getGuild().getRealmsOwned();
output += newline;
output += "====Nation====";
output += newline;
output += "Nation Name: " + targetPC.getGuild().getNation().getName();
output += newline;
output += "Nation State: " + targetPC.getGuild().getNation().getGuildState();
output += newline;
output += "Realms Owned:" + targetPC.getGuild().getNation().getRealmsOwned();
output += newline;
output += "Guild Rank:" + (GuildStatusController.getRank(targetPC.getGuildStatus()) + targetPC.getGuild().getRealmsOwnedFlag());
}
output += newline;
output += "Movement State: " + targetPC.getMovementState().name();
output += newline;
output += "Movement Speed: " + targetPC.getSpeed();
output += "Altitude : " + targetPC.getLoc().y;
output += "Swimming : " + targetPC.isSwimming();
output += newline;
output += "isMoving : " + targetPC.isMoving();
break;
case NPC:
NPC targetNPC = (NPC) target;
output += "databaseID: " + targetNPC.getDBID() + newline;
output += "Name: " + targetNPC.getName();
output += newline;
output += StringUtils.addWS("Level: " + targetNPC.getLevel(), 20);
MobBase mobBase;
if (targetNPC.getContract() == null)
mobBase = targetNPC.getMobBase();
else
mobBase = MobBase.getMobBase(targetNPC.getContract().getMobbaseID());
if (mobBase != null) {
output += "Mobbbase: " + mobBase.getObjectUUID();
output += newline;
output += "Flags: " + mobBase.getFlags().toString();
}
output += newline;
output += "Spawn: (" + targetNPC.getBindLoc().getX();
output += ", " + targetNPC.getBindLoc().getY();
output += ", " + targetNPC.getBindLoc().getZ() + ')';
output += newline;
output += "ContractID: " + targetNPC.getContractID();
output += newline;
output += "InventorySet: " + targetNPC.getContract().inventorySet;
output += newline;
output += targetNPC.getContract().getAllowedBuildings().toString();
output += newline;
output += "Extra Rune: " + targetNPC.getContract().getExtraRune();
output += newline;
output += "isTrainer: " + targetNPC.getContract().isTrainer();
output += newline;
output += "Buy Cost: " + targetNPC.getBuyPercent();
output += "\tSell Cost: " + targetNPC.getSellPercent();
output += newline;
output += "fromInit: " + targetNPC.isStatic();
output += newline;
if (mobBase != null) {
output += newline;
output += "Slottable: " + targetNPC.getContract().getAllowedBuildings().toString();
output += newline;
output += "EquipSet: " + targetNPC.getEquipmentSetID();
output += newline;
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
}
if (targetNPC.region != null) {
output += newline;
output += "Region found: " + "Building : " + targetNPC.region.parentBuildingID + newline;
output += "building level : " + targetNPC.region.level + newline;
output += "building room : " + targetNPC.region.room + newline;
} else {
output += newline;
output += "No region was found.";
}
if (targetNPC.getBuilding() != null) {
output += newline;
output += "Building : " + targetNPC.getBuilding();
} else {
output += newline;
output += "No building found.";
}
break;
case Mob:
Mob targetMob = (Mob) target;
output += "databaseID: " + targetMob.getDBID() + newline;
output += "Name: " + targetMob.getName();
output += newline;
output += StringUtils.addWS("Level: " + targetMob.getLevel(), 20);
mobBase = targetMob.getMobBase();
if (mobBase != null)
output += "RaceID: " + mobBase.getObjectUUID();
else
output += "RaceID: " + targetMob.getLoadID();
output += newline;
try {
output += "notEnemy: " + targetMob.notEnemy.toString();
output += newline;
output += "enemy: " + targetMob.enemy.toString();
output += newline;
} catch (Exception ex) {
//who cares its info
}
output += "Spawn: (" + targetMob.getBindLoc().getX();
output += ", " + targetMob.getBindLoc().getY();
output += ", " + targetMob.getBindLoc().getZ() + ')';
output += newline;
if (targetMob.isPet()) {
output += "isPet: true";
output += newline;
if (targetMob.isSummonedPet())
output += "isSummonedPet: true";
else
output += "isSummonedPet: false";
PlayerCharacter owner = targetMob.getOwner();
if (owner != null)
output += " owner: " + owner.getObjectUUID();
output += newline;
output += "assist: " + targetMob.assist() + " resting: " + targetMob.isSit();
output += newline;
}
if (targetMob.getMobBase() != null) {
output += "Mobbase: " + targetMob.getMobBase().getObjectUUID();
output += newline;
output += "Flags: " + targetMob.getMobBase().getFlags().toString();
output += newline;
}
if (targetMob.isMob()) {
output += "SpawnRadius: " + targetMob.getSpawnRadius();
output += newline;
output += "Spawn Timer: " + targetMob.getSpawnTimeAsString();
output += newline;
}
output += StringUtils.addWS("isAlive: "
+ targetMob.isAlive(), 20);
output += newline;
//output += "Mob State: " + targetMob.state.name();
output += newline;
output += "Speed : " + targetMob.getSpeed();
output += newline;
output += "EquipSet: " + targetMob.equipmentSetID;
output += newline;
try {
output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
} catch (Exception ex) {
//who cares
}
output += newline;
output += "isMoving : " + targetMob.isMoving();
if (targetMob.region != null) {
output += newline;
output += "BuildingID : " + targetMob.region.parentBuildingID;
output += "building level : " + targetMob.region.level;
output += "building room : " + targetMob.region.room;
}
if (targetMob.building != null) {
output += "Building Name: " + targetMob.building.getName() + newline;
output += "BuildingID : " + targetMob.building + newline;
output += "Bind Loc : " + targetMob.getBindLoc() + newline;
output += "Curr Loc : " + targetMob.getLoc() + newline;
} else {
output += newline;
output += "No building found.";
}
break;
case Item: //intentional passthrough
case MobLoot:
Item item = (Item) target;
ItemBase itemBase = item.getItemBase();
output += StringUtils.addWS("ItemBase: " + itemBase.getUUID(), 20);
output += "Weight: " + itemBase.getWeight();
output += newline;
DecimalFormat df = new DecimalFormat("###,###,###,###,##0");
output += StringUtils.addWS("Qty: "
+ df.format(item.getNumOfItems()), 20);
output += "Charges: " + item.getChargesRemaining()
+ '/' + item.getChargesMax();
output += newline;
output += "Name: " + itemBase.getName();
output += newline;
output += item.getContainerInfo();
throwbackInfo(pc, output);
output = "Effects:" + newline;
ConcurrentHashMap<String, Effect> effects = item.getEffects();
for (String name : effects.keySet()) {
Effect eff = effects.get(name);
output += eff.getEffectsBase().getIDString();
output += newline;
// output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
}
break;
}
throwbackInfo(pc, output);
}
@Override
protected String _getHelpString() {
return "Gets information on an Object.";
}
@Override
protected String _getUsageString() {
return "' /info targetID'";
}
}
+49 -49
View File
@@ -16,70 +16,70 @@ import engine.objects.PlayerCharacter;
public class JumpCmd extends AbstractDevCmd {
public JumpCmd() {
public JumpCmd() {
super("jump");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 2) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 2) {
this.sendUsage(pc);
return;
}
//test
//test
if (words[0].equalsIgnoreCase("face")){
if (words[0].equalsIgnoreCase("face")) {
try {
float range = Float.parseFloat(words[1]);
Vector3fImmutable newLoc = pc.getFaceDir().scaleAdd(range, pc.getLoc());
pc.teleport(newLoc);
try {
float range = Float.parseFloat(words[1]);
Vector3fImmutable newLoc = pc.getFaceDir().scaleAdd(range, pc.getLoc());
pc.teleport(newLoc);
} catch (NumberFormatException e) {
this.throwbackError(pc, ""
+ " failed to parse to Floats");
return;
} catch (NumberFormatException e) {
this.throwbackError(pc, ""
+ " failed to parse to Floats");
return;
}
return;
}
float lat = 0.0f, lon = 0.0f;
String latLong = '\'' + words[0] + ", " + words[1] + '\'';
}
return;
}
float lat = 0.0f, lon = 0.0f;
String latLong = '\'' + words[0] + ", " + words[1] + '\'';
try {
lat = Float.parseFloat(words[0]);
lon = Float.parseFloat(words[1]);
try {
lat = Float.parseFloat(words[0]);
lon = Float.parseFloat(words[1]);
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied LatLong: " + latLong
+ " failed to parse to Floats");
return;
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied LatLong: " + latLong
+ " failed to parse to Floats");
return;
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to jump to LatLong of "
+ latLong);
return;
}
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to jump to LatLong of "
+ latLong);
return;
}
Vector3fImmutable loc = pc.getLoc();
loc = loc.add(lat, 0f, -lon);
pc.teleport(loc);
}
Vector3fImmutable loc = pc.getLoc();
loc = loc.add(lat, 0f, -lon);
pc.teleport(loc);
}
@Override
protected String _getHelpString() {
return "Alters your characters position by 'lat' and 'long'. This does not transport you TO 'lat' and 'long', but rather BY 'lat' and 'long' ";
@Override
protected String _getHelpString() {
return "Alters your characters position by 'lat' and 'long'. This does not transport you TO 'lat' and 'long', but rather BY 'lat' and 'long' ";
}
}
@Override
protected String _getUsageString() {
return "' /jump lat long'";
}
@Override
protected String _getUsageString() {
return "' /jump lat long'";
}
}
+77 -79
View File
@@ -16,119 +16,117 @@ import engine.objects.LootTable;
import engine.objects.PlayerCharacter;
/**
*
* @author Eighty
*
*/
public class MBDropCmd extends AbstractDevCmd {
public MBDropCmd() {
public MBDropCmd() {
super("mbdrop");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
String newline = "\r\n ";
if (args.length != 1){
this.sendUsage(pcSender);
this.sendHelp(pcSender);
return;
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
String newline = "\r\n ";
if (args.length != 1) {
this.sendUsage(pcSender);
this.sendHelp(pcSender);
return;
}
String output = "";
switch (args[0].toLowerCase()){
case "clear":
String output = "";
switch (args[0].toLowerCase()) {
case "clear":
LootTable.contractCount = 0;
LootTable.dropCount = 0;
LootTable.glassCount = 0;
LootTable.runeCount = 0;
LootTable.rollCount = 0;
LootTable.resourceCount = 0;
LootTable.contractCount = 0;
LootTable.dropCount = 0;
LootTable.glassCount = 0;
LootTable.runeCount = 0;
LootTable.rollCount = 0;
LootTable.resourceCount = 0;
LootTable.contractDroppedMap.clear();
LootTable.glassDroppedMap.clear();
LootTable.itemsDroppedMap.clear();
LootTable.resourceDroppedMap.clear();
LootTable.runeDroppedMap.clear();
break;
case "all":
output = LootTable.dropCount + " items - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib: LootTable.itemsDroppedMap.keySet()){
LootTable.contractDroppedMap.clear();
LootTable.glassDroppedMap.clear();
LootTable.itemsDroppedMap.clear();
LootTable.resourceDroppedMap.clear();
LootTable.runeDroppedMap.clear();
break;
case "all":
output = LootTable.dropCount + " items - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib : LootTable.itemsDroppedMap.keySet()) {
int dropCount = LootTable.itemsDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
int dropCount = LootTable.itemsDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
}
break;
case "resource":
output = LootTable.resourceCount + " Resources - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib: LootTable.resourceDroppedMap.keySet()){
}
break;
case "resource":
output = LootTable.resourceCount + " Resources - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib : LootTable.resourceDroppedMap.keySet()) {
int dropCount = LootTable.resourceDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
int dropCount = LootTable.resourceDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
}
}
break;
case "rune":
break;
case "rune":
output = LootTable.runeCount + " Runes - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib: LootTable.runeDroppedMap.keySet()){
output = LootTable.runeCount + " Runes - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib : LootTable.runeDroppedMap.keySet()) {
int dropCount = LootTable.runeDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
int dropCount = LootTable.runeDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
}
break;
case "contract":
}
break;
case "contract":
output = LootTable.contractCount + " Contracts - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib: LootTable.contractDroppedMap.keySet()){
output = LootTable.contractCount + " Contracts - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib : LootTable.contractDroppedMap.keySet()) {
int dropCount = LootTable.contractDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
int dropCount = LootTable.contractDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
}
break;
}
break;
case "glass":
case "glass":
output = LootTable.glassCount + " Glass - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib: LootTable.glassDroppedMap.keySet()){
output = LootTable.glassCount + " Glass - ITEM NAME : DROP COUNT" + newline;
for (ItemBase ib : LootTable.glassDroppedMap.keySet()) {
int dropCount = LootTable.glassDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
}
break;
int dropCount = LootTable.glassDroppedMap.get(ib);
output += ib.getName() + " : " + dropCount + newline;
}
break;
case "chance":
float chance = (float)LootTable.dropCount/(float)LootTable.rollCount * 100;
output = LootTable.dropCount + " out of " + LootTable.rollCount + " items Dropped. chance = " + chance + '%';
case "chance":
float chance = (float) LootTable.dropCount / (float) LootTable.rollCount * 100;
output = LootTable.dropCount + " out of " + LootTable.rollCount + " items Dropped. chance = " + chance + '%';
break;
break;
default:
this.sendUsage(pcSender);
this.sendHelp(pcSender);
return;
}
default:
this.sendUsage(pcSender);
this.sendHelp(pcSender);
return;
}
this.throwbackInfo(pcSender, output);
this.throwbackInfo(pcSender, output);
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /mbdrop all/resource/rune/contract/glass/chance/clear";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Lists drops for server since a reboot. All lists all items and drops. chance is the overall chance items drop from mobs on server. (not including Equipment)";
}
}
}
+138 -141
View File
@@ -23,193 +23,190 @@ import org.pmw.tinylog.Logger;
/**
* @author Eighty
*
*/
public class MakeBaneCmd extends AbstractDevCmd {
public MakeBaneCmd() {
public MakeBaneCmd() {
super("makebane");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 1 || words.length > 2) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 1 || words.length > 2) {
this.sendUsage(pc);
return;
}
int attackerID = 0;
int rank = 8;
int attackerID = 0;
int rank = 8;
if (words.length == 2) {
try {
attackerID = Integer.parseInt(words[0]);
rank = Integer.parseInt(words[1]);
} catch (NumberFormatException e) {
throwbackError(pc, "AttackerGuildID must be a number, " + words[0] + " is invalid");
return;
}
} else if (words.length == 1) {
if (target == null) {
throwbackError(pc, "No target specified");
return;
}
if (words.length == 2) {
try {
attackerID = Integer.parseInt(words[0]);
rank = Integer.parseInt(words[1]);
} catch (NumberFormatException e) {
throwbackError(pc, "AttackerGuildID must be a number, " + words[0] + " is invalid");
return;
}
} else if (words.length == 1) {
if (target == null) {
throwbackError(pc, "No target specified");
return;
}
if (!(target instanceof PlayerCharacter)) {
throwbackError(pc, "Target is not a player");
return;
}
attackerID = target.getObjectUUID();
if (!(target instanceof PlayerCharacter)) {
throwbackError(pc, "Target is not a player");
return;
}
attackerID = target.getObjectUUID();
try {
rank = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Rank must be specified, 1 through 8");
return;
}
}
try {
rank = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Rank must be specified, 1 through 8");
return;
}
}
if (rank < 1 || rank > 8) {
throwbackError(pc, "Rank must be 1 through 8");
return;
}
if (rank < 1 || rank > 8) {
throwbackError(pc, "Rank must be 1 through 8");
return;
}
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
if (player.getGuild().isEmptyGuild()) {
throwbackError(pc, "Errant's can not place banes");
return;
}
if (player.getGuild().isEmptyGuild()) {
throwbackError(pc, "Errant's can not place banes");
return;
}
AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
if (attackerAGL == null) {
throwbackError(pc, "No guild leader found for attacking guild.");
return;
}
if (attackerAGL == null) {
throwbackError(pc, "No guild leader found for attacking guild.");
return;
}
if (!(attackerAGL instanceof PlayerCharacter)) {
throwbackError(pc, "Attacking guild leader is an NPC.");
return;
}
if (!(attackerAGL instanceof PlayerCharacter)) {
throwbackError(pc, "Attacking guild leader is an NPC.");
return;
}
if (player.getGuild().isNPCGuild()) {
throwbackError(pc, "The guild used is an npc guild. They can not bane.");
return;
}
if (player.getGuild().isNPCGuild()) {
throwbackError(pc, "The guild used is an npc guild. They can not bane.");
return;
}
// if (player.getGuild().getOwnedCity() != null) {
// throwbackError(pc, "The attacking guild already has a city.");
// return;
// }
// if (player.getGuild().getOwnedCity() != null) {
// throwbackError(pc, "The attacking guild already has a city.");
// return;
// }
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) {
throwbackError(pc, "Unable to find the zone you're in.");
return;
}
if (zone == null) {
throwbackError(pc, "Unable to find the zone you're in.");
return;
}
if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city.");
return;
}
if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city.");
return;
}
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone.");
return;
}
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone.");
return;
}
if (city.getTOL() == null) {
throwbackError(pc, "Unable to find the tree of life for this city.");
return;
}
if (city.getTOL() == null) {
throwbackError(pc, "Unable to find the tree of life for this city.");
return;
}
if (city.getBane() != null) {
throwbackError(pc, "This city is already baned.");
return;
}
if (city.getBane() != null) {
throwbackError(pc, "This city is already baned.");
return;
}
if (Bane.getBaneByAttackerGuild(player.getGuild()) != null) {
throwbackError(pc, "This guild is already baning someone.");
return;
}
if (Bane.getBaneByAttackerGuild(player.getGuild()) != null) {
throwbackError(pc, "This guild is already baning someone.");
return;
}
Blueprint blueprint = Blueprint.getBlueprint(24300);
Blueprint blueprint = Blueprint.getBlueprint(24300);
if (blueprint == null) {
throwbackError(pc, "Unable to find building set for banestone.");
return;
}
if (blueprint == null) {
throwbackError(pc, "Unable to find building set for banestone.");
return;
}
Vector3f rot = new Vector3f(0, 0, 0);
Vector3f rot = new Vector3f(0, 0, 0);
// *** Refactor : Overlap test goes here
// *** Refactor : Overlap test goes here
//Let's drop a banestone!
Vector3fImmutable localLocation = ZoneManager.worldToLocal(pc.getLoc(), zone);
//Let's drop a banestone!
Vector3fImmutable localLocation = ZoneManager.worldToLocal(pc.getLoc(), zone);
if (localLocation == null) {
ChatManager.chatSystemError(pc, "Failed to convert world location to zone location. Contact a CCR.");
Logger.info("Failed to Convert World coordinates to local zone coordinates");
return;
}
if (localLocation == null){
ChatManager.chatSystemError(pc, "Failed to convert world location to zone location. Contact a CCR.");
Logger.info("Failed to Convert World coordinates to local zone coordinates");
return;
}
Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
zone.getObjectUUID(), pc.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
null, blueprint.getBlueprintUUID(), 1, 0.0f);
Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
zone.getObjectUUID(), pc.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
null, blueprint.getBlueprintUUID(), 1, 0.0f);
if (stone == null) {
ChatManager.chatSystemError(pc, "Failed to create banestone.");
return;
}
stone.addEffectBit((1 << 19));
stone.setRank((byte) rank);
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
stone.setCurrentHitPoints(stone.getMaxHitPoints());
BuildingManager.setUpgradeDateTime(stone, null, 0);
if (stone == null) {
ChatManager.chatSystemError(pc, "Failed to create banestone.");
return;
}
stone.addEffectBit((1 << 19));
stone.setRank((byte) rank);
stone.setMaxHitPoints( blueprint.getMaxHealth(stone.getRank()));
stone.setCurrentHitPoints(stone.getMaxHitPoints());
BuildingManager.setUpgradeDateTime(stone, null, 0);
//Make the bane
//Make the bane
Bane bane = Bane.makeBane(player, city, stone);
Bane bane = Bane.makeBane(player, city, stone);
if (bane == null) {
if (bane == null) {
//delete bane stone, failed to make bane object
DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
//delete bane stone, failed to make bane object
DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
throwbackError(pc, "Failed to create bane.");
return;
}
throwbackError(pc, "Failed to create bane.");
return;
}
WorldGrid.addObject(stone, pc);
WorldGrid.addObject(stone, pc);
//Add baned effect to TOL
city.getTOL().addEffectBit((1 << 16));
city.getTOL().updateEffects();
//Add baned effect to TOL
city.getTOL().addEffectBit((1 << 16));
city.getTOL().updateEffects();
Vector3fImmutable movePlayerOutsideStone = player.getLoc();
movePlayerOutsideStone = movePlayerOutsideStone.setX(movePlayerOutsideStone.x + 10);
movePlayerOutsideStone = movePlayerOutsideStone.setZ(movePlayerOutsideStone.z + 10);
player.teleport(movePlayerOutsideStone);
Vector3fImmutable movePlayerOutsideStone = player.getLoc();
movePlayerOutsideStone = movePlayerOutsideStone.setX(movePlayerOutsideStone.x + 10);
movePlayerOutsideStone = movePlayerOutsideStone.setZ(movePlayerOutsideStone.z + 10);
player.teleport(movePlayerOutsideStone);
throwbackInfo(pc, "The city has been succesfully baned.");
}
throwbackInfo(pc, "The city has been succesfully baned.");
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Creates an bane.";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "'./makebane playerUUID baneRank'";
}
}
}
+194 -196
View File
@@ -21,236 +21,234 @@ import java.util.ArrayList;
/**
* @author Eighty
*
*/
public class MakeItemCmd extends AbstractDevCmd {
public MakeItemCmd() {
public MakeItemCmd() {
super("makeitem");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words[0].equals("resources")){
for (int ibID : Warehouse.getMaxResources().keySet()){
if (ibID == 7)
continue;
ItemBase ib = ItemBase.getItemBase(ibID);
short weight = ib.getWeight();
if (!pc.getCharItemManager().hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more of this item");
pc.getCharItemManager().updateInventory();
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
boolean worked = false;
Item item = new Item(ib, pc.getObjectUUID(),
OwnerType.PlayerCharacter, (byte)0, (byte)0, (short)ib.getDurability(), (short)ib.getDurability(),
true, false, ItemContainerType.INVENTORY, (byte) 0,
new ArrayList<>(),"");
item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
if (words[0].equals("resources")) {
for (int ibID : Warehouse.getMaxResources().keySet()) {
if (ibID == 7)
continue;
try {
item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) {
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
return;
}
ItemBase ib = ItemBase.getItemBase(ibID);
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
return;
}
short weight = ib.getWeight();
if (!pc.getCharItemManager().hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more of this item");
pc.getCharItemManager().updateInventory();
return;
}
//add item to inventory
pc.getCharItemManager().addItemToInventory(item);
}
return;
}
if (words.length < 3 || words.length > 5) {
this.sendUsage(pc);
return;
}
boolean worked = false;
Item item = new Item(ib, pc.getObjectUUID(),
OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
true, false, ItemContainerType.INVENTORY, (byte) 0,
new ArrayList<>(), "");
int quantity = 1;
if (words.length > 3) {
try {
quantity = Integer.parseInt(words[3]);
} catch (NumberFormatException e) {
throwbackError(pc, "Quantity must be a number, " + words[3] + " is invalid");
return;
}
if (quantity < 1 || quantity > 100)
quantity = 1;
}
item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
int numItems = 1;
if (words.length > 4) {
try {
numItems = Integer.parseInt(words[4]);
} catch (NumberFormatException e) {
throwbackError(pc, "numResources must be a number, " + words[4] + " is invalid");
return;
}
numItems = (numItems < 1) ? 1 : numItems;
numItems = (numItems > 5000) ? 5000 : numItems;
}
try {
item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) {
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
return;
}
int itembaseID;
try {
itembaseID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
itembaseID = ItemBase.getIDByName(words[0].toLowerCase());
if (itembaseID == 0) {
throwbackError(pc, "Supplied type " + words[0]
+ " failed to parse to an Integer");
return;
}
} catch (Exception e) {
throwbackError(pc,
"An unknown exception occurred when trying to use createitem command for type "
+ words[0]);
return; // NaN
}
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
return;
}
if (itembaseID == 7) {
this.throwbackInfo(pc, "use /addgold to add gold.");
return;
}
String prefix = "";
String suffix = "";
//add item to inventory
pc.getCharItemManager().addItemToInventory(item);
}
return;
}
if (words.length < 3 || words.length > 5) {
this.sendUsage(pc);
return;
}
if (!(words[1].equals("0"))) {
prefix = words[1];
if (!(prefix.substring(0, 4).equals("PRE-")))
prefix = EffectsBase.getItemEffectsByName(prefix.toLowerCase());
if (!(prefix.substring(0, 4).equals("PRE-"))) {
throwbackError(pc, "Invalid Prefix. Prefix must consist of PRE-001 to PRE-334 or 0 for no Prefix.");
return;
}
int quantity = 1;
if (words.length > 3) {
try {
quantity = Integer.parseInt(words[3]);
} catch (NumberFormatException e) {
throwbackError(pc, "Quantity must be a number, " + words[3] + " is invalid");
return;
}
if (quantity < 1 || quantity > 100)
quantity = 1;
}
boolean validInt = false;
try {
int num = Integer.parseInt(prefix.substring(4, 7));
if (num > 0 && num < 335)
validInt = true;
} catch (Exception e) {
throwbackError(pc, "error parsing number " + prefix);
}
if (!validInt) {
throwbackError(pc, "Invalid Prefix. Prefix must consist of PRE-001 to PRE-334 or 0 for no Prefix.");
return;
}
}
int numItems = 1;
if (words.length > 4) {
try {
numItems = Integer.parseInt(words[4]);
} catch (NumberFormatException e) {
throwbackError(pc, "numResources must be a number, " + words[4] + " is invalid");
return;
}
numItems = (numItems < 1) ? 1 : numItems;
numItems = (numItems > 5000) ? 5000 : numItems;
}
if (!(words[2].equals("0"))) {
suffix = words[2];
int itembaseID;
try {
itembaseID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
itembaseID = ItemBase.getIDByName(words[0].toLowerCase());
if (itembaseID == 0) {
throwbackError(pc, "Supplied type " + words[0]
+ " failed to parse to an Integer");
return;
}
} catch (Exception e) {
throwbackError(pc,
"An unknown exception occurred when trying to use createitem command for type "
+ words[0]);
return; // NaN
}
if (!(suffix.substring(0, 4).equals("SUF-")))
suffix = EffectsBase.getItemEffectsByName(suffix.toLowerCase());
if (!(suffix.substring(0, 4).equals("SUF-"))) {
throwbackError(pc, "Invalid Suffix. Suffix must consist of SUF-001 to SUF-328 or 0 for no Suffix.");
return;
}
if (itembaseID == 7) {
this.throwbackInfo(pc, "use /addgold to add gold.");
return;
}
boolean validInt = false;
try {
int num = Integer.parseInt(suffix.substring(4, 7));
if (num > 0 && num < 329)
validInt = true;
} catch (Exception e) {
throwbackError(pc, "error parsing number " + suffix);
}
if (!validInt) {
throwbackError(pc, "Invalid Suffix. Suffix must consist of SUF-001 to SUF-328 or 0 for no Suffix.");
return;
}
}
ItemBase ib = ItemBase.getItemBase(itembaseID);
if (ib == null) {
throwbackError(pc, "Unable to find itembase of ID " + itembaseID);
return;
}
String prefix = "";
String suffix = "";
if ((numItems > 1)
&& (ib.getType().equals(ItemType.RESOURCE) == false)
&& (ib.getType().equals(ItemType.OFFERING)) == false)
numItems = 1;
if (!(words[1].equals("0"))) {
prefix = words[1];
if (!(prefix.substring(0, 4).equals("PRE-")))
prefix = EffectsBase.getItemEffectsByName(prefix.toLowerCase());
if (!(prefix.substring(0, 4).equals("PRE-"))) {
throwbackError(pc, "Invalid Prefix. Prefix must consist of PRE-001 to PRE-334 or 0 for no Prefix.");
return;
}
CharacterItemManager cim = pc.getCharItemManager();
if (cim == null) {
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
return;
}
boolean validInt = false;
try {
int num = Integer.parseInt(prefix.substring(4, 7));
if (num > 0 && num < 335)
validInt = true;
} catch (Exception e) {
throwbackError(pc, "error parsing number " + prefix);
}
if (!validInt) {
throwbackError(pc, "Invalid Prefix. Prefix must consist of PRE-001 to PRE-334 or 0 for no Prefix.");
return;
}
}
byte charges = (byte) ib.getNumCharges();
short dur = (short) ib.getDurability();
if (!(words[2].equals("0"))) {
suffix = words[2];
String result = "";
for (int i = 0; i < quantity; i++) {
short weight = ib.getWeight();
if (!cim.hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more of this item. " + i + " produced.");
if (i > 0)
cim.updateInventory();
return;
}
if (!(suffix.substring(0, 4).equals("SUF-")))
suffix = EffectsBase.getItemEffectsByName(suffix.toLowerCase());
if (!(suffix.substring(0, 4).equals("SUF-"))) {
throwbackError(pc, "Invalid Suffix. Suffix must consist of SUF-001 to SUF-328 or 0 for no Suffix.");
return;
}
boolean worked = false;
Item item = new Item(ib, pc.getObjectUUID(),
OwnerType.PlayerCharacter, charges, charges, dur, dur,
true, false, ItemContainerType.INVENTORY, (byte) 0,
new ArrayList<>(),"");
if (numItems > 1)
item.setNumOfItems(numItems);
boolean validInt = false;
try {
int num = Integer.parseInt(suffix.substring(4, 7));
if (num > 0 && num < 329)
validInt = true;
} catch (Exception e) {
throwbackError(pc, "error parsing number " + suffix);
}
if (!validInt) {
throwbackError(pc, "Invalid Suffix. Suffix must consist of SUF-001 to SUF-328 or 0 for no Suffix.");
return;
}
}
ItemBase ib = ItemBase.getItemBase(itembaseID);
if (ib == null) {
throwbackError(pc, "Unable to find itembase of ID " + itembaseID);
return;
}
try {
item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) {
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
return;
}
if ((numItems > 1)
&& (ib.getType().equals(ItemType.RESOURCE) == false)
&& (ib.getType().equals(ItemType.OFFERING)) == false)
numItems = 1;
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
return;
}
CharacterItemManager cim = pc.getCharItemManager();
if (cim == null) {
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
return;
}
//create prefix
if (!prefix.isEmpty())
item.addPermanentEnchantmentForDev(prefix, 0);
byte charges = (byte) ib.getNumCharges();
short dur = (short) ib.getDurability();
//create suffix
if (!suffix.isEmpty())
item.addPermanentEnchantmentForDev(suffix, 0);
String result = "";
for (int i = 0; i < quantity; i++) {
short weight = ib.getWeight();
if (!cim.hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more of this item. " + i + " produced.");
if (i > 0)
cim.updateInventory();
return;
}
//add item to inventory
cim.addItemToInventory(item);
result += " " + item.getObjectUUID();
}
this.setResult(result);
cim.updateInventory();
}
boolean worked = false;
Item item = new Item(ib, pc.getObjectUUID(),
OwnerType.PlayerCharacter, charges, charges, dur, dur,
true, false, ItemContainerType.INVENTORY, (byte) 0,
new ArrayList<>(), "");
if (numItems > 1)
item.setNumOfItems(numItems);
@Override
protected String _getHelpString() {
try {
item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) {
throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
return;
}
if (item == null || !worked) {
throwbackError(pc, "DB error 2: Unable to create item.");
return;
}
//create prefix
if (!prefix.isEmpty())
item.addPermanentEnchantmentForDev(prefix, 0);
//create suffix
if (!suffix.isEmpty())
item.addPermanentEnchantmentForDev(suffix, 0);
//add item to inventory
cim.addItemToInventory(item);
result += " " + item.getObjectUUID();
}
this.setResult(result);
cim.updateInventory();
}
@Override
protected String _getHelpString() {
return "Creates an item of type 'itembaseID' with a prefix and suffix";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "'./makeitem itembaseID PrefixID SuffixID [quantity] [numResources]'";
}
}
}
+56 -58
View File
@@ -6,81 +6,79 @@ import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
/**
* @author
* Summary: Devcmd to toggle logging of application protocol messages
*
* @author Summary: Devcmd to toggle logging of application protocol messages
*/
public class NetDebugCmd extends AbstractDevCmd {
// Instance variables
public NetDebugCmd() {
public NetDebugCmd() {
super("netdebug");
}
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
Boolean debugState = false;
if(validateUserInput(args) == false) {
this.sendUsage(pc);
return;
}
// Arguments have been validated use argument to set debug state
switch (args[0]) {
case "on":
debugState = true;
break;
case "off":
debugState = false;
break;
default:
break;
}
MBServerStatics.DEBUG_PROTOCOL = debugState;
// Send results to user
throwbackInfo(pc, "Network debug state: " + debugState.toString());
}
// AbstractDevCmd Overridden methods
@Override
protected String _getHelpString() {
return "Toggles sending network messages to log";
}
@Override
protected String _getUsageString() {
return "/netdebug on|off";
}
// Class methods
private static boolean validateUserInput(String[] userInput) {
private static boolean validateUserInput(String[] userInput) {
int stringIndex;
String commandSet = "onoff";
// incorrect number of arguments test
if (userInput.length != 1)
return false;
return false;
// Validate arguments
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
return stringIndex != -1;
return stringIndex != -1;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
Boolean debugState = false;
if (validateUserInput(args) == false) {
this.sendUsage(pc);
return;
}
// Arguments have been validated use argument to set debug state
switch (args[0]) {
case "on":
debugState = true;
break;
case "off":
debugState = false;
break;
default:
break;
}
MBServerStatics.DEBUG_PROTOCOL = debugState;
// Send results to user
throwbackInfo(pc, "Network debug state: " + debugState.toString());
}
@Override
protected String _getHelpString() {
return "Toggles sending network messages to log";
}
// Class methods
@Override
protected String _getUsageString() {
return "/netdebug on|off";
}
}
+45 -45
View File
@@ -16,58 +16,58 @@ import java.util.ArrayList;
public class PrintBankCmd extends AbstractDevCmd {
public PrintBankCmd() {
super("printbank");
}
public PrintBankCmd() {
super("printbank");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
if (target != null) {
if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
if (target != null) {
if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
if (!(tar instanceof PlayerCharacter)) {
throwbackError(pc, "Must target player");
return;
}
if (!(tar instanceof PlayerCharacter)) {
throwbackError(pc, "Must target player");
return;
}
CharacterItemManager cim = ((AbstractCharacter)tar).getCharItemManager();
ArrayList<Item> list = cim.getBank();
throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Item item : list) {
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
}
Item gold = cim.getGoldBank();
if (gold != null)
throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
else
throwbackInfo(pc, " NULL Gold");
}
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
ArrayList<Item> list = cim.getBank();
throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Item item : list) {
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
}
Item gold = cim.getGoldBank();
if (gold != null)
throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
else
throwbackInfo(pc, " NULL Gold");
}
@Override
protected String _getHelpString() {
return "Returns the player's current bank";
}
@Override
protected String _getHelpString() {
return "Returns the player's current bank";
}
@Override
protected String _getUsageString() {
return "' /printbank'";
}
@Override
protected String _getUsageString() {
return "' /printbank'";
}
}
+62 -63
View File
@@ -17,75 +17,74 @@ import engine.powers.effectmodifiers.AbstractEffectModifier;
public class PrintBonusesCmd extends AbstractDevCmd {
public PrintBonusesCmd() {
super("printbonuses");
// super("printbonuses", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
public PrintBonusesCmd() {
super("printbonuses");
// super("printbonuses", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
if (target != null)
if (target instanceof Item) {
type = "Item";
tar = (Item) target;
name = ((Item) tar).getItemBase().getName();
} else if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
if (target != null)
if (target instanceof Item) {
type = "Item";
tar = (Item) target;
name = ((Item) tar).getItemBase().getName();
} else if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
//Get name and type
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null)
name = mb.getFirstName();
type = "Mob";
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null)
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
type = "NPC";
}
//Get name and type
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null)
name = mb.getFirstName();
type = "Mob";
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null)
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
type = "NPC";
}
if (tar.getObjectType() == GameObjectType.Item) {
Item targetItem = (Item) tar;
if (tar.getObjectType() == GameObjectType.Item) {
Item targetItem = (Item) tar;
if (targetItem.getBonuses() != null)
for (AbstractEffectModifier targetName : targetItem.getBonuses().keySet()) {
ChatManager.chatSystemInfo(pc, " " + targetName.modType.name() + "-" + targetName.sourceType.name() + ": " + targetItem.getBonuses().get(name));
}
} else if (((AbstractCharacter)tar).getBonuses() != null) {
((AbstractCharacter)tar).getBonuses().printBonusesToClient(pc);
}
else
throwbackInfo(pc, "Bonuses for " + type + ' ' + name + " not found");
}
if (targetItem.getBonuses() != null)
for (AbstractEffectModifier targetName : targetItem.getBonuses().keySet()) {
ChatManager.chatSystemInfo(pc, " " + targetName.modType.name() + "-" + targetName.sourceType.name() + ": " + targetItem.getBonuses().get(name));
}
} else if (((AbstractCharacter) tar).getBonuses() != null) {
((AbstractCharacter) tar).getBonuses().printBonusesToClient(pc);
} else
throwbackInfo(pc, "Bonuses for " + type + ' ' + name + " not found");
}
@Override
protected String _getHelpString() {
return "Returns the player's current bonuses";
}
@Override
protected String _getHelpString() {
return "Returns the player's current bonuses";
}
@Override
protected String _getUsageString() {
return "' /printbonuses'";
}
@Override
protected String _getUsageString() {
return "' /printbonuses'";
}
}
+73 -73
View File
@@ -17,86 +17,86 @@ import java.util.concurrent.ConcurrentHashMap;
public class PrintEquipCmd extends AbstractDevCmd {
public PrintEquipCmd() {
super("printequip");
}
public PrintEquipCmd() {
super("printequip");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
if (target != null) {
if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
if (target != null) {
if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
//Get name and type
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null)
name = mb.getFirstName();
type = "Mob";
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null) {
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
}
type = "NPC";
}
//Get name and type
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null)
name = mb.getFirstName();
type = "Mob";
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null) {
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
}
type = "NPC";
}
if (tar.getObjectType() == GameObjectType.Mob){
Mob tarMob = (Mob)tar;
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (int slot:tarMob.getEquip().keySet()){
MobEquipment equip = tarMob.getEquip().get(slot);
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
}
return;
}
if (tar.getObjectType() == GameObjectType.Mob) {
Mob tarMob = (Mob) tar;
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (int slot : tarMob.getEquip().keySet()) {
MobEquipment equip = tarMob.getEquip().get(slot);
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
}
return;
}
if (tar.getObjectType() == GameObjectType.NPC){
NPC tarMob = (NPC)tar;
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (int slot:tarMob.getEquip().keySet()){
MobEquipment equip = tarMob.getEquip().get(slot);
throwbackInfo(pc,equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
}
return;
}
if (tar.getObjectType() == GameObjectType.NPC) {
NPC tarMob = (NPC) tar;
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (int slot : tarMob.getEquip().keySet()) {
MobEquipment equip = tarMob.getEquip().get(slot);
throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
}
return;
}
CharacterItemManager cim = ((AbstractCharacter)tar).getCharItemManager();
ConcurrentHashMap<Integer, Item> list = cim.getEquipped();
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Integer slot : list.keySet()) {
Item item = list.get(slot);
throwbackInfo(pc, " " + item.getItemBase().getName() + ", slot: " + slot);
}
}
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
ConcurrentHashMap<Integer, Item> list = cim.getEquipped();
throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Integer slot : list.keySet()) {
Item item = list.get(slot);
throwbackInfo(pc, " " + item.getItemBase().getName() + ", slot: " + slot);
}
}
@Override
protected String _getHelpString() {
return "Returns the player's current equipment";
}
@Override
protected String _getHelpString() {
return "Returns the player's current equipment";
}
@Override
protected String _getUsageString() {
return "' /printequip'";
}
@Override
protected String _getUsageString() {
return "' /printequip'";
}
}
+74 -73
View File
@@ -18,92 +18,93 @@ import java.util.ArrayList;
public class PrintInventoryCmd extends AbstractDevCmd {
public PrintInventoryCmd() {
super("printinventory");
}
public PrintInventoryCmd() {
super("printinventory");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target == null || (!(target instanceof AbstractCharacter) && !(target instanceof Corpse))) {
target = pc;
}
if (target == null || (!(target instanceof AbstractCharacter) && !(target instanceof Corpse))) {
target = pc;
}
String type = target.getClass().getSimpleName();
String name = "";
ArrayList<Item> inventory = null;
Item gold = null;
DecimalFormat df = new DecimalFormat("###,###,###,##0");
String type = target.getClass().getSimpleName();
String name = "";
ArrayList<Item> inventory = null;
Item gold = null;
DecimalFormat df = new DecimalFormat("###,###,###,##0");
if (target instanceof AbstractCharacter) {
AbstractCharacter tar = (AbstractCharacter)target;
if (target instanceof AbstractCharacter) {
AbstractCharacter tar = (AbstractCharacter) target;
name = tar.getFirstName();
name = tar.getFirstName();
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null) {
name = mb.getFirstName();
}
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null) {
if (contract.isTrainer()) {
name = tar.getName() + ", " + contract.getName();
} else {
name = tar.getName() + " the " + contract.getName();
}
}
}
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null) {
name = mb.getFirstName();
}
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null) {
if (contract.isTrainer()) {
name = tar.getName() + ", " + contract.getName();
} else {
name = tar.getName() + " the " + contract.getName();
}
}
}
CharacterItemManager cim = tar.getCharItemManager();
inventory = cim.getInventory(); //this list can contain gold when tar is a PC that is dead
gold = cim.getGoldInventory();
throwbackInfo(pc, " Weight : " + (cim.getInventoryWeight() + cim.getEquipWeight()));
} else if (target instanceof Corpse) {
Corpse corpse = (Corpse) target;
name = "of " + corpse.getName();
inventory = corpse.getInventory();
}
CharacterItemManager cim = tar.getCharItemManager();
inventory = cim.getInventory(); //this list can contain gold when tar is a PC that is dead
gold = cim.getGoldInventory();
throwbackInfo(pc, " Weight : " + (cim.getInventoryWeight() + cim.getEquipWeight()));
} else if (target instanceof Corpse) {
Corpse corpse = (Corpse) target;
name = "of " + corpse.getName();
inventory = corpse.getInventory();
}
throwbackInfo(pc, "Inventory for " + type + ' ' + name + " (" + target.getObjectUUID() + ')');
throwbackInfo(pc, "Inventory for " + type + ' ' + name + " (" + target.getObjectUUID() + ')');
int goldCount = 0;
int goldCount = 0;
for (Item item : inventory) {
if (item.getItemBase().getType().equals(ItemType.GOLD) == false) {
String chargeInfo = "";
byte chargeMax = item.getChargesMax();
if (chargeMax > 0) {
byte charges = item.getChargesRemaining();
chargeInfo = " charges: " + charges + '/' + chargeMax;
}
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems() + chargeInfo);
} else goldCount += item.getNumOfItems();
}
if (gold != null) {
goldCount += gold.getNumOfItems();
}
for (Item item : inventory) {
if (item.getItemBase().getType().equals(ItemType.GOLD) == false) {
String chargeInfo = "";
byte chargeMax = item.getChargesMax();
if (chargeMax > 0) {
byte charges = item.getChargesRemaining();
chargeInfo = " charges: " + charges + '/' + chargeMax;
}
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems() + chargeInfo);
} else
goldCount += item.getNumOfItems();
}
if (gold != null) {
goldCount += gold.getNumOfItems();
}
if (goldCount > 0 || gold != null) {
throwbackInfo(pc, " Gold, count: " + df.format(goldCount));
} else {
throwbackInfo(pc, " NULL Gold");
}
}
if (goldCount > 0 || gold != null) {
throwbackInfo(pc, " Gold, count: " + df.format(goldCount));
} else {
throwbackInfo(pc, " NULL Gold");
}
}
@Override
protected String _getHelpString() {
return "Returns the player's current inventory";
}
@Override
protected String _getHelpString() {
return "Returns the player's current inventory";
}
@Override
protected String _getUsageString() {
return "' /printinventory'";
}
@Override
protected String _getUsageString() {
return "' /printinventory'";
}
}
+34 -35
View File
@@ -16,52 +16,51 @@ import engine.objects.Regions;
/**
* @author Eighty
*
*/
public class PrintLocationCmd extends AbstractDevCmd {
public PrintLocationCmd() {
super("printloc");
}
public PrintLocationCmd() {
super("printloc");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
PlayerCharacter tar;
PlayerCharacter tar;
if (target != null && target instanceof PlayerCharacter)
tar = (PlayerCharacter) target;
else
tar = pc;
if (target != null && target instanceof PlayerCharacter)
tar = (PlayerCharacter) target;
else
tar = pc;
throwbackInfo(pc, "Server location for " + tar.getFirstName());
if (tar.getLoc() != null) {
throwbackInfo(pc, "Lat: " + tar.getLoc().getX());
throwbackInfo(pc, "Lon: " + -tar.getLoc().getZ());
throwbackInfo(pc, "Alt: " + tar.getLoc().getY());
if (pc.region != null) {
this.throwbackInfo(pc, "Player Region Slope Position : " + Regions.SlopeLerpPercent(pc, pc.region));
this.throwbackInfo(pc, "Region Slope Magnitude : " + Regions.GetMagnitudeOfRegionSlope(pc.region));
this.throwbackInfo(pc, "Player Region Slope Magnitude : " + Regions.GetMagnitudeOfPlayerOnRegionSlope(pc.region, pc));
} else {
this.throwbackInfo(pc, "No Region Found for player.");
}
throwbackInfo(pc, "Server location for " + tar.getFirstName());
if (tar.getLoc() != null) {
throwbackInfo(pc, "Lat: " + tar.getLoc().getX());
throwbackInfo(pc, "Lon: " + -tar.getLoc().getZ());
throwbackInfo(pc, "Alt: " + tar.getLoc().getY());
if (pc.region != null) {
this.throwbackInfo(pc, "Player Region Slope Position : " + Regions.SlopeLerpPercent(pc, pc.region));
this.throwbackInfo(pc, "Region Slope Magnitude : " + Regions.GetMagnitudeOfRegionSlope(pc.region));
this.throwbackInfo(pc, "Player Region Slope Magnitude : " + Regions.GetMagnitudeOfPlayerOnRegionSlope(pc.region, pc));
} else {
this.throwbackInfo(pc, "No Region Found for player.");
}
} else {
throwbackInfo(pc, "Server location for " + tar.getFirstName()
+ " not found");
}
}
} else {
throwbackInfo(pc, "Server location for " + tar.getFirstName()
+ " not found");
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Returns the player's current location according to the server";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /printloc'";
}
}
}
+36 -36
View File
@@ -19,50 +19,50 @@ import java.util.concurrent.ConcurrentHashMap;
public class PrintPowersCmd extends AbstractDevCmd {
public PrintPowersCmd() {
super("printpowers");
// super("printpowers", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
public PrintPowersCmd() {
super("printpowers");
// super("printpowers", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
PlayerCharacter tar;
PlayerCharacter tar;
if (target != null && target instanceof PlayerCharacter)
tar = (PlayerCharacter) target;
else
tar = pc;
if (target != null && target instanceof PlayerCharacter)
tar = (PlayerCharacter) target;
else
tar = pc;
throwbackInfo(pc, "Server powers for " + tar.getFirstName());
throwbackInfo(pc, "Server powers for " + tar.getFirstName());
ConcurrentHashMap<Integer, CharacterPower> powers = tar.getPowers();
if (powers != null) {
throwbackInfo(pc,
"Power(token): Trains; TrainsGranted; MaxTrains");
for (CharacterPower power : powers.values()) {
PowersBase pb = power.getPower();
if (pb != null) {
throwbackInfo(pc, " " + pb.getName() + '('
+ pb.getToken() + "): "
+ power.getTrains() + "; "
+ power.getGrantedTrains() + "; "
+ pb.getMaxTrains());
}
}
} else
throwbackInfo(pc, "Powers not found for player");
}
ConcurrentHashMap<Integer, CharacterPower> powers = tar.getPowers();
if (powers != null) {
throwbackInfo(pc,
"Power(token): Trains; TrainsGranted; MaxTrains");
for (CharacterPower power : powers.values()) {
PowersBase pb = power.getPower();
if (pb != null) {
throwbackInfo(pc, " " + pb.getName() + '('
+ pb.getToken() + "): "
+ power.getTrains() + "; "
+ power.getGrantedTrains() + "; "
+ pb.getMaxTrains());
}
}
} else
throwbackInfo(pc, "Powers not found for player");
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Returns the player's current granted powers";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /printpowers'";
}
}
}
+46 -46
View File
@@ -14,58 +14,58 @@ import engine.objects.*;
public class PrintResistsCmd extends AbstractDevCmd {
public PrintResistsCmd() {
super("printresists");
// super("printresists", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
public PrintResistsCmd() {
super("printresists");
// super("printresists", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
AbstractCharacter tar;
AbstractCharacter tar;
if (target != null && target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
} else
tar = pc;
if (target != null && target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
} else
tar = pc;
//Get name and type
String type = "PlayerCharacter";
String name = tar.getFirstName();
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null)
name = mb.getFirstName();
type = "Mob";
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null) {
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
}
type = "NPC";
}
//Get name and type
String type = "PlayerCharacter";
String name = tar.getFirstName();
if (tar instanceof Mob) {
Mob mob = (Mob) tar;
MobBase mb = mob.getMobBase();
if (mb != null)
name = mb.getFirstName();
type = "Mob";
} else if (tar instanceof NPC) {
NPC npc = (NPC) tar;
Contract contract = npc.getContract();
if (contract != null) {
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
}
type = "NPC";
}
throwbackInfo(pc, "Server resists for " + type + ' ' + name);
if (tar.getResists() != null) {
tar.getResists().printResistsToClient(pc);
} else
throwbackInfo(pc, "Resists for " + type + ' ' + name + " not found");
}
throwbackInfo(pc, "Server resists for " + type + ' ' + name);
if (tar.getResists() != null) {
tar.getResists().printResistsToClient(pc);
} else
throwbackInfo(pc, "Resists for " + type + ' ' + name + " not found");
}
@Override
protected String _getHelpString() {
return "Returns the player's current resists";
}
@Override
protected String _getHelpString() {
return "Returns the player's current resists";
}
@Override
protected String _getUsageString() {
return "' /printresists'";
}
@Override
protected String _getUsageString() {
return "' /printresists'";
}
}
+39 -39
View File
@@ -17,50 +17,50 @@ import java.util.concurrent.ConcurrentHashMap;
public class PrintSkillsCmd extends AbstractDevCmd {
public PrintSkillsCmd() {
super("printskills");
// super("printskills", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
public PrintSkillsCmd() {
super("printskills");
// super("printskills", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
AbstractCharacter tar = null;
AbstractCharacter tar = null;
if (target != null && target instanceof PlayerCharacter)
tar = (PlayerCharacter) target;
else if (target.getObjectType() == GameObjectType.Mob)
tar = (Mob) target;
else
tar = pc;
if (target != null && target instanceof PlayerCharacter)
tar = (PlayerCharacter) target;
else if (target.getObjectType() == GameObjectType.Mob)
tar = (Mob) target;
else
tar = pc;
throwbackInfo(pc, "Server skills for " + tar.getFirstName());
ConcurrentHashMap<String, CharacterSkill> skills = tar.getSkills();
if (skills != null) {
throwbackInfo(pc,
"Skills Name: Trains; Base(Trains); ModBase(Trains)");
for (CharacterSkill skill : skills.values()) {
throwbackInfo(pc, " " + skill.getName() + ": "
+ skill.getNumTrains() + "; "
+ skill.getBaseAmountBeforeMods() + " ("
+ skill.getModifiedAmountBeforeMods() + "); "
+ skill.getBaseAmount() + " ("
+ skill.getModifiedAmount() + '('
+ skill.getTotalSkillPercet() + " )");
}
} else
throwbackInfo(pc, "Skills not found for player");
}
throwbackInfo(pc, "Server skills for " + tar.getFirstName());
ConcurrentHashMap<String, CharacterSkill> skills = tar.getSkills();
if (skills != null) {
throwbackInfo(pc,
"Skills Name: Trains; Base(Trains); ModBase(Trains)");
for (CharacterSkill skill : skills.values()) {
throwbackInfo(pc, " " + skill.getName() + ": "
+ skill.getNumTrains() + "; "
+ skill.getBaseAmountBeforeMods() + " ("
+ skill.getModifiedAmountBeforeMods() + "); "
+ skill.getBaseAmount() + " ("
+ skill.getModifiedAmount() + '('
+ skill.getTotalSkillPercet() + " )");
}
} else
throwbackInfo(pc, "Skills not found for player");
}
@Override
protected String _getHelpString() {
return "Returns the player's current skills";
}
@Override
protected String _getHelpString() {
return "Returns the player's current skills";
}
@Override
protected String _getUsageString() {
return "' /printskills'";
}
@Override
protected String _getUsageString() {
return "' /printskills'";
}
}
+108 -110
View File
@@ -20,135 +20,133 @@ import java.util.HashMap;
public class PrintStatsCmd extends AbstractDevCmd {
public PrintStatsCmd() {
super("printstats");
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
public PrintStatsCmd() {
super("printstats");
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
if (equip.containsKey(slot)) {
MobEquipment item = equip.get(slot);
if (item != null && item.getItemBase() != null) {
return item.getItemBase();
}
}
return null;
}
AbstractCharacter tar;
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target != null && target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
AbstractCharacter tar;
if (tar instanceof PlayerCharacter) {
printStatsPlayer(pc, (PlayerCharacter) tar);
this.setTarget(tar); //for logging
} else if (tar instanceof Mob)
printStatsMob(pc, (Mob) tar);
else if (tar instanceof NPC)
printStatsNPC(pc, (NPC) tar);
}
}
if (target != null && target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
String newline = "\r\n ";
String out = "Server stats for Player " + tar.getFirstName() + newline;
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
out += "Stats Base (Modified)" + newline;
if (tar instanceof PlayerCharacter) {
printStatsPlayer(pc, (PlayerCharacter) tar);
this.setTarget(tar); //for logging
} else if (tar instanceof Mob)
printStatsMob(pc, (Mob) tar);
else if (tar instanceof NPC)
printStatsNPC(pc, (NPC) tar);
}
}
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
String newline = "\r\n ";
String out = "Server stats for Player " + tar.getFirstName() + newline;
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
out += "Stats Base (Modified)" + newline;
out += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
throwbackInfo(pc, out);
out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
out += "Defense: " + tar.getDefenseRating() + newline;
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
throwbackInfo(pc, out);
}
out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
throwbackInfo(pc, out);
out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
out += "Defense: " + tar.getDefenseRating() + newline;
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
throwbackInfo(pc, out);
}
public void printStatsMob(PlayerCharacter pc, Mob tar) {
MobBase mb = tar.getMobBase();
if (mb == null)
return;
public void printStatsMob(PlayerCharacter pc, Mob tar) {
MobBase mb = tar.getMobBase();
if (mb == null)
return;
String newline = "\r\n ";
String out = "Server stats for Mob " + mb.getFirstName() + newline;
out += "Stats Base (Modified)" + newline;
out += " Str: " + tar.getStatStrCurrent() + " (" + tar.getStatStrCurrent() + ')' + newline;
out += " Dex: " + tar.getStatDexCurrent() + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getStatDexCurrent() + newline;
out += " Con: " + tar.getStatConCurrent() + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getStatConCurrent() + newline;
out += " Int: " + tar.getStatIntCurrent() + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getStatIntCurrent() + newline;
out += " Spi: " + tar.getStatSpiCurrent() + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getStatSpiCurrent() + newline;
String newline = "\r\n ";
String out = "Server stats for Mob " + mb.getFirstName() + newline;
out += "Stats Base (Modified)" + newline;
out += " Str: " + tar.getStatStrCurrent() + " (" + tar.getStatStrCurrent() + ')' + newline;
out += " Dex: " + tar.getStatDexCurrent() + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getStatDexCurrent() + newline;
out += " Con: " + tar.getStatConCurrent() + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getStatConCurrent() + newline;
out += " Int: " + tar.getStatIntCurrent() + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getStatIntCurrent() + newline;
out += " Spi: " + tar.getStatSpiCurrent() + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getStatSpiCurrent() + newline;
out += "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
out += "Defense: " + tar.getDefenseRating() + newline;
out += "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
out += "Defense: " + tar.getDefenseRating() + newline;
//get weapons
HashMap<Integer, MobEquipment> equip = tar.getEquip();
ItemBase main = null;
//get weapons
HashMap<Integer, MobEquipment> equip = tar.getEquip();
ItemBase main = null;
if (equip != null)
main = getWeaponBase(1, equip);
ItemBase off = null;
if (equip != null)
main = getWeaponBase(1, equip);
ItemBase off = null;
if (equip != null)
getWeaponBase(2, equip);
if (main == null && off == null) {
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
} else {
if (main != null)
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
if (off != null)
out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
}
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
if (equip != null)
getWeaponBase(2, equip);
if (main == null && off == null) {
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
} else {
if (main != null)
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
if (off != null)
out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
}
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
throwbackInfo(pc, out);
}
throwbackInfo(pc, out);
}
public void printStatsNPC(PlayerCharacter pc, NPC tar) {
Contract contract = tar.getContract();
if (contract == null)
return;
public void printStatsNPC(PlayerCharacter pc, NPC tar) {
Contract contract = tar.getContract();
if (contract == null)
return;
String newline = "\r\n ";
String newline = "\r\n ";
String name;
if (contract != null) {
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
} else
name = tar.getName();
String out = "Server stats for NPC " + name + newline;
out += "Sell Percent: " + tar.getSellPercent() + ", Buy Percent: " + tar.getBuyPercent() + newline;
String name;
if (contract != null) {
if (contract.isTrainer())
name = tar.getName() + ", " + contract.getName();
else
name = tar.getName() + " the " + contract.getName();
} else
name = tar.getName();
String out = "Server stats for NPC " + name + newline;
out += "Sell Percent: " + tar.getSellPercent() + ", Buy Percent: " + tar.getBuyPercent() + newline;
throwbackInfo(pc, out);
}
throwbackInfo(pc, out);
}
@Override
protected String _getHelpString() {
return "Returns the player's current stats";
}
public static ItemBase getWeaponBase(int slot, HashMap<Integer, MobEquipment> equip) {
if (equip.containsKey(slot)) {
MobEquipment item = equip.get(slot);
if (item != null && item.getItemBase() != null) {
return item.getItemBase();
}
}
return null;
}
@Override
protected String _getHelpString() {
return "Returns the player's current stats";
}
@Override
protected String _getUsageString() {
return "' /printstats'";
}
@Override
protected String _getUsageString() {
return "' /printstats'";
}
}
+45 -45
View File
@@ -16,57 +16,57 @@ import java.util.ArrayList;
public class PrintVaultCmd extends AbstractDevCmd {
public PrintVaultCmd() {
super("printvault");
}
public PrintVaultCmd() {
super("printvault");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
if (target != null) {
if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
AbstractWorldObject tar;
String name;
String type = "PlayerCharacter";
if (target != null) {
if (target instanceof AbstractCharacter) {
tar = (AbstractCharacter) target;
name = ((AbstractCharacter) tar).getFirstName();
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
} else {
tar = pc;
name = ((AbstractCharacter) tar).getFirstName();
}
if (!(tar instanceof PlayerCharacter)) {
throwbackError(pc, "Must target player");
return;
}
if (!(tar instanceof PlayerCharacter)) {
throwbackError(pc, "Must target player");
return;
}
CharacterItemManager cim = ((AbstractCharacter)tar).getCharItemManager();
ArrayList<Item> list = cim.getVault();
throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Item item : list) {
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
}
Item gold = cim.getGoldVault();
if (gold != null)
throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
else
throwbackInfo(pc, " NULL Gold");
}
CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
ArrayList<Item> list = cim.getVault();
throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
for (Item item : list) {
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
}
Item gold = cim.getGoldVault();
if (gold != null)
throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
else
throwbackInfo(pc, " NULL Gold");
}
@Override
protected String _getHelpString() {
return "Returns the player's current vault";
}
@Override
protected String _getHelpString() {
return "Returns the player's current vault";
}
@Override
protected String _getUsageString() {
return "' /printvault'";
}
@Override
protected String _getUsageString() {
return "' /printvault'";
}
}
+75 -77
View File
@@ -8,97 +8,95 @@ import engine.math.Vector3fImmutable;
import engine.objects.*;
/**
*
* @author
* Dev command to move mobile and it's spawn location
* @author Dev command to move mobile and it's spawn location
* to the player's current location
*/
public class PullCmd extends AbstractDevCmd {
public PullCmd() {
public PullCmd() {
super("pull");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
private static void MoveMobile(Mob targetMobile, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
Mob targetMobile;
Vector3fImmutable targetLoc;
Zone serverZone;
Vector3fImmutable localCoords;
if (validateUserInput(pcSender, target, args) == false) {
this.sendUsage(pcSender);
return;
}
localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
targetLoc = pcSender.getLoc();
serverZone = ZoneManager.findSmallestZone(targetLoc);
switch (target.getObjectType()) {
case Mob:
MoveMobile((Mob) target, pcSender, targetLoc, serverZone);
break;
case Building:
MoveBuilding((Building) target, pcSender, targetLoc, serverZone);
break;
case NPC:
MoveNPC((NPC) target, pcSender, targetLoc, serverZone);
}
}
DbManager.MobQueries.MOVE_MOB(targetMobile.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
targetMobile.setBindLoc(newLoc);
targetMobile.setLoc(newLoc);
targetMobile.refresh();
}
@Override
protected String _getUsageString() {
private static void MoveBuilding(Building targetBuilding, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
Vector3fImmutable localCoords;
localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
DbManager.BuildingQueries.MOVE_BUILDING(targetBuilding.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
targetBuilding.setLoc(newLoc);
targetBuilding.getBounds().setBounds(targetBuilding);
targetBuilding.refresh(true);
}
private static void MoveNPC(NPC targetNPC, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
Vector3fImmutable localCoords;
localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
DbManager.NPCQueries.MOVE_NPC(targetNPC.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
targetNPC.setBindLoc(newLoc);
targetNPC.setLoc(newLoc);
WorldGrid.updateObject(targetNPC, pcSender);
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
Mob targetMobile;
Vector3fImmutable targetLoc;
Zone serverZone;
if (validateUserInput(pcSender, target, args) == false) {
this.sendUsage(pcSender);
return;
}
targetLoc = pcSender.getLoc();
serverZone = ZoneManager.findSmallestZone(targetLoc);
switch (target.getObjectType()) {
case Mob:
MoveMobile((Mob) target, pcSender, targetLoc, serverZone);
break;
case Building:
MoveBuilding((Building) target, pcSender, targetLoc, serverZone);
break;
case NPC:
MoveNPC((NPC) target, pcSender, targetLoc, serverZone);
}
}
@Override
protected String _getUsageString() {
return "/pull";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Moves mobile (and spawn) to player's location";
}
}
private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
// No target
if (currTarget == null) {
throwbackError(pcSender, "Requires a Mobile be targeted");
return false;
}
return true;
}
private static void MoveMobile(Mob targetMobile, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
Vector3fImmutable localCoords;
localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
DbManager.MobQueries.MOVE_MOB(targetMobile.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
targetMobile.setBindLoc(newLoc);
targetMobile.setLoc(newLoc);
targetMobile.refresh();
}
private static void MoveBuilding(Building targetBuilding, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
Vector3fImmutable localCoords;
localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
DbManager.BuildingQueries.MOVE_BUILDING(targetBuilding.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
targetBuilding.setLoc(newLoc);
targetBuilding.getBounds().setBounds(targetBuilding);
targetBuilding.refresh(true);
}
private static void MoveNPC(NPC targetNPC, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
Vector3fImmutable localCoords;
localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
DbManager.NPCQueries.MOVE_NPC(targetNPC.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
targetNPC.setBindLoc(newLoc);
targetNPC.setLoc(newLoc);
WorldGrid.updateObject(targetNPC, pcSender);
}
// No target
if (currTarget == null) {
throwbackError(pcSender, "Requires a Mobile be targeted");
return false;
}
return true;
}
}
+205 -208
View File
@@ -18,50 +18,48 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* @author
* Summary: Game designer utility command to purge all
objects of a given type within a supplied range
* @author Summary: Game designer utility command to purge all
* objects of a given type within a supplied range
*/
public class PurgeObjectsCmd extends AbstractDevCmd {
// Instance variables
// Instance variables
private Vector3fImmutable _currentLocation;
private float _targetRange;
private int _targetMask;
private Vector3fImmutable _currentLocation;
private float _targetRange;
private int _targetMask;
// Concurrency support
// Concurrency support
private ReadWriteLock lock = new ReentrantReadWriteLock();
private ReadWriteLock lock = new ReentrantReadWriteLock();
// Constructor
// Constructor
public PurgeObjectsCmd() {
public PurgeObjectsCmd() {
super("purge");
}
private static void PurgeWalls(Zone zone, PlayerCharacter pc){
private static void PurgeWalls(Zone zone, PlayerCharacter pc) {
if (!zone.isPlayerCity())
return;
for (Building building: zone.zoneBuildingSet){
for (Building building : zone.zoneBuildingSet) {
if (!BuildingManager.IsWallPiece(building))
continue;
for (AbstractCharacter ac: building.getHirelings().keySet()){
for (AbstractCharacter ac : building.getHirelings().keySet()) {
NPC npc = null;
Mob mobA = null;
if (ac.getObjectType() == GameObjectType.NPC)
npc = (NPC)ac;
npc = (NPC) ac;
else if (ac.getObjectType() == GameObjectType.Mob)
mobA = (Mob)ac;
mobA = (Mob) ac;
if (npc != null){
for (Mob mob: npc.getSiegeMinionMap().keySet()){
if (npc != null) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
@@ -72,8 +70,8 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
DbManager.removeFromCache(GameObjectType.NPC,
npc.getObjectUUID());
WorldGrid.RemoveWorldObject(npc);
}else if (mobA != null){
for (Mob mob: mobA.getSiegeMinionMap().keySet()){
} else if (mobA != null) {
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
@@ -100,216 +98,215 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
private static boolean validateUserInput(String[] userInput) {
// Grab write lock due to use of instance variables
int stringIndex;
String commandSet = "npcmobmeshall";
lock.writeLock().lock();
// incorrect number of arguments test
try {
if (args[0].toLowerCase().equals("walls")){
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
PurgeWalls(zone, pc);
return;
}
if (userInput.length != 2)
return false;
if(validateUserInput(args) == false) {
this.sendUsage(pc);
return;
}
// Test of game object type argument
parseUserInput(args);
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
// Arguments have been validated and parsed at this point
// Build array of requested objects
if (stringIndex == -1)
return false;
_currentLocation = pc.getLoc();
// Test if range argument can convert to a float
HashSet<AbstractWorldObject> objectList =
WorldGrid.getObjectsInRangePartial(_currentLocation, _targetRange, _targetMask);
try {
Float.parseFloat(userInput[1]);
} catch (NumberFormatException | NullPointerException e) {
return false;
}
// Iterate through array and remove objects from game world and database
// User input passes validation
for (AbstractWorldObject awo : objectList) {
return true;
}
switch(awo.getObjectType()) {
case Building:
removeBuilding(pc, (Building) awo);
break;
case NPC:
removeNPC(pc, (NPC) awo);
break;
case Mob:
removeMob(pc, (Mob) awo);
break;
default:
break;
}
}
private static void removeBuilding(PlayerCharacter pc, Building building) {
// Send results to user
throwbackInfo(pc, "Purge: " + objectList.size() + " objects were removed in range " + _targetRange);
}catch(Exception e){
Logger.error(e);
}
if ((building.getBlueprintUUID() != 0) &&
(building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL))
return;
if ((building.getBlueprintUUID() != 0) &&
(building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
Shrine.RemoveShrineFromCacheByBuilding(building);
// Release Reentrant lock
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
building.disableSpire(false);
finally {
lock.writeLock().unlock();
}
}
for (AbstractCharacter ac : building.getHirelings().keySet()) {
NPC npc = null;
Mob mobA = null;
@Override
protected String _getHelpString() {
if (ac.getObjectType() == GameObjectType.NPC)
npc = (NPC) ac;
else if (ac.getObjectType() == GameObjectType.Mob)
mobA = (Mob) ac;
if (npc != null) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(Enum.GameObjectType.NPC,
npc.getObjectUUID());
WorldGrid.RemoveWorldObject(npc);
} else if (mobA != null) {
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.MobQueries.DELETE_MOB(mobA);
DbManager.removeFromCache(Enum.GameObjectType.Mob,
mobA.getObjectUUID());
WorldGrid.RemoveWorldObject(mobA);
}
}
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
DbManager.removeFromCache(building);
WorldGrid.RemoveWorldObject(building);
WorldGrid.removeObject(building, pc);
}
private static void removeNPC(PlayerCharacter pc, NPC npc) {
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(npc);
WorldGrid.RemoveWorldObject(npc);
WorldGrid.removeObject(npc, pc);
}
// Class methods
private static void removeMob(PlayerCharacter pc, Mob mob) {
mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
//mob.setHealth(-1, pc); //Kill it!
DbManager.MobQueries.DELETE_MOB(mob);
DbManager.removeFromCache(mob);
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
// Grab write lock due to use of instance variables
lock.writeLock().lock();
try {
if (args[0].toLowerCase().equals("walls")) {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
PurgeWalls(zone, pc);
return;
}
if (validateUserInput(args) == false) {
this.sendUsage(pc);
return;
}
parseUserInput(args);
// Arguments have been validated and parsed at this point
// Build array of requested objects
_currentLocation = pc.getLoc();
HashSet<AbstractWorldObject> objectList =
WorldGrid.getObjectsInRangePartial(_currentLocation, _targetRange, _targetMask);
// Iterate through array and remove objects from game world and database
for (AbstractWorldObject awo : objectList) {
switch (awo.getObjectType()) {
case Building:
removeBuilding(pc, (Building) awo);
break;
case NPC:
removeNPC(pc, (NPC) awo);
break;
case Mob:
removeMob(pc, (Mob) awo);
break;
default:
break;
}
}
// Send results to user
throwbackInfo(pc, "Purge: " + objectList.size() + " objects were removed in range " + _targetRange);
} catch (Exception e) {
Logger.error(e);
}
// Release Reentrant lock
finally {
lock.writeLock().unlock();
}
}
@Override
protected String _getHelpString() {
return "Purges game objects within range";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "/purge [npc|mob|mesh|all] [range <= 200]";
}
}
// Class methods
private void parseUserInput(String[] userInput) {
private static boolean validateUserInput(String[] userInput) {
_targetMask = 0;
_targetRange = 0f;
int stringIndex;
String commandSet = "npcmobmeshall";
// Build mask from user input
// incorrect number of arguments test
switch (userInput[0].toLowerCase()) {
case "npc":
_targetMask = MBServerStatics.MASK_NPC;
break;
case "mob":
_targetMask = MBServerStatics.MASK_MOB;
break;
case "mesh":
_targetMask = MBServerStatics.MASK_BUILDING;
break;
case "all":
_targetMask = MBServerStatics.MASK_NPC | MBServerStatics.MASK_MOB | MBServerStatics.MASK_BUILDING;
break;
default:
break;
}
if (userInput.length != 2)
return false;
// Parse second argument into range parameter. Cap at 200 units.
// Test of game object type argument
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
if (stringIndex == -1)
return false;
// Test if range argument can convert to a float
try {
Float.parseFloat(userInput[1]); }
catch (NumberFormatException | NullPointerException e) {
return false;
}
// User input passes validation
return true;
}
private void parseUserInput(String[] userInput) {
_targetMask = 0;
_targetRange = 0f;
// Build mask from user input
switch (userInput[0].toLowerCase()) {
case "npc":
_targetMask = MBServerStatics.MASK_NPC;
break;
case "mob":
_targetMask = MBServerStatics.MASK_MOB;
break;
case "mesh":
_targetMask = MBServerStatics.MASK_BUILDING;
break;
case "all":
_targetMask = MBServerStatics.MASK_NPC | MBServerStatics.MASK_MOB | MBServerStatics.MASK_BUILDING;
break;
default:
break;
}
// Parse second argument into range parameter. Cap at 200 units.
_targetRange = Float.parseFloat(userInput[1]);
_targetRange = Math.min(_targetRange, 200f);
}
private static void removeBuilding(PlayerCharacter pc, Building building) {
if ((building.getBlueprintUUID() != 0) &&
(building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL))
return;
if ((building.getBlueprintUUID() != 0) &&
(building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
Shrine.RemoveShrineFromCacheByBuilding(building);
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
building.disableSpire(false);
for (AbstractCharacter ac: building.getHirelings().keySet()){
NPC npc = null;
Mob mobA = null;
if (ac.getObjectType() == GameObjectType.NPC)
npc = (NPC)ac;
else if (ac.getObjectType() == GameObjectType.Mob)
mobA = (Mob)ac;
if (npc != null){
for (Mob mob: npc.getSiegeMinionMap().keySet()){
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(Enum.GameObjectType.NPC,
npc.getObjectUUID());
WorldGrid.RemoveWorldObject(npc);
}else if (mobA != null){
for (Mob mob: mobA.getSiegeMinionMap().keySet()){
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.MobQueries.DELETE_MOB(mobA);
DbManager.removeFromCache(Enum.GameObjectType.Mob,
mobA.getObjectUUID());
WorldGrid.RemoveWorldObject(mobA);
}
}
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
DbManager.removeFromCache(building);
WorldGrid.RemoveWorldObject(building);
WorldGrid.removeObject(building, pc);
}
private static void removeNPC(PlayerCharacter pc, NPC npc) {
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(npc);
WorldGrid.RemoveWorldObject(npc);
WorldGrid.removeObject(npc, pc);
}
private static void removeMob(PlayerCharacter pc, Mob mob) {
mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
//mob.setHealth(-1, pc); //Kill it!
DbManager.MobQueries.DELETE_MOB(mob);
DbManager.removeFromCache(mob);
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
}
_targetRange = Float.parseFloat(userInput[1]);
_targetRange = Math.min(_targetRange, 200f);
}
}
+41 -42
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
@@ -21,68 +20,68 @@ import engine.objects.Zone;
public class RealmInfoCmd extends AbstractDevCmd {
public RealmInfoCmd() {
public RealmInfoCmd() {
super("realminfo");
}
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
AbstractGameObject target) {
Zone serverZone;
Realm serverRealm;
int realmID;
String outString = "";
Zone serverZone;
Realm serverRealm;
int realmID;
String outString = "";
if (playerCharacter == null)
return;
if (playerCharacter == null)
return;
serverZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
serverZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
if (serverZone == null) {
throwbackError(playerCharacter, "Zone not found");
return;
}
if (serverZone == null) {
throwbackError(playerCharacter, "Zone not found");
return;
}
realmID = RealmMap.getRealmIDAtLocation(playerCharacter.getLoc());
realmID = RealmMap.getRealmIDAtLocation(playerCharacter.getLoc());
String newline = "\r\n ";
String newline = "\r\n ";
outString = newline;
outString += "Realm: " + realmID + "(";
outString = newline;
outString += "Realm: " + realmID + "(";
serverRealm = Realm.getRealm(realmID);
serverRealm = Realm.getRealm(realmID);
if (serverRealm == null)
outString += "SeaFloor";
else
outString += serverRealm.getRealmName();
if (serverRealm == null)
outString += "SeaFloor";
else
outString += serverRealm.getRealmName();
outString += ")";
outString += newline;
outString += ")";
outString += newline;
outString += " Zone: " + serverZone.getName();
outString += " Zone: " + serverZone.getName();
outString += newline;
outString += newline;
if (serverZone.getParent() != null)
outString += " Parent: " + serverZone.getParent().getName();
else
outString += "Parent: NONE";
if (serverZone.getParent() != null)
outString += " Parent: " + serverZone.getParent().getName();
else
outString += "Parent: NONE";
outString += newline;
outString += newline;
throwbackInfo(playerCharacter, outString);
}
throwbackInfo(playerCharacter, outString);
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Returns info on realm.";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /info targetID'";
}
}
}
+20 -22
View File
@@ -6,43 +6,41 @@ import engine.objects.PlayerCharacter;
import org.pmw.tinylog.Logger;
/**
* @author
* Summary: Devcmd to reboot server
*
* @author Summary: Devcmd to reboot server
*/
public class RebootCmd extends AbstractDevCmd {
// Instance variables
// Instance variables
public RebootCmd() {
public RebootCmd() {
super("reboot");
}
// AbstractDevCmd Overridden methods
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
try {
Runtime rt = Runtime.getRuntime();
rt.exec("./mbrestart.sh");
} catch (java.io.IOException err) {
Logger.info( err.getMessage());
}
try {
Runtime rt = Runtime.getRuntime();
rt.exec("./mbrestart.sh");
} catch (java.io.IOException err) {
Logger.info(err.getMessage());
}
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Reboot server";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "./reboot";
}
}
}
+46 -47
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -18,62 +17,62 @@ import java.lang.reflect.Field;
public class RegionCmd extends AbstractDevCmd {
public RegionCmd() {
public RegionCmd() {
super("region");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (pc.region == null) {
this.throwbackInfo(pc, "No Region Found.");
return;
}
String newLine = System.getProperty("line.separator");
String result = "";
result += (pc.region.getClass().getSimpleName());
result += (" {");
result+=(newLine);
Field[] fields = pc.region.getClass().getDeclaredFields();
//print field names paired with their values
for ( Field field : fields ) {
field.setAccessible(true);
result+=(" ");
try {
if(field.getName().contains("Furniture"))
continue;
result+=( field.getName());
result+=(": ");
//requires access to private field:
result += (field.get(pc.region).toString());
} catch ( IllegalAccessException ex ) {
System.out.println(ex);
}
result.trim();
result+=(newLine);
}
result+=("}");
this.throwbackInfo(pc, result.toString());
this.throwbackInfo(pc, "No Region Found.");
return;
}
}
String newLine = System.getProperty("line.separator");
String result = "";
result += (pc.region.getClass().getSimpleName());
result += (" {");
result += (newLine);
Field[] fields = pc.region.getClass().getDeclaredFields();
@Override
protected String _getHelpString() {
return "Temporarily Changes SubRace";
}
//print field names paired with their values
for (Field field : fields) {
field.setAccessible(true);
result += (" ");
try {
@Override
protected String _getUsageString() {
return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
if (field.getName().contains("Furniture"))
continue;
result += (field.getName());
result += (": ");
//requires access to private field:
result += (field.get(pc.region).toString());
} catch (IllegalAccessException ex) {
System.out.println(ex);
}
result.trim();
result += (newLine);
}
result += ("}");
}
this.throwbackInfo(pc, result.toString());
}
@Override
protected String _getHelpString() {
return "Temporarily Changes SubRace";
}
@Override
protected String _getUsageString() {
return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
}
}
+32 -33
View File
@@ -16,55 +16,54 @@ import engine.objects.*;
/**
* @author Eighty
*
*/
public class RemoveBaneCmd extends AbstractDevCmd {
public RemoveBaneCmd() {
public RemoveBaneCmd() {
super("removebane");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) {
throwbackError(pc, "Unable to find the zone you're in.");
return;
}
if (zone == null) {
throwbackError(pc, "Unable to find the zone you're in.");
return;
}
if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city.");
return;
}
if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city.");
return;
}
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone.");
return;
}
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone.");
return;
}
Bane bane = city.getBane();
if (bane == null) {
throwbackError(pc, "Could not find bane to remove.");
return;
}
Bane bane = city.getBane();
if (bane == null) {
throwbackError(pc, "Could not find bane to remove.");
return;
}
bane.endBane(SiegeResult.DEFEND);
bane.endBane(SiegeResult.DEFEND);
throwbackInfo(pc, "The bane has been removed.");
}
throwbackInfo(pc, "The bane has been removed.");
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Removes a bane from the city grid you're standing on.";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "'./removebane'";
}
}
}
+186 -186
View File
@@ -26,240 +26,240 @@ import engine.objects.*;
*/
public class RemoveObjectCmd extends AbstractDevCmd {
public RemoveObjectCmd() {
//set to Player access level so it can be run by non-admins on production.
//Actual access level is set in _doCmd.
super("remove");
this.addCmdString("delete");
}
public RemoveObjectCmd() {
//set to Player access level so it can be run by non-admins on production.
//Actual access level is set in _doCmd.
super("remove");
this.addCmdString("delete");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words, AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter player, String[] words, AbstractGameObject target) {
int targetID;
DbObjectType targetObjType;
Building targetBuilding;
NPC targetNPC;
Mob targetMob;
int targetID;
DbObjectType targetObjType;
Building targetBuilding;
NPC targetNPC;
Mob targetMob;
if (target == null && words.length != 1) {
this.sendUsage(player);
return;
}
if (target == null && words.length != 1) {
this.sendUsage(player);
return;
}
// Delete the targeted building
// Delete the targeted building
if (target != null) {
if (target != null) {
switch (target.getObjectType()) {
switch (target.getObjectType()) {
case Building:
removeBuilding(player, (Building) target);
break;
case NPC:
removeNPC(player, (NPC) target);
break;
case Mob:
removeMob(player, (Mob) target);
break;
default:
throwbackError(player, "Target " + target.getObjectType()
+ " is not a valid object type");
break;
}
return;
}
case Building:
removeBuilding(player, (Building) target);
break;
case NPC:
removeNPC(player, (NPC) target);
break;
case Mob:
removeMob(player, (Mob) target);
break;
default:
throwbackError(player, "Target " + target.getObjectType()
+ " is not a valid object type");
break;
}
return;
}
// Attempt to delete object based upon parsed UUID from input
// Attempt to delete object based upon parsed UUID from input
// Parse Target UUID
// Parse Target UUID
try {
targetID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(player, "Supplied object ID " + words[0]
+ " failed to parse to an Integer");
return;
}
try {
targetID = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
throwbackError(player, "Supplied object ID " + words[0]
+ " failed to parse to an Integer");
return;
}
// Determine object type of given UUID
// Determine object type of given UUID
targetObjType = DbManager.BuildingQueries.GET_UID_ENUM(targetID);
targetObjType = DbManager.BuildingQueries.GET_UID_ENUM(targetID);
// Process accordingly
// Process accordingly
switch (targetObjType) {
case BUILDING:
targetBuilding = BuildingManager.getBuilding(targetID);
removeBuilding(player, targetBuilding);
break;
case NPC:
targetNPC = NPC.getNPC(targetID);
removeNPC(player, targetNPC);
break;
case MOB:
targetMob = Mob.getMob(targetID);
removeMob(player, targetMob);
break;
default:
throwbackError(player, "Invalid UUID: Not found in database");
break;
}
switch (targetObjType) {
case BUILDING:
targetBuilding = BuildingManager.getBuilding(targetID);
removeBuilding(player, targetBuilding);
break;
case NPC:
targetNPC = NPC.getNPC(targetID);
removeNPC(player, targetNPC);
break;
case MOB:
targetMob = Mob.getMob(targetID);
removeMob(player, targetMob);
break;
default:
throwbackError(player, "Invalid UUID: Not found in database");
break;
}
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Removes targeted or specified object";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /remove [objectID]' || ' /delete [objectID]'";
}
}
private void removeBuilding(PlayerCharacter pc, Building building) {
private void removeBuilding(PlayerCharacter pc, Building building) {
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
if (currentZone == null) {
this.throwbackError(pc, "Could not locate zone for player.");
return;
}
if (currentZone == null) {
this.throwbackError(pc, "Could not locate zone for player.");
return;
}
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
building.disableSpire(false);
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
building.disableSpire(false);
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)){
City city =City.getCity(building.getParentZone().getPlayerCityUUID());
if (city != null){
city.setWarehouseBuildingID(0);
}
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
}
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) {
City city = City.getCity(building.getParentZone().getPlayerCityUUID());
if (city != null) {
city.setWarehouseBuildingID(0);
}
Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
}
//remove cached shrines.
if ((building.getBlueprintUUID() != 0)
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
Shrine.RemoveShrineFromCacheByBuilding(building);
//remove cached shrines.
if ((building.getBlueprintUUID() != 0)
&& (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
Shrine.RemoveShrineFromCacheByBuilding(building);
for (AbstractCharacter ac : building.getHirelings().keySet()) {
NPC npc = null;
Mob mobA = null;
for (AbstractCharacter ac : building.getHirelings().keySet()) {
NPC npc = null;
Mob mobA = null;
if (ac.getObjectType() == GameObjectType.NPC)
npc = (NPC)ac;
else if (ac.getObjectType() == GameObjectType.Mob)
mobA = (Mob)ac;
if (ac.getObjectType() == GameObjectType.NPC)
npc = (NPC) ac;
else if (ac.getObjectType() == GameObjectType.Mob)
mobA = (Mob) ac;
if (npc != null){
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(npc);
WorldGrid.RemoveWorldObject(npc);
WorldGrid.removeObject(npc, pc);
}else if (mobA != null){
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.MobQueries.DELETE_MOB(mobA);
DbManager.removeFromCache(mobA);
WorldGrid.RemoveWorldObject(mobA);
WorldGrid.removeObject(mobA, pc);
}
if (npc != null) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(npc);
WorldGrid.RemoveWorldObject(npc);
WorldGrid.removeObject(npc, pc);
} else if (mobA != null) {
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.MobQueries.DELETE_MOB(mobA);
DbManager.removeFromCache(mobA);
WorldGrid.RemoveWorldObject(mobA);
WorldGrid.removeObject(mobA, pc);
}
}
Zone zone = building.getParentZone();
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
DbManager.removeFromCache(building);
zone.zoneBuildingSet.remove(building);
if(building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)){
building.RemoveFromBarracksList();
}
WorldGrid.RemoveWorldObject(building);
WorldGrid.removeObject(building, pc);
}
Zone zone = building.getParentZone();
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
DbManager.removeFromCache(building);
zone.zoneBuildingSet.remove(building);
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)) {
building.RemoveFromBarracksList();
}
WorldGrid.RemoveWorldObject(building);
WorldGrid.removeObject(building, pc);
ChatManager.chatSayInfo(pc,
"Building with ID " + building.getObjectUUID() + " removed");
this.setResult(String.valueOf(building.getObjectUUID()));
}
ChatManager.chatSayInfo(pc,
"Building with ID " + building.getObjectUUID() + " removed");
this.setResult(String.valueOf(building.getObjectUUID()));
}
private void removeNPC(PlayerCharacter pc, NPC npc) {
private void removeNPC(PlayerCharacter pc, NPC npc) {
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
if (currentZone == null) {
this.throwbackError(pc, "Could not locate zone for player.");
return;
}
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
if (currentZone == null) {
this.throwbackError(pc, "Could not locate zone for player.");
return;
}
// Remove npc from hirelings list.
// Remove npc from hirelings list.
if (npc.building != null)
npc.building.getHirelings().remove(npc);
if (npc.building != null)
npc.building.getHirelings().remove(npc);
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
}
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(npc);
WorldGrid.RemoveWorldObject(npc);
WorldGrid.removeObject(npc, pc);
ChatManager.chatSayInfo(pc,
"NPC with ID " + npc.getDBID() + " removed");
this.setResult(String.valueOf(npc.getDBID()));
}
DbManager.NPCQueries.DELETE_NPC(npc);
DbManager.removeFromCache(npc);
WorldGrid.RemoveWorldObject(npc);
WorldGrid.removeObject(npc, pc);
ChatManager.chatSayInfo(pc,
"NPC with ID " + npc.getDBID() + " removed");
this.setResult(String.valueOf(npc.getDBID()));
}
private void removeMob(PlayerCharacter pc, Mob mob) {
private void removeMob(PlayerCharacter pc, Mob mob) {
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
if (currentZone == null) {
this.throwbackError(pc, "Could not locate zone for player.");
return;
}
if (currentZone == null) {
this.throwbackError(pc, "Could not locate zone for player.");
return;
}
if (mob.getParentZone() != null && mob.getParentZone() != currentZone && !mob.isPet() && !mob.isNecroPet()) {
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
return;
}
if (mob.getParentZone() != null && mob.getParentZone() != currentZone && !mob.isPet() && !mob.isNecroPet()) {
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
return;
}
// Remove npc from hirelings list.
// Remove npc from hirelings list.
if (mob.building != null)
mob.building.getHirelings().remove(mob);
if (mob.building != null)
mob.building.getHirelings().remove(mob);
mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
//mob.setHealth(-1, pc); //Kill it!
mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
//mob.setHealth(-1, pc); //Kill it!
DbManager.MobQueries.DELETE_MOB(mob);
DbManager.MobQueries.DELETE_MOB(mob);
DbManager.removeFromCache(mob);
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
DbManager.removeFromCache(mob);
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
if (mob.getParentZone() != null)
mob.getParentZone().zoneMobSet.remove(mob);
ChatManager.chatSayInfo(pc,
"Mob with ID " + mob.getDBID() + " removed");
this.setResult(String.valueOf(mob.getDBID()));
}
ChatManager.chatSayInfo(pc,
"Mob with ID " + mob.getDBID() + " removed");
this.setResult(String.valueOf(mob.getDBID()));
}
}
+43 -45
View File
@@ -18,64 +18,62 @@ import engine.objects.NPC;
import engine.objects.PlayerCharacter;
/**
*
* @author Eighty
*
*/
public class RenameCmd extends AbstractDevCmd {
public RenameCmd() {
public RenameCmd() {
super("rename");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (args.length < 1) {
this.sendUsage(pcSender);
return;
}
if (args[0].isEmpty()) {
throwbackError(pcSender, "Invalid rename Command. must specify a name.");
return;
}
NPC npc = null;
Building building = null;
if (target != null) {
if (target instanceof NPC)
npc = (NPC) target;
else if (target instanceof Building)
building = (Building)target;
} else
npc = getTargetAsNPC(pcSender);
if (npc != null) {
DbManager.NPCQueries.SET_PROPERTY(npc, "npc_name", args[0]);
String name = args[0];
name = name.replaceAll("_", " ");
npc.setName(name);
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (args.length < 1) {
this.sendUsage(pcSender);
return;
}
if (args[0].isEmpty()) {
throwbackError(pcSender, "Invalid rename Command. must specify a name.");
return;
}
NPC npc = null;
Building building = null;
this.setResult(String.valueOf(npc.getDBID()));
if (target != null) {
if (target instanceof NPC)
npc = (NPC) target;
else if (target instanceof Building)
building = (Building) target;
} else
npc = getTargetAsNPC(pcSender);
if (npc != null) {
DbManager.NPCQueries.SET_PROPERTY(npc, "npc_name", args[0]);
String name = args[0];
name = name.replaceAll("_", " ");
npc.setName(name);
this.setResult(String.valueOf(npc.getDBID()));
// npc.updateDatabase();
WorldGrid.updateObject(npc, pcSender);
} else if (building != null){
String name = args[0];
name = name.replaceAll("_", " ");
building.setName(name);
}
throwbackError(pcSender, "Invalid rename Command. must target an npc.");
}
WorldGrid.updateObject(npc, pcSender);
} else if (building != null) {
String name = args[0];
name = name.replaceAll("_", " ");
building.setName(name);
}
throwbackError(pcSender, "Invalid rename Command. must target an npc.");
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /rename npcName'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Renames an NPC.";
}
}
}
+17 -18
View File
@@ -5,32 +5,31 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
public class ResetLevelCmd extends AbstractDevCmd {
public ResetLevelCmd() {
public ResetLevelCmd() {
super("resetlevel");
}
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter player, String[] args,
AbstractGameObject target) {
player.ResetLevel(Short.parseShort(args[0]));
}
// AbstractDevCmd Overridden methods
@Override
protected String _getHelpString() {
@Override
protected void _doCmd(PlayerCharacter player, String[] args,
AbstractGameObject target) {
player.ResetLevel(Short.parseShort(args[0]));
}
@Override
protected String _getHelpString() {
return "Resets character level to `level`. All training points are reset. Player must relog for changes to update.";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "/resetlevel <level>";
}
}
}
+191 -191
View File
@@ -20,232 +20,232 @@ import engine.objects.*;
public class RotateCmd extends AbstractDevCmd {
public RotateCmd() {
public RotateCmd() {
super("rotate");
this.addCmdString("rot");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target == null && (words.length != 2) ) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target == null && (words.length != 2)) {
this.sendUsage(pc);
return;
}
if (words.length == 3){
try{
if (words.length == 3) {
try {
}catch(Exception e){
} catch (Exception e) {
}
}
}
}
float rot;
if (target != null && words.length == 1) {
float rot;
if (target != null && words.length == 1) {
try {
if (words[0].equalsIgnoreCase("face")){
this.rotateFace(pc, target);
return;
}
try {
if (words[0].equalsIgnoreCase("face")) {
this.rotateFace(pc, target);
return;
}
rot = Float.parseFloat(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied rotation " + words[0]
+ " failed to parse to a Float");
return;
} catch (Exception e) {
throwbackError(pc,
"Invalid Rotate Command. Need Rotation specified.");
return;
}
rot = Float.parseFloat(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied rotation " + words[0]
+ " failed to parse to a Float");
return;
} catch (Exception e) {
throwbackError(pc,
"Invalid Rotate Command. Need Rotation specified.");
return;
}
Vector3f rotation = new Vector3f(0f, rot, 0f);
Vector3f rotation = new Vector3f(0f, rot, 0f);
if (target instanceof Building)
rotateBuilding(pc, (Building) target, rotation, rot,false);
else if (target instanceof NPC)
rotateNPC(pc, (NPC) target, rotation,false);
else if (target instanceof Mob)
rotateMob(pc, (Mob) target, rotation,false);
else
throwbackError(pc, "Target " + target.getObjectType()
+ " is not a valid object type");
} else {
if (target instanceof Building)
rotateBuilding(pc, (Building) target, rotation, rot, false);
else if (target instanceof NPC)
rotateNPC(pc, (NPC) target, rotation, false);
else if (target instanceof Mob)
rotateMob(pc, (Mob) target, rotation, false);
else
throwbackError(pc, "Target " + target.getObjectType()
+ " is not a valid object type");
} else {
int id = 0;
if (words.length == 2) {
try {
id = Integer.parseInt(words[0]);
int id = 0;
if (words.length == 2) {
try {
id = Integer.parseInt(words[0]);
if (words[1].equalsIgnoreCase("face")){
if (words[1].equalsIgnoreCase("face")) {
Building b;
if (id != 0)
b = BuildingManager.getBuilding(id);
else
b = getTargetAsBuilding(pc);
if (b != null) {
rotateFace(pc, b);
return;
}
Building b;
if (id != 0)
b = BuildingManager.getBuilding(id);
else
b = getTargetAsBuilding(pc);
if (b != null) {
rotateFace(pc, b);
return;
}
// building failed, try npc
NPC npc;
if (id != 0)
npc = NPC.getNPC(id);
else
npc = getTargetAsNPC(pc);
if (npc != null) {
rotateFace(pc, npc);
return;
}
// building failed, try npc
NPC npc;
if (id != 0)
npc = NPC.getNPC(id);
else
npc = getTargetAsNPC(pc);
if (npc != null) {
rotateFace(pc, npc);
return;
}
// NPC failed, try mob
Mob mob;
if (id != 0)
mob = Mob.getMob(id);
else
mob = getTargetAsMob(pc);
if (mob != null) {
rotateFace(pc, mob);
return;
}
throwbackError(pc, "Nothing found to rotate.");
return;
}
rot = Float.parseFloat(words[1]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied arguments " + words[0] + ' '
+ words[1] + " failed to parse");
return;
} catch (Exception e) {
throwbackError(pc,
"Invalid Rotate Command. Need Rotation specified.");
return; // NaN
}
} else {
try {
rot = Float.parseFloat(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied rotation " + words[0]
+ " failed to parse to a Float");
return;
} catch (Exception e) {
throwbackError(pc,
"Invalid Rotate Command. Need Rotation specified.");
return; // NaN
}
}
// NPC failed, try mob
Mob mob;
if (id != 0)
mob = Mob.getMob(id);
else
mob = getTargetAsMob(pc);
if (mob != null) {
rotateFace(pc, mob);
return;
}
throwbackError(pc, "Nothing found to rotate.");
return;
}
rot = Float.parseFloat(words[1]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied arguments " + words[0] + ' '
+ words[1] + " failed to parse");
return;
} catch (Exception e) {
throwbackError(pc,
"Invalid Rotate Command. Need Rotation specified.");
return; // NaN
}
} else {
try {
rot = Float.parseFloat(words[0]);
} catch (NumberFormatException e) {
throwbackError(pc, "Supplied rotation " + words[0]
+ " failed to parse to a Float");
return;
} catch (Exception e) {
throwbackError(pc,
"Invalid Rotate Command. Need Rotation specified.");
return; // NaN
}
}
Vector3f rotation = new Vector3f(0f, rot, 0f);
Vector3f rotation = new Vector3f(0f, rot, 0f);
Building b;
if (id != 0)
b = BuildingManager.getBuilding(id);
else
b = getTargetAsBuilding(pc);
if (b != null) {
rotateBuilding(pc, b, rotation, rot,false);
return;
}
Building b;
if (id != 0)
b = BuildingManager.getBuilding(id);
else
b = getTargetAsBuilding(pc);
if (b != null) {
rotateBuilding(pc, b, rotation, rot, false);
return;
}
// building failed, try npc
NPC npc;
if (id != 0)
npc = NPC.getNPC(id);
else
npc = getTargetAsNPC(pc);
if (npc != null) {
rotateNPC(pc, npc, rotation,false);
return;
}
// building failed, try npc
NPC npc;
if (id != 0)
npc = NPC.getNPC(id);
else
npc = getTargetAsNPC(pc);
if (npc != null) {
rotateNPC(pc, npc, rotation, false);
return;
}
// NPC failed, try mob
Mob mob;
if (id != 0)
mob = Mob.getMob(id);
else
mob = getTargetAsMob(pc);
if (mob != null) {
rotateMob(pc, mob, rotation,false);
return;
}
throwbackError(pc, "Nothing found to rotate.");
}
}
// NPC failed, try mob
Mob mob;
if (id != 0)
mob = Mob.getMob(id);
else
mob = getTargetAsMob(pc);
if (mob != null) {
rotateMob(pc, mob, rotation, false);
return;
}
throwbackError(pc, "Nothing found to rotate.");
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Rotates targeted or specified object";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /rotate [objectID] rotation' || ' /rot [objectID] rotation'";
}
}
private void rotateBuilding(PlayerCharacter pc, Building building, Vector3f rot, float orig, boolean faceDirection) {
if (!faceDirection)
rot.set(0.0f, (float)Math.sin(Math.toRadians(orig)/2), 0.0f);
building.setRot(rot);
building.setw( (float) Math.abs(Math.cos(Math.toRadians(orig)/2)) );
building.getBounds().setBounds(building);
WorldGrid.updateObject(building, pc);
DbManager.BuildingQueries.SET_PROPERTY(building, "rotY", building.getRot().getY());
DbManager.BuildingQueries.SET_PROPERTY(building, "w", building.getw());
ChatManager.chatSayInfo(pc,
"Building with ID " + building.getObjectUUID() + " rotated");
}
private void rotateBuilding(PlayerCharacter pc, Building building, Vector3f rot, float orig, boolean faceDirection) {
if (!faceDirection)
rot.set(0.0f, (float) Math.sin(Math.toRadians(orig) / 2), 0.0f);
building.setRot(rot);
building.setw((float) Math.abs(Math.cos(Math.toRadians(orig) / 2)));
building.getBounds().setBounds(building);
WorldGrid.updateObject(building, pc);
DbManager.BuildingQueries.SET_PROPERTY(building, "rotY", building.getRot().getY());
DbManager.BuildingQueries.SET_PROPERTY(building, "w", building.getw());
ChatManager.chatSayInfo(pc,
"Building with ID " + building.getObjectUUID() + " rotated");
}
private void rotateNPC(PlayerCharacter pc, NPC npc, Vector3f rot,boolean faceDirection) {
npc.setRot(rot);
DbManager.NPCQueries.SET_PROPERTY(npc, "npc_rotation", rot.y);
WorldGrid.updateObject(npc, pc);
//no rotation for npc's in db currently
ChatManager.chatSayInfo(pc,
"NPC with ID " + npc.getObjectUUID() + " rotated");
}
private void rotateNPC(PlayerCharacter pc, NPC npc, Vector3f rot, boolean faceDirection) {
npc.setRot(rot);
DbManager.NPCQueries.SET_PROPERTY(npc, "npc_rotation", rot.y);
WorldGrid.updateObject(npc, pc);
//no rotation for npc's in db currently
ChatManager.chatSayInfo(pc,
"NPC with ID " + npc.getObjectUUID() + " rotated");
}
private void rotateMob(PlayerCharacter pc, Mob mob, Vector3f rot,boolean faceDirection) {
mob.setRot(rot);
DbManager.MobQueries.SET_PROPERTY(mob, "mob_rotation", rot.y);
WorldGrid.updateObject(mob, pc);
//no rotation for mobs's in db currently
ChatManager.chatSayInfo(pc,
"Mob with ID " + mob.getObjectUUID() + " rotated");
}
private void rotateMob(PlayerCharacter pc, Mob mob, Vector3f rot, boolean faceDirection) {
mob.setRot(rot);
DbManager.MobQueries.SET_PROPERTY(mob, "mob_rotation", rot.y);
WorldGrid.updateObject(mob, pc);
//no rotation for mobs's in db currently
ChatManager.chatSayInfo(pc,
"Mob with ID " + mob.getObjectUUID() + " rotated");
}
private void rotateFace(PlayerCharacter pc, AbstractGameObject target){
AbstractWorldObject awo = (AbstractWorldObject)target;
if (awo == null)
return;
Vector3fImmutable buildingLoc = awo.getLoc();
Vector3fImmutable playerLoc = pc.getLoc();
private void rotateFace(PlayerCharacter pc, AbstractGameObject target) {
AbstractWorldObject awo = (AbstractWorldObject) target;
if (awo == null)
return;
Vector3fImmutable buildingLoc = awo.getLoc();
Vector3fImmutable playerLoc = pc.getLoc();
Vector3fImmutable faceDirection = playerLoc.subtract2D(buildingLoc);
Vector3fImmutable faceDirection = playerLoc.subtract2D(buildingLoc);
float rotangle = faceDirection.getRotation();
float rotangle = faceDirection.getRotation();
float rot = (float) Math.toDegrees(rotangle);
float rot = (float) Math.toDegrees(rotangle);
if (rot > 180)
rot*=-1;
if (rot > 180)
rot *= -1;
Vector3f buildingrotation = new Vector3f(0f, rot, 0f);
Vector3f rotation = new Vector3f(0f, rotangle, 0f);
if (target instanceof Building)
rotateBuilding(pc, (Building) target, buildingrotation, rot,false);
else if (target instanceof NPC)
rotateNPC(pc, (NPC) target, rotation,true);
else if (target instanceof Mob)
rotateMob(pc, (Mob) target, rotation,true);
else
throwbackError(pc, "Target " + target.getObjectType()
+ " is not a valid object type");
Vector3f buildingrotation = new Vector3f(0f, rot, 0f);
Vector3f rotation = new Vector3f(0f, rotangle, 0f);
if (target instanceof Building)
rotateBuilding(pc, (Building) target, buildingrotation, rot, false);
else if (target instanceof NPC)
rotateNPC(pc, (NPC) target, rotation, true);
else if (target instanceof Mob)
rotateMob(pc, (Mob) target, rotation, true);
else
throwbackError(pc, "Target " + target.getObjectType()
+ " is not a valid object type");
}
}
}
+94 -96
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.ai.MobileFSMManager;
@@ -19,111 +18,110 @@ import engine.server.MBServerStatics;
/**
* @author Steve
*
*/
public class SetAICmd extends AbstractDevCmd {
public SetAICmd() {
public SetAICmd() {
super("setAI");
this.addCmdString("ai");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2){
this.sendUsage(pc);
return;
}
int amount;
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length < 2) {
this.sendUsage(pc);
return;
}
try{
amount = Integer.valueOf(words[1]);
}catch (NumberFormatException e) {
this.throwbackError(pc, "Failed to parse amount");
return;
}
switch(words[0]){
case "angle" :
float angle = Float.parseFloat(words[1]);
MobileFSMManager.AI_MAX_ANGLE = angle;
break;
case "aggrorange":
MobileFSMManager.AI_BASE_AGGRO_RANGE = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Aggro Range is now set to " + amount);
break;
case "dropaggrorange":
MobileFSMManager.AI_DROP_AGGRO_RANGE = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Drop Aggro Range is now set to " + amount);
break;
case "patroldivisor":
MobileFSMManager.AI_PATROL_DIVISOR = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Patrol Chance is now set to " + amount);
break;
case "pulse":
if (amount < 500){
this.throwbackError(pc, "pulse amount must be greather than 500 to execute.");
return;
}
MobileFSMManager.AI_PULSE_MOB_THRESHOLD = amount;
this.throwbackInfo(pc, "Pulse is now set to " + amount);
break;
case "sleepthread":
if (amount < 500){
this.throwbackError(pc, "sleep amount must be greather than 500 to execute.");
return;
}
MobileFSMManager.AI_THREAD_SLEEP = amount;
this.throwbackInfo(pc, "Thread Sleep is now set to " + amount);
break;
case "recallrange":
MobileFSMManager.AI_RECALL_RANGE = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Recall Range is now set to " + amount);
break;
case "powerdivisor":
MobileFSMManager.AI_POWER_DIVISOR = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Power Divisor is now set to " + amount);
break;
case "losehate":
MBServerStatics.PLAYER_HATE_DELIMITER = amount;
break;
case "hatemodcombat":
MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER = amount;
default:
this.throwbackError(pc, words[0] + " is not a valid AI Command.");
break;
}
}
int amount;
@Override
protected String _getHelpString() {
String help = "Modifies Mob AI Statics. Commands:";
help += "\n AGGRORANGE: Sets the range when a mob will aggro it's target. Aggro range is currently " + MobileFSMManager.AI_BASE_AGGRO_RANGE;
help += "\n DROPAGGRORANGE: Sets the range when a mob will drop aggro from it's target. Drop aggro range is currently " + MobileFSMManager.AI_DROP_AGGRO_RANGE;
help += "\n PATROLDIVISOR: Sets the Patrol Divisor for Mob AI. Setting this will give a 1/[amount] chance to parol the area. Patrol Chance is currently 1/" + MobileFSMManager.AI_PATROL_DIVISOR;
help += "\n PULSE: sets how often to run mob's AI. Measured in MS. Pulse is currently " + MobileFSMManager.AI_PULSE_MOB_THRESHOLD + "ms.";
help += "\n SLEEPTHREAD: Sets how long to sleep the AI for ALL mobs.Thread sleep is currently " + MobileFSMManager.AI_THREAD_SLEEP + "ms.";
help += "\n RECALLRANGE: Sets the range of a mob to recall back to it's bind location. Recall range is currently " + MobileFSMManager.AI_RECALL_RANGE;
help += "\n POWERDIVISOR: Sets the Power Divisor for Mob AI.Setting this will give a 1/[amount] chance to use power on a player. Power Divisor is currently " + MobileFSMManager.AI_POWER_DIVISOR;
help += "\n LOSEHATE: Sets the amount per second to reduce hate amount for player while they are idle. Hate Delimiter is currently " + MBServerStatics.PLAYER_HATE_DELIMITER;
help += "\n HATEMODCOMBAT: sets the modifier for Hate value for Combat. Hate Value is `Damage *[HATEMODCOMBAT]`.Hate Mod Combat is currently " + MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER;
try {
amount = Integer.valueOf(words[1]);
} catch (NumberFormatException e) {
this.throwbackError(pc, "Failed to parse amount");
return;
}
return help;
}
switch (words[0]) {
case "angle":
float angle = Float.parseFloat(words[1]);
@Override
protected String _getUsageString() {
String usage = "' /setai `command` `amount` `";
usage += '\n' + _getHelpString();
return usage;
}
MobileFSMManager.AI_MAX_ANGLE = angle;
break;
case "aggrorange":
MobileFSMManager.AI_BASE_AGGRO_RANGE = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Aggro Range is now set to " + amount);
break;
case "dropaggrorange":
MobileFSMManager.AI_DROP_AGGRO_RANGE = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Drop Aggro Range is now set to " + amount);
break;
case "patroldivisor":
MobileFSMManager.AI_PATROL_DIVISOR = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Patrol Chance is now set to " + amount);
break;
case "pulse":
if (amount < 500) {
this.throwbackError(pc, "pulse amount must be greather than 500 to execute.");
return;
}
MobileFSMManager.AI_PULSE_MOB_THRESHOLD = amount;
this.throwbackInfo(pc, "Pulse is now set to " + amount);
break;
case "sleepthread":
if (amount < 500) {
this.throwbackError(pc, "sleep amount must be greather than 500 to execute.");
return;
}
MobileFSMManager.AI_THREAD_SLEEP = amount;
this.throwbackInfo(pc, "Thread Sleep is now set to " + amount);
break;
case "recallrange":
MobileFSMManager.AI_RECALL_RANGE = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Recall Range is now set to " + amount);
break;
case "powerdivisor":
MobileFSMManager.AI_POWER_DIVISOR = amount;
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
this.throwbackInfo(pc, "Power Divisor is now set to " + amount);
break;
case "losehate":
MBServerStatics.PLAYER_HATE_DELIMITER = amount;
break;
case "hatemodcombat":
MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER = amount;
default:
this.throwbackError(pc, words[0] + " is not a valid AI Command.");
break;
}
}
@Override
protected String _getHelpString() {
String help = "Modifies Mob AI Statics. Commands:";
help += "\n AGGRORANGE: Sets the range when a mob will aggro it's target. Aggro range is currently " + MobileFSMManager.AI_BASE_AGGRO_RANGE;
help += "\n DROPAGGRORANGE: Sets the range when a mob will drop aggro from it's target. Drop aggro range is currently " + MobileFSMManager.AI_DROP_AGGRO_RANGE;
help += "\n PATROLDIVISOR: Sets the Patrol Divisor for Mob AI. Setting this will give a 1/[amount] chance to parol the area. Patrol Chance is currently 1/" + MobileFSMManager.AI_PATROL_DIVISOR;
help += "\n PULSE: sets how often to run mob's AI. Measured in MS. Pulse is currently " + MobileFSMManager.AI_PULSE_MOB_THRESHOLD + "ms.";
help += "\n SLEEPTHREAD: Sets how long to sleep the AI for ALL mobs.Thread sleep is currently " + MobileFSMManager.AI_THREAD_SLEEP + "ms.";
help += "\n RECALLRANGE: Sets the range of a mob to recall back to it's bind location. Recall range is currently " + MobileFSMManager.AI_RECALL_RANGE;
help += "\n POWERDIVISOR: Sets the Power Divisor for Mob AI.Setting this will give a 1/[amount] chance to use power on a player. Power Divisor is currently " + MobileFSMManager.AI_POWER_DIVISOR;
help += "\n LOSEHATE: Sets the amount per second to reduce hate amount for player while they are idle. Hate Delimiter is currently " + MBServerStatics.PLAYER_HATE_DELIMITER;
help += "\n HATEMODCOMBAT: sets the modifier for Hate value for Combat. Hate Value is `Damage *[HATEMODCOMBAT]`.Hate Mod Combat is currently " + MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER;
return help;
}
@Override
protected String _getUsageString() {
String usage = "' /setai `command` `amount` `";
usage += '\n' + _getHelpString();
return usage;
}
}
+49 -51
View File
@@ -17,70 +17,68 @@ import engine.objects.CharacterRune;
import engine.objects.PlayerCharacter;
/**
*
* @author Eighty
*
*/
public class SetAdminRuneCmd extends AbstractDevCmd {
public SetAdminRuneCmd() {
public SetAdminRuneCmd() {
super("setadminrune");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
int runeID = 0;
boolean add = true;
try {
runeID = Integer.parseInt(args[0]);
if (args.length > 1)
add = (args[1].toLowerCase().equals("false")) ? false : true;
} catch (NumberFormatException e) {
this.sendUsage(pcSender);
return;
}
if (runeID < 2901 || runeID > 2911) {
throwbackError(pcSender,
"Invalid setrune Command. must specify an ID between 2901 and 2911.");
return;
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
int runeID = 0;
boolean add = true;
try {
runeID = Integer.parseInt(args[0]);
if (args.length > 1)
add = (args[1].toLowerCase().equals("false")) ? false : true;
} catch (NumberFormatException e) {
this.sendUsage(pcSender);
return;
}
if (runeID < 2901 || runeID > 2911) {
throwbackError(pcSender,
"Invalid setrune Command. must specify an ID between 2901 and 2911.");
return;
}
if(!(target instanceof PlayerCharacter)) {
target = pcSender;
}
if (!(target instanceof PlayerCharacter)) {
target = pcSender;
}
boolean worked = false;
if (add) {
worked = CharacterRune.grantRune((PlayerCharacter) target, runeID);
if (worked)
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " added");
else
throwbackError(pcSender, "Failed to add the rune of type "
+ runeID);
} else {
worked = CharacterRune.removeRune((PlayerCharacter) target, runeID);
if (worked) {
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " removed");
InterestManager.reloadCharacter(pcSender);
} else
throwbackError(pcSender, "Failed to remove the rune of type "
+ runeID);
}
this.setTarget(target); //for logging
boolean worked = false;
if (add) {
worked = CharacterRune.grantRune((PlayerCharacter) target, runeID);
if (worked)
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " added");
else
throwbackError(pcSender, "Failed to add the rune of type "
+ runeID);
} else {
worked = CharacterRune.removeRune((PlayerCharacter) target, runeID);
if (worked) {
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " removed");
InterestManager.reloadCharacter(pcSender);
} else
throwbackError(pcSender, "Failed to remove the rune of type "
+ runeID);
}
this.setTarget(target); //for logging
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /setrune runeID [true/false]'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Grant or remove the rune with the specified runeID";
}
}
}
+41 -42
View File
@@ -15,66 +15,65 @@ import engine.objects.*;
/**
* @author Eighty
*
*/
public class SetBaneActiveCmd extends AbstractDevCmd {
public SetBaneActiveCmd() {
public SetBaneActiveCmd() {
super("setbaneactive");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words.length != 1) {
this.sendUsage(pc);
return;
}
boolean setActive = false;
if (words[0].equals("true"))
setActive = true;
boolean setActive = false;
if (words[0].equals("true"))
setActive = true;
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null) {
throwbackError(pc, "Unable to find the zone you're in.");
return;
}
if (zone == null) {
throwbackError(pc, "Unable to find the zone you're in.");
return;
}
if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city.");
return;
}
if (!zone.isPlayerCity()) {
throwbackError(pc, "This is not a player city.");
return;
}
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone.");
return;
}
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null) {
throwbackError(pc, "Unable to find the city associated with this zone.");
return;
}
Bane bane = city.getBane();
if (bane == null) {
throwbackError(pc, "Could not find bane to modify.");
return;
}
Bane bane = city.getBane();
if (bane == null) {
throwbackError(pc, "Could not find bane to modify.");
return;
}
bane.getCity().protectionEnforced = !setActive;
if (setActive)
throwbackInfo(pc, "The bane has been set active.");
else
throwbackInfo(pc, "The bane has been set inactive.");
}
if (setActive)
throwbackInfo(pc, "The bane has been set active.");
else
throwbackInfo(pc, "The bane has been set inactive.");
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Sets a bane active or deactivates a bane.";
}
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "'./setbaneactive true|false'";
}
}
}
+36 -36
View File
@@ -17,48 +17,48 @@ import engine.objects.PlayerCharacter;
public class SetBaseClassCmd extends AbstractDevCmd {
public SetBaseClassCmd() {
public SetBaseClassCmd() {
super("setBaseClass");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
int classID = 0;
try {
classID = Integer.parseInt(words[0]);
} catch (Exception e) {
throwbackError(pc,
"Invalid setBaseClass Command. must specify an ID between 2500 and 2503.");
return;
}
if (classID < 2500 || classID > 2503) {
throwbackError(pc,
"Invalid setBaseClass Command. must specify an ID between 2500 and 2503.");
return;
}
pc.setBaseClass(classID);
this.setTarget(pc); //for logging
ChatManager.chatSayInfo(pc,
"BaseClass changed to " + classID);
InterestManager.reloadCharacter(pc);
int classID = 0;
try {
classID = Integer.parseInt(words[0]);
} catch (Exception e) {
throwbackError(pc,
"Invalid setBaseClass Command. must specify an ID between 2500 and 2503.");
return;
}
if (classID < 2500 || classID > 2503) {
throwbackError(pc,
"Invalid setBaseClass Command. must specify an ID between 2500 and 2503.");
return;
}
pc.setBaseClass(classID);
this.setTarget(pc); //for logging
ChatManager.chatSayInfo(pc,
"BaseClass changed to " + classID);
InterestManager.reloadCharacter(pc);
}
}
@Override
protected String _getHelpString() {
return "Sets your character's BaseClass to 'id'";
}
@Override
protected String _getHelpString() {
return "Sets your character's BaseClass to 'id'";
}
@Override
protected String _getUsageString() {
return "' /setBaseClass id'";
}
@Override
protected String _getUsageString() {
return "' /setBaseClass id'";
}
}
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -22,7 +21,7 @@ import engine.objects.PlayerCharacter;
public class SetBuildingAltitudeCmd extends AbstractDevCmd {
public SetBuildingAltitudeCmd() {
public SetBuildingAltitudeCmd() {
super("setbuildingaltitude");
this.addCmdString("buildingaltitude");
}
@@ -52,56 +51,56 @@ public class SetBuildingAltitudeCmd extends AbstractDevCmd {
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (target.getObjectType() != GameObjectType.Building){
this.sendUsage(pc);
return;
}
if (target.getObjectType() != GameObjectType.Building) {
this.sendUsage(pc);
return;
}
Building targetBuilding = (Building)target;
Building targetBuilding = (Building) target;
float altitude = 0;
try {
altitude = Float.parseFloat(words[0]);
float altitude = 0;
try {
altitude = Float.parseFloat(words[0]);
if (!UpdateBuildingAltitude(targetBuilding, targetBuilding.getStatAlt() + altitude)){
this.throwbackError(pc, "Failed to update building altitude");
return;
}
if (!UpdateBuildingAltitude(targetBuilding, targetBuilding.getStatAlt() + altitude)) {
this.throwbackError(pc, "Failed to update building altitude");
return;
}
WorldGrid.updateObject(targetBuilding);
WorldGrid.updateObject(targetBuilding);
this.setTarget(pc); //for logging
this.setTarget(pc); //for logging
// Update all surrounding clients.
// Update all surrounding clients.
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: " + words[0]
+ " failed to parse to an Integer.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to setSlot to "
+ words[0]);
}
}
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: " + words[0]
+ " failed to parse to an Integer.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to setSlot to "
+ words[0]);
}
}
@Override
protected String _getHelpString() {
return "Sets slot position for an NPC to 'slot'";
}
@Override
protected String _getHelpString() {
return "Sets slot position for an NPC to 'slot'";
}
@Override
protected String _getUsageString() {
return "' /changeslot slot'";
}
@Override
protected String _getUsageString() {
return "' /changeslot slot'";
}
}
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -20,35 +19,35 @@ import engine.objects.Zone;
public class SetForceRenameCityCmd extends AbstractDevCmd {
public SetForceRenameCityCmd() {
public SetForceRenameCityCmd() {
super("forcerename");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null)
return;
boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
if (zone.getPlayerCityUUID() == 0)
return;
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null)
return;
city.setForceRename(rename);
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected String _getHelpString() {
return "Temporarily Changes SubRace";
}
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
if (zone == null)
return;
boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
if (zone.getPlayerCityUUID() == 0)
return;
City city = City.getCity(zone.getPlayerCityUUID());
if (city == null)
return;
city.setForceRename(rename);
@Override
protected String _getUsageString() {
return "' /subrace mobBaseID";
}
}
@Override
protected String _getHelpString() {
return "Temporarily Changes SubRace";
}
@Override
protected String _getUsageString() {
return "' /subrace mobBaseID";
}
}
+61 -63
View File
@@ -10,96 +10,94 @@ import engine.objects.NPC;
import engine.objects.PlayerCharacter;
/**
*
* @author
* Dev command to set the guild of targeted npc.
* @author Dev command to set the guild of targeted npc.
* Argument is a valid guild UID
*/
public class SetGuildCmd extends AbstractDevCmd {
public SetGuildCmd() {
public SetGuildCmd() {
super("setguild");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
NPC targetNPC;
Guild targetGuild;
if(validateUserInput(pcSender, target, args) == false) {
this.sendUsage(pcSender);
return;
}
if (validateUserInput(pcSender, target, args) == false) {
this.sendUsage(pcSender);
return;
}
// Valid arguments, attempt to set guild of NPC.
targetNPC = getTargetAsNPC(pcSender);
targetGuild = Guild.getGuild(Integer.parseInt(args[0]));
DbManager.NPCQueries.SET_PROPERTY(targetNPC, "npc_guildID", args[0]);
targetNPC.setGuild(targetGuild);
// Refresh loaded game object
WorldGrid.updateObject(targetNPC, pcSender);
}
@Override
protected String _getUsageString() {
}
@Override
protected String _getUsageString() {
return "' /setguild [UID]";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Assigns NPC to a given guild";
}
private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
}
private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
Guild tempGuild;
// Incorrect number of arguments
if (userInput.length != 1)
return false;
return false;
// No target
if (currTarget == null) {
throwbackError(pcSender, "Requires an NPC be targeted");
return false;
}
// Target must be an NPC
if (currTarget.getObjectType() != GameObjectType.NPC) {
throwbackError(pcSender, "Invalid object. Must be an NPC");
return false;
}
// Argument must parse as a int.
try {
Integer.parseInt(userInput[0]); }
catch (NumberFormatException | NullPointerException e) {
return false;
if (currTarget == null) {
throwbackError(pcSender, "Requires an NPC be targeted");
return false;
}
// Argument must return a valid guild
tempGuild = Guild.getGuild(Integer.parseInt(userInput[0]));
if (tempGuild == null) {
throwbackError(pcSender, "Invalid Guild UID");
return false;
}
// Target must be an NPC
if (currTarget.getObjectType() != GameObjectType.NPC) {
throwbackError(pcSender, "Invalid object. Must be an NPC");
return false;
}
// Argument must parse as a int.
try {
Integer.parseInt(userInput[0]);
} catch (NumberFormatException | NullPointerException e) {
return false;
}
// Argument must return a valid guild
tempGuild = Guild.getGuild(Integer.parseInt(userInput[0]));
if (tempGuild == null) {
throwbackError(pcSender, "Invalid Guild UID");
return false;
}
return true;
}
}
}
+34 -35
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.DispatchChannel;
@@ -20,48 +19,48 @@ import engine.server.MBServerStatics;
public class SetHealthCmd extends AbstractDevCmd {
public SetHealthCmd() {
public SetHealthCmd() {
super("setHealth");
this.addCmdString("health");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
float amount = 0.0f;
try {
amount = Float.parseFloat(words[0]);
pc.modifyHealth(amount, pc, false);
this.setTarget(pc); //for logging
float amount = 0.0f;
try {
amount = Float.parseFloat(words[0]);
pc.modifyHealth(amount, pc, false);
this.setTarget(pc); //for logging
// Update all surrounding clients.
TargetedActionMsg cmm = new TargetedActionMsg(pc);
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
// Update all surrounding clients.
TargetedActionMsg cmm = new TargetedActionMsg(pc);
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: " + words[0]
+ " failed to parse to a Float.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to setHealth to "
+ words[0]);
}
}
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: " + words[0]
+ " failed to parse to a Float.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to setHealth to "
+ words[0]);
}
}
@Override
protected String _getHelpString() {
return "Sets your character's health to 'amount'";
}
@Override
protected String _getHelpString() {
return "Sets your character's health to 'amount'";
}
@Override
protected String _getUsageString() {
return "' /setHealth amount'";
}
@Override
protected String _getUsageString() {
return "' /setHealth amount'";
}
}
+53 -52
View File
@@ -20,72 +20,73 @@ import engine.objects.PlayerCharacter;
public class SetInvulCmd extends AbstractDevCmd {
public SetInvulCmd() {
public SetInvulCmd() {
super("setinvul");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null) return;
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] words,
AbstractGameObject target) {
if (pcSender == null)
return;
if (words.length != 1) {
this.sendUsage(pcSender);
return;
}
if (words.length != 1) {
this.sendUsage(pcSender);
return;
}
boolean invul;
switch (words[0].toLowerCase()) {
case "true":
invul = true;
break;
case "false":
invul = false;
break;
default:
this.sendUsage(pcSender);
return;
}
boolean invul;
switch (words[0].toLowerCase()) {
case "true":
invul = true;
break;
case "false":
invul = false;
break;
default:
this.sendUsage(pcSender);
return;
}
if (target == null || !(target instanceof Building)) {
throwbackError(pcSender, "No building targeted");
return;
}
if (target == null || !(target instanceof Building)) {
throwbackError(pcSender, "No building targeted");
return;
}
Building b = (Building) target;
Building b = (Building) target;
// if strucutre is a TOL then we're modifying the protection
// status of the entire city
// if strucutre is a TOL then we're modifying the protection
// status of the entire city
if ( (b.getBlueprint() != null) &&
(b.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))) {
if ((b.getBlueprint() != null) &&
(b.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))) {
City city;
City city;
city = b.getCity();
city.protectionEnforced = !city.protectionEnforced;
throwbackInfo(pcSender, "City protection contracts enforced: " + city.protectionEnforced);
return;
}
city = b.getCity();
city.protectionEnforced = !city.protectionEnforced;
throwbackInfo(pcSender, "City protection contracts enforced: " + city.protectionEnforced);
return;
}
if (invul) {
if (invul) {
b.setProtectionState(ProtectionState.PROTECTED);
throwbackInfo(pcSender, "The targetted building is now invulnerable.");
return;
}
b.setProtectionState(ProtectionState.NONE);
throwbackInfo(pcSender, "The targetted building is no longer invulernable.");
}
b.setProtectionState(ProtectionState.PROTECTED);
throwbackInfo(pcSender, "The targetted building is now invulnerable.");
return;
}
b.setProtectionState(ProtectionState.NONE);
throwbackInfo(pcSender, "The targetted building is no longer invulernable.");
}
@Override
protected String _getUsageString() {
return "'./setInvul true|false'";
}
@Override
protected String _getUsageString() {
return "'./setInvul true|false'";
}
@Override
protected String _getHelpString() {
return "Turns invulernability on or off for building";
}
@Override
protected String _getHelpString() {
return "Turns invulernability on or off for building";
}
}
+45 -45
View File
@@ -17,57 +17,57 @@ import engine.objects.PlayerCharacter;
public class SetLevelCmd extends AbstractDevCmd {
public SetLevelCmd() {
super("setLevel");
}
public SetLevelCmd() {
super("setLevel");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
PlayerCharacter tar;
if (target != null) {
if (target instanceof PlayerCharacter)
tar = (PlayerCharacter) target;
else
tar = pc;
} else
tar = pc;
PlayerCharacter tar;
if (target != null) {
if (target instanceof PlayerCharacter)
tar = (PlayerCharacter) target;
else
tar = pc;
} else
tar = pc;
int level = 0;
try {
level = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
this.sendUsage(pc);
return;
}
if (level < 1 || level > 75) {
this.sendHelp(pc);
return;
}
int level = 0;
try {
level = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
this.sendUsage(pc);
return;
}
if (level < 1 || level > 75) {
this.sendHelp(pc);
return;
}
if (level > 10 && pc.getPromotionClass() == null)
level = 10;
if (level > 10 && pc.getPromotionClass() == null)
level = 10;
tar.setLevel((short) level);
this.setTarget(tar); //for logging
ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level);
InterestManager.reloadCharacter(tar);
}
tar.setLevel((short) level);
this.setTarget(tar); //for logging
ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level);
InterestManager.reloadCharacter(tar);
}
@Override
protected String _getHelpString() {
return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
}
@Override
protected String _getHelpString() {
return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
}
@Override
protected String _getUsageString() {
return "' /setLevel amount'";
}
@Override
protected String _getUsageString() {
return "' /setLevel amount'";
}
}
+24 -25
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum;
@@ -22,40 +21,40 @@ import java.time.LocalDateTime;
public class SetMaintCmd extends AbstractDevCmd {
public SetMaintCmd() {
public SetMaintCmd() {
super("setMaint");
this.addCmdString("setmaint");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
if (!target.getObjectType().equals(Enum.GameObjectType.Building)) {
ChatManager.chatSayInfo(player, "Target is not a valid building");
return;
}
if (!target.getObjectType().equals(Enum.GameObjectType.Building)) {
ChatManager.chatSayInfo(player, "Target is not a valid building");
return;
}
Building targetBuilding = (Building)target;
Building targetBuilding = (Building) target;
if (targetBuilding.getProtectionState().equals(Enum.ProtectionState.NPC)) {
ChatManager.chatSayInfo(player, "Target is not a valid building");
return;
}
if (targetBuilding.getProtectionState().equals(Enum.ProtectionState.NPC)) {
ChatManager.chatSayInfo(player, "Target is not a valid building");
return;
}
MaintenanceManager.setMaintDateTime(targetBuilding, LocalDateTime.now().minusDays(1).withHour(13).withMinute(0).withSecond(0).withNano(0));
ChatManager.chatSayInfo(player, "Maint will run for UUID: " + targetBuilding.getObjectUUID());
}
MaintenanceManager.setMaintDateTime(targetBuilding, LocalDateTime.now().minusDays(1).withHour(13).withMinute(0).withSecond(0).withNano(0));
ChatManager.chatSayInfo(player, "Maint will run for UUID: " + targetBuilding.getObjectUUID());
}
@Override
protected String _getHelpString() {
return "Sets the Rank of either the targets object or the object specified by ID.";
}
@Override
protected String _getHelpString() {
return "Sets the Rank of either the targets object or the object specified by ID.";
}
@Override
protected String _getUsageString() {
return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
}
@Override
protected String _getUsageString() {
return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
}
}
+34 -34
View File
@@ -9,48 +9,48 @@ import engine.server.MBServerStatics;
public class SetManaCmd extends AbstractDevCmd {
public SetManaCmd() {
public SetManaCmd() {
super("setMana");
this.addCmdString("mana");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
float amount = 0.0f;
try {
amount = Float.parseFloat(words[0]);
pc.setMana(amount, pc);
this.setTarget(pc); //for logging
float amount = 0.0f;
try {
amount = Float.parseFloat(words[0]);
pc.setMana(amount, pc);
this.setTarget(pc); //for logging
//Update all surrounding clients. - NOT for Mana?
TargetedActionMsg cmm = new TargetedActionMsg(pc);
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, engine.Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
//Update all surrounding clients. - NOT for Mana?
TargetedActionMsg cmm = new TargetedActionMsg(pc);
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, engine.Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: " + words[0]
+ " failed to parse to a Float.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to setMana to "
+ words[0]);
}
}
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: " + words[0]
+ " failed to parse to a Float.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to setMana to "
+ words[0]);
}
}
@Override
protected String _getHelpString() {
return "Sets your character's Mana to 'amount'";
}
@Override
protected String _getHelpString() {
return "Sets your character's Mana to 'amount'";
}
@Override
protected String _getUsageString() {
return "' /setMana amount'";
}
@Override
protected String _getUsageString() {
return "' /setMana amount'";
}
}
+81 -83
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -20,119 +19,118 @@ import engine.objects.PlayerCharacter;
public class SetNpcEquipSetCmd extends AbstractDevCmd {
public static int lastEquipSetID = 0;
public SetNpcEquipSetCmd() {
public static int lastEquipSetID = 0;
public SetNpcEquipSetCmd() {
super("setEquipSet");
this.addCmdString("equipset");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (target.getObjectType() != GameObjectType.NPC){
this.sendUsage(pc);
return;
}
if (target.getObjectType() != GameObjectType.NPC) {
this.sendUsage(pc);
return;
}
NPC npc = (NPC)target;
NPC npc = (NPC) target;
if (words[0].equalsIgnoreCase("next")){
if (words[0].equalsIgnoreCase("next")) {
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
SetNpcEquipSetCmd.lastEquipSetID = 1;
else
SetNpcEquipSetCmd.lastEquipSetID++;
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
SetNpcEquipSetCmd.lastEquipSetID = 1;
else
SetNpcEquipSetCmd.lastEquipSetID++;
boolean complete = false;
boolean complete = false;
while (complete == false){
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
while (complete == false) {
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
if (!complete){
SetNpcEquipSetCmd.lastEquipSetID++;
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
SetNpcEquipSetCmd.lastEquipSetID = 1;
}
}
if (!complete) {
SetNpcEquipSetCmd.lastEquipSetID++;
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
SetNpcEquipSetCmd.lastEquipSetID = 1;
}
}
if (complete){
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
WorldGrid.updateObject(npc);
this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID );
}
if (complete) {
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
WorldGrid.updateObject(npc);
this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID);
}
return;
}
return;
}
if (words[0].equalsIgnoreCase("last")) {
if (words[0].equalsIgnoreCase("last")){
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
SetNpcEquipSetCmd.lastEquipSetID = 1222;
else
SetNpcEquipSetCmd.lastEquipSetID--;
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
SetNpcEquipSetCmd.lastEquipSetID = 1222;
else
SetNpcEquipSetCmd.lastEquipSetID--;
boolean complete = false;
boolean complete = false;
while (complete == false) {
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
while (complete == false){
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
if (!complete) {
SetNpcEquipSetCmd.lastEquipSetID--;
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
SetNpcEquipSetCmd.lastEquipSetID = 1222;
}
if (!complete){
SetNpcEquipSetCmd.lastEquipSetID--;
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
SetNpcEquipSetCmd.lastEquipSetID = 1222;
}
}
}
if (complete){
this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID );
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
WorldGrid.updateObject(npc);
}
if (complete) {
this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID);
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
WorldGrid.updateObject(npc);
}
return;
}
return;
}
int equipSetID = 0;
int equipSetID = 0;
try {
equipSetID = Integer.parseInt(words[0]);
} catch (Exception e) {
this.throwbackError(pc, e.getMessage());
}
try{
equipSetID = Integer.parseInt(words[0]);
}catch(Exception e){
this.throwbackError(pc, e.getMessage());
}
if (!NPC.UpdateEquipSetID(npc, equipSetID)) {
this.throwbackError(pc, "Unable to find Equipset for ID " + equipSetID);
return;
}
if (!NPC.UpdateEquipSetID(npc, equipSetID)){
this.throwbackError(pc, "Unable to find Equipset for ID " + equipSetID );
return;
}
SetNpcEquipSetCmd.lastEquipSetID = equipSetID;
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
WorldGrid.updateObject(npc);
SetNpcEquipSetCmd.lastEquipSetID = equipSetID;
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
WorldGrid.updateObject(npc);
this.throwbackInfo(pc, "Equipment Set Changed to " + equipSetID );
this.throwbackInfo(pc, "Equipment Set Changed to " + equipSetID);
}
}
@Override
protected String _getHelpString() {
return "Sets slot position for an NPC to 'slot'";
}
@Override
protected String _getHelpString() {
return "Sets slot position for an NPC to 'slot'";
}
@Override
protected String _getUsageString() {
return "' /changeslot slot'";
}
@Override
protected String _getUsageString() {
return "' /changeslot slot'";
}
}
+34 -35
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -20,48 +19,48 @@ import engine.objects.PlayerCharacter;
public class SetNpcMobbaseCmd extends AbstractDevCmd {
public SetNpcMobbaseCmd() {
public SetNpcMobbaseCmd() {
super("setmobbase");
this.addCmdString("npcmobbase");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(player);
return;
}
// Arg Count Check
if (words.length != 1) {
this.sendUsage(player);
return;
}
if (target.getObjectType() != GameObjectType.NPC){
this.sendUsage(player);
return;
}
NPC npc = (NPC)target;
int mobBaseID = Integer.parseInt(words[0]);
if (MobBase.getMobBase(mobBaseID) == null){
this.throwbackError(player, "Cannot find Mobbase for ID " + mobBaseID);
return;
}
NPC.UpdateRaceID(npc, mobBaseID);
WorldGrid.updateObject(npc);
if (target.getObjectType() != GameObjectType.NPC) {
this.sendUsage(player);
return;
}
}
NPC npc = (NPC) target;
@Override
protected String _getHelpString() {
return "Sets mobbase override for an NPC";
}
int mobBaseID = Integer.parseInt(words[0]);
@Override
protected String _getUsageString() {
return "' /setmobbase mobBaseID'";
}
if (MobBase.getMobBase(mobBaseID) == null) {
this.throwbackError(player, "Cannot find Mobbase for ID " + mobBaseID);
return;
}
NPC.UpdateRaceID(npc, mobBaseID);
WorldGrid.updateObject(npc);
}
@Override
protected String _getHelpString() {
return "Sets mobbase override for an NPC";
}
@Override
protected String _getUsageString() {
return "' /setmobbase mobBaseID'";
}
}
+32 -32
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -19,44 +18,45 @@ import engine.objects.PlayerCharacter;
public class SetNpcNameCmd extends AbstractDevCmd {
public static int lastEquipSetID = 0;
public SetNpcNameCmd() {
public static int lastEquipSetID = 0;
public SetNpcNameCmd() {
super("setNPCName");
this.addCmdString("npcname");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (target.getObjectType() != GameObjectType.NPC){
this.sendUsage(pc);
return;
}
NPC npc = (NPC)target;
String name = words[0];
NPC.UpdateName(npc, name);
WorldGrid.updateObject(npc);
if (target.getObjectType() != GameObjectType.NPC) {
this.sendUsage(pc);
return;
}
}
NPC npc = (NPC) target;
@Override
protected String _getHelpString() {
return "Sets slot position for an NPC to 'slot'";
}
String name = words[0];
@Override
protected String _getUsageString() {
return "' /changeslot slot'";
}
NPC.UpdateName(npc, name);
WorldGrid.updateObject(npc);
}
@Override
protected String _getHelpString() {
return "Sets slot position for an NPC to 'slot'";
}
@Override
protected String _getUsageString() {
return "' /changeslot slot'";
}
}
+70 -71
View File
@@ -8,111 +8,110 @@ import engine.objects.*;
/**
*
* @author
* Dev command to set the owner of targeted building.
* @author Dev command to set the owner of targeted building.
* Argument is a valid guild UID
*/
public class SetOwnerCmd extends AbstractDevCmd {
Building _targetBuilding = null;
DbObjectType _newOwnerType;
AbstractCharacter outOwner;
Building _targetBuilding = null;
DbObjectType _newOwnerType;
AbstractCharacter outOwner;
public SetOwnerCmd() {
public SetOwnerCmd() {
super("setowner");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if(validateUserInput(pcSender, target, args) == false) {
this.sendUsage(pcSender);
return;
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (validateUserInput(pcSender, target, args) == false) {
this.sendUsage(pcSender);
return;
}
// Valid arguments, attempt to set owner of Building.
_targetBuilding = getTargetAsBuilding(pcSender);
// if it's a tol change ownership of the city
if (_targetBuilding.getBlueprint() != null &&
_targetBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.TOL)) {
_targetBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.TOL)) {
City city = _targetBuilding.getCity();
if (city != null) {
city.claim(outOwner);
return; }
return;
}
}
_targetBuilding.setOwner(outOwner);
DbManager.BuildingQueries.SET_PROPERTY(_targetBuilding, "ownerUUID", args[0]);
_targetBuilding.refreshGuild();
}
@Override
protected String _getUsageString() {
}
@Override
protected String _getUsageString() {
return "' /setowner [UID]";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Assigns new owner to building";
}
private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
}
private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
// Incorrect number of arguments
if (userInput.length != 1)
return false;
return false;
// No target
if (currTarget == null) {
throwbackError(pcSender, "Requires a Building to be targeted");
return false;
}
// Target must be an Building
if (currTarget.getObjectType() != GameObjectType.Building) {
throwbackError(pcSender, "Invalid target. Must be a Building");
return false;
}
// Argument must parse to a long.
try {
Long.parseLong(userInput[0]); }
catch (NumberFormatException | NullPointerException e) {
return false;
if (currTarget == null) {
throwbackError(pcSender, "Requires a Building to be targeted");
return false;
}
// Argument must return a valid NPC or PlayerCharacter
_newOwnerType = DbManager.BuildingQueries.GET_UID_ENUM(Long.parseLong(userInput[0]));
switch (_newOwnerType) {
case NPC:
outOwner = (AbstractCharacter)DbManager.getObject(GameObjectType.NPC, Integer.parseInt(userInput[0]));
break;
case CHARACTER:
outOwner = (AbstractCharacter)DbManager.getObject(GameObjectType.PlayerCharacter, Integer.parseInt(userInput[0]));
break;
}
// Target must be an Building
if (currTarget.getObjectType() != GameObjectType.Building) {
throwbackError(pcSender, "Invalid target. Must be a Building");
return false;
}
// Argument must parse to a long.
try {
Long.parseLong(userInput[0]);
} catch (NumberFormatException | NullPointerException e) {
return false;
}
// Argument must return a valid NPC or PlayerCharacter
_newOwnerType = DbManager.BuildingQueries.GET_UID_ENUM(Long.parseLong(userInput[0]));
switch (_newOwnerType) {
case NPC:
outOwner = (AbstractCharacter) DbManager.getObject(GameObjectType.NPC, Integer.parseInt(userInput[0]));
break;
case CHARACTER:
outOwner = (AbstractCharacter) DbManager.getObject(GameObjectType.PlayerCharacter, Integer.parseInt(userInput[0]));
break;
}
if (outOwner == null) {
throwbackError(pcSender, "Invalid Owner UID");
return false;
}
if (outOwner == null) {
throwbackError(pcSender, "Invalid Owner UID");
return false;
}
return true;
}
}
}
@@ -13,60 +13,60 @@ import engine.server.MBServerStatics;
public class SetPromotionClassCmd extends AbstractDevCmd {
public SetPromotionClassCmd() {
public SetPromotionClassCmd() {
super("setPromotionClass");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
int classID = 0;
try {
classID = Integer.parseInt(words[0]);
} catch (Exception e) {
throwbackError(pc,
"Invalid setPromotionClass Command. must specify an ID between 2504 and 2526.");
return;
}
if (classID < 2504 || classID > 2526 || classID == 2522) {
throwbackError(pc,
"Invalid setPromotionClass Command. must specify an ID between 2504 and 2526.");
return;
}
pc.setPromotionClass(classID);
ChatManager.chatSayInfo(pc,
"PromotionClass changed to " + classID);
InterestManager.reloadCharacter(pc);
this.setTarget(pc); //for logging
int classID = 0;
try {
classID = Integer.parseInt(words[0]);
} catch (Exception e) {
throwbackError(pc,
"Invalid setPromotionClass Command. must specify an ID between 2504 and 2526.");
return;
}
if (classID < 2504 || classID > 2526 || classID == 2522) {
throwbackError(pc,
"Invalid setPromotionClass Command. must specify an ID between 2504 and 2526.");
return;
}
pc.setPromotionClass(classID);
ChatManager.chatSayInfo(pc,
"PromotionClass changed to " + classID);
InterestManager.reloadCharacter(pc);
this.setTarget(pc); //for logging
// recalculate all bonuses/formulas/skills/powers
pc.recalculate();
// recalculate all bonuses/formulas/skills/powers
pc.recalculate();
// send the rune application to the clients
// send the rune application to the clients
PromotionClass promo = pc.getPromotionClass();
if (promo != null) {
ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo.getObjectUUID(), true);
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
}
PromotionClass promo = pc.getPromotionClass();
if (promo != null) {
ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo.getObjectUUID(), true);
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
}
}
}
@Override
protected String _getHelpString() {
return "Sets your character's PromotionClass to 'ID'";
}
@Override
protected String _getHelpString() {
return "Sets your character's PromotionClass to 'ID'";
}
@Override
protected String _getUsageString() {
return "' /setPromotionClass id'";
}
@Override
protected String _getUsageString() {
return "' /setPromotionClass id'";
}
}
+98 -100
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.InterestManagement.WorldGrid;
@@ -18,125 +17,124 @@ import engine.objects.*;
public class SetRankCmd extends AbstractDevCmd {
public SetRankCmd() {
super("setRank");
this.addCmdString("setrank");
this.addCmdString("rank");
}
public SetRankCmd() {
super("setRank");
this.addCmdString("setrank");
this.addCmdString("rank");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
int targetRank;
int uuid = 0;
int targetRank;
int uuid = 0;
if (words.length == 2) {
try {
uuid = Integer.parseInt(words[0]);
targetRank = Integer.parseInt(words[1]);
} catch (NumberFormatException e) {
this.sendUsage(player);
return; // NaN
}
} else if (words.length == 1) {
try {
targetRank = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
this.sendUsage(player);
return; // NaN
}
} else {
this.sendUsage(player);
return;
}
if (words.length == 2) {
try {
uuid = Integer.parseInt(words[0]);
targetRank = Integer.parseInt(words[1]);
} catch (NumberFormatException e) {
this.sendUsage(player);
return; // NaN
}
} else if (words.length == 1) {
try {
targetRank = Integer.parseInt(words[0]);
} catch (NumberFormatException e) {
this.sendUsage(player);
return; // NaN
}
} else {
this.sendUsage(player);
return;
}
if (target != null){
switch(target.getObjectType()){
case Building:
Building targetBuilding = (Building)target;
Blueprint blueprint = targetBuilding.getBlueprint();
if (target != null) {
switch (target.getObjectType()) {
case Building:
Building targetBuilding = (Building) target;
Blueprint blueprint = targetBuilding.getBlueprint();
if (blueprint == null) {
targetBuilding.setRank(targetRank);
ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
return;
}
if (blueprint == null) {
targetBuilding.setRank(targetRank);
ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
return;
}
if (targetRank > blueprint.getMaxRank()) {
throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
return;
}
if (targetRank > blueprint.getMaxRank()) {
throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
return;
}
// Set the current targetRank
int lastMeshID = targetBuilding.getMeshUUID();
targetBuilding.setRank(targetRank);
// Set the current targetRank
int lastMeshID = targetBuilding.getMeshUUID();
targetBuilding.setRank(targetRank);
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
break;
case NPC:
NPC toRank = (NPC)target;
toRank.setRank(targetRank * 10);
toRank.setUpgradeDateTime(null);
WorldGrid.updateObject(toRank);
break;
case Mob:
Mob toRankCaptain = (Mob)target;
if (toRankCaptain.getContract() != null){
toRankCaptain.setRank(targetRank * 10);
Mob.setUpgradeDateTime(toRankCaptain, null);
WorldGrid.updateObject(toRankCaptain);
}
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
break;
case NPC:
NPC toRank = (NPC) target;
toRank.setRank(targetRank * 10);
toRank.setUpgradeDateTime(null);
WorldGrid.updateObject(toRank);
break;
case Mob:
Mob toRankCaptain = (Mob) target;
if (toRankCaptain.getContract() != null) {
toRankCaptain.setRank(targetRank * 10);
Mob.setUpgradeDateTime(toRankCaptain, null);
WorldGrid.updateObject(toRankCaptain);
}
break;
}
break;
}
}else{
Building targetBuilding = null;
if (uuid != 0)
targetBuilding = BuildingManager.getBuilding(uuid);
} else {
Building targetBuilding = null;
if (uuid != 0)
targetBuilding = BuildingManager.getBuilding(uuid);
if (targetBuilding == null) {
throwbackError(player, "Unable to find building.");
return;
}
if (targetBuilding == null) {
throwbackError(player, "Unable to find building.");
return;
}
Blueprint blueprint = targetBuilding.getBlueprint();
Blueprint blueprint = targetBuilding.getBlueprint();
if (blueprint == null) {
throwbackError(player, "Attempt to rank building without blueprint" + targetBuilding.getObjectUUID());
return;
}
if (blueprint == null) {
throwbackError(player, "Attempt to rank building without blueprint" + targetBuilding.getObjectUUID());
return;
}
if (targetRank > blueprint.getMaxRank()) {
throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
return;
}
if (targetRank > blueprint.getMaxRank()) {
throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
return;
}
// Set the current targetRank
int lastMeshID = targetBuilding.getMeshUUID();
targetBuilding.setRank(targetRank);
// Set the current targetRank
int lastMeshID = targetBuilding.getMeshUUID();
targetBuilding.setRank(targetRank);
if (lastMeshID != targetBuilding.getMeshUUID())
targetBuilding.refresh(true);
else
targetBuilding.refresh(false);
if (lastMeshID != targetBuilding.getMeshUUID())
targetBuilding.refresh(true);
else
targetBuilding.refresh(false);
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
}
ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
}
}
}
@Override
protected String _getHelpString() {
return "Sets the Rank of either the targets object or the object specified by ID.";
}
@Override
protected String _getHelpString() {
return "Sets the Rank of either the targets object or the object specified by ID.";
}
@Override
protected String _getUsageString() {
return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
}
@Override
protected String _getUsageString() {
return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
}
}
+46 -48
View File
@@ -17,64 +17,62 @@ import engine.objects.CharacterRune;
import engine.objects.PlayerCharacter;
/**
*
* @author Eighty
*
*/
public class SetRuneCmd extends AbstractDevCmd {
public SetRuneCmd() {
public SetRuneCmd() {
super("setRune");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
int runeID = 0;
boolean add = true;
try {
runeID = Integer.parseInt(args[0]);
if (args.length > 1)
add = (args[1].toLowerCase().equals("false")) ? false : true;
} catch (NumberFormatException e) {
this.sendUsage(pcSender);
return;
}
if (runeID < 3001 || runeID > 3049) {
throwbackError(pcSender,
"Invalid setrune Command. must specify an ID between 3001 and 3048.");
return;
}
boolean worked = false;
if (add) {
worked = CharacterRune.grantRune(pcSender, runeID);
if (worked)
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " added");
else
throwbackError(pcSender, "Failed to add the rune of type "
+ runeID);
} else {
worked = CharacterRune.removeRune(pcSender, runeID);
if (worked) {
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " removed");
InterestManager.reloadCharacter(pcSender);
} else
throwbackError(pcSender, "Failed to remove the rune of type "
+ runeID);
}
this.setTarget(pcSender); //for logging
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
int runeID = 0;
boolean add = true;
try {
runeID = Integer.parseInt(args[0]);
if (args.length > 1)
add = (args[1].toLowerCase().equals("false")) ? false : true;
} catch (NumberFormatException e) {
this.sendUsage(pcSender);
return;
}
if (runeID < 3001 || runeID > 3049) {
throwbackError(pcSender,
"Invalid setrune Command. must specify an ID between 3001 and 3048.");
return;
}
boolean worked = false;
if (add) {
worked = CharacterRune.grantRune(pcSender, runeID);
if (worked)
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " added");
else
throwbackError(pcSender, "Failed to add the rune of type "
+ runeID);
} else {
worked = CharacterRune.removeRune(pcSender, runeID);
if (worked) {
ChatManager.chatSayInfo(pcSender,
"rune of ID " + runeID + " removed");
InterestManager.reloadCharacter(pcSender);
} else
throwbackError(pcSender, "Failed to remove the rune of type "
+ runeID);
}
this.setTarget(pcSender); //for logging
}
@Override
protected String _getUsageString() {
@Override
protected String _getUsageString() {
return "' /setrune runeID [true/false]'";
}
}
@Override
protected String _getHelpString() {
@Override
protected String _getHelpString() {
return "Grant or remove the rune with the specified runeID";
}
}
}
+34 -35
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.DispatchChannel;
@@ -21,48 +20,48 @@ import engine.server.MBServerStatics;
public class SetStaminaCmd extends AbstractDevCmd {
public SetStaminaCmd() {
public SetStaminaCmd() {
super("setStamina");
this.addCmdString("stamina");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
float amount = 0.0f;
try {
amount = Float.parseFloat(words[0]);
pc.setStamina(amount, pc);
this.setTarget(pc); //for logging
float amount = 0.0f;
try {
amount = Float.parseFloat(words[0]);
pc.setStamina(amount, pc);
this.setTarget(pc); //for logging
// Update all surrounding clients.
TargetedActionMsg cmm = new TargetedActionMsg(pc);
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
// Update all surrounding clients.
TargetedActionMsg cmm = new TargetedActionMsg(pc);
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: " + words[0]
+ " failed to parse to a Float.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to setStamina to "
+ words[0]);
}
}
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied data: " + words[0]
+ " failed to parse to a Float.");
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to setStamina to "
+ words[0]);
}
}
@Override
protected String _getHelpString() {
return "Sets your character's Stamina to 'amount'";
}
@Override
protected String _getHelpString() {
return "Sets your character's Stamina to 'amount'";
}
@Override
protected String _getUsageString() {
return "' /setStamina amount'";
}
@Override
protected String _getUsageString() {
return "' /setStamina amount'";
}
}
+149 -162
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
@@ -20,190 +19,178 @@ import engine.objects.*;
public class SetSubRaceCmd extends AbstractDevCmd {
public SetSubRaceCmd() {
public SetSubRaceCmd() {
super("setSubRace");
this.addCmdString("subrace");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target instanceof AbstractCharacter){
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (words[0].equals("race")){
if (target.getObjectType() != GameObjectType.PlayerCharacter)
return;
PlayerCharacter player = (PlayerCharacter)target;
int raceID = Integer.parseInt(words[1]);
player.setSubRaceID(raceID);
if (raceID == 0)
raceID = player.getRaceID();
UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(player, 1,raceID);
DispatchMessage.sendToAllInRange(player, ucm);
return;
}
if (words[0].equals("all")){
for (int i = 15999; i< 16337;i++){
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), i);
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (target instanceof AbstractCharacter) {
}else{
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
}
if (words[0].equals("race")) {
if (target.getObjectType() != GameObjectType.PlayerCharacter)
return;
PlayerCharacter player = (PlayerCharacter) target;
int raceID = Integer.parseInt(words[1]);
player.setSubRaceID(raceID);
if (raceID == 0)
raceID = player.getRaceID();
UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(player, 1, raceID);
DispatchMessage.sendToAllInRange(player, ucm);
return;
}
if (words[0].equals("all")) {
for (int i = 15999; i < 16337; i++) {
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), i);
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return;
}
} else {
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
}
Building building = (Building)target;
return;
}
building.removeAllVisualEffects();
building.addEffectBit(1<<Integer.parseInt(words[0]));
building.updateEffects();
//63535 38751
// Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
// //CityZoneMsg czm = new CityZoneMsg(3, zone.getLoc().x, zone.getLoc().y, zone.getLoc().z, "balls", zone, 0, 0);
// pc.getClientConnection().sendMsg(new DeleteItemMsg(zone.getObjectType().ordinal(), zone.getObjectUUID()));
Building building = (Building) target;
// UpdateInventoryMsg updateInventoryMsg = new UpdateInventoryMsg(new ArrayList<>(), new ArrayList<>(), null, true);
// pc.getClientConnection().sendMsg(updateInventoryMsg);
building.removeAllVisualEffects();
building.addEffectBit(1 << Integer.parseInt(words[0]));
building.updateEffects();
//63535 38751
// Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
// //CityZoneMsg czm = new CityZoneMsg(3, zone.getLoc().x, zone.getLoc().y, zone.getLoc().z, "balls", zone, 0, 0);
// pc.getClientConnection().sendMsg(new DeleteItemMsg(zone.getObjectType().ordinal(), zone.getObjectUUID()));
//pc.getCharItemManager().updateInventory();
// UpdateInventoryMsg updateInventoryMsg = new UpdateInventoryMsg(new ArrayList<>(), new ArrayList<>(), null, true);
// pc.getClientConnection().sendMsg(updateInventoryMsg);
//pc.getCharItemManager().updateInventory();
// Mob mob = (Mob)target;
//
// if (mob == null)
// return;
//
// MobLoot mobLoot = new MobLoot(mob, ItemBase.getItemBase(Integer.parseInt(words[0])), false);
//
// mob.getCharItemManager().addItemToInventory(mobLoot);
// Mob mob = (Mob)target;
//
// if (mob == null)
// return;
//
// MobLoot mobLoot = new MobLoot(mob, ItemBase.getItemBase(Integer.parseInt(words[0])), false);
//
// mob.getCharItemManager().addItemToInventory(mobLoot);
// if (target.getObjectType() != GameObjectType.Building)
// return;
//
// Building warehouseBuilding = (Building)target;
//
// if (Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID()) == null)
// return;
//
// Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID());
//
// for (int ibID: Warehouse.getMaxResources().keySet()){
// ItemBase ib = ItemBase.getItemBase(ibID);
// warehouse.depositFromMine(null, ib, Warehouse.getMaxResources().get(ibID));
// }
// if (target.getObjectType() != GameObjectType.Building)
// return;
//
// Building warehouseBuilding = (Building)target;
//
// if (Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID()) == null)
// return;
//
// Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID());
//
// for (int ibID: Warehouse.getMaxResources().keySet()){
// ItemBase ib = ItemBase.getItemBase(ibID);
// warehouse.depositFromMine(null, ib, Warehouse.getMaxResources().get(ibID));
// }
// int raceID = Integer.parseInt(words[0]);
//
// UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(pc, raceID);
//
// pc.getClientConnection().sendMsg(ucm);
// LoadCharacterMsg lcm = new LoadCharacterMsg((AbstractCharacter)null,false);
// try {
// DispatchMessage.sendToAllInRange(pc, lcm);
// } catch (MsgSendException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// ModifyHealthMsg mhm =new ModifyHealthMsg(pc, pc, -50f, 0f, 0f, 0, null, 9999, 0);
// mhm.setOmitFromChat(1);
// pc.getClientConnection().sendMsg(mhm);
//
// int temp = 0;
// boolean start = false;
//
// for (EffectsBase eb: EffectsBase.getAllEffectsBase()){
//
//
//
// if (!pc.getClientConnection().isConnected()){
// Logger.info("", "PLAYER DC!" + eb.getIDString());
// break;
// }
//
// eb = PowersManager.getEffectByIDString("WLR-018A");
//
//
// NoTimeJob ntj = new NoTimeJob(pc, "NONE", eb, 40);
// pc.addEffect(String.valueOf(eb.getUUID()), 1000, ntj, eb, 40);
// eb.sendEffectNoPower(ntj, 1000, pc.getClientConnection());
//
// ThreadUtils.sleep(500);
// pc.clearEffects();
//
// //WorldServer.updateObject((AbstractWorldObject)target, pc);
// this.throwbackInfo(pc, eb.getIDString());
// break;
// //ThreadUtils.sleep(500);
//
// }
// int raceID = Integer.parseInt(words[0]);
//
// UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(pc, raceID);
//
// pc.getClientConnection().sendMsg(ucm);
// for (EffectsBase eb : EffectsBase.getAllEffectsBase()){
// if (eb.getToken() == 0)
// continue;
// int token = eb.getToken();
// ApplyEffectMsg pum = new ApplyEffectMsg();
// pum.setEffectID(token);
// pum.setSourceType(pc.getObjectType().ordinal());
// pum.setSourceID(pc.getObjectUUID());
// pum.setTargetType(pc.getObjectType().ordinal());
// pum.setTargetID(pc.getObjectUUID());
// pum.setNumTrains(40);
// pum.setDuration(-1);
//// pum.setDuration((pb.isChant()) ? (int)pb.getChantDuration() : ab.getDurationInSeconds(trains));
// pum.setPowerUsedID(0);
// // pum.setPowerUsedName("Inflict Poison");
// this.throwbackInfo(pc, eb.getName() + "Token = " + eb.getToken());
// pc.getClientConnection().sendMsg(pum);
// ThreadUtils.sleep(200);
// }
//
// LoadCharacterMsg lcm = new LoadCharacterMsg((AbstractCharacter)null,false);
// try {
// DispatchMessage.sendToAllInRange(pc, lcm);
// } catch (MsgSendException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// ModifyHealthMsg mhm =new ModifyHealthMsg(pc, pc, -50f, 0f, 0f, 0, null, 9999, 0);
// mhm.setOmitFromChat(1);
// pc.getClientConnection().sendMsg(mhm);
//
// int temp = 0;
// boolean start = false;
//
// for (EffectsBase eb: EffectsBase.getAllEffectsBase()){
//
//
//
// if (!pc.getClientConnection().isConnected()){
// Logger.info("", "PLAYER DC!" + eb.getIDString());
// break;
// }
//
// eb = PowersManager.getEffectByIDString("WLR-018A");
//
//
// NoTimeJob ntj = new NoTimeJob(pc, "NONE", eb, 40);
// pc.addEffect(String.valueOf(eb.getUUID()), 1000, ntj, eb, 40);
// eb.sendEffectNoPower(ntj, 1000, pc.getClientConnection());
//
// ThreadUtils.sleep(500);
// pc.clearEffects();
//
// //WorldServer.updateObject((AbstractWorldObject)target, pc);
// this.throwbackInfo(pc, eb.getIDString());
// break;
// //ThreadUtils.sleep(500);
//
// }
// UpdateObjectMsg uom = new UpdateObjectMsg(pc, 4);
// try {
// Location.sendToAllInRange(pc, uom);
// } catch (MsgSendException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
@Override
protected String _getHelpString() {
return "Temporarily Changes SubRace";
}
// for (EffectsBase eb : EffectsBase.getAllEffectsBase()){
// if (eb.getToken() == 0)
// continue;
// int token = eb.getToken();
// ApplyEffectMsg pum = new ApplyEffectMsg();
// pum.setEffectID(token);
// pum.setSourceType(pc.getObjectType().ordinal());
// pum.setSourceID(pc.getObjectUUID());
// pum.setTargetType(pc.getObjectType().ordinal());
// pum.setTargetID(pc.getObjectUUID());
// pum.setNumTrains(40);
// pum.setDuration(-1);
//// pum.setDuration((pb.isChant()) ? (int)pb.getChantDuration() : ab.getDurationInSeconds(trains));
// pum.setPowerUsedID(0);
// // pum.setPowerUsedName("Inflict Poison");
// this.throwbackInfo(pc, eb.getName() + "Token = " + eb.getToken());
// pc.getClientConnection().sendMsg(pum);
// ThreadUtils.sleep(200);
// }
//
// UpdateObjectMsg uom = new UpdateObjectMsg(pc, 4);
// try {
// Location.sendToAllInRange(pc, uom);
// } catch (MsgSendException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
@Override
protected String _getHelpString() {
return "Temporarily Changes SubRace";
}
@Override
protected String _getUsageString() {
return "' /subrace mobBaseID";
}
@Override
protected String _getUsageString() {
return "' /subrace mobBaseID";
}
}
+34 -35
View File
@@ -8,50 +8,49 @@ import engine.objects.Building;
import engine.objects.PlayerCharacter;
public class ShowOffsetCmd extends AbstractDevCmd {
public ShowOffsetCmd() {
public ShowOffsetCmd() {
super("showoffset");
}
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
// AbstractDevCmd Overridden methods
Building targetBuilding;
String outString;
Vector3fImmutable offset;
String newline = "\r\n ";
targetBuilding = (Building)target;
if (targetBuilding.getObjectType() != GameObjectType.Building) {
throwbackInfo(pc, "showgate: target must be an Building");
return;
}
offset = pc.getLoc().subtract(targetBuilding.getLoc());
outString = "Location: " + pc.getLoc().x + "x " + pc.getLoc().z + 'y';
outString += newline;
outString += "Offset: " + offset.x + "x " + offset.y + 'y';
throwbackInfo(pc, outString);
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
Building targetBuilding;
String outString;
Vector3fImmutable offset;
String newline = "\r\n ";
targetBuilding = (Building) target;
if (targetBuilding.getObjectType() != GameObjectType.Building) {
throwbackInfo(pc, "showgate: target must be an Building");
return;
}
@Override
protected String _getHelpString() {
return "Shows offset to current building";
}
offset = pc.getLoc().subtract(targetBuilding.getLoc());
@Override
protected String _getUsageString() {
outString = "Location: " + pc.getLoc().x + "x " + pc.getLoc().z + 'y';
outString += newline;
outString += "Offset: " + offset.x + "x " + offset.y + 'y';
throwbackInfo(pc, outString);
}
@Override
protected String _getHelpString() {
return "Shows offset to current building";
}
@Override
protected String _getUsageString() {
return "Shows offset to current building";
}
}
}
+46 -47
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -21,75 +20,75 @@ import java.util.ArrayList;
public class SlotTestCmd extends AbstractDevCmd {
public SlotTestCmd() {
public SlotTestCmd() {
super("slottest");
}
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] args,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] args,
AbstractGameObject target) {
ArrayList<BuildingLocation> buildingLocations;
String outString = "Available Slots\r\n";
ArrayList<BuildingLocation> buildingLocations;
String outString = "Available Slots\r\n";
if (target == null)
return;
if (target == null)
return;
if (target.getObjectType() != GameObjectType.Building)
return;
if (target.getObjectType() != GameObjectType.Building)
return;
Building building = (Building) target;
Building building = (Building) target;
buildingLocations = BuildingManager._slotLocations.get(building.meshUUID);
buildingLocations = BuildingManager._slotLocations.get(building.meshUUID);
if (buildingLocations == null) {
outString = "No slot information for mesh: " + building.meshUUID;
ChatManager.chatSystemInfo(playerCharacter, outString);
return;
}
if (buildingLocations == null) {
outString = "No slot information for mesh: " + building.meshUUID;
ChatManager.chatSystemInfo(playerCharacter, outString);
return;
}
// Goto slot location
// Goto slot location
if (args[0].isEmpty() == false) {
if (args[0].isEmpty() == false) {
int slot = Integer.parseInt(args[0]);
Vector3fImmutable slotLocation;
BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot - 1);
slotLocation = building.getLoc().add(buildingLocation.getLocation());
slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY);
playerCharacter.teleport(slotLocation);
return;
}
int slot = Integer.parseInt(args[0]);
Vector3fImmutable slotLocation;
BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot - 1);
slotLocation = building.getLoc().add(buildingLocation.getLocation());
slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY);
playerCharacter.teleport(slotLocation);
return;
}
for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID))
outString += buildingLocation.getSlot() + buildingLocation.getLocation().toString() + "\r\n";
for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID))
outString += buildingLocation.getSlot() + buildingLocation.getLocation().toString() + "\r\n";
outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building);
outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building);
if (building.getHirelings().isEmpty() == false) {
if (building.getHirelings().isEmpty() == false) {
outString += "\r\n\r\n";
outString += "Hirelings List:";
outString += "\r\n\r\n";
outString += "Hirelings List:";
for (AbstractCharacter hireling : building.getHirelings().keySet())
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
for (AbstractCharacter hireling : building.getHirelings().keySet())
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
}
}
ChatManager.chatSystemInfo(playerCharacter,outString);
ChatManager.chatSystemInfo(playerCharacter, outString);
}
}
@Override
protected String _getHelpString() {
return "Displays slot information for building";
}
@Override
protected String _getHelpString() {
return "Displays slot information for building";
}
@Override
protected String _getUsageString() {
return "./slottest <target builing> n";
@Override
protected String _getUsageString() {
return "./slottest <target builing> n";
}
}
}
+104 -105
View File
@@ -12,155 +12,154 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* @author
* Summary: Game designer utility command to create multiple
* mobiles of a given UUID within a supplied range
* @author Summary: Game designer utility command to create multiple
* mobiles of a given UUID within a supplied range
*/
public class SplatMobCmd extends AbstractDevCmd {
// Instance variables
// Instance variables
private int _mobileUUID;
private int _mobileCount;
private float _targetRange;
private Vector3fImmutable _currentLocation;
private int _mobileUUID;
private int _mobileCount;
private float _targetRange;
private Vector3fImmutable _currentLocation;
// Concurrency support
// Concurrency support
private ReadWriteLock lock = new ReentrantReadWriteLock();
private ReadWriteLock lock = new ReentrantReadWriteLock();
// Constructor
// Constructor
public SplatMobCmd() {
public SplatMobCmd() {
super("splatmob");
}
// AbstractDevCmd Overridden methods
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
private static boolean validateUserInput(String[] userInput) {
// Member variables
// incorrect number of arguments test
Vector3fImmutable mobileLocation;
Mob mobile;
Zone serverZone;
if (userInput.length != 3)
return false;
// Concurrency write lock due to instance variable usage
// Test for UUID conversion to int
lock.writeLock().lock();
try {
Integer.parseInt(userInput[0]);
} catch (NumberFormatException | NullPointerException e) {
return false;
}
try {
// Validate user input
// Test for Number of Mobs conversion to int
if(validateUserInput(args) == false) {
this.sendUsage(pc);
return;
}
try {
Integer.parseInt(userInput[1]);
} catch (NumberFormatException | NullPointerException e) {
return false;
}
// Parse user input
// Test if range argument can convert to a float
parseUserInput(args);
try {
Float.parseFloat(userInput[2]);
} catch (NumberFormatException | NullPointerException e) {
return false;
}
// Arguments have been validated and parsed at this point
// Begin creating mobiles
return true;
}
_currentLocation = pc.getLoc();
serverZone = ZoneManager.findSmallestZone(_currentLocation);
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
for(int i=0;i<_mobileCount;i++) {
// Member variables
mobile = Mob.createMob(_mobileUUID,
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
null, true, serverZone,null,0, "", 1);
Vector3fImmutable mobileLocation;
Mob mobile;
Zone serverZone;
if (mobile != null) {
mobile.updateDatabase();
}
}
// Concurrency write lock due to instance variable usage
} // End Try Block
lock.writeLock().lock();
// Release Reentrant lock
try {
finally {
lock.writeLock().unlock();
}
}
// Validate user input
@Override
protected String _getHelpString() {
if (validateUserInput(args) == false) {
this.sendUsage(pc);
return;
}
// Parse user input
parseUserInput(args);
// Arguments have been validated and parsed at this point
// Begin creating mobiles
_currentLocation = pc.getLoc();
serverZone = ZoneManager.findSmallestZone(_currentLocation);
for (int i = 0; i < _mobileCount; i++) {
mobile = Mob.createMob(_mobileUUID,
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
null, true, serverZone, null, 0, "", 1);
if (mobile != null) {
mobile.updateDatabase();
}
}
} // End Try Block
// Release Reentrant lock
finally {
lock.writeLock().unlock();
}
}
@Override
protected String _getHelpString() {
return "Spawns multiple mobiles with a given range";
}
}
@Override
protected String _getUsageString() {
// Class methods
@Override
protected String _getUsageString() {
return "/splatmob UUID [Count <= 100] [range <= 1200]";
}
}
// Class methods
private void parseUserInput(String[] userInput) {
private static boolean validateUserInput(String[] userInput) {
// Clear previous values
// incorrect number of arguments test
_mobileUUID = 0;
_mobileCount = 0;
_targetRange = 0f;
if (userInput.length != 3)
return false;
// Parse first argument into mobile UID.
// Test for UUID conversion to int
_mobileUUID = Integer.parseInt(userInput[0]);
try {
Integer.parseInt(userInput[0]); }
catch (NumberFormatException | NullPointerException e) {
return false;
}
// Parse second argument into mobile count. Cap at 100 mobs.
_mobileCount = Integer.parseInt(userInput[1]);
_mobileCount = Math.min(_mobileCount, 100);
// Test for Number of Mobs conversion to int
// Parse third argument into range. Cap at 200 units.
try {
Integer.parseInt(userInput[1]); }
catch (NumberFormatException | NullPointerException e) {
return false;
}
_targetRange = Float.parseFloat(userInput[2]);
_targetRange = Math.min(_targetRange, 1200f);
// Test if range argument can convert to a float
try {
Float.parseFloat(userInput[2]); }
catch (NumberFormatException | NullPointerException e) {
return false;
}
return true;
}
private void parseUserInput(String[] userInput) {
// Clear previous values
_mobileUUID = 0;
_mobileCount = 0;
_targetRange = 0f;
// Parse first argument into mobile UID.
_mobileUUID = Integer.parseInt(userInput[0]);
// Parse second argument into mobile count. Cap at 100 mobs.
_mobileCount = Integer.parseInt(userInput[1]);
_mobileCount = Math.min(_mobileCount, 100);
// Parse third argument into range. Cap at 200 units.
_targetRange = Float.parseFloat(userInput[2]);
_targetRange = Math.min(_targetRange, 1200f);
}
}
}
+56 -58
View File
@@ -6,81 +6,79 @@ import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
/**
* @author
* Summary: Devcmd to toggle logging of mysql statements
*
* @author Summary: Devcmd to toggle logging of mysql statements
*/
public class SqlDebugCmd extends AbstractDevCmd {
// Instance variables
public SqlDebugCmd() {
public SqlDebugCmd() {
super("sqldebug");
}
// AbstractDevCmd Overridden methods
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
Boolean debugState = false;
if(validateUserInput(args) == false) {
this.sendUsage(pc);
return;
}
// Arguments have been validated use argument to set debug state
switch (args[0]) {
case "on":
debugState = true;
break;
case "off":
debugState = false;
break;
default:
break;
}
MBServerStatics.DB_ENABLE_QUERY_OUTPUT = debugState;
// Send results to user
throwbackInfo(pc, "SQL debug state: " + debugState.toString());
}
// AbstractDevCmd Overridden methods
@Override
protected String _getHelpString() {
return "Toggles sending SQL statements to log";
}
@Override
protected String _getUsageString() {
return "/sqldebug on|off";
}
// Class methods
private static boolean validateUserInput(String[] userInput) {
private static boolean validateUserInput(String[] userInput) {
int stringIndex;
String commandSet = "onoff";
// incorrect number of arguments test
if (userInput.length != 1)
return false;
return false;
// Validate arguments
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
return stringIndex != -1;
return stringIndex != -1;
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
Boolean debugState = false;
if (validateUserInput(args) == false) {
this.sendUsage(pc);
return;
}
// Arguments have been validated use argument to set debug state
switch (args[0]) {
case "on":
debugState = true;
break;
case "off":
debugState = false;
break;
default:
break;
}
MBServerStatics.DB_ENABLE_QUERY_OUTPUT = debugState;
// Send results to user
throwbackInfo(pc, "SQL debug state: " + debugState.toString());
}
@Override
protected String _getHelpString() {
return "Toggles sending SQL statements to log";
}
// Class methods
@Override
protected String _getUsageString() {
return "/sqldebug on|off";
}
}
+75 -76
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -21,94 +20,94 @@ import engine.objects.Zone;
public class SummonCmd extends AbstractDevCmd {
public SummonCmd() {
public SummonCmd() {
super("summon");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
// Arg Count Check
if (args.length != 1) {
this.sendUsage(pc);
return;
}
PlayerCharacter pcToSummon = null;
@Override
protected void _doCmd(PlayerCharacter pc, String[] args,
AbstractGameObject target) {
// Arg Count Check
if (args.length != 1) {
this.sendUsage(pc);
return;
}
PlayerCharacter pcToSummon = null;
if (args[0].equalsIgnoreCase("all")){
for (PlayerCharacter toSummon: SessionManager.getAllActivePlayerCharacters()){
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
String location = "Somewhere";
if (zone != null)
location = zone.getName();
RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
location, false);
toSummon.getClientConnection().sendMsg(rsrm);
if (args[0].equalsIgnoreCase("all")) {
for (PlayerCharacter toSummon : SessionManager.getAllActivePlayerCharacters()) {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
String location = "Somewhere";
if (zone != null)
location = zone.getName();
RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
location, false);
toSummon.getClientConnection().sendMsg(rsrm);
}
return;
}
// 1-9 numeric digits, must be playerID
if (args[0].matches("\\d{1,9}?")) {
try {
int playerID = Integer.parseInt(args[0]);
pcToSummon = SessionManager
.getPlayerCharacterByID(playerID);
}
return;
}
// 1-9 numeric digits, must be playerID
if (args[0].matches("\\d{1,9}?")) {
try {
int playerID = Integer.parseInt(args[0]);
pcToSummon = SessionManager
.getPlayerCharacterByID(playerID);
if (pcToSummon == null) {
this.throwbackError(pc, "Character not found by ID: "
+ playerID);
return;
}
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied ID: '" + args[0]
+ "' failed to parse to an INT");
return;
if (pcToSummon == null) {
this.throwbackError(pc, "Character not found by ID: "
+ playerID);
return;
}
} catch (NumberFormatException e) {
this.throwbackError(pc, "Supplied ID: '" + args[0]
+ "' failed to parse to an INT");
return;
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to summon '"
+ args[0] + "'by ID");
return;
}
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to summon '"
+ args[0] + "'by ID");
return;
}
} else { // player name
try {
pcToSummon = SessionManager
.getPlayerCharacterByLowerCaseName(args[0]);
if (pcToSummon == null) {
this.throwbackError(pc, "Character not found by name: "
+ args[0]);
return;
}
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to summon '"
+ args[0] + "'by name");
return;
}
}
this.setTarget(pcToSummon); //for logging
} else { // player name
try {
pcToSummon = SessionManager
.getPlayerCharacterByLowerCaseName(args[0]);
if (pcToSummon == null) {
this.throwbackError(pc, "Character not found by name: "
+ args[0]);
return;
}
} catch (Exception e) {
this.throwbackError(pc,
"An unknown exception occurred while attempting to summon '"
+ args[0] + "'by name");
return;
}
}
this.setTarget(pcToSummon); //for logging
Vector3fImmutable loc = pc.getLoc();
pcToSummon.teleport(loc);
Vector3fImmutable loc = pc.getLoc();
pcToSummon.teleport(loc);
this.throwbackInfo(pc, "Player " + pcToSummon.getCombinedName()
+ " has been summoned to your location.");
this.throwbackInfo(pcToSummon,
"You have been transported to another location.");
}
this.throwbackInfo(pc, "Player " + pcToSummon.getCombinedName()
+ " has been summoned to your location.");
this.throwbackInfo(pcToSummon,
"You have been transported to another location.");
}
@Override
protected String _getHelpString() {
return "Summons 'character' TO your current position. Can summon by character's first name or by the character's characterID.";
@Override
protected String _getHelpString() {
return "Summons 'character' TO your current position. Can summon by character's first name or by the character's characterID.";
}
}
@Override
protected String _getUsageString() {
return "' /summon characterName' || ' /summon characterID'";
}
@Override
protected String _getUsageString() {
return "' /summon characterName' || ' /summon characterID'";
}
}
+35 -35
View File
@@ -15,53 +15,53 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
*
*
*/
public class SysMsgCmd extends AbstractDevCmd {
public SysMsgCmd() {
public SysMsgCmd() {
super("sysmsg");
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (args.length != 1 || args[0].isEmpty()) {
this.sendUsage(pcSender);
return;
}
String text = "[System Admin Message]: " + args[0];
ChatManager.chatSystemChannel(text);
}
@Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
AbstractGameObject target) {
if (args.length != 1 || args[0].isEmpty()) {
this.sendUsage(pcSender);
return;
}
String text = "[System Admin Message]: " + args[0];
ChatManager.chatSystemChannel(text);
}
/**
* This function is called by the DevCmdManager. Override to avoid splitting
* argString into String array, since sysmsg displays full String as
* message, then calls the subclass specific _doCmd method.
*/
/**
* This function is called by the DevCmdManager. Override to avoid splitting
* argString into String array, since sysmsg displays full String as
* message, then calls the subclass specific _doCmd method.
*/
@Override
public void doCmd(PlayerCharacter pcSender, String argString,
AbstractGameObject target) {
String[] args = new String[1];
args[0] = argString;
@Override
public void doCmd(PlayerCharacter pcSender, String argString,
AbstractGameObject target) {
String[] args = new String[1];
args[0] = argString;
if (pcSender == null) {
return;
}
if (pcSender == null) {
return;
}
this._doCmd(pcSender, args, target);
}
this._doCmd(pcSender, args, target);
}
@Override
protected String _getUsageString() {
return "' /sysmsg message'";
}
@Override
protected String _getUsageString() {
return "' /sysmsg message'";
}
@Override
protected String _getHelpString() {
return "Send system message in chat window to all players";
}
@Override
protected String _getHelpString() {
return "Send system message in chat window to all players";
}
}
+28 -28
View File
@@ -15,42 +15,42 @@ import engine.objects.PlayerCharacter;
public class TeleportModeCmd extends AbstractDevCmd {
public TeleportModeCmd() {
public TeleportModeCmd() {
super("teleportMode");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
boolean newTeleportMode = false;
if (words.length == 0) { // toggle
newTeleportMode = !pc.isTeleportMode();
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
boolean newTeleportMode = false;
if (words.length == 0) { // toggle
newTeleportMode = !pc.isTeleportMode();
} else if (words[0].equalsIgnoreCase("on")) {
newTeleportMode = true;
} else if (words[0].equalsIgnoreCase("on")) {
newTeleportMode = true;
} else if (words[0].equalsIgnoreCase("off")) {
newTeleportMode = false;
} else if (words[0].equalsIgnoreCase("off")) {
newTeleportMode = false;
} else {
this.sendUsage(pc);
return;
}
pc.setTeleportMode(newTeleportMode);
this.setTarget(pc); //for logging
String output = (newTeleportMode ? "on" : "off");
} else {
this.sendUsage(pc);
return;
}
pc.setTeleportMode(newTeleportMode);
this.setTarget(pc); //for logging
String output = (newTeleportMode ? "on" : "off");
throwbackInfo(pc, "Teleport mode is now '" + output + "'.");
}
throwbackInfo(pc, "Teleport mode is now '" + output + "'.");
}
@Override
protected String _getHelpString() {
return "'on' enables teleport mode, 'off' disables. No arguments to the /teleportMode command will toggle the setting.";
}
@Override
protected String _getHelpString() {
return "'on' enables teleport mode, 'off' disables. No arguments to the /teleportMode command will toggle the setting.";
}
@Override
protected String _getUsageString() {
return "' /teleportMode [on | off]'";
}
@Override
protected String _getUsageString() {
return "' /teleportMode [on | off]'";
}
}
+47 -48
View File
@@ -21,82 +21,81 @@ import engine.objects.PlayerCharacter;
/**
* @author
*
*/
public class UnloadFurnitureCmd extends AbstractDevCmd {
public UnloadFurnitureCmd() {
public UnloadFurnitureCmd() {
super("furniture");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target.getObjectType() != GameObjectType.Building){
this.throwbackError(pc, "Must be targeting a building to load/unload furniture.");
return;
}
if (words[0].equalsIgnoreCase("unload")){
if (target.getObjectType() != GameObjectType.Building) {
this.throwbackError(pc, "Must be targeting a building to load/unload furniture.");
return;
}
if (words[0].equalsIgnoreCase("unload")) {
UnloadObjectsMsg uom = new UnloadObjectsMsg();
for (AbstractWorldObject awo: pc.getLoadedStaticObjects()){
if (awo.getObjectType() != GameObjectType.Building)
continue;
UnloadObjectsMsg uom = new UnloadObjectsMsg();
for (AbstractWorldObject awo : pc.getLoadedStaticObjects()) {
if (awo.getObjectType() != GameObjectType.Building)
continue;
Building awoBuilding = (Building)awo;
Building awoBuilding = (Building) awo;
if (!awoBuilding.isFurniture)
continue;
continue;
if (awoBuilding.parentBuildingID != target.getObjectUUID())
continue;
MoveToPointMsg msg = new MoveToPointMsg(awoBuilding);
pc.getClientConnection().sendMsg(msg);
if (awoBuilding.parentBuildingID != target.getObjectUUID())
continue;
uom.addObject(awoBuilding);
MoveToPointMsg msg = new MoveToPointMsg(awoBuilding);
pc.getClientConnection().sendMsg(msg);
uom.addObject(awoBuilding);
}
}
pc.getClientConnection().sendMsg(uom);
pc.getClientConnection().sendMsg(uom);
}else if (words[0].equalsIgnoreCase("load")){
LoadStructureMsg lsm = new LoadStructureMsg();
} else if (words[0].equalsIgnoreCase("load")) {
LoadStructureMsg lsm = new LoadStructureMsg();
for (AbstractWorldObject awo: pc.getLoadedStaticObjects()){
if (awo.getObjectType() != GameObjectType.Building)
continue;
for (AbstractWorldObject awo : pc.getLoadedStaticObjects()) {
if (awo.getObjectType() != GameObjectType.Building)
continue;
Building awoBuilding = (Building)awo;
Building awoBuilding = (Building) awo;
if (!awoBuilding.isFurniture)
continue;
continue;
if (awoBuilding.parentBuildingID != target.getObjectUUID())
continue;
if (awoBuilding.parentBuildingID != target.getObjectUUID())
continue;
lsm.addObject(awoBuilding);
lsm.addObject(awoBuilding);
}
}
pc.getClientConnection().sendMsg(lsm);
pc.getClientConnection().sendMsg(lsm);
}
}
}
}
@Override
protected String _getHelpString() {
String help = "Enchants an item with a prefix and suffix";
return help;
}
@Override
protected String _getHelpString() {
String help = "Enchants an item with a prefix and suffix";
return help;
}
@Override
protected String _getUsageString() {
String usage = "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
return usage;
}
@Override
protected String _getUsageString() {
String usage = "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
return usage;
}
}
+95 -96
View File
@@ -22,129 +22,128 @@ import java.util.ArrayList;
/**
* @author
*
*/
public class ZoneInfoCmd extends AbstractDevCmd {
public ZoneInfoCmd() {
public ZoneInfoCmd() {
super("zoneinfo");
}
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
// Arg Count Check
Zone zone = null;
@Override
protected void _doCmd(PlayerCharacter player, String[] words,
AbstractGameObject target) {
// Arg Count Check
Zone zone = null;
if (player == null) {
throwbackError(player, "Unable to find the pc making the request.");
return;
}
if (player == null) {
throwbackError(player, "Unable to find the pc making the request.");
return;
}
try {
int targetID = Integer.parseInt(words[0]);
try {
int targetID = Integer.parseInt(words[0]);
//try get zone by objectUUID
zone = ZoneManager.getZoneByUUID(targetID);
//try get zone by objectUUID
zone = ZoneManager.getZoneByUUID(targetID);
//that failed, try get by zoneID
if (zone == null)
zone = ZoneManager.getZoneByZoneID(targetID);
//that failed, try get by zoneID
if (zone == null)
zone = ZoneManager.getZoneByZoneID(targetID);
//no zone found, so fail
if (zone == null) {
throwbackError(player, "Zone with ID " + targetID + "not found");
return;
}
} catch (Exception e) {
zone = ZoneManager.findSmallestZone(player.getLoc());
}
//no zone found, so fail
if (zone == null) {
throwbackError(player, "Zone with ID " + targetID + "not found");
return;
}
} catch (Exception e) {
zone = ZoneManager.findSmallestZone(player.getLoc());
}
if (zone == null) {
throwbackError(player, "Zone not found");
return;
}
if (zone == null) {
throwbackError(player, "Zone not found");
return;
}
String newline = "\r\n ";
String newline = "\r\n ";
int objectUUID = zone.getObjectUUID();
String output;
int objectUUID = zone.getObjectUUID();
String output;
output = "Target Information:" + newline;
output += StringUtils.addWS("UUID: " + objectUUID, 20);
output += newline;
output += "name: " + zone.getName();
output += newline;
output += "loadNum: " + zone.getLoadNum();
if (zone.getParent() != null) {
output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
output = "Target Information:" + newline;
output += StringUtils.addWS("UUID: " + objectUUID, 20);
output += newline;
output += "name: " + zone.getName();
output += newline;
output += "loadNum: " + zone.getLoadNum();
if (zone.getParent() != null) {
output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
} else
output += StringUtils.addWS(", parent: none", 30);
output += newline;
output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
output += newline;
output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
output += newline;
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
output += newline;
} else
output += StringUtils.addWS(", parent: none", 30);
output += newline;
output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
output += newline;
output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
output += newline;
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
output += newline;
if (zone.getHeightMap() != null){
output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
output += newline;
output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
output += newline;
output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
if (zone.getHeightMap() != null) {
output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
output += newline;
output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
output += newline;
output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
}
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
output += newline;
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
output += newline;
output += "Sea Level = " +zone.getSeaLevel();
output += newline;
output += "World Altitude = " + zone.getWorldAltitude();
throwbackInfo(player, output);
}
output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
output += newline;
// output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
output += newline;
output += "Sea Level = " + zone.getSeaLevel();
output += newline;
output += "World Altitude = " + zone.getWorldAltitude();
throwbackInfo(player, output);
City city = ZoneManager.getCityAtLocation(player.getLoc());
City city = ZoneManager.getCityAtLocation(player.getLoc());
output += newline;
output += (city == null)? "None" : city.getParent().getName();
output += newline;
output += (city == null) ? "None" : city.getParent().getName();
if (city != null ) {
if (city != null) {
if (city.isLocationOnCityGrid(player.getLoc()))
output += " (Grid)";
else if (city.isLocationOnCityZone(player.getLoc()))
output += " (Zone)";
else if (city.isLocationWithinSiegeBounds(player.getLoc()))
output += " (Siege)";
} else {
output = "children:";
if (city.isLocationOnCityGrid(player.getLoc()))
output += " (Grid)";
else if (city.isLocationOnCityZone(player.getLoc()))
output += " (Zone)";
else if (city.isLocationWithinSiegeBounds(player.getLoc()))
output += " (Siege)";
} else {
output = "children:";
ArrayList<Zone> nodes = zone.getNodes();
ArrayList<Zone> nodes = zone.getNodes();
if (nodes.isEmpty())
output += " none";
if (nodes.isEmpty())
output += " none";
for (Zone child : nodes) {
output += newline;
output += child.getName() + " (" + child.getLoadNum() + ')';
}
}
throwbackInfo(player, output);
}
for (Zone child : nodes) {
output += newline;
output += child.getName() + " (" + child.getLoadNum() + ')';
}
}
throwbackInfo(player, output);
}
@Override
protected String _getHelpString() {
return "Gets information on an Object.";
}
@Override
protected String _getHelpString() {
return "Gets information on an Object.";
}
@Override
protected String _getUsageString() {
return "' /info targetID'";
}
@Override
protected String _getUsageString() {
return "' /info targetID'";
}
}
+12 -18
View File
@@ -9,25 +9,19 @@
package engine.devcmd.cmds;
import engine.Enum.BuildingGroup;
import engine.Enum.GameObjectType;
import engine.Enum.TargetColor;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.util.StringUtils;
import engine.objects.AbstractGameObject;
import engine.objects.Building;
import engine.objects.Mob;
import engine.objects.PlayerCharacter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author
*
*/
public class aiInfoCmd extends AbstractDevCmd {
@@ -73,17 +67,17 @@ public class aiInfoCmd extends AbstractDevCmd {
int objectUUID = target.getObjectUUID();
String output;
if(objType != GameObjectType.Mob){
if (objType != GameObjectType.Mob) {
output = "Please Select A Mob For AI Info" + newline;
} else {
Mob mob = (Mob) target;
output = "Mob AI Information:" + newline;
output += mob.getName() + newline;
if(mob.BehaviourType != null) {
if (mob.BehaviourType != null) {
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
if(mob.BehaviourType.BehaviourHelperType != null) {
if (mob.BehaviourType.BehaviourHelperType != null) {
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
} else{
} else {
output += "Behaviour Helper Type: NULL" + newline;
}
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
@@ -91,18 +85,18 @@ public class aiInfoCmd extends AbstractDevCmd {
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
} else{
} else {
output += "BehaviourType: NULL" + newline;
}
output += "Aggro Range: " + mob.getAggroRange() + newline;
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
if(mob.playerAgroMap.size() > 0){
if (mob.playerAgroMap.size() > 0) {
output += "Players Loaded:" + newline;
}
for(Map.Entry<Integer,Boolean> entry : mob.playerAgroMap.entrySet()){
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
output += "Player ID: " + entry.getKey() + " Is Safemode: " + entry.getValue() + newline;
}
if(mob.getCombatTarget() != null)
if (mob.getCombatTarget() != null)
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
else
output += "Current Target: NULL" + newline;
+23 -26
View File
@@ -7,7 +7,6 @@
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -21,42 +20,40 @@ import engine.objects.PlayerCharacter;
public class convertLoc extends AbstractDevCmd {
public convertLoc() {
public convertLoc() {
super("convertLoc");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
if (target == null){
Vector3fImmutable convertLoc = ZoneManager.findSmallestZone(pc.getLoc()).getLoc().subtract(pc.getLoc());
ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertLoc));
return;
}
if (target == null) {
Vector3fImmutable convertLoc = ZoneManager.findSmallestZone(pc.getLoc()).getLoc().subtract(pc.getLoc());
ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertLoc));
return;
}
if (target.getObjectType() != GameObjectType.Building)
return;
Building toConvert = (Building)target;
Vector3fImmutable convertedLoc = ZoneManager.convertWorldToLocal(toConvert, pc.getLoc());
ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertedLoc));
if (target.getObjectType() != GameObjectType.Building)
return;
Building toConvert = (Building) target;
Vector3fImmutable convertedLoc = ZoneManager.convertWorldToLocal(toConvert, pc.getLoc());
ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertedLoc));
}
@Override
protected String _getHelpString() {
return "Temporarily Changes SubRace";
}
}
@Override
protected String _getUsageString() {
return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
@Override
protected String _getHelpString() {
return "Temporarily Changes SubRace";
}
@Override
protected String _getUsageString() {
return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
}
}
}
+12 -10
View File
@@ -2,11 +2,13 @@ package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.*;
import engine.gameManager.BuildingManager;
import engine.gameManager.NPCManager;
import engine.objects.*;
import java.util.ArrayList;
public class simulateBootyCmd extends AbstractDevCmd {
public class simulateBootyCmd extends AbstractDevCmd {
public simulateBootyCmd() {
super("simulatebooty");
}
@@ -70,7 +72,7 @@ public class simulateBootyCmd extends AbstractDevCmd {
int maxRollRange = (mob.getLevel() * 2) + 120 + (mob.getParentZone().maxLvl * 2);
output += "Roll Range: " + minRollRange + " - " + maxRollRange + newline;
output += "Special Loot:" + newline;
if(mob.bootySet != 0) {
if (mob.bootySet != 0) {
for (BootySetEntry entry : NPCManager._bootySetMap.get(mob.bootySet)) {
ItemBase item = ItemBase.getItemBase(entry.itemBase);
if (item != null) {
@@ -108,14 +110,14 @@ public class simulateBootyCmd extends AbstractDevCmd {
GlassItems.add(lootItem);
} else {
OtherDrops.add(lootItem);
if(lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") ||lootItem.getName().toLowerCase().contains("bell")){
if (lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") || lootItem.getName().toLowerCase().contains("bell")) {
output += lootItem.getName() + newline;
}
}
break;
default:
OtherDrops.add(lootItem);
if(lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") ||lootItem.getName().toLowerCase().contains("bell")){
if (lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") || lootItem.getName().toLowerCase().contains("bell")) {
output += lootItem.getName() + newline;
}
break;
@@ -126,20 +128,20 @@ public class simulateBootyCmd extends AbstractDevCmd {
}
}
int respawnTime = mob.getMobBase().getSpawnTime();
if(mob.spawnTime > 0){
if (mob.spawnTime > 0) {
respawnTime = mob.spawnTime;
}
output += "MobBase BootySet: " + mob.getMobBase().bootySet + newline;
output += "Mob BootySet: " + mob.bootySet + newline;
output += "Tables Rolled On: " + newline;
for(BootySetEntry entry : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)){
for (BootySetEntry entry : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)) {
output += "[" + entry.bootyType + "] " + entry.lootTable + newline;
}
output += "Time Required To Gain Simulated Booty: " + respawnTime * 100 + " Seconds" + newline;
output += "GLASS DROPS: " + GlassItems.size() + newline;
output += "RUNE DROPS: " + Runes.size()+ newline;
output += "CONTRACTS DROPS: " + Contracts.size()+ newline;
output += "RESOURCE DROPS: " + Resources.size()+ newline;
output += "RUNE DROPS: " + Runes.size() + newline;
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
output += "RESOURCE DROPS: " + Resources.size() + newline;
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
output += "OTHER ITEMS DROPPED: " + OtherDrops.size() + newline;
output += "FAILED ROLLS: " + failures + newline;