Initial Repository Push
This commit is contained in:
@@ -0,0 +1,181 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class AbstractDevCmd {
|
||||
|
||||
protected final ArrayList<String> cmdStrings;
|
||||
private AbstractGameObject tr;
|
||||
private String rsult;
|
||||
|
||||
public AbstractDevCmd(String cmdString) {
|
||||
super();
|
||||
this.cmdStrings = new ArrayList<>();
|
||||
this.addCmdString(cmdString);
|
||||
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
|
||||
*/
|
||||
protected static Building getTargetAsBuilding(PlayerCharacter pc) {
|
||||
int targetType = pc.getLastTargetType().ordinal();
|
||||
int targetID = pc.getLastTargetID();
|
||||
if (targetType == GameObjectType.Building.ordinal()) {
|
||||
Building b = (Building) DbManager
|
||||
.getFromCache(GameObjectType.Building, targetID);
|
||||
if (b == null) {
|
||||
ChatManager.chatSystemError(
|
||||
pc,
|
||||
"Command Failed. Could not find building of ID "
|
||||
+ targetID);
|
||||
return null;
|
||||
}
|
||||
return b;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected static Mob getTargetAsMob(PlayerCharacter pc) {
|
||||
int targetType = pc.getLastTargetType().ordinal();
|
||||
int targetID = pc.getLastTargetID();
|
||||
if (targetType == GameObjectType.Mob.ordinal()) {
|
||||
Mob b = Mob.getMob(targetID);
|
||||
if (b == null) {
|
||||
ChatManager.chatSystemError(pc,
|
||||
"Command Failed. Could not find Mob of ID " + targetID);
|
||||
return null;
|
||||
}
|
||||
return b;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected static NPC getTargetAsNPC(PlayerCharacter pc) {
|
||||
int targetType = pc.getLastTargetType().ordinal();
|
||||
int targetID = pc.getLastTargetID();
|
||||
if (targetType == GameObjectType.NPC.ordinal()) {
|
||||
NPC b = NPC.getFromCache(targetID);
|
||||
if (b == null) {
|
||||
ChatManager.chatSystemError(pc,
|
||||
"Command Failed. Could not find NPC of ID " + targetID);
|
||||
return null;
|
||||
}
|
||||
return b;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.ProtectionState;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
public class AddBuildingCmd extends AbstractDevCmd {
|
||||
|
||||
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) {
|
||||
|
||||
// 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());
|
||||
|
||||
if (zone == null) {
|
||||
throwbackError(pc, "Failed to find zone to place building in.");
|
||||
return;
|
||||
}
|
||||
|
||||
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 (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'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class AddGoldCmd extends AbstractDevCmd {
|
||||
|
||||
public AddGoldCmd() {
|
||||
super("addgold");
|
||||
}
|
||||
|
||||
@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();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
||||
pc.getCharItemManager().updateInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "adds gold to inventory";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /addGold quantity'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class AddMobCmd extends AbstractDevCmd {
|
||||
|
||||
public AddMobCmd() {
|
||||
super("mob");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (words.length != 1) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
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);
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Mob mob = Mob.createMob( loadID, pc.getLoc(),
|
||||
null, true, zone, null,0);
|
||||
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() {
|
||||
return "Creates a Mob of type 'mobID' at the location your character is standing";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /mob mobID'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class AddMobPowerCmd extends AbstractDevCmd {
|
||||
|
||||
public AddMobPowerCmd() {
|
||||
super("addmobpower");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
|
||||
if(args.length != 2){
|
||||
this.sendUsage(pcSender);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getObjectType() != GameObjectType.Mob){
|
||||
this.throwbackError(pcSender, "Target is not a valid Mob.");
|
||||
return;
|
||||
}
|
||||
Mob mobTarget = (Mob)target;
|
||||
|
||||
|
||||
int rank = 0;
|
||||
String idString = args[0];
|
||||
|
||||
try{
|
||||
rank = Integer.valueOf(args[1]);
|
||||
}catch(Exception e){
|
||||
this.throwbackInfo(pcSender, "Failed to Parse an Integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
PowersBase pb = PowersManager.getPowerByIDString(idString);
|
||||
if (pb == null){
|
||||
this.throwbackError(pcSender, "not a valid Effect. IDString is Case Sensitive.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DbManager.MobBaseQueries.ADD_MOBBASE_POWER(mobTarget.getMobBaseID(), pb.getToken(), rank)){
|
||||
this.throwbackError(pcSender, "Failed to update Database");
|
||||
}
|
||||
|
||||
mobTarget.getMobBase().updatePowers();
|
||||
|
||||
this.throwbackInfo(pcSender, "Successfuly added Power " + pb.getIDString() + " to Mobbase with UID " + mobTarget.getMobBaseID());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /addmobpower poweridstring rank";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Temporarily add visual effects to Character";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.RuneBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class AddMobRuneCmd extends AbstractDevCmd {
|
||||
|
||||
public AddMobRuneCmd() {
|
||||
super("addmobrune");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
|
||||
if(args.length != 1){
|
||||
this.sendUsage(pcSender);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getObjectType() != GameObjectType.Mob){
|
||||
this.throwbackError(pcSender, "Target is not a valid Mob.");
|
||||
return;
|
||||
}
|
||||
Mob mobTarget = (Mob)target;
|
||||
|
||||
|
||||
int runeID = 0;
|
||||
try{
|
||||
runeID = Integer.valueOf(args[0]);
|
||||
}catch(Exception e){
|
||||
this.throwbackInfo(pcSender, "Failed to Parse an Integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
RuneBase rune = RuneBase.getRuneBase(runeID);
|
||||
if (rune == null){
|
||||
this.throwbackError(pcSender, "Invalid Rune ID");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!DbManager.MobBaseQueries.ADD_MOBBASE_RUNE(mobTarget.getMobBaseID(), runeID)){
|
||||
this.throwbackError(pcSender, "Failed to update Database");
|
||||
return;
|
||||
}
|
||||
|
||||
mobTarget.getMobBase().updateRunes();
|
||||
|
||||
this.throwbackInfo(pcSender, "Successfuly added rune " + rune.getName() + " to Mobbase with UID " + mobTarget.getMobBaseID());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /visualeffect visualeffectID";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Temporarily add visual effects to Character";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class AddNPCCmd extends AbstractDevCmd {
|
||||
|
||||
public AddNPCCmd() {
|
||||
super("npc");
|
||||
}
|
||||
|
||||
@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]);
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// Pick a random name
|
||||
if (name.isEmpty())
|
||||
name = NPC.getPirateName(contract.getMobbaseID());
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
NPC npc = NPC.createNPC(name, contractID,
|
||||
pc.getLoc(), null, true, zone, (short)level, true, 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);
|
||||
}
|
||||
}
|
||||
|
||||
@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'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.PowerActionType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.util.ThreadUtils;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class ApplyBonusCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class ApplyStatModCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 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));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
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() {
|
||||
return "' /applystatmod <stat> [trains]'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "You must be targeting a player!";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.ModType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.net.ItemProductionManager;
|
||||
import engine.objects.*;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.powers.poweractions.AbstractPowerAction;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class AuditFailedItemsCmd extends AbstractDevCmd {
|
||||
|
||||
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 String _getUsageString() {
|
||||
return "' /bounds'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Audits all the mobs in a zone.";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class AuditHeightMapCmd extends AbstractDevCmd {
|
||||
|
||||
public AuditHeightMapCmd() {
|
||||
super("auditheightmap");
|
||||
}
|
||||
|
||||
@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++){
|
||||
|
||||
|
||||
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 );
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
long delta = end - start;
|
||||
|
||||
this.throwbackInfo(pcSender, "Audit Heightmap took " + delta + " ms to run " + count + " times!");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /auditmobs [zone.UUID]'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Audits all the mobs in a zone.";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class AuditMobsCmd extends AbstractDevCmd {
|
||||
|
||||
public AuditMobsCmd() {
|
||||
super("auditmobs");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (pcSender == null) return;
|
||||
|
||||
//get Zone to check mobs against
|
||||
|
||||
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 (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());
|
||||
|
||||
if (zone == null) {
|
||||
throwbackError(pcSender, "Unable to find the zone");
|
||||
return;
|
||||
}
|
||||
|
||||
//get list of mobs for zone
|
||||
|
||||
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();
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /auditmobs [zone.UUID]'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Audits all the mobs in a zone.";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class BoundsCmd extends AbstractDevCmd {
|
||||
|
||||
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 String _getUsageString() {
|
||||
return "' /bounds'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Audits all the mobs in a zone.";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.util.MiscUtils;
|
||||
|
||||
public class ChangeNameCmd extends AbstractDevCmd {
|
||||
|
||||
public ChangeNameCmd() {
|
||||
super("changename");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
Vector3fImmutable loc = null;
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
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 _getUsageString() {
|
||||
return "'./changename oldFirstName newFirstName newLastName'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class CombatMessageCmd extends AbstractDevCmd {
|
||||
|
||||
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 String _getUsageString() {
|
||||
return "' /cm [cmNumber]'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets the combat message to the supplied integer value";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.MobBase;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class CopyMobCmd extends AbstractDevCmd {
|
||||
|
||||
public CopyMobCmd() {
|
||||
super("copymob");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (words.length < 1) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
int loadID = 0;
|
||||
String name = "";
|
||||
try {
|
||||
loadID = Integer.parseInt(words[0]);
|
||||
if (words.length > 1) {
|
||||
name = words[1];
|
||||
for (int i=2; i<words.length;i++)
|
||||
name += ' ' + words[i];
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc, "Supplied type " + words[0]
|
||||
+ " failed to parse to an Integer");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
throwbackError(pc,
|
||||
"Invalid copyMob Command. Need mob ID specified.");
|
||||
return; // NaN
|
||||
}
|
||||
MobBase mob = MobBase.getMobBase(loadID);
|
||||
if (mob == null) {
|
||||
throwbackError(pc,
|
||||
"Invalid copyMob Command. Mob ID specified is not valid.");
|
||||
return;
|
||||
}
|
||||
MobBase mb = null;
|
||||
try {
|
||||
mb = MobBase.copyMobBase(mob, name);
|
||||
} catch (Exception e) {}
|
||||
if (mb == null) {
|
||||
throwbackError(pc, "copyMob SQL Error. Failed to create new mob.");
|
||||
return;
|
||||
}
|
||||
ChatManager.chatSayInfo(
|
||||
pc,
|
||||
"MobBase created with ID " + mb.getObjectUUID() + " using name "
|
||||
+ mb.getFirstName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Copies a Mob of type 'mobID' with optional new name";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /mob mobID [name]'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.ItemFactory;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class CreateItemCmd extends AbstractDevCmd {
|
||||
|
||||
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]);
|
||||
|
||||
if (id == 0)
|
||||
id = Integer.parseInt(words[0]);
|
||||
if (id == 7){
|
||||
this.throwbackInfo(pc, "use /addgold to add gold.....");
|
||||
return;
|
||||
}
|
||||
|
||||
int size = 1;
|
||||
|
||||
if(words.length < 3) {
|
||||
size = Integer.parseInt(words[1]);
|
||||
}
|
||||
|
||||
ItemFactory.fillInventory(pc, id, size);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Fill your inventory with items";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /createitem <ItembaseID> <quantity>'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.jobs.DebugTimerJob;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class DebugCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
|
||||
public DebugCmd() {
|
||||
super("debug");
|
||||
// super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (words.length < 2) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
//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;
|
||||
|
||||
switch (command) {
|
||||
case "magictrek":
|
||||
pc.RUN_MAGICTREK = toggle;
|
||||
|
||||
break;
|
||||
case "combat":
|
||||
pc.setDebug(64, toggle);
|
||||
|
||||
break;
|
||||
case "health":
|
||||
toggleDebugTimer(pc, "Debug_Health", 1, 1000, toggle);
|
||||
|
||||
break;
|
||||
case "mana":
|
||||
toggleDebugTimer(pc, "Debug_Mana", 2, 1000, toggle);
|
||||
|
||||
break;
|
||||
case "stamina":
|
||||
toggleDebugTimer(pc, "Debug_Stamina", 3, 500, toggle);
|
||||
|
||||
break;
|
||||
case "spells":
|
||||
pc.setDebug(16, toggle);
|
||||
|
||||
break;
|
||||
case "damageabsorber":
|
||||
pc.setDebug(2, toggle);
|
||||
|
||||
break;
|
||||
case "recast":
|
||||
case "recycle":
|
||||
pc.setDebug(4, toggle);
|
||||
|
||||
break;
|
||||
case "seeinvis":
|
||||
pc.setDebug(8, toggle);
|
||||
|
||||
break;
|
||||
case "movement":
|
||||
pc.setDebug(1, toggle);
|
||||
|
||||
break;
|
||||
case "noaggro":
|
||||
pc.setDebug(32, toggle);
|
||||
|
||||
break;
|
||||
// case "loot":
|
||||
// MBServerStatics.debugLoot = toggle;
|
||||
// break;
|
||||
|
||||
default:
|
||||
String output = "Debug for " + command + " not found.";
|
||||
throwbackError(pc, output);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
setTarget(pc); //for logging
|
||||
|
||||
String output = "Debug for " + command + " turned " + ((toggle) ? "on." : "off.");
|
||||
throwbackInfo(pc, output);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class DebugMeleeSyncCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Turns on/off melee sync debugging.";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./debugmeleesync on|off'";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class DecachePlayerCmd extends AbstractDevCmd {
|
||||
|
||||
public DecachePlayerCmd() {
|
||||
super("decacheplayer");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if(words.length < 1) {
|
||||
this.sendUsage(pc);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "No player found. Please make sure the table ID is correct.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /decacheplayer <UUID>'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class DespawnCmd extends AbstractDevCmd {
|
||||
|
||||
public DespawnCmd() {
|
||||
super("debugmob");
|
||||
}
|
||||
|
||||
@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");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Gets distance from a target.";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /distance'";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class DistanceCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Gets distance from a target.";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /distance'";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.EffectsBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class EffectCmd extends AbstractDevCmd {
|
||||
|
||||
public EffectCmd() {
|
||||
super("effect");
|
||||
}
|
||||
|
||||
@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]);
|
||||
|
||||
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() {
|
||||
return "' /effect EffectsBaseID Token'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Temporarily places the effect token with the corresponding EffectsBase on the server";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
public class EnchantCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Enchants an item with a prefix and suffix";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class FindBuildingsCmd extends AbstractDevCmd {
|
||||
|
||||
public FindBuildingsCmd() {
|
||||
super("findBuildings");
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
} 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 == 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;
|
||||
}
|
||||
|
||||
String s = "";
|
||||
|
||||
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);
|
||||
|
||||
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() + ']';
|
||||
|
||||
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 + '\'');
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets your character's Mana to 'amount'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /findBuildings [lat long] [range]'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class FlashMsgCmd extends AbstractDevCmd {
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
if (pcSender == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._doCmd(pcSender, args, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /flash message'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Flashes system message to all players";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.BuildingGroup;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.RunegateType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
|
||||
public class GateInfoCmd extends AbstractDevCmd {
|
||||
|
||||
public GateInfoCmd() {
|
||||
super("gateinfo");
|
||||
}
|
||||
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
Building targetBuilding;
|
||||
String outString;
|
||||
RunegateType runegateType;
|
||||
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;
|
||||
}
|
||||
|
||||
blueprint = Blueprint._meshLookup.get(targetBuilding.getMeshUUID());
|
||||
|
||||
if (blueprint == null ||
|
||||
(blueprint.getBuildingGroup() != BuildingGroup.RUNEGATE)){
|
||||
throwbackInfo(player, "showgate: target must be a Runegate");
|
||||
return;
|
||||
}
|
||||
|
||||
runegateType = RunegateType.getGateTypeFromUUID(targetBuilding.getObjectUUID());
|
||||
runeGate = Runegate.getRunegates()[runegateType.ordinal()];
|
||||
|
||||
outString = "RungateType: " + runegateType.name();
|
||||
outString += newline;
|
||||
|
||||
outString += "Portal State:";
|
||||
outString += newline;
|
||||
|
||||
for (Portal portal : runeGate.getPortals()) {
|
||||
|
||||
outString += "Portal: " + portal.getPortalType().name();
|
||||
outString += " Active: " + portal.isActive();
|
||||
outString += " Dest: " + portal.getDestinationGateType().name();
|
||||
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";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.VendorDialogMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class GetBankCmd extends AbstractDevCmd {
|
||||
|
||||
public GetBankCmd() {
|
||||
super("getbank");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
if (pcSender == null) return;
|
||||
|
||||
ClientConnection cc = SessionManager.getClientConnection(pcSender);
|
||||
if (cc == null) return;
|
||||
|
||||
VendorDialogMsg.getBank(pcSender, null, cc);
|
||||
this.setTarget(pcSender); //for logging
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /getbank'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Opens bank window";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class GetCacheCountCmd extends AbstractDevCmd {
|
||||
|
||||
public GetCacheCountCmd() {
|
||||
super("getcachecount");
|
||||
this.addCmdString("getcachecount");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
DbManager.printCacheCount(pcSender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /getcachecount'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Get a count of the objects in the cache";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
public class GetDisciplineLocCmd extends AbstractDevCmd {
|
||||
|
||||
public GetDisciplineLocCmd() {
|
||||
super("getdiscloc");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
System.out.println("MOB UUID , MOB NAME , MACRO ZONE NAME , MOB LOCATION, DROPPED ITEM, DROP CHANCE");
|
||||
|
||||
for (Zone zone: ZoneManager.getAllZones()){
|
||||
for (Mob mob: zone.zoneMobSet){
|
||||
|
||||
if (mob.getLevel() >= 80)
|
||||
continue;
|
||||
|
||||
ArrayList<SpecialLoot> specialLootList = SpecialLoot.LootMap.get(mob.getLootSet());
|
||||
|
||||
|
||||
if (specialLootList != null)
|
||||
for (SpecialLoot specialLoot: specialLootList){
|
||||
|
||||
|
||||
ItemBase itemBase = ItemBase.getItemBase(specialLoot.getItemID());
|
||||
System.out.println(mob.getObjectUUID() + " : " + mob.getName() + " : " + (mob.getParentZone().isMacroZone() ? mob.getParentZone().getName() : mob.getParentZone().getParent().getName()) + " , " + mob.getLoc().toString2D() + " , " + itemBase.getName() + " , " + specialLoot.getDropChance() + '%');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Enchants an item with a prefix and suffix";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class GetHeightCmd extends AbstractDevCmd {
|
||||
|
||||
public GetHeightCmd() {
|
||||
super("getHeight");
|
||||
this.addCmdString("height");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
boolean end = true;
|
||||
|
||||
float height = HeightMap.getWorldHeight(pc);
|
||||
|
||||
this.throwbackInfo(pc, "Altitude : " + height);
|
||||
|
||||
this.throwbackInfo(pc, "Character Height: " + pc.getCharacterHeight());
|
||||
this.throwbackInfo(pc, "Character Height to start swimming: " + pc.centerHeight);
|
||||
|
||||
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()) );
|
||||
|
||||
if (end)
|
||||
return;
|
||||
|
||||
Vector2f gridSquare;
|
||||
Vector2f gridOffset;
|
||||
Vector2f parentGrid;
|
||||
Vector2f parentLoc = new Vector2f(-1, -1);
|
||||
|
||||
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
if (currentZone == null)
|
||||
return;
|
||||
|
||||
Zone parentZone = currentZone.getParent();
|
||||
|
||||
HeightMap heightMap = currentZone.getHeightMap();
|
||||
|
||||
|
||||
//find the next parents heightmap if the currentzone heightmap is null.
|
||||
while (heightMap == null){
|
||||
|
||||
if (currentZone == ZoneManager.getSeaFloor()){
|
||||
this.throwbackInfo(pc, "Could not find a heightmap to get height.");
|
||||
break;
|
||||
}
|
||||
|
||||
this.throwbackError(pc, "Heightmap does not exist for " + currentZone.getName());
|
||||
this.throwbackInfo(pc, "Using parent zone instead: ");
|
||||
currentZone = currentZone.getParent();
|
||||
heightMap = currentZone.getHeightMap();
|
||||
}
|
||||
|
||||
|
||||
if ( (heightMap == null) || (currentZone == ZoneManager.getSeaFloor()) ) {
|
||||
this.throwbackInfo(pc, currentZone.getName() + " has no heightmap " );
|
||||
this.throwbackInfo(pc, "Current altitude: " + currentZone.absY );
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone);
|
||||
|
||||
Vector3fImmutable seaFloorLocalLoc = ZoneManager.worldToLocal(pc.getLoc(), ZoneManager.getSeaFloor());
|
||||
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());
|
||||
this.throwbackInfo(pc, "Local Zone Location from center : " + localLocFromCenter);
|
||||
this.throwbackInfo(pc, "parent Zone Location from center : " + parentLocFromCenter);
|
||||
|
||||
Vector2f parentZoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone.getParent());
|
||||
this.throwbackInfo(pc, "Parent Zone Location from Bottom Left : " + parentZoneLoc);
|
||||
|
||||
if ((parentZone != null ) && (parentZone.getHeightMap() != null)) {
|
||||
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
|
||||
parentGrid = parentZone.getHeightMap().getGridSquare( parentLoc);
|
||||
} else parentGrid = new Vector2f(-1,-1);
|
||||
|
||||
gridSquare = heightMap.getGridSquare(zoneLoc);
|
||||
gridOffset = HeightMap.getGridOffset(gridSquare);
|
||||
|
||||
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
|
||||
|
||||
this.throwbackInfo(pc, currentZone.getName());
|
||||
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);
|
||||
|
||||
if (parentGrid.x != -1) {
|
||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||
this.throwbackInfo(pc, "Parent ALTITUDE: " + (parentAltitude));
|
||||
this.throwbackInfo(pc, "Parent Interpolation: " + (parentAltitude + parentZone.getWorldAltitude()));
|
||||
}
|
||||
this.throwbackInfo(pc, "interpolated height: " + interaltitude);
|
||||
|
||||
this.throwbackInfo(pc, "interpolated height with World: " + (interaltitude + currentZone.getWorldAltitude()));
|
||||
|
||||
float realWorldAltitude = interaltitude + currentZone.getWorldAltitude();
|
||||
|
||||
//OUTSET
|
||||
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 outsideGridSizeX = 1 - bucketScaleX; //32/256
|
||||
float outsideGridSizeZ = 1 - bucketScaleZ;
|
||||
float weight;
|
||||
|
||||
double scale;
|
||||
|
||||
|
||||
if (offsetX > outsideGridSizeX && offsetX > offsetZ){
|
||||
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
|
||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||
|
||||
float scaleChild = (float) ((scale + 1) * .5);
|
||||
float scaleParent = 1 - scaleChild;
|
||||
|
||||
|
||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||
|
||||
parentCenterAltitude += currentZone.getYCoord();
|
||||
parentCenterAltitude += interaltitude;
|
||||
|
||||
float firstScale = parentAltitude * scaleParent;
|
||||
float secondScale = parentCenterAltitude * scaleChild;
|
||||
float outsetALt = firstScale + secondScale;
|
||||
|
||||
outsetALt += currentZone.getParent().getAbsY();
|
||||
realWorldAltitude = outsetALt;
|
||||
|
||||
}else if (offsetZ > outsideGridSizeZ){
|
||||
|
||||
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
|
||||
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
|
||||
|
||||
float scaleChild = (float) ((scale + 1) * .5);
|
||||
float scaleParent = 1 - scaleChild;
|
||||
float parentAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(parentLoc);
|
||||
float parentCenterAltitude = parentZone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(currentZone.getLoc(), parentZone));
|
||||
|
||||
parentCenterAltitude += currentZone.getYCoord();
|
||||
parentCenterAltitude += interaltitude;
|
||||
float firstScale = parentAltitude * scaleParent;
|
||||
float secondScale = parentCenterAltitude * scaleChild;
|
||||
float outsetALt = firstScale + secondScale;
|
||||
|
||||
outsetALt += currentZone.getParent().getAbsY();
|
||||
realWorldAltitude = outsetALt;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
float strMod = pc.statStrBase - 40;
|
||||
|
||||
strMod *= .00999999998f;
|
||||
|
||||
strMod += 1f;
|
||||
|
||||
float radius = 0;
|
||||
switch (pc.getRaceID()){
|
||||
case 2017:
|
||||
radius = 3.1415927f;
|
||||
case 2000:
|
||||
|
||||
|
||||
}
|
||||
strMod *= 1.5707964f;
|
||||
|
||||
strMod += 3.1415927f;
|
||||
|
||||
strMod -= .5f;
|
||||
|
||||
|
||||
|
||||
realWorldAltitude += strMod;
|
||||
|
||||
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Temporarily Changes SubRace";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /subrace mobBaseID";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class GetMemoryCmd extends AbstractDevCmd {
|
||||
|
||||
public GetMemoryCmd() {
|
||||
super("getmemory");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (pcSender == null) return;
|
||||
|
||||
String hSize = getMemoryOutput(Runtime.getRuntime().totalMemory());
|
||||
String mhSize = getMemoryOutput(Runtime.getRuntime().maxMemory());
|
||||
String fhSize = getMemoryOutput(Runtime.getRuntime().freeMemory());
|
||||
|
||||
String out = "Heap Size: " + hSize + ", Max Heap Size: " + mhSize + ", Free Heap Size: " + fhSize;
|
||||
throwbackInfo(pcSender, out);
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /getmemory'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "lists memory usage";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.MobLootBase;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class GetMobBaseLoot extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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 ");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Copies a Mob of type 'mobID' with optional new name";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /mob mobID [name]'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class GetOffsetCmd extends AbstractDevCmd {
|
||||
|
||||
public GetOffsetCmd() {
|
||||
super("getoffset");
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
throwbackInfo(pcSender, zone.getName() + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./getoffset [zoneID]'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "lists offset from center of zone";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
public class GetRuneDropRateCmd extends AbstractDevCmd {
|
||||
|
||||
public GetRuneDropRateCmd() {
|
||||
super("getrunedroprate");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (pcSender == null) return;
|
||||
|
||||
String out = "Depracated";
|
||||
throwbackInfo(pcSender, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /getrunedroprate'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "lists drop rates for runes and contracts in non-hotzone.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.VendorDialogMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class GetVaultCmd extends AbstractDevCmd {
|
||||
|
||||
public GetVaultCmd() {
|
||||
super("getvault");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
if (pcSender == null) return;
|
||||
|
||||
ClientConnection cc = SessionManager.getClientConnection(pcSender);
|
||||
if (cc == null) return;
|
||||
|
||||
VendorDialogMsg.getVault(pcSender, null, cc);
|
||||
this.setTarget(pcSender); //for logging
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /getvault'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Opens account vault";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GetZoneCmd extends AbstractDevCmd {
|
||||
|
||||
public GetZoneCmd() {
|
||||
super("getzone");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (pcSender == null) 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;
|
||||
}
|
||||
|
||||
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 _getHelpString() {
|
||||
return "lists what zones a player is in";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class GetZoneMobsCmd extends AbstractDevCmd {
|
||||
|
||||
public GetZoneMobsCmd() {
|
||||
super("getzonemobs");
|
||||
}
|
||||
|
||||
@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) {}
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
//get all mobs for the zone
|
||||
|
||||
throwbackInfo(pcSender, zone.getName() + " (" + zone.getLoadNum() + ") " + zone.getObjectUUID());
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /getzonemobs [zoneID]'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "lists all mobs for a zone";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class GotoBoundsCmd extends AbstractDevCmd {
|
||||
|
||||
public GotoBoundsCmd() {
|
||||
super("gotobounds");
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
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>'";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class GotoCmd extends AbstractDevCmd {
|
||||
|
||||
public GotoCmd() {
|
||||
super("goto");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
Vector3fImmutable loc = null;
|
||||
|
||||
// Arg Count Check
|
||||
|
||||
|
||||
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].equalsIgnoreCase("playground")){
|
||||
if (target instanceof AbstractCharacter){
|
||||
loc = new Vector3fImmutable(63276,0,-54718);
|
||||
}
|
||||
|
||||
if (loc != null)
|
||||
pc.teleport(loc);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (words[0].equalsIgnoreCase("coc")){
|
||||
if (target instanceof AbstractCharacter){
|
||||
loc = new Vector3fImmutable(98561.656f,0,-13353.778f);
|
||||
}
|
||||
|
||||
if (loc != null)
|
||||
pc.teleport(loc);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
String cityName = "";
|
||||
for (String partial: words){
|
||||
cityName += partial + ' ';
|
||||
}
|
||||
|
||||
cityName = cityName.substring(0, cityName.length() - 1);
|
||||
|
||||
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();
|
||||
|
||||
int random = ThreadLocalRandom.current().nextInt(5);
|
||||
if (random == 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (loc == null && words.length == 1){
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (pcDest.getCombinedName().equals(pc.getCombinedName())) {
|
||||
this
|
||||
.throwbackError(pc,
|
||||
"Cannot goto yourself. Well, you can, but you wont go anywhere.");
|
||||
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 (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] + '\'';
|
||||
|
||||
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;
|
||||
|
||||
} 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 _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 `_`]`";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
|
||||
public class GotoObj extends AbstractDevCmd {
|
||||
|
||||
public GotoObj() {
|
||||
super("gotoobj");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
objectType = DbManager.BuildingQueries.GET_UID_ENUM(uuid);
|
||||
|
||||
switch (objectType) {
|
||||
|
||||
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 (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 (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 (city != null)
|
||||
targetLoc = city.getLoc();
|
||||
break;
|
||||
}
|
||||
// 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>'";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
/**
|
||||
* @author
|
||||
* Summary: Lists UID, Name and GL UID of either
|
||||
* Player or NPC sovereign guilds
|
||||
*/
|
||||
|
||||
public class GuildListCmd extends AbstractDevCmd {
|
||||
|
||||
// Instance variables
|
||||
|
||||
private int _guildType; // 0 = Player : 1 = NPC sovereign guilds
|
||||
private String outputStr = null;
|
||||
|
||||
public GuildListCmd() {
|
||||
super("guildlist");
|
||||
}
|
||||
|
||||
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
if(validateUserInput(args) == false) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
parseUserInput(args);
|
||||
|
||||
// Execute stored procedure
|
||||
|
||||
outputStr = DbManager.GuildQueries.GET_GUILD_LIST(_guildType);
|
||||
|
||||
// Send results to user
|
||||
|
||||
throwbackInfo(pc, outputStr);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Lists guild info for sovereign guilds";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "/guildlist npc|player";
|
||||
}
|
||||
|
||||
// Class methods
|
||||
|
||||
private static boolean validateUserInput(String[] userInput) {
|
||||
|
||||
int stringIndex;
|
||||
String commandSet = "npcplayer";
|
||||
|
||||
// incorrect number of arguments test
|
||||
|
||||
if (userInput.length != 1)
|
||||
return false;
|
||||
|
||||
// Test of game object type argument
|
||||
|
||||
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
|
||||
|
||||
return stringIndex != -1;
|
||||
}
|
||||
|
||||
private void parseUserInput(String[] userInput) {
|
||||
|
||||
// Build mask from user input
|
||||
|
||||
switch (userInput[0].toLowerCase()) {
|
||||
case "npc":
|
||||
_guildType = 1;
|
||||
break;
|
||||
case "player":
|
||||
_guildType = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.SimulationManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class HeartbeatCmd extends AbstractDevCmd {
|
||||
|
||||
public HeartbeatCmd() {
|
||||
super("heartbeat");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
this.throwbackInfo(pc, "Current Heartbeat : " + SimulationManager.currentHeartBeatDelta + " ms.");
|
||||
this.throwbackInfo(pc, "Max Heartbeat : " + SimulationManager.HeartbeatDelta + " ms.");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Temporarily Changes SubRace";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /subrace mobBaseID";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DevCmdManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class HelpCmd extends AbstractDevCmd {
|
||||
|
||||
public HelpCmd() {
|
||||
super("help");
|
||||
this.addCmdString("list");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
if (pcSender == null)
|
||||
return;
|
||||
if (pcSender.getAccount() == null)
|
||||
return;
|
||||
this.throwbackInfo(
|
||||
pcSender,
|
||||
"Type ' /command ?' for info about a command. A space is necessary before the slash.");
|
||||
String commands = DevCmdManager.getCmdsForAccessLevel();
|
||||
this.throwbackInfo(pcSender, "Commands your account is eligible to use: ");
|
||||
|
||||
int first = 0;
|
||||
int last = 500;
|
||||
int charLimit = 500;
|
||||
while (commands.length() > charLimit) {
|
||||
this.throwbackInfo(pcSender, commands.substring(first, last));
|
||||
first = charLimit;
|
||||
charLimit += 500;
|
||||
last = charLimit;
|
||||
}
|
||||
this.throwbackInfo(pcSender, commands.substring(first));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /help' || ' /list'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Displays help info and lists all commands accessible for the player's access level.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.FastMath;
|
||||
import engine.net.client.msg.HotzoneChangeMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
import engine.server.world.WorldServer;
|
||||
|
||||
/**
|
||||
* ./hotzone <- display the current hotzone & time remaining
|
||||
* ./hotzone random <- change hotzone to random new zone
|
||||
* ./hotzone name of a macrozone <- change hotzone to the zone name provided
|
||||
*
|
||||
*/
|
||||
public class HotzoneCmd extends AbstractDevCmd {
|
||||
|
||||
public HotzoneCmd() {
|
||||
super("hotzone");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
StringBuilder data = new StringBuilder();
|
||||
for (String s : words) {
|
||||
data.append(s);
|
||||
data.append(' ');
|
||||
}
|
||||
String input = data.toString().trim();
|
||||
|
||||
if (input.length() == 0) {
|
||||
throwbackInfo(pc, "Current hotzone: " + hotzoneInfo());
|
||||
return;
|
||||
}
|
||||
|
||||
Zone zone;
|
||||
|
||||
if (input.equalsIgnoreCase("random")) {
|
||||
throwbackInfo(pc, "Previous hotzone: " + hotzoneInfo());
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
zone = ZoneManager.getHotZone();
|
||||
} else {
|
||||
zone = ZoneManager.findMacroZoneByName(input);
|
||||
|
||||
if (zone == null) {
|
||||
throwbackError(pc, "Cannot find a macrozone with that name.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (zone == ZoneManager.getHotZone()) {
|
||||
throwbackInfo(pc, "That macrozone is already the Hotzone.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZoneManager.validHotZone(zone) == false) {
|
||||
throwbackError(pc, "That macrozone cannot be set as the Hotzone.");
|
||||
return;
|
||||
}
|
||||
|
||||
throwbackInfo(pc, "Previous hotzone: " + hotzoneInfo());
|
||||
ZoneManager.setHotZone(zone);
|
||||
}
|
||||
|
||||
throwbackInfo(pc, "New hotzone: " + hotzoneInfo());
|
||||
HotzoneChangeMsg hcm = new HotzoneChangeMsg(zone.getObjectType().ordinal(), zone.getObjectUUID());
|
||||
WorldServer.setLastHZChange(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Use no arguments to see the current hotzone. Specify a macrozone name to change the hotzone, or \"random\" to change it randomly.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./hotzone [random | <macroZoneName>]";
|
||||
}
|
||||
|
||||
private static String hotzoneInfo() {
|
||||
final int hotzoneTimeLeft = FastMath.secondsUntilNextHour();
|
||||
final Zone hotzone = ZoneManager.getHotZone();
|
||||
String hotzoneInfo;
|
||||
|
||||
if (hotzone == null) {
|
||||
hotzoneInfo = "none";
|
||||
} else {
|
||||
int hr = hotzoneTimeLeft/3600;
|
||||
int rem = hotzoneTimeLeft%3600;
|
||||
int mn = rem/60;
|
||||
int sec = rem%60;
|
||||
hotzoneInfo = hotzone.getName() +
|
||||
" (" + (hr<10 ? "0" : "") + hr + ':' +
|
||||
(mn<10 ? "0" : "") + mn + ':' +
|
||||
(sec<10 ? "0" : "") + sec +
|
||||
" remaining)";
|
||||
}
|
||||
return hotzoneInfo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,514 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
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 java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
/**
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
public class InfoCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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+= "Mine Type: "+mine.getMineType().name;
|
||||
output+= newline;
|
||||
output+= "Expansion : " + mine.isExpansion();
|
||||
output+= newline;
|
||||
output+= "Production type: " +mine.getProduction().name();
|
||||
|
||||
output+= newline;
|
||||
output+= "Open Date: "+ ( mine.openDate).toString();
|
||||
|
||||
output+= newline;
|
||||
output+= "Open Date: "+ (mine.openDate).toString();
|
||||
}
|
||||
}
|
||||
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";
|
||||
|
||||
BuildingModelBase buildingModelBase = BuildingModelBase.getModelBase(targetBuilding.getMeshUUID());
|
||||
|
||||
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();
|
||||
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 = targetNPC.getMobBase();
|
||||
|
||||
if (mobBase != null)
|
||||
output += "RaceID: " + mobBase.getObjectUUID();
|
||||
else
|
||||
output += "RaceID: " + targetNPC.getLoadID();
|
||||
|
||||
output += newline;
|
||||
output += "Flags: " + targetNPC.getMobBase().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 += "Fidelity ID: " + targetNPC.getFidalityID();
|
||||
output += newline;
|
||||
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
||||
output += newline;
|
||||
output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
|
||||
|
||||
}
|
||||
|
||||
if (targetNPC.getRegion() != null){
|
||||
output += newline;
|
||||
output += "BuildingID : " + targetNPC.getRegion().parentBuildingID;
|
||||
output += "building level : " + targetNPC.getRegion().level;
|
||||
output += "building room : " + targetNPC.getRegion().room;
|
||||
}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;
|
||||
output += "NoAggro: " + mobBase.getNoAggro().toString();
|
||||
output += newline;
|
||||
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.getState().name();
|
||||
|
||||
output += newline;
|
||||
output += "Speed : " + targetMob.getSpeed();
|
||||
output += newline;
|
||||
output += "Fidelity ID: " + targetMob.getFidalityID();
|
||||
output += newline;
|
||||
output += "EquipSet: " + targetMob.getEquipmentSetID();
|
||||
output += newline;
|
||||
output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
|
||||
output += newline;
|
||||
output += "isMoving : " + targetMob.isMoving();
|
||||
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'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class JumpCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//test
|
||||
|
||||
if (words[0].equalsIgnoreCase("face")){
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
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]);
|
||||
|
||||
} 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;
|
||||
}
|
||||
|
||||
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 _getUsageString() {
|
||||
return "' /jump lat long'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.LootTable;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class MBDropCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.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;
|
||||
|
||||
}
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case "rune":
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
break;
|
||||
case "contract":
|
||||
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "glass":
|
||||
|
||||
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;
|
||||
|
||||
case "chance":
|
||||
float chance = (float)LootTable.dropCount/(float)LootTable.rollCount * 100;
|
||||
output = LootTable.dropCount + " out of " + LootTable.rollCount + " items Dropped. chance = " + chance + '%';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
this.sendUsage(pcSender);
|
||||
this.sendHelp(pcSender);
|
||||
return;
|
||||
}
|
||||
|
||||
this.throwbackInfo(pcSender, output);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /mbdrop all/resource/rune/contract/glass/chance/clear";
|
||||
}
|
||||
|
||||
@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)";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.ProtectionState;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class MakeBaneCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 (!(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;
|
||||
}
|
||||
}
|
||||
|
||||
if (rank < 1 || rank > 8) {
|
||||
throwbackError(pc, "Rank must be 1 through 8");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
|
||||
|
||||
|
||||
|
||||
|
||||
if (player.getGuild().isErrant()) {
|
||||
throwbackError(pc, "Errant's can not place banes");
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
|
||||
|
||||
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 (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;
|
||||
// }
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.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;
|
||||
}
|
||||
|
||||
Blueprint blueprint = Blueprint.getBlueprint(24300);
|
||||
|
||||
if (blueprint == null) {
|
||||
throwbackError(pc, "Unable to find building set for banestone.");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3f rot = new Vector3f(0, 0, 0);
|
||||
|
||||
// *** Refactor : Overlap test goes here
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
//Make the bane
|
||||
|
||||
Bane bane = Bane.makeBane(player, city, stone);
|
||||
|
||||
if (bane == null) {
|
||||
|
||||
//delete bane stone, failed to make bane object
|
||||
DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
|
||||
|
||||
throwbackError(pc, "Failed to create bane.");
|
||||
return;
|
||||
}
|
||||
|
||||
WorldGrid.addObject(stone, pc);
|
||||
|
||||
//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);
|
||||
|
||||
throwbackInfo(pc, "The city has been succesfully baned.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Creates an bane.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./makebane playerUUID baneRank'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.ItemContainerType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.Enum.OwnerType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class MakeItemCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//add item to inventory
|
||||
pc.getCharItemManager().addItemToInventory(item);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (words.length < 3 || words.length > 5) {
|
||||
this.sendUsage(pc);
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 (itembaseID == 7) {
|
||||
this.throwbackInfo(pc, "use /addgold to add gold.");
|
||||
return;
|
||||
}
|
||||
|
||||
String prefix = "";
|
||||
String suffix = "";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(words[2].equals("0"))) {
|
||||
suffix = words[2];
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
if ((numItems > 1)
|
||||
&& (ib.getType().equals(ItemType.RESOURCE) == false)
|
||||
&& (ib.getType().equals(ItemType.OFFERING)) == false)
|
||||
numItems = 1;
|
||||
|
||||
CharacterItemManager cim = pc.getCharItemManager();
|
||||
if (cim == null) {
|
||||
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
|
||||
return;
|
||||
}
|
||||
|
||||
byte charges = (byte) ib.getNumCharges();
|
||||
short dur = (short) ib.getDurability();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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() {
|
||||
return "'./makeitem itembaseID PrefixID SuffixID [quantity] [numResources]'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* Summary: Devcmd to toggle logging of application protocol messages
|
||||
*
|
||||
*/
|
||||
|
||||
public class NetDebugCmd extends AbstractDevCmd {
|
||||
|
||||
// Instance variables
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
||||
int stringIndex;
|
||||
String commandSet = "onoff";
|
||||
|
||||
// incorrect number of arguments test
|
||||
|
||||
if (userInput.length != 1)
|
||||
return false;
|
||||
|
||||
// Validate arguments
|
||||
|
||||
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
|
||||
|
||||
return stringIndex != -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PrintBankCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintBankCmd() {
|
||||
super("printbank");
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Returns the player's current bank";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /printbank'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.*;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
|
||||
public class PrintBonusesCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintBonusesCmd() {
|
||||
super("printbonuses");
|
||||
// super("printbonuses", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
//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 (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 _getUsageString() {
|
||||
return "' /printbonuses'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PrintEquipCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintEquipCmd() {
|
||||
super("printequip");
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
//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.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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Returns the player's current equipment";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /printequip'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.ItemType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PrintInventoryCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintInventoryCmd() {
|
||||
super("printinventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
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");
|
||||
|
||||
if (target instanceof AbstractCharacter) {
|
||||
AbstractCharacter tar = (AbstractCharacter)target;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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() + ')');
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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 _getUsageString() {
|
||||
return "' /printinventory'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Regions;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class PrintLocationCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintLocationCmd() {
|
||||
super("printloc");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
PlayerCharacter tar;
|
||||
|
||||
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.getRegion() != null) {
|
||||
this.throwbackInfo(pc, "Player Region Slope Position : " + Regions.SlopeLerpPercent(pc, pc.getRegion()));
|
||||
this.throwbackInfo(pc, "Region Slope Magnitude : " + Regions.GetMagnitudeOfRegionSlope(pc.getRegion()));
|
||||
this.throwbackInfo(pc, "Player Region Slope Magnitude : " + Regions.GetMagnitudeOfPlayerOnRegionSlope(pc.getRegion(), pc));
|
||||
}else{
|
||||
this.throwbackInfo(pc, "No Region Found for player.");
|
||||
}
|
||||
|
||||
} else {
|
||||
throwbackInfo(pc, "Server location for " + tar.getFirstName()
|
||||
+ " not found");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Returns the player's current location according to the server";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /printloc'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.CharacterPower;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.PowersBase;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PrintPowersCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintPowersCmd() {
|
||||
super("printpowers");
|
||||
// super("printpowers", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
PlayerCharacter tar;
|
||||
|
||||
if (target != null && target instanceof PlayerCharacter)
|
||||
tar = (PlayerCharacter) target;
|
||||
else
|
||||
tar = pc;
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Returns the player's current granted powers";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /printpowers'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
public class PrintResistsCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintResistsCmd() {
|
||||
super("printresists");
|
||||
// super("printresists", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
AbstractCharacter tar;
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
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 _getUsageString() {
|
||||
return "' /printresists'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PrintSkillsCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintSkillsCmd() {
|
||||
super("printskills");
|
||||
// super("printskills", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
AbstractCharacter tar = null;
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Returns the player's current skills";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /printskills'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
public class PrintStatsCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintStatsCmd() {
|
||||
super("printstats");
|
||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
AbstractCharacter tar;
|
||||
|
||||
if (target != null && target instanceof AbstractCharacter) {
|
||||
tar = (AbstractCharacter) target;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
throwbackInfo(pc, out);
|
||||
}
|
||||
|
||||
public void printStatsNPC(PlayerCharacter pc, NPC tar) {
|
||||
Contract contract = tar.getContract();
|
||||
if (contract == null)
|
||||
return;
|
||||
|
||||
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;
|
||||
|
||||
throwbackInfo(pc, out);
|
||||
}
|
||||
|
||||
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'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PrintVaultCmd extends AbstractDevCmd {
|
||||
|
||||
public PrintVaultCmd() {
|
||||
super("printvault");
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Returns the player's current vault";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /printvault'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author
|
||||
* Dev command to move mobile and it's spawn location
|
||||
* to the player's current location
|
||||
*/
|
||||
public class PullCmd extends AbstractDevCmd {
|
||||
|
||||
public PullCmd() {
|
||||
super("pull");
|
||||
}
|
||||
|
||||
@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() {
|
||||
return "Moves mobile (and spawn) to player's location";
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.BuildingGroup;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.HashSet;
|
||||
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
|
||||
*/
|
||||
|
||||
public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
|
||||
// Instance variables
|
||||
|
||||
private Vector3fImmutable _currentLocation;
|
||||
private float _targetRange;
|
||||
private int _targetMask;
|
||||
|
||||
// Concurrency support
|
||||
|
||||
private ReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
|
||||
// Constructor
|
||||
|
||||
public PurgeObjectsCmd() {
|
||||
super("purge");
|
||||
}
|
||||
|
||||
private static void PurgeWalls(Zone zone, PlayerCharacter pc){
|
||||
|
||||
if (!zone.isPlayerCity())
|
||||
return;
|
||||
|
||||
for (Building building: zone.zoneBuildingSet){
|
||||
if (!BuildingManager.IsWallPiece(building))
|
||||
continue;
|
||||
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(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(GameObjectType.Mob,
|
||||
mobA.getObjectUUID());
|
||||
WorldGrid.RemoveWorldObject(mobA);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
|
||||
DbManager.removeFromCache(building);
|
||||
WorldGrid.RemoveWorldObject(building);
|
||||
WorldGrid.removeObject(building, pc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@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() {
|
||||
return "/purge [npc|mob|mesh|all] [range <= 200]";
|
||||
}
|
||||
|
||||
// Class methods
|
||||
|
||||
private static boolean validateUserInput(String[] userInput) {
|
||||
|
||||
int stringIndex;
|
||||
String commandSet = "npcmobmeshall";
|
||||
|
||||
// incorrect number of arguments test
|
||||
|
||||
if (userInput.length != 2)
|
||||
return false;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Realm;
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class RealmInfoCmd extends AbstractDevCmd {
|
||||
|
||||
public RealmInfoCmd() {
|
||||
super("realminfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
Zone serverZone;
|
||||
Zone parentZone;
|
||||
Realm serverRealm;
|
||||
int realmID;
|
||||
String outString = "";
|
||||
|
||||
if (pc == null) {
|
||||
throwbackError(pc, "Unable to find the pc making the request.");
|
||||
return;
|
||||
}
|
||||
|
||||
serverZone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
if (serverZone == null) {
|
||||
throwbackError(pc, "Zone not found");
|
||||
return;
|
||||
}
|
||||
|
||||
parentZone = serverZone.getParent();
|
||||
|
||||
realmID = RealmMap.getRealmIDAtLocation(pc.getLoc());
|
||||
|
||||
String newline = "\r\n ";
|
||||
|
||||
outString = newline;
|
||||
outString += "RealmID: " + realmID;
|
||||
|
||||
serverRealm = Realm.getRealm(realmID);
|
||||
|
||||
if (serverRealm == null)
|
||||
outString += " Name: SeaFloor";
|
||||
else
|
||||
outString += serverRealm.getRealmName();
|
||||
|
||||
outString += newline;
|
||||
|
||||
outString += " Zone: " + serverZone.getName();
|
||||
|
||||
outString += newline;
|
||||
|
||||
if (serverZone.getParent() != null)
|
||||
outString += " Parent: " + serverZone.getParent().getName();
|
||||
else
|
||||
outString += "Parent: NONE";
|
||||
|
||||
outString += newline;
|
||||
|
||||
throwbackInfo(pc, outString);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Returns info on realm.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /info targetID'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* Summary: Devcmd to reboot server
|
||||
*
|
||||
*/
|
||||
|
||||
public class RebootCmd extends AbstractDevCmd {
|
||||
|
||||
// Instance variables
|
||||
|
||||
public RebootCmd() {
|
||||
super("reboot");
|
||||
}
|
||||
|
||||
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Reboot server";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "./reboot";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class RegionCmd extends AbstractDevCmd {
|
||||
|
||||
public RegionCmd() {
|
||||
super("region");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
|
||||
if (pc.getRegion() == null){
|
||||
this.throwbackInfo(pc, "No Region Found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String newLine = System.getProperty("line.separator");
|
||||
String result = "";
|
||||
result+=(pc.getRegion().getClass().getSimpleName());
|
||||
result+=( " {" );
|
||||
result+=(newLine);
|
||||
Field[] fields = pc.getRegion().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.getRegion()).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";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.SiegeResult;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.*;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class RemoveBaneCmd extends AbstractDevCmd {
|
||||
|
||||
public RemoveBaneCmd() {
|
||||
super("removebane");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.endBane(SiegeResult.DEFEND);
|
||||
|
||||
throwbackInfo(pc, "The bane has been removed.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Removes a bane from the city grid you're standing on.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./removebane'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.BuildingGroup;
|
||||
import engine.Enum.DbObjectType;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
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");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words, AbstractGameObject target) {
|
||||
|
||||
int targetID;
|
||||
DbObjectType targetObjType;
|
||||
Building targetBuilding;
|
||||
NPC targetNPC;
|
||||
Mob targetMob;
|
||||
|
||||
if (target == null && words.length != 1) {
|
||||
this.sendUsage(player);
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete the targeted building
|
||||
|
||||
if (target != null) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Attempt to delete object based upon parsed UUID from input
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Determine object type of given UUID
|
||||
|
||||
targetObjType = DbManager.BuildingQueries.GET_UID_ENUM(targetID);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Removes targeted or specified object";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /remove [objectID]' || ' /delete [objectID]'";
|
||||
}
|
||||
|
||||
private void removeBuilding(PlayerCharacter pc, Building building) {
|
||||
|
||||
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
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.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);
|
||||
|
||||
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(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);
|
||||
WorldGrid.RemoveWorldObject(building);
|
||||
WorldGrid.removeObject(building, pc);
|
||||
|
||||
ChatManager.chatSayInfo(pc,
|
||||
"Building with ID " + building.getObjectUUID() + " removed");
|
||||
this.setResult(String.valueOf(building.getObjectUUID()));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
private void removeMob(PlayerCharacter pc, Mob mob) {
|
||||
|
||||
Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
|
||||
ChatManager.chatSayInfo(pc,
|
||||
"Mob with ID " + mob.getDBID() + " removed");
|
||||
this.setResult(String.valueOf(mob.getDBID()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class RenameCmd extends AbstractDevCmd {
|
||||
|
||||
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);
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /rename npcName'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Renames an NPC.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.MobBase;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class RenameMobCmd extends AbstractDevCmd {
|
||||
|
||||
public RenameMobCmd() {
|
||||
super("renamemob");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
if (args.length < 1) {
|
||||
this.sendUsage(pcSender);
|
||||
return;
|
||||
}
|
||||
int loadID = 0;
|
||||
String name = "";
|
||||
NPC npc;
|
||||
if (target != null && target instanceof NPC)
|
||||
npc = (NPC) target;
|
||||
else
|
||||
npc = getTargetAsNPC(pcSender);
|
||||
if (npc != null) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
name += args[i];
|
||||
if (i + 1 < args.length)
|
||||
name += " ";
|
||||
}
|
||||
npc.setName(name);
|
||||
npc.updateDatabase();
|
||||
ChatManager.chatSayInfo(
|
||||
pcSender,
|
||||
"NPC with ID " + npc.getObjectUUID() + " renamed to "
|
||||
+ npc.getFirstName());
|
||||
} else {
|
||||
try {
|
||||
loadID = Integer.parseInt(args[0]);
|
||||
if (args.length > 1) {
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
name += args[i];
|
||||
if (i + 1 < args.length)
|
||||
name += " ";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throwbackError(pcSender,
|
||||
"Invalid renameMob Command. Need mob ID specified.");
|
||||
return; // NaN
|
||||
}
|
||||
MobBase mob = MobBase.getMobBase(loadID);
|
||||
if (mob == null) {
|
||||
throwbackError(pcSender,
|
||||
"Invalid renameMob Command. Mob ID specified is not valid.");
|
||||
return;
|
||||
}
|
||||
if (!MobBase.renameMobBase(mob.getObjectUUID(), name)) {
|
||||
throwbackError(pcSender,
|
||||
"renameMob SQL Error. Failed to rename mob.");
|
||||
return;
|
||||
}
|
||||
mob = MobBase.getMobBase(mob.getObjectUUID(), true); // force refresh
|
||||
// from db
|
||||
ChatManager.chatSayInfo(
|
||||
pcSender,
|
||||
"MobBase with ID " + mob.getObjectUUID() + " renamed to "
|
||||
+ mob.getFirstName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /renamemob [ID] newName'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Changes a mobs old name to a new name";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class ResetLevelCmd extends AbstractDevCmd {
|
||||
|
||||
public ResetLevelCmd() {
|
||||
super("resetlevel");
|
||||
}
|
||||
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@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() {
|
||||
|
||||
|
||||
return "/resetlevel <level>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
|
||||
public class RotateCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
if (words.length == 3){
|
||||
try{
|
||||
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float rot;
|
||||
if (target != null && words.length == 1) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
int id = 0;
|
||||
if (words.length == 2) {
|
||||
try {
|
||||
id = Integer.parseInt(words[0]);
|
||||
|
||||
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 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
|
||||
}
|
||||
}
|
||||
|
||||
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 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.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Rotates targeted or specified object";
|
||||
}
|
||||
|
||||
@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 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 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);
|
||||
|
||||
float rotangle = faceDirection.getRotation();
|
||||
|
||||
float rot = (float) Math.toDegrees(rotangle);
|
||||
|
||||
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");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
/**
|
||||
* @author Steve
|
||||
*
|
||||
*/
|
||||
public class SetAICmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
|
||||
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]);
|
||||
|
||||
MBServerStatics.AI_MAX_ANGLE = angle;
|
||||
break;
|
||||
case "aggrorange":
|
||||
MBServerStatics.AI_BASE_AGGRO_RANGE = amount;
|
||||
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
|
||||
this.throwbackInfo(pc, "Aggro Range is now set to " + amount);
|
||||
break;
|
||||
case "dropaggrorange":
|
||||
MBServerStatics.AI_DROP_AGGRO_RANGE = amount;
|
||||
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
|
||||
this.throwbackInfo(pc, "Drop Aggro Range is now set to " + amount);
|
||||
break;
|
||||
case "patroldivisor":
|
||||
MBServerStatics.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;
|
||||
}
|
||||
MBServerStatics.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;
|
||||
}
|
||||
MBServerStatics.AI_THREAD_SLEEP = amount;
|
||||
this.throwbackInfo(pc, "Thread Sleep is now set to " + amount);
|
||||
break;
|
||||
case "recallrange":
|
||||
MBServerStatics.AI_RECALL_RANGE = amount;
|
||||
DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
|
||||
this.throwbackInfo(pc, "Recall Range is now set to " + amount);
|
||||
break;
|
||||
case "powerdivisor":
|
||||
MBServerStatics.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 " + MBServerStatics.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 " + MBServerStatics.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/" + MBServerStatics.AI_PATROL_DIVISOR;
|
||||
help += "\n PULSE: sets how often to run mob's AI. Measured in MS. Pulse is currently " + MBServerStatics.AI_PULSE_MOB_THRESHOLD + "ms.";
|
||||
help += "\n SLEEPTHREAD: Sets how long to sleep the AI for ALL mobs.Thread sleep is currently " + MBServerStatics.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 " + MBServerStatics.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 " + MBServerStatics.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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class SetActivateMineCmd extends AbstractDevCmd {
|
||||
|
||||
public SetActivateMineCmd() {
|
||||
super("mineactive");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
Building mineBuilding = BuildingManager.getBuilding(target.getObjectUUID());
|
||||
if (mineBuilding == null)
|
||||
return;
|
||||
|
||||
Mine mine = Mine.getMineFromTower(mineBuilding.getObjectUUID());
|
||||
if (mine == null)
|
||||
return;
|
||||
|
||||
String trigger = args[0];
|
||||
switch (trigger){
|
||||
case "true":
|
||||
mine.handleStartMineWindow();
|
||||
Mine.setLastChange(System.currentTimeMillis());
|
||||
break;
|
||||
case "false":
|
||||
mine.handleEndMineWindow();
|
||||
Mine.setLastChange(System.currentTimeMillis());
|
||||
break;
|
||||
default:
|
||||
this.sendUsage(pcSender);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /mineactive true|false";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Temporarily add visual effects to Character";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.CharacterRune;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class SetAdminRuneCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setrune runeID [true/false]'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Grant or remove the rune with the specified runeID";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.*;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class SetBaneActiveCmd extends AbstractDevCmd {
|
||||
|
||||
public SetBaneActiveCmd() {
|
||||
super("setbaneactive");
|
||||
}
|
||||
|
||||
@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;
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.getCity().protectionEnforced = !setActive;
|
||||
|
||||
if (setActive)
|
||||
throwbackInfo(pc, "The bane has been set active.");
|
||||
else
|
||||
throwbackInfo(pc, "The bane has been set inactive.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets a bane active or deactivates a bane.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./setbaneactive true|false'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetBaseClassCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 _getUsageString() {
|
||||
return "' /setBaseClass id'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetBuildingAltitudeCmd extends AbstractDevCmd {
|
||||
|
||||
public SetBuildingAltitudeCmd() {
|
||||
super("setbuildingaltitude");
|
||||
this.addCmdString("buildingaltitude");
|
||||
}
|
||||
|
||||
private static boolean UpdateBuildingAltitude(Building building, float altitude) {
|
||||
|
||||
if (!DbManager.BuildingQueries.UPDATE_BUILDING_ALTITUDE(building.getObjectUUID(), altitude))
|
||||
return false;
|
||||
|
||||
building.statAlt = altitude;
|
||||
|
||||
if (building.parentZone != null) {
|
||||
if (building.parentBuildingID != 0) {
|
||||
Building parentBuilding = BuildingManager.getBuilding(building.parentBuildingID);
|
||||
if (parentBuilding != null) {
|
||||
building.setLoc(new Vector3fImmutable(building.statLat + building.parentZone.absX + parentBuilding.statLat, building.statAlt + building.parentZone.absY + parentBuilding.statAlt, building.statLon + building.parentZone.absZ + parentBuilding.statLon));
|
||||
} else {
|
||||
building.setLoc(new Vector3fImmutable(building.statLat + building.parentZone.absX, building.statAlt + building.parentZone.absY, building.statLon + building.parentZone.absZ));
|
||||
|
||||
}
|
||||
} else
|
||||
building.setLoc(new Vector3fImmutable(building.statLat + building.parentZone.absX, building.statAlt + building.parentZone.absY, building.statLon + building.parentZone.absZ));
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@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.Building){
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
Building targetBuilding = (Building)target;
|
||||
|
||||
|
||||
float altitude = 0;
|
||||
try {
|
||||
altitude = Float.parseFloat(words[0]);
|
||||
|
||||
if (!UpdateBuildingAltitude(targetBuilding, targetBuilding.getStatAlt() + altitude)){
|
||||
this.throwbackError(pc, "Failed to update building altitude");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WorldGrid.updateObject(targetBuilding);
|
||||
|
||||
this.setTarget(pc); //for logging
|
||||
|
||||
// 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]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets slot position for an NPC to 'slot'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /changeslot slot'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
|
||||
|
||||
public class SetForceRenameCityCmd extends AbstractDevCmd {
|
||||
|
||||
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 String _getHelpString() {
|
||||
return "Temporarily Changes SubRace";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /subrace mobBaseID";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author
|
||||
* Dev command to set the guild of targeted npc.
|
||||
* Argument is a valid guild UID
|
||||
*/
|
||||
public class SetGuildCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
public SetGuildCmd() {
|
||||
super("setguild");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
NPC targetNPC;
|
||||
Guild targetGuild;
|
||||
|
||||
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() {
|
||||
return "' /setguild [UID]";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Assigns NPC to a given guild";
|
||||
}
|
||||
|
||||
private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
|
||||
|
||||
Guild tempGuild;
|
||||
|
||||
// Incorrect number of arguments
|
||||
|
||||
if (userInput.length != 1)
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
public class SetHealthCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
} 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 _getUsageString() {
|
||||
return "' /setHealth amount'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.ProtectionState;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetInvulCmd extends AbstractDevCmd {
|
||||
|
||||
public SetInvulCmd() {
|
||||
super("setinvul");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (pcSender == null) 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;
|
||||
}
|
||||
|
||||
if (target == null || !(target instanceof Building)) {
|
||||
throwbackError(pcSender, "No building targeted");
|
||||
return;
|
||||
}
|
||||
|
||||
Building b = (Building) target;
|
||||
|
||||
// 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))) {
|
||||
|
||||
City city;
|
||||
|
||||
city = b.getCity();
|
||||
city.protectionEnforced = !city.protectionEnforced;
|
||||
throwbackInfo(pcSender, "City protection contracts enforced: " + city.protectionEnforced);
|
||||
return;
|
||||
}
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./setInvul true|false'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Turns invulernability on or off for building";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetLevelCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@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'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.MaintenanceManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class SetMaintCmd extends AbstractDevCmd {
|
||||
|
||||
public SetMaintCmd() {
|
||||
super("setMaint");
|
||||
this.addCmdString("setmaint");
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
Building targetBuilding = (Building)target;
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@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'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
public class SetManaCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
} 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 _getUsageString() {
|
||||
return "' /setMana amount'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class SetMineExpansion extends AbstractDevCmd {
|
||||
|
||||
public SetMineExpansion() {
|
||||
super("setexpansion");
|
||||
this.addCmdString("setexpansion");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
|
||||
if (target.getObjectType() != GameObjectType.Building)
|
||||
return;
|
||||
Building mineBuilding = BuildingManager.getBuilding(target.getObjectUUID());
|
||||
if (mineBuilding == null)
|
||||
return;
|
||||
Mine mine = Mine.getMineFromTower(mineBuilding.getObjectUUID());
|
||||
if (mine == null)
|
||||
return;
|
||||
int bit = 2;
|
||||
switch (args[0].toUpperCase()) {
|
||||
case "ON":
|
||||
|
||||
bit |= mine.getFlags();
|
||||
if (!DbManager.MineQueries.SET_FLAGS(mine, bit))
|
||||
return;
|
||||
mine.setFlags(bit);
|
||||
ChatManager.chatSystemInfo(pcSender, mine.getZoneName() + "'s " + mine.getMineType().name + " is now an expansion mine.");
|
||||
Mine.setLastChange(System.currentTimeMillis());
|
||||
break;
|
||||
|
||||
case "OFF":
|
||||
bit &= ~mine.getFlags();
|
||||
if (!DbManager.MineQueries.SET_FLAGS(mine, bit))
|
||||
return;
|
||||
mine.setFlags(bit);
|
||||
ChatManager.chatSystemInfo(pcSender, mine.getZoneName() + "'s " + mine.getMineType().name + " is no longer an expansion mine.");
|
||||
Mine.setLastChange(System.currentTimeMillis());
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setmineexpansion on|off";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "enables or disables an expansion type for a mine.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class SetMineTypeCmd extends AbstractDevCmd {
|
||||
|
||||
public SetMineTypeCmd() {
|
||||
super("setminetype");
|
||||
this.addCmdString("setminetype");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
MineProduction mineType = MineProduction.valueOf(args[0].toUpperCase());
|
||||
if (mineType == null)
|
||||
return;
|
||||
|
||||
if (target.getObjectType() != GameObjectType.Building)
|
||||
return;
|
||||
Building mineBuilding = BuildingManager.getBuilding(target.getObjectUUID());
|
||||
if (mineBuilding == null)
|
||||
return;
|
||||
Mine mine = Mine.getMineFromTower(mineBuilding.getObjectUUID());
|
||||
if (mine == null)
|
||||
return;
|
||||
if (!DbManager.MineQueries.CHANGE_TYPE(mine, mineType))
|
||||
return;
|
||||
mine.setMineType(mineType.name());
|
||||
ChatManager.chatSystemInfo(pcSender, "The mine in " + mine.getZoneName() + " is now a(n) " + mine.getMineType().name);
|
||||
Mine.setLastChange(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setminetype gold|ore|magic|lumber";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Changes the mine type of the current mine.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetNPCSlotCmd extends AbstractDevCmd {
|
||||
|
||||
public SetNPCSlotCmd() {
|
||||
super("updateNPCSlot");
|
||||
this.addCmdString("changeslot");
|
||||
}
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
int slot = 0;
|
||||
try {
|
||||
slot = Integer.parseInt(words[0]);
|
||||
|
||||
if (!NPC.UpdateSlot(npc, slot)){
|
||||
this.throwbackError(pc, "Failed to Update Slot");
|
||||
return;
|
||||
}
|
||||
|
||||
npc.setParentZone(npc.getParentZone());
|
||||
WorldGrid.updateObject(npc);
|
||||
|
||||
this.setTarget(pc); //for logging
|
||||
|
||||
// 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]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets slot position for an NPC to 'slot'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /changeslot slot'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.MobBase;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetNpcEquipSetCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (target.getObjectType() != GameObjectType.NPC){
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
NPC npc = (NPC)target;
|
||||
|
||||
if (words[0].equalsIgnoreCase("next")){
|
||||
|
||||
if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
|
||||
SetNpcEquipSetCmd.lastEquipSetID = 1;
|
||||
else
|
||||
SetNpcEquipSetCmd.lastEquipSetID++;
|
||||
|
||||
boolean complete = false;
|
||||
|
||||
while (complete == false){
|
||||
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (words[0].equalsIgnoreCase("last")){
|
||||
|
||||
if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
|
||||
SetNpcEquipSetCmd.lastEquipSetID = 1222;
|
||||
else
|
||||
SetNpcEquipSetCmd.lastEquipSetID--;
|
||||
|
||||
boolean complete = false;
|
||||
|
||||
while (complete == false){
|
||||
complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int equipSetID = 0;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
SetNpcEquipSetCmd.lastEquipSetID = equipSetID;
|
||||
npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
|
||||
WorldGrid.updateObject(npc);
|
||||
|
||||
this.throwbackInfo(pc, "Equipment Set Changed to " + equipSetID );
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets slot position for an NPC to 'slot'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /changeslot slot'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.MobBase;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetNpcMobbaseCmd extends AbstractDevCmd {
|
||||
|
||||
public SetNpcMobbaseCmd() {
|
||||
super("setmobbase");
|
||||
this.addCmdString("npcmobbase");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
// 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);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets mobbase override for an NPC";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setmobbase mobBaseID'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetNpcNameCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (target.getObjectType() != GameObjectType.NPC){
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
NPC npc = (NPC)target;
|
||||
|
||||
String name = words[0];
|
||||
|
||||
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'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.DbObjectType;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
|
||||
public SetOwnerCmd() {
|
||||
super("setowner");
|
||||
}
|
||||
|
||||
@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)) {
|
||||
|
||||
City city = _targetBuilding.getCity();
|
||||
|
||||
if (city != null) {
|
||||
city.claim(outOwner);
|
||||
return; }
|
||||
}
|
||||
_targetBuilding.setOwner(outOwner);
|
||||
|
||||
DbManager.BuildingQueries.SET_PROPERTY(_targetBuilding, "ownerUUID", args[0]);
|
||||
|
||||
_targetBuilding.refreshGuild();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setowner [UID]";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Assigns new owner to building";
|
||||
}
|
||||
|
||||
private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
|
||||
|
||||
// Incorrect number of arguments
|
||||
|
||||
if (userInput.length != 1)
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ApplyRuneMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.PromotionClass;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
public class SetPromotionClassCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets your character's PromotionClass to 'ID'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setPromotionClass id'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.*;
|
||||
|
||||
public class SetRankCmd extends AbstractDevCmd {
|
||||
|
||||
public SetRankCmd() {
|
||||
super("setRank");
|
||||
this.addCmdString("setrank");
|
||||
this.addCmdString("rank");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
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 (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 (targetRank > blueprint.getMaxRank()) {
|
||||
throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}else{
|
||||
Building targetBuilding = null;
|
||||
if (uuid != 0)
|
||||
targetBuilding = BuildingManager.getBuilding(uuid);
|
||||
|
||||
if (targetBuilding == null) {
|
||||
throwbackError(player, "Unable to find building.");
|
||||
return;
|
||||
}
|
||||
|
||||
Blueprint blueprint = targetBuilding.getBlueprint();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Set the current targetRank
|
||||
int lastMeshID = targetBuilding.getMeshUUID();
|
||||
targetBuilding.setRank(targetRank);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@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'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Murray
|
||||
*
|
||||
*/
|
||||
public class SetRateCmd extends AbstractDevCmd {
|
||||
|
||||
public SetRateCmd() {
|
||||
super("setrate");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] args, AbstractGameObject target) {
|
||||
|
||||
if (args.length != 2) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
float mod = 0f;
|
||||
|
||||
try {
|
||||
mod = Float.parseFloat(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc, "Supplied data failed to parse to Float.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (args[0].equals("exp")){
|
||||
|
||||
MBServerStatics.EXP_RATE_MOD = mod;
|
||||
throwbackInfo(pc, "Experience Rate set to: " + mod);
|
||||
|
||||
} else if (args[0].equals("gold")){
|
||||
|
||||
MBServerStatics.GOLD_RATE_MOD = mod;
|
||||
throwbackInfo(pc, "Gold Rate set to: " + mod);
|
||||
|
||||
} else if (args[0].equals("drop")){
|
||||
|
||||
MBServerStatics.DROP_RATE_MOD = mod;
|
||||
throwbackInfo(pc, "Drop Multiplier Rate set to: " + mod);
|
||||
|
||||
} else if (args[0].equals("hotexp")){
|
||||
|
||||
MBServerStatics.HOT_EXP_RATE_MOD = mod;
|
||||
throwbackInfo(pc, "HOTZONE Experience Rate set to: " + mod);
|
||||
|
||||
} else if (args[0].equals("hotgold")){
|
||||
|
||||
MBServerStatics.HOT_GOLD_RATE_MOD = mod;
|
||||
throwbackInfo(pc, "HOTZONE Gold Rate set to: " + mod);
|
||||
|
||||
} else if (args[0].equals("hotdrop")){
|
||||
|
||||
MBServerStatics.HOT_DROP_RATE_MOD = mod;
|
||||
throwbackInfo(pc, "HOTZONE Drop Multiplier Rate set to: " + mod);
|
||||
|
||||
} else if (args[0].equals("production")){
|
||||
|
||||
MBServerStatics.PRODUCTION_TIME_MULTIPLIER = mod;
|
||||
throwbackInfo(pc, "Production Time Multiplier Rate set to: " + mod);
|
||||
|
||||
} else {
|
||||
this.sendUsage(pc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setrate {exp|gold|drop|hotexp|hotgold|hotdrop} rate'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets the rates for exp, gold or drops. Accepts a float, defaults to 1.0";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.CharacterRune;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eighty
|
||||
*
|
||||
*/
|
||||
public class SetRuneCmd extends AbstractDevCmd {
|
||||
|
||||
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 String _getUsageString() {
|
||||
return "' /setrune runeID [true/false]'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Grant or remove the rune with the specified runeID";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
|
||||
public class SetStaminaCmd extends AbstractDevCmd {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
} 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 _getUsageString() {
|
||||
return "' /setStamina amount'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ApplyBuildingEffectMsg;
|
||||
import engine.net.client.msg.UpdateCharOrMobMessage;
|
||||
import engine.objects.*;
|
||||
|
||||
public class SetSubRaceCmd extends AbstractDevCmd {
|
||||
|
||||
public SetSubRaceCmd() {
|
||||
super("setSubRace");
|
||||
this.addCmdString("subrace");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
if (target instanceof AbstractCharacter){
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
|
||||
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Building building = (Building)target;
|
||||
|
||||
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()));
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
|
||||
|
||||
// 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);
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class ShowOffsetCmd extends AbstractDevCmd {
|
||||
|
||||
public ShowOffsetCmd() {
|
||||
super("showoffset");
|
||||
}
|
||||
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
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 String _getHelpString() {
|
||||
return "Shows offset to current building";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
|
||||
|
||||
return "Shows offset to current building";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.BuildingGroup;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Contract;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.util.StringUtils;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* Summary: Game designer utility command to add or
|
||||
* remove building slot access for contracts
|
||||
*/
|
||||
|
||||
public class SlotNpcCmd extends AbstractDevCmd {
|
||||
|
||||
public SlotNpcCmd() {
|
||||
super("slotnpc");
|
||||
}
|
||||
|
||||
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
Contract contractObject;
|
||||
BuildingGroup buildingGroup;
|
||||
|
||||
long slotBitvalue;
|
||||
String outString;
|
||||
|
||||
if (target.getObjectType() != GameObjectType.NPC) {
|
||||
throwbackInfo(pc, "NpcSlot: target must be an NPC");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the contract from the npc
|
||||
contractObject = getTargetAsNPC(pc).getContract();
|
||||
|
||||
// User requests list of current groups.
|
||||
|
||||
if (args[0].toUpperCase().equals("LIST")) {
|
||||
|
||||
outString = "Current: " + contractObject.getAllowedBuildings();
|
||||
|
||||
throwbackInfo(pc, outString);
|
||||
return;
|
||||
}
|
||||
|
||||
if(validateUserInput(args) == false) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract the building group flag from user input
|
||||
|
||||
buildingGroup = BuildingGroup.valueOf(args[0].toUpperCase());
|
||||
|
||||
switch (args[1].toUpperCase()) {
|
||||
|
||||
case "ON":
|
||||
contractObject.getAllowedBuildings().add(buildingGroup);
|
||||
|
||||
if (!DbManager.ContractQueries.updateAllowedBuildings(contractObject, contractObject.getAllowedBuildings().toLong())){
|
||||
Logger.error( "Failed to update Database for Contract Allowed buildings");
|
||||
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. " +
|
||||
"Contact A CCR, oh wait, you are a CCR. You're Fubared.");
|
||||
return;
|
||||
}
|
||||
|
||||
throwbackInfo(pc, "SlotNpc " + buildingGroup.name() + " added to npc");
|
||||
break;
|
||||
case "OFF":
|
||||
contractObject.getAllowedBuildings().remove(buildingGroup);
|
||||
if (!DbManager.ContractQueries.updateAllowedBuildings(contractObject, contractObject.getAllowedBuildings().toLong())){
|
||||
Logger.error( "Failed to update Database for Contract Allowed buildings");
|
||||
ChatManager.chatSystemError(pc, "Failed to update Database for Contract Allowed buildings. " +
|
||||
"Contact A CCR, oh wait, you are a CCR. You're Fubared.");
|
||||
return;
|
||||
}
|
||||
|
||||
throwbackInfo(pc, "SlotNpc " + buildingGroup.name() + " removed from npc");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets a building slot on a targeted npc";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
String usage = "/npcslot [BuildingType] on-off \n";
|
||||
|
||||
for (BuildingGroup group:BuildingGroup.values()) {
|
||||
usage += group.name() + ' ';
|
||||
}
|
||||
|
||||
usage = StringUtils.wordWrap(usage, 30);
|
||||
|
||||
return usage;
|
||||
}
|
||||
|
||||
// Class methods
|
||||
|
||||
private static boolean validateUserInput(String[] userInput) {
|
||||
|
||||
int stringIndex;
|
||||
BuildingGroup testGroup;
|
||||
|
||||
testGroup = BuildingGroup.FORGE;
|
||||
|
||||
String commandSet = "onoff";
|
||||
|
||||
// incorrect number of arguments test
|
||||
|
||||
if (userInput.length > 2)
|
||||
return false;
|
||||
|
||||
|
||||
// Test of toggle argument
|
||||
|
||||
stringIndex = commandSet.indexOf(userInput[1].toLowerCase());
|
||||
|
||||
if (stringIndex == -1)
|
||||
return false;
|
||||
|
||||
// Validate we have a corrent building group name
|
||||
|
||||
for (BuildingGroup group:BuildingGroup.values()) {
|
||||
if (group.name().equals(userInput[0].toUpperCase()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user