diff --git a/README.md b/README.md
index c83b332d..3468187d 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,23 @@

# Magicbane Open-Source MMO Project
+
### *The Community written Shadowbane emulator*
+
[Magicbane](http://www.magicbane.com)
[Public Repository](http://repo.magicbane.com)
-> Magicbane is an emulator for the long dead but much beloved Ubisoft 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.
+> Magicbane is an emulator for the long dead but much beloved Ubisoft
+> 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.
- Project with real infrastructure; Production and development servers supporting multiple containerized apps.
@@ -20,11 +26,12 @@ The Magicbane Team has wanted to open source Shadowbane for half a decade. We a
## Contributing
-- Project is released under an MIT license. Please see the LICENSE file.
+- Project is released under an MIT license. Please see the LICENSE file.
- Inbound == Outbound.
- IntelliJ is the supported IDE.
- Write code today see it running on the Magicbane production server tomorrow.
## Support
-Documentation is available through the Magicbane [Wiki](http://repo.magicbane.com/MagicBane/Server/wiki) and [Discord server](www.magicbane.com).
\ No newline at end of file
+Documentation is available through the Magicbane [Wiki](http://repo.magicbane.com/MagicBane/Server/wiki)
+and [Discord server](www.magicbane.com).
\ No newline at end of file
diff --git a/src/discord/ChatChannel.java b/src/discord/ChatChannel.java
index 1540dfce..a67e31fe 100644
--- a/src/discord/ChatChannel.java
+++ b/src/discord/ChatChannel.java
@@ -24,7 +24,7 @@ public enum ChatChannel {
ADMINLOG("MB_MAGICBOT_ADMINLOG");
public final String configName;
- public long channelID;
+ public long channelID;
public TextChannel textChannel;
ChatChannel(String configName) {
diff --git a/src/discord/DiscordAccount.java b/src/discord/DiscordAccount.java
index 0b3d6b77..fce59a4b 100644
--- a/src/discord/DiscordAccount.java
+++ b/src/discord/DiscordAccount.java
@@ -7,6 +7,7 @@
// www.magicbane.com
package discord;
+
import engine.Enum;
import java.time.LocalDateTime;
@@ -18,6 +19,7 @@ public class DiscordAccount {
public LocalDateTime registrationDate;
public LocalDateTime lastUpdateRequest;
public byte isDiscordAdmin;
+
public DiscordAccount() {
}
diff --git a/src/discord/MagicBot.java b/src/discord/MagicBot.java
index fe5a6150..1e496c17 100644
--- a/src/discord/MagicBot.java
+++ b/src/discord/MagicBot.java
@@ -37,32 +37,32 @@ import java.util.regex.Pattern;
import static discord.ChatChannel.ADMINLOG;
/*
-* MagicBot is many things to Magicbane...
-*
-* -Project Mascot
-* -Customer service and administration bot
-* -Benevolent dictator
-* -Investment manager.
-*
-* MagicBot will never beg you for money. He is a very
-* responsible robot. He was varnished but never garnished.
-* MagicBot does not for to overclock himself. His chips
-* will therefore never overcook.
-* MagicBot will never be a pitiful robot trying for to use
-* you as emotional support human.
-*
-* MagicBot is just not that sort of robot and Magicbane
-* just isn't that sort of project.
-*
-* MagicBot runs a Shaodowbane emulator not a Second Life emulator.
-*
-*/
+ * MagicBot is many things to Magicbane...
+ *
+ * -Project Mascot
+ * -Customer service and administration bot
+ * -Benevolent dictator
+ * -Investment manager.
+ *
+ * MagicBot will never beg you for money. He is a very
+ * responsible robot. He was varnished but never garnished.
+ * MagicBot does not for to overclock himself. His chips
+ * will therefore never overcook.
+ * MagicBot will never be a pitiful robot trying for to use
+ * you as emotional support human.
+ *
+ * MagicBot is just not that sort of robot and Magicbane
+ * just isn't that sort of project.
+ *
+ * MagicBot runs a Shaodowbane emulator not a Second Life emulator.
+ *
+ */
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 passwordRegex = Pattern.compile("^[\\p{Alnum}]{6,20}$");
+ public static JDA jda;
+ public static Database database;
public static long discordServerID;
public static long discordRoleID;
@@ -126,12 +126,136 @@ public class MagicBot extends ListenerAdapter {
Runnable adminLogRunnable = () -> SendAdminLogUpdates();
ScheduledExecutorService exec = Executors.newScheduledThreadPool(1);
- exec.scheduleAtFixedRate(adminLogRunnable , 0, 1, TimeUnit.MINUTES);
+ exec.scheduleAtFixedRate(adminLogRunnable, 0, 1, TimeUnit.MINUTES);
Logger.info("***MAGICBOT IS RUNNING***");
}
+ 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 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 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
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.
- if (event.getAuthor().isBot()) return;
+ if (event.getAuthor().isBot())
+ return;
// 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 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) {
// Help is kept here in the main class instead of a handler as a
@@ -322,85 +404,4 @@ public class MagicBot extends ListenerAdapter {
"#trash /detail/flush";
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 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();
-
- }
- }
}
diff --git a/src/discord/handlers/ChatChannelHandler.java b/src/discord/handlers/ChatChannelHandler.java
index 4f86b184..67697dab 100644
--- a/src/discord/handlers/ChatChannelHandler.java
+++ b/src/discord/handlers/ChatChannelHandler.java
@@ -39,10 +39,11 @@ public class ChatChannelHandler {
if (chatText.startsWith("-r "))
outString =
- "```\n" + "Hello Players \n\n" +
- chatText.substring(3) + "\n\n" +
- RobotSpeak.getRobotSpeak() + "\n```";
- else outString = chatText;
+ "```\n" + "Hello Players \n\n" +
+ chatText.substring(3) + "\n\n" +
+ RobotSpeak.getRobotSpeak() + "\n```";
+ else
+ outString = chatText;
// Write string to changelog channel
diff --git a/src/discord/handlers/DevRequestHandler.java b/src/discord/handlers/DevRequestHandler.java
index c73ea898..f5c73ba2 100644
--- a/src/discord/handlers/DevRequestHandler.java
+++ b/src/discord/handlers/DevRequestHandler.java
@@ -40,7 +40,7 @@ public class DevRequestHandler {
switch (serverCommand) {
- case "build" :
+ case "build":
commandString = "./mbdevbuild.sh";
break;
case "restart":
@@ -61,11 +61,11 @@ public class DevRequestHandler {
case "help":
MagicBot.sendResponse(event,
"#dev build (blank==master) \n" +
- "#dev shutdown (Shutdown dev server)\n" +
- "#dev restart (Restarts the server)\n"+
- "#dev debug (Restarts server in debug mode)\n" +
- "#dev console # (Displays # lines from console)\n" +
- "#dev lastout (Displays output from last command) \n");
+ "#dev shutdown (Shutdown dev server)\n" +
+ "#dev restart (Restarts the server)\n" +
+ "#dev debug (Restarts server in debug mode)\n" +
+ "#dev console # (Displays # lines from console)\n" +
+ "#dev lastout (Displays output from last command) \n");
return;
default:
break;
@@ -77,18 +77,19 @@ public class DevRequestHandler {
}
processBuilder = new ProcessBuilder("/bin/sh", "-c", commandString + " " + commandArgument + " > devLastOut");
- logString = String.join(" ",processBuilder.command().toArray(new String[0]));
+ logString = String.join(" ", processBuilder.command().toArray(new String[0]));
try {
- processBuilder.start();
- } catch (IOException e) {
- Logger.info(e.toString());
- }
+ processBuilder.start();
+ } catch (IOException e) {
+ Logger.info(e.toString());
+ }
MagicBot.sendResponse(event, "Executed on dev: " + logString + "\n" +
- "Use #dev lastout to view results");
+ "Use #dev lastout to view results");
+
+ }
- }
private static String getLastOutput() {
String outString = null;
diff --git a/src/discord/handlers/RegisterAccountHandler.java b/src/discord/handlers/RegisterAccountHandler.java
index eef45cf3..8daf6a84 100644
--- a/src/discord/handlers/RegisterAccountHandler.java
+++ b/src/discord/handlers/RegisterAccountHandler.java
@@ -56,18 +56,18 @@ public class RegisterAccountHandler {
return;
}
- // Validate account name with regex
+ // Validate account name with regex
- accountName = args[0].replaceAll("\\s+", "");
+ accountName = args[0].replaceAll("\\s+", "");
- if (MagicBot.accountNameRegex.matcher(accountName).matches() == false) {
+ if (MagicBot.accountNameRegex.matcher(accountName).matches() == false) {
- MagicBot.sendResponse(event,
- "Your supplied account name does not compute.\n" +
- "Account names must satisfy following regex:\n" +
- "^[\\p{Alnum}]{6,20}$");
- return;
- }
+ MagicBot.sendResponse(event,
+ "Your supplied account name does not compute.\n" +
+ "Account names must satisfy following regex:\n" +
+ "^[\\p{Alnum}]{6,20}$");
+ return;
+ }
if (accountName.equalsIgnoreCase("accountname")) {
MagicBot.sendResponse(event,
diff --git a/src/discord/handlers/StatusRequestHandler.java b/src/discord/handlers/StatusRequestHandler.java
index 1ea836c6..173196ef 100644
--- a/src/discord/handlers/StatusRequestHandler.java
+++ b/src/discord/handlers/StatusRequestHandler.java
@@ -24,7 +24,7 @@ public class StatusRequestHandler {
outString = "Server Status: ";
if (LoginServer.isPortInUse(Integer.parseInt(ConfigManager.MB_WORLD_PORT.getValue())))
- outString += "ONLINE\n";
+ outString += "ONLINE\n";
else
outString += "OFFLINE\n";
diff --git a/src/discord/handlers/TrashRequestHandler.java b/src/discord/handlers/TrashRequestHandler.java
index 79da4ae9..fe053060 100644
--- a/src/discord/handlers/TrashRequestHandler.java
+++ b/src/discord/handlers/TrashRequestHandler.java
@@ -48,7 +48,7 @@ public class TrashRequestHandler {
// Anounce event in septic tank channel
- outString = "```\n" + trashCount + " Player Character were for to deleted due to verified cheatings. \n\n";
+ outString = "```\n" + trashCount + " Player Character were for to deleted due to verified cheatings. \n\n";
outString += MagicBot.database.getTrashList() + "\n\n";
outString += RobotSpeak.getRobotInsult() + "\n```";
diff --git a/src/engine/Enum.java b/src/engine/Enum.java
index b42d18ef..251c105d 100644
--- a/src/engine/Enum.java
+++ b/src/engine/Enum.java
@@ -37,2770 +37,2770 @@ import java.util.concurrent.ThreadLocalRandom;
public class Enum {
- public enum MobFlagType implements EnumBitSetHelper {
- AGGRESSIVE,
- CANROAM,
- CALLSFORHELP,
- RESPONDSTOCALLSFORHELP,
- HUMANOID,
- UNDEAD,
- BEAST,
- DRAGON,
- RAT,
- SENTINEL,
- }
-
- public enum MonsterType implements EnumBitSetHelper {
- Aelfborn,
- All,
- Animal,
- Aracoix,
- Celestial,
- Centaur,
- Construct,
- CSR,
- Dragon,
- Dwarf,
- Elf,
- Giant,
- Goblin,
- Grave,
- HalfGiant,
- Human,
- Infernal,
- Insect,
- Irekei,
- Minotaur,
- Monster,
- NecroPet,
- NPC,
- Pet,
- Plant,
- Rat,
- Reptile,
- Shade,
- Siege,
- Summoned,
- Troll,
- Undead,
- Nephilim,
- Vampire,
- SiegeEngineer;
-
- }
-
- public enum CharacterSex {
- MALE,
- FEMALE,
- FUZZY,
- OTHER;
- }
-
- public enum RaceType {
-
- // RaceRuneID / AggroType, isFemale
-
- AELFMALE(2000, MonsterType.Aelfborn, RunSpeed.STANDARD, CharacterSex.MALE, 1.05f),
- AELFFEMALE(2001, MonsterType.Aelfborn, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.05f),
- ARACOIXMALE(2002, MonsterType.Aracoix, RunSpeed.STANDARD, CharacterSex.MALE, 1),
- ARACOIXFEMALE(2003, MonsterType.Aracoix, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
- CENTAURMALE(2004, MonsterType.Centaur, RunSpeed.CENTAUR, CharacterSex.MALE, 1.2f),
- CENTAURFEMALE(2005, MonsterType.Centaur, RunSpeed.CENTAUR, CharacterSex.FEMALE, 1.2f),
- DWARFMALE(2006, MonsterType.Dwarf, RunSpeed.STANDARD, CharacterSex.MALE, 0.80000001f),
- ELFMALE(2008, MonsterType.Elf, RunSpeed.STANDARD, CharacterSex.MALE, 1.4f),
- ELFFEMALE(2009, MonsterType.Elf, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
- HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
- HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
- HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
- IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
- IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
- SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
- SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
- MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
- ARCHONMALE(2018, MonsterType.Celestial, RunSpeed.STANDARD, CharacterSex.MALE, 1),
- HALEGIANTOLDMALE(2019, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
- CSRFEMALE(2020, MonsterType.CSR, RunSpeed.STANDARD, CharacterSex.FEMALE, 0.66000003f),
- CSRMALE(2021, MonsterType.CSR, RunSpeed.STANDARD, CharacterSex.MALE, 1),
- NEPHMALE(2025, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
- NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
- HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f),
- VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1),
- VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1);
-
- @SuppressWarnings("unchecked")
- private static HashMap _raceTypeByID = new HashMap<>();
-
- int runeID;
- private MonsterType monsterType;
- private CharacterSex characterSex;
- private RunSpeed runSpeed;
- private float scaleHeight;
-
- RaceType(int runeID, MonsterType aggroType, RunSpeed runspeed, CharacterSex characterSex, float scaleHeight) {
- this.runeID = runeID;
- this.monsterType = aggroType;
- this.runSpeed = runspeed;
- this.characterSex = characterSex;
- this.scaleHeight = scaleHeight;
- }
-
- public static RaceType getRaceTypebyRuneID(int runeID) {
- return _raceTypeByID.get(runeID);
- }
-
- public static void initRaceTypeTables() {
-
- for (RaceType raceType : RaceType.values()) {
- _raceTypeByID.put(raceType.runeID, raceType);
- }
- }
-
- public int getRuneID() {
- return this.runeID;
- }
-
- public float getScaleHeight() {
- return this.scaleHeight;
- }
-
- public MonsterType getMonsterType() {
- return monsterType;
- }
-
- public RunSpeed getRunSpeed() {
- return runSpeed;
- }
-
- public CharacterSex getCharacterSex() {
- return characterSex;
- }
- }
-
- public enum RunSpeed {
-
- SENTINEL(0, 0, 0, 0, 0, 0, 0),
- STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
- CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
- MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
-
- private float walkStandard;
- private float walkCombat;
- private float runStandard;
- private float runCombat;
- private float swim;
- private float flyRun;
- private float flyWalk;
-
- RunSpeed(float walkStandard, float runStandard, float walkCombat, float runCombat, float flyWalk, float flyRun, float swim) {
- this.walkStandard = walkStandard;
- this.walkCombat = walkCombat;
- this.runStandard = runStandard;
- this.runCombat = runCombat;
- this.swim = swim;
- this.flyRun = flyRun;
- this.flyWalk = flyWalk;
- }
-
-
- public float getWalkStandard() {
- return walkStandard;
- }
-
- public float getWalkCombat() {
- return walkCombat;
- }
-
- public float getRunStandard() {
- return runStandard;
- }
-
- public float getRunCombat() {
- return runCombat;
- }
-
- public float getFlyRun() {
- return flyRun;
- }
-
-
- public float getFlyWalk() {
- return flyWalk;
- }
-
- }
-
- public enum FriendListType {
-
- VIEWHERALDRY(1),
- ADDHERALDRY(4),
- REMOVEHERALDRY(6),
- DEALTHS(7),
- KILLS(9),
- VIEWCONDEMN(11),
- ADDCONDEMN(14),
- REMOVECONDEMN(15),
- TOGGLEACTIVE(17),
- REVERSEKOS(19),
- VIEWFRIENDS(25),
- TOITEM(23),
- ADDFRIEND(28),
- REMOVEFRIEND(30);
-
- private final int listType;
-
- FriendListType(int listType) {
- this.listType = listType;
- }
-
- public static FriendListType getListTypeByID(int listType) {
-
- FriendListType outType = null;
-
- for (FriendListType friendListType : FriendListType.values()) {
- if (friendListType.listType == listType)
- outType = friendListType;
- }
- return outType;
- }
-
- }
-
- public enum DispatchChannel {
- PRIMARY(0),
- SECONDARY(1);
-
- private final int channelID;
-
- DispatchChannel(int channelID) {
- this.channelID = channelID;
- }
-
- public int getChannelID() {
- return this.channelID;
- }
-
- }
-
- public enum PvpHistoryType {
- KILLS,
- DEATHS;
- }
-
- public enum ChatMessageType {
- ERROR,
- INFO,
- MOTD;
- }
-
- public enum DataRecordType {
- PVP,
- CHARACTER,
- BANE,
- GUILD,
- CITY,
- ZONE,
- REALM,
- MINE;
- }
-
- public enum RecordEventType {
- CREATE, // Shared with city/guild
- DISBAND,
- DESTROY, // City events
- CAPTURE,
- TRANSFER,
- PENDING,
- DEFEND,
- LOST; // Realm event
- }
-
- public enum CharterType {
- FEUDAL(-600065291, 5060000),
- MERCANTILE(-15978914, 5060400),
- BELLIGERENT(762228431, 5060800);
-
- private int charterID;
- private int meshID;
-
- CharterType(int charterID, int meshID) {
- this.charterID = charterID;
- this.meshID = meshID;
- }
-
- public static CharterType getCharterTypeByID(int charterID) {
- CharterType outType = null;
-
- for (CharterType charterType : CharterType.values()) {
- if (charterType.charterID == charterID)
- outType = charterType;
- }
- return outType;
- }
-
- public int getMeshID() {
- return meshID;
- }
- }
-
-
- public enum ChatChannelType {
- SYSTEM(1),
- FLASH(2),
- COMMANDER(3),
- NATION(5),
- LEADER(6),
- SHOUT(7),
- INFO(10),
- GUILD(12),
- INNERCOUNCIL(13),
- GROUP(14),
- CITY(15),
- SAY(16),
- EMOTE(17),
- TELL(19),
- COMBAT(20);
-
- private final int channelID;
-
- ChatChannelType(int channelID) {
- this.channelID = channelID;
- }
-
- public int getChannelID() {
- return this.channelID;
- }
- }
-
- public enum OwnerType {
- Npc,
- PlayerCharacter,
- Account,
- Mob;
- }
-
- public enum SiegePhase {
- ERRANT,
- CHALLENGE,
- STANDOFF,
- WAR,
- CEASEFIRE;
- }
-
- public enum SiegeResult {
- PENDING,
- DEFEND,
- DESTROY,
- CAPTURE;
- }
-
- public enum TaxType {
- PROFIT,
- WEEKLY,
- NONE;
-
- }
-
- public enum Ruins {
-
- ESTRAGOTH(569),
- KARFELL(570),
- MORELAN(571),
- REGARS(572),
- HALLOS(573),
- WESTERMORE(574),
- EYWAN(575),
- CAER(576);
-
- private final int zoneUUID;
-
- Ruins(int uuid) {
- this.zoneUUID = uuid;
- }
-
- public static Ruins getRandomRuin() {
-
- Ruins ruins;
-
- ruins = Ruins.values()[ThreadLocalRandom.current()
- .nextInt(Ruins.values().length)];
-
- return ruins;
- }
-
- public Vector3fImmutable getLocation() {
-
- Zone ruinZone;
- Vector3fImmutable spawnLocation;
-
- // Send to SDR if so configured
-
- if (ConfigManager.MB_USE_RUINS.getValue().equalsIgnoreCase("true")) {
- ruinZone = ZoneManager.getZoneByUUID(this.zoneUUID);
- spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
- } else {
- ruinZone = ZoneManager.getZoneByName("sea dog's rest");
-
- // 14001 does not have a banestone to bind at
-
- if (ruinZone.getLoadNum() == 14001)
- spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
- else
- spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
- .add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
- }
-
-
- return spawnLocation;
- }
-
- }
-
- public enum Guards {
-
- HumanArcher(13.97f, 13.97f, 6.19f, 4.2199998f, 18.38f, 6.33f, 6.5f),
- HumanGuard(13.97f, 13.97f, 6.19f, 4.2199998f, 18.38f, 6.33f, 6.5f),
- HumanMage(13.97f, 13.97f, 6.19f, 4.2199998f, 18.38f, 6.33f, 6.5f),
- UndeadArcher(14.67f, 14.67f, 6.5f, 4.44f, 18.38f, 6.33f, 6.5f),
- UndeadGuard(14.67f, 14.67f, 6.5f, 4.44f, 18.38f, 6.33f, 6.5f),
- UndeadMage(14.67f, 14.67f, 6.5f, 4.44f, 18.38f, 6.33f, 6.5f);
-
- private final float runSpeed;
- private final float runCombatSpeed;
- private final float walkSpeed;
- private final float walkCombatSpeed;
- private final float fly;
- private final float flyWalk;
- private final float swim;
-
- Guards(float runSpeed, float runCombatSpeed, float walkSpeed, float walkCombatSpeed, float fly, float flyWalk, float swim) {
- this.runSpeed = runSpeed;
- this.runCombatSpeed = runCombatSpeed;
- this.walkSpeed = walkSpeed;
- this.walkCombatSpeed = walkCombatSpeed;
- this.fly = fly;
- this.flyWalk = flyWalk;
- this.swim = swim;
- }
-
- public float getRunSpeed() {
- return runSpeed;
- }
-
- public float getRunCombatSpeed() {
- return runCombatSpeed;
- }
-
- public float getWalkSpeed() {
- return walkSpeed;
- }
-
- public float getWalkCombatSpeed() {
- return walkCombatSpeed;
- }
-
- public float getFly() {
- return fly;
- }
-
- public float getSwim() {
- return swim;
- }
-
- public float getFlyWalk() {
- return flyWalk;
- }
- }
-
- public enum PortalType {
-
- EARTH(6f, 19.5f, 128),
- AIR(-6f, 19.5f, 256),
- FIRE(15f, 7.5f, 512),
- WATER(-15f, 8.5f, 1024),
- SPIRIT(0, 10.5f, 2048),
- CHAOS(22f, 3.5f, 8192),
- OBLIV(0f, 42f, 16384),
- MERCHANT(-22f, 4.5f, 4096),
- FORBID(0.0f, 0.0f, 0);
-
- public final Vector2f offset;
- public final int effectFlag;
-
- PortalType(float offsetX, float offsetY, int effectFlag) {
-
- this.offset = new Vector2f(offsetX, offsetY);
- this.effectFlag = effectFlag;
-
- }
- }
-
-
- // Enum for ItemBase flags
-
- public enum ItemType {
- DECORATION(0),
- WEAPON(1),
- ARMOR(2),
- HAIR(3),
- GOLD(4),
- RUNE(5),
- SCROLL(5),
- BOOK(6),
- COMMANDROD(7),
- POTION(8),
- TEARS(8),
- KEY(9),
- GUILDCHARTER(10),
- JEWELRY(13),
- WINE(16),
- ALEJUG(17),
- DEED(19),
- CONTRACT(20),
- PET(21),
- FURNITURE(25),
- BEDROLL(26),
- FARMABLE(27),
- WATERBUCKET(30),
- GIFT(31),
- OFFERING(33),
- RESOURCE(34),
- REALMCHARTER(35);
-
- private final static HashMap _typeLookup = new HashMap<>();
- private final int _value;
-
- ItemType(int value) {
- this._value = value;
- }
-
- public static ItemType getByValue(int value) {
-
- ItemType outType = ItemType.DECORATION;
-
- if (_typeLookup.isEmpty()) {
-
- for (ItemType itemType : ItemType.values()) {
- _typeLookup.put(itemType._value, itemType);
- }
- }
-
- if (_typeLookup.containsKey(value))
- outType = _typeLookup.get(value);
-
- return outType;
- }
-
- /**
- * @return the _value
- */
- public int getValue() {
- return _value;
- }
-
- }
- // Enum to derive effects for active spires from blueprintUUID
-
- public enum SpireType {
-
- WATCHFUL(1800100, (1 << 23), -1139520957),
- GROUNDING(1800400, (1 << 24), -1733819072),
- BINDING(1800700, (1 << 25), -1971545187),
- WARDING(1801000, (1 << 26), 2122002462),
- GUILEFUL(1801300, (1 << 27), -1378972677),
- BALEFUL(1801600, -1, 1323012132),
- ARCANE(1801900, (1 << 30), 1323888676),
- WOUNDING(1802200, (1 << 10), 1357392095),
- WEARYING(1802500, (1 << 10), 1350838495),
- CONFUSING(1802800, (1 << 10), 1358702815),
- CHILLING(1803100, (1 << 1), 1332155165),
- SEARING(1803400, (1 << 2), -1401744610),
- THUNDERING(1803700, (1 << 3), -443544829),
- UNHOLY(1804000, (1 << 4), 1330320167),
- BEFUDDLING(1804300, (1 << 5), 1489317547),
- WRATHFUL(1804600, (1 << 6), 165160210),
- SPITEFUL(1804900, (1 << 7), 1238906779),
- ENFEEBLING(1805200, (1 << 8), -908578401),
- CONFOUNDING(1805500, (1 << 9), 165165842),
- DISTRACTING(1805800, (1 << 10), 1238906697),
- WOLFPACK(1806100, (1 << 4), 416932375);
-
- private final int blueprintUUID;
- private final int effectFlag;
- private final int token;
-
- SpireType(int blueprint, int flag, int token) {
- this.blueprintUUID = blueprint;
- this.effectFlag = flag;
- this.token = token;
- }
-
- public static SpireType getByBlueprintUUID(int uuid) {
-
- SpireType outType = SpireType.GROUNDING;
-
- for (SpireType spireType : SpireType.values()) {
-
- if (spireType.blueprintUUID == uuid) {
- outType = spireType;
- return outType;
- }
-
- }
-
- return outType;
- }
-
- public int getBlueprintUUID() {
- return blueprintUUID;
- }
-
- public int getEffectFlag() {
- return effectFlag;
- }
-
- public int getToken() {
- return token;
- }
-
- public EffectsBase getEffectBase() {
- return PowersManager.getEffectByToken(token);
- }
-
- }
-
- public enum TransactionType {
- MAINTENANCE(43),
- WITHDRAWL(80),
- DEPOSIT(82),
- MINE(81),
- MIGRATION(83),
- PLAYERREWARD(84),
- TAXRESOURCE(85),
- TAXRESOURCEDEPOSIT(86);
-
- private final int ID;
-
- TransactionType(int ID) {
- this.ID = ID;
- }
-
- public int getID() {
- return ID;
- }
- }
-
- public enum TargetColor {
-
- White,
- Green,
- Cyan,
- Blue,
- Yellow,
- Orange,
- Red;
-
- public static TargetColor getCon(AbstractCharacter source,
- AbstractCharacter target) {
- return getCon(source.getLevel(), target.getLevel());
- }
-
- public static TargetColor getCon(short sourceLevel, short targetLevel) {
- if (targetLevel > (sourceLevel + 2))
- return Red;
- else if (targetLevel == (sourceLevel + 2))
- return Orange;
- else if (targetLevel == (sourceLevel + 1))
- return Yellow;
-
- short lowestBlue = (short) (sourceLevel - (((sourceLevel / 5)) + 2));
-
- if (lowestBlue <= targetLevel)
- return Blue;
- else if (lowestBlue - 1 <= targetLevel)
- return Cyan;
- else if (lowestBlue - 2 <= targetLevel)
- return Green;
- return White;
- }
- }
-
- public enum DamageType {
- None,
- Crush,
- Slash,
- Siege,
- Pierce,
- Magic,
- Bleed,
- Poison,
- Mental,
- Holy,
- Unholy,
- Lightning,
- Fire,
- Cold,
- Healing,
- Acid,
- Disease,
- Unknown,
- // these added for immunities
- Attack,
- Powers,
- Combat,
- Spires,
- Snare,
- Stun,
- Blind,
- Root,
- Fear,
- Charm,
- PowerBlock,
- DeBuff,
- Powerblock,
- Steel,
- Drain;
-
- public static DamageType GetDamageType(String modName) {
- DamageType damageType;
- if (modName.isEmpty())
- return DamageType.None;
-
- try {
- damageType = DamageType.valueOf(modName.replace(",", ""));
- } catch (Exception e) {
- Logger.error(e);
- return DamageType.None;
- }
- return damageType;
- }
- }
-
-
- public enum SourceType {
- None,
- Abjuration,
- Acid,
- AntiSiege,
- Archery,
- Axe,
- Bardsong,
- Beastcraft,
- Benediction,
- BladeWeaving,
- Bleed,
- Blind,
- Block,
- Bloodcraft,
- Bow,
- Buff,
- Channeling,
- Charm,
- Cold,
- COLD,
- Constitution,
- Corruption,
- Crossbow,
- Crush,
- Dagger,
- DaggerMastery,
- DeBuff,
- Dexterity,
- Disease,
- Dodge,
- Dragon,
- Drain,
- Earth,
- Effect,
- Exorcism,
- Fear,
- Fire,
- FIRE,
- Fly,
- Giant,
- GreatAxeMastery,
- GreatSwordMastery,
- Hammer,
- Heal,
- Healing,
- Holy,
- HOLY,
- ImmuneToAttack,
- ImmuneToPowers,
- Intelligence,
- Invisible,
- Lightning,
- LIGHTNING,
- Liturgy,
- Magic,
- MAGIC,
- Mental,
- MENTAL,
- NatureLore,
- Necromancy,
- Parry,
- Pierce,
- Poison,
- POISON,
- PoleArm,
- Powerblock,
- Rat,
- ResistDeBuff,
- Restoration,
- Root,
- Shadowmastery,
- Siege,
- Slash,
- Snare,
- Sorcery,
- Spear,
- SpearMastery,
- Spirit,
- Staff,
- Stormcalling,
- Strength,
- Stun,
- Summon,
- Sword,
- SwordMastery,
- Thaumaturgy,
- Theurgy,
- Transform,
- UnarmedCombat,
- UnarmedCombatMastery,
- Unholy,
- UNHOLY,
- Unknown,
- Warding,
- Warlockry,
- WayoftheGaana,
- WearArmorHeavy,
- WearArmorLight,
- WearArmorMedium,
- Wereform,
- Athletics,
- AxeMastery,
- Bargaining,
- BladeMastery,
- FlameCalling,
- GreatHammerMastery,
- HammerMastery,
- Leadership,
- PoleArmMastery,
- Running,
- StaffMastery,
- Throwing,
- Toughness,
- WayoftheWolf,
- WayoftheRat,
- WayoftheBear,
- Orthanatos,
- SunDancing,
- //Power categories.
- AE,
- AEDAMAGE,
- BEHAVIOR,
- BLESSING,
- BOONCLASS,
- BOONRACE,
- BREAKFLY,
- BUFF,
- CHANT,
- DAMAGE,
- DEBUFF,
- DISPEL,
- FLIGHT,
- GROUPBUFF,
- GROUPHEAL,
- HEAL,
- INVIS,
- MOVE,
- RECALL,
- SPECIAL,
- SPIREDISABLE,
- SPIREPROOFTELEPORT,
- STANCE,
- STUN,
- SUMMON,
- TELEPORT,
- THIEF,
- TRACK,
- TRANSFORM,
- VAMPDRAIN,
- WEAPON,
- Wizardry;
-
- public static SourceType GetSourceType(String modName) {
- SourceType returnMod;
- if (modName.isEmpty())
- return SourceType.None;
-
- try {
- returnMod = SourceType.valueOf(modName.replace(",", ""));
- } catch (Exception e) {
- Logger.error(modName);
- Logger.error(e);
- return SourceType.None;
- }
- return returnMod;
- }
- }
-
- public enum EffectSourceType {
- None,
- AttackSpeedBuff,
- Bleeding,
- Blind,
- Buff,
- Chant,
- Charm,
- Cold,
- Combat,
- ConstitutionBuff,
- Crush,
- DamageShield,
- DeathShroud,
- DeBuff,
- Disease,
- Drain,
- Earth,
- Effect,
- Fear,
- Fire,
- Flight,
- Fortitude,
- Heal,
- Holy,
- Invisibility,
- Invulnerability,
- Lightning,
- Magic,
- Mental,
- Multielement,
- PetBuff,
- Pierce,
- Poison,
- Powerblock,
- RecoveryManaBuff,
- ResistDeBuff,
- Root,
- Siege,
- SiegeBuff,
- SiegeDamage,
- Silence,
- Slash,
- Snare,
- Stance,
- Stun,
- Summon,
- Transform,
- Unholy,
- Wereform,
- WereformATRBuff,
- WereformConBuff,
- WereformDexBuff,
- WereformHPRecBuff,
- WereformMoveBuff,
- WereformPhysResBuff,
- WereformSPRecBuff,
- WereformStrBuff;
-
- public static EffectSourceType GetEffectSourceType(String modName) {
- EffectSourceType returnMod;
- if (modName.isEmpty())
- return EffectSourceType.None;
-
- try {
- returnMod = EffectSourceType.valueOf(modName.replace(",", ""));
- } catch (Exception e) {
- Logger.error(e);
- return EffectSourceType.None;
- }
- return returnMod;
- }
- }
-
- public enum StackType {
- None,
- AggRangeDeBuff,
- ArcheryPrecisionBuff,
- AttackDebuff,
- AttackSpeedBuff,
- AttackSpeedDeBuff,
- AttackValueBuff,
- AttackValueDebuff,
- AttrCONBuff,
- AttrCONDebuff,
- AttrDEXBuff,
- AttrINTBuff,
- AttrSPRBuff,
- AttrSTRBuff,
- Bleeding,
- Blindness,
- BluntResistanceDebuff,
- BMHealing,
- Charm,
- ClassBoon,
- Confusion,
- DamageAbsorber,
- DamageDebuff,
- DamageModifierBuff,
- DamageShield,
- DeathShroud,
- DefenseBuff,
- DefenseBuffGroup,
- DefenseDebuff,
- DetectInvis,
- DrainImmunity,
- ElementalDeBuff,
- EnchantWeapon,
- Fear,
- Flight,
- Frenzy,
- GroupHeal,
- HealingBuff,
- HealOverTime,
- HealResBuff,
- HealthPotion,
- IgnoreStack,
- Invisible,
- ManaPotion,
- MangonelFire,
- MeleeDamageDeBuff,
- MeleeDeBuff,
- MoveBuff,
- MoveDebuff,
- NoFear,
- NoPassiveDefense,
- NoPowerBlock,
- NoPowerInhibitor,
- NoRecall,
- NoSnare,
- NoStun,
- NoTrack,
- PassiveDefense,
- PersAttrSPRBuff,
- PetBuff,
- PierceResistanceDebuff,
- PoisonBuchinine,
- PoisonGalpa,
- PoisonGorgonsVenom,
- PoisonMagusbane,
- PoisonPellegorn,
- PowerBlock,
- PowerCostBuff,
- PowerDamageModifierBuff,
- PowerInhibitor,
- PrecisionBuff,
- Protection,
- RaceBoon,
- RecoveryHealthBuff,
- RecoveryHealthDeBuff,
- RecoveryManaBuff,
- RecoveryManaDeBuff,
- RecoveryStaminaBuff,
- RecoveryStaminaDeBuff,
- ResistanceBuff,
- ResistanceDeBuff,
- ResistanceDebuff,
- Root,
- SafeMode,
- SelfOneAttrBuff,
- SelfThreeAttrBuff,
- SelfTwoAttrBuff,
- SiegeDebuff,
- SiegeWeaponBuff,
- Silence,
- SkillDebuff,
- SlashResistanceDebuff,
- Snare,
- StackableAttrCONBuff,
- StackableAttrDEXBuff,
- StackableAttrSTRBuff,
- StackableDefenseBuff,
- StackableRecoveryHealthBuff,
- StackableRecoveryStaminaBuff,
- StaminaPotion,
- StanceA,
- StanceB,
- Stun,
- Track,
- Transform,
- WeaponMove;
-
- public static StackType GetStackType(String modName) {
- StackType stackType;
- if (modName.isEmpty())
- return StackType.None;
-
- try {
- stackType = StackType.valueOf(modName.replace(",", ""));
- } catch (Exception e) {
- Logger.error(modName);
- Logger.error(e);
- return StackType.None;
- }
- return stackType;
- }
- }
-
- public enum ModType {
- None,
- AdjustAboveDmgCap,
- Ambidexterity,
- AnimOverride,
- ArmorPiercing,
- AttackDelay,
- Attr,
- BlackMantle,
- BladeTrails,
- Block,
- BlockedPowerType,
- CannotAttack,
- CannotCast,
- CannotMove,
- CannotTrack,
- Charmed,
- ConstrainedAmbidexterity,
- DamageCap,
- DamageShield,
- DCV,
- Dodge,
- DR,
- Durability,
- ExclusiveDamageCap,
- Fade,
- Fly,
- Health,
- HealthFull,
- HealthRecoverRate,
- IgnoreDamageCap,
- IgnorePassiveDefense,
- ImmuneTo,
- ImmuneToAttack,
- ImmuneToPowers,
- Invisible,
- ItemName,
- Mana,
- ManaFull,
- ManaRecoverRate,
- MaxDamage,
- MeleeDamageModifier,
- MinDamage,
- NoMod,
- OCV,
- Parry,
- PassiveDefense,
- PowerCost,
- PowerCostHealth,
- PowerDamageModifier,
- ProtectionFrom,
- Resistance,
- ScaleHeight,
- ScaleWidth,
- ScanRange,
- SeeInvisible,
- Silenced,
- Skill,
- Slay,
- Speed,
- SpireBlock,
- Stamina,
- StaminaFull,
- StaminaRecoverRate,
- Stunned,
- Value,
- WeaponProc,
- WeaponRange,
- WeaponSpeed;
-
- public static ModType GetModType(String modName) {
- ModType modType;
- if (modName.isEmpty())
- return ModType.None;
-
- try {
- modType = ModType.valueOf(modName.replace(",", ""));
- } catch (Exception e) {
- Logger.error(e);
- return ModType.None;
- }
- return modType;
- }
- }
-
- public enum MovementState {
-
- IDLE,
- SITTING,
- RUNNING,
- FLYING,
- SWIMMING;
- }
-
- public enum DoorState {
-
- OPEN,
- CLOSED,
- LOCKED,
- UNLOCKED;
- }
-
- // Used with stored procedure GET_UID_ENUM() for
- // type tests against objects not yet loaded into the game.
- public enum DbObjectType {
-
- INVALID,
- ACCOUNT,
- BUILDING,
- CHARACTER,
- CITY,
- CONTAINER,
- GUILD,
- ITEM,
- MINE,
- MOB,
- NPC,
- SHRINE,
- WORLDSERVER,
- ZONE,
- WAREHOUSE;
- }
-
- ;
-
- /**
- * Enumeration of Building Protection Status stored in the database as a
- * mysql enumfield. WARNING: This enumeration is fragile. Do not rename. Do
- * not reorder.
- */
- public enum ProtectionState {
-
- NONE,
- PROTECTED,
- UNDERSIEGE,
- CEASEFIRE,
- CONTRACT,
- DESTROYED,
- PENDING,
- NPC;
- }
-
- ;
-
- public enum CharacterSkills {
-
- Archery((1L << 1), -529201545, 20),
- Athletics((1L << 2), -327713877, 15),
- AxeMastery((1L << 3), 1103042709, 20),
- Axe((1L << 4), 73505, 1),
- Bardsong((1L << 5), 454246953, 10),
- Bargaining((1L << 6), 372927577, 10),
- Beastcraft((1L << 7), 56772766, 10),
- Benediction((1L << 8), 1464998706, 1),
- BladeMastery((1L << 9), -59908956, 20),
- BladeWeaving((1L << 10), -1839362429, 20),
- Block((1L << 11), 76592546, 3),
- Bow((1L << 12), 87490, 1),
- Channeling((1L << 13), -1899060872, 20),
- Crossbow((1L << 14), 1092138184, 1),
- DaggerMastery((1L << 15), -1549224741, 20),
- Dagger((1L << 16), -1603103740, 1),
- Dodge((1L << 17), 74619332, 5),
- FlameCalling((1L << 18), -1839578206, 20),
- GreatAxeMastery((1L << 19), 1427003458, 20),
- GreatHammerMastery((1L << 20), -309659310, 20),
- GreatSwordMastery((1L << 21), 2054956946, 20),
- HammerMastery((1L << 22), -1548903209, 20),
- Hammer((1L << 23), -1602765816, 1),
- Leadership((1L << 24), 1618560984, 20),
- Liturgy((1L << 25), -888415974, 10),
- NatureLore((1L << 26), -1911171474, 10),
- Parry((1L << 27), 95961104, 5),
- PoleArmMastery((1L << 28), -1432303709, 20),
- PoleArm((1L << 29), -1037845588, 1),
- Restoration((1L << 30), -504697054, 1),
- Running((1L << 31), 1488335491, 10),
- Shadowmastery((1L << 32), 1389222957, 10),
- Sorcery((1L << 33), -529481275, 1),
- SpearMastery((1L << 34), -48279755, 20),
- Spear((1L << 35), 83992115, 1),
- StaffMastery((1L << 36), -61022283, 20),
- Staff((1L << 37), 71438003, 1),
- Stormcalling((1L << 38), -532064061, 10),
- SwordMastery((1L << 39), -59316267, 20),
- Sword((1L << 40), 73938643, 1),
- Thaumaturgy((1L << 41), -2020131447, 10),
- Theurgy((1L << 42), -888431326, 10),
- Throwing((1L << 43), 391562015, 20),
- Toughness((1L << 44), -660435875, 10),
- UnarmedCombatMastery((1L << 45), 1692733771, 20),
- UnarmedCombat((1L << 46), -1094332856, 1),
- Warding((1L << 47), 1488142342, 1),
- Warlockry((1L << 48), 1121393557, 10),
- WayoftheGaana((1L << 49), -1954832975, 10),
- WearArmorHeavy((1L << 50), 1112121635, 15),
- WearArmorLight((1L << 51), 38031547, 1),
- WearArmorMedium((1L << 52), 468015203, 5),
- Wizardry((1L << 53), 218227659, 10),
- Corruption((1L << 54), -1519268706, 10),
- Abjuration((1L << 55), -2029900484, 10),
- WayoftheWolf((1L << 56), 1668913067, 20),
- WayoftheRat((1L << 57), -2114353637, 20),
- WayoftheBear((1L << 58), -906390863, 20),
- Orthanatos((1L << 59), -666929185, 20),
- Bloodcraft((1L << 60), 40661438, 10),
- Exorcism((1L << 61), 1444427097, 10),
- Necromancy((1L << 62), -556571154, 10),
- SunDancing((1L << 63), 22329752, 20);
-
- private long flag;
- private int token;
- private int reqLvl;
-
- CharacterSkills(long flag, int token, int reqLvl) {
- this.flag = flag;
- this.token = token;
- this.reqLvl = reqLvl;
- }
-
- public static CharacterSkills GetCharacterSkillByToken(int token) {
- for (CharacterSkills skill : CharacterSkills.values()) {
- if (skill.token == token)
- return skill;
- }
-
- Logger.info("Returned No Skill for token " + token + ". Defaulting to Axe");
- return CharacterSkills.Axe;
- }
-
- public long getFlag() {
- return flag;
- }
-
- public void setFlag(long flag) {
- this.flag = flag;
- }
-
- public int getReqLvl() {
- return this.reqLvl;
- }
-
- public int getToken() {
- return token;
- }
-
- public void setToken(int token) {
- this.token = token;
- }
- }
-
- ;
-
- public enum GuildHistoryType {
- JOIN(1),
- LEAVE(4),
- BANISHED(3),
- CREATE(7),
- DISBAND(5);
- private final int type;
-
- GuildHistoryType(int type) {
- this.type = type;
- }
-
- public int getType() {
- return type;
- }
- }
-
- public enum SexType {
- NONE,
- MALE,
- FEMALE;
- }
-
- public enum ClassType {
- FIGHTER,
- HEALER,
- ROGUE,
- MAGE;
- }
-
- public enum PromoteType {
- Assassin(SexType.NONE),
- Barbarian(SexType.NONE),
- Bard(SexType.NONE),
- Channeler(SexType.NONE),
- Confessor(SexType.NONE),
- Crusader(SexType.NONE),
- Doomsayer(SexType.NONE),
- Druid(SexType.NONE),
- Fury(SexType.FEMALE),
- Huntress(SexType.FEMALE),
- Prelate(SexType.NONE),
- Priest(SexType.NONE),
- Ranger(SexType.NONE),
- Scout(SexType.NONE),
- Sentinel(SexType.NONE),
- Templar(SexType.NONE),
- Thief(SexType.NONE),
- Warlock(SexType.MALE),
- Warrior(SexType.NONE),
- Wizard(SexType.NONE),
- Nightstalker(SexType.NONE),
- Necromancer(SexType.NONE),
- ;
-
- private SexType sexRestriction;
-
- PromoteType(SexType sexRestriction) {
- this.sexRestriction = sexRestriction;
- }
-
- public SexType getSexRestriction() {
- return sexRestriction;
- }
- }
-
- public enum ShrineType {
-
- Aelfborn(1701900, -75506007, true),
- Aracoix(1703100, -563708986, true),
- Centaur(1704000, 521645243, true),
- Dwarf(1708500, -2000467257, true),
- Elf(1703400, 1254603001, true),
- HalfGiant(1709100, 349844468, true),
- Human(1702200, 281172391, true),
- Irekei(1702800, -764988442, true),
- Minotaur(1704600, 549787579, true),
- Nephilim(1701000, -655183799, true),
- Shade(1700100, 1724071104, true),
- Assassin(1700400, 1989015892, false),
- Barbarian(1708800, 9157124, false),
- Bard(1704300, 80190554, false),
- Channeler(1702500, 5658278, false),
- Confessor(1707600, 1871658719, false),
- Crusader(1706700, -187454619, false),
- Doomsayer(1700700, -993659433, false),
- Druid(1701600, -926740122, false),
- Fury(1705500, 214401375, false),
- Huntress(1704900, 970312892, false),
- Prelate(1707000, -225200922, false),
- Priest(1705200, -535691898, false),
- Ranger(1701300, 604716986, false),
- Scout(1706100, -1497297486, false),
- Sentinel(1707300, -184898375, false),
- Templar(1707900, 826673315, false),
- Thief(1708200, 1757633920, false),
- Warlock(1706400, 1003385946, false),
- Warrior(1703700, 931048026, false),
- Wizard(1705800, 777115928, false),
- Nightstalker(1709400, 373174890, false),
- Necromancer(1709700, -319294505, false),
- Vampire(1710000, 1049274530, true);
-
- private final int blueprintUUID;
- private final int powerToken;
- private final ArrayList shrines = new ArrayList<>();
- private final boolean isRace;
-
- ShrineType(int blueprintUUID, int powerToken, boolean isRace) {
- this.blueprintUUID = blueprintUUID;
- this.powerToken = powerToken;
- this.isRace = isRace;
-
- }
-
- public int getBlueprintUUID() {
- return blueprintUUID;
- }
-
- public int getPowerToken() {
- return powerToken;
- }
-
- public ArrayList getShrinesCopy() {
- ArrayList copyShrines = new ArrayList<>();
- copyShrines.addAll(shrines);
- Collections.sort(copyShrines);
- return copyShrines;
- }
-
- public final void addShrineToServerList(Shrine shrine) {
- synchronized (shrines) {
- shrines.add(shrine);
- }
- }
-
- public final void RemoveShrineFromServerList(Shrine shrine) {
- synchronized (shrines) {
- shrines.remove(shrine);
- }
- }
-
- public boolean isRace() {
- return isRace;
- }
- }
-
- public enum GuildState {
-
- Errant(0),
- Sworn(4),
- Protectorate(6),
- Petitioner(2),
- Province(8),
- Nation(5),
- Sovereign(7);
-
- private final int stateID;
-
- GuildState(int stateID) {
- this.stateID = stateID;
- }
-
- public int getStateID() {
- return stateID;
- }
-
- }
-
-
- // Building group enumeration.
- // This is used to drive linear equations to calculate
- // structure hp, ranking times and such from within
- // the BuildingBlueprint class.
- //
- // It is also used as a bitvector flag in the npc
- // building slot mechanics.
-
- public enum BuildingGroup implements EnumBitSetHelper {
- NONE(0, 0),
- TOL(64f, 64f),
- BARRACK(32f, 64f),
- CHURCH(64f, 64f),
- FORGE(32f, 64f),
- SPIRE(16f, 16f),
- GENERICNOUPGRADE(16f, 16f),
- WALLSTRAIGHT(16f, 64),
- WALLCORNER(64f, 64f),
- SMALLGATE(64f, 64),
- ARTYTOWER(64f, 64),
- SIEGETENT(32f, 32f),
- BANESTONE(16f, 16f),
- MINE(16f, 16f),
- WAREHOUSE(32f, 32f),
- SHRINE(16f, 16f),
- RUNEGATE(64f, 64f),
- AMAZONHALL(64f, 64f),
- CATHEDRAL(64f, 64f),
- GREATHALL(64f, 64f),
- KEEP(64f, 64f),
- THIEFHALL(64f, 24f),
- TEMPLEHALL(64f, 64f),
- WIZARDHALL(64f, 64f),
- ELVENHALL(64f, 64f),
- ELVENSANCTUM(64f, 64f),
- IREKEIHALL(64f, 64f),
- FORESTHALL(64f, 64f),
- MAGICSHOP(32f, 32f),
- BULWARK(32f, 32f),
- SHACK(16f, 16f),
- INN(64f, 32f),
- TAILOR(32f, 32f),
- VILLA(64f, 32f),
- ESTATE(64f, 64f),
- FORTRESS(64f, 64f),
- CITADEL(64f, 64f),
- WALLSTRAIGHTTOWER(16f, 64),
- WALLSTAIRS(64, 64);
-
- private final Vector2f extents;
-
- BuildingGroup(float extentX, float extentY) {
- this.extents = new Vector2f(extentX, extentY);
- }
-
- public Vector2f getExtents() {
- return extents;
- }
-
- }
-
- public enum UpdateType {
- ALL,
- MOVEMENT,
- REGEN,
- FLIGHT,
- LOCATION,
- MOVEMENTSTATE;
- }
-
- public enum ServerType {
- WORLDSERVER,
- LOGINSERVER,
- NONE;
- }
-
- public enum ChatChannel implements EnumBitSetHelper {
- System,
- Announce,
- Unknown,
- Commander,
- Address,
- Nation,
- Leader,
- Shout,
- Siege,
- Territory,
- Info,
- CSR,
- Guild,
- InnerCouncil,
- Group,
- City,
- Say,
- Emote,
- Social,
- Tell,
- Combat,
- Powers,
- Snoop,
- Debug,
- Global,
- Trade,
- PVP,
- Mine,
- Alert,
- Assassin,
- Barbarian,
- Bard,
- Channeler,
- Confessor,
- Crusader,
- Doomsayer,
- Druid,
- Fury,
- Huntress,
- Necromancer,
- Nightstalker,
- Prelate,
- Priest,
- Ranger,
- Scout,
- Sentinel,
- Templar,
- Thief,
- Warlock,
- Warrior,
- Wizard;
-
- }
-
- public enum AllianceType {
- RecommendedAlly,
- RecommendedEnemy,
- Ally,
- Enemy;
- }
-
- public enum FriendStatus {
- Available,
- Away,
- Busy;
- }
-
- public enum ProfitType {
-
-
- BuyNormal("buy_normal"),
- BuyGuild("buy_guild"),
- BuyNation("buy_nation"),
- SellNormal("sell_normal"),
- SellGuild("sell_guild"),
- SellNation("sell_nation");
-
- public String dbField;
-
- private ProfitType(String dbField) {
- this.dbField = dbField;
- }
- }
-
- public enum GameObjectType {
-
- /*
- * These will be used as the 4 high bytes in the application protocol's
- * long CompositeID field and when tracking an AbstractGameObject's type
- * from within the code. The low 4 bytes will be used as the Object's
- * UUID
- */
- unknown,
- Account,
- AccountIP,
- ActiveEffect,
- ArmorBase,
- BaseClass,
- BeardStyle,
- BlockedIP,
- Building,
- BuildingLocation,
- BuildingModelBase,
- CharacterPower,
- CharacterPowers,
- CharacterRune,
- CharacterSkill,
- City,
- Contract,
- Corpse,
- CSSession,
- EffectsResourceCosts,
- EnchantmentBase,
- GenericItemBase,
- Group,
- Guild,
- GuildAllianceEnemy,
- GuildBanish,
- GuildCharacterKOS,
- GuildGuildKOS,
- GuildTableList,
- HairStyle,
- Item,
- ItemContainer,
- ItemEnchantment,
- JewelryBase,
- Kit,
- MenuOption,
- Mine,
- Mob,
- MobBase,
- MobEquipment,
- MobLoot,
- MobType,
- NPC,
- NPCClassRune,
- NPCClassRuneThree,
- NPCClassRuneTwo,
- NPCExtraRune,
- NPCRaceRune,
- NPCRune,
- NPCShopkeeperRune,
- NPCTrainerRune,
- Nation,
- PlayerCharacter,
- PlayerInfo,
- PowerGrant,
- PowerReq,
- PowersBase,
- PowersBaseAttribute,
- PromotionClass,
- Race,
- RuneBase,
- RuneBaseAttribute,
- RuneBaseEffect,
- SkillReq,
- SkillsBase,
- SkillsBaseAttribute,
- MobileBooty,
- StrongBox,
- Trigger,
- ValidRaceBeardStyle,
- ValidRaceClassCombo,
- ValidRaceHairStyle,
- VendorDialog,
- Warehouse,
- WeaponBase,
- WorldServerInfo,
- WorldServerInfoSnapshot,
- Shrine,
- Zone,
- Transaction;
- }
-
- public enum ContainerType {
- BANK,
- INVENTORY,
- VAULT;
- }
-
- ;
-
- public enum CompoundCurveType {
- DefaultFlat(0),
- DefaultSlope(1),
- DefaultSlopeDown(-1),
- SL0001Up(0.01),
- SL0003Up(0.03),
- SL0005Up(0.05),
- SL0006Up(0.06),
- SL0007Up(0.07),
- SL0008Up(0.08),
- SL0010Up(0.10),
- SL0011Up(0.11),
- SL0012Up(0.12),
- SL0013Up(0.13),
- SL0014Up(0.14),
- SL00143U(0.143),
- SL0015Up(0.15),
- SL0016Up(0.16),
- SL0019Up(0.19),
- SL0020Up(0.20),
- SL0021Up(0.21),
- SL0022Up(0.22),
- SL0023Up(0.23),
- SL0024Up(0.24),
- SL0025Up(0.25),
- SL0026Up(0.26),
- SL0028Up(0.28),
- SL0030Up(0.30),
- SL0031Up(0.31),
- SL0032Up(0.32),
- SL0033Up(0.33),
- SL0034Up(0.34),
- SL0035Up(0.35),
- SL0037Up(0.37),
- SL0038Up(0.38),
- SL0039Up(0.39),
- SL0040Up(0.40),
- SL0041Up(0.41),
- SL0042Up(0.42),
- SL0043Up(0.43),
- SL0044Up(0.44),
- SL0045Up(0.45),
- SL0046Up(0.46),
- SL0047Up(0.47),
- SL0048Up(0.48),
- SL0050Up(0.50),
- SL0051Up(0.51),
- SL0053Up(0.53),
- SL0054Up(0.54),
- SL0055Up(0.55),
- SL0056Up(0.56),
- SL0057Up(0.57),
- SL0058Up(0.58),
- SL0060Up(0.60),
- SL0061Up(0.61),
- SL0063Up(0.63),
- SL0064Up(0.64),
- SL0065Up(0.65),
- SL0066Up(0.66),
- SL0067Up(0.67),
- SL0068Up(0.68),
- SL0069Up(0.69),
- SL0070Up(0.70),
- SL0071Up(0.71),
- SL0073Up(0.73),
- SL0074Up(0.74),
- SL0075Up(0.75),
- SL0076Up(0.76),
- SL0077Up(0.77),
- SL0079Up(0.79),
- SL0080Up(0.80),
- SL0081Up(0.81),
- SL0082Up(0.82),
- SL0083Up(0.83),
- SL0084Up(0.84),
- SL0085Up(0.85),
- SL0087Up(0.87),
- SL0088Up(0.88),
- SL0089Up(0.89),
- SL0090Up(0.90),
- SL0092Up(0.92),
- SL0098Up(0.98),
- SL0100Up(1.00),
- SL0106Up(1.06),
- SL0109Up(1.09),
- SL0112Up(1.12),
- SL0113Up(1.13),
- SL0115Up(1.15),
- SL0116Up(1.16),
- SL0122Up(1.22),
- SL0123Up(1.23),
- SL0125Up(1.25),
- SL0128Up(1.28),
- SL0130Up(1.30),
- SL0135Up(1.35),
- SL0140Up(1.40),
- SL0143Up(1.43),
- SL0145Up(1.45),
- SL0150Up(1.50),
- SL0154Up(1.54),
- SL0163Up(1.63),
- SL0166Up(1.66),
- SL0175Up(1.75),
- SL0188Up(1.88),
- SL0190Up(1.90),
- SL0200Up(2.00),
- SL0222Up(2.22),
- SL0225Up(2.25),
- SL0235Up(2.35),
- SL0238Up(2.38),
- SL0250Up(2.50),
- SL0260Up(2.60),
- SL0263Up(2.63),
- SL0275Up(2.75),
- SL0280Up(2.80),
- SL0300Up(3.00),
- SL0308Up(3.08),
- SL0312Up(3.12),
- SL0350Up(3.50),
- SL0357Up(3.57),
- SL0360Up(3.60),
- SL0375Up(3.75),
- SL0380Up(3.80),
- SL0385Up(3.85),
- SL0400Up(4.00),
- SL0410Up(4.10),
- SL0429Up(4.29),
- SL0450Up(4.50),
- SL0460Up(4.60),
- SL0480Up(4.80),
- SL0500Up(5.00),
- SL0510Up(5.10),
- SL0550Up(5.50),
- SL0600Up(6.00),
- SL0643Up(6.43),
- SL0714Up(7.14),
- SL0750Up(7.50),
- SL0790Up(7.90),
- SL0800Up(8.00),
- SL0900Up(9.00),
- SL1000Up(10.00),
- SL1050Up(10.50),
- SL1100Up(11.00),
- SL1125Up(11.25),
- SL1200Up(12.00),
- SL1282Up(12.82),
- SL1300Up(13.00),
- SL1350Up(13.50),
- SL1400Up(14.00),
- SL1500Up(15.00),
- SL1579Up(15.79),
- SL2000Up(20.00),
- SL2100Up(21.00),
- SL2500Up(25.00),
- SL2521Up(25.21),
- SL3000Up(30.00),
- SL4000Up(40.00),
- SL5000Up(50.00),
- SL6000Up(60.00),
- SL7500Up(75.00),
- SL8000Up(80.00),
- SL12000Up(120.00),
- SL14000Up(140.00),
- SL30000Up(300.00),
- SL66600Up(666.00),
- SL71500Up(715.00),
- SL00003Down(-0.003),
- SL0001Down(-0.01),
- SL0003Down(-0.03),
- SL0004Down(-0.04),
- SL0005Down(-0.05),
- SL0006Down(-0.06),
- SL0007Down(-0.07),
- SL00075Down(-0.075),
- SL0008Down(-0.08),
- SL0009Down(-0.09),
- SL0010Down(-0.10),
- SL0011Down(-0.11),
- SL0012Down(-0.12),
- SL0013Down(-0.13),
- SL00125Down(-0.125),
- SL0014Down(-0.14),
- SL0015Down(-0.15),
- SL0016Down(-0.16),
- SL0017Down(-0.17),
- SL00175Down(-0.175),
- SL0018Down(-0.18),
- SL0019Down(-0.19),
- SL0020Down(-0.20),
- SL0023Down(-0.23),
- SL0024Down(-0.24),
- SL0025Down(-0.25),
- SL0027Down(-0.27),
- SL0028Down(-0.28),
- SL0029Down(-0.29),
- SL0030Down(-0.30),
- SL0032Down(-0.32),
- SL0033Down(-0.33),
- SL0035Down(-0.35),
- SL0038Down(-0.38),
- SL0040Down(-0.40),
- SL0044Down(-0.44),
- SL0045Down(-0.45),
- SL0050Down(-0.50),
- SL0055Down(-0.55),
- SL0060Down(-0.60),
- SL0062Down(-0.62),
- SL0063Down(-0.63),
- SL0064Down(-0.64),
- SL0066Down(-0.66),
- SL0069Down(-0.69),
- SL0071Down(-0.71),
- SL0075Down(-0.75),
- SL0077Down(-0.77),
- SL0079Down(-0.79),
- SL0080Down(-0.80),
- SL0090Down(-0.90),
- SL0100Down(-1.00),
- SL0113Down(-1.13),
- SL0120Down(-1.20),
- SL0125Down(-1.25),
- SL0128Down(-1.28),
- SL0130Down(-1.30),
- SL0135Down(-1.35),
- SL0150Down(-1.50),
- SL0175Down(-1.75),
- SL0188Down(-1.88),
- SL0200Down(-2.00),
- SL0225Down(-2.25),
- SL0250Down(-2.50),
- SL0263Down(-2.63),
- SL0300Down(-3.00),
- SL0357Down(-3.57),
- SL0385Down(-3.85),
- SL0429Down(-4.29),
- SL0450Down(-4.50),
- SL0500Down(-5.00),
- SL0550Down(-5.50),
- SL0600Down(-6.00),
- SL0643Down(-6.43),
- SL0714Down(-7.14),
- SL0750Down(-7.50),
- SL0790Down(-7.90),
- SL0800Down(-8.00),
- SL1000Down(-10.00),
- SL1050Down(-10.50),
- SL1200Down(-12.00),
- SL1350Down(-13.50),
- SL1500Down(-15.00),
- SL1579Down(-15.79),
- SL2000Down(-20.00),
- SL2400Down(-24.00),
- SL2500Down(-25.00),
- SL3000Down(-30.00),
- SL4500Down(-45.00),
- SL7500Down(-75.00),
- SIVL0005(0.005),
- SIVL0008(0.008),
- SIVL0009(0.009),
- SIVL0010(0.010),
- SIVL0012(0.012),
- SIVL0013(0.013),
- SIVL0014(0.014),
- SIVL0015(0.015),
- SIVL0016(0.016),
- SIVL0017(0.017),
- SIVL0019(0.019),
- SIVL0020(0.020),
- SIVL0021(0.021),
- SIVL0022(0.022),
- SIVL0023(0.023),
- SIVL0024(0.024),
- SIVL0025(0.025),
- SIVL0026(0.026),
- SIVL0027(0.027),
- SIVL0029(0.029),
- SIVL0030(0.030),
- SIVL0031(0.031),
- SIVL0032(0.032),
- SIVL0033(0.033),
- SIVL0034(0.034),
- SIVL0035(0.035),
- SIVL0036(0.036),
- SIVL0038(0.038),
- SIVL0040(0.040),
- SIVL0044(0.044),
- SIVL0046(0.046),
- SIVL0048(0.048),
- SIVL0055(0.055),
- SIVL0056(0.056),
- SIVL0057(0.057),
- SIVL0058(0.058),
- SIVL0060(0.060),
- SIVL0061(0.061),
- SIVL0066(0.066),
- SIVL0067(0.067),
- SIVL0075(0.075),
- SIVL0078(0.078),
- SIVL0130(0.130),
- SIVL0150(0.150),
- SIVL0205(0.205),
- SIVL0220(0.220),
- SIVL0243(0.243),
- SIVL0360(0.360);
-
- private final double value;
-
- private CompoundCurveType(double value) {
-
- this.value = value;
- }
-
- public double getValue() {
- return value;
- }
- }
-
- public enum PowerFailCondition {
-
- Attack,
- AttackSwing,
- Cast,
- CastSpell,
- EquipChange,
- Logout,
- Move,
- NewCharm,
- Sit,
- TakeDamage,
- TerritoryClaim,
- UnEquip;
- }
-
- public enum PowerSubType {
- Amount,
- Ramp,
- UseAddFormula,
- DamageType1,
- DamageType2,
- DamageType3,
- Cancel;
- }
-
- public enum PowerCategoryType {
- NONE,
- WEAPON,
- BUFF,
- DEBUFF,
- SPECIAL,
- DAMAGE,
- DISPEL,
- INVIS,
- STUN,
- TELEPORT,
- HEAL,
- VAMPDRAIN,
- BLESSING,
- BOONRACE,
- BOONCLASS,
- BEHAVIOR,
- CHANT,
- GROUPBUFF,
- MOVE,
- FLIGHT,
- GROUPHEAL,
- AEDAMAGE,
- BREAKFLY,
- AE,
- TRANSFORM,
- TRACK,
- SUMMON,
- STANCE,
- RECALL,
- SPIREPROOFTELEPORT,
- SPIREDISABLE,
- THIEF;
- }
-
- public enum PowerTargetType {
-
- SELF,
- PCMOBILE,
- PET,
- MOBILE,
- PC,
- WEAPON,
- GUILDLEADER,
- BUILDING,
- GROUP,
- ARMORWEAPONJEWELRY,
- CORPSE,
- JEWELRY,
- WEAPONARMOR,
- ARMOR,
- ITEM;
- }
-
- public enum objectMaskType {
- PLAYER,
- MOB,
- PET,
- CORPSE,
- BUILDING,
- UNDEAD,
- BEAST,
- HUMANOID,
- NPC,
- IAGENT,
- DRAGON,
- RAT,
- SIEGE,
- CITY,
- ZONE;
-
- public static EnumSet AGGRO = EnumSet.of(PLAYER, PET);
- public static EnumSet MOBILE = EnumSet.of(PLAYER, MOB, PET);
- public static EnumSet STATIC = EnumSet.of(CORPSE, BUILDING, NPC);
-
- }
-
- public enum ItemContainerType {
- NONE,
- INVENTORY,
- EQUIPPED,
- BANK,
- VAULT,
- FORGE,
- WAREHOUSE;
- }
-
- public enum ItemSlotType implements EnumBitSetHelper {
- RHELD,
- LHELD,
- HELM,
- CHEST,
- SLEEVES,
- HANDS,
- RRING,
- LRING,
- AMULET,
- LEGS,
- FEET,
- CLOAK,
- SHIN,
- UPLEGS,
- UPARM,
- WINGS,
- BEARD,
- HAIR;
- }
-
- public enum CityBoundsType {
-
- GRID(640),
- ZONE(875),
- PLACEMENT(1050);
-
- public final float extents;
-
- CityBoundsType(float extents) {
- this.extents = extents;
- }
- }
-
- public enum GuildType {
- NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}),
- CATHEDRAL("Church of the All-Father", new String[][]{
- {"Acolyte", "Acolyte"},
- {"Catechist"},
- {"Deacon", "Deaconess"},
- {"Priest", "Priestess"},
- {"High Priest", "High Priestess"},
- {"Bishop", "Bishop"},
- {"Lord Cardinal", "Lady Cardinal"},
- {"Patriarch", "Matriarch"}},
- new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}),
- MILITARY("Military", new String[][]{
- {"Recruit"},
- {"Footman"},
- {"Corporal"},
- {"Sergeant"},
- {"Lieutenant"},
- {"Captain"},
- {"General"},
- {"Lord Marshall", "Lady Marshall"}},
- new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}),
- TEMPLE("Temple of the Cleansing Flame", new String[][]{
- {"Aspirant"},
- {"Novice"},
- {"Initiate"},
- {"Inquisitor"},
- {"Jannisary"},
- {"Tribune"},
- {"Lictor"},
- {"Justiciar"},
- {"Pontifex", "Pontifectrix"}},
- new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}),
- BARBARIAN("Barbarian Clan", new String[][]{
- {"Barbarian"},
- {"Skald"},
- {"Raider"},
- {"Karl"},
- {"Jarl"},
- {"Chieftain"},
- {"Thane"}},
- new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}),
- RANGER("Ranger's Brotherhood", new String[][]{
- {"Yeoman"},
- {"Pathfinder"},
- {"Tracker"},
- {"Seeker"},
- {"Protector"},
- {"Guardian"},
- {"Lord Protector", "Lady Protector"}},
- new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}),
- AMAZON("Amazon Temple", new String[][]{
- {"Amazon Thrall", "Amazon"},
- {"Amazon Slave", "Amazon Warrior"},
- {"Amazon Servant", "Amazon Chieftess"},
- {"Amazon Consort", "Amazon Princess"},
- {"Amazon Seneschal", "Majestrix"},
- {"Amazon Regent", "Imperatrix"}},
- new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}),
- NOBLE("Noble House", new String[][]{
- {"Serf"},
- {"Vassal"},
- {"Exultant"},
- {"Lord", "Lady"},
- {"Baron", "Baroness"},
- {"Count", "Countess"},
- {"Duke", "Duchess"},
- {"King", "Queen"},
- {"Emperor", "Empress"}},
- new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}),
- WIZARD("Wizard's Conclave", new String[][]{
- {"Apprentice"},
- {"Neophyte"},
- {"Adeptus Minor"},
- {"Adeptus Major"},
- {"Magus"},
- {"High Magus"},
- {"Archmagus"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}),
- MERCENARY("Mercenary Company", new String[][]{
- {"Soldier"},
- {"Man-at-Arms"},
- {"Veteran"},
- {"Myrmidon"},
- {"Captain"},
- {"Commander"},
- {"High Commander"},
- {"Warlord"}},
- new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}),
- THIEVES("Thieve's Den", new String[][]{
- {"Urchin"},
- {"Footpad"},
- {"Grifter"},
- {"Burglar"},
- {"Collector"},
- {"Naster Thief"},
- {"Treasurer"},
- {"Grandmaster Thief"},
- {"Grandfather"}},
- new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}),
- DWARF("Dwarf Hold", new String[][]{
- {"Citizen"},
- {"Master"},
- {"Councilor"},
- {"Thane"},
- {"Great Thane"},
- {"High Thane"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
- HIGHCOURT("High Court", new String[][]{
- {"Eccekebe"},
- {"Saedulor"},
- {"Hodrimarth"},
- {"Mandrae"},
- {"Imaelin"},
- {"Thaelostor", "Thaelostril"},
- {"Dar Thaelostor", "Dar Thaelostril"},
- {"Aglaeron"},
- {"Ellestor", "Elestril"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
- VIRAKT("Virakt", new String[][]{
- {"Jov'uus"},
- {"Urikhan"},
- {"Irkhan"},
- {"Khal'usht"},
- {"Arkhalar"},
- {"Khal'uvho"},
- {"Khar'uus"},
- {"Kryqh'khalin"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
- BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names
- {"Devotee"},
- {"Initiated"},
- {"Witch of the First"},
- {"Witch of the Second"},
- {"Witch of the Third"},
- {"Elder"},
- {"Hierophant"},
- {"Witch King", "Witch Queen"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
- UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names
- {"Footman"},
- {"Fell Legionaire"},
- {"Fell Centurion"},
- {"Dark Captain"},
- {"Dark Commander"},
- {"Dark Master", "Dark Mistress"},
- {"Dread Master", "Dread Mistress"},
- {"Dread Lord", "Dread Lady"}},
- new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"}),
- SCOURGE("Cult of the Scourge", new String[][]{
- {"Thrall"},
- {"Mudir"},
- {"Dark Brother", "Dark Sister"},
- {"Hand of the Dark"},
- {"Dark Father", "Dark Mother"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
- PIRATE("Pirate Crew", new String[][]{
- {"Midshipman", "Midshipwoman"},
- {"Sailor"},
- {"Third Mat"},
- {"Second Mat"},
- {"First Mate"},
- {"Captain"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
- HERALD("Academy of Heralds", new String[][]{
- {"Pupil"},
- {"Scribe"},
- {"Recorder"},
- {"Scrivener"},
- {"Chronicler"},
- {"Scholar"},
- {"Archivist"},
- {"Loremaster"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
- CENTAUR("Centaur Cohort", new String[][]{
- {"Hoplite"},
- {"Peltast"},
- {"Myrmidon"},
- {"Myrmidon"},
- {"Cataphract"},
- {"Septenrion"},
- {"Praetorian"},
- {"Paragon"}},
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
- KHREE("Aracoix Kh'ree", new String[][]{
- {"Duriacor"},
- {"Exarch"},
- {"Tetrarch"},
- {"Dimarch"},
- {"Elnarch"},
- {"Illiarch"},
- {"Tellotharch"},
- {"Erentar"},
- {"Araceos"},
- {"Hierarch"}},
-
- new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"});
-
- private final String name;
- private final String[][] ranks; //Stored Rank#->Gender(M,F)
- private final String[] leadershipTypes;
-
- GuildType(String name, String[][] ranks, String[] leadershipTypes) {
- this.name = name;
- this.ranks = ranks;
- this.leadershipTypes = leadershipTypes;
- }
-
- public static GuildType getGuildTypeFromCharter(ItemBase itemBase) {
-
- GuildType charterType;
-
- // Must be a valid charter object
-
- if (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)
- return GuildType.NONE; //No guild Type
-
- // No switches on long in java. Cast to int
- // when refactor to long uuid's. Loss won't matter
- // with values this small.
-
- switch (itemBase.getUUID()) {
-
- case 559:
- charterType = GuildType.CATHEDRAL;
- break;
- case 560:
- charterType = GuildType.MILITARY;
- break;
- case 561:
- charterType = GuildType.TEMPLE;
- break;
- case 562:
- charterType = GuildType.BARBARIAN;
- break;
- case 563:
- charterType = GuildType.RANGER;
- break;
- case 564:
- charterType = GuildType.AMAZON;
- break;
- case 565:
- charterType = GuildType.NOBLE;
- break;
- case 566:
- charterType = GuildType.WIZARD;
- break;
- case 567:
- charterType = GuildType.MERCENARY;
- break;
- case 568:
- charterType = GuildType.THIEVES;
- break;
- case 569:
- charterType = GuildType.DWARF;
- break;
- case 570:
- charterType = GuildType.HIGHCOURT;
- break;
- case 571:
- charterType = GuildType.VIRAKT;
- break;
- case 572:
- charterType = GuildType.SCOURGE;
- break;
- case 573:
- charterType = GuildType.KHREE;
- break;
- case 574:
- charterType = GuildType.CENTAUR;
- break;
- case 575:
- charterType = GuildType.UNHOLY;
- break;
- case 576:
- charterType = GuildType.PIRATE;
- break;
- case 577:
- charterType = GuildType.BRIALIA;
- break;
-
- default:
- charterType = GuildType.HERALD;
- }
-
- return charterType;
- }
-
- public static GuildType getGuildTypeFromInt(int i) {
- return GuildType.values()[i];
- }
-
- public String getCharterName() {
- return this.name;
- }
-
- public int getNumberOfRanks() {
- return ranks.length;
- }
-
- public String getRankForGender(int rank, boolean male) {
- if (ranks.length < rank) {
- return "";
- }
-
- if (ranks[rank].length != 1 && !male) {
- return ranks[rank][1];
- }
- return ranks[rank][0];
- }
-
- public String getLeadershipType(int i) {
- return leadershipTypes[i];
- }
-
- }
-
- public enum MinionClass {
- MELEE,
- ARCHER,
- MAGE;
- }
-
- public enum MinionType {
- AELFBORNGUARD(951, 1637, MinionClass.MELEE, "Guard", "Aelfborn"),
- AELFBORNMAGE(952, 1635, MinionClass.MAGE, "Adept", "Aelfborn"),
- AMAZONGUARD(1500, 1670, MinionClass.MELEE, "Guard", "Amazon"),
- AMAZONMAGE(1502, 1638, MinionClass.MAGE, "Fury", "Amazon"),
- ARACOIXGUARD(1600, 1672, MinionClass.MELEE, "Guard", "Aracoix"), //used guard captain equipset.
- ARACOIXMAGE(1602, 885, MinionClass.MAGE, "Adept", "Aracoix"),
- CENTAURGUARD(1650, 1642, MinionClass.MELEE, "Guard", "Centaur"),
- CENTAURMAGE(1652, 1640, MinionClass.MAGE, "Druid", "Centaur"),
- DWARVENARCHER(845, 1644, MinionClass.ARCHER, "Marksman", "Dwarven"),
- DWARVENGUARD(1050, 1666, MinionClass.MELEE, "Guard", "Dwarven"),
- DWARVENMAGE(1052, 1643, MinionClass.MAGE, "War Priest", "Dwarven"),
- ELFGUARD(1180, 1671, MinionClass.MELEE, "Guard", "Elven"), //old 1645
- ELFMAGE(1182, 1667, MinionClass.MAGE, "Adept", "Elven"),
- FORESTGUARD(1550, 1668, MinionClass.MELEE, "Guard", "Forest"), //captain changed to guard equipset
- FORESTMAGE(1552, 436, MinionClass.MAGE, "Adept", "Forest"),
- HOLYGUARD(1525, 1658, MinionClass.MELEE, "Guard", "Holy Church"),
- HOLYMAGE(1527, 1646, MinionClass.MAGE, "Prelate", "Holy Church"),
- HUMANARCHER(846, 1654, MinionClass.ARCHER, "Archer", "Human"),
- HUMANGUARD(840, 1665, MinionClass.MELEE, "Guard", "Human"),
- HUMANMAGE(848, 1655, MinionClass.MAGE, "Adept", "Human"),
- IREKEIGUARD(1350, 1659, MinionClass.MELEE, "Guard", "Irekei"),
- IREKEIMAGE(1352, 1660, MinionClass.MAGE, "Adept", "Irekei"),
- MINOTAURARCHER(1701, 0, MinionClass.ARCHER, "Archer", "Minotaur"),
- MINOTAURGUARD(1700, 1673, MinionClass.MELEE, "Guard", "Minotaur"),
- NORTHMANGUARD(1250, 1669, MinionClass.MELEE, "Guard", "Northman"),
- NORTHMANMAGE(1252, 1650, MinionClass.MAGE, "Runecaster", "Northman"),
- SHADEGUARD(1450, 1662, MinionClass.MELEE, "Guard", "Shade"),
- SHADEMAGE(1452, 1664, MinionClass.MAGE, "Adept", "Shade"),
- TEMPLARGUARD(841, 1564, MinionClass.MELEE, "Marksman", "Templar"),
- TEMPLEGUARD(1575, 1652, MinionClass.MELEE, "Guard", "Temple"),
- TEMPLEMAGE(1577, 1656, MinionClass.MAGE, "Confessor", "Temple"),
- UNDEADGUARD(980100, 1674, MinionClass.MELEE, "Guard", "Undead"),
- UNDEADMAGE(980102, 1675, MinionClass.MAGE, "Adept", "Undead"),
- WEREWOLFGUARD(980104, 0, MinionClass.MELEE, "Guard", "Werewolf"),
- WEREBEARGUARD(980103, 0, MinionClass.MELEE, "Guard", "Werebear");
- public static HashMap ContractToMinionMap = new HashMap<>();
- private final int captainContractID;
- private final int equipSetID;
- private final MinionClass minionClass;
- private final String name;
- private final String race;
-
- MinionType(int captainContractID, int equipSetID, MinionClass minionClass, String name, String race) {
-
- this.captainContractID = captainContractID;
- this.equipSetID = equipSetID;
- this.minionClass = minionClass;
- this.name = name;
- this.race = race;
-
- }
-
- public static void InitializeMinions() {
-
- for (MinionType minionType : MinionType.values())
- ContractToMinionMap.put(minionType.captainContractID, minionType);
- }
-
- public String getName() {
- return name;
- }
-
- public String getRace() {
- return race;
- }
-
- }
-
- public enum GridObjectType {
- STATIC,
- DYNAMIC;
- }
-
- public enum SupportMsgType {
- NONE(0),
- PROTECT(1),
- UNPROTECT(3),
- VIEWUNPROTECTED(4),
- REMOVETAX(6),
- ACCEPTTAX(7),
- CONFIRMPROTECT(8);
-
- public static HashMap typeLookup = new HashMap<>();
- private final int type;
-
- SupportMsgType(int messageType) {
- this.type = messageType;
-
- }
-
- public static void InitializeSupportMsgType() {
-
- for (SupportMsgType supportMsgType : SupportMsgType.values())
- typeLookup.put(supportMsgType.type, supportMsgType);
- }
- }
-
- public enum ResourceType implements EnumBitSetHelper {
-
- STONE(1580000),
- TRUESTEEL(1580001),
- IRON(1580002),
- ADAMANT(1580003),
- LUMBER(1580004),
- OAK(1580005),
- BRONZEWOOD(1580006),
- MANDRAKE(1580007),
- COAL(1580008),
- AGATE(1580009),
- DIAMOND(1580010),
- ONYX(1580011),
- AZOTH(1580012),
- ORICHALK(1580013),
- ANTIMONY(1580014),
- SULFUR(1580015),
- QUICKSILVER(1580016),
- GALVOR(1580017),
- WORMWOOD(1580018),
- OBSIDIAN(1580019),
- BLOODSTONE(1580020),
- MITHRIL(1580021),
- GOLD(7);
-
- public static HashMap resourceLookup = new HashMap<>();
- public int itemID;
-
- ResourceType(int itemID) {
- this.itemID = itemID;
- }
-
- public static void InitializeResourceTypes() {
-
- for (ResourceType resourceType : ResourceType.values())
- resourceLookup.put(resourceType.itemID, resourceType);
- }
- }
-
- public enum PowerActionType {
- ApplyEffect,
- ApplyEffects,
- Block,
- Charm,
- ClaimMine,
- ClearAggro,
- ClearNearbyAggro,
- Confusion,
- CreateMob,
- DamageOverTime,
- DeferredPower,
- DirectDamage,
- Invis,
- MobRecall,
- Peek,
- Recall,
- RemoveEffect,
- Resurrect,
- RunegateTeleport,
- SetItemFlag,
- SimpleDamage,
- SpireDisable,
- Steal,
- Summon,
- Teleport,
- Track,
- TransferStat,
- TransferStatOT,
- Transform,
- TreeChoke
- }
-
- public enum AccountStatus {
- BANNED,
- ACTIVE,
- ADMIN;
- }
-
- public enum MobBehaviourType {
- None(null, false, false, false, false, false),
- //Power
- Power(null, false, true, true, true, false),
- PowerHelpee(Power, false, true, true, false, true),
- PowerHelpeeWimpy(Power, true, false, true, false, false),
- PowerGrouperWimpy(Power, true, false, true, false, false),
- PowerAggro(Power, false, true, true, false, true),
- PowerAggroHelpee(Power, false, true, true, false, true),
- //Aggro
- Aggro(null, false, true, true, true, false),
- AggroHelpee(Aggro, false, true, true, false, true),
+ public enum MobFlagType implements EnumBitSetHelper {
+ AGGRESSIVE,
+ CANROAM,
+ CALLSFORHELP,
+ RESPONDSTOCALLSFORHELP,
+ HUMANOID,
+ UNDEAD,
+ BEAST,
+ DRAGON,
+ RAT,
+ SENTINEL,
+ }
+
+ public enum MonsterType implements EnumBitSetHelper {
+ Aelfborn,
+ All,
+ Animal,
+ Aracoix,
+ Celestial,
+ Centaur,
+ Construct,
+ CSR,
+ Dragon,
+ Dwarf,
+ Elf,
+ Giant,
+ Goblin,
+ Grave,
+ HalfGiant,
+ Human,
+ Infernal,
+ Insect,
+ Irekei,
+ Minotaur,
+ Monster,
+ NecroPet,
+ NPC,
+ Pet,
+ Plant,
+ Rat,
+ Reptile,
+ Shade,
+ Siege,
+ Summoned,
+ Troll,
+ Undead,
+ Nephilim,
+ Vampire,
+ SiegeEngineer;
+
+ }
+
+ public enum CharacterSex {
+ MALE,
+ FEMALE,
+ FUZZY,
+ OTHER;
+ }
+
+ public enum RaceType {
+
+ // RaceRuneID / AggroType, isFemale
+
+ AELFMALE(2000, MonsterType.Aelfborn, RunSpeed.STANDARD, CharacterSex.MALE, 1.05f),
+ AELFFEMALE(2001, MonsterType.Aelfborn, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.05f),
+ ARACOIXMALE(2002, MonsterType.Aracoix, RunSpeed.STANDARD, CharacterSex.MALE, 1),
+ ARACOIXFEMALE(2003, MonsterType.Aracoix, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
+ CENTAURMALE(2004, MonsterType.Centaur, RunSpeed.CENTAUR, CharacterSex.MALE, 1.2f),
+ CENTAURFEMALE(2005, MonsterType.Centaur, RunSpeed.CENTAUR, CharacterSex.FEMALE, 1.2f),
+ DWARFMALE(2006, MonsterType.Dwarf, RunSpeed.STANDARD, CharacterSex.MALE, 0.80000001f),
+ ELFMALE(2008, MonsterType.Elf, RunSpeed.STANDARD, CharacterSex.MALE, 1.4f),
+ ELFFEMALE(2009, MonsterType.Elf, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
+ HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
+ HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
+ HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
+ IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
+ IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
+ SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
+ SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
+ MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
+ ARCHONMALE(2018, MonsterType.Celestial, RunSpeed.STANDARD, CharacterSex.MALE, 1),
+ HALEGIANTOLDMALE(2019, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
+ CSRFEMALE(2020, MonsterType.CSR, RunSpeed.STANDARD, CharacterSex.FEMALE, 0.66000003f),
+ CSRMALE(2021, MonsterType.CSR, RunSpeed.STANDARD, CharacterSex.MALE, 1),
+ NEPHMALE(2025, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
+ NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
+ HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f),
+ VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1),
+ VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1);
+
+ @SuppressWarnings("unchecked")
+ private static HashMap _raceTypeByID = new HashMap<>();
+
+ int runeID;
+ private MonsterType monsterType;
+ private CharacterSex characterSex;
+ private RunSpeed runSpeed;
+ private float scaleHeight;
+
+ RaceType(int runeID, MonsterType aggroType, RunSpeed runspeed, CharacterSex characterSex, float scaleHeight) {
+ this.runeID = runeID;
+ this.monsterType = aggroType;
+ this.runSpeed = runspeed;
+ this.characterSex = characterSex;
+ this.scaleHeight = scaleHeight;
+ }
+
+ public static RaceType getRaceTypebyRuneID(int runeID) {
+ return _raceTypeByID.get(runeID);
+ }
+
+ public static void initRaceTypeTables() {
+
+ for (RaceType raceType : RaceType.values()) {
+ _raceTypeByID.put(raceType.runeID, raceType);
+ }
+ }
+
+ public int getRuneID() {
+ return this.runeID;
+ }
+
+ public float getScaleHeight() {
+ return this.scaleHeight;
+ }
+
+ public MonsterType getMonsterType() {
+ return monsterType;
+ }
+
+ public RunSpeed getRunSpeed() {
+ return runSpeed;
+ }
+
+ public CharacterSex getCharacterSex() {
+ return characterSex;
+ }
+ }
+
+ public enum RunSpeed {
+
+ SENTINEL(0, 0, 0, 0, 0, 0, 0),
+ STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
+ CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
+ MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
+
+ private float walkStandard;
+ private float walkCombat;
+ private float runStandard;
+ private float runCombat;
+ private float swim;
+ private float flyRun;
+ private float flyWalk;
+
+ RunSpeed(float walkStandard, float runStandard, float walkCombat, float runCombat, float flyWalk, float flyRun, float swim) {
+ this.walkStandard = walkStandard;
+ this.walkCombat = walkCombat;
+ this.runStandard = runStandard;
+ this.runCombat = runCombat;
+ this.swim = swim;
+ this.flyRun = flyRun;
+ this.flyWalk = flyWalk;
+ }
+
+
+ public float getWalkStandard() {
+ return walkStandard;
+ }
+
+ public float getWalkCombat() {
+ return walkCombat;
+ }
+
+ public float getRunStandard() {
+ return runStandard;
+ }
+
+ public float getRunCombat() {
+ return runCombat;
+ }
+
+ public float getFlyRun() {
+ return flyRun;
+ }
+
+
+ public float getFlyWalk() {
+ return flyWalk;
+ }
+
+ }
+
+ public enum FriendListType {
+
+ VIEWHERALDRY(1),
+ ADDHERALDRY(4),
+ REMOVEHERALDRY(6),
+ DEALTHS(7),
+ KILLS(9),
+ VIEWCONDEMN(11),
+ ADDCONDEMN(14),
+ REMOVECONDEMN(15),
+ TOGGLEACTIVE(17),
+ REVERSEKOS(19),
+ VIEWFRIENDS(25),
+ TOITEM(23),
+ ADDFRIEND(28),
+ REMOVEFRIEND(30);
+
+ private final int listType;
+
+ FriendListType(int listType) {
+ this.listType = listType;
+ }
+
+ public static FriendListType getListTypeByID(int listType) {
+
+ FriendListType outType = null;
+
+ for (FriendListType friendListType : FriendListType.values()) {
+ if (friendListType.listType == listType)
+ outType = friendListType;
+ }
+ return outType;
+ }
+
+ }
+
+ public enum DispatchChannel {
+ PRIMARY(0),
+ SECONDARY(1);
+
+ private final int channelID;
+
+ DispatchChannel(int channelID) {
+ this.channelID = channelID;
+ }
+
+ public int getChannelID() {
+ return this.channelID;
+ }
+
+ }
+
+ public enum PvpHistoryType {
+ KILLS,
+ DEATHS;
+ }
+
+ public enum ChatMessageType {
+ ERROR,
+ INFO,
+ MOTD;
+ }
+
+ public enum DataRecordType {
+ PVP,
+ CHARACTER,
+ BANE,
+ GUILD,
+ CITY,
+ ZONE,
+ REALM,
+ MINE;
+ }
+
+ public enum RecordEventType {
+ CREATE, // Shared with city/guild
+ DISBAND,
+ DESTROY, // City events
+ CAPTURE,
+ TRANSFER,
+ PENDING,
+ DEFEND,
+ LOST; // Realm event
+ }
+
+ public enum CharterType {
+ FEUDAL(-600065291, 5060000),
+ MERCANTILE(-15978914, 5060400),
+ BELLIGERENT(762228431, 5060800);
+
+ private int charterID;
+ private int meshID;
+
+ CharterType(int charterID, int meshID) {
+ this.charterID = charterID;
+ this.meshID = meshID;
+ }
+
+ public static CharterType getCharterTypeByID(int charterID) {
+ CharterType outType = null;
+
+ for (CharterType charterType : CharterType.values()) {
+ if (charterType.charterID == charterID)
+ outType = charterType;
+ }
+ return outType;
+ }
+
+ public int getMeshID() {
+ return meshID;
+ }
+ }
+
+
+ public enum ChatChannelType {
+ SYSTEM(1),
+ FLASH(2),
+ COMMANDER(3),
+ NATION(5),
+ LEADER(6),
+ SHOUT(7),
+ INFO(10),
+ GUILD(12),
+ INNERCOUNCIL(13),
+ GROUP(14),
+ CITY(15),
+ SAY(16),
+ EMOTE(17),
+ TELL(19),
+ COMBAT(20);
+
+ private final int channelID;
+
+ ChatChannelType(int channelID) {
+ this.channelID = channelID;
+ }
+
+ public int getChannelID() {
+ return this.channelID;
+ }
+ }
+
+ public enum OwnerType {
+ Npc,
+ PlayerCharacter,
+ Account,
+ Mob;
+ }
+
+ public enum SiegePhase {
+ ERRANT,
+ CHALLENGE,
+ STANDOFF,
+ WAR,
+ CEASEFIRE;
+ }
+
+ public enum SiegeResult {
+ PENDING,
+ DEFEND,
+ DESTROY,
+ CAPTURE;
+ }
+
+ public enum TaxType {
+ PROFIT,
+ WEEKLY,
+ NONE;
+
+ }
+
+ public enum Ruins {
+
+ ESTRAGOTH(569),
+ KARFELL(570),
+ MORELAN(571),
+ REGARS(572),
+ HALLOS(573),
+ WESTERMORE(574),
+ EYWAN(575),
+ CAER(576);
+
+ private final int zoneUUID;
+
+ Ruins(int uuid) {
+ this.zoneUUID = uuid;
+ }
+
+ public static Ruins getRandomRuin() {
+
+ Ruins ruins;
+
+ ruins = Ruins.values()[ThreadLocalRandom.current()
+ .nextInt(Ruins.values().length)];
+
+ return ruins;
+ }
+
+ public Vector3fImmutable getLocation() {
+
+ Zone ruinZone;
+ Vector3fImmutable spawnLocation;
+
+ // Send to SDR if so configured
+
+ if (ConfigManager.MB_USE_RUINS.getValue().equalsIgnoreCase("true")) {
+ ruinZone = ZoneManager.getZoneByUUID(this.zoneUUID);
+ spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
+ } else {
+ ruinZone = ZoneManager.getZoneByName("sea dog's rest");
+
+ // 14001 does not have a banestone to bind at
+
+ if (ruinZone.getLoadNum() == 14001)
+ spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
+ else
+ spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
+ .add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
+ }
+
+
+ return spawnLocation;
+ }
+
+ }
+
+ public enum Guards {
+
+ HumanArcher(13.97f, 13.97f, 6.19f, 4.2199998f, 18.38f, 6.33f, 6.5f),
+ HumanGuard(13.97f, 13.97f, 6.19f, 4.2199998f, 18.38f, 6.33f, 6.5f),
+ HumanMage(13.97f, 13.97f, 6.19f, 4.2199998f, 18.38f, 6.33f, 6.5f),
+ UndeadArcher(14.67f, 14.67f, 6.5f, 4.44f, 18.38f, 6.33f, 6.5f),
+ UndeadGuard(14.67f, 14.67f, 6.5f, 4.44f, 18.38f, 6.33f, 6.5f),
+ UndeadMage(14.67f, 14.67f, 6.5f, 4.44f, 18.38f, 6.33f, 6.5f);
+
+ private final float runSpeed;
+ private final float runCombatSpeed;
+ private final float walkSpeed;
+ private final float walkCombatSpeed;
+ private final float fly;
+ private final float flyWalk;
+ private final float swim;
+
+ Guards(float runSpeed, float runCombatSpeed, float walkSpeed, float walkCombatSpeed, float fly, float flyWalk, float swim) {
+ this.runSpeed = runSpeed;
+ this.runCombatSpeed = runCombatSpeed;
+ this.walkSpeed = walkSpeed;
+ this.walkCombatSpeed = walkCombatSpeed;
+ this.fly = fly;
+ this.flyWalk = flyWalk;
+ this.swim = swim;
+ }
+
+ public float getRunSpeed() {
+ return runSpeed;
+ }
+
+ public float getRunCombatSpeed() {
+ return runCombatSpeed;
+ }
+
+ public float getWalkSpeed() {
+ return walkSpeed;
+ }
+
+ public float getWalkCombatSpeed() {
+ return walkCombatSpeed;
+ }
+
+ public float getFly() {
+ return fly;
+ }
+
+ public float getSwim() {
+ return swim;
+ }
+
+ public float getFlyWalk() {
+ return flyWalk;
+ }
+ }
+
+ public enum PortalType {
+
+ EARTH(6f, 19.5f, 128),
+ AIR(-6f, 19.5f, 256),
+ FIRE(15f, 7.5f, 512),
+ WATER(-15f, 8.5f, 1024),
+ SPIRIT(0, 10.5f, 2048),
+ CHAOS(22f, 3.5f, 8192),
+ OBLIV(0f, 42f, 16384),
+ MERCHANT(-22f, 4.5f, 4096),
+ FORBID(0.0f, 0.0f, 0);
+
+ public final Vector2f offset;
+ public final int effectFlag;
+
+ PortalType(float offsetX, float offsetY, int effectFlag) {
+
+ this.offset = new Vector2f(offsetX, offsetY);
+ this.effectFlag = effectFlag;
+
+ }
+ }
+
+
+ // Enum for ItemBase flags
+
+ public enum ItemType {
+ DECORATION(0),
+ WEAPON(1),
+ ARMOR(2),
+ HAIR(3),
+ GOLD(4),
+ RUNE(5),
+ SCROLL(5),
+ BOOK(6),
+ COMMANDROD(7),
+ POTION(8),
+ TEARS(8),
+ KEY(9),
+ GUILDCHARTER(10),
+ JEWELRY(13),
+ WINE(16),
+ ALEJUG(17),
+ DEED(19),
+ CONTRACT(20),
+ PET(21),
+ FURNITURE(25),
+ BEDROLL(26),
+ FARMABLE(27),
+ WATERBUCKET(30),
+ GIFT(31),
+ OFFERING(33),
+ RESOURCE(34),
+ REALMCHARTER(35);
+
+ private final static HashMap _typeLookup = new HashMap<>();
+ private final int _value;
+
+ ItemType(int value) {
+ this._value = value;
+ }
+
+ public static ItemType getByValue(int value) {
+
+ ItemType outType = ItemType.DECORATION;
+
+ if (_typeLookup.isEmpty()) {
+
+ for (ItemType itemType : ItemType.values()) {
+ _typeLookup.put(itemType._value, itemType);
+ }
+ }
+
+ if (_typeLookup.containsKey(value))
+ outType = _typeLookup.get(value);
+
+ return outType;
+ }
+
+ /**
+ * @return the _value
+ */
+ public int getValue() {
+ return _value;
+ }
+
+ }
+ // Enum to derive effects for active spires from blueprintUUID
+
+ public enum SpireType {
+
+ WATCHFUL(1800100, (1 << 23), -1139520957),
+ GROUNDING(1800400, (1 << 24), -1733819072),
+ BINDING(1800700, (1 << 25), -1971545187),
+ WARDING(1801000, (1 << 26), 2122002462),
+ GUILEFUL(1801300, (1 << 27), -1378972677),
+ BALEFUL(1801600, -1, 1323012132),
+ ARCANE(1801900, (1 << 30), 1323888676),
+ WOUNDING(1802200, (1 << 10), 1357392095),
+ WEARYING(1802500, (1 << 10), 1350838495),
+ CONFUSING(1802800, (1 << 10), 1358702815),
+ CHILLING(1803100, (1 << 1), 1332155165),
+ SEARING(1803400, (1 << 2), -1401744610),
+ THUNDERING(1803700, (1 << 3), -443544829),
+ UNHOLY(1804000, (1 << 4), 1330320167),
+ BEFUDDLING(1804300, (1 << 5), 1489317547),
+ WRATHFUL(1804600, (1 << 6), 165160210),
+ SPITEFUL(1804900, (1 << 7), 1238906779),
+ ENFEEBLING(1805200, (1 << 8), -908578401),
+ CONFOUNDING(1805500, (1 << 9), 165165842),
+ DISTRACTING(1805800, (1 << 10), 1238906697),
+ WOLFPACK(1806100, (1 << 4), 416932375);
+
+ private final int blueprintUUID;
+ private final int effectFlag;
+ private final int token;
+
+ SpireType(int blueprint, int flag, int token) {
+ this.blueprintUUID = blueprint;
+ this.effectFlag = flag;
+ this.token = token;
+ }
+
+ public static SpireType getByBlueprintUUID(int uuid) {
+
+ SpireType outType = SpireType.GROUNDING;
+
+ for (SpireType spireType : SpireType.values()) {
+
+ if (spireType.blueprintUUID == uuid) {
+ outType = spireType;
+ return outType;
+ }
+
+ }
+
+ return outType;
+ }
+
+ public int getBlueprintUUID() {
+ return blueprintUUID;
+ }
+
+ public int getEffectFlag() {
+ return effectFlag;
+ }
+
+ public int getToken() {
+ return token;
+ }
+
+ public EffectsBase getEffectBase() {
+ return PowersManager.getEffectByToken(token);
+ }
+
+ }
+
+ public enum TransactionType {
+ MAINTENANCE(43),
+ WITHDRAWL(80),
+ DEPOSIT(82),
+ MINE(81),
+ MIGRATION(83),
+ PLAYERREWARD(84),
+ TAXRESOURCE(85),
+ TAXRESOURCEDEPOSIT(86);
+
+ private final int ID;
+
+ TransactionType(int ID) {
+ this.ID = ID;
+ }
+
+ public int getID() {
+ return ID;
+ }
+ }
+
+ public enum TargetColor {
+
+ White,
+ Green,
+ Cyan,
+ Blue,
+ Yellow,
+ Orange,
+ Red;
+
+ public static TargetColor getCon(AbstractCharacter source,
+ AbstractCharacter target) {
+ return getCon(source.getLevel(), target.getLevel());
+ }
+
+ public static TargetColor getCon(short sourceLevel, short targetLevel) {
+ if (targetLevel > (sourceLevel + 2))
+ return Red;
+ else if (targetLevel == (sourceLevel + 2))
+ return Orange;
+ else if (targetLevel == (sourceLevel + 1))
+ return Yellow;
+
+ short lowestBlue = (short) (sourceLevel - (((sourceLevel / 5)) + 2));
+
+ if (lowestBlue <= targetLevel)
+ return Blue;
+ else if (lowestBlue - 1 <= targetLevel)
+ return Cyan;
+ else if (lowestBlue - 2 <= targetLevel)
+ return Green;
+ return White;
+ }
+ }
+
+ public enum DamageType {
+ None,
+ Crush,
+ Slash,
+ Siege,
+ Pierce,
+ Magic,
+ Bleed,
+ Poison,
+ Mental,
+ Holy,
+ Unholy,
+ Lightning,
+ Fire,
+ Cold,
+ Healing,
+ Acid,
+ Disease,
+ Unknown,
+ // these added for immunities
+ Attack,
+ Powers,
+ Combat,
+ Spires,
+ Snare,
+ Stun,
+ Blind,
+ Root,
+ Fear,
+ Charm,
+ PowerBlock,
+ DeBuff,
+ Powerblock,
+ Steel,
+ Drain;
+
+ public static DamageType GetDamageType(String modName) {
+ DamageType damageType;
+ if (modName.isEmpty())
+ return DamageType.None;
+
+ try {
+ damageType = DamageType.valueOf(modName.replace(",", ""));
+ } catch (Exception e) {
+ Logger.error(e);
+ return DamageType.None;
+ }
+ return damageType;
+ }
+ }
+
+
+ public enum SourceType {
+ None,
+ Abjuration,
+ Acid,
+ AntiSiege,
+ Archery,
+ Axe,
+ Bardsong,
+ Beastcraft,
+ Benediction,
+ BladeWeaving,
+ Bleed,
+ Blind,
+ Block,
+ Bloodcraft,
+ Bow,
+ Buff,
+ Channeling,
+ Charm,
+ Cold,
+ COLD,
+ Constitution,
+ Corruption,
+ Crossbow,
+ Crush,
+ Dagger,
+ DaggerMastery,
+ DeBuff,
+ Dexterity,
+ Disease,
+ Dodge,
+ Dragon,
+ Drain,
+ Earth,
+ Effect,
+ Exorcism,
+ Fear,
+ Fire,
+ FIRE,
+ Fly,
+ Giant,
+ GreatAxeMastery,
+ GreatSwordMastery,
+ Hammer,
+ Heal,
+ Healing,
+ Holy,
+ HOLY,
+ ImmuneToAttack,
+ ImmuneToPowers,
+ Intelligence,
+ Invisible,
+ Lightning,
+ LIGHTNING,
+ Liturgy,
+ Magic,
+ MAGIC,
+ Mental,
+ MENTAL,
+ NatureLore,
+ Necromancy,
+ Parry,
+ Pierce,
+ Poison,
+ POISON,
+ PoleArm,
+ Powerblock,
+ Rat,
+ ResistDeBuff,
+ Restoration,
+ Root,
+ Shadowmastery,
+ Siege,
+ Slash,
+ Snare,
+ Sorcery,
+ Spear,
+ SpearMastery,
+ Spirit,
+ Staff,
+ Stormcalling,
+ Strength,
+ Stun,
+ Summon,
+ Sword,
+ SwordMastery,
+ Thaumaturgy,
+ Theurgy,
+ Transform,
+ UnarmedCombat,
+ UnarmedCombatMastery,
+ Unholy,
+ UNHOLY,
+ Unknown,
+ Warding,
+ Warlockry,
+ WayoftheGaana,
+ WearArmorHeavy,
+ WearArmorLight,
+ WearArmorMedium,
+ Wereform,
+ Athletics,
+ AxeMastery,
+ Bargaining,
+ BladeMastery,
+ FlameCalling,
+ GreatHammerMastery,
+ HammerMastery,
+ Leadership,
+ PoleArmMastery,
+ Running,
+ StaffMastery,
+ Throwing,
+ Toughness,
+ WayoftheWolf,
+ WayoftheRat,
+ WayoftheBear,
+ Orthanatos,
+ SunDancing,
+ //Power categories.
+ AE,
+ AEDAMAGE,
+ BEHAVIOR,
+ BLESSING,
+ BOONCLASS,
+ BOONRACE,
+ BREAKFLY,
+ BUFF,
+ CHANT,
+ DAMAGE,
+ DEBUFF,
+ DISPEL,
+ FLIGHT,
+ GROUPBUFF,
+ GROUPHEAL,
+ HEAL,
+ INVIS,
+ MOVE,
+ RECALL,
+ SPECIAL,
+ SPIREDISABLE,
+ SPIREPROOFTELEPORT,
+ STANCE,
+ STUN,
+ SUMMON,
+ TELEPORT,
+ THIEF,
+ TRACK,
+ TRANSFORM,
+ VAMPDRAIN,
+ WEAPON,
+ Wizardry;
+
+ public static SourceType GetSourceType(String modName) {
+ SourceType returnMod;
+ if (modName.isEmpty())
+ return SourceType.None;
+
+ try {
+ returnMod = SourceType.valueOf(modName.replace(",", ""));
+ } catch (Exception e) {
+ Logger.error(modName);
+ Logger.error(e);
+ return SourceType.None;
+ }
+ return returnMod;
+ }
+ }
+
+ public enum EffectSourceType {
+ None,
+ AttackSpeedBuff,
+ Bleeding,
+ Blind,
+ Buff,
+ Chant,
+ Charm,
+ Cold,
+ Combat,
+ ConstitutionBuff,
+ Crush,
+ DamageShield,
+ DeathShroud,
+ DeBuff,
+ Disease,
+ Drain,
+ Earth,
+ Effect,
+ Fear,
+ Fire,
+ Flight,
+ Fortitude,
+ Heal,
+ Holy,
+ Invisibility,
+ Invulnerability,
+ Lightning,
+ Magic,
+ Mental,
+ Multielement,
+ PetBuff,
+ Pierce,
+ Poison,
+ Powerblock,
+ RecoveryManaBuff,
+ ResistDeBuff,
+ Root,
+ Siege,
+ SiegeBuff,
+ SiegeDamage,
+ Silence,
+ Slash,
+ Snare,
+ Stance,
+ Stun,
+ Summon,
+ Transform,
+ Unholy,
+ Wereform,
+ WereformATRBuff,
+ WereformConBuff,
+ WereformDexBuff,
+ WereformHPRecBuff,
+ WereformMoveBuff,
+ WereformPhysResBuff,
+ WereformSPRecBuff,
+ WereformStrBuff;
+
+ public static EffectSourceType GetEffectSourceType(String modName) {
+ EffectSourceType returnMod;
+ if (modName.isEmpty())
+ return EffectSourceType.None;
+
+ try {
+ returnMod = EffectSourceType.valueOf(modName.replace(",", ""));
+ } catch (Exception e) {
+ Logger.error(e);
+ return EffectSourceType.None;
+ }
+ return returnMod;
+ }
+ }
+
+ public enum StackType {
+ None,
+ AggRangeDeBuff,
+ ArcheryPrecisionBuff,
+ AttackDebuff,
+ AttackSpeedBuff,
+ AttackSpeedDeBuff,
+ AttackValueBuff,
+ AttackValueDebuff,
+ AttrCONBuff,
+ AttrCONDebuff,
+ AttrDEXBuff,
+ AttrINTBuff,
+ AttrSPRBuff,
+ AttrSTRBuff,
+ Bleeding,
+ Blindness,
+ BluntResistanceDebuff,
+ BMHealing,
+ Charm,
+ ClassBoon,
+ Confusion,
+ DamageAbsorber,
+ DamageDebuff,
+ DamageModifierBuff,
+ DamageShield,
+ DeathShroud,
+ DefenseBuff,
+ DefenseBuffGroup,
+ DefenseDebuff,
+ DetectInvis,
+ DrainImmunity,
+ ElementalDeBuff,
+ EnchantWeapon,
+ Fear,
+ Flight,
+ Frenzy,
+ GroupHeal,
+ HealingBuff,
+ HealOverTime,
+ HealResBuff,
+ HealthPotion,
+ IgnoreStack,
+ Invisible,
+ ManaPotion,
+ MangonelFire,
+ MeleeDamageDeBuff,
+ MeleeDeBuff,
+ MoveBuff,
+ MoveDebuff,
+ NoFear,
+ NoPassiveDefense,
+ NoPowerBlock,
+ NoPowerInhibitor,
+ NoRecall,
+ NoSnare,
+ NoStun,
+ NoTrack,
+ PassiveDefense,
+ PersAttrSPRBuff,
+ PetBuff,
+ PierceResistanceDebuff,
+ PoisonBuchinine,
+ PoisonGalpa,
+ PoisonGorgonsVenom,
+ PoisonMagusbane,
+ PoisonPellegorn,
+ PowerBlock,
+ PowerCostBuff,
+ PowerDamageModifierBuff,
+ PowerInhibitor,
+ PrecisionBuff,
+ Protection,
+ RaceBoon,
+ RecoveryHealthBuff,
+ RecoveryHealthDeBuff,
+ RecoveryManaBuff,
+ RecoveryManaDeBuff,
+ RecoveryStaminaBuff,
+ RecoveryStaminaDeBuff,
+ ResistanceBuff,
+ ResistanceDeBuff,
+ ResistanceDebuff,
+ Root,
+ SafeMode,
+ SelfOneAttrBuff,
+ SelfThreeAttrBuff,
+ SelfTwoAttrBuff,
+ SiegeDebuff,
+ SiegeWeaponBuff,
+ Silence,
+ SkillDebuff,
+ SlashResistanceDebuff,
+ Snare,
+ StackableAttrCONBuff,
+ StackableAttrDEXBuff,
+ StackableAttrSTRBuff,
+ StackableDefenseBuff,
+ StackableRecoveryHealthBuff,
+ StackableRecoveryStaminaBuff,
+ StaminaPotion,
+ StanceA,
+ StanceB,
+ Stun,
+ Track,
+ Transform,
+ WeaponMove;
+
+ public static StackType GetStackType(String modName) {
+ StackType stackType;
+ if (modName.isEmpty())
+ return StackType.None;
+
+ try {
+ stackType = StackType.valueOf(modName.replace(",", ""));
+ } catch (Exception e) {
+ Logger.error(modName);
+ Logger.error(e);
+ return StackType.None;
+ }
+ return stackType;
+ }
+ }
+
+ public enum ModType {
+ None,
+ AdjustAboveDmgCap,
+ Ambidexterity,
+ AnimOverride,
+ ArmorPiercing,
+ AttackDelay,
+ Attr,
+ BlackMantle,
+ BladeTrails,
+ Block,
+ BlockedPowerType,
+ CannotAttack,
+ CannotCast,
+ CannotMove,
+ CannotTrack,
+ Charmed,
+ ConstrainedAmbidexterity,
+ DamageCap,
+ DamageShield,
+ DCV,
+ Dodge,
+ DR,
+ Durability,
+ ExclusiveDamageCap,
+ Fade,
+ Fly,
+ Health,
+ HealthFull,
+ HealthRecoverRate,
+ IgnoreDamageCap,
+ IgnorePassiveDefense,
+ ImmuneTo,
+ ImmuneToAttack,
+ ImmuneToPowers,
+ Invisible,
+ ItemName,
+ Mana,
+ ManaFull,
+ ManaRecoverRate,
+ MaxDamage,
+ MeleeDamageModifier,
+ MinDamage,
+ NoMod,
+ OCV,
+ Parry,
+ PassiveDefense,
+ PowerCost,
+ PowerCostHealth,
+ PowerDamageModifier,
+ ProtectionFrom,
+ Resistance,
+ ScaleHeight,
+ ScaleWidth,
+ ScanRange,
+ SeeInvisible,
+ Silenced,
+ Skill,
+ Slay,
+ Speed,
+ SpireBlock,
+ Stamina,
+ StaminaFull,
+ StaminaRecoverRate,
+ Stunned,
+ Value,
+ WeaponProc,
+ WeaponRange,
+ WeaponSpeed;
+
+ public static ModType GetModType(String modName) {
+ ModType modType;
+ if (modName.isEmpty())
+ return ModType.None;
+
+ try {
+ modType = ModType.valueOf(modName.replace(",", ""));
+ } catch (Exception e) {
+ Logger.error(e);
+ return ModType.None;
+ }
+ return modType;
+ }
+ }
+
+ public enum MovementState {
+
+ IDLE,
+ SITTING,
+ RUNNING,
+ FLYING,
+ SWIMMING;
+ }
+
+ public enum DoorState {
+
+ OPEN,
+ CLOSED,
+ LOCKED,
+ UNLOCKED;
+ }
+
+ // Used with stored procedure GET_UID_ENUM() for
+ // type tests against objects not yet loaded into the game.
+ public enum DbObjectType {
+
+ INVALID,
+ ACCOUNT,
+ BUILDING,
+ CHARACTER,
+ CITY,
+ CONTAINER,
+ GUILD,
+ ITEM,
+ MINE,
+ MOB,
+ NPC,
+ SHRINE,
+ WORLDSERVER,
+ ZONE,
+ WAREHOUSE;
+ }
+
+ ;
+
+ /**
+ * Enumeration of Building Protection Status stored in the database as a
+ * mysql enumfield. WARNING: This enumeration is fragile. Do not rename. Do
+ * not reorder.
+ */
+ public enum ProtectionState {
+
+ NONE,
+ PROTECTED,
+ UNDERSIEGE,
+ CEASEFIRE,
+ CONTRACT,
+ DESTROYED,
+ PENDING,
+ NPC;
+ }
+
+ ;
+
+ public enum CharacterSkills {
+
+ Archery((1L << 1), -529201545, 20),
+ Athletics((1L << 2), -327713877, 15),
+ AxeMastery((1L << 3), 1103042709, 20),
+ Axe((1L << 4), 73505, 1),
+ Bardsong((1L << 5), 454246953, 10),
+ Bargaining((1L << 6), 372927577, 10),
+ Beastcraft((1L << 7), 56772766, 10),
+ Benediction((1L << 8), 1464998706, 1),
+ BladeMastery((1L << 9), -59908956, 20),
+ BladeWeaving((1L << 10), -1839362429, 20),
+ Block((1L << 11), 76592546, 3),
+ Bow((1L << 12), 87490, 1),
+ Channeling((1L << 13), -1899060872, 20),
+ Crossbow((1L << 14), 1092138184, 1),
+ DaggerMastery((1L << 15), -1549224741, 20),
+ Dagger((1L << 16), -1603103740, 1),
+ Dodge((1L << 17), 74619332, 5),
+ FlameCalling((1L << 18), -1839578206, 20),
+ GreatAxeMastery((1L << 19), 1427003458, 20),
+ GreatHammerMastery((1L << 20), -309659310, 20),
+ GreatSwordMastery((1L << 21), 2054956946, 20),
+ HammerMastery((1L << 22), -1548903209, 20),
+ Hammer((1L << 23), -1602765816, 1),
+ Leadership((1L << 24), 1618560984, 20),
+ Liturgy((1L << 25), -888415974, 10),
+ NatureLore((1L << 26), -1911171474, 10),
+ Parry((1L << 27), 95961104, 5),
+ PoleArmMastery((1L << 28), -1432303709, 20),
+ PoleArm((1L << 29), -1037845588, 1),
+ Restoration((1L << 30), -504697054, 1),
+ Running((1L << 31), 1488335491, 10),
+ Shadowmastery((1L << 32), 1389222957, 10),
+ Sorcery((1L << 33), -529481275, 1),
+ SpearMastery((1L << 34), -48279755, 20),
+ Spear((1L << 35), 83992115, 1),
+ StaffMastery((1L << 36), -61022283, 20),
+ Staff((1L << 37), 71438003, 1),
+ Stormcalling((1L << 38), -532064061, 10),
+ SwordMastery((1L << 39), -59316267, 20),
+ Sword((1L << 40), 73938643, 1),
+ Thaumaturgy((1L << 41), -2020131447, 10),
+ Theurgy((1L << 42), -888431326, 10),
+ Throwing((1L << 43), 391562015, 20),
+ Toughness((1L << 44), -660435875, 10),
+ UnarmedCombatMastery((1L << 45), 1692733771, 20),
+ UnarmedCombat((1L << 46), -1094332856, 1),
+ Warding((1L << 47), 1488142342, 1),
+ Warlockry((1L << 48), 1121393557, 10),
+ WayoftheGaana((1L << 49), -1954832975, 10),
+ WearArmorHeavy((1L << 50), 1112121635, 15),
+ WearArmorLight((1L << 51), 38031547, 1),
+ WearArmorMedium((1L << 52), 468015203, 5),
+ Wizardry((1L << 53), 218227659, 10),
+ Corruption((1L << 54), -1519268706, 10),
+ Abjuration((1L << 55), -2029900484, 10),
+ WayoftheWolf((1L << 56), 1668913067, 20),
+ WayoftheRat((1L << 57), -2114353637, 20),
+ WayoftheBear((1L << 58), -906390863, 20),
+ Orthanatos((1L << 59), -666929185, 20),
+ Bloodcraft((1L << 60), 40661438, 10),
+ Exorcism((1L << 61), 1444427097, 10),
+ Necromancy((1L << 62), -556571154, 10),
+ SunDancing((1L << 63), 22329752, 20);
+
+ private long flag;
+ private int token;
+ private int reqLvl;
+
+ CharacterSkills(long flag, int token, int reqLvl) {
+ this.flag = flag;
+ this.token = token;
+ this.reqLvl = reqLvl;
+ }
+
+ public static CharacterSkills GetCharacterSkillByToken(int token) {
+ for (CharacterSkills skill : CharacterSkills.values()) {
+ if (skill.token == token)
+ return skill;
+ }
+
+ Logger.info("Returned No Skill for token " + token + ". Defaulting to Axe");
+ return CharacterSkills.Axe;
+ }
+
+ public long getFlag() {
+ return flag;
+ }
+
+ public void setFlag(long flag) {
+ this.flag = flag;
+ }
+
+ public int getReqLvl() {
+ return this.reqLvl;
+ }
+
+ public int getToken() {
+ return token;
+ }
+
+ public void setToken(int token) {
+ this.token = token;
+ }
+ }
+
+ ;
+
+ public enum GuildHistoryType {
+ JOIN(1),
+ LEAVE(4),
+ BANISHED(3),
+ CREATE(7),
+ DISBAND(5);
+ private final int type;
+
+ GuildHistoryType(int type) {
+ this.type = type;
+ }
+
+ public int getType() {
+ return type;
+ }
+ }
+
+ public enum SexType {
+ NONE,
+ MALE,
+ FEMALE;
+ }
+
+ public enum ClassType {
+ FIGHTER,
+ HEALER,
+ ROGUE,
+ MAGE;
+ }
+
+ public enum PromoteType {
+ Assassin(SexType.NONE),
+ Barbarian(SexType.NONE),
+ Bard(SexType.NONE),
+ Channeler(SexType.NONE),
+ Confessor(SexType.NONE),
+ Crusader(SexType.NONE),
+ Doomsayer(SexType.NONE),
+ Druid(SexType.NONE),
+ Fury(SexType.FEMALE),
+ Huntress(SexType.FEMALE),
+ Prelate(SexType.NONE),
+ Priest(SexType.NONE),
+ Ranger(SexType.NONE),
+ Scout(SexType.NONE),
+ Sentinel(SexType.NONE),
+ Templar(SexType.NONE),
+ Thief(SexType.NONE),
+ Warlock(SexType.MALE),
+ Warrior(SexType.NONE),
+ Wizard(SexType.NONE),
+ Nightstalker(SexType.NONE),
+ Necromancer(SexType.NONE),
+ ;
+
+ private SexType sexRestriction;
+
+ PromoteType(SexType sexRestriction) {
+ this.sexRestriction = sexRestriction;
+ }
+
+ public SexType getSexRestriction() {
+ return sexRestriction;
+ }
+ }
+
+ public enum ShrineType {
+
+ Aelfborn(1701900, -75506007, true),
+ Aracoix(1703100, -563708986, true),
+ Centaur(1704000, 521645243, true),
+ Dwarf(1708500, -2000467257, true),
+ Elf(1703400, 1254603001, true),
+ HalfGiant(1709100, 349844468, true),
+ Human(1702200, 281172391, true),
+ Irekei(1702800, -764988442, true),
+ Minotaur(1704600, 549787579, true),
+ Nephilim(1701000, -655183799, true),
+ Shade(1700100, 1724071104, true),
+ Assassin(1700400, 1989015892, false),
+ Barbarian(1708800, 9157124, false),
+ Bard(1704300, 80190554, false),
+ Channeler(1702500, 5658278, false),
+ Confessor(1707600, 1871658719, false),
+ Crusader(1706700, -187454619, false),
+ Doomsayer(1700700, -993659433, false),
+ Druid(1701600, -926740122, false),
+ Fury(1705500, 214401375, false),
+ Huntress(1704900, 970312892, false),
+ Prelate(1707000, -225200922, false),
+ Priest(1705200, -535691898, false),
+ Ranger(1701300, 604716986, false),
+ Scout(1706100, -1497297486, false),
+ Sentinel(1707300, -184898375, false),
+ Templar(1707900, 826673315, false),
+ Thief(1708200, 1757633920, false),
+ Warlock(1706400, 1003385946, false),
+ Warrior(1703700, 931048026, false),
+ Wizard(1705800, 777115928, false),
+ Nightstalker(1709400, 373174890, false),
+ Necromancer(1709700, -319294505, false),
+ Vampire(1710000, 1049274530, true);
+
+ private final int blueprintUUID;
+ private final int powerToken;
+ private final ArrayList shrines = new ArrayList<>();
+ private final boolean isRace;
+
+ ShrineType(int blueprintUUID, int powerToken, boolean isRace) {
+ this.blueprintUUID = blueprintUUID;
+ this.powerToken = powerToken;
+ this.isRace = isRace;
+
+ }
+
+ public int getBlueprintUUID() {
+ return blueprintUUID;
+ }
+
+ public int getPowerToken() {
+ return powerToken;
+ }
+
+ public ArrayList getShrinesCopy() {
+ ArrayList copyShrines = new ArrayList<>();
+ copyShrines.addAll(shrines);
+ Collections.sort(copyShrines);
+ return copyShrines;
+ }
+
+ public final void addShrineToServerList(Shrine shrine) {
+ synchronized (shrines) {
+ shrines.add(shrine);
+ }
+ }
+
+ public final void RemoveShrineFromServerList(Shrine shrine) {
+ synchronized (shrines) {
+ shrines.remove(shrine);
+ }
+ }
+
+ public boolean isRace() {
+ return isRace;
+ }
+ }
+
+ public enum GuildState {
+
+ Errant(0),
+ Sworn(4),
+ Protectorate(6),
+ Petitioner(2),
+ Province(8),
+ Nation(5),
+ Sovereign(7);
+
+ private final int stateID;
+
+ GuildState(int stateID) {
+ this.stateID = stateID;
+ }
+
+ public int getStateID() {
+ return stateID;
+ }
+
+ }
+
+
+ // Building group enumeration.
+ // This is used to drive linear equations to calculate
+ // structure hp, ranking times and such from within
+ // the BuildingBlueprint class.
+ //
+ // It is also used as a bitvector flag in the npc
+ // building slot mechanics.
+
+ public enum BuildingGroup implements EnumBitSetHelper {
+ NONE(0, 0),
+ TOL(64f, 64f),
+ BARRACK(32f, 64f),
+ CHURCH(64f, 64f),
+ FORGE(32f, 64f),
+ SPIRE(16f, 16f),
+ GENERICNOUPGRADE(16f, 16f),
+ WALLSTRAIGHT(16f, 64),
+ WALLCORNER(64f, 64f),
+ SMALLGATE(64f, 64),
+ ARTYTOWER(64f, 64),
+ SIEGETENT(32f, 32f),
+ BANESTONE(16f, 16f),
+ MINE(16f, 16f),
+ WAREHOUSE(32f, 32f),
+ SHRINE(16f, 16f),
+ RUNEGATE(64f, 64f),
+ AMAZONHALL(64f, 64f),
+ CATHEDRAL(64f, 64f),
+ GREATHALL(64f, 64f),
+ KEEP(64f, 64f),
+ THIEFHALL(64f, 24f),
+ TEMPLEHALL(64f, 64f),
+ WIZARDHALL(64f, 64f),
+ ELVENHALL(64f, 64f),
+ ELVENSANCTUM(64f, 64f),
+ IREKEIHALL(64f, 64f),
+ FORESTHALL(64f, 64f),
+ MAGICSHOP(32f, 32f),
+ BULWARK(32f, 32f),
+ SHACK(16f, 16f),
+ INN(64f, 32f),
+ TAILOR(32f, 32f),
+ VILLA(64f, 32f),
+ ESTATE(64f, 64f),
+ FORTRESS(64f, 64f),
+ CITADEL(64f, 64f),
+ WALLSTRAIGHTTOWER(16f, 64),
+ WALLSTAIRS(64, 64);
+
+ private final Vector2f extents;
+
+ BuildingGroup(float extentX, float extentY) {
+ this.extents = new Vector2f(extentX, extentY);
+ }
+
+ public Vector2f getExtents() {
+ return extents;
+ }
+
+ }
+
+ public enum UpdateType {
+ ALL,
+ MOVEMENT,
+ REGEN,
+ FLIGHT,
+ LOCATION,
+ MOVEMENTSTATE;
+ }
+
+ public enum ServerType {
+ WORLDSERVER,
+ LOGINSERVER,
+ NONE;
+ }
+
+ public enum ChatChannel implements EnumBitSetHelper {
+ System,
+ Announce,
+ Unknown,
+ Commander,
+ Address,
+ Nation,
+ Leader,
+ Shout,
+ Siege,
+ Territory,
+ Info,
+ CSR,
+ Guild,
+ InnerCouncil,
+ Group,
+ City,
+ Say,
+ Emote,
+ Social,
+ Tell,
+ Combat,
+ Powers,
+ Snoop,
+ Debug,
+ Global,
+ Trade,
+ PVP,
+ Mine,
+ Alert,
+ Assassin,
+ Barbarian,
+ Bard,
+ Channeler,
+ Confessor,
+ Crusader,
+ Doomsayer,
+ Druid,
+ Fury,
+ Huntress,
+ Necromancer,
+ Nightstalker,
+ Prelate,
+ Priest,
+ Ranger,
+ Scout,
+ Sentinel,
+ Templar,
+ Thief,
+ Warlock,
+ Warrior,
+ Wizard;
+
+ }
+
+ public enum AllianceType {
+ RecommendedAlly,
+ RecommendedEnemy,
+ Ally,
+ Enemy;
+ }
+
+ public enum FriendStatus {
+ Available,
+ Away,
+ Busy;
+ }
+
+ public enum ProfitType {
+
+
+ BuyNormal("buy_normal"),
+ BuyGuild("buy_guild"),
+ BuyNation("buy_nation"),
+ SellNormal("sell_normal"),
+ SellGuild("sell_guild"),
+ SellNation("sell_nation");
+
+ public String dbField;
+
+ private ProfitType(String dbField) {
+ this.dbField = dbField;
+ }
+ }
+
+ public enum GameObjectType {
+
+ /*
+ * These will be used as the 4 high bytes in the application protocol's
+ * long CompositeID field and when tracking an AbstractGameObject's type
+ * from within the code. The low 4 bytes will be used as the Object's
+ * UUID
+ */
+ unknown,
+ Account,
+ AccountIP,
+ ActiveEffect,
+ ArmorBase,
+ BaseClass,
+ BeardStyle,
+ BlockedIP,
+ Building,
+ BuildingLocation,
+ BuildingModelBase,
+ CharacterPower,
+ CharacterPowers,
+ CharacterRune,
+ CharacterSkill,
+ City,
+ Contract,
+ Corpse,
+ CSSession,
+ EffectsResourceCosts,
+ EnchantmentBase,
+ GenericItemBase,
+ Group,
+ Guild,
+ GuildAllianceEnemy,
+ GuildBanish,
+ GuildCharacterKOS,
+ GuildGuildKOS,
+ GuildTableList,
+ HairStyle,
+ Item,
+ ItemContainer,
+ ItemEnchantment,
+ JewelryBase,
+ Kit,
+ MenuOption,
+ Mine,
+ Mob,
+ MobBase,
+ MobEquipment,
+ MobLoot,
+ MobType,
+ NPC,
+ NPCClassRune,
+ NPCClassRuneThree,
+ NPCClassRuneTwo,
+ NPCExtraRune,
+ NPCRaceRune,
+ NPCRune,
+ NPCShopkeeperRune,
+ NPCTrainerRune,
+ Nation,
+ PlayerCharacter,
+ PlayerInfo,
+ PowerGrant,
+ PowerReq,
+ PowersBase,
+ PowersBaseAttribute,
+ PromotionClass,
+ Race,
+ RuneBase,
+ RuneBaseAttribute,
+ RuneBaseEffect,
+ SkillReq,
+ SkillsBase,
+ SkillsBaseAttribute,
+ MobileBooty,
+ StrongBox,
+ Trigger,
+ ValidRaceBeardStyle,
+ ValidRaceClassCombo,
+ ValidRaceHairStyle,
+ VendorDialog,
+ Warehouse,
+ WeaponBase,
+ WorldServerInfo,
+ WorldServerInfoSnapshot,
+ Shrine,
+ Zone,
+ Transaction;
+ }
+
+ public enum ContainerType {
+ BANK,
+ INVENTORY,
+ VAULT;
+ }
+
+ ;
+
+ public enum CompoundCurveType {
+ DefaultFlat(0),
+ DefaultSlope(1),
+ DefaultSlopeDown(-1),
+ SL0001Up(0.01),
+ SL0003Up(0.03),
+ SL0005Up(0.05),
+ SL0006Up(0.06),
+ SL0007Up(0.07),
+ SL0008Up(0.08),
+ SL0010Up(0.10),
+ SL0011Up(0.11),
+ SL0012Up(0.12),
+ SL0013Up(0.13),
+ SL0014Up(0.14),
+ SL00143U(0.143),
+ SL0015Up(0.15),
+ SL0016Up(0.16),
+ SL0019Up(0.19),
+ SL0020Up(0.20),
+ SL0021Up(0.21),
+ SL0022Up(0.22),
+ SL0023Up(0.23),
+ SL0024Up(0.24),
+ SL0025Up(0.25),
+ SL0026Up(0.26),
+ SL0028Up(0.28),
+ SL0030Up(0.30),
+ SL0031Up(0.31),
+ SL0032Up(0.32),
+ SL0033Up(0.33),
+ SL0034Up(0.34),
+ SL0035Up(0.35),
+ SL0037Up(0.37),
+ SL0038Up(0.38),
+ SL0039Up(0.39),
+ SL0040Up(0.40),
+ SL0041Up(0.41),
+ SL0042Up(0.42),
+ SL0043Up(0.43),
+ SL0044Up(0.44),
+ SL0045Up(0.45),
+ SL0046Up(0.46),
+ SL0047Up(0.47),
+ SL0048Up(0.48),
+ SL0050Up(0.50),
+ SL0051Up(0.51),
+ SL0053Up(0.53),
+ SL0054Up(0.54),
+ SL0055Up(0.55),
+ SL0056Up(0.56),
+ SL0057Up(0.57),
+ SL0058Up(0.58),
+ SL0060Up(0.60),
+ SL0061Up(0.61),
+ SL0063Up(0.63),
+ SL0064Up(0.64),
+ SL0065Up(0.65),
+ SL0066Up(0.66),
+ SL0067Up(0.67),
+ SL0068Up(0.68),
+ SL0069Up(0.69),
+ SL0070Up(0.70),
+ SL0071Up(0.71),
+ SL0073Up(0.73),
+ SL0074Up(0.74),
+ SL0075Up(0.75),
+ SL0076Up(0.76),
+ SL0077Up(0.77),
+ SL0079Up(0.79),
+ SL0080Up(0.80),
+ SL0081Up(0.81),
+ SL0082Up(0.82),
+ SL0083Up(0.83),
+ SL0084Up(0.84),
+ SL0085Up(0.85),
+ SL0087Up(0.87),
+ SL0088Up(0.88),
+ SL0089Up(0.89),
+ SL0090Up(0.90),
+ SL0092Up(0.92),
+ SL0098Up(0.98),
+ SL0100Up(1.00),
+ SL0106Up(1.06),
+ SL0109Up(1.09),
+ SL0112Up(1.12),
+ SL0113Up(1.13),
+ SL0115Up(1.15),
+ SL0116Up(1.16),
+ SL0122Up(1.22),
+ SL0123Up(1.23),
+ SL0125Up(1.25),
+ SL0128Up(1.28),
+ SL0130Up(1.30),
+ SL0135Up(1.35),
+ SL0140Up(1.40),
+ SL0143Up(1.43),
+ SL0145Up(1.45),
+ SL0150Up(1.50),
+ SL0154Up(1.54),
+ SL0163Up(1.63),
+ SL0166Up(1.66),
+ SL0175Up(1.75),
+ SL0188Up(1.88),
+ SL0190Up(1.90),
+ SL0200Up(2.00),
+ SL0222Up(2.22),
+ SL0225Up(2.25),
+ SL0235Up(2.35),
+ SL0238Up(2.38),
+ SL0250Up(2.50),
+ SL0260Up(2.60),
+ SL0263Up(2.63),
+ SL0275Up(2.75),
+ SL0280Up(2.80),
+ SL0300Up(3.00),
+ SL0308Up(3.08),
+ SL0312Up(3.12),
+ SL0350Up(3.50),
+ SL0357Up(3.57),
+ SL0360Up(3.60),
+ SL0375Up(3.75),
+ SL0380Up(3.80),
+ SL0385Up(3.85),
+ SL0400Up(4.00),
+ SL0410Up(4.10),
+ SL0429Up(4.29),
+ SL0450Up(4.50),
+ SL0460Up(4.60),
+ SL0480Up(4.80),
+ SL0500Up(5.00),
+ SL0510Up(5.10),
+ SL0550Up(5.50),
+ SL0600Up(6.00),
+ SL0643Up(6.43),
+ SL0714Up(7.14),
+ SL0750Up(7.50),
+ SL0790Up(7.90),
+ SL0800Up(8.00),
+ SL0900Up(9.00),
+ SL1000Up(10.00),
+ SL1050Up(10.50),
+ SL1100Up(11.00),
+ SL1125Up(11.25),
+ SL1200Up(12.00),
+ SL1282Up(12.82),
+ SL1300Up(13.00),
+ SL1350Up(13.50),
+ SL1400Up(14.00),
+ SL1500Up(15.00),
+ SL1579Up(15.79),
+ SL2000Up(20.00),
+ SL2100Up(21.00),
+ SL2500Up(25.00),
+ SL2521Up(25.21),
+ SL3000Up(30.00),
+ SL4000Up(40.00),
+ SL5000Up(50.00),
+ SL6000Up(60.00),
+ SL7500Up(75.00),
+ SL8000Up(80.00),
+ SL12000Up(120.00),
+ SL14000Up(140.00),
+ SL30000Up(300.00),
+ SL66600Up(666.00),
+ SL71500Up(715.00),
+ SL00003Down(-0.003),
+ SL0001Down(-0.01),
+ SL0003Down(-0.03),
+ SL0004Down(-0.04),
+ SL0005Down(-0.05),
+ SL0006Down(-0.06),
+ SL0007Down(-0.07),
+ SL00075Down(-0.075),
+ SL0008Down(-0.08),
+ SL0009Down(-0.09),
+ SL0010Down(-0.10),
+ SL0011Down(-0.11),
+ SL0012Down(-0.12),
+ SL0013Down(-0.13),
+ SL00125Down(-0.125),
+ SL0014Down(-0.14),
+ SL0015Down(-0.15),
+ SL0016Down(-0.16),
+ SL0017Down(-0.17),
+ SL00175Down(-0.175),
+ SL0018Down(-0.18),
+ SL0019Down(-0.19),
+ SL0020Down(-0.20),
+ SL0023Down(-0.23),
+ SL0024Down(-0.24),
+ SL0025Down(-0.25),
+ SL0027Down(-0.27),
+ SL0028Down(-0.28),
+ SL0029Down(-0.29),
+ SL0030Down(-0.30),
+ SL0032Down(-0.32),
+ SL0033Down(-0.33),
+ SL0035Down(-0.35),
+ SL0038Down(-0.38),
+ SL0040Down(-0.40),
+ SL0044Down(-0.44),
+ SL0045Down(-0.45),
+ SL0050Down(-0.50),
+ SL0055Down(-0.55),
+ SL0060Down(-0.60),
+ SL0062Down(-0.62),
+ SL0063Down(-0.63),
+ SL0064Down(-0.64),
+ SL0066Down(-0.66),
+ SL0069Down(-0.69),
+ SL0071Down(-0.71),
+ SL0075Down(-0.75),
+ SL0077Down(-0.77),
+ SL0079Down(-0.79),
+ SL0080Down(-0.80),
+ SL0090Down(-0.90),
+ SL0100Down(-1.00),
+ SL0113Down(-1.13),
+ SL0120Down(-1.20),
+ SL0125Down(-1.25),
+ SL0128Down(-1.28),
+ SL0130Down(-1.30),
+ SL0135Down(-1.35),
+ SL0150Down(-1.50),
+ SL0175Down(-1.75),
+ SL0188Down(-1.88),
+ SL0200Down(-2.00),
+ SL0225Down(-2.25),
+ SL0250Down(-2.50),
+ SL0263Down(-2.63),
+ SL0300Down(-3.00),
+ SL0357Down(-3.57),
+ SL0385Down(-3.85),
+ SL0429Down(-4.29),
+ SL0450Down(-4.50),
+ SL0500Down(-5.00),
+ SL0550Down(-5.50),
+ SL0600Down(-6.00),
+ SL0643Down(-6.43),
+ SL0714Down(-7.14),
+ SL0750Down(-7.50),
+ SL0790Down(-7.90),
+ SL0800Down(-8.00),
+ SL1000Down(-10.00),
+ SL1050Down(-10.50),
+ SL1200Down(-12.00),
+ SL1350Down(-13.50),
+ SL1500Down(-15.00),
+ SL1579Down(-15.79),
+ SL2000Down(-20.00),
+ SL2400Down(-24.00),
+ SL2500Down(-25.00),
+ SL3000Down(-30.00),
+ SL4500Down(-45.00),
+ SL7500Down(-75.00),
+ SIVL0005(0.005),
+ SIVL0008(0.008),
+ SIVL0009(0.009),
+ SIVL0010(0.010),
+ SIVL0012(0.012),
+ SIVL0013(0.013),
+ SIVL0014(0.014),
+ SIVL0015(0.015),
+ SIVL0016(0.016),
+ SIVL0017(0.017),
+ SIVL0019(0.019),
+ SIVL0020(0.020),
+ SIVL0021(0.021),
+ SIVL0022(0.022),
+ SIVL0023(0.023),
+ SIVL0024(0.024),
+ SIVL0025(0.025),
+ SIVL0026(0.026),
+ SIVL0027(0.027),
+ SIVL0029(0.029),
+ SIVL0030(0.030),
+ SIVL0031(0.031),
+ SIVL0032(0.032),
+ SIVL0033(0.033),
+ SIVL0034(0.034),
+ SIVL0035(0.035),
+ SIVL0036(0.036),
+ SIVL0038(0.038),
+ SIVL0040(0.040),
+ SIVL0044(0.044),
+ SIVL0046(0.046),
+ SIVL0048(0.048),
+ SIVL0055(0.055),
+ SIVL0056(0.056),
+ SIVL0057(0.057),
+ SIVL0058(0.058),
+ SIVL0060(0.060),
+ SIVL0061(0.061),
+ SIVL0066(0.066),
+ SIVL0067(0.067),
+ SIVL0075(0.075),
+ SIVL0078(0.078),
+ SIVL0130(0.130),
+ SIVL0150(0.150),
+ SIVL0205(0.205),
+ SIVL0220(0.220),
+ SIVL0243(0.243),
+ SIVL0360(0.360);
+
+ private final double value;
+
+ private CompoundCurveType(double value) {
+
+ this.value = value;
+ }
+
+ public double getValue() {
+ return value;
+ }
+ }
+
+ public enum PowerFailCondition {
+
+ Attack,
+ AttackSwing,
+ Cast,
+ CastSpell,
+ EquipChange,
+ Logout,
+ Move,
+ NewCharm,
+ Sit,
+ TakeDamage,
+ TerritoryClaim,
+ UnEquip;
+ }
+
+ public enum PowerSubType {
+ Amount,
+ Ramp,
+ UseAddFormula,
+ DamageType1,
+ DamageType2,
+ DamageType3,
+ Cancel;
+ }
+
+ public enum PowerCategoryType {
+ NONE,
+ WEAPON,
+ BUFF,
+ DEBUFF,
+ SPECIAL,
+ DAMAGE,
+ DISPEL,
+ INVIS,
+ STUN,
+ TELEPORT,
+ HEAL,
+ VAMPDRAIN,
+ BLESSING,
+ BOONRACE,
+ BOONCLASS,
+ BEHAVIOR,
+ CHANT,
+ GROUPBUFF,
+ MOVE,
+ FLIGHT,
+ GROUPHEAL,
+ AEDAMAGE,
+ BREAKFLY,
+ AE,
+ TRANSFORM,
+ TRACK,
+ SUMMON,
+ STANCE,
+ RECALL,
+ SPIREPROOFTELEPORT,
+ SPIREDISABLE,
+ THIEF;
+ }
+
+ public enum PowerTargetType {
+
+ SELF,
+ PCMOBILE,
+ PET,
+ MOBILE,
+ PC,
+ WEAPON,
+ GUILDLEADER,
+ BUILDING,
+ GROUP,
+ ARMORWEAPONJEWELRY,
+ CORPSE,
+ JEWELRY,
+ WEAPONARMOR,
+ ARMOR,
+ ITEM;
+ }
+
+ public enum objectMaskType {
+ PLAYER,
+ MOB,
+ PET,
+ CORPSE,
+ BUILDING,
+ UNDEAD,
+ BEAST,
+ HUMANOID,
+ NPC,
+ IAGENT,
+ DRAGON,
+ RAT,
+ SIEGE,
+ CITY,
+ ZONE;
+
+ public static EnumSet AGGRO = EnumSet.of(PLAYER, PET);
+ public static EnumSet MOBILE = EnumSet.of(PLAYER, MOB, PET);
+ public static EnumSet STATIC = EnumSet.of(CORPSE, BUILDING, NPC);
+
+ }
+
+ public enum ItemContainerType {
+ NONE,
+ INVENTORY,
+ EQUIPPED,
+ BANK,
+ VAULT,
+ FORGE,
+ WAREHOUSE;
+ }
+
+ public enum ItemSlotType implements EnumBitSetHelper {
+ RHELD,
+ LHELD,
+ HELM,
+ CHEST,
+ SLEEVES,
+ HANDS,
+ RRING,
+ LRING,
+ AMULET,
+ LEGS,
+ FEET,
+ CLOAK,
+ SHIN,
+ UPLEGS,
+ UPARM,
+ WINGS,
+ BEARD,
+ HAIR;
+ }
+
+ public enum CityBoundsType {
+
+ GRID(640),
+ ZONE(875),
+ PLACEMENT(1050);
+
+ public final float extents;
+
+ CityBoundsType(float extents) {
+ this.extents = extents;
+ }
+ }
+
+ public enum GuildType {
+ NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}),
+ CATHEDRAL("Church of the All-Father", new String[][]{
+ {"Acolyte", "Acolyte"},
+ {"Catechist"},
+ {"Deacon", "Deaconess"},
+ {"Priest", "Priestess"},
+ {"High Priest", "High Priestess"},
+ {"Bishop", "Bishop"},
+ {"Lord Cardinal", "Lady Cardinal"},
+ {"Patriarch", "Matriarch"}},
+ new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"}),
+ MILITARY("Military", new String[][]{
+ {"Recruit"},
+ {"Footman"},
+ {"Corporal"},
+ {"Sergeant"},
+ {"Lieutenant"},
+ {"Captain"},
+ {"General"},
+ {"Lord Marshall", "Lady Marshall"}},
+ new String[]{"Autocracy", "Common Rule", "Council Rule", "Militocracy"}),
+ TEMPLE("Temple of the Cleansing Flame", new String[][]{
+ {"Aspirant"},
+ {"Novice"},
+ {"Initiate"},
+ {"Inquisitor"},
+ {"Jannisary"},
+ {"Tribune"},
+ {"Lictor"},
+ {"Justiciar"},
+ {"Pontifex", "Pontifectrix"}},
+ new String[]{"Despot Rule", "Common Rule", "Protectorship", "Republic Rule"}),
+ BARBARIAN("Barbarian Clan", new String[][]{
+ {"Barbarian"},
+ {"Skald"},
+ {"Raider"},
+ {"Karl"},
+ {"Jarl"},
+ {"Chieftain"},
+ {"Thane"}},
+ new String[]{"Chiefdom", "Common Rule", "Council Rule", "Republic Rule"}),
+ RANGER("Ranger's Brotherhood", new String[][]{
+ {"Yeoman"},
+ {"Pathfinder"},
+ {"Tracker"},
+ {"Seeker"},
+ {"Protector"},
+ {"Guardian"},
+ {"Lord Protector", "Lady Protector"}},
+ new String[]{"Despot Rule", "Collectivism", "Council Rule", "Republic Rule"}),
+ AMAZON("Amazon Temple", new String[][]{
+ {"Amazon Thrall", "Amazon"},
+ {"Amazon Slave", "Amazon Warrior"},
+ {"Amazon Servant", "Amazon Chieftess"},
+ {"Amazon Consort", "Amazon Princess"},
+ {"Amazon Seneschal", "Majestrix"},
+ {"Amazon Regent", "Imperatrix"}},
+ new String[]{"Despot Rule", "Common Rule", "Gynarchy", "Gynocracy"}),
+ NOBLE("Noble House", new String[][]{
+ {"Serf"},
+ {"Vassal"},
+ {"Exultant"},
+ {"Lord", "Lady"},
+ {"Baron", "Baroness"},
+ {"Count", "Countess"},
+ {"Duke", "Duchess"},
+ {"King", "Queen"},
+ {"Emperor", "Empress"}},
+ new String[]{"Monarchy", "Common Rule", "Feodality", "Republic"}),
+ WIZARD("Wizard's Conclave", new String[][]{
+ {"Apprentice"},
+ {"Neophyte"},
+ {"Adeptus Minor"},
+ {"Adeptus Major"},
+ {"Magus"},
+ {"High Magus"},
+ {"Archmagus"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Magocracy"}),
+ MERCENARY("Mercenary Company", new String[][]{
+ {"Soldier"},
+ {"Man-at-Arms"},
+ {"Veteran"},
+ {"Myrmidon"},
+ {"Captain"},
+ {"Commander"},
+ {"High Commander"},
+ {"Warlord"}},
+ new String[]{"Magistrature", "Mob Law", "Council Rule", "Republic Rule"}),
+ THIEVES("Thieve's Den", new String[][]{
+ {"Urchin"},
+ {"Footpad"},
+ {"Grifter"},
+ {"Burglar"},
+ {"Collector"},
+ {"Naster Thief"},
+ {"Treasurer"},
+ {"Grandmaster Thief"},
+ {"Grandfather"}},
+ new String[]{"Despot Rule", "Common Rule", "Oligarchy", "Republic Rule"}),
+ DWARF("Dwarf Hold", new String[][]{
+ {"Citizen"},
+ {"Master"},
+ {"Councilor"},
+ {"Thane"},
+ {"Great Thane"},
+ {"High Thane"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
+ HIGHCOURT("High Court", new String[][]{
+ {"Eccekebe"},
+ {"Saedulor"},
+ {"Hodrimarth"},
+ {"Mandrae"},
+ {"Imaelin"},
+ {"Thaelostor", "Thaelostril"},
+ {"Dar Thaelostor", "Dar Thaelostril"},
+ {"Aglaeron"},
+ {"Ellestor", "Elestril"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
+ VIRAKT("Virakt", new String[][]{
+ {"Jov'uus"},
+ {"Urikhan"},
+ {"Irkhan"},
+ {"Khal'usht"},
+ {"Arkhalar"},
+ {"Khal'uvho"},
+ {"Khar'uus"},
+ {"Kryqh'khalin"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
+ BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names
+ {"Devotee"},
+ {"Initiated"},
+ {"Witch of the First"},
+ {"Witch of the Second"},
+ {"Witch of the Third"},
+ {"Elder"},
+ {"Hierophant"},
+ {"Witch King", "Witch Queen"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
+ UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names
+ {"Footman"},
+ {"Fell Legionaire"},
+ {"Fell Centurion"},
+ {"Dark Captain"},
+ {"Dark Commander"},
+ {"Dark Master", "Dark Mistress"},
+ {"Dread Master", "Dread Mistress"},
+ {"Dread Lord", "Dread Lady"}},
+ new String[]{"Despot Rule", "Despot Rule", "Council Rule", "Republic Rule"}),
+ SCOURGE("Cult of the Scourge", new String[][]{
+ {"Thrall"},
+ {"Mudir"},
+ {"Dark Brother", "Dark Sister"},
+ {"Hand of the Dark"},
+ {"Dark Father", "Dark Mother"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
+ PIRATE("Pirate Crew", new String[][]{
+ {"Midshipman", "Midshipwoman"},
+ {"Sailor"},
+ {"Third Mat"},
+ {"Second Mat"},
+ {"First Mate"},
+ {"Captain"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
+ HERALD("Academy of Heralds", new String[][]{
+ {"Pupil"},
+ {"Scribe"},
+ {"Recorder"},
+ {"Scrivener"},
+ {"Chronicler"},
+ {"Scholar"},
+ {"Archivist"},
+ {"Loremaster"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
+ CENTAUR("Centaur Cohort", new String[][]{
+ {"Hoplite"},
+ {"Peltast"},
+ {"Myrmidon"},
+ {"Myrmidon"},
+ {"Cataphract"},
+ {"Septenrion"},
+ {"Praetorian"},
+ {"Paragon"}},
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"}),
+ KHREE("Aracoix Kh'ree", new String[][]{
+ {"Duriacor"},
+ {"Exarch"},
+ {"Tetrarch"},
+ {"Dimarch"},
+ {"Elnarch"},
+ {"Illiarch"},
+ {"Tellotharch"},
+ {"Erentar"},
+ {"Araceos"},
+ {"Hierarch"}},
+
+ new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"});
+
+ private final String name;
+ private final String[][] ranks; //Stored Rank#->Gender(M,F)
+ private final String[] leadershipTypes;
+
+ GuildType(String name, String[][] ranks, String[] leadershipTypes) {
+ this.name = name;
+ this.ranks = ranks;
+ this.leadershipTypes = leadershipTypes;
+ }
+
+ public static GuildType getGuildTypeFromCharter(ItemBase itemBase) {
+
+ GuildType charterType;
+
+ // Must be a valid charter object
+
+ if (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)
+ return GuildType.NONE; //No guild Type
+
+ // No switches on long in java. Cast to int
+ // when refactor to long uuid's. Loss won't matter
+ // with values this small.
+
+ switch (itemBase.getUUID()) {
+
+ case 559:
+ charterType = GuildType.CATHEDRAL;
+ break;
+ case 560:
+ charterType = GuildType.MILITARY;
+ break;
+ case 561:
+ charterType = GuildType.TEMPLE;
+ break;
+ case 562:
+ charterType = GuildType.BARBARIAN;
+ break;
+ case 563:
+ charterType = GuildType.RANGER;
+ break;
+ case 564:
+ charterType = GuildType.AMAZON;
+ break;
+ case 565:
+ charterType = GuildType.NOBLE;
+ break;
+ case 566:
+ charterType = GuildType.WIZARD;
+ break;
+ case 567:
+ charterType = GuildType.MERCENARY;
+ break;
+ case 568:
+ charterType = GuildType.THIEVES;
+ break;
+ case 569:
+ charterType = GuildType.DWARF;
+ break;
+ case 570:
+ charterType = GuildType.HIGHCOURT;
+ break;
+ case 571:
+ charterType = GuildType.VIRAKT;
+ break;
+ case 572:
+ charterType = GuildType.SCOURGE;
+ break;
+ case 573:
+ charterType = GuildType.KHREE;
+ break;
+ case 574:
+ charterType = GuildType.CENTAUR;
+ break;
+ case 575:
+ charterType = GuildType.UNHOLY;
+ break;
+ case 576:
+ charterType = GuildType.PIRATE;
+ break;
+ case 577:
+ charterType = GuildType.BRIALIA;
+ break;
+
+ default:
+ charterType = GuildType.HERALD;
+ }
+
+ return charterType;
+ }
+
+ public static GuildType getGuildTypeFromInt(int i) {
+ return GuildType.values()[i];
+ }
+
+ public String getCharterName() {
+ return this.name;
+ }
+
+ public int getNumberOfRanks() {
+ return ranks.length;
+ }
+
+ public String getRankForGender(int rank, boolean male) {
+ if (ranks.length < rank) {
+ return "";
+ }
+
+ if (ranks[rank].length != 1 && !male) {
+ return ranks[rank][1];
+ }
+ return ranks[rank][0];
+ }
+
+ public String getLeadershipType(int i) {
+ return leadershipTypes[i];
+ }
+
+ }
+
+ public enum MinionClass {
+ MELEE,
+ ARCHER,
+ MAGE;
+ }
+
+ public enum MinionType {
+ AELFBORNGUARD(951, 1637, MinionClass.MELEE, "Guard", "Aelfborn"),
+ AELFBORNMAGE(952, 1635, MinionClass.MAGE, "Adept", "Aelfborn"),
+ AMAZONGUARD(1500, 1670, MinionClass.MELEE, "Guard", "Amazon"),
+ AMAZONMAGE(1502, 1638, MinionClass.MAGE, "Fury", "Amazon"),
+ ARACOIXGUARD(1600, 1672, MinionClass.MELEE, "Guard", "Aracoix"), //used guard captain equipset.
+ ARACOIXMAGE(1602, 885, MinionClass.MAGE, "Adept", "Aracoix"),
+ CENTAURGUARD(1650, 1642, MinionClass.MELEE, "Guard", "Centaur"),
+ CENTAURMAGE(1652, 1640, MinionClass.MAGE, "Druid", "Centaur"),
+ DWARVENARCHER(845, 1644, MinionClass.ARCHER, "Marksman", "Dwarven"),
+ DWARVENGUARD(1050, 1666, MinionClass.MELEE, "Guard", "Dwarven"),
+ DWARVENMAGE(1052, 1643, MinionClass.MAGE, "War Priest", "Dwarven"),
+ ELFGUARD(1180, 1671, MinionClass.MELEE, "Guard", "Elven"), //old 1645
+ ELFMAGE(1182, 1667, MinionClass.MAGE, "Adept", "Elven"),
+ FORESTGUARD(1550, 1668, MinionClass.MELEE, "Guard", "Forest"), //captain changed to guard equipset
+ FORESTMAGE(1552, 436, MinionClass.MAGE, "Adept", "Forest"),
+ HOLYGUARD(1525, 1658, MinionClass.MELEE, "Guard", "Holy Church"),
+ HOLYMAGE(1527, 1646, MinionClass.MAGE, "Prelate", "Holy Church"),
+ HUMANARCHER(846, 1654, MinionClass.ARCHER, "Archer", "Human"),
+ HUMANGUARD(840, 1665, MinionClass.MELEE, "Guard", "Human"),
+ HUMANMAGE(848, 1655, MinionClass.MAGE, "Adept", "Human"),
+ IREKEIGUARD(1350, 1659, MinionClass.MELEE, "Guard", "Irekei"),
+ IREKEIMAGE(1352, 1660, MinionClass.MAGE, "Adept", "Irekei"),
+ MINOTAURARCHER(1701, 0, MinionClass.ARCHER, "Archer", "Minotaur"),
+ MINOTAURGUARD(1700, 1673, MinionClass.MELEE, "Guard", "Minotaur"),
+ NORTHMANGUARD(1250, 1669, MinionClass.MELEE, "Guard", "Northman"),
+ NORTHMANMAGE(1252, 1650, MinionClass.MAGE, "Runecaster", "Northman"),
+ SHADEGUARD(1450, 1662, MinionClass.MELEE, "Guard", "Shade"),
+ SHADEMAGE(1452, 1664, MinionClass.MAGE, "Adept", "Shade"),
+ TEMPLARGUARD(841, 1564, MinionClass.MELEE, "Marksman", "Templar"),
+ TEMPLEGUARD(1575, 1652, MinionClass.MELEE, "Guard", "Temple"),
+ TEMPLEMAGE(1577, 1656, MinionClass.MAGE, "Confessor", "Temple"),
+ UNDEADGUARD(980100, 1674, MinionClass.MELEE, "Guard", "Undead"),
+ UNDEADMAGE(980102, 1675, MinionClass.MAGE, "Adept", "Undead"),
+ WEREWOLFGUARD(980104, 0, MinionClass.MELEE, "Guard", "Werewolf"),
+ WEREBEARGUARD(980103, 0, MinionClass.MELEE, "Guard", "Werebear");
+ public static HashMap ContractToMinionMap = new HashMap<>();
+ private final int captainContractID;
+ private final int equipSetID;
+ private final MinionClass minionClass;
+ private final String name;
+ private final String race;
+
+ MinionType(int captainContractID, int equipSetID, MinionClass minionClass, String name, String race) {
+
+ this.captainContractID = captainContractID;
+ this.equipSetID = equipSetID;
+ this.minionClass = minionClass;
+ this.name = name;
+ this.race = race;
+
+ }
+
+ public static void InitializeMinions() {
+
+ for (MinionType minionType : MinionType.values())
+ ContractToMinionMap.put(minionType.captainContractID, minionType);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getRace() {
+ return race;
+ }
+
+ }
+
+ public enum GridObjectType {
+ STATIC,
+ DYNAMIC;
+ }
+
+ public enum SupportMsgType {
+ NONE(0),
+ PROTECT(1),
+ UNPROTECT(3),
+ VIEWUNPROTECTED(4),
+ REMOVETAX(6),
+ ACCEPTTAX(7),
+ CONFIRMPROTECT(8);
+
+ public static HashMap typeLookup = new HashMap<>();
+ private final int type;
+
+ SupportMsgType(int messageType) {
+ this.type = messageType;
+
+ }
+
+ public static void InitializeSupportMsgType() {
+
+ for (SupportMsgType supportMsgType : SupportMsgType.values())
+ typeLookup.put(supportMsgType.type, supportMsgType);
+ }
+ }
+
+ public enum ResourceType implements EnumBitSetHelper {
+
+ STONE(1580000),
+ TRUESTEEL(1580001),
+ IRON(1580002),
+ ADAMANT(1580003),
+ LUMBER(1580004),
+ OAK(1580005),
+ BRONZEWOOD(1580006),
+ MANDRAKE(1580007),
+ COAL(1580008),
+ AGATE(1580009),
+ DIAMOND(1580010),
+ ONYX(1580011),
+ AZOTH(1580012),
+ ORICHALK(1580013),
+ ANTIMONY(1580014),
+ SULFUR(1580015),
+ QUICKSILVER(1580016),
+ GALVOR(1580017),
+ WORMWOOD(1580018),
+ OBSIDIAN(1580019),
+ BLOODSTONE(1580020),
+ MITHRIL(1580021),
+ GOLD(7);
+
+ public static HashMap resourceLookup = new HashMap<>();
+ public int itemID;
+
+ ResourceType(int itemID) {
+ this.itemID = itemID;
+ }
+
+ public static void InitializeResourceTypes() {
+
+ for (ResourceType resourceType : ResourceType.values())
+ resourceLookup.put(resourceType.itemID, resourceType);
+ }
+ }
+
+ public enum PowerActionType {
+ ApplyEffect,
+ ApplyEffects,
+ Block,
+ Charm,
+ ClaimMine,
+ ClearAggro,
+ ClearNearbyAggro,
+ Confusion,
+ CreateMob,
+ DamageOverTime,
+ DeferredPower,
+ DirectDamage,
+ Invis,
+ MobRecall,
+ Peek,
+ Recall,
+ RemoveEffect,
+ Resurrect,
+ RunegateTeleport,
+ SetItemFlag,
+ SimpleDamage,
+ SpireDisable,
+ Steal,
+ Summon,
+ Teleport,
+ Track,
+ TransferStat,
+ TransferStatOT,
+ Transform,
+ TreeChoke
+ }
+
+ public enum AccountStatus {
+ BANNED,
+ ACTIVE,
+ ADMIN;
+ }
+
+ public enum MobBehaviourType {
+ None(null, false, false, false, false, false),
+ //Power
+ Power(null, false, true, true, true, false),
+ PowerHelpee(Power, false, true, true, false, true),
+ PowerHelpeeWimpy(Power, true, false, true, false, false),
+ PowerGrouperWimpy(Power, true, false, true, false, false),
+ PowerAggro(Power, false, true, true, false, true),
+ PowerAggroHelpee(Power, false, true, true, false, true),
+ //Aggro
+ Aggro(null, false, true, true, true, false),
+ AggroHelpee(Aggro, false, true, true, false, true),
AggroHelpeeWimpy(Aggro, true, false, true, false, false),
AggroGrouperWimpy(Aggro, true, false, true, false, false),
//Spell
@@ -2811,30 +2811,30 @@ public class Enum {
SpellAggro(Spell, false, true, true, false, true),
SpellAggroHelpee(Spell, false, true, true, false, true),
SpellAggroHelpeeWimpy(Spell, true, false, true, false, false),
- SpellAggroHelpeeEpic(Spell, false, true, true, false, true),
- SpellAggroGrouperWimpy(Spell, true, false, true, false, false),
- //Independent Types
- SimpleStandingGuard(null, false, false, false, false, false),
- Pet1(null, false, false, true, false, false),
- Simple(null, false, false, true, false, false),
- Helpee(null, false, true, true, false, true),
- HelpeeWimpy(null, true, false, true, false, false),
- GuardCaptain(null, false, true, true, false, false),
- GuardMinion(GuardCaptain, false, true, true, false, false),
- GuardWallArcher(null, false, true, false, false, false),
- Wanderer(null, false, true, true, false, false),
- HamletGuard(null, false, true, false, false, false),
- AggroWanderer(null, false, false, true, false, false);
-
- private static HashMap _behaviourTypes = new HashMap<>();
- public MobBehaviourType BehaviourHelperType;
- public boolean isWimpy;
- public boolean isAgressive;
- public boolean canRoam;
- public boolean callsForHelp;
- public boolean respondsToCallForHelp;
-
- MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
+ SpellAggroHelpeeEpic(Spell, false, true, true, false, true),
+ SpellAggroGrouperWimpy(Spell, true, false, true, false, false),
+ //Independent Types
+ SimpleStandingGuard(null, false, false, false, false, false),
+ Pet1(null, false, false, true, false, false),
+ Simple(null, false, false, true, false, false),
+ Helpee(null, false, true, true, false, true),
+ HelpeeWimpy(null, true, false, true, false, false),
+ GuardCaptain(null, false, true, true, false, false),
+ GuardMinion(GuardCaptain, false, true, true, false, false),
+ GuardWallArcher(null, false, true, false, false, false),
+ Wanderer(null, false, true, true, false, false),
+ HamletGuard(null, false, true, false, false, false),
+ AggroWanderer(null, false, false, true, false, false);
+
+ private static HashMap _behaviourTypes = new HashMap<>();
+ public MobBehaviourType BehaviourHelperType;
+ public boolean isWimpy;
+ public boolean isAgressive;
+ public boolean canRoam;
+ public boolean callsForHelp;
+ public boolean respondsToCallForHelp;
+
+ MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
this.BehaviourHelperType = helpeebehaviourType;
this.isWimpy = wimpy;
this.isAgressive = agressive;
diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java
index e7272dba..3909028d 100644
--- a/src/engine/InterestManagement/HeightMap.java
+++ b/src/engine/InterestManagement/HeightMap.java
@@ -100,7 +100,7 @@ public class HeightMap {
float numOfBuckets = this.heightmapImage.getWidth() - 1;
float calculatedWidth = this.fullExtentsX / numOfBuckets;
this.bucketWidthX = calculatedWidth;
- this.bucketWidthY = this.bucketWidthX; // This makes no sense.
+ this.bucketWidthY = this.bucketWidthX; // This makes no sense.
// Generate pixel array from image data
@@ -142,7 +142,7 @@ public class HeightMap {
this.bucketWidthX = 1;
this.bucketWidthY = 1;
- this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY+1];
+ this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
for (int y = 0; y <= this.fullExtentsY; y++) {
for (int x = 0; x <= this.fullExtentsX; x++) {
@@ -153,7 +153,7 @@ public class HeightMap {
HeightMap.heightmapByLoadNum.put(this.zoneLoadID, this);
}
-
+
public HeightMap(Zone zone) {
this.heightMapID = 999999;
@@ -180,7 +180,7 @@ public class HeightMap {
this.bucketWidthX = 1;
this.bucketWidthY = 1;
- this.pixelColorValues = new int[this.fullExtentsX+1][this.fullExtentsY+1];
+ this.pixelColorValues = new int[this.fullExtentsX + 1][this.fullExtentsY + 1];
for (int y = 0; y <= this.fullExtentsY; y++) {
for (int x = 0; x <= this.fullExtentsX; x++) {
@@ -197,95 +197,13 @@ public class HeightMap {
HeightMap.PlayerCityHeightMap = new HeightMap();
}
-
+
public static void GenerateCustomHeightMap(Zone zone) {
HeightMap heightMap = new HeightMap(zone);
-
- HeightMap.heightmapByLoadNum.put(zone.getLoadNum(), 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
+ HeightMap.heightmapByLoadNum.put(zone.getLoadNum(), heightMap);
- return interpolatedHeight;
}
public static Zone getNextZoneWithTerrain(Zone zone) {
@@ -505,48 +423,6 @@ public class HeightMap {
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) {
Vector2f parentLoc;
@@ -620,24 +496,6 @@ public class HeightMap {
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) {
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() {
// Load the heightmaps into staging hashmap keyed by HashMapID
@@ -661,17 +514,175 @@ public class HeightMap {
//generate static player city heightmap.
HeightMap.GeneratePlayerCityHeightMap();
-
-
+
+
// Clear all heightmap image data as it's no longer needed.
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
heightMap.heightmapImage = null;
}
-
+
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() {
return bucketWidthX;
}
@@ -692,15 +703,4 @@ public class HeightMap {
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;
- }
-
}
diff --git a/src/engine/InterestManagement/InterestManager.java b/src/engine/InterestManagement/InterestManager.java
index 24291887..e0252eff 100644
--- a/src/engine/InterestManagement/InterestManager.java
+++ b/src/engine/InterestManagement/InterestManager.java
@@ -38,14 +38,128 @@ public enum InterestManager implements Runnable {
private static long lastTime;
private static boolean keepGoing = true;
- public void shutdown() {
- this.keepGoing = false;
- }
-
InterestManager() {
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 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 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 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
public void run() {
beginLoadJob();
@@ -84,6 +198,9 @@ public enum InterestManager implements Runnable {
return dur;
}
+ // Forces the loading of static objects (corpses and buildings).
+ // Needed to override threshold limits on loading statics
+
private void updateAllPlayers() {
// get all players
@@ -341,7 +458,7 @@ public enum InterestManager implements Runnable {
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
//MobileFSM.setAwake(awonpc, false);
- ((Mob)awonpc).setCombatTarget(null);
+ ((Mob) awonpc).setCombatTarget(null);
// IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000));
// awonpc.enableIntelligence();
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@@ -358,7 +475,7 @@ public enum InterestManager implements Runnable {
if (awonpc.isMob())
//MobileFSM.setAwake(awonpc, false);
- ((Mob)awonpc).setCombatTarget(null);
+ ((Mob) awonpc).setCombatTarget(null);
// IVarController.setVariable(awonpc, "IntelligenceDisableDelay", (double) (System.currentTimeMillis() + 5000));
// awonpc.enableIntelligence();
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@@ -385,76 +502,6 @@ public enum InterestManager implements Runnable {
//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 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 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) {
if (player == null)
@@ -504,51 +551,4 @@ public enum InterestManager implements Runnable {
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 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");
- }
- }
- }
- }
}
\ No newline at end of file
diff --git a/src/engine/InterestManagement/RealmMap.java b/src/engine/InterestManagement/RealmMap.java
index 9bb8de96..4c08f6bf 100644
--- a/src/engine/InterestManagement/RealmMap.java
+++ b/src/engine/InterestManagement/RealmMap.java
@@ -36,8 +36,8 @@ public enum RealmMap {
// Spatial hashmap. Used for determining which Realm
// a player is currently located within.
- public static int[][] _realmImageMap;
private static final HashMap _rgbToIDMap = new HashMap<>();
+ public static int[][] _realmImageMap;
public static int getRealmIDByColor(Color color) {
diff --git a/src/engine/InterestManagement/WorldGrid.java b/src/engine/InterestManagement/WorldGrid.java
index af932325..2eb71a40 100644
--- a/src/engine/InterestManagement/WorldGrid.java
+++ b/src/engine/InterestManagement/WorldGrid.java
@@ -25,177 +25,177 @@ import java.util.concurrent.ConcurrentHashMap;
public class WorldGrid {
-
- public static ConcurrentHashMap[][] DynamicGridMap;
- public static ConcurrentHashMap[][] StaticGridMap;
- private static float dynamicBucketScale = 0.00390625f; // 256 bucket size, 1/256
- private static float staticBucketScale = 0.00390625f;
- public static void startLoadJob() {
-
- Thread loadJobThread;
-
-
- loadJobThread = new Thread(InterestManager.INTERESTMANAGER);
- loadJobThread.setName("InterestManager");
- loadJobThread.start();
- }
-
- public static boolean moveWorldObject(AbstractWorldObject awo, Vector3fImmutable location) {
- awo.setLoc(location);
- return true;
- }
-
- public static HashSet getInRange(Vector3f loc, double r) {
- HashSet outbound = new HashSet<>();
- return outbound;
- }
-
- public static HashSet getObjectsInRangePartial(Vector3fImmutable loc, double r, int mask) {
- HashSet outbound = new HashSet<>();
- float scale;
-
- if ((mask & MBServerStatics.MASK_STATIC) != 0)
- scale = WorldGrid.staticBucketScale;
- else
- scale = WorldGrid.dynamicBucketScale;
- int gridX = (int) Math.abs(loc.x * scale);
- int gridZ = (int)Math.abs(loc.z * scale);
- int bucketSize = (int) (r *scale) + 1;
- //start at top left most corner to scan.
- int startingX = gridX - bucketSize;
- int startingZ = gridZ + bucketSize;
-
-
-
- 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.
-
- if (startingX < 0)
- startingX = 0;
-
- if (startingZ < 0)
- startingZ = 0;
-
- if (startingX > limitX)
- startingX = limitX;
-
- if (startingZ > limitZ)
- startingZ = limitZ;
-
- int endX = startingX + (bucketSize * 2);
- int endZ = startingZ - (bucketSize * 2);
-
- if (endX < 0)
- endX = 0;
-
- if (endZ < 0)
- endZ = 0;
-
- if (endX > limitX)
- endX = limitX;
-
- if (endZ > limitZ)
- endZ = limitZ;
-
- int auditMob = 0;
- for (int x = startingX;x<=endX;x++){
- for (int z = startingZ;z >= endZ;z--){
-
- ConcurrentHashMap gridMap;
-
- if ((MBServerStatics.MASK_STATIC & mask) != 0)
- gridMap = WorldGrid.StaticGridMap[x][z];
- else
- gridMap = WorldGrid.DynamicGridMap[x][z];
- for (AbstractWorldObject gridObject: gridMap.values()){
- if ((gridObject.getObjectTypeMask() & mask) == 0)
- continue;
- if (gridObject.getLoc().distanceSquared2D(loc) <= FastMath.sqr(r))
- outbound.add(gridObject);
- }
- }
- }
- return outbound;
- }
-
- public static HashSet getObjectsInRangePartialNecroPets(Vector3fImmutable loc, double r) {
- HashSet outbound = new HashSet<>();
- return outbound;
- }
-
- public static HashSet getObjectsInRangeContains(Vector3fImmutable loc, double r, int mask) {
- HashSet outbound = getObjectsInRangePartial(loc,r,mask);
- return outbound;
- }
-
- public static HashSet getObjectsInRangePartial(AbstractWorldObject awo, double range, int mask) {
- return getObjectsInRangePartial(awo.getLoc(), range, mask);
- }
-
-
- public static void InitializeGridObjects(){
-
- int dynamicWidth = (int) Math.abs(MBServerStatics.MAX_WORLD_WIDTH *WorldGrid.dynamicBucketScale);
- int dynamicHeight = (int) Math.abs(MBServerStatics.MAX_WORLD_HEIGHT*WorldGrid.dynamicBucketScale);
-
- int staticWidth = (int) Math.abs(MBServerStatics.MAX_WORLD_WIDTH *WorldGrid.staticBucketScale);
- int staticHeight = (int) Math.abs(MBServerStatics.MAX_WORLD_HEIGHT*WorldGrid.staticBucketScale);
- WorldGrid.DynamicGridMap = new ConcurrentHashMap[dynamicWidth+ 1][dynamicHeight + 1];
- WorldGrid.StaticGridMap = new ConcurrentHashMap[staticWidth + 1][staticHeight + 1];
- //create new hash maps for each bucket
- for (int x = 0; x<= staticWidth; x++)
- for (int y = 0; y<= staticHeight; y++){
- WorldGrid.StaticGridMap[x][y] = new ConcurrentHashMap();
- }
-
- for (int x = 0; x<= dynamicWidth; x++)
- for (int y = 0; y<= dynamicHeight; y++){
- WorldGrid.DynamicGridMap[x][y] = new ConcurrentHashMap();
- }
-
- }
-
- public static void RemoveWorldObject(AbstractWorldObject gridObject){
-
- if (gridObject == null)
- return;
- AbstractWorldObject.RemoveFromWorldGrid(gridObject);
- }
-
- public static boolean addObject(AbstractWorldObject gridObject, float x, float z){
-
- if (gridObject == null)
- return false;
-
- if (x > MBServerStatics.MAX_WORLD_WIDTH)
- return false;
-
- if (z < MBServerStatics.MAX_WORLD_HEIGHT)
- return false;
-
- if (x < 0)
- return false;
- if (z > 0)
- return false;
-
- int gridX;
- int gridZ;
-
- if (gridObject.getGridObjectType().equals(GridObjectType.STATIC)){
- gridX = Math.abs((int) (x *WorldGrid.staticBucketScale));
- gridZ = Math.abs((int) (z*WorldGrid.staticBucketScale));
- }else{
- gridX = Math.abs((int) (x *WorldGrid.dynamicBucketScale));
- gridZ = Math.abs((int) (z*WorldGrid.dynamicBucketScale));
- }
-
-
- WorldGrid.RemoveWorldObject(gridObject);
-
- return AbstractWorldObject.AddToWorldGrid(gridObject, gridX, gridZ);
-
-
- }
+
+ public static ConcurrentHashMap[][] DynamicGridMap;
+ public static ConcurrentHashMap[][] StaticGridMap;
+ private static float dynamicBucketScale = 0.00390625f; // 256 bucket size, 1/256
+ private static float staticBucketScale = 0.00390625f;
+
+ public static void startLoadJob() {
+
+ Thread loadJobThread;
+
+
+ loadJobThread = new Thread(InterestManager.INTERESTMANAGER);
+ loadJobThread.setName("InterestManager");
+ loadJobThread.start();
+ }
+
+ public static boolean moveWorldObject(AbstractWorldObject awo, Vector3fImmutable location) {
+ awo.setLoc(location);
+ return true;
+ }
+
+ public static HashSet getInRange(Vector3f loc, double r) {
+ HashSet outbound = new HashSet<>();
+ return outbound;
+ }
+
+ public static HashSet getObjectsInRangePartial(Vector3fImmutable loc, double r, int mask) {
+ HashSet outbound = new HashSet<>();
+ float scale;
+
+ if ((mask & MBServerStatics.MASK_STATIC) != 0)
+ scale = WorldGrid.staticBucketScale;
+ else
+ scale = WorldGrid.dynamicBucketScale;
+ int gridX = (int) Math.abs(loc.x * scale);
+ int gridZ = (int) Math.abs(loc.z * scale);
+ int bucketSize = (int) (r * scale) + 1;
+ //start at top left most corner to scan.
+ int startingX = gridX - bucketSize;
+ int startingZ = gridZ + bucketSize;
+
+
+ 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.
+
+ if (startingX < 0)
+ startingX = 0;
+
+ if (startingZ < 0)
+ startingZ = 0;
+
+ if (startingX > limitX)
+ startingX = limitX;
+
+ if (startingZ > limitZ)
+ startingZ = limitZ;
+
+ int endX = startingX + (bucketSize * 2);
+ int endZ = startingZ - (bucketSize * 2);
+
+ if (endX < 0)
+ endX = 0;
+
+ if (endZ < 0)
+ endZ = 0;
+
+ if (endX > limitX)
+ endX = limitX;
+
+ if (endZ > limitZ)
+ endZ = limitZ;
+
+ int auditMob = 0;
+ for (int x = startingX; x <= endX; x++) {
+ for (int z = startingZ; z >= endZ; z--) {
+
+ ConcurrentHashMap gridMap;
+
+ if ((MBServerStatics.MASK_STATIC & mask) != 0)
+ gridMap = WorldGrid.StaticGridMap[x][z];
+ else
+ gridMap = WorldGrid.DynamicGridMap[x][z];
+ for (AbstractWorldObject gridObject : gridMap.values()) {
+ if ((gridObject.getObjectTypeMask() & mask) == 0)
+ continue;
+ if (gridObject.getLoc().distanceSquared2D(loc) <= FastMath.sqr(r))
+ outbound.add(gridObject);
+ }
+ }
+ }
+ return outbound;
+ }
+
+ public static HashSet getObjectsInRangePartialNecroPets(Vector3fImmutable loc, double r) {
+ HashSet outbound = new HashSet<>();
+ return outbound;
+ }
+
+ public static HashSet getObjectsInRangeContains(Vector3fImmutable loc, double r, int mask) {
+ HashSet outbound = getObjectsInRangePartial(loc, r, mask);
+ return outbound;
+ }
+
+ public static HashSet getObjectsInRangePartial(AbstractWorldObject awo, double range, int mask) {
+ return getObjectsInRangePartial(awo.getLoc(), range, mask);
+ }
+
+
+ public static void InitializeGridObjects() {
+
+ int dynamicWidth = (int) Math.abs(MBServerStatics.MAX_WORLD_WIDTH * WorldGrid.dynamicBucketScale);
+ int dynamicHeight = (int) Math.abs(MBServerStatics.MAX_WORLD_HEIGHT * WorldGrid.dynamicBucketScale);
+
+ int staticWidth = (int) Math.abs(MBServerStatics.MAX_WORLD_WIDTH * WorldGrid.staticBucketScale);
+ int staticHeight = (int) Math.abs(MBServerStatics.MAX_WORLD_HEIGHT * WorldGrid.staticBucketScale);
+ WorldGrid.DynamicGridMap = new ConcurrentHashMap[dynamicWidth + 1][dynamicHeight + 1];
+ WorldGrid.StaticGridMap = new ConcurrentHashMap[staticWidth + 1][staticHeight + 1];
+ //create new hash maps for each bucket
+ for (int x = 0; x <= staticWidth; x++)
+ for (int y = 0; y <= staticHeight; y++) {
+ WorldGrid.StaticGridMap[x][y] = new ConcurrentHashMap();
+ }
+
+ for (int x = 0; x <= dynamicWidth; x++)
+ for (int y = 0; y <= dynamicHeight; y++) {
+ WorldGrid.DynamicGridMap[x][y] = new ConcurrentHashMap();
+ }
+
+ }
+
+ public static void RemoveWorldObject(AbstractWorldObject gridObject) {
+
+ if (gridObject == null)
+ return;
+ AbstractWorldObject.RemoveFromWorldGrid(gridObject);
+ }
+
+ public static boolean addObject(AbstractWorldObject gridObject, float x, float z) {
+
+ if (gridObject == null)
+ return false;
+
+ if (x > MBServerStatics.MAX_WORLD_WIDTH)
+ return false;
+
+ if (z < MBServerStatics.MAX_WORLD_HEIGHT)
+ return false;
+
+ if (x < 0)
+ return false;
+ if (z > 0)
+ return false;
+
+ int gridX;
+ int gridZ;
+
+ if (gridObject.getGridObjectType().equals(GridObjectType.STATIC)) {
+ gridX = Math.abs((int) (x * WorldGrid.staticBucketScale));
+ gridZ = Math.abs((int) (z * WorldGrid.staticBucketScale));
+ } else {
+ gridX = Math.abs((int) (x * WorldGrid.dynamicBucketScale));
+ gridZ = Math.abs((int) (z * WorldGrid.dynamicBucketScale));
+ }
+
+
+ WorldGrid.RemoveWorldObject(gridObject);
+
+ return AbstractWorldObject.AddToWorldGrid(gridObject, gridX, gridZ);
+
+
+ }
public static void unloadObject(AbstractWorldObject awo) {
@@ -204,109 +204,109 @@ public class WorldGrid {
DispatchMessage.sendToAllInRange(awo, uom);
}
- public static void loadObject(AbstractWorldObject awo) {
-
- LoadStructureMsg lsm;
- LoadCharacterMsg lcm;
-
- switch (awo.getObjectType()) {
- case Building:
- lsm = new LoadStructureMsg();
- lsm.addObject((Building)awo);
- DispatchMessage.sendToAllInRange(awo, lsm);
- break;
- case NPC:
- lcm = new LoadCharacterMsg((NPC) awo, false);
- DispatchMessage.sendToAllInRange(awo, lcm);
- break;
- case Mob:
- lcm = new LoadCharacterMsg((Mob) awo, false);
- DispatchMessage.sendToAllInRange(awo, lcm);
- break;
- default:
- // *** Refactor: Log error?
- break;
- }
- }
-
- public static void loadObject(AbstractWorldObject awo, ClientConnection origin) {
-
- LoadStructureMsg lsm;
- LoadCharacterMsg lcm;
-
- switch (awo.getObjectType()) {
-
- case Building:
- lsm = new LoadStructureMsg();
- lsm.addObject((Building)awo);
- DispatchMessage.sendToAllInRange(awo, lsm);
- break;
- case NPC:
- lcm = new LoadCharacterMsg((NPC) awo, false);
- DispatchMessage.sendToAllInRange(awo, lcm);
- break;
- case Mob:
- lcm = new LoadCharacterMsg((Mob) awo, false);
- DispatchMessage.sendToAllInRange(awo, lcm);
- break;
- case PlayerCharacter:
- lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
- DispatchMessage.sendToAllInRange(awo, lcm);
- break;
- default:
- // *** Refactor: Log error?
- break;
- }
- }
-
- public static void unloadObject(AbstractWorldObject awo,
- ClientConnection origin) {
- UnloadObjectsMsg uom = new UnloadObjectsMsg();
- uom.addObject(awo);
- DispatchMessage.sendToAllInRange(awo, uom);
- }
-
- public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
- if (pc == null || awo == null)
- return;
- ClientConnection origin = pc.getClientConnection();
- if (origin == null)
- return;
- loadObject(awo, origin);
- }
-
- public static void removeObject(AbstractWorldObject awo, PlayerCharacter pc) {
- if (pc == null || awo == null)
- return;
- ClientConnection origin = pc.getClientConnection();
- if (origin == null)
- return;
- unloadObject(awo, origin);
- }
-
- public static void updateObject(AbstractWorldObject awo, PlayerCharacter pc) {
- if (pc == null || awo == null)
- return;
- ClientConnection origin = pc.getClientConnection();
- if (origin == null)
- return;
- unloadObject(awo, origin);
- loadObject(awo, origin);
- }
-
- public static void updateObject(AbstractWorldObject awo) {
- if (awo == null)
- return;
- unloadObject(awo);
- loadObject(awo);
- }
-
- /*
- *
- */
- public static void removeObject(AbstractWorldObject awo) {
- if (awo == null)
- return;
- unloadObject(awo);
- }
+ public static void loadObject(AbstractWorldObject awo) {
+
+ LoadStructureMsg lsm;
+ LoadCharacterMsg lcm;
+
+ switch (awo.getObjectType()) {
+ case Building:
+ lsm = new LoadStructureMsg();
+ lsm.addObject((Building) awo);
+ DispatchMessage.sendToAllInRange(awo, lsm);
+ break;
+ case NPC:
+ lcm = new LoadCharacterMsg((NPC) awo, false);
+ DispatchMessage.sendToAllInRange(awo, lcm);
+ break;
+ case Mob:
+ lcm = new LoadCharacterMsg((Mob) awo, false);
+ DispatchMessage.sendToAllInRange(awo, lcm);
+ break;
+ default:
+ // *** Refactor: Log error?
+ break;
+ }
+ }
+
+ public static void loadObject(AbstractWorldObject awo, ClientConnection origin) {
+
+ LoadStructureMsg lsm;
+ LoadCharacterMsg lcm;
+
+ switch (awo.getObjectType()) {
+
+ case Building:
+ lsm = new LoadStructureMsg();
+ lsm.addObject((Building) awo);
+ DispatchMessage.sendToAllInRange(awo, lsm);
+ break;
+ case NPC:
+ lcm = new LoadCharacterMsg((NPC) awo, false);
+ DispatchMessage.sendToAllInRange(awo, lcm);
+ break;
+ case Mob:
+ lcm = new LoadCharacterMsg((Mob) awo, false);
+ DispatchMessage.sendToAllInRange(awo, lcm);
+ break;
+ case PlayerCharacter:
+ lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
+ DispatchMessage.sendToAllInRange(awo, lcm);
+ break;
+ default:
+ // *** Refactor: Log error?
+ break;
+ }
+ }
+
+ public static void unloadObject(AbstractWorldObject awo,
+ ClientConnection origin) {
+ UnloadObjectsMsg uom = new UnloadObjectsMsg();
+ uom.addObject(awo);
+ DispatchMessage.sendToAllInRange(awo, uom);
+ }
+
+ public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
+ if (pc == null || awo == null)
+ return;
+ ClientConnection origin = pc.getClientConnection();
+ if (origin == null)
+ return;
+ loadObject(awo, origin);
+ }
+
+ public static void removeObject(AbstractWorldObject awo, PlayerCharacter pc) {
+ if (pc == null || awo == null)
+ return;
+ ClientConnection origin = pc.getClientConnection();
+ if (origin == null)
+ return;
+ unloadObject(awo, origin);
+ }
+
+ public static void updateObject(AbstractWorldObject awo, PlayerCharacter pc) {
+ if (pc == null || awo == null)
+ return;
+ ClientConnection origin = pc.getClientConnection();
+ if (origin == null)
+ return;
+ unloadObject(awo, origin);
+ loadObject(awo, origin);
+ }
+
+ public static void updateObject(AbstractWorldObject awo) {
+ if (awo == null)
+ return;
+ unloadObject(awo);
+ loadObject(awo);
+ }
+
+ /*
+ *
+ */
+ public static void removeObject(AbstractWorldObject awo) {
+ if (awo == null)
+ return;
+ unloadObject(awo);
+ }
}
diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java
index 34a357ee..7e10ea4d 100644
--- a/src/engine/ai/MobileFSM.java
+++ b/src/engine/ai/MobileFSM.java
@@ -6,6 +6,7 @@
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.ai;
+
import engine.Enum;
import engine.Enum.DispatchChannel;
import engine.InterestManagement.WorldGrid;
@@ -22,12 +23,15 @@ import engine.objects.*;
import engine.powers.ActionsBase;
import engine.powers.PowersBase;
import engine.server.MBServerStatics;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
+
import static engine.math.FastMath.sqr;
+
public class MobileFSM {
private static void AttackTarget(Mob mob, AbstractWorldObject target) {
if (mob == null)
@@ -36,8 +40,8 @@ public class MobileFSM {
mob.setCombatTarget(null);
return;
}
- if(target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)){
- if(MobCast(mob)){
+ if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) {
+ if (MobCast(mob)) {
return;
}
}
@@ -58,8 +62,9 @@ public class MobileFSM {
break;
}
}
+
public static void AttackPlayer(Mob mob, PlayerCharacter target) {
- if(!mob.canSee(target)){
+ if (!mob.canSee(target)) {
mob.setCombatTarget(null);
return;
}
@@ -100,6 +105,7 @@ public class MobileFSM {
}
}
}
+
public static void AttackBuilding(Mob mob, Building target) {
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
mob.setCombatTarget(null);
@@ -140,6 +146,7 @@ public class MobileFSM {
DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
}
}
+
public static void AttackMob(Mob mob, Mob target) {
if (mob.getRange() >= 30 && mob.isMoving())
return;
@@ -166,6 +173,7 @@ public class MobileFSM {
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
}
}
+
private static void Patrol(Mob mob) {
//make sure mob is out of combat stance
if (mob.isCombat() && mob.getCombatTarget() == null) {
@@ -174,7 +182,7 @@ public class MobileFSM {
rwss.setPlayer(mob);
DispatchMessage.sendToAllInRange(mob, rwss);
}
- int patrolDelay = ThreadLocalRandom.current().nextInt((int)(MobileFSMManager.AI_PATROL_DIVISOR * 0.5f), MobileFSMManager.AI_PATROL_DIVISOR) + MobileFSMManager.AI_PATROL_DIVISOR;
+ int patrolDelay = ThreadLocalRandom.current().nextInt((int) (MobileFSMManager.AI_PATROL_DIVISOR * 0.5f), MobileFSMManager.AI_PATROL_DIVISOR) + MobileFSMManager.AI_PATROL_DIVISOR;
if (mob.stopPatrolTime + (patrolDelay * 1000) > System.currentTimeMillis())
//early exit while waiting to patrol again
return;
@@ -183,18 +191,18 @@ public class MobileFSM {
Building barracks = mob.building;
if (barracks != null && barracks.patrolPoints != null && !barracks.getPatrolPoints().isEmpty()) {
mob.patrolPoints = barracks.patrolPoints;
- } else{
+ } else {
randomGuardPatrolPoint(mob);
return;
}
}
- if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1) {
- mob.lastPatrolPointIndex = 0;
- }
+ if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1) {
+ mob.lastPatrolPointIndex = 0;
+ }
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
mob.lastPatrolPointIndex += 1;
MovementUtilities.aiMove(mob, mob.destination, true);
- if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()){
+ if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
for (Entry minion : mob.siegeMinionMap.entrySet()) {
//make sure mob is out of combat stance
if (minion.getKey().despawned == false) {
@@ -214,6 +222,7 @@ public class MobileFSM {
}
}
}
+
public static boolean canCast(Mob mob) {
// Performs validation to determine if a
// mobile in the proper state to cast.
@@ -221,7 +230,7 @@ public class MobileFSM {
return false;
if (mob.mobPowers.isEmpty())
return false;
- if(!mob.canSee((PlayerCharacter) mob.getCombatTarget())){
+ if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
mob.setCombatTarget(null);
return false;
}
@@ -229,6 +238,7 @@ public class MobileFSM {
mob.nextCastTime = System.currentTimeMillis();
return mob.nextCastTime <= System.currentTimeMillis();
}
+
public static boolean MobCast(Mob mob) {
// Method picks a random spell from a mobile's list of powers
// and casts it on the current target (or itself). Validation
@@ -261,7 +271,7 @@ public class MobileFSM {
int powerRank = mob.mobPowers.get(powerToken);
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
//check for hit-roll
- if(mobPower.requiresHitRoll) {
+ if (mobPower.requiresHitRoll) {
if (CombatUtilities.triggerDefense(mob, mob.getCombatTarget())) {
return false;
}
@@ -286,11 +296,12 @@ public class MobileFSM {
msg.setUnknown04(2);
PowersManager.finishUseMobPower(msg, mob, 0, 0);
// Default minimum seconds between cast = 10
- mob.nextCastTime = System.currentTimeMillis() + mobPower.getCooldown() + (MobileFSMManager.AI_POWER_DIVISOR * 1000);
+ mob.nextCastTime = System.currentTimeMillis() + mobPower.getCooldown() + (MobileFSMManager.AI_POWER_DIVISOR * 1000);
return true;
}
return false;
}
+
public static void MobCallForHelp(Mob mob) {
boolean callGotResponse = false;
if (mob.nextCallForHelp == 0) {
@@ -311,6 +322,7 @@ public class MobileFSM {
//wait 60 seconds to call for help again
mob.nextCallForHelp = System.currentTimeMillis() + 60000;
}
+
public static void DetermineAction(Mob mob) {
if (mob == null)
return;
@@ -321,10 +333,10 @@ public class MobileFSM {
}
if (mob.despawned && mob.isPlayerGuard) {
//override for guards
- if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){
- if(mob.npcOwner.isAlive() == false || ((Mob)mob.npcOwner).despawned == true){
+ if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
+ if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) {
//minions don't respawn while guard captain is dead
- if(mob.isAlive() == false) {
+ if (mob.isAlive() == false) {
mob.deathTime = System.currentTimeMillis();
return;
}
@@ -351,7 +363,7 @@ public class MobileFSM {
}
mob.updateLocation();
CheckToSendMobHome(mob);
- if(mob.combatTarget != null && mob.combatTarget.isAlive() == false){
+ if (mob.combatTarget != null && mob.combatTarget.isAlive() == false) {
mob.setCombatTarget(null);
}
switch (mob.BehaviourType) {
@@ -375,6 +387,7 @@ public class MobileFSM {
break;
}
}
+
private static void CheckForAggro(Mob aiAgent) {
//looks for and sets mobs combatTarget
if (!aiAgent.isAlive())
@@ -405,10 +418,11 @@ public class MobileFSM {
}
}
}
+
private static void CheckMobMovement(Mob mob) {
if (!MovementUtilities.canMove(mob))
return;
- switch(mob.BehaviourType){
+ switch (mob.BehaviourType) {
case Pet1:
if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) {
//mob no longer has its owner loaded, translocate pet to owner
@@ -425,27 +439,28 @@ public class MobileFSM {
chaseTarget(mob);
break;
case GuardMinion:
- if (!mob.npcOwner.isAlive() || ((Mob)mob.npcOwner).despawned)
+ if (!mob.npcOwner.isAlive() || ((Mob) mob.npcOwner).despawned)
randomGuardPatrolPoint(mob);
- else{
- if(mob.getCombatTarget() != null){
+ else {
+ if (mob.getCombatTarget() != null) {
chaseTarget(mob);
}
}
break;
default:
if (mob.getCombatTarget() == null) {
- if(!mob.isMoving()) {
+ if (!mob.isMoving()) {
Patrol(mob);
- } else{
+ } else {
mob.stopPatrolTime = System.currentTimeMillis();
}
- }else {
+ } else {
chaseTarget(mob);
}
break;
}
}
+
private static void CheckForRespawn(Mob aiAgent) {
if (aiAgent.deathTime == 0) {
aiAgent.setDeathTime(System.currentTimeMillis());
@@ -479,14 +494,15 @@ public class MobileFSM {
aiAgent.respawn();
}
}
+
public static void CheckForAttack(Mob mob) {
//checks if mob can attack based on attack timer and range
if (mob.isAlive() == false)
return;
- if(mob.getCombatTarget() == null){
+ if (mob.getCombatTarget() == null) {
return;
}
- if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter)mob.getCombatTarget()) == false) {
+ if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false) {
mob.setCombatTarget(null);
if (mob.isCombat()) {
mob.setCombat(false);
@@ -505,18 +521,18 @@ public class MobileFSM {
if (System.currentTimeMillis() > mob.getLastAttackTime())
AttackTarget(mob, mob.getCombatTarget());
}
+
private static void CheckToSendMobHome(Mob mob) {
- if(mob.BehaviourType.isAgressive) {
- if(mob.isPlayerGuard())
- {
- if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()){
+ if (mob.BehaviourType.isAgressive) {
+ if (mob.isPlayerGuard()) {
+ if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
CheckForPlayerGuardAggro(mob);
}
} else {
CheckForAggro(mob);
}
}
- if(mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob,mob.getCombatTarget(), MobileFSMManager.AI_BASE_AGGRO_RANGE * 0.5f)){
+ if (mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob, mob.getCombatTarget(), MobileFSMManager.AI_BASE_AGGRO_RANGE * 0.5f)) {
return;
}
if (mob.isPlayerGuard() && !mob.despawned) {
@@ -525,7 +541,7 @@ public class MobileFSM {
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
PowersManager.useMobPower(mob, mob, recall, 40);
mob.setCombatTarget(null);
- if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()){
+ if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()) {
//guard captain pulls his minions home with him
for (Entry minion : mob.siegeMinionMap.entrySet()) {
PowersManager.useMobPower(minion.getKey(), minion.getKey(), recall, 40);
@@ -533,20 +549,20 @@ public class MobileFSM {
}
}
}
- }
- else if(MovementUtilities.inRangeOfBindLocation(mob) == false) {
+ } else if (MovementUtilities.inRangeOfBindLocation(mob) == false) {
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
PowersManager.useMobPower(mob, mob, recall, 40);
mob.setCombatTarget(null);
for (Entry playerEntry : mob.playerAgroMap.entrySet()) {
- PlayerCharacter.getFromCache((int)playerEntry.getKey()).setHateValue(0);
+ PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
}
}
}
+
private static void chaseTarget(Mob mob) {
mob.updateMovementState();
- if(mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false){
+ if (mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) {
mob.setCombatTarget(null);
return;
}
@@ -560,6 +576,7 @@ public class MobileFSM {
}
}
}
+
private static void SafeGuardAggro(Mob mob) {
HashSet awoList = WorldGrid.getObjectsInRangePartial(mob, 100, MBServerStatics.MASK_MOB);
for (AbstractWorldObject awoMob : awoList) {
@@ -575,49 +592,55 @@ public class MobileFSM {
mob.setCombatTarget(aggroMob);
}
}
+
public static void GuardCaptainLogic(Mob mob) {
if (mob.getCombatTarget() == null)
CheckForPlayerGuardAggro(mob);
CheckMobMovement(mob);
CheckForAttack(mob);
}
+
public static void GuardMinionLogic(Mob mob) {
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null) {
CheckForPlayerGuardAggro(mob);
}
- if(mob.npcOwner.getCombatTarget() != null)
+ if (mob.npcOwner.getCombatTarget() != null)
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
- else
+ else
mob.setCombatTarget(null);
CheckMobMovement(mob);
CheckForAttack(mob);
}
+
public static void GuardWallArcherLogic(Mob mob) {
if (mob.getCombatTarget() == null)
CheckForPlayerGuardAggro(mob);
else
CheckForAttack(mob);
}
+
private static void PetLogic(Mob mob) {
if (mob.getCombatTarget() != null && !mob.getCombatTarget().isAlive())
mob.setCombatTarget(null);
if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)
CheckMobMovement(mob);
- CheckForAttack(mob);
+ CheckForAttack(mob);
}
+
private static void HamletGuardLogic(Mob mob) {
if (mob.getCombatTarget() == null) {
//safehold guard
SafeGuardAggro(mob);
- } else{
- if(mob.combatTarget.isAlive() == false){
+ } else {
+ if (mob.combatTarget.isAlive() == false) {
SafeGuardAggro(mob);
}
}
- CheckForAttack(mob);
+ CheckForAttack(mob);
}
+
private static void DefaultLogic(Mob mob) {
- if(mob.getObjectUUID() == 40548){
+ if (mob.getObjectUUID() == 40548) {
int thing = 0;
}
//check for players that can be aggroed if mob is agressive and has no target
@@ -643,6 +666,7 @@ public class MobileFSM {
if (!mob.BehaviourType.isWimpy && !mob.isMoving() && mob.combatTarget != null)
CheckForAttack(mob);
}
+
public static void CheckForPlayerGuardAggro(Mob mob) {
//looks for and sets mobs combatTarget
if (!mob.isAlive())
@@ -673,14 +697,15 @@ public class MobileFSM {
}
}
}
+
public static Boolean GuardCanAggro(Mob mob, PlayerCharacter target) {
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
return false;
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
- if(((Mob)mob.npcOwner).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true){
+ if (((Mob) mob.npcOwner).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
return true;
}
- } else if(mob.building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true){
+ } else if (mob.building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
return true;
}
//first check condemn list for aggro allowed (allies button is checked)
@@ -697,7 +722,7 @@ public class MobileFSM {
return false;
}
return true;
- } else{
+ } else {
//allies button is not checked
for (Entry entry : ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().getCondemned().entrySet()) {
if (entry.getValue().getPlayerUID() == target.getObjectUUID() && entry.getValue().isActive())
@@ -713,7 +738,8 @@ public class MobileFSM {
}
return false;
}
- public static void randomGuardPatrolPoint(Mob mob){
+
+ public static void randomGuardPatrolPoint(Mob mob) {
if (mob.isMoving() == true) {
//early exit for a mob who is already moving to a patrol point
//while mob moving, update lastPatrolTime so that when they stop moving the 10 second timer can begin
@@ -728,9 +754,9 @@ public class MobileFSM {
float xPoint = ThreadLocalRandom.current().nextInt(400) - 200;
float zPoint = ThreadLocalRandom.current().nextInt(400) - 200;
Vector3fImmutable TreePos = mob.getGuild().getOwnedCity().getLoc();
- mob.destination = new Vector3fImmutable(TreePos.x + xPoint,TreePos.y,TreePos.z + zPoint);
+ mob.destination = new Vector3fImmutable(TreePos.x + xPoint, TreePos.y, TreePos.z + zPoint);
MovementUtilities.aiMove(mob, mob.destination, true);
- if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()){
+ if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
for (Entry minion : mob.siegeMinionMap.entrySet()) {
//make sure mob is out of combat stance
if (minion.getKey().despawned == false) {
@@ -750,18 +776,19 @@ public class MobileFSM {
}
}
}
- public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob){
+
+ public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob) {
float CurrentHateValue = 0;
- if(mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
- CurrentHateValue = ((PlayerCharacter)mob.getCombatTarget()).getHateValue();
+ if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
+ CurrentHateValue = ((PlayerCharacter) mob.getCombatTarget()).getHateValue();
}
AbstractWorldObject mostHatedTarget = null;
for (Entry playerEntry : mob.playerAgroMap.entrySet()) {
- PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int)playerEntry.getKey());
- if(potentialTarget.equals(mob.getCombatTarget())){
+ PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int) playerEntry.getKey());
+ if (potentialTarget.equals(mob.getCombatTarget())) {
continue;
}
- if(potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)){
+ if (potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
CurrentHateValue = potentialTarget.getHateValue();
mostHatedTarget = potentialTarget;
}
diff --git a/src/engine/ai/MobileFSMManager.java b/src/engine/ai/MobileFSMManager.java
index f99308b3..4733567e 100644
--- a/src/engine/ai/MobileFSMManager.java
+++ b/src/engine/ai/MobileFSMManager.java
@@ -25,9 +25,6 @@ public class MobileFSMManager {
private static final MobileFSMManager INSTANCE = new MobileFSMManager();
public static Duration executionTime = 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
public static int AI_BASE_AGGRO_RANGE = 60;
public static int AI_DROP_AGGRO_RANGE = 60;
@@ -36,7 +33,9 @@ public class MobileFSMManager {
public static int AI_THREAD_SLEEP = 1000;
public static int AI_PATROL_DIVISOR = 15;
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() {
diff --git a/src/engine/ai/utilities/CombatUtilities.java b/src/engine/ai/utilities/CombatUtilities.java
index a5d3bd9e..abc35db2 100644
--- a/src/engine/ai/utilities/CombatUtilities.java
+++ b/src/engine/ai/utilities/CombatUtilities.java
@@ -405,7 +405,7 @@ public class CombatUtilities {
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
double min = agent.getMinDamageHandOne();
double max = agent.getMaxDamageHandOne();
- if(agent.getEquip().get(1) != null) {
+ if (agent.getEquip().get(1) != null) {
if (agent.getEquip().get(1).getItemBase() != null) {
dt = agent.getEquip().get(1).getItemBase().getDamageType();
min = agent.getMinDamageHandOne();
diff --git a/src/engine/core/ControlledRunnable.java b/src/engine/core/ControlledRunnable.java
index d9d8bf4a..0dde32ed 100644
--- a/src/engine/core/ControlledRunnable.java
+++ b/src/engine/core/ControlledRunnable.java
@@ -14,161 +14,160 @@ import org.pmw.tinylog.Logger;
import java.util.ArrayList;
/**
- *
+ *
*/
public abstract class ControlledRunnable implements Runnable {
- protected boolean runCmd = false;
- protected boolean runStatus = false;
- private Thread thisThread;
- private final String threadName;
-
- public ControlledRunnable(String threadName) {
- super();
- this.threadName = threadName;
- ControlledRunnable.runnables.add(this);
- }
-
- /*
- * Main loop
- */
-
- /**
- * This is the method called when ControlledRunnable.thisThread.start() is
- * called.
- */
- @Override
- public void run() {
- if (this._preRun() == false) {
- return;
- }
-
- this.runStatus = true;
-
- if (this._Run() == false) {
- return;
- }
-
- if (this._postRun() == false) {
- return;
- }
-
- this.runStatus = false;
- }
-
- /**
- * _preRun() is called prior to the call to _Run(), but after _startup()
- *
- * @return
- */
- protected abstract boolean _preRun();
-
- /**
- * _Run() is called after _startup() and contains should contain the main
- * loop.
- *
- * @return
- */
- protected abstract boolean _Run();
-
- /**
- * _postRun() is called after _Run() exits, not necessarily before
- * _shutdown()
- *
- * @return
- */
- protected abstract boolean _postRun();
-
- /*
- * Control
- */
-
- /**
- * startup() initializes the internal thread, sets the runCMD to true, and
- * calls _startup() prior to starting of the internal Thread.
- */
- public void startup() {
-
- this.thisThread = new Thread(this, this.threadName);
- this.runCmd = true;
- this._startup();
- this.thisThread.start();
- }
-
- /**
- * This method is called just before ControlledRunnable.thisThread.start()
- * is called.
- */
- protected abstract void _startup();
-
- /**
- * This method is called to request a shutdown of the runnable.
- */
- public void shutdown() {
- this.runCmd = false;
- this._shutdown();
- }
-
- /**
- * This method is called just after ControlledRunnable.runCmd is set to
- * False.
- */
- protected abstract void _shutdown();
-
- /*
- * Getters n setters
- */
- public boolean getRunCmd() {
- return runCmd;
- }
-
- public boolean getRunStatus() {
- return runStatus;
- }
-
- /*
- * Blockers
- */
- public void blockTillRunStatus(boolean status) {
- while (this.runStatus != status) {
- try {
- System.out.println("BLOCKING");
- Thread.sleep(25L);
- } catch (InterruptedException e) {
- Logger.debug( e.getMessage());
-
- break;
- }
- }
- }
-
- /**
- * @return the thisThread
- */
- protected Thread getThisThread() {
- return thisThread;
- }
-
- /**
- * @return the threadName
- */
- public String getThreadName() {
- return threadName;
- }
-
- /*
- * Instance monitoring and tools
- */
-
- // Runnable tracking
- private static final ArrayList runnables = new ArrayList<>();
-
- public static void shutdownAllRunnables() {
- for (ControlledRunnable cr : ControlledRunnable.runnables) {
- //Use Direct logging since JobManager is a runnable.
+ // Runnable tracking
+ private static final ArrayList runnables = new ArrayList<>();
+ private final String threadName;
+ protected boolean runCmd = false;
+ protected boolean runStatus = false;
+ private Thread thisThread;
+
+ /*
+ * Main loop
+ */
+
+ public ControlledRunnable(String threadName) {
+ super();
+ this.threadName = threadName;
+ ControlledRunnable.runnables.add(this);
+ }
+
+ 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();
- }
- }
+ "Sending Shutdown cmd to: " + cr.threadName);
+ cr.shutdown();
+ }
+ }
+
+ /**
+ * This is the method called when ControlledRunnable.thisThread.start() is
+ * called.
+ */
+ @Override
+ public void run() {
+ if (this._preRun() == false) {
+ return;
+ }
+
+ this.runStatus = true;
+
+ if (this._Run() == false) {
+ return;
+ }
+
+ if (this._postRun() == false) {
+ return;
+ }
+
+ this.runStatus = false;
+ }
+
+ /**
+ * _preRun() is called prior to the call to _Run(), but after _startup()
+ *
+ * @return
+ */
+ protected abstract boolean _preRun();
+
+ /*
+ * Control
+ */
+
+ /**
+ * _Run() is called after _startup() and contains should contain the main
+ * loop.
+ *
+ * @return
+ */
+ protected abstract boolean _Run();
+
+ /**
+ * _postRun() is called after _Run() exits, not necessarily before
+ * _shutdown()
+ *
+ * @return
+ */
+ protected abstract boolean _postRun();
+
+ /**
+ * startup() initializes the internal thread, sets the runCMD to true, and
+ * calls _startup() prior to starting of the internal Thread.
+ */
+ public void startup() {
+
+ this.thisThread = new Thread(this, this.threadName);
+ this.runCmd = true;
+ this._startup();
+ this.thisThread.start();
+ }
+
+ /**
+ * This method is called just before ControlledRunnable.thisThread.start()
+ * is called.
+ */
+ protected abstract void _startup();
+
+ /**
+ * This method is called to request a shutdown of the runnable.
+ */
+ public void shutdown() {
+ this.runCmd = false;
+ this._shutdown();
+ }
+
+ /**
+ * This method is called just after ControlledRunnable.runCmd is set to
+ * False.
+ */
+ protected abstract void _shutdown();
+
+ /*
+ * Getters n setters
+ */
+ public boolean getRunCmd() {
+ return runCmd;
+ }
+
+ public boolean getRunStatus() {
+ return runStatus;
+ }
+
+ /*
+ * Blockers
+ */
+ public void blockTillRunStatus(boolean status) {
+ while (this.runStatus != status) {
+ try {
+ System.out.println("BLOCKING");
+ Thread.sleep(25L);
+ } catch (InterruptedException e) {
+ Logger.debug(e.getMessage());
+
+ break;
+ }
+ }
+ }
+
+ /*
+ * Instance monitoring and tools
+ */
+
+ /**
+ * @return the thisThread
+ */
+ protected Thread getThisThread() {
+ return thisThread;
+ }
+
+ /**
+ * @return the threadName
+ */
+ public String getThreadName() {
+ return threadName;
+ }
}
diff --git a/src/engine/db/archive/BaneRecord.java b/src/engine/db/archive/BaneRecord.java
index 27f6507f..700c4a2d 100644
--- a/src/engine/db/archive/BaneRecord.java
+++ b/src/engine/db/archive/BaneRecord.java
@@ -25,360 +25,358 @@ import static engine.Enum.RecordEventType;
public class BaneRecord extends DataRecord {
- private static final LinkedBlockingQueue recordPool = new LinkedBlockingQueue<>();
- private RecordEventType eventType;
- private String cityHash;
- private String cityName;
- private String cityGuildHash;
- private String cityNationHash;
- private String baneDropperHash;
- private String baneGuildHash;
- private String baneNationHash;
- private DateTime baneLiveTime;
- private DateTime baneDropTime;
+ private static final LinkedBlockingQueue recordPool = new LinkedBlockingQueue<>();
+ private RecordEventType eventType;
+ private String cityHash;
+ private String cityName;
+ private String cityGuildHash;
+ private String cityNationHash;
+ private String baneDropperHash;
+ private String baneGuildHash;
+ private String baneNationHash;
+ private DateTime baneLiveTime;
+ private DateTime baneDropTime;
- private BaneRecord(Bane bane) {
- this.recordType = Enum.DataRecordType.BANE;
- this.eventType = RecordEventType.PENDING;
- }
+ private BaneRecord(Bane bane) {
+ this.recordType = Enum.DataRecordType.BANE;
+ this.eventType = RecordEventType.PENDING;
+ }
- public static BaneRecord borrow(Bane bane, RecordEventType eventType) {
- BaneRecord baneRecord;
+ public static BaneRecord borrow(Bane bane, RecordEventType eventType) {
+ BaneRecord baneRecord;
- baneRecord = recordPool.poll();
+ baneRecord = recordPool.poll();
- if (baneRecord == null) {
- baneRecord = new BaneRecord(bane);
- baneRecord.eventType = eventType;
- }
- else {
- baneRecord.recordType = Enum.DataRecordType.BANE;
- baneRecord.eventType = eventType;
+ if (baneRecord == null) {
+ baneRecord = new BaneRecord(bane);
+ baneRecord.eventType = eventType;
+ } else {
+ baneRecord.recordType = Enum.DataRecordType.BANE;
+ baneRecord.eventType = eventType;
- }
+ }
- baneRecord.cityHash = bane.getCity().getHash();
- baneRecord.cityName = bane.getCity().getCityName();
- baneRecord.cityGuildHash = bane.getCity().getGuild().getHash();
- baneRecord.cityNationHash = bane.getCity().getGuild().getNation().getHash();
+ baneRecord.cityHash = bane.getCity().getHash();
+ baneRecord.cityName = bane.getCity().getCityName();
+ baneRecord.cityGuildHash = bane.getCity().getGuild().getHash();
+ baneRecord.cityNationHash = bane.getCity().getGuild().getNation().getHash();
- if (bane.getOwner() == null) {
- baneRecord.baneDropperHash = "ERRANT";
- baneRecord.baneGuildHash = "ERRANT";
- baneRecord.baneNationHash = "ERRANT";
- }
- else {
- baneRecord.baneDropperHash = DataWarehouse.hasher.encrypt(bane.getOwner().getObjectUUID()); // getPlayerCharacter didn't check hash first? OMFG
+ if (bane.getOwner() == null) {
+ baneRecord.baneDropperHash = "ERRANT";
+ baneRecord.baneGuildHash = "ERRANT";
+ baneRecord.baneNationHash = "ERRANT";
+ } else {
+ baneRecord.baneDropperHash = DataWarehouse.hasher.encrypt(bane.getOwner().getObjectUUID()); // getPlayerCharacter didn't check hash first? OMFG
- baneRecord.baneGuildHash = bane.getOwner().getGuild().getHash();
- baneRecord.baneNationHash = bane.getOwner().getGuild().getNation().getHash();
+ baneRecord.baneGuildHash = bane.getOwner().getGuild().getHash();
+ baneRecord.baneNationHash = bane.getOwner().getGuild().getNation().getHash();
- baneRecord.baneLiveTime = bane.getLiveDate();
- baneRecord.baneDropTime = bane.getPlacementDate();
- }
+ baneRecord.baneLiveTime = bane.getLiveDate();
+ baneRecord.baneDropTime = bane.getPlacementDate();
+ }
- return baneRecord;
- }
+ return baneRecord;
+ }
- public static PreparedStatement buildBanePushStatement(Connection connection, ResultSet rs) throws SQLException {
+ public static PreparedStatement buildBanePushStatement(Connection connection, ResultSet rs) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "INSERT INTO `warehouse_banehistory` (`event_number`, `city_id`, `city_name`, `char_id`, `offGuild_id`, `offNat_id`, `defGuild_id`, `defNat_id`, `dropDatetime`, `liveDateTime`, `resolution`) VALUES(?,?,?,?,?,?,?,?,?,?,?)";
- java.util.Date sqlDateTime;
+ PreparedStatement outStatement = null;
+ String queryString = "INSERT INTO `warehouse_banehistory` (`event_number`, `city_id`, `city_name`, `char_id`, `offGuild_id`, `offNat_id`, `defGuild_id`, `defNat_id`, `dropDatetime`, `liveDateTime`, `resolution`) VALUES(?,?,?,?,?,?,?,?,?,?,?)";
+ java.util.Date sqlDateTime;
- outStatement = connection.prepareStatement(queryString);
+ outStatement = connection.prepareStatement(queryString);
- // Bind record data
+ // Bind record data
- outStatement.setInt(1, rs.getInt("event_number"));
- outStatement.setString(2, rs.getString("city_id"));
- outStatement.setString(3, rs.getString("city_name"));
- outStatement.setString(4, rs.getString("char_id"));
- outStatement.setString(5, rs.getString("offGuild_id"));
- outStatement.setString(6, rs.getString("offNat_id"));
- outStatement.setString(7, rs.getString("defGuild_id"));
- outStatement.setString(8, rs.getString("defNat_id"));
+ outStatement.setInt(1, rs.getInt("event_number"));
+ outStatement.setString(2, rs.getString("city_id"));
+ outStatement.setString(3, rs.getString("city_name"));
+ outStatement.setString(4, rs.getString("char_id"));
+ outStatement.setString(5, rs.getString("offGuild_id"));
+ outStatement.setString(6, rs.getString("offNat_id"));
+ outStatement.setString(7, rs.getString("defGuild_id"));
+ outStatement.setString(8, rs.getString("defNat_id"));
- sqlDateTime = rs.getTimestamp("dropDatetime");
+ sqlDateTime = rs.getTimestamp("dropDatetime");
- if (sqlDateTime == null)
- outStatement.setNull(9, Types.DATE);
- else
- outStatement.setTimestamp(9, rs.getTimestamp("dropDatetime"));
+ if (sqlDateTime == null)
+ outStatement.setNull(9, Types.DATE);
+ else
+ outStatement.setTimestamp(9, rs.getTimestamp("dropDatetime"));
- sqlDateTime = rs.getTimestamp("dropDatetime");
+ sqlDateTime = rs.getTimestamp("dropDatetime");
- if (sqlDateTime == null)
- outStatement.setNull(10, Types.DATE);
- else
- outStatement.setTimestamp(10, rs.getTimestamp("liveDateTime"));
+ if (sqlDateTime == null)
+ outStatement.setNull(10, Types.DATE);
+ else
+ outStatement.setTimestamp(10, rs.getTimestamp("liveDateTime"));
- outStatement.setString(11, rs.getString("resolution"));
+ outStatement.setString(11, rs.getString("resolution"));
- return outStatement;
- }
+ return outStatement;
+ }
- public static PreparedStatement buildBaneQueryStatement(Connection connection) throws SQLException {
+ public static PreparedStatement buildBaneQueryStatement(Connection connection) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "SELECT * FROM `warehouse_banehistory` WHERE `event_number` > ?";
- outStatement = connection.prepareStatement(queryString);
- outStatement.setInt(1, WarehousePushThread.baneIndex);
- return outStatement;
- }
+ PreparedStatement outStatement = null;
+ String queryString = "SELECT * FROM `warehouse_banehistory` WHERE `event_number` > ?";
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setInt(1, WarehousePushThread.baneIndex);
+ return outStatement;
+ }
- public static DateTime getLastBaneDateTime(City city) {
+ public static DateTime getLastBaneDateTime(City city) {
- DateTime outDateTime = null;
+ DateTime outDateTime = null;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = buildDateTimeQueryStatement(connection, city);
- ResultSet rs = statement.executeQuery()) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = buildDateTimeQueryStatement(connection, city);
+ ResultSet rs = statement.executeQuery()) {
- while (rs.next()) {
+ while (rs.next()) {
- outDateTime = new DateTime(rs.getTimestamp("endDatetime"));
+ outDateTime = new DateTime(rs.getTimestamp("endDatetime"));
- }
+ }
- } catch (SQLException e) {
- Logger.error(e.toString());
- }
+ } catch (SQLException e) {
+ Logger.error(e.toString());
+ }
- return outDateTime;
- }
+ return outDateTime;
+ }
- private static PreparedStatement buildDateTimeQueryStatement (Connection connection, City city) throws SQLException {
- PreparedStatement outStatement;
- String queryString = "SELECT `endDatetime` FROM `warehouse_banehistory` WHERE `city_id` = ? ORDER BY `endDatetime` DESC LIMIT 1";
- outStatement = connection.prepareStatement(queryString);
- outStatement.setString(1, city.getHash());
- return outStatement;
+ private static PreparedStatement buildDateTimeQueryStatement(Connection connection, City city) throws SQLException {
+ PreparedStatement outStatement;
+ String queryString = "SELECT `endDatetime` FROM `warehouse_banehistory` WHERE `city_id` = ? ORDER BY `endDatetime` DESC LIMIT 1";
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setString(1, city.getHash());
+ return outStatement;
- }
+ }
- public static void updateLiveDate(Bane bane, DateTime dateTime) {
+ public static void updateLiveDate(Bane bane, DateTime dateTime) {
- if (bane == null)
- return;
+ if (bane == null)
+ return;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = buildUpdateLiveDateStatement(connection, bane, dateTime)) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = buildUpdateLiveDateStatement(connection, bane, dateTime)) {
- statement.execute();
+ statement.execute();
- } catch (SQLException e) {
- Logger.error(e.toString());
- }
- }
+ } catch (SQLException e) {
+ Logger.error(e.toString());
+ }
+ }
- private static PreparedStatement buildUpdateLiveDateStatement(Connection connection, Bane bane, DateTime dateTime) throws SQLException {
+ private static PreparedStatement buildUpdateLiveDateStatement(Connection connection, Bane bane, DateTime dateTime) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "UPDATE `warehouse_banehistory` SET `liveDatetime` = ?, `dirty` = 1 WHERE `city_id` = ? AND `resolution` = 'PENDING'";
+ PreparedStatement outStatement = null;
+ String queryString = "UPDATE `warehouse_banehistory` SET `liveDatetime` = ?, `dirty` = 1 WHERE `city_id` = ? AND `resolution` = 'PENDING'";
- outStatement = connection.prepareStatement(queryString);
- outStatement.setTimestamp(1, new java.sql.Timestamp(dateTime.getMillis()));
- outStatement.setString(2, bane.getCity().getHash());
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setTimestamp(1, new java.sql.Timestamp(dateTime.getMillis()));
+ outStatement.setString(2, bane.getCity().getHash());
- return outStatement;
- }
+ return outStatement;
+ }
- private static PreparedStatement buildUpdateResolutionStatement(Connection connection, Bane bane, RecordEventType eventType) throws SQLException {
+ private static PreparedStatement buildUpdateResolutionStatement(Connection connection, Bane bane, RecordEventType eventType) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "UPDATE `warehouse_banehistory` SET `endDatetime` = ?, `resolution` = ?, `dirty` = 1 WHERE `city_id` = ? AND `resolution` = 'PENDING'";
+ PreparedStatement outStatement = null;
+ String queryString = "UPDATE `warehouse_banehistory` SET `endDatetime` = ?, `resolution` = ?, `dirty` = 1 WHERE `city_id` = ? AND `resolution` = 'PENDING'";
- outStatement = connection.prepareStatement(queryString);
- outStatement.setTimestamp(1, Timestamp.valueOf(LocalDateTime.now()));
- outStatement.setString(2, eventType.name());
- outStatement.setString(3, bane.getCity().getHash());
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setTimestamp(1, Timestamp.valueOf(LocalDateTime.now()));
+ outStatement.setString(2, eventType.name());
+ outStatement.setString(3, bane.getCity().getHash());
- return outStatement;
- }
+ return outStatement;
+ }
- public static void updateResolution(Bane bane, RecordEventType eventType) {
+ public static void updateResolution(Bane bane, RecordEventType eventType) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = buildUpdateResolutionStatement(connection, bane, eventType)) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = buildUpdateResolutionStatement(connection, bane, eventType)) {
- statement.execute();
+ statement.execute();
- } catch (SQLException e) {
- Logger.error(e.toString());
- }
- }
+ } catch (SQLException e) {
+ Logger.error(e.toString());
+ }
+ }
- public static String getBaneHistoryString() {
+ public static String getBaneHistoryString() {
- String outString;
- String queryString;
- String dividerString;
- String newLine = System.getProperty("line.separator");
- outString = "[LUA_BANES() DATA WAREHOUSE]" + newLine;
- dividerString = "--------------------------------" + newLine;
- queryString = "CALL `baneHistory`()";
+ String outString;
+ String queryString;
+ String dividerString;
+ String newLine = System.getProperty("line.separator");
+ outString = "[LUA_BANES() DATA WAREHOUSE]" + newLine;
+ dividerString = "--------------------------------" + newLine;
+ queryString = "CALL `baneHistory`()";
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = connection.prepareCall(queryString);
- ResultSet rs = statement.executeQuery()) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = connection.prepareCall(queryString);
+ ResultSet rs = statement.executeQuery()) {
- while (rs.next()) {
+ while (rs.next()) {
- outString += "Magicbane unresolved banes: " + rs.getInt("PENDING") + '/' + rs.getInt("TOTAL") + newLine;
- outString += dividerString;
- outString += "Bane Resolution History" + newLine;
- outString += dividerString;
+ outString += "Magicbane unresolved banes: " + rs.getInt("PENDING") + '/' + rs.getInt("TOTAL") + newLine;
+ outString += dividerString;
+ outString += "Bane Resolution History" + newLine;
+ outString += dividerString;
- outString += "Destruction: " + rs.getInt("DESTROY") + newLine;
- outString += "Capture: " + rs.getInt("CAPTURE") + newLine;
- outString += "Defended: " + rs.getInt("DEFEND") + newLine;
- }
+ outString += "Destruction: " + rs.getInt("DESTROY") + newLine;
+ outString += "Capture: " + rs.getInt("CAPTURE") + newLine;
+ outString += "Defended: " + rs.getInt("DEFEND") + newLine;
+ }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return outString;
- }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return outString;
+ }
- public static void updateDirtyRecords() {
+ public static void updateDirtyRecords() {
- String queryString = "SELECT * FROM `warehouse_banehistory` where `dirty` = 1";
+ String queryString = "SELECT * FROM `warehouse_banehistory` where `dirty` = 1";
- // Reset character delta
+ // Reset character delta
- WarehousePushThread.baneDelta = 0;
+ WarehousePushThread.baneDelta = 0;
- try (Connection localConnection = DbManager.getConnection();
- PreparedStatement statement = localConnection.prepareStatement(queryString, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); // Make this an updatable result set as we'll reset the dirty flag as we go along
- ResultSet rs = statement.executeQuery()) {
+ try (Connection localConnection = DbManager.getConnection();
+ PreparedStatement statement = localConnection.prepareStatement(queryString, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); // Make this an updatable result set as we'll reset the dirty flag as we go along
+ ResultSet rs = statement.executeQuery()) {
- while (rs.next()) {
+ while (rs.next()) {
- // Only update the index and dirty flag
- // if the remote database update succeeded
+ // Only update the index and dirty flag
+ // if the remote database update succeeded
- if (updateDirtyRecord(rs) == true)
- WarehousePushThread.baneDelta++;
- else
- continue;
+ if (updateDirtyRecord(rs) == true)
+ WarehousePushThread.baneDelta++;
+ else
+ continue;
- // Reset the dirty flag in the local database
+ // Reset the dirty flag in the local database
- rs.updateInt("dirty", 0);
- rs.updateRow();
- }
+ rs.updateInt("dirty", 0);
+ rs.updateRow();
+ }
- } catch (SQLException e) {
- Logger.error( e.toString());
- }
- }
+ } catch (SQLException e) {
+ Logger.error(e.toString());
+ }
+ }
- private static boolean updateDirtyRecord(ResultSet rs) {
+ private static boolean updateDirtyRecord(ResultSet rs) {
- try (Connection remoteConnection = DataWarehouse.remoteConnectionPool.getConnection();
- PreparedStatement statement = buildUpdateDirtyStatement(remoteConnection, rs)) {
+ try (Connection remoteConnection = DataWarehouse.remoteConnectionPool.getConnection();
+ PreparedStatement statement = buildUpdateDirtyStatement(remoteConnection, rs)) {
- statement.execute();
- return true;
- } catch (SQLException e) {
- Logger.error( e.toString());
- return false;
- }
- }
+ statement.execute();
+ return true;
+ } catch (SQLException e) {
+ Logger.error(e.toString());
+ return false;
+ }
+ }
- private static PreparedStatement buildUpdateDirtyStatement(Connection connection, ResultSet rs) throws SQLException {
+ private static PreparedStatement buildUpdateDirtyStatement(Connection connection, ResultSet rs) throws SQLException {
- PreparedStatement outStatement;
- String queryString = "UPDATE `warehouse_banehistory` SET `liveDateTime` = ?, `endDateTime` = ?, `resolution` = ? WHERE `event_number` = ?";
- java.util.Date sqlDateTime;
+ PreparedStatement outStatement;
+ String queryString = "UPDATE `warehouse_banehistory` SET `liveDateTime` = ?, `endDateTime` = ?, `resolution` = ? WHERE `event_number` = ?";
+ java.util.Date sqlDateTime;
- outStatement = connection.prepareStatement(queryString);
+ outStatement = connection.prepareStatement(queryString);
- // Bind record data
+ // Bind record data
- sqlDateTime = rs.getTimestamp("liveDateTime");
+ sqlDateTime = rs.getTimestamp("liveDateTime");
- if (sqlDateTime == null)
- outStatement.setNull(1, Types.DATE);
- else
- outStatement.setTimestamp(1, rs.getTimestamp("liveDateTime"));
+ if (sqlDateTime == null)
+ outStatement.setNull(1, Types.DATE);
+ else
+ outStatement.setTimestamp(1, rs.getTimestamp("liveDateTime"));
- sqlDateTime = rs.getTimestamp("endDateTime");
+ sqlDateTime = rs.getTimestamp("endDateTime");
- if (sqlDateTime == null)
- outStatement.setNull(2, Types.DATE);
- else
- outStatement.setTimestamp(2, rs.getTimestamp("endDateTime"));
+ if (sqlDateTime == null)
+ outStatement.setNull(2, Types.DATE);
+ else
+ outStatement.setTimestamp(2, rs.getTimestamp("endDateTime"));
- outStatement.setString(3, rs.getString("resolution"));
- outStatement.setInt(4, rs.getInt("event_number"));
+ outStatement.setString(3, rs.getString("resolution"));
+ outStatement.setInt(4, rs.getInt("event_number"));
- return outStatement;
- }
+ return outStatement;
+ }
- void reset() {
- this.cityHash = null;
- this.cityGuildHash = null;
- this.cityNationHash = null;
- this.baneDropperHash = null;
- this.baneGuildHash = null;
- this.baneNationHash = null;
- this.baneLiveTime = null;
- }
+ void reset() {
+ this.cityHash = null;
+ this.cityGuildHash = null;
+ this.cityNationHash = null;
+ this.baneDropperHash = null;
+ this.baneGuildHash = null;
+ this.baneNationHash = null;
+ this.baneLiveTime = null;
+ }
- public void release() {
- this.reset();
- recordPool.add(this);
- }
+ public void release() {
+ this.reset();
+ recordPool.add(this);
+ }
- public void write() {
+ public void write() {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = buildBaneInsertStatement(connection)) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = buildBaneInsertStatement(connection)) {
- statement.execute();
+ statement.execute();
- } catch (SQLException e) {
- Logger.error(e.toString());
- }
+ } catch (SQLException e) {
+ Logger.error(e.toString());
+ }
- }
+ }
- private PreparedStatement buildBaneInsertStatement(Connection connection) throws SQLException {
+ private PreparedStatement buildBaneInsertStatement(Connection connection) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "INSERT INTO `warehouse_banehistory` (`city_id`, `city_name`, `char_id`, `offGuild_id`, `offNat_id`, `defGuild_id`, `defNat_id`, `dropDatetime`, `liveDateTime`, `resolution`) VALUES(?,?,?,?,?,?,?,?,?,?)";
+ PreparedStatement outStatement = null;
+ String queryString = "INSERT INTO `warehouse_banehistory` (`city_id`, `city_name`, `char_id`, `offGuild_id`, `offNat_id`, `defGuild_id`, `defNat_id`, `dropDatetime`, `liveDateTime`, `resolution`) VALUES(?,?,?,?,?,?,?,?,?,?)";
- outStatement = connection.prepareStatement(queryString);
+ outStatement = connection.prepareStatement(queryString);
- outStatement.setString(1, this.cityHash);
- outStatement.setString(2, this.cityName);
- outStatement.setString(3, this.baneDropperHash);
- outStatement.setString(4, this.baneGuildHash);
- outStatement.setString(5, this.baneNationHash);
- outStatement.setString(6, this.cityGuildHash);
- outStatement.setString(7, this.cityNationHash);
+ outStatement.setString(1, this.cityHash);
+ outStatement.setString(2, this.cityName);
+ outStatement.setString(3, this.baneDropperHash);
+ outStatement.setString(4, this.baneGuildHash);
+ outStatement.setString(5, this.baneNationHash);
+ outStatement.setString(6, this.cityGuildHash);
+ outStatement.setString(7, this.cityNationHash);
- if (this.baneDropTime == null)
- outStatement.setNull(8, java.sql.Types.DATE);
- else
- outStatement.setTimestamp(8, new java.sql.Timestamp(this.baneDropTime.getMillis()));
+ if (this.baneDropTime == null)
+ outStatement.setNull(8, java.sql.Types.DATE);
+ else
+ outStatement.setTimestamp(8, new java.sql.Timestamp(this.baneDropTime.getMillis()));
- if (this.baneLiveTime == null)
- outStatement.setNull(9, java.sql.Types.DATE);
- else
- outStatement.setTimestamp(9, new java.sql.Timestamp(this.baneLiveTime.getMillis()));
+ if (this.baneLiveTime == null)
+ outStatement.setNull(9, java.sql.Types.DATE);
+ else
+ outStatement.setTimestamp(9, new java.sql.Timestamp(this.baneLiveTime.getMillis()));
- outStatement.setString(10, this.eventType.name());
+ outStatement.setString(10, this.eventType.name());
- return outStatement;
- }
+ return outStatement;
+ }
} // END CLASS
diff --git a/src/engine/db/archive/CharacterRecord.java b/src/engine/db/archive/CharacterRecord.java
index 157c6d71..7b329d32 100644
--- a/src/engine/db/archive/CharacterRecord.java
+++ b/src/engine/db/archive/CharacterRecord.java
@@ -44,8 +44,7 @@ public class CharacterRecord extends DataRecord {
if (characterRecord == null) {
characterRecord = new CharacterRecord(player);
- }
- else {
+ } else {
characterRecord.recordType = Enum.DataRecordType.CHARACTER;
characterRecord.player = player;
diff --git a/src/engine/db/archive/CityRecord.java b/src/engine/db/archive/CityRecord.java
index 785cf405..099ddf7d 100644
--- a/src/engine/db/archive/CityRecord.java
+++ b/src/engine/db/archive/CityRecord.java
@@ -19,144 +19,143 @@ import java.util.concurrent.LinkedBlockingQueue;
public class CityRecord extends DataRecord {
- private static final LinkedBlockingQueue recordPool = new LinkedBlockingQueue<>();
- private Enum.RecordEventType eventType;
- private City city;
- private String cityHash;
- private String cityGuildHash;
- private String cityName;
- private String cityMotto;
- private float locX;
- private float locY;
- private String zoneHash;
- private java.time.LocalDateTime establishedDatetime;
+ private static final LinkedBlockingQueue recordPool = new LinkedBlockingQueue<>();
+ private Enum.RecordEventType eventType;
+ private City city;
+ private String cityHash;
+ private String cityGuildHash;
+ private String cityName;
+ private String cityMotto;
+ private float locX;
+ private float locY;
+ private String zoneHash;
+ private java.time.LocalDateTime establishedDatetime;
- private CityRecord(City city) {
- this.recordType = Enum.DataRecordType.CITY;
- this.city = city;
- this.eventType = Enum.RecordEventType.CREATE;
+ private CityRecord(City city) {
+ this.recordType = Enum.DataRecordType.CITY;
+ this.city = city;
+ this.eventType = Enum.RecordEventType.CREATE;
- }
+ }
- public static CityRecord borrow(City city, Enum.RecordEventType eventType) {
- CityRecord cityRecord;
+ public static CityRecord borrow(City city, Enum.RecordEventType eventType) {
+ CityRecord cityRecord;
- cityRecord = recordPool.poll();
+ cityRecord = recordPool.poll();
- if (cityRecord == null) {
- cityRecord = new CityRecord(city);
- cityRecord.eventType = eventType;
- }
- else {
- cityRecord.recordType = Enum.DataRecordType.CITY;
- cityRecord.eventType = eventType;
- cityRecord.city = city;
+ if (cityRecord == null) {
+ cityRecord = new CityRecord(city);
+ cityRecord.eventType = eventType;
+ } else {
+ cityRecord.recordType = Enum.DataRecordType.CITY;
+ cityRecord.eventType = eventType;
+ cityRecord.city = city;
- }
+ }
- if (cityRecord.city.getHash() == null)
- cityRecord.city.setHash(DataWarehouse.hasher.encrypt(cityRecord.city.getObjectUUID()));
+ if (cityRecord.city.getHash() == null)
+ cityRecord.city.setHash(DataWarehouse.hasher.encrypt(cityRecord.city.getObjectUUID()));
- cityRecord.cityHash = cityRecord.city.getHash();
+ cityRecord.cityHash = cityRecord.city.getHash();
- cityRecord.cityName = cityRecord.city.getCityName();
- cityRecord.cityMotto = cityRecord.city.getMotto();
+ cityRecord.cityName = cityRecord.city.getCityName();
+ cityRecord.cityMotto = cityRecord.city.getMotto();
- cityRecord.cityGuildHash = cityRecord.city.getGuild().getHash();
+ cityRecord.cityGuildHash = cityRecord.city.getGuild().getHash();
- cityRecord.locX = cityRecord.city.getTOL().getLoc().x;
- cityRecord.locY = -cityRecord.city.getTOL().getLoc().z; // flip sign on 'y' coordinate
+ cityRecord.locX = cityRecord.city.getTOL().getLoc().x;
+ cityRecord.locY = -cityRecord.city.getTOL().getLoc().z; // flip sign on 'y' coordinate
- cityRecord.zoneHash = cityRecord.city.getParent().getHash();
+ cityRecord.zoneHash = cityRecord.city.getParent().getHash();
- if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
- cityRecord.establishedDatetime = cityRecord.city.established;
- else
- cityRecord.establishedDatetime = java.time.LocalDateTime.now();
+ if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
+ cityRecord.establishedDatetime = cityRecord.city.established;
+ else
+ cityRecord.establishedDatetime = java.time.LocalDateTime.now();
- return cityRecord;
- }
+ return cityRecord;
+ }
- public static PreparedStatement buildCityPushStatement(Connection connection, ResultSet rs) throws SQLException {
+ public static PreparedStatement buildCityPushStatement(Connection connection, ResultSet rs) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "INSERT INTO `warehouse_cityhistory` (`event_number`, `city_id`, `city_name`, `city_motto`, `guild_id`, `loc_x`, `loc_y`, `zone_id`, `eventType`, `datetime`) VALUES(?,?,?,?,?,?,?,?,?,?)";
- outStatement = connection.prepareStatement(queryString);
+ PreparedStatement outStatement = null;
+ String queryString = "INSERT INTO `warehouse_cityhistory` (`event_number`, `city_id`, `city_name`, `city_motto`, `guild_id`, `loc_x`, `loc_y`, `zone_id`, `eventType`, `datetime`) VALUES(?,?,?,?,?,?,?,?,?,?)";
+ outStatement = connection.prepareStatement(queryString);
- // Bind record data
+ // Bind record data
- outStatement.setInt(1, rs.getInt("event_number"));
- outStatement.setString(2, rs.getString("city_id"));
- outStatement.setString(3, rs.getString("city_name"));
- outStatement.setString(4, rs.getString("city_motto"));
- outStatement.setString(5, rs.getString("guild_id"));
+ outStatement.setInt(1, rs.getInt("event_number"));
+ outStatement.setString(2, rs.getString("city_id"));
+ outStatement.setString(3, rs.getString("city_name"));
+ outStatement.setString(4, rs.getString("city_motto"));
+ outStatement.setString(5, rs.getString("guild_id"));
- outStatement.setFloat(6, rs.getFloat("loc_x"));
- outStatement.setFloat(7, rs.getFloat("loc_y"));
- outStatement.setString(8, rs.getString("zone_id"));
- outStatement.setString(9, rs.getString("eventType"));
- outStatement.setTimestamp(10, rs.getTimestamp("datetime"));
+ outStatement.setFloat(6, rs.getFloat("loc_x"));
+ outStatement.setFloat(7, rs.getFloat("loc_y"));
+ outStatement.setString(8, rs.getString("zone_id"));
+ outStatement.setString(9, rs.getString("eventType"));
+ outStatement.setTimestamp(10, rs.getTimestamp("datetime"));
- return outStatement;
- }
+ return outStatement;
+ }
- public static PreparedStatement buildCityQueryStatement(Connection connection) throws SQLException {
+ public static PreparedStatement buildCityQueryStatement(Connection connection) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "SELECT * FROM `warehouse_cityhistory` WHERE `event_number` > ?";
- outStatement = connection.prepareStatement(queryString);
- outStatement.setInt(1, WarehousePushThread.cityIndex);
- return outStatement;
- }
+ PreparedStatement outStatement = null;
+ String queryString = "SELECT * FROM `warehouse_cityhistory` WHERE `event_number` > ?";
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setInt(1, WarehousePushThread.cityIndex);
+ return outStatement;
+ }
- void reset() {
- this.city = null;
- this.cityHash = null;
- this.cityGuildHash = null;
- this.cityMotto = null;
- this.zoneHash = null;
- this.establishedDatetime = null;
+ void reset() {
+ this.city = null;
+ this.cityHash = null;
+ this.cityGuildHash = null;
+ this.cityMotto = null;
+ this.zoneHash = null;
+ this.establishedDatetime = null;
- }
+ }
- public void release() {
- this.reset();
- recordPool.add(this);
- }
+ public void release() {
+ this.reset();
+ recordPool.add(this);
+ }
- public void write() {
+ public void write() {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = this.buildCityInsertStatement(connection)) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = this.buildCityInsertStatement(connection)) {
- statement.execute();
+ statement.execute();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
- private PreparedStatement buildCityInsertStatement(Connection connection) throws SQLException {
+ private PreparedStatement buildCityInsertStatement(Connection connection) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "INSERT INTO `warehouse_cityhistory` (`city_id`, `city_name`, `city_motto`, `guild_id`, `loc_x`, `loc_y`, `zone_id`, `eventType`, `datetime`) VALUES(?,?,?,?,?,?,?,?,?)";
+ PreparedStatement outStatement = null;
+ String queryString = "INSERT INTO `warehouse_cityhistory` (`city_id`, `city_name`, `city_motto`, `guild_id`, `loc_x`, `loc_y`, `zone_id`, `eventType`, `datetime`) VALUES(?,?,?,?,?,?,?,?,?)";
- outStatement = connection.prepareStatement(queryString);
+ outStatement = connection.prepareStatement(queryString);
- // Bind character data
+ // Bind character data
- outStatement.setString(1, this.cityHash);
- outStatement.setString(2, this.cityName);
- outStatement.setString(3, this.cityMotto);
- outStatement.setString(4, this.cityGuildHash);
+ outStatement.setString(1, this.cityHash);
+ outStatement.setString(2, this.cityName);
+ outStatement.setString(3, this.cityMotto);
+ outStatement.setString(4, this.cityGuildHash);
- outStatement.setFloat(5, this.locX);
- outStatement.setFloat(6, this.locY);
- outStatement.setString(7, this.zoneHash);
- outStatement.setString(8, this.eventType.name());
- outStatement.setTimestamp(9, Timestamp.valueOf(this.establishedDatetime));
+ outStatement.setFloat(5, this.locX);
+ outStatement.setFloat(6, this.locY);
+ outStatement.setString(7, this.zoneHash);
+ outStatement.setString(8, this.eventType.name());
+ outStatement.setTimestamp(9, Timestamp.valueOf(this.establishedDatetime));
- return outStatement;
- }
+ return outStatement;
+ }
}
diff --git a/src/engine/db/archive/DataRecord.java b/src/engine/db/archive/DataRecord.java
index a86dd3a3..acba35e7 100644
--- a/src/engine/db/archive/DataRecord.java
+++ b/src/engine/db/archive/DataRecord.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.db.archive;
import engine.Enum;
diff --git a/src/engine/db/archive/DataWarehouse.java b/src/engine/db/archive/DataWarehouse.java
index 8ba3b744..d8055409 100644
--- a/src/engine/db/archive/DataWarehouse.java
+++ b/src/engine/db/archive/DataWarehouse.java
@@ -35,12 +35,12 @@ public class DataWarehouse implements Runnable {
// If WarehousePush is disabled
// then early exit
- if ( ConfigManager.MB_WORLD_WAREHOUSE_PUSH.getValue().equalsIgnoreCase("false")) {
+ if (ConfigManager.MB_WORLD_WAREHOUSE_PUSH.getValue().equalsIgnoreCase("false")) {
Logger.info("Warehouse Remote Connection disabled along with push");
return;
}
- Logger.info( "Configuring remote Database Connection Pool...");
+ Logger.info("Configuring remote Database Connection Pool...");
configureRemoteConnectionPool();
}
@@ -188,6 +188,24 @@ public class DataWarehouse implements Runnable {
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() {
// Working variable set
@@ -201,7 +219,7 @@ public class DataWarehouse implements Runnable {
RealmRecord realmRecord;
MineRecord mineRecord;
- Logger.info( "DataWarehouse is running.");
+ Logger.info("DataWarehouse is running.");
while (true) {
@@ -261,7 +279,7 @@ public class DataWarehouse implements Runnable {
mineRecord.release();
break;
default:
- Logger.error( "Unhandled record type");
+ Logger.error("Unhandled record type");
break;
} // end switch
@@ -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");
- }
-
}
diff --git a/src/engine/db/archive/GuildRecord.java b/src/engine/db/archive/GuildRecord.java
index ec141cea..9447fd54 100644
--- a/src/engine/db/archive/GuildRecord.java
+++ b/src/engine/db/archive/GuildRecord.java
@@ -26,144 +26,139 @@ import java.util.concurrent.LinkedBlockingQueue;
public class GuildRecord extends DataRecord {
- private static final LinkedBlockingQueue recordPool = new LinkedBlockingQueue<>();
- private Enum.RecordEventType eventType;
- private Guild guild;
- public String guildHash;
- private String guildName;
- private String charterName;
- private String GLHash;
- private String guildMotto;
- private int bgIcon;
- private int bgColour1;
- private int bgColour2;
- private int fgIcon;
- private int fgColour;
- public int guildID;
-
- private java.time.LocalDateTime eventDatetime;
-
- public static HashMap GuildRecordCache = null;
-
- private GuildRecord(Guild guild) {
- this.recordType = Enum.DataRecordType.GUILD;
- this.guild = guild;
- this.eventType = Enum.RecordEventType.CREATE;
- }
-
-
-
- public GuildRecord(ResultSet rs) throws SQLException {
- super();
- this.eventType = RecordEventType.valueOf(rs.getString("eventType"));
- this.guildHash = rs.getString("guild_id");
- this.guildName = rs.getString("guild_name");
- this.charterName = rs.getString("charter");
- GLHash = rs.getString("guild_founder");
- this.guildMotto = rs.getString("guild_motto");
- this.bgIcon = rs.getInt("bgicon");
- this.bgColour1 = rs.getInt("bgcoloura");
- this.bgColour2 = rs.getInt("bgcolourb");
- this.fgIcon = rs.getInt("fgicon");
- this.fgColour = rs.getInt("fgcolour");
-
- java.sql.Timestamp eventTimeStamp = rs.getTimestamp("upgradeDate");
-
- if (eventTimeStamp != null)
- this.eventDatetime = LocalDateTime.ofInstant(eventTimeStamp.toInstant(), ZoneId.systemDefault());
- }
-
-
-
- public static GuildRecord borrow(Guild guild, Enum.RecordEventType eventType) {
- GuildRecord guildRecord;
- //add
- guildRecord = recordPool.poll();
-
- if (guildRecord == null) {
- guildRecord = new GuildRecord(guild);
- guildRecord.eventType = eventType;
- }
- else {
- guildRecord.guild = guild;
- guildRecord.recordType = Enum.DataRecordType.GUILD;
- guildRecord.eventType = eventType;
-
- }
-
- guildRecord.guildHash = guildRecord.guild.getHash();
- guildRecord.guildID = guildRecord.guild.getObjectUUID();
- guildRecord.guildName = guildRecord.guild.getName();
- guildRecord.charterName = Enum.GuildType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
-
- guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
-
- guildRecord.guildMotto = guildRecord.guild.getMotto();
- guildRecord.bgIcon = guildRecord.guild.getBgDesign();
- guildRecord.bgColour1 = guildRecord.guild.getBgc1();
- guildRecord.bgColour2 = guildRecord.guild.getBgc2();
- guildRecord.fgIcon = guildRecord.guild.getSymbol();
- guildRecord.fgColour = guildRecord.guild.getSc();
-
- if (guild.getOwnedCity() != null)
- guildRecord.eventDatetime = guild.getOwnedCity().established;
- else
- guildRecord.eventDatetime = LocalDateTime.now();
-
- return guildRecord;
- }
-
- public static PreparedStatement buildGuildPushStatement(Connection connection, ResultSet rs) throws SQLException {
-
- PreparedStatement outStatement = null;
- String queryString = "INSERT INTO `warehouse_guildhistory` (`event_number`, `guild_id`, `guild_name`, `guild_motto`, `guild_founder`, `charter`, `bgicon`, `bgcoloura`, `bgcolourb`, `fgicon`, `fgcolour`, `eventtype`, `datetime`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)";
-
- outStatement = connection.prepareStatement(queryString);
-
- // Bind record data
-
- outStatement.setInt(1, rs.getInt("event_number"));
- outStatement.setString(2, rs.getString("guild_id"));
- outStatement.setString(3, rs.getString("guild_name"));
- outStatement.setString(4, rs.getString("guild_motto"));
- outStatement.setString(5, rs.getString("guild_founder"));
- outStatement.setString(6, rs.getString("charter"));
- outStatement.setInt(7, rs.getInt("bgicon"));
- outStatement.setInt(8, rs.getInt("bgcoloura"));
- outStatement.setInt(9, rs.getInt("bgcolourb"));
- outStatement.setInt(10, rs.getInt("fgicon"));
- outStatement.setInt(11, rs.getInt("fgcolour"));
- outStatement.setString(12, rs.getString("eventtype"));
- outStatement.setTimestamp(13, rs.getTimestamp("datetime"));
-
- return outStatement;
- }
-
- public static PreparedStatement buildGuildQueryStatement(Connection connection) throws SQLException {
-
- PreparedStatement outStatement = null;
- String queryString = "SELECT * FROM `warehouse_guildhistory` WHERE `event_number` > ?";
- outStatement = connection.prepareStatement(queryString);
- outStatement.setInt(1, WarehousePushThread.guildIndex);
- return outStatement;
- }
-
- void reset() {
-
- this.guild = null;
- this.guildHash = null;
- this.GLHash = null;
- this.guildMotto = null;
- this.charterName = null;
- this.eventDatetime = null;
- }
-
- public void release() {
- this.reset();
- recordPool.add(this);
- }
+ private static final LinkedBlockingQueue recordPool = new LinkedBlockingQueue<>();
+ public static HashMap GuildRecordCache = null;
+ public String guildHash;
+ public int guildID;
+ private Enum.RecordEventType eventType;
+ private Guild guild;
+ private String guildName;
+ private String charterName;
+ private String GLHash;
+ private String guildMotto;
+ private int bgIcon;
+ private int bgColour1;
+ private int bgColour2;
+ private int fgIcon;
+ private int fgColour;
+ private java.time.LocalDateTime eventDatetime;
+
+ private GuildRecord(Guild guild) {
+ this.recordType = Enum.DataRecordType.GUILD;
+ this.guild = guild;
+ this.eventType = Enum.RecordEventType.CREATE;
+ }
+
+
+ public GuildRecord(ResultSet rs) throws SQLException {
+ super();
+ this.eventType = RecordEventType.valueOf(rs.getString("eventType"));
+ this.guildHash = rs.getString("guild_id");
+ this.guildName = rs.getString("guild_name");
+ this.charterName = rs.getString("charter");
+ GLHash = rs.getString("guild_founder");
+ this.guildMotto = rs.getString("guild_motto");
+ this.bgIcon = rs.getInt("bgicon");
+ this.bgColour1 = rs.getInt("bgcoloura");
+ this.bgColour2 = rs.getInt("bgcolourb");
+ this.fgIcon = rs.getInt("fgicon");
+ this.fgColour = rs.getInt("fgcolour");
+
+ java.sql.Timestamp eventTimeStamp = rs.getTimestamp("upgradeDate");
+
+ if (eventTimeStamp != null)
+ this.eventDatetime = LocalDateTime.ofInstant(eventTimeStamp.toInstant(), ZoneId.systemDefault());
+ }
+
+
+ public static GuildRecord borrow(Guild guild, Enum.RecordEventType eventType) {
+ GuildRecord guildRecord;
+ //add
+ guildRecord = recordPool.poll();
+
+ if (guildRecord == null) {
+ guildRecord = new GuildRecord(guild);
+ guildRecord.eventType = eventType;
+ } else {
+ guildRecord.guild = guild;
+ guildRecord.recordType = Enum.DataRecordType.GUILD;
+ guildRecord.eventType = eventType;
+
+ }
+
+ guildRecord.guildHash = guildRecord.guild.getHash();
+ guildRecord.guildID = guildRecord.guild.getObjectUUID();
+ guildRecord.guildName = guildRecord.guild.getName();
+ guildRecord.charterName = Enum.GuildType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
+
+ guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
+
+ guildRecord.guildMotto = guildRecord.guild.getMotto();
+ guildRecord.bgIcon = guildRecord.guild.getBgDesign();
+ guildRecord.bgColour1 = guildRecord.guild.getBgc1();
+ guildRecord.bgColour2 = guildRecord.guild.getBgc2();
+ guildRecord.fgIcon = guildRecord.guild.getSymbol();
+ guildRecord.fgColour = guildRecord.guild.getSc();
+
+ if (guild.getOwnedCity() != null)
+ guildRecord.eventDatetime = guild.getOwnedCity().established;
+ else
+ guildRecord.eventDatetime = LocalDateTime.now();
+
+ return guildRecord;
+ }
+
+ public static PreparedStatement buildGuildPushStatement(Connection connection, ResultSet rs) throws SQLException {
- public void write() {
+ PreparedStatement outStatement = null;
+ String queryString = "INSERT INTO `warehouse_guildhistory` (`event_number`, `guild_id`, `guild_name`, `guild_motto`, `guild_founder`, `charter`, `bgicon`, `bgcoloura`, `bgcolourb`, `fgicon`, `fgcolour`, `eventtype`, `datetime`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)";
+
+ outStatement = connection.prepareStatement(queryString);
+
+ // Bind record data
+
+ outStatement.setInt(1, rs.getInt("event_number"));
+ outStatement.setString(2, rs.getString("guild_id"));
+ outStatement.setString(3, rs.getString("guild_name"));
+ outStatement.setString(4, rs.getString("guild_motto"));
+ outStatement.setString(5, rs.getString("guild_founder"));
+ outStatement.setString(6, rs.getString("charter"));
+ outStatement.setInt(7, rs.getInt("bgicon"));
+ outStatement.setInt(8, rs.getInt("bgcoloura"));
+ outStatement.setInt(9, rs.getInt("bgcolourb"));
+ outStatement.setInt(10, rs.getInt("fgicon"));
+ outStatement.setInt(11, rs.getInt("fgcolour"));
+ outStatement.setString(12, rs.getString("eventtype"));
+ outStatement.setTimestamp(13, rs.getTimestamp("datetime"));
+
+ return outStatement;
+ }
+
+ public static PreparedStatement buildGuildQueryStatement(Connection connection) throws SQLException {
+
+ PreparedStatement outStatement = null;
+ String queryString = "SELECT * FROM `warehouse_guildhistory` WHERE `event_number` > ?";
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setInt(1, WarehousePushThread.guildIndex);
+ return outStatement;
+ }
+
+ void reset() {
+
+ this.guild = null;
+ this.guildHash = null;
+ this.GLHash = null;
+ this.guildMotto = null;
+ this.charterName = null;
+ this.eventDatetime = null;
+ }
+
+ public void release() {
+ this.reset();
+ recordPool.add(this);
+ }
+
+ public void write() {
try (Connection connection = DbManager.getConnection();
PreparedStatement statement = this.buildGuildInsertStatement(connection)) {
@@ -176,33 +171,33 @@ public class GuildRecord extends DataRecord {
}
- private PreparedStatement buildGuildInsertStatement(Connection connection) throws SQLException {
+ private PreparedStatement buildGuildInsertStatement(Connection connection) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "INSERT INTO `warehouse_guildhistory` (`guild_id`, `guild_name`, `guild_motto`, `guild_founder`, `charter`, `bgicon`, `bgcoloura`, `bgcolourb`, `fgicon`, `fgcolour`, `eventtype`, `datetime`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
+ PreparedStatement outStatement = null;
+ String queryString = "INSERT INTO `warehouse_guildhistory` (`guild_id`, `guild_name`, `guild_motto`, `guild_founder`, `charter`, `bgicon`, `bgcoloura`, `bgcolourb`, `fgicon`, `fgcolour`, `eventtype`, `datetime`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
- outStatement = connection.prepareStatement(queryString);
+ outStatement = connection.prepareStatement(queryString);
- // Bind character data
+ // Bind character data
- outStatement.setString(1, this.guildHash);
- outStatement.setString(2, this.guildName);
- outStatement.setString(3, this.guildMotto);
- outStatement.setString(4, this.GLHash);
- outStatement.setString(5, this.charterName);
+ outStatement.setString(1, this.guildHash);
+ outStatement.setString(2, this.guildName);
+ outStatement.setString(3, this.guildMotto);
+ outStatement.setString(4, this.GLHash);
+ outStatement.setString(5, this.charterName);
- outStatement.setInt(6, this.bgIcon);
- outStatement.setInt(7, this.bgColour1);
- outStatement.setInt(8, this.bgColour2);
- outStatement.setInt(9, this.fgIcon);
- outStatement.setInt(10, this.fgColour);
- outStatement.setString(11, this.eventType.name());
- outStatement.setTimestamp(12, new java.sql.Timestamp( this.eventDatetime.atZone(ZoneId.systemDefault())
- .toInstant().toEpochMilli()));
+ outStatement.setInt(6, this.bgIcon);
+ outStatement.setInt(7, this.bgColour1);
+ outStatement.setInt(8, this.bgColour2);
+ outStatement.setInt(9, this.fgIcon);
+ outStatement.setInt(10, this.fgColour);
+ outStatement.setString(11, this.eventType.name());
+ outStatement.setTimestamp(12, new java.sql.Timestamp(this.eventDatetime.atZone(ZoneId.systemDefault())
+ .toInstant().toEpochMilli()));
+
+ return outStatement;
+ }
- return outStatement;
- }
-
// public static void InitializeGuildRecords(){
// GuildRecord.GuildRecordCache = DbManager.GuildQueries.GET_WAREHOUSE_GUILD_HISTORY();
// }
diff --git a/src/engine/db/archive/MineRecord.java b/src/engine/db/archive/MineRecord.java
index dbc236c0..25c151bd 100644
--- a/src/engine/db/archive/MineRecord.java
+++ b/src/engine/db/archive/MineRecord.java
@@ -47,8 +47,7 @@ public class MineRecord extends DataRecord {
if (mineRecord == null) {
mineRecord = new MineRecord();
mineRecord.eventType = eventType;
- }
- else {
+ } else {
mineRecord.recordType = Enum.DataRecordType.MINE;
mineRecord.eventType = eventType;
}
@@ -58,8 +57,7 @@ public class MineRecord extends DataRecord {
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
player = (PlayerCharacter) character;
mineRecord.charHash = player.getHash();
- }
- else
+ } else
mineRecord.charHash = character.getName();
DataWarehouse.hasher.encrypt(0);
diff --git a/src/engine/db/archive/PvpRecord.java b/src/engine/db/archive/PvpRecord.java
index 56734977..bfe3652e 100644
--- a/src/engine/db/archive/PvpRecord.java
+++ b/src/engine/db/archive/PvpRecord.java
@@ -28,286 +28,285 @@ import static engine.Enum.PvpHistoryType;
public class PvpRecord extends DataRecord {
- private static final LinkedBlockingQueue recordPool = new LinkedBlockingQueue<>();
+ private static final LinkedBlockingQueue recordPool = new LinkedBlockingQueue<>();
- private PlayerCharacter player;
- private PlayerCharacter victim;
- private Vector3fImmutable location;
- private boolean pvpExp;
+ private PlayerCharacter player;
+ private PlayerCharacter victim;
+ private Vector3fImmutable location;
+ private boolean pvpExp;
- private PvpRecord(PlayerCharacter player, PlayerCharacter victim, Vector3fImmutable location, boolean pvpExp) {
- this.recordType = DataRecordType.PVP;
- this.player = player;
- this.victim = victim;
- this.location = new Vector3fImmutable(location);
- this.pvpExp = pvpExp;
- }
+ private PvpRecord(PlayerCharacter player, PlayerCharacter victim, Vector3fImmutable location, boolean pvpExp) {
+ this.recordType = DataRecordType.PVP;
+ this.player = player;
+ this.victim = victim;
+ this.location = new Vector3fImmutable(location);
+ this.pvpExp = pvpExp;
+ }
- public static PvpRecord borrow(PlayerCharacter player, PlayerCharacter victim, Vector3fImmutable location, boolean pvpExp) {
+ public static PvpRecord borrow(PlayerCharacter player, PlayerCharacter victim, Vector3fImmutable location, boolean pvpExp) {
- PvpRecord pvpRecord;
+ PvpRecord pvpRecord;
- pvpRecord = recordPool.poll();
+ pvpRecord = recordPool.poll();
- if (pvpRecord == null) {
- pvpRecord = new PvpRecord(player, victim, location, pvpExp);
- }
- else {
- pvpRecord.recordType = DataRecordType.PVP;
- pvpRecord.player = player;
- pvpRecord.victim = victim;
- pvpRecord.location = new Vector3fImmutable(location);
- pvpRecord.pvpExp = pvpExp;
- }
+ if (pvpRecord == null) {
+ pvpRecord = new PvpRecord(player, victim, location, pvpExp);
+ } else {
+ pvpRecord.recordType = DataRecordType.PVP;
+ pvpRecord.player = player;
+ pvpRecord.victim = victim;
+ pvpRecord.location = new Vector3fImmutable(location);
+ pvpRecord.pvpExp = pvpExp;
+ }
- return pvpRecord;
- }
+ return pvpRecord;
+ }
- private static PreparedStatement buildHistoryStatement(Connection connection, int charUUID, PvpHistoryType historyType) throws SQLException {
+ private static PreparedStatement buildHistoryStatement(Connection connection, int charUUID, PvpHistoryType historyType) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "";
+ PreparedStatement outStatement = null;
+ String queryString = "";
- switch (historyType) {
- case KILLS:
- queryString = "SELECT DISTINCT `victim_id`, `datetime` FROM warehouse_pvphistory where char_id = ? " +
- "ORDER BY `datetime` DESC LIMIT 10";
- break;
- case DEATHS:
- queryString = "SELECT DISTINCT `char_id`,`datetime` FROM warehouse_pvphistory where `victim_id` = ? " +
- "ORDER BY `datetime` DESC LIMIT 10";
- break;
- }
+ switch (historyType) {
+ case KILLS:
+ queryString = "SELECT DISTINCT `victim_id`, `datetime` FROM warehouse_pvphistory where char_id = ? " +
+ "ORDER BY `datetime` DESC LIMIT 10";
+ break;
+ case DEATHS:
+ queryString = "SELECT DISTINCT `char_id`,`datetime` FROM warehouse_pvphistory where `victim_id` = ? " +
+ "ORDER BY `datetime` DESC LIMIT 10";
+ break;
+ }
- outStatement = connection.prepareStatement(queryString);
- outStatement.setString(1, DataWarehouse.hasher.encrypt(charUUID));
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setString(1, DataWarehouse.hasher.encrypt(charUUID));
- return outStatement;
- }
+ return outStatement;
+ }
- public static LinkedList getCharacterPvPHistory(int charUUID, PvpHistoryType historyType) {
+ public static LinkedList getCharacterPvPHistory(int charUUID, PvpHistoryType historyType) {
- // Member variable declaration
+ // Member variable declaration
- LinkedList outList = new LinkedList<>();
+ LinkedList outList = new LinkedList<>();
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = buildHistoryStatement(connection, charUUID, historyType);
- ResultSet rs = statement.executeQuery()) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = buildHistoryStatement(connection, charUUID, historyType);
+ ResultSet rs = statement.executeQuery()) {
- while (rs.next()) {
+ while (rs.next()) {
- switch (historyType) {
- case KILLS:
- outList.add((int) DataWarehouse.hasher.decrypt(rs.getString("victim_id"))[0]);
- break;
- case DEATHS:
- outList.add((int) DataWarehouse.hasher.decrypt(rs.getString("char_id"))[0]);
- break;
- }
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return outList;
- }
+ switch (historyType) {
+ case KILLS:
+ outList.add((int) DataWarehouse.hasher.decrypt(rs.getString("victim_id"))[0]);
+ break;
+ case DEATHS:
+ outList.add((int) DataWarehouse.hasher.decrypt(rs.getString("char_id"))[0]);
+ break;
+ }
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return outList;
+ }
- private static PreparedStatement buildLuaHistoryQueryStatement(Connection connection, int charUUID) throws SQLException {
+ private static PreparedStatement buildLuaHistoryQueryStatement(Connection connection, int charUUID) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "CALL `pvpHistory`(?)";
+ PreparedStatement outStatement = null;
+ String queryString = "CALL `pvpHistory`(?)";
- outStatement = connection.prepareStatement(queryString);
- outStatement.setString(1, DataWarehouse.hasher.encrypt(charUUID));
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setString(1, DataWarehouse.hasher.encrypt(charUUID));
- return outStatement;
- }
+ return outStatement;
+ }
- public static String getPvpHistoryString(int charUUID) {
+ public static String getPvpHistoryString(int charUUID) {
- String outString;
- String dividerString;
+ String outString;
+ String dividerString;
- String newLine = System.getProperty("line.separator");
+ String newLine = System.getProperty("line.separator");
- outString = "[LUA_PVP() DATA WAREHOUSE]" + newLine;
- dividerString = "--------------------------------" + newLine;
+ outString = "[LUA_PVP() DATA WAREHOUSE]" + newLine;
+ dividerString = "--------------------------------" + newLine;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = buildLuaHistoryQueryStatement(connection, charUUID);
- ResultSet rs = statement.executeQuery()) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = buildLuaHistoryQueryStatement(connection, charUUID);
+ ResultSet rs = statement.executeQuery()) {
- while (rs.next()) {
+ while (rs.next()) {
- int killCount;
- int deathCount;
- float killRatio;
+ int killCount;
+ int deathCount;
+ float killRatio;
- outString += "Total Magicbane murdered souls: " + rs.getInt("TOTALDEATHS") + newLine;
- outString += dividerString;
- outString += String.format("%-8s %-8s %-8s %-8s %n", "Period", "Kills", "Deaths", "K/D");
- outString += dividerString;
+ outString += "Total Magicbane murdered souls: " + rs.getInt("TOTALDEATHS") + newLine;
+ outString += dividerString;
+ outString += String.format("%-8s %-8s %-8s %-8s %n", "Period", "Kills", "Deaths", "K/D");
+ outString += dividerString;
- killCount = rs.getInt("KILLCOUNT");
- deathCount = rs.getInt("DEATHCOUNT");
-
- if (deathCount == 0)
- killRatio = (float) killCount;
- else
- killRatio = (float) killCount / deathCount;
+ killCount = rs.getInt("KILLCOUNT");
+ deathCount = rs.getInt("DEATHCOUNT");
+
+ if (deathCount == 0)
+ killRatio = (float) killCount;
+ else
+ killRatio = (float) killCount / deathCount;
- try {
- outString += String.format("%-8s %-8d %-8d %.2f %n", "Total", killCount, deathCount, killRatio);
+ try {
+ outString += String.format("%-8s %-8d %-8d %.2f %n", "Total", killCount, deathCount, killRatio);
- killCount = rs.getInt("DAILYKILLS");
- deathCount = rs.getInt("DAILYDEATHS");
+ killCount = rs.getInt("DAILYKILLS");
+ deathCount = rs.getInt("DAILYDEATHS");
- if (deathCount == 0)
- killRatio = (float) killCount;
- else
- killRatio = (float) killCount / deathCount;
+ if (deathCount == 0)
+ killRatio = (float) killCount;
+ else
+ killRatio = (float) killCount / deathCount;
- outString += String.format("%-8s %-8d %-8d %.2f %n", "24hrs", killCount, deathCount, killRatio);
+ outString += String.format("%-8s %-8d %-8d %.2f %n", "24hrs", killCount, deathCount, killRatio);
- killCount = rs.getInt("HOURLYKILLS");
- deathCount = rs.getInt("HOURLYDEATHS");
+ killCount = rs.getInt("HOURLYKILLS");
+ deathCount = rs.getInt("HOURLYDEATHS");
- if (deathCount == 0)
- killRatio = (float) killCount;
- else
- killRatio = (float) killCount / deathCount;
+ if (deathCount == 0)
+ killRatio = (float) killCount;
+ else
+ killRatio = (float) killCount / deathCount;
- outString += String.format("%-8s %-8d %-8d %.2f %n", "1hr", killCount, deathCount, killRatio);
- } catch (Exception e) {
- Logger.error(e.toString());
- }
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
+ outString += String.format("%-8s %-8d %-8d %.2f %n", "1hr", killCount, deathCount, killRatio);
+ } catch (Exception e) {
+ Logger.error(e.toString());
+ }
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
- return outString;
- }
+ return outString;
+ }
- public static PreparedStatement buildPvpPushStatement(Connection connection, ResultSet rs) throws SQLException {
+ public static PreparedStatement buildPvpPushStatement(Connection connection, ResultSet rs) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "INSERT INTO `warehouse_pvphistory` (`event_number`, `char_id`, `char_guild_id`, `char_nation_id`, `char_level`," +
- " `victim_id`, `victim_guild_id`, `victim_nation_id`, `victim_level`," +
- " `zone_id`, `zone_name`, `loc_x`, `loc_y`, `gave_exp`, `datetime`) " +
- " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ PreparedStatement outStatement = null;
+ String queryString = "INSERT INTO `warehouse_pvphistory` (`event_number`, `char_id`, `char_guild_id`, `char_nation_id`, `char_level`," +
+ " `victim_id`, `victim_guild_id`, `victim_nation_id`, `victim_level`," +
+ " `zone_id`, `zone_name`, `loc_x`, `loc_y`, `gave_exp`, `datetime`) " +
+ " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- outStatement = connection.prepareStatement(queryString);
+ outStatement = connection.prepareStatement(queryString);
- // Bind record data
+ // Bind record data
- outStatement.setInt(1, rs.getInt("event_number"));
- outStatement.setString(2, rs.getString("char_id"));
- outStatement.setString(3, rs.getString("char_guild_id"));
- outStatement.setString(4, rs.getString("char_nation_id"));
- outStatement.setInt(5, rs.getInt("char_level"));
+ outStatement.setInt(1, rs.getInt("event_number"));
+ outStatement.setString(2, rs.getString("char_id"));
+ outStatement.setString(3, rs.getString("char_guild_id"));
+ outStatement.setString(4, rs.getString("char_nation_id"));
+ outStatement.setInt(5, rs.getInt("char_level"));
- // Bind victim data
+ // Bind victim data
- outStatement.setString(6, rs.getString("victim_id"));
- outStatement.setString(7, rs.getString("victim_guild_id"));
- outStatement.setString(8, rs.getString("victim_nation_id"));
- outStatement.setInt(9, rs.getInt("victim_level"));
+ outStatement.setString(6, rs.getString("victim_id"));
+ outStatement.setString(7, rs.getString("victim_guild_id"));
+ outStatement.setString(8, rs.getString("victim_nation_id"));
+ outStatement.setInt(9, rs.getInt("victim_level"));
- outStatement.setString(10, rs.getString("zone_id"));
- outStatement.setString(11, rs.getString("zone_name"));
- outStatement.setFloat(12, rs.getFloat("loc_x"));
- outStatement.setFloat(13, rs.getFloat("loc_y"));
- outStatement.setBoolean(14, rs.getBoolean("gave_exp"));
- outStatement.setTimestamp(15, rs.getTimestamp("datetime"));
+ outStatement.setString(10, rs.getString("zone_id"));
+ outStatement.setString(11, rs.getString("zone_name"));
+ outStatement.setFloat(12, rs.getFloat("loc_x"));
+ outStatement.setFloat(13, rs.getFloat("loc_y"));
+ outStatement.setBoolean(14, rs.getBoolean("gave_exp"));
+ outStatement.setTimestamp(15, rs.getTimestamp("datetime"));
- return outStatement;
- }
+ return outStatement;
+ }
- public static PreparedStatement buildPvpQueryStatement(Connection connection) throws SQLException {
+ public static PreparedStatement buildPvpQueryStatement(Connection connection) throws SQLException {
- PreparedStatement outStatement = null;
- String queryString = "SELECT * FROM `warehouse_pvphistory` WHERE `event_number` > ?";
- outStatement = connection.prepareStatement(queryString);
- outStatement.setInt(1, WarehousePushThread.pvpIndex);
- return outStatement;
- }
+ PreparedStatement outStatement = null;
+ String queryString = "SELECT * FROM `warehouse_pvphistory` WHERE `event_number` > ?";
+ outStatement = connection.prepareStatement(queryString);
+ outStatement.setInt(1, WarehousePushThread.pvpIndex);
+ return outStatement;
+ }
- void reset() {
- this.player = null;
- this.victim = null;
- this.location = Vector3fImmutable.ZERO;
- pvpExp = false;
- }
+ void reset() {
+ this.player = null;
+ this.victim = null;
+ this.location = Vector3fImmutable.ZERO;
+ pvpExp = false;
+ }
- public void release() {
- this.reset();
- recordPool.add(this);
- }
+ public void release() {
+ this.reset();
+ recordPool.add(this);
+ }
- private PreparedStatement buildPvPInsertStatement(Connection connection) throws SQLException {
+ private PreparedStatement buildPvPInsertStatement(Connection connection) throws SQLException {
- Guild charGuild;
- Guild victimGuild;
- Zone zone;
- PreparedStatement outStatement = null;
+ Guild charGuild;
+ Guild victimGuild;
+ Zone zone;
+ PreparedStatement outStatement = null;
- String queryString = "INSERT INTO `warehouse_pvphistory` (`char_id`, `char_guild_id`, `char_nation_id`, `char_level`," +
- " `victim_id`, `victim_guild_id`, `victim_nation_id`, `victim_level`," +
- " `zone_id`, `zone_name`, `loc_x`, `loc_y`, `gave_exp`, `datetime`) " +
- " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ String queryString = "INSERT INTO `warehouse_pvphistory` (`char_id`, `char_guild_id`, `char_nation_id`, `char_level`," +
+ " `victim_id`, `victim_guild_id`, `victim_nation_id`, `victim_level`," +
+ " `zone_id`, `zone_name`, `loc_x`, `loc_y`, `gave_exp`, `datetime`) " +
+ " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- outStatement = connection.prepareStatement(queryString);
+ outStatement = connection.prepareStatement(queryString);
- charGuild = this.player.getGuild();
- victimGuild = this.victim.getGuild();
+ charGuild = this.player.getGuild();
+ victimGuild = this.victim.getGuild();
- // Use a proxy in the situation where a char guild is null (errant)
+ // Use a proxy in the situation where a char guild is null (errant)
-
- // Retrieve the zone name where the PvP event occurred
- zone = ZoneManager.findSmallestZone(this.location);
+ // Retrieve the zone name where the PvP event occurred
- outStatement.setString(1, DataWarehouse.hasher.encrypt(this.player.getObjectUUID()));
- outStatement.setString(2, DataWarehouse.hasher.encrypt(charGuild.getObjectUUID()));
- outStatement.setString(3, DataWarehouse.hasher.encrypt(charGuild.getNation().getObjectUUID()));
- outStatement.setInt(4, this.player.getLevel());
+ zone = ZoneManager.findSmallestZone(this.location);
- // Bind victim data
+ outStatement.setString(1, DataWarehouse.hasher.encrypt(this.player.getObjectUUID()));
+ outStatement.setString(2, DataWarehouse.hasher.encrypt(charGuild.getObjectUUID()));
+ outStatement.setString(3, DataWarehouse.hasher.encrypt(charGuild.getNation().getObjectUUID()));
+ outStatement.setInt(4, this.player.getLevel());
- outStatement.setString(5, DataWarehouse.hasher.encrypt(this.victim.getObjectUUID()));
- outStatement.setString(6, DataWarehouse.hasher.encrypt(victimGuild.getObjectUUID()));
- outStatement.setString(7, DataWarehouse.hasher.encrypt(victimGuild.getNation().getObjectUUID()));
- outStatement.setInt(8, this.victim.getLevel());
+ // Bind victim data
- outStatement.setString(9, DataWarehouse.hasher.encrypt(zone.getObjectUUID()));
- outStatement.setString(10, zone.getName());
- outStatement.setFloat(11, this.location.getX());
- outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate
- outStatement.setBoolean(13, this.pvpExp);
- outStatement.setTimestamp(14, Timestamp.valueOf(LocalDateTime.now()));
+ outStatement.setString(5, DataWarehouse.hasher.encrypt(this.victim.getObjectUUID()));
+ outStatement.setString(6, DataWarehouse.hasher.encrypt(victimGuild.getObjectUUID()));
+ outStatement.setString(7, DataWarehouse.hasher.encrypt(victimGuild.getNation().getObjectUUID()));
+ outStatement.setInt(8, this.victim.getLevel());
- return outStatement;
- }
+ outStatement.setString(9, DataWarehouse.hasher.encrypt(zone.getObjectUUID()));
+ outStatement.setString(10, zone.getName());
+ outStatement.setFloat(11, this.location.getX());
+ outStatement.setFloat(12, -this.location.getZ()); // flip sign on 'y' coordinate
+ outStatement.setBoolean(13, this.pvpExp);
+ outStatement.setTimestamp(14, Timestamp.valueOf(LocalDateTime.now()));
+ return outStatement;
+ }
- public void write() {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement statement = buildPvPInsertStatement(connection)) {
+ public void write() {
- statement.execute();
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement statement = buildPvPInsertStatement(connection)) {
- } catch (SQLException e) {
- Logger.error(e.toString());
- }
+ statement.execute();
- // Warehouse record for this pvp event written if code path reaches here.
- // Time to update the respective kill counters.
+ } catch (SQLException e) {
+ Logger.error(e.toString());
+ }
- CharacterRecord.advanceKillCounter(this.player);
- CharacterRecord.advanceDeathCounter(this.victim);
+ // Warehouse record for this pvp event written if code path reaches here.
+ // Time to update the respective kill counters.
- }
+ CharacterRecord.advanceKillCounter(this.player);
+ CharacterRecord.advanceDeathCounter(this.victim);
+
+ }
}
diff --git a/src/engine/db/archive/RealmRecord.java b/src/engine/db/archive/RealmRecord.java
index 957858e5..b93ed553 100644
--- a/src/engine/db/archive/RealmRecord.java
+++ b/src/engine/db/archive/RealmRecord.java
@@ -44,8 +44,7 @@ public class RealmRecord extends DataRecord {
if (realmRecord == null) {
realmRecord = new RealmRecord(realm);
realmRecord.eventType = eventType;
- }
- else {
+ } else {
realmRecord.recordType = Enum.DataRecordType.REALM;
realmRecord.eventType = eventType;
realmRecord.realm = realm;
@@ -57,7 +56,7 @@ public class RealmRecord extends DataRecord {
realmRecord.charterType = Enum.CharterType.getCharterTypeByID(realmRecord.realm.getCharterType()).name();
if (realmRecord.eventType.equals(Enum.RecordEventType.CAPTURE))
- realmRecord.eventDateTime = realm.ruledSince;
+ realmRecord.eventDateTime = realm.ruledSince;
else
realmRecord.eventDateTime = LocalDateTime.now();
@@ -122,7 +121,7 @@ public class RealmRecord extends DataRecord {
outStatement.setString(4, cityHash);
outStatement.setString(5, guildHash);
outStatement.setString(6, eventType.name());
- outStatement.setTimestamp(7, Timestamp.valueOf(this.eventDateTime));
+ outStatement.setTimestamp(7, Timestamp.valueOf(this.eventDateTime));
return outStatement;
}
diff --git a/src/engine/db/handlers/dbBoonHandler.java b/src/engine/db/handlers/dbBoonHandler.java
index 02951d4a..3c16ca82 100644
--- a/src/engine/db/handlers/dbBoonHandler.java
+++ b/src/engine/db/handlers/dbBoonHandler.java
@@ -21,31 +21,31 @@ import java.util.ArrayList;
public class dbBoonHandler extends dbHandlerBase {
- public dbBoonHandler() {
- }
+ public dbBoonHandler() {
+ }
- public ArrayList GET_BOON_AMOUNTS_FOR_ITEMBASE(int itemBaseUUID) {
+ public ArrayList GET_BOON_AMOUNTS_FOR_ITEMBASE(int itemBaseUUID) {
- ArrayList boons = new ArrayList<>();
- Boon thisBoon;
+ ArrayList boons = new ArrayList<>();
+ Boon thisBoon;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_boons` WHERE `itemBaseID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_boons` WHERE `itemBaseID` = ?")) {
- preparedStatement.setInt(1, itemBaseUUID);
+ preparedStatement.setInt(1, itemBaseUUID);
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
- thisBoon = new Boon(rs);
- boons.add(thisBoon);
- }
+ while (rs.next()) {
+ thisBoon = new Boon(rs);
+ boons.add(thisBoon);
+ }
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- return boons;
- }
+ return boons;
+ }
}
diff --git a/src/engine/db/handlers/dbCSSessionHandler.java b/src/engine/db/handlers/dbCSSessionHandler.java
index ae6cc04f..5516c733 100644
--- a/src/engine/db/handlers/dbCSSessionHandler.java
+++ b/src/engine/db/handlers/dbCSSessionHandler.java
@@ -24,91 +24,91 @@ import java.sql.SQLException;
public class dbCSSessionHandler extends dbHandlerBase {
- public dbCSSessionHandler() {
- this.localClass = CSSession.class;
- this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
- }
+ public dbCSSessionHandler() {
+ this.localClass = CSSession.class;
+ this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
+ }
- public boolean ADD_CSSESSION(String secKey, Account acc, InetAddress inet, String machineID) {
+ public boolean ADD_CSSESSION(String secKey, Account acc, InetAddress inet, String machineID) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_session` (`secretKey`, `accountID`, `discordAccount`, `sessionIP`, machineID) VALUES (?,?,?,INET_ATON(?),?)")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_session` (`secretKey`, `accountID`, `discordAccount`, `sessionIP`, machineID) VALUES (?,?,?,INET_ATON(?),?)")) {
- preparedStatement.setString(1, secKey);
- preparedStatement.setLong(2, acc.getObjectUUID());
- preparedStatement.setString(3, acc.discordAccount);
- preparedStatement.setString(4, StringUtils.InetAddressToClientString(inet));
- preparedStatement.setString(5, machineID);
+ preparedStatement.setString(1, secKey);
+ preparedStatement.setLong(2, acc.getObjectUUID());
+ preparedStatement.setString(3, acc.discordAccount);
+ preparedStatement.setString(4, StringUtils.InetAddressToClientString(inet));
+ preparedStatement.setString(5, machineID);
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean DELETE_UNUSED_CSSESSION(String secKey) {
+ public boolean DELETE_UNUSED_CSSESSION(String secKey) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_session` WHERE `secretKey`=? && `characterID` IS NULL")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_session` WHERE `secretKey`=? && `characterID` IS NULL")) {
- preparedStatement.setString(1, secKey);
- return (preparedStatement.executeUpdate() > 0);
+ preparedStatement.setString(1, secKey);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean DELETE_CSSESSION(String secKey) {
+ public boolean DELETE_CSSESSION(String secKey) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_session` WHERE `secretKey`=?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_session` WHERE `secretKey`=?")) {
- preparedStatement.setString(1, secKey);
- return (preparedStatement.executeUpdate() > 0);
+ preparedStatement.setString(1, secKey);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean UPDATE_CSSESSION(String secKey, int charID) {
+ public boolean UPDATE_CSSESSION(String secKey, int charID) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_session` SET `characterID`=? WHERE `secretKey`=?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_session` SET `characterID`=? WHERE `secretKey`=?")) {
- preparedStatement.setInt(1, charID);
- preparedStatement.setString(2, secKey);
+ preparedStatement.setInt(1, charID);
+ preparedStatement.setString(2, secKey);
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public CSSession GET_CSSESSION(String secKey) {
+ public CSSession GET_CSSESSION(String secKey) {
- CSSession css = null;
+ CSSession css = null;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT `accountID`, `characterID`, `machineID` FROM `dyn_session` WHERE `secretKey`=?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT `accountID`, `characterID`, `machineID` FROM `dyn_session` WHERE `secretKey`=?")) {
- preparedStatement.setString(1, secKey);
- ResultSet rs = preparedStatement.executeQuery();
+ preparedStatement.setString(1, secKey);
+ ResultSet rs = preparedStatement.executeQuery();
- if (rs.next())
- css = new CSSession(secKey, DbManager.AccountQueries.GET_ACCOUNT(rs.getInt("accountID")), PlayerCharacter.getPlayerCharacter(rs.getInt("characterID")), rs.getString("machineID"));
+ if (rs.next())
+ css = new CSSession(secKey, DbManager.AccountQueries.GET_ACCOUNT(rs.getInt("accountID")), PlayerCharacter.getPlayerCharacter(rs.getInt("characterID")), rs.getString("machineID"));
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- return css;
- }
+ return css;
+ }
}
diff --git a/src/engine/db/handlers/dbCharacterSkillHandler.java b/src/engine/db/handlers/dbCharacterSkillHandler.java
index beb9b5bf..49e88952 100644
--- a/src/engine/db/handlers/dbCharacterSkillHandler.java
+++ b/src/engine/db/handlers/dbCharacterSkillHandler.java
@@ -22,152 +22,152 @@ import java.util.concurrent.ConcurrentHashMap;
public class dbCharacterSkillHandler extends dbHandlerBase {
- public dbCharacterSkillHandler() {
- this.localClass = CharacterSkill.class;
- this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
- }
+ public dbCharacterSkillHandler() {
+ this.localClass = CharacterSkill.class;
+ this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
+ }
- public CharacterSkill ADD_SKILL(CharacterSkill toAdd) {
+ public CharacterSkill ADD_SKILL(CharacterSkill toAdd) {
- CharacterSkill characterSkill = null;
+ CharacterSkill characterSkill = null;
- if (CharacterSkill.GetOwner(toAdd) == null || toAdd.getSkillsBase() == null) {
- Logger.error("dbCharacterSkillHandler.ADD_SKILL", toAdd.getObjectUUID() + " missing owner or skillsBase");
- return null;
- }
+ if (CharacterSkill.GetOwner(toAdd) == null || toAdd.getSkillsBase() == null) {
+ Logger.error("dbCharacterSkillHandler.ADD_SKILL", toAdd.getObjectUUID() + " missing owner or skillsBase");
+ return null;
+ }
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_character_skill` (`CharacterID`, `skillsBaseID`, `trains`) VALUES (?, ?, ?);", Statement.RETURN_GENERATED_KEYS)) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_character_skill` (`CharacterID`, `skillsBaseID`, `trains`) VALUES (?, ?, ?);", Statement.RETURN_GENERATED_KEYS)) {
- preparedStatement.setLong(1, CharacterSkill.GetOwner(toAdd).getObjectUUID());
- preparedStatement.setInt(2, toAdd.getSkillsBase().getObjectUUID());
- preparedStatement.setInt(3, toAdd.getNumTrains());
+ preparedStatement.setLong(1, CharacterSkill.GetOwner(toAdd).getObjectUUID());
+ preparedStatement.setInt(2, toAdd.getSkillsBase().getObjectUUID());
+ preparedStatement.setInt(3, toAdd.getNumTrains());
- preparedStatement.executeUpdate();
- ResultSet rs = preparedStatement.getGeneratedKeys();
+ preparedStatement.executeUpdate();
+ ResultSet rs = preparedStatement.getGeneratedKeys();
- if (rs.next())
- characterSkill = GET_SKILL(rs.getInt(1));
+ if (rs.next())
+ characterSkill = GET_SKILL(rs.getInt(1));
- } catch (SQLException e) {
- Logger.error(e);
- }
- return characterSkill;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return characterSkill;
+ }
- public boolean DELETE_SKILL(final int objectUUID) {
+ public boolean DELETE_SKILL(final int objectUUID) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_character_skill` WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_character_skill` WHERE `UID` = ?")) {
- preparedStatement.setLong(1, objectUUID);
+ preparedStatement.setLong(1, objectUUID);
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public CharacterSkill GET_SKILL(final int objectUUID) {
+ public CharacterSkill GET_SKILL(final int objectUUID) {
- CharacterSkill characterSkill = (CharacterSkill) DbManager.getFromCache(Enum.GameObjectType.CharacterSkill, objectUUID);
+ CharacterSkill characterSkill = (CharacterSkill) DbManager.getFromCache(Enum.GameObjectType.CharacterSkill, objectUUID);
- if (characterSkill != null)
- return characterSkill;
+ if (characterSkill != null)
+ return characterSkill;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_character_skill` WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_character_skill` WHERE `UID` = ?")) {
- preparedStatement.setInt(1, objectUUID);
- ResultSet rs = preparedStatement.executeQuery();
+ preparedStatement.setInt(1, objectUUID);
+ ResultSet rs = preparedStatement.executeQuery();
- characterSkill = (CharacterSkill) getObjectFromRs(rs);
+ characterSkill = (CharacterSkill) getObjectFromRs(rs);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return characterSkill;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return characterSkill;
+ }
- public ConcurrentHashMap GET_SKILLS_FOR_CHARACTER(final AbstractCharacter ac) {
+ public ConcurrentHashMap GET_SKILLS_FOR_CHARACTER(final AbstractCharacter ac) {
- ConcurrentHashMap characterSkills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
+ ConcurrentHashMap characterSkills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
- if (ac == null || (!(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))))
- return characterSkills;
+ if (ac == null || (!(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))))
+ return characterSkills;
- PlayerCharacter playerCharacter = (PlayerCharacter) ac;
- int characterId = playerCharacter.getObjectUUID();
+ PlayerCharacter playerCharacter = (PlayerCharacter) ac;
+ int characterId = playerCharacter.getObjectUUID();
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_character_skill` WHERE `CharacterID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_character_skill` WHERE `CharacterID` = ?")) {
- preparedStatement.setInt(1, characterId);
+ preparedStatement.setInt(1, characterId);
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
- CharacterSkill cs = new CharacterSkill(rs, playerCharacter);
- if (cs.getSkillsBase() != null)
- characterSkills.put(cs.getSkillsBase().getName(), cs);
- }
+ while (rs.next()) {
+ CharacterSkill cs = new CharacterSkill(rs, playerCharacter);
+ if (cs.getSkillsBase() != null)
+ characterSkills.put(cs.getSkillsBase().getName(), cs);
+ }
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- return characterSkills;
- }
+ return characterSkills;
+ }
- public void UPDATE_TRAINS(final CharacterSkill characterSkill) {
+ public void UPDATE_TRAINS(final CharacterSkill characterSkill) {
- if (!characterSkill.isTrained())
- return;
+ if (!characterSkill.isTrained())
+ return;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_character_skill` SET `trains`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_character_skill` SET `trains`=? WHERE `UID` = ?")) {
- preparedStatement.setShort(1, (short) characterSkill.getNumTrains());
- preparedStatement.setLong(2, characterSkill.getObjectUUID());
+ preparedStatement.setShort(1, (short) characterSkill.getNumTrains());
+ preparedStatement.setLong(2, characterSkill.getObjectUUID());
- if (preparedStatement.executeUpdate() != 0)
- characterSkill.syncTrains();
+ if (preparedStatement.executeUpdate() != 0)
+ characterSkill.syncTrains();
- } catch (SQLException e) {
- Logger.error(e);
- }
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ }
- public void updateDatabase(final CharacterSkill characterSkill) {
+ public void updateDatabase(final CharacterSkill characterSkill) {
- if (characterSkill.getSkillsBase() == null) {
- Logger.error("Failed to find skillsBase for Skill " + characterSkill.getObjectUUID());
- return;
- }
+ if (characterSkill.getSkillsBase() == null) {
+ Logger.error("Failed to find skillsBase for Skill " + characterSkill.getObjectUUID());
+ return;
+ }
- if (CharacterSkill.GetOwner(characterSkill) == null) {
- Logger.error("Failed to find owner for Skill " + characterSkill.getObjectUUID());
- return;
- }
+ if (CharacterSkill.GetOwner(characterSkill) == null) {
+ Logger.error("Failed to find owner for Skill " + characterSkill.getObjectUUID());
+ return;
+ }
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_character_skill` SET `skillsBaseID`=?, `CharacterID`=?, `trains`=? WHERE `UID`=?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_character_skill` SET `skillsBaseID`=?, `CharacterID`=?, `trains`=? WHERE `UID`=?")) {
- preparedStatement.setInt(1, characterSkill.getSkillsBase().getObjectUUID());
- preparedStatement.setInt(2, CharacterSkill.GetOwner(characterSkill).getObjectUUID());
- preparedStatement.setShort(3, (short) characterSkill.getNumTrains());
- preparedStatement.setLong(4, characterSkill.getObjectUUID());
+ preparedStatement.setInt(1, characterSkill.getSkillsBase().getObjectUUID());
+ preparedStatement.setInt(2, CharacterSkill.GetOwner(characterSkill).getObjectUUID());
+ preparedStatement.setShort(3, (short) characterSkill.getNumTrains());
+ preparedStatement.setLong(4, characterSkill.getObjectUUID());
- if (preparedStatement.executeUpdate() != 0)
- characterSkill.syncTrains();
+ if (preparedStatement.executeUpdate() != 0)
+ characterSkill.syncTrains();
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- }
+ }
}
diff --git a/src/engine/db/handlers/dbContractHandler.java b/src/engine/db/handlers/dbContractHandler.java
index 7f543cd3..323b349d 100644
--- a/src/engine/db/handlers/dbContractHandler.java
+++ b/src/engine/db/handlers/dbContractHandler.java
@@ -23,146 +23,146 @@ import java.sql.SQLException;
public class dbContractHandler extends dbHandlerBase {
- public dbContractHandler() {
- this.localClass = Contract.class;
- this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
- }
+ public dbContractHandler() {
+ this.localClass = Contract.class;
+ this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
+ }
- public Contract GET_CONTRACT(final int objectUUID) {
+ public Contract GET_CONTRACT(final int objectUUID) {
- Contract contract = (Contract) DbManager.getFromCache(Enum.GameObjectType.Contract, objectUUID);
+ Contract contract = (Contract) DbManager.getFromCache(Enum.GameObjectType.Contract, objectUUID);
- if (contract != null)
- return contract;
+ if (contract != null)
+ return contract;
- if (objectUUID == 0)
- return null;
+ if (objectUUID == 0)
+ return null;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract` WHERE `ID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract` WHERE `ID` = ?")) {
- preparedStatement.setInt(1, objectUUID);
+ preparedStatement.setInt(1, objectUUID);
- ResultSet rs = preparedStatement.executeQuery();
- contract = (Contract) getObjectFromRs(rs);
+ ResultSet rs = preparedStatement.executeQuery();
+ contract = (Contract) getObjectFromRs(rs);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return contract;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return contract;
+ }
- public void LOAD_CONTRACT_INVENTORY(final Contract contract) {
+ public void LOAD_CONTRACT_INVENTORY(final Contract contract) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_inventoryset` WHERE `inventorySet` = ?;")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_inventoryset` WHERE `inventorySet` = ?;")) {
- preparedStatement.setInt(1, contract.inventorySet);
+ preparedStatement.setInt(1, contract.inventorySet);
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
+ while (rs.next()) {
- //handle item base
- int itemBaseID = rs.getInt("itembaseID");
+ //handle item base
+ int itemBaseID = rs.getInt("itembaseID");
- ItemBase ib = ItemBase.getItemBase(itemBaseID);
+ ItemBase ib = ItemBase.getItemBase(itemBaseID);
- if (ib != null) {
+ if (ib != null) {
- MobEquipment me = new MobEquipment(ib, 0, 0);
- contract.getSellInventory().add(me);
+ MobEquipment me = new MobEquipment(ib, 0, 0);
+ contract.getSellInventory().add(me);
- //handle magic effects
- String prefix = rs.getString("prefix");
- int pRank = rs.getInt("pRank");
- String suffix = rs.getString("suffix");
- int sRank = rs.getInt("sRank");
+ //handle magic effects
+ String prefix = rs.getString("prefix");
+ int pRank = rs.getInt("pRank");
+ String suffix = rs.getString("suffix");
+ int sRank = rs.getInt("sRank");
- if (prefix != null) {
- me.setPrefix(prefix, pRank);
- me.setIsID(true);
- }
+ if (prefix != null) {
+ me.setPrefix(prefix, pRank);
+ me.setIsID(true);
+ }
- if (suffix != null) {
- me.setSuffix(suffix, sRank);
- me.setIsID(true);
- }
+ if (suffix != null) {
+ me.setSuffix(suffix, sRank);
+ me.setIsID(true);
+ }
- }
- }
- } catch (SQLException e) {
- Logger.error(e);
- }
- }
+ }
+ }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ }
- public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
+ public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
- preparedStatement.setInt(1, contract.getObjectUUID());
+ preparedStatement.setInt(1, contract.getObjectUUID());
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
+ while (rs.next()) {
- int type = rs.getInt("type");
- int value = rs.getInt("value");
+ int type = rs.getInt("type");
+ int value = rs.getInt("value");
- switch (type) {
- case 1:
- contract.getBuyItemType().add(value);
- break;
- case 2:
- contract.getBuySkillToken().add(value);
- break;
- case 3:
- contract.getBuyUnknownToken().add(value);
- break;
- }
- }
- } catch (SQLException e) {
- Logger.error(e);
- }
- }
+ switch (type) {
+ case 1:
+ contract.getBuyItemType().add(value);
+ break;
+ case 2:
+ contract.getBuySkillToken().add(value);
+ break;
+ case 3:
+ contract.getBuyUnknownToken().add(value);
+ break;
+ }
+ }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ }
- public boolean updateAllowedBuildings(final Contract con, final long slotbitvalue) {
+ public boolean updateAllowedBuildings(final Contract con, final long slotbitvalue) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `allowedBuildingTypeID`=? WHERE `contractID`=?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `allowedBuildingTypeID`=? WHERE `contractID`=?")) {
- preparedStatement.setLong(1, slotbitvalue);
- preparedStatement.setInt(2, con.getContractID());
+ preparedStatement.setLong(1, slotbitvalue);
+ preparedStatement.setInt(2, con.getContractID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateDatabase(final Contract con) {
+ public boolean updateDatabase(final Contract con) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, "
- + "`mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, allowedBuildingTypeID=? WHERE `ID`=?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, "
+ + "`mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, allowedBuildingTypeID=? WHERE `ID`=?")) {
- preparedStatement.setInt(1, con.getContractID());
- preparedStatement.setString(2, con.getName());
- preparedStatement.setInt(3, con.getMobbaseID());
- preparedStatement.setInt(4, con.getClassID());
- preparedStatement.setInt(5, (con.getVendorDialog() != null) ? con.getVendorDialog().getObjectUUID() : 0);
- preparedStatement.setInt(6, con.getIconID());
- preparedStatement.setInt(8, con.getObjectUUID());
- preparedStatement.setLong(7, con.getAllowedBuildings().toLong());
+ preparedStatement.setInt(1, con.getContractID());
+ preparedStatement.setString(2, con.getName());
+ preparedStatement.setInt(3, con.getMobbaseID());
+ preparedStatement.setInt(4, con.getClassID());
+ preparedStatement.setInt(5, (con.getVendorDialog() != null) ? con.getVendorDialog().getObjectUUID() : 0);
+ preparedStatement.setInt(6, con.getIconID());
+ preparedStatement.setInt(8, con.getObjectUUID());
+ preparedStatement.setLong(7, con.getAllowedBuildings().toLong());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
}
diff --git a/src/engine/db/handlers/dbEffectsBaseHandler.java b/src/engine/db/handlers/dbEffectsBaseHandler.java
index de60587c..4836ec6e 100644
--- a/src/engine/db/handlers/dbEffectsBaseHandler.java
+++ b/src/engine/db/handlers/dbEffectsBaseHandler.java
@@ -27,277 +27,277 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
public dbEffectsBaseHandler() {
- }
+ }
- public static ArrayList getAllEffectsBase() {
+ public static ArrayList getAllEffectsBase() {
- ArrayList effectList = new ArrayList<>();
+ ArrayList effectList = new ArrayList<>();
- try (Connection connection = DbManager.getConnection();
- PreparedStatement prepareStatement = connection.prepareStatement("SELECT * FROM static_power_effectbase ORDER BY `IDString` DESC")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement prepareStatement = connection.prepareStatement("SELECT * FROM static_power_effectbase ORDER BY `IDString` DESC")) {
- ResultSet rs = prepareStatement.executeQuery();
+ ResultSet rs = prepareStatement.executeQuery();
- while (rs.next()) {
- EffectsBase effectBase = new EffectsBase(rs);
- effectList.add(effectBase);
- }
- } catch (SQLException e) {
- Logger.error(e.toString());
- }
+ while (rs.next()) {
+ EffectsBase effectBase = new EffectsBase(rs);
+ effectList.add(effectBase);
+ }
+ } catch (SQLException e) {
+ Logger.error(e.toString());
+ }
- return effectList;
- }
+ return effectList;
+ }
- public static void cacheAllEffectModifiers() {
+ public static void cacheAllEffectModifiers() {
- String IDString;
- AbstractEffectModifier abstractEffectModifier = null;
+ String IDString;
+ AbstractEffectModifier abstractEffectModifier = null;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement prepareStatement = connection.prepareStatement("SELECT * FROM static_power_effectmod")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement prepareStatement = connection.prepareStatement("SELECT * FROM static_power_effectmod")) {
- ResultSet rs = prepareStatement.executeQuery();
+ ResultSet rs = prepareStatement.executeQuery();
- while (rs.next()) {
+ while (rs.next()) {
- IDString = rs.getString("IDString");
- EffectsBase effectBase = PowersManager.getEffectByIDString(IDString);
- Enum.ModType modifier = Enum.ModType.GetModType(rs.getString("modType"));
+ IDString = rs.getString("IDString");
+ EffectsBase effectBase = PowersManager.getEffectByIDString(IDString);
+ Enum.ModType modifier = Enum.ModType.GetModType(rs.getString("modType"));
- //combine item prefix and suffix effect modifiers
+ //combine item prefix and suffix effect modifiers
- abstractEffectModifier = getCombinedModifiers(abstractEffectModifier, rs, effectBase, modifier);
+ abstractEffectModifier = getCombinedModifiers(abstractEffectModifier, rs, effectBase, modifier);
- if (abstractEffectModifier != null) {
+ if (abstractEffectModifier != null) {
- if (EffectsBase.modifiersMap.containsKey(effectBase.getIDString()) == false)
- EffectsBase.modifiersMap.put(effectBase.getIDString(), new HashSet<>());
+ if (EffectsBase.modifiersMap.containsKey(effectBase.getIDString()) == false)
+ EffectsBase.modifiersMap.put(effectBase.getIDString(), new HashSet<>());
- EffectsBase.modifiersMap.get(effectBase.getIDString()).add(abstractEffectModifier);
+ EffectsBase.modifiersMap.get(effectBase.getIDString()).add(abstractEffectModifier);
- }
+ }
- }
+ }
- } catch (Exception e) {
- Logger.error(e);
- }
+ } catch (Exception e) {
+ Logger.error(e);
+ }
- }
+ }
- private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, Enum.ModType modifier) throws SQLException {
- switch (modifier) {
- case AdjustAboveDmgCap:
- abstractEffectModifier = new AdjustAboveDmgCapEffectModifier(rs);
- break;
- case Ambidexterity:
- abstractEffectModifier = new AmbidexterityEffectModifier(rs);
- break;
- case AnimOverride:
- break;
- case ArmorPiercing:
- abstractEffectModifier = new ArmorPiercingEffectModifier(rs);
- break;
- case AttackDelay:
- abstractEffectModifier = new AttackDelayEffectModifier(rs);
- break;
- case Attr:
- abstractEffectModifier = new AttributeEffectModifier(rs);
- break;
- case BlackMantle:
- abstractEffectModifier = new BlackMantleEffectModifier(rs);
- break;
- case BladeTrails:
- abstractEffectModifier = new BladeTrailsEffectModifier(rs);
- break;
- case Block:
- abstractEffectModifier = new BlockEffectModifier(rs);
- break;
- case BlockedPowerType:
- abstractEffectModifier = new BlockedPowerTypeEffectModifier(rs);
- break;
- case CannotAttack:
- abstractEffectModifier = new CannotAttackEffectModifier(rs);
- break;
- case CannotCast:
- abstractEffectModifier = new CannotCastEffectModifier(rs);
- break;
- case CannotMove:
- abstractEffectModifier = new CannotMoveEffectModifier(rs);
- break;
- case CannotTrack:
- abstractEffectModifier = new CannotTrackEffectModifier(rs);
- break;
- case Charmed:
- abstractEffectModifier = new CharmedEffectModifier(rs);
- break;
- case ConstrainedAmbidexterity:
- abstractEffectModifier = new ConstrainedAmbidexterityEffectModifier(rs);
- break;
- case DamageCap:
- abstractEffectModifier = new DamageCapEffectModifier(rs);
- break;
- case DamageShield:
- abstractEffectModifier = new DamageShieldEffectModifier(rs);
- break;
- case DCV:
- abstractEffectModifier = new DCVEffectModifier(rs);
- break;
- case Dodge:
- abstractEffectModifier = new DodgeEffectModifier(rs);
- break;
- case DR:
- abstractEffectModifier = new DREffectModifier(rs);
- break;
- case Durability:
- abstractEffectModifier = new DurabilityEffectModifier(rs);
- break;
- case ExclusiveDamageCap:
- abstractEffectModifier = new ExclusiveDamageCapEffectModifier(rs);
- break;
- case Fade:
- abstractEffectModifier = new FadeEffectModifier(rs);
- break;
- case Fly:
- abstractEffectModifier = new FlyEffectModifier(rs);
- break;
- case Health:
- abstractEffectModifier = new HealthEffectModifier(rs);
- break;
- case HealthFull:
- abstractEffectModifier = new HealthFullEffectModifier(rs);
- break;
- case HealthRecoverRate:
- abstractEffectModifier = new HealthRecoverRateEffectModifier(rs);
- break;
- case IgnoreDamageCap:
- abstractEffectModifier = new IgnoreDamageCapEffectModifier(rs);
- break;
- case IgnorePassiveDefense:
- abstractEffectModifier = new IgnorePassiveDefenseEffectModifier(rs);
- break;
- case ImmuneTo:
- abstractEffectModifier = new ImmuneToEffectModifier(rs);
- break;
- case ImmuneToAttack:
- abstractEffectModifier = new ImmuneToAttackEffectModifier(rs);
- break;
- case ImmuneToPowers:
- abstractEffectModifier = new ImmuneToPowersEffectModifier(rs);
- break;
- case Invisible:
- abstractEffectModifier = new InvisibleEffectModifier(rs);
- break;
- case ItemName:
- abstractEffectModifier = new ItemNameEffectModifier(rs);
- if (((ItemNameEffectModifier) abstractEffectModifier).name.isEmpty())
- break;
- if (effectBase != null)
- effectBase.setName((((ItemNameEffectModifier) abstractEffectModifier).name));
- break;
- case Mana:
- abstractEffectModifier = new ManaEffectModifier(rs);
- break;
- case ManaFull:
- abstractEffectModifier = new ManaFullEffectModifier(rs);
- break;
- case ManaRecoverRate:
- abstractEffectModifier = new ManaRecoverRateEffectModifier(rs);
- break;
- case MaxDamage:
- abstractEffectModifier = new MaxDamageEffectModifier(rs);
- break;
- case MeleeDamageModifier:
- abstractEffectModifier = new MeleeDamageEffectModifier(rs);
- break;
- case MinDamage:
- abstractEffectModifier = new MinDamageEffectModifier(rs);
- break;
- case NoMod:
- abstractEffectModifier = new NoModEffectModifier(rs);
- break;
- case OCV:
- abstractEffectModifier = new OCVEffectModifier(rs);
- break;
- case Parry:
- abstractEffectModifier = new ParryEffectModifier(rs);
- break;
- case PassiveDefense:
- abstractEffectModifier = new PassiveDefenseEffectModifier(rs);
- break;
- case PowerCost:
- abstractEffectModifier = new PowerCostEffectModifier(rs);
- break;
- case PowerCostHealth:
- abstractEffectModifier = new PowerCostHealthEffectModifier(rs);
- break;
- case PowerDamageModifier:
- abstractEffectModifier = new PowerDamageEffectModifier(rs);
- break;
- case ProtectionFrom:
- abstractEffectModifier = new ProtectionFromEffectModifier(rs);
- break;
- case Resistance:
- abstractEffectModifier = new ResistanceEffectModifier(rs);
- break;
- case ScaleHeight:
- abstractEffectModifier = new ScaleHeightEffectModifier(rs);
- break;
- case ScaleWidth:
- abstractEffectModifier = new ScaleWidthEffectModifier(rs);
- break;
- case ScanRange:
- abstractEffectModifier = new ScanRangeEffectModifier(rs);
- break;
- case SeeInvisible:
- abstractEffectModifier = new SeeInvisibleEffectModifier(rs);
- break;
- case Silenced:
- abstractEffectModifier = new SilencedEffectModifier(rs);
- break;
- case Skill:
- abstractEffectModifier = new SkillEffectModifier(rs);
- break;
- case Slay:
- abstractEffectModifier = new SlayEffectModifier(rs);
- break;
- case Speed:
- abstractEffectModifier = new SpeedEffectModifier(rs);
- break;
- case SpireBlock:
- abstractEffectModifier = new SpireBlockEffectModifier(rs);
- break;
- case Stamina:
- abstractEffectModifier = new StaminaEffectModifier(rs);
- break;
- case StaminaFull:
- abstractEffectModifier = new StaminaFullEffectModifier(rs);
- break;
- case StaminaRecoverRate:
- abstractEffectModifier = new StaminaRecoverRateEffectModifier(rs);
- break;
- case Stunned:
- abstractEffectModifier = new StunnedEffectModifier(rs);
- break;
- case Value:
- abstractEffectModifier = new ValueEffectModifier(rs);
- if (effectBase != null) {
- ValueEffectModifier valueEffect = (ValueEffectModifier) abstractEffectModifier;
- effectBase.setValue(valueEffect.minMod);
- }
- break;
- case WeaponProc:
- abstractEffectModifier = new WeaponProcEffectModifier(rs);
- break;
- case WeaponRange:
- abstractEffectModifier = new WeaponRangeEffectModifier(rs);
- break;
- case WeaponSpeed:
- abstractEffectModifier = new WeaponSpeedEffectModifier(rs);
- break;
+ private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, Enum.ModType modifier) throws SQLException {
+ switch (modifier) {
+ case AdjustAboveDmgCap:
+ abstractEffectModifier = new AdjustAboveDmgCapEffectModifier(rs);
+ break;
+ case Ambidexterity:
+ abstractEffectModifier = new AmbidexterityEffectModifier(rs);
+ break;
+ case AnimOverride:
+ break;
+ case ArmorPiercing:
+ abstractEffectModifier = new ArmorPiercingEffectModifier(rs);
+ break;
+ case AttackDelay:
+ abstractEffectModifier = new AttackDelayEffectModifier(rs);
+ break;
+ case Attr:
+ abstractEffectModifier = new AttributeEffectModifier(rs);
+ break;
+ case BlackMantle:
+ abstractEffectModifier = new BlackMantleEffectModifier(rs);
+ break;
+ case BladeTrails:
+ abstractEffectModifier = new BladeTrailsEffectModifier(rs);
+ break;
+ case Block:
+ abstractEffectModifier = new BlockEffectModifier(rs);
+ break;
+ case BlockedPowerType:
+ abstractEffectModifier = new BlockedPowerTypeEffectModifier(rs);
+ break;
+ case CannotAttack:
+ abstractEffectModifier = new CannotAttackEffectModifier(rs);
+ break;
+ case CannotCast:
+ abstractEffectModifier = new CannotCastEffectModifier(rs);
+ break;
+ case CannotMove:
+ abstractEffectModifier = new CannotMoveEffectModifier(rs);
+ break;
+ case CannotTrack:
+ abstractEffectModifier = new CannotTrackEffectModifier(rs);
+ break;
+ case Charmed:
+ abstractEffectModifier = new CharmedEffectModifier(rs);
+ break;
+ case ConstrainedAmbidexterity:
+ abstractEffectModifier = new ConstrainedAmbidexterityEffectModifier(rs);
+ break;
+ case DamageCap:
+ abstractEffectModifier = new DamageCapEffectModifier(rs);
+ break;
+ case DamageShield:
+ abstractEffectModifier = new DamageShieldEffectModifier(rs);
+ break;
+ case DCV:
+ abstractEffectModifier = new DCVEffectModifier(rs);
+ break;
+ case Dodge:
+ abstractEffectModifier = new DodgeEffectModifier(rs);
+ break;
+ case DR:
+ abstractEffectModifier = new DREffectModifier(rs);
+ break;
+ case Durability:
+ abstractEffectModifier = new DurabilityEffectModifier(rs);
+ break;
+ case ExclusiveDamageCap:
+ abstractEffectModifier = new ExclusiveDamageCapEffectModifier(rs);
+ break;
+ case Fade:
+ abstractEffectModifier = new FadeEffectModifier(rs);
+ break;
+ case Fly:
+ abstractEffectModifier = new FlyEffectModifier(rs);
+ break;
+ case Health:
+ abstractEffectModifier = new HealthEffectModifier(rs);
+ break;
+ case HealthFull:
+ abstractEffectModifier = new HealthFullEffectModifier(rs);
+ break;
+ case HealthRecoverRate:
+ abstractEffectModifier = new HealthRecoverRateEffectModifier(rs);
+ break;
+ case IgnoreDamageCap:
+ abstractEffectModifier = new IgnoreDamageCapEffectModifier(rs);
+ break;
+ case IgnorePassiveDefense:
+ abstractEffectModifier = new IgnorePassiveDefenseEffectModifier(rs);
+ break;
+ case ImmuneTo:
+ abstractEffectModifier = new ImmuneToEffectModifier(rs);
+ break;
+ case ImmuneToAttack:
+ abstractEffectModifier = new ImmuneToAttackEffectModifier(rs);
+ break;
+ case ImmuneToPowers:
+ abstractEffectModifier = new ImmuneToPowersEffectModifier(rs);
+ break;
+ case Invisible:
+ abstractEffectModifier = new InvisibleEffectModifier(rs);
+ break;
+ case ItemName:
+ abstractEffectModifier = new ItemNameEffectModifier(rs);
+ if (((ItemNameEffectModifier) abstractEffectModifier).name.isEmpty())
+ break;
+ if (effectBase != null)
+ effectBase.setName((((ItemNameEffectModifier) abstractEffectModifier).name));
+ break;
+ case Mana:
+ abstractEffectModifier = new ManaEffectModifier(rs);
+ break;
+ case ManaFull:
+ abstractEffectModifier = new ManaFullEffectModifier(rs);
+ break;
+ case ManaRecoverRate:
+ abstractEffectModifier = new ManaRecoverRateEffectModifier(rs);
+ break;
+ case MaxDamage:
+ abstractEffectModifier = new MaxDamageEffectModifier(rs);
+ break;
+ case MeleeDamageModifier:
+ abstractEffectModifier = new MeleeDamageEffectModifier(rs);
+ break;
+ case MinDamage:
+ abstractEffectModifier = new MinDamageEffectModifier(rs);
+ break;
+ case NoMod:
+ abstractEffectModifier = new NoModEffectModifier(rs);
+ break;
+ case OCV:
+ abstractEffectModifier = new OCVEffectModifier(rs);
+ break;
+ case Parry:
+ abstractEffectModifier = new ParryEffectModifier(rs);
+ break;
+ case PassiveDefense:
+ abstractEffectModifier = new PassiveDefenseEffectModifier(rs);
+ break;
+ case PowerCost:
+ abstractEffectModifier = new PowerCostEffectModifier(rs);
+ break;
+ case PowerCostHealth:
+ abstractEffectModifier = new PowerCostHealthEffectModifier(rs);
+ break;
+ case PowerDamageModifier:
+ abstractEffectModifier = new PowerDamageEffectModifier(rs);
+ break;
+ case ProtectionFrom:
+ abstractEffectModifier = new ProtectionFromEffectModifier(rs);
+ break;
+ case Resistance:
+ abstractEffectModifier = new ResistanceEffectModifier(rs);
+ break;
+ case ScaleHeight:
+ abstractEffectModifier = new ScaleHeightEffectModifier(rs);
+ break;
+ case ScaleWidth:
+ abstractEffectModifier = new ScaleWidthEffectModifier(rs);
+ break;
+ case ScanRange:
+ abstractEffectModifier = new ScanRangeEffectModifier(rs);
+ break;
+ case SeeInvisible:
+ abstractEffectModifier = new SeeInvisibleEffectModifier(rs);
+ break;
+ case Silenced:
+ abstractEffectModifier = new SilencedEffectModifier(rs);
+ break;
+ case Skill:
+ abstractEffectModifier = new SkillEffectModifier(rs);
+ break;
+ case Slay:
+ abstractEffectModifier = new SlayEffectModifier(rs);
+ break;
+ case Speed:
+ abstractEffectModifier = new SpeedEffectModifier(rs);
+ break;
+ case SpireBlock:
+ abstractEffectModifier = new SpireBlockEffectModifier(rs);
+ break;
+ case Stamina:
+ abstractEffectModifier = new StaminaEffectModifier(rs);
+ break;
+ case StaminaFull:
+ abstractEffectModifier = new StaminaFullEffectModifier(rs);
+ break;
+ case StaminaRecoverRate:
+ abstractEffectModifier = new StaminaRecoverRateEffectModifier(rs);
+ break;
+ case Stunned:
+ abstractEffectModifier = new StunnedEffectModifier(rs);
+ break;
+ case Value:
+ abstractEffectModifier = new ValueEffectModifier(rs);
+ if (effectBase != null) {
+ ValueEffectModifier valueEffect = (ValueEffectModifier) abstractEffectModifier;
+ effectBase.setValue(valueEffect.minMod);
+ }
+ break;
+ case WeaponProc:
+ abstractEffectModifier = new WeaponProcEffectModifier(rs);
+ break;
+ case WeaponRange:
+ abstractEffectModifier = new WeaponRangeEffectModifier(rs);
+ break;
+ case WeaponSpeed:
+ abstractEffectModifier = new WeaponSpeedEffectModifier(rs);
+ break;
- }
- return abstractEffectModifier;
- }
+ }
+ return abstractEffectModifier;
+ }
}
diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java
index 61ebfdc5..62e249d8 100644
--- a/src/engine/db/handlers/dbItemBaseHandler.java
+++ b/src/engine/db/handlers/dbItemBaseHandler.java
@@ -25,152 +25,152 @@ public class dbItemBaseHandler extends dbHandlerBase {
public dbItemBaseHandler() {
- }
+ }
- public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
+ public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
- preparedStatement.setInt(1, itemBase.getUUID());
- ResultSet rs = preparedStatement.executeQuery();
+ preparedStatement.setInt(1, itemBase.getUUID());
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
- if (rs.getBoolean("fromUse"))
- itemBase.getUsedStats().put(rs.getInt("token"), rs.getInt("numTrains"));
- else
- itemBase.getBakedInStats().put(rs.getInt("token"), rs.getInt("numTrains"));
- }
- } catch (SQLException e) {
- Logger.error(e);
- }
- }
+ while (rs.next()) {
+ if (rs.getBoolean("fromUse"))
+ itemBase.getUsedStats().put(rs.getInt("token"), rs.getInt("numTrains"));
+ else
+ itemBase.getBakedInStats().put(rs.getInt("token"), rs.getInt("numTrains"));
+ }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ }
- public void LOAD_ANIMATIONS(ItemBase itemBase) {
+ public void LOAD_ANIMATIONS(ItemBase itemBase) {
- ArrayList tempList = new ArrayList<>();
- ArrayList tempListOff = new ArrayList<>();
+ ArrayList tempList = new ArrayList<>();
+ ArrayList tempListOff = new ArrayList<>();
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_itembase_animations` WHERE `itemBaseUUID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_itembase_animations` WHERE `itemBaseUUID` = ?")) {
- preparedStatement.setInt(1, itemBase.getUUID());
- ResultSet rs = preparedStatement.executeQuery();
+ preparedStatement.setInt(1, itemBase.getUUID());
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
- int animation = rs.getInt("animation");
- boolean rightHand = rs.getBoolean("rightHand");
+ while (rs.next()) {
+ int animation = rs.getInt("animation");
+ boolean rightHand = rs.getBoolean("rightHand");
- if (rightHand)
- tempList.add(animation);
- else
- tempListOff.add(animation);
- }
- } catch (SQLException e) {
- Logger.error(e);
- }
+ if (rightHand)
+ tempList.add(animation);
+ else
+ tempListOff.add(animation);
+ }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- itemBase.setAnimations(tempList);
- itemBase.setOffHandAnimations(tempListOff);
- }
+ itemBase.setAnimations(tempList);
+ itemBase.setOffHandAnimations(tempListOff);
+ }
- public void LOAD_ALL_ITEMBASES() {
+ public void LOAD_ALL_ITEMBASES() {
- ItemBase itemBase;
- int recordsRead = 0;
+ ItemBase itemBase;
+ int recordsRead = 0;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_itembase")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_itembase")) {
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
- recordsRead++;
- itemBase = new ItemBase(rs);
- ItemBase.addToCache(itemBase);
- }
+ while (rs.next()) {
+ recordsRead++;
+ itemBase = new ItemBase(rs);
+ ItemBase.addToCache(itemBase);
+ }
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
- }
+ Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
+ }
- public HashMap> LOAD_RUNES_FOR_NPC_AND_MOBS() {
+ public HashMap> LOAD_RUNES_FOR_NPC_AND_MOBS() {
- HashMap> runeSets = new HashMap<>();
- int runeSetID;
- int runeBaseID;
- int recordsRead = 0;
+ HashMap> runeSets = new HashMap<>();
+ int runeSetID;
+ int runeBaseID;
+ int recordsRead = 0;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) {
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
+ while (rs.next()) {
- recordsRead++;
+ recordsRead++;
- runeSetID = rs.getInt("runeSet");
- runeBaseID = rs.getInt("runeBase");
+ runeSetID = rs.getInt("runeSet");
+ runeBaseID = rs.getInt("runeBase");
- if (runeSets.get(runeSetID) == null) {
- ArrayList runeList = new ArrayList<>();
- runeList.add(runeBaseID);
- runeSets.put(runeSetID, runeList);
- } else {
- ArrayList runeList = runeSets.get(runeSetID);
- runeList.add(runeSetID);
- runeSets.put(runeSetID, runeList);
- }
- }
+ if (runeSets.get(runeSetID) == null) {
+ ArrayList runeList = new ArrayList<>();
+ runeList.add(runeBaseID);
+ runeSets.put(runeSetID, runeList);
+ } else {
+ ArrayList runeList = runeSets.get(runeSetID);
+ runeList.add(runeSetID);
+ runeSets.put(runeSetID, runeList);
+ }
+ }
- } catch (SQLException e) {
- Logger.error(e);
- return runeSets;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ return runeSets;
+ }
- Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
- return runeSets;
- }
-
- public HashMap> LOAD_BOOTY_FOR_MOBS() {
-
- HashMap> bootySets = new HashMap<>();
- BootySetEntry bootySetEntry;
- int bootySetID;
- int recordsRead = 0;
+ Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
+ return runeSets;
+ }
+
+ public HashMap> LOAD_BOOTY_FOR_MOBS() {
+
+ HashMap> bootySets = new HashMap<>();
+ BootySetEntry bootySetEntry;
+ int bootySetID;
+ int recordsRead = 0;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_bootySet")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_bootySet")) {
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
+ while (rs.next()) {
- recordsRead++;
+ recordsRead++;
- bootySetID = rs.getInt("bootySet");
- bootySetEntry = new BootySetEntry(rs);
+ bootySetID = rs.getInt("bootySet");
+ bootySetEntry = new BootySetEntry(rs);
- if (bootySets.get(bootySetID) == null) {
- ArrayList bootyList = new ArrayList<>();
- bootyList.add(bootySetEntry);
- bootySets.put(bootySetID, bootyList);
- } else {
- ArrayList bootyList = bootySets.get(bootySetID);
- bootyList.add(bootySetEntry);
- bootySets.put(bootySetID, bootyList);
- }
- }
- } catch (SQLException e) {
- Logger.error(e);
- return bootySets;
- }
+ if (bootySets.get(bootySetID) == null) {
+ ArrayList bootyList = new ArrayList<>();
+ bootyList.add(bootySetEntry);
+ bootySets.put(bootySetID, bootyList);
+ } else {
+ ArrayList bootyList = bootySets.get(bootySetID);
+ bootyList.add(bootySetEntry);
+ bootySets.put(bootySetID, bootyList);
+ }
+ }
+ } catch (SQLException e) {
+ Logger.error(e);
+ return bootySets;
+ }
- Logger.info("read: " + recordsRead + " cached: " + bootySets.size());
- return bootySets;
- }
+ Logger.info("read: " + recordsRead + " cached: " + bootySets.size());
+ return bootySets;
+ }
}
diff --git a/src/engine/db/handlers/dbWarehouseHandler.java b/src/engine/db/handlers/dbWarehouseHandler.java
index 216aea87..419268f6 100644
--- a/src/engine/db/handlers/dbWarehouseHandler.java
+++ b/src/engine/db/handlers/dbWarehouseHandler.java
@@ -28,529 +28,529 @@ import java.util.concurrent.ConcurrentHashMap;
public class dbWarehouseHandler extends dbHandlerBase {
- private static final ConcurrentHashMap columns = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
-
- public dbWarehouseHandler() {
- this.localClass = Warehouse.class;
- this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
-
- }
-
- public static void addObject(ArrayList list, ResultSet rs) throws SQLException {
- String type = rs.getString("type");
- switch (type) {
- case "building":
- Building building = new Building(rs);
- DbManager.addToCache(building);
- list.add(building);
- break;
- case "warehouse":
- Warehouse warehouse = new Warehouse(rs);
- DbManager.addToCache(warehouse);
- list.add(warehouse);
- break;
- }
- }
-
- public ArrayList CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
- Vector3fImmutable location, float meshScale, int currentHP,
- ProtectionState protectionState, int currentGold, int rank,
- DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
+ private static final ConcurrentHashMap columns = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
+
+ public dbWarehouseHandler() {
+ this.localClass = Warehouse.class;
+ this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
+
+ }
+
+ public static void addObject(ArrayList list, ResultSet rs) throws SQLException {
+ String type = rs.getString("type");
+ switch (type) {
+ case "building":
+ Building building = new Building(rs);
+ DbManager.addToCache(building);
+ list.add(building);
+ break;
+ case "warehouse":
+ Warehouse warehouse = new Warehouse(rs);
+ DbManager.addToCache(warehouse);
+ list.add(warehouse);
+ break;
+ }
+ }
+
+ public ArrayList CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
+ Vector3fImmutable location, float meshScale, int currentHP,
+ ProtectionState protectionState, int currentGold, int rank,
+ DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
- ArrayList warehouseList = new ArrayList<>();
+ ArrayList warehouseList = new ArrayList<>();
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("CALL `WAREHOUSE_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ,? ,?, ?);")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("CALL `WAREHOUSE_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ,? ,?, ?);")) {
- preparedStatement.setInt(1, parentZoneID);
- preparedStatement.setInt(2, OwnerUUID);
- preparedStatement.setString(3, name);
- preparedStatement.setInt(4, meshUUID);
- preparedStatement.setFloat(5, location.x);
- preparedStatement.setFloat(6, location.y);
- preparedStatement.setFloat(7, location.z);
- preparedStatement.setFloat(8, meshScale);
- preparedStatement.setInt(9, currentHP);
- preparedStatement.setString(10, protectionState.name());
- preparedStatement.setInt(11, currentGold);
- preparedStatement.setInt(12, rank);
+ preparedStatement.setInt(1, parentZoneID);
+ preparedStatement.setInt(2, OwnerUUID);
+ preparedStatement.setString(3, name);
+ preparedStatement.setInt(4, meshUUID);
+ preparedStatement.setFloat(5, location.x);
+ preparedStatement.setFloat(6, location.y);
+ preparedStatement.setFloat(7, location.z);
+ preparedStatement.setFloat(8, meshScale);
+ preparedStatement.setInt(9, currentHP);
+ preparedStatement.setString(10, protectionState.name());
+ preparedStatement.setInt(11, currentGold);
+ preparedStatement.setInt(12, rank);
- if (upgradeDate != null)
- preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
- else
- preparedStatement.setNull(13, java.sql.Types.DATE);
+ if (upgradeDate != null)
+ preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
+ else
+ preparedStatement.setNull(13, java.sql.Types.DATE);
- preparedStatement.setInt(14, blueprintUUID);
- preparedStatement.setFloat(15, w);
- preparedStatement.setFloat(16, rotY);
+ preparedStatement.setInt(14, blueprintUUID);
+ preparedStatement.setFloat(15, w);
+ preparedStatement.setFloat(16, rotY);
- preparedStatement.execute();
- ResultSet rs = preparedStatement.getResultSet();
+ preparedStatement.execute();
+ ResultSet rs = preparedStatement.getResultSet();
- while (rs.next())
- addObject(warehouseList, rs);
+ while (rs.next())
+ addObject(warehouseList, rs);
- while (preparedStatement.getMoreResults()) {
- rs = preparedStatement.getResultSet();
+ while (preparedStatement.getMoreResults()) {
+ rs = preparedStatement.getResultSet();
- while (rs.next())
- addObject(warehouseList, rs);
- }
- } catch (SQLException e) {
- Logger.error(e);
- }
+ while (rs.next())
+ addObject(warehouseList, rs);
+ }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- return warehouseList;
- }
+ return warehouseList;
+ }
- public boolean updateLocks(final Warehouse wh, long locks) {
+ public boolean updateLocks(final Warehouse wh, long locks) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
- preparedStatement.setLong(1, locks);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setLong(1, locks);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateGold(final Warehouse wh, int amount) {
+ public boolean updateGold(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateStone(final Warehouse wh, int amount) {
+ public boolean updateStone(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateTruesteel(final Warehouse wh, int amount) {
+ public boolean updateTruesteel(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateIron(final Warehouse wh, int amount) {
+ public boolean updateIron(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateAdamant(final Warehouse wh, int amount) {
+ public boolean updateAdamant(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateLumber(final Warehouse wh, int amount) {
+ public boolean updateLumber(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateOak(final Warehouse wh, int amount) {
+ public boolean updateOak(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateBronzewood(final Warehouse wh, int amount) {
+ public boolean updateBronzewood(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateMandrake(final Warehouse wh, int amount) {
+ public boolean updateMandrake(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateCoal(final Warehouse wh, int amount) {
+ public boolean updateCoal(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateAgate(final Warehouse wh, int amount) {
+ public boolean updateAgate(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateDiamond(final Warehouse wh, int amount) {
+ public boolean updateDiamond(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateOnyx(final Warehouse wh, int amount) {
+ public boolean updateOnyx(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateAzoth(final Warehouse wh, int amount) {
+ public boolean updateAzoth(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateOrichalk(final Warehouse wh, int amount) {
+ public boolean updateOrichalk(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateAntimony(final Warehouse wh, int amount) {
+ public boolean updateAntimony(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateSulfur(final Warehouse wh, int amount) {
+ public boolean updateSulfur(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateQuicksilver(final Warehouse wh, int amount) {
+ public boolean updateQuicksilver(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateGalvor(final Warehouse wh, int amount) {
+ public boolean updateGalvor(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateWormwood(final Warehouse wh, int amount) {
+ public boolean updateWormwood(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateObsidian(final Warehouse wh, int amount) {
+ public boolean updateObsidian(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateBloodstone(final Warehouse wh, int amount) {
+ public boolean updateBloodstone(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean updateMithril(final Warehouse wh, int amount) {
+ public boolean updateMithril(final Warehouse wh, int amount) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setInt(2, wh.getUID());
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setInt(2, wh.getUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, DateTime date) {
+ public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, DateTime date) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
- preparedStatement.setInt(1, amount);
- preparedStatement.setLong(1, warehouseBuildingID);
- preparedStatement.setString(2, targetType.name());
- preparedStatement.setLong(3, targetUUID);
- preparedStatement.setString(4, transactionType.name());
- preparedStatement.setString(5, resource.name());
- preparedStatement.setInt(6, amount);
- preparedStatement.setTimestamp(7, new java.sql.Timestamp(date.getMillis()));
+ preparedStatement.setInt(1, amount);
+ preparedStatement.setLong(1, warehouseBuildingID);
+ preparedStatement.setString(2, targetType.name());
+ preparedStatement.setLong(3, targetUUID);
+ preparedStatement.setString(4, transactionType.name());
+ preparedStatement.setString(5, resource.name());
+ preparedStatement.setInt(6, amount);
+ preparedStatement.setTimestamp(7, new java.sql.Timestamp(date.getMillis()));
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
- return false;
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ return false;
+ }
- public ArrayList GET_TRANSACTIONS_FOR_WAREHOUSE(final int warehouseUUID) {
+ public ArrayList GET_TRANSACTIONS_FOR_WAREHOUSE(final int warehouseUUID) {
- ArrayList transactionsList = new ArrayList<>();
+ ArrayList transactionsList = new ArrayList<>();
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM dyn_warehouse_transactions WHERE `warehouseUID` = ?;")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM dyn_warehouse_transactions WHERE `warehouseUID` = ?;")) {
- preparedStatement.setInt(1, warehouseUUID);
+ preparedStatement.setInt(1, warehouseUUID);
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
- Transaction transactions = new Transaction(rs);
- transactionsList.add(transactions);
- }
+ while (rs.next()) {
+ Transaction transactions = new Transaction(rs);
+ transactionsList.add(transactions);
+ }
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- return transactionsList;
- }
+ return transactionsList;
+ }
- public void LOAD_ALL_WAREHOUSES() {
+ public void LOAD_ALL_WAREHOUSES() {
- Warehouse warehouse;
+ Warehouse warehouse;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_warehouse`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_warehouse` ON `object`.`UID` = `obj_warehouse`.`UID` WHERE `object`.`type` = 'warehouse';")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_warehouse`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_warehouse` ON `object`.`UID` = `obj_warehouse`.`UID` WHERE `object`.`type` = 'warehouse';")) {
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
- warehouse = new Warehouse(rs);
- warehouse.runAfterLoad();
- warehouse.loadAllTransactions();
- }
+ while (rs.next()) {
+ warehouse = new Warehouse(rs);
+ warehouse.runAfterLoad();
+ warehouse.loadAllTransactions();
+ }
- } catch (SQLException e) {
- Logger.error(e);
- }
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ }
}
diff --git a/src/engine/db/handlers/dbZoneHandler.java b/src/engine/db/handlers/dbZoneHandler.java
index 8b6b603f..84abc1a7 100644
--- a/src/engine/db/handlers/dbZoneHandler.java
+++ b/src/engine/db/handlers/dbZoneHandler.java
@@ -24,107 +24,107 @@ import java.util.ArrayList;
public class dbZoneHandler extends dbHandlerBase {
- public dbZoneHandler() {
- this.localClass = Zone.class;
- this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
- }
+ public dbZoneHandler() {
+ this.localClass = Zone.class;
+ this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
+ }
- public ArrayList GET_ALL_NODES(Zone zone) {
- ArrayList wsmList = new ArrayList<>();
- wsmList.addAll(zone.getNodes());
- if (zone.absX == 0.0f) {
- zone.absX = zone.getXCoord();
- }
- if (zone.absY == 0.0f) {
- zone.absY = zone.getYCoord();
- }
- if (zone.absZ == 0.0f) {
- zone.absZ = zone.getZCoord();
- }
- for (Zone child : zone.getNodes()) {
- child.absX = child.getXCoord() + zone.absX;
- child.absY = child.getYCoord() + zone.absY;
- child.absZ = child.getZCoord() + zone.absZ;
- wsmList.addAll(this.GET_ALL_NODES(child));
- }
- return wsmList;
- }
+ public ArrayList GET_ALL_NODES(Zone zone) {
+ ArrayList wsmList = new ArrayList<>();
+ wsmList.addAll(zone.getNodes());
+ if (zone.absX == 0.0f) {
+ zone.absX = zone.getXCoord();
+ }
+ if (zone.absY == 0.0f) {
+ zone.absY = zone.getYCoord();
+ }
+ if (zone.absZ == 0.0f) {
+ zone.absZ = zone.getZCoord();
+ }
+ for (Zone child : zone.getNodes()) {
+ child.absX = child.getXCoord() + zone.absX;
+ child.absY = child.getYCoord() + zone.absY;
+ child.absZ = child.getZCoord() + zone.absZ;
+ wsmList.addAll(this.GET_ALL_NODES(child));
+ }
+ return wsmList;
+ }
- public Zone GET_BY_UID(long ID) {
+ public Zone GET_BY_UID(long ID) {
- Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, (int) ID);
+ Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, (int) ID);
- if (zone != null)
- return zone;
+ if (zone != null)
+ return zone;
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` WHERE `object`.`UID` = ?;")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` WHERE `object`.`UID` = ?;")) {
- preparedStatement.setLong(1, ID);
+ preparedStatement.setLong(1, ID);
- ResultSet rs = preparedStatement.executeQuery();
- zone = (Zone) getObjectFromRs(rs);
+ ResultSet rs = preparedStatement.executeQuery();
+ zone = (Zone) getObjectFromRs(rs);
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- return zone;
- }
+ return zone;
+ }
- public ArrayList GET_MAP_NODES(final int objectUUID) {
+ public ArrayList GET_MAP_NODES(final int objectUUID) {
- ArrayList zoneList = new ArrayList<>();
+ ArrayList zoneList = new ArrayList<>();
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_zone`.*, `object`.`parent` FROM `object` INNER JOIN `obj_zone` ON `obj_zone`.`UID` = `object`.`UID` WHERE `object`.`parent` = ?;")) {
- preparedStatement.setLong(1, objectUUID);
+ preparedStatement.setLong(1, objectUUID);
- ResultSet rs = preparedStatement.executeQuery();
- zoneList = getObjectsFromRs(rs, 2000);
+ ResultSet rs = preparedStatement.executeQuery();
+ zoneList = getObjectsFromRs(rs, 2000);
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- return zoneList;
- }
+ return zoneList;
+ }
- public void LOAD_ZONE_EXTENTS() {
+ public void LOAD_ZONE_EXTENTS() {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_zone_size`;")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_zone_size`;")) {
- ResultSet rs = preparedStatement.executeQuery();
+ ResultSet rs = preparedStatement.executeQuery();
- while (rs.next()) {
- Vector2f zoneSize = new Vector2f();
- int loadNum = rs.getInt("loadNum");
- zoneSize.x = rs.getFloat("xRadius");
- zoneSize.y = rs.getFloat("zRadius");
- ZoneManager._zone_size_data.put(loadNum, zoneSize);
- }
+ while (rs.next()) {
+ Vector2f zoneSize = new Vector2f();
+ int loadNum = rs.getInt("loadNum");
+ zoneSize.x = rs.getFloat("xRadius");
+ zoneSize.y = rs.getFloat("zRadius");
+ ZoneManager._zone_size_data.put(loadNum, zoneSize);
+ }
- } catch (SQLException e) {
- Logger.error(e);
- }
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
+ }
- public boolean DELETE_ZONE(final Zone zone) {
+ public boolean DELETE_ZONE(final Zone zone) {
- try (Connection connection = DbManager.getConnection();
- PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `object` WHERE `UID` = ? AND `type` = 'zone'")) {
+ try (Connection connection = DbManager.getConnection();
+ PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `object` WHERE `UID` = ? AND `type` = 'zone'")) {
- preparedStatement.setInt(1, zone.getObjectUUID());
+ preparedStatement.setInt(1, zone.getObjectUUID());
- return (preparedStatement.executeUpdate() > 0);
+ return (preparedStatement.executeUpdate() > 0);
- } catch (SQLException e) {
- Logger.error(e);
- }
+ } catch (SQLException e) {
+ Logger.error(e);
+ }
- return false;
- }
+ return false;
+ }
}
diff --git a/src/engine/devcmd/AbstractDevCmd.java b/src/engine/devcmd/AbstractDevCmd.java
index 75a54683..ae2364b6 100644
--- a/src/engine/devcmd/AbstractDevCmd.java
+++ b/src/engine/devcmd/AbstractDevCmd.java
@@ -29,13 +29,67 @@ public abstract class AbstractDevCmd {
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
* into a String array and then calls the subclass specific _doCmd method.
*/
public void doCmd(PlayerCharacter pcSender, String argString,
- AbstractGameObject target) {
+ AbstractGameObject target) {
String[] args = argString.split(" ");
if (pcSender == null) {
@@ -52,7 +106,7 @@ public abstract class AbstractDevCmd {
}
protected abstract void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target);
+ AbstractGameObject target);
/**
* Returns the string sent to the client that displays how to use this
@@ -89,22 +143,22 @@ public abstract class AbstractDevCmd {
this.cmdStrings.add(lowercase);
}
- public void setTarget(AbstractGameObject ago) {
- this.tr = ago;
- }
-
public AbstractGameObject getTarget() {
return this.tr;
}
- public void setResult(String result) {
- this.rsult = result;
+ public void setTarget(AbstractGameObject ago) {
+ this.tr = ago;
}
public String getResult() {
return this.rsult;
}
+ public void setResult(String result) {
+ this.rsult = result;
+ }
+
/*
* Helper functions
*/
@@ -124,58 +178,4 @@ public abstract class AbstractDevCmd {
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;
- }
- }
-
}
diff --git a/src/engine/devcmd/cmds/AddBuildingCmd.java b/src/engine/devcmd/cmds/AddBuildingCmd.java
index 50e371ff..537faab1 100644
--- a/src/engine/devcmd/cmds/AddBuildingCmd.java
+++ b/src/engine/devcmd/cmds/AddBuildingCmd.java
@@ -22,106 +22,106 @@ import engine.server.MBServerStatics;
public class AddBuildingCmd extends AbstractDevCmd {
- public AddBuildingCmd() {
+ public AddBuildingCmd() {
super("addbuilding");
// super("addbuilding", MBServerStatics.ACCESS_GROUP_DESIGNER_UP, 0, false, true);
this.addCmdString("building");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
- // Arg Count Check
- if (words.length != 2) {
- this.sendUsage(pc);
- return;
- }
-
- int ID;
- int rank;
- Blueprint blueprint;
-
- try {
- ID = Integer.parseInt(words[0]);
- rank = Integer.parseInt(words[1]);
- } catch (Exception e) {
- throwbackError(pc, "Invalid addBuilding Command. Need Building ID and rank.");
- return; // NaN
- }
- if (ID < 1) {
- throwbackError(pc,
- "Invalid addBuilding Command. Invalid Building ID.");
- return;
- }
- Vector3f rot = new Vector3f(0.0f, 0.0f, 0.0f);
- float w = 1f;
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
-
- if (zone == null) {
- throwbackError(pc, "Failed to find zone to place building in.");
- return;
- }
-
- blueprint = Blueprint.getBlueprint(ID);
-
- if ((blueprint != null) && (rank > blueprint.getMaxRank())) {
- throwbackError(pc, rank + " is not a valid rank for this building");
- return;
- }
-
- Building likeBuilding = DbManager.BuildingQueries.GET_BUILDING_BY_MESH(ID);
-
- if (likeBuilding != null) {
- rot = likeBuilding.getRot();
- w = likeBuilding.getw();
- }
-
- String buildingName = "";
- int blueprintUUID = 0;
-
- Vector3fImmutable localLoc = ZoneManager.worldToLocal(pc.getLoc(), zone);
-
- if (localLoc == null)
- return;
-
- if (blueprint != null) {
- buildingName = blueprint.getName();
- blueprintUUID = blueprint.getBlueprintUUID();
- }
-
- Building building = DbManager.BuildingQueries.
- CREATE_BUILDING(
- zone.getObjectUUID(), 0, buildingName, ID,
- localLoc, 1.0f, 0, ProtectionState.PROTECTED, 0, rank,
- null, blueprintUUID, w, rot.y);
-
-
- if (building == null) {
- throwbackError(pc, "Failed to add building.");
- return;
- }
-
- building.setRot(rot);
- building.setw(w);
-
- building.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
- WorldGrid.addObject(building, pc);
- ChatManager.chatSayInfo(pc,
- "Building with ID " + building.getObjectUUID() + " added");
-
- this.setResult(String.valueOf(building.getObjectUUID()));
-
- }
-
- @Override
- protected String _getHelpString() {
- return "Creates a building of type 'buildingID' at the location your character is standing.";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /addbuilding buildingID rank' || ' /building buildingID rank'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+
+ // Arg Count Check
+ if (words.length != 2) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ int ID;
+ int rank;
+ Blueprint blueprint;
+
+ try {
+ ID = Integer.parseInt(words[0]);
+ rank = Integer.parseInt(words[1]);
+ } catch (Exception e) {
+ throwbackError(pc, "Invalid addBuilding Command. Need Building ID and rank.");
+ return; // NaN
+ }
+ if (ID < 1) {
+ throwbackError(pc,
+ "Invalid addBuilding Command. Invalid Building ID.");
+ return;
+ }
+ Vector3f rot = new Vector3f(0.0f, 0.0f, 0.0f);
+ float w = 1f;
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+
+ if (zone == null) {
+ throwbackError(pc, "Failed to find zone to place building in.");
+ return;
+ }
+
+ blueprint = Blueprint.getBlueprint(ID);
+
+ if ((blueprint != null) && (rank > blueprint.getMaxRank())) {
+ throwbackError(pc, rank + " is not a valid rank for this building");
+ return;
+ }
+
+ Building likeBuilding = DbManager.BuildingQueries.GET_BUILDING_BY_MESH(ID);
+
+ if (likeBuilding != null) {
+ rot = likeBuilding.getRot();
+ w = likeBuilding.getw();
+ }
+
+ String buildingName = "";
+ int blueprintUUID = 0;
+
+ Vector3fImmutable localLoc = ZoneManager.worldToLocal(pc.getLoc(), zone);
+
+ if (localLoc == null)
+ return;
+
+ if (blueprint != null) {
+ buildingName = blueprint.getName();
+ blueprintUUID = blueprint.getBlueprintUUID();
+ }
+
+ Building building = DbManager.BuildingQueries.
+ CREATE_BUILDING(
+ zone.getObjectUUID(), 0, buildingName, ID,
+ localLoc, 1.0f, 0, ProtectionState.PROTECTED, 0, rank,
+ null, blueprintUUID, w, rot.y);
+
+
+ if (building == null) {
+ throwbackError(pc, "Failed to add building.");
+ return;
+ }
+
+ building.setRot(rot);
+ building.setw(w);
+
+ building.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
+ WorldGrid.addObject(building, pc);
+ ChatManager.chatSayInfo(pc,
+ "Building with ID " + building.getObjectUUID() + " added");
+
+ this.setResult(String.valueOf(building.getObjectUUID()));
+
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Creates a building of type 'buildingID' at the location your character is standing.";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /addbuilding buildingID rank' || ' /building buildingID rank'";
+ }
}
diff --git a/src/engine/devcmd/cmds/AddGoldCmd.java b/src/engine/devcmd/cmds/AddGoldCmd.java
index 2d339821..e998fc5b 100644
--- a/src/engine/devcmd/cmds/AddGoldCmd.java
+++ b/src/engine/devcmd/cmds/AddGoldCmd.java
@@ -17,61 +17,60 @@ import engine.objects.PlayerCharacter;
/**
* @author Eighty
- *
*/
public class AddGoldCmd extends AbstractDevCmd {
- public AddGoldCmd() {
+ public AddGoldCmd() {
super("addgold");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
- Item gold = pc.getCharItemManager().getGoldInventory();
- int curAmt;
- if (gold == null)
- curAmt = 0;
- else
- curAmt = gold.getNumOfItems();
+ Item gold = pc.getCharItemManager().getGoldInventory();
+ int curAmt;
+ if (gold == null)
+ curAmt = 0;
+ else
+ curAmt = gold.getNumOfItems();
- int amt;
- try {
- amt = Integer.parseInt(words[0]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
- return;
- }
- if (amt < 1 || amt > 10000000) {
- throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
- return;
- } else if ((curAmt + amt) > 10000000) {
- throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
- return;
- }
+ int amt;
+ try {
+ amt = Integer.parseInt(words[0]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
+ return;
+ }
+ if (amt < 1 || amt > 10000000) {
+ throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
+ return;
+ } else if ((curAmt + amt) > 10000000) {
+ throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
+ return;
+ }
- if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
- throwbackError(pc, "Failed to add gold to inventory");
- return;
- }
+ if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
+ throwbackError(pc, "Failed to add gold to inventory");
+ return;
+ }
- ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
- pc.getCharItemManager().updateInventory();
- }
+ ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
+ pc.getCharItemManager().updateInventory();
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "adds gold to inventory";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /addGold quantity'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/AddMobCmd.java b/src/engine/devcmd/cmds/AddMobCmd.java
index 89f7d6fa..ac2fbfa8 100644
--- a/src/engine/devcmd/cmds/AddMobCmd.java
+++ b/src/engine/devcmd/cmds/AddMobCmd.java
@@ -20,92 +20,91 @@ import org.pmw.tinylog.Logger;
/**
* @author Eighty
- *
*/
public class AddMobCmd extends AbstractDevCmd {
- public AddMobCmd() {
+ public AddMobCmd() {
super("mob");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
-
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
-
- if (words[0].equals("all")){
-
- for (AbstractGameObject mobbaseAGO: DbManager.getList(GameObjectType.MobBase)){
- MobBase mb = (MobBase)mobbaseAGO;
- int loadID = mb.getObjectUUID();
- Mob mob = Mob.createMob( loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
- null, true, zone, null,0, "", 1);
- if (mob != null) {
- mob.updateDatabase();
- this.setResult(String.valueOf(mob.getDBID()));
- } else {
- throwbackError(pc, "Failed to create mob of type " + loadID);
- Logger.error( "Failed to create mob of type "
- + loadID);
- }
- }
- return;
- }
-
-
- int loadID;
- try {
- loadID = Integer.parseInt(words[0]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "Supplied type " + words[0]
- + " failed to parse to an Integer");
- return;
- } catch (Exception e) {
- throwbackError(pc,
- "An unknown exception occurred when trying to use mob command for type "
- + words[0]);
- return; // NaN
- }
-
-
- if (zone == null) {
- throwbackError(pc, "Failed to find zone to place mob in.");
- return;
- }
-
- if (zone.isPlayerCity()) {
- throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
- return;
- }
-
-
- Mob mob = Mob.createMob( loadID, pc.getLoc(),
- null, true, zone, null,0, "", 1);
- if (mob != null) {
- mob.updateDatabase();
- ChatManager.chatSayInfo(pc,
- "Mob with ID " + mob.getDBID() + " added");
- this.setResult(String.valueOf(mob.getDBID()));
- } else {
- throwbackError(pc, "Failed to create mob of type " + loadID);
- Logger.error("Failed to create mob of type "
- + loadID);
- }
- }
-
- @Override
- protected String _getHelpString() {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+
+ if (words[0].equals("all")) {
+
+ for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
+ MobBase mb = (MobBase) mobbaseAGO;
+ int loadID = mb.getObjectUUID();
+ Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
+ null, true, zone, null, 0, "", 1);
+ if (mob != null) {
+ mob.updateDatabase();
+ this.setResult(String.valueOf(mob.getDBID()));
+ } else {
+ throwbackError(pc, "Failed to create mob of type " + loadID);
+ Logger.error("Failed to create mob of type "
+ + loadID);
+ }
+ }
+ return;
+ }
+
+
+ int loadID;
+ try {
+ loadID = Integer.parseInt(words[0]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "Supplied type " + words[0]
+ + " failed to parse to an Integer");
+ return;
+ } catch (Exception e) {
+ throwbackError(pc,
+ "An unknown exception occurred when trying to use mob command for type "
+ + words[0]);
+ return; // NaN
+ }
+
+
+ if (zone == null) {
+ throwbackError(pc, "Failed to find zone to place mob in.");
+ return;
+ }
+
+ if (zone.isPlayerCity()) {
+ throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
+ return;
+ }
+
+
+ Mob mob = Mob.createMob(loadID, pc.getLoc(),
+ null, true, zone, null, 0, "", 1);
+ if (mob != null) {
+ mob.updateDatabase();
+ ChatManager.chatSayInfo(pc,
+ "Mob with ID " + mob.getDBID() + " added");
+ this.setResult(String.valueOf(mob.getDBID()));
+ } else {
+ throwbackError(pc, "Failed to create mob of type " + loadID);
+ Logger.error("Failed to create mob of type "
+ + loadID);
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
return "Creates a Mob of type 'mobID' at the location your character is standing";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /mob mobID'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/AddNPCCmd.java b/src/engine/devcmd/cmds/AddNPCCmd.java
index a5bd5c87..e01ef111 100644
--- a/src/engine/devcmd/cmds/AddNPCCmd.java
+++ b/src/engine/devcmd/cmds/AddNPCCmd.java
@@ -18,91 +18,90 @@ import org.pmw.tinylog.Logger;
/**
* @author Eighty
- *
*/
public class AddNPCCmd extends AbstractDevCmd {
- public AddNPCCmd() {
+ public AddNPCCmd() {
super("npc");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- int contractID;
- String name = "";
- int level = 0;
-
- if (words.length < 2) {
- this.sendUsage(pc);
- return;
- }
- try {
- contractID = Integer.parseInt(words[0]);
- level = Integer.parseInt(words[1]);
-
- for (int i = 2; i < words.length; i++) {
- name += words[i];
- if (i + 1 < words.length)
- name += "";
- }
-
- } catch (NumberFormatException e) {
- throwbackError(pc,
- "Failed to parse supplied contractID or level to an Integer.");
- return; // NaN
- }
-
- Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
-
- if (contract == null || level < 1 || level > 75) {
- throwbackError(pc,
- "Invalid addNPC Command. Need contract ID, and level");
- return; // NaN
- }
-
- // Pick a random name
- if (name.isEmpty())
- name = NPCManager.getPirateName(contract.getMobbaseID());
-
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
-
- if (zone == null) {
- throwbackError(pc, "Failed to find zone to place npc in.");
- return;
- }
-
- if (target != null)
- if (target.getObjectType() == GameObjectType.Building){
- Building parentBuilding = (Building)target;
- BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
- return;
- }
-
- NPC npc = NPC.createNPC(name, contractID,
- pc.getLoc(), null, true, zone, (short) level, null);
-
- if (npc != null) {
- WorldGrid.addObject(npc, pc);
- ChatManager.chatSayInfo(pc,
- "NPC with ID " + npc.getDBID() + " added");
- this.setResult(String.valueOf(npc.getDBID()));
- } else {
- throwbackError(pc, "Failed to create npc of contract type "
- + contractID);
- Logger.error(
- "Failed to create npc of contract type " + contractID);
- }
- }
-
- @Override
- protected String _getHelpString() {
- return "Creates an NPC of type 'npcID' at the location your character is standing";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /npc npcID level name'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ int contractID;
+ String name = "";
+ int level = 0;
+
+ if (words.length < 2) {
+ this.sendUsage(pc);
+ return;
+ }
+ try {
+ contractID = Integer.parseInt(words[0]);
+ level = Integer.parseInt(words[1]);
+
+ for (int i = 2; i < words.length; i++) {
+ name += words[i];
+ if (i + 1 < words.length)
+ name += "";
+ }
+
+ } catch (NumberFormatException e) {
+ throwbackError(pc,
+ "Failed to parse supplied contractID or level to an Integer.");
+ return; // NaN
+ }
+
+ Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
+
+ if (contract == null || level < 1 || level > 75) {
+ throwbackError(pc,
+ "Invalid addNPC Command. Need contract ID, and level");
+ return; // NaN
+ }
+
+ // Pick a random name
+ if (name.isEmpty())
+ name = NPCManager.getPirateName(contract.getMobbaseID());
+
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+
+ if (zone == null) {
+ throwbackError(pc, "Failed to find zone to place npc in.");
+ return;
+ }
+
+ if (target != null)
+ if (target.getObjectType() == GameObjectType.Building) {
+ Building parentBuilding = (Building) target;
+ BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
+ return;
+ }
+
+ NPC npc = NPC.createNPC(name, contractID,
+ pc.getLoc(), null, true, zone, (short) level, null);
+
+ if (npc != null) {
+ WorldGrid.addObject(npc, pc);
+ ChatManager.chatSayInfo(pc,
+ "NPC with ID " + npc.getDBID() + " added");
+ this.setResult(String.valueOf(npc.getDBID()));
+ } else {
+ throwbackError(pc, "Failed to create npc of contract type "
+ + contractID);
+ Logger.error(
+ "Failed to create npc of contract type " + contractID);
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Creates an NPC of type 'npcID' at the location your character is standing";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /npc npcID level name'";
+ }
}
diff --git a/src/engine/devcmd/cmds/ApplyBonusCmd.java b/src/engine/devcmd/cmds/ApplyBonusCmd.java
index 76234e1c..898332fc 100644
--- a/src/engine/devcmd/cmds/ApplyBonusCmd.java
+++ b/src/engine/devcmd/cmds/ApplyBonusCmd.java
@@ -26,133 +26,131 @@ import java.util.HashSet;
public class ApplyBonusCmd extends AbstractDevCmd {
- public ApplyBonusCmd() {
- super("applybonus");
- }
-
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
-
- String action = words[0];
-
- PowerActionType actionType = null;
-
- HashMap> appliedMods = new HashMap<>();
-
- try{
-
- if (action.equals("all") == false)
- for (PowerActionType powerActionType : PowerActionType.values()){
- if (powerActionType.name().equalsIgnoreCase(action) == false)
- continue;
- actionType = powerActionType;
- break;
- }
-
- }catch(Exception e){
- this.throwbackError(pcSender, "Invalid power Action type for " + action);
- this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
- return;
- }
- if (action.equals("all") == false)
- if (actionType == null){
- this.throwbackError(pcSender, "Invalid power Action type for " + action);
- this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
- return;
- }
-
-
- for (PowersBase pb : PowersManager.powersBaseByIDString.values()){
- if (pb.getActions() == null || pb.getActions().isEmpty())
- continue;
-
- for (ActionsBase ab: pb.getActions()){
- if (ab.getPowerAction() == null)
- continue;
- if (action.equals("all") == false)
- if (ab.getPowerAction().getType().equalsIgnoreCase(action) == false)
- continue;
- String effect1 = "";
- String effect2 = "";
- ChatManager.chatSystemInfo(pcSender,"Applying Power " + pb.getName() + " : " +pb.getDescription());
- if (ab.getPowerAction().getEffectsBase() == null){
-
- try {
- PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- ThreadUtils.sleep(500);
- continue;
- }
-
-
- if (ab.getPowerAction().getEffectsBase().getModifiers() == null || ab.getPowerAction().getEffectsBase().getModifiers().isEmpty()){
- try {
- PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- continue;
- }
-
- boolean run = true;
- for (AbstractEffectModifier mod : ab.getPowerAction().getEffectsBase().getModifiers()){
- if (appliedMods.containsKey(mod.modType.name()) == false){
- appliedMods.put(mod.modType.name(), new HashSet<>());
- }
-
+ public ApplyBonusCmd() {
+ super("applybonus");
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
+
+ String action = words[0];
+
+ PowerActionType actionType = null;
+
+ HashMap> appliedMods = new HashMap<>();
+
+ try {
+
+ if (action.equals("all") == false)
+ for (PowerActionType powerActionType : PowerActionType.values()) {
+ if (powerActionType.name().equalsIgnoreCase(action) == false)
+ continue;
+ actionType = powerActionType;
+ break;
+ }
+
+ } catch (Exception e) {
+ this.throwbackError(pcSender, "Invalid power Action type for " + action);
+ this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
+ return;
+ }
+ if (action.equals("all") == false)
+ if (actionType == null) {
+ this.throwbackError(pcSender, "Invalid power Action type for " + action);
+ this.throwbackInfo(pcSender, "Valid Types : " + this.getActionTypes());
+ return;
+ }
+
+
+ for (PowersBase pb : PowersManager.powersBaseByIDString.values()) {
+ if (pb.getActions() == null || pb.getActions().isEmpty())
+ continue;
+
+ for (ActionsBase ab : pb.getActions()) {
+ if (ab.getPowerAction() == null)
+ continue;
+ if (action.equals("all") == false)
+ if (ab.getPowerAction().getType().equalsIgnoreCase(action) == false)
+ continue;
+ String effect1 = "";
+ String effect2 = "";
+ ChatManager.chatSystemInfo(pcSender, "Applying Power " + pb.getName() + " : " + pb.getDescription());
+ if (ab.getPowerAction().getEffectsBase() == null) {
+
+ try {
+ PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ ThreadUtils.sleep(500);
+ continue;
+ }
+
+
+ if (ab.getPowerAction().getEffectsBase().getModifiers() == null || ab.getPowerAction().getEffectsBase().getModifiers().isEmpty()) {
+ try {
+ PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ continue;
+ }
+
+ boolean run = true;
+ for (AbstractEffectModifier mod : ab.getPowerAction().getEffectsBase().getModifiers()) {
+ if (appliedMods.containsKey(mod.modType.name()) == false) {
+ appliedMods.put(mod.modType.name(), new HashSet<>());
+ }
+
// if (appliedMods.get(mod.modType.name()).contains(mod.sourceType.name())){
// continue;
// }
-
- appliedMods.get(mod.modType.name()).add(mod.sourceType.name());
- try{
- try {
- PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }catch(Exception e){
- Logger.error(e);
- }
- break;
-
-
-
-
- }
-
- }
- }
- }
-
-
- @Override
- protected String _getUsageString() {
- return "' /bounds'";
- }
-
- @Override
- protected String _getHelpString() {
- return "Audits all the mobs in a zone.";
-
- }
-
- private String getActionTypes(){
- String output = "";
-
- for (PowerActionType actionType : PowerActionType.values()){
- output += actionType.name() + " | ";
-
- }
-
- return output.substring(0, output.length() -3);
- }
+
+ appliedMods.get(mod.modType.name()).add(mod.sourceType.name());
+ try {
+ try {
+ PowersManager.runPowerAction(pcSender, pcSender, pcSender.getLoc(), ab, 1, pb);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ } catch (Exception e) {
+ Logger.error(e);
+ }
+ break;
+
+
+ }
+
+ }
+ }
+ }
+
+
+ @Override
+ protected String _getUsageString() {
+ return "' /bounds'";
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Audits all the mobs in a zone.";
+
+ }
+
+ private String getActionTypes() {
+ String output = "";
+
+ for (PowerActionType actionType : PowerActionType.values()) {
+ output += actionType.name() + " | ";
+
+ }
+
+ return output.substring(0, output.length() - 3);
+ }
}
diff --git a/src/engine/devcmd/cmds/ApplyStatModCmd.java b/src/engine/devcmd/cmds/ApplyStatModCmd.java
index 21bf52ab..c2797ce6 100644
--- a/src/engine/devcmd/cmds/ApplyStatModCmd.java
+++ b/src/engine/devcmd/cmds/ApplyStatModCmd.java
@@ -21,129 +21,124 @@ import engine.powers.PowersBase;
import java.util.ArrayList;
/**
- *
* @author Eighty
- *
*/
public class ApplyStatModCmd extends AbstractDevCmd {
- public ApplyStatModCmd() {
+ private static int cnt = 0;
+
+ public ApplyStatModCmd() {
super("applystatmod");
}
- private static int cnt = 0;
-
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- if(args.length < 1) {
- // if(args.length < 2) {
- this.sendUsage(pcSender);
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ if (args.length < 1) {
+ // if(args.length < 2) {
+ this.sendUsage(pcSender);
+ return;
+ }
- if(!(target instanceof AbstractCharacter)) {
- this.sendHelp(pcSender);
- return;
- }
+ if (!(target instanceof AbstractCharacter)) {
+ this.sendHelp(pcSender);
+ return;
+ }
this.setTarget(pcSender); //for logging
- int spellID;
- int powerAction = 0;
- if (args[0].toLowerCase().contains("all")){
-
- int amount = 0;
- if (args.length == 1) {
- amount = ApplyStatModCmd.cnt;
- ApplyStatModCmd.cnt++;
- } else {
- amount = Integer.valueOf(args[1]);
- ApplyStatModCmd.cnt = amount+1;
- }
-
-
- ArrayList pbList = new ArrayList<>();
- pbList.add(PowersManager.getPowerByToken(429047968));
- pbList.add(PowersManager.getPowerByToken(429768864));
- pbList.add(PowersManager.getPowerByToken(428458144));
- pbList.add(PowersManager.getPowerByToken(428677994));
- pbList.add(PowersManager.getPowerByToken(431874079));
- pbList.add(PowersManager.getPowerByToken(431081336));
-
-
-
-
-
- for (PowersBase pb:pbList){
- if(amount <= 0) {
- if (pb.getToken() ==428677994)
- powerAction = 1;
- PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
- continue;
- } else if(amount > 9999 || amount < 21) {
- ChatManager.chatSystemInfo(pcSender, "Amount must be between 21 and 9999 inclusive.");
- return;
- }
-
- if (pb.getToken() ==428677994){
- PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
- PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
- }
- if (pb.getToken() ==428677994)
- powerAction = 1;
- PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
- PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
- }
- return;
- }
- if(args[0].toLowerCase().contains("con")) {
- spellID = 429047968; //Blessing of Health
- } else if(args[0].toLowerCase().contains("str")) {
- spellID = 429768864; //Blessing of Might
- } else if(args[0].toLowerCase().contains("dex")) {
- spellID = 428458144; //Blessing of Dexterity
- } else if(args[0].toLowerCase().contains("int")) {
- spellID = 428677994; //Bard Spi - TODO
- powerAction = 1;
- } else if(args[0].toLowerCase().contains("spi")) {
- spellID = 428677994; //Bard Spi
- } else{
- ChatManager.chatSystemInfo(pcSender, "No valid stat found.");
- return;
- }
-
- PowersBase pb = PowersManager.getPowerByToken(spellID);
-
- int amount = 0;
- if (args.length == 1) {
- amount = ApplyStatModCmd.cnt;
- ApplyStatModCmd.cnt++;
- } else {
- amount = Integer.valueOf(args[1]);
- ApplyStatModCmd.cnt = amount+1;
- }
- // int amount = Integer.valueOf(args[1]);
- if(amount <= 0) {
- PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
- return;
- } else if(amount > 9999 || amount < 21) {
- ChatManager.chatSystemInfo(pcSender, "Amount must be between 21 and 9999 inclusive.");
- return;
- }
-
- PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
- PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
- }
-
- @Override
- protected String _getUsageString() {
+ int spellID;
+ int powerAction = 0;
+ if (args[0].toLowerCase().contains("all")) {
+
+ int amount = 0;
+ if (args.length == 1) {
+ amount = ApplyStatModCmd.cnt;
+ ApplyStatModCmd.cnt++;
+ } else {
+ amount = Integer.valueOf(args[1]);
+ ApplyStatModCmd.cnt = amount + 1;
+ }
+
+
+ ArrayList pbList = new ArrayList<>();
+ pbList.add(PowersManager.getPowerByToken(429047968));
+ pbList.add(PowersManager.getPowerByToken(429768864));
+ pbList.add(PowersManager.getPowerByToken(428458144));
+ pbList.add(PowersManager.getPowerByToken(428677994));
+ pbList.add(PowersManager.getPowerByToken(431874079));
+ pbList.add(PowersManager.getPowerByToken(431081336));
+
+
+ for (PowersBase pb : pbList) {
+ if (amount <= 0) {
+ if (pb.getToken() == 428677994)
+ powerAction = 1;
+ PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
+ continue;
+ } else if (amount > 9999 || amount < 21) {
+ ChatManager.chatSystemInfo(pcSender, "Amount must be between 21 and 9999 inclusive.");
+ return;
+ }
+
+ if (pb.getToken() == 428677994) {
+ PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
+ PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
+ }
+ if (pb.getToken() == 428677994)
+ powerAction = 1;
+ PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
+ PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
+ }
+ return;
+ }
+ if (args[0].toLowerCase().contains("con")) {
+ spellID = 429047968; //Blessing of Health
+ } else if (args[0].toLowerCase().contains("str")) {
+ spellID = 429768864; //Blessing of Might
+ } else if (args[0].toLowerCase().contains("dex")) {
+ spellID = 428458144; //Blessing of Dexterity
+ } else if (args[0].toLowerCase().contains("int")) {
+ spellID = 428677994; //Bard Spi - TODO
+ powerAction = 1;
+ } else if (args[0].toLowerCase().contains("spi")) {
+ spellID = 428677994; //Bard Spi
+ } else {
+ ChatManager.chatSystemInfo(pcSender, "No valid stat found.");
+ return;
+ }
+
+ PowersBase pb = PowersManager.getPowerByToken(spellID);
+
+ int amount = 0;
+ if (args.length == 1) {
+ amount = ApplyStatModCmd.cnt;
+ ApplyStatModCmd.cnt++;
+ } else {
+ amount = Integer.valueOf(args[1]);
+ ApplyStatModCmd.cnt = amount + 1;
+ }
+ // int amount = Integer.valueOf(args[1]);
+ if (amount <= 0) {
+ PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
+ return;
+ } else if (amount > 9999 || amount < 21) {
+ ChatManager.chatSystemInfo(pcSender, "Amount must be between 21 and 9999 inclusive.");
+ return;
+ }
+
+ PowersManager.removeEffect(pcSender, pb.getActions().get(powerAction), false, false);
+ PowersManager.runPowerAction(pcSender, pcSender, Vector3fImmutable.ZERO, pb.getActions().get(powerAction), amount - 20, pb);
+ }
+
+ @Override
+ protected String _getUsageString() {
return "' /applystatmod [trains]'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "You must be targeting a player!";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/AuditFailedItemsCmd.java b/src/engine/devcmd/cmds/AuditFailedItemsCmd.java
index 216e05fb..e92e0b87 100644
--- a/src/engine/devcmd/cmds/AuditFailedItemsCmd.java
+++ b/src/engine/devcmd/cmds/AuditFailedItemsCmd.java
@@ -20,111 +20,108 @@ import org.pmw.tinylog.Logger;
public class AuditFailedItemsCmd extends AbstractDevCmd {
- public AuditFailedItemsCmd() {
- super("faileditems");
- }
-
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
-
-
-
- if (ItemProductionManager.FailedItems.isEmpty())
- return;
-
- Logger.info("Auditing Item production Failed Items");
-
- String newLine = "\r\n";
- String auditFailedItem = "Failed Item Name | Prefix | Suffix | NPC | Contract | Player | ";
-
- for (ProducedItem failedItem: ItemProductionManager.FailedItems){
-
- String npcName = "";
- String playerName ="";
- String contractName = "";
-
- String prefix = "";
- String suffix = "";
- String itemName = "";
- NPC npc = NPC.getFromCache(failedItem.getNpcUID());
-
- if (npc == null){
- npcName = "null";
- contractName = "null";
- }else{
- npcName = npc.getName();
- if (npc.getContract() != null)
- contractName = npc.getContract().getName();
- }
-
- PlayerCharacter roller = PlayerCharacter.getFromCache(failedItem.getPlayerID());
-
- if (roller == null)
- playerName = "null";
- else
- playerName = roller.getName();
-
- ItemBase ib = ItemBase.getItemBase(failedItem.getItemBaseID());
-
- if (ib != null){
- itemName = ib.getName();
- }
-
- if (failedItem.isRandom() == false){
- if (failedItem.getPrefix().isEmpty() == false){
- AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getPrefix());
- if (pa != null){
- for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()){
- if (aem.modType.equals(ModType.ItemName)){
- prefix = aem.getString1();
- break;
- }
- }
- }
-
- }
-
- if (failedItem.getSuffix().isEmpty() == false){
- AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getSuffix());
- if (pa != null){
- for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()){
- if (aem.modType.equals(ModType.ItemName)){
- suffix = aem.getString1();
- break;
- }
- }
- }
-
- }
-
- }else{
- prefix = "random";
- }
-
-
-
-
- auditFailedItem += newLine;
- auditFailedItem += itemName + " | "+prefix + " | "+suffix + " | "+ failedItem.getNpcUID() + ":" +npcName + " | "+contractName + " | "+failedItem.getPlayerID() + ":" +playerName;
-
- }
- Logger.info(auditFailedItem);
- ItemProductionManager.FailedItems.clear();
-
-
- }
-
-
- @Override
- protected String _getUsageString() {
- return "' /bounds'";
- }
-
- @Override
- protected String _getHelpString() {
- return "Audits all the mobs in a zone.";
-
- }
+ public AuditFailedItemsCmd() {
+ super("faileditems");
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
+
+
+ if (ItemProductionManager.FailedItems.isEmpty())
+ return;
+
+ Logger.info("Auditing Item production Failed Items");
+
+ String newLine = "\r\n";
+ String auditFailedItem = "Failed Item Name | Prefix | Suffix | NPC | Contract | Player | ";
+
+ for (ProducedItem failedItem : ItemProductionManager.FailedItems) {
+
+ String npcName = "";
+ String playerName = "";
+ String contractName = "";
+
+ String prefix = "";
+ String suffix = "";
+ String itemName = "";
+ NPC npc = NPC.getFromCache(failedItem.getNpcUID());
+
+ if (npc == null) {
+ npcName = "null";
+ contractName = "null";
+ } else {
+ npcName = npc.getName();
+ if (npc.getContract() != null)
+ contractName = npc.getContract().getName();
+ }
+
+ PlayerCharacter roller = PlayerCharacter.getFromCache(failedItem.getPlayerID());
+
+ if (roller == null)
+ playerName = "null";
+ else
+ playerName = roller.getName();
+
+ ItemBase ib = ItemBase.getItemBase(failedItem.getItemBaseID());
+
+ if (ib != null) {
+ itemName = ib.getName();
+ }
+
+ if (failedItem.isRandom() == false) {
+ if (failedItem.getPrefix().isEmpty() == false) {
+ AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getPrefix());
+ if (pa != null) {
+ for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
+ if (aem.modType.equals(ModType.ItemName)) {
+ prefix = aem.getString1();
+ break;
+ }
+ }
+ }
+
+ }
+
+ if (failedItem.getSuffix().isEmpty() == false) {
+ AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getSuffix());
+ if (pa != null) {
+ for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
+ if (aem.modType.equals(ModType.ItemName)) {
+ suffix = aem.getString1();
+ break;
+ }
+ }
+ }
+
+ }
+
+ } else {
+ prefix = "random";
+ }
+
+
+ auditFailedItem += newLine;
+ auditFailedItem += itemName + " | " + prefix + " | " + suffix + " | " + failedItem.getNpcUID() + ":" + npcName + " | " + contractName + " | " + failedItem.getPlayerID() + ":" + playerName;
+
+ }
+ Logger.info(auditFailedItem);
+ ItemProductionManager.FailedItems.clear();
+
+
+ }
+
+
+ @Override
+ protected String _getUsageString() {
+ return "' /bounds'";
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Audits all the mobs in a zone.";
+
+ }
}
diff --git a/src/engine/devcmd/cmds/AuditHeightMapCmd.java b/src/engine/devcmd/cmds/AuditHeightMapCmd.java
index 74e9005a..66e6d1ed 100644
--- a/src/engine/devcmd/cmds/AuditHeightMapCmd.java
+++ b/src/engine/devcmd/cmds/AuditHeightMapCmd.java
@@ -20,52 +20,51 @@ import engine.objects.Zone;
public class AuditHeightMapCmd extends AbstractDevCmd {
- public AuditHeightMapCmd() {
+ public AuditHeightMapCmd() {
super("auditheightmap");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
- int count = Integer.parseInt(words[0]);
- long start = System.currentTimeMillis();
- for (int i = 0; i= count) {
+ plusplus++;
+ throwbackInfo(pcSender, zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
+ System.out.println(zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
+ }
+
+
+ }
+ throwbackInfo(pcSender, " there are " + plusplus + " zones with at least " + count + " mobs in each.");
+ }
+ return;
+ }
+ if (words.length > 1) {
+ this.sendUsage(pcSender);
+ return;
+ } else if (words.length == 1) {
+ int uuid;
+ try {
+ uuid = Integer.parseInt(words[0]);
+ zone = ZoneManager.getZoneByUUID(uuid);
+ } catch (NumberFormatException e) {
+ zone = ZoneManager.findSmallestZone(pcSender.getLoc());
+ }
+ } else
+ zone = ZoneManager.findSmallestZone(pcSender.getLoc());
+
+ if (zone == null) {
+ throwbackError(pcSender, "Unable to find the zone");
+ return;
+ }
+
+ //get list of mobs for zone
+
+ if (zone.zoneMobSet.isEmpty()) {
+ throwbackError(pcSender, "No mobs found for this zone.");
+ return;
+ }
+
+ // ConcurrentHashMap spawnMap = Mob.getSpawnMap();
+ //ConcurrentHashMap respawnMap = Mob.getRespawnMap();
+ // ConcurrentHashMap despawnMap = Mob.getDespawnMap();
+
+ throwbackInfo(pcSender, zone.getName() + ", numMobs: " + zone.zoneMobSet.size());
+ throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
+
+
+ //mob not found in spawn map, check respawn
+ boolean inRespawn = false;
- //get Zone to check mobs against
- Zone zone;
-
- if (words.length == 2){
- if (words[0].equals("all")){
- int plusplus = 0;
- int count = Integer.parseInt(words[1]);
- for (Zone zoneMicro: ZoneManager.getAllZones()){
- int size = zoneMicro.zoneMobSet.size();
-
- if (size >= count){
- plusplus++;
- throwbackInfo(pcSender, zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
- System.out.println(zoneMicro.getName() + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
- }
-
-
- }
- throwbackInfo(pcSender," there are " +plusplus + " zones with at least " + count + " mobs in each.");
- }
- return;
- }
- if (words.length > 1) {
- this.sendUsage(pcSender);
- return;
- } else if (words.length == 1) {
- int uuid;
- try {
- uuid = Integer.parseInt(words[0]);
- zone = ZoneManager.getZoneByUUID(uuid);
- } catch (NumberFormatException e) {
- zone = ZoneManager.findSmallestZone(pcSender.getLoc());
- }
- } else
- zone = ZoneManager.findSmallestZone(pcSender.getLoc());
-
- if (zone == null) {
- throwbackError(pcSender, "Unable to find the zone");
- return;
- }
-
- //get list of mobs for zone
-
- if (zone.zoneMobSet.isEmpty()) {
- throwbackError(pcSender, "No mobs found for this zone.");
- return;
- }
-
- // ConcurrentHashMap spawnMap = Mob.getSpawnMap();
- //ConcurrentHashMap respawnMap = Mob.getRespawnMap();
- // ConcurrentHashMap despawnMap = Mob.getDespawnMap();
-
- throwbackInfo(pcSender, zone.getName() + ", numMobs: " + zone.zoneMobSet.size());
- throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
-
-
-
- //mob not found in spawn map, check respawn
- boolean inRespawn = false;
-
-
-
- }
+ }
- @Override
- protected String _getUsageString() {
- return "' /auditmobs [zone.UUID]'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /auditmobs [zone.UUID]'";
+ }
- @Override
- protected String _getHelpString() {
- return "Audits all the mobs in a zone.";
+ @Override
+ protected String _getHelpString() {
+ return "Audits all the mobs in a zone.";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/BoundsCmd.java b/src/engine/devcmd/cmds/BoundsCmd.java
index dc5e6835..e6a1a7aa 100644
--- a/src/engine/devcmd/cmds/BoundsCmd.java
+++ b/src/engine/devcmd/cmds/BoundsCmd.java
@@ -17,61 +17,61 @@ import engine.objects.PlayerCharacter;
public class BoundsCmd extends AbstractDevCmd {
- public BoundsCmd() {
+ public BoundsCmd() {
super("bounds");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
- if (target == null || !target.getObjectType().equals(GameObjectType.Building)){
- this.throwbackError(pcSender, "No Building Selected");
- return;
- }
-
- Building building = (Building)target;
-
- if (building.getBounds() == null){
- this.throwbackInfo(pcSender, "No valid Bounds for building UUID " + building.getObjectUUID());
- return;
- }
- float topLeftX = building.getLoc().x - building.getBounds().getHalfExtents().x;
- float topLeftY = building.getLoc().z - building.getBounds().getHalfExtents().y;
-
- float topRightX = building.getLoc().x + building.getBounds().getHalfExtents().x;
- float topRightY = building.getLoc().z - building.getBounds().getHalfExtents().y;
-
- float bottomLeftX = building.getLoc().x - building.getBounds().getHalfExtents().x;
- float bottomLeftY = building.getLoc().z + building.getBounds().getHalfExtents().y;
-
- float bottomRightX = building.getLoc().x + building.getBounds().getHalfExtents().x;
- float bottomRightY = building.getLoc().z + building.getBounds().getHalfExtents().y;
-
- String newLine = "\r\n ";
-
- String output = "Bounds Information for Building UUID " + building.getObjectUUID();
- output += newLine;
-
- output+= "Top Left : " + topLeftX + " , " + topLeftY + newLine;
- output+= "Top Right : " + topRightX + " , " + topRightY + newLine;
- output+= "Bottom Left : " + bottomLeftX + " , " + bottomLeftY + newLine;
- output+= "Bottom Right : " + bottomRightX + " , " + bottomRightY + newLine;
-
- this.throwbackInfo(pcSender, output);
-
-
- }
-
-
- @Override
- protected String _getUsageString() {
- return "' /bounds'";
- }
-
- @Override
- protected String _getHelpString() {
- return "Audits all the mobs in a zone.";
-
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
+ if (target == null || !target.getObjectType().equals(GameObjectType.Building)) {
+ this.throwbackError(pcSender, "No Building Selected");
+ return;
+ }
+
+ Building building = (Building) target;
+
+ if (building.getBounds() == null) {
+ this.throwbackInfo(pcSender, "No valid Bounds for building UUID " + building.getObjectUUID());
+ return;
+ }
+ float topLeftX = building.getLoc().x - building.getBounds().getHalfExtents().x;
+ float topLeftY = building.getLoc().z - building.getBounds().getHalfExtents().y;
+
+ float topRightX = building.getLoc().x + building.getBounds().getHalfExtents().x;
+ float topRightY = building.getLoc().z - building.getBounds().getHalfExtents().y;
+
+ float bottomLeftX = building.getLoc().x - building.getBounds().getHalfExtents().x;
+ float bottomLeftY = building.getLoc().z + building.getBounds().getHalfExtents().y;
+
+ float bottomRightX = building.getLoc().x + building.getBounds().getHalfExtents().x;
+ float bottomRightY = building.getLoc().z + building.getBounds().getHalfExtents().y;
+
+ String newLine = "\r\n ";
+
+ String output = "Bounds Information for Building UUID " + building.getObjectUUID();
+ output += newLine;
+
+ output += "Top Left : " + topLeftX + " , " + topLeftY + newLine;
+ output += "Top Right : " + topRightX + " , " + topRightY + newLine;
+ output += "Bottom Left : " + bottomLeftX + " , " + bottomLeftY + newLine;
+ output += "Bottom Right : " + bottomRightX + " , " + bottomRightY + newLine;
+
+ this.throwbackInfo(pcSender, output);
+
+
+ }
+
+
+ @Override
+ protected String _getUsageString() {
+ return "' /bounds'";
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Audits all the mobs in a zone.";
+
+ }
}
diff --git a/src/engine/devcmd/cmds/ChangeNameCmd.java b/src/engine/devcmd/cmds/ChangeNameCmd.java
index 3ef3e095..e8676bdd 100644
--- a/src/engine/devcmd/cmds/ChangeNameCmd.java
+++ b/src/engine/devcmd/cmds/ChangeNameCmd.java
@@ -19,96 +19,96 @@ import engine.util.MiscUtils;
public class ChangeNameCmd extends AbstractDevCmd {
- public ChangeNameCmd() {
- super("changename");
- }
-
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- Vector3fImmutable loc = null;
-
- // Arg Count Check
- if (words.length < 2) {
- this.sendUsage(pc);
- return;
- }
-
- String oldFirst = words[0];
- String newFirst = words[1];
- String newLast = "";
- if (words.length > 2) {
- newLast = words[2];
- for (int i=3; i 50) {
- this.throwbackError(pc, "Error: Last name is incorrect length. Must be no more than 50 characters");
- return;
- }
-
- // Check if firstname is valid
- if (MiscUtils.checkIfFirstNameInvalid(newFirst)) {
- this.throwbackError(pc, "Error: First name is not allowed");
- return;
- }
-
-
- //get the world ID we're modifying for
-
- //test if first name is unique, unless new and old first name are equal.
- if (!(oldFirst.equals(newFirst))) {
- if (!DbManager.PlayerCharacterQueries.IS_CHARACTER_NAME_UNIQUE(newFirst)) {
- this.throwbackError(pc, "Error: First name is not unique.");
- return;
- }
- }
-
- //tests passed, update name in database
- if (!DbManager.PlayerCharacterQueries.UPDATE_NAME(oldFirst, newFirst, newLast)) {
- this.throwbackError(pc, "Error: Database failed to update the name.");
- return;
- }
-
- //Finally update player ingame
- PlayerCharacter pcTar = null;
- try {
- pcTar = SessionManager
- .getPlayerCharacterByLowerCaseName(words[0]);
- pcTar.setFirstName(newFirst);
- pcTar.setLastName(newLast);
- this.setTarget(pcTar); //for logging
-
- //specify if last name is ascii characters only
- String lastAscii = newLast.replaceAll("[^\\p{ASCII}]", "");
- pcTar.setAsciiLastName(lastAscii.equals(newLast));
- } catch (Exception e) {
- this.throwbackError(pc, "Database was updated but ingame character failed to update.");
- return;
- }
-
- String out = oldFirst + " was changed to " + newFirst + (newLast.isEmpty() ? "." : (' ' + newLast + '.'));
- this.throwbackInfo(pc, out);
-
-
- }
-
- @Override
- protected String _getHelpString() {
- return "Changes the name of a player";
- }
-
- @Override
- protected String _getUsageString() {
- return "'./changename oldFirstName newFirstName newLastName'";
- }
+ public ChangeNameCmd() {
+ super("changename");
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ Vector3fImmutable loc = null;
+
+ // Arg Count Check
+ if (words.length < 2) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ String oldFirst = words[0];
+ String newFirst = words[1];
+ String newLast = "";
+ if (words.length > 2) {
+ newLast = words[2];
+ for (int i = 3; i < words.length; i++)
+ newLast += ' ' + words[i];
+ }
+
+ //verify new name length
+ if (newFirst.length() < 3) {
+ this.throwbackError(pc, "Error: First name is incorrect length. Must be between 3 and 15 characters");
+ return;
+ }
+
+ //verify old name length
+ if (newLast.length() > 50) {
+ this.throwbackError(pc, "Error: Last name is incorrect length. Must be no more than 50 characters");
+ return;
+ }
+
+ // Check if firstname is valid
+ if (MiscUtils.checkIfFirstNameInvalid(newFirst)) {
+ this.throwbackError(pc, "Error: First name is not allowed");
+ return;
+ }
+
+
+ //get the world ID we're modifying for
+
+ //test if first name is unique, unless new and old first name are equal.
+ if (!(oldFirst.equals(newFirst))) {
+ if (!DbManager.PlayerCharacterQueries.IS_CHARACTER_NAME_UNIQUE(newFirst)) {
+ this.throwbackError(pc, "Error: First name is not unique.");
+ return;
+ }
+ }
+
+ //tests passed, update name in database
+ if (!DbManager.PlayerCharacterQueries.UPDATE_NAME(oldFirst, newFirst, newLast)) {
+ this.throwbackError(pc, "Error: Database failed to update the name.");
+ return;
+ }
+
+ //Finally update player ingame
+ PlayerCharacter pcTar = null;
+ try {
+ pcTar = SessionManager
+ .getPlayerCharacterByLowerCaseName(words[0]);
+ pcTar.setFirstName(newFirst);
+ pcTar.setLastName(newLast);
+ this.setTarget(pcTar); //for logging
+
+ //specify if last name is ascii characters only
+ String lastAscii = newLast.replaceAll("[^\\p{ASCII}]", "");
+ pcTar.setAsciiLastName(lastAscii.equals(newLast));
+ } catch (Exception e) {
+ this.throwbackError(pc, "Database was updated but ingame character failed to update.");
+ return;
+ }
+
+ String out = oldFirst + " was changed to " + newFirst + (newLast.isEmpty() ? "." : (' ' + newLast + '.'));
+ this.throwbackInfo(pc, out);
+
+
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Changes the name of a player";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "'./changename oldFirstName newFirstName newLastName'";
+ }
}
diff --git a/src/engine/devcmd/cmds/CombatMessageCmd.java b/src/engine/devcmd/cmds/CombatMessageCmd.java
index f1847562..a3615e89 100644
--- a/src/engine/devcmd/cmds/CombatMessageCmd.java
+++ b/src/engine/devcmd/cmds/CombatMessageCmd.java
@@ -7,9 +7,6 @@
// www.magicbane.com
-
-
-
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
@@ -27,44 +24,42 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
- *
* @author Eighty
- *
*/
public class CombatMessageCmd extends AbstractDevCmd {
- public CombatMessageCmd() {
+ public CombatMessageCmd() {
super("cm");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- if (pcSender == null)
- return;
- if (args.length != 1) {
- this.sendUsage(pcSender);
- return;
- }
- int num = 0;
- try {
- num = Integer.parseInt(args[0]);
- } catch (NumberFormatException e) {
- throwbackError(pcSender, "Supplied message number " + args[0] + " failed to parse to an Integer");
- return;
- }
- TargetedActionMsg.un2cnt = num;
- throwbackInfo(pcSender, "CombatMessage set to " + num);
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ if (pcSender == null)
+ return;
+ if (args.length != 1) {
+ this.sendUsage(pcSender);
+ return;
+ }
+ int num = 0;
+ try {
+ num = Integer.parseInt(args[0]);
+ } catch (NumberFormatException e) {
+ throwbackError(pcSender, "Supplied message number " + args[0] + " failed to parse to an Integer");
+ return;
+ }
+ TargetedActionMsg.un2cnt = num;
+ throwbackInfo(pcSender, "CombatMessage set to " + num);
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /cm [cmNumber]'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Sets the combat message to the supplied integer value";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/CreateItemCmd.java b/src/engine/devcmd/cmds/CreateItemCmd.java
index 2067a4dd..813f2b41 100644
--- a/src/engine/devcmd/cmds/CreateItemCmd.java
+++ b/src/engine/devcmd/cmds/CreateItemCmd.java
@@ -17,49 +17,48 @@ import engine.objects.PlayerCharacter;
/**
* @author Eighty
- *
*/
public class CreateItemCmd extends AbstractDevCmd {
- public CreateItemCmd() {
+ public CreateItemCmd() {
super("createitem");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (words.length < 2) {
- this.sendUsage(pc);
- return;
- }
- int id;
- id = ItemBase.getIDByName(words[0]);
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (words.length < 2) {
+ this.sendUsage(pc);
+ return;
+ }
+ int id;
+ id = ItemBase.getIDByName(words[0]);
- if (id == 0)
- id = Integer.parseInt(words[0]);
- if (id == 7){
- this.throwbackInfo(pc, "use /addgold to add gold.....");
- return;
- }
+ if (id == 0)
+ id = Integer.parseInt(words[0]);
+ if (id == 7) {
+ this.throwbackInfo(pc, "use /addgold to add gold.....");
+ return;
+ }
- int size = 1;
+ int size = 1;
- if(words.length < 3) {
- size = Integer.parseInt(words[1]);
- }
+ if (words.length < 3) {
+ size = Integer.parseInt(words[1]);
+ }
- ItemFactory.fillInventory(pc, id, size);
+ ItemFactory.fillInventory(pc, id, size);
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Fill your inventory with items";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /createitem '";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/DebugCmd.java b/src/engine/devcmd/cmds/DebugCmd.java
index 3a3f0110..ef1111c2 100644
--- a/src/engine/devcmd/cmds/DebugCmd.java
+++ b/src/engine/devcmd/cmds/DebugCmd.java
@@ -17,107 +17,106 @@ import engine.objects.PlayerCharacter;
public class DebugCmd extends AbstractDevCmd {
-
- public DebugCmd() {
- super("debug");
- // super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
- }
-
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (words.length < 2) {
- this.sendUsage(pc);
- return;
- }
-
- if (pc == null)
- return;
-
- //pc.setDebug must use bit sizes: 1, 2, 4, 8, 16, 32
-
- String command = words[0].toLowerCase();
- boolean toggle = (words[1].toLowerCase().equals("on")) ? true : false;
-
- switch (command) {
- case "magictrek":
- pc.RUN_MAGICTREK = toggle;
-
- break;
- case "combat":
- pc.setDebug(64, toggle);
-
- break;
- case "health":
- toggleDebugTimer(pc, "Debug_Health", 1, 1000, toggle);
-
- break;
- case "mana":
- toggleDebugTimer(pc, "Debug_Mana", 2, 1000, toggle);
-
- break;
- case "stamina":
- toggleDebugTimer(pc, "Debug_Stamina", 3, 500, toggle);
-
- break;
- case "spells":
- pc.setDebug(16, toggle);
-
- break;
- case "damageabsorber":
- pc.setDebug(2, toggle);
-
- break;
- case "recast":
- case "recycle":
- pc.setDebug(4, toggle);
-
- break;
- case "seeinvis":
- pc.setDebug(8, toggle);
-
- break;
- case "movement":
- pc.setDebug(1, toggle);
-
- break;
- case "noaggro":
- pc.setDebug(32, toggle);
-
- break;
- // case "loot":
- // MBServerStatics.debugLoot = toggle;
- // break;
-
- default:
- String output = "Debug for " + command + " not found.";
- throwbackError(pc, output);
- return;
- }
-
-
- setTarget(pc); //for logging
-
- String output = "Debug for " + command + " turned " + ((toggle) ? "on." : "off.");
- throwbackInfo(pc, output);
- }
-
- @Override
- protected String _getHelpString() {
- return "Runs debug commands";
-
- }
-
- @Override
- protected String _getUsageString() {
- return "'./Debug command on/off'";
- }
-
- private static void toggleDebugTimer(PlayerCharacter pc, String name, int num, int duration, boolean toggle) {
- if (toggle) {
- DebugTimerJob dtj = new DebugTimerJob(pc, name, num, duration);
- pc.renewTimer(name, dtj, duration);
- } else
- pc.cancelTimer(name);
- }
+ public DebugCmd() {
+ super("debug");
+ // super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
+ }
+
+ private static void toggleDebugTimer(PlayerCharacter pc, String name, int num, int duration, boolean toggle) {
+ if (toggle) {
+ DebugTimerJob dtj = new DebugTimerJob(pc, name, num, duration);
+ pc.renewTimer(name, dtj, duration);
+ } else
+ pc.cancelTimer(name);
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (words.length < 2) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ if (pc == null)
+ return;
+
+ //pc.setDebug must use bit sizes: 1, 2, 4, 8, 16, 32
+
+ String command = words[0].toLowerCase();
+ boolean toggle = (words[1].toLowerCase().equals("on")) ? true : false;
+
+ switch (command) {
+ case "magictrek":
+ pc.RUN_MAGICTREK = toggle;
+
+ break;
+ case "combat":
+ pc.setDebug(64, toggle);
+
+ break;
+ case "health":
+ toggleDebugTimer(pc, "Debug_Health", 1, 1000, toggle);
+
+ break;
+ case "mana":
+ toggleDebugTimer(pc, "Debug_Mana", 2, 1000, toggle);
+
+ break;
+ case "stamina":
+ toggleDebugTimer(pc, "Debug_Stamina", 3, 500, toggle);
+
+ break;
+ case "spells":
+ pc.setDebug(16, toggle);
+
+ break;
+ case "damageabsorber":
+ pc.setDebug(2, toggle);
+
+ break;
+ case "recast":
+ case "recycle":
+ pc.setDebug(4, toggle);
+
+ break;
+ case "seeinvis":
+ pc.setDebug(8, toggle);
+
+ break;
+ case "movement":
+ pc.setDebug(1, toggle);
+
+ break;
+ case "noaggro":
+ pc.setDebug(32, toggle);
+
+ break;
+ // case "loot":
+ // MBServerStatics.debugLoot = toggle;
+ // break;
+
+ default:
+ String output = "Debug for " + command + " not found.";
+ throwbackError(pc, output);
+ return;
+ }
+
+
+ setTarget(pc); //for logging
+
+ String output = "Debug for " + command + " turned " + ((toggle) ? "on." : "off.");
+ throwbackInfo(pc, output);
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Runs debug commands";
+
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "'./Debug command on/off'";
+ }
}
diff --git a/src/engine/devcmd/cmds/DebugMeleeSyncCmd.java b/src/engine/devcmd/cmds/DebugMeleeSyncCmd.java
index baa189dc..ff97a168 100644
--- a/src/engine/devcmd/cmds/DebugMeleeSyncCmd.java
+++ b/src/engine/devcmd/cmds/DebugMeleeSyncCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -17,42 +16,42 @@ import engine.objects.PlayerCharacter;
public class DebugMeleeSyncCmd extends AbstractDevCmd {
- public DebugMeleeSyncCmd() {
+ public DebugMeleeSyncCmd() {
super("debugmeleesync");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
-
- String s = words[0].toLowerCase();
-
- if (s.equals("on")) {
- pc.setDebug(64, true);
- ChatManager.chatSayInfo(pc, "Melee Sync Debug ON");
- } else if (s.equals("off")) {
- pc.setDebug(64, false);
- ChatManager.chatSayInfo(pc, "Melee Sync Debug OFF");
- } else {
- this.sendUsage(pc);
- }
- }
-
- @Override
- protected String _getHelpString() {
- return "Turns on/off melee sync debugging.";
-
- }
-
- @Override
- protected String _getUsageString() {
- return "'./debugmeleesync on|off'";
-
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ String s = words[0].toLowerCase();
+
+ if (s.equals("on")) {
+ pc.setDebug(64, true);
+ ChatManager.chatSayInfo(pc, "Melee Sync Debug ON");
+ } else if (s.equals("off")) {
+ pc.setDebug(64, false);
+ ChatManager.chatSayInfo(pc, "Melee Sync Debug OFF");
+ } else {
+ this.sendUsage(pc);
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Turns on/off melee sync debugging.";
+
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "'./debugmeleesync on|off'";
+
+ }
}
diff --git a/src/engine/devcmd/cmds/DecachePlayerCmd.java b/src/engine/devcmd/cmds/DecachePlayerCmd.java
index ef9caf4f..d4e006e2 100644
--- a/src/engine/devcmd/cmds/DecachePlayerCmd.java
+++ b/src/engine/devcmd/cmds/DecachePlayerCmd.java
@@ -20,35 +20,35 @@ import engine.objects.PlayerCharacter;
*/
public class DecachePlayerCmd extends AbstractDevCmd {
- public DecachePlayerCmd() {
+ public DecachePlayerCmd() {
super("decacheplayer");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if(words.length < 1) {
- this.sendUsage(pc);
- }
-
- int objectUUID = Integer.parseInt(words[0]);
-
- if(DbManager.inCache(Enum.GameObjectType.PlayerCharacter, objectUUID)) {
- this.setTarget(PlayerCharacter.getFromCache(objectUUID)); //for logging
- PlayerCharacter.getFromCache(objectUUID).removeFromCache();
- } else {
- this.sendHelp(pc);
- }
- }
-
- @Override
- protected String _getHelpString() {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (words.length < 1) {
+ this.sendUsage(pc);
+ }
+
+ int objectUUID = Integer.parseInt(words[0]);
+
+ if (DbManager.inCache(Enum.GameObjectType.PlayerCharacter, objectUUID)) {
+ this.setTarget(PlayerCharacter.getFromCache(objectUUID)); //for logging
+ PlayerCharacter.getFromCache(objectUUID).removeFromCache();
+ } else {
+ this.sendHelp(pc);
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
return "No player found. Please make sure the table ID is correct.";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /decacheplayer '";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/DespawnCmd.java b/src/engine/devcmd/cmds/DespawnCmd.java
index 18d54437..02f7ce98 100644
--- a/src/engine/devcmd/cmds/DespawnCmd.java
+++ b/src/engine/devcmd/cmds/DespawnCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -18,56 +17,50 @@ import engine.objects.PlayerCharacter;
public class DespawnCmd extends AbstractDevCmd {
- public DespawnCmd() {
+ public DespawnCmd() {
super("debugmob");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
-
-
-
-
- if (pc == null) {
- return;
- }
-
-
-
-
-
- Mob mob = null;
-
- if (target != null && target.getObjectType().equals(GameObjectType.Mob))
- mob = (Mob)target;
-
- if (mob == null)
- mob = Mob.getFromCache(Integer.parseInt(words[1]));
-
- if (mob == null)
- return;
-
- if (words[0].equalsIgnoreCase("respawn")){
- mob.respawn();
- this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Respawned");
- }else if (words[0].equalsIgnoreCase("despawn")){
- mob.despawn();
- this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Despawned");
- }
- }
-
- @Override
- protected String _getHelpString() {
- return "Gets distance from a target.";
-
- }
-
- @Override
- protected String _getUsageString() {
- return "' /distance'";
-
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+
+
+ if (pc == null) {
+ return;
+ }
+
+
+ Mob mob = null;
+
+ if (target != null && target.getObjectType().equals(GameObjectType.Mob))
+ mob = (Mob) target;
+
+ if (mob == null)
+ mob = Mob.getFromCache(Integer.parseInt(words[1]));
+
+ if (mob == null)
+ return;
+
+ if (words[0].equalsIgnoreCase("respawn")) {
+ mob.respawn();
+ this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Respawned");
+ } else if (words[0].equalsIgnoreCase("despawn")) {
+ mob.despawn();
+ this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Despawned");
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Gets distance from a target.";
+
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /distance'";
+
+ }
}
diff --git a/src/engine/devcmd/cmds/DistanceCmd.java b/src/engine/devcmd/cmds/DistanceCmd.java
index 458531c2..81e02c3f 100644
--- a/src/engine/devcmd/cmds/DistanceCmd.java
+++ b/src/engine/devcmd/cmds/DistanceCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -18,51 +17,49 @@ import engine.objects.PlayerCharacter;
public class DistanceCmd extends AbstractDevCmd {
- public DistanceCmd() {
+ public DistanceCmd() {
super("distance");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
-
-
-
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
- if (pc == null) {
- return;
- }
-
- if (target == null || !(target instanceof AbstractWorldObject)) {
- throwbackError(pc, "No target found.");
- return;
- }
-
- AbstractWorldObject awoTarget = (AbstractWorldObject)target;
-
- Vector3fImmutable pcLoc = pc.getLoc();
- Vector3fImmutable tarLoc = awoTarget.getLoc();
- String out = "Distance: " + pcLoc.distance(tarLoc) +
- "\r\nYour Loc: " + pcLoc.x + 'x' + pcLoc.y + 'x' + pcLoc.z +
- "\r\nTarget Loc: " + tarLoc.x + 'x' + tarLoc.y + 'x' + tarLoc.z;
- throwbackInfo(pc, out);
- }
-
- @Override
- protected String _getHelpString() {
- return "Gets distance from a target.";
-
- }
-
- @Override
- protected String _getUsageString() {
- return "' /distance'";
-
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+
+
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
+ if (pc == null) {
+ return;
+ }
+
+ if (target == null || !(target instanceof AbstractWorldObject)) {
+ throwbackError(pc, "No target found.");
+ return;
+ }
+
+ AbstractWorldObject awoTarget = (AbstractWorldObject) target;
+
+ Vector3fImmutable pcLoc = pc.getLoc();
+ Vector3fImmutable tarLoc = awoTarget.getLoc();
+ String out = "Distance: " + pcLoc.distance(tarLoc) +
+ "\r\nYour Loc: " + pcLoc.x + 'x' + pcLoc.y + 'x' + pcLoc.z +
+ "\r\nTarget Loc: " + tarLoc.x + 'x' + tarLoc.y + 'x' + tarLoc.z;
+ throwbackInfo(pc, out);
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Gets distance from a target.";
+
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /distance'";
+
+ }
}
diff --git a/src/engine/devcmd/cmds/EffectCmd.java b/src/engine/devcmd/cmds/EffectCmd.java
index 74733945..8ad9ca8d 100644
--- a/src/engine/devcmd/cmds/EffectCmd.java
+++ b/src/engine/devcmd/cmds/EffectCmd.java
@@ -17,47 +17,45 @@ import engine.objects.PlayerCharacter;
import engine.powers.EffectsBase;
/**
- *
* @author Eighty
- *
*/
public class EffectCmd extends AbstractDevCmd {
- public EffectCmd() {
+ public EffectCmd() {
super("effect");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- int ID = 0;
- int token = 0;
-
- if (args.length != 2) {
- this.sendUsage(pcSender);
- return;
- }
- ID = Integer.parseInt(args[0]);
- token = Integer.parseInt(args[1]);
-
- EffectsBase eb = PowersManager.setEffectToken(ID, token);
- if (eb == null) {
- throwbackError(pcSender, "Unable to find EffectsBase " + ID
- + " to modify.");
- return;
- }
- ChatManager.chatSayInfo(pcSender,
- "EffectsBase with ID " + ID + " changed token to " + token);
- }
-
- @Override
- protected String _getUsageString() {
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ int ID = 0;
+ int token = 0;
+
+ if (args.length != 2) {
+ this.sendUsage(pcSender);
+ return;
+ }
+ ID = Integer.parseInt(args[0]);
+ token = Integer.parseInt(args[1]);
+
+ EffectsBase eb = PowersManager.setEffectToken(ID, token);
+ if (eb == null) {
+ throwbackError(pcSender, "Unable to find EffectsBase " + ID
+ + " to modify.");
+ return;
+ }
+ ChatManager.chatSayInfo(pcSender,
+ "EffectsBase with ID " + ID + " changed token to " + token);
+ }
+
+ @Override
+ protected String _getUsageString() {
return "' /effect EffectsBaseID Token'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Temporarily places the effect token with the corresponding EffectsBase on the server";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/EnchantCmd.java b/src/engine/devcmd/cmds/EnchantCmd.java
index b6f2247c..1f23ae86 100644
--- a/src/engine/devcmd/cmds/EnchantCmd.java
+++ b/src/engine/devcmd/cmds/EnchantCmd.java
@@ -14,75 +14,74 @@ import engine.objects.*;
public class EnchantCmd extends AbstractDevCmd {
- public EnchantCmd() {
+ public EnchantCmd() {
super("enchant");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- int rank = 0;
- if (words.length < 1) {
- this.sendUsage(pc);
- return;
- }
-
-
- try{
- rank = Integer.parseInt(words[0]);
- }catch(Exception e){
-
- }
-
-
-
- Item item;
- if (target == null || target instanceof Item)
- item = (Item) target;
- else {
- throwbackError(pc, "Must have an item targeted");
- return;
- }
-
- CharacterItemManager cim = pc.getCharItemManager();
- if (cim == null) {
- throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
- return;
- }
-
- if (words[0].equals("clear")) {
- item.clearEnchantments();
- cim.updateInventory();
- this.setResult(String.valueOf(item.getObjectUUID()));
- } else {
- int cnt = words.length;
- for (int i=1;i container = WorldGrid.getObjectsInRangePartial(
- searchPt, range, MBServerStatics.MASK_BUILDING);
-
- s += "Found " + container.size();
- s += " buildings within " + range;
- s += " units of [" + searchPt.toString() + ']';
- throwbackInfo(pc, s);
-
- int index = 0;
- for (AbstractWorldObject awo : container) {
- Building b = (Building) awo;
-
- s = index + ")";
- s += " ObjectID: " + awo.getObjectUUID() + ']';
- s += " -> Name: " + b.getSimpleName();
- if (b.getBlueprint() == null) {
- s += " No Blueprint";
- } else {
- s += " Blueprint UUID: " + b.getBlueprint().getMeshForRank(0);
- }
- s += "[" + ((Building) awo).getBlueprintUUID() + ']';
-
- throwbackInfo(pc, s);
- ++index;
- }
-
- } catch (NumberFormatException e) {
- this.throwbackError(pc, "Supplied data: '" + words
- + "' failed to parse to a Float.");
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to findBuildings with data: '"
- + words + '\'');
- }
- }
-
- @Override
- protected String _getHelpString() {
- return "Sets your character's Mana to 'amount'";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /findBuildings [lat long] [range]'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ try {
+ Vector3fImmutable searchPt = pc.getLoc();
+ float range = 50.0f;
+
+ // Arg Count Check
+ // Valid arg count is 0,1,2,3
+ if (words.length == 0) {
+ // Use Player's loc and default range
+
+ } else if (words.length == 1) {
+ // Use Player's loc and specified range
+ range = Float.valueOf(words[0]);
+
+ } else if (words.length == 2) {
+ // Use specified loc and default range
+ searchPt = new Vector3fImmutable(Float.valueOf(words[0]),
+ searchPt.y,
+ Float.valueOf(words[1]));
+
+ } else if (words.length == 3) {
+ // Use specified loc and specified range
+ searchPt = new Vector3fImmutable(Float.valueOf(words[0]),
+ searchPt.y,
+ Float.valueOf(words[1]));
+ range = Float.valueOf(words[2]);
+
+ } else {
+ this.sendUsage(pc);
+ return;
+ }
+
+ String s = "";
+
+ HashSet container = WorldGrid.getObjectsInRangePartial(
+ searchPt, range, MBServerStatics.MASK_BUILDING);
+
+ s += "Found " + container.size();
+ s += " buildings within " + range;
+ s += " units of [" + searchPt.toString() + ']';
+ throwbackInfo(pc, s);
+
+ int index = 0;
+ for (AbstractWorldObject awo : container) {
+ Building b = (Building) awo;
+
+ s = index + ")";
+ s += " ObjectID: " + awo.getObjectUUID() + ']';
+ s += " -> Name: " + b.getSimpleName();
+ if (b.getBlueprint() == null) {
+ s += " No Blueprint";
+ } else {
+ s += " Blueprint UUID: " + b.getBlueprint().getMeshForRank(0);
+ }
+ s += "[" + ((Building) awo).getBlueprintUUID() + ']';
+
+ throwbackInfo(pc, s);
+ ++index;
+ }
+
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Supplied data: '" + words
+ + "' failed to parse to a Float.");
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to findBuildings with data: '"
+ + words + '\'');
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Sets your character's Mana to 'amount'";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /findBuildings [lat long] [range]'";
+ }
}
diff --git a/src/engine/devcmd/cmds/FlashMsgCmd.java b/src/engine/devcmd/cmds/FlashMsgCmd.java
index e500ca74..66565b62 100644
--- a/src/engine/devcmd/cmds/FlashMsgCmd.java
+++ b/src/engine/devcmd/cmds/FlashMsgCmd.java
@@ -15,54 +15,51 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
- *
* @author Eighty
- *
*/
public class FlashMsgCmd extends AbstractDevCmd {
- public FlashMsgCmd() {
+ public FlashMsgCmd() {
super("flash");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- if (args.length != 1 || args[0].isEmpty()) {
- this.sendUsage(pcSender);
- return;
- }
- ChatManager.chatSystemFlash(args[0]);
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ if (args.length != 1 || args[0].isEmpty()) {
+ this.sendUsage(pcSender);
+ return;
+ }
+ ChatManager.chatSystemFlash(args[0]);
+ }
- /**
- * This function is called by the DevCmdManager. Override to avoid splitting
- * argString into String array, since flash displays full String as message,
- * then calls the subclass specific _doCmd method.
- *
- */
+ /**
+ * This function is called by the DevCmdManager. Override to avoid splitting
+ * argString into String array, since flash displays full String as message,
+ * then calls the subclass specific _doCmd method.
+ */
- @Override
- public void doCmd(PlayerCharacter pcSender, String argString,
- AbstractGameObject target) {
- String[] args = new String[1];
- args[0] = argString;
+ @Override
+ public void doCmd(PlayerCharacter pcSender, String argString,
+ AbstractGameObject target) {
+ String[] args = new String[1];
+ args[0] = argString;
- if (pcSender == null) {
- return;
- }
+ if (pcSender == null) {
+ return;
+ }
- this._doCmd(pcSender, args, target);
- }
+ this._doCmd(pcSender, args, target);
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /flash message'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Flashes system message to all players";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/GateInfoCmd.java b/src/engine/devcmd/cmds/GateInfoCmd.java
index bba5164d..700f2928 100644
--- a/src/engine/devcmd/cmds/GateInfoCmd.java
+++ b/src/engine/devcmd/cmds/GateInfoCmd.java
@@ -7,79 +7,78 @@ import engine.math.Vector3fImmutable;
import engine.objects.*;
public class GateInfoCmd extends AbstractDevCmd {
-
- public GateInfoCmd() {
+
+ public GateInfoCmd() {
super("gateinfo");
}
- // AbstractDevCmd Overridden methods
-
- @Override
- protected void _doCmd(PlayerCharacter player, String[] args,
- AbstractGameObject target) {
-
- Building targetBuilding;
- String outString;
- Runegate runeGate;
- Blueprint blueprint;
- String newline = "\r\n ";
- targetBuilding = (Building)target;
-
- if (targetBuilding.getObjectType() != GameObjectType.Building) {
- throwbackInfo(player, "GateInfo: target must be a Building");
- throwbackInfo(player, "Found" + targetBuilding.getObjectType().toString());
- return;
- }
-
- blueprint = Blueprint._meshLookup.get(targetBuilding.getMeshUUID());
-
- if (blueprint == null ||
- (blueprint.getBuildingGroup() != BuildingGroup.RUNEGATE)){
- throwbackInfo(player, "showgate: target must be a Runegate");
- return;
- }
-
-
- runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
-
- outString = "RungateType: " + runeGate.gateBuilding.getName();
- outString += newline;
-
- outString += "Portal State:";
- outString += newline;
-
- for (Portal portal : runeGate.getPortals()) {
-
- outString += "Portal: " + portal.portalType.name();
- outString += " Active: " + portal.isActive();
- outString += " Dest: " + portal.targetGate.getName();
- outString += newline;
- outString += " Origin: " + portal.getPortalLocation().x + 'x';
- outString += " " + portal.getPortalLocation().y + 'y';
- outString += newline;
-
- Vector3fImmutable offset = portal.getPortalLocation().subtract(targetBuilding.getLoc());
- outString += " Offset: " + offset.x + "x " + offset.z + 'y';
- outString += newline;
- outString += newline;
-
- }
- outString += newline;
- throwbackInfo(player, outString);
+ // AbstractDevCmd Overridden methods
+
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] args,
+ AbstractGameObject target) {
+
+ Building targetBuilding;
+ String outString;
+ Runegate runeGate;
+ Blueprint blueprint;
+ String newline = "\r\n ";
+ targetBuilding = (Building) target;
+
+ if (targetBuilding.getObjectType() != GameObjectType.Building) {
+ throwbackInfo(player, "GateInfo: target must be a Building");
+ throwbackInfo(player, "Found" + targetBuilding.getObjectType().toString());
+ return;
+ }
+
+ blueprint = Blueprint._meshLookup.get(targetBuilding.getMeshUUID());
+
+ if (blueprint == null ||
+ (blueprint.getBuildingGroup() != BuildingGroup.RUNEGATE)) {
+ throwbackInfo(player, "showgate: target must be a Runegate");
+ return;
+ }
+
+
+ runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
+
+ outString = "RungateType: " + runeGate.gateBuilding.getName();
+ outString += newline;
+
+ outString += "Portal State:";
+ outString += newline;
+
+ for (Portal portal : runeGate.getPortals()) {
+
+ outString += "Portal: " + portal.portalType.name();
+ outString += " Active: " + portal.isActive();
+ outString += " Dest: " + portal.targetGate.getName();
+ outString += newline;
+ outString += " Origin: " + portal.getPortalLocation().x + 'x';
+ outString += " " + portal.getPortalLocation().y + 'y';
+ outString += newline;
+
+ Vector3fImmutable offset = portal.getPortalLocation().subtract(targetBuilding.getLoc());
+ outString += " Offset: " + offset.x + "x " + offset.z + 'y';
+ outString += newline;
+ outString += newline;
+
}
+ outString += newline;
+ throwbackInfo(player, outString);
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Displays a runegate's gate status";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "/gateinfo \n";
- }
+ }
+
-
-
}
diff --git a/src/engine/devcmd/cmds/GetBankCmd.java b/src/engine/devcmd/cmds/GetBankCmd.java
index 55e1e871..65e4c466 100644
--- a/src/engine/devcmd/cmds/GetBankCmd.java
+++ b/src/engine/devcmd/cmds/GetBankCmd.java
@@ -17,36 +17,36 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
- *
* @author Eighty
- *
*/
public class GetBankCmd extends AbstractDevCmd {
- public GetBankCmd() {
+ public GetBankCmd() {
super("getbank");
}
- @Override
+ @Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- if (pcSender == null) return;
+ AbstractGameObject target) {
+ if (pcSender == null)
+ return;
- ClientConnection cc = SessionManager.getClientConnection(pcSender);
- if (cc == null) return;
+ ClientConnection cc = SessionManager.getClientConnection(pcSender);
+ if (cc == null)
+ return;
- VendorDialogMsg.getBank(pcSender, null, cc);
- this.setTarget(pcSender); //for logging
- }
+ VendorDialogMsg.getBank(pcSender, null, cc);
+ this.setTarget(pcSender); //for logging
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /getbank'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Opens bank window";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/GetCacheCountCmd.java b/src/engine/devcmd/cmds/GetCacheCountCmd.java
index 29840336..eaea4c14 100644
--- a/src/engine/devcmd/cmds/GetCacheCountCmd.java
+++ b/src/engine/devcmd/cmds/GetCacheCountCmd.java
@@ -16,25 +16,25 @@ import engine.objects.PlayerCharacter;
public class GetCacheCountCmd extends AbstractDevCmd {
- public GetCacheCountCmd() {
+ public GetCacheCountCmd() {
super("getcachecount");
this.addCmdString("getcachecount");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- DbManager.printCacheCount(pcSender);
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ DbManager.printCacheCount(pcSender);
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /getcachecount'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Get a count of the objects in the cache";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java
index 6f94f457..8254a47f 100644
--- a/src/engine/devcmd/cmds/GetHeightCmd.java
+++ b/src/engine/devcmd/cmds/GetHeightCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.InterestManagement.HeightMap;
@@ -41,7 +40,7 @@ public class GetHeightCmd extends AbstractDevCmd {
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
this.throwbackInfo(pc, "Water Level : " + zone.getSeaLevel());
- this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()) );
+ this.throwbackInfo(pc, "Character Water Level Above : " + (pc.getCharacterHeight() + height - zone.getSeaLevel()));
if (end)
return;
@@ -62,9 +61,9 @@ public class GetHeightCmd extends AbstractDevCmd {
//find the next parents heightmap if the currentzone heightmap is null.
- while (heightMap == null){
+ while (heightMap == null) {
- if (currentZone == ZoneManager.getSeaFloor()){
+ if (currentZone == ZoneManager.getSeaFloor()) {
this.throwbackInfo(pc, "Could not find a heightmap to get height.");
break;
}
@@ -76,9 +75,9 @@ public class GetHeightCmd extends AbstractDevCmd {
}
- if ( (heightMap == null) || (currentZone == ZoneManager.getSeaFloor()) ) {
- this.throwbackInfo(pc, currentZone.getName() + " has no heightmap " );
- this.throwbackInfo(pc, "Current altitude: " + currentZone.absY );
+ if ((heightMap == null) || (currentZone == ZoneManager.getSeaFloor())) {
+ this.throwbackInfo(pc, currentZone.getName() + " has no heightmap ");
+ this.throwbackInfo(pc, "Current altitude: " + currentZone.absY);
return;
}
@@ -88,8 +87,6 @@ public class GetHeightCmd extends AbstractDevCmd {
this.throwbackInfo(pc, "SeaFloor Local : " + seaFloorLocalLoc.x + " , " + seaFloorLocalLoc.y);
-
-
this.throwbackInfo(pc, "Local Zone Location : " + zoneLoc.x + " , " + zoneLoc.y);
Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone);
Vector3fImmutable parentLocFromCenter = ZoneManager.worldToLocal(pc.getLoc(), currentZone.getParent());
@@ -99,10 +96,11 @@ public class GetHeightCmd extends AbstractDevCmd {
Vector2f parentZoneLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), currentZone.getParent());
this.throwbackInfo(pc, "Parent Zone Location from Bottom Left : " + parentZoneLoc);
- if ((parentZone != null ) && (parentZone.getHeightMap() != null)) {
+ if ((parentZone != null) && (parentZone.getHeightMap() != null)) {
parentLoc = ZoneManager.worldToZoneSpace(pc.getLoc(), parentZone);
- parentGrid = parentZone.getHeightMap().getGridSquare( parentLoc);
- } else parentGrid = new Vector2f(-1,-1);
+ parentGrid = parentZone.getHeightMap().getGridSquare(parentLoc);
+ } else
+ parentGrid = new Vector2f(-1, -1);
gridSquare = heightMap.getGridSquare(zoneLoc);
gridOffset = HeightMap.getGridOffset(gridSquare);
@@ -110,7 +108,7 @@ public class GetHeightCmd extends AbstractDevCmd {
float interaltitude = currentZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
this.throwbackInfo(pc, currentZone.getName());
- this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y );
+ this.throwbackInfo(pc, "Current Grid Square: " + gridSquare.x + " , " + gridSquare.y);
this.throwbackInfo(pc, "Grid Offset: " + gridOffset.x + " , " + gridOffset.y);
this.throwbackInfo(pc, "Parent Grid: " + parentGrid.x + " , " + parentGrid.y);
@@ -126,15 +124,15 @@ public class GetHeightCmd extends AbstractDevCmd {
float realWorldAltitude = interaltitude + currentZone.getWorldAltitude();
//OUTSET
- if (parentZone != null){
+ if (parentZone != null) {
float parentXRadius = currentZone.getBounds().getHalfExtents().x;
float parentZRadius = currentZone.getBounds().getHalfExtents().y;
float offsetX = Math.abs((localLocFromCenter.x / parentXRadius));
float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius));
- float bucketScaleX = 100/parentXRadius;
- float bucketScaleZ = 200/parentZRadius;
+ float bucketScaleX = 100 / parentXRadius;
+ float bucketScaleZ = 200 / parentZRadius;
float outsideGridSizeX = 1 - bucketScaleX; //32/256
float outsideGridSizeZ = 1 - bucketScaleZ;
@@ -143,7 +141,7 @@ public class GetHeightCmd extends AbstractDevCmd {
double scale;
- if (offsetX > outsideGridSizeX && offsetX > offsetZ){
+ if (offsetX > outsideGridSizeX && offsetX > offsetZ) {
weight = (offsetX - outsideGridSizeX) / bucketScaleX;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
@@ -164,7 +162,7 @@ public class GetHeightCmd extends AbstractDevCmd {
outsetALt += currentZone.getParent().getAbsY();
realWorldAltitude = outsetALt;
- }else if (offsetZ > outsideGridSizeZ){
+ } else if (offsetZ > outsideGridSizeZ) {
weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ;
scale = Math.atan2((.5 - weight) * 3.1415927, 1);
@@ -184,8 +182,6 @@ public class GetHeightCmd extends AbstractDevCmd {
realWorldAltitude = outsetALt;
-
-
}
}
@@ -196,7 +192,7 @@ public class GetHeightCmd extends AbstractDevCmd {
strMod += 1f;
float radius = 0;
- switch (pc.getRaceID()){
+ switch (pc.getRaceID()) {
case 2017:
radius = 3.1415927f;
case 2000:
@@ -210,14 +206,11 @@ public class GetHeightCmd extends AbstractDevCmd {
strMod -= .5f;
-
realWorldAltitude += strMod;
this.throwbackInfo(pc, "interpolated height with World: " + realWorldAltitude);
-
-
}
@Override
diff --git a/src/engine/devcmd/cmds/GetMemoryCmd.java b/src/engine/devcmd/cmds/GetMemoryCmd.java
index d6b1a0a8..795c19b7 100644
--- a/src/engine/devcmd/cmds/GetMemoryCmd.java
+++ b/src/engine/devcmd/cmds/GetMemoryCmd.java
@@ -15,43 +15,44 @@ import engine.objects.PlayerCharacter;
public class GetMemoryCmd extends AbstractDevCmd {
- public GetMemoryCmd() {
+ public GetMemoryCmd() {
super("getmemory");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
- if (pcSender == null) return;
-
- String hSize = getMemoryOutput(Runtime.getRuntime().totalMemory());
- String mhSize = getMemoryOutput(Runtime.getRuntime().maxMemory());
- String fhSize = getMemoryOutput(Runtime.getRuntime().freeMemory());
-
- String out = "Heap Size: " + hSize + ", Max Heap Size: " + mhSize + ", Free Heap Size: " + fhSize;
- throwbackInfo(pcSender, out);
- }
-
- public static String getMemoryOutput(long memory) {
- String out = "";
- if (memory > 1073741824)
- return (memory / 1073741824) + "GB";
- else if (memory > 1048576)
- return (memory / 1048576) + "MB";
- else if (memory > 1024)
- return (memory / 1048576) + "KB";
- else
- return memory + "B";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /getmemory'";
- }
-
- @Override
- protected String _getHelpString() {
- return "lists memory usage";
- }
+ public static String getMemoryOutput(long memory) {
+ String out = "";
+ if (memory > 1073741824)
+ return (memory / 1073741824) + "GB";
+ else if (memory > 1048576)
+ return (memory / 1048576) + "MB";
+ else if (memory > 1024)
+ return (memory / 1048576) + "KB";
+ else
+ return memory + "B";
+ }
+
+ @Override
+ protected 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
+ protected String _getUsageString() {
+ return "' /getmemory'";
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "lists memory usage";
+ }
}
diff --git a/src/engine/devcmd/cmds/GetMobBaseLoot.java b/src/engine/devcmd/cmds/GetMobBaseLoot.java
index 3ecce72f..edd450a6 100644
--- a/src/engine/devcmd/cmds/GetMobBaseLoot.java
+++ b/src/engine/devcmd/cmds/GetMobBaseLoot.java
@@ -18,42 +18,41 @@ import engine.objects.PlayerCharacter;
/**
* @author Eighty
- *
*/
public class GetMobBaseLoot extends AbstractDevCmd {
- public GetMobBaseLoot() {
+ public GetMobBaseLoot() {
super("mobbaseloot");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (target.getObjectType() != GameObjectType.Mob){
- this.throwbackError(pc, "Must be targeting a Valid Mob For this Command.");
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (target.getObjectType() != GameObjectType.Mob) {
+ this.throwbackError(pc, "Must be targeting a Valid Mob For this Command.");
+ return;
+ }
- Mob mob = (Mob)target;
- for (MobLootBase mlb : MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID())){
+ Mob mob = (Mob) target;
+ for (MobLootBase mlb : MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID())) {
- this.throwbackInfo(pc, "LootTable11 = " + mlb.getLootTableID() + "\rn ");
- this.throwbackInfo(pc, "Chance = " + mlb.getChance() + "\rn ");
+ this.throwbackInfo(pc, "LootTable11 = " + mlb.getLootTableID() + "\rn ");
+ this.throwbackInfo(pc, "Chance = " + mlb.getChance() + "\rn ");
- }
+ }
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Copies a Mob of type 'mobID' with optional new name";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /mob mobID [name]'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/GetOffsetCmd.java b/src/engine/devcmd/cmds/GetOffsetCmd.java
index 515b5d3f..46c75b14 100644
--- a/src/engine/devcmd/cmds/GetOffsetCmd.java
+++ b/src/engine/devcmd/cmds/GetOffsetCmd.java
@@ -17,47 +17,48 @@ import engine.objects.Zone;
public class GetOffsetCmd extends AbstractDevCmd {
- public GetOffsetCmd() {
+ public GetOffsetCmd() {
super("getoffset");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
- if (pcSender == null) return;
-
- Zone zone = null;
- try {
- int loadID = Integer.parseInt(words[0]);
- zone = ZoneManager.getZoneByZoneID(loadID);
- if (zone == null) {
- throwbackError(pcSender, "Error: can't find the zone of ID " + loadID + '.');
- return;
- }
- } catch (Exception e) {
- zone = ZoneManager.findSmallestZone(pcSender.getLoc());
- }
-
- if (zone == null) {
- throwbackError(pcSender, "Error: can't find the zone you're in.");
- return;
- }
-
- float difX = pcSender.getLoc().x - zone.absX;
- float difY = pcSender.getLoc().y - zone.absY;
- float difZ = pcSender.getLoc().z - zone.absZ;
-
- throwbackInfo(pcSender, zone.getName() + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
- }
-
- @Override
- protected String _getUsageString() {
- return "'./getoffset [zoneID]'";
- }
-
- @Override
- protected String _getHelpString() {
- return "lists offset from center of zone";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
+ if (pcSender == null)
+ return;
+
+ Zone zone = null;
+ try {
+ int loadID = Integer.parseInt(words[0]);
+ zone = ZoneManager.getZoneByZoneID(loadID);
+ if (zone == null) {
+ throwbackError(pcSender, "Error: can't find the zone of ID " + loadID + '.');
+ return;
+ }
+ } catch (Exception e) {
+ zone = ZoneManager.findSmallestZone(pcSender.getLoc());
+ }
+
+ if (zone == null) {
+ throwbackError(pcSender, "Error: can't find the zone you're in.");
+ return;
+ }
+
+ float difX = pcSender.getLoc().x - zone.absX;
+ float difY = pcSender.getLoc().y - zone.absY;
+ float difZ = pcSender.getLoc().z - zone.absZ;
+
+ throwbackInfo(pcSender, zone.getName() + ": (x: " + difX + ", y: " + difY + ", z: " + difZ + ')');
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "'./getoffset [zoneID]'";
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "lists offset from center of zone";
+ }
}
diff --git a/src/engine/devcmd/cmds/GetRuneDropRateCmd.java b/src/engine/devcmd/cmds/GetRuneDropRateCmd.java
index 7dea4c5c..300fe6df 100644
--- a/src/engine/devcmd/cmds/GetRuneDropRateCmd.java
+++ b/src/engine/devcmd/cmds/GetRuneDropRateCmd.java
@@ -16,27 +16,28 @@ import engine.objects.PlayerCharacter;
public class GetRuneDropRateCmd extends AbstractDevCmd {
- public GetRuneDropRateCmd() {
+ public GetRuneDropRateCmd() {
super("getrunedroprate");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
- if (pcSender == null) return;
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
+ if (pcSender == null)
+ return;
- String out = "Depracated";
- throwbackInfo(pcSender, out);
- }
+ String out = "Depracated";
+ throwbackInfo(pcSender, out);
+ }
- @Override
- protected String _getUsageString() {
- return "' /getrunedroprate'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /getrunedroprate'";
+ }
- @Override
- protected String _getHelpString() {
- return "lists drop rates for runes and contracts in non-hotzone.";
- }
+ @Override
+ protected String _getHelpString() {
+ return "lists drop rates for runes and contracts in non-hotzone.";
+ }
}
diff --git a/src/engine/devcmd/cmds/GetVaultCmd.java b/src/engine/devcmd/cmds/GetVaultCmd.java
index df50846e..c480f761 100644
--- a/src/engine/devcmd/cmds/GetVaultCmd.java
+++ b/src/engine/devcmd/cmds/GetVaultCmd.java
@@ -18,30 +18,32 @@ import engine.objects.PlayerCharacter;
public class GetVaultCmd extends AbstractDevCmd {
- public GetVaultCmd() {
+ public GetVaultCmd() {
super("getvault");
}
- @Override
+ @Override
protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- if (pcSender == null) return;
+ AbstractGameObject target) {
+ if (pcSender == null)
+ return;
- ClientConnection cc = SessionManager.getClientConnection(pcSender);
- if (cc == null) return;
+ ClientConnection cc = SessionManager.getClientConnection(pcSender);
+ if (cc == null)
+ return;
- VendorDialogMsg.getVault(pcSender, null, cc);
- this.setTarget(pcSender); //for logging
- }
+ VendorDialogMsg.getVault(pcSender, null, cc);
+ this.setTarget(pcSender); //for logging
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /getvault'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Opens account vault";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/GetZoneCmd.java b/src/engine/devcmd/cmds/GetZoneCmd.java
index bab3ae9d..dc7c3693 100644
--- a/src/engine/devcmd/cmds/GetZoneCmd.java
+++ b/src/engine/devcmd/cmds/GetZoneCmd.java
@@ -19,48 +19,49 @@ import java.util.ArrayList;
public class GetZoneCmd extends AbstractDevCmd {
- public GetZoneCmd() {
+ public GetZoneCmd() {
super("getzone");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
- if (pcSender == null) return;
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
+ if (pcSender == null)
+ return;
- if (words.length != 1) {
- this.sendUsage(pcSender);
- return;
- }
+ if (words.length != 1) {
+ this.sendUsage(pcSender);
+ return;
+ }
- ArrayList allIn = new ArrayList<>();
- switch (words[0].toLowerCase()) {
- case "all":
- throwbackInfo(pcSender, "All zones currently in");
- allIn = ZoneManager.getAllZonesIn(pcSender.getLoc());
- break;
- case "smallest":
- throwbackInfo(pcSender, "Smallest zone currently in");
- Zone zone = ZoneManager.findSmallestZone(pcSender.getLoc());
- allIn.add(zone);
- break;
- default:
- this.sendUsage(pcSender);
- return;
- }
+ ArrayList allIn = new ArrayList<>();
+ switch (words[0].toLowerCase()) {
+ case "all":
+ throwbackInfo(pcSender, "All zones currently in");
+ allIn = ZoneManager.getAllZonesIn(pcSender.getLoc());
+ break;
+ case "smallest":
+ throwbackInfo(pcSender, "Smallest zone currently in");
+ Zone zone = ZoneManager.findSmallestZone(pcSender.getLoc());
+ allIn.add(zone);
+ break;
+ default:
+ this.sendUsage(pcSender);
+ return;
+ }
- for (Zone zone : allIn)
- throwbackInfo(pcSender, zone.getName() + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.getLoadNum());
- }
+ for (Zone zone : allIn)
+ throwbackInfo(pcSender, zone.getName() + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.getLoadNum());
+ }
- @Override
- protected String _getUsageString() {
- return "' /getzone smallest/all'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /getzone smallest/all'";
+ }
- @Override
- protected String _getHelpString() {
- return "lists what zones a player is in";
- }
+ @Override
+ protected String _getHelpString() {
+ return "lists what zones a player is in";
+ }
}
diff --git a/src/engine/devcmd/cmds/GetZoneMobsCmd.java b/src/engine/devcmd/cmds/GetZoneMobsCmd.java
index f069ef20..aea5761f 100644
--- a/src/engine/devcmd/cmds/GetZoneMobsCmd.java
+++ b/src/engine/devcmd/cmds/GetZoneMobsCmd.java
@@ -18,65 +18,67 @@ import engine.objects.Zone;
public class GetZoneMobsCmd extends AbstractDevCmd {
- public GetZoneMobsCmd() {
+ public GetZoneMobsCmd() {
super("getzonemobs");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
- if (pcSender == null) return;
-
- int loadID = 0;
- if (words.length == 1) {
- try {
- loadID = Integer.parseInt(words[0]);
- } catch (Exception e) {}
- }
-
- //find the zone
- Zone zone = null;
- if (loadID != 0) {
- zone = ZoneManager.getZoneByZoneID(loadID);
- if (zone == null)
- zone = ZoneManager.getZoneByUUID(loadID);
- } else
- zone = ZoneManager.findSmallestZone(pcSender.getLoc());
-
- if (zone == null) {
- if (loadID != 0)
- throwbackError(pcSender, "Error: can't find the zone of ID " + loadID + '.');
- else
- throwbackError(pcSender, "Error: can't find the zone you are in.");
- return;
- }
-
- //get all mobs for the zone
-
- throwbackInfo(pcSender, zone.getName() + " (" + zone.getLoadNum() + ") " + zone.getObjectUUID());
-
- for (Mob m : zone.zoneMobSet) {
-
- if (m != null) {
- String out = m.getName() + '(' + m.getDBID() + "): ";
- if (m.isAlive())
- out += m.getLoc().x + "x" + m.getLoc().z + "; isAlive: " + m.isAlive();
- else
- out += " isAlive: " + m.isAlive();
- throwbackInfo(pcSender, out);
- } else
- throwbackInfo(pcSender, "Unknown (" + m.getDBID() + "): not loaded");
- }
- }
-
- @Override
- protected String _getUsageString() {
- return "' /getzonemobs [zoneID]'";
- }
-
- @Override
- protected String _getHelpString() {
- return "lists all mobs for a zone";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
+ if (pcSender == null)
+ return;
+
+ int loadID = 0;
+ if (words.length == 1) {
+ try {
+ loadID = Integer.parseInt(words[0]);
+ } catch (Exception e) {
+ }
+ }
+
+ //find the zone
+ Zone zone = null;
+ if (loadID != 0) {
+ zone = ZoneManager.getZoneByZoneID(loadID);
+ if (zone == null)
+ zone = ZoneManager.getZoneByUUID(loadID);
+ } else
+ zone = ZoneManager.findSmallestZone(pcSender.getLoc());
+
+ if (zone == null) {
+ if (loadID != 0)
+ throwbackError(pcSender, "Error: can't find the zone of ID " + loadID + '.');
+ else
+ throwbackError(pcSender, "Error: can't find the zone you are in.");
+ return;
+ }
+
+ //get all mobs for the zone
+
+ throwbackInfo(pcSender, zone.getName() + " (" + zone.getLoadNum() + ") " + zone.getObjectUUID());
+
+ for (Mob m : zone.zoneMobSet) {
+
+ if (m != null) {
+ String out = m.getName() + '(' + m.getDBID() + "): ";
+ if (m.isAlive())
+ out += m.getLoc().x + "x" + m.getLoc().z + "; isAlive: " + m.isAlive();
+ else
+ out += " isAlive: " + m.isAlive();
+ throwbackInfo(pcSender, out);
+ } else
+ throwbackInfo(pcSender, "Unknown (" + m.getDBID() + "): not loaded");
+ }
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /getzonemobs [zoneID]'";
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "lists all mobs for a zone";
+ }
}
diff --git a/src/engine/devcmd/cmds/GotoBoundsCmd.java b/src/engine/devcmd/cmds/GotoBoundsCmd.java
index ae10766b..67004d26 100644
--- a/src/engine/devcmd/cmds/GotoBoundsCmd.java
+++ b/src/engine/devcmd/cmds/GotoBoundsCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -19,90 +18,90 @@ import engine.objects.PlayerCharacter;
public class GotoBoundsCmd extends AbstractDevCmd {
- public GotoBoundsCmd() {
+ public GotoBoundsCmd() {
super("gotobounds");
}
- @Override
- protected void _doCmd(PlayerCharacter player, String[] words,
- AbstractGameObject target) {
-
- String corner = words[0];
- Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
-
- if (target == null || !target.getObjectType().equals(GameObjectType.Building)){
- this.throwbackError(player, "No Building Selected");
- return;
- }
-
- Building building = (Building)target;
-
- if (building.getBounds() == null){
- this.throwbackInfo(player, "No valid Bounds for building UUID " + building.getObjectUUID());
- return;
- }
- float x = building.getBounds().getHalfExtents().x;
- float z = building.getBounds().getHalfExtents().y;
-
- if (building.getBlueprint() != null){
- x = building.getBlueprint().getExtents().x;
- z = building.getBlueprint().getExtents().y;
- }
-
- float topLeftX = building.getLoc().x - x;
- float topLeftY = building.getLoc().z -z;
-
- float topRightX = building.getLoc().x + x;
- float topRightY = building.getLoc().z - z;
-
- float bottomLeftX = building.getLoc().x - x;
- float bottomLeftY = building.getLoc().z + z;
-
- float bottomRightX = building.getLoc().x +x;
- float bottomRightY = building.getLoc().z + z;
-
-
- switch (corner){
- case "topleft":
- targetLoc = new Vector3fImmutable(topLeftX, 0, topLeftY);
- break;
- case "topright":
- targetLoc = new Vector3fImmutable(topRightX, 0, topRightY);
- break;
- case "bottomleft":
- targetLoc = new Vector3fImmutable(bottomLeftX, 0, bottomLeftY);
- break;
- case "bottomright":
- targetLoc = new Vector3fImmutable(bottomRightX, 0, bottomRightY);
- break;
- default:
- this.throwbackInfo(player, "wrong corner name. use topleft , topright , bottomleft , bottomright");
- return;
-
- }
-
- targetLoc = Vector3fImmutable.transform(building.getLoc(),targetLoc , building.getBounds().getRotationDegrees());
-
- // Teleport player
-
- if (targetLoc == Vector3fImmutable.ZERO) {
- this.throwbackError(player, "Failed to locate UUID");
- return;
- }
-
- player.teleport(targetLoc);
-
- }
-
- @Override
- protected String _getHelpString() {
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] words,
+ AbstractGameObject target) {
+
+ String corner = words[0];
+ Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
+
+ if (target == null || !target.getObjectType().equals(GameObjectType.Building)) {
+ this.throwbackError(player, "No Building Selected");
+ return;
+ }
+
+ Building building = (Building) target;
+
+ if (building.getBounds() == null) {
+ this.throwbackInfo(player, "No valid Bounds for building UUID " + building.getObjectUUID());
+ return;
+ }
+ float x = building.getBounds().getHalfExtents().x;
+ float z = building.getBounds().getHalfExtents().y;
+
+ if (building.getBlueprint() != null) {
+ x = building.getBlueprint().getExtents().x;
+ z = building.getBlueprint().getExtents().y;
+ }
+
+ float topLeftX = building.getLoc().x - x;
+ float topLeftY = building.getLoc().z - z;
+
+ float topRightX = building.getLoc().x + x;
+ float topRightY = building.getLoc().z - z;
+
+ float bottomLeftX = building.getLoc().x - x;
+ float bottomLeftY = building.getLoc().z + z;
+
+ float bottomRightX = building.getLoc().x + x;
+ float bottomRightY = building.getLoc().z + z;
+
+
+ switch (corner) {
+ case "topleft":
+ targetLoc = new Vector3fImmutable(topLeftX, 0, topLeftY);
+ break;
+ case "topright":
+ targetLoc = new Vector3fImmutable(topRightX, 0, topRightY);
+ break;
+ case "bottomleft":
+ targetLoc = new Vector3fImmutable(bottomLeftX, 0, bottomLeftY);
+ break;
+ case "bottomright":
+ targetLoc = new Vector3fImmutable(bottomRightX, 0, bottomRightY);
+ break;
+ default:
+ this.throwbackInfo(player, "wrong corner name. use topleft , topright , bottomleft , bottomright");
+ return;
+
+ }
+
+ targetLoc = Vector3fImmutable.transform(building.getLoc(), targetLoc, building.getBounds().getRotationDegrees());
+
+ // Teleport player
+
+ if (targetLoc == Vector3fImmutable.ZERO) {
+ this.throwbackError(player, "Failed to locate UUID");
+ return;
+ }
+
+ player.teleport(targetLoc);
+
+ }
+
+ @Override
+ protected String _getHelpString() {
return "Teleports player to a UUID";
- }
+ }
- @Override
- protected String _getUsageString() {
- return "' /gotoobj '";
+ @Override
+ protected String _getUsageString() {
+ return "' /gotoobj '";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/GotoCmd.java b/src/engine/devcmd/cmds/GotoCmd.java
index 3825ae4a..95ab5f93 100644
--- a/src/engine/devcmd/cmds/GotoCmd.java
+++ b/src/engine/devcmd/cmds/GotoCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -22,161 +21,161 @@ import java.util.concurrent.ThreadLocalRandom;
public class GotoCmd extends AbstractDevCmd {
- public GotoCmd() {
+ public GotoCmd() {
super("goto");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- Vector3fImmutable loc = null;
-
- // Arg Count Check
-
-
- if (target != null && words[0].isEmpty()){
- AbstractWorldObject targetAgo = (AbstractWorldObject)target;
- pc.teleport(targetAgo.getLoc());
- return;
- }
-
- if (words[0].isEmpty()){
- this.sendUsage(pc);
- return;
- }
-
- if (words[0].equalsIgnoreCase("playground")){
- if (target instanceof AbstractCharacter){
- loc = new Vector3fImmutable(63276,0,-54718);
- }
-
- if (loc != null)
- pc.teleport(loc);
-
- return;
- }
-
- if (words[0].equalsIgnoreCase("coc")){
- if (target instanceof AbstractCharacter){
- loc = new Vector3fImmutable(98561.656f,0,-13353.778f);
- }
-
- if (loc != null)
- pc.teleport(loc);
-
- return;
- }
-
- String cityName = "";
- for (String partial: words){
- cityName += partial + ' ';
- }
-
- cityName = cityName.substring(0, cityName.length() - 1);
-
- for (AbstractGameObject cityAgo: DbManager.getList(GameObjectType.City)){
- City city = (City)cityAgo;
- if (city == null)
- continue;
- if (!city.getCityName().equalsIgnoreCase(cityName))
- continue;
- Zone zone = city.getParent();
- if (zone != null){
- if (zone.isNPCCity() || zone.isPlayerCity())
- loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
- else
- loc = zone.getLoc();
-
- int random = ThreadLocalRandom.current().nextInt(5);
- if (random == 1)
- break;
- }
- }
-
- if (loc == null){
- for (AbstractGameObject zoneAgo: DbManager.getList(GameObjectType.Zone)){
- Zone zone = (Zone)zoneAgo;
- if (zone == null)
- continue;
- if (!zone.getName().equalsIgnoreCase(cityName))
- continue;
- if (zone != null){
- if (zone.isNPCCity() || zone.isPlayerCity())
- loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
- else
- loc = zone.getLoc();
-
- int random = ThreadLocalRandom.current().nextInt(5);
- if (random == 1)
- break;
- }
- }
- }
- if (loc == null && words.length == 1){
-
- try {
- PlayerCharacter pcDest = SessionManager
- .getPlayerCharacterByLowerCaseName(words[0]);
- if (pcDest == null){
- this.throwbackError(pc, "Player or Zone not found by name: "
- + words[0]);
- this.throwbackInfo(pc, "If you have spaces in the zone name, replace them with '_'");
- return;
- }
-
- if (pcDest.getCombinedName().equals(pc.getCombinedName())) {
- this
- .throwbackError(pc,
- "Cannot goto yourself. Well, you can, but you wont go anywhere.");
- return;
- }
-
- loc = pcDest.getLoc();
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to goto a character named '"
- + words[0] + '\'');
- return;
- }
-
- }
- if (loc == null) { // lat lon mode
- if (words.length != 2) {
- throwbackError(pc, this.getUsageString());
- return;
- }
- float lat = 0.0f, lon = 0.0f;
- String latLong = '\'' + words[0] + ", " + words[1] + '\'';
-
- try {
- lat = Float.parseFloat(words[0]);
- lon = Float.parseFloat(words[1]);
- loc = new Vector3fImmutable(lat, 0f, -lon);
- } catch (NumberFormatException e) {
- this.throwbackError(pc, "Supplied LatLong: " + latLong
- + " failed to parse to Floats");
- return;
-
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to goto LatLong of "
- + latLong);
- return;
- }
- }
- if (loc != null) {
- pc.teleport(loc);
- }
- }
-
- @Override
- protected String _getHelpString() {
- return "Alters your characters position TO 'lat' and 'long', or TO the position of 'characterName'. This does not transport you BY 'lat' and 'long', but rather TO 'lat' and 'long' ";
- }
-
- @Override
- protected String _getUsageString() {
- return "'[ /goto lat lon] || [ /goto characterName] || [/goto zoneName \replace spaces with `_`]`";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ Vector3fImmutable loc = null;
+
+ // Arg Count Check
+
+
+ if (target != null && words[0].isEmpty()) {
+ AbstractWorldObject targetAgo = (AbstractWorldObject) target;
+ pc.teleport(targetAgo.getLoc());
+ return;
+ }
+
+ if (words[0].isEmpty()) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ if (words[0].equalsIgnoreCase("playground")) {
+ if (target instanceof AbstractCharacter) {
+ loc = new Vector3fImmutable(63276, 0, -54718);
+ }
+
+ if (loc != null)
+ pc.teleport(loc);
+
+ return;
+ }
+
+ if (words[0].equalsIgnoreCase("coc")) {
+ if (target instanceof AbstractCharacter) {
+ loc = new Vector3fImmutable(98561.656f, 0, -13353.778f);
+ }
+
+ if (loc != null)
+ pc.teleport(loc);
+
+ return;
+ }
+
+ String cityName = "";
+ for (String partial : words) {
+ cityName += partial + ' ';
+ }
+
+ cityName = cityName.substring(0, cityName.length() - 1);
+
+ for (AbstractGameObject cityAgo : DbManager.getList(GameObjectType.City)) {
+ City city = (City) cityAgo;
+ if (city == null)
+ continue;
+ if (!city.getCityName().equalsIgnoreCase(cityName))
+ continue;
+ Zone zone = city.getParent();
+ if (zone != null) {
+ if (zone.isNPCCity() || zone.isPlayerCity())
+ loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
+ else
+ loc = zone.getLoc();
+
+ int random = ThreadLocalRandom.current().nextInt(5);
+ if (random == 1)
+ break;
+ }
+ }
+
+ if (loc == null) {
+ for (AbstractGameObject zoneAgo : DbManager.getList(GameObjectType.Zone)) {
+ Zone zone = (Zone) zoneAgo;
+ if (zone == null)
+ continue;
+ if (!zone.getName().equalsIgnoreCase(cityName))
+ continue;
+ if (zone != null) {
+ if (zone.isNPCCity() || zone.isPlayerCity())
+ loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
+ else
+ loc = zone.getLoc();
+
+ int random = ThreadLocalRandom.current().nextInt(5);
+ if (random == 1)
+ break;
+ }
+ }
+ }
+ if (loc == null && words.length == 1) {
+
+ try {
+ PlayerCharacter pcDest = SessionManager
+ .getPlayerCharacterByLowerCaseName(words[0]);
+ if (pcDest == null) {
+ this.throwbackError(pc, "Player or Zone not found by name: "
+ + words[0]);
+ this.throwbackInfo(pc, "If you have spaces in the zone name, replace them with '_'");
+ return;
+ }
+
+ if (pcDest.getCombinedName().equals(pc.getCombinedName())) {
+ this
+ .throwbackError(pc,
+ "Cannot goto yourself. Well, you can, but you wont go anywhere.");
+ return;
+ }
+
+ loc = pcDest.getLoc();
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to goto a character named '"
+ + words[0] + '\'');
+ return;
+ }
+
+ }
+ if (loc == null) { // lat lon mode
+ if (words.length != 2) {
+ throwbackError(pc, this.getUsageString());
+ return;
+ }
+ float lat = 0.0f, lon = 0.0f;
+ String latLong = '\'' + words[0] + ", " + words[1] + '\'';
+
+ try {
+ lat = Float.parseFloat(words[0]);
+ lon = Float.parseFloat(words[1]);
+ loc = new Vector3fImmutable(lat, 0f, -lon);
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Supplied LatLong: " + latLong
+ + " failed to parse to Floats");
+ return;
+
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to goto LatLong of "
+ + latLong);
+ return;
+ }
+ }
+ if (loc != null) {
+ pc.teleport(loc);
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Alters your characters position TO 'lat' and 'long', or TO the position of 'characterName'. This does not transport you BY 'lat' and 'long', but rather TO 'lat' and 'long' ";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "'[ /goto lat lon] || [ /goto characterName] || [/goto zoneName \replace spaces with `_`]`";
+ }
}
diff --git a/src/engine/devcmd/cmds/GotoObj.java b/src/engine/devcmd/cmds/GotoObj.java
index 2b535564..e6e69b8c 100644
--- a/src/engine/devcmd/cmds/GotoObj.java
+++ b/src/engine/devcmd/cmds/GotoObj.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum;
@@ -18,86 +17,86 @@ import engine.objects.*;
public class GotoObj extends AbstractDevCmd {
- public GotoObj() {
+ public GotoObj() {
super("gotoobj");
}
- @Override
- protected void _doCmd(PlayerCharacter player, String[] words,
- AbstractGameObject target) {
-
- int uuid;
- Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
- Enum.DbObjectType objectType;
-
- try {
- uuid = Integer.parseInt(words[0]);
- } catch (NumberFormatException e) {
- this.throwbackError(player, "Failed to parse UUID" + e.toString());
- return;
- }
-
- objectType = DbManager.BuildingQueries.GET_UID_ENUM(uuid);
-
- switch (objectType) {
-
- case NPC:
- NPC npc = (NPC) DbManager.getFromCache(Enum.GameObjectType.NPC, uuid);
-
- if (npc != null)
- targetLoc = npc.getLoc();
- break;
- case MOB:
- Mob mob = (Mob) DbManager.getFromCache(Enum.GameObjectType.Mob, uuid);
-
- if (mob != null)
- targetLoc = mob.getLoc();
- break;
- case CHARACTER:
- PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, uuid);
-
- if (playerCharacter != null)
- targetLoc = playerCharacter.getLoc();
- break;
- case BUILDING:
- Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
-
- if (building != null)
- targetLoc = building.getLoc();
- break;
- case ZONE:
- Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, uuid);
-
- if (zone != null)
- targetLoc = zone.getLoc();
- break;
- case CITY:
- City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, uuid);
-
- if (city != null)
- targetLoc = city.getLoc();
- break;
- }
- // Teleport player
-
- if (targetLoc == Vector3fImmutable.ZERO) {
- this.throwbackError(player, "Failed to locate UUID");
- return;
- }
-
- player.teleport(targetLoc);
-
- }
-
- @Override
- protected String _getHelpString() {
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] words,
+ AbstractGameObject target) {
+
+ int uuid;
+ Vector3fImmutable targetLoc = Vector3fImmutable.ZERO;
+ Enum.DbObjectType objectType;
+
+ try {
+ uuid = Integer.parseInt(words[0]);
+ } catch (NumberFormatException e) {
+ this.throwbackError(player, "Failed to parse UUID" + e.toString());
+ return;
+ }
+
+ objectType = DbManager.BuildingQueries.GET_UID_ENUM(uuid);
+
+ switch (objectType) {
+
+ case NPC:
+ NPC npc = (NPC) DbManager.getFromCache(Enum.GameObjectType.NPC, uuid);
+
+ if (npc != null)
+ targetLoc = npc.getLoc();
+ break;
+ case MOB:
+ Mob mob = (Mob) DbManager.getFromCache(Enum.GameObjectType.Mob, uuid);
+
+ if (mob != null)
+ targetLoc = mob.getLoc();
+ break;
+ case CHARACTER:
+ PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, uuid);
+
+ if (playerCharacter != null)
+ targetLoc = playerCharacter.getLoc();
+ break;
+ case BUILDING:
+ Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
+
+ if (building != null)
+ targetLoc = building.getLoc();
+ break;
+ case ZONE:
+ Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, uuid);
+
+ if (zone != null)
+ targetLoc = zone.getLoc();
+ break;
+ case CITY:
+ City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, uuid);
+
+ if (city != null)
+ targetLoc = city.getLoc();
+ break;
+ }
+ // Teleport player
+
+ if (targetLoc == Vector3fImmutable.ZERO) {
+ this.throwbackError(player, "Failed to locate UUID");
+ return;
+ }
+
+ player.teleport(targetLoc);
+
+ }
+
+ @Override
+ protected String _getHelpString() {
return "Teleports player to a UUID";
- }
+ }
- @Override
- protected String _getUsageString() {
- return "' /gotoobj '";
+ @Override
+ protected String _getUsageString() {
+ return "' /gotoobj '";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/HeartbeatCmd.java b/src/engine/devcmd/cmds/HeartbeatCmd.java
index 4a8584cb..84afaba6 100644
--- a/src/engine/devcmd/cmds/HeartbeatCmd.java
+++ b/src/engine/devcmd/cmds/HeartbeatCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.ai.MobileFSMManager;
@@ -18,30 +17,30 @@ import engine.objects.PlayerCharacter;
public class HeartbeatCmd extends AbstractDevCmd {
- public HeartbeatCmd() {
+ public HeartbeatCmd() {
super("heartbeat");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- this.throwbackInfo(pc, "Heartbeat : " + SimulationManager.executionTime.toMillis() + "ms");
- this.throwbackInfo(pc, "Heartbeat Max: " + SimulationManager.executionMax.toMillis() + "ms");
+ this.throwbackInfo(pc, "Heartbeat : " + SimulationManager.executionTime.toMillis() + "ms");
+ this.throwbackInfo(pc, "Heartbeat Max: " + SimulationManager.executionMax.toMillis() + "ms");
- this.throwbackInfo(pc, "FSM: " + MobileFSMManager.executionTime.toMillis() + "ms");
- this.throwbackInfo(pc, "FSM max: " + MobileFSMManager.executionMax.toMillis() + "ms");
+ this.throwbackInfo(pc, "FSM: " + MobileFSMManager.executionTime.toMillis() + "ms");
+ this.throwbackInfo(pc, "FSM max: " + MobileFSMManager.executionMax.toMillis() + "ms");
- }
+ }
- @Override
- protected String _getHelpString() {
- return "Displays simulation metrics";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Displays simulation metrics";
+ }
- @Override
- protected String _getUsageString() {
- return "' ./heartbeat";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' ./heartbeat";
+ }
}
diff --git a/src/engine/devcmd/cmds/HelpCmd.java b/src/engine/devcmd/cmds/HelpCmd.java
index 4c3d49f0..b0fe83e3 100644
--- a/src/engine/devcmd/cmds/HelpCmd.java
+++ b/src/engine/devcmd/cmds/HelpCmd.java
@@ -16,14 +16,14 @@ import engine.objects.PlayerCharacter;
public class HelpCmd extends AbstractDevCmd {
- public HelpCmd() {
- super("help");
- this.addCmdString("list");
- }
-
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
+ public HelpCmd() {
+ super("help");
+ this.addCmdString("list");
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
if (pcSender == null)
return;
if (pcSender.getAccount() == null)
@@ -42,18 +42,18 @@ public class HelpCmd extends AbstractDevCmd {
first = charLimit;
charLimit += 500;
last = charLimit;
- }
- this.throwbackInfo(pcSender, commands.substring(first));
- }
+ }
+ this.throwbackInfo(pcSender, commands.substring(first));
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /help' || ' /list'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Displays help info and lists all commands accessible for the player's access level.";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/HotzoneCmd.java b/src/engine/devcmd/cmds/HotzoneCmd.java
index 5a8bb7b5..2aa88f14 100644
--- a/src/engine/devcmd/cmds/HotzoneCmd.java
+++ b/src/engine/devcmd/cmds/HotzoneCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -63,6 +62,7 @@ public class HotzoneCmd extends AbstractDevCmd {
return;
}
+
@Override
protected String _getHelpString() {
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java
index 926af745..6a95992b 100644
--- a/src/engine/devcmd/cmds/InfoCmd.java
+++ b/src/engine/devcmd/cmds/InfoCmd.java
@@ -26,515 +26,514 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* @author
- *
*/
public class InfoCmd extends AbstractDevCmd {
- public InfoCmd() {
- super("info");
- }
-
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
- if (pc == null) {
- return;
- }
-
- String newline = "\r\n ";
-
- try {
- int targetID = Integer.parseInt(words[0]);
- Building b = BuildingManager.getBuilding(targetID);
- if (b == null)
- throwbackError(pc, "Building with ID " + targetID
- + " not found");
- else
- target = b;
- } catch (Exception e) {
- }
-
- if (target == null) {
- throwbackError(pc, "Target is unknown or of an invalid type."
- + newline + "Type ID: 0x"
- + pc.getLastTargetType().toString()
- + " Table ID: " + pc.getLastTargetID());
- return;
- }
-
-
- GameObjectType objType = target.getObjectType();
- int objectUUID = target.getObjectUUID();
- String output;
-
- output = "Target Information:" + newline;
- output += StringUtils.addWS("UUID: " + objectUUID, 20);
- output += newline;
- output += "Type: " + target.getClass().getSimpleName();
- output += " [0x" + objType.toString() + ']';
-
- if (target instanceof AbstractWorldObject) {
- AbstractWorldObject targetAWO = (AbstractWorldObject) target;
- Vector3fImmutable targetLoc = targetAWO.getLoc();
- output += newline;
- output += StringUtils.addWS("Lat: " + targetLoc.x, 20);
- output += "Lon: " + -targetLoc.z;
- output += newline;
- output += StringUtils.addWS("Alt: " + targetLoc.y, 20);
- output += newline;
- output += "Rot: " + targetAWO.getRot().y;
- output += newline;
- double radian = 0;
-
-
- if (targetAWO.getBounds() != null && targetAWO.getBounds().getQuaternion() != null)
- radian = targetAWO.getBounds().getQuaternion().angleY;
- int degrees = (int) Math.toDegrees(radian);
-
-
- output += "Degrees: " + degrees;
- output += newline;
- }
-
- switch (objType) {
- case Building:
- Building targetBuilding = (Building) target;
- output += StringUtils.addWS("Lac: "
- + targetBuilding.getw(), 20);
- output += "Blueprint : ";
- output += targetBuilding.getBlueprintUUID();
- output += newline;
-
- output += " MeshUUID : ";
- output += targetBuilding.getMeshUUID();
- output += newline;
-
- if (targetBuilding.getBlueprintUUID() != 0)
- output += ' ' + targetBuilding.getBlueprint().getName();
-
- output += newline;
- output += targetBuilding.getBlueprint() != null ? targetBuilding.getBlueprint().getBuildingGroup().name(): " no building group";
-
- output += newline;
- output += "EffectFlags: " + targetBuilding.getEffectFlags();
- output += newline;
- output += StringUtils.addWS("rank: " + targetBuilding.getRank(),
- 20);
- output += "HP: " + targetBuilding.getHealth() + '/'
- + targetBuilding.getMaxHitPoints();
- output += newline;
- output += "Scale: (" + targetBuilding.getMeshScale().getX();
- output += ", " + targetBuilding.getMeshScale().getY();
- output += ", " + targetBuilding.getMeshScale().getZ() + ')';
- output += newline;
- output += "Owner UID: " + targetBuilding.getOwnerUUID();
- output += (targetBuilding.isOwnerIsNPC() ? " (NPC)" : " (PC)");
- output += newline;
- output += "ProtectionState: " + targetBuilding.getProtectionState().name();
- output += newline;
-
- if (targetBuilding.getUpgradeDateTime() != null) {
- output += targetBuilding.getUpgradeDateTime().toString();
- output += newline;
- }
-
- Guild guild = targetBuilding.getGuild();
- Guild nation = null;
- String guildId = "-1";
- String nationId = "-1";
- String gTag = "";
- String nTag = "";
-
- if (guild != null) {
- int id = guild.getObjectUUID();
-
- if (id == 0) {
- guildId = id + " [" + guild.hashCode() + ']';
- } else
- guildId = Integer.toString(id);
-
- gTag = guild.getGuildTag().summarySentence();
- nation = guild.getNation();
-
- if (nation != null) {
- id = nation.getObjectUUID();
- if (id == 0) {
- nationId = id + " [" + nation.hashCode() + ']';
- } else {
- nationId = Integer.toString(id);
- }
- nTag = nation.getGuildTag().summarySentence();
- }
- }
- output += StringUtils.addWS("Guild UID: " + guildId, 20);
-
- if (gTag.length() > 0)
- output += "Guild crest: " + gTag;
-
- output += newline;
- output += StringUtils.addWS("Nation UID: " + nationId, 20);
-
- if (nTag.length() > 0) {
- output += "Nation crest: " + nTag;
- }
-
- output+= newline;
-
-
- if (targetBuilding.getBlueprint() != null){
-
- if(targetBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.MINE){
- Mine mine = Mine.getMineFromTower(targetBuilding.getObjectUUID());
-
- if (mine != null){
- output+= newline;
- output+= "Mine active: " + mine.getIsActive();
- output+= newline;
- output+= "Was claimed: " + mine.wasClaimed;
- output+= newline;
- output+= "Mine Type: "+mine.getMineType().name;
- output+= newline;
- output+= "Expansion : " + mine.isExpansion();
- output+= newline;
- output+= "Production type: " +mine.getProduction().name();
-
- }
- }
- output += newline;
-
- if (targetBuilding.maintDateTime != null){
- output += targetBuilding.maintDateTime.toString();
- output+= newline;
- }
- }
-
- output += "Reserve : " + targetBuilding.reserve;
- output+= newline;
- output += "Strongbox : " + targetBuilding.getStrongboxValue();
- output+= newline;
-
- // List hirelings
-
- if (targetBuilding.getHirelings().isEmpty() == false) {
-
- output += newline;
- output += "Hirelings List: name / slot / floor";
-
- for (AbstractCharacter npc : targetBuilding.getHirelings().keySet()) {
-
- if (npc.getObjectType() != GameObjectType.NPC)
- continue;
- output += newline + npc.getName() + " slot " + targetBuilding.getHirelings().get(npc);
- output += newline + "location " + npc.getLoc();
- }
- }
-
- ArrayList tempList = BuildingRegions._staticRegions.get(targetBuilding.getMeshUUID());
- output+= newline;
- output+= "Building Regions: Size - " + tempList.size();
- output+= newline;
- output+= "Building Regions from Bounds: Size - " + targetBuilding.getBounds().getRegions().size();
- output+= newline;
-
- for (Regions regions: targetBuilding.getBounds().getRegions()){
- //TODO ADD REGION INFO
- }
-
- break;
- case PlayerCharacter:
- output += newline;
- PlayerCharacter targetPC = (PlayerCharacter) target;
- output += StringUtils.addWS("Name: " + targetPC.getName(), 20);
- output += newline;
- output += "InSession : " + SessionManager.getPlayerCharacterByID(target.getObjectUUID()) != null ? " true " : " false";
- output += newline;
- output += "RaceType: " + targetPC.getRace().getRaceType().name();
- output += newline;
- output += "Race: " + targetPC.getRace().getName();
- output += newline;
- output += "Safe:" + targetPC.inSafeZone();
- output+= newline;
- output+= "Experience : " + targetPC.getExp();
+ public InfoCmd() {
+ super("info");
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
+ if (pc == null) {
+ return;
+ }
+
+ String newline = "\r\n ";
+
+ try {
+ int targetID = Integer.parseInt(words[0]);
+ Building b = BuildingManager.getBuilding(targetID);
+ if (b == null)
+ throwbackError(pc, "Building with ID " + targetID
+ + " not found");
+ else
+ target = b;
+ } catch (Exception e) {
+ }
+
+ if (target == null) {
+ throwbackError(pc, "Target is unknown or of an invalid type."
+ + newline + "Type ID: 0x"
+ + pc.getLastTargetType().toString()
+ + " Table ID: " + pc.getLastTargetID());
+ return;
+ }
+
+
+ GameObjectType objType = target.getObjectType();
+ int objectUUID = target.getObjectUUID();
+ String output;
+
+ output = "Target Information:" + newline;
+ output += StringUtils.addWS("UUID: " + objectUUID, 20);
+ output += newline;
+ output += "Type: " + target.getClass().getSimpleName();
+ output += " [0x" + objType.toString() + ']';
+
+ if (target instanceof AbstractWorldObject) {
+ AbstractWorldObject targetAWO = (AbstractWorldObject) target;
+ Vector3fImmutable targetLoc = targetAWO.getLoc();
output += newline;
- output += "OverFlowExperience : " + targetPC.getOverFlowEXP();
+ output += StringUtils.addWS("Lat: " + targetLoc.x, 20);
+ output += "Lon: " + -targetLoc.z;
output += newline;
- output += StringUtils.addWS("Level: "
- + targetPC.getLevel() + " (" +
- TargetColor.getCon(targetPC, pc).toString() + ')', 20);
+ output += StringUtils.addWS("Alt: " + targetLoc.y, 20);
+ output += newline;
+ output += "Rot: " + targetAWO.getRot().y;
+ output += newline;
+ double radian = 0;
- Account acpc = SessionManager.getAccount(pc);
- Account ac = SessionManager.getAccount(targetPC);
- if (acpc != null && ac != null) {
- output += "Account ID: " + ac.getObjectUUID();
- output += newline;
- output += "Access Level: " + ac.status.name();
- } else
- output += "Account ID: UNKNOWN";
+ if (targetAWO.getBounds() != null && targetAWO.getBounds().getQuaternion() != null)
+ radian = targetAWO.getBounds().getQuaternion().angleY;
+ int degrees = (int) Math.toDegrees(radian);
+
+ output += "Degrees: " + degrees;
output += newline;
- output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
- output += newline;
- output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
- output += newline;
- output += "ALTITUDE :"+ targetPC.getAltitude();
- output += newline;
- output += "BuildingID :"+ targetPC.getInBuildingID();
- output += newline;
- output += "inBuilding :"+ targetPC.getInBuilding();
- output += newline;
- output += "inFloor :"+ targetPC.getInFloorID();
- output += newline;
-
- BaseClass baseClass = targetPC.getBaseClass();
-
- if (baseClass != null)
- output += StringUtils.addWS("Class: " + baseClass.getName(), 20);
- else
- output += StringUtils.addWS("", 20);
-
- PromotionClass promotionClass = targetPC.getPromotionClass();
- if (promotionClass != null) {
- output += "Pro. Class: " + promotionClass.getName();
- } else {
- output += "Pro. Class: ";
- }
-
- output += newline;
- output += "====Guild Info====";
- output += newline;
-
- if (targetPC.getGuild() != null){
- output += "Name: " + targetPC.getGuild().getName();
- output += newline;
- output += "State: " + targetPC.getGuild().getGuildState();
- output += newline;
- output += "Realms Owned:" +targetPC.getGuild().getRealmsOwned();
- output += newline;
- output += "====Nation====";
- output += newline;
- output += "Nation Name: " + targetPC.getGuild().getNation().getName();
- output += newline;
- output += "Nation State: " + targetPC.getGuild().getNation().getGuildState();
- output += newline;
- output += "Realms Owned:" +targetPC.getGuild().getNation().getRealmsOwned();
- output += newline;
- output += "Guild Rank:" +(GuildStatusController.getRank(targetPC.getGuildStatus()) + targetPC.getGuild().getRealmsOwnedFlag());
- }
-
- output += newline;
- output += "Movement State: " + targetPC.getMovementState().name();
- output += newline;
- output += "Movement Speed: " + targetPC.getSpeed();
-
- output += "Altitude : " + targetPC.getLoc().y;
-
- output += "Swimming : " + targetPC.isSwimming();
- output += newline;
- output += "isMoving : " + targetPC.isMoving();
-
- break;
-
- case NPC:
- NPC targetNPC = (NPC) target;
- output += "databaseID: " + targetNPC.getDBID() + newline;
- output += "Name: " + targetNPC.getName();
- output += newline;
- output += StringUtils.addWS("Level: " + targetNPC.getLevel(), 20);
-
- MobBase mobBase;
-
- if (targetNPC.getContract() == null)
- mobBase = targetNPC.getMobBase();
- else
- mobBase = MobBase.getMobBase(targetNPC.getContract().getMobbaseID());
-
- if (mobBase != null) {
- output += "Mobbbase: " + mobBase.getObjectUUID();
- output += newline;
- output += "Flags: " + mobBase.getFlags().toString();
- }
-
- output += newline;
- output += "Spawn: (" + targetNPC.getBindLoc().getX();
- output += ", " + targetNPC.getBindLoc().getY();
- output += ", " + targetNPC.getBindLoc().getZ() + ')';
- output += newline;
- output += "ContractID: " + targetNPC.getContractID();
- output += newline;
- output += "InventorySet: " + targetNPC.getContract().inventorySet;
- output += newline;
- output += targetNPC.getContract().getAllowedBuildings().toString();
- output += newline;
- output += "Extra Rune: " + targetNPC.getContract().getExtraRune();
-
- output += newline;
- output += "isTrainer: " + targetNPC.getContract().isTrainer();
- output += newline;
- output += "Buy Cost: " + targetNPC.getBuyPercent();
- output += "\tSell Cost: " + targetNPC.getSellPercent();
- output += newline;
- output += "fromInit: " + targetNPC.isStatic();
- output += newline;
- if (mobBase != null) {
- output += newline;
- output += "Slottable: " + targetNPC.getContract().getAllowedBuildings().toString();
- output += newline;
- output += "EquipSet: " + targetNPC.getEquipmentSetID();
- output += newline;
- output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
-
- }
-
- if (targetNPC.region != null) {
- output += newline;
- output += "Region found: " + "Building : " + targetNPC.region.parentBuildingID + newline;
- output += "building level : " + targetNPC.region.level + newline;
- output += "building room : " + targetNPC.region.room + newline;
- } else {
- output += newline;
- output += "No region was found.";
- }
-
- if (targetNPC.getBuilding() != null) {
- output += newline;
- output += "Building : " + targetNPC.getBuilding();
- } else {
- output += newline;
- output += "No building found.";
- }
- break;
- case Mob:
- Mob targetMob = (Mob) target;
- output += "databaseID: " + targetMob.getDBID() + newline;
- output += "Name: " + targetMob.getName();
- output += newline;
- output += StringUtils.addWS("Level: " + targetMob.getLevel(), 20);
- mobBase = targetMob.getMobBase();
- if (mobBase != null)
- output += "RaceID: " + mobBase.getObjectUUID();
- else
- output += "RaceID: " + targetMob.getLoadID();
- output += newline;
- try {
- output += "notEnemy: " + targetMob.notEnemy.toString();
- output += newline;
- output += "enemy: " + targetMob.enemy.toString();
- output += newline;
- }
- catch(Exception ex){
- //who cares its info
- }
- output += "Spawn: (" + targetMob.getBindLoc().getX();
- output += ", " + targetMob.getBindLoc().getY();
- output += ", " + targetMob.getBindLoc().getZ() + ')';
- output += newline;
- if (targetMob.isPet()) {
- output += "isPet: true";
- output+= newline;
- if (targetMob.isSummonedPet())
- output += "isSummonedPet: true";
- else output += "isSummonedPet: false";
- PlayerCharacter owner = targetMob.getOwner();
- if (owner != null)
- output += " owner: " + owner.getObjectUUID();
- output += newline;
- output += "assist: " + targetMob.assist() + " resting: " + targetMob.isSit();
- output += newline;
- }
- if (targetMob.getMobBase() != null) {
- output += "Mobbase: " + targetMob.getMobBase().getObjectUUID();
- output += newline;
- output += "Flags: " + targetMob.getMobBase().getFlags().toString();
- output += newline;
-
- }
- if (targetMob.isMob()) {
- output += "SpawnRadius: " + targetMob.getSpawnRadius();
- output += newline;
- output += "Spawn Timer: " + targetMob.getSpawnTimeAsString();
- output += newline;
- }
- output += StringUtils.addWS("isAlive: "
- + targetMob.isAlive(), 20);
- output += newline;
- //output += "Mob State: " + targetMob.state.name();
-
- output += newline;
- output += "Speed : " + targetMob.getSpeed();
- output += newline;
- output += "EquipSet: " + targetMob.equipmentSetID;
- output += newline;
- try {
- output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
- } catch(Exception ex){
- //who cares
- }
- output += newline;
- output += "isMoving : " + targetMob.isMoving();
- if (targetMob.region != null) {
- output += newline;
- output += "BuildingID : " + targetMob.region.parentBuildingID;
- output += "building level : " + targetMob.region.level;
- output += "building room : " + targetMob.region.room;
- }
- if (targetMob.building != null) {
- output += "Building Name: " + targetMob.building.getName() + newline;
- output += "BuildingID : " + targetMob.building + newline;
- output += "Bind Loc : " + targetMob.getBindLoc() + newline;
- output += "Curr Loc : " + targetMob.getLoc() + newline;
- }else{
- output += newline;
- output += "No building found.";
- }
- break;
- case Item: //intentional passthrough
- case MobLoot:
- Item item = (Item) target;
- ItemBase itemBase = item.getItemBase();
- output += StringUtils.addWS("ItemBase: " + itemBase.getUUID(), 20);
- output += "Weight: " + itemBase.getWeight();
- output += newline;
- DecimalFormat df = new DecimalFormat("###,###,###,###,##0");
- output += StringUtils.addWS("Qty: "
- + df.format(item.getNumOfItems()), 20);
- output += "Charges: " + item.getChargesRemaining()
- + '/' + item.getChargesMax();
- output += newline;
- output += "Name: " + itemBase.getName();
- output += newline;
- output += item.getContainerInfo();
-
- throwbackInfo(pc, output);
-
- output = "Effects:" + newline;
- ConcurrentHashMap effects = item.getEffects();
- for (String name : effects.keySet()) {
- Effect eff = effects.get(name);
- output+= eff.getEffectsBase().getIDString();
- output+= newline;
- // output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
- }
-
- break;
- }
-
- throwbackInfo(pc, output);
- }
-
- @Override
- protected String _getHelpString() {
- return "Gets information on an Object.";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /info targetID'";
- }
+ }
+
+ switch (objType) {
+ case Building:
+ Building targetBuilding = (Building) target;
+ output += StringUtils.addWS("Lac: "
+ + targetBuilding.getw(), 20);
+ output += "Blueprint : ";
+ output += targetBuilding.getBlueprintUUID();
+ output += newline;
+
+ output += " MeshUUID : ";
+ output += targetBuilding.getMeshUUID();
+ output += newline;
+
+ if (targetBuilding.getBlueprintUUID() != 0)
+ output += ' ' + targetBuilding.getBlueprint().getName();
+
+ output += newline;
+ output += targetBuilding.getBlueprint() != null ? targetBuilding.getBlueprint().getBuildingGroup().name() : " no building group";
+
+ output += newline;
+ output += "EffectFlags: " + targetBuilding.getEffectFlags();
+ output += newline;
+ output += StringUtils.addWS("rank: " + targetBuilding.getRank(),
+ 20);
+ output += "HP: " + targetBuilding.getHealth() + '/'
+ + targetBuilding.getMaxHitPoints();
+ output += newline;
+ output += "Scale: (" + targetBuilding.getMeshScale().getX();
+ output += ", " + targetBuilding.getMeshScale().getY();
+ output += ", " + targetBuilding.getMeshScale().getZ() + ')';
+ output += newline;
+ output += "Owner UID: " + targetBuilding.getOwnerUUID();
+ output += (targetBuilding.isOwnerIsNPC() ? " (NPC)" : " (PC)");
+ output += newline;
+ output += "ProtectionState: " + targetBuilding.getProtectionState().name();
+ output += newline;
+
+ if (targetBuilding.getUpgradeDateTime() != null) {
+ output += targetBuilding.getUpgradeDateTime().toString();
+ output += newline;
+ }
+
+ Guild guild = targetBuilding.getGuild();
+ Guild nation = null;
+ String guildId = "-1";
+ String nationId = "-1";
+ String gTag = "";
+ String nTag = "";
+
+ if (guild != null) {
+ int id = guild.getObjectUUID();
+
+ if (id == 0) {
+ guildId = id + " [" + guild.hashCode() + ']';
+ } else
+ guildId = Integer.toString(id);
+
+ gTag = guild.getGuildTag().summarySentence();
+ nation = guild.getNation();
+
+ if (nation != null) {
+ id = nation.getObjectUUID();
+ if (id == 0) {
+ nationId = id + " [" + nation.hashCode() + ']';
+ } else {
+ nationId = Integer.toString(id);
+ }
+ nTag = nation.getGuildTag().summarySentence();
+ }
+ }
+ output += StringUtils.addWS("Guild UID: " + guildId, 20);
+
+ if (gTag.length() > 0)
+ output += "Guild crest: " + gTag;
+
+ output += newline;
+ output += StringUtils.addWS("Nation UID: " + nationId, 20);
+
+ if (nTag.length() > 0) {
+ output += "Nation crest: " + nTag;
+ }
+
+ output += newline;
+
+
+ if (targetBuilding.getBlueprint() != null) {
+
+ if (targetBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.MINE) {
+ Mine mine = Mine.getMineFromTower(targetBuilding.getObjectUUID());
+
+ if (mine != null) {
+ output += newline;
+ output += "Mine active: " + mine.getIsActive();
+ output += newline;
+ output += "Was claimed: " + mine.wasClaimed;
+ output += newline;
+ output += "Mine Type: " + mine.getMineType().name;
+ output += newline;
+ output += "Expansion : " + mine.isExpansion();
+ output += newline;
+ output += "Production type: " + mine.getProduction().name();
+
+ }
+ }
+ output += newline;
+
+ if (targetBuilding.maintDateTime != null) {
+ output += targetBuilding.maintDateTime.toString();
+ output += newline;
+ }
+ }
+
+ output += "Reserve : " + targetBuilding.reserve;
+ output += newline;
+ output += "Strongbox : " + targetBuilding.getStrongboxValue();
+ output += newline;
+
+ // List hirelings
+
+ if (targetBuilding.getHirelings().isEmpty() == false) {
+
+ output += newline;
+ output += "Hirelings List: name / slot / floor";
+
+ for (AbstractCharacter npc : targetBuilding.getHirelings().keySet()) {
+
+ if (npc.getObjectType() != GameObjectType.NPC)
+ continue;
+ output += newline + npc.getName() + " slot " + targetBuilding.getHirelings().get(npc);
+ output += newline + "location " + npc.getLoc();
+ }
+ }
+
+ ArrayList tempList = BuildingRegions._staticRegions.get(targetBuilding.getMeshUUID());
+ output += newline;
+ output += "Building Regions: Size - " + tempList.size();
+ output += newline;
+ output += "Building Regions from Bounds: Size - " + targetBuilding.getBounds().getRegions().size();
+ output += newline;
+
+ for (Regions regions : targetBuilding.getBounds().getRegions()) {
+ //TODO ADD REGION INFO
+ }
+
+ break;
+ case PlayerCharacter:
+ output += newline;
+ PlayerCharacter targetPC = (PlayerCharacter) target;
+ output += StringUtils.addWS("Name: " + targetPC.getName(), 20);
+ output += newline;
+ output += "InSession : " + SessionManager.getPlayerCharacterByID(target.getObjectUUID()) != null ? " true " : " false";
+ output += newline;
+ output += "RaceType: " + targetPC.getRace().getRaceType().name();
+ output += newline;
+ output += "Race: " + targetPC.getRace().getName();
+ output += newline;
+ output += "Safe:" + targetPC.inSafeZone();
+ output += newline;
+ output += "Experience : " + targetPC.getExp();
+ output += newline;
+ output += "OverFlowExperience : " + targetPC.getOverFlowEXP();
+ output += newline;
+ output += StringUtils.addWS("Level: "
+ + targetPC.getLevel() + " (" +
+ TargetColor.getCon(targetPC, pc).toString() + ')', 20);
+
+ Account acpc = SessionManager.getAccount(pc);
+ Account ac = SessionManager.getAccount(targetPC);
+
+ if (acpc != null && ac != null) {
+ output += "Account ID: " + ac.getObjectUUID();
+ output += newline;
+ output += "Access Level: " + ac.status.name();
+ } else
+ output += "Account ID: UNKNOWN";
+
+ output += newline;
+ output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
+ output += newline;
+ output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
+ output += newline;
+ output += "ALTITUDE :" + targetPC.getAltitude();
+ output += newline;
+ output += "BuildingID :" + targetPC.getInBuildingID();
+ output += newline;
+ output += "inBuilding :" + targetPC.getInBuilding();
+ output += newline;
+ output += "inFloor :" + targetPC.getInFloorID();
+ output += newline;
+
+ BaseClass baseClass = targetPC.getBaseClass();
+
+ if (baseClass != null)
+ output += StringUtils.addWS("Class: " + baseClass.getName(), 20);
+ else
+ output += StringUtils.addWS("", 20);
+
+ PromotionClass promotionClass = targetPC.getPromotionClass();
+ if (promotionClass != null) {
+ output += "Pro. Class: " + promotionClass.getName();
+ } else {
+ output += "Pro. Class: ";
+ }
+
+ output += newline;
+ output += "====Guild Info====";
+ output += newline;
+
+ if (targetPC.getGuild() != null) {
+ output += "Name: " + targetPC.getGuild().getName();
+ output += newline;
+ output += "State: " + targetPC.getGuild().getGuildState();
+ output += newline;
+ output += "Realms Owned:" + targetPC.getGuild().getRealmsOwned();
+ output += newline;
+ output += "====Nation====";
+ output += newline;
+ output += "Nation Name: " + targetPC.getGuild().getNation().getName();
+ output += newline;
+ output += "Nation State: " + targetPC.getGuild().getNation().getGuildState();
+ output += newline;
+ output += "Realms Owned:" + targetPC.getGuild().getNation().getRealmsOwned();
+ output += newline;
+ output += "Guild Rank:" + (GuildStatusController.getRank(targetPC.getGuildStatus()) + targetPC.getGuild().getRealmsOwnedFlag());
+ }
+
+ output += newline;
+ output += "Movement State: " + targetPC.getMovementState().name();
+ output += newline;
+ output += "Movement Speed: " + targetPC.getSpeed();
+
+ output += "Altitude : " + targetPC.getLoc().y;
+
+ output += "Swimming : " + targetPC.isSwimming();
+ output += newline;
+ output += "isMoving : " + targetPC.isMoving();
+
+ break;
+
+ case NPC:
+ NPC targetNPC = (NPC) target;
+ output += "databaseID: " + targetNPC.getDBID() + newline;
+ output += "Name: " + targetNPC.getName();
+ output += newline;
+ output += StringUtils.addWS("Level: " + targetNPC.getLevel(), 20);
+
+ MobBase mobBase;
+
+ if (targetNPC.getContract() == null)
+ mobBase = targetNPC.getMobBase();
+ else
+ mobBase = MobBase.getMobBase(targetNPC.getContract().getMobbaseID());
+
+ if (mobBase != null) {
+ output += "Mobbbase: " + mobBase.getObjectUUID();
+ output += newline;
+ output += "Flags: " + mobBase.getFlags().toString();
+ }
+
+ output += newline;
+ output += "Spawn: (" + targetNPC.getBindLoc().getX();
+ output += ", " + targetNPC.getBindLoc().getY();
+ output += ", " + targetNPC.getBindLoc().getZ() + ')';
+ output += newline;
+ output += "ContractID: " + targetNPC.getContractID();
+ output += newline;
+ output += "InventorySet: " + targetNPC.getContract().inventorySet;
+ output += newline;
+ output += targetNPC.getContract().getAllowedBuildings().toString();
+ output += newline;
+ output += "Extra Rune: " + targetNPC.getContract().getExtraRune();
+
+ output += newline;
+ output += "isTrainer: " + targetNPC.getContract().isTrainer();
+ output += newline;
+ output += "Buy Cost: " + targetNPC.getBuyPercent();
+ output += "\tSell Cost: " + targetNPC.getSellPercent();
+ output += newline;
+ output += "fromInit: " + targetNPC.isStatic();
+ output += newline;
+ if (mobBase != null) {
+ output += newline;
+ output += "Slottable: " + targetNPC.getContract().getAllowedBuildings().toString();
+ output += newline;
+ output += "EquipSet: " + targetNPC.getEquipmentSetID();
+ output += newline;
+ output += "Parent Zone LoadNum : " + targetNPC.getParentZone().getLoadNum();
+
+ }
+
+ if (targetNPC.region != null) {
+ output += newline;
+ output += "Region found: " + "Building : " + targetNPC.region.parentBuildingID + newline;
+ output += "building level : " + targetNPC.region.level + newline;
+ output += "building room : " + targetNPC.region.room + newline;
+ } else {
+ output += newline;
+ output += "No region was found.";
+ }
+
+ if (targetNPC.getBuilding() != null) {
+ output += newline;
+ output += "Building : " + targetNPC.getBuilding();
+ } else {
+ output += newline;
+ output += "No building found.";
+ }
+ break;
+ case Mob:
+ Mob targetMob = (Mob) target;
+ output += "databaseID: " + targetMob.getDBID() + newline;
+ output += "Name: " + targetMob.getName();
+ output += newline;
+ output += StringUtils.addWS("Level: " + targetMob.getLevel(), 20);
+ mobBase = targetMob.getMobBase();
+ if (mobBase != null)
+ output += "RaceID: " + mobBase.getObjectUUID();
+ else
+ output += "RaceID: " + targetMob.getLoadID();
+ output += newline;
+ try {
+ output += "notEnemy: " + targetMob.notEnemy.toString();
+ output += newline;
+ output += "enemy: " + targetMob.enemy.toString();
+ output += newline;
+ } catch (Exception ex) {
+ //who cares its info
+ }
+ output += "Spawn: (" + targetMob.getBindLoc().getX();
+ output += ", " + targetMob.getBindLoc().getY();
+ output += ", " + targetMob.getBindLoc().getZ() + ')';
+ output += newline;
+ if (targetMob.isPet()) {
+ output += "isPet: true";
+ output += newline;
+ if (targetMob.isSummonedPet())
+ output += "isSummonedPet: true";
+ else
+ output += "isSummonedPet: false";
+ PlayerCharacter owner = targetMob.getOwner();
+ if (owner != null)
+ output += " owner: " + owner.getObjectUUID();
+ output += newline;
+ output += "assist: " + targetMob.assist() + " resting: " + targetMob.isSit();
+ output += newline;
+ }
+ if (targetMob.getMobBase() != null) {
+ output += "Mobbase: " + targetMob.getMobBase().getObjectUUID();
+ output += newline;
+ output += "Flags: " + targetMob.getMobBase().getFlags().toString();
+ output += newline;
+
+ }
+ if (targetMob.isMob()) {
+ output += "SpawnRadius: " + targetMob.getSpawnRadius();
+ output += newline;
+ output += "Spawn Timer: " + targetMob.getSpawnTimeAsString();
+ output += newline;
+ }
+ output += StringUtils.addWS("isAlive: "
+ + targetMob.isAlive(), 20);
+ output += newline;
+ //output += "Mob State: " + targetMob.state.name();
+
+ output += newline;
+ output += "Speed : " + targetMob.getSpeed();
+ output += newline;
+ output += "EquipSet: " + targetMob.equipmentSetID;
+ output += newline;
+ try {
+ output += "Parent Zone LoadNum : " + targetMob.getParentZone().getLoadNum();
+ } catch (Exception ex) {
+ //who cares
+ }
+ output += newline;
+ output += "isMoving : " + targetMob.isMoving();
+ if (targetMob.region != null) {
+ output += newline;
+ output += "BuildingID : " + targetMob.region.parentBuildingID;
+ output += "building level : " + targetMob.region.level;
+ output += "building room : " + targetMob.region.room;
+ }
+ if (targetMob.building != null) {
+ output += "Building Name: " + targetMob.building.getName() + newline;
+ output += "BuildingID : " + targetMob.building + newline;
+ output += "Bind Loc : " + targetMob.getBindLoc() + newline;
+ output += "Curr Loc : " + targetMob.getLoc() + newline;
+ } else {
+ output += newline;
+ output += "No building found.";
+ }
+ break;
+ case Item: //intentional passthrough
+ case MobLoot:
+ Item item = (Item) target;
+ ItemBase itemBase = item.getItemBase();
+ output += StringUtils.addWS("ItemBase: " + itemBase.getUUID(), 20);
+ output += "Weight: " + itemBase.getWeight();
+ output += newline;
+ DecimalFormat df = new DecimalFormat("###,###,###,###,##0");
+ output += StringUtils.addWS("Qty: "
+ + df.format(item.getNumOfItems()), 20);
+ output += "Charges: " + item.getChargesRemaining()
+ + '/' + item.getChargesMax();
+ output += newline;
+ output += "Name: " + itemBase.getName();
+ output += newline;
+ output += item.getContainerInfo();
+
+ throwbackInfo(pc, output);
+
+ output = "Effects:" + newline;
+ ConcurrentHashMap effects = item.getEffects();
+ for (String name : effects.keySet()) {
+ Effect eff = effects.get(name);
+ output += eff.getEffectsBase().getIDString();
+ output += newline;
+ // output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
+ }
+
+ break;
+ }
+
+ throwbackInfo(pc, output);
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Gets information on an Object.";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /info targetID'";
+ }
}
diff --git a/src/engine/devcmd/cmds/JumpCmd.java b/src/engine/devcmd/cmds/JumpCmd.java
index c85ff0a6..7da57eb3 100644
--- a/src/engine/devcmd/cmds/JumpCmd.java
+++ b/src/engine/devcmd/cmds/JumpCmd.java
@@ -16,70 +16,70 @@ import engine.objects.PlayerCharacter;
public class JumpCmd extends AbstractDevCmd {
- public JumpCmd() {
+ public JumpCmd() {
super("jump");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 2) {
- this.sendUsage(pc);
- return;
- }
-
- //test
-
- if (words[0].equalsIgnoreCase("face")){
-
- try {
- float range = Float.parseFloat(words[1]);
- Vector3fImmutable newLoc = pc.getFaceDir().scaleAdd(range, pc.getLoc());
- pc.teleport(newLoc);
-
-
- } catch (NumberFormatException e) {
- this.throwbackError(pc, ""
- + " failed to parse to Floats");
- return;
-
- }
- return;
- }
- float lat = 0.0f, lon = 0.0f;
- String latLong = '\'' + words[0] + ", " + words[1] + '\'';
-
- try {
- lat = Float.parseFloat(words[0]);
- lon = Float.parseFloat(words[1]);
-
- } catch (NumberFormatException e) {
- this.throwbackError(pc, "Supplied LatLong: " + latLong
- + " failed to parse to Floats");
- return;
-
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to jump to LatLong of "
- + latLong);
- return;
- }
-
- Vector3fImmutable loc = pc.getLoc();
- loc = loc.add(lat, 0f, -lon);
- pc.teleport(loc);
- }
-
- @Override
- protected String _getHelpString() {
- return "Alters your characters position by 'lat' and 'long'. This does not transport you TO 'lat' and 'long', but rather BY 'lat' and 'long' ";
-
- }
-
- @Override
- protected String _getUsageString() {
- return "' /jump lat long'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 2) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ //test
+
+ if (words[0].equalsIgnoreCase("face")) {
+
+ try {
+ float range = Float.parseFloat(words[1]);
+ Vector3fImmutable newLoc = pc.getFaceDir().scaleAdd(range, pc.getLoc());
+ pc.teleport(newLoc);
+
+
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, ""
+ + " failed to parse to Floats");
+ return;
+
+ }
+ return;
+ }
+ float lat = 0.0f, lon = 0.0f;
+ String latLong = '\'' + words[0] + ", " + words[1] + '\'';
+
+ try {
+ lat = Float.parseFloat(words[0]);
+ lon = Float.parseFloat(words[1]);
+
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Supplied LatLong: " + latLong
+ + " failed to parse to Floats");
+ return;
+
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to jump to LatLong of "
+ + latLong);
+ return;
+ }
+
+ Vector3fImmutable loc = pc.getLoc();
+ loc = loc.add(lat, 0f, -lon);
+ pc.teleport(loc);
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Alters your characters position by 'lat' and 'long'. This does not transport you TO 'lat' and 'long', but rather BY 'lat' and 'long' ";
+
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /jump lat long'";
+ }
}
diff --git a/src/engine/devcmd/cmds/MBDropCmd.java b/src/engine/devcmd/cmds/MBDropCmd.java
index 89957656..5e5bfbe8 100644
--- a/src/engine/devcmd/cmds/MBDropCmd.java
+++ b/src/engine/devcmd/cmds/MBDropCmd.java
@@ -16,119 +16,117 @@ import engine.objects.LootTable;
import engine.objects.PlayerCharacter;
/**
- *
* @author Eighty
- *
*/
public class MBDropCmd extends AbstractDevCmd {
- public MBDropCmd() {
+ public MBDropCmd() {
super("mbdrop");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- String newline = "\r\n ";
- if (args.length != 1){
- this.sendUsage(pcSender);
- this.sendHelp(pcSender);
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ String newline = "\r\n ";
+ if (args.length != 1) {
+ this.sendUsage(pcSender);
+ this.sendHelp(pcSender);
+ return;
+ }
- String output = "";
- switch (args[0].toLowerCase()){
- case "clear":
+ String output = "";
+ switch (args[0].toLowerCase()) {
+ case "clear":
- LootTable.contractCount = 0;
- LootTable.dropCount = 0;
- LootTable.glassCount = 0;
- LootTable.runeCount = 0;
- LootTable.rollCount = 0;
- LootTable.resourceCount = 0;
+ LootTable.contractCount = 0;
+ LootTable.dropCount = 0;
+ LootTable.glassCount = 0;
+ LootTable.runeCount = 0;
+ LootTable.rollCount = 0;
+ LootTable.resourceCount = 0;
- LootTable.contractDroppedMap.clear();
- LootTable.glassDroppedMap.clear();
- LootTable.itemsDroppedMap.clear();
- LootTable.resourceDroppedMap.clear();
- LootTable.runeDroppedMap.clear();
- break;
- case "all":
- output = LootTable.dropCount + " items - ITEM NAME : DROP COUNT" + newline;
- for (ItemBase ib: LootTable.itemsDroppedMap.keySet()){
+ LootTable.contractDroppedMap.clear();
+ LootTable.glassDroppedMap.clear();
+ LootTable.itemsDroppedMap.clear();
+ LootTable.resourceDroppedMap.clear();
+ LootTable.runeDroppedMap.clear();
+ break;
+ case "all":
+ output = LootTable.dropCount + " items - ITEM NAME : DROP COUNT" + newline;
+ for (ItemBase ib : LootTable.itemsDroppedMap.keySet()) {
- int dropCount = LootTable.itemsDroppedMap.get(ib);
- output += ib.getName() + " : " + dropCount + newline;
+ int dropCount = LootTable.itemsDroppedMap.get(ib);
+ output += ib.getName() + " : " + dropCount + newline;
- }
- break;
- case "resource":
- output = LootTable.resourceCount + " Resources - ITEM NAME : DROP COUNT" + newline;
- for (ItemBase ib: LootTable.resourceDroppedMap.keySet()){
+ }
+ break;
+ case "resource":
+ output = LootTable.resourceCount + " Resources - ITEM NAME : DROP COUNT" + newline;
+ for (ItemBase ib : LootTable.resourceDroppedMap.keySet()) {
- int dropCount = LootTable.resourceDroppedMap.get(ib);
- output += ib.getName() + " : " + dropCount + newline;
+ int dropCount = LootTable.resourceDroppedMap.get(ib);
+ output += ib.getName() + " : " + dropCount + newline;
- }
+ }
- break;
- case "rune":
+ break;
+ case "rune":
- output = LootTable.runeCount + " Runes - ITEM NAME : DROP COUNT" + newline;
- for (ItemBase ib: LootTable.runeDroppedMap.keySet()){
+ output = LootTable.runeCount + " Runes - ITEM NAME : DROP COUNT" + newline;
+ for (ItemBase ib : LootTable.runeDroppedMap.keySet()) {
- int dropCount = LootTable.runeDroppedMap.get(ib);
- output += ib.getName() + " : " + dropCount + newline;
+ int dropCount = LootTable.runeDroppedMap.get(ib);
+ output += ib.getName() + " : " + dropCount + newline;
- }
- break;
- case "contract":
+ }
+ break;
+ case "contract":
- output = LootTable.contractCount + " Contracts - ITEM NAME : DROP COUNT" + newline;
- for (ItemBase ib: LootTable.contractDroppedMap.keySet()){
+ output = LootTable.contractCount + " Contracts - ITEM NAME : DROP COUNT" + newline;
+ for (ItemBase ib : LootTable.contractDroppedMap.keySet()) {
- int dropCount = LootTable.contractDroppedMap.get(ib);
- output += ib.getName() + " : " + dropCount + newline;
+ int dropCount = LootTable.contractDroppedMap.get(ib);
+ output += ib.getName() + " : " + dropCount + newline;
- }
- break;
+ }
+ break;
- case "glass":
+ case "glass":
- output = LootTable.glassCount + " Glass - ITEM NAME : DROP COUNT" + newline;
- for (ItemBase ib: LootTable.glassDroppedMap.keySet()){
+ output = LootTable.glassCount + " Glass - ITEM NAME : DROP COUNT" + newline;
+ for (ItemBase ib : LootTable.glassDroppedMap.keySet()) {
- int dropCount = LootTable.glassDroppedMap.get(ib);
- output += ib.getName() + " : " + dropCount + newline;
- }
- break;
+ int dropCount = LootTable.glassDroppedMap.get(ib);
+ output += ib.getName() + " : " + dropCount + newline;
+ }
+ break;
- case "chance":
- float chance = (float)LootTable.dropCount/(float)LootTable.rollCount * 100;
- output = LootTable.dropCount + " out of " + LootTable.rollCount + " items Dropped. chance = " + chance + '%';
+ case "chance":
+ float chance = (float) LootTable.dropCount / (float) LootTable.rollCount * 100;
+ output = LootTable.dropCount + " out of " + LootTable.rollCount + " items Dropped. chance = " + chance + '%';
- break;
+ break;
- default:
- this.sendUsage(pcSender);
- this.sendHelp(pcSender);
- return;
- }
+ default:
+ this.sendUsage(pcSender);
+ this.sendHelp(pcSender);
+ return;
+ }
- this.throwbackInfo(pcSender, output);
+ this.throwbackInfo(pcSender, output);
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /mbdrop all/resource/rune/contract/glass/chance/clear";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Lists drops for server since a reboot. All lists all items and drops. chance is the overall chance items drop from mobs on server. (not including Equipment)";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/MakeBaneCmd.java b/src/engine/devcmd/cmds/MakeBaneCmd.java
index 85f17c0e..e4328ec0 100644
--- a/src/engine/devcmd/cmds/MakeBaneCmd.java
+++ b/src/engine/devcmd/cmds/MakeBaneCmd.java
@@ -23,193 +23,190 @@ import org.pmw.tinylog.Logger;
/**
* @author Eighty
- *
*/
public class MakeBaneCmd extends AbstractDevCmd {
- public MakeBaneCmd() {
+ public MakeBaneCmd() {
super("makebane");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (words.length < 1 || words.length > 2) {
- this.sendUsage(pc);
- return;
- }
-
- int attackerID = 0;
- int rank = 8;
-
- if (words.length == 2) {
- try {
- attackerID = Integer.parseInt(words[0]);
- rank = Integer.parseInt(words[1]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "AttackerGuildID must be a number, " + words[0] + " is invalid");
- return;
- }
- } else if (words.length == 1) {
- if (target == null) {
- throwbackError(pc, "No target specified");
- return;
- }
-
- if (!(target instanceof PlayerCharacter)) {
- throwbackError(pc, "Target is not a player");
- return;
- }
- attackerID = target.getObjectUUID();
-
- try {
- rank = Integer.parseInt(words[0]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "Rank must be specified, 1 through 8");
- return;
- }
- }
-
- if (rank < 1 || rank > 8) {
- throwbackError(pc, "Rank must be 1 through 8");
- return;
- }
-
- PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
-
-
-
-
- if (player.getGuild().isEmptyGuild()) {
- throwbackError(pc, "Errant's can not place banes");
- return;
- }
-
- AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
-
- if (attackerAGL == null) {
- throwbackError(pc, "No guild leader found for attacking guild.");
- return;
- }
-
- if (!(attackerAGL instanceof PlayerCharacter)) {
- throwbackError(pc, "Attacking guild leader is an NPC.");
- return;
- }
-
- if (player.getGuild().isNPCGuild()) {
- throwbackError(pc, "The guild used is an npc guild. They can not bane.");
- return;
- }
-
- // if (player.getGuild().getOwnedCity() != null) {
- // throwbackError(pc, "The attacking guild already has a city.");
- // return;
- // }
-
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
-
- if (zone == null) {
- throwbackError(pc, "Unable to find the zone you're in.");
- return;
- }
-
- if (!zone.isPlayerCity()) {
- throwbackError(pc, "This is not a player city.");
- return;
- }
-
- City city = City.getCity(zone.getPlayerCityUUID());
- if (city == null) {
- throwbackError(pc, "Unable to find the city associated with this zone.");
- return;
- }
-
- if (city.getTOL() == null) {
- throwbackError(pc, "Unable to find the tree of life for this city.");
- return;
- }
-
- if (city.getBane() != null) {
- throwbackError(pc, "This city is already baned.");
- return;
- }
-
- if (Bane.getBaneByAttackerGuild(player.getGuild()) != null) {
- throwbackError(pc, "This guild is already baning someone.");
- return;
- }
-
- Blueprint blueprint = Blueprint.getBlueprint(24300);
-
- if (blueprint == null) {
- throwbackError(pc, "Unable to find building set for banestone.");
- return;
- }
-
- Vector3f rot = new Vector3f(0, 0, 0);
-
- // *** Refactor : Overlap test goes here
-
- //Let's drop a banestone!
- Vector3fImmutable localLocation = ZoneManager.worldToLocal(pc.getLoc(), zone);
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (words.length < 1 || words.length > 2) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ int attackerID = 0;
+ int rank = 8;
+
+ if (words.length == 2) {
+ try {
+ attackerID = Integer.parseInt(words[0]);
+ rank = Integer.parseInt(words[1]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "AttackerGuildID must be a number, " + words[0] + " is invalid");
+ return;
+ }
+ } else if (words.length == 1) {
+ if (target == null) {
+ throwbackError(pc, "No target specified");
+ return;
+ }
+
+ if (!(target instanceof PlayerCharacter)) {
+ throwbackError(pc, "Target is not a player");
+ return;
+ }
+ attackerID = target.getObjectUUID();
+
+ try {
+ rank = Integer.parseInt(words[0]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "Rank must be specified, 1 through 8");
+ return;
+ }
+ }
+
+ if (rank < 1 || rank > 8) {
+ throwbackError(pc, "Rank must be 1 through 8");
+ return;
+ }
+
+ PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
+
+
+ if (player.getGuild().isEmptyGuild()) {
+ throwbackError(pc, "Errant's can not place banes");
+ return;
+ }
+
+ AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
+
+ if (attackerAGL == null) {
+ throwbackError(pc, "No guild leader found for attacking guild.");
+ return;
+ }
+
+ if (!(attackerAGL instanceof PlayerCharacter)) {
+ throwbackError(pc, "Attacking guild leader is an NPC.");
+ return;
+ }
+
+ if (player.getGuild().isNPCGuild()) {
+ throwbackError(pc, "The guild used is an npc guild. They can not bane.");
+ return;
+ }
+
+ // if (player.getGuild().getOwnedCity() != null) {
+ // throwbackError(pc, "The attacking guild already has a city.");
+ // return;
+ // }
+
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+
+ if (zone == null) {
+ throwbackError(pc, "Unable to find the zone you're in.");
+ return;
+ }
+
+ if (!zone.isPlayerCity()) {
+ throwbackError(pc, "This is not a player city.");
+ return;
+ }
+
+ City city = City.getCity(zone.getPlayerCityUUID());
+ if (city == null) {
+ throwbackError(pc, "Unable to find the city associated with this zone.");
+ return;
+ }
+
+ if (city.getTOL() == null) {
+ throwbackError(pc, "Unable to find the tree of life for this city.");
+ return;
+ }
+
+ if (city.getBane() != null) {
+ throwbackError(pc, "This city is already baned.");
+ return;
+ }
+
+ if (Bane.getBaneByAttackerGuild(player.getGuild()) != null) {
+ throwbackError(pc, "This guild is already baning someone.");
+ return;
+ }
+
+ Blueprint blueprint = Blueprint.getBlueprint(24300);
+
+ if (blueprint == null) {
+ throwbackError(pc, "Unable to find building set for banestone.");
+ return;
+ }
+
+ Vector3f rot = new Vector3f(0, 0, 0);
+
+ // *** Refactor : Overlap test goes here
+
+ //Let's drop a banestone!
+ Vector3fImmutable localLocation = ZoneManager.worldToLocal(pc.getLoc(), zone);
+
+ if (localLocation == null) {
+ ChatManager.chatSystemError(pc, "Failed to convert world location to zone location. Contact a CCR.");
+ Logger.info("Failed to Convert World coordinates to local zone coordinates");
+ return;
+ }
+
+ Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
+ zone.getObjectUUID(), pc.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
+ localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
+ null, blueprint.getBlueprintUUID(), 1, 0.0f);
+
+ if (stone == null) {
+ ChatManager.chatSystemError(pc, "Failed to create banestone.");
+ return;
+ }
+ stone.addEffectBit((1 << 19));
+ stone.setRank((byte) rank);
+ stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
+ stone.setCurrentHitPoints(stone.getMaxHitPoints());
+ BuildingManager.setUpgradeDateTime(stone, null, 0);
- if (localLocation == null){
- ChatManager.chatSystemError(pc, "Failed to convert world location to zone location. Contact a CCR.");
- Logger.info("Failed to Convert World coordinates to local zone coordinates");
- return;
- }
+ //Make the bane
- Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
- zone.getObjectUUID(), pc.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
- localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
- null, blueprint.getBlueprintUUID(), 1, 0.0f);
+ Bane bane = Bane.makeBane(player, city, stone);
- if (stone == null) {
- ChatManager.chatSystemError(pc, "Failed to create banestone.");
- return;
- }
- stone.addEffectBit((1 << 19));
- stone.setRank((byte) rank);
- stone.setMaxHitPoints( blueprint.getMaxHealth(stone.getRank()));
- stone.setCurrentHitPoints(stone.getMaxHitPoints());
- BuildingManager.setUpgradeDateTime(stone, null, 0);
+ if (bane == null) {
+
+ //delete bane stone, failed to make bane object
+ DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
- //Make the bane
+ throwbackError(pc, "Failed to create bane.");
+ return;
+ }
+
+ WorldGrid.addObject(stone, pc);
- Bane bane = Bane.makeBane(player, city, stone);
+ //Add baned effect to TOL
+ city.getTOL().addEffectBit((1 << 16));
+ city.getTOL().updateEffects();
- if (bane == null) {
-
- //delete bane stone, failed to make bane object
- DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
+ Vector3fImmutable movePlayerOutsideStone = player.getLoc();
+ movePlayerOutsideStone = movePlayerOutsideStone.setX(movePlayerOutsideStone.x + 10);
+ movePlayerOutsideStone = movePlayerOutsideStone.setZ(movePlayerOutsideStone.z + 10);
+ player.teleport(movePlayerOutsideStone);
- throwbackError(pc, "Failed to create bane.");
- return;
- }
-
- WorldGrid.addObject(stone, pc);
-
- //Add baned effect to TOL
- city.getTOL().addEffectBit((1 << 16));
- city.getTOL().updateEffects();
-
- Vector3fImmutable movePlayerOutsideStone = player.getLoc();
- movePlayerOutsideStone = movePlayerOutsideStone.setX(movePlayerOutsideStone.x + 10);
- movePlayerOutsideStone = movePlayerOutsideStone.setZ(movePlayerOutsideStone.z + 10);
- player.teleport(movePlayerOutsideStone);
-
- throwbackInfo(pc, "The city has been succesfully baned.");
- }
+ throwbackInfo(pc, "The city has been succesfully baned.");
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Creates an bane.";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "'./makebane playerUUID baneRank'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/MakeItemCmd.java b/src/engine/devcmd/cmds/MakeItemCmd.java
index 3bdd2384..835cdb27 100644
--- a/src/engine/devcmd/cmds/MakeItemCmd.java
+++ b/src/engine/devcmd/cmds/MakeItemCmd.java
@@ -21,236 +21,234 @@ import java.util.ArrayList;
/**
* @author Eighty
- *
*/
public class MakeItemCmd extends AbstractDevCmd {
- public MakeItemCmd() {
+ public MakeItemCmd() {
super("makeitem");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
- if (words[0].equals("resources")){
- for (int ibID : Warehouse.getMaxResources().keySet()){
- if (ibID == 7)
- continue;
-
- ItemBase ib = ItemBase.getItemBase(ibID);
-
- short weight = ib.getWeight();
- if (!pc.getCharItemManager().hasRoomInventory(weight)) {
- throwbackError(pc, "Not enough room in inventory for any more of this item");
-
- pc.getCharItemManager().updateInventory();
- return;
- }
-
- boolean worked = false;
- Item item = new Item(ib, pc.getObjectUUID(),
- OwnerType.PlayerCharacter, (byte)0, (byte)0, (short)ib.getDurability(), (short)ib.getDurability(),
- true, false, ItemContainerType.INVENTORY, (byte) 0,
- new ArrayList<>(),"");
-
- item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
-
- try {
- item = DbManager.ItemQueries.ADD_ITEM(item);
- worked = true;
- } catch (Exception e) {
- throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
- return;
- }
-
- if (item == null || !worked) {
- throwbackError(pc, "DB error 2: Unable to create item.");
- return;
- }
-
-
-
- //add item to inventory
- pc.getCharItemManager().addItemToInventory(item);
- }
- return;
- }
- if (words.length < 3 || words.length > 5) {
- this.sendUsage(pc);
- return;
- }
-
- int quantity = 1;
- if (words.length > 3) {
- try {
- quantity = Integer.parseInt(words[3]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "Quantity must be a number, " + words[3] + " is invalid");
- return;
- }
- if (quantity < 1 || quantity > 100)
- quantity = 1;
- }
-
- int numItems = 1;
- if (words.length > 4) {
- try {
- numItems = Integer.parseInt(words[4]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "numResources must be a number, " + words[4] + " is invalid");
- return;
- }
- numItems = (numItems < 1) ? 1 : numItems;
- numItems = (numItems > 5000) ? 5000 : numItems;
- }
-
- int itembaseID;
- try {
- itembaseID = Integer.parseInt(words[0]);
- } catch (NumberFormatException e) {
- itembaseID = ItemBase.getIDByName(words[0].toLowerCase());
- if (itembaseID == 0) {
- throwbackError(pc, "Supplied type " + words[0]
- + " failed to parse to an Integer");
- return;
- }
- } catch (Exception e) {
- throwbackError(pc,
- "An unknown exception occurred when trying to use createitem command for type "
- + words[0]);
- return; // NaN
- }
-
- if (itembaseID == 7) {
- this.throwbackInfo(pc, "use /addgold to add gold.");
- return;
- }
-
- String prefix = "";
- String suffix = "";
-
- if (!(words[1].equals("0"))) {
- prefix = words[1];
- if (!(prefix.substring(0, 4).equals("PRE-")))
- prefix = EffectsBase.getItemEffectsByName(prefix.toLowerCase());
- if (!(prefix.substring(0, 4).equals("PRE-"))) {
- throwbackError(pc, "Invalid Prefix. Prefix must consist of PRE-001 to PRE-334 or 0 for no Prefix.");
- return;
- }
-
- boolean validInt = false;
- try {
- int num = Integer.parseInt(prefix.substring(4, 7));
- if (num > 0 && num < 335)
- validInt = true;
- } catch (Exception e) {
- throwbackError(pc, "error parsing number " + prefix);
- }
- if (!validInt) {
- throwbackError(pc, "Invalid Prefix. Prefix must consist of PRE-001 to PRE-334 or 0 for no Prefix.");
- return;
- }
- }
-
- if (!(words[2].equals("0"))) {
- suffix = words[2];
-
- if (!(suffix.substring(0, 4).equals("SUF-")))
- suffix = EffectsBase.getItemEffectsByName(suffix.toLowerCase());
- if (!(suffix.substring(0, 4).equals("SUF-"))) {
- throwbackError(pc, "Invalid Suffix. Suffix must consist of SUF-001 to SUF-328 or 0 for no Suffix.");
- return;
- }
-
- boolean validInt = false;
- try {
- int num = Integer.parseInt(suffix.substring(4, 7));
- if (num > 0 && num < 329)
- validInt = true;
- } catch (Exception e) {
- throwbackError(pc, "error parsing number " + suffix);
- }
- if (!validInt) {
- throwbackError(pc, "Invalid Suffix. Suffix must consist of SUF-001 to SUF-328 or 0 for no Suffix.");
- return;
- }
- }
- ItemBase ib = ItemBase.getItemBase(itembaseID);
- if (ib == null) {
- throwbackError(pc, "Unable to find itembase of ID " + itembaseID);
- return;
- }
-
- if ((numItems > 1)
- && (ib.getType().equals(ItemType.RESOURCE) == false)
- && (ib.getType().equals(ItemType.OFFERING)) == false)
- numItems = 1;
-
- CharacterItemManager cim = pc.getCharItemManager();
- if (cim == null) {
- throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
- return;
- }
-
- byte charges = (byte) ib.getNumCharges();
- short dur = (short) ib.getDurability();
-
- String result = "";
- for (int i = 0; i < quantity; i++) {
- short weight = ib.getWeight();
- if (!cim.hasRoomInventory(weight)) {
- throwbackError(pc, "Not enough room in inventory for any more of this item. " + i + " produced.");
- if (i > 0)
- cim.updateInventory();
- return;
- }
-
- boolean worked = false;
- Item item = new Item(ib, pc.getObjectUUID(),
- OwnerType.PlayerCharacter, charges, charges, dur, dur,
- true, false, ItemContainerType.INVENTORY, (byte) 0,
- new ArrayList<>(),"");
- if (numItems > 1)
- item.setNumOfItems(numItems);
-
- try {
- item = DbManager.ItemQueries.ADD_ITEM(item);
- worked = true;
- } catch (Exception e) {
- throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
- return;
- }
-
- if (item == null || !worked) {
- throwbackError(pc, "DB error 2: Unable to create item.");
- return;
- }
-
- //create prefix
- if (!prefix.isEmpty())
- item.addPermanentEnchantmentForDev(prefix, 0);
-
- //create suffix
- if (!suffix.isEmpty())
- item.addPermanentEnchantmentForDev(suffix, 0);
-
- //add item to inventory
- cim.addItemToInventory(item);
- result += " " + item.getObjectUUID();
- }
- this.setResult(result);
- cim.updateInventory();
- }
-
- @Override
- protected String _getHelpString() {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+
+ if (words[0].equals("resources")) {
+ for (int ibID : Warehouse.getMaxResources().keySet()) {
+ if (ibID == 7)
+ continue;
+
+ ItemBase ib = ItemBase.getItemBase(ibID);
+
+ short weight = ib.getWeight();
+ if (!pc.getCharItemManager().hasRoomInventory(weight)) {
+ throwbackError(pc, "Not enough room in inventory for any more of this item");
+
+ pc.getCharItemManager().updateInventory();
+ return;
+ }
+
+ boolean worked = false;
+ Item item = new Item(ib, pc.getObjectUUID(),
+ OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
+ true, false, ItemContainerType.INVENTORY, (byte) 0,
+ new ArrayList<>(), "");
+
+ item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
+
+ try {
+ item = DbManager.ItemQueries.ADD_ITEM(item);
+ worked = true;
+ } catch (Exception e) {
+ throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
+ return;
+ }
+
+ if (item == null || !worked) {
+ throwbackError(pc, "DB error 2: Unable to create item.");
+ return;
+ }
+
+
+ //add item to inventory
+ pc.getCharItemManager().addItemToInventory(item);
+ }
+ return;
+ }
+ if (words.length < 3 || words.length > 5) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ int quantity = 1;
+ if (words.length > 3) {
+ try {
+ quantity = Integer.parseInt(words[3]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "Quantity must be a number, " + words[3] + " is invalid");
+ return;
+ }
+ if (quantity < 1 || quantity > 100)
+ quantity = 1;
+ }
+
+ int numItems = 1;
+ if (words.length > 4) {
+ try {
+ numItems = Integer.parseInt(words[4]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "numResources must be a number, " + words[4] + " is invalid");
+ return;
+ }
+ numItems = (numItems < 1) ? 1 : numItems;
+ numItems = (numItems > 5000) ? 5000 : numItems;
+ }
+
+ int itembaseID;
+ try {
+ itembaseID = Integer.parseInt(words[0]);
+ } catch (NumberFormatException e) {
+ itembaseID = ItemBase.getIDByName(words[0].toLowerCase());
+ if (itembaseID == 0) {
+ throwbackError(pc, "Supplied type " + words[0]
+ + " failed to parse to an Integer");
+ return;
+ }
+ } catch (Exception e) {
+ throwbackError(pc,
+ "An unknown exception occurred when trying to use createitem command for type "
+ + words[0]);
+ return; // NaN
+ }
+
+ if (itembaseID == 7) {
+ this.throwbackInfo(pc, "use /addgold to add gold.");
+ return;
+ }
+
+ String prefix = "";
+ String suffix = "";
+
+ if (!(words[1].equals("0"))) {
+ prefix = words[1];
+ if (!(prefix.substring(0, 4).equals("PRE-")))
+ prefix = EffectsBase.getItemEffectsByName(prefix.toLowerCase());
+ if (!(prefix.substring(0, 4).equals("PRE-"))) {
+ throwbackError(pc, "Invalid Prefix. Prefix must consist of PRE-001 to PRE-334 or 0 for no Prefix.");
+ return;
+ }
+
+ boolean validInt = false;
+ try {
+ int num = Integer.parseInt(prefix.substring(4, 7));
+ if (num > 0 && num < 335)
+ validInt = true;
+ } catch (Exception e) {
+ throwbackError(pc, "error parsing number " + prefix);
+ }
+ if (!validInt) {
+ throwbackError(pc, "Invalid Prefix. Prefix must consist of PRE-001 to PRE-334 or 0 for no Prefix.");
+ return;
+ }
+ }
+
+ if (!(words[2].equals("0"))) {
+ suffix = words[2];
+
+ if (!(suffix.substring(0, 4).equals("SUF-")))
+ suffix = EffectsBase.getItemEffectsByName(suffix.toLowerCase());
+ if (!(suffix.substring(0, 4).equals("SUF-"))) {
+ throwbackError(pc, "Invalid Suffix. Suffix must consist of SUF-001 to SUF-328 or 0 for no Suffix.");
+ return;
+ }
+
+ boolean validInt = false;
+ try {
+ int num = Integer.parseInt(suffix.substring(4, 7));
+ if (num > 0 && num < 329)
+ validInt = true;
+ } catch (Exception e) {
+ throwbackError(pc, "error parsing number " + suffix);
+ }
+ if (!validInt) {
+ throwbackError(pc, "Invalid Suffix. Suffix must consist of SUF-001 to SUF-328 or 0 for no Suffix.");
+ return;
+ }
+ }
+ ItemBase ib = ItemBase.getItemBase(itembaseID);
+ if (ib == null) {
+ throwbackError(pc, "Unable to find itembase of ID " + itembaseID);
+ return;
+ }
+
+ if ((numItems > 1)
+ && (ib.getType().equals(ItemType.RESOURCE) == false)
+ && (ib.getType().equals(ItemType.OFFERING)) == false)
+ numItems = 1;
+
+ CharacterItemManager cim = pc.getCharItemManager();
+ if (cim == null) {
+ throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
+ return;
+ }
+
+ byte charges = (byte) ib.getNumCharges();
+ short dur = (short) ib.getDurability();
+
+ String result = "";
+ for (int i = 0; i < quantity; i++) {
+ short weight = ib.getWeight();
+ if (!cim.hasRoomInventory(weight)) {
+ throwbackError(pc, "Not enough room in inventory for any more of this item. " + i + " produced.");
+ if (i > 0)
+ cim.updateInventory();
+ return;
+ }
+
+ boolean worked = false;
+ Item item = new Item(ib, pc.getObjectUUID(),
+ OwnerType.PlayerCharacter, charges, charges, dur, dur,
+ true, false, ItemContainerType.INVENTORY, (byte) 0,
+ new ArrayList<>(), "");
+ if (numItems > 1)
+ item.setNumOfItems(numItems);
+
+ try {
+ item = DbManager.ItemQueries.ADD_ITEM(item);
+ worked = true;
+ } catch (Exception e) {
+ throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
+ return;
+ }
+
+ if (item == null || !worked) {
+ throwbackError(pc, "DB error 2: Unable to create item.");
+ return;
+ }
+
+ //create prefix
+ if (!prefix.isEmpty())
+ item.addPermanentEnchantmentForDev(prefix, 0);
+
+ //create suffix
+ if (!suffix.isEmpty())
+ item.addPermanentEnchantmentForDev(suffix, 0);
+
+ //add item to inventory
+ cim.addItemToInventory(item);
+ result += " " + item.getObjectUUID();
+ }
+ this.setResult(result);
+ cim.updateInventory();
+ }
+
+ @Override
+ protected String _getHelpString() {
return "Creates an item of type 'itembaseID' with a prefix and suffix";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "'./makeitem itembaseID PrefixID SuffixID [quantity] [numResources]'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/NetDebugCmd.java b/src/engine/devcmd/cmds/NetDebugCmd.java
index 065ff18d..202dc7b8 100644
--- a/src/engine/devcmd/cmds/NetDebugCmd.java
+++ b/src/engine/devcmd/cmds/NetDebugCmd.java
@@ -6,81 +6,79 @@ import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
/**
- * @author
- * Summary: Devcmd to toggle logging of application protocol messages
- *
+ * @author Summary: Devcmd to toggle logging of application protocol messages
*/
-
+
public class NetDebugCmd extends AbstractDevCmd {
// Instance variables
-
-
- public NetDebugCmd() {
+
+
+ public NetDebugCmd() {
super("netdebug");
}
-
- // AbstractDevCmd Overridden methods
-
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] args,
- AbstractGameObject target) {
-
- Boolean debugState = false;
-
- if(validateUserInput(args) == false) {
- this.sendUsage(pc);
- return;
- }
-
- // Arguments have been validated use argument to set debug state
-
- switch (args[0]) {
- case "on":
- debugState = true;
- break;
- case "off":
- debugState = false;
- break;
- default:
- break;
- }
-
- MBServerStatics.DEBUG_PROTOCOL = debugState;
-
- // Send results to user
- throwbackInfo(pc, "Network debug state: " + debugState.toString());
- }
-
- @Override
- protected String _getHelpString() {
- return "Toggles sending network messages to log";
- }
- @Override
- protected String _getUsageString() {
- return "/netdebug on|off";
- }
+ // AbstractDevCmd Overridden methods
- // Class methods
-
- private static boolean validateUserInput(String[] userInput) {
+ private static boolean validateUserInput(String[] userInput) {
int stringIndex;
String commandSet = "onoff";
-
+
// incorrect number of arguments test
-
+
if (userInput.length != 1)
- return false;
+ return false;
// Validate arguments
-
+
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
- return stringIndex != -1;
+ return stringIndex != -1;
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] args,
+ AbstractGameObject target) {
+
+ Boolean debugState = false;
+
+ if (validateUserInput(args) == false) {
+ this.sendUsage(pc);
+ return;
}
-
-
+
+ // Arguments have been validated use argument to set debug state
+
+ switch (args[0]) {
+ case "on":
+ debugState = true;
+ break;
+ case "off":
+ debugState = false;
+ break;
+ default:
+ break;
+ }
+
+ MBServerStatics.DEBUG_PROTOCOL = debugState;
+
+ // Send results to user
+ throwbackInfo(pc, "Network debug state: " + debugState.toString());
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Toggles sending network messages to log";
+ }
+
+ // Class methods
+
+ @Override
+ protected String _getUsageString() {
+ return "/netdebug on|off";
+ }
+
+
}
diff --git a/src/engine/devcmd/cmds/PrintBankCmd.java b/src/engine/devcmd/cmds/PrintBankCmd.java
index 981d4014..7074af52 100644
--- a/src/engine/devcmd/cmds/PrintBankCmd.java
+++ b/src/engine/devcmd/cmds/PrintBankCmd.java
@@ -16,58 +16,58 @@ import java.util.ArrayList;
public class PrintBankCmd extends AbstractDevCmd {
- public PrintBankCmd() {
- super("printbank");
- }
+ public PrintBankCmd() {
+ super("printbank");
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- AbstractWorldObject tar;
- String name;
- String type = "PlayerCharacter";
+ AbstractWorldObject tar;
+ String name;
+ String type = "PlayerCharacter";
- if (target != null) {
- if (target instanceof AbstractCharacter) {
- tar = (AbstractCharacter) target;
- name = ((AbstractCharacter) tar).getFirstName();
- } else {
- tar = pc;
- name = ((AbstractCharacter) tar).getFirstName();
- }
- } else {
- tar = pc;
- name = ((AbstractCharacter) tar).getFirstName();
- }
+ if (target != null) {
+ if (target instanceof AbstractCharacter) {
+ tar = (AbstractCharacter) target;
+ name = ((AbstractCharacter) tar).getFirstName();
+ } else {
+ tar = pc;
+ name = ((AbstractCharacter) tar).getFirstName();
+ }
+ } else {
+ tar = pc;
+ name = ((AbstractCharacter) tar).getFirstName();
+ }
- if (!(tar instanceof PlayerCharacter)) {
- throwbackError(pc, "Must target player");
- return;
- }
+ if (!(tar instanceof PlayerCharacter)) {
+ throwbackError(pc, "Must target player");
+ return;
+ }
- CharacterItemManager cim = ((AbstractCharacter)tar).getCharItemManager();
- ArrayList- list = cim.getBank();
- throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
- for (Item item : list) {
- throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
- }
- Item gold = cim.getGoldBank();
- if (gold != null)
- throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
- else
- throwbackInfo(pc, " NULL Gold");
- }
+ CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
+ ArrayList
- list = cim.getBank();
+ throwbackInfo(pc, "Bank for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
+ for (Item item : list) {
+ throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
+ }
+ Item gold = cim.getGoldBank();
+ if (gold != null)
+ throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
+ else
+ throwbackInfo(pc, " NULL Gold");
+ }
- @Override
- protected String _getHelpString() {
- return "Returns the player's current bank";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Returns the player's current bank";
+ }
- @Override
- protected String _getUsageString() {
- return "' /printbank'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /printbank'";
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintBonusesCmd.java b/src/engine/devcmd/cmds/PrintBonusesCmd.java
index b425ec45..e642b712 100644
--- a/src/engine/devcmd/cmds/PrintBonusesCmd.java
+++ b/src/engine/devcmd/cmds/PrintBonusesCmd.java
@@ -17,75 +17,74 @@ import engine.powers.effectmodifiers.AbstractEffectModifier;
public class PrintBonusesCmd extends AbstractDevCmd {
- public PrintBonusesCmd() {
- super("printbonuses");
- // super("printbonuses", MBServerStatics.ACCESS_LEVEL_ADMIN);
- }
+ public PrintBonusesCmd() {
+ super("printbonuses");
+ // super("printbonuses", MBServerStatics.ACCESS_LEVEL_ADMIN);
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- AbstractWorldObject tar;
- String name;
- String type = "PlayerCharacter";
- if (target != null)
- if (target instanceof Item) {
- type = "Item";
- tar = (Item) target;
- name = ((Item) tar).getItemBase().getName();
- } else if (target instanceof AbstractCharacter) {
- tar = (AbstractCharacter) target;
- name = ((AbstractCharacter) tar).getFirstName();
- } else {
- tar = pc;
- name = ((AbstractCharacter) tar).getFirstName();
- }
- else {
- tar = pc;
- name = ((AbstractCharacter) tar).getFirstName();
- }
+ AbstractWorldObject tar;
+ String name;
+ String type = "PlayerCharacter";
+ if (target != null)
+ if (target instanceof Item) {
+ type = "Item";
+ tar = (Item) target;
+ name = ((Item) tar).getItemBase().getName();
+ } else if (target instanceof AbstractCharacter) {
+ tar = (AbstractCharacter) target;
+ name = ((AbstractCharacter) tar).getFirstName();
+ } else {
+ tar = pc;
+ name = ((AbstractCharacter) tar).getFirstName();
+ }
+ else {
+ tar = pc;
+ name = ((AbstractCharacter) tar).getFirstName();
+ }
- //Get name and type
- if (tar instanceof Mob) {
- Mob mob = (Mob) tar;
- MobBase mb = mob.getMobBase();
- if (mb != null)
- name = mb.getFirstName();
- type = "Mob";
- } else if (tar instanceof NPC) {
- NPC npc = (NPC) tar;
- Contract contract = npc.getContract();
- if (contract != null)
- if (contract.isTrainer())
- name = tar.getName() + ", " + contract.getName();
- else
- name = tar.getName() + " the " + contract.getName();
- type = "NPC";
- }
+ //Get name and type
+ if (tar instanceof Mob) {
+ Mob mob = (Mob) tar;
+ MobBase mb = mob.getMobBase();
+ if (mb != null)
+ name = mb.getFirstName();
+ type = "Mob";
+ } else if (tar instanceof NPC) {
+ NPC npc = (NPC) tar;
+ Contract contract = npc.getContract();
+ if (contract != null)
+ if (contract.isTrainer())
+ name = tar.getName() + ", " + contract.getName();
+ else
+ name = tar.getName() + " the " + contract.getName();
+ type = "NPC";
+ }
- if (tar.getObjectType() == GameObjectType.Item) {
- Item targetItem = (Item) tar;
+ if (tar.getObjectType() == GameObjectType.Item) {
+ Item targetItem = (Item) tar;
- if (targetItem.getBonuses() != null)
- for (AbstractEffectModifier targetName : targetItem.getBonuses().keySet()) {
- ChatManager.chatSystemInfo(pc, " " + targetName.modType.name() + "-" + targetName.sourceType.name() + ": " + targetItem.getBonuses().get(name));
- }
- } else if (((AbstractCharacter)tar).getBonuses() != null) {
- ((AbstractCharacter)tar).getBonuses().printBonusesToClient(pc);
- }
- else
- throwbackInfo(pc, "Bonuses for " + type + ' ' + name + " not found");
- }
+ if (targetItem.getBonuses() != null)
+ for (AbstractEffectModifier targetName : targetItem.getBonuses().keySet()) {
+ ChatManager.chatSystemInfo(pc, " " + targetName.modType.name() + "-" + targetName.sourceType.name() + ": " + targetItem.getBonuses().get(name));
+ }
+ } else if (((AbstractCharacter) tar).getBonuses() != null) {
+ ((AbstractCharacter) tar).getBonuses().printBonusesToClient(pc);
+ } else
+ throwbackInfo(pc, "Bonuses for " + type + ' ' + name + " not found");
+ }
- @Override
- protected String _getHelpString() {
- return "Returns the player's current bonuses";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Returns the player's current bonuses";
+ }
- @Override
- protected String _getUsageString() {
- return "' /printbonuses'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /printbonuses'";
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintEquipCmd.java b/src/engine/devcmd/cmds/PrintEquipCmd.java
index 284ff49e..2bf192fe 100644
--- a/src/engine/devcmd/cmds/PrintEquipCmd.java
+++ b/src/engine/devcmd/cmds/PrintEquipCmd.java
@@ -17,86 +17,86 @@ import java.util.concurrent.ConcurrentHashMap;
public class PrintEquipCmd extends AbstractDevCmd {
- public PrintEquipCmd() {
- super("printequip");
- }
+ public PrintEquipCmd() {
+ super("printequip");
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- AbstractWorldObject tar;
- String name;
- String type = "PlayerCharacter";
- if (target != null) {
- if (target instanceof AbstractCharacter) {
- tar = (AbstractCharacter) target;
- name = ((AbstractCharacter) tar).getFirstName();
- } else {
- tar = pc;
- name = ((AbstractCharacter) tar).getFirstName();
- }
- } else {
- tar = pc;
- name = ((AbstractCharacter) tar).getFirstName();
- }
+ AbstractWorldObject tar;
+ String name;
+ String type = "PlayerCharacter";
+ if (target != null) {
+ if (target instanceof AbstractCharacter) {
+ tar = (AbstractCharacter) target;
+ name = ((AbstractCharacter) tar).getFirstName();
+ } else {
+ tar = pc;
+ name = ((AbstractCharacter) tar).getFirstName();
+ }
+ } else {
+ tar = pc;
+ name = ((AbstractCharacter) tar).getFirstName();
+ }
- //Get name and type
- if (tar instanceof Mob) {
- Mob mob = (Mob) tar;
- MobBase mb = mob.getMobBase();
- if (mb != null)
- name = mb.getFirstName();
- type = "Mob";
- } else if (tar instanceof NPC) {
- NPC npc = (NPC) tar;
- Contract contract = npc.getContract();
- if (contract != null) {
- if (contract.isTrainer())
- name = tar.getName() + ", " + contract.getName();
- else
- name = tar.getName() + " the " + contract.getName();
- }
- type = "NPC";
- }
+ //Get name and type
+ if (tar instanceof Mob) {
+ Mob mob = (Mob) tar;
+ MobBase mb = mob.getMobBase();
+ if (mb != null)
+ name = mb.getFirstName();
+ type = "Mob";
+ } else if (tar instanceof NPC) {
+ NPC npc = (NPC) tar;
+ Contract contract = npc.getContract();
+ if (contract != null) {
+ if (contract.isTrainer())
+ name = tar.getName() + ", " + contract.getName();
+ else
+ name = tar.getName() + " the " + contract.getName();
+ }
+ type = "NPC";
+ }
- if (tar.getObjectType() == GameObjectType.Mob){
- Mob tarMob = (Mob)tar;
- throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
- for (int slot:tarMob.getEquip().keySet()){
- MobEquipment equip = tarMob.getEquip().get(slot);
- throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
- }
- return;
- }
+ if (tar.getObjectType() == GameObjectType.Mob) {
+ Mob tarMob = (Mob) tar;
+ throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
+ for (int slot : tarMob.getEquip().keySet()) {
+ MobEquipment equip = tarMob.getEquip().get(slot);
+ throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
+ }
+ return;
+ }
- if (tar.getObjectType() == GameObjectType.NPC){
- NPC tarMob = (NPC)tar;
- throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
- for (int slot:tarMob.getEquip().keySet()){
- MobEquipment equip = tarMob.getEquip().get(slot);
- throwbackInfo(pc,equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
- }
- return;
- }
+ if (tar.getObjectType() == GameObjectType.NPC) {
+ NPC tarMob = (NPC) tar;
+ throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
+ for (int slot : tarMob.getEquip().keySet()) {
+ MobEquipment equip = tarMob.getEquip().get(slot);
+ throwbackInfo(pc, equip.getItemBase().getUUID() + " : " + equip.getItemBase().getName() + ", slot: " + slot);
+ }
+ return;
+ }
- CharacterItemManager cim = ((AbstractCharacter)tar).getCharItemManager();
- ConcurrentHashMap list = cim.getEquipped();
- throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
- for (Integer slot : list.keySet()) {
- Item item = list.get(slot);
- throwbackInfo(pc, " " + item.getItemBase().getName() + ", slot: " + slot);
- }
- }
+ CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
+ ConcurrentHashMap list = cim.getEquipped();
+ throwbackInfo(pc, "Equip for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
+ for (Integer slot : list.keySet()) {
+ Item item = list.get(slot);
+ throwbackInfo(pc, " " + item.getItemBase().getName() + ", slot: " + slot);
+ }
+ }
- @Override
- protected String _getHelpString() {
- return "Returns the player's current equipment";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Returns the player's current equipment";
+ }
- @Override
- protected String _getUsageString() {
- return "' /printequip'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /printequip'";
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintInventoryCmd.java b/src/engine/devcmd/cmds/PrintInventoryCmd.java
index c151b923..5535f22e 100644
--- a/src/engine/devcmd/cmds/PrintInventoryCmd.java
+++ b/src/engine/devcmd/cmds/PrintInventoryCmd.java
@@ -18,92 +18,93 @@ import java.util.ArrayList;
public class PrintInventoryCmd extends AbstractDevCmd {
- public PrintInventoryCmd() {
- super("printinventory");
- }
-
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
- if (target == null || (!(target instanceof AbstractCharacter) && !(target instanceof Corpse))) {
- target = pc;
- }
-
-
- String type = target.getClass().getSimpleName();
- String name = "";
- ArrayList
- inventory = null;
- Item gold = null;
- DecimalFormat df = new DecimalFormat("###,###,###,##0");
-
- if (target instanceof AbstractCharacter) {
- AbstractCharacter tar = (AbstractCharacter)target;
-
- name = tar.getFirstName();
-
- if (tar instanceof Mob) {
- Mob mob = (Mob) tar;
- MobBase mb = mob.getMobBase();
- if (mb != null) {
- name = mb.getFirstName();
- }
- } else if (tar instanceof NPC) {
- NPC npc = (NPC) tar;
- Contract contract = npc.getContract();
- if (contract != null) {
- if (contract.isTrainer()) {
- name = tar.getName() + ", " + contract.getName();
- } else {
- name = tar.getName() + " the " + contract.getName();
- }
- }
- }
-
- CharacterItemManager cim = tar.getCharItemManager();
- inventory = cim.getInventory(); //this list can contain gold when tar is a PC that is dead
- gold = cim.getGoldInventory();
- throwbackInfo(pc, " Weight : " + (cim.getInventoryWeight() + cim.getEquipWeight()));
- } else if (target instanceof Corpse) {
- Corpse corpse = (Corpse) target;
- name = "of " + corpse.getName();
- inventory = corpse.getInventory();
- }
-
- throwbackInfo(pc, "Inventory for " + type + ' ' + name + " (" + target.getObjectUUID() + ')');
-
- int goldCount = 0;
-
- for (Item item : inventory) {
- if (item.getItemBase().getType().equals(ItemType.GOLD) == false) {
- String chargeInfo = "";
- byte chargeMax = item.getChargesMax();
- if (chargeMax > 0) {
- byte charges = item.getChargesRemaining();
- chargeInfo = " charges: " + charges + '/' + chargeMax;
- }
- throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems() + chargeInfo);
- } else goldCount += item.getNumOfItems();
- }
- if (gold != null) {
- goldCount += gold.getNumOfItems();
- }
-
- if (goldCount > 0 || gold != null) {
- throwbackInfo(pc, " Gold, count: " + df.format(goldCount));
- } else {
- throwbackInfo(pc, " NULL Gold");
- }
- }
-
- @Override
- protected String _getHelpString() {
- return "Returns the player's current inventory";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /printinventory'";
- }
+ public PrintInventoryCmd() {
+ super("printinventory");
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+
+ if (target == null || (!(target instanceof AbstractCharacter) && !(target instanceof Corpse))) {
+ target = pc;
+ }
+
+
+ String type = target.getClass().getSimpleName();
+ String name = "";
+ ArrayList
- inventory = null;
+ Item gold = null;
+ DecimalFormat df = new DecimalFormat("###,###,###,##0");
+
+ if (target instanceof AbstractCharacter) {
+ AbstractCharacter tar = (AbstractCharacter) target;
+
+ name = tar.getFirstName();
+
+ if (tar instanceof Mob) {
+ Mob mob = (Mob) tar;
+ MobBase mb = mob.getMobBase();
+ if (mb != null) {
+ name = mb.getFirstName();
+ }
+ } else if (tar instanceof NPC) {
+ NPC npc = (NPC) tar;
+ Contract contract = npc.getContract();
+ if (contract != null) {
+ if (contract.isTrainer()) {
+ name = tar.getName() + ", " + contract.getName();
+ } else {
+ name = tar.getName() + " the " + contract.getName();
+ }
+ }
+ }
+
+ CharacterItemManager cim = tar.getCharItemManager();
+ inventory = cim.getInventory(); //this list can contain gold when tar is a PC that is dead
+ gold = cim.getGoldInventory();
+ throwbackInfo(pc, " Weight : " + (cim.getInventoryWeight() + cim.getEquipWeight()));
+ } else if (target instanceof Corpse) {
+ Corpse corpse = (Corpse) target;
+ name = "of " + corpse.getName();
+ inventory = corpse.getInventory();
+ }
+
+ throwbackInfo(pc, "Inventory for " + type + ' ' + name + " (" + target.getObjectUUID() + ')');
+
+ int goldCount = 0;
+
+ for (Item item : inventory) {
+ if (item.getItemBase().getType().equals(ItemType.GOLD) == false) {
+ String chargeInfo = "";
+ byte chargeMax = item.getChargesMax();
+ if (chargeMax > 0) {
+ byte charges = item.getChargesRemaining();
+ chargeInfo = " charges: " + charges + '/' + chargeMax;
+ }
+ throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems() + chargeInfo);
+ } else
+ goldCount += item.getNumOfItems();
+ }
+ if (gold != null) {
+ goldCount += gold.getNumOfItems();
+ }
+
+ if (goldCount > 0 || gold != null) {
+ throwbackInfo(pc, " Gold, count: " + df.format(goldCount));
+ } else {
+ throwbackInfo(pc, " NULL Gold");
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Returns the player's current inventory";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /printinventory'";
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintLocationCmd.java b/src/engine/devcmd/cmds/PrintLocationCmd.java
index e8ce418d..053ea33e 100644
--- a/src/engine/devcmd/cmds/PrintLocationCmd.java
+++ b/src/engine/devcmd/cmds/PrintLocationCmd.java
@@ -16,52 +16,51 @@ import engine.objects.Regions;
/**
* @author Eighty
- *
*/
public class PrintLocationCmd extends AbstractDevCmd {
- public PrintLocationCmd() {
- super("printloc");
- }
+ public PrintLocationCmd() {
+ super("printloc");
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- PlayerCharacter tar;
+ PlayerCharacter tar;
- if (target != null && target instanceof PlayerCharacter)
- tar = (PlayerCharacter) target;
- else
- tar = pc;
+ if (target != null && target instanceof PlayerCharacter)
+ tar = (PlayerCharacter) target;
+ else
+ tar = pc;
- throwbackInfo(pc, "Server location for " + tar.getFirstName());
- if (tar.getLoc() != null) {
- throwbackInfo(pc, "Lat: " + tar.getLoc().getX());
- throwbackInfo(pc, "Lon: " + -tar.getLoc().getZ());
- throwbackInfo(pc, "Alt: " + tar.getLoc().getY());
- if (pc.region != null) {
- this.throwbackInfo(pc, "Player Region Slope Position : " + Regions.SlopeLerpPercent(pc, pc.region));
- this.throwbackInfo(pc, "Region Slope Magnitude : " + Regions.GetMagnitudeOfRegionSlope(pc.region));
- this.throwbackInfo(pc, "Player Region Slope Magnitude : " + Regions.GetMagnitudeOfPlayerOnRegionSlope(pc.region, pc));
- } else {
- this.throwbackInfo(pc, "No Region Found for player.");
- }
+ throwbackInfo(pc, "Server location for " + tar.getFirstName());
+ if (tar.getLoc() != null) {
+ throwbackInfo(pc, "Lat: " + tar.getLoc().getX());
+ throwbackInfo(pc, "Lon: " + -tar.getLoc().getZ());
+ throwbackInfo(pc, "Alt: " + tar.getLoc().getY());
+ if (pc.region != null) {
+ this.throwbackInfo(pc, "Player Region Slope Position : " + Regions.SlopeLerpPercent(pc, pc.region));
+ this.throwbackInfo(pc, "Region Slope Magnitude : " + Regions.GetMagnitudeOfRegionSlope(pc.region));
+ this.throwbackInfo(pc, "Player Region Slope Magnitude : " + Regions.GetMagnitudeOfPlayerOnRegionSlope(pc.region, pc));
+ } else {
+ this.throwbackInfo(pc, "No Region Found for player.");
+ }
- } else {
- throwbackInfo(pc, "Server location for " + tar.getFirstName()
- + " not found");
- }
- }
+ } else {
+ throwbackInfo(pc, "Server location for " + tar.getFirstName()
+ + " not found");
+ }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Returns the player's current location according to the server";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /printloc'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintPowersCmd.java b/src/engine/devcmd/cmds/PrintPowersCmd.java
index 8c9fa980..0264439e 100644
--- a/src/engine/devcmd/cmds/PrintPowersCmd.java
+++ b/src/engine/devcmd/cmds/PrintPowersCmd.java
@@ -19,50 +19,50 @@ import java.util.concurrent.ConcurrentHashMap;
public class PrintPowersCmd extends AbstractDevCmd {
- public PrintPowersCmd() {
- super("printpowers");
- // super("printpowers", MBServerStatics.ACCESS_LEVEL_ADMIN);
- }
+ public PrintPowersCmd() {
+ super("printpowers");
+ // super("printpowers", MBServerStatics.ACCESS_LEVEL_ADMIN);
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- PlayerCharacter tar;
+ PlayerCharacter tar;
- if (target != null && target instanceof PlayerCharacter)
- tar = (PlayerCharacter) target;
- else
- tar = pc;
+ if (target != null && target instanceof PlayerCharacter)
+ tar = (PlayerCharacter) target;
+ else
+ tar = pc;
- throwbackInfo(pc, "Server powers for " + tar.getFirstName());
+ throwbackInfo(pc, "Server powers for " + tar.getFirstName());
- ConcurrentHashMap powers = tar.getPowers();
- if (powers != null) {
- throwbackInfo(pc,
- "Power(token): Trains; TrainsGranted; MaxTrains");
- for (CharacterPower power : powers.values()) {
- PowersBase pb = power.getPower();
- if (pb != null) {
- throwbackInfo(pc, " " + pb.getName() + '('
- + pb.getToken() + "): "
- + power.getTrains() + "; "
- + power.getGrantedTrains() + "; "
- + pb.getMaxTrains());
- }
- }
- } else
- throwbackInfo(pc, "Powers not found for player");
- }
+ ConcurrentHashMap powers = tar.getPowers();
+ if (powers != null) {
+ throwbackInfo(pc,
+ "Power(token): Trains; TrainsGranted; MaxTrains");
+ for (CharacterPower power : powers.values()) {
+ PowersBase pb = power.getPower();
+ if (pb != null) {
+ throwbackInfo(pc, " " + pb.getName() + '('
+ + pb.getToken() + "): "
+ + power.getTrains() + "; "
+ + power.getGrantedTrains() + "; "
+ + pb.getMaxTrains());
+ }
+ }
+ } else
+ throwbackInfo(pc, "Powers not found for player");
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Returns the player's current granted powers";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /printpowers'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintResistsCmd.java b/src/engine/devcmd/cmds/PrintResistsCmd.java
index 49a9e0e1..2bcfbf46 100644
--- a/src/engine/devcmd/cmds/PrintResistsCmd.java
+++ b/src/engine/devcmd/cmds/PrintResistsCmd.java
@@ -14,58 +14,58 @@ import engine.objects.*;
public class PrintResistsCmd extends AbstractDevCmd {
- public PrintResistsCmd() {
- super("printresists");
- // super("printresists", MBServerStatics.ACCESS_LEVEL_ADMIN);
- }
+ public PrintResistsCmd() {
+ super("printresists");
+ // super("printresists", MBServerStatics.ACCESS_LEVEL_ADMIN);
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- AbstractCharacter tar;
+ AbstractCharacter tar;
- if (target != null && target instanceof AbstractCharacter) {
- tar = (AbstractCharacter) target;
- } else
- tar = pc;
+ if (target != null && target instanceof AbstractCharacter) {
+ tar = (AbstractCharacter) target;
+ } else
+ tar = pc;
- //Get name and type
- String type = "PlayerCharacter";
- String name = tar.getFirstName();
- if (tar instanceof Mob) {
- Mob mob = (Mob) tar;
- MobBase mb = mob.getMobBase();
- if (mb != null)
- name = mb.getFirstName();
- type = "Mob";
- } else if (tar instanceof NPC) {
- NPC npc = (NPC) tar;
- Contract contract = npc.getContract();
- if (contract != null) {
- if (contract.isTrainer())
- name = tar.getName() + ", " + contract.getName();
- else
- name = tar.getName() + " the " + contract.getName();
- }
- type = "NPC";
- }
+ //Get name and type
+ String type = "PlayerCharacter";
+ String name = tar.getFirstName();
+ if (tar instanceof Mob) {
+ Mob mob = (Mob) tar;
+ MobBase mb = mob.getMobBase();
+ if (mb != null)
+ name = mb.getFirstName();
+ type = "Mob";
+ } else if (tar instanceof NPC) {
+ NPC npc = (NPC) tar;
+ Contract contract = npc.getContract();
+ if (contract != null) {
+ if (contract.isTrainer())
+ name = tar.getName() + ", " + contract.getName();
+ else
+ name = tar.getName() + " the " + contract.getName();
+ }
+ type = "NPC";
+ }
- throwbackInfo(pc, "Server resists for " + type + ' ' + name);
- if (tar.getResists() != null) {
- tar.getResists().printResistsToClient(pc);
- } else
- throwbackInfo(pc, "Resists for " + type + ' ' + name + " not found");
- }
+ throwbackInfo(pc, "Server resists for " + type + ' ' + name);
+ if (tar.getResists() != null) {
+ tar.getResists().printResistsToClient(pc);
+ } else
+ throwbackInfo(pc, "Resists for " + type + ' ' + name + " not found");
+ }
- @Override
- protected String _getHelpString() {
- return "Returns the player's current resists";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Returns the player's current resists";
+ }
- @Override
- protected String _getUsageString() {
- return "' /printresists'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /printresists'";
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintSkillsCmd.java b/src/engine/devcmd/cmds/PrintSkillsCmd.java
index 6ab5068a..51fbe1bc 100644
--- a/src/engine/devcmd/cmds/PrintSkillsCmd.java
+++ b/src/engine/devcmd/cmds/PrintSkillsCmd.java
@@ -17,50 +17,50 @@ import java.util.concurrent.ConcurrentHashMap;
public class PrintSkillsCmd extends AbstractDevCmd {
- public PrintSkillsCmd() {
- super("printskills");
- // super("printskills", MBServerStatics.ACCESS_LEVEL_ADMIN);
- }
+ public PrintSkillsCmd() {
+ super("printskills");
+ // super("printskills", MBServerStatics.ACCESS_LEVEL_ADMIN);
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- AbstractCharacter tar = null;
+ AbstractCharacter tar = null;
- if (target != null && target instanceof PlayerCharacter)
- tar = (PlayerCharacter) target;
- else if (target.getObjectType() == GameObjectType.Mob)
- tar = (Mob) target;
- else
- tar = pc;
+ if (target != null && target instanceof PlayerCharacter)
+ tar = (PlayerCharacter) target;
+ else if (target.getObjectType() == GameObjectType.Mob)
+ tar = (Mob) target;
+ else
+ tar = pc;
- throwbackInfo(pc, "Server skills for " + tar.getFirstName());
- ConcurrentHashMap skills = tar.getSkills();
- if (skills != null) {
- throwbackInfo(pc,
- "Skills Name: Trains; Base(Trains); ModBase(Trains)");
- for (CharacterSkill skill : skills.values()) {
- throwbackInfo(pc, " " + skill.getName() + ": "
- + skill.getNumTrains() + "; "
- + skill.getBaseAmountBeforeMods() + " ("
- + skill.getModifiedAmountBeforeMods() + "); "
- + skill.getBaseAmount() + " ("
- + skill.getModifiedAmount() + '('
- + skill.getTotalSkillPercet() + " )");
- }
- } else
- throwbackInfo(pc, "Skills not found for player");
- }
+ throwbackInfo(pc, "Server skills for " + tar.getFirstName());
+ ConcurrentHashMap skills = tar.getSkills();
+ if (skills != null) {
+ throwbackInfo(pc,
+ "Skills Name: Trains; Base(Trains); ModBase(Trains)");
+ for (CharacterSkill skill : skills.values()) {
+ throwbackInfo(pc, " " + skill.getName() + ": "
+ + skill.getNumTrains() + "; "
+ + skill.getBaseAmountBeforeMods() + " ("
+ + skill.getModifiedAmountBeforeMods() + "); "
+ + skill.getBaseAmount() + " ("
+ + skill.getModifiedAmount() + '('
+ + skill.getTotalSkillPercet() + " )");
+ }
+ } else
+ throwbackInfo(pc, "Skills not found for player");
+ }
- @Override
- protected String _getHelpString() {
- return "Returns the player's current skills";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Returns the player's current skills";
+ }
- @Override
- protected String _getUsageString() {
- return "' /printskills'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /printskills'";
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintStatsCmd.java b/src/engine/devcmd/cmds/PrintStatsCmd.java
index aee35228..1b6b30ca 100644
--- a/src/engine/devcmd/cmds/PrintStatsCmd.java
+++ b/src/engine/devcmd/cmds/PrintStatsCmd.java
@@ -20,135 +20,133 @@ import java.util.HashMap;
public class PrintStatsCmd extends AbstractDevCmd {
- public PrintStatsCmd() {
- super("printstats");
- // super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
- }
-
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
- AbstractCharacter tar;
-
- if (target != null && target instanceof AbstractCharacter) {
- tar = (AbstractCharacter) target;
-
- if (tar instanceof PlayerCharacter) {
- printStatsPlayer(pc, (PlayerCharacter) tar);
- this.setTarget(tar); //for logging
- } else if (tar instanceof Mob)
- printStatsMob(pc, (Mob) tar);
- else if (tar instanceof NPC)
- printStatsNPC(pc, (NPC) tar);
- }
- }
-
- public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
- String newline = "\r\n ";
- String out = "Server stats for Player " + tar.getFirstName() + newline;
- out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
- out += "Stats Base (Modified)" + newline;
+ public PrintStatsCmd() {
+ super("printstats");
+ // super("printstats", MBServerStatics.ACCESS_LEVEL_ADMIN);
+ }
+
+ public static ItemBase getWeaponBase(int slot, HashMap equip) {
+ if (equip.containsKey(slot)) {
+ MobEquipment item = equip.get(slot);
+ if (item != null && item.getItemBase() != null) {
+ return item.getItemBase();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+
+ AbstractCharacter tar;
+
+ if (target != null && target instanceof AbstractCharacter) {
+ tar = (AbstractCharacter) target;
+
+ if (tar instanceof PlayerCharacter) {
+ printStatsPlayer(pc, (PlayerCharacter) tar);
+ this.setTarget(tar); //for logging
+ } else if (tar instanceof Mob)
+ printStatsMob(pc, (Mob) tar);
+ else if (tar instanceof NPC)
+ printStatsNPC(pc, (NPC) tar);
+ }
+ }
+
+ public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
+ String newline = "\r\n ";
+ String out = "Server stats for Player " + tar.getFirstName() + newline;
+ out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
+ out += "Stats Base (Modified)" + newline;
out += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
- out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
- out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
- out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
- out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
- throwbackInfo(pc, out);
- out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
- out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
- out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
- out += "Defense: " + tar.getDefenseRating() + newline;
- out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
- out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
- out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
- throwbackInfo(pc, out);
- }
-
- public void printStatsMob(PlayerCharacter pc, Mob tar) {
- MobBase mb = tar.getMobBase();
- if (mb == null)
- return;
-
-
-
- String newline = "\r\n ";
- String out = "Server stats for Mob " + mb.getFirstName() + newline;
- out += "Stats Base (Modified)" + newline;
- out += " Str: " + tar.getStatStrCurrent() + " (" + tar.getStatStrCurrent() + ')' + newline;
- out += " Dex: " + tar.getStatDexCurrent() + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getStatDexCurrent() + newline;
- out += " Con: " + tar.getStatConCurrent() + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getStatConCurrent() + newline;
- out += " Int: " + tar.getStatIntCurrent() + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getStatIntCurrent() + newline;
- out += " Spi: " + tar.getStatSpiCurrent() + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getStatSpiCurrent() + newline;
-
- out += "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
- out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
- out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
- out += "Defense: " + tar.getDefenseRating() + newline;
-
- //get weapons
- HashMap equip = tar.getEquip();
- ItemBase main = null;
-
- if (equip != null)
- main = getWeaponBase(1, equip);
- ItemBase off = null;
-
- if (equip != null)
- getWeaponBase(2, equip);
- if (main == null && off == null) {
- out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
- } else {
- if (main != null)
- out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
- if (off != null)
- out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
- }
- out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
-
- throwbackInfo(pc, out);
- }
-
- public void printStatsNPC(PlayerCharacter pc, NPC tar) {
- Contract contract = tar.getContract();
- if (contract == null)
- return;
-
- String newline = "\r\n ";
-
- String name;
- if (contract != null) {
- if (contract.isTrainer())
- name = tar.getName() + ", " + contract.getName();
- else
- name = tar.getName() + " the " + contract.getName();
- } else
- name = tar.getName();
- String out = "Server stats for NPC " + name + newline;
- out += "Sell Percent: " + tar.getSellPercent() + ", Buy Percent: " + tar.getBuyPercent() + newline;
-
- throwbackInfo(pc, out);
- }
-
- public static ItemBase getWeaponBase(int slot, HashMap equip) {
- if (equip.containsKey(slot)) {
- MobEquipment item = equip.get(slot);
- if (item != null && item.getItemBase() != null) {
- return item.getItemBase();
- }
- }
- return null;
- }
-
-
- @Override
- protected String _getHelpString() {
- return "Returns the player's current stats";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /printstats'";
- }
+ out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
+ out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
+ out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
+ out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
+ throwbackInfo(pc, out);
+ out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
+ out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
+ out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
+ out += "Defense: " + tar.getDefenseRating() + newline;
+ out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
+ out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
+ out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
+ throwbackInfo(pc, out);
+ }
+
+ public void printStatsMob(PlayerCharacter pc, Mob tar) {
+ MobBase mb = tar.getMobBase();
+ if (mb == null)
+ return;
+
+
+ String newline = "\r\n ";
+ String out = "Server stats for Mob " + mb.getFirstName() + newline;
+ out += "Stats Base (Modified)" + newline;
+ out += " Str: " + tar.getStatStrCurrent() + " (" + tar.getStatStrCurrent() + ')' + newline;
+ out += " Dex: " + tar.getStatDexCurrent() + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getStatDexCurrent() + newline;
+ out += " Con: " + tar.getStatConCurrent() + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getStatConCurrent() + newline;
+ out += " Int: " + tar.getStatIntCurrent() + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getStatIntCurrent() + newline;
+ out += " Spi: " + tar.getStatSpiCurrent() + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getStatSpiCurrent() + newline;
+
+ out += "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
+ out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
+ out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
+ out += "Defense: " + tar.getDefenseRating() + newline;
+
+ //get weapons
+ HashMap equip = tar.getEquip();
+ ItemBase main = null;
+
+ if (equip != null)
+ main = getWeaponBase(1, equip);
+ ItemBase off = null;
+
+ if (equip != null)
+ getWeaponBase(2, equip);
+ if (main == null && off == null) {
+ out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: 6" + newline;
+ } else {
+ if (main != null)
+ out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + ", range: " + main.getRange() + newline;
+ if (off != null)
+ out += "Main Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + ", range: " + off.getRange() + newline;
+ }
+ out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
+
+ throwbackInfo(pc, out);
+ }
+
+ public void printStatsNPC(PlayerCharacter pc, NPC tar) {
+ Contract contract = tar.getContract();
+ if (contract == null)
+ return;
+
+ String newline = "\r\n ";
+
+ String name;
+ if (contract != null) {
+ if (contract.isTrainer())
+ name = tar.getName() + ", " + contract.getName();
+ else
+ name = tar.getName() + " the " + contract.getName();
+ } else
+ name = tar.getName();
+ String out = "Server stats for NPC " + name + newline;
+ out += "Sell Percent: " + tar.getSellPercent() + ", Buy Percent: " + tar.getBuyPercent() + newline;
+
+ throwbackInfo(pc, out);
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Returns the player's current stats";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /printstats'";
+ }
}
diff --git a/src/engine/devcmd/cmds/PrintVaultCmd.java b/src/engine/devcmd/cmds/PrintVaultCmd.java
index 7ddc411d..b949f18d 100644
--- a/src/engine/devcmd/cmds/PrintVaultCmd.java
+++ b/src/engine/devcmd/cmds/PrintVaultCmd.java
@@ -16,57 +16,57 @@ import java.util.ArrayList;
public class PrintVaultCmd extends AbstractDevCmd {
- public PrintVaultCmd() {
- super("printvault");
- }
+ public PrintVaultCmd() {
+ super("printvault");
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- AbstractWorldObject tar;
- String name;
- String type = "PlayerCharacter";
- if (target != null) {
- if (target instanceof AbstractCharacter) {
- tar = (AbstractCharacter) target;
- name = ((AbstractCharacter) tar).getFirstName();
- } else {
- tar = pc;
- name = ((AbstractCharacter) tar).getFirstName();
- }
- } else {
- tar = pc;
- name = ((AbstractCharacter) tar).getFirstName();
- }
+ AbstractWorldObject tar;
+ String name;
+ String type = "PlayerCharacter";
+ if (target != null) {
+ if (target instanceof AbstractCharacter) {
+ tar = (AbstractCharacter) target;
+ name = ((AbstractCharacter) tar).getFirstName();
+ } else {
+ tar = pc;
+ name = ((AbstractCharacter) tar).getFirstName();
+ }
+ } else {
+ tar = pc;
+ name = ((AbstractCharacter) tar).getFirstName();
+ }
- if (!(tar instanceof PlayerCharacter)) {
- throwbackError(pc, "Must target player");
- return;
- }
+ if (!(tar instanceof PlayerCharacter)) {
+ throwbackError(pc, "Must target player");
+ return;
+ }
- CharacterItemManager cim = ((AbstractCharacter)tar).getCharItemManager();
- ArrayList
- list = cim.getVault();
- throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
- for (Item item : list) {
- throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
- }
- Item gold = cim.getGoldVault();
- if (gold != null)
- throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
- else
- throwbackInfo(pc, " NULL Gold");
- }
+ CharacterItemManager cim = ((AbstractCharacter) tar).getCharItemManager();
+ ArrayList
- list = cim.getVault();
+ throwbackInfo(pc, "Vault for " + type + ' ' + name + " (" + tar.getObjectUUID() + ')');
+ for (Item item : list) {
+ throwbackInfo(pc, " " + item.getItemBase().getName() + ", count: " + item.getNumOfItems());
+ }
+ Item gold = cim.getGoldVault();
+ if (gold != null)
+ throwbackInfo(pc, " Gold, count: " + gold.getNumOfItems());
+ else
+ throwbackInfo(pc, " NULL Gold");
+ }
- @Override
- protected String _getHelpString() {
- return "Returns the player's current vault";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Returns the player's current vault";
+ }
- @Override
- protected String _getUsageString() {
- return "' /printvault'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /printvault'";
+ }
}
diff --git a/src/engine/devcmd/cmds/PullCmd.java b/src/engine/devcmd/cmds/PullCmd.java
index 16c4f4d4..0b26d16b 100644
--- a/src/engine/devcmd/cmds/PullCmd.java
+++ b/src/engine/devcmd/cmds/PullCmd.java
@@ -8,97 +8,95 @@ import engine.math.Vector3fImmutable;
import engine.objects.*;
/**
- *
- * @author
- * Dev command to move mobile and it's spawn location
+ * @author Dev command to move mobile and it's spawn location
* to the player's current location
*/
public class PullCmd extends AbstractDevCmd {
- public PullCmd() {
+ public PullCmd() {
super("pull");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
-
- Mob targetMobile;
- Vector3fImmutable targetLoc;
- Zone serverZone;
-
- if (validateUserInput(pcSender, target, args) == false) {
- this.sendUsage(pcSender);
- return;
- }
-
- targetLoc = pcSender.getLoc();
- serverZone = ZoneManager.findSmallestZone(targetLoc);
- switch (target.getObjectType()) {
- case Mob:
- MoveMobile((Mob) target, pcSender, targetLoc, serverZone);
- break;
- case Building:
- MoveBuilding((Building) target, pcSender, targetLoc, serverZone);
- break;
- case NPC:
- MoveNPC((NPC) target, pcSender, targetLoc, serverZone);
- }
- }
-
- @Override
- protected String _getUsageString() {
- return "/pull";
- }
+ private static void MoveMobile(Mob targetMobile, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
- @Override
- protected String _getHelpString() {
- return "Moves mobile (and spawn) to player's location";
- }
+ Vector3fImmutable localCoords;
+
+ localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
- private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
+ DbManager.MobQueries.MOVE_MOB(targetMobile.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
+ targetMobile.setBindLoc(newLoc);
+ targetMobile.setLoc(newLoc);
+ targetMobile.refresh();
+ }
- // No target
- if (currTarget == null) {
- throwbackError(pcSender, "Requires a Mobile be targeted");
- return false;
- }
- return true;
- }
+ private static void MoveBuilding(Building targetBuilding, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
- private static void MoveMobile(Mob targetMobile, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
+ Vector3fImmutable localCoords;
- Vector3fImmutable localCoords;
+ localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
- 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);
+ }
- 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 MoveNPC(NPC targetNPC, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
- private static void MoveBuilding(Building targetBuilding, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
+ Vector3fImmutable localCoords;
- Vector3fImmutable localCoords;
+ localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
- 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);
+ }
- DbManager.BuildingQueries.MOVE_BUILDING(targetBuilding.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
- targetBuilding.setLoc(newLoc);
- targetBuilding.getBounds().setBounds(targetBuilding);
- targetBuilding.refresh(true);
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+
+ Mob targetMobile;
+ Vector3fImmutable targetLoc;
+ Zone serverZone;
+
+ if (validateUserInput(pcSender, target, args) == false) {
+ this.sendUsage(pcSender);
+ return;
+ }
+
+ targetLoc = pcSender.getLoc();
+ serverZone = ZoneManager.findSmallestZone(targetLoc);
+ switch (target.getObjectType()) {
+ case Mob:
+ MoveMobile((Mob) target, pcSender, targetLoc, serverZone);
+ break;
+ case Building:
+ MoveBuilding((Building) target, pcSender, targetLoc, serverZone);
+ break;
+ case NPC:
+ MoveNPC((NPC) target, pcSender, targetLoc, serverZone);
+ }
+ }
- private static void MoveNPC(NPC targetNPC, PlayerCharacter pcSender, Vector3fImmutable newLoc, Zone serverZone) {
+ @Override
+ protected String _getUsageString() {
+ return "/pull";
+ }
- Vector3fImmutable localCoords;
+ @Override
+ protected String _getHelpString() {
+ return "Moves mobile (and spawn) to player's location";
+ }
- localCoords = ZoneManager.worldToLocal(newLoc, serverZone);
+ private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
- DbManager.NPCQueries.MOVE_NPC(targetNPC.getObjectUUID(), serverZone.getObjectUUID(), localCoords.x, localCoords.y, localCoords.z);
- targetNPC.setBindLoc(newLoc);
- targetNPC.setLoc(newLoc);
- WorldGrid.updateObject(targetNPC, pcSender);
- }
+ // No target
+ if (currTarget == null) {
+ throwbackError(pcSender, "Requires a Mobile be targeted");
+ return false;
+ }
+ return true;
+ }
}
diff --git a/src/engine/devcmd/cmds/PurgeObjectsCmd.java b/src/engine/devcmd/cmds/PurgeObjectsCmd.java
index 13545c84..7a022384 100644
--- a/src/engine/devcmd/cmds/PurgeObjectsCmd.java
+++ b/src/engine/devcmd/cmds/PurgeObjectsCmd.java
@@ -18,50 +18,48 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
- * @author
- * Summary: Game designer utility command to purge all
- objects of a given type within a supplied range
+ * @author Summary: Game designer utility command to purge all
+ * objects of a given type within a supplied range
*/
public class PurgeObjectsCmd extends AbstractDevCmd {
- // Instance variables
+ // Instance variables
- private Vector3fImmutable _currentLocation;
- private float _targetRange;
- private int _targetMask;
+ private Vector3fImmutable _currentLocation;
+ private float _targetRange;
+ private int _targetMask;
- // Concurrency support
+ // Concurrency support
- private ReadWriteLock lock = new ReentrantReadWriteLock();
+ private ReadWriteLock lock = new ReentrantReadWriteLock();
- // Constructor
+ // Constructor
- public PurgeObjectsCmd() {
+ public PurgeObjectsCmd() {
super("purge");
}
- private static void PurgeWalls(Zone zone, PlayerCharacter pc){
+ private static void PurgeWalls(Zone zone, PlayerCharacter pc) {
if (!zone.isPlayerCity())
return;
- for (Building building: zone.zoneBuildingSet){
+ for (Building building : zone.zoneBuildingSet) {
if (!BuildingManager.IsWallPiece(building))
continue;
- for (AbstractCharacter ac: building.getHirelings().keySet()){
+ for (AbstractCharacter ac : building.getHirelings().keySet()) {
NPC npc = null;
Mob mobA = null;
if (ac.getObjectType() == GameObjectType.NPC)
- npc = (NPC)ac;
+ npc = (NPC) ac;
else if (ac.getObjectType() == GameObjectType.Mob)
- mobA = (Mob)ac;
+ mobA = (Mob) ac;
-
- if (npc != null){
- for (Mob mob: npc.getSiegeMinionMap().keySet()){
+ if (npc != null) {
+ for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
@@ -72,8 +70,8 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
DbManager.removeFromCache(GameObjectType.NPC,
npc.getObjectUUID());
WorldGrid.RemoveWorldObject(npc);
- }else if (mobA != null){
- for (Mob mob: mobA.getSiegeMinionMap().keySet()){
+ } else if (mobA != null) {
+ for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
@@ -100,216 +98,215 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
// AbstractDevCmd Overridden methods
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] args,
- AbstractGameObject target) {
+ private static boolean validateUserInput(String[] userInput) {
- // Grab write lock due to use of instance variables
+ int stringIndex;
+ String commandSet = "npcmobmeshall";
- lock.writeLock().lock();
+ // incorrect number of arguments test
- try {
-
- if (args[0].toLowerCase().equals("walls")){
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
-
- PurgeWalls(zone, pc);
- return;
- }
+ if (userInput.length != 2)
+ return false;
- if(validateUserInput(args) == false) {
- this.sendUsage(pc);
- return;
- }
+ // Test of game object type argument
- parseUserInput(args);
+ stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
- // Arguments have been validated and parsed at this point
- // Build array of requested objects
+ if (stringIndex == -1)
+ return false;
- _currentLocation = pc.getLoc();
+ // Test if range argument can convert to a float
- HashSet objectList =
- WorldGrid.getObjectsInRangePartial(_currentLocation, _targetRange, _targetMask);
+ try {
+ Float.parseFloat(userInput[1]);
+ } catch (NumberFormatException | NullPointerException e) {
+ return false;
+ }
- // Iterate through array and remove objects from game world and database
+ // User input passes validation
- for (AbstractWorldObject awo : objectList) {
+ return true;
+ }
- switch(awo.getObjectType()) {
- case Building:
- removeBuilding(pc, (Building) awo);
- break;
- case NPC:
- removeNPC(pc, (NPC) awo);
- break;
- case Mob:
- removeMob(pc, (Mob) awo);
- break;
- default:
- break;
- }
- }
+ private static void removeBuilding(PlayerCharacter pc, Building building) {
- // Send results to user
- throwbackInfo(pc, "Purge: " + objectList.size() + " objects were removed in range " + _targetRange);
- }catch(Exception e){
- Logger.error(e);
- }
+ if ((building.getBlueprintUUID() != 0) &&
+ (building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL))
+ return;
+ if ((building.getBlueprintUUID() != 0) &&
+ (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
+ Shrine.RemoveShrineFromCacheByBuilding(building);
+
+ 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);
+ }
- // Release Reentrant lock
+ }
- finally {
- lock.writeLock().unlock();
- }
- }
- @Override
- protected String _getHelpString() {
- return "Purges game objects within range";
- }
+ DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
+ DbManager.removeFromCache(building);
+ WorldGrid.RemoveWorldObject(building);
+ WorldGrid.removeObject(building, pc);
+ }
- @Override
- protected String _getUsageString() {
- return "/purge [npc|mob|mesh|all] [range <= 200]";
- }
+ 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
+ // Class methods
- private static boolean validateUserInput(String[] userInput) {
+ private static void removeMob(PlayerCharacter pc, Mob mob) {
+ mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
+ mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
+ //mob.setHealth(-1, pc); //Kill it!
+
+ DbManager.MobQueries.DELETE_MOB(mob);
+ DbManager.removeFromCache(mob);
+ WorldGrid.RemoveWorldObject(mob);
+ WorldGrid.removeObject(mob, pc);
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] args,
+ AbstractGameObject target) {
+
+ // Grab write lock due to use of instance variables
+
+ lock.writeLock().lock();
+
+ try {
+
+ if (args[0].toLowerCase().equals("walls")) {
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+
+ PurgeWalls(zone, pc);
+ return;
+ }
+
+ if (validateUserInput(args) == false) {
+ this.sendUsage(pc);
+ return;
+ }
- int stringIndex;
- String commandSet = "npcmobmeshall";
-
- // incorrect number of arguments test
-
- if (userInput.length != 2)
- return false;
-
- // Test of game object type argument
+ parseUserInput(args);
- stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
+ // Arguments have been validated and parsed at this point
+ // Build array of requested objects
- if (stringIndex == -1)
- return false;
-
- // Test if range argument can convert to a float
+ _currentLocation = pc.getLoc();
- try {
- Float.parseFloat(userInput[1]); }
- catch (NumberFormatException | NullPointerException e) {
- return false;
- }
-
- // User input passes validation
-
- return true;
- }
-
- private void parseUserInput(String[] userInput) {
-
- _targetMask = 0;
- _targetRange = 0f;
-
- // Build mask from user input
-
- switch (userInput[0].toLowerCase()) {
- case "npc":
- _targetMask = MBServerStatics.MASK_NPC;
- break;
- case "mob":
- _targetMask = MBServerStatics.MASK_MOB;
- break;
- case "mesh":
- _targetMask = MBServerStatics.MASK_BUILDING;
- break;
- case "all":
- _targetMask = MBServerStatics.MASK_NPC | MBServerStatics.MASK_MOB | MBServerStatics.MASK_BUILDING;
- break;
- default:
- break;
- }
-
- // Parse second argument into range parameter. Cap at 200 units.
-
- _targetRange = Float.parseFloat(userInput[1]);
- _targetRange = Math.min(_targetRange, 200f);
- }
-
- private static void removeBuilding(PlayerCharacter pc, Building building) {
-
- if ((building.getBlueprintUUID() != 0) &&
- (building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL))
- return;
- if ((building.getBlueprintUUID() != 0) &&
- (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
- Shrine.RemoveShrineFromCacheByBuilding(building);
-
- if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
- building.disableSpire(false);
-
- for (AbstractCharacter ac: building.getHirelings().keySet()){
- NPC npc = null;
- Mob mobA = null;
-
- if (ac.getObjectType() == GameObjectType.NPC)
- npc = (NPC)ac;
- else if (ac.getObjectType() == GameObjectType.Mob)
- mobA = (Mob)ac;
-
-
-
- if (npc != null){
- for (Mob mob: npc.getSiegeMinionMap().keySet()){
- WorldGrid.RemoveWorldObject(mob);
- WorldGrid.removeObject(mob, pc);
- //Mob.getRespawnMap().remove(mob);
- if (mob.getParentZone() != null)
- mob.getParentZone().zoneMobSet.remove(mob);
- }
- DbManager.NPCQueries.DELETE_NPC(npc);
- DbManager.removeFromCache(Enum.GameObjectType.NPC,
- npc.getObjectUUID());
- WorldGrid.RemoveWorldObject(npc);
- }else if (mobA != null){
- for (Mob mob: mobA.getSiegeMinionMap().keySet()){
- WorldGrid.RemoveWorldObject(mob);
- WorldGrid.removeObject(mob, pc);
- //Mob.getRespawnMap().remove(mob);
- if (mob.getParentZone() != null)
- mob.getParentZone().zoneMobSet.remove(mob);
- }
- DbManager.MobQueries.DELETE_MOB(mobA);
- DbManager.removeFromCache(Enum.GameObjectType.Mob,
- mobA.getObjectUUID());
- WorldGrid.RemoveWorldObject(mobA);
- }
-
- }
-
-
- DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
- DbManager.removeFromCache(building);
- WorldGrid.RemoveWorldObject(building);
- WorldGrid.removeObject(building, pc);
- }
-
- private static void removeNPC(PlayerCharacter pc, NPC npc) {
- DbManager.NPCQueries.DELETE_NPC(npc);
- DbManager.removeFromCache(npc);
- WorldGrid.RemoveWorldObject(npc);
- WorldGrid.removeObject(npc, pc);
- }
-
- private static void removeMob(PlayerCharacter pc, Mob mob) {
- mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
- mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
- //mob.setHealth(-1, pc); //Kill it!
-
- DbManager.MobQueries.DELETE_MOB(mob);
- DbManager.removeFromCache(mob);
- WorldGrid.RemoveWorldObject(mob);
- WorldGrid.removeObject(mob, pc);
- }
+ HashSet objectList =
+ WorldGrid.getObjectsInRangePartial(_currentLocation, _targetRange, _targetMask);
+
+ // Iterate through array and remove objects from game world and database
+
+ for (AbstractWorldObject awo : objectList) {
+
+ switch (awo.getObjectType()) {
+ case Building:
+ removeBuilding(pc, (Building) awo);
+ break;
+ case NPC:
+ removeNPC(pc, (NPC) awo);
+ break;
+ case Mob:
+ removeMob(pc, (Mob) awo);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Send results to user
+ throwbackInfo(pc, "Purge: " + objectList.size() + " objects were removed in range " + _targetRange);
+ } catch (Exception e) {
+ Logger.error(e);
+ }
+
+ // Release Reentrant lock
+
+ finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Purges game objects within range";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "/purge [npc|mob|mesh|all] [range <= 200]";
+ }
+
+ private void parseUserInput(String[] userInput) {
+
+ _targetMask = 0;
+ _targetRange = 0f;
+
+ // Build mask from user input
+
+ switch (userInput[0].toLowerCase()) {
+ case "npc":
+ _targetMask = MBServerStatics.MASK_NPC;
+ break;
+ case "mob":
+ _targetMask = MBServerStatics.MASK_MOB;
+ break;
+ case "mesh":
+ _targetMask = MBServerStatics.MASK_BUILDING;
+ break;
+ case "all":
+ _targetMask = MBServerStatics.MASK_NPC | MBServerStatics.MASK_MOB | MBServerStatics.MASK_BUILDING;
+ break;
+ default:
+ break;
+ }
+
+ // Parse second argument into range parameter. Cap at 200 units.
+
+ _targetRange = Float.parseFloat(userInput[1]);
+ _targetRange = Math.min(_targetRange, 200f);
+ }
}
diff --git a/src/engine/devcmd/cmds/RealmInfoCmd.java b/src/engine/devcmd/cmds/RealmInfoCmd.java
index 5c22d4a2..21c29e8d 100644
--- a/src/engine/devcmd/cmds/RealmInfoCmd.java
+++ b/src/engine/devcmd/cmds/RealmInfoCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
@@ -21,68 +20,68 @@ import engine.objects.Zone;
public class RealmInfoCmd extends AbstractDevCmd {
- public RealmInfoCmd() {
+ public RealmInfoCmd() {
super("realminfo");
}
- @Override
- protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
+ AbstractGameObject target) {
- Zone serverZone;
- Realm serverRealm;
- int realmID;
- String outString = "";
+ Zone serverZone;
+ Realm serverRealm;
+ int realmID;
+ String outString = "";
- if (playerCharacter == null)
- return;
+ if (playerCharacter == null)
+ return;
- serverZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
+ serverZone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
- if (serverZone == null) {
- throwbackError(playerCharacter, "Zone not found");
- return;
- }
+ if (serverZone == null) {
+ throwbackError(playerCharacter, "Zone not found");
+ return;
+ }
- realmID = RealmMap.getRealmIDAtLocation(playerCharacter.getLoc());
+ realmID = RealmMap.getRealmIDAtLocation(playerCharacter.getLoc());
- String newline = "\r\n ";
+ String newline = "\r\n ";
- outString = newline;
- outString += "Realm: " + realmID + "(";
+ outString = newline;
+ outString += "Realm: " + realmID + "(";
- serverRealm = Realm.getRealm(realmID);
+ serverRealm = Realm.getRealm(realmID);
- if (serverRealm == null)
- outString += "SeaFloor";
- else
- outString += serverRealm.getRealmName();
+ if (serverRealm == null)
+ outString += "SeaFloor";
+ else
+ outString += serverRealm.getRealmName();
- outString += ")";
- outString += newline;
+ outString += ")";
+ outString += newline;
- outString += " Zone: " + serverZone.getName();
+ outString += " Zone: " + serverZone.getName();
- outString += newline;
+ outString += newline;
- if (serverZone.getParent() != null)
- outString += " Parent: " + serverZone.getParent().getName();
- else
- outString += "Parent: NONE";
+ if (serverZone.getParent() != null)
+ outString += " Parent: " + serverZone.getParent().getName();
+ else
+ outString += "Parent: NONE";
- outString += newline;
+ outString += newline;
- throwbackInfo(playerCharacter, outString);
- }
+ throwbackInfo(playerCharacter, outString);
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Returns info on realm.";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /info targetID'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/RebootCmd.java b/src/engine/devcmd/cmds/RebootCmd.java
index 2fe01c44..879125b3 100644
--- a/src/engine/devcmd/cmds/RebootCmd.java
+++ b/src/engine/devcmd/cmds/RebootCmd.java
@@ -6,43 +6,41 @@ import engine.objects.PlayerCharacter;
import org.pmw.tinylog.Logger;
/**
- * @author
- * Summary: Devcmd to reboot server
- *
+ * @author Summary: Devcmd to reboot server
*/
public class RebootCmd extends AbstractDevCmd {
- // Instance variables
+ // Instance variables
- public RebootCmd() {
+ public RebootCmd() {
super("reboot");
}
- // AbstractDevCmd Overridden methods
+ // AbstractDevCmd Overridden methods
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] args,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] args,
+ AbstractGameObject target) {
- try {
- Runtime rt = Runtime.getRuntime();
- rt.exec("./mbrestart.sh");
- } catch (java.io.IOException err) {
- Logger.info( err.getMessage());
- }
+ try {
+ Runtime rt = Runtime.getRuntime();
+ rt.exec("./mbrestart.sh");
+ } catch (java.io.IOException err) {
+ Logger.info(err.getMessage());
+ }
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Reboot server";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "./reboot";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/RegionCmd.java b/src/engine/devcmd/cmds/RegionCmd.java
index 928bcdfb..ca19fd25 100644
--- a/src/engine/devcmd/cmds/RegionCmd.java
+++ b/src/engine/devcmd/cmds/RegionCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -18,62 +17,62 @@ import java.lang.reflect.Field;
public class RegionCmd extends AbstractDevCmd {
- public RegionCmd() {
+ public RegionCmd() {
super("region");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
if (pc.region == null) {
- this.throwbackInfo(pc, "No Region Found.");
- return;
- }
-
-
- String newLine = System.getProperty("line.separator");
- String result = "";
- result += (pc.region.getClass().getSimpleName());
- result += (" {");
- result+=(newLine);
- Field[] fields = pc.region.getClass().getDeclaredFields();
-
- //print field names paired with their values
- for ( Field field : fields ) {
- field.setAccessible(true);
- result+=(" ");
- try {
-
- if(field.getName().contains("Furniture"))
- continue;
- result+=( field.getName());
- result+=(": ");
- //requires access to private field:
- result += (field.get(pc.region).toString());
- } catch ( IllegalAccessException ex ) {
- System.out.println(ex);
- }
- result.trim();
- result+=(newLine);
- }
- result+=("}");
-
- this.throwbackInfo(pc, result.toString());
-
-
- }
-
- @Override
- protected String _getHelpString() {
- return "Temporarily Changes SubRace";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
-
- }
+ this.throwbackInfo(pc, "No Region Found.");
+ return;
+ }
+
+
+ String newLine = System.getProperty("line.separator");
+ String result = "";
+ result += (pc.region.getClass().getSimpleName());
+ result += (" {");
+ result += (newLine);
+ Field[] fields = pc.region.getClass().getDeclaredFields();
+
+ //print field names paired with their values
+ for (Field field : fields) {
+ field.setAccessible(true);
+ result += (" ");
+ try {
+
+ if (field.getName().contains("Furniture"))
+ continue;
+ result += (field.getName());
+ result += (": ");
+ //requires access to private field:
+ result += (field.get(pc.region).toString());
+ } catch (IllegalAccessException ex) {
+ System.out.println(ex);
+ }
+ result.trim();
+ result += (newLine);
+ }
+ result += ("}");
+
+ this.throwbackInfo(pc, result.toString());
+
+
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Temporarily Changes SubRace";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
+
+ }
}
diff --git a/src/engine/devcmd/cmds/RemoveBaneCmd.java b/src/engine/devcmd/cmds/RemoveBaneCmd.java
index 98de9f90..31994552 100644
--- a/src/engine/devcmd/cmds/RemoveBaneCmd.java
+++ b/src/engine/devcmd/cmds/RemoveBaneCmd.java
@@ -16,55 +16,54 @@ import engine.objects.*;
/**
* @author Eighty
- *
*/
public class RemoveBaneCmd extends AbstractDevCmd {
- public RemoveBaneCmd() {
+ public RemoveBaneCmd() {
super("removebane");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
- if (zone == null) {
- throwbackError(pc, "Unable to find the zone you're in.");
- return;
- }
+ if (zone == null) {
+ throwbackError(pc, "Unable to find the zone you're in.");
+ return;
+ }
- if (!zone.isPlayerCity()) {
- throwbackError(pc, "This is not a player city.");
- return;
- }
+ if (!zone.isPlayerCity()) {
+ throwbackError(pc, "This is not a player city.");
+ return;
+ }
- City city = City.getCity(zone.getPlayerCityUUID());
- if (city == null) {
- throwbackError(pc, "Unable to find the city associated with this zone.");
- return;
- }
+ City city = City.getCity(zone.getPlayerCityUUID());
+ if (city == null) {
+ throwbackError(pc, "Unable to find the city associated with this zone.");
+ return;
+ }
- Bane bane = city.getBane();
- if (bane == null) {
- throwbackError(pc, "Could not find bane to remove.");
- return;
- }
+ Bane bane = city.getBane();
+ if (bane == null) {
+ throwbackError(pc, "Could not find bane to remove.");
+ return;
+ }
- bane.endBane(SiegeResult.DEFEND);
+ bane.endBane(SiegeResult.DEFEND);
- throwbackInfo(pc, "The bane has been removed.");
- }
+ throwbackInfo(pc, "The bane has been removed.");
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Removes a bane from the city grid you're standing on.";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "'./removebane'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/RemoveObjectCmd.java b/src/engine/devcmd/cmds/RemoveObjectCmd.java
index 4979205f..6d13d2b1 100644
--- a/src/engine/devcmd/cmds/RemoveObjectCmd.java
+++ b/src/engine/devcmd/cmds/RemoveObjectCmd.java
@@ -26,240 +26,240 @@ import engine.objects.*;
*/
public class RemoveObjectCmd extends AbstractDevCmd {
- public RemoveObjectCmd() {
- //set to Player access level so it can be run by non-admins on production.
- //Actual access level is set in _doCmd.
- super("remove");
- this.addCmdString("delete");
- }
-
- @Override
- protected void _doCmd(PlayerCharacter player, String[] words, AbstractGameObject target) {
-
- int targetID;
- DbObjectType targetObjType;
- Building targetBuilding;
- NPC targetNPC;
- Mob targetMob;
-
- if (target == null && words.length != 1) {
- this.sendUsage(player);
- return;
- }
-
- // Delete the targeted building
-
- if (target != null) {
-
- switch (target.getObjectType()) {
-
- case Building:
- removeBuilding(player, (Building) target);
- break;
- case NPC:
- removeNPC(player, (NPC) target);
- break;
- case Mob:
- removeMob(player, (Mob) target);
- break;
- default:
- throwbackError(player, "Target " + target.getObjectType()
- + " is not a valid object type");
- break;
- }
- return;
- }
-
- // Attempt to delete object based upon parsed UUID from input
-
- // Parse Target UUID
-
- try {
- targetID = Integer.parseInt(words[0]);
- } catch (NumberFormatException e) {
- throwbackError(player, "Supplied object ID " + words[0]
- + " failed to parse to an Integer");
- return;
- }
-
- // Determine object type of given UUID
-
- targetObjType = DbManager.BuildingQueries.GET_UID_ENUM(targetID);
-
- // Process accordingly
-
- switch (targetObjType) {
- case BUILDING:
- targetBuilding = BuildingManager.getBuilding(targetID);
- removeBuilding(player, targetBuilding);
- break;
- case NPC:
- targetNPC = NPC.getNPC(targetID);
- removeNPC(player, targetNPC);
- break;
- case MOB:
- targetMob = Mob.getMob(targetID);
- removeMob(player, targetMob);
- break;
- default:
- throwbackError(player, "Invalid UUID: Not found in database");
- break;
- }
-
- }
-
- @Override
- protected String _getHelpString() {
+ public RemoveObjectCmd() {
+ //set to Player access level so it can be run by non-admins on production.
+ //Actual access level is set in _doCmd.
+ super("remove");
+ this.addCmdString("delete");
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] words, AbstractGameObject target) {
+
+ int targetID;
+ DbObjectType targetObjType;
+ Building targetBuilding;
+ NPC targetNPC;
+ Mob targetMob;
+
+ if (target == null && words.length != 1) {
+ this.sendUsage(player);
+ return;
+ }
+
+ // Delete the targeted building
+
+ if (target != null) {
+
+ switch (target.getObjectType()) {
+
+ case Building:
+ removeBuilding(player, (Building) target);
+ break;
+ case NPC:
+ removeNPC(player, (NPC) target);
+ break;
+ case Mob:
+ removeMob(player, (Mob) target);
+ break;
+ default:
+ throwbackError(player, "Target " + target.getObjectType()
+ + " is not a valid object type");
+ break;
+ }
+ return;
+ }
+
+ // Attempt to delete object based upon parsed UUID from input
+
+ // Parse Target UUID
+
+ try {
+ targetID = Integer.parseInt(words[0]);
+ } catch (NumberFormatException e) {
+ throwbackError(player, "Supplied object ID " + words[0]
+ + " failed to parse to an Integer");
+ return;
+ }
+
+ // Determine object type of given UUID
+
+ targetObjType = DbManager.BuildingQueries.GET_UID_ENUM(targetID);
+
+ // Process accordingly
+
+ switch (targetObjType) {
+ case BUILDING:
+ targetBuilding = BuildingManager.getBuilding(targetID);
+ removeBuilding(player, targetBuilding);
+ break;
+ case NPC:
+ targetNPC = NPC.getNPC(targetID);
+ removeNPC(player, targetNPC);
+ break;
+ case MOB:
+ targetMob = Mob.getMob(targetID);
+ removeMob(player, targetMob);
+ break;
+ default:
+ throwbackError(player, "Invalid UUID: Not found in database");
+ break;
+ }
+
+ }
+
+ @Override
+ protected String _getHelpString() {
return "Removes targeted or specified object";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /remove [objectID]' || ' /delete [objectID]'";
- }
-
- private void removeBuilding(PlayerCharacter pc, Building building) {
-
- Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
-
- if (currentZone == null) {
- this.throwbackError(pc, "Could not locate zone for player.");
- return;
- }
-
- if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
- building.disableSpire(false);
-
- if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)){
- City city =City.getCity(building.getParentZone().getPlayerCityUUID());
- if (city != null){
- city.setWarehouseBuildingID(0);
- }
- Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
- }
-
-
- //remove cached shrines.
- if ((building.getBlueprintUUID() != 0)
- && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
- Shrine.RemoveShrineFromCacheByBuilding(building);
-
- for (AbstractCharacter ac : building.getHirelings().keySet()) {
- NPC npc = null;
- Mob mobA = null;
-
- if (ac.getObjectType() == GameObjectType.NPC)
- npc = (NPC)ac;
- else if (ac.getObjectType() == GameObjectType.Mob)
- mobA = (Mob)ac;
-
- if (npc != null){
- for (Mob mob : npc.getSiegeMinionMap().keySet()) {
- WorldGrid.RemoveWorldObject(mob);
- WorldGrid.removeObject(mob, pc);
- //Mob.getRespawnMap().remove(mob);
- if (mob.getParentZone() != null)
- mob.getParentZone().zoneMobSet.remove(mob);
- }
- DbManager.NPCQueries.DELETE_NPC(npc);
- DbManager.removeFromCache(npc);
- WorldGrid.RemoveWorldObject(npc);
- WorldGrid.removeObject(npc, pc);
- }else if (mobA != null){
- for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
- WorldGrid.RemoveWorldObject(mob);
- WorldGrid.removeObject(mob, pc);
- //Mob.getRespawnMap().remove(mob);
- if (mob.getParentZone() != null)
- mob.getParentZone().zoneMobSet.remove(mob);
- }
- DbManager.MobQueries.DELETE_MOB(mobA);
- DbManager.removeFromCache(mobA);
- WorldGrid.RemoveWorldObject(mobA);
- WorldGrid.removeObject(mobA, pc);
- }
-
-
- }
- Zone zone = building.getParentZone();
- DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
- DbManager.removeFromCache(building);
- zone.zoneBuildingSet.remove(building);
- if(building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)){
- building.RemoveFromBarracksList();
- }
- WorldGrid.RemoveWorldObject(building);
- WorldGrid.removeObject(building, pc);
-
- ChatManager.chatSayInfo(pc,
- "Building with ID " + building.getObjectUUID() + " removed");
- this.setResult(String.valueOf(building.getObjectUUID()));
- }
-
- private void removeNPC(PlayerCharacter pc, NPC npc) {
-
- Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
- if (currentZone == null) {
- this.throwbackError(pc, "Could not locate zone for player.");
- return;
- }
-
- // Remove npc from hirelings list.
-
- if (npc.building != null)
- npc.building.getHirelings().remove(npc);
-
- for (Mob mob : npc.getSiegeMinionMap().keySet()) {
- WorldGrid.RemoveWorldObject(mob);
- WorldGrid.removeObject(mob, pc);
- if (mob.getParentZone() != null)
- mob.getParentZone().zoneMobSet.remove(mob);
- }
-
- DbManager.NPCQueries.DELETE_NPC(npc);
- DbManager.removeFromCache(npc);
- WorldGrid.RemoveWorldObject(npc);
- WorldGrid.removeObject(npc, pc);
- ChatManager.chatSayInfo(pc,
- "NPC with ID " + npc.getDBID() + " removed");
- this.setResult(String.valueOf(npc.getDBID()));
- }
-
- private void removeMob(PlayerCharacter pc, Mob mob) {
-
- Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
-
- if (currentZone == null) {
- this.throwbackError(pc, "Could not locate zone for player.");
- return;
- }
-
- if (mob.getParentZone() != null && mob.getParentZone() != currentZone && !mob.isPet() && !mob.isNecroPet()) {
- this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
- return;
- }
-
- // Remove npc from hirelings list.
-
- if (mob.building != null)
- mob.building.getHirelings().remove(mob);
-
- mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
- mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
- //mob.setHealth(-1, pc); //Kill it!
-
- DbManager.MobQueries.DELETE_MOB(mob);
-
- DbManager.removeFromCache(mob);
- WorldGrid.RemoveWorldObject(mob);
- WorldGrid.removeObject(mob, pc);
-
- if (mob.getParentZone() != null)
- mob.getParentZone().zoneMobSet.remove(mob);
-
- ChatManager.chatSayInfo(pc,
- "Mob with ID " + mob.getDBID() + " removed");
- this.setResult(String.valueOf(mob.getDBID()));
- }
+ }
+
+ private void removeBuilding(PlayerCharacter pc, Building building) {
+
+ Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
+
+ if (currentZone == null) {
+ this.throwbackError(pc, "Could not locate zone for player.");
+ return;
+ }
+
+ if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
+ building.disableSpire(false);
+
+ if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) {
+ City city = City.getCity(building.getParentZone().getPlayerCityUUID());
+ if (city != null) {
+ city.setWarehouseBuildingID(0);
+ }
+ Warehouse.warehouseByBuildingUUID.remove(building.getObjectUUID());
+ }
+
+
+ //remove cached shrines.
+ if ((building.getBlueprintUUID() != 0)
+ && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE))
+ Shrine.RemoveShrineFromCacheByBuilding(building);
+
+ for (AbstractCharacter ac : building.getHirelings().keySet()) {
+ NPC npc = null;
+ Mob mobA = null;
+
+ if (ac.getObjectType() == GameObjectType.NPC)
+ npc = (NPC) ac;
+ else if (ac.getObjectType() == GameObjectType.Mob)
+ mobA = (Mob) ac;
+
+ if (npc != null) {
+ for (Mob mob : npc.getSiegeMinionMap().keySet()) {
+ WorldGrid.RemoveWorldObject(mob);
+ WorldGrid.removeObject(mob, pc);
+ //Mob.getRespawnMap().remove(mob);
+ if (mob.getParentZone() != null)
+ mob.getParentZone().zoneMobSet.remove(mob);
+ }
+ DbManager.NPCQueries.DELETE_NPC(npc);
+ DbManager.removeFromCache(npc);
+ WorldGrid.RemoveWorldObject(npc);
+ WorldGrid.removeObject(npc, pc);
+ } else if (mobA != null) {
+ for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
+ WorldGrid.RemoveWorldObject(mob);
+ WorldGrid.removeObject(mob, pc);
+ //Mob.getRespawnMap().remove(mob);
+ if (mob.getParentZone() != null)
+ mob.getParentZone().zoneMobSet.remove(mob);
+ }
+ DbManager.MobQueries.DELETE_MOB(mobA);
+ DbManager.removeFromCache(mobA);
+ WorldGrid.RemoveWorldObject(mobA);
+ WorldGrid.removeObject(mobA, pc);
+ }
+
+
+ }
+ Zone zone = building.getParentZone();
+ DbManager.BuildingQueries.DELETE_FROM_DATABASE(building);
+ DbManager.removeFromCache(building);
+ zone.zoneBuildingSet.remove(building);
+ if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BARRACK)) {
+ building.RemoveFromBarracksList();
+ }
+ WorldGrid.RemoveWorldObject(building);
+ WorldGrid.removeObject(building, pc);
+
+ ChatManager.chatSayInfo(pc,
+ "Building with ID " + building.getObjectUUID() + " removed");
+ this.setResult(String.valueOf(building.getObjectUUID()));
+ }
+
+ private void removeNPC(PlayerCharacter pc, NPC npc) {
+
+ Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
+ if (currentZone == null) {
+ this.throwbackError(pc, "Could not locate zone for player.");
+ return;
+ }
+
+ // Remove npc from hirelings list.
+
+ if (npc.building != null)
+ npc.building.getHirelings().remove(npc);
+
+ for (Mob mob : npc.getSiegeMinionMap().keySet()) {
+ WorldGrid.RemoveWorldObject(mob);
+ WorldGrid.removeObject(mob, pc);
+ if (mob.getParentZone() != null)
+ mob.getParentZone().zoneMobSet.remove(mob);
+ }
+
+ DbManager.NPCQueries.DELETE_NPC(npc);
+ DbManager.removeFromCache(npc);
+ WorldGrid.RemoveWorldObject(npc);
+ WorldGrid.removeObject(npc, pc);
+ ChatManager.chatSayInfo(pc,
+ "NPC with ID " + npc.getDBID() + " removed");
+ this.setResult(String.valueOf(npc.getDBID()));
+ }
+
+ private void removeMob(PlayerCharacter pc, Mob mob) {
+
+ Zone currentZone = ZoneManager.findSmallestZone(pc.getLoc());
+
+ if (currentZone == null) {
+ this.throwbackError(pc, "Could not locate zone for player.");
+ return;
+ }
+
+ if (mob.getParentZone() != null && mob.getParentZone() != currentZone && !mob.isPet() && !mob.isNecroPet()) {
+ this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
+ return;
+ }
+
+ // Remove npc from hirelings list.
+
+ if (mob.building != null)
+ mob.building.getHirelings().remove(mob);
+
+ mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
+ mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
+ //mob.setHealth(-1, pc); //Kill it!
+
+ DbManager.MobQueries.DELETE_MOB(mob);
+
+ DbManager.removeFromCache(mob);
+ WorldGrid.RemoveWorldObject(mob);
+ WorldGrid.removeObject(mob, pc);
+
+ if (mob.getParentZone() != null)
+ mob.getParentZone().zoneMobSet.remove(mob);
+
+ ChatManager.chatSayInfo(pc,
+ "Mob with ID " + mob.getDBID() + " removed");
+ this.setResult(String.valueOf(mob.getDBID()));
+ }
}
diff --git a/src/engine/devcmd/cmds/RenameCmd.java b/src/engine/devcmd/cmds/RenameCmd.java
index 73db6a24..d1d31edb 100644
--- a/src/engine/devcmd/cmds/RenameCmd.java
+++ b/src/engine/devcmd/cmds/RenameCmd.java
@@ -18,64 +18,62 @@ import engine.objects.NPC;
import engine.objects.PlayerCharacter;
/**
- *
* @author Eighty
- *
*/
public class RenameCmd extends AbstractDevCmd {
- public RenameCmd() {
+ public RenameCmd() {
super("rename");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- if (args.length < 1) {
- this.sendUsage(pcSender);
- return;
- }
- if (args[0].isEmpty()) {
- throwbackError(pcSender, "Invalid rename Command. must specify a name.");
- return;
- }
- NPC npc = null;
- Building building = null;
-
- if (target != null) {
- if (target instanceof NPC)
- npc = (NPC) target;
- else if (target instanceof Building)
- building = (Building)target;
- } else
- npc = getTargetAsNPC(pcSender);
- if (npc != null) {
- DbManager.NPCQueries.SET_PROPERTY(npc, "npc_name", args[0]);
- String name = args[0];
- name = name.replaceAll("_", " ");
-
- npc.setName(name);
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ if (args.length < 1) {
+ this.sendUsage(pcSender);
+ return;
+ }
+ if (args[0].isEmpty()) {
+ throwbackError(pcSender, "Invalid rename Command. must specify a name.");
+ return;
+ }
+ NPC npc = null;
+ Building building = null;
- this.setResult(String.valueOf(npc.getDBID()));
+ if (target != null) {
+ if (target instanceof NPC)
+ npc = (NPC) target;
+ else if (target instanceof Building)
+ building = (Building) target;
+ } else
+ npc = getTargetAsNPC(pcSender);
+ if (npc != null) {
+ DbManager.NPCQueries.SET_PROPERTY(npc, "npc_name", args[0]);
+ String name = args[0];
+ name = name.replaceAll("_", " ");
+
+ npc.setName(name);
+
+ this.setResult(String.valueOf(npc.getDBID()));
// npc.updateDatabase();
- WorldGrid.updateObject(npc, pcSender);
- } else if (building != null){
- String name = args[0];
- name = name.replaceAll("_", " ");
- building.setName(name);
- }
- throwbackError(pcSender, "Invalid rename Command. must target an npc.");
- }
+ WorldGrid.updateObject(npc, pcSender);
+ } else if (building != null) {
+ String name = args[0];
+ name = name.replaceAll("_", " ");
+ building.setName(name);
+ }
+ throwbackError(pcSender, "Invalid rename Command. must target an npc.");
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /rename npcName'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Renames an NPC.";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/ResetLevelCmd.java b/src/engine/devcmd/cmds/ResetLevelCmd.java
index ef3dc496..aa6d1ef2 100644
--- a/src/engine/devcmd/cmds/ResetLevelCmd.java
+++ b/src/engine/devcmd/cmds/ResetLevelCmd.java
@@ -5,32 +5,31 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
public class ResetLevelCmd extends AbstractDevCmd {
-
- public ResetLevelCmd() {
+
+ public ResetLevelCmd() {
super("resetlevel");
}
- // AbstractDevCmd Overridden methods
-
- @Override
- protected void _doCmd(PlayerCharacter player, String[] args,
- AbstractGameObject target) {
-
- player.ResetLevel(Short.parseShort(args[0]));
- }
-
- @Override
- protected String _getHelpString() {
+ // AbstractDevCmd Overridden methods
+
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] args,
+ AbstractGameObject target) {
+
+ player.ResetLevel(Short.parseShort(args[0]));
+ }
+
+ @Override
+ protected String _getHelpString() {
return "Resets character level to `level`. All training points are reset. Player must relog for changes to update.";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "/resetlevel ";
- }
+ }
+
-
-
}
diff --git a/src/engine/devcmd/cmds/RotateCmd.java b/src/engine/devcmd/cmds/RotateCmd.java
index c6dc7c73..fe25ad35 100644
--- a/src/engine/devcmd/cmds/RotateCmd.java
+++ b/src/engine/devcmd/cmds/RotateCmd.java
@@ -20,232 +20,232 @@ import engine.objects.*;
public class RotateCmd extends AbstractDevCmd {
- public RotateCmd() {
+ public RotateCmd() {
super("rotate");
this.addCmdString("rot");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (target == null && (words.length != 2) ) {
- this.sendUsage(pc);
- return;
- }
-
-
- if (words.length == 3){
- try{
-
- }catch(Exception e){
-
- }
- }
-
-
- float rot;
- if (target != null && words.length == 1) {
-
- try {
- if (words[0].equalsIgnoreCase("face")){
- this.rotateFace(pc, target);
- return;
- }
-
- rot = Float.parseFloat(words[0]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "Supplied rotation " + words[0]
- + " failed to parse to a Float");
- return;
- } catch (Exception e) {
- throwbackError(pc,
- "Invalid Rotate Command. Need Rotation specified.");
- return;
- }
-
- Vector3f rotation = new Vector3f(0f, rot, 0f);
-
- if (target instanceof Building)
- rotateBuilding(pc, (Building) target, rotation, rot,false);
- else if (target instanceof NPC)
- rotateNPC(pc, (NPC) target, rotation,false);
- else if (target instanceof Mob)
- rotateMob(pc, (Mob) target, rotation,false);
- else
- throwbackError(pc, "Target " + target.getObjectType()
- + " is not a valid object type");
- } else {
-
- int id = 0;
- if (words.length == 2) {
- try {
- id = Integer.parseInt(words[0]);
-
- if (words[1].equalsIgnoreCase("face")){
-
- Building b;
- if (id != 0)
- b = BuildingManager.getBuilding(id);
- else
- b = getTargetAsBuilding(pc);
- if (b != null) {
- rotateFace(pc, b);
- return;
- }
-
- // building failed, try npc
- NPC npc;
- if (id != 0)
- npc = NPC.getNPC(id);
- else
- npc = getTargetAsNPC(pc);
- if (npc != null) {
- rotateFace(pc, npc);
- return;
- }
-
- // NPC failed, try mob
- Mob mob;
- if (id != 0)
- mob = Mob.getMob(id);
- else
- mob = getTargetAsMob(pc);
- if (mob != null) {
- rotateFace(pc, mob);
- return;
- }
- throwbackError(pc, "Nothing found to rotate.");
- return;
- }
- rot = Float.parseFloat(words[1]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "Supplied arguments " + words[0] + ' '
- + words[1] + " failed to parse");
- return;
- } catch (Exception e) {
- throwbackError(pc,
- "Invalid Rotate Command. Need Rotation specified.");
- return; // NaN
- }
- } else {
- try {
- rot = Float.parseFloat(words[0]);
- } catch (NumberFormatException e) {
- throwbackError(pc, "Supplied rotation " + words[0]
- + " failed to parse to a Float");
- return;
- } catch (Exception e) {
- throwbackError(pc,
- "Invalid Rotate Command. Need Rotation specified.");
- return; // NaN
- }
- }
-
- Vector3f rotation = new Vector3f(0f, rot, 0f);
-
- Building b;
- if (id != 0)
- b = BuildingManager.getBuilding(id);
- else
- b = getTargetAsBuilding(pc);
- if (b != null) {
- rotateBuilding(pc, b, rotation, rot,false);
- return;
- }
-
- // building failed, try npc
- NPC npc;
- if (id != 0)
- npc = NPC.getNPC(id);
- else
- npc = getTargetAsNPC(pc);
- if (npc != null) {
- rotateNPC(pc, npc, rotation,false);
- return;
- }
-
- // NPC failed, try mob
- Mob mob;
- if (id != 0)
- mob = Mob.getMob(id);
- else
- mob = getTargetAsMob(pc);
- if (mob != null) {
- rotateMob(pc, mob, rotation,false);
- return;
- }
- throwbackError(pc, "Nothing found to rotate.");
- }
- }
-
- @Override
- protected String _getHelpString() {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (target == null && (words.length != 2)) {
+ this.sendUsage(pc);
+ return;
+ }
+
+
+ if (words.length == 3) {
+ try {
+
+ } catch (Exception e) {
+
+ }
+ }
+
+
+ float rot;
+ if (target != null && words.length == 1) {
+
+ try {
+ if (words[0].equalsIgnoreCase("face")) {
+ this.rotateFace(pc, target);
+ return;
+ }
+
+ rot = Float.parseFloat(words[0]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "Supplied rotation " + words[0]
+ + " failed to parse to a Float");
+ return;
+ } catch (Exception e) {
+ throwbackError(pc,
+ "Invalid Rotate Command. Need Rotation specified.");
+ return;
+ }
+
+ Vector3f rotation = new Vector3f(0f, rot, 0f);
+
+ if (target instanceof Building)
+ rotateBuilding(pc, (Building) target, rotation, rot, false);
+ else if (target instanceof NPC)
+ rotateNPC(pc, (NPC) target, rotation, false);
+ else if (target instanceof Mob)
+ rotateMob(pc, (Mob) target, rotation, false);
+ else
+ throwbackError(pc, "Target " + target.getObjectType()
+ + " is not a valid object type");
+ } else {
+
+ int id = 0;
+ if (words.length == 2) {
+ try {
+ id = Integer.parseInt(words[0]);
+
+ if (words[1].equalsIgnoreCase("face")) {
+
+ Building b;
+ if (id != 0)
+ b = BuildingManager.getBuilding(id);
+ else
+ b = getTargetAsBuilding(pc);
+ if (b != null) {
+ rotateFace(pc, b);
+ return;
+ }
+
+ // building failed, try npc
+ NPC npc;
+ if (id != 0)
+ npc = NPC.getNPC(id);
+ else
+ npc = getTargetAsNPC(pc);
+ if (npc != null) {
+ rotateFace(pc, npc);
+ return;
+ }
+
+ // NPC failed, try mob
+ Mob mob;
+ if (id != 0)
+ mob = Mob.getMob(id);
+ else
+ mob = getTargetAsMob(pc);
+ if (mob != null) {
+ rotateFace(pc, mob);
+ return;
+ }
+ throwbackError(pc, "Nothing found to rotate.");
+ return;
+ }
+ rot = Float.parseFloat(words[1]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "Supplied arguments " + words[0] + ' '
+ + words[1] + " failed to parse");
+ return;
+ } catch (Exception e) {
+ throwbackError(pc,
+ "Invalid Rotate Command. Need Rotation specified.");
+ return; // NaN
+ }
+ } else {
+ try {
+ rot = Float.parseFloat(words[0]);
+ } catch (NumberFormatException e) {
+ throwbackError(pc, "Supplied rotation " + words[0]
+ + " failed to parse to a Float");
+ return;
+ } catch (Exception e) {
+ throwbackError(pc,
+ "Invalid Rotate Command. Need Rotation specified.");
+ return; // NaN
+ }
+ }
+
+ Vector3f rotation = new Vector3f(0f, rot, 0f);
+
+ Building b;
+ if (id != 0)
+ b = BuildingManager.getBuilding(id);
+ else
+ b = getTargetAsBuilding(pc);
+ if (b != null) {
+ rotateBuilding(pc, b, rotation, rot, false);
+ return;
+ }
+
+ // building failed, try npc
+ NPC npc;
+ if (id != 0)
+ npc = NPC.getNPC(id);
+ else
+ npc = getTargetAsNPC(pc);
+ if (npc != null) {
+ rotateNPC(pc, npc, rotation, false);
+ return;
+ }
+
+ // NPC failed, try mob
+ Mob mob;
+ if (id != 0)
+ mob = Mob.getMob(id);
+ else
+ mob = getTargetAsMob(pc);
+ if (mob != null) {
+ rotateMob(pc, mob, rotation, false);
+ return;
+ }
+ throwbackError(pc, "Nothing found to rotate.");
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
return "Rotates targeted or specified object";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /rotate [objectID] rotation' || ' /rot [objectID] rotation'";
- }
-
- private void rotateBuilding(PlayerCharacter pc, Building building, Vector3f rot, float orig, boolean faceDirection) {
- if (!faceDirection)
- rot.set(0.0f, (float)Math.sin(Math.toRadians(orig)/2), 0.0f);
- building.setRot(rot);
- building.setw( (float) Math.abs(Math.cos(Math.toRadians(orig)/2)) );
- building.getBounds().setBounds(building);
- WorldGrid.updateObject(building, pc);
- DbManager.BuildingQueries.SET_PROPERTY(building, "rotY", building.getRot().getY());
- DbManager.BuildingQueries.SET_PROPERTY(building, "w", building.getw());
- ChatManager.chatSayInfo(pc,
- "Building with ID " + building.getObjectUUID() + " rotated");
- }
-
- private void rotateNPC(PlayerCharacter pc, NPC npc, Vector3f rot,boolean faceDirection) {
- npc.setRot(rot);
- DbManager.NPCQueries.SET_PROPERTY(npc, "npc_rotation", rot.y);
- WorldGrid.updateObject(npc, pc);
- //no rotation for npc's in db currently
- ChatManager.chatSayInfo(pc,
- "NPC with ID " + npc.getObjectUUID() + " rotated");
- }
-
- private void rotateMob(PlayerCharacter pc, Mob mob, Vector3f rot,boolean faceDirection) {
- mob.setRot(rot);
- DbManager.MobQueries.SET_PROPERTY(mob, "mob_rotation", rot.y);
- WorldGrid.updateObject(mob, pc);
- //no rotation for mobs's in db currently
- ChatManager.chatSayInfo(pc,
- "Mob with ID " + mob.getObjectUUID() + " rotated");
- }
-
- private void rotateFace(PlayerCharacter pc, AbstractGameObject target){
- AbstractWorldObject awo = (AbstractWorldObject)target;
- if (awo == null)
- return;
- Vector3fImmutable buildingLoc = awo.getLoc();
- Vector3fImmutable playerLoc = pc.getLoc();
-
- Vector3fImmutable faceDirection = playerLoc.subtract2D(buildingLoc);
-
- float rotangle = faceDirection.getRotation();
-
- float rot = (float) Math.toDegrees(rotangle);
-
- if (rot > 180)
- rot*=-1;
-
- Vector3f buildingrotation = new Vector3f(0f, rot, 0f);
- Vector3f rotation = new Vector3f(0f, rotangle, 0f);
- if (target instanceof Building)
- rotateBuilding(pc, (Building) target, buildingrotation, rot,false);
- else if (target instanceof NPC)
- rotateNPC(pc, (NPC) target, rotation,true);
- else if (target instanceof Mob)
- rotateMob(pc, (Mob) target, rotation,true);
- else
- throwbackError(pc, "Target " + target.getObjectType()
- + " is not a valid object type");
-
- }
+ }
+
+ private void rotateBuilding(PlayerCharacter pc, Building building, Vector3f rot, float orig, boolean faceDirection) {
+ if (!faceDirection)
+ rot.set(0.0f, (float) Math.sin(Math.toRadians(orig) / 2), 0.0f);
+ building.setRot(rot);
+ building.setw((float) Math.abs(Math.cos(Math.toRadians(orig) / 2)));
+ building.getBounds().setBounds(building);
+ WorldGrid.updateObject(building, pc);
+ DbManager.BuildingQueries.SET_PROPERTY(building, "rotY", building.getRot().getY());
+ DbManager.BuildingQueries.SET_PROPERTY(building, "w", building.getw());
+ ChatManager.chatSayInfo(pc,
+ "Building with ID " + building.getObjectUUID() + " rotated");
+ }
+
+ private void rotateNPC(PlayerCharacter pc, NPC npc, Vector3f rot, boolean faceDirection) {
+ npc.setRot(rot);
+ DbManager.NPCQueries.SET_PROPERTY(npc, "npc_rotation", rot.y);
+ WorldGrid.updateObject(npc, pc);
+ //no rotation for npc's in db currently
+ ChatManager.chatSayInfo(pc,
+ "NPC with ID " + npc.getObjectUUID() + " rotated");
+ }
+
+ private void rotateMob(PlayerCharacter pc, Mob mob, Vector3f rot, boolean faceDirection) {
+ mob.setRot(rot);
+ DbManager.MobQueries.SET_PROPERTY(mob, "mob_rotation", rot.y);
+ WorldGrid.updateObject(mob, pc);
+ //no rotation for mobs's in db currently
+ ChatManager.chatSayInfo(pc,
+ "Mob with ID " + mob.getObjectUUID() + " rotated");
+ }
+
+ private void rotateFace(PlayerCharacter pc, AbstractGameObject target) {
+ AbstractWorldObject awo = (AbstractWorldObject) target;
+ if (awo == null)
+ return;
+ Vector3fImmutable buildingLoc = awo.getLoc();
+ Vector3fImmutable playerLoc = pc.getLoc();
+
+ Vector3fImmutable faceDirection = playerLoc.subtract2D(buildingLoc);
+
+ float rotangle = faceDirection.getRotation();
+
+ float rot = (float) Math.toDegrees(rotangle);
+
+ if (rot > 180)
+ rot *= -1;
+
+ Vector3f buildingrotation = new Vector3f(0f, rot, 0f);
+ Vector3f rotation = new Vector3f(0f, rotangle, 0f);
+ if (target instanceof Building)
+ rotateBuilding(pc, (Building) target, buildingrotation, rot, false);
+ else if (target instanceof NPC)
+ rotateNPC(pc, (NPC) target, rotation, true);
+ else if (target instanceof Mob)
+ rotateMob(pc, (Mob) target, rotation, true);
+ else
+ throwbackError(pc, "Target " + target.getObjectType()
+ + " is not a valid object type");
+
+ }
}
\ No newline at end of file
diff --git a/src/engine/devcmd/cmds/SetAICmd.java b/src/engine/devcmd/cmds/SetAICmd.java
index 603307e6..7a30899d 100644
--- a/src/engine/devcmd/cmds/SetAICmd.java
+++ b/src/engine/devcmd/cmds/SetAICmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.ai.MobileFSMManager;
@@ -19,111 +18,110 @@ import engine.server.MBServerStatics;
/**
* @author Steve
- *
*/
public class SetAICmd extends AbstractDevCmd {
- public SetAICmd() {
+ public SetAICmd() {
super("setAI");
this.addCmdString("ai");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (words.length < 2){
- this.sendUsage(pc);
- return;
- }
-
- int amount;
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (words.length < 2) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ int amount;
- try{
- amount = Integer.valueOf(words[1]);
- }catch (NumberFormatException e) {
- this.throwbackError(pc, "Failed to parse amount");
- return;
- }
-
- switch(words[0]){
- case "angle" :
- float angle = Float.parseFloat(words[1]);
-
- MobileFSMManager.AI_MAX_ANGLE = angle;
- break;
- case "aggrorange":
- MobileFSMManager.AI_BASE_AGGRO_RANGE = amount;
- DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
- this.throwbackInfo(pc, "Aggro Range is now set to " + amount);
- break;
- case "dropaggrorange":
- MobileFSMManager.AI_DROP_AGGRO_RANGE = amount;
- DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
- this.throwbackInfo(pc, "Drop Aggro Range is now set to " + amount);
- break;
- case "patroldivisor":
- MobileFSMManager.AI_PATROL_DIVISOR = amount;
- DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
- this.throwbackInfo(pc, "Patrol Chance is now set to " + amount);
- break;
- case "pulse":
- if (amount < 500){
- this.throwbackError(pc, "pulse amount must be greather than 500 to execute.");
- return;
- }
- MobileFSMManager.AI_PULSE_MOB_THRESHOLD = amount;
- this.throwbackInfo(pc, "Pulse is now set to " + amount);
- break;
- case "sleepthread":
- if (amount < 500){
- this.throwbackError(pc, "sleep amount must be greather than 500 to execute.");
- return;
- }
- MobileFSMManager.AI_THREAD_SLEEP = amount;
- this.throwbackInfo(pc, "Thread Sleep is now set to " + amount);
- break;
- case "recallrange":
- MobileFSMManager.AI_RECALL_RANGE = amount;
- DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
- this.throwbackInfo(pc, "Recall Range is now set to " + amount);
- break;
- case "powerdivisor":
- MobileFSMManager.AI_POWER_DIVISOR = amount;
- DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
- this.throwbackInfo(pc, "Power Divisor is now set to " + amount);
- break;
- case "losehate":
- MBServerStatics.PLAYER_HATE_DELIMITER = amount;
- break;
- case "hatemodcombat":
- MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER = amount;
- default:
- this.throwbackError(pc, words[0] + " is not a valid AI Command.");
- break;
- }
- }
+ try {
+ amount = Integer.valueOf(words[1]);
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Failed to parse amount");
+ return;
+ }
- @Override
- protected String _getHelpString() {
- String help = "Modifies Mob AI Statics. Commands:";
- help += "\n AGGRORANGE: Sets the range when a mob will aggro it's target. Aggro range is currently " + MobileFSMManager.AI_BASE_AGGRO_RANGE;
- help += "\n DROPAGGRORANGE: Sets the range when a mob will drop aggro from it's target. Drop aggro range is currently " + MobileFSMManager.AI_DROP_AGGRO_RANGE;
- help += "\n PATROLDIVISOR: Sets the Patrol Divisor for Mob AI. Setting this will give a 1/[amount] chance to parol the area. Patrol Chance is currently 1/" + MobileFSMManager.AI_PATROL_DIVISOR;
- help += "\n PULSE: sets how often to run mob's AI. Measured in MS. Pulse is currently " + MobileFSMManager.AI_PULSE_MOB_THRESHOLD + "ms.";
- help += "\n SLEEPTHREAD: Sets how long to sleep the AI for ALL mobs.Thread sleep is currently " + MobileFSMManager.AI_THREAD_SLEEP + "ms.";
- help += "\n RECALLRANGE: Sets the range of a mob to recall back to it's bind location. Recall range is currently " + MobileFSMManager.AI_RECALL_RANGE;
- help += "\n POWERDIVISOR: Sets the Power Divisor for Mob AI.Setting this will give a 1/[amount] chance to use power on a player. Power Divisor is currently " + MobileFSMManager.AI_POWER_DIVISOR;
- help += "\n LOSEHATE: Sets the amount per second to reduce hate amount for player while they are idle. Hate Delimiter is currently " + MBServerStatics.PLAYER_HATE_DELIMITER;
- help += "\n HATEMODCOMBAT: sets the modifier for Hate value for Combat. Hate Value is `Damage *[HATEMODCOMBAT]`.Hate Mod Combat is currently " + MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER;
+ switch (words[0]) {
+ case "angle":
+ float angle = Float.parseFloat(words[1]);
+
+ MobileFSMManager.AI_MAX_ANGLE = angle;
+ break;
+ case "aggrorange":
+ MobileFSMManager.AI_BASE_AGGRO_RANGE = amount;
+ DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
+ this.throwbackInfo(pc, "Aggro Range is now set to " + amount);
+ break;
+ case "dropaggrorange":
+ MobileFSMManager.AI_DROP_AGGRO_RANGE = amount;
+ DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
+ this.throwbackInfo(pc, "Drop Aggro Range is now set to " + amount);
+ break;
+ case "patroldivisor":
+ MobileFSMManager.AI_PATROL_DIVISOR = amount;
+ DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
+ this.throwbackInfo(pc, "Patrol Chance is now set to " + amount);
+ break;
+ case "pulse":
+ if (amount < 500) {
+ this.throwbackError(pc, "pulse amount must be greather than 500 to execute.");
+ return;
+ }
+ MobileFSMManager.AI_PULSE_MOB_THRESHOLD = amount;
+ this.throwbackInfo(pc, "Pulse is now set to " + amount);
+ break;
+ case "sleepthread":
+ if (amount < 500) {
+ this.throwbackError(pc, "sleep amount must be greather than 500 to execute.");
+ return;
+ }
+ MobileFSMManager.AI_THREAD_SLEEP = amount;
+ this.throwbackInfo(pc, "Thread Sleep is now set to " + amount);
+ break;
+ case "recallrange":
+ MobileFSMManager.AI_RECALL_RANGE = amount;
+ DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
+ this.throwbackInfo(pc, "Recall Range is now set to " + amount);
+ break;
+ case "powerdivisor":
+ MobileFSMManager.AI_POWER_DIVISOR = amount;
+ DbManager.MobBaseQueries.UPDATE_AI_DEFAULTS();
+ this.throwbackInfo(pc, "Power Divisor is now set to " + amount);
+ break;
+ case "losehate":
+ MBServerStatics.PLAYER_HATE_DELIMITER = amount;
+ break;
+ case "hatemodcombat":
+ MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER = amount;
+ default:
+ this.throwbackError(pc, words[0] + " is not a valid AI Command.");
+ break;
+ }
+ }
- return help;
- }
+ @Override
+ protected String _getHelpString() {
+ String help = "Modifies Mob AI Statics. Commands:";
+ help += "\n AGGRORANGE: Sets the range when a mob will aggro it's target. Aggro range is currently " + MobileFSMManager.AI_BASE_AGGRO_RANGE;
+ help += "\n DROPAGGRORANGE: Sets the range when a mob will drop aggro from it's target. Drop aggro range is currently " + MobileFSMManager.AI_DROP_AGGRO_RANGE;
+ help += "\n PATROLDIVISOR: Sets the Patrol Divisor for Mob AI. Setting this will give a 1/[amount] chance to parol the area. Patrol Chance is currently 1/" + MobileFSMManager.AI_PATROL_DIVISOR;
+ help += "\n PULSE: sets how often to run mob's AI. Measured in MS. Pulse is currently " + MobileFSMManager.AI_PULSE_MOB_THRESHOLD + "ms.";
+ help += "\n SLEEPTHREAD: Sets how long to sleep the AI for ALL mobs.Thread sleep is currently " + MobileFSMManager.AI_THREAD_SLEEP + "ms.";
+ help += "\n RECALLRANGE: Sets the range of a mob to recall back to it's bind location. Recall range is currently " + MobileFSMManager.AI_RECALL_RANGE;
+ help += "\n POWERDIVISOR: Sets the Power Divisor for Mob AI.Setting this will give a 1/[amount] chance to use power on a player. Power Divisor is currently " + MobileFSMManager.AI_POWER_DIVISOR;
+ help += "\n LOSEHATE: Sets the amount per second to reduce hate amount for player while they are idle. Hate Delimiter is currently " + MBServerStatics.PLAYER_HATE_DELIMITER;
+ help += "\n HATEMODCOMBAT: sets the modifier for Hate value for Combat. Hate Value is `Damage *[HATEMODCOMBAT]`.Hate Mod Combat is currently " + MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER;
- @Override
- protected String _getUsageString() {
- String usage = "' /setai `command` `amount` `";
- usage += '\n' + _getHelpString();
- return usage;
- }
+ return help;
+ }
+
+ @Override
+ protected String _getUsageString() {
+ String usage = "' /setai `command` `amount` `";
+ usage += '\n' + _getHelpString();
+ return usage;
+ }
}
diff --git a/src/engine/devcmd/cmds/SetAdminRuneCmd.java b/src/engine/devcmd/cmds/SetAdminRuneCmd.java
index 039a0b91..f8df7016 100644
--- a/src/engine/devcmd/cmds/SetAdminRuneCmd.java
+++ b/src/engine/devcmd/cmds/SetAdminRuneCmd.java
@@ -17,70 +17,68 @@ import engine.objects.CharacterRune;
import engine.objects.PlayerCharacter;
/**
- *
* @author Eighty
- *
*/
public class SetAdminRuneCmd extends AbstractDevCmd {
- public SetAdminRuneCmd() {
+ public SetAdminRuneCmd() {
super("setadminrune");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- int runeID = 0;
- boolean add = true;
- try {
- runeID = Integer.parseInt(args[0]);
- if (args.length > 1)
- add = (args[1].toLowerCase().equals("false")) ? false : true;
- } catch (NumberFormatException e) {
- this.sendUsage(pcSender);
- return;
- }
- if (runeID < 2901 || runeID > 2911) {
- throwbackError(pcSender,
- "Invalid setrune Command. must specify an ID between 2901 and 2911.");
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ int runeID = 0;
+ boolean add = true;
+ try {
+ runeID = Integer.parseInt(args[0]);
+ if (args.length > 1)
+ add = (args[1].toLowerCase().equals("false")) ? false : true;
+ } catch (NumberFormatException e) {
+ this.sendUsage(pcSender);
+ return;
+ }
+ if (runeID < 2901 || runeID > 2911) {
+ throwbackError(pcSender,
+ "Invalid setrune Command. must specify an ID between 2901 and 2911.");
+ return;
+ }
- if(!(target instanceof PlayerCharacter)) {
- target = pcSender;
- }
+ if (!(target instanceof PlayerCharacter)) {
+ target = pcSender;
+ }
- boolean worked = false;
- if (add) {
- worked = CharacterRune.grantRune((PlayerCharacter) target, runeID);
- if (worked)
- ChatManager.chatSayInfo(pcSender,
- "rune of ID " + runeID + " added");
- else
- throwbackError(pcSender, "Failed to add the rune of type "
- + runeID);
- } else {
- worked = CharacterRune.removeRune((PlayerCharacter) target, runeID);
- if (worked) {
- ChatManager.chatSayInfo(pcSender,
- "rune of ID " + runeID + " removed");
- InterestManager.reloadCharacter(pcSender);
- } else
- throwbackError(pcSender, "Failed to remove the rune of type "
- + runeID);
- }
- this.setTarget(target); //for logging
+ boolean worked = false;
+ if (add) {
+ worked = CharacterRune.grantRune((PlayerCharacter) target, runeID);
+ if (worked)
+ ChatManager.chatSayInfo(pcSender,
+ "rune of ID " + runeID + " added");
+ else
+ throwbackError(pcSender, "Failed to add the rune of type "
+ + runeID);
+ } else {
+ worked = CharacterRune.removeRune((PlayerCharacter) target, runeID);
+ if (worked) {
+ ChatManager.chatSayInfo(pcSender,
+ "rune of ID " + runeID + " removed");
+ InterestManager.reloadCharacter(pcSender);
+ } else
+ throwbackError(pcSender, "Failed to remove the rune of type "
+ + runeID);
+ }
+ this.setTarget(target); //for logging
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /setrune runeID [true/false]'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Grant or remove the rune with the specified runeID";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/SetBaneActiveCmd.java b/src/engine/devcmd/cmds/SetBaneActiveCmd.java
index 1dabfc7d..eb24655b 100644
--- a/src/engine/devcmd/cmds/SetBaneActiveCmd.java
+++ b/src/engine/devcmd/cmds/SetBaneActiveCmd.java
@@ -15,66 +15,65 @@ import engine.objects.*;
/**
* @author Eighty
- *
*/
public class SetBaneActiveCmd extends AbstractDevCmd {
- public SetBaneActiveCmd() {
+ public SetBaneActiveCmd() {
super("setbaneactive");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
-
- boolean setActive = false;
- if (words[0].equals("true"))
- setActive = true;
-
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
-
- if (zone == null) {
- throwbackError(pc, "Unable to find the zone you're in.");
- return;
- }
-
- if (!zone.isPlayerCity()) {
- throwbackError(pc, "This is not a player city.");
- return;
- }
-
- City city = City.getCity(zone.getPlayerCityUUID());
- if (city == null) {
- throwbackError(pc, "Unable to find the city associated with this zone.");
- return;
- }
-
- Bane bane = city.getBane();
- if (bane == null) {
- throwbackError(pc, "Could not find bane to modify.");
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ boolean setActive = false;
+ if (words[0].equals("true"))
+ setActive = true;
+
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+
+ if (zone == null) {
+ throwbackError(pc, "Unable to find the zone you're in.");
+ return;
+ }
+
+ if (!zone.isPlayerCity()) {
+ throwbackError(pc, "This is not a player city.");
+ return;
+ }
+
+ City city = City.getCity(zone.getPlayerCityUUID());
+ if (city == null) {
+ throwbackError(pc, "Unable to find the city associated with this zone.");
+ return;
+ }
+
+ Bane bane = city.getBane();
+ if (bane == null) {
+ throwbackError(pc, "Could not find bane to modify.");
+ return;
+ }
bane.getCity().protectionEnforced = !setActive;
- if (setActive)
- throwbackInfo(pc, "The bane has been set active.");
- else
- throwbackInfo(pc, "The bane has been set inactive.");
- }
+ if (setActive)
+ throwbackInfo(pc, "The bane has been set active.");
+ else
+ throwbackInfo(pc, "The bane has been set inactive.");
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Sets a bane active or deactivates a bane.";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "'./setbaneactive true|false'";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/SetBaseClassCmd.java b/src/engine/devcmd/cmds/SetBaseClassCmd.java
index 0c589c7a..be99f8de 100644
--- a/src/engine/devcmd/cmds/SetBaseClassCmd.java
+++ b/src/engine/devcmd/cmds/SetBaseClassCmd.java
@@ -17,48 +17,48 @@ import engine.objects.PlayerCharacter;
public class SetBaseClassCmd extends AbstractDevCmd {
- public SetBaseClassCmd() {
+ public SetBaseClassCmd() {
super("setBaseClass");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
- int classID = 0;
- try {
- classID = Integer.parseInt(words[0]);
- } catch (Exception e) {
- throwbackError(pc,
- "Invalid setBaseClass Command. must specify an ID between 2500 and 2503.");
- return;
- }
- if (classID < 2500 || classID > 2503) {
- throwbackError(pc,
- "Invalid setBaseClass Command. must specify an ID between 2500 and 2503.");
- return;
- }
- pc.setBaseClass(classID);
- this.setTarget(pc); //for logging
- ChatManager.chatSayInfo(pc,
- "BaseClass changed to " + classID);
- InterestManager.reloadCharacter(pc);
+ int classID = 0;
+ try {
+ classID = Integer.parseInt(words[0]);
+ } catch (Exception e) {
+ throwbackError(pc,
+ "Invalid setBaseClass Command. must specify an ID between 2500 and 2503.");
+ return;
+ }
+ if (classID < 2500 || classID > 2503) {
+ throwbackError(pc,
+ "Invalid setBaseClass Command. must specify an ID between 2500 and 2503.");
+ return;
+ }
+ pc.setBaseClass(classID);
+ this.setTarget(pc); //for logging
+ ChatManager.chatSayInfo(pc,
+ "BaseClass changed to " + classID);
+ InterestManager.reloadCharacter(pc);
- }
+ }
- @Override
- protected String _getHelpString() {
- return "Sets your character's BaseClass to 'id'";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Sets your character's BaseClass to 'id'";
+ }
- @Override
- protected String _getUsageString() {
- return "' /setBaseClass id'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /setBaseClass id'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetBuildingAltitudeCmd.java b/src/engine/devcmd/cmds/SetBuildingAltitudeCmd.java
index 441aec15..48386d00 100644
--- a/src/engine/devcmd/cmds/SetBuildingAltitudeCmd.java
+++ b/src/engine/devcmd/cmds/SetBuildingAltitudeCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -22,7 +21,7 @@ import engine.objects.PlayerCharacter;
public class SetBuildingAltitudeCmd extends AbstractDevCmd {
- public SetBuildingAltitudeCmd() {
+ public SetBuildingAltitudeCmd() {
super("setbuildingaltitude");
this.addCmdString("buildingaltitude");
}
@@ -52,56 +51,56 @@ public class SetBuildingAltitudeCmd extends AbstractDevCmd {
}
@Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
- if (target.getObjectType() != GameObjectType.Building){
- this.sendUsage(pc);
- return;
- }
+ if (target.getObjectType() != GameObjectType.Building) {
+ this.sendUsage(pc);
+ return;
+ }
- Building targetBuilding = (Building)target;
+ Building targetBuilding = (Building) target;
- float altitude = 0;
- try {
- altitude = Float.parseFloat(words[0]);
+ float altitude = 0;
+ try {
+ altitude = Float.parseFloat(words[0]);
- if (!UpdateBuildingAltitude(targetBuilding, targetBuilding.getStatAlt() + altitude)){
- this.throwbackError(pc, "Failed to update building altitude");
- return;
- }
+ if (!UpdateBuildingAltitude(targetBuilding, targetBuilding.getStatAlt() + altitude)) {
+ this.throwbackError(pc, "Failed to update building altitude");
+ return;
+ }
- WorldGrid.updateObject(targetBuilding);
+ WorldGrid.updateObject(targetBuilding);
- this.setTarget(pc); //for logging
+ this.setTarget(pc); //for logging
- // Update all surrounding clients.
+ // Update all surrounding clients.
- } catch (NumberFormatException e) {
- this.throwbackError(pc, "Supplied data: " + words[0]
- + " failed to parse to an Integer.");
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to setSlot to "
- + words[0]);
- }
- }
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Supplied data: " + words[0]
+ + " failed to parse to an Integer.");
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to setSlot to "
+ + words[0]);
+ }
+ }
- @Override
- protected String _getHelpString() {
- return "Sets slot position for an NPC to 'slot'";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Sets slot position for an NPC to 'slot'";
+ }
- @Override
- protected String _getUsageString() {
- return "' /changeslot slot'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /changeslot slot'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetForceRenameCityCmd.java b/src/engine/devcmd/cmds/SetForceRenameCityCmd.java
index 6e592155..3fded48b 100644
--- a/src/engine/devcmd/cmds/SetForceRenameCityCmd.java
+++ b/src/engine/devcmd/cmds/SetForceRenameCityCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -20,35 +19,35 @@ import engine.objects.Zone;
public class SetForceRenameCityCmd extends AbstractDevCmd {
- public SetForceRenameCityCmd() {
+ public SetForceRenameCityCmd() {
super("forcerename");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
- if (zone == null)
- return;
- boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
- if (zone.getPlayerCityUUID() == 0)
- return;
- City city = City.getCity(zone.getPlayerCityUUID());
- if (city == null)
- return;
- city.setForceRename(rename);
-
- }
-
- @Override
- protected String _getHelpString() {
- return "Temporarily Changes SubRace";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /subrace mobBaseID";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+ if (zone == null)
+ return;
+ boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
+ if (zone.getPlayerCityUUID() == 0)
+ return;
+ City city = City.getCity(zone.getPlayerCityUUID());
+ if (city == null)
+ return;
+ city.setForceRename(rename);
+
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Temporarily Changes SubRace";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /subrace mobBaseID";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetGuildCmd.java b/src/engine/devcmd/cmds/SetGuildCmd.java
index b46282ec..d869081b 100644
--- a/src/engine/devcmd/cmds/SetGuildCmd.java
+++ b/src/engine/devcmd/cmds/SetGuildCmd.java
@@ -10,96 +10,94 @@ import engine.objects.NPC;
import engine.objects.PlayerCharacter;
/**
- *
- * @author
- * Dev command to set the guild of targeted npc.
+ * @author Dev command to set the guild of targeted npc.
* Argument is a valid guild UID
*/
public class SetGuildCmd extends AbstractDevCmd {
-
- public SetGuildCmd() {
+
+ public SetGuildCmd() {
super("setguild");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
NPC targetNPC;
Guild targetGuild;
-
- if(validateUserInput(pcSender, target, args) == false) {
- this.sendUsage(pcSender);
- return;
- }
-
+
+ if (validateUserInput(pcSender, target, args) == false) {
+ this.sendUsage(pcSender);
+ return;
+ }
+
// Valid arguments, attempt to set guild of NPC.
-
+
targetNPC = getTargetAsNPC(pcSender);
targetGuild = Guild.getGuild(Integer.parseInt(args[0]));
-
+
DbManager.NPCQueries.SET_PROPERTY(targetNPC, "npc_guildID", args[0]);
targetNPC.setGuild(targetGuild);
-
+
// Refresh loaded game object
-
+
WorldGrid.updateObject(targetNPC, pcSender);
-
- }
- @Override
- protected String _getUsageString() {
+ }
+
+ @Override
+ protected String _getUsageString() {
return "' /setguild [UID]";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Assigns NPC to a given guild";
- }
-
- private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
-
+ }
+
+ private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
+
Guild tempGuild;
-
+
// Incorrect number of arguments
-
+
if (userInput.length != 1)
- return false;
+ return false;
// No target
-
- if (currTarget == null) {
- throwbackError(pcSender, "Requires an NPC be targeted");
- return false;
- }
-
+
+ if (currTarget == null) {
+ throwbackError(pcSender, "Requires an NPC be targeted");
+ return false;
+ }
+
// Target must be an NPC
-
- if (currTarget.getObjectType() != GameObjectType.NPC) {
- throwbackError(pcSender, "Invalid object. Must be an NPC");
- return false;
- }
-
+
+ if (currTarget.getObjectType() != GameObjectType.NPC) {
+ throwbackError(pcSender, "Invalid object. Must be an NPC");
+ return false;
+ }
+
// Argument must parse as a int.
-
- try {
- Integer.parseInt(userInput[0]); }
- catch (NumberFormatException | NullPointerException e) {
- return false;
+
+ try {
+ Integer.parseInt(userInput[0]);
+ } catch (NumberFormatException | NullPointerException e) {
+ return false;
}
-
- // Argument must return a valid guild
-
- tempGuild = Guild.getGuild(Integer.parseInt(userInput[0]));
-
- if (tempGuild == null) {
- throwbackError(pcSender, "Invalid Guild UID");
- return false;
- }
-
-
+
+ // Argument must return a valid guild
+
+ tempGuild = Guild.getGuild(Integer.parseInt(userInput[0]));
+
+ if (tempGuild == null) {
+ throwbackError(pcSender, "Invalid Guild UID");
+ return false;
+ }
+
+
return true;
-}
+ }
}
diff --git a/src/engine/devcmd/cmds/SetHealthCmd.java b/src/engine/devcmd/cmds/SetHealthCmd.java
index 81ef3064..3ee2763b 100644
--- a/src/engine/devcmd/cmds/SetHealthCmd.java
+++ b/src/engine/devcmd/cmds/SetHealthCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.DispatchChannel;
@@ -20,48 +19,48 @@ import engine.server.MBServerStatics;
public class SetHealthCmd extends AbstractDevCmd {
- public SetHealthCmd() {
+ public SetHealthCmd() {
super("setHealth");
this.addCmdString("health");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
- float amount = 0.0f;
- try {
- amount = Float.parseFloat(words[0]);
- pc.modifyHealth(amount, pc, false);
- this.setTarget(pc); //for logging
+ float amount = 0.0f;
+ try {
+ amount = Float.parseFloat(words[0]);
+ pc.modifyHealth(amount, pc, false);
+ this.setTarget(pc); //for logging
- // Update all surrounding clients.
- TargetedActionMsg cmm = new TargetedActionMsg(pc);
- DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
+ // Update all surrounding clients.
+ TargetedActionMsg cmm = new TargetedActionMsg(pc);
+ DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
- } catch (NumberFormatException e) {
- this.throwbackError(pc, "Supplied data: " + words[0]
- + " failed to parse to a Float.");
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to setHealth to "
- + words[0]);
- }
- }
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Supplied data: " + words[0]
+ + " failed to parse to a Float.");
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to setHealth to "
+ + words[0]);
+ }
+ }
- @Override
- protected String _getHelpString() {
- return "Sets your character's health to 'amount'";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Sets your character's health to 'amount'";
+ }
- @Override
- protected String _getUsageString() {
- return "' /setHealth amount'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /setHealth amount'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetInvulCmd.java b/src/engine/devcmd/cmds/SetInvulCmd.java
index a9f952a7..f26df9e4 100644
--- a/src/engine/devcmd/cmds/SetInvulCmd.java
+++ b/src/engine/devcmd/cmds/SetInvulCmd.java
@@ -20,72 +20,73 @@ import engine.objects.PlayerCharacter;
public class SetInvulCmd extends AbstractDevCmd {
- public SetInvulCmd() {
+ public SetInvulCmd() {
super("setinvul");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] words,
- AbstractGameObject target) {
- if (pcSender == null) return;
-
- if (words.length != 1) {
- this.sendUsage(pcSender);
- return;
- }
-
- boolean invul;
- switch (words[0].toLowerCase()) {
- case "true":
- invul = true;
- break;
- case "false":
- invul = false;
- break;
- default:
- this.sendUsage(pcSender);
- return;
- }
-
- if (target == null || !(target instanceof Building)) {
- throwbackError(pcSender, "No building targeted");
- return;
- }
-
- Building b = (Building) target;
-
- // if strucutre is a TOL then we're modifying the protection
- // status of the entire city
-
- if ( (b.getBlueprint() != null) &&
- (b.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))) {
-
- City city;
-
- city = b.getCity();
- city.protectionEnforced = !city.protectionEnforced;
- throwbackInfo(pcSender, "City protection contracts enforced: " + city.protectionEnforced);
- return;
- }
-
- if (invul) {
-
- b.setProtectionState(ProtectionState.PROTECTED);
- throwbackInfo(pcSender, "The targetted building is now invulnerable.");
- return;
- }
- b.setProtectionState(ProtectionState.NONE);
- throwbackInfo(pcSender, "The targetted building is no longer invulernable.");
- }
-
- @Override
- protected String _getUsageString() {
- return "'./setInvul true|false'";
- }
-
- @Override
- protected String _getHelpString() {
- return "Turns invulernability on or off for building";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] words,
+ AbstractGameObject target) {
+ if (pcSender == null)
+ return;
+
+ if (words.length != 1) {
+ this.sendUsage(pcSender);
+ return;
+ }
+
+ boolean invul;
+ switch (words[0].toLowerCase()) {
+ case "true":
+ invul = true;
+ break;
+ case "false":
+ invul = false;
+ break;
+ default:
+ this.sendUsage(pcSender);
+ return;
+ }
+
+ if (target == null || !(target instanceof Building)) {
+ throwbackError(pcSender, "No building targeted");
+ return;
+ }
+
+ Building b = (Building) target;
+
+ // if strucutre is a TOL then we're modifying the protection
+ // status of the entire city
+
+ if ((b.getBlueprint() != null) &&
+ (b.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))) {
+
+ City city;
+
+ city = b.getCity();
+ city.protectionEnforced = !city.protectionEnforced;
+ throwbackInfo(pcSender, "City protection contracts enforced: " + city.protectionEnforced);
+ return;
+ }
+
+ if (invul) {
+
+ b.setProtectionState(ProtectionState.PROTECTED);
+ throwbackInfo(pcSender, "The targetted building is now invulnerable.");
+ return;
+ }
+ b.setProtectionState(ProtectionState.NONE);
+ throwbackInfo(pcSender, "The targetted building is no longer invulernable.");
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "'./setInvul true|false'";
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Turns invulernability on or off for building";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetLevelCmd.java b/src/engine/devcmd/cmds/SetLevelCmd.java
index aabedc40..47be4ff6 100644
--- a/src/engine/devcmd/cmds/SetLevelCmd.java
+++ b/src/engine/devcmd/cmds/SetLevelCmd.java
@@ -17,57 +17,57 @@ import engine.objects.PlayerCharacter;
public class SetLevelCmd extends AbstractDevCmd {
- public SetLevelCmd() {
- super("setLevel");
- }
+ public SetLevelCmd() {
+ super("setLevel");
+ }
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
- PlayerCharacter tar;
- if (target != null) {
- if (target instanceof PlayerCharacter)
- tar = (PlayerCharacter) target;
- else
- tar = pc;
- } else
- tar = pc;
+ PlayerCharacter tar;
+ if (target != null) {
+ if (target instanceof PlayerCharacter)
+ tar = (PlayerCharacter) target;
+ else
+ tar = pc;
+ } else
+ tar = pc;
- int level = 0;
- try {
- level = Integer.parseInt(words[0]);
- } catch (NumberFormatException e) {
- this.sendUsage(pc);
- return;
- }
- if (level < 1 || level > 75) {
- this.sendHelp(pc);
- return;
- }
+ int level = 0;
+ try {
+ level = Integer.parseInt(words[0]);
+ } catch (NumberFormatException e) {
+ this.sendUsage(pc);
+ return;
+ }
+ if (level < 1 || level > 75) {
+ this.sendHelp(pc);
+ return;
+ }
- if (level > 10 && pc.getPromotionClass() == null)
- level = 10;
+ if (level > 10 && pc.getPromotionClass() == null)
+ level = 10;
- tar.setLevel((short) level);
- this.setTarget(tar); //for logging
- ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level);
- InterestManager.reloadCharacter(tar);
- }
+ tar.setLevel((short) level);
+ this.setTarget(tar); //for logging
+ ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level);
+ InterestManager.reloadCharacter(tar);
+ }
- @Override
- protected String _getHelpString() {
- return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
+ }
- @Override
- protected String _getUsageString() {
- return "' /setLevel amount'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /setLevel amount'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetMaintCmd.java b/src/engine/devcmd/cmds/SetMaintCmd.java
index e81832e4..85346322 100644
--- a/src/engine/devcmd/cmds/SetMaintCmd.java
+++ b/src/engine/devcmd/cmds/SetMaintCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum;
@@ -22,40 +21,40 @@ import java.time.LocalDateTime;
public class SetMaintCmd extends AbstractDevCmd {
- public SetMaintCmd() {
+ public SetMaintCmd() {
super("setMaint");
this.addCmdString("setmaint");
}
- @Override
- protected void _doCmd(PlayerCharacter player, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] words,
+ AbstractGameObject target) {
- if (!target.getObjectType().equals(Enum.GameObjectType.Building)) {
- ChatManager.chatSayInfo(player, "Target is not a valid building");
- return;
- }
+ if (!target.getObjectType().equals(Enum.GameObjectType.Building)) {
+ ChatManager.chatSayInfo(player, "Target is not a valid building");
+ return;
+ }
- Building targetBuilding = (Building)target;
+ Building targetBuilding = (Building) target;
- if (targetBuilding.getProtectionState().equals(Enum.ProtectionState.NPC)) {
- ChatManager.chatSayInfo(player, "Target is not a valid building");
- return;
- }
+ if (targetBuilding.getProtectionState().equals(Enum.ProtectionState.NPC)) {
+ ChatManager.chatSayInfo(player, "Target is not a valid building");
+ return;
+ }
- MaintenanceManager.setMaintDateTime(targetBuilding, LocalDateTime.now().minusDays(1).withHour(13).withMinute(0).withSecond(0).withNano(0));
- ChatManager.chatSayInfo(player, "Maint will run for UUID: " + targetBuilding.getObjectUUID());
- }
+ MaintenanceManager.setMaintDateTime(targetBuilding, LocalDateTime.now().minusDays(1).withHour(13).withMinute(0).withSecond(0).withNano(0));
+ ChatManager.chatSayInfo(player, "Maint will run for UUID: " + targetBuilding.getObjectUUID());
+ }
- @Override
- protected String _getHelpString() {
- return "Sets the Rank of either the targets object or the object specified by ID.";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Sets the Rank of either the targets object or the object specified by ID.";
+ }
- @Override
- protected String _getUsageString() {
- return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetManaCmd.java b/src/engine/devcmd/cmds/SetManaCmd.java
index 47e059a3..3988e2a3 100644
--- a/src/engine/devcmd/cmds/SetManaCmd.java
+++ b/src/engine/devcmd/cmds/SetManaCmd.java
@@ -9,48 +9,48 @@ import engine.server.MBServerStatics;
public class SetManaCmd extends AbstractDevCmd {
- public SetManaCmd() {
+ public SetManaCmd() {
super("setMana");
this.addCmdString("mana");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
-
- float amount = 0.0f;
- try {
- amount = Float.parseFloat(words[0]);
- pc.setMana(amount, pc);
- this.setTarget(pc); //for logging
-
- //Update all surrounding clients. - NOT for Mana?
- TargetedActionMsg cmm = new TargetedActionMsg(pc);
- DispatchMessage.dispatchMsgToInterestArea(pc, cmm, engine.Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
-
- } catch (NumberFormatException e) {
- this.throwbackError(pc, "Supplied data: " + words[0]
- + " failed to parse to a Float.");
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to setMana to "
- + words[0]);
- }
- }
-
- @Override
- protected String _getHelpString() {
- return "Sets your character's Mana to 'amount'";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /setMana amount'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ float amount = 0.0f;
+ try {
+ amount = Float.parseFloat(words[0]);
+ pc.setMana(amount, pc);
+ this.setTarget(pc); //for logging
+
+ //Update all surrounding clients. - NOT for Mana?
+ TargetedActionMsg cmm = new TargetedActionMsg(pc);
+ DispatchMessage.dispatchMsgToInterestArea(pc, cmm, engine.Enum.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
+
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Supplied data: " + words[0]
+ + " failed to parse to a Float.");
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to setMana to "
+ + words[0]);
+ }
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Sets your character's Mana to 'amount'";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /setMana amount'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetNpcEquipSetCmd.java b/src/engine/devcmd/cmds/SetNpcEquipSetCmd.java
index d4b2dd67..844d6613 100644
--- a/src/engine/devcmd/cmds/SetNpcEquipSetCmd.java
+++ b/src/engine/devcmd/cmds/SetNpcEquipSetCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -20,119 +19,118 @@ import engine.objects.PlayerCharacter;
public class SetNpcEquipSetCmd extends AbstractDevCmd {
- public static int lastEquipSetID = 0;
- public SetNpcEquipSetCmd() {
+ public static int lastEquipSetID = 0;
+
+ public SetNpcEquipSetCmd() {
super("setEquipSet");
this.addCmdString("equipset");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
-
- if (target.getObjectType() != GameObjectType.NPC){
- this.sendUsage(pc);
- return;
- }
-
- NPC npc = (NPC)target;
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
- if (words[0].equalsIgnoreCase("next")){
+ if (target.getObjectType() != GameObjectType.NPC) {
+ this.sendUsage(pc);
+ return;
+ }
- if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
- SetNpcEquipSetCmd.lastEquipSetID = 1;
- else
- SetNpcEquipSetCmd.lastEquipSetID++;
+ NPC npc = (NPC) target;
- boolean complete = false;
+ if (words[0].equalsIgnoreCase("next")) {
- while (complete == false){
- complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
+ if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
+ SetNpcEquipSetCmd.lastEquipSetID = 1;
+ else
+ SetNpcEquipSetCmd.lastEquipSetID++;
- if (!complete){
- SetNpcEquipSetCmd.lastEquipSetID++;
- if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
- SetNpcEquipSetCmd.lastEquipSetID = 1;
- }
- }
+ boolean complete = false;
- if (complete){
- npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
- WorldGrid.updateObject(npc);
- this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID );
- }
+ while (complete == false) {
+ complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
+ if (!complete) {
+ SetNpcEquipSetCmd.lastEquipSetID++;
+ if (SetNpcEquipSetCmd.lastEquipSetID >= 1222)
+ SetNpcEquipSetCmd.lastEquipSetID = 1;
+ }
+ }
+ if (complete) {
+ npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
+ WorldGrid.updateObject(npc);
+ this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID);
+ }
- return;
- }
- if (words[0].equalsIgnoreCase("last")){
+ return;
+ }
- if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
- SetNpcEquipSetCmd.lastEquipSetID = 1222;
- else
- SetNpcEquipSetCmd.lastEquipSetID--;
+ if (words[0].equalsIgnoreCase("last")) {
- boolean complete = false;
+ if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
+ SetNpcEquipSetCmd.lastEquipSetID = 1222;
+ else
+ SetNpcEquipSetCmd.lastEquipSetID--;
- while (complete == false){
- complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
+ boolean complete = false;
- if (!complete){
- SetNpcEquipSetCmd.lastEquipSetID--;
- if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
- SetNpcEquipSetCmd.lastEquipSetID = 1222;
- }
+ while (complete == false) {
+ complete = NPC.UpdateEquipSetID(npc, SetNpcEquipSetCmd.lastEquipSetID);
- }
+ if (!complete) {
+ SetNpcEquipSetCmd.lastEquipSetID--;
+ if (SetNpcEquipSetCmd.lastEquipSetID <= 1)
+ SetNpcEquipSetCmd.lastEquipSetID = 1222;
+ }
- if (complete){
- this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID );
- npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
- WorldGrid.updateObject(npc);
- }
+ }
+ if (complete) {
+ this.throwbackInfo(pc, "Equipment Set Changed to " + SetNpcEquipSetCmd.lastEquipSetID);
+ npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
+ WorldGrid.updateObject(npc);
+ }
- return;
- }
+ return;
+ }
- int equipSetID = 0;
+ int equipSetID = 0;
- try{
- equipSetID = Integer.parseInt(words[0]);
- }catch(Exception e){
- this.throwbackError(pc, e.getMessage());
- }
+ try {
+ equipSetID = Integer.parseInt(words[0]);
+ } catch (Exception e) {
+ this.throwbackError(pc, e.getMessage());
+ }
- if (!NPC.UpdateEquipSetID(npc, equipSetID)){
- this.throwbackError(pc, "Unable to find Equipset for ID " + equipSetID );
- return;
- }
+ if (!NPC.UpdateEquipSetID(npc, equipSetID)) {
+ this.throwbackError(pc, "Unable to find Equipset for ID " + equipSetID);
+ return;
+ }
- SetNpcEquipSetCmd.lastEquipSetID = equipSetID;
- npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
- WorldGrid.updateObject(npc);
+ SetNpcEquipSetCmd.lastEquipSetID = equipSetID;
+ npc.equip = MobBase.loadEquipmentSet(npc.getEquipmentSetID());
+ WorldGrid.updateObject(npc);
- this.throwbackInfo(pc, "Equipment Set Changed to " + equipSetID );
+ this.throwbackInfo(pc, "Equipment Set Changed to " + equipSetID);
- }
+ }
- @Override
- protected String _getHelpString() {
- return "Sets slot position for an NPC to 'slot'";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Sets slot position for an NPC to 'slot'";
+ }
- @Override
- protected String _getUsageString() {
- return "' /changeslot slot'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /changeslot slot'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetNpcMobbaseCmd.java b/src/engine/devcmd/cmds/SetNpcMobbaseCmd.java
index 07002761..4b5c708f 100644
--- a/src/engine/devcmd/cmds/SetNpcMobbaseCmd.java
+++ b/src/engine/devcmd/cmds/SetNpcMobbaseCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -20,48 +19,48 @@ import engine.objects.PlayerCharacter;
public class SetNpcMobbaseCmd extends AbstractDevCmd {
- public SetNpcMobbaseCmd() {
+ public SetNpcMobbaseCmd() {
super("setmobbase");
this.addCmdString("npcmobbase");
}
- @Override
- protected void _doCmd(PlayerCharacter player, String[] words,
- AbstractGameObject target) {
-
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(player);
- return;
- }
-
- if (target.getObjectType() != GameObjectType.NPC){
- this.sendUsage(player);
- return;
- }
-
- NPC npc = (NPC)target;
-
- int mobBaseID = Integer.parseInt(words[0]);
-
- if (MobBase.getMobBase(mobBaseID) == null){
- this.throwbackError(player, "Cannot find Mobbase for ID " + mobBaseID);
- return;
- }
- NPC.UpdateRaceID(npc, mobBaseID);
-
- WorldGrid.updateObject(npc);
-
- }
-
- @Override
- protected String _getHelpString() {
- return "Sets mobbase override for an NPC";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /setmobbase mobBaseID'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] words,
+ AbstractGameObject target) {
+
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(player);
+ return;
+ }
+
+ if (target.getObjectType() != GameObjectType.NPC) {
+ this.sendUsage(player);
+ return;
+ }
+
+ NPC npc = (NPC) target;
+
+ int mobBaseID = Integer.parseInt(words[0]);
+
+ if (MobBase.getMobBase(mobBaseID) == null) {
+ this.throwbackError(player, "Cannot find Mobbase for ID " + mobBaseID);
+ return;
+ }
+ NPC.UpdateRaceID(npc, mobBaseID);
+
+ WorldGrid.updateObject(npc);
+
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Sets mobbase override for an NPC";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /setmobbase mobBaseID'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetNpcNameCmd.java b/src/engine/devcmd/cmds/SetNpcNameCmd.java
index 2e05ae2c..d670db67 100644
--- a/src/engine/devcmd/cmds/SetNpcNameCmd.java
+++ b/src/engine/devcmd/cmds/SetNpcNameCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -19,44 +18,45 @@ import engine.objects.PlayerCharacter;
public class SetNpcNameCmd extends AbstractDevCmd {
- public static int lastEquipSetID = 0;
- public SetNpcNameCmd() {
+ public static int lastEquipSetID = 0;
+
+ public SetNpcNameCmd() {
super("setNPCName");
this.addCmdString("npcname");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
-
- if (target.getObjectType() != GameObjectType.NPC){
- this.sendUsage(pc);
- return;
- }
-
- NPC npc = (NPC)target;
-
- String name = words[0];
-
- NPC.UpdateName(npc, name);
-
- WorldGrid.updateObject(npc);
-
- }
-
- @Override
- protected String _getHelpString() {
- return "Sets slot position for an NPC to 'slot'";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /changeslot slot'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ if (target.getObjectType() != GameObjectType.NPC) {
+ this.sendUsage(pc);
+ return;
+ }
+
+ NPC npc = (NPC) target;
+
+ String name = words[0];
+
+ NPC.UpdateName(npc, name);
+
+ WorldGrid.updateObject(npc);
+
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Sets slot position for an NPC to 'slot'";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /changeslot slot'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetOwnerCmd.java b/src/engine/devcmd/cmds/SetOwnerCmd.java
index f07241bf..f7753db2 100644
--- a/src/engine/devcmd/cmds/SetOwnerCmd.java
+++ b/src/engine/devcmd/cmds/SetOwnerCmd.java
@@ -8,111 +8,110 @@ import engine.objects.*;
/**
- *
- * @author
- * Dev command to set the owner of targeted building.
+ * @author Dev command to set the owner of targeted building.
* Argument is a valid guild UID
*/
public class SetOwnerCmd extends AbstractDevCmd {
- Building _targetBuilding = null;
- DbObjectType _newOwnerType;
- AbstractCharacter outOwner;
+ Building _targetBuilding = null;
+ DbObjectType _newOwnerType;
+ AbstractCharacter outOwner;
- public SetOwnerCmd() {
+ public SetOwnerCmd() {
super("setowner");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
-
- if(validateUserInput(pcSender, target, args) == false) {
- this.sendUsage(pcSender);
- return;
- }
-
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+
+ if (validateUserInput(pcSender, target, args) == false) {
+ this.sendUsage(pcSender);
+ return;
+ }
+
// Valid arguments, attempt to set owner of Building.
-
+
_targetBuilding = getTargetAsBuilding(pcSender);
// if it's a tol change ownership of the city
if (_targetBuilding.getBlueprint() != null &&
- _targetBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.TOL)) {
+ _targetBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.TOL)) {
City city = _targetBuilding.getCity();
if (city != null) {
city.claim(outOwner);
- return; }
+ return;
+ }
}
_targetBuilding.setOwner(outOwner);
-
+
DbManager.BuildingQueries.SET_PROPERTY(_targetBuilding, "ownerUUID", args[0]);
-
+
_targetBuilding.refreshGuild();
-
- }
- @Override
- protected String _getUsageString() {
+ }
+
+ @Override
+ protected String _getUsageString() {
return "' /setowner [UID]";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Assigns new owner to building";
- }
-
- private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
-
+ }
+
+ private boolean validateUserInput(PlayerCharacter pcSender, AbstractGameObject currTarget, String[] userInput) {
+
// Incorrect number of arguments
-
+
if (userInput.length != 1)
- return false;
+ return false;
// No target
-
- if (currTarget == null) {
- throwbackError(pcSender, "Requires a Building to be targeted");
- return false;
- }
-
+
+ if (currTarget == null) {
+ throwbackError(pcSender, "Requires a Building to be targeted");
+ return false;
+ }
+
// Target must be an Building
-
- if (currTarget.getObjectType() != GameObjectType.Building) {
- throwbackError(pcSender, "Invalid target. Must be a Building");
- return false;
- }
-
+
+ if (currTarget.getObjectType() != GameObjectType.Building) {
+ throwbackError(pcSender, "Invalid target. Must be a Building");
+ return false;
+ }
+
// Argument must parse to a long.
-
- try {
- Long.parseLong(userInput[0]); }
- catch (NumberFormatException | NullPointerException e) {
- return false;
+
+ try {
+ Long.parseLong(userInput[0]);
+ } catch (NumberFormatException | NullPointerException e) {
+ return false;
+ }
+
+ // Argument must return a valid NPC or PlayerCharacter
+
+ _newOwnerType = DbManager.BuildingQueries.GET_UID_ENUM(Long.parseLong(userInput[0]));
+
+ switch (_newOwnerType) {
+ case NPC:
+ outOwner = (AbstractCharacter) DbManager.getObject(GameObjectType.NPC, Integer.parseInt(userInput[0]));
+ break;
+ case CHARACTER:
+ outOwner = (AbstractCharacter) DbManager.getObject(GameObjectType.PlayerCharacter, Integer.parseInt(userInput[0]));
+ break;
+ }
+
+ if (outOwner == null) {
+ throwbackError(pcSender, "Invalid Owner UID");
+ return false;
}
-
- // Argument must return a valid NPC or PlayerCharacter
-
- _newOwnerType = DbManager.BuildingQueries.GET_UID_ENUM(Long.parseLong(userInput[0]));
-
- switch (_newOwnerType) {
- case NPC:
- outOwner = (AbstractCharacter)DbManager.getObject(GameObjectType.NPC, Integer.parseInt(userInput[0]));
- break;
- case CHARACTER:
- outOwner = (AbstractCharacter)DbManager.getObject(GameObjectType.PlayerCharacter, Integer.parseInt(userInput[0]));
- break;
- }
- if (outOwner == null) {
- throwbackError(pcSender, "Invalid Owner UID");
- return false;
- }
-
return true;
-}
+ }
}
diff --git a/src/engine/devcmd/cmds/SetPromotionClassCmd.java b/src/engine/devcmd/cmds/SetPromotionClassCmd.java
index 88239ab2..f8776786 100644
--- a/src/engine/devcmd/cmds/SetPromotionClassCmd.java
+++ b/src/engine/devcmd/cmds/SetPromotionClassCmd.java
@@ -13,60 +13,60 @@ import engine.server.MBServerStatics;
public class SetPromotionClassCmd extends AbstractDevCmd {
- public SetPromotionClassCmd() {
+ public SetPromotionClassCmd() {
super("setPromotionClass");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
- int classID = 0;
- try {
- classID = Integer.parseInt(words[0]);
- } catch (Exception e) {
- throwbackError(pc,
- "Invalid setPromotionClass Command. must specify an ID between 2504 and 2526.");
- return;
- }
- if (classID < 2504 || classID > 2526 || classID == 2522) {
- throwbackError(pc,
- "Invalid setPromotionClass Command. must specify an ID between 2504 and 2526.");
- return;
- }
- pc.setPromotionClass(classID);
- ChatManager.chatSayInfo(pc,
- "PromotionClass changed to " + classID);
- InterestManager.reloadCharacter(pc);
- this.setTarget(pc); //for logging
+ int classID = 0;
+ try {
+ classID = Integer.parseInt(words[0]);
+ } catch (Exception e) {
+ throwbackError(pc,
+ "Invalid setPromotionClass Command. must specify an ID between 2504 and 2526.");
+ return;
+ }
+ if (classID < 2504 || classID > 2526 || classID == 2522) {
+ throwbackError(pc,
+ "Invalid setPromotionClass Command. must specify an ID between 2504 and 2526.");
+ return;
+ }
+ pc.setPromotionClass(classID);
+ ChatManager.chatSayInfo(pc,
+ "PromotionClass changed to " + classID);
+ InterestManager.reloadCharacter(pc);
+ this.setTarget(pc); //for logging
- // recalculate all bonuses/formulas/skills/powers
- pc.recalculate();
+ // recalculate all bonuses/formulas/skills/powers
+ pc.recalculate();
- // send the rune application to the clients
+ // send the rune application to the clients
- PromotionClass promo = pc.getPromotionClass();
- if (promo != null) {
- ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo.getObjectUUID(), true);
- DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
- }
+ PromotionClass promo = pc.getPromotionClass();
+ if (promo != null) {
+ ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo.getObjectUUID(), true);
+ DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
+ }
- }
+ }
- @Override
- protected String _getHelpString() {
- return "Sets your character's PromotionClass to 'ID'";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Sets your character's PromotionClass to 'ID'";
+ }
- @Override
- protected String _getUsageString() {
- return "' /setPromotionClass id'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /setPromotionClass id'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetRankCmd.java b/src/engine/devcmd/cmds/SetRankCmd.java
index 6e7a43a4..614701c4 100644
--- a/src/engine/devcmd/cmds/SetRankCmd.java
+++ b/src/engine/devcmd/cmds/SetRankCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.InterestManagement.WorldGrid;
@@ -18,125 +17,124 @@ import engine.objects.*;
public class SetRankCmd extends AbstractDevCmd {
- public SetRankCmd() {
- super("setRank");
- this.addCmdString("setrank");
- this.addCmdString("rank");
- }
-
- @Override
- protected void _doCmd(PlayerCharacter player, String[] words,
- AbstractGameObject target) {
-
- int targetRank;
- int uuid = 0;
-
- if (words.length == 2) {
- try {
- uuid = Integer.parseInt(words[0]);
- targetRank = Integer.parseInt(words[1]);
- } catch (NumberFormatException e) {
- this.sendUsage(player);
- return; // NaN
- }
- } else if (words.length == 1) {
- try {
- targetRank = Integer.parseInt(words[0]);
- } catch (NumberFormatException e) {
- this.sendUsage(player);
- return; // NaN
- }
- } else {
- this.sendUsage(player);
- return;
- }
-
- if (target != null){
- switch(target.getObjectType()){
- case Building:
- Building targetBuilding = (Building)target;
- Blueprint blueprint = targetBuilding.getBlueprint();
-
- if (blueprint == null) {
- targetBuilding.setRank(targetRank);
- ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
- return;
- }
-
- if (targetRank > blueprint.getMaxRank()) {
- throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
- return;
- }
-
- // Set the current targetRank
- int lastMeshID = targetBuilding.getMeshUUID();
- targetBuilding.setRank(targetRank);
-
- ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
- break;
- case NPC:
- NPC toRank = (NPC)target;
- toRank.setRank(targetRank * 10);
- toRank.setUpgradeDateTime(null);
- WorldGrid.updateObject(toRank);
- break;
- case Mob:
- Mob toRankCaptain = (Mob)target;
- if (toRankCaptain.getContract() != null){
- toRankCaptain.setRank(targetRank * 10);
- Mob.setUpgradeDateTime(toRankCaptain, null);
- WorldGrid.updateObject(toRankCaptain);
- }
-
- break;
- }
-
- }else{
- Building targetBuilding = null;
- if (uuid != 0)
- targetBuilding = BuildingManager.getBuilding(uuid);
-
- if (targetBuilding == null) {
- throwbackError(player, "Unable to find building.");
- return;
- }
-
- Blueprint blueprint = targetBuilding.getBlueprint();
-
- if (blueprint == null) {
- throwbackError(player, "Attempt to rank building without blueprint" + targetBuilding.getObjectUUID());
- return;
- }
-
- if (targetRank > blueprint.getMaxRank()) {
- throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
- return;
- }
-
- // Set the current targetRank
- int lastMeshID = targetBuilding.getMeshUUID();
- targetBuilding.setRank(targetRank);
-
- if (lastMeshID != targetBuilding.getMeshUUID())
- targetBuilding.refresh(true);
- else
- targetBuilding.refresh(false);
-
- ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
- }
-
-
-
- }
-
- @Override
- protected String _getHelpString() {
- return "Sets the Rank of either the targets object or the object specified by ID.";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
- }
+ public SetRankCmd() {
+ super("setRank");
+ this.addCmdString("setrank");
+ this.addCmdString("rank");
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] words,
+ AbstractGameObject target) {
+
+ int targetRank;
+ int uuid = 0;
+
+ if (words.length == 2) {
+ try {
+ uuid = Integer.parseInt(words[0]);
+ targetRank = Integer.parseInt(words[1]);
+ } catch (NumberFormatException e) {
+ this.sendUsage(player);
+ return; // NaN
+ }
+ } else if (words.length == 1) {
+ try {
+ targetRank = Integer.parseInt(words[0]);
+ } catch (NumberFormatException e) {
+ this.sendUsage(player);
+ return; // NaN
+ }
+ } else {
+ this.sendUsage(player);
+ return;
+ }
+
+ if (target != null) {
+ switch (target.getObjectType()) {
+ case Building:
+ Building targetBuilding = (Building) target;
+ Blueprint blueprint = targetBuilding.getBlueprint();
+
+ if (blueprint == null) {
+ targetBuilding.setRank(targetRank);
+ ChatManager.chatSayInfo(player, "Building ranked without blueprint" + targetBuilding.getObjectUUID());
+ return;
+ }
+
+ if (targetRank > blueprint.getMaxRank()) {
+ throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
+ return;
+ }
+
+ // Set the current targetRank
+ int lastMeshID = targetBuilding.getMeshUUID();
+ targetBuilding.setRank(targetRank);
+
+ ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
+ break;
+ case NPC:
+ NPC toRank = (NPC) target;
+ toRank.setRank(targetRank * 10);
+ toRank.setUpgradeDateTime(null);
+ WorldGrid.updateObject(toRank);
+ break;
+ case Mob:
+ Mob toRankCaptain = (Mob) target;
+ if (toRankCaptain.getContract() != null) {
+ toRankCaptain.setRank(targetRank * 10);
+ Mob.setUpgradeDateTime(toRankCaptain, null);
+ WorldGrid.updateObject(toRankCaptain);
+ }
+
+ break;
+ }
+
+ } else {
+ Building targetBuilding = null;
+ if (uuid != 0)
+ targetBuilding = BuildingManager.getBuilding(uuid);
+
+ if (targetBuilding == null) {
+ throwbackError(player, "Unable to find building.");
+ return;
+ }
+
+ Blueprint blueprint = targetBuilding.getBlueprint();
+
+ if (blueprint == null) {
+ throwbackError(player, "Attempt to rank building without blueprint" + targetBuilding.getObjectUUID());
+ return;
+ }
+
+ if (targetRank > blueprint.getMaxRank()) {
+ throwbackError(player, "Attempt to set Invalid Rank" + targetBuilding.getObjectUUID());
+ return;
+ }
+
+ // Set the current targetRank
+ int lastMeshID = targetBuilding.getMeshUUID();
+ targetBuilding.setRank(targetRank);
+
+ if (lastMeshID != targetBuilding.getMeshUUID())
+ targetBuilding.refresh(true);
+ else
+ targetBuilding.refresh(false);
+
+ ChatManager.chatSayInfo(player, "Rank set for building with ID " + targetBuilding.getObjectUUID() + " to rank " + targetRank);
+ }
+
+
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Sets the Rank of either the targets object or the object specified by ID.";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /setrank ID rank' || ' /setrank rank' || ' /rank ID rank' || ' /rank rank'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetRuneCmd.java b/src/engine/devcmd/cmds/SetRuneCmd.java
index 99bd3b2d..1379ab35 100644
--- a/src/engine/devcmd/cmds/SetRuneCmd.java
+++ b/src/engine/devcmd/cmds/SetRuneCmd.java
@@ -17,64 +17,62 @@ import engine.objects.CharacterRune;
import engine.objects.PlayerCharacter;
/**
- *
* @author Eighty
- *
*/
public class SetRuneCmd extends AbstractDevCmd {
- public SetRuneCmd() {
+ public SetRuneCmd() {
super("setRune");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- int runeID = 0;
- boolean add = true;
- try {
- runeID = Integer.parseInt(args[0]);
- if (args.length > 1)
- add = (args[1].toLowerCase().equals("false")) ? false : true;
- } catch (NumberFormatException e) {
- this.sendUsage(pcSender);
- return;
- }
- if (runeID < 3001 || runeID > 3049) {
- throwbackError(pcSender,
- "Invalid setrune Command. must specify an ID between 3001 and 3048.");
- return;
- }
- boolean worked = false;
- if (add) {
- worked = CharacterRune.grantRune(pcSender, runeID);
- if (worked)
- ChatManager.chatSayInfo(pcSender,
- "rune of ID " + runeID + " added");
- else
- throwbackError(pcSender, "Failed to add the rune of type "
- + runeID);
- } else {
- worked = CharacterRune.removeRune(pcSender, runeID);
- if (worked) {
- ChatManager.chatSayInfo(pcSender,
- "rune of ID " + runeID + " removed");
- InterestManager.reloadCharacter(pcSender);
- } else
- throwbackError(pcSender, "Failed to remove the rune of type "
- + runeID);
- }
- this.setTarget(pcSender); //for logging
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ int runeID = 0;
+ boolean add = true;
+ try {
+ runeID = Integer.parseInt(args[0]);
+ if (args.length > 1)
+ add = (args[1].toLowerCase().equals("false")) ? false : true;
+ } catch (NumberFormatException e) {
+ this.sendUsage(pcSender);
+ return;
+ }
+ if (runeID < 3001 || runeID > 3049) {
+ throwbackError(pcSender,
+ "Invalid setrune Command. must specify an ID between 3001 and 3048.");
+ return;
+ }
+ boolean worked = false;
+ if (add) {
+ worked = CharacterRune.grantRune(pcSender, runeID);
+ if (worked)
+ ChatManager.chatSayInfo(pcSender,
+ "rune of ID " + runeID + " added");
+ else
+ throwbackError(pcSender, "Failed to add the rune of type "
+ + runeID);
+ } else {
+ worked = CharacterRune.removeRune(pcSender, runeID);
+ if (worked) {
+ ChatManager.chatSayInfo(pcSender,
+ "rune of ID " + runeID + " removed");
+ InterestManager.reloadCharacter(pcSender);
+ } else
+ throwbackError(pcSender, "Failed to remove the rune of type "
+ + runeID);
+ }
+ this.setTarget(pcSender); //for logging
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "' /setrune runeID [true/false]'";
- }
+ }
- @Override
- protected String _getHelpString() {
+ @Override
+ protected String _getHelpString() {
return "Grant or remove the rune with the specified runeID";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/SetStaminaCmd.java b/src/engine/devcmd/cmds/SetStaminaCmd.java
index e0cde8e7..d760a1cc 100644
--- a/src/engine/devcmd/cmds/SetStaminaCmd.java
+++ b/src/engine/devcmd/cmds/SetStaminaCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.DispatchChannel;
@@ -21,48 +20,48 @@ import engine.server.MBServerStatics;
public class SetStaminaCmd extends AbstractDevCmd {
- public SetStaminaCmd() {
+ public SetStaminaCmd() {
super("setStamina");
this.addCmdString("stamina");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- if (words.length != 1) {
- this.sendUsage(pc);
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (words.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
- float amount = 0.0f;
- try {
- amount = Float.parseFloat(words[0]);
- pc.setStamina(amount, pc);
- this.setTarget(pc); //for logging
+ float amount = 0.0f;
+ try {
+ amount = Float.parseFloat(words[0]);
+ pc.setStamina(amount, pc);
+ this.setTarget(pc); //for logging
- // Update all surrounding clients.
- TargetedActionMsg cmm = new TargetedActionMsg(pc);
- DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
+ // Update all surrounding clients.
+ TargetedActionMsg cmm = new TargetedActionMsg(pc);
+ DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
- } catch (NumberFormatException e) {
- this.throwbackError(pc, "Supplied data: " + words[0]
- + " failed to parse to a Float.");
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to setStamina to "
- + words[0]);
- }
- }
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Supplied data: " + words[0]
+ + " failed to parse to a Float.");
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to setStamina to "
+ + words[0]);
+ }
+ }
- @Override
- protected String _getHelpString() {
- return "Sets your character's Stamina to 'amount'";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Sets your character's Stamina to 'amount'";
+ }
- @Override
- protected String _getUsageString() {
- return "' /setStamina amount'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /setStamina amount'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SetSubRaceCmd.java b/src/engine/devcmd/cmds/SetSubRaceCmd.java
index 78227780..4ad42ffc 100644
--- a/src/engine/devcmd/cmds/SetSubRaceCmd.java
+++ b/src/engine/devcmd/cmds/SetSubRaceCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
@@ -20,190 +19,178 @@ import engine.objects.*;
public class SetSubRaceCmd extends AbstractDevCmd {
- public SetSubRaceCmd() {
+ public SetSubRaceCmd() {
super("setSubRace");
this.addCmdString("subrace");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
- if (target instanceof AbstractCharacter){
-
- if (words[0].equals("race")){
- if (target.getObjectType() != GameObjectType.PlayerCharacter)
- return;
- PlayerCharacter player = (PlayerCharacter)target;
- int raceID = Integer.parseInt(words[1]);
- player.setSubRaceID(raceID);
- if (raceID == 0)
- raceID = player.getRaceID();
- UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(player, 1,raceID);
- DispatchMessage.sendToAllInRange(player, ucm);
- return;
- }
- if (words[0].equals("all")){
- for (int i = 15999; i< 16337;i++){
- ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), i);
- DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }else{
- ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
- DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
- }
-
- return;
- }
-
- Building building = (Building)target;
-
- building.removeAllVisualEffects();
- building.addEffectBit(1<(), new ArrayList<>(), null, true);
- // pc.getClientConnection().sendMsg(updateInventoryMsg);
-
- //pc.getCharItemManager().updateInventory();
-
-
-
- // Mob mob = (Mob)target;
- //
- // if (mob == null)
- // return;
- //
- // MobLoot mobLoot = new MobLoot(mob, ItemBase.getItemBase(Integer.parseInt(words[0])), false);
- //
- // mob.getCharItemManager().addItemToInventory(mobLoot);
-
-
-
-
- // if (target.getObjectType() != GameObjectType.Building)
- // return;
- //
- // Building warehouseBuilding = (Building)target;
- //
- // if (Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID()) == null)
- // return;
- //
- // Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID());
- //
- // for (int ibID: Warehouse.getMaxResources().keySet()){
- // ItemBase ib = ItemBase.getItemBase(ibID);
- // warehouse.depositFromMine(null, ib, Warehouse.getMaxResources().get(ibID));
- // }
-
-
- // int raceID = Integer.parseInt(words[0]);
- //
- // UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(pc, raceID);
- //
- // pc.getClientConnection().sendMsg(ucm);
-
- // LoadCharacterMsg lcm = new LoadCharacterMsg((AbstractCharacter)null,false);
- // try {
- // DispatchMessage.sendToAllInRange(pc, lcm);
- // } catch (MsgSendException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- // ModifyHealthMsg mhm =new ModifyHealthMsg(pc, pc, -50f, 0f, 0f, 0, null, 9999, 0);
- // mhm.setOmitFromChat(1);
- // pc.getClientConnection().sendMsg(mhm);
- //
- // int temp = 0;
- // boolean start = false;
- //
- // for (EffectsBase eb: EffectsBase.getAllEffectsBase()){
- //
- //
- //
- // if (!pc.getClientConnection().isConnected()){
- // Logger.info("", "PLAYER DC!" + eb.getIDString());
- // break;
- // }
- //
- // eb = PowersManager.getEffectByIDString("WLR-018A");
- //
- //
- // NoTimeJob ntj = new NoTimeJob(pc, "NONE", eb, 40);
- // pc.addEffect(String.valueOf(eb.getUUID()), 1000, ntj, eb, 40);
- // eb.sendEffectNoPower(ntj, 1000, pc.getClientConnection());
- //
- // ThreadUtils.sleep(500);
- // pc.clearEffects();
- //
- // //WorldServer.updateObject((AbstractWorldObject)target, pc);
- // this.throwbackInfo(pc, eb.getIDString());
- // break;
- // //ThreadUtils.sleep(500);
- //
- // }
-
-
-
-
-
-
-
-
-
- // for (EffectsBase eb : EffectsBase.getAllEffectsBase()){
- // if (eb.getToken() == 0)
- // continue;
- // int token = eb.getToken();
- // ApplyEffectMsg pum = new ApplyEffectMsg();
- // pum.setEffectID(token);
- // pum.setSourceType(pc.getObjectType().ordinal());
- // pum.setSourceID(pc.getObjectUUID());
- // pum.setTargetType(pc.getObjectType().ordinal());
- // pum.setTargetID(pc.getObjectUUID());
- // pum.setNumTrains(40);
- // pum.setDuration(-1);
- //// pum.setDuration((pb.isChant()) ? (int)pb.getChantDuration() : ab.getDurationInSeconds(trains));
- // pum.setPowerUsedID(0);
- // // pum.setPowerUsedName("Inflict Poison");
- // this.throwbackInfo(pc, eb.getName() + "Token = " + eb.getToken());
- // pc.getClientConnection().sendMsg(pum);
- // ThreadUtils.sleep(200);
- // }
- //
-
- // UpdateObjectMsg uom = new UpdateObjectMsg(pc, 4);
- // try {
- // Location.sendToAllInRange(pc, uom);
- // } catch (MsgSendException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
-
-
-
-
- }
-
- @Override
- protected String _getHelpString() {
- return "Temporarily Changes SubRace";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /subrace mobBaseID";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+
+ if (target instanceof AbstractCharacter) {
+
+ if (words[0].equals("race")) {
+ if (target.getObjectType() != GameObjectType.PlayerCharacter)
+ return;
+ PlayerCharacter player = (PlayerCharacter) target;
+ int raceID = Integer.parseInt(words[1]);
+ player.setSubRaceID(raceID);
+ if (raceID == 0)
+ raceID = player.getRaceID();
+ UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(player, 1, raceID);
+ DispatchMessage.sendToAllInRange(player, ucm);
+ return;
+ }
+ if (words[0].equals("all")) {
+ for (int i = 15999; i < 16337; i++) {
+ ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), i);
+ DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ } else {
+ ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
+ DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
+ }
+
+ return;
+ }
+
+ Building building = (Building) target;
+
+ building.removeAllVisualEffects();
+ building.addEffectBit(1 << Integer.parseInt(words[0]));
+ building.updateEffects();
+ //63535 38751
+ // Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+ // //CityZoneMsg czm = new CityZoneMsg(3, zone.getLoc().x, zone.getLoc().y, zone.getLoc().z, "balls", zone, 0, 0);
+ // pc.getClientConnection().sendMsg(new DeleteItemMsg(zone.getObjectType().ordinal(), zone.getObjectUUID()));
+
+ // UpdateInventoryMsg updateInventoryMsg = new UpdateInventoryMsg(new ArrayList<>(), new ArrayList<>(), null, true);
+ // pc.getClientConnection().sendMsg(updateInventoryMsg);
+
+ //pc.getCharItemManager().updateInventory();
+
+
+ // Mob mob = (Mob)target;
+ //
+ // if (mob == null)
+ // return;
+ //
+ // MobLoot mobLoot = new MobLoot(mob, ItemBase.getItemBase(Integer.parseInt(words[0])), false);
+ //
+ // mob.getCharItemManager().addItemToInventory(mobLoot);
+
+
+ // if (target.getObjectType() != GameObjectType.Building)
+ // return;
+ //
+ // Building warehouseBuilding = (Building)target;
+ //
+ // if (Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID()) == null)
+ // return;
+ //
+ // Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(warehouseBuilding.getObjectUUID());
+ //
+ // for (int ibID: Warehouse.getMaxResources().keySet()){
+ // ItemBase ib = ItemBase.getItemBase(ibID);
+ // warehouse.depositFromMine(null, ib, Warehouse.getMaxResources().get(ibID));
+ // }
+
+
+ // int raceID = Integer.parseInt(words[0]);
+ //
+ // UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(pc, raceID);
+ //
+ // pc.getClientConnection().sendMsg(ucm);
+
+ // LoadCharacterMsg lcm = new LoadCharacterMsg((AbstractCharacter)null,false);
+ // try {
+ // DispatchMessage.sendToAllInRange(pc, lcm);
+ // } catch (MsgSendException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ // ModifyHealthMsg mhm =new ModifyHealthMsg(pc, pc, -50f, 0f, 0f, 0, null, 9999, 0);
+ // mhm.setOmitFromChat(1);
+ // pc.getClientConnection().sendMsg(mhm);
+ //
+ // int temp = 0;
+ // boolean start = false;
+ //
+ // for (EffectsBase eb: EffectsBase.getAllEffectsBase()){
+ //
+ //
+ //
+ // if (!pc.getClientConnection().isConnected()){
+ // Logger.info("", "PLAYER DC!" + eb.getIDString());
+ // break;
+ // }
+ //
+ // eb = PowersManager.getEffectByIDString("WLR-018A");
+ //
+ //
+ // NoTimeJob ntj = new NoTimeJob(pc, "NONE", eb, 40);
+ // pc.addEffect(String.valueOf(eb.getUUID()), 1000, ntj, eb, 40);
+ // eb.sendEffectNoPower(ntj, 1000, pc.getClientConnection());
+ //
+ // ThreadUtils.sleep(500);
+ // pc.clearEffects();
+ //
+ // //WorldServer.updateObject((AbstractWorldObject)target, pc);
+ // this.throwbackInfo(pc, eb.getIDString());
+ // break;
+ // //ThreadUtils.sleep(500);
+ //
+ // }
+
+
+ // for (EffectsBase eb : EffectsBase.getAllEffectsBase()){
+ // if (eb.getToken() == 0)
+ // continue;
+ // int token = eb.getToken();
+ // ApplyEffectMsg pum = new ApplyEffectMsg();
+ // pum.setEffectID(token);
+ // pum.setSourceType(pc.getObjectType().ordinal());
+ // pum.setSourceID(pc.getObjectUUID());
+ // pum.setTargetType(pc.getObjectType().ordinal());
+ // pum.setTargetID(pc.getObjectUUID());
+ // pum.setNumTrains(40);
+ // pum.setDuration(-1);
+ //// pum.setDuration((pb.isChant()) ? (int)pb.getChantDuration() : ab.getDurationInSeconds(trains));
+ // pum.setPowerUsedID(0);
+ // // pum.setPowerUsedName("Inflict Poison");
+ // this.throwbackInfo(pc, eb.getName() + "Token = " + eb.getToken());
+ // pc.getClientConnection().sendMsg(pum);
+ // ThreadUtils.sleep(200);
+ // }
+ //
+
+ // UpdateObjectMsg uom = new UpdateObjectMsg(pc, 4);
+ // try {
+ // Location.sendToAllInRange(pc, uom);
+ // } catch (MsgSendException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+
+
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Temporarily Changes SubRace";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /subrace mobBaseID";
+ }
}
diff --git a/src/engine/devcmd/cmds/ShowOffsetCmd.java b/src/engine/devcmd/cmds/ShowOffsetCmd.java
index 45fc2ae6..55b0a0fe 100644
--- a/src/engine/devcmd/cmds/ShowOffsetCmd.java
+++ b/src/engine/devcmd/cmds/ShowOffsetCmd.java
@@ -8,50 +8,49 @@ import engine.objects.Building;
import engine.objects.PlayerCharacter;
public class ShowOffsetCmd extends AbstractDevCmd {
-
- public ShowOffsetCmd() {
+
+ public ShowOffsetCmd() {
super("showoffset");
}
- // AbstractDevCmd Overridden methods
-
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] args,
- AbstractGameObject target) {
-
-
- Building targetBuilding;
- String outString;
- Vector3fImmutable offset;
-
- String newline = "\r\n ";
- targetBuilding = (Building)target;
-
- if (targetBuilding.getObjectType() != GameObjectType.Building) {
- throwbackInfo(pc, "showgate: target must be an Building");
- return;
- }
-
- offset = pc.getLoc().subtract(targetBuilding.getLoc());
-
- outString = "Location: " + pc.getLoc().x + "x " + pc.getLoc().z + 'y';
- outString += newline;
- outString += "Offset: " + offset.x + "x " + offset.y + 'y';
- throwbackInfo(pc, outString);
+ // AbstractDevCmd Overridden methods
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] args,
+ AbstractGameObject target) {
+
+
+ Building targetBuilding;
+ String outString;
+ Vector3fImmutable offset;
+
+ String newline = "\r\n ";
+ targetBuilding = (Building) target;
+
+ if (targetBuilding.getObjectType() != GameObjectType.Building) {
+ throwbackInfo(pc, "showgate: target must be an Building");
+ return;
}
- @Override
- protected String _getHelpString() {
+ offset = pc.getLoc().subtract(targetBuilding.getLoc());
+
+ outString = "Location: " + pc.getLoc().x + "x " + pc.getLoc().z + 'y';
+ outString += newline;
+ outString += "Offset: " + offset.x + "x " + offset.y + 'y';
+ throwbackInfo(pc, outString);
+ }
+
+ @Override
+ protected String _getHelpString() {
return "Shows offset to current building";
- }
+ }
- @Override
- protected String _getUsageString() {
+ @Override
+ protected String _getUsageString() {
return "Shows offset to current building";
- }
+ }
+
-
-
}
diff --git a/src/engine/devcmd/cmds/SlotTestCmd.java b/src/engine/devcmd/cmds/SlotTestCmd.java
index 6fbac8a9..3da13617 100644
--- a/src/engine/devcmd/cmds/SlotTestCmd.java
+++ b/src/engine/devcmd/cmds/SlotTestCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -21,75 +20,75 @@ import java.util.ArrayList;
public class SlotTestCmd extends AbstractDevCmd {
- public SlotTestCmd() {
+ public SlotTestCmd() {
super("slottest");
}
- @Override
- protected void _doCmd(PlayerCharacter playerCharacter, String[] args,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter playerCharacter, String[] args,
+ AbstractGameObject target) {
- ArrayList buildingLocations;
- String outString = "Available Slots\r\n";
+ ArrayList buildingLocations;
+ String outString = "Available Slots\r\n";
- if (target == null)
- return;
+ if (target == null)
+ return;
- if (target.getObjectType() != GameObjectType.Building)
- return;
+ if (target.getObjectType() != GameObjectType.Building)
+ return;
- Building building = (Building) target;
+ Building building = (Building) target;
- buildingLocations = BuildingManager._slotLocations.get(building.meshUUID);
+ buildingLocations = BuildingManager._slotLocations.get(building.meshUUID);
- if (buildingLocations == null) {
- outString = "No slot information for mesh: " + building.meshUUID;
- ChatManager.chatSystemInfo(playerCharacter, outString);
- return;
- }
+ if (buildingLocations == null) {
+ outString = "No slot information for mesh: " + building.meshUUID;
+ ChatManager.chatSystemInfo(playerCharacter, outString);
+ return;
+ }
- // Goto slot location
+ // Goto slot location
- if (args[0].isEmpty() == false) {
+ if (args[0].isEmpty() == false) {
- int slot = Integer.parseInt(args[0]);
- Vector3fImmutable slotLocation;
- BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot - 1);
- slotLocation = building.getLoc().add(buildingLocation.getLocation());
- slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY);
- playerCharacter.teleport(slotLocation);
- return;
- }
+ int slot = Integer.parseInt(args[0]);
+ Vector3fImmutable slotLocation;
+ BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot - 1);
+ slotLocation = building.getLoc().add(buildingLocation.getLocation());
+ slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY);
+ playerCharacter.teleport(slotLocation);
+ return;
+ }
- for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID))
- outString += buildingLocation.getSlot() + buildingLocation.getLocation().toString() + "\r\n";
+ for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID))
+ outString += buildingLocation.getSlot() + buildingLocation.getLocation().toString() + "\r\n";
- outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building);
+ outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building);
- if (building.getHirelings().isEmpty() == false) {
+ if (building.getHirelings().isEmpty() == false) {
- outString += "\r\n\r\n";
- outString += "Hirelings List:";
+ outString += "\r\n\r\n";
+ outString += "Hirelings List:";
- for (AbstractCharacter hireling : building.getHirelings().keySet())
- outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
+ for (AbstractCharacter hireling : building.getHirelings().keySet())
+ outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
- }
+ }
- ChatManager.chatSystemInfo(playerCharacter,outString);
+ ChatManager.chatSystemInfo(playerCharacter, outString);
- }
+ }
- @Override
- protected String _getHelpString() {
- return "Displays slot information for building";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Displays slot information for building";
+ }
- @Override
- protected String _getUsageString() {
- return "./slottest n";
+ @Override
+ protected String _getUsageString() {
+ return "./slottest n";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/SplatMobCmd.java b/src/engine/devcmd/cmds/SplatMobCmd.java
index 4f924c0f..cb429b99 100644
--- a/src/engine/devcmd/cmds/SplatMobCmd.java
+++ b/src/engine/devcmd/cmds/SplatMobCmd.java
@@ -12,155 +12,154 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
- * @author
- * Summary: Game designer utility command to create multiple
- * mobiles of a given UUID within a supplied range
+ * @author Summary: Game designer utility command to create multiple
+ * mobiles of a given UUID within a supplied range
*/
public class SplatMobCmd extends AbstractDevCmd {
- // Instance variables
+ // Instance variables
- private int _mobileUUID;
- private int _mobileCount;
- private float _targetRange;
- private Vector3fImmutable _currentLocation;
+ private int _mobileUUID;
+ private int _mobileCount;
+ private float _targetRange;
+ private Vector3fImmutable _currentLocation;
- // Concurrency support
+ // Concurrency support
- private ReadWriteLock lock = new ReentrantReadWriteLock();
+ private ReadWriteLock lock = new ReentrantReadWriteLock();
- // Constructor
+ // Constructor
- public SplatMobCmd() {
+ public SplatMobCmd() {
super("splatmob");
}
- // AbstractDevCmd Overridden methods
+ // AbstractDevCmd Overridden methods
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] args,
- AbstractGameObject target) {
+ private static boolean validateUserInput(String[] userInput) {
- // Member variables
+ // incorrect number of arguments test
- Vector3fImmutable mobileLocation;
- Mob mobile;
- Zone serverZone;
+ if (userInput.length != 3)
+ return false;
- // Concurrency write lock due to instance variable usage
+ // Test for UUID conversion to int
- lock.writeLock().lock();
+ try {
+ Integer.parseInt(userInput[0]);
+ } catch (NumberFormatException | NullPointerException e) {
+ return false;
+ }
- try {
- // Validate user input
+ // Test for Number of Mobs conversion to int
- if(validateUserInput(args) == false) {
- this.sendUsage(pc);
- return;
- }
+ try {
+ Integer.parseInt(userInput[1]);
+ } catch (NumberFormatException | NullPointerException e) {
+ return false;
+ }
- // Parse user input
+ // Test if range argument can convert to a float
- parseUserInput(args);
+ try {
+ Float.parseFloat(userInput[2]);
+ } catch (NumberFormatException | NullPointerException e) {
+ return false;
+ }
- // Arguments have been validated and parsed at this point
- // Begin creating mobiles
+ return true;
+ }
- _currentLocation = pc.getLoc();
- serverZone = ZoneManager.findSmallestZone(_currentLocation);
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] args,
+ AbstractGameObject target) {
- for(int i=0;i<_mobileCount;i++) {
+ // Member variables
- mobile = Mob.createMob(_mobileUUID,
- Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
- null, true, serverZone,null,0, "", 1);
+ Vector3fImmutable mobileLocation;
+ Mob mobile;
+ Zone serverZone;
- if (mobile != null) {
- mobile.updateDatabase();
- }
- }
+ // Concurrency write lock due to instance variable usage
- } // End Try Block
+ lock.writeLock().lock();
- // Release Reentrant lock
+ try {
- finally {
- lock.writeLock().unlock();
- }
- }
+ // Validate user input
- @Override
- protected String _getHelpString() {
- return "Spawns multiple mobiles with a given range";
- }
+ if (validateUserInput(args) == false) {
+ this.sendUsage(pc);
+ return;
+ }
- @Override
- protected String _getUsageString() {
- return "/splatmob UUID [Count <= 100] [range <= 1200]";
- }
+ // Parse user input
- // Class methods
+ parseUserInput(args);
- private static boolean validateUserInput(String[] userInput) {
+ // Arguments have been validated and parsed at this point
+ // Begin creating mobiles
- // incorrect number of arguments test
+ _currentLocation = pc.getLoc();
+ serverZone = ZoneManager.findSmallestZone(_currentLocation);
- if (userInput.length != 3)
- return false;
+ for (int i = 0; i < _mobileCount; i++) {
- // Test for UUID conversion to int
+ mobile = Mob.createMob(_mobileUUID,
+ Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
+ null, true, serverZone, null, 0, "", 1);
- try {
- Integer.parseInt(userInput[0]); }
- catch (NumberFormatException | NullPointerException e) {
- return false;
- }
+ if (mobile != null) {
+ mobile.updateDatabase();
+ }
+ }
+ } // End Try Block
- // Test for Number of Mobs conversion to int
+ // Release Reentrant lock
- try {
- Integer.parseInt(userInput[1]); }
- catch (NumberFormatException | NullPointerException e) {
- return false;
- }
+ finally {
+ lock.writeLock().unlock();
+ }
+ }
- // Test if range argument can convert to a float
+ @Override
+ protected String _getHelpString() {
+ return "Spawns multiple mobiles with a given range";
+ }
- try {
- Float.parseFloat(userInput[2]); }
- catch (NumberFormatException | NullPointerException e) {
- return false;
- }
+ // Class methods
- return true;
- }
+ @Override
+ protected String _getUsageString() {
+ return "/splatmob UUID [Count <= 100] [range <= 1200]";
+ }
- private void parseUserInput(String[] userInput) {
+ private void parseUserInput(String[] userInput) {
- // Clear previous values
+ // Clear previous values
- _mobileUUID = 0;
- _mobileCount = 0;
- _targetRange = 0f;
+ _mobileUUID = 0;
+ _mobileCount = 0;
+ _targetRange = 0f;
- // Parse first argument into mobile UID.
+ // Parse first argument into mobile UID.
- _mobileUUID = Integer.parseInt(userInput[0]);
+ _mobileUUID = Integer.parseInt(userInput[0]);
- // Parse second argument into mobile count. Cap at 100 mobs.
+ // Parse second argument into mobile count. Cap at 100 mobs.
- _mobileCount = Integer.parseInt(userInput[1]);
- _mobileCount = Math.min(_mobileCount, 100);
+ _mobileCount = Integer.parseInt(userInput[1]);
+ _mobileCount = Math.min(_mobileCount, 100);
- // Parse third argument into range. Cap at 200 units.
+ // Parse third argument into range. Cap at 200 units.
- _targetRange = Float.parseFloat(userInput[2]);
- _targetRange = Math.min(_targetRange, 1200f);
+ _targetRange = Float.parseFloat(userInput[2]);
+ _targetRange = Math.min(_targetRange, 1200f);
- }
+ }
}
\ No newline at end of file
diff --git a/src/engine/devcmd/cmds/SqlDebugCmd.java b/src/engine/devcmd/cmds/SqlDebugCmd.java
index 18087692..5e9b9a28 100644
--- a/src/engine/devcmd/cmds/SqlDebugCmd.java
+++ b/src/engine/devcmd/cmds/SqlDebugCmd.java
@@ -6,81 +6,79 @@ import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;
/**
- * @author
- * Summary: Devcmd to toggle logging of mysql statements
- *
+ * @author Summary: Devcmd to toggle logging of mysql statements
*/
-
+
public class SqlDebugCmd extends AbstractDevCmd {
// Instance variables
-
-
- public SqlDebugCmd() {
+
+
+ public SqlDebugCmd() {
super("sqldebug");
}
-
- // AbstractDevCmd Overridden methods
-
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] args,
- AbstractGameObject target) {
-
- Boolean debugState = false;
-
- if(validateUserInput(args) == false) {
- this.sendUsage(pc);
- return;
- }
-
- // Arguments have been validated use argument to set debug state
-
- switch (args[0]) {
- case "on":
- debugState = true;
- break;
- case "off":
- debugState = false;
- break;
- default:
- break;
- }
-
- MBServerStatics.DB_ENABLE_QUERY_OUTPUT = debugState;
-
- // Send results to user
- throwbackInfo(pc, "SQL debug state: " + debugState.toString());
- }
-
- @Override
- protected String _getHelpString() {
- return "Toggles sending SQL statements to log";
- }
- @Override
- protected String _getUsageString() {
- return "/sqldebug on|off";
- }
+ // AbstractDevCmd Overridden methods
- // Class methods
-
- private static boolean validateUserInput(String[] userInput) {
+ private static boolean validateUserInput(String[] userInput) {
int stringIndex;
String commandSet = "onoff";
-
+
// incorrect number of arguments test
-
+
if (userInput.length != 1)
- return false;
+ return false;
// Validate arguments
-
+
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
- return stringIndex != -1;
+ return stringIndex != -1;
+ }
+
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] args,
+ AbstractGameObject target) {
+
+ Boolean debugState = false;
+
+ if (validateUserInput(args) == false) {
+ this.sendUsage(pc);
+ return;
}
-
-
+
+ // Arguments have been validated use argument to set debug state
+
+ switch (args[0]) {
+ case "on":
+ debugState = true;
+ break;
+ case "off":
+ debugState = false;
+ break;
+ default:
+ break;
+ }
+
+ MBServerStatics.DB_ENABLE_QUERY_OUTPUT = debugState;
+
+ // Send results to user
+ throwbackInfo(pc, "SQL debug state: " + debugState.toString());
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Toggles sending SQL statements to log";
+ }
+
+ // Class methods
+
+ @Override
+ protected String _getUsageString() {
+ return "/sqldebug on|off";
+ }
+
+
}
diff --git a/src/engine/devcmd/cmds/SummonCmd.java b/src/engine/devcmd/cmds/SummonCmd.java
index c0a1c7d1..184903ca 100644
--- a/src/engine/devcmd/cmds/SummonCmd.java
+++ b/src/engine/devcmd/cmds/SummonCmd.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
@@ -21,94 +20,94 @@ import engine.objects.Zone;
public class SummonCmd extends AbstractDevCmd {
- public SummonCmd() {
+ public SummonCmd() {
super("summon");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] args,
- AbstractGameObject target) {
- // Arg Count Check
- if (args.length != 1) {
- this.sendUsage(pc);
- return;
- }
- PlayerCharacter pcToSummon = null;
-
-
- if (args[0].equalsIgnoreCase("all")){
- for (PlayerCharacter toSummon: SessionManager.getAllActivePlayerCharacters()){
- Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
- String location = "Somewhere";
- if (zone != null)
- location = zone.getName();
- RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
- location, false);
- toSummon.getClientConnection().sendMsg(rsrm);
-
- }
- return;
- }
- // 1-9 numeric digits, must be playerID
- if (args[0].matches("\\d{1,9}?")) {
- try {
- int playerID = Integer.parseInt(args[0]);
- pcToSummon = SessionManager
- .getPlayerCharacterByID(playerID);
-
- if (pcToSummon == null) {
- this.throwbackError(pc, "Character not found by ID: "
- + playerID);
- return;
- }
- } catch (NumberFormatException e) {
- this.throwbackError(pc, "Supplied ID: '" + args[0]
- + "' failed to parse to an INT");
- return;
-
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to summon '"
- + args[0] + "'by ID");
- return;
- }
-
- } else { // player name
- try {
- pcToSummon = SessionManager
- .getPlayerCharacterByLowerCaseName(args[0]);
- if (pcToSummon == null) {
- this.throwbackError(pc, "Character not found by name: "
- + args[0]);
- return;
- }
- } catch (Exception e) {
- this.throwbackError(pc,
- "An unknown exception occurred while attempting to summon '"
- + args[0] + "'by name");
- return;
- }
- }
- this.setTarget(pcToSummon); //for logging
-
- Vector3fImmutable loc = pc.getLoc();
- pcToSummon.teleport(loc);
-
- this.throwbackInfo(pc, "Player " + pcToSummon.getCombinedName()
- + " has been summoned to your location.");
- this.throwbackInfo(pcToSummon,
- "You have been transported to another location.");
- }
-
- @Override
- protected String _getHelpString() {
- return "Summons 'character' TO your current position. Can summon by character's first name or by the character's characterID.";
-
- }
-
- @Override
- protected String _getUsageString() {
- return "' /summon characterName' || ' /summon characterID'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] args,
+ AbstractGameObject target) {
+ // Arg Count Check
+ if (args.length != 1) {
+ this.sendUsage(pc);
+ return;
+ }
+ PlayerCharacter pcToSummon = null;
+
+
+ if (args[0].equalsIgnoreCase("all")) {
+ for (PlayerCharacter toSummon : SessionManager.getAllActivePlayerCharacters()) {
+ Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
+ String location = "Somewhere";
+ if (zone != null)
+ location = zone.getName();
+ RecvSummonsRequestMsg rsrm = new RecvSummonsRequestMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), pc.getFirstName(),
+ location, false);
+ toSummon.getClientConnection().sendMsg(rsrm);
+
+ }
+ return;
+ }
+ // 1-9 numeric digits, must be playerID
+ if (args[0].matches("\\d{1,9}?")) {
+ try {
+ int playerID = Integer.parseInt(args[0]);
+ pcToSummon = SessionManager
+ .getPlayerCharacterByID(playerID);
+
+ if (pcToSummon == null) {
+ this.throwbackError(pc, "Character not found by ID: "
+ + playerID);
+ return;
+ }
+ } catch (NumberFormatException e) {
+ this.throwbackError(pc, "Supplied ID: '" + args[0]
+ + "' failed to parse to an INT");
+ return;
+
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to summon '"
+ + args[0] + "'by ID");
+ return;
+ }
+
+ } else { // player name
+ try {
+ pcToSummon = SessionManager
+ .getPlayerCharacterByLowerCaseName(args[0]);
+ if (pcToSummon == null) {
+ this.throwbackError(pc, "Character not found by name: "
+ + args[0]);
+ return;
+ }
+ } catch (Exception e) {
+ this.throwbackError(pc,
+ "An unknown exception occurred while attempting to summon '"
+ + args[0] + "'by name");
+ return;
+ }
+ }
+ this.setTarget(pcToSummon); //for logging
+
+ Vector3fImmutable loc = pc.getLoc();
+ pcToSummon.teleport(loc);
+
+ this.throwbackInfo(pc, "Player " + pcToSummon.getCombinedName()
+ + " has been summoned to your location.");
+ this.throwbackInfo(pcToSummon,
+ "You have been transported to another location.");
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Summons 'character' TO your current position. Can summon by character's first name or by the character's characterID.";
+
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /summon characterName' || ' /summon characterID'";
+ }
}
diff --git a/src/engine/devcmd/cmds/SysMsgCmd.java b/src/engine/devcmd/cmds/SysMsgCmd.java
index 4004655e..3b619b86 100644
--- a/src/engine/devcmd/cmds/SysMsgCmd.java
+++ b/src/engine/devcmd/cmds/SysMsgCmd.java
@@ -15,53 +15,53 @@ import engine.objects.AbstractGameObject;
import engine.objects.PlayerCharacter;
/**
- *
+ *
*/
public class SysMsgCmd extends AbstractDevCmd {
- public SysMsgCmd() {
+ public SysMsgCmd() {
super("sysmsg");
}
- @Override
- protected void _doCmd(PlayerCharacter pcSender, String[] args,
- AbstractGameObject target) {
- if (args.length != 1 || args[0].isEmpty()) {
- this.sendUsage(pcSender);
- return;
- }
- String text = "[System Admin Message]: " + args[0];
- ChatManager.chatSystemChannel(text);
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pcSender, String[] args,
+ AbstractGameObject target) {
+ if (args.length != 1 || args[0].isEmpty()) {
+ this.sendUsage(pcSender);
+ return;
+ }
+ String text = "[System Admin Message]: " + args[0];
+ ChatManager.chatSystemChannel(text);
+ }
- /**
- * This function is called by the DevCmdManager. Override to avoid splitting
- * argString into String array, since sysmsg displays full String as
- * message, then calls the subclass specific _doCmd method.
- */
+ /**
+ * This function is called by the DevCmdManager. Override to avoid splitting
+ * argString into String array, since sysmsg displays full String as
+ * message, then calls the subclass specific _doCmd method.
+ */
- @Override
- public void doCmd(PlayerCharacter pcSender, String argString,
- AbstractGameObject target) {
- String[] args = new String[1];
- args[0] = argString;
+ @Override
+ public void doCmd(PlayerCharacter pcSender, String argString,
+ AbstractGameObject target) {
+ String[] args = new String[1];
+ args[0] = argString;
- if (pcSender == null) {
- return;
- }
+ if (pcSender == null) {
+ return;
+ }
- this._doCmd(pcSender, args, target);
- }
+ this._doCmd(pcSender, args, target);
+ }
- @Override
- protected String _getUsageString() {
- return "' /sysmsg message'";
- }
+ @Override
+ protected String _getUsageString() {
+ return "' /sysmsg message'";
+ }
- @Override
- protected String _getHelpString() {
- return "Send system message in chat window to all players";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Send system message in chat window to all players";
+ }
}
diff --git a/src/engine/devcmd/cmds/TeleportModeCmd.java b/src/engine/devcmd/cmds/TeleportModeCmd.java
index 630f3824..89bac199 100644
--- a/src/engine/devcmd/cmds/TeleportModeCmd.java
+++ b/src/engine/devcmd/cmds/TeleportModeCmd.java
@@ -15,42 +15,42 @@ import engine.objects.PlayerCharacter;
public class TeleportModeCmd extends AbstractDevCmd {
- public TeleportModeCmd() {
+ public TeleportModeCmd() {
super("teleportMode");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
- boolean newTeleportMode = false;
- if (words.length == 0) { // toggle
- newTeleportMode = !pc.isTeleportMode();
-
- } else if (words[0].equalsIgnoreCase("on")) {
- newTeleportMode = true;
-
- } else if (words[0].equalsIgnoreCase("off")) {
- newTeleportMode = false;
-
- } else {
- this.sendUsage(pc);
- return;
- }
- pc.setTeleportMode(newTeleportMode);
- this.setTarget(pc); //for logging
- String output = (newTeleportMode ? "on" : "off");
-
- throwbackInfo(pc, "Teleport mode is now '" + output + "'.");
- }
-
- @Override
- protected String _getHelpString() {
- return "'on' enables teleport mode, 'off' disables. No arguments to the /teleportMode command will toggle the setting.";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /teleportMode [on | off]'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
+ boolean newTeleportMode = false;
+ if (words.length == 0) { // toggle
+ newTeleportMode = !pc.isTeleportMode();
+
+ } else if (words[0].equalsIgnoreCase("on")) {
+ newTeleportMode = true;
+
+ } else if (words[0].equalsIgnoreCase("off")) {
+ newTeleportMode = false;
+
+ } else {
+ this.sendUsage(pc);
+ return;
+ }
+ pc.setTeleportMode(newTeleportMode);
+ this.setTarget(pc); //for logging
+ String output = (newTeleportMode ? "on" : "off");
+
+ throwbackInfo(pc, "Teleport mode is now '" + output + "'.");
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "'on' enables teleport mode, 'off' disables. No arguments to the /teleportMode command will toggle the setting.";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /teleportMode [on | off]'";
+ }
}
diff --git a/src/engine/devcmd/cmds/UnloadFurnitureCmd.java b/src/engine/devcmd/cmds/UnloadFurnitureCmd.java
index 4197a800..e926ccbc 100644
--- a/src/engine/devcmd/cmds/UnloadFurnitureCmd.java
+++ b/src/engine/devcmd/cmds/UnloadFurnitureCmd.java
@@ -21,82 +21,81 @@ import engine.objects.PlayerCharacter;
/**
* @author
- *
*/
public class UnloadFurnitureCmd extends AbstractDevCmd {
- public UnloadFurnitureCmd() {
+ public UnloadFurnitureCmd() {
super("furniture");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- if (target.getObjectType() != GameObjectType.Building){
- this.throwbackError(pc, "Must be targeting a building to load/unload furniture.");
- return;
- }
- if (words[0].equalsIgnoreCase("unload")){
+ if (target.getObjectType() != GameObjectType.Building) {
+ this.throwbackError(pc, "Must be targeting a building to load/unload furniture.");
+ return;
+ }
+ if (words[0].equalsIgnoreCase("unload")) {
- UnloadObjectsMsg uom = new UnloadObjectsMsg();
- for (AbstractWorldObject awo: pc.getLoadedStaticObjects()){
- if (awo.getObjectType() != GameObjectType.Building)
- continue;
+ UnloadObjectsMsg uom = new UnloadObjectsMsg();
+ for (AbstractWorldObject awo : pc.getLoadedStaticObjects()) {
+ if (awo.getObjectType() != GameObjectType.Building)
+ continue;
- Building awoBuilding = (Building)awo;
+ Building awoBuilding = (Building) awo;
if (!awoBuilding.isFurniture)
- continue;
+ continue;
- if (awoBuilding.parentBuildingID != target.getObjectUUID())
- continue;
-
- MoveToPointMsg msg = new MoveToPointMsg(awoBuilding);
- pc.getClientConnection().sendMsg(msg);
+ if (awoBuilding.parentBuildingID != target.getObjectUUID())
+ continue;
- uom.addObject(awoBuilding);
+ MoveToPointMsg msg = new MoveToPointMsg(awoBuilding);
+ pc.getClientConnection().sendMsg(msg);
+ uom.addObject(awoBuilding);
- }
- pc.getClientConnection().sendMsg(uom);
+ }
- }else if (words[0].equalsIgnoreCase("load")){
- LoadStructureMsg lsm = new LoadStructureMsg();
+ pc.getClientConnection().sendMsg(uom);
- for (AbstractWorldObject awo: pc.getLoadedStaticObjects()){
- if (awo.getObjectType() != GameObjectType.Building)
- continue;
+ } else if (words[0].equalsIgnoreCase("load")) {
+ LoadStructureMsg lsm = new LoadStructureMsg();
- Building awoBuilding = (Building)awo;
+ for (AbstractWorldObject awo : pc.getLoadedStaticObjects()) {
+ if (awo.getObjectType() != GameObjectType.Building)
+ continue;
+
+ Building awoBuilding = (Building) awo;
if (!awoBuilding.isFurniture)
- continue;
+ continue;
- if (awoBuilding.parentBuildingID != target.getObjectUUID())
- continue;
+ if (awoBuilding.parentBuildingID != target.getObjectUUID())
+ continue;
- lsm.addObject(awoBuilding);
+ lsm.addObject(awoBuilding);
- }
+ }
- pc.getClientConnection().sendMsg(lsm);
+ pc.getClientConnection().sendMsg(lsm);
- }
- }
+ }
+ }
- @Override
- protected String _getHelpString() {
- String help = "Enchants an item with a prefix and suffix";
- return help;
- }
+ @Override
+ protected String _getHelpString() {
+ String help = "Enchants an item with a prefix and suffix";
+ return help;
+ }
- @Override
- protected String _getUsageString() {
- String usage = "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
- return usage;
- }
+ @Override
+ protected String _getUsageString() {
+ String usage = "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
+ return usage;
+ }
}
diff --git a/src/engine/devcmd/cmds/ZoneInfoCmd.java b/src/engine/devcmd/cmds/ZoneInfoCmd.java
index 0cc7c2f2..09f03b83 100644
--- a/src/engine/devcmd/cmds/ZoneInfoCmd.java
+++ b/src/engine/devcmd/cmds/ZoneInfoCmd.java
@@ -22,129 +22,128 @@ import java.util.ArrayList;
/**
* @author
- *
*/
public class ZoneInfoCmd extends AbstractDevCmd {
- public ZoneInfoCmd() {
+ public ZoneInfoCmd() {
super("zoneinfo");
}
- @Override
- protected void _doCmd(PlayerCharacter player, String[] words,
- AbstractGameObject target) {
- // Arg Count Check
- Zone zone = null;
-
- if (player == null) {
- throwbackError(player, "Unable to find the pc making the request.");
- return;
- }
-
- try {
- int targetID = Integer.parseInt(words[0]);
-
- //try get zone by objectUUID
- zone = ZoneManager.getZoneByUUID(targetID);
-
- //that failed, try get by zoneID
- if (zone == null)
- zone = ZoneManager.getZoneByZoneID(targetID);
-
- //no zone found, so fail
- if (zone == null) {
- throwbackError(player, "Zone with ID " + targetID + "not found");
- return;
- }
- } catch (Exception e) {
- zone = ZoneManager.findSmallestZone(player.getLoc());
- }
-
- if (zone == null) {
- throwbackError(player, "Zone not found");
- return;
- }
-
- String newline = "\r\n ";
-
-
- int objectUUID = zone.getObjectUUID();
- String output;
-
- output = "Target Information:" + newline;
- output += StringUtils.addWS("UUID: " + objectUUID, 20);
- output += newline;
- output += "name: " + zone.getName();
- output += newline;
- output += "loadNum: " + zone.getLoadNum();
- if (zone.getParent() != null) {
- output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
- output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
-
- } else
- output += StringUtils.addWS(", parent: none", 30);
- output += newline;
- output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
- output += newline;
- output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
- output += newline;
- output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
- output += newline;
-
- if (zone.getHeightMap() != null){
- output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
- output += newline;
- output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
- output += newline;
- output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
-
- }
- output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
- output += newline;
- // output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
- output += newline;
- output += "Sea Level = " +zone.getSeaLevel();
- output += newline;
- output += "World Altitude = " + zone.getWorldAltitude();
- throwbackInfo(player, output);
-
- City city = ZoneManager.getCityAtLocation(player.getLoc());
-
- output += newline;
- output += (city == null)? "None" : city.getParent().getName();
-
- if (city != null ) {
-
- if (city.isLocationOnCityGrid(player.getLoc()))
- output += " (Grid)";
- else if (city.isLocationOnCityZone(player.getLoc()))
- output += " (Zone)";
- else if (city.isLocationWithinSiegeBounds(player.getLoc()))
- output += " (Siege)";
- } else {
- output = "children:";
-
- ArrayList nodes = zone.getNodes();
-
- if (nodes.isEmpty())
- output += " none";
-
- for (Zone child : nodes) {
- output += newline;
- output += child.getName() + " (" + child.getLoadNum() + ')';
- }
- }
- throwbackInfo(player, output);
- }
-
- @Override
- protected String _getHelpString() {
- return "Gets information on an Object.";
- }
-
- @Override
- protected String _getUsageString() {
- return "' /info targetID'";
- }
+ @Override
+ protected void _doCmd(PlayerCharacter player, String[] words,
+ AbstractGameObject target) {
+ // Arg Count Check
+ Zone zone = null;
+
+ if (player == null) {
+ throwbackError(player, "Unable to find the pc making the request.");
+ return;
+ }
+
+ try {
+ int targetID = Integer.parseInt(words[0]);
+
+ //try get zone by objectUUID
+ zone = ZoneManager.getZoneByUUID(targetID);
+
+ //that failed, try get by zoneID
+ if (zone == null)
+ zone = ZoneManager.getZoneByZoneID(targetID);
+
+ //no zone found, so fail
+ if (zone == null) {
+ throwbackError(player, "Zone with ID " + targetID + "not found");
+ return;
+ }
+ } catch (Exception e) {
+ zone = ZoneManager.findSmallestZone(player.getLoc());
+ }
+
+ if (zone == null) {
+ throwbackError(player, "Zone not found");
+ return;
+ }
+
+ String newline = "\r\n ";
+
+
+ int objectUUID = zone.getObjectUUID();
+ String output;
+
+ output = "Target Information:" + newline;
+ output += StringUtils.addWS("UUID: " + objectUUID, 20);
+ output += newline;
+ output += "name: " + zone.getName();
+ output += newline;
+ output += "loadNum: " + zone.getLoadNum();
+ if (zone.getParent() != null) {
+ output += StringUtils.addWS(", parent: " + zone.getParent().getObjectUUID(), 30);
+ output += "Parentabs: x: " + zone.getParent().getAbsX() + ", y: " + zone.getParent().getAbsY() + ", z: " + zone.getParent().getAbsZ();
+
+ } else
+ output += StringUtils.addWS(", parent: none", 30);
+ output += newline;
+ output += "absLoc: x: " + zone.getAbsX() + ", y: " + zone.getAbsY() + ", z: " + zone.getAbsZ();
+ output += newline;
+ output += "offset: x: " + zone.getXCoord() + ", y: " + zone.getYCoord() + ", z: " + zone.getZCoord();
+ output += newline;
+ output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
+ output += newline;
+
+ if (zone.getHeightMap() != null) {
+ output += "HeightMap ID: " + zone.getHeightMap().getHeightMapID();
+ output += newline;
+ output += "Bucket Width X : " + zone.getHeightMap().getBucketWidthX();
+ output += newline;
+ output += "Bucket Width Y : " + zone.getHeightMap().getBucketWidthY();
+
+ }
+ output += "radius: x: " + zone.getBounds().getHalfExtents().x + ", z: " + zone.getBounds().getHalfExtents().y;
+ output += newline;
+ // output += "minLvl = " + zone.getMinLvl() + " | maxLvl = " + zone.getMaxLvl();
+ output += newline;
+ output += "Sea Level = " + zone.getSeaLevel();
+ output += newline;
+ output += "World Altitude = " + zone.getWorldAltitude();
+ throwbackInfo(player, output);
+
+ City city = ZoneManager.getCityAtLocation(player.getLoc());
+
+ output += newline;
+ output += (city == null) ? "None" : city.getParent().getName();
+
+ if (city != null) {
+
+ if (city.isLocationOnCityGrid(player.getLoc()))
+ output += " (Grid)";
+ else if (city.isLocationOnCityZone(player.getLoc()))
+ output += " (Zone)";
+ else if (city.isLocationWithinSiegeBounds(player.getLoc()))
+ output += " (Siege)";
+ } else {
+ output = "children:";
+
+ ArrayList nodes = zone.getNodes();
+
+ if (nodes.isEmpty())
+ output += " none";
+
+ for (Zone child : nodes) {
+ output += newline;
+ output += child.getName() + " (" + child.getLoadNum() + ')';
+ }
+ }
+ throwbackInfo(player, output);
+ }
+
+ @Override
+ protected String _getHelpString() {
+ return "Gets information on an Object.";
+ }
+
+ @Override
+ protected String _getUsageString() {
+ return "' /info targetID'";
+ }
}
diff --git a/src/engine/devcmd/cmds/aiInfoCmd.java b/src/engine/devcmd/cmds/aiInfoCmd.java
index 5987e0b1..3f1c3869 100644
--- a/src/engine/devcmd/cmds/aiInfoCmd.java
+++ b/src/engine/devcmd/cmds/aiInfoCmd.java
@@ -9,25 +9,19 @@
package engine.devcmd.cmds;
-import engine.Enum.BuildingGroup;
import engine.Enum.GameObjectType;
-import engine.Enum.TargetColor;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager;
-import engine.gameManager.SessionManager;
-import engine.math.Vector3fImmutable;
-import engine.objects.*;
-import engine.util.StringUtils;
+import engine.objects.AbstractGameObject;
+import engine.objects.Building;
+import engine.objects.Mob;
+import engine.objects.PlayerCharacter;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
/**
* @author
- *
*/
public class aiInfoCmd extends AbstractDevCmd {
@@ -73,17 +67,17 @@ public class aiInfoCmd extends AbstractDevCmd {
int objectUUID = target.getObjectUUID();
String output;
- if(objType != GameObjectType.Mob){
+ if (objType != GameObjectType.Mob) {
output = "Please Select A Mob For AI Info" + newline;
} else {
Mob mob = (Mob) target;
output = "Mob AI Information:" + newline;
output += mob.getName() + newline;
- if(mob.BehaviourType != null) {
+ if (mob.BehaviourType != null) {
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
- if(mob.BehaviourType.BehaviourHelperType != null) {
+ if (mob.BehaviourType.BehaviourHelperType != null) {
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
- } else{
+ } else {
output += "Behaviour Helper Type: NULL" + newline;
}
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
@@ -91,18 +85,18 @@ public class aiInfoCmd extends AbstractDevCmd {
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
- } else{
+ } else {
output += "BehaviourType: NULL" + newline;
}
output += "Aggro Range: " + mob.getAggroRange() + newline;
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
- if(mob.playerAgroMap.size() > 0){
+ if (mob.playerAgroMap.size() > 0) {
output += "Players Loaded:" + newline;
}
- for(Map.Entry entry : mob.playerAgroMap.entrySet()){
+ for (Map.Entry entry : mob.playerAgroMap.entrySet()) {
output += "Player ID: " + entry.getKey() + " Is Safemode: " + entry.getValue() + newline;
}
- if(mob.getCombatTarget() != null)
+ if (mob.getCombatTarget() != null)
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
else
output += "Current Target: NULL" + newline;
diff --git a/src/engine/devcmd/cmds/convertLoc.java b/src/engine/devcmd/cmds/convertLoc.java
index 8190c6ee..e794e3fd 100644
--- a/src/engine/devcmd/cmds/convertLoc.java
+++ b/src/engine/devcmd/cmds/convertLoc.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
@@ -21,42 +20,40 @@ import engine.objects.PlayerCharacter;
public class convertLoc extends AbstractDevCmd {
- public convertLoc() {
+ public convertLoc() {
super("convertLoc");
}
- @Override
- protected void _doCmd(PlayerCharacter pc, String[] words,
- AbstractGameObject target) {
-
-
- if (target == null){
- Vector3fImmutable convertLoc = ZoneManager.findSmallestZone(pc.getLoc()).getLoc().subtract(pc.getLoc());
- ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertLoc));
- return;
- }
+ @Override
+ protected void _doCmd(PlayerCharacter pc, String[] words,
+ AbstractGameObject target) {
- if (target.getObjectType() != GameObjectType.Building)
- return;
- Building toConvert = (Building)target;
- Vector3fImmutable convertedLoc = ZoneManager.convertWorldToLocal(toConvert, pc.getLoc());
- ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertedLoc));
+ if (target == null) {
+ Vector3fImmutable convertLoc = ZoneManager.findSmallestZone(pc.getLoc()).getLoc().subtract(pc.getLoc());
+ ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertLoc));
+ return;
+ }
+ if (target.getObjectType() != GameObjectType.Building)
+ return;
+ Building toConvert = (Building) target;
+ Vector3fImmutable convertedLoc = ZoneManager.convertWorldToLocal(toConvert, pc.getLoc());
+ ChatManager.chatSystemInfo(pc, Vector3fImmutable.toString(convertedLoc));
- }
+ }
- @Override
- protected String _getHelpString() {
- return "Temporarily Changes SubRace";
- }
+ @Override
+ protected String _getHelpString() {
+ return "Temporarily Changes SubRace";
+ }
- @Override
- protected String _getUsageString() {
- return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
+ @Override
+ protected String _getUsageString() {
+ return "' /setBuildingCollidables add/remove 'add creates a collision line.' needs 4 integers. startX, endX, startY, endY";
- }
+ }
}
diff --git a/src/engine/devcmd/cmds/simulateBootyCmd.java b/src/engine/devcmd/cmds/simulateBootyCmd.java
index e1688e63..c6eed230 100644
--- a/src/engine/devcmd/cmds/simulateBootyCmd.java
+++ b/src/engine/devcmd/cmds/simulateBootyCmd.java
@@ -2,11 +2,13 @@ package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd;
-import engine.gameManager.*;
+import engine.gameManager.BuildingManager;
+import engine.gameManager.NPCManager;
import engine.objects.*;
+
import java.util.ArrayList;
-public class simulateBootyCmd extends AbstractDevCmd {
+public class simulateBootyCmd extends AbstractDevCmd {
public simulateBootyCmd() {
super("simulatebooty");
}
@@ -70,7 +72,7 @@ public class simulateBootyCmd extends AbstractDevCmd {
int maxRollRange = (mob.getLevel() * 2) + 120 + (mob.getParentZone().maxLvl * 2);
output += "Roll Range: " + minRollRange + " - " + maxRollRange + newline;
output += "Special Loot:" + newline;
- if(mob.bootySet != 0) {
+ if (mob.bootySet != 0) {
for (BootySetEntry entry : NPCManager._bootySetMap.get(mob.bootySet)) {
ItemBase item = ItemBase.getItemBase(entry.itemBase);
if (item != null) {
@@ -108,14 +110,14 @@ public class simulateBootyCmd extends AbstractDevCmd {
GlassItems.add(lootItem);
} else {
OtherDrops.add(lootItem);
- if(lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") ||lootItem.getName().toLowerCase().contains("bell")){
+ if (lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") || lootItem.getName().toLowerCase().contains("bell")) {
output += lootItem.getName() + newline;
}
}
break;
default:
OtherDrops.add(lootItem);
- if(lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") ||lootItem.getName().toLowerCase().contains("bell")){
+ if (lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") || lootItem.getName().toLowerCase().contains("bell")) {
output += lootItem.getName() + newline;
}
break;
@@ -126,20 +128,20 @@ public class simulateBootyCmd extends AbstractDevCmd {
}
}
int respawnTime = mob.getMobBase().getSpawnTime();
- if(mob.spawnTime > 0){
+ if (mob.spawnTime > 0) {
respawnTime = mob.spawnTime;
}
output += "MobBase BootySet: " + mob.getMobBase().bootySet + newline;
output += "Mob BootySet: " + mob.bootySet + newline;
output += "Tables Rolled On: " + newline;
- for(BootySetEntry entry : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)){
+ for (BootySetEntry entry : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)) {
output += "[" + entry.bootyType + "] " + entry.lootTable + newline;
}
output += "Time Required To Gain Simulated Booty: " + respawnTime * 100 + " Seconds" + newline;
output += "GLASS DROPS: " + GlassItems.size() + newline;
- output += "RUNE DROPS: " + Runes.size()+ newline;
- output += "CONTRACTS DROPS: " + Contracts.size()+ newline;
- output += "RESOURCE DROPS: " + Resources.size()+ newline;
+ output += "RUNE DROPS: " + Runes.size() + newline;
+ output += "CONTRACTS DROPS: " + Contracts.size() + newline;
+ output += "RESOURCE DROPS: " + Resources.size() + newline;
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
output += "OTHER ITEMS DROPPED: " + OtherDrops.size() + newline;
output += "FAILED ROLLS: " + failures + newline;
diff --git a/src/engine/exception/FactoryBuildException.java b/src/engine/exception/FactoryBuildException.java
index e0293036..319bf2ba 100644
--- a/src/engine/exception/FactoryBuildException.java
+++ b/src/engine/exception/FactoryBuildException.java
@@ -11,22 +11,22 @@ package engine.exception;
public class FactoryBuildException extends MBServerException {
- private static final long serialVersionUID = 2331961867931593523L;
+ private static final long serialVersionUID = 2331961867931593523L;
- public FactoryBuildException() {
- super();
- }
+ public FactoryBuildException() {
+ super();
+ }
- public FactoryBuildException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
+ public FactoryBuildException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
- public FactoryBuildException(String arg0) {
- super(arg0);
- }
+ public FactoryBuildException(String arg0) {
+ super(arg0);
+ }
- public FactoryBuildException(Throwable arg0) {
- super(arg0);
- }
+ public FactoryBuildException(Throwable arg0) {
+ super(arg0);
+ }
}
diff --git a/src/engine/exception/MBServerException.java b/src/engine/exception/MBServerException.java
index 3ede5360..3bd77543 100644
--- a/src/engine/exception/MBServerException.java
+++ b/src/engine/exception/MBServerException.java
@@ -13,26 +13,26 @@ import org.pmw.tinylog.Logger;
public abstract class MBServerException extends Exception {
- private static final long serialVersionUID = 3878845236025977250L;
+ private static final long serialVersionUID = 3878845236025977250L;
- public MBServerException() {
- super();
- }
+ public MBServerException() {
+ super();
+ }
- public MBServerException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
+ public MBServerException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
- public MBServerException(String arg0) {
- super(arg0);
- }
+ public MBServerException(String arg0) {
+ super(arg0);
+ }
- public MBServerException(Throwable arg0) {
- super(arg0);
- }
+ public MBServerException(Throwable arg0) {
+ super(arg0);
+ }
- public void logException(String origin) {
- Logger.error(origin, this.getClass().getSimpleName() + "(1): " + this.getMessage());
+ public void logException(String origin) {
+ Logger.error(origin, this.getClass().getSimpleName() + "(1): " + this.getMessage());
- }
+ }
}
diff --git a/src/engine/exception/MsgSendException.java b/src/engine/exception/MsgSendException.java
index b84fcd33..f789402f 100644
--- a/src/engine/exception/MsgSendException.java
+++ b/src/engine/exception/MsgSendException.java
@@ -7,25 +7,25 @@
// www.magicbane.com
- package engine.exception;
+package engine.exception;
public class MsgSendException extends MBServerException {
- private static final long serialVersionUID = 6927044139998382254L;
+ private static final long serialVersionUID = 6927044139998382254L;
- public MsgSendException() {
- super();
- }
+ public MsgSendException() {
+ super();
+ }
- public MsgSendException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
+ public MsgSendException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
- public MsgSendException(String arg0) {
- super(arg0);
- }
+ public MsgSendException(String arg0) {
+ super(arg0);
+ }
- public MsgSendException(Throwable arg0) {
- super(arg0);
- }
+ public MsgSendException(Throwable arg0) {
+ super(arg0);
+ }
}
diff --git a/src/engine/exception/SerializationException.java b/src/engine/exception/SerializationException.java
index 0dd0066c..2381e619 100644
--- a/src/engine/exception/SerializationException.java
+++ b/src/engine/exception/SerializationException.java
@@ -7,25 +7,25 @@
// www.magicbane.com
- package engine.exception;
+package engine.exception;
public class SerializationException extends MBServerException {
- private static final long serialVersionUID = 6927044139998382254L;
+ private static final long serialVersionUID = 6927044139998382254L;
- public SerializationException() {
- super();
- }
+ public SerializationException() {
+ super();
+ }
- public SerializationException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
+ public SerializationException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
- public SerializationException(String arg0) {
- super(arg0);
- }
+ public SerializationException(String arg0) {
+ super(arg0);
+ }
- public SerializationException(Throwable arg0) {
- super(arg0);
- }
+ public SerializationException(Throwable arg0) {
+ super(arg0);
+ }
}
diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java
index b5ee8e94..b945c5a5 100644
--- a/src/engine/gameManager/BuildingManager.java
+++ b/src/engine/gameManager/BuildingManager.java
@@ -7,7 +7,6 @@
// www.magicbane.com
-
package engine.gameManager;
import engine.Enum;
@@ -315,7 +314,7 @@ public enum BuildingManager {
for (AbstractCharacter slottedNPC : building.getHirelings().keySet()) {
if (slottedNPC.getObjectType() == Enum.GameObjectType.NPC)
- ((NPC)slottedNPC).remove();
+ ((NPC) slottedNPC).remove();
else if (slottedNPC.getObjectType() == Enum.GameObjectType.Mob)
NPCManager.removeMobileFromBuilding(((Mob) slottedNPC), building);
}
@@ -493,7 +492,7 @@ public enum BuildingManager {
NPC npc = null;
- npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, null, false, zone, (short)rank, building);
+ npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, null, false, zone, (short) rank, building);
if (npc == null)
return false;
@@ -519,7 +518,8 @@ public enum BuildingManager {
if (item.getChargesRemaining() > 0)
rank = item.getChargesRemaining() * 10;
- else rank = 10;
+ else
+ rank = 10;
Mob mob;
NPC npc;
@@ -595,10 +595,10 @@ public enum BuildingManager {
public static boolean IsOwner(Building building, PlayerCharacter player) {
if (building == null || player == null)
return false;
-
+
if (building.getOwner() == null)
- return false;
-
+ return false;
+
return building.getOwner().getObjectUUID() == player.getObjectUUID();
@@ -650,54 +650,53 @@ public enum BuildingManager {
}
return null;
}
-
- public static Vector3fImmutable GetBindLocationForBuilding(Building building){
-
- Vector3fImmutable bindLoc = null;
-
- if (building == null)
- return Enum.Ruins.getRandomRuin().getLocation();
-
-
- bindLoc = building.getLoc();
-
-
- float radius = Bounds.meshBoundsCache.get(building.getMeshUUID()).radius;
- if ( building.getRank() == 8){
- bindLoc = building.getStuckLocation();
- if (bindLoc != null)
- return bindLoc;
- }
-
- float x = bindLoc.getX();
- float z = bindLoc.getZ();
- float offset = ((ThreadLocalRandom.current().nextFloat() * 2) - 1) * radius;
- int direction = ThreadLocalRandom.current().nextInt(4);
-
- switch (direction) {
- case 0:
- x += radius;
- z += offset;
- break;
- case 1:
- x += offset;
- z -= radius;
- break;
- case 2:
- x -= radius;
- z += offset;
- break;
- case 3:
- x += offset;
- z += radius;
- break;
- }
- bindLoc = new Vector3fImmutable(x, bindLoc.getY(), z);
-
- return bindLoc;
-
-
-
+
+ public static Vector3fImmutable GetBindLocationForBuilding(Building building) {
+
+ Vector3fImmutable bindLoc = null;
+
+ if (building == null)
+ return Enum.Ruins.getRandomRuin().getLocation();
+
+
+ bindLoc = building.getLoc();
+
+
+ float radius = Bounds.meshBoundsCache.get(building.getMeshUUID()).radius;
+ if (building.getRank() == 8) {
+ bindLoc = building.getStuckLocation();
+ if (bindLoc != null)
+ return bindLoc;
+ }
+
+ float x = bindLoc.getX();
+ float z = bindLoc.getZ();
+ float offset = ((ThreadLocalRandom.current().nextFloat() * 2) - 1) * radius;
+ int direction = ThreadLocalRandom.current().nextInt(4);
+
+ switch (direction) {
+ case 0:
+ x += radius;
+ z += offset;
+ break;
+ case 1:
+ x += offset;
+ z -= radius;
+ break;
+ case 2:
+ x -= radius;
+ z += offset;
+ break;
+ case 3:
+ x += offset;
+ z += radius;
+ break;
+ }
+ bindLoc = new Vector3fImmutable(x, bindLoc.getY(), z);
+
+ return bindLoc;
+
+
}
}
diff --git a/src/engine/gameManager/ChatManager.java b/src/engine/gameManager/ChatManager.java
index 10c502e3..496cfb6c 100644
--- a/src/engine/gameManager/ChatManager.java
+++ b/src/engine/gameManager/ChatManager.java
@@ -47,6 +47,7 @@ public enum ChatManager {
private static final String FLOOD_USER_ERROR = "You talk too much!";
private static final String SILENCED = "You find yourself mute!";
private static final String UNKNOWN_COMMAND = "No such command.";
+
/**
* This method used when handling a ChatMsg received from the network.
*/
@@ -107,8 +108,8 @@ public enum ChatManager {
ChatManager.chatIC(pc, (ChatICMsg) msg);
return;
case LEADERCHANNELMESSAGE:
- ChatManager.chatGlobal(pc, msg.getMessage(), isFlood);
- return;
+ ChatManager.chatGlobal(pc, msg.getMessage(), isFlood);
+ return;
case GLOBALCHANNELMESSAGE:
case CHATPVP:
case CHATCITY:
@@ -199,7 +200,7 @@ public enum ChatManager {
}
if (ChatManager.isVersionRequest(text) == true) {
- sendSystemMessage(pcSender, ConfigManager.MB_WORLD_GREETING.getValue());
+ sendSystemMessage(pcSender, ConfigManager.MB_WORLD_GREETING.getValue());
return;
}
@@ -247,7 +248,7 @@ public enum ChatManager {
* Shout
*/
public static void chatShout(AbstractWorldObject sender, String text,
- boolean isFlood) {
+ boolean isFlood) {
PlayerCharacter pcSender = null;
@@ -267,34 +268,34 @@ public enum ChatManager {
DispatchMessage.dispatchMsgToInterestArea(pcSender, msg, engine.Enum.DispatchChannel.SECONDARY, MBServerStatics.SHOUT_RANGE, true, true);
}
-
+
public static void chatGlobal(PlayerCharacter sender, String text,
- boolean isFlood) {
+ boolean isFlood) {
-PlayerCharacter pcSender = null;
+ PlayerCharacter pcSender = null;
-if (sender.getObjectType().equals(GameObjectType.PlayerCharacter))
-pcSender = (PlayerCharacter) sender;
+ if (sender.getObjectType().equals(GameObjectType.PlayerCharacter))
+ pcSender = (PlayerCharacter) sender;
-if (isFlood) {
-ChatManager.chatSayError(pcSender, FLOOD_USER_ERROR);
-return;
-}
+ if (isFlood) {
+ ChatManager.chatSayError(pcSender, FLOOD_USER_ERROR);
+ return;
+ }
-if (pcSender != null && testSilenced(pcSender))
-return;
+ if (pcSender != null && testSilenced(pcSender))
+ return;
// Make the Message
-ChatGlobalMsg msg = new ChatGlobalMsg(sender, text);
-DispatchMessage.dispatchMsgToAll(sender, msg, true);
+ ChatGlobalMsg msg = new ChatGlobalMsg(sender, text);
+ DispatchMessage.dispatchMsgToAll(sender, msg, true);
-}
+ }
/*
* Tell
*/
public static void chatTell(AbstractWorldObject sender, String recipient,
- String text, boolean isFlood) {
+ String text, boolean isFlood) {
if (text.isEmpty())
return;
@@ -323,7 +324,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
}
public static void chatTell(AbstractWorldObject sender,
- AbstractWorldObject recipient, String text) {
+ AbstractWorldObject recipient, String text) {
PlayerCharacter pcSender = null;
@@ -538,7 +539,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
}
public static void GuildEnterWorldMsg(PlayerCharacter sender,
- ClientConnection origin) {
+ ClientConnection origin) {
// Verify sender has PlayerCharacter
if (sender == null)
return;
@@ -643,7 +644,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
ChatManager.chatSystemSend(senderList, textToThief, 1, 2);
if (target != null && !textToVictim.isEmpty()) {
- HashSet victimList = new HashSet<>();
+ HashSet victimList = new HashSet<>();
victimList.add(target);
ChatManager.chatSystemSend(victimList, textToVictim, 1, 2);
}
@@ -774,7 +775,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
}
public static void chatGroupInfoCanSee(PlayerCharacter pc, String text) {
- HashSet distroList = null;
+ HashSet distroList = null;
Group group = GroupManager.getGroup(pc);
if (group != null) {
@@ -838,7 +839,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
// Send Info Message to guild channel based on guild
public static void chatGuildInfo(Guild guild, String text) {
- HashSet distroList = null;
+ HashSet distroList = null;
if (guild != null)
distroList = ChatManager.getGuildList(guild, null);
ChatManager.chatSystemSend(distroList, text, 12, 2);
@@ -846,7 +847,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
public static void chatSystemMOTD(PlayerCharacter sender, String text,
int channel, int messageType) {
- HashSet distroList = ChatManager.getOwnPlayer(sender);
+ HashSet distroList = ChatManager.getOwnPlayer(sender);
ChatManager.chatSystemSend(distroList, text, channel, messageType);
}
@@ -857,7 +858,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
}
public static void chatInfo(String text) {
- HashSet distroList = ChatManager.getAllPlayers(null);
+ HashSet distroList = ChatManager.getAllPlayers(null);
chatSystemSend(distroList, text, 1, 2);
}
@@ -871,7 +872,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
public static void chatSystem(PlayerCharacter sender, String text, int channel,
int messageType) {
- HashSet distroList = null;
+ HashSet distroList = null;
if (channel == 1) // System Channel Message
distroList = ChatManager.getAllPlayers(sender);
@@ -924,7 +925,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
public static void chatSystemGuild(Guild sender, String text, int channel,
int messageType) {
- HashSet distroList = null;
+ HashSet distroList = null;
if (channel == 5) { // Nation Channel, get Nation list
if (sender != null) {
@@ -976,7 +977,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
// Get distroList for guild
public static HashSet getGuildList(Guild guild, PlayerCharacter source) {
- HashSet distroList = new HashSet<>();
+ HashSet distroList = new HashSet<>();
for (PlayerCharacter playerCharacter : SessionManager.getAllActivePlayerCharacters()) {
@@ -992,7 +993,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
// Get distroList for guild IC's
public static HashSet getGuildICList(Guild guild, PlayerCharacter source) {
- HashSet distroList = new HashSet<>();
+ HashSet distroList = new HashSet<>();
for (PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()) {
@@ -1008,7 +1009,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
// Get distroList for group
public static HashSet getGroupList(Group group, PlayerCharacter source) {
- HashSet distroList = new HashSet<>();
+ HashSet distroList = new HashSet<>();
Set players = group.getMembers();
for (PlayerCharacter pc : players) {
if (source != null && pc.isIgnoringPlayer(source))
@@ -1020,7 +1021,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
// Get distroList for nation
public static HashSet getNationList(Guild nation, PlayerCharacter source) {
- HashSet distroList = new HashSet<>();
+ HashSet distroList = new HashSet<>();
for (PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()) {
@@ -1056,7 +1057,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
// Get distroList for all players
public static HashSet getAllPlayers(PlayerCharacter source) {
- HashSet distroList = new HashSet<>();
+ HashSet distroList = new HashSet<>();
for (PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()) {
if (source != null && pc.isIgnoringPlayer(source))
continue; // dont add if recip has ignored source
@@ -1218,7 +1219,7 @@ DispatchMessage.dispatchMsgToAll(sender, msg, true);
else if (cmd.compareTo("getinfo") == 0)
devCmd = "info";
else if (devCmd.isEmpty()) {
- Logger.info( "Unhandled admin command was used: /"
+ Logger.info("Unhandled admin command was used: /"
+ cmd);
return;
}
diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java
index fae77eb0..843d7824 100644
--- a/src/engine/gameManager/CombatManager.java
+++ b/src/engine/gameManager/CombatManager.java
@@ -9,7 +9,6 @@
package engine.gameManager;
import engine.Enum.*;
-import engine.ai.MobileFSM;
import engine.exception.MsgSendException;
import engine.job.JobContainer;
import engine.job.JobScheduler;
@@ -28,7 +27,6 @@ import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.util.HashSet;
-import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
@@ -38,6 +36,8 @@ public enum CombatManager {
COMBATMANAGER;
+ public static int animation = 0;
+
/**
* Message sent by player to attack something.
*/
@@ -60,7 +60,7 @@ public enum CombatManager {
//source must match player this account belongs to
if (player.getObjectUUID() != msg.getSourceID() || player.getObjectType().ordinal() != msg.getSourceType()) {
- Logger.error("Msg Source ID " + msg.getSourceID() + " Does not Match Player ID " + player.getObjectUUID() );
+ Logger.error("Msg Source ID " + msg.getSourceID() + " Does not Match Player ID " + player.getObjectUUID());
return;
}
@@ -73,7 +73,7 @@ public enum CombatManager {
target = BuildingManager.getBuildingFromCache(msg.getTargetID());
} else if (targetType == GameObjectType.Mob.ordinal()) {
target = Mob.getFromCache(msg.getTargetID());
- }else{
+ } else {
player.setCombatTarget(null);
return; //not valid type to attack
}
@@ -137,7 +137,7 @@ public enum CombatManager {
}
}
City playerCity = ZoneManager.getCityAtLocation(playerCharacter.getLoc());
- if( playerCity != null && playerCity.getGuild().getNation().equals(playerCharacter.getGuild().getNation()) == false && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
+ if (playerCity != null && playerCity.getGuild().getNation().equals(playerCharacter.getGuild().getNation()) == false && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
}
@@ -173,7 +173,7 @@ public enum CombatManager {
pet.setCombatTarget(null);
return; //not valid type to attack
}
-
+
if (pet.equals(target))
return;
@@ -184,10 +184,9 @@ public enum CombatManager {
return;
-
//set sources target
pet.setCombatTarget(target);
- // setFirstHitCombatTarget(player,target);
+ // setFirstHitCombatTarget(player,target);
//put in combat if not already
if (!pet.isCombat())
@@ -292,10 +291,10 @@ public enum CombatManager {
AbstractWorldObject target = abstractCharacter.getCombatTarget();
- if (target == null){
+ if (target == null) {
return 0;
}
-
+
//target must be valid type
if (AbstractWorldObject.IsAbstractCharacter(target)) {
@@ -303,11 +302,9 @@ public enum CombatManager {
//must be alive, attackable and in World
if (!tar.isAlive()) {
return 0;
- }
- else if (tar.isSafeMode()) {
+ } else if (tar.isSafeMode()) {
return 0;
- }
- else if (!tar.isActive()) {
+ } else if (!tar.isActive()) {
return 0;
}
@@ -327,8 +324,7 @@ public enum CombatManager {
}
}
}
- }
- else if (target.getObjectType().equals(GameObjectType.Building)) {
+ } else if (target.getObjectType().equals(GameObjectType.Building)) {
Building tar = (Building) target;
// Cannot attack an invuln building
@@ -337,16 +333,14 @@ public enum CombatManager {
return 0;
}
- }
- else {
+ } else {
return 0; //only characters and buildings may be attacked
}
//source must be in world and alive
if (!abstractCharacter.isActive()) {
return 0;
- }
- else if (!abstractCharacter.isAlive()) {
+ } else if (!abstractCharacter.isAlive()) {
return 0;
}
@@ -384,13 +378,11 @@ public enum CombatManager {
ItemBase wb = null;
if (weapon == null) {
isWeapon = false;
- }
- else {
+ } else {
ItemBase ib = weapon.getItemBase();
if (ib == null || !ib.getType().equals(ItemType.WEAPON)) {
isWeapon = false;
- }
- else {
+ } else {
wb = ib;
}
}
@@ -405,17 +397,14 @@ public enum CombatManager {
ItemBase ib = weaponOff.getItemBase();
if (ib == null || !ib.getType().equals(ItemType.WEAPON)) {
hasNoWeapon = true;
- }
- else {
+ } else {
// debugCombat(ac, "mainhand, weapon in other hand");
return 1; //no need to attack with this hand
}
- }
- else {
+ } else {
hasNoWeapon = true;
}
- }
- else {
+ } else {
if (equipped.get(MBServerStatics.SLOT_MAINHAND) == null) {
// debgCombat(ac, "offhand, weapon in other hand");
return 1; //no need to attack with this hand
@@ -439,8 +428,7 @@ public enum CombatManager {
// debugCombat(ac, "Not enough stamina to attack");
attackFailure = true;
}
- }
- else if (abstractCharacter.getStamina() < wb.getWeight()) {
+ } else if (abstractCharacter.getStamina() < wb.getWeight()) {
// debugCombat(ac, "Not enough stamina to attack");
attackFailure = true;
}
@@ -453,7 +441,7 @@ public enum CombatManager {
// }
//see if attacker is stunned. If so, stop here
bonus = abstractCharacter.getBonuses();
- if (bonus != null && bonus.getBool(ModType.Stunned,SourceType.None)) {
+ if (bonus != null && bonus.getBool(ModType.Stunned, SourceType.None)) {
// debugCombat(ac, "Cannot attack while stunned");
attackFailure = true;
}
@@ -462,13 +450,12 @@ public enum CombatManager {
float range;
if (hasNoWeapon) {
range = MBServerStatics.NO_WEAPON_RANGE;
- }
- else {
+ } else {
range = getWeaponRange(wb);
- if (bonus != null){
+ if (bonus != null) {
float buffRange = 1;
- buffRange += bonus.getFloat(ModType.WeaponRange, SourceType.None) *.01f;
- range*= buffRange;
+ buffRange += bonus.getFloat(ModType.WeaponRange, SourceType.None) * .01f;
+ range *= buffRange;
}
}
@@ -504,8 +491,7 @@ public enum CombatManager {
if (!attackFailure) {
if (hasNoWeapon || abstractCharacter.getObjectType().equals(GameObjectType.Mob)) {
createTimer(abstractCharacter, slot, 20, true); //2 second for no weapon
- }
- else {
+ } else {
int wepSpeed = (int) (wb.getSpeed());
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus
{
@@ -525,14 +511,13 @@ public enum CombatManager {
return 0;
attack(abstractCharacter, target, weapon, wb, (slot == MBServerStatics.SLOT_MAINHAND) ? true : false);
- }
- else {
+ } else {
// changed this to half a second to make combat attempts more aggressive than movement sync
createTimer(abstractCharacter, slot, 5, false); //0.5 second timer if attack fails
//System.out.println("Attack attempt failed");
}
- } catch(Exception e) {
+ } catch (Exception e) {
return 0;
}
return 2;
@@ -576,7 +561,7 @@ public enum CombatManager {
job = JobScheduler.getInstance().scheduleJob(aj, (time * 100));
timers.put("Attack" + slot, job);
} else {
- Logger.error( "Unable to find Timers for Character " + ac.getObjectUUID());
+ Logger.error("Unable to find Timers for Character " + ac.getObjectUUID());
}
}
@@ -601,8 +586,7 @@ public enum CombatManager {
atr = ac.getAtrHandOne();
minDamage = ac.getMinDamageHandOne();
maxDamage = ac.getMaxDamageHandOne();
- }
- else {
+ } else {
atr = ac.getAtrHandTwo();
minDamage = ac.getMinDamageHandTwo();
maxDamage = ac.getMaxDamageHandTwo();
@@ -612,20 +596,20 @@ public enum CombatManager {
if (target.getObjectTypeMask() == MBServerStatics.MASK_RAT)
tarIsRat = true;
- else if (target.getObjectType() == GameObjectType.PlayerCharacter){
- PlayerCharacter pTar = (PlayerCharacter)target;
- for (Effect eff: pTar.getEffects().values()){
- if (eff.getPowerToken() == 429513599 || eff.getPowerToken() == 429415295){
+ else if (target.getObjectType() == GameObjectType.PlayerCharacter) {
+ PlayerCharacter pTar = (PlayerCharacter) target;
+ for (Effect eff : pTar.getEffects().values()) {
+ if (eff.getPowerToken() == 429513599 || eff.getPowerToken() == 429415295) {
tarIsRat = true;
}
}
}
//Dont think we need to do this anymore.
- if (tarIsRat){
+ if (tarIsRat) {
//strip away current % dmg buffs then add with rat %
- if (ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0){
-
+ if (ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat) != 0) {
+
float percent = 1 + ac.getBonuses().getFloatPercentAll(ModType.Slay, SourceType.Rat);
@@ -640,8 +624,7 @@ public enum CombatManager {
//subtract stamina
if (wb == null) {
ac.modifyStamina(-0.5f, ac, true);
- }
- else {
+ } else {
float stam = wb.getWeight() / 3;
stam = (stam < 1) ? 1 : stam;
ac.modifyStamina(-(stam), ac, true);
@@ -655,8 +638,7 @@ public enum CombatManager {
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && target.getObjectUUID() != ac.getObjectUUID() && ac.getObjectType() == GameObjectType.PlayerCharacter) {
ac.setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
((PlayerCharacter) target).setTimeStamp("LastCombatPlayer", System.currentTimeMillis());
- }
- else {
+ } else {
ac.setTimeStamp("LastCombatMob", System.currentTimeMillis());
}
@@ -665,20 +647,20 @@ public enum CombatManager {
//Get defense for target
float defense;
if (target.getObjectType().equals(GameObjectType.Building)) {
-
- if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null){
+
+ if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
ac.setCombatTarget(null);
return;
}
defense = 0;
- Building building = (Building)target;
- if (building.getParentZone() != null && building.getParentZone().isPlayerCity()){
+ Building building = (Building) target;
+ if (building.getParentZone() != null && building.getParentZone().isPlayerCity()) {
- if (System.currentTimeMillis() > building.getTimeStamp("CallForHelp")){
+ if (System.currentTimeMillis() > building.getTimeStamp("CallForHelp")) {
building.getTimestamps().put("CallForHelp", System.currentTimeMillis() + 15000);
int count = 0;
- for (Mob mob:building.getParentZone().zoneMobSet){
+ for (Mob mob : building.getParentZone().zoneMobSet) {
if (!mob.isPlayerGuard())
continue;
if (mob.getCombatTarget() != null)
@@ -694,11 +676,10 @@ public enum CombatManager {
count++;
mob.setCombatTarget(ac);
- }
+ }
}
}
- }
- else {
+ } else {
AbstractCharacter tar = (AbstractCharacter) target;
defense = tar.getDefenseRating();
//Handle target attacking back if in combat and has no other target
@@ -712,11 +693,9 @@ public enum CombatManager {
float dif = atr - defense;
if (dif > 100) {
chance = 94;
- }
- else if (dif < -100) {
+ } else if (dif < -100) {
chance = 4;
- }
- else {
+ } else {
chance = (int) ((0.45 * dif) + 49);
}
@@ -755,11 +734,11 @@ public enum CombatManager {
dpj.attack(target, attackRange);
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
- ((PlayerCharacter)ac).setWeaponPower(dpj);
+ ((PlayerCharacter) ac).setWeaponPower(dpj);
}
}
//check to apply second backstab.
- if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand){
+ if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) && !mainHand) {
dpj = ((PlayerCharacter) ac).getWeaponPower();
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
float attackRange = getWeaponRange(wb);
@@ -780,7 +759,7 @@ public enum CombatManager {
if (!target.isAlive())
return;
- sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj,mainHand);
+ sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_BLOCK, dpj, mainHand);
passiveFired = true;
}
@@ -789,7 +768,7 @@ public enum CombatManager {
if (canTestParry(ac, target) && testPassive(ac, tarAc, "Parry")) {
if (!target.isAlive())
return;
- sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj,mainHand);
+ sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_PARRY, dpj, mainHand);
passiveFired = true;
}
}
@@ -804,7 +783,7 @@ public enum CombatManager {
if (!target.isAlive())
return;
- sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj,mainHand);
+ sendPassiveDefenseMessage(ac, wb, target, MBServerStatics.COMBAT_SEND_DODGE, dpj, mainHand);
passiveFired = true;
}
}
@@ -827,11 +806,9 @@ public enum CombatManager {
DamageType damageType;
if (wb != null) {
damageType = wb.getDamageType();
- }
- else if (ac.getObjectType().equals(GameObjectType.Mob) && ((Mob) ac).isSiege()) {
+ } else if (ac.getObjectType().equals(GameObjectType.Mob) && ((Mob) ac).isSiege()) {
damageType = DamageType.Siege;
- }
- else {
+ } else {
damageType = DamageType.Crush;
}
@@ -842,14 +819,13 @@ public enum CombatManager {
if (tarAc != null) {
resists = tarAc.getResists();
- }
- else if (target.getObjectType().equals(GameObjectType.Building)) {
+ } else if (target.getObjectType().equals(GameObjectType.Building)) {
resists = ((Building) target).getResists();
}
//make sure target is not immune to damage type;
if (resists != null && resists.immuneTo(damageType)) {
- sendCombatMessage(ac, target, 0f, wb, dpj,mainHand);
+ sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
return;
}
@@ -865,8 +841,7 @@ public enum CombatManager {
if (wb != null) {
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
- }
- else {
+ } else {
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
}
@@ -887,10 +862,9 @@ public enum CombatManager {
if (tarAc.getHealth() > 0)
d = tarAc.modifyHealth(-damage, ac, false);
- }
- else if (target.getObjectType().equals(GameObjectType.Building)) {
-
- if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null){
+ } else if (target.getObjectType().equals(GameObjectType.Building)) {
+
+ if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
ac.setCombatTarget(null);
return;
}
@@ -910,7 +884,7 @@ public enum CombatManager {
//test double death fix
if (d != 0) {
- sendCombatMessage(ac, target, damage, wb, dpj,mainHand); //send damage message
+ sendCombatMessage(ac, target, damage, wb, dpj, mainHand); //send damage message
}
errorTrack = 14;
@@ -945,8 +919,7 @@ public enum CombatManager {
if (ac.isAlive() && tarAc != null && tarAc.isAlive()) {
handleDamageShields(ac, tarAc, damage);
}
- }
- else {
+ } else {
int animationOverride = 0;
// Apply Weapon power effect if any.
// don't try to apply twice if dual wielding.
@@ -958,9 +931,8 @@ public enum CombatManager {
PowersBase wp = dpj.getPower();
if (wp.requiresHitRoll() == false) {
float attackRange = getWeaponRange(wb);
- dpj.attack(target,attackRange);
- }
- else {
+ dpj.attack(target, attackRange);
+ } else {
((PlayerCharacter) ac).setWeaponPower(null);
}
@@ -973,7 +945,7 @@ public enum CombatManager {
errorTrack = 17;
//miss, Send miss message
- sendCombatMessage(ac, target, 0f, wb, dpj,mainHand);
+ sendCombatMessage(ac, target, 0f, wb, dpj, mainHand);
//if attacker is player, set last attack timestamp
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)) {
@@ -1026,7 +998,6 @@ public enum CombatManager {
return false;
-
Item tarOff = tarItem.getItemFromEquipped(2);
@@ -1060,7 +1031,7 @@ public enum CombatManager {
//Damage is calculated twice to average a more central point
float damage = ThreadLocalRandom.current().nextFloat() * range;
- damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) *.5f;
+ damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) * .5f;
//put it back between min and max
damage += minDamage;
@@ -1075,29 +1046,29 @@ public enum CombatManager {
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
- int swingAnimation = getSwingAnimation(wb, dpj,mainHand);
+ int swingAnimation = getSwingAnimation(wb, dpj, mainHand);
- if (dpj != null){
- if(PowersManager.AnimationOverrides.containsKey(dpj.getAction().getEffectID()))
+ if (dpj != null) {
+ if (PowersManager.AnimationOverrides.containsKey(dpj.getAction().getEffectID()))
swingAnimation = PowersManager.AnimationOverrides.get(dpj.getAction().getEffectID());
}
- TargetedActionMsg cmm = new TargetedActionMsg(source,swingAnimation, target, passiveType);
+ TargetedActionMsg cmm = new TargetedActionMsg(source, swingAnimation, target, passiveType);
DispatchMessage.sendToAllInRange(target, cmm);
}
private static void sendCombatMessage(AbstractCharacter source, AbstractWorldObject target, float damage, ItemBase wb, DeferredPowerJob dpj, boolean mainHand) {
- int swingAnimation = getSwingAnimation(wb, dpj,mainHand);
+ int swingAnimation = getSwingAnimation(wb, dpj, mainHand);
- if (dpj != null){
- if(PowersManager.AnimationOverrides.containsKey(dpj.getAction().getEffectID()))
+ if (dpj != null) {
+ if (PowersManager.AnimationOverrides.containsKey(dpj.getAction().getEffectID()))
swingAnimation = PowersManager.AnimationOverrides.get(dpj.getAction().getEffectID());
}
- if (source.getObjectType() == GameObjectType.PlayerCharacter){
- for (Effect eff: source.getEffects().values()){
- if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 ||eff.getPower().getToken() == 429415295))
+ if (source.getObjectType() == GameObjectType.PlayerCharacter) {
+ for (Effect eff : source.getEffects().values()) {
+ if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295))
swingAnimation = 0;
}
}
@@ -1105,8 +1076,6 @@ public enum CombatManager {
DispatchMessage.sendToAllInRange(target, cmm);
}
- public static int animation = 0;
-
public static int getSwingAnimation(ItemBase wb, DeferredPowerJob dpj, boolean mainHand) {
int token = 0;
if (dpj != null) {
@@ -1125,57 +1094,56 @@ public enum CombatManager {
if (wb == null) {
return 75;
}
- if (mainHand){
- if (wb.getAnimations().size() > 0){
+ if (mainHand) {
+ if (wb.getAnimations().size() > 0) {
int animation = wb.getAnimations().get(0);
int random = ThreadLocalRandom.current().nextInt(wb.getAnimations().size());
- try{
+ try {
animation = wb.getAnimations().get(random);
return animation;
- }catch(Exception e){
- Logger.error( e.getMessage());
+ } catch (Exception e) {
+ Logger.error(e.getMessage());
return wb.getAnimations().get(0);
}
- }else if (wb.getOffHandAnimations().size() > 0){
+ } else if (wb.getOffHandAnimations().size() > 0) {
int animation = wb.getOffHandAnimations().get(0);
int random = ThreadLocalRandom.current().nextInt(wb.getOffHandAnimations().size());
- try{
+ try {
animation = wb.getOffHandAnimations().get(random);
return animation;
- }catch(Exception e){
- Logger.error( e.getMessage());
+ } catch (Exception e) {
+ Logger.error(e.getMessage());
return wb.getOffHandAnimations().get(0);
}
}
- }else{
- if (wb.getOffHandAnimations().size() > 0){
+ } else {
+ if (wb.getOffHandAnimations().size() > 0) {
int animation = wb.getOffHandAnimations().get(0);
int random = ThreadLocalRandom.current().nextInt(wb.getOffHandAnimations().size());
- try{
+ try {
animation = wb.getOffHandAnimations().get(random);
return animation;
- }catch(Exception e){
- Logger.error( e.getMessage());
+ } catch (Exception e) {
+ Logger.error(e.getMessage());
return wb.getOffHandAnimations().get(0);
}
- }else
- if (wb.getAnimations().size() > 0){
- int animation = wb.getAnimations().get(0);
- int random = ThreadLocalRandom.current().nextInt(wb.getAnimations().size());
- try{
- animation = wb.getAnimations().get(random);
- return animation;
- }catch(Exception e){
- Logger.error( e.getMessage());
- return wb.getAnimations().get(0);
-
- }
+ } else if (wb.getAnimations().size() > 0) {
+ int animation = wb.getAnimations().get(0);
+ int random = ThreadLocalRandom.current().nextInt(wb.getAnimations().size());
+ try {
+ animation = wb.getAnimations().get(random);
+ return animation;
+ } catch (Exception e) {
+ Logger.error(e.getMessage());
+ return wb.getAnimations().get(0);
}
+
+ }
}
@@ -1290,7 +1258,7 @@ public enum CombatManager {
UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(pc);
- DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true,false);
+ DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
}
public static boolean NotInRange(AbstractCharacter ac, AbstractWorldObject target, float range) {
@@ -1313,16 +1281,16 @@ public enum CombatManager {
if (ac.equals(tarAc)) {
return;
}
-
+
if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter))
return;
-
+
if (!tarAc.isAlive() || !ac.isAlive())
return;
boolean isCombat = tarAc.isCombat();
//If target in combat and has no target, then attack back
AbstractWorldObject awoCombTar = tarAc.getCombatTarget();
- if ((tarAc.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() ||tarAc.isCombat() && NotInRange(tarAc, awoCombTar, tarAc.getRange()))) || (tarAc != null && tarAc.getObjectType() == GameObjectType.Mob && ((Mob) tarAc).isSiege())) {
+ if ((tarAc.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || tarAc.isCombat() && NotInRange(tarAc, awoCombTar, tarAc.getRange()))) || (tarAc != null && tarAc.getObjectType() == GameObjectType.Mob && ((Mob) tarAc).isSiege())) {
// we are in combat with no valid target
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) tarAc;
@@ -1341,7 +1309,7 @@ public enum CombatManager {
Mob pet = ((PlayerCharacter) tarAc).getPet();
if (pet != null && pet.assist() && pet.getCombatTarget() == null) {
pet.setCombatTarget(ac);
- }
+ }
}
//Handle Mob Retaliate.
@@ -1353,7 +1321,7 @@ public enum CombatManager {
return;
retaliater.setCombatTarget(ac);
- }
+ }
}
public static void handleDamageShields(AbstractCharacter ac, AbstractCharacter target, float damage) {
@@ -1385,7 +1353,7 @@ public enum CombatManager {
//apply Damage back
ac.modifyHealth(-total, target, true);
- TargetedActionMsg cmm = new TargetedActionMsg(ac,ac, total, 0);
+ TargetedActionMsg cmm = new TargetedActionMsg(ac, ac, total, 0);
DispatchMessage.sendToAllInRange(target, cmm);
}
@@ -1395,32 +1363,32 @@ public enum CombatManager {
public static float calcHitBox(AbstractWorldObject ac) {
//TODO Figure out how Str Affects HitBox
float hitBox = 1;
- switch(ac.getObjectType()){
- case PlayerCharacter:
- PlayerCharacter pc = (PlayerCharacter)ac;
- if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG) {
- Logger.info("Hit box radius for " + pc.getFirstName() + " is " + ((int) pc.statStrBase / 20f));
- }
- hitBox = 1.5f + (int) ((PlayerCharacter) ac).statStrBase / 20f;
- break;
-
- case Mob:
- Mob mob = (Mob)ac;
- if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG)
- Logger.info( "Hit box radius for " + mob.getFirstName()
- + " is " + ((Mob) ac).getMobBase().getHitBoxRadius());
-
- hitBox = ((Mob) ac).getMobBase().getHitBoxRadius();
- break;
- case Building:
- Building building = (Building)ac;
- if (building.getBlueprint() == null)
- return 32;
- hitBox = Math.max(building.getBlueprint().getBuildingGroup().getExtents().x,
- building.getBlueprint().getBuildingGroup().getExtents().y);
- if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG)
- Logger.info( "Hit box radius for " + building.getName() + " is " + hitBox);
- break;
+ switch (ac.getObjectType()) {
+ case PlayerCharacter:
+ PlayerCharacter pc = (PlayerCharacter) ac;
+ if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG) {
+ Logger.info("Hit box radius for " + pc.getFirstName() + " is " + ((int) pc.statStrBase / 20f));
+ }
+ hitBox = 1.5f + (int) ((PlayerCharacter) ac).statStrBase / 20f;
+ break;
+
+ case Mob:
+ Mob mob = (Mob) ac;
+ if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG)
+ Logger.info("Hit box radius for " + mob.getFirstName()
+ + " is " + ((Mob) ac).getMobBase().getHitBoxRadius());
+
+ hitBox = ((Mob) ac).getMobBase().getHitBoxRadius();
+ break;
+ case Building:
+ Building building = (Building) ac;
+ if (building.getBlueprint() == null)
+ return 32;
+ hitBox = Math.max(building.getBlueprint().getBuildingGroup().getExtents().x,
+ building.getBlueprint().getBuildingGroup().getExtents().y);
+ if (MBServerStatics.COMBAT_TARGET_HITBOX_DEBUG)
+ Logger.info("Hit box radius for " + building.getName() + " is " + hitBox);
+ break;
}
return hitBox;
diff --git a/src/engine/gameManager/ConfigManager.java b/src/engine/gameManager/ConfigManager.java
index e51282f0..75fffdf4 100644
--- a/src/engine/gameManager/ConfigManager.java
+++ b/src/engine/gameManager/ConfigManager.java
@@ -132,8 +132,11 @@ public enum ConfigManager {
// Get the value associated with this enumeration
- public String getValue() {
- return configMap.get(this.name());
+ public String getValue() {
+ return configMap.get(this.name());
+ }
+
+ public void setValue(String value) {
+ configMap.put(this.name(), value);
}
- public void setValue(String value) { configMap.put(this.name(), value); }
}
diff --git a/src/engine/gameManager/DbManager.java b/src/engine/gameManager/DbManager.java
index 94282831..a2e2522f 100644
--- a/src/engine/gameManager/DbManager.java
+++ b/src/engine/gameManager/DbManager.java
@@ -25,304 +25,299 @@ import java.util.EnumMap;
import java.util.concurrent.ConcurrentHashMap;
public enum DbManager {
- DBMANAGER;
+ DBMANAGER;
+
+ public static final dbAccountHandler AccountQueries = new dbAccountHandler();
+ public static final dbBaneHandler BaneQueries = new dbBaneHandler();
+
+ //Local Object Caching
+ public static final dbBaseClassHandler BaseClassQueries = new dbBaseClassHandler();
+ public static final dbBuildingHandler BuildingQueries = new dbBuildingHandler();
+ public static final dbBuildingLocationHandler BuildingLocationQueries = new dbBuildingLocationHandler();
+ public static final dbCharacterPowerHandler CharacterPowerQueries = new dbCharacterPowerHandler();
+ public static final dbCharacterRuneHandler CharacterRuneQueries = new dbCharacterRuneHandler();
+ public static final dbCharacterSkillHandler CharacterSkillQueries = new dbCharacterSkillHandler();
+ public static final dbCityHandler CityQueries = new dbCityHandler();
+ public static final dbContractHandler ContractQueries = new dbContractHandler();
+ public static final dbWarehouseHandler WarehouseQueries = new dbWarehouseHandler();
+
+ // Omg refactor this out, somebody!
+ public static final dbCSSessionHandler CSSessionQueries = new dbCSSessionHandler();
+ public static final dbEnchantmentHandler EnchantmentQueries = new dbEnchantmentHandler();
+ public static final dbEffectsResourceCostHandler EffectsResourceCostsQueries = new dbEffectsResourceCostHandler();
+ public static final dbGuildHandler GuildQueries = new dbGuildHandler();
+ public static final dbItemHandler ItemQueries = new dbItemHandler();
+ public static final dbItemBaseHandler ItemBaseQueries = new dbItemBaseHandler();
+ public static final dbKitHandler KitQueries = new dbKitHandler();
+ public static final dbLootTableHandler LootQueries = new dbLootTableHandler();
+ public static final dbMenuHandler MenuQueries = new dbMenuHandler();
+ public static final dbMineHandler MineQueries = new dbMineHandler();
+ public static final dbMobHandler MobQueries = new dbMobHandler();
+ public static final dbMobBaseHandler MobBaseQueries = new dbMobBaseHandler();
+ public static final dbNPCHandler NPCQueries = new dbNPCHandler();
+ public static final dbPlayerCharacterHandler PlayerCharacterQueries = new dbPlayerCharacterHandler();
+ public static final dbPromotionClassHandler PromotionQueries = new dbPromotionClassHandler();
+ public static final dbRaceHandler RaceQueries = new dbRaceHandler();
+ public static final dbResistHandler ResistQueries = new dbResistHandler();
+ public static final dbRuneBaseAttributeHandler RuneBaseAttributeQueries = new dbRuneBaseAttributeHandler();
+ public static final dbRuneBaseEffectHandler RuneBaseEffectQueries = new dbRuneBaseEffectHandler();
+ public static final dbRuneBaseHandler RuneBaseQueries = new dbRuneBaseHandler();
+ public static final dbSkillBaseHandler SkillsBaseQueries = new dbSkillBaseHandler();
+ public static final dbSkillReqHandler SkillReqQueries = new dbSkillReqHandler();
+ public static final dbVendorDialogHandler VendorDialogQueries = new dbVendorDialogHandler();
+ public static final dbZoneHandler ZoneQueries = new dbZoneHandler();
+ public static final dbRealmHandler RealmQueries = new dbRealmHandler();
+ public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler();
+ public static final dbBoonHandler BoonQueries = new dbBoonHandler();
+ public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
+ public static final dbHeightMapHandler HeightMapQueries = new dbHeightMapHandler();
+ public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
+ private static final EnumMap> objectCache = new EnumMap<>(GameObjectType.class);
+ public static Hasher hasher;
+ private static HikariDataSource connectionPool = null;
+
+ public static AbstractGameObject getObject(GameObjectType objectType, int objectUUID) {
+
+ AbstractGameObject outObject = null;
+
+ switch (objectType) {
+ case PlayerCharacter:
+ outObject = PlayerCharacter.getPlayerCharacter(objectUUID);
+ break;
+ case NPC:
+ outObject = NPC.getNPC(objectUUID);
+ break;
+ case Mob:
+ outObject = Mob.getFromCache(objectUUID);
+ break;
+ case Building:
+ outObject = BuildingManager.getBuilding(objectUUID);
+ break;
+ case Guild:
+ outObject = Guild.getGuild(objectUUID);
+ break;
+ case Item:
+ outObject = Item.getFromCache(objectUUID);
+ break;
+ case MobLoot:
+ outObject = MobLoot.getFromCache(objectUUID);
+ break;
+ case City:
+ outObject = City.getCity(objectUUID);
+ break;
+ default:
+ Logger.error("Attempt to retrieve nonexistant " + objectType +
+ " from object cache.");
+ break;
+
+ }
+
+ return outObject;
+ }
+
+ public static boolean inCache(GameObjectType gameObjectType, int uuid) {
+
+ if (objectCache.get(gameObjectType) == null)
+ return false;
+
+ return (objectCache.get(gameObjectType).containsKey(uuid));
+
+ }
+
+ public static AbstractGameObject getFromCache(GameObjectType gameObjectType, int uuid) {
+
+ if (objectCache.get(gameObjectType) == null)
+ return null;
+
+ return objectCache.get(gameObjectType).get(uuid);
+
+ }
+
+ public static void removeFromCache(GameObjectType gameObjectType, int uuid) {
+
+ AbstractGameObject abstractGameObject;
+
+ if (objectCache.get(gameObjectType) == null)
+ return;
+
+ abstractGameObject = objectCache.get(gameObjectType).get(uuid);
+
+ if (abstractGameObject == null)
+ return;
+
+ removeFromCache(abstractGameObject);
+
+ }
+
+ public static void removeFromCache(AbstractGameObject abstractGameObject) {
+
+ if (abstractGameObject == null)
+ return;
+
+ if (objectCache.get(abstractGameObject.getObjectType()) == null)
+ return;
+
+ // Remove object from game cache
+
+ objectCache.get(abstractGameObject.getObjectType()).remove(abstractGameObject.getObjectUUID());
+
+ // Release bounds as we're dispensing with this object.
+
+ if (abstractGameObject instanceof AbstractWorldObject) {
+ AbstractWorldObject abstractWorldObject = (AbstractWorldObject) abstractGameObject;
+
+ if (abstractWorldObject.getBounds() != null) {
+ abstractWorldObject.getBounds().release();
+ abstractWorldObject.setBounds(null);
+ }
+ }
- private static HikariDataSource connectionPool = null;
+ }
- public static Hasher hasher;
+ public static boolean addToCache(AbstractGameObject gameObject) {
- //Local Object Caching
+ boolean isWorldServer = ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER);
- private static final EnumMap> objectCache = new EnumMap<>(GameObjectType.class);
+ if (!isWorldServer) {
+ if (MBServerStatics.SKIP_CACHE_LOGIN)
+ return true;
+ if (MBServerStatics.SKIP_CACHE_LOGIN_PLAYER
+ && (gameObject.getObjectType() == GameObjectType.PlayerCharacter))
+ return true;
+ if (MBServerStatics.SKIP_CACHE_LOGIN_ITEM &&
+ (gameObject.getObjectType() == GameObjectType.Item))
+ return true;
+ }
- public static AbstractGameObject getObject(GameObjectType objectType, int objectUUID) {
+ // First time this object type has been cached. Create the hashmap.
- AbstractGameObject outObject = null;
+ if (objectCache.get(gameObject.getObjectType()) == null) {
- switch (objectType) {
- case PlayerCharacter:
- outObject = PlayerCharacter.getPlayerCharacter(objectUUID);
- break;
- case NPC:
- outObject = NPC.getNPC(objectUUID);
- break;
- case Mob:
- outObject = Mob.getFromCache(objectUUID);
- break;
- case Building:
- outObject = BuildingManager.getBuilding(objectUUID);
- break;
- case Guild:
- outObject = Guild.getGuild(objectUUID);
- break;
- case Item:
- outObject = Item.getFromCache(objectUUID);
- break;
- case MobLoot:
- outObject = MobLoot.getFromCache(objectUUID);
- break;
- case City:
- outObject = City.getCity(objectUUID);
- break;
- default:
- Logger.error("Attempt to retrieve nonexistant " + objectType +
- " from object cache." );
- break;
+ int initialCapacity;
- }
+ // Provide initial sizing hints
- return outObject;
- }
+ switch (gameObject.getObjectType()) {
+ case Building:
+ initialCapacity = 46900;
+ break;
+ case Mob:
+ initialCapacity = 11700;
+ break;
+ case NPC:
+ initialCapacity = 900;
+ break;
+ case Zone:
+ initialCapacity = 1070;
+ break;
+ case Account:
+ initialCapacity = 10000;
+ break;
+ case Guild:
+ initialCapacity = 100;
+ break;
+ case ItemContainer:
+ initialCapacity = 100;
+ break;
+ case Item:
+ initialCapacity = 1000;
+ break;
+ case MobLoot:
+ initialCapacity = 10000;
+ break;
+ case PlayerCharacter:
+ initialCapacity = 100;
+ break;
+ default:
+ initialCapacity = 100; // Lookup api default should be ok for small maps
+ break;
+ }
+ objectCache.put(gameObject.getObjectType(), new ConcurrentHashMap<>(initialCapacity));
+ }
+ // Add the object to the cache. This will overwrite the current map entry.
- public static boolean inCache(GameObjectType gameObjectType, int uuid) {
+ objectCache.get(gameObject.getObjectType()).put(gameObject.getObjectUUID(), gameObject);
- if (objectCache.get(gameObjectType) == null)
- return false;
+ return true;
+ }
- return (objectCache.get(gameObjectType).containsKey(uuid));
+ public static java.util.Collection getList(GameObjectType gameObjectType) {
- }
+ if (objectCache.get(gameObjectType) == null)
+ return null;
- public static AbstractGameObject getFromCache(GameObjectType gameObjectType, int uuid) {
+ return objectCache.get(gameObjectType).values();
+ }
- if (objectCache.get(gameObjectType) == null)
- return null;
+ public static PreparedStatement prepareStatement(String sql) throws SQLException {
+ return getConnection().prepareStatement(sql, 1);
+ }
- return objectCache.get(gameObjectType).get(uuid);
+ public static ConcurrentHashMap getMap(
+ GameObjectType gameObjectType) {
- }
+ if (objectCache.get(gameObjectType) == null)
+ return null;
+
+ return objectCache.get(gameObjectType);
+
+ }
+
+ public static void printCacheCount(PlayerCharacter pc) {
+ ChatManager.chatSystemInfo(pc, "Cache Lists");
+
+ for (GameObjectType gameObjectType : GameObjectType.values()) {
+
+ if (objectCache.get(gameObjectType) == null)
+ continue;
+
+ String ret = gameObjectType.name() + ": " + objectCache.get(gameObjectType).size();
+ ChatManager.chatSystemInfo(pc, ret + '\n');
+ }
+ }
+
+ /**
+ * @return the conn
+ */
+ //XXX I think we have a severe resource leak here! No one is putting the connections back!
+ public static Connection getConnection() {
+ try {
+ return DbManager.connectionPool.getConnection();
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void configureConnectionPool() {
+
+ HikariConfig config = new HikariConfig();
+
+ int connectionCount = (Runtime.getRuntime().availableProcessors() * 2) + 1;
+ config.setMaximumPoolSize(connectionCount);
+
+ config.setJdbcUrl("jdbc:mysql://" + ConfigManager.MB_DATABASE_ADDRESS.getValue() +
+ ":" + ConfigManager.MB_DATABASE_PORT.getValue() + "/" +
+ ConfigManager.MB_DATABASE_NAME.getValue());
+ config.setUsername(ConfigManager.MB_DATABASE_USER.getValue());
+ config.setPassword(ConfigManager.MB_DATABASE_PASS.getValue());
+
+ // Must be set lower than SQL server connection lifetime!
+
+ config.addDataSourceProperty("maxLifetime", "3600000");
+
+ config.addDataSourceProperty("characterEncoding", "utf8");
+
+ config.addDataSourceProperty("useServerPrepStmts", "true");
+ config.addDataSourceProperty("cachePrepStmts", "true");
+ config.addDataSourceProperty("prepStmtCacheSize", "500");
+ config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
- public static void removeFromCache(GameObjectType gameObjectType, int uuid) {
+ config.addDataSourceProperty("leakDetectionThreshold", "5000");
+ config.addDataSourceProperty("cacheServerConfiguration", "true");
- AbstractGameObject abstractGameObject;
+ connectionPool = new HikariDataSource(config); // setup the connection pool
- if (objectCache.get(gameObjectType) == null)
- return;
-
- abstractGameObject = objectCache.get(gameObjectType).get(uuid);
-
- if (abstractGameObject == null)
- return;
-
- removeFromCache(abstractGameObject);
-
- }
-
- public static void removeFromCache(AbstractGameObject abstractGameObject) {
-
- if (abstractGameObject == null)
- return;
-
- if (objectCache.get(abstractGameObject.getObjectType()) == null)
- return;
-
- // Remove object from game cache
-
- objectCache.get(abstractGameObject.getObjectType()).remove(abstractGameObject.getObjectUUID());
-
- // Release bounds as we're dispensing with this object.
-
- if (abstractGameObject instanceof AbstractWorldObject) {
- AbstractWorldObject abstractWorldObject = (AbstractWorldObject)abstractGameObject;
-
- if (abstractWorldObject.getBounds() != null) {
- abstractWorldObject.getBounds().release();
- abstractWorldObject.setBounds(null);
- }
- }
-
- }
-
- public static boolean addToCache(AbstractGameObject gameObject) {
-
- boolean isWorldServer = ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER);
-
- if (!isWorldServer) {
- if (MBServerStatics.SKIP_CACHE_LOGIN)
- return true;
- if (MBServerStatics.SKIP_CACHE_LOGIN_PLAYER
- && (gameObject.getObjectType() == GameObjectType.PlayerCharacter))
- return true;
- if (MBServerStatics.SKIP_CACHE_LOGIN_ITEM &&
- (gameObject.getObjectType() == GameObjectType.Item))
- return true;
- }
-
- // First time this object type has been cached. Create the hashmap.
-
- if (objectCache.get(gameObject.getObjectType()) == null) {
-
- int initialCapacity;
-
- // Provide initial sizing hints
-
- switch (gameObject.getObjectType()) {
- case Building:
- initialCapacity = 46900;
- break;
- case Mob:
- initialCapacity = 11700;
- break;
- case NPC:
- initialCapacity = 900;
- break;
- case Zone:
- initialCapacity = 1070;
- break;
- case Account:
- initialCapacity = 10000;
- break;
- case Guild:
- initialCapacity = 100;
- break;
- case ItemContainer:
- initialCapacity = 100;
- break;
- case Item:
- initialCapacity = 1000;
- break;
- case MobLoot:
- initialCapacity = 10000;
- break;
- case PlayerCharacter:
- initialCapacity = 100;
- break;
- default:
- initialCapacity = 100; // Lookup api default should be ok for small maps
- break;
- }
- objectCache.put(gameObject.getObjectType(), new ConcurrentHashMap<>(initialCapacity));
- }
-
- // Add the object to the cache. This will overwrite the current map entry.
-
- objectCache.get(gameObject.getObjectType()).put(gameObject.getObjectUUID(), gameObject);
-
- return true;
- }
-
- public static java.util.Collection getList(GameObjectType gameObjectType) {
-
- if (objectCache.get(gameObjectType) == null)
- return null;
-
- return objectCache.get(gameObjectType).values();
- }
-
- public static PreparedStatement prepareStatement(String sql) throws SQLException {
- return getConnection().prepareStatement(sql, 1);
- }
-
- // Omg refactor this out, somebody!
-
- public static ConcurrentHashMap getMap(
- GameObjectType gameObjectType) {
-
- if (objectCache.get(gameObjectType) == null)
- return null;
-
- return objectCache.get(gameObjectType);
-
- }
-
- public static void printCacheCount(PlayerCharacter pc) {
- ChatManager.chatSystemInfo(pc, "Cache Lists");
-
- for (GameObjectType gameObjectType : GameObjectType.values()) {
-
- if (objectCache.get(gameObjectType) == null)
- continue;
-
- String ret = gameObjectType.name() + ": " + objectCache.get(gameObjectType).size();
- ChatManager.chatSystemInfo(pc, ret + '\n');
- }
- }
-
- /**
- * @return the conn
- */
- //XXX I think we have a severe resource leak here! No one is putting the connections back!
- public static Connection getConnection() {
- try {
- return DbManager.connectionPool.getConnection();
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static final dbAccountHandler AccountQueries = new dbAccountHandler();
- public static final dbBaneHandler BaneQueries = new dbBaneHandler();
- public static final dbBaseClassHandler BaseClassQueries = new dbBaseClassHandler();
- public static final dbBuildingHandler BuildingQueries = new dbBuildingHandler();
- public static final dbBuildingLocationHandler BuildingLocationQueries = new dbBuildingLocationHandler();
- public static final dbCharacterPowerHandler CharacterPowerQueries = new dbCharacterPowerHandler();
- public static final dbCharacterRuneHandler CharacterRuneQueries = new dbCharacterRuneHandler();
- public static final dbCharacterSkillHandler CharacterSkillQueries = new dbCharacterSkillHandler();
- public static final dbCityHandler CityQueries = new dbCityHandler();
- public static final dbContractHandler ContractQueries = new dbContractHandler();
- public static final dbWarehouseHandler WarehouseQueries = new dbWarehouseHandler();
- public static final dbCSSessionHandler CSSessionQueries = new dbCSSessionHandler();
- public static final dbEnchantmentHandler EnchantmentQueries = new dbEnchantmentHandler();
- public static final dbEffectsResourceCostHandler EffectsResourceCostsQueries = new dbEffectsResourceCostHandler();
- public static final dbGuildHandler GuildQueries = new dbGuildHandler();
- public static final dbItemHandler ItemQueries = new dbItemHandler();
- public static final dbItemBaseHandler ItemBaseQueries = new dbItemBaseHandler();
- public static final dbKitHandler KitQueries = new dbKitHandler();
- public static final dbLootTableHandler LootQueries = new dbLootTableHandler();
- public static final dbMenuHandler MenuQueries = new dbMenuHandler();
- public static final dbMineHandler MineQueries = new dbMineHandler();
- public static final dbMobHandler MobQueries = new dbMobHandler();
- public static final dbMobBaseHandler MobBaseQueries = new dbMobBaseHandler();
- public static final dbNPCHandler NPCQueries = new dbNPCHandler();
- public static final dbPlayerCharacterHandler PlayerCharacterQueries = new dbPlayerCharacterHandler();
- public static final dbPromotionClassHandler PromotionQueries = new dbPromotionClassHandler();
- public static final dbRaceHandler RaceQueries = new dbRaceHandler();
- public static final dbResistHandler ResistQueries = new dbResistHandler();
- public static final dbRuneBaseAttributeHandler RuneBaseAttributeQueries = new dbRuneBaseAttributeHandler();
- public static final dbRuneBaseEffectHandler RuneBaseEffectQueries = new dbRuneBaseEffectHandler();
- public static final dbRuneBaseHandler RuneBaseQueries = new dbRuneBaseHandler();
- public static final dbSkillBaseHandler SkillsBaseQueries = new dbSkillBaseHandler();
- public static final dbSkillReqHandler SkillReqQueries = new dbSkillReqHandler();
- public static final dbVendorDialogHandler VendorDialogQueries = new dbVendorDialogHandler();
- public static final dbZoneHandler ZoneQueries = new dbZoneHandler();
- public static final dbRealmHandler RealmQueries = new dbRealmHandler();
- public static final dbBlueprintHandler BlueprintQueries = new dbBlueprintHandler();
- public static final dbBoonHandler BoonQueries = new dbBoonHandler();
- public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
- public static final dbHeightMapHandler HeightMapQueries = new dbHeightMapHandler();
-
- public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
-
- public static void configureConnectionPool() {
-
- HikariConfig config = new HikariConfig();
-
- int connectionCount = (Runtime.getRuntime().availableProcessors() * 2) + 1;
- config.setMaximumPoolSize(connectionCount);
-
- config.setJdbcUrl("jdbc:mysql://" + ConfigManager.MB_DATABASE_ADDRESS.getValue() +
- ":" + ConfigManager.MB_DATABASE_PORT.getValue() + "/" +
- ConfigManager.MB_DATABASE_NAME.getValue());
- config.setUsername(ConfigManager.MB_DATABASE_USER.getValue());
- config.setPassword(ConfigManager.MB_DATABASE_PASS.getValue());
-
- // Must be set lower than SQL server connection lifetime!
-
- config.addDataSourceProperty("maxLifetime", "3600000");
-
- config.addDataSourceProperty("characterEncoding", "utf8");
-
- config.addDataSourceProperty("useServerPrepStmts", "true");
- config.addDataSourceProperty("cachePrepStmts", "true");
- config.addDataSourceProperty("prepStmtCacheSize", "500");
- config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
-
- config.addDataSourceProperty("leakDetectionThreshold", "5000");
- config.addDataSourceProperty("cacheServerConfiguration", "true");
-
- connectionPool = new HikariDataSource(config); // setup the connection pool
-
- Logger.info("Database configured with " + connectionCount + " connections");
- }
+ Logger.info("Database configured with " + connectionCount + " connections");
+ }
}
diff --git a/src/engine/gameManager/DevCmdManager.java b/src/engine/gameManager/DevCmdManager.java
index 7c68d2f7..8aae245e 100644
--- a/src/engine/gameManager/DevCmdManager.java
+++ b/src/engine/gameManager/DevCmdManager.java
@@ -22,202 +22,203 @@ import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
public enum DevCmdManager {
- DEV_CMD_MANAGER;
-
- public static ConcurrentHashMap devCmds;
-
- DevCmdManager() {
- init();
- }
-
- public static void init() {
- DevCmdManager.devCmds = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
- DevCmdManager.registerCommands();
- }
-
- /**
- *
- */
- private static void registerCommands() {
-
- // Player
- DevCmdManager.registerDevCmd(new DistanceCmd());;
- DevCmdManager.registerDevCmd(new HelpCmd());
- DevCmdManager.registerDevCmd(new GetZoneCmd());
- DevCmdManager.registerDevCmd(new GetZoneMobsCmd());
- DevCmdManager.registerDevCmd(new PrintBankCmd());
- DevCmdManager.registerDevCmd(new PrintEquipCmd());
- DevCmdManager.registerDevCmd(new PrintInventoryCmd());
- DevCmdManager.registerDevCmd(new PrintVaultCmd());
- DevCmdManager.registerDevCmd(new PrintStatsCmd());
- DevCmdManager.registerDevCmd(new PrintSkillsCmd());
- DevCmdManager.registerDevCmd(new PrintPowersCmd());
- DevCmdManager.registerDevCmd(new PrintBonusesCmd());
- DevCmdManager.registerDevCmd(new PrintResistsCmd());
- DevCmdManager.registerDevCmd(new PrintLocationCmd());
- DevCmdManager.registerDevCmd(new InfoCmd());
- DevCmdManager.registerDevCmd(new aiInfoCmd());
- DevCmdManager.registerDevCmd(new simulateBootyCmd());
- DevCmdManager.registerDevCmd(new GetHeightCmd());
-
- // Tester
- DevCmdManager.registerDevCmd(new JumpCmd());
- DevCmdManager.registerDevCmd(new GotoCmd());
- DevCmdManager.registerDevCmd(new SummonCmd());
- DevCmdManager.registerDevCmd(new SetHealthCmd());
- DevCmdManager.registerDevCmd(new SetManaCmd());
- DevCmdManager.registerDevCmd(new SetStaminaCmd());
- DevCmdManager.registerDevCmd(new FindBuildingsCmd());
- DevCmdManager.registerDevCmd(new TeleportModeCmd());
- DevCmdManager.registerDevCmd(new SetLevelCmd());
- DevCmdManager.registerDevCmd(new SetBaseClassCmd());
- DevCmdManager.registerDevCmd(new SetPromotionClassCmd());
- DevCmdManager.registerDevCmd(new EffectCmd());
- DevCmdManager.registerDevCmd(new SetRuneCmd());
- DevCmdManager.registerDevCmd(new GetOffsetCmd());
- DevCmdManager.registerDevCmd(new DebugCmd());
- DevCmdManager.registerDevCmd(new AddGoldCmd());
- DevCmdManager.registerDevCmd(new ZoneInfoCmd());
- DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
- DevCmdManager.registerDevCmd(new HotzoneCmd());
- DevCmdManager.registerDevCmd(new MineActiveCmd());
- // Dev
- DevCmdManager.registerDevCmd(new ApplyStatModCmd());
- DevCmdManager.registerDevCmd(new AddBuildingCmd());
- DevCmdManager.registerDevCmd(new AddNPCCmd());
- DevCmdManager.registerDevCmd(new AddMobCmd());
- DevCmdManager.registerDevCmd(new RemoveObjectCmd());
- DevCmdManager.registerDevCmd(new RotateCmd());
- DevCmdManager.registerDevCmd(new FlashMsgCmd());
- DevCmdManager.registerDevCmd(new SysMsgCmd());
- DevCmdManager.registerDevCmd(new GetBankCmd());
- DevCmdManager.registerDevCmd(new GetVaultCmd());
- DevCmdManager.registerDevCmd(new CombatMessageCmd());
- DevCmdManager.registerDevCmd(new RenameCmd());
- DevCmdManager.registerDevCmd(new CreateItemCmd());
- DevCmdManager.registerDevCmd(new GetMemoryCmd());
- DevCmdManager.registerDevCmd(new SetRankCmd());
- DevCmdManager.registerDevCmd(new MakeBaneCmd());
- DevCmdManager.registerDevCmd(new RemoveBaneCmd());
- DevCmdManager.registerDevCmd(new SetBaneActiveCmd());
- DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
- DevCmdManager.registerDevCmd(new SetInvulCmd());
- DevCmdManager.registerDevCmd(new MakeItemCmd());
- DevCmdManager.registerDevCmd(new EnchantCmd());
- DevCmdManager.registerDevCmd(new SetSubRaceCmd());
- // Admin
- DevCmdManager.registerDevCmd(new GetCacheCountCmd());
- DevCmdManager.registerDevCmd(new GetRuneDropRateCmd());
- DevCmdManager.registerDevCmd(new DecachePlayerCmd());
- DevCmdManager.registerDevCmd(new AuditMobsCmd());
- DevCmdManager.registerDevCmd(new ChangeNameCmd());
- DevCmdManager.registerDevCmd(new SetGuildCmd());
- DevCmdManager.registerDevCmd(new SetOwnerCmd());
- DevCmdManager.registerDevCmd(new NetDebugCmd());
- DevCmdManager.registerDevCmd(new SqlDebugCmd());
- DevCmdManager.registerDevCmd(new PullCmd());
- DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
- DevCmdManager.registerDevCmd(new SplatMobCmd());
- DevCmdManager.registerDevCmd(new SlotNpcCmd());
- DevCmdManager.registerDevCmd(new SetAICmd());
- DevCmdManager.registerDevCmd(new GateInfoCmd());
- DevCmdManager.registerDevCmd(new ShowOffsetCmd());
- DevCmdManager.registerDevCmd(new RealmInfoCmd());
- DevCmdManager.registerDevCmd(new RebootCmd());
- DevCmdManager.registerDevCmd(new SetMineTypeCmd());
- DevCmdManager.registerDevCmd(new SetMineExpansion());
- DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
- DevCmdManager.registerDevCmd(new GotoObj());
- DevCmdManager.registerDevCmd(new convertLoc());
- DevCmdManager.registerDevCmd(new GetMobBaseLoot());
- DevCmdManager.registerDevCmd(new MBDropCmd());
- DevCmdManager.registerDevCmd(new AuditHeightMapCmd());
- DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
- DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
- DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
- DevCmdManager.registerDevCmd(new ResetLevelCmd());
- DevCmdManager.registerDevCmd(new HeartbeatCmd());
- DevCmdManager.registerDevCmd(new SetNpcNameCmd());
- DevCmdManager.registerDevCmd(new SetNpcMobbaseCmd());
- DevCmdManager.registerDevCmd(new DespawnCmd());
- DevCmdManager.registerDevCmd(new BoundsCmd());
- DevCmdManager.registerDevCmd(new GotoBoundsCmd());
- DevCmdManager.registerDevCmd(new RegionCmd());
- DevCmdManager.registerDevCmd(new SetMaintCmd());
- DevCmdManager.registerDevCmd(new ApplyBonusCmd());
- DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
- DevCmdManager.registerDevCmd(new SlotTestCmd());
-
- }
-
- private static void registerDevCmd(AbstractDevCmd cmd) {
- ArrayList cmdStrings = cmd.getCmdStrings();
- for (String cmdString : cmdStrings) {
- DevCmdManager.devCmds.put(cmdString, cmd);
- }
- }
-
- public static AbstractDevCmd getDevCmd(String cmd) {
- String lowercase = cmd.toLowerCase();
- return DevCmdManager.devCmds.get(lowercase);
- }
-
- public static boolean handleDevCmd(PlayerCharacter pcSender, String cmd,
- String argString, AbstractGameObject target) {
-
- if (pcSender == null) {
- return false;
- }
-
- Account a = SessionManager.getAccount(pcSender);
-
- if (a == null) {
- return false;
- }
-
- AbstractDevCmd adc = DevCmdManager.getDevCmd(cmd);
-
- if (adc == null) {
- return false;
- }
-
- //kill any commands not available to everyone on production server
- //only admin level can run dev commands on production
-
- if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
- Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
- return false;
- }
-
- // TODO add a job here to separate calling thread form executing thread?
- // Log
-
- String accName = a.getUname();
- String pcName = pcSender.getCombinedName();
- String logString = pcName + '(' + accName
- + ") '";
- logString += cmd + ' ' + argString + '\'';
- Logger.info( logString);
- DbManager.AccountQueries.WRITE_ADMIN_LOG(pcName, "COMMAND: " + cmd + " " + argString);
-
- // execute command;
- try {
- adc.doCmd(pcSender, argString, target);
- } catch (Exception e) {
- Logger.error(e.toString());
- e.printStackTrace();
- }
-
- return true;
- }
-
- public static String getCmdsForAccessLevel() {
- String out = "";
-
- for (Entry e : DevCmdManager.devCmds.entrySet())
- out += e.getKey() + ", ";
-
- return out;
- }
+ DEV_CMD_MANAGER;
+
+ public static ConcurrentHashMap devCmds;
+
+ DevCmdManager() {
+ init();
+ }
+
+ public static void init() {
+ DevCmdManager.devCmds = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
+ DevCmdManager.registerCommands();
+ }
+
+ /**
+ *
+ */
+ private static void registerCommands() {
+
+ // Player
+ DevCmdManager.registerDevCmd(new DistanceCmd());
+ ;
+ DevCmdManager.registerDevCmd(new HelpCmd());
+ DevCmdManager.registerDevCmd(new GetZoneCmd());
+ DevCmdManager.registerDevCmd(new GetZoneMobsCmd());
+ DevCmdManager.registerDevCmd(new PrintBankCmd());
+ DevCmdManager.registerDevCmd(new PrintEquipCmd());
+ DevCmdManager.registerDevCmd(new PrintInventoryCmd());
+ DevCmdManager.registerDevCmd(new PrintVaultCmd());
+ DevCmdManager.registerDevCmd(new PrintStatsCmd());
+ DevCmdManager.registerDevCmd(new PrintSkillsCmd());
+ DevCmdManager.registerDevCmd(new PrintPowersCmd());
+ DevCmdManager.registerDevCmd(new PrintBonusesCmd());
+ DevCmdManager.registerDevCmd(new PrintResistsCmd());
+ DevCmdManager.registerDevCmd(new PrintLocationCmd());
+ DevCmdManager.registerDevCmd(new InfoCmd());
+ DevCmdManager.registerDevCmd(new aiInfoCmd());
+ DevCmdManager.registerDevCmd(new simulateBootyCmd());
+ DevCmdManager.registerDevCmd(new GetHeightCmd());
+
+ // Tester
+ DevCmdManager.registerDevCmd(new JumpCmd());
+ DevCmdManager.registerDevCmd(new GotoCmd());
+ DevCmdManager.registerDevCmd(new SummonCmd());
+ DevCmdManager.registerDevCmd(new SetHealthCmd());
+ DevCmdManager.registerDevCmd(new SetManaCmd());
+ DevCmdManager.registerDevCmd(new SetStaminaCmd());
+ DevCmdManager.registerDevCmd(new FindBuildingsCmd());
+ DevCmdManager.registerDevCmd(new TeleportModeCmd());
+ DevCmdManager.registerDevCmd(new SetLevelCmd());
+ DevCmdManager.registerDevCmd(new SetBaseClassCmd());
+ DevCmdManager.registerDevCmd(new SetPromotionClassCmd());
+ DevCmdManager.registerDevCmd(new EffectCmd());
+ DevCmdManager.registerDevCmd(new SetRuneCmd());
+ DevCmdManager.registerDevCmd(new GetOffsetCmd());
+ DevCmdManager.registerDevCmd(new DebugCmd());
+ DevCmdManager.registerDevCmd(new AddGoldCmd());
+ DevCmdManager.registerDevCmd(new ZoneInfoCmd());
+ DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
+ DevCmdManager.registerDevCmd(new HotzoneCmd());
+ DevCmdManager.registerDevCmd(new MineActiveCmd());
+ // Dev
+ DevCmdManager.registerDevCmd(new ApplyStatModCmd());
+ DevCmdManager.registerDevCmd(new AddBuildingCmd());
+ DevCmdManager.registerDevCmd(new AddNPCCmd());
+ DevCmdManager.registerDevCmd(new AddMobCmd());
+ DevCmdManager.registerDevCmd(new RemoveObjectCmd());
+ DevCmdManager.registerDevCmd(new RotateCmd());
+ DevCmdManager.registerDevCmd(new FlashMsgCmd());
+ DevCmdManager.registerDevCmd(new SysMsgCmd());
+ DevCmdManager.registerDevCmd(new GetBankCmd());
+ DevCmdManager.registerDevCmd(new GetVaultCmd());
+ DevCmdManager.registerDevCmd(new CombatMessageCmd());
+ DevCmdManager.registerDevCmd(new RenameCmd());
+ DevCmdManager.registerDevCmd(new CreateItemCmd());
+ DevCmdManager.registerDevCmd(new GetMemoryCmd());
+ DevCmdManager.registerDevCmd(new SetRankCmd());
+ DevCmdManager.registerDevCmd(new MakeBaneCmd());
+ DevCmdManager.registerDevCmd(new RemoveBaneCmd());
+ DevCmdManager.registerDevCmd(new SetBaneActiveCmd());
+ DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
+ DevCmdManager.registerDevCmd(new SetInvulCmd());
+ DevCmdManager.registerDevCmd(new MakeItemCmd());
+ DevCmdManager.registerDevCmd(new EnchantCmd());
+ DevCmdManager.registerDevCmd(new SetSubRaceCmd());
+ // Admin
+ DevCmdManager.registerDevCmd(new GetCacheCountCmd());
+ DevCmdManager.registerDevCmd(new GetRuneDropRateCmd());
+ DevCmdManager.registerDevCmd(new DecachePlayerCmd());
+ DevCmdManager.registerDevCmd(new AuditMobsCmd());
+ DevCmdManager.registerDevCmd(new ChangeNameCmd());
+ DevCmdManager.registerDevCmd(new SetGuildCmd());
+ DevCmdManager.registerDevCmd(new SetOwnerCmd());
+ DevCmdManager.registerDevCmd(new NetDebugCmd());
+ DevCmdManager.registerDevCmd(new SqlDebugCmd());
+ DevCmdManager.registerDevCmd(new PullCmd());
+ DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
+ DevCmdManager.registerDevCmd(new SplatMobCmd());
+ DevCmdManager.registerDevCmd(new SlotNpcCmd());
+ DevCmdManager.registerDevCmd(new SetAICmd());
+ DevCmdManager.registerDevCmd(new GateInfoCmd());
+ DevCmdManager.registerDevCmd(new ShowOffsetCmd());
+ DevCmdManager.registerDevCmd(new RealmInfoCmd());
+ DevCmdManager.registerDevCmd(new RebootCmd());
+ DevCmdManager.registerDevCmd(new SetMineTypeCmd());
+ DevCmdManager.registerDevCmd(new SetMineExpansion());
+ DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
+ DevCmdManager.registerDevCmd(new GotoObj());
+ DevCmdManager.registerDevCmd(new convertLoc());
+ DevCmdManager.registerDevCmd(new GetMobBaseLoot());
+ DevCmdManager.registerDevCmd(new MBDropCmd());
+ DevCmdManager.registerDevCmd(new AuditHeightMapCmd());
+ DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
+ DevCmdManager.registerDevCmd(new SetNpcEquipSetCmd());
+ DevCmdManager.registerDevCmd(new SetBuildingAltitudeCmd());
+ DevCmdManager.registerDevCmd(new ResetLevelCmd());
+ DevCmdManager.registerDevCmd(new HeartbeatCmd());
+ DevCmdManager.registerDevCmd(new SetNpcNameCmd());
+ DevCmdManager.registerDevCmd(new SetNpcMobbaseCmd());
+ DevCmdManager.registerDevCmd(new DespawnCmd());
+ DevCmdManager.registerDevCmd(new BoundsCmd());
+ DevCmdManager.registerDevCmd(new GotoBoundsCmd());
+ DevCmdManager.registerDevCmd(new RegionCmd());
+ DevCmdManager.registerDevCmd(new SetMaintCmd());
+ DevCmdManager.registerDevCmd(new ApplyBonusCmd());
+ DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
+ DevCmdManager.registerDevCmd(new SlotTestCmd());
+
+ }
+
+ private static void registerDevCmd(AbstractDevCmd cmd) {
+ ArrayList cmdStrings = cmd.getCmdStrings();
+ for (String cmdString : cmdStrings) {
+ DevCmdManager.devCmds.put(cmdString, cmd);
+ }
+ }
+
+ public static AbstractDevCmd getDevCmd(String cmd) {
+ String lowercase = cmd.toLowerCase();
+ return DevCmdManager.devCmds.get(lowercase);
+ }
+
+ public static boolean handleDevCmd(PlayerCharacter pcSender, String cmd,
+ String argString, AbstractGameObject target) {
+
+ if (pcSender == null) {
+ return false;
+ }
+
+ Account a = SessionManager.getAccount(pcSender);
+
+ if (a == null) {
+ return false;
+ }
+
+ AbstractDevCmd adc = DevCmdManager.getDevCmd(cmd);
+
+ if (adc == null) {
+ return false;
+ }
+
+ //kill any commands not available to everyone on production server
+ //only admin level can run dev commands on production
+
+ if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
+ Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
+ return false;
+ }
+
+ // TODO add a job here to separate calling thread form executing thread?
+ // Log
+
+ String accName = a.getUname();
+ String pcName = pcSender.getCombinedName();
+ String logString = pcName + '(' + accName
+ + ") '";
+ logString += cmd + ' ' + argString + '\'';
+ Logger.info(logString);
+ DbManager.AccountQueries.WRITE_ADMIN_LOG(pcName, "COMMAND: " + cmd + " " + argString);
+
+ // execute command;
+ try {
+ adc.doCmd(pcSender, argString, target);
+ } catch (Exception e) {
+ Logger.error(e.toString());
+ e.printStackTrace();
+ }
+
+ return true;
+ }
+
+ public static String getCmdsForAccessLevel() {
+ String out = "";
+
+ for (Entry e : DevCmdManager.devCmds.entrySet())
+ out += e.getKey() + ", ";
+
+ return out;
+ }
}
diff --git a/src/engine/gameManager/GroupManager.java b/src/engine/gameManager/GroupManager.java
index a451d4c9..fad20eda 100644
--- a/src/engine/gameManager/GroupManager.java
+++ b/src/engine/gameManager/GroupManager.java
@@ -304,7 +304,7 @@ public enum GroupManager {
public static boolean goldSplit(PlayerCharacter pc, Item item, ClientConnection origin, AbstractWorldObject tar) {
if (item == null || pc == null || tar == null || item.getItemBase() == null) {
- Logger.error( "null something");
+ Logger.error("null something");
return false;
}
@@ -321,7 +321,7 @@ public enum GroupManager {
//get group members
- for (PlayerCharacter groupMember: group.getMembers()){
+ for (PlayerCharacter groupMember : group.getMembers()) {
if (pc.getLoc().distanceSquared2D(groupMember.getLoc()) > MBServerStatics.CHARACTER_LOAD_RANGE * MBServerStatics.CHARACTER_LOAD_RANGE)
continue;
@@ -343,27 +343,24 @@ public enum GroupManager {
int dif = total - (size * amount);
if (AbstractWorldObject.IsAbstractCharacter(tar)) {
- }
- else if (tar.getObjectType().equals(Enum.GameObjectType.Corpse)) {
+ } else if (tar.getObjectType().equals(Enum.GameObjectType.Corpse)) {
Corpse corpse = (Corpse) tar;
corpse.getInventory().remove(item);
- }
- else {
+ } else {
Logger.error("target not corpse or character");
return false;
}
- if (item.getObjectType() == Enum.GameObjectType.MobLoot){
- if (tar.getObjectType() == Enum.GameObjectType.Mob){
- ((Mob)tar).getCharItemManager().delete(item);
- }else
+ if (item.getObjectType() == Enum.GameObjectType.MobLoot) {
+ if (tar.getObjectType() == Enum.GameObjectType.Mob) {
+ ((Mob) tar).getCharItemManager().delete(item);
+ } else
item.setNumOfItems(0);
- }else
+ } else
item.setNumOfItems(0);
for (PlayerCharacter splitPlayer : playersSplit) {
-
int amt = (group.isGroupLead(splitPlayer)) ? (amount + dif) : amount;
if (amt > 0)
splitPlayer.getCharItemManager().addGoldToInventory(amt, false);
diff --git a/src/engine/gameManager/GuildManager.java b/src/engine/gameManager/GuildManager.java
index 75ea7afc..e6b285ae 100644
--- a/src/engine/gameManager/GuildManager.java
+++ b/src/engine/gameManager/GuildManager.java
@@ -19,188 +19,186 @@ import engine.net.client.msg.guild.GuildInfoMsg;
import engine.objects.*;
import org.joda.time.DateTime;
-public enum GuildManager {
+public enum GuildManager {
- GUILDMANAGER;
+ GUILDMANAGER;
- //Guild Error Message
- public static final int FAILURE_TO_SWEAR_GUILD = 45; //45: Failure to swear guild
- public static final int MUST_LEAVE_GUILD = 75;//75: You must leave your current guild before you can repledge
- public static final int NO_CHARTER_FOUND = 148; //148: Unable to find a matching petition to complete guild creation
- public static final int PROFANE_NAME = 149; //149: Guild name fails profanity check
- public static final int PROFANE_MOTTO = 150; //150: Guild motto fails profanity check
- public static final int UNIQUE_NAME = 151;//151: Guild name is not unique
- public static final int UNIQUE_CREST = 152;//152: Guild crest is not unique
- public static final int CREST_RESERVED = 153; //153: Guild crest is reserved
- public static final int CREST_COLOR_ERROR = 154; //154: All three crest colors cannot be the same
+ //Guild Error Message
+ public static final int FAILURE_TO_SWEAR_GUILD = 45; //45: Failure to swear guild
+ public static final int MUST_LEAVE_GUILD = 75;//75: You must leave your current guild before you can repledge
+ public static final int NO_CHARTER_FOUND = 148; //148: Unable to find a matching petition to complete guild creation
+ public static final int PROFANE_NAME = 149; //149: Guild name fails profanity check
+ public static final int PROFANE_MOTTO = 150; //150: Guild motto fails profanity check
+ public static final int UNIQUE_NAME = 151;//151: Guild name is not unique
+ public static final int UNIQUE_CREST = 152;//152: Guild crest is not unique
+ public static final int CREST_RESERVED = 153; //153: Guild crest is reserved
+ public static final int CREST_COLOR_ERROR = 154; //154: All three crest colors cannot be the same
- public static boolean joinGuild(PlayerCharacter pc, Guild guild, GuildHistoryType historyType) {
- return joinGuild(pc, guild, 0, historyType);
- }
+ public static boolean joinGuild(PlayerCharacter pc, Guild guild, GuildHistoryType historyType) {
+ return joinGuild(pc, guild, 0, historyType);
+ }
- //Used when repledging
- public static boolean joinGuild(PlayerCharacter pc, Guild guild, int cityID, GuildHistoryType historyType) {
- return joinGuild(pc, guild, cityID, true,historyType);
- }
+ //Used when repledging
+ public static boolean joinGuild(PlayerCharacter pc, Guild guild, int cityID, GuildHistoryType historyType) {
+ return joinGuild(pc, guild, cityID, true, historyType);
+ }
- public static boolean joinGuild(PlayerCharacter playerCharacter, Guild guild, int cityID, boolean fromTeleportScreen, GuildHistoryType historyType) {
+ public static boolean joinGuild(PlayerCharacter playerCharacter, Guild guild, int cityID, boolean fromTeleportScreen, GuildHistoryType historyType) {
- // Member variable delcaration
+ // Member variable delcaration
- ClientConnection origin;
- AcceptInviteToGuildMsg msg;
- Dispatch dispatch;
+ ClientConnection origin;
+ AcceptInviteToGuildMsg msg;
+ Dispatch dispatch;
- if (playerCharacter == null || guild == null)
- return false;
+ if (playerCharacter == null || guild == null)
+ return false;
- // Member variable assignment
+ // Member variable assignment
- origin = SessionManager.getClientConnection(playerCharacter);
+ origin = SessionManager.getClientConnection(playerCharacter);
- if (origin == null)
- return false;
+ if (origin == null)
+ return false;
- if (playerCharacter.getGuild().isEmptyGuild() == false && GuildStatusController.isGuildLeader(playerCharacter.getGuildStatus()))
- return false;
+ if (playerCharacter.getGuild().isEmptyGuild() == false && GuildStatusController.isGuildLeader(playerCharacter.getGuildStatus()))
+ return false;
- if (playerCharacter.getGuild() != null && playerCharacter.getGuild().isGuildLeader(playerCharacter.getObjectUUID()))
- return false;
+ if (playerCharacter.getGuild() != null && playerCharacter.getGuild().isGuildLeader(playerCharacter.getObjectUUID()))
+ return false;
- if (playerCharacter.getGuild() != null && !playerCharacter.getGuild().isEmptyGuild()){
- if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(playerCharacter.getGuildUUID(), playerCharacter, DateTime.now(), GuildHistoryType.LEAVE)){
- GuildHistory guildHistory = new GuildHistory(playerCharacter.getGuildUUID(),playerCharacter.getGuild().getName(),DateTime.now(), GuildHistoryType.LEAVE) ;
- playerCharacter.getGuildHistory().add(guildHistory);
- }
- }
+ if (playerCharacter.getGuild() != null && !playerCharacter.getGuild().isEmptyGuild()) {
+ if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(playerCharacter.getGuildUUID(), playerCharacter, DateTime.now(), GuildHistoryType.LEAVE)) {
+ GuildHistory guildHistory = new GuildHistory(playerCharacter.getGuildUUID(), playerCharacter.getGuild().getName(), DateTime.now(), GuildHistoryType.LEAVE);
+ playerCharacter.getGuildHistory().add(guildHistory);
+ }
+ }
- playerCharacter.setInnerCouncil(false);
- playerCharacter.setGuildLeader(false);
- playerCharacter.setGuild(guild);
-
- // Cleanup guild stuff
- playerCharacter.resetGuildStatuses();
-
- // send success message to client
- if (fromTeleportScreen && guild.isNPCGuild())
- playerCharacter.setFullMember(true);
-
- msg = new AcceptInviteToGuildMsg(guild.getObjectUUID(), 1, 0);
-
- if (fromTeleportScreen) {
- dispatch = Dispatch.borrow(playerCharacter, msg);
- DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
- }
- if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), playerCharacter, DateTime.now(), historyType)){
- GuildHistory guildHistory = new GuildHistory(guild.getObjectUUID(),guild.getName(),DateTime.now(), historyType) ;
- playerCharacter.getGuildHistory().add(guildHistory);
- }
-
- DispatchMessage.sendToAllInRange(playerCharacter, new GuildInfoMsg(playerCharacter, guild, 2));
-
- // Send guild join message
- ChatManager.chatGuildInfo(playerCharacter,
- playerCharacter.getFirstName() + " has joined the guild");
-
- playerCharacter.incVer();
-
- return true;
- // TODO update player to world
- }
-
- public static void enterWorldMOTD(PlayerCharacter pc) {
-
- Guild guild;
- Guild nation;
-
- if (pc == null) {
- return;
- }
-
- guild = pc.getGuild();
-
- if (guild == null || guild.getObjectUUID() == 0) // Don't send to errant
- return;
-
- // Send Guild MOTD
- String motd = guild.getMOTD();
- if (motd.length() > 0) {
- ChatManager.chatGuildMOTD(pc, motd);
- }
-
- // Send Nation MOTD
- nation = guild.getNation();
-
- if (nation != null) {
- if (nation.getObjectUUID() != 0) { // Don't send to errant nation
- motd = nation.getMOTD();
- if (motd.length() > 0) {
- ChatManager.chatNationMOTD(pc, motd);
- }
- }
- }
+ playerCharacter.setInnerCouncil(false);
+ playerCharacter.setGuildLeader(false);
+ playerCharacter.setGuild(guild);
- // Send IC MOTD if player is IC
- if (GuildStatusController.isInnerCouncil(pc.getGuildStatus())) {
- motd = guild.getICMOTD();
- if (motd.length() > 0) {
- ChatManager.chatICMOTD(pc, motd);
- }
- }
- }
-
- //Updates the bind point for everyone in guild
-
- public static void updateAllGuildBinds(Guild guild, City city) {
-
- if (guild == null)
- return;
-
- int cityID = (city != null) ? city.getObjectUUID() : 0;
-
-
-
- //update binds ingame
-
-
- for (PlayerCharacter playerCharacter : Guild.GuildRoster(guild)) {
- boolean updateBindBuilding = false;
-
- Building oldBoundBuilding = BuildingManager.getBuildingFromCache(playerCharacter.getBindBuildingID());
-
- if (oldBoundBuilding == null || oldBoundBuilding.getBlueprint() == null || oldBoundBuilding.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL))
- updateBindBuilding = true;
-
-
-
- if (updateBindBuilding){
- Building bindBuilding = null;
- if (city != null)
- if (city.getTOL() != null)
- bindBuilding = city.getTOL();
-
- if (bindBuilding == null)
- bindBuilding = PlayerCharacter.getBindBuildingForGuild(playerCharacter);
-
- playerCharacter.setBindBuildingID(bindBuilding != null ? bindBuilding.getObjectUUID() : 0);
- }
-
-
- }
- }
-
- //This updates tags for all online players in a guild.
- public static void updateAllGuildTags(Guild guild) {
-
- if (guild == null)
- return;
-
- for (PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) {
-
- if (player.getGuild().equals(guild))
- DispatchMessage.sendToAllInRange(player, new GuildInfoMsg(player , guild, 2));
-
- }
- }
+ // Cleanup guild stuff
+ playerCharacter.resetGuildStatuses();
+
+ // send success message to client
+ if (fromTeleportScreen && guild.isNPCGuild())
+ playerCharacter.setFullMember(true);
+
+ msg = new AcceptInviteToGuildMsg(guild.getObjectUUID(), 1, 0);
+
+ if (fromTeleportScreen) {
+ dispatch = Dispatch.borrow(playerCharacter, msg);
+ DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
+ }
+ if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), playerCharacter, DateTime.now(), historyType)) {
+ GuildHistory guildHistory = new GuildHistory(guild.getObjectUUID(), guild.getName(), DateTime.now(), historyType);
+ playerCharacter.getGuildHistory().add(guildHistory);
+ }
+
+ DispatchMessage.sendToAllInRange(playerCharacter, new GuildInfoMsg(playerCharacter, guild, 2));
+
+ // Send guild join message
+ ChatManager.chatGuildInfo(playerCharacter,
+ playerCharacter.getFirstName() + " has joined the guild");
+
+ playerCharacter.incVer();
+
+ return true;
+ // TODO update player to world
+ }
+
+ public static void enterWorldMOTD(PlayerCharacter pc) {
+
+ Guild guild;
+ Guild nation;
+
+ if (pc == null) {
+ return;
+ }
+
+ guild = pc.getGuild();
+
+ if (guild == null || guild.getObjectUUID() == 0) // Don't send to errant
+ return;
+
+ // Send Guild MOTD
+ String motd = guild.getMOTD();
+ if (motd.length() > 0) {
+ ChatManager.chatGuildMOTD(pc, motd);
+ }
+
+ // Send Nation MOTD
+ nation = guild.getNation();
+
+ if (nation != null) {
+ if (nation.getObjectUUID() != 0) { // Don't send to errant nation
+ motd = nation.getMOTD();
+ if (motd.length() > 0) {
+ ChatManager.chatNationMOTD(pc, motd);
+ }
+ }
+ }
+
+ // Send IC MOTD if player is IC
+ if (GuildStatusController.isInnerCouncil(pc.getGuildStatus())) {
+ motd = guild.getICMOTD();
+ if (motd.length() > 0) {
+ ChatManager.chatICMOTD(pc, motd);
+ }
+ }
+ }
+
+ //Updates the bind point for everyone in guild
+
+ public static void updateAllGuildBinds(Guild guild, City city) {
+
+ if (guild == null)
+ return;
+
+ int cityID = (city != null) ? city.getObjectUUID() : 0;
+
+
+ //update binds ingame
+
+
+ for (PlayerCharacter playerCharacter : Guild.GuildRoster(guild)) {
+ boolean updateBindBuilding = false;
+
+ Building oldBoundBuilding = BuildingManager.getBuildingFromCache(playerCharacter.getBindBuildingID());
+
+ if (oldBoundBuilding == null || oldBoundBuilding.getBlueprint() == null || oldBoundBuilding.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL))
+ updateBindBuilding = true;
+
+
+ if (updateBindBuilding) {
+ Building bindBuilding = null;
+ if (city != null)
+ if (city.getTOL() != null)
+ bindBuilding = city.getTOL();
+
+ if (bindBuilding == null)
+ bindBuilding = PlayerCharacter.getBindBuildingForGuild(playerCharacter);
+
+ playerCharacter.setBindBuildingID(bindBuilding != null ? bindBuilding.getObjectUUID() : 0);
+ }
+
+
+ }
+ }
+
+ //This updates tags for all online players in a guild.
+ public static void updateAllGuildTags(Guild guild) {
+
+ if (guild == null)
+ return;
+
+ for (PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) {
+
+ if (player.getGuild().equals(guild))
+ DispatchMessage.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
+
+ }
+ }
}
diff --git a/src/engine/gameManager/MaintenanceManager.java b/src/engine/gameManager/MaintenanceManager.java
index 2cc15cf7..f92d531e 100644
--- a/src/engine/gameManager/MaintenanceManager.java
+++ b/src/engine/gameManager/MaintenanceManager.java
@@ -122,7 +122,7 @@ public enum MaintenanceManager {
//no maintenance if day of week doesnt match
- if(LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()){
+ if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
continue;
}
// Add building to maintenance queue
diff --git a/src/engine/gameManager/MovementManager.java b/src/engine/gameManager/MovementManager.java
index d5e30fce..f38b502e 100644
--- a/src/engine/gameManager/MovementManager.java
+++ b/src/engine/gameManager/MovementManager.java
@@ -32,474 +32,469 @@ import static engine.math.FastMath.sqr;
public enum MovementManager {
- MOVEMENTMANAGER;
-
- private static final String changeAltitudeTimerJobName = "ChangeHeight";
- private static final String flightTimerJobName = "Flight";
-
- public static void sendOOS(PlayerCharacter pc) {
- pc.setWalkMode(true);
- MovementManager.sendRWSSMsg(pc);
- }
-
- public static void sendRWSSMsg(AbstractCharacter ac) {
-
- if (!ac.isAlive())
- return;
- UpdateStateMsg rssm = new UpdateStateMsg();
- rssm.setPlayer(ac);
- if (ac.getObjectType() == GameObjectType.PlayerCharacter)
- DispatchMessage.dispatchMsgToInterestArea(ac, rssm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
- else
- DispatchMessage.sendToAllInRange(ac, rssm);
- }
-
- /*
- * Sets the first combat target for the AbstractCharacter. Used to clear the
- * combat
- * target upon each move, unless something has set the firstHitCombatTarget
- * Also used to determine the size of a monster's hitbox
- */
- public static void movement(MoveToPointMsg msg, AbstractCharacter toMove) throws MsgSendException {
-
- // check for stun/root
- if (!toMove.isAlive())
- return;
-
- if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)){
- if (((PlayerCharacter)toMove).isCasting())
- ((PlayerCharacter)toMove).update();
- }
-
-
-
- toMove.setIsCasting(false);
- toMove.setItemCasting(false);
-
- if (toMove.getBonuses().getBool(ModType.Stunned, SourceType.None) || toMove.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
- return;
- }
-
- if (msg.getEndLat() > MBServerStatics.MAX_WORLD_WIDTH)
- msg.setEndLat((float) MBServerStatics.MAX_WORLD_WIDTH);
-
- if (msg.getEndLon() < MBServerStatics.MAX_WORLD_HEIGHT){
- msg.setEndLon((float) MBServerStatics.MAX_WORLD_HEIGHT);
- }
-
+ MOVEMENTMANAGER;
+
+ private static final String changeAltitudeTimerJobName = "ChangeHeight";
+ private static final String flightTimerJobName = "Flight";
+
+ public static void sendOOS(PlayerCharacter pc) {
+ pc.setWalkMode(true);
+ MovementManager.sendRWSSMsg(pc);
+ }
+
+ public static void sendRWSSMsg(AbstractCharacter ac) {
+
+ if (!ac.isAlive())
+ return;
+ UpdateStateMsg rssm = new UpdateStateMsg();
+ rssm.setPlayer(ac);
+ if (ac.getObjectType() == GameObjectType.PlayerCharacter)
+ DispatchMessage.dispatchMsgToInterestArea(ac, rssm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
+ else
+ DispatchMessage.sendToAllInRange(ac, rssm);
+ }
+
+ /*
+ * Sets the first combat target for the AbstractCharacter. Used to clear the
+ * combat
+ * target upon each move, unless something has set the firstHitCombatTarget
+ * Also used to determine the size of a monster's hitbox
+ */
+ public static void movement(MoveToPointMsg msg, AbstractCharacter toMove) throws MsgSendException {
+
+ // check for stun/root
+ if (!toMove.isAlive())
+ return;
+
+ if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
+ if (((PlayerCharacter) toMove).isCasting())
+ ((PlayerCharacter) toMove).update();
+ }
+
+
+ toMove.setIsCasting(false);
+ toMove.setItemCasting(false);
+
+ if (toMove.getBonuses().getBool(ModType.Stunned, SourceType.None) || toMove.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
+ return;
+ }
+
+ if (msg.getEndLat() > MBServerStatics.MAX_WORLD_WIDTH)
+ msg.setEndLat((float) MBServerStatics.MAX_WORLD_WIDTH);
+
+ if (msg.getEndLon() < MBServerStatics.MAX_WORLD_HEIGHT) {
+ msg.setEndLon((float) MBServerStatics.MAX_WORLD_HEIGHT);
+ }
+
// if (msg.getEndLat() < 0)
// msg.setEndLat(0);
//
// if (msg.getEndLon() > 0)
// msg.setEndLon(0);
-
-
-
-
-
- if (!toMove.isMoving())
- toMove.resetLastSetLocUpdate();
- else
- toMove.update();
-
- // Update movement for the player
-
-
- // else if (toMove.getObjectType() == GameObjectType.Mob)
- // ((Mob)toMove).updateLocation();
- // get start and end locations for the move
- Vector3fImmutable startLocation = new Vector3fImmutable(msg.getStartLat(), msg.getStartAlt(), msg.getStartLon());
- Vector3fImmutable endLocation = new Vector3fImmutable(msg.getEndLat(), msg.getEndAlt(), msg.getEndLon());
-
- // if (toMove.getObjectType() == GameObjectType.PlayerCharacter)
- // if (msg.getEndAlt() == 0 && msg.getTargetID() == 0){
- // MovementManager.sendRWSSMsg(toMove);
- // }
-
- //If in Building, let's see if we need to Fix
-
- // if inside a building, convert both locations from the building local reference frame to the world reference frame
-
- if (msg.getTargetID() > 0) {
- Building building = BuildingManager.getBuildingFromCache(msg.getTargetID());
- if (building != null) {
-
- Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
- // if (!Bounds.collide(convertLocEnd, b) || !b.loadObjectsInside()) {
- // toMove.setInBuilding(-1);
- // toMove.setInFloorID(-1);
- // toMove.setInBuildingID(0);
- // }
- // else {
- toMove.setInBuilding(msg.getInBuilding());
- toMove.setInFloorID(msg.getUnknown01());
- toMove.setInBuildingID(msg.getTargetID());
- msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
-
- if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
- if (convertLocEnd.distanceSquared2D(toMove.getLoc()) > 6000 * 6000) {
-
- Logger.info( "ENDLOC:" + convertLocEnd.x + ',' + convertLocEnd.y + ',' + convertLocEnd.z +
- ',' + "GETLOC:" + toMove.getLoc().x + ',' + toMove.getLoc().y + ',' + toMove.getLoc().z + " Name " + ((PlayerCharacter) toMove).getCombinedName());
- toMove.teleport(toMove.getLoc());
-
- return;
- }
- }
-
- startLocation = toMove.getLoc();
- endLocation = convertLocEnd;
-
- } else {
-
- toMove.setInBuilding(-1);
- toMove.setInFloorID(-1);
- toMove.setInBuildingID(0);
- //SYNC PLAYER
- toMove.teleport(toMove.getLoc());
- return;
- }
-
- } else {
- toMove.setInBuildingID(0);
- toMove.setInFloorID(-1);
- toMove.setInBuilding(-1);
- msg.setStartCoord(toMove.getLoc());
- }
-
- //make sure we set the correct player.
- msg.setSourceType(toMove.getObjectType().ordinal());
- msg.setSourceID(toMove.getObjectUUID());
-
- //if player in region, modify location to local location of building. set target to building.
- if (toMove.region != null) {
- Building regionBuilding = Regions.GetBuildingForRegion(toMove.region);
- if (regionBuilding != null) {
- msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
- msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
- msg.setInBuilding(toMove.region.level);
- msg.setUnknown01(toMove.region.room);
- msg.setTargetType(GameObjectType.Building.ordinal());
- msg.setTargetID(regionBuilding.getObjectUUID());
- }
-
- } else {
- toMove.setInBuildingID(0);
- toMove.setInFloorID(-1);
- toMove.setInBuilding(-1);
- msg.setStartCoord(toMove.getLoc());
- msg.setEndCoord(endLocation);
- msg.setTargetType(0);
- msg.setTargetID(0);
- }
-
- //checks sync between character and server, if out of sync, teleport player to original position and return.
- if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
- boolean startLocInSync = checkSync(toMove, startLocation, toMove.getLoc());
-
- if (!startLocInSync){
- syncLoc(toMove, toMove.getLoc(), startLocInSync);
- return;
- }
-
- }
-
- // set direction, based on the current location which has just been sync'd
- // with the client and the calc'd destination
- toMove.setFaceDir(endLocation.subtract2D(toMove.getLoc()).normalize());
-
- boolean collide = false;
- if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
- Vector3fImmutable collidePoint = Bounds.PlayerBuildingCollisionPoint((PlayerCharacter)toMove, toMove.getLoc(), endLocation);
-
- if (collidePoint != null) {
- msg.setEndCoord(collidePoint);
- endLocation = collidePoint;
- collide = true;
- }
-
- }
-
- if (toMove.getObjectType() == GameObjectType.PlayerCharacter && ((PlayerCharacter) toMove).isTeleportMode()) {
- toMove.teleport(endLocation);
- return;
- }
-
- // move to end location, this can interrupt the current move
- toMove.setEndLoc(endLocation);
-
- // ChatManager.chatSystemInfo((PlayerCharacter)toMove, "Moving to " + Vector3fImmutable.toString(endLocation));
-
- // make sure server knows player is not sitting
- toMove.setSit(false);
-
- // cancel any effects that break upon movement
- toMove.cancelOnMove();
-
- //cancel any attacks for manual move.
- if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getUnknown02() == 0)
- toMove.setCombatTarget(null);
-
-
- // If it's not a player moving just send the message
-
- if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) == false) {
- DispatchMessage.sendToAllInRange(toMove, msg);
- return;
- }
-
- // If it's a player who is moving then we need to handle characters
- // who should see the message via group follow
-
- PlayerCharacter player = (PlayerCharacter) toMove;
-
- player.setTimeStamp("lastMoveGate", System.currentTimeMillis());
-
- if (collide)
- DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
- else
- DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
-
-
- // Handle formation movement if needed
-
- if (player.getFollow() == false)
- return;
-
-
- City cityObject = null;
- Zone serverZone = null;
-
- serverZone = ZoneManager.findSmallestZone(player.getLoc());
- cityObject = (City) DbManager.getFromCache(GameObjectType.City, serverZone.getPlayerCityUUID());
-
- // Do not send group messages if player is on grid
-
- if (cityObject != null)
- return;
-
- // If player is not in a group we can exit here
-
- Group group = GroupManager.getGroup(player);
- if (group == null)
- return;
-
- // Echo group movement messages
- if (group.getGroupLead().getObjectUUID() == player.getObjectUUID())
- moveGroup(player, player.getClientConnection(), msg);
-
- }
+ if (!toMove.isMoving())
+ toMove.resetLastSetLocUpdate();
+ else
+ toMove.update();
+
+ // Update movement for the player
+
+
+ // else if (toMove.getObjectType() == GameObjectType.Mob)
+ // ((Mob)toMove).updateLocation();
+ // get start and end locations for the move
+ Vector3fImmutable startLocation = new Vector3fImmutable(msg.getStartLat(), msg.getStartAlt(), msg.getStartLon());
+ Vector3fImmutable endLocation = new Vector3fImmutable(msg.getEndLat(), msg.getEndAlt(), msg.getEndLon());
+
+ // if (toMove.getObjectType() == GameObjectType.PlayerCharacter)
+ // if (msg.getEndAlt() == 0 && msg.getTargetID() == 0){
+ // MovementManager.sendRWSSMsg(toMove);
+ // }
+
+ //If in Building, let's see if we need to Fix
+
+ // if inside a building, convert both locations from the building local reference frame to the world reference frame
+
+ if (msg.getTargetID() > 0) {
+ Building building = BuildingManager.getBuildingFromCache(msg.getTargetID());
+ if (building != null) {
+
+ Vector3fImmutable convertLocEnd = new Vector3fImmutable(ZoneManager.convertLocalToWorld(building, endLocation));
+ // if (!Bounds.collide(convertLocEnd, b) || !b.loadObjectsInside()) {
+ // toMove.setInBuilding(-1);
+ // toMove.setInFloorID(-1);
+ // toMove.setInBuildingID(0);
+ // }
+ // else {
+ toMove.setInBuilding(msg.getInBuilding());
+ toMove.setInFloorID(msg.getUnknown01());
+ toMove.setInBuildingID(msg.getTargetID());
+ msg.setStartCoord(ZoneManager.convertWorldToLocal(building, toMove.getLoc()));
+
+ if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
+ if (convertLocEnd.distanceSquared2D(toMove.getLoc()) > 6000 * 6000) {
+
+ Logger.info("ENDLOC:" + convertLocEnd.x + ',' + convertLocEnd.y + ',' + convertLocEnd.z +
+ ',' + "GETLOC:" + toMove.getLoc().x + ',' + toMove.getLoc().y + ',' + toMove.getLoc().z + " Name " + ((PlayerCharacter) toMove).getCombinedName());
+ toMove.teleport(toMove.getLoc());
+
+ return;
+ }
+ }
+
+ startLocation = toMove.getLoc();
+ endLocation = convertLocEnd;
+
+ } else {
+
+ toMove.setInBuilding(-1);
+ toMove.setInFloorID(-1);
+ toMove.setInBuildingID(0);
+ //SYNC PLAYER
+ toMove.teleport(toMove.getLoc());
+ return;
+ }
+
+ } else {
+ toMove.setInBuildingID(0);
+ toMove.setInFloorID(-1);
+ toMove.setInBuilding(-1);
+ msg.setStartCoord(toMove.getLoc());
+ }
+
+ //make sure we set the correct player.
+ msg.setSourceType(toMove.getObjectType().ordinal());
+ msg.setSourceID(toMove.getObjectUUID());
+
+ //if player in region, modify location to local location of building. set target to building.
+ if (toMove.region != null) {
+ Building regionBuilding = Regions.GetBuildingForRegion(toMove.region);
+ if (regionBuilding != null) {
+ msg.setStartCoord(ZoneManager.convertWorldToLocal(Regions.GetBuildingForRegion(toMove.region), toMove.getLoc()));
+ msg.setEndCoord(ZoneManager.convertWorldToLocal(regionBuilding, endLocation));
+ msg.setInBuilding(toMove.region.level);
+ msg.setUnknown01(toMove.region.room);
+ msg.setTargetType(GameObjectType.Building.ordinal());
+ msg.setTargetID(regionBuilding.getObjectUUID());
+ }
+
+ } else {
+ toMove.setInBuildingID(0);
+ toMove.setInFloorID(-1);
+ toMove.setInBuilding(-1);
+ msg.setStartCoord(toMove.getLoc());
+ msg.setEndCoord(endLocation);
+ msg.setTargetType(0);
+ msg.setTargetID(0);
+ }
+
+ //checks sync between character and server, if out of sync, teleport player to original position and return.
+ if (toMove.getObjectType() == GameObjectType.PlayerCharacter) {
+ boolean startLocInSync = checkSync(toMove, startLocation, toMove.getLoc());
+
+ if (!startLocInSync) {
+ syncLoc(toMove, toMove.getLoc(), startLocInSync);
+ return;
+ }
+
+ }
+
+ // set direction, based on the current location which has just been sync'd
+ // with the client and the calc'd destination
+ toMove.setFaceDir(endLocation.subtract2D(toMove.getLoc()).normalize());
+
+ boolean collide = false;
+ if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
+ Vector3fImmutable collidePoint = Bounds.PlayerBuildingCollisionPoint((PlayerCharacter) toMove, toMove.getLoc(), endLocation);
+
+ if (collidePoint != null) {
+ msg.setEndCoord(collidePoint);
+ endLocation = collidePoint;
+ collide = true;
+ }
+
+ }
+
+ if (toMove.getObjectType() == GameObjectType.PlayerCharacter && ((PlayerCharacter) toMove).isTeleportMode()) {
+ toMove.teleport(endLocation);
+ return;
+ }
+
+ // move to end location, this can interrupt the current move
+ toMove.setEndLoc(endLocation);
+
+ // ChatManager.chatSystemInfo((PlayerCharacter)toMove, "Moving to " + Vector3fImmutable.toString(endLocation));
+
+ // make sure server knows player is not sitting
+ toMove.setSit(false);
+
+ // cancel any effects that break upon movement
+ toMove.cancelOnMove();
+
+ //cancel any attacks for manual move.
+ if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) && msg.getUnknown02() == 0)
+ toMove.setCombatTarget(null);
+
+
+ // If it's not a player moving just send the message
+
+ if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) == false) {
+ DispatchMessage.sendToAllInRange(toMove, msg);
+ return;
+ }
+
+ // If it's a player who is moving then we need to handle characters
+ // who should see the message via group follow
+
+ PlayerCharacter player = (PlayerCharacter) toMove;
+
+ player.setTimeStamp("lastMoveGate", System.currentTimeMillis());
+
+ if (collide)
+ DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
+ else
+ DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
+
+
+ // Handle formation movement if needed
+
+ if (player.getFollow() == false)
+ return;
+
+
+ City cityObject = null;
+ Zone serverZone = null;
+
+ serverZone = ZoneManager.findSmallestZone(player.getLoc());
+ cityObject = (City) DbManager.getFromCache(GameObjectType.City, serverZone.getPlayerCityUUID());
+
+ // Do not send group messages if player is on grid
+
+ if (cityObject != null)
+ return;
+
+ // If player is not in a group we can exit here
+
+ Group group = GroupManager.getGroup(player);
+
+ if (group == null)
+ return;
+
+ // Echo group movement messages
+
+ if (group.getGroupLead().getObjectUUID() == player.getObjectUUID())
+ moveGroup(player, player.getClientConnection(), msg);
+
+ }
- /**
- * compare client and server location to verify that the two are in sync
- *
- * @param ac the player character
- * @param clientLoc location as reported by the client
- * @param serverLoc location known to the server
- * @return true if the two are in sync
- */
- private static boolean checkSync(AbstractCharacter ac, Vector3fImmutable clientLoc, Vector3fImmutable serverLoc) {
+ /**
+ * compare client and server location to verify that the two are in sync
+ *
+ * @param ac the player character
+ * @param clientLoc location as reported by the client
+ * @param serverLoc location known to the server
+ * @return true if the two are in sync
+ */
+ private static boolean checkSync(AbstractCharacter ac, Vector3fImmutable clientLoc, Vector3fImmutable serverLoc) {
- float desyncDist = clientLoc.distanceSquared2D(serverLoc);
+ float desyncDist = clientLoc.distanceSquared2D(serverLoc);
- // desync logging
- if (MBServerStatics.MOVEMENT_SYNC_DEBUG)
- if (desyncDist > MBServerStatics.MOVEMENT_DESYNC_TOLERANCE * MBServerStatics.MOVEMENT_DESYNC_TOLERANCE)
- // our current location server side is a calc of last known loc + direction + speed and known time of last update
- Logger.debug("Movement out of sync for " + ac.getFirstName()
- + ", Server Loc: " + serverLoc.getX() + ' ' + serverLoc.getZ()
- + " , Client loc: " + clientLoc.getX() + ' ' + clientLoc.getZ()
- + " desync distance " + desyncDist
- + " moving=" + ac.isMoving());
- else
- Logger.debug( "Movement sync is good - desyncDist = " + desyncDist);
+ // desync logging
+ if (MBServerStatics.MOVEMENT_SYNC_DEBUG)
+ if (desyncDist > MBServerStatics.MOVEMENT_DESYNC_TOLERANCE * MBServerStatics.MOVEMENT_DESYNC_TOLERANCE)
+ // our current location server side is a calc of last known loc + direction + speed and known time of last update
+ Logger.debug("Movement out of sync for " + ac.getFirstName()
+ + ", Server Loc: " + serverLoc.getX() + ' ' + serverLoc.getZ()
+ + " , Client loc: " + clientLoc.getX() + ' ' + clientLoc.getZ()
+ + " desync distance " + desyncDist
+ + " moving=" + ac.isMoving());
+ else
+ Logger.debug("Movement sync is good - desyncDist = " + desyncDist);
- if (ac.getDebug(1) && ac.getObjectType().equals(GameObjectType.PlayerCharacter))
- if (desyncDist > MBServerStatics.MOVEMENT_DESYNC_TOLERANCE * MBServerStatics.MOVEMENT_DESYNC_TOLERANCE) {
- PlayerCharacter pc = (PlayerCharacter) ac;
- ChatManager.chatSystemInfo(pc,
- "Movement out of sync for " + ac.getFirstName()
- + ", Server Loc: " + serverLoc.getX() + ' ' + serverLoc.getZ()
- + " , Client loc: " + clientLoc.getX() + ' ' + clientLoc.getZ()
- + " desync distance " + desyncDist
- + " moving=" + ac.isMoving());
- }
+ if (ac.getDebug(1) && ac.getObjectType().equals(GameObjectType.PlayerCharacter))
+ if (desyncDist > MBServerStatics.MOVEMENT_DESYNC_TOLERANCE * MBServerStatics.MOVEMENT_DESYNC_TOLERANCE) {
+ PlayerCharacter pc = (PlayerCharacter) ac;
+ ChatManager.chatSystemInfo(pc,
+ "Movement out of sync for " + ac.getFirstName()
+ + ", Server Loc: " + serverLoc.getX() + ' ' + serverLoc.getZ()
+ + " , Client loc: " + clientLoc.getX() + ' ' + clientLoc.getZ()
+ + " desync distance " + desyncDist
+ + " moving=" + ac.isMoving());
+ }
- // return indicator that the two are in sync or not
- return (desyncDist < 100f * 100f);
+ // return indicator that the two are in sync or not
+ return (desyncDist < 100f * 100f);
- }
+ }
+ public static void finishChangeAltitude(AbstractCharacter ac, float targetAlt) {
- public static void finishChangeAltitude(AbstractCharacter ac, float targetAlt) {
+ if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) == false)
+ return;
- if (ac.getObjectType().equals(GameObjectType.PlayerCharacter) == false)
- return;
+ //reset the getLoc timer before we clear other timers
+ // otherwise the next call to getLoc will not be correct
+ ac.resetLastSetLocUpdate();
- //reset the getLoc timer before we clear other timers
- // otherwise the next call to getLoc will not be correct
- ac.resetLastSetLocUpdate();
+ // call getLoc once as it processes loc to the ms
+ Vector3fImmutable curLoc = ac.getLoc();
- // call getLoc once as it processes loc to the ms
- Vector3fImmutable curLoc = ac.getLoc();
+ if (MBServerStatics.MOVEMENT_SYNC_DEBUG)
+ Logger.info("Finished Alt change, setting the end location to "
+ + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ()
+ + " moving=" + ac.isMoving()
+ + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
- if (MBServerStatics.MOVEMENT_SYNC_DEBUG)
- Logger.info("Finished Alt change, setting the end location to "
- + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ()
- + " moving=" + ac.isMoving()
- + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
-
- if (ac.getDebug(1) && ac.getObjectType().equals(GameObjectType.PlayerCharacter))
- ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
-
- //Send run/walk/sit/stand to tell the client we are flying / landing etc
- ac.update();
- ac.stopMovement(ac.getLoc());
- if (ac.isAlive())
- MovementManager.sendRWSSMsg(ac);
-
- //Check collision again
- }
-
-
- // Handle formation movement in group
-
- public static void moveGroup(PlayerCharacter pc, ClientConnection origin, MoveToPointMsg msg) throws MsgSendException {
- // get forward vector
- Vector3f faceDir = new Vector3f(pc.getFaceDir().x, 0, pc.getFaceDir().z).normalize();
- // get perpendicular vector
- Vector3f crossDir = new Vector3f(faceDir.z, 0, -faceDir.x);
-
- //get source loc with altitude
- Vector3f sLoc = new Vector3f(pc.getLoc().x, pc.getAltitude(), pc.getLoc().z);
-
- Group group = GroupManager.getGroup(pc);
- Set members = group.getMembers();
- int pos = 0;
- for (PlayerCharacter member : members) {
-
- if (member == null)
- continue;
- if (member.getObjectUUID() == pc.getObjectUUID())
- continue;
-
- MoveToPointMsg groupMsg = new MoveToPointMsg(msg);
-
- // Verify group member should be moved
-
- pos++;
- if (member.getFollow() != true)
- continue;
-
- //get member loc with altitude, then range against source loc
- Vector3f mLoc = new Vector3f(member.getLoc().x, member.getAltitude(), member.getLoc().z);
-
- if (sLoc.distanceSquared2D(mLoc) > sqr(MBServerStatics.FORMATION_RANGE))
- continue;
-
- //don't move if player has taken damage from another player in last 60 seconds
- long lastAttacked = System.currentTimeMillis() - pc.getLastPlayerAttackTime();
- if (lastAttacked < 60000)
- continue;
-
- if (!member.isAlive())
- continue;
-
- //don't move if player is stunned or rooted
- PlayerBonuses bonus = member.getBonuses();
- if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
- continue;
-
- member.update();
-
-
- // All checks passed, let's move the player
- // First get the offset position
- Vector3f offset = Formation.getOffset(group.getFormation(), pos);
- Vector3fImmutable destination = pc.getEndLoc();
- // offset forwards or backwards
- destination = destination.add(faceDir.mult(offset.z));
- // offset left or right
- destination = destination.add(crossDir.mult(offset.x));
- // ArrayList awoList = WorldGrid.INSTANCE.getObjectsInRangePartial(member, member.getLoc().distance2D(destination) +1000, MBServerStatics.MASK_BUILDING);
- //
- // boolean skip = false;
- //
- // for (AbstractWorldObject awo: awoList){
- // Building building = (Building)awo;
- //
- // if (building.getBounds() != null){
- // if (Bounds.collide(building, member.getLoc(), destination)){
- // skip = true;
- // break;
- // }
- //
- // }
- //
- // }
- //
- // if (skip)
- // continue;
- // if (member.isMoving())
- // member.stopMovement();
-
- // Update player speed to match group lead speed and make standing
- if (member.isSit() || (member.isWalk() != pc.isWalk())) {
- member.setSit(false);
- member.setWalkMode(pc.isWalk());
- MovementManager.sendRWSSMsg(member);
- }
-
- //cancel any effects that break upon movement
- member.cancelOnMove();
-
- // send movement for other players to see
- groupMsg.setSourceID(member.getObjectUUID());
- groupMsg.setStartCoord(member.getLoc());
- groupMsg.setEndCoord(destination);
- groupMsg.clearTarget();
- DispatchMessage.sendToAllInRange(member, groupMsg);
-
- // update group member
- member.setFaceDir(destination.subtract2D(member.getLoc()).normalize());
- member.setEndLoc(destination);
- }
- }
-
- public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc, Regions region) {
-
-
- if (targetLoc == null)
- return;
-
- Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
-
- teleporter.stopMovement(targetLoc);
- teleporter.setRegion(region);
-
- //mobs ignore region sets for now.
- if (teleporter.getObjectType().equals(GameObjectType.Mob)){
- teleporter.setInBuildingID(0);
- teleporter.setInBuilding(-1);
- teleporter.setInFloorID(-1);
- TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, targetLoc.getX(), targetLoc.getY(), targetLoc.getZ(), 0, -1, -1);
- DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
- return;
- }
- TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, targetLoc.getX(), targetLoc.getY(), targetLoc.getZ(), 0, -1, -1);
- //we shouldnt need to send teleport message to new area, as loadjob should pick it up.
- // DispatchMessage.dispatchMsgToInterestArea(teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
- DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
-
- if (teleporter.getObjectType().equals(GameObjectType.PlayerCharacter))
- InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter)teleporter);
-
- }
-
- private static void syncLoc(AbstractCharacter ac, Vector3fImmutable clientLoc, boolean useClientLoc) {
- ac.teleport(ac.getLoc());
- }
+ if (ac.getDebug(1) && ac.getObjectType().equals(GameObjectType.PlayerCharacter))
+ ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
+
+ //Send run/walk/sit/stand to tell the client we are flying / landing etc
+ ac.update();
+ ac.stopMovement(ac.getLoc());
+ if (ac.isAlive())
+ MovementManager.sendRWSSMsg(ac);
+
+ //Check collision again
+ }
+
+
+ // Handle formation movement in group
+
+ public static void moveGroup(PlayerCharacter pc, ClientConnection origin, MoveToPointMsg msg) throws MsgSendException {
+ // get forward vector
+ Vector3f faceDir = new Vector3f(pc.getFaceDir().x, 0, pc.getFaceDir().z).normalize();
+ // get perpendicular vector
+ Vector3f crossDir = new Vector3f(faceDir.z, 0, -faceDir.x);
+
+ //get source loc with altitude
+ Vector3f sLoc = new Vector3f(pc.getLoc().x, pc.getAltitude(), pc.getLoc().z);
+
+ Group group = GroupManager.getGroup(pc);
+ Set members = group.getMembers();
+ int pos = 0;
+ for (PlayerCharacter member : members) {
+
+ if (member == null)
+ continue;
+ if (member.getObjectUUID() == pc.getObjectUUID())
+ continue;
+
+ MoveToPointMsg groupMsg = new MoveToPointMsg(msg);
+
+ // Verify group member should be moved
+
+ pos++;
+ if (member.getFollow() != true)
+ continue;
+
+ //get member loc with altitude, then range against source loc
+ Vector3f mLoc = new Vector3f(member.getLoc().x, member.getAltitude(), member.getLoc().z);
+
+ if (sLoc.distanceSquared2D(mLoc) > sqr(MBServerStatics.FORMATION_RANGE))
+ continue;
+
+ //don't move if player has taken damage from another player in last 60 seconds
+ long lastAttacked = System.currentTimeMillis() - pc.getLastPlayerAttackTime();
+ if (lastAttacked < 60000)
+ continue;
+
+ if (!member.isAlive())
+ continue;
+
+ //don't move if player is stunned or rooted
+ PlayerBonuses bonus = member.getBonuses();
+ if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
+ continue;
+
+ member.update();
+
+
+ // All checks passed, let's move the player
+ // First get the offset position
+ Vector3f offset = Formation.getOffset(group.getFormation(), pos);
+ Vector3fImmutable destination = pc.getEndLoc();
+ // offset forwards or backwards
+ destination = destination.add(faceDir.mult(offset.z));
+ // offset left or right
+ destination = destination.add(crossDir.mult(offset.x));
+ // ArrayList awoList = WorldGrid.INSTANCE.getObjectsInRangePartial(member, member.getLoc().distance2D(destination) +1000, MBServerStatics.MASK_BUILDING);
+ //
+ // boolean skip = false;
+ //
+ // for (AbstractWorldObject awo: awoList){
+ // Building building = (Building)awo;
+ //
+ // if (building.getBounds() != null){
+ // if (Bounds.collide(building, member.getLoc(), destination)){
+ // skip = true;
+ // break;
+ // }
+ //
+ // }
+ //
+ // }
+ //
+ // if (skip)
+ // continue;
+ // if (member.isMoving())
+ // member.stopMovement();
+
+ // Update player speed to match group lead speed and make standing
+ if (member.isSit() || (member.isWalk() != pc.isWalk())) {
+ member.setSit(false);
+ member.setWalkMode(pc.isWalk());
+ MovementManager.sendRWSSMsg(member);
+ }
+
+ //cancel any effects that break upon movement
+ member.cancelOnMove();
+
+ // send movement for other players to see
+ groupMsg.setSourceID(member.getObjectUUID());
+ groupMsg.setStartCoord(member.getLoc());
+ groupMsg.setEndCoord(destination);
+ groupMsg.clearTarget();
+ DispatchMessage.sendToAllInRange(member, groupMsg);
+
+ // update group member
+ member.setFaceDir(destination.subtract2D(member.getLoc()).normalize());
+ member.setEndLoc(destination);
+ }
+ }
+
+ public static void translocate(AbstractCharacter teleporter, Vector3fImmutable targetLoc, Regions region) {
+
+
+ if (targetLoc == null)
+ return;
+
+ Vector3fImmutable oldLoc = new Vector3fImmutable(teleporter.getLoc());
+
+ teleporter.stopMovement(targetLoc);
+ teleporter.setRegion(region);
+
+ //mobs ignore region sets for now.
+ if (teleporter.getObjectType().equals(GameObjectType.Mob)) {
+ teleporter.setInBuildingID(0);
+ teleporter.setInBuilding(-1);
+ teleporter.setInFloorID(-1);
+ TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, targetLoc.getX(), targetLoc.getY(), targetLoc.getZ(), 0, -1, -1);
+ DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
+ return;
+ }
+ TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, targetLoc.getX(), targetLoc.getY(), targetLoc.getZ(), 0, -1, -1);
+ //we shouldnt need to send teleport message to new area, as loadjob should pick it up.
+ // DispatchMessage.dispatchMsgToInterestArea(teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
+ DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
+
+ if (teleporter.getObjectType().equals(GameObjectType.PlayerCharacter))
+ InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) teleporter);
+
+ }
+
+ private static void syncLoc(AbstractCharacter ac, Vector3fImmutable clientLoc, boolean useClientLoc) {
+ ac.teleport(ac.getLoc());
+ }
}
diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java
index ea79c58f..448aa587 100644
--- a/src/engine/gameManager/NPCManager.java
+++ b/src/engine/gameManager/NPCManager.java
@@ -199,7 +199,6 @@ public enum NPCManager {
}
-
public static void removeSiegeMinions(Mob mobile) {
for (Mob toRemove : mobile.siegeMinionMap.keySet()) {
diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java
index 59a4aa36..5cdd14f5 100644
--- a/src/engine/gameManager/PowersManager.java
+++ b/src/engine/gameManager/PowersManager.java
@@ -44,411 +44,408 @@ import static engine.math.FastMath.sqr;
public enum PowersManager {
- POWERMANAGER;
+ POWERMANAGER;
- public static HashMap