Project cleanup pre merge.
This commit is contained in:
@@ -1,17 +1,23 @@
|
|||||||

|

|
||||||
|
|
||||||
# Magicbane Open-Source MMO Project
|
# Magicbane Open-Source MMO Project
|
||||||
|
|
||||||
### *The Community written Shadowbane emulator*
|
### *The Community written Shadowbane emulator*
|
||||||
|
|
||||||
[Magicbane](http://www.magicbane.com)
|
[Magicbane](http://www.magicbane.com)
|
||||||
</BR>
|
</BR>
|
||||||
[Public Repository](http://repo.magicbane.com)
|
[Public Repository](http://repo.magicbane.com)
|
||||||
<BR>
|
<BR>
|
||||||
<magicbot@magicbane.com>
|
<magicbot@magicbane.com>
|
||||||
|
|
||||||
> Magicbane is an emulator for the long dead but much beloved Ubisoft MMO, [Shadowbane](https://en.wikipedia.org/wiki/Shadowbane).
|
> Magicbane is an emulator for the long dead but much beloved Ubisoft
|
||||||
The project was founded in 2013 with the concept of free availability of gameplay; players unencumbered by any factor other than a desire to again play a game they once loved. A game where the developers do not play is guaranteed to be the fairest game.
|
> MMO, [Shadowbane](https://en.wikipedia.org/wiki/Shadowbane).
|
||||||
|
> The project was founded in 2013 with the concept of free availability of gameplay; players unencumbered by any factor
|
||||||
|
> other than a desire to again play a game they once loved. A game where the developers do not play is guaranteed to be
|
||||||
|
> the fairest game.
|
||||||
|
|
||||||
The Magicbane Team has wanted to open source Shadowbane for half a decade. We are excited to now finally have the opportunity, along with some new technology, to truly democratize Shadowbane.
|
The Magicbane Team has wanted to open source Shadowbane for half a decade. We are excited to now finally have the
|
||||||
|
opportunity, along with some new technology, to truly democratize Shadowbane.
|
||||||
|
|
||||||
- Written in some 80k lines of Java 8 and bash.
|
- Written in some 80k lines of Java 8 and bash.
|
||||||
- Project with real infrastructure; Production and development servers supporting multiple containerized apps.
|
- Project with real infrastructure; Production and development servers supporting multiple containerized apps.
|
||||||
@@ -27,4 +33,5 @@ The Magicbane Team has wanted to open source Shadowbane for half a decade. We a
|
|||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Documentation is available through the Magicbane [Wiki](http://repo.magicbane.com/MagicBane/Server/wiki) and [Discord server](www.magicbane.com).
|
Documentation is available through the Magicbane [Wiki](http://repo.magicbane.com/MagicBane/Server/wiki)
|
||||||
|
and [Discord server](www.magicbane.com).
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord;
|
package discord;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -18,6 +19,7 @@ public class DiscordAccount {
|
|||||||
public LocalDateTime registrationDate;
|
public LocalDateTime registrationDate;
|
||||||
public LocalDateTime lastUpdateRequest;
|
public LocalDateTime lastUpdateRequest;
|
||||||
public byte isDiscordAdmin;
|
public byte isDiscordAdmin;
|
||||||
|
|
||||||
public DiscordAccount() {
|
public DiscordAccount() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+128
-127
@@ -59,10 +59,10 @@ import static discord.ChatChannel.ADMINLOG;
|
|||||||
*/
|
*/
|
||||||
public class MagicBot extends ListenerAdapter {
|
public class MagicBot extends ListenerAdapter {
|
||||||
|
|
||||||
public static JDA jda;
|
|
||||||
public static Database database;
|
|
||||||
public static final Pattern accountNameRegex = Pattern.compile("^[\\p{Alnum}]{6,20}$");
|
public static final Pattern accountNameRegex = Pattern.compile("^[\\p{Alnum}]{6,20}$");
|
||||||
public static final Pattern passwordRegex = Pattern.compile("^[\\p{Alnum}]{6,20}$");
|
public static final Pattern passwordRegex = Pattern.compile("^[\\p{Alnum}]{6,20}$");
|
||||||
|
public static JDA jda;
|
||||||
|
public static Database database;
|
||||||
public static long discordServerID;
|
public static long discordServerID;
|
||||||
public static long discordRoleID;
|
public static long discordRoleID;
|
||||||
|
|
||||||
@@ -132,6 +132,130 @@ public class MagicBot extends ListenerAdapter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendResponse(MessageReceivedEvent event, String responseContent) {
|
||||||
|
|
||||||
|
// Send a formatted MagicBot response to a Discord user
|
||||||
|
|
||||||
|
String discordUserName;
|
||||||
|
MessageChannel channel;
|
||||||
|
|
||||||
|
// Exit if discord is offline
|
||||||
|
|
||||||
|
if (jda.getStatus().equals(JDA.Status.CONNECTED) == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
discordUserName = event.getAuthor().getName();
|
||||||
|
channel = event.getMessage().getChannel();
|
||||||
|
|
||||||
|
channel.sendMessage(
|
||||||
|
"```\n" + "Hello Player " + discordUserName + "\n\n" +
|
||||||
|
responseContent + "\n\n" +
|
||||||
|
RobotSpeak.getRobotSpeak() + "\n```").queue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAdminEvent(MessageReceivedEvent event) {
|
||||||
|
|
||||||
|
String discordAccountID = event.getAuthor().getId();
|
||||||
|
List<DiscordAccount> discordAccounts;
|
||||||
|
DiscordAccount discordAccount;
|
||||||
|
|
||||||
|
// Note that database errors will cause this to return false.
|
||||||
|
// After the database is offline Avail status must be set
|
||||||
|
// to true before any subsequent admin commands will function.
|
||||||
|
|
||||||
|
if (Database.online == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
discordAccounts = database.getDiscordAccounts(discordAccountID);
|
||||||
|
|
||||||
|
if (discordAccounts.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
discordAccount = discordAccounts.get(0);
|
||||||
|
return (discordAccount.isDiscordAdmin == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String generatePassword(int length) {
|
||||||
|
|
||||||
|
String ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
StringBuilder passwordBuilder = new StringBuilder(length);
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
|
// Generate alphanumeric password of a given length.
|
||||||
|
// Could not find a good method of generating a password
|
||||||
|
// based upon a given regex.
|
||||||
|
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
passwordBuilder.append(ALPHABET.charAt(random.nextInt(ALPHABET.length())));
|
||||||
|
|
||||||
|
return new String(passwordBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String readLogFile(String filePath, int lineCount) {
|
||||||
|
|
||||||
|
ProcessBuilder builder = new ProcessBuilder("/bin/bash", "-c", "tail -n " + lineCount + " " + filePath);
|
||||||
|
builder.redirectErrorStream(true);
|
||||||
|
Process process = null;
|
||||||
|
String line = null;
|
||||||
|
String logOutput = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
process = builder.start();
|
||||||
|
|
||||||
|
InputStream is = process.getInputStream();
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
|
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
logOutput += line + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
Logger.error(e.toString());
|
||||||
|
return "Error while reading logfile";
|
||||||
|
}
|
||||||
|
|
||||||
|
return logOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void junkbot(String command, String[] inString) {
|
||||||
|
|
||||||
|
String outString;
|
||||||
|
Writer fileWriter;
|
||||||
|
|
||||||
|
if (inString == null)
|
||||||
|
return;
|
||||||
|
;
|
||||||
|
|
||||||
|
outString = command + String.join(" ", inString);
|
||||||
|
outString += "\n";
|
||||||
|
|
||||||
|
try {
|
||||||
|
fileWriter = new BufferedWriter(new FileWriter("junkbot.txt", true));
|
||||||
|
fileWriter.append(outString);
|
||||||
|
fileWriter.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SendAdminLogUpdates() {
|
||||||
|
HashMap<Integer, String> adminEvents = database.getAdminEvents();
|
||||||
|
|
||||||
|
for (int adminEvent : adminEvents.keySet()) {
|
||||||
|
|
||||||
|
// Set event as read
|
||||||
|
database.setAdminEventAsRead(adminEvent);
|
||||||
|
String outString =
|
||||||
|
"```\n" + "Hello Players \n\n" +
|
||||||
|
adminEvents.get(adminEvent) + "\n\n" +
|
||||||
|
RobotSpeak.getRobotSpeak() + "\n```";
|
||||||
|
|
||||||
|
if (ADMINLOG.textChannel.canTalk())
|
||||||
|
ADMINLOG.textChannel.sendMessage(outString).queue();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(MessageReceivedEvent event) {
|
public void onMessageReceived(MessageReceivedEvent event) {
|
||||||
|
|
||||||
@@ -142,7 +266,8 @@ public class MagicBot extends ListenerAdapter {
|
|||||||
|
|
||||||
// Early exit if message sent to us by another bot or ourselves.
|
// Early exit if message sent to us by another bot or ourselves.
|
||||||
|
|
||||||
if (event.getAuthor().isBot()) return;
|
if (event.getAuthor().isBot())
|
||||||
|
return;
|
||||||
|
|
||||||
// Extract message and origin channel from event
|
// Extract message and origin channel from event
|
||||||
|
|
||||||
@@ -247,49 +372,6 @@ public class MagicBot extends ListenerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendResponse(MessageReceivedEvent event, String responseContent) {
|
|
||||||
|
|
||||||
// Send a formatted MagicBot response to a Discord user
|
|
||||||
|
|
||||||
String discordUserName;
|
|
||||||
MessageChannel channel;
|
|
||||||
|
|
||||||
// Exit if discord is offline
|
|
||||||
|
|
||||||
if (jda.getStatus().equals(JDA.Status.CONNECTED) == false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
discordUserName = event.getAuthor().getName();
|
|
||||||
channel = event.getMessage().getChannel();
|
|
||||||
|
|
||||||
channel.sendMessage(
|
|
||||||
"```\n" + "Hello Player " + discordUserName + "\n\n" +
|
|
||||||
responseContent + "\n\n" +
|
|
||||||
RobotSpeak.getRobotSpeak() + "\n```").queue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isAdminEvent(MessageReceivedEvent event) {
|
|
||||||
|
|
||||||
String discordAccountID = event.getAuthor().getId();
|
|
||||||
List<DiscordAccount> discordAccounts;
|
|
||||||
DiscordAccount discordAccount;
|
|
||||||
|
|
||||||
// Note that database errors will cause this to return false.
|
|
||||||
// After the database is offline Avail status must be set
|
|
||||||
// to true before any subsequent admin commands will function.
|
|
||||||
|
|
||||||
if (Database.online == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
discordAccounts = database.getDiscordAccounts(discordAccountID);
|
|
||||||
|
|
||||||
if (discordAccounts.isEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
discordAccount = discordAccounts.get(0);
|
|
||||||
return (discordAccount.isDiscordAdmin == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handleHelpRequest(MessageReceivedEvent event) {
|
public void handleHelpRequest(MessageReceivedEvent event) {
|
||||||
|
|
||||||
// Help is kept here in the main class instead of a handler as a
|
// Help is kept here in the main class instead of a handler as a
|
||||||
@@ -322,85 +404,4 @@ public class MagicBot extends ListenerAdapter {
|
|||||||
"#trash <blank>/detail/flush";
|
"#trash <blank>/detail/flush";
|
||||||
sendResponse(event, helpString);
|
sendResponse(event, helpString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String generatePassword(int length) {
|
|
||||||
|
|
||||||
String ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
||||||
StringBuilder passwordBuilder = new StringBuilder(length);
|
|
||||||
Random random = new Random();
|
|
||||||
|
|
||||||
// Generate alphanumeric password of a given length.
|
|
||||||
// Could not find a good method of generating a password
|
|
||||||
// based upon a given regex.
|
|
||||||
|
|
||||||
for (int i = 0; i < length; i++)
|
|
||||||
passwordBuilder.append(ALPHABET.charAt(random.nextInt(ALPHABET.length())));
|
|
||||||
|
|
||||||
return new String(passwordBuilder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String readLogFile(String filePath, int lineCount) {
|
|
||||||
|
|
||||||
ProcessBuilder builder = new ProcessBuilder("/bin/bash", "-c", "tail -n " + lineCount + " " + filePath);
|
|
||||||
builder.redirectErrorStream(true);
|
|
||||||
Process process = null;
|
|
||||||
String line = null;
|
|
||||||
String logOutput = "";
|
|
||||||
|
|
||||||
try {
|
|
||||||
process = builder.start();
|
|
||||||
|
|
||||||
InputStream is = process.getInputStream();
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
logOutput += line + "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error(e.toString());
|
|
||||||
return "Error while reading logfile";
|
|
||||||
}
|
|
||||||
|
|
||||||
return logOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void junkbot(String command, String[] inString) {
|
|
||||||
|
|
||||||
String outString;
|
|
||||||
Writer fileWriter;
|
|
||||||
|
|
||||||
if (inString == null)
|
|
||||||
return;
|
|
||||||
;
|
|
||||||
|
|
||||||
outString = command + String.join(" ", inString);
|
|
||||||
outString += "\n";
|
|
||||||
|
|
||||||
try {
|
|
||||||
fileWriter = new BufferedWriter(new FileWriter("junkbot.txt", true));
|
|
||||||
fileWriter.append(outString);
|
|
||||||
fileWriter.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SendAdminLogUpdates() {
|
|
||||||
HashMap<Integer, String> adminEvents = database.getAdminEvents();
|
|
||||||
|
|
||||||
for (int adminEvent : adminEvents.keySet()) {
|
|
||||||
|
|
||||||
// Set event as read
|
|
||||||
database.setAdminEventAsRead(adminEvent);
|
|
||||||
String outString =
|
|
||||||
"```\n" + "Hello Players \n\n" +
|
|
||||||
adminEvents.get(adminEvent) + "\n\n" +
|
|
||||||
RobotSpeak.getRobotSpeak() + "\n```";
|
|
||||||
|
|
||||||
if (ADMINLOG.textChannel.canTalk())
|
|
||||||
ADMINLOG.textChannel.sendMessage(outString).queue();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ public class ChatChannelHandler {
|
|||||||
"```\n" + "Hello Players \n\n" +
|
"```\n" + "Hello Players \n\n" +
|
||||||
chatText.substring(3) + "\n\n" +
|
chatText.substring(3) + "\n\n" +
|
||||||
RobotSpeak.getRobotSpeak() + "\n```";
|
RobotSpeak.getRobotSpeak() + "\n```";
|
||||||
else outString = chatText;
|
else
|
||||||
|
outString = chatText;
|
||||||
|
|
||||||
// Write string to changelog channel
|
// Write string to changelog channel
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public class DevRequestHandler {
|
|||||||
"Use #dev lastout to view results");
|
"Use #dev lastout to view results");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getLastOutput() {
|
private static String getLastOutput() {
|
||||||
|
|
||||||
String outString = null;
|
String outString = null;
|
||||||
|
|||||||
@@ -206,88 +206,6 @@ public class HeightMap {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
|
||||||
|
|
||||||
if (zoneLoc.x < 0)
|
|
||||||
zoneLoc.setX(0);
|
|
||||||
|
|
||||||
if (zoneLoc.x > this.fullExtentsX - 1)
|
|
||||||
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
|
|
||||||
|
|
||||||
if (zoneLoc.y < 0)
|
|
||||||
zoneLoc.setY(0);
|
|
||||||
|
|
||||||
if (zoneLoc.y > this.fullExtentsY - 1)
|
|
||||||
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
|
|
||||||
|
|
||||||
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
|
||||||
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
|
||||||
|
|
||||||
return new Vector2f(xBucket, yBucket);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getInterpolatedTerrainHeight(Vector2f zoneLoc) {
|
|
||||||
|
|
||||||
Vector2f gridSquare;
|
|
||||||
|
|
||||||
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
|
||||||
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
|
||||||
|
|
||||||
//flip the Y so it grabs from the bottom left instead of top left.
|
|
||||||
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
|
||||||
|
|
||||||
gridSquare = getGridSquare(zoneLoc);
|
|
||||||
|
|
||||||
int gridX = (int) gridSquare.x;
|
|
||||||
int gridY = (int) (gridSquare.y);
|
|
||||||
|
|
||||||
if (gridX > maxX)
|
|
||||||
gridX = maxX;
|
|
||||||
if (gridY > maxY)
|
|
||||||
gridY = maxY;
|
|
||||||
|
|
||||||
float offsetX = (gridSquare.x - gridX);
|
|
||||||
float offsetY = gridSquare.y - gridY;
|
|
||||||
|
|
||||||
//get height of the 4 vertices.
|
|
||||||
|
|
||||||
float topLeftHeight = 0;
|
|
||||||
float topRightHeight = 0;
|
|
||||||
float bottomLeftHeight = 0;
|
|
||||||
float bottomRightHeight = 0;
|
|
||||||
|
|
||||||
int nextY = gridY +1;
|
|
||||||
int nextX = gridX + 1;
|
|
||||||
|
|
||||||
if (nextY > maxY)
|
|
||||||
nextY = gridY;
|
|
||||||
|
|
||||||
if (nextX > maxX)
|
|
||||||
nextX = gridX;
|
|
||||||
|
|
||||||
topLeftHeight = pixelColorValues[gridX][gridY];
|
|
||||||
topRightHeight = pixelColorValues[nextX][gridY];
|
|
||||||
bottomLeftHeight = pixelColorValues[gridX][nextY];
|
|
||||||
bottomRightHeight = pixelColorValues[nextX][nextY];
|
|
||||||
|
|
||||||
float interpolatedHeight;
|
|
||||||
|
|
||||||
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
|
||||||
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
|
||||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
|
||||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
|
||||||
|
|
||||||
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
|
||||||
|
|
||||||
return interpolatedHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Zone getNextZoneWithTerrain(Zone zone) {
|
public static Zone getNextZoneWithTerrain(Zone zone) {
|
||||||
|
|
||||||
Zone nextZone = zone;
|
Zone nextZone = zone;
|
||||||
@@ -505,48 +423,6 @@ public class HeightMap {
|
|||||||
return realWorldAltitude;
|
return realWorldAltitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
|
|
||||||
|
|
||||||
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
|
|
||||||
|
|
||||||
Vector2f gridSquare;
|
|
||||||
|
|
||||||
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
//flip the Y so it grabs from the bottom left instead of top left.
|
|
||||||
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
|
||||||
|
|
||||||
gridSquare = getGridSquare(zoneLoc);
|
|
||||||
|
|
||||||
int gridX = (int) gridSquare.x;
|
|
||||||
int gridY = (int) (gridSquare.y);
|
|
||||||
|
|
||||||
float offsetX = (gridSquare.x - gridX);
|
|
||||||
float offsetY = gridSquare.y - gridY;
|
|
||||||
|
|
||||||
//get height of the 4 vertices.
|
|
||||||
|
|
||||||
float topLeftHeight = pixelColorValues[gridX][gridY];
|
|
||||||
float topRightHeight = pixelColorValues[gridX + 1][gridY];
|
|
||||||
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
|
|
||||||
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
|
|
||||||
|
|
||||||
float interpolatedHeight;
|
|
||||||
|
|
||||||
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
|
||||||
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
|
||||||
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
|
||||||
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
|
||||||
|
|
||||||
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
|
||||||
|
|
||||||
return interpolatedHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) {
|
public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) {
|
||||||
|
|
||||||
Vector2f parentLoc;
|
Vector2f parentLoc;
|
||||||
@@ -620,24 +496,6 @@ public class HeightMap {
|
|||||||
return outsetALt;
|
return outsetALt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generatePixelData() {
|
|
||||||
|
|
||||||
Color color;
|
|
||||||
|
|
||||||
// Generate altitude lookup table for this heightmap
|
|
||||||
|
|
||||||
this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()];
|
|
||||||
|
|
||||||
for (int y = 0; y < this.heightmapImage.getHeight(); y++) {
|
|
||||||
for (int x = 0; x < this.heightmapImage.getWidth(); x++) {
|
|
||||||
|
|
||||||
color = new Color(this.heightmapImage.getRGB(x, y));
|
|
||||||
pixelColorValues[x][y] = color.getRed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vector2f getGridOffset(Vector2f gridSquare) {
|
public static Vector2f getGridOffset(Vector2f gridSquare) {
|
||||||
|
|
||||||
int floorX = (int) gridSquare.x;
|
int floorX = (int) gridSquare.x;
|
||||||
@@ -647,11 +505,6 @@ public class HeightMap {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getScaledHeightForColor(float color) {
|
|
||||||
|
|
||||||
return (color / 256) * this.maxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void loadAlHeightMaps() {
|
public static void loadAlHeightMaps() {
|
||||||
|
|
||||||
// Load the heightmaps into staging hashmap keyed by HashMapID
|
// Load the heightmaps into staging hashmap keyed by HashMapID
|
||||||
@@ -672,6 +525,164 @@ public class HeightMap {
|
|||||||
Logger.info(HeightMap.heightmapByLoadNum.size() + " Heightmaps cached.");
|
Logger.info(HeightMap.heightmapByLoadNum.size() + " Heightmaps cached.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
|
||||||
|
|
||||||
|
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
||||||
|
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
||||||
|
|
||||||
|
if (localAltitude < zone.getSeaLevel())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2f getGridSquare(Vector2f zoneLoc) {
|
||||||
|
|
||||||
|
if (zoneLoc.x < 0)
|
||||||
|
zoneLoc.setX(0);
|
||||||
|
|
||||||
|
if (zoneLoc.x > this.fullExtentsX - 1)
|
||||||
|
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
|
||||||
|
|
||||||
|
if (zoneLoc.y < 0)
|
||||||
|
zoneLoc.setY(0);
|
||||||
|
|
||||||
|
if (zoneLoc.y > this.fullExtentsY - 1)
|
||||||
|
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
|
||||||
|
|
||||||
|
float xBucket = (zoneLoc.x / this.bucketWidthX);
|
||||||
|
float yBucket = (zoneLoc.y / this.bucketWidthY);
|
||||||
|
|
||||||
|
return new Vector2f(xBucket, yBucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getInterpolatedTerrainHeight(Vector2f zoneLoc) {
|
||||||
|
|
||||||
|
Vector2f gridSquare;
|
||||||
|
|
||||||
|
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
|
||||||
|
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
|
||||||
|
|
||||||
|
//flip the Y so it grabs from the bottom left instead of top left.
|
||||||
|
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||||
|
|
||||||
|
gridSquare = getGridSquare(zoneLoc);
|
||||||
|
|
||||||
|
int gridX = (int) gridSquare.x;
|
||||||
|
int gridY = (int) (gridSquare.y);
|
||||||
|
|
||||||
|
if (gridX > maxX)
|
||||||
|
gridX = maxX;
|
||||||
|
if (gridY > maxY)
|
||||||
|
gridY = maxY;
|
||||||
|
|
||||||
|
float offsetX = (gridSquare.x - gridX);
|
||||||
|
float offsetY = gridSquare.y - gridY;
|
||||||
|
|
||||||
|
//get height of the 4 vertices.
|
||||||
|
|
||||||
|
float topLeftHeight = 0;
|
||||||
|
float topRightHeight = 0;
|
||||||
|
float bottomLeftHeight = 0;
|
||||||
|
float bottomRightHeight = 0;
|
||||||
|
|
||||||
|
int nextY = gridY + 1;
|
||||||
|
int nextX = gridX + 1;
|
||||||
|
|
||||||
|
if (nextY > maxY)
|
||||||
|
nextY = gridY;
|
||||||
|
|
||||||
|
if (nextX > maxX)
|
||||||
|
nextX = gridX;
|
||||||
|
|
||||||
|
topLeftHeight = pixelColorValues[gridX][gridY];
|
||||||
|
topRightHeight = pixelColorValues[nextX][gridY];
|
||||||
|
bottomLeftHeight = pixelColorValues[gridX][nextY];
|
||||||
|
bottomRightHeight = pixelColorValues[nextX][nextY];
|
||||||
|
|
||||||
|
float interpolatedHeight;
|
||||||
|
|
||||||
|
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||||
|
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||||
|
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||||
|
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||||
|
|
||||||
|
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||||
|
|
||||||
|
return interpolatedHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getInterpolatedTerrainHeight(Vector3fImmutable zoneLoc3f) {
|
||||||
|
|
||||||
|
Vector2f zoneLoc = new Vector2f(zoneLoc3f.x, zoneLoc3f.z);
|
||||||
|
|
||||||
|
Vector2f gridSquare;
|
||||||
|
|
||||||
|
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
//flip the Y so it grabs from the bottom left instead of top left.
|
||||||
|
//zoneLoc.setY(maxZoneHeight - zoneLoc.y);
|
||||||
|
|
||||||
|
gridSquare = getGridSquare(zoneLoc);
|
||||||
|
|
||||||
|
int gridX = (int) gridSquare.x;
|
||||||
|
int gridY = (int) (gridSquare.y);
|
||||||
|
|
||||||
|
float offsetX = (gridSquare.x - gridX);
|
||||||
|
float offsetY = gridSquare.y - gridY;
|
||||||
|
|
||||||
|
//get height of the 4 vertices.
|
||||||
|
|
||||||
|
float topLeftHeight = pixelColorValues[gridX][gridY];
|
||||||
|
float topRightHeight = pixelColorValues[gridX + 1][gridY];
|
||||||
|
float bottomLeftHeight = pixelColorValues[gridX][gridY + 1];
|
||||||
|
float bottomRightHeight = pixelColorValues[gridX + 1][gridY + 1];
|
||||||
|
|
||||||
|
float interpolatedHeight;
|
||||||
|
|
||||||
|
interpolatedHeight = topRightHeight * (1 - offsetY) * (offsetX);
|
||||||
|
interpolatedHeight += (bottomRightHeight * offsetY * offsetX);
|
||||||
|
interpolatedHeight += (bottomLeftHeight * (1 - offsetX) * offsetY);
|
||||||
|
interpolatedHeight += (topLeftHeight * (1 - offsetX) * (1 - offsetY));
|
||||||
|
|
||||||
|
interpolatedHeight *= (float) this.maxHeight / 256; // Scale height
|
||||||
|
|
||||||
|
return interpolatedHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generatePixelData() {
|
||||||
|
|
||||||
|
Color color;
|
||||||
|
|
||||||
|
// Generate altitude lookup table for this heightmap
|
||||||
|
|
||||||
|
this.pixelColorValues = new int[this.heightmapImage.getWidth()][this.heightmapImage.getHeight()];
|
||||||
|
|
||||||
|
for (int y = 0; y < this.heightmapImage.getHeight(); y++) {
|
||||||
|
for (int x = 0; x < this.heightmapImage.getWidth(); x++) {
|
||||||
|
|
||||||
|
color = new Color(this.heightmapImage.getRGB(x, y));
|
||||||
|
pixelColorValues[x][y] = color.getRed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getScaledHeightForColor(float color) {
|
||||||
|
|
||||||
|
return (color / 256) * this.maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
public float getBucketWidthX() {
|
public float getBucketWidthX() {
|
||||||
return bucketWidthX;
|
return bucketWidthX;
|
||||||
}
|
}
|
||||||
@@ -692,15 +703,4 @@ public class HeightMap {
|
|||||||
return seaLevel;
|
return seaLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLocUnderwater(Vector3fImmutable currentLoc) {
|
|
||||||
|
|
||||||
float localAltitude = HeightMap.getWorldHeight(currentLoc);
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(currentLoc);
|
|
||||||
|
|
||||||
if (localAltitude < zone.getSeaLevel())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,14 +38,128 @@ public enum InterestManager implements Runnable {
|
|||||||
private static long lastTime;
|
private static long lastTime;
|
||||||
private static boolean keepGoing = true;
|
private static boolean keepGoing = true;
|
||||||
|
|
||||||
public void shutdown() {
|
|
||||||
this.keepGoing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
InterestManager() {
|
InterestManager() {
|
||||||
Logger.info(" Interest Management thread is running.");
|
Logger.info(" Interest Management thread is running.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void forceLoad(AbstractWorldObject awo) {
|
||||||
|
|
||||||
|
AbstractNetMsg msg = null;
|
||||||
|
LoadStructureMsg lsm;
|
||||||
|
LoadCharacterMsg lcm;
|
||||||
|
NPC npc;
|
||||||
|
Corpse corpse;
|
||||||
|
HashSet<AbstractWorldObject> toUpdate;
|
||||||
|
|
||||||
|
switch (awo.getObjectType()) {
|
||||||
|
case Building:
|
||||||
|
lsm = new LoadStructureMsg();
|
||||||
|
lsm.addObject((Building) awo);
|
||||||
|
msg = lsm;
|
||||||
|
break;
|
||||||
|
case Corpse:
|
||||||
|
corpse = (Corpse) awo;
|
||||||
|
lcm = new LoadCharacterMsg(corpse, false);
|
||||||
|
msg = lcm;
|
||||||
|
break;
|
||||||
|
case NPC:
|
||||||
|
npc = (NPC) awo;
|
||||||
|
lcm = new LoadCharacterMsg(npc, false);
|
||||||
|
msg = lcm;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
toUpdate = WorldGrid.getObjectsInRangePartial(awo.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
||||||
|
|
||||||
|
boolean send;
|
||||||
|
|
||||||
|
for (AbstractWorldObject tar : toUpdate) {
|
||||||
|
PlayerCharacter player = (PlayerCharacter) tar;
|
||||||
|
HashSet<AbstractWorldObject> loadedStaticObjects = player.getLoadedStaticObjects();
|
||||||
|
send = false;
|
||||||
|
|
||||||
|
if (!loadedStaticObjects.contains(awo)) {
|
||||||
|
loadedStaticObjects.add(awo);
|
||||||
|
send = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (send) {
|
||||||
|
|
||||||
|
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void HandleSpecialUnload(Building building, ClientConnection origin) {
|
||||||
|
|
||||||
|
if (Regions.FurnitureRegionMap.get(building.getObjectUUID()) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Regions buildingRegion = Regions.FurnitureRegionMap.get(building.getObjectUUID());
|
||||||
|
|
||||||
|
if (!buildingRegion.isOutside())
|
||||||
|
return;
|
||||||
|
|
||||||
|
MoveToPointMsg moveMsg = new MoveToPointMsg(building);
|
||||||
|
|
||||||
|
if (origin != null)
|
||||||
|
origin.sendMsg(moveMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void reloadCharacter(AbstractCharacter absChar) {
|
||||||
|
|
||||||
|
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||||
|
uom.addObject(absChar);
|
||||||
|
LoadCharacterMsg lcm = new LoadCharacterMsg(absChar, false);
|
||||||
|
|
||||||
|
HashSet<AbstractWorldObject> toSend = WorldGrid.getObjectsInRangePartial(absChar.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE,
|
||||||
|
MBServerStatics.MASK_PLAYER);
|
||||||
|
|
||||||
|
PlayerCharacter pc = null;
|
||||||
|
|
||||||
|
if (absChar.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
|
pc = (PlayerCharacter) absChar;
|
||||||
|
|
||||||
|
for (AbstractWorldObject awo : toSend) {
|
||||||
|
|
||||||
|
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||||
|
|
||||||
|
if (pcc == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ClientConnection cc = SessionManager.getClientConnection(pcc);
|
||||||
|
|
||||||
|
if (cc == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pcc.getObjectUUID() == absChar.getObjectUUID())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
else {
|
||||||
|
if (pc != null)
|
||||||
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!cc.sendMsg(uom)) {
|
||||||
|
String classType = uom.getClass().getSimpleName();
|
||||||
|
Logger.error("Failed to send message ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cc.sendMsg(lcm)) {
|
||||||
|
String classType = lcm.getClass().getSimpleName();
|
||||||
|
Logger.error("Failed to send message");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
this.keepGoing = false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
beginLoadJob();
|
beginLoadJob();
|
||||||
@@ -84,6 +198,9 @@ public enum InterestManager implements Runnable {
|
|||||||
return dur;
|
return dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Forces the loading of static objects (corpses and buildings).
|
||||||
|
// Needed to override threshold limits on loading statics
|
||||||
|
|
||||||
private void updateAllPlayers() {
|
private void updateAllPlayers() {
|
||||||
// get all players
|
// get all players
|
||||||
|
|
||||||
@@ -385,76 +502,6 @@ public enum InterestManager implements Runnable {
|
|||||||
//JobScheduler.getInstance().scheduleJob(new LoadEffectsJob(players, origin), MBServerStatics.LOAD_OBJECT_DELAY);
|
//JobScheduler.getInstance().scheduleJob(new LoadEffectsJob(players, origin), MBServerStatics.LOAD_OBJECT_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forces the loading of static objects (corpses and buildings).
|
|
||||||
// Needed to override threshold limits on loading statics
|
|
||||||
|
|
||||||
public static void forceLoad(AbstractWorldObject awo) {
|
|
||||||
|
|
||||||
AbstractNetMsg msg = null;
|
|
||||||
LoadStructureMsg lsm;
|
|
||||||
LoadCharacterMsg lcm;
|
|
||||||
NPC npc;
|
|
||||||
Corpse corpse;
|
|
||||||
HashSet<AbstractWorldObject> toUpdate;
|
|
||||||
|
|
||||||
switch (awo.getObjectType()) {
|
|
||||||
case Building:
|
|
||||||
lsm = new LoadStructureMsg();
|
|
||||||
lsm.addObject((Building) awo);
|
|
||||||
msg = lsm;
|
|
||||||
break;
|
|
||||||
case Corpse:
|
|
||||||
corpse = (Corpse) awo;
|
|
||||||
lcm = new LoadCharacterMsg(corpse, false);
|
|
||||||
msg = lcm;
|
|
||||||
break;
|
|
||||||
case NPC:
|
|
||||||
npc = (NPC) awo;
|
|
||||||
lcm = new LoadCharacterMsg(npc, false);
|
|
||||||
msg = lcm;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
toUpdate = WorldGrid.getObjectsInRangePartial(awo.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
boolean send;
|
|
||||||
|
|
||||||
for (AbstractWorldObject tar : toUpdate) {
|
|
||||||
PlayerCharacter player = (PlayerCharacter) tar;
|
|
||||||
HashSet<AbstractWorldObject> loadedStaticObjects = player.getLoadedStaticObjects();
|
|
||||||
send = false;
|
|
||||||
|
|
||||||
if (!loadedStaticObjects.contains(awo)) {
|
|
||||||
loadedStaticObjects.add(awo);
|
|
||||||
send = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (send) {
|
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void HandleSpecialUnload(Building building, ClientConnection origin) {
|
|
||||||
|
|
||||||
if (Regions.FurnitureRegionMap.get(building.getObjectUUID()) == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Regions buildingRegion = Regions.FurnitureRegionMap.get(building.getObjectUUID());
|
|
||||||
|
|
||||||
if (!buildingRegion.isOutside())
|
|
||||||
return;
|
|
||||||
|
|
||||||
MoveToPointMsg moveMsg = new MoveToPointMsg(building);
|
|
||||||
|
|
||||||
if (origin != null)
|
|
||||||
origin.sendMsg(moveMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void HandleLoadForEnterWorld(PlayerCharacter player) {
|
public synchronized void HandleLoadForEnterWorld(PlayerCharacter player) {
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
@@ -504,51 +551,4 @@ public enum InterestManager implements Runnable {
|
|||||||
Logger.error("InterestManager.updateAllMobilePlayers: " + player.getObjectUUID(), e);
|
Logger.error("InterestManager.updateAllMobilePlayers: " + player.getObjectUUID(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reloadCharacter(AbstractCharacter absChar) {
|
|
||||||
|
|
||||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
|
||||||
uom.addObject(absChar);
|
|
||||||
LoadCharacterMsg lcm = new LoadCharacterMsg(absChar, false);
|
|
||||||
|
|
||||||
HashSet<AbstractWorldObject> toSend = WorldGrid.getObjectsInRangePartial(absChar.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE,
|
|
||||||
MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
PlayerCharacter pc = null;
|
|
||||||
|
|
||||||
if (absChar.getObjectType().equals(GameObjectType.PlayerCharacter))
|
|
||||||
pc = (PlayerCharacter) absChar;
|
|
||||||
|
|
||||||
for (AbstractWorldObject awo : toSend) {
|
|
||||||
|
|
||||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
|
||||||
|
|
||||||
if (pcc == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ClientConnection cc = SessionManager.getClientConnection(pcc);
|
|
||||||
|
|
||||||
if (cc == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pcc.getObjectUUID() == absChar.getObjectUUID())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
else {
|
|
||||||
if (pc != null)
|
|
||||||
if (pcc.getSeeInvis() < pc.getHidden())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!cc.sendMsg(uom)) {
|
|
||||||
String classType = uom.getClass().getSimpleName();
|
|
||||||
Logger.error("Failed to send message ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cc.sendMsg(lcm)) {
|
|
||||||
String classType = lcm.getClass().getSimpleName();
|
|
||||||
Logger.error("Failed to send message");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -36,8 +36,8 @@ public enum RealmMap {
|
|||||||
// Spatial hashmap. Used for determining which Realm
|
// Spatial hashmap. Used for determining which Realm
|
||||||
// a player is currently located within.
|
// a player is currently located within.
|
||||||
|
|
||||||
public static int[][] _realmImageMap;
|
|
||||||
private static final HashMap<Color, Integer> _rgbToIDMap = new HashMap<>();
|
private static final HashMap<Color, Integer> _rgbToIDMap = new HashMap<>();
|
||||||
|
public static int[][] _realmImageMap;
|
||||||
|
|
||||||
public static int getRealmIDByColor(Color color) {
|
public static int getRealmIDByColor(Color color) {
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class WorldGrid {
|
|||||||
public static ConcurrentHashMap<Integer, AbstractWorldObject>[][] StaticGridMap;
|
public static ConcurrentHashMap<Integer, AbstractWorldObject>[][] StaticGridMap;
|
||||||
private static float dynamicBucketScale = 0.00390625f; // 256 bucket size, 1/256
|
private static float dynamicBucketScale = 0.00390625f; // 256 bucket size, 1/256
|
||||||
private static float staticBucketScale = 0.00390625f;
|
private static float staticBucketScale = 0.00390625f;
|
||||||
|
|
||||||
public static void startLoadJob() {
|
public static void startLoadJob() {
|
||||||
|
|
||||||
Thread loadJobThread;
|
Thread loadJobThread;
|
||||||
@@ -66,7 +67,6 @@ public class WorldGrid {
|
|||||||
int startingZ = gridZ + bucketSize;
|
int startingZ = gridZ + bucketSize;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int limitX = Math.abs((int) (MBServerStatics.MAX_WORLD_WIDTH * scale));
|
int limitX = Math.abs((int) (MBServerStatics.MAX_WORLD_WIDTH * scale));
|
||||||
int limitZ = Math.abs((int) (MBServerStatics.MAX_WORLD_HEIGHT * scale)); //LimitZ is negative, remember to flip sign.
|
int limitZ = Math.abs((int) (MBServerStatics.MAX_WORLD_HEIGHT * scale)); //LimitZ is negative, remember to flip sign.
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
// Magicbane Emulator Project © 2013 - 2022
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
package engine.ai;
|
package engine.ai;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.DispatchChannel;
|
import engine.Enum.DispatchChannel;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
@@ -22,12 +23,15 @@ import engine.objects.*;
|
|||||||
import engine.powers.ActionsBase;
|
import engine.powers.ActionsBase;
|
||||||
import engine.powers.PowersBase;
|
import engine.powers.PowersBase;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
import static engine.math.FastMath.sqr;
|
import static engine.math.FastMath.sqr;
|
||||||
|
|
||||||
public class MobileFSM {
|
public class MobileFSM {
|
||||||
private static void AttackTarget(Mob mob, AbstractWorldObject target) {
|
private static void AttackTarget(Mob mob, AbstractWorldObject target) {
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
@@ -58,6 +62,7 @@ public class MobileFSM {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AttackPlayer(Mob mob, PlayerCharacter target) {
|
public static void AttackPlayer(Mob mob, PlayerCharacter target) {
|
||||||
if (!mob.canSee(target)) {
|
if (!mob.canSee(target)) {
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
@@ -100,6 +105,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AttackBuilding(Mob mob, Building target) {
|
public static void AttackBuilding(Mob mob, Building target) {
|
||||||
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
@@ -140,6 +146,7 @@ public class MobileFSM {
|
|||||||
DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AttackMob(Mob mob, Mob target) {
|
public static void AttackMob(Mob mob, Mob target) {
|
||||||
if (mob.getRange() >= 30 && mob.isMoving())
|
if (mob.getRange() >= 30 && mob.isMoving())
|
||||||
return;
|
return;
|
||||||
@@ -166,6 +173,7 @@ public class MobileFSM {
|
|||||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Patrol(Mob mob) {
|
private static void Patrol(Mob mob) {
|
||||||
//make sure mob is out of combat stance
|
//make sure mob is out of combat stance
|
||||||
if (mob.isCombat() && mob.getCombatTarget() == null) {
|
if (mob.isCombat() && mob.getCombatTarget() == null) {
|
||||||
@@ -214,6 +222,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canCast(Mob mob) {
|
public static boolean canCast(Mob mob) {
|
||||||
// Performs validation to determine if a
|
// Performs validation to determine if a
|
||||||
// mobile in the proper state to cast.
|
// mobile in the proper state to cast.
|
||||||
@@ -229,6 +238,7 @@ public class MobileFSM {
|
|||||||
mob.nextCastTime = System.currentTimeMillis();
|
mob.nextCastTime = System.currentTimeMillis();
|
||||||
return mob.nextCastTime <= System.currentTimeMillis();
|
return mob.nextCastTime <= System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean MobCast(Mob mob) {
|
public static boolean MobCast(Mob mob) {
|
||||||
// Method picks a random spell from a mobile's list of powers
|
// Method picks a random spell from a mobile's list of powers
|
||||||
// and casts it on the current target (or itself). Validation
|
// and casts it on the current target (or itself). Validation
|
||||||
@@ -291,6 +301,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MobCallForHelp(Mob mob) {
|
public static void MobCallForHelp(Mob mob) {
|
||||||
boolean callGotResponse = false;
|
boolean callGotResponse = false;
|
||||||
if (mob.nextCallForHelp == 0) {
|
if (mob.nextCallForHelp == 0) {
|
||||||
@@ -311,6 +322,7 @@ public class MobileFSM {
|
|||||||
//wait 60 seconds to call for help again
|
//wait 60 seconds to call for help again
|
||||||
mob.nextCallForHelp = System.currentTimeMillis() + 60000;
|
mob.nextCallForHelp = System.currentTimeMillis() + 60000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DetermineAction(Mob mob) {
|
public static void DetermineAction(Mob mob) {
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return;
|
return;
|
||||||
@@ -375,6 +387,7 @@ public class MobileFSM {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckForAggro(Mob aiAgent) {
|
private static void CheckForAggro(Mob aiAgent) {
|
||||||
//looks for and sets mobs combatTarget
|
//looks for and sets mobs combatTarget
|
||||||
if (!aiAgent.isAlive())
|
if (!aiAgent.isAlive())
|
||||||
@@ -405,6 +418,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckMobMovement(Mob mob) {
|
private static void CheckMobMovement(Mob mob) {
|
||||||
if (!MovementUtilities.canMove(mob))
|
if (!MovementUtilities.canMove(mob))
|
||||||
return;
|
return;
|
||||||
@@ -446,6 +460,7 @@ public class MobileFSM {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckForRespawn(Mob aiAgent) {
|
private static void CheckForRespawn(Mob aiAgent) {
|
||||||
if (aiAgent.deathTime == 0) {
|
if (aiAgent.deathTime == 0) {
|
||||||
aiAgent.setDeathTime(System.currentTimeMillis());
|
aiAgent.setDeathTime(System.currentTimeMillis());
|
||||||
@@ -479,6 +494,7 @@ public class MobileFSM {
|
|||||||
aiAgent.respawn();
|
aiAgent.respawn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CheckForAttack(Mob mob) {
|
public static void CheckForAttack(Mob mob) {
|
||||||
//checks if mob can attack based on attack timer and range
|
//checks if mob can attack based on attack timer and range
|
||||||
if (mob.isAlive() == false)
|
if (mob.isAlive() == false)
|
||||||
@@ -505,10 +521,10 @@ public class MobileFSM {
|
|||||||
if (System.currentTimeMillis() > mob.getLastAttackTime())
|
if (System.currentTimeMillis() > mob.getLastAttackTime())
|
||||||
AttackTarget(mob, mob.getCombatTarget());
|
AttackTarget(mob, mob.getCombatTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckToSendMobHome(Mob mob) {
|
private static void CheckToSendMobHome(Mob mob) {
|
||||||
if (mob.BehaviourType.isAgressive) {
|
if (mob.BehaviourType.isAgressive) {
|
||||||
if(mob.isPlayerGuard())
|
if (mob.isPlayerGuard()) {
|
||||||
{
|
|
||||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
}
|
}
|
||||||
@@ -533,8 +549,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (MovementUtilities.inRangeOfBindLocation(mob) == false) {
|
||||||
else if(MovementUtilities.inRangeOfBindLocation(mob) == false) {
|
|
||||||
|
|
||||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
@@ -544,6 +559,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void chaseTarget(Mob mob) {
|
private static void chaseTarget(Mob mob) {
|
||||||
mob.updateMovementState();
|
mob.updateMovementState();
|
||||||
if (mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) {
|
if (mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) {
|
||||||
@@ -560,6 +576,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SafeGuardAggro(Mob mob) {
|
private static void SafeGuardAggro(Mob mob) {
|
||||||
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(mob, 100, MBServerStatics.MASK_MOB);
|
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(mob, 100, MBServerStatics.MASK_MOB);
|
||||||
for (AbstractWorldObject awoMob : awoList) {
|
for (AbstractWorldObject awoMob : awoList) {
|
||||||
@@ -575,12 +592,14 @@ public class MobileFSM {
|
|||||||
mob.setCombatTarget(aggroMob);
|
mob.setCombatTarget(aggroMob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardCaptainLogic(Mob mob) {
|
public static void GuardCaptainLogic(Mob mob) {
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardMinionLogic(Mob mob) {
|
public static void GuardMinionLogic(Mob mob) {
|
||||||
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null) {
|
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null) {
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
@@ -592,12 +611,14 @@ public class MobileFSM {
|
|||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardWallArcherLogic(Mob mob) {
|
public static void GuardWallArcherLogic(Mob mob) {
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
else
|
else
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PetLogic(Mob mob) {
|
private static void PetLogic(Mob mob) {
|
||||||
if (mob.getCombatTarget() != null && !mob.getCombatTarget().isAlive())
|
if (mob.getCombatTarget() != null && !mob.getCombatTarget().isAlive())
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
@@ -605,6 +626,7 @@ public class MobileFSM {
|
|||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HamletGuardLogic(Mob mob) {
|
private static void HamletGuardLogic(Mob mob) {
|
||||||
if (mob.getCombatTarget() == null) {
|
if (mob.getCombatTarget() == null) {
|
||||||
//safehold guard
|
//safehold guard
|
||||||
@@ -616,6 +638,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DefaultLogic(Mob mob) {
|
private static void DefaultLogic(Mob mob) {
|
||||||
if (mob.getObjectUUID() == 40548) {
|
if (mob.getObjectUUID() == 40548) {
|
||||||
int thing = 0;
|
int thing = 0;
|
||||||
@@ -643,6 +666,7 @@ public class MobileFSM {
|
|||||||
if (!mob.BehaviourType.isWimpy && !mob.isMoving() && mob.combatTarget != null)
|
if (!mob.BehaviourType.isWimpy && !mob.isMoving() && mob.combatTarget != null)
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CheckForPlayerGuardAggro(Mob mob) {
|
public static void CheckForPlayerGuardAggro(Mob mob) {
|
||||||
//looks for and sets mobs combatTarget
|
//looks for and sets mobs combatTarget
|
||||||
if (!mob.isAlive())
|
if (!mob.isAlive())
|
||||||
@@ -673,6 +697,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean GuardCanAggro(Mob mob, PlayerCharacter target) {
|
public static Boolean GuardCanAggro(Mob mob, PlayerCharacter target) {
|
||||||
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||||
return false;
|
return false;
|
||||||
@@ -713,6 +738,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void randomGuardPatrolPoint(Mob mob) {
|
public static void randomGuardPatrolPoint(Mob mob) {
|
||||||
if (mob.isMoving() == true) {
|
if (mob.isMoving() == true) {
|
||||||
//early exit for a mob who is already moving to a patrol point
|
//early exit for a mob who is already moving to a patrol point
|
||||||
@@ -750,6 +776,7 @@ public class MobileFSM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob) {
|
public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob) {
|
||||||
float CurrentHateValue = 0;
|
float CurrentHateValue = 0;
|
||||||
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ public class MobileFSMManager {
|
|||||||
private static final MobileFSMManager INSTANCE = new MobileFSMManager();
|
private static final MobileFSMManager INSTANCE = new MobileFSMManager();
|
||||||
public static Duration executionTime = Duration.ofNanos(1);
|
public static Duration executionTime = Duration.ofNanos(1);
|
||||||
public static Duration executionMax = Duration.ofNanos(1);
|
public static Duration executionMax = Duration.ofNanos(1);
|
||||||
private volatile boolean alive;
|
|
||||||
private long timeOfKill = -1;
|
|
||||||
|
|
||||||
//AI variables moved form mb_server_statics
|
//AI variables moved form mb_server_statics
|
||||||
public static int AI_BASE_AGGRO_RANGE = 60;
|
public static int AI_BASE_AGGRO_RANGE = 60;
|
||||||
public static int AI_DROP_AGGRO_RANGE = 60;
|
public static int AI_DROP_AGGRO_RANGE = 60;
|
||||||
@@ -37,6 +34,8 @@ public class MobileFSMManager {
|
|||||||
public static int AI_PATROL_DIVISOR = 15;
|
public static int AI_PATROL_DIVISOR = 15;
|
||||||
public static int AI_POWER_DIVISOR = 20;
|
public static int AI_POWER_DIVISOR = 20;
|
||||||
public static float AI_MAX_ANGLE = 10f;
|
public static float AI_MAX_ANGLE = 10f;
|
||||||
|
private volatile boolean alive;
|
||||||
|
private long timeOfKill = -1;
|
||||||
|
|
||||||
|
|
||||||
private MobileFSMManager() {
|
private MobileFSMManager() {
|
||||||
|
|||||||
@@ -17,10 +17,16 @@ import java.util.ArrayList;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class ControlledRunnable implements Runnable {
|
public abstract class ControlledRunnable implements Runnable {
|
||||||
|
// Runnable tracking
|
||||||
|
private static final ArrayList<ControlledRunnable> runnables = new ArrayList<>();
|
||||||
|
private final String threadName;
|
||||||
protected boolean runCmd = false;
|
protected boolean runCmd = false;
|
||||||
protected boolean runStatus = false;
|
protected boolean runStatus = false;
|
||||||
private Thread thisThread;
|
private Thread thisThread;
|
||||||
private final String threadName;
|
|
||||||
|
/*
|
||||||
|
* Main loop
|
||||||
|
*/
|
||||||
|
|
||||||
public ControlledRunnable(String threadName) {
|
public ControlledRunnable(String threadName) {
|
||||||
super();
|
super();
|
||||||
@@ -28,9 +34,14 @@ public abstract class ControlledRunnable implements Runnable {
|
|||||||
ControlledRunnable.runnables.add(this);
|
ControlledRunnable.runnables.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
public static void shutdownAllRunnables() {
|
||||||
* Main loop
|
for (ControlledRunnable cr : ControlledRunnable.runnables) {
|
||||||
*/
|
//Use Direct logging since JobManager is a runnable.
|
||||||
|
Logger.info("ControlledRunnable",
|
||||||
|
"Sending Shutdown cmd to: " + cr.threadName);
|
||||||
|
cr.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the method called when ControlledRunnable.thisThread.start() is
|
* This is the method called when ControlledRunnable.thisThread.start() is
|
||||||
@@ -62,6 +73,10 @@ public abstract class ControlledRunnable implements Runnable {
|
|||||||
*/
|
*/
|
||||||
protected abstract boolean _preRun();
|
protected abstract boolean _preRun();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Control
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _Run() is called after _startup() and contains should contain the main
|
* _Run() is called after _startup() and contains should contain the main
|
||||||
* loop.
|
* loop.
|
||||||
@@ -78,10 +93,6 @@ public abstract class ControlledRunnable implements Runnable {
|
|||||||
*/
|
*/
|
||||||
protected abstract boolean _postRun();
|
protected abstract boolean _postRun();
|
||||||
|
|
||||||
/*
|
|
||||||
* Control
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startup() initializes the internal thread, sets the runCMD to true, and
|
* startup() initializes the internal thread, sets the runCMD to true, and
|
||||||
* calls _startup() prior to starting of the internal Thread.
|
* calls _startup() prior to starting of the internal Thread.
|
||||||
@@ -141,6 +152,10 @@ public abstract class ControlledRunnable implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Instance monitoring and tools
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the thisThread
|
* @return the thisThread
|
||||||
*/
|
*/
|
||||||
@@ -155,20 +170,4 @@ public abstract class ControlledRunnable implements Runnable {
|
|||||||
return threadName;
|
return threadName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Instance monitoring and tools
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Runnable tracking
|
|
||||||
private static final ArrayList<ControlledRunnable> runnables = new ArrayList<>();
|
|
||||||
|
|
||||||
public static void shutdownAllRunnables() {
|
|
||||||
for (ControlledRunnable cr : ControlledRunnable.runnables) {
|
|
||||||
//Use Direct logging since JobManager is a runnable.
|
|
||||||
Logger.info("ControlledRunnable",
|
|
||||||
"Sending Shutdown cmd to: " + cr.threadName);
|
|
||||||
cr.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,7 @@ public class BaneRecord extends DataRecord {
|
|||||||
if (baneRecord == null) {
|
if (baneRecord == null) {
|
||||||
baneRecord = new BaneRecord(bane);
|
baneRecord = new BaneRecord(bane);
|
||||||
baneRecord.eventType = eventType;
|
baneRecord.eventType = eventType;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
baneRecord.recordType = Enum.DataRecordType.BANE;
|
baneRecord.recordType = Enum.DataRecordType.BANE;
|
||||||
baneRecord.eventType = eventType;
|
baneRecord.eventType = eventType;
|
||||||
|
|
||||||
@@ -67,8 +66,7 @@ public class BaneRecord extends DataRecord {
|
|||||||
baneRecord.baneDropperHash = "ERRANT";
|
baneRecord.baneDropperHash = "ERRANT";
|
||||||
baneRecord.baneGuildHash = "ERRANT";
|
baneRecord.baneGuildHash = "ERRANT";
|
||||||
baneRecord.baneNationHash = "ERRANT";
|
baneRecord.baneNationHash = "ERRANT";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
baneRecord.baneDropperHash = DataWarehouse.hasher.encrypt(bane.getOwner().getObjectUUID()); // getPlayerCharacter didn't check hash first? OMFG
|
baneRecord.baneDropperHash = DataWarehouse.hasher.encrypt(bane.getOwner().getObjectUUID()); // getPlayerCharacter didn't check hash first? OMFG
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ public class CharacterRecord extends DataRecord {
|
|||||||
|
|
||||||
if (characterRecord == null) {
|
if (characterRecord == null) {
|
||||||
characterRecord = new CharacterRecord(player);
|
characterRecord = new CharacterRecord(player);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
characterRecord.recordType = Enum.DataRecordType.CHARACTER;
|
characterRecord.recordType = Enum.DataRecordType.CHARACTER;
|
||||||
characterRecord.player = player;
|
characterRecord.player = player;
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ public class CityRecord extends DataRecord {
|
|||||||
if (cityRecord == null) {
|
if (cityRecord == null) {
|
||||||
cityRecord = new CityRecord(city);
|
cityRecord = new CityRecord(city);
|
||||||
cityRecord.eventType = eventType;
|
cityRecord.eventType = eventType;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cityRecord.recordType = Enum.DataRecordType.CITY;
|
cityRecord.recordType = Enum.DataRecordType.CITY;
|
||||||
cityRecord.eventType = eventType;
|
cityRecord.eventType = eventType;
|
||||||
cityRecord.city = city;
|
cityRecord.city = city;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
|
|||||||
@@ -188,6 +188,24 @@ public class DataWarehouse implements Runnable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void configureRemoteConnectionPool() {
|
||||||
|
|
||||||
|
HikariConfig config = new HikariConfig();
|
||||||
|
|
||||||
|
config.setMaximumPoolSize(1); // Only the server talks to remote, so yeah.
|
||||||
|
config.setJdbcUrl(ConfigManager.MB_WAREHOUSE_ADDR.getValue());
|
||||||
|
config.setUsername(ConfigManager.MB_WAREHOUSE_USER.getValue());
|
||||||
|
config.setPassword(ConfigManager.MB_WAREHOUSE_PASS.getValue());
|
||||||
|
config.addDataSourceProperty("characterEncoding", "utf8");
|
||||||
|
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||||
|
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||||
|
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||||
|
|
||||||
|
remoteConnectionPool = new HikariDataSource(config); // setup the connection pool
|
||||||
|
|
||||||
|
Logger.info("remote warehouse connection configured");
|
||||||
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// Working variable set
|
// Working variable set
|
||||||
@@ -269,22 +287,4 @@ public class DataWarehouse implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void configureRemoteConnectionPool() {
|
|
||||||
|
|
||||||
HikariConfig config = new HikariConfig();
|
|
||||||
|
|
||||||
config.setMaximumPoolSize(1); // Only the server talks to remote, so yeah.
|
|
||||||
config.setJdbcUrl(ConfigManager.MB_WAREHOUSE_ADDR.getValue());
|
|
||||||
config.setUsername(ConfigManager.MB_WAREHOUSE_USER.getValue());
|
|
||||||
config.setPassword(ConfigManager.MB_WAREHOUSE_PASS.getValue());
|
|
||||||
config.addDataSourceProperty("characterEncoding", "utf8");
|
|
||||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
|
||||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
|
||||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
|
||||||
|
|
||||||
remoteConnectionPool = new HikariDataSource(config); // setup the connection pool
|
|
||||||
|
|
||||||
Logger.info("remote warehouse connection configured");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
public class GuildRecord extends DataRecord {
|
public class GuildRecord extends DataRecord {
|
||||||
|
|
||||||
private static final LinkedBlockingQueue<GuildRecord> recordPool = new LinkedBlockingQueue<>();
|
private static final LinkedBlockingQueue<GuildRecord> recordPool = new LinkedBlockingQueue<>();
|
||||||
|
public static HashMap<Integer, GuildRecord> GuildRecordCache = null;
|
||||||
|
public String guildHash;
|
||||||
|
public int guildID;
|
||||||
private Enum.RecordEventType eventType;
|
private Enum.RecordEventType eventType;
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
public String guildHash;
|
|
||||||
private String guildName;
|
private String guildName;
|
||||||
private String charterName;
|
private String charterName;
|
||||||
private String GLHash;
|
private String GLHash;
|
||||||
@@ -39,12 +41,8 @@ public class GuildRecord extends DataRecord {
|
|||||||
private int bgColour2;
|
private int bgColour2;
|
||||||
private int fgIcon;
|
private int fgIcon;
|
||||||
private int fgColour;
|
private int fgColour;
|
||||||
public int guildID;
|
|
||||||
|
|
||||||
private java.time.LocalDateTime eventDatetime;
|
private java.time.LocalDateTime eventDatetime;
|
||||||
|
|
||||||
public static HashMap<Integer, GuildRecord> GuildRecordCache = null;
|
|
||||||
|
|
||||||
private GuildRecord(Guild guild) {
|
private GuildRecord(Guild guild) {
|
||||||
this.recordType = Enum.DataRecordType.GUILD;
|
this.recordType = Enum.DataRecordType.GUILD;
|
||||||
this.guild = guild;
|
this.guild = guild;
|
||||||
@@ -52,7 +50,6 @@ public class GuildRecord extends DataRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public GuildRecord(ResultSet rs) throws SQLException {
|
public GuildRecord(ResultSet rs) throws SQLException {
|
||||||
super();
|
super();
|
||||||
this.eventType = RecordEventType.valueOf(rs.getString("eventType"));
|
this.eventType = RecordEventType.valueOf(rs.getString("eventType"));
|
||||||
@@ -74,7 +71,6 @@ public class GuildRecord extends DataRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static GuildRecord borrow(Guild guild, Enum.RecordEventType eventType) {
|
public static GuildRecord borrow(Guild guild, Enum.RecordEventType eventType) {
|
||||||
GuildRecord guildRecord;
|
GuildRecord guildRecord;
|
||||||
//add
|
//add
|
||||||
@@ -83,8 +79,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
if (guildRecord == null) {
|
if (guildRecord == null) {
|
||||||
guildRecord = new GuildRecord(guild);
|
guildRecord = new GuildRecord(guild);
|
||||||
guildRecord.eventType = eventType;
|
guildRecord.eventType = eventType;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
guildRecord.guild = guild;
|
guildRecord.guild = guild;
|
||||||
guildRecord.recordType = Enum.DataRecordType.GUILD;
|
guildRecord.recordType = Enum.DataRecordType.GUILD;
|
||||||
guildRecord.eventType = eventType;
|
guildRecord.eventType = eventType;
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ public class MineRecord extends DataRecord {
|
|||||||
if (mineRecord == null) {
|
if (mineRecord == null) {
|
||||||
mineRecord = new MineRecord();
|
mineRecord = new MineRecord();
|
||||||
mineRecord.eventType = eventType;
|
mineRecord.eventType = eventType;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mineRecord.recordType = Enum.DataRecordType.MINE;
|
mineRecord.recordType = Enum.DataRecordType.MINE;
|
||||||
mineRecord.eventType = eventType;
|
mineRecord.eventType = eventType;
|
||||||
}
|
}
|
||||||
@@ -58,8 +57,7 @@ public class MineRecord extends DataRecord {
|
|||||||
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||||
player = (PlayerCharacter) character;
|
player = (PlayerCharacter) character;
|
||||||
mineRecord.charHash = player.getHash();
|
mineRecord.charHash = player.getHash();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
mineRecord.charHash = character.getName();
|
mineRecord.charHash = character.getName();
|
||||||
|
|
||||||
DataWarehouse.hasher.encrypt(0);
|
DataWarehouse.hasher.encrypt(0);
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ public class PvpRecord extends DataRecord {
|
|||||||
|
|
||||||
if (pvpRecord == null) {
|
if (pvpRecord == null) {
|
||||||
pvpRecord = new PvpRecord(player, victim, location, pvpExp);
|
pvpRecord = new PvpRecord(player, victim, location, pvpExp);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pvpRecord.recordType = DataRecordType.PVP;
|
pvpRecord.recordType = DataRecordType.PVP;
|
||||||
pvpRecord.player = player;
|
pvpRecord.player = player;
|
||||||
pvpRecord.victim = victim;
|
pvpRecord.victim = victim;
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ public class RealmRecord extends DataRecord {
|
|||||||
if (realmRecord == null) {
|
if (realmRecord == null) {
|
||||||
realmRecord = new RealmRecord(realm);
|
realmRecord = new RealmRecord(realm);
|
||||||
realmRecord.eventType = eventType;
|
realmRecord.eventType = eventType;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
realmRecord.recordType = Enum.DataRecordType.REALM;
|
realmRecord.recordType = Enum.DataRecordType.REALM;
|
||||||
realmRecord.eventType = eventType;
|
realmRecord.eventType = eventType;
|
||||||
realmRecord.realm = realm;
|
realmRecord.realm = realm;
|
||||||
|
|||||||
@@ -29,6 +29,60 @@ public abstract class AbstractDevCmd {
|
|||||||
this.rsult = "";
|
this.rsult = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called by the DevCmdManager. Method splits argString
|
* This function is called by the DevCmdManager. Method splits argString
|
||||||
* into a String array and then calls the subclass specific _doCmd method.
|
* into a String array and then calls the subclass specific _doCmd method.
|
||||||
@@ -89,22 +143,22 @@ public abstract class AbstractDevCmd {
|
|||||||
this.cmdStrings.add(lowercase);
|
this.cmdStrings.add(lowercase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTarget(AbstractGameObject ago) {
|
|
||||||
this.tr = ago;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractGameObject getTarget() {
|
public AbstractGameObject getTarget() {
|
||||||
return this.tr;
|
return this.tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResult(String result) {
|
public void setTarget(AbstractGameObject ago) {
|
||||||
this.rsult = result;
|
this.tr = ago;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResult() {
|
public String getResult() {
|
||||||
return this.rsult;
|
return this.rsult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setResult(String result) {
|
||||||
|
this.rsult = result;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper functions
|
* Helper functions
|
||||||
*/
|
*/
|
||||||
@@ -124,58 +178,4 @@ public abstract class AbstractDevCmd {
|
|||||||
ChatManager.chatSystemInfo(pc, 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import engine.objects.PlayerCharacter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class AddGoldCmd extends AbstractDevCmd {
|
public class AddGoldCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class AddMobCmd extends AbstractDevCmd {
|
public class AddMobCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class AddNPCCmd extends AbstractDevCmd {
|
public class AddNPCCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -124,8 +124,6 @@ public class ApplyBonusCmd extends AbstractDevCmd {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,18 +21,16 @@ import engine.powers.PowersBase;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ApplyStatModCmd extends AbstractDevCmd {
|
public class ApplyStatModCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
private static int cnt = 0;
|
||||||
|
|
||||||
public ApplyStatModCmd() {
|
public ApplyStatModCmd() {
|
||||||
super("applystatmod");
|
super("applystatmod");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int cnt = 0;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
@@ -72,9 +70,6 @@ public class ApplyStatModCmd extends AbstractDevCmd {
|
|||||||
pbList.add(PowersManager.getPowerByToken(431081336));
|
pbList.add(PowersManager.getPowerByToken(431081336));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (PowersBase pb : pbList) {
|
for (PowersBase pb : pbList) {
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
if (pb.getToken() == 428677994)
|
if (pb.getToken() == 428677994)
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public class AuditFailedItemsCmd extends AbstractDevCmd {
|
|||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ItemProductionManager.FailedItems.isEmpty())
|
if (ItemProductionManager.FailedItems.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -103,8 +102,6 @@ public class AuditFailedItemsCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
auditFailedItem += newLine;
|
auditFailedItem += newLine;
|
||||||
auditFailedItem += itemName + " | " + prefix + " | " + suffix + " | " + failedItem.getNpcUID() + ":" + npcName + " | " + contractName + " | " + failedItem.getPlayerID() + ":" + playerName;
|
auditFailedItem += itemName + " | " + prefix + " | " + suffix + " | " + failedItem.getNpcUID() + ":" + npcName + " | " + contractName + " | " + failedItem.getPlayerID() + ":" + playerName;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public class AuditHeightMapCmd extends AbstractDevCmd {
|
|||||||
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
Zone currentZone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y);
|
Vector3fImmutable currentLoc = Vector3fImmutable.getRandomPointInCircle(currentZone.getLoc(), currentZone.getBounds().getHalfExtents().x < currentZone.getBounds().getHalfExtents().y ? currentZone.getBounds().getHalfExtents().x : currentZone.getBounds().getHalfExtents().y);
|
||||||
|
|
||||||
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
|
Vector2f zoneLoc = ZoneManager.worldToZoneSpace(currentLoc, currentZone);
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ public class AuditMobsCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (pcSender == null) return;
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
//get Zone to check mobs against
|
//get Zone to check mobs against
|
||||||
|
|
||||||
@@ -83,12 +84,10 @@ public class AuditMobsCmd extends AbstractDevCmd {
|
|||||||
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
|
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//mob not found in spawn map, check respawn
|
//mob not found in spawn map, check respawn
|
||||||
boolean inRespawn = false;
|
boolean inRespawn = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
@@ -27,9 +24,7 @@ import engine.objects.AbstractGameObject;
|
|||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class CombatMessageCmd extends AbstractDevCmd {
|
public class CombatMessageCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import engine.objects.PlayerCharacter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class CreateItemCmd extends AbstractDevCmd {
|
public class CreateItemCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,19 @@ import engine.objects.PlayerCharacter;
|
|||||||
public class DebugCmd extends AbstractDevCmd {
|
public class DebugCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DebugCmd() {
|
public DebugCmd() {
|
||||||
super("debug");
|
super("debug");
|
||||||
// super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
|
// super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void toggleDebugTimer(PlayerCharacter pc, String name, int num, int duration, boolean toggle) {
|
||||||
|
if (toggle) {
|
||||||
|
DebugTimerJob dtj = new DebugTimerJob(pc, name, num, duration);
|
||||||
|
pc.renewTimer(name, dtj, duration);
|
||||||
|
} else
|
||||||
|
pc.cancelTimer(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
@@ -112,12 +119,4 @@ public class DebugCmd extends AbstractDevCmd {
|
|||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "'./Debug command on/off'";
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
@@ -27,17 +26,11 @@ public class DespawnCmd extends AbstractDevCmd {
|
|||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (pc == null) {
|
if (pc == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mob mob = null;
|
Mob mob = null;
|
||||||
|
|
||||||
if (target != null && target.getObjectType().equals(GameObjectType.Mob))
|
if (target != null && target.getObjectType().equals(GameObjectType.Mob))
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
@@ -27,8 +26,6 @@ public class DistanceCmd extends AbstractDevCmd {
|
|||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Arg Count Check
|
// Arg Count Check
|
||||||
if (words.length != 1) {
|
if (words.length != 1) {
|
||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ import engine.objects.PlayerCharacter;
|
|||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class EffectCmd extends AbstractDevCmd {
|
public class EffectCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public class EnchantCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Item item;
|
Item item;
|
||||||
if (target == null || target instanceof Item)
|
if (target == null || target instanceof Item)
|
||||||
item = (Item) target;
|
item = (Item) target;
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ import engine.objects.AbstractGameObject;
|
|||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class FlashMsgCmd extends AbstractDevCmd {
|
public class FlashMsgCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
@@ -39,7 +37,6 @@ public class FlashMsgCmd extends AbstractDevCmd {
|
|||||||
* This function is called by the DevCmdManager. Override to avoid splitting
|
* This function is called by the DevCmdManager. Override to avoid splitting
|
||||||
* argString into String array, since flash displays full String as message,
|
* argString into String array, since flash displays full String as message,
|
||||||
* then calls the subclass specific _doCmd method.
|
* then calls the subclass specific _doCmd method.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -81,5 +81,4 @@ public class GateInfoCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ import engine.objects.AbstractGameObject;
|
|||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class GetBankCmd extends AbstractDevCmd {
|
public class GetBankCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
@@ -30,10 +28,12 @@ public class GetBankCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (pcSender == null) return;
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
ClientConnection cc = SessionManager.getClientConnection(pcSender);
|
ClientConnection cc = SessionManager.getClientConnection(pcSender);
|
||||||
if (cc == null) return;
|
if (cc == null)
|
||||||
|
return;
|
||||||
|
|
||||||
VendorDialogMsg.getBank(pcSender, null, cc);
|
VendorDialogMsg.getBank(pcSender, null, cc);
|
||||||
this.setTarget(pcSender); //for logging
|
this.setTarget(pcSender); //for logging
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.InterestManagement.HeightMap;
|
import engine.InterestManagement.HeightMap;
|
||||||
@@ -88,8 +87,6 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
|
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
|
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
|
||||||
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
|
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
|
||||||
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
|
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
|
||||||
@@ -102,7 +99,8 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
|
if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
|
||||||
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
|
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
|
||||||
parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
|
parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
|
||||||
} else parentGrid = new Vector2f(-1,-1);
|
} else
|
||||||
|
parentGrid = new Vector2f(-1, -1);
|
||||||
|
|
||||||
gridSquare = heightMap.getGridSquare(zoneLoc);
|
gridSquare = heightMap.getGridSquare(zoneLoc);
|
||||||
gridOffset = HeightMap.getGridOffset(gridSquare);
|
gridOffset = HeightMap.getGridOffset(gridSquare);
|
||||||
@@ -184,8 +182,6 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
realWorldAltitude = outsetALt;
|
realWorldAltitude = outsetALt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,14 +206,11 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
strMod -= .5f;
|
strMod -= .5f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
realWorldAltitude += strMod;
|
realWorldAltitude += strMod;
|
||||||
|
|
||||||
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
|
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,19 +19,6 @@ public class GetMemoryCmd extends AbstractDevCmd {
|
|||||||
super("getmemory");
|
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) {
|
public static String getMemoryOutput(long memory) {
|
||||||
String out = "";
|
String out = "";
|
||||||
if (memory > 1073741824)
|
if (memory > 1073741824)
|
||||||
@@ -44,6 +31,20 @@ public class GetMemoryCmd extends AbstractDevCmd {
|
|||||||
return memory + "B";
|
return memory + "B";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /getmemory'";
|
return "' /getmemory'";
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import engine.objects.PlayerCharacter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class GetMobBaseLoot extends AbstractDevCmd {
|
public class GetMobBaseLoot extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ public class GetOffsetCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (pcSender == null) return;
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Zone zone = null;
|
Zone zone = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ public class GetRuneDropRateCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (pcSender == null) return;
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
String out = "Depracated";
|
String out = "Depracated";
|
||||||
throwbackInfo(pcSender, out);
|
throwbackInfo(pcSender, out);
|
||||||
|
|||||||
@@ -25,10 +25,12 @@ public class GetVaultCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (pcSender == null) return;
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
ClientConnection cc = SessionManager.getClientConnection(pcSender);
|
ClientConnection cc = SessionManager.getClientConnection(pcSender);
|
||||||
if (cc == null) return;
|
if (cc == null)
|
||||||
|
return;
|
||||||
|
|
||||||
VendorDialogMsg.getVault(pcSender, null, cc);
|
VendorDialogMsg.getVault(pcSender, null, cc);
|
||||||
this.setTarget(pcSender); //for logging
|
this.setTarget(pcSender); //for logging
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public class GetZoneCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (pcSender == null) return;
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (words.length != 1) {
|
if (words.length != 1) {
|
||||||
this.sendUsage(pcSender);
|
this.sendUsage(pcSender);
|
||||||
|
|||||||
@@ -25,13 +25,15 @@ public class GetZoneMobsCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (pcSender == null) return;
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
int loadID = 0;
|
int loadID = 0;
|
||||||
if (words.length == 1) {
|
if (words.length == 1) {
|
||||||
try {
|
try {
|
||||||
loadID = Integer.parseInt(words[0]);
|
loadID = Integer.parseInt(words[0]);
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//find the zone
|
//find the zone
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.ai.MobileFSMManager;
|
import engine.ai.MobileFSMManager;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
@@ -63,6 +62,7 @@ public class HotzoneCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
|
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class InfoCmd extends AbstractDevCmd {
|
public class InfoCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
@@ -426,8 +425,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "enemy: " + targetMob.enemy.toString();
|
output += "enemy: " + targetMob.enemy.toString();
|
||||||
output += newline;
|
output += newline;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch(Exception ex){
|
|
||||||
//who cares its info
|
//who cares its info
|
||||||
}
|
}
|
||||||
output += "Spawn: (" + targetMob.getBindLoc().getX();
|
output += "Spawn: (" + targetMob.getBindLoc().getX();
|
||||||
@@ -439,7 +437,8 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
if (targetMob.isSummonedPet())
|
if (targetMob.isSummonedPet())
|
||||||
output += "isSummonedPet: true";
|
output += "isSummonedPet: true";
|
||||||
else output += "isSummonedPet: false";
|
else
|
||||||
|
output += "isSummonedPet: false";
|
||||||
PlayerCharacter owner = targetMob.getOwner();
|
PlayerCharacter owner = targetMob.getOwner();
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
output += " owner: " + owner.getObjectUUID();
|
output += " owner: " + owner.getObjectUUID();
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ import engine.objects.LootTable;
|
|||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class MBDropCmd extends AbstractDevCmd {
|
public class MBDropCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class MakeBaneCmd extends AbstractDevCmd {
|
public class MakeBaneCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
@@ -78,8 +77,6 @@ public class MakeBaneCmd extends AbstractDevCmd {
|
|||||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
|
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (player.getGuild().isEmptyGuild()) {
|
if (player.getGuild().isEmptyGuild()) {
|
||||||
throwbackError(pc, "Errant's can not place banes");
|
throwbackError(pc, "Errant's can not place banes");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class MakeItemCmd extends AbstractDevCmd {
|
public class MakeItemCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
@@ -70,7 +69,6 @@ public class MakeItemCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//add item to inventory
|
//add item to inventory
|
||||||
pc.getCharItemManager().addItemToInventory(item);
|
pc.getCharItemManager().addItemToInventory(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import engine.objects.PlayerCharacter;
|
|||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author Summary: Devcmd to toggle logging of application protocol messages
|
||||||
* Summary: Devcmd to toggle logging of application protocol messages
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class NetDebugCmd extends AbstractDevCmd {
|
public class NetDebugCmd extends AbstractDevCmd {
|
||||||
@@ -23,6 +21,23 @@ public class NetDebugCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// AbstractDevCmd Overridden methods
|
// AbstractDevCmd Overridden 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;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] args,
|
protected void _doCmd(PlayerCharacter pc, String[] args,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
@@ -58,29 +73,12 @@ public class NetDebugCmd extends AbstractDevCmd {
|
|||||||
return "Toggles sending network messages to log";
|
return "Toggles sending network messages to log";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Class methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "/netdebug on|off";
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,8 +73,7 @@ public class PrintBonusesCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
} else if (((AbstractCharacter) tar).getBonuses() != null) {
|
} else if (((AbstractCharacter) tar).getBonuses() != null) {
|
||||||
((AbstractCharacter) tar).getBonuses().printBonusesToClient(pc);
|
((AbstractCharacter) tar).getBonuses().printBonusesToClient(pc);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
throwbackInfo(pc, "Bonuses for " + type + ' ' + name + " not found");
|
throwbackInfo(pc, "Bonuses for " + type + ' ' + name + " not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,8 @@ public class PrintInventoryCmd extends AbstractDevCmd {
|
|||||||
chargeInfo = " charges: " + charges + '/' + chargeMax;
|
chargeInfo = " charges: " + charges + '/' + chargeMax;
|
||||||
}
|
}
|
||||||
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems() + chargeInfo);
|
throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems() + chargeInfo);
|
||||||
} else goldCount += item.getNumOfItems();
|
} else
|
||||||
|
goldCount += item.getNumOfItems();
|
||||||
}
|
}
|
||||||
if (gold != null) {
|
if (gold != null) {
|
||||||
goldCount += gold.getNumOfItems();
|
goldCount += gold.getNumOfItems();
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import engine.objects.Regions;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class PrintLocationCmd extends AbstractDevCmd {
|
public class PrintLocationCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
// super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
@@ -71,7 +81,6 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String newline = "\r\n ";
|
String newline = "\r\n ";
|
||||||
String out = "Server stats for Mob " + mb.getFirstName() + newline;
|
String out = "Server stats for Mob " + mb.getFirstName() + newline;
|
||||||
out += "Stats Base (Modified)" + newline;
|
out += "Stats Base (Modified)" + newline;
|
||||||
@@ -130,17 +139,6 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
throwbackInfo(pc, out);
|
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
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Returns the player's current stats";
|
return "Returns the player's current stats";
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import engine.math.Vector3fImmutable;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Dev command to move mobile and it's spawn location
|
||||||
* @author
|
|
||||||
* Dev command to move mobile and it's spawn location
|
|
||||||
* to the player's current location
|
* to the player's current location
|
||||||
*/
|
*/
|
||||||
public class PullCmd extends AbstractDevCmd {
|
public class PullCmd extends AbstractDevCmd {
|
||||||
@@ -19,6 +17,42 @@ public class PullCmd extends AbstractDevCmd {
|
|||||||
super("pull");
|
super("pull");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
@@ -65,40 +99,4 @@ public class PullCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
return true;
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,8 @@ import java.util.concurrent.locks.ReadWriteLock;
|
|||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author Summary: Game designer utility command to purge all
|
||||||
* Summary: Game designer utility command to purge all
|
* objects of a given type within a supplied range
|
||||||
objects of a given type within a supplied range
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PurgeObjectsCmd extends AbstractDevCmd {
|
public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||||
@@ -59,7 +58,6 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
mobA = (Mob) ac;
|
mobA = (Mob) ac;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
@@ -100,6 +98,113 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// AbstractDevCmd Overridden methods
|
// AbstractDevCmd Overridden 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 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Class methods
|
||||||
|
|
||||||
|
private static void removeMob(PlayerCharacter pc, Mob mob) {
|
||||||
|
mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
|
||||||
|
mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
|
||||||
|
//mob.setHealth(-1, pc); //Kill it!
|
||||||
|
|
||||||
|
DbManager.MobQueries.DELETE_MOB(mob);
|
||||||
|
DbManager.removeFromCache(mob);
|
||||||
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
|
WorldGrid.removeObject(mob, pc);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] args,
|
protected void _doCmd(PlayerCharacter pc, String[] args,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
@@ -174,38 +279,6 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
return "/purge [npc|mob|mesh|all] [range <= 200]";
|
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) {
|
private void parseUserInput(String[] userInput) {
|
||||||
|
|
||||||
_targetMask = 0;
|
_targetMask = 0;
|
||||||
@@ -236,80 +309,4 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
_targetRange = Math.min(_targetRange, 200f);
|
_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import engine.objects.PlayerCharacter;
|
|||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author Summary: Devcmd to reboot server
|
||||||
* Summary: Devcmd to reboot server
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RebootCmd extends AbstractDevCmd {
|
public class RebootCmd extends AbstractDevCmd {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import engine.objects.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class RemoveBaneCmd extends AbstractDevCmd {
|
public class RemoveBaneCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ import engine.objects.NPC;
|
|||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class RenameCmd extends AbstractDevCmd {
|
public class RenameCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -32,5 +32,4 @@ public class ResetLevelCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.ai.MobileFSMManager;
|
import engine.ai.MobileFSMManager;
|
||||||
@@ -19,7 +18,6 @@ import engine.server.MBServerStatics;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve
|
* @author Steve
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SetAICmd extends AbstractDevCmd {
|
public class SetAICmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ import engine.objects.CharacterRune;
|
|||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SetAdminRuneCmd extends AbstractDevCmd {
|
public class SetAdminRuneCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import engine.objects.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SetBaneActiveCmd extends AbstractDevCmd {
|
public class SetBaneActiveCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ import engine.objects.NPC;
|
|||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Dev command to set the guild of targeted npc.
|
||||||
* @author
|
|
||||||
* Dev command to set the guild of targeted npc.
|
|
||||||
* Argument is a valid guild UID
|
* Argument is a valid guild UID
|
||||||
*/
|
*/
|
||||||
public class SetGuildCmd extends AbstractDevCmd {
|
public class SetGuildCmd extends AbstractDevCmd {
|
||||||
@@ -84,8 +82,8 @@ public class SetGuildCmd extends AbstractDevCmd {
|
|||||||
// Argument must parse as a int.
|
// Argument must parse as a int.
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(userInput[0]); }
|
Integer.parseInt(userInput[0]);
|
||||||
catch (NumberFormatException | NullPointerException e) {
|
} catch (NumberFormatException | NullPointerException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.DispatchChannel;
|
import engine.Enum.DispatchChannel;
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ public class SetInvulCmd extends AbstractDevCmd {
|
|||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
if (pcSender == null) return;
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (words.length != 1) {
|
if (words.length != 1) {
|
||||||
this.sendUsage(pcSender);
|
this.sendUsage(pcSender);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
@@ -21,6 +20,7 @@ import engine.objects.PlayerCharacter;
|
|||||||
public class SetNpcEquipSetCmd extends AbstractDevCmd {
|
public class SetNpcEquipSetCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public static int lastEquipSetID = 0;
|
public static int lastEquipSetID = 0;
|
||||||
|
|
||||||
public SetNpcEquipSetCmd() {
|
public SetNpcEquipSetCmd() {
|
||||||
super("setEquipSet");
|
super("setEquipSet");
|
||||||
this.addCmdString("equipset");
|
this.addCmdString("equipset");
|
||||||
@@ -68,7 +68,6 @@ public class SetNpcEquipSetCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +98,6 @@ public class SetNpcEquipSetCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
@@ -20,6 +19,7 @@ import engine.objects.PlayerCharacter;
|
|||||||
public class SetNpcNameCmd extends AbstractDevCmd {
|
public class SetNpcNameCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public static int lastEquipSetID = 0;
|
public static int lastEquipSetID = 0;
|
||||||
|
|
||||||
public SetNpcNameCmd() {
|
public SetNpcNameCmd() {
|
||||||
super("setNPCName");
|
super("setNPCName");
|
||||||
this.addCmdString("npcname");
|
this.addCmdString("npcname");
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import engine.objects.*;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Dev command to set the owner of targeted building.
|
||||||
* @author
|
|
||||||
* Dev command to set the owner of targeted building.
|
|
||||||
* Argument is a valid guild UID
|
* Argument is a valid guild UID
|
||||||
*/
|
*/
|
||||||
public class SetOwnerCmd extends AbstractDevCmd {
|
public class SetOwnerCmd extends AbstractDevCmd {
|
||||||
@@ -45,7 +43,8 @@ public class SetOwnerCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
if (city != null) {
|
if (city != null) {
|
||||||
city.claim(outOwner);
|
city.claim(outOwner);
|
||||||
return; }
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_targetBuilding.setOwner(outOwner);
|
_targetBuilding.setOwner(outOwner);
|
||||||
|
|
||||||
@@ -89,8 +88,8 @@ public class SetOwnerCmd extends AbstractDevCmd {
|
|||||||
// Argument must parse to a long.
|
// Argument must parse to a long.
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Long.parseLong(userInput[0]); }
|
Long.parseLong(userInput[0]);
|
||||||
catch (NumberFormatException | NullPointerException e) {
|
} catch (NumberFormatException | NullPointerException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
@@ -126,7 +125,6 @@ public class SetRankCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ import engine.objects.CharacterRune;
|
|||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SetRuneCmd extends AbstractDevCmd {
|
public class SetRuneCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.DispatchChannel;
|
import engine.Enum.DispatchChannel;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
|
||||||
@@ -79,7 +78,6 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
//pc.getCharItemManager().updateInventory();
|
//pc.getCharItemManager().updateInventory();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Mob mob = (Mob)target;
|
// Mob mob = (Mob)target;
|
||||||
//
|
//
|
||||||
// if (mob == null)
|
// if (mob == null)
|
||||||
@@ -90,8 +88,6 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
// mob.getCharItemManager().addItemToInventory(mobLoot);
|
// mob.getCharItemManager().addItemToInventory(mobLoot);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (target.getObjectType() != GameObjectType.Building)
|
// if (target.getObjectType() != GameObjectType.Building)
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
@@ -155,13 +151,6 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// for (EffectsBase eb : EffectsBase.getAllEffectsBase()){
|
// for (EffectsBase eb : EffectsBase.getAllEffectsBase()){
|
||||||
// if (eb.getToken() == 0)
|
// if (eb.getToken() == 0)
|
||||||
// continue;
|
// continue;
|
||||||
@@ -192,8 +181,6 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -53,5 +53,4 @@ public class ShowOffsetCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ import java.util.concurrent.locks.ReadWriteLock;
|
|||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author Summary: Game designer utility command to create multiple
|
||||||
* Summary: Game designer utility command to create multiple
|
|
||||||
* mobiles of a given UUID within a supplied range
|
* mobiles of a given UUID within a supplied range
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -39,6 +38,41 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// AbstractDevCmd Overridden methods
|
// AbstractDevCmd Overridden methods
|
||||||
|
|
||||||
|
private static boolean validateUserInput(String[] userInput) {
|
||||||
|
|
||||||
|
// incorrect number of arguments test
|
||||||
|
|
||||||
|
if (userInput.length != 3)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Test for UUID conversion to int
|
||||||
|
|
||||||
|
try {
|
||||||
|
Integer.parseInt(userInput[0]);
|
||||||
|
} catch (NumberFormatException | NullPointerException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Test for Number of Mobs conversion to int
|
||||||
|
|
||||||
|
try {
|
||||||
|
Integer.parseInt(userInput[1]);
|
||||||
|
} catch (NumberFormatException | NullPointerException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test if range argument can convert to a float
|
||||||
|
|
||||||
|
try {
|
||||||
|
Float.parseFloat(userInput[2]);
|
||||||
|
} catch (NumberFormatException | NullPointerException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] args,
|
protected void _doCmd(PlayerCharacter pc, String[] args,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
@@ -97,48 +131,13 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
return "Spawns multiple mobiles with a given range";
|
return "Spawns multiple mobiles with a given range";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Class methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "/splatmob UUID [Count <= 100] [range <= 1200]";
|
return "/splatmob UUID [Count <= 100] [range <= 1200]";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class methods
|
|
||||||
|
|
||||||
private static boolean validateUserInput(String[] userInput) {
|
|
||||||
|
|
||||||
// incorrect number of arguments test
|
|
||||||
|
|
||||||
if (userInput.length != 3)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Test for UUID conversion to int
|
|
||||||
|
|
||||||
try {
|
|
||||||
Integer.parseInt(userInput[0]); }
|
|
||||||
catch (NumberFormatException | NullPointerException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Test for Number of Mobs conversion to int
|
|
||||||
|
|
||||||
try {
|
|
||||||
Integer.parseInt(userInput[1]); }
|
|
||||||
catch (NumberFormatException | NullPointerException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test if range argument can convert to a float
|
|
||||||
|
|
||||||
try {
|
|
||||||
Float.parseFloat(userInput[2]); }
|
|
||||||
catch (NumberFormatException | NullPointerException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parseUserInput(String[] userInput) {
|
private void parseUserInput(String[] userInput) {
|
||||||
|
|
||||||
// Clear previous values
|
// Clear previous values
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import engine.objects.PlayerCharacter;
|
|||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author Summary: Devcmd to toggle logging of mysql statements
|
||||||
* Summary: Devcmd to toggle logging of mysql statements
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class SqlDebugCmd extends AbstractDevCmd {
|
public class SqlDebugCmd extends AbstractDevCmd {
|
||||||
@@ -23,6 +21,23 @@ public class SqlDebugCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
// AbstractDevCmd Overridden methods
|
// AbstractDevCmd Overridden 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;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] args,
|
protected void _doCmd(PlayerCharacter pc, String[] args,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
@@ -58,29 +73,12 @@ public class SqlDebugCmd extends AbstractDevCmd {
|
|||||||
return "Toggles sending SQL statements to log";
|
return "Toggles sending SQL statements to log";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Class methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "/sqldebug on|off";
|
return "/sqldebug 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import engine.objects.PlayerCharacter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class UnloadFurnitureCmd extends AbstractDevCmd {
|
public class UnloadFurnitureCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ZoneInfoCmd extends AbstractDevCmd {
|
public class ZoneInfoCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -9,25 +9,19 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.TargetColor;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.objects.Building;
|
||||||
import engine.objects.*;
|
import engine.objects.Mob;
|
||||||
import engine.util.StringUtils;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class aiInfoCmd extends AbstractDevCmd {
|
public class aiInfoCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
@@ -44,8 +43,6 @@ public class convertLoc extends AbstractDevCmd {
|
|||||||
ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertedLoc));
|
ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertedLoc));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package engine.devcmd.cmds;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.BuildingManager;
|
||||||
|
import engine.gameManager.NPCManager;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class simulateBootyCmd extends AbstractDevCmd {
|
public class simulateBootyCmd extends AbstractDevCmd {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
// www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
@@ -519,7 +518,8 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
if (item.getChargesRemaining() > 0)
|
if (item.getChargesRemaining() > 0)
|
||||||
rank = item.getChargesRemaining() * 10;
|
rank = item.getChargesRemaining() * 10;
|
||||||
else rank = 10;
|
else
|
||||||
|
rank = 10;
|
||||||
|
|
||||||
Mob mob;
|
Mob mob;
|
||||||
NPC npc;
|
NPC npc;
|
||||||
@@ -697,7 +697,6 @@ public enum BuildingManager {
|
|||||||
return bindLoc;
|
return bindLoc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public enum ChatManager {
|
|||||||
private static final String FLOOD_USER_ERROR = "You talk too much!";
|
private static final String FLOOD_USER_ERROR = "You talk too much!";
|
||||||
private static final String SILENCED = "You find yourself mute!";
|
private static final String SILENCED = "You find yourself mute!";
|
||||||
private static final String UNKNOWN_COMMAND = "No such command.";
|
private static final String UNKNOWN_COMMAND = "No such command.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method used when handling a ChatMsg received from the network.
|
* This method used when handling a ChatMsg received from the network.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user