Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.perception.model.players.packets.commands;
- import static org.perception.util.PlayerPredicates.*;
- import java.io.BufferedWriter;
- import java.io.File;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.util.List;
- import java.util.Objects;
- import java.util.Optional;
- import java.util.function.Predicate;
- import org.apache.commons.io.FileUtils;
- import org.apache.commons.lang3.StringUtils;
- import org.apache.commons.lang3.text.WordUtils;
- import org.perception.Config;
- import org.perception.Connection;
- import org.perception.Server;
- import org.perception.model.content.SkillConstants;
- import org.perception.model.content.Kraken.Kraken;
- import org.perception.model.content.help.HelpDatabase;
- import org.perception.model.content.kill_streaks.Killstreak;
- import org.perception.model.content.teleport.Position;
- import org.perception.model.content.teleport.TeleportExecutor;
- import org.perception.model.content.zulrah.Zulrah;
- import org.perception.model.interaction.MultiplayerSession;
- import org.perception.model.interaction.MultiplayerSessionFinalizeType;
- import org.perception.model.interaction.MultiplayerSessionStage;
- import org.perception.model.interaction.MultiplayerSessionType;
- import org.perception.model.interaction.duel.DuelSession;
- import org.perception.model.items.ItemDefinition;
- import org.perception.model.npcs.NPCCacheDefinition;
- import org.perception.model.npcs.NPCHandler;
- import org.perception.model.npcs.NpcDefinition;
- import org.perception.model.npcs.Bosses.Cerberus;
- import org.perception.model.players.Boundary;
- import org.perception.model.players.Player;
- import org.perception.model.players.PlayerHandler;
- import org.perception.model.players.Rights;
- import org.perception.model.players.combat.Hitmark;
- import org.perception.model.players.skills.Skill;
- import org.perception.util.Misc;
- import org.perception.util.json.ItemDefinitionLoader;
- import com.google.gson.Gson;
- import com.google.gson.reflect.TypeToken;
- import com.rspserver.mvh.AuthService;
- /**
- * New command system. Uses predicates / enum to store commands. Much cleaner.
- *
- * The enum name is the string used to execute the command. After is the predicate that handles the requirement to
- * perform the command. Finally, after that is any additional strings that can be used to execute the command.
- * @author Advocatus
- *
- */
- public enum Commands {
- /*
- * All
- */
- AUTH {
- @Override
- public void execute(Player c, String input) {
- String auth = input.replace("Auth ", "");
- if(input.length() < 5) {
- c.sendMessage("You must enter an auth code to process your vote!");
- return;
- }
- boolean success = AuthService.provider().redeemNow(auth);
- if (success) {
- c.votePoints += 5;
- c.getItems().addItemUnderAnyCircumstance(2996, 10);
- PlayerHandler.executeGlobalMessage("<img=10></img><col=255>" + Misc.capitalize(c.playerName)
- + " </col>has just voted and received <col=CC0000>10 PK Points & 5 Vote Points</col>.");
- c.getPA().loadQuests();
- }
- else {
- c.sendMessage("Invalid auth supplied, please try again later.");
- }
- //}
- }
- },
- CHANGEPASS("changepassword") {
- @Override
- public void execute(Player c, String input) {
- if(input.length() < 3) {
- c.sendMessage("Your password must contain atleast 3 characters.");
- return;
- }
- if (input.length() > 20) {
- c.sendMessage("Passwords cannot contain more than 20 characters.");
- c.sendMessage("The password you tried had " + input.length() + " characters.");
- return;
- }
- if (input.contains("character-rights") || input.contains("[CHARACTER]") || input.contains(".") || input.contains("_")) {
- c.sendMessage("Your password contains illegal characters.");
- return;
- }
- //c.playerPass = input;
- c.playerPass = Misc.getFilteredInput(input).toLowerCase();
- c.sendMessage("Your password is now: @red@" + c.playerPass);
- }
- },
- CHARSOF {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()) {
- return;
- }
- c.getPA().showInterface(3559);
- }
- },
- COMMANDS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- for (int i = 8144; i < 8195; i++) {
- c.getPA().sendFrame126("", i);
- }
- c.getPA().sendFrame126("@dre@DomePS Commands", 8144);
- c.getPA().sendFrame126("", 8145);
- c.getPA().sendFrame126("@blu@::players@bla@ - Shows players online", 8147);
- c.getPA().sendFrame126("@blu@::check@bla@ - Claim your voting reward", 8148);
- c.getPA().sendFrame126("@blu@::getid itemname@bla@ - Auth the ID of an item", 8149);
- c.getPA().sendFrame126("@blu@::empty@bla@ - Destroy all items in your inventory", 8150);
- c.getPA().sendFrame126("@blu@::vote@bla@ - Takes you to the voting page", 8151);
- c.getPA().sendFrame126("@blu@::forums@bla@ - Takes you to the forums", 8152);
- c.getPA().sendFrame126("@blu@::store@bla@ - Takes you to the store/donation page", 8153);
- c.getPA().sendFrame126("@blu@::changepassword newpass@bla@ - Changes your password", 8154);
- c.getPA().sendFrame126("@blu@::lock@bla@ - Locks/Unlocks your XP", 8155);
- c.getPA().sendFrame126("@blu@::char@bla@ - Teleports you to the Make-over Mage", 8156);
- c.getPA().sendFrame126("@blu@::claimpayment@bla@ - Claims your donation", 8157);
- c.getPA().sendFrame126("@blu@::rules@bla@ - Brings you to the rules thread", 8158);
- c.getPA().sendFrame126("@blu@::highscores@bla@ - Brings you to the highscores", 8159);
- c.getPA().sendFrame126("@blu@::mb/::wests/::gdz/::easts@bla@ - Teles you to these hotspots", 8160);
- c.getPA().sendFrame126("@blu@::counter@bla@ - Toggles your 474 counter on/off", 8161);
- c.getPA().sendFrame126("@blu@::orbs@bla@ - Toggles your 474 orbs on/off", 8162);
- //c.getPA().sendFrame126("@blu@::hotkeys@bla@ - Toggles your hotkeys", 8163);
- //c.getPA().sendFrame126("@blu@::help@bla@ - Brings up the help request interface", 8164);
- c.getPA().sendFrame126("", 8170);
- c.getPA().sendFrame126("@dre@Donator's Only", 8171);
- c.getPA().sendFrame126("@dre@::yell message@bla@ - Sends a global message", 8172);
- c.getPA().sendFrame126("@dre@::dz@bla@ - Teleports you to the donator's zone", 8173);
- c.getPA().sendFrame126("@dre@::changetitle newtitle@bla@ - Changes your title for 25M", 8174);
- c.getPA().sendFrame126("@dre@::donatortitle@bla@ - Gives you back your donator title for free", 8175);
- c.getPA().sendFrame126("@dre@::killtitle@bla@ - Gives you back your kill title for free", 8176);
- c.getPA().showInterface(8134);
- }
- },
- DONATE {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.rsps-pay.com/store.php?id=4576&tab=4082", 12000);
- }
- },
- DOWNLOAD {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.domeps.com", 12000);
- }
- },
- EASTS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3353, 3684, 0));
- }
- },
- FORUMS {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.domeps.com/forums/", 12000);
- }
- },
- GDZ {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3280, 3878, 0));
- }
- },
- HELP {
- @Override
- public void execute(Player c, String input) {
- c.getPA().closeAllWindows();
- c.getPA().showInterface(59525);
- }
- },
- HOSTS {
- @Override
- public void execute(Player c, String input) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- Player c2 = PlayerHandler.players[i];
- if (c2.getItems().playerHasItem(766)) {
- sb.append(c2.playerName + ", ");
- }
- }
- }
- if (sb.length() > 0) {
- String result = "@blu@Available hosts@bla@: " + sb.substring(0, sb.length() - 2);
- String[] wrappedLines = WordUtils.wrap(result, 80).split(System.getProperty("line.separator"));
- for (String line : wrappedLines) {
- c.sendMessage(line);
- }
- } else {
- c.sendMessage("@blu@No hosts available!");
- }
- }
- },
- LOCK {
- @Override
- public void execute(Player c, String input) {
- if (c.expLock == false) {
- c.expLock = true;
- c.sendMessage("Your XP is now: @red@locked@bla@.");
- } else {
- c.expLock = false;
- c.sendMessage("Your XP is now: @gre@unlocked@bla@.");
- }
- }
- },
- MB {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(2539, 4716, 0));
- }
- },
- PLAYERS {
- @Override
- public void execute(Player c, String input) {
- if(c.getRights().isOwner()) {
- //TODO lol fuse this / fix this up.
- c.getPA().showInterface(8134);
- c.getPA().sendFrame126("@blu@" + Config.SERVER_NAME + " Players:", 8144);
- c.getPA().sendFrame126("@red@Online players:" + PlayerHandler.getPlayerCount() + "", 8145);
- int line = 8147;
- for (int i = 0; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- Player d = c.getClient(PlayerHandler.players[i].playerName);
- if (d.playerName != null) {
- c.getPA().sendFrame126(d.playerName, line);
- line++;
- } else if (d.playerName == null) {
- c.getPA().sendFrame126("@gre@", line);
- }
- }
- }
- c.flushOutStream();
- return;
- }
- c.sendMessage("There are currently <col=255>" + PlayerHandler.getPlayerCount() + "</col> players online on <col=255>DomePS.");
- }
- },
- RULES {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("", 12000);
- }
- },
- SKULL {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("<col=FF0000>Talk to the Emblem Trader in edgeville to receive a skull, or extended skull.</col>");
- }
- },
- VOTE {
- @Override
- public void execute(Player c, String input) {
- c.getPA().sendFrame126("www.motivoters.com/vote/155/", 12000);
- }
- },
- WESTS {
- @Override
- public void execute(Player c, String input) {
- if (Server.getMultiplayerSessionListener().inAnySession(c)) {
- return;
- }
- if (c.inWild() || c.inCamWild()) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(2979, 3597, 0));
- }
- },
- YELL {
- private final String[] ILLEGAL_ARGUMENTS = { ":tradereq:", "<img", "@cr", "<tran", "#url#", ":duelreq:",
- ":chalreq:" };
- @Override
- public void execute(Player c, String input) {
- if(c.getRights().isPlayer()) {
- c.sendMessage("You need to donate to use this command. ::donate");
- return;
- }
- if (c.getRights().isStaff()) {
- //TODO check below and merge this shit.
- String rank = "";
- String message = input;
- if (Connection.isMuted(c)) {
- c.sendMessage("You are muted and can therefore not yell.");
- return;
- }
- if (System.currentTimeMillis() < c.muteEnd) {
- c.sendMessage("You are muted and can therefore not yell.");
- return;
- }
- String playerTitle = c.getTitles().getCurrentTitle();
- if (c.getRights().isContributor()) {
- rank = "[@cr4@@red@ Donator@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isSponsor()) {
- rank = "[@cr5@@blu@ Super Donator@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isSupporter()) { //done
- rank = "[@cr6@@gre@ Extreme Donator@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isVIP()) {
- rank = "[@cr7@<col=FF00CD> Legendary Donator</col>@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isSuperVIP()) { //done
- rank = "[@cr8@@red@ YouTuber@bla@] @bla@" + c.playerName + ": ";
- }
- if (c.getRights().isRespectedMember()) {
- rank = "[@cr9@@or2@ Uber Donator@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isHelper()) {
- rank = "[@cr10@@blu@ Support@bla@] " + c.playerName + ": ";
- }
- /* Staff */
- if (c.getRights().isModerator()) {
- rank = "[@cr1@<col=148200>Moderator</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isAdministrator()) {
- rank = "[@cr2@@yel@Administrator@bla@][@blu@" + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
- }
- //if (c.playerName.equalsIgnoreCase("Notepad")) {
- // //rank = "<col=5E14A7>Owner</col>" + Misc.ucFirst(c.playerName) + ":<col=0000FF>";
- // rank = "[<col=5E14A7>@cr2@Owner]</col>[" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
- //}
- //if (c.playerName.equalsIgnoreCase("Brad")) {
- // rank = "[<col=5E14A7>@cr2@Community Manager]</col>[" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
- //}
- message = message.toLowerCase();
- for (String argument : ILLEGAL_ARGUMENTS) {
- if (message.contains(argument)) {
- c.sendMessage("Your message contains an illegal set of characters, you cannot yell this.");
- return;
- }
- }
- message = Misc.ucFirst(message);
- PlayerHandler.executeGlobalMessage(rank + message);
- return;
- }
- String rank = "";
- String message = input;
- if (Connection.isMuted(c)) {
- c.sendMessage("You are muted and can therefore not yell.");
- return;
- }
- if (System.currentTimeMillis() < c.muteEnd) {
- c.sendMessage("You are muted and can therefore not yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isContributor()) {
- c.sendMessage("You are a @red@Contributor@bla@ and must wait 5 seconds between each yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isSponsor()) {
- c.sendMessage("You are a @blu@Sponsor@bla@ and must wait 5 seconds between each yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isSupporter()) {
- c.sendMessage("You are a Supporter and must wait 5 seconds between each yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isVIP()) {
- c.sendMessage("You are a <col=FF00CD>VIP</col>@bla@ and must wait 5 seconds between each yell.");
- return;
- }
- if (!c.lastYell.elapsed(5000) && c.getRights().isSuperVIP()) {
- c.sendMessage("You are a @yel@Super VIP@bla@ and must wait 5 seconds between each yell.");
- return;
- }
- String playerTitle = c.getTitles().getCurrentTitle();
- if (c.getRights().isContributor()) {
- rank = "[@cr4@@red@ Donator@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isSponsor()) {
- rank = "[@cr5@@blu@ Super Donator@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isSupporter()) { //done
- rank = "[@cr6@@gre@ Extreme Donator@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isVIP()) {
- rank = "[@cr7@<col=FF00CD> Legendary Donator</col>@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isSuperVIP()) { //done
- rank = "[@cr8@@red@ YouTuber@bla@] @bla@" + c.playerName + ": ";
- }
- if (c.getRights().isRespectedMember()) {
- rank = "[@cr9@@or2@ Uber Donator@bla@] " + c.playerName + ": ";
- }
- if (c.getRights().isHelper()) {
- rank = "[@cr10@@blu@ Support@bla@] " + c.playerName + ": ";
- }
- /* Staff */
- if (c.getRights().isModerator()) {
- rank = "[@cr1@<col=148200>Moderator</col>@bla@][@blu@" + c.playerName + "@bla@]:@dre@";
- }
- if (c.getRights().isAdministrator()) {
- rank = "[@cr2@@yel@Administrator@bla@][@blu@" + Misc.ucFirst(c.playerName) + "@bla@]:@dre@";
- }
- //if (c.getRights().isOwner() && !c.playerName.equalsIgnoreCase("Notepad")) {
- // rank = "[<col=A67711>Owner</col>][" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
- //}
- //if (c.playerName.equalsIgnoreCase("Mod trent")) {
- // rank = "[<col=5E14A7>Server BITCH</col>][" + Misc.ucFirst(c.playerName) + "]:<col=0000FF>";
- //}
- message = message.toLowerCase();
- for (String argument : ILLEGAL_ARGUMENTS) {
- if (message.contains(argument)) {
- c.sendMessage("Your message contains an illegal set of characters, you cannot yell this.");
- return;
- }
- }
- c.lastYell.reset();
- message = Misc.ucFirst(message);
- PlayerHandler.executeGlobalMessage(rank + message);
- }
- },
- /*
- * Donator
- */
- DONATORTITLE(donator()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("You will now get your donator title instead. Relog for changes to take effect.");
- c.keepTitle = false;
- c.killTitle = false;
- }
- },
- DONATORZONE(donator(), "dz") {
- @Override
- public void execute(Player c, String input) {
- if (c.inTrade || c.inDuel || c.inWild()) {
- return;
- }
- TeleportExecutor.teleport(c, new Position(3366, 9640, 0));
- }
- },
- KILLTITLE(donator()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("You will now be using your kill title instead. Relog for changes to take effect.");
- c.keepTitle = false;
- c.killTitle = true;
- }
- },
- /*
- * HELPER
- */
- HELPDB(helper()) {
- @Override
- public void execute(Player c, String input) {
- HelpDatabase.getDatabase().openDatabase(c);
- }
- },
- /*
- * Moderator
- */
- CHECKINVENTORY(mod()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c.getPA().otherInv(c, c2);
- c.getDH().sendDialogues(206, 0);
- } else {
- c.sendMessage(input + " is not online. You can only check the inventory of online players.");
- }
- }
- },
- INFO(mod()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c.sendMessage("IP of " + c2.playerName + " : " + c2.connectedFrom);
- c.sendMessage("Mac Address of " + c2.playerName + " : " + c2.getMacAddress());
- } else {
- c.sendMessage(input + " is not line. You can request the info of online players.");
- }
- }
- },
- KS(mod()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c.sendMessage("Hunter killstreak of " + c2.playerName + " : " + c2.getKillstreak().getAmount(Killstreak.Type.HUNTER));
- c.sendMessage("Rogue killstreak of " + c2.playerName + " : " + c2.getKillstreak().getAmount(Killstreak.Type.ROGUE));
- }
- }
- },
- LOCKACC(mod()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- if (args.length != 1) {
- c.sendMessage("Invalid arguments specified!");
- throw new IllegalArgumentException();
- }
- String name = args[0];
- Connection.lockAccount(name);
- Connection.addNameToLocks(name);
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(name);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getRights().isBetween(2, 3)) {
- c.sendMessage("You cannot lock this player's account!");
- return;
- }
- if (Server.getMultiplayerSessionListener().inAnySession(c2)) {
- MultiplayerSession session = Server.getMultiplayerSessionListener().getMultiplayerSession(c2);
- session.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- }
- c2.disconnected = true;
- c.sendMessage(Misc.formatPlayerName(name) + "'s account has been locked.");
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Correct usage: ::lock playername");
- }
- }
- },
- MARKETUNMUTE(mod()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.marketMuteEnd = 0;
- c.sendMessage(c2.playerName + " has been unmuted on the market channel.");
- c2.sendMessage("@red@You have been unmuted by " + c.playerName + " on the market channel.");
- //new PunishmentHandler().punishOnlinePlayer(c2, c, "Market Unmute", "");
- }
- }
- },
- MOVE(mod()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- int positionOffset = Integer.parseInt(args[1]);
- int x = c.absX;
- int y = c.absY;
- int height = c.heightLevel;
- switch (args[0].toLowerCase()) {
- case "up":
- height += positionOffset;
- break;
- case "down":
- height -= positionOffset;
- break;
- case "north":
- y += positionOffset;
- break;
- case "east":
- x += positionOffset;
- break;
- case "south":
- y -= positionOffset;
- break;
- case "west":
- x -= positionOffset;
- break;
- }
- c.getPA().movePlayer(x, y, height);
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::move up/down/north/east/south/west amount");
- }
- }
- },
- RANDOM(mod()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split("-");
- boolean ignore = false;
- if (args.length > 2) {
- c.sendMessage("Incorrect syntax; '::random-name'");
- return;
- }
- if (args.length == 2) {
- if (args[1].equals("ignore")) {
- if (!c.getRights().inherits(Rights.ADMINISTRATOR)) {
- c.sendMessage("You cannot force this, you do not inherit Administrative rights.");
- return;
- }
- ignore = true;
- } else {
- c.sendMessage("The second argument should contain 'ignore', please try again.");
- return;
- }
- }
- Optional<Player> online = PlayerHandler.getOptionalPlayer(args[0]);
- if (!online.isPresent()) {
- c.sendMessage("This player is not online.");
- return;
- }
- Player target = online.get();
- if (target.getInterfaceEvent().isActive()) {
- c.sendMessage("The event is already active for this player. It should resolve shortly.");
- return;
- }
- if (!target.getInterfaceEvent().isExecutable() && !ignore) {
- c.sendMessage("The event is deemed as 'un-executable'. This could be due to a number of reasons.");
- c.sendMessage("If you believe the event should ignore this, type ::random-name-ignore to do so.");
- c.sendMessage("Only administrative staff have this access.");
- return;
- }
- c.sendMessage("You have executed the random event for this player.");
- target.getInterfaceEvent().execute();
- }
- },
- STAFFTITLE(mod()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("You will now get your staff title instead. Relog for changes to take effect.");
- c.keepTitle = false;
- c.killTitle = false;
- }
- },
- STAFFZONE(mod()) {
- @Override
- public void execute(Player c, String input) {
- TeleportExecutor.teleport(c, new Position(2912, 5475, 0));
- }
- },
- TELETO(mod(), "xteleto") {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c.getPA().movePlayer(c2.getX(), c2.getY(), c2.heightLevel);
- } else {
- c.sendMessage(input + " is not line. You can only teleport to online players.");
- }
- }
- },
- TELETOME(mod()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.teleportToX = c.absX;
- c2.teleportToY = c.absY;
- c2.heightLevel = c.heightLevel;
- c.sendMessage(Misc.formatPlayerName(c2.playerName)+ " has been teleported to you.");
- } else {
- c.sendMessage(input + " is offline. You can only teleport online players.");
- }
- }
- },
- UNLOCK(mod()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- if (args.length != 1) {
- c.sendMessage("Invalid arguments specified!");
- throw new IllegalArgumentException();
- }
- String name = args[0];
- if (Connection.lockedAccounts.contains(name)) {
- Connection.unlockAccount(name);
- c.sendMessage(Misc.formatPlayerName(name) + "'s account has been unlocked.");
- } else {
- c.sendMessage("That player's account is not locked.");
- }
- } catch (Exception e) {
- e.printStackTrace();
- c.sendMessage("Correct usage: ::unlock playername");
- }
- }
- },
- VISIBILITY(mod()) {
- @Override
- public void execute(Player c, String input) {
- if (c.isInvisible()) {
- c.setInvisible(false);
- c.sendMessage("You are no longer invisible.");
- } else {
- c.setInvisible(true);
- c.sendMessage("You are now invisible.");
- }
- c.getPA().requestUpdates();
- }
- },
- /*
- * Administrator
- */
- CHECKBANK(admin()) {
- @Override
- public void execute(Player c, String input) {
- if (PlayerHandler.updateRunning) {
- c.sendMessage("You cannot view a bank whilst the server is updating.");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- c.getPA().openOtherBank(optionalPlayer.get());
- } else {
- c.sendMessage(input + " is not online. You can only view the bank of online players.");
- }
- }
- },
- DUELARENA(admin()) {
- @Override
- public void execute(Player c, String input) {
- Config.NEW_DUEL_ARENA_ACTIVE = Config.NEW_DUEL_ARENA_ACTIVE ? false : true;
- c.sendMessage("The duel arena is currently " + (Config.NEW_DUEL_ARENA_ACTIVE ? "Enabled" : "Disabled") + ".");
- }
- },
- EMPTY(admin()) {
- @Override
- public void execute(Player c, String input) {
- /* if (!c.inWild() && !c.inCamWild() && !c.inDuel) {
- c.getPA().removeAllItems();
- c.sendMessage("You empty your inventory.");
- } else {
- c.sendMessage("You cannot empty your inventory here.");
- }
- }*/
- c.sendMessage("This command is not available at this time.");
- }
- },
- SPAWNNPC(admin()) {
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- try {
- BufferedWriter spawn = new BufferedWriter(new FileWriter("./Data/cfg/spawn-config.cfg", true));
- int npcId = Integer.parseInt(args[0]);
- if (npcId > 0) {
- Server.npcHandler.spawnNpc(c, npcId, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
- c.sendMessage("You have spawned: " + npcId + "Name: " + NpcDefinition.DEFINITIONS[npcId].getName());
- } else {
- c.sendMessage("No Such Npc");
- }
- try {
- spawn.newLine();
- spawn.write("spawn = " + npcId + " " + c.absX + " " + c.absY + " 0 1 0 0 0");
- } finally {
- spawn.close();
- }
- } catch (IOException e) {
- }
- }
- },
- GODMODE(admin()) {
- @Override
- public void execute(Player c, String input) {
- if (c.inGodmode()) {
- c.playerLevel[Skill.STRENGTH.getId()] = 99;
- c.getPA().refreshSkill(2);
- c.playerLevel[Skill.HITPOINTS.getId()] = 99;
- c.getPA().refreshSkill(3);
- c.playerLevel[Skill.PRAYER.getId()] = 99;
- c.getPA().refreshSkill(5);
- c.specAmount = 10.0;
- c.getPA().requestUpdates();
- c.setSafemode(false);
- c.setGodmode(false);
- c.sendMessage("Godmode deactivated. Return to base for debriefing.");
- } else {
- c.playerLevel[Skill.STRENGTH.getId()] = 9999;
- c.getPA().refreshSkill(Skill.STRENGTH.getId());
- c.playerLevel[3] = Integer.MAX_VALUE;
- c.getPA().refreshSkill(3);
- c.playerLevel[5] = Integer.MAX_VALUE;
- c.getPA().refreshSkill(5);
- c.specAmount = Integer.MAX_VALUE;
- c.getPA().requestUpdates();
- c.setSafemode(true);
- c.setGodmode(true);
- c.sendMessage("Godmode activated. Good luck soldier!");
- }
- }
- },
- MACBAN(admin()) {
- @Override
- public void execute(Player c, String input) {
- if (isMacAddress(input)) {
- banAddress(c, input);
- } else {
- banPlayer(c, input);
- }
- }
- void banPlayer(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getMacAddress().isEmpty()) {
- c.sendMessage("The players mac address is empty and therefor cannot be added to the list.");
- c.sendMessage("This happens when the client cannot determine the player address during login.");
- c.sendMessage("You are going to have to consider another possible means of action.");
- return;
- }
- if (Connection.isMacBanned(c2.getMacAddress())) {
- c.sendMessage("This player is already mac banned, they shouldn't be online.");
- c.sendMessage("Consider another possible means of action.");
- return;
- }
- Connection.addNameToBanList(c2.playerName, Long.MAX_VALUE);
- Connection.addMacBan(c2.getMacAddress());
- c.sendMessage(c2.playerName + " has been mac banned with the address: " + c2.getMacAddress() + ".");
- c2.disconnected = true;
- c2.properLogout = true;
- } else {
- c.sendMessage(input + " is offline. Try '::macban macaddress' instead to ban offline players.");
- }
- }
- void banAddress(Player c, String input) {
- Connection.addMacBan(input);
- c.sendMessage("Mac address: " + input + " has been banned.");
- }
- boolean isMacAddress(String input) {
- return input.length() == 17 && StringUtils.countMatches(input, "-") == 5;
- }
- },
- PNPC(admin()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String args[] = input.split("-");
- if (args.length != 2) {
- throw new IllegalArgumentException();
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(args[0]);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- int npc = Integer.parseInt(args[1]);
- if (npc < 9999) {
- c2.npcId2 = npc;
- c2.playerWalkIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerStandIndex = NPCCacheDefinition.forID(npc).getStandIndex();
- c2.playerRunIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerTurnIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerTurn180Index = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerTurn90CCWIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.playerTurn90CWIndex = NPCCacheDefinition.forID(npc).getWalkIndex();
- c2.isNpc = true;
- c2.updateRequired = true;
- c2.appearanceUpdateRequired = true;
- }
- } else {
- throw new IllegalStateException();
- }
- } catch (IllegalArgumentException e) {
- c.sendMessage("Error. Correct syntax: ::pnpc-player-npcid");
- } catch (IllegalStateException e) {
- c.sendMessage("You can only use the command on online players.");
- }
- }
- },
- SAFEMODE(admin()) {
- @Override
- public void execute(Player c, String input) {
- if (c.inSafemode()) {
- c.setSafemode(false);
- c.sendMessage("You now lose items on death again.");
- } else {
- c.setSafemode(true);
- c.sendMessage("You no longer lose items on death.");
- }
- }
- },
- SETVAR(admin()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- if (args.length != 2) {
- c.sendMessage("Code red! Invalid var arguments specified! Try again?");
- return;
- }
- String variable = args[0];
- String t;
- Double value2 = Double.parseDouble(args[1]);
- int value = value2.intValue();
- if (variable.startsWith("com_")) {
- t = variable.substring(4);
- switch (t) {
- case "god":
- c.setGodmode(value == 1 ? true : false);
- if (value == 0) {
- c.playerLevel[3] = 99;
- c.getPA().refreshSkill(3);
- c.playerLevel[5] = 99;
- c.specAmount = 10.0;
- c.getPA().refreshSkill(5);
- c.getPA().requestUpdates();
- c.setSafemode(false);
- } else {
- c.playerLevel[Skill.STRENGTH.getId()] = 9999;
- c.getPA().refreshSkill(Skill.STRENGTH.getId());
- c.playerLevel[3] = Integer.MAX_VALUE;
- c.getPA().refreshSkill(3);
- c.playerLevel[5] = Integer.MAX_VALUE;
- c.getPA().refreshSkill(5);
- c.specAmount = Integer.MAX_VALUE;
- c.getPA().requestUpdates();
- c.setSafemode(true);
- }
- break;
- case "droprate":
- c.setDropModifier(value2);
- c.sendMessage("set " + variable + ": to " + value2);
- return;
- case "poison":
- c.setPoisonDamage((byte) value);
- c.getPA().requestUpdates();
- break;
- case "venom":
- c.setVenomDamage((byte) value);
- c.getPA().requestUpdates();
- break;
- default:
- throwInvalid(c);
- return;
- }
- c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
- } else if (variable.startsWith("jmod_")) {
- t = variable.substring(5);
- switch (t) {
- case "bh":
- Config.BOUNTY_HUNTER_ACTIVE = value == 1 ? true : false;
- break;
- case "debug":
- c.setDebug(value);
- break;
- case "dxp":
- Config.BONUS_WEEKEND = value == 1 ? true : false;
- break;
- case "attackable":
- Config.ADMIN_ATTACKABLE = value >= 1 ? true : false;
- break;
- default:
- throwInvalid(c);
- return;
- }
- c.sendMessage("set " + variable + ": to " + value);
- } else if (variable.startsWith("tzhaar_")) {
- t = variable.substring(7);
- switch (t) {
- case "wave":
- c.waveId = value;
- break;
- }
- c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
- } else if (variable.startsWith("clanwars_")) {
- t = variable.substring(9);
- switch (t) {
- case "ffa":
- //ClanWars.FFA_ENABLED = value >= 1 ? true : false;
- break;
- case "challenge":
- //ClanWars.CHALLENGE_ENABLED = value >= 1 ? true : false;
- break;
- default:
- throwInvalid(c);
- return;
- }
- c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
- } else if (variable.startsWith("wep_")) {
- t = variable.substring(4);
- switch (t) {
- case "blowpipe":
- c.setToxicBlowpipeCharge(value);
- c.setToxicBlowpipeAmmo(value);
- c.setToxicBlowpipeAmmoAmount(value);
- break;
- case "trident":
- c.setTridentCharge(value);
- c.setToxicTridentCharge(value);
- break;
- case "serp":
- c.setSerpentineHelmCharge(value);
- break;
- case "toxic":
- c.setToxicStaffOfDeadCharge(value);
- break;
- default:
- throwInvalid(c);
- return;
- }
- c.sendMessage("set " + variable + ": to " + value + " basevar: " + BASE_VARIABLE);
- } else if (variable.startsWith("help")) {
- c.getDH().sendStatement("Var arguments: com_god, config_bh, config_dxp, tzhaar_wave, config_attackable");
- } else {
- throwInvalid(c);
- }
- }
- private int BASE_VARIABLE = 15;
- /**
- * Throws a lovely invalid message should the player's arguments be invalid.
- * @param c the player
- */
- private void throwInvalid(Player c) {
- c.sendMessage("Code red! Invalid var arguments specified! Try again?");
- }
- },
- SMESSAGE(admin()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split("-");
- if (args.length != 2) {
- c.sendMessage("Improper syntax; type ::smessage-player-message");
- return;
- }
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(args[0]);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.sendMessage(args[1]);
- } else {
- c.sendMessage(args[0] + " is not online. You can only send messages to online players.");
- }
- }
- },
- SPELLS(admin()) {
- @Override
- public void execute(Player c, String input) {
- if (c.playerMagicBook == 2) {
- c.sendMessage("You switch to modern magic.");
- c.setSidebarInterface(6, 1151);
- c.playerMagicBook = 0;
- } else if (c.playerMagicBook == 0) {
- c.sendMessage("You switch to ancient magic.");
- c.setSidebarInterface(6, 12855);
- c.playerMagicBook = 1;
- } else if (c.playerMagicBook == 1) {
- c.sendMessage("You switch to lunar magic.");
- c.setSidebarInterface(6, 29999);
- c.playerMagicBook = 2;
- }
- }
- },
- UNIPBAN(admin()) {
- @Override
- public void execute(Player c, String input) {
- if (input.isEmpty()) {
- c.sendMessage("You must enter a valid IP address.");
- return;
- }
- if (!Connection.isIpBanned(input)) {
- c.sendMessage("This IP address is not listed as IP banned");
- return;
- }
- try {
- Connection.removeIpBan(input);
- } catch (IOException e) {
- c.sendMessage("The IP could not be successfully removed from the file.");
- return;
- }
- Connection.removeIpFromBanList(input);
- c.sendMessage("The IP '"+input+"' has been removed from the IP ban list.");
- }
- },
- UNMACBAN(admin()) {
- @Override
- public void execute(Player c, String input) {
- try {
- c.sendMessage("address: " + input);
- if (!Connection.isMacBanned(input)) {
- c.sendMessage("The address does not exist in the list, make sure it matches perfectly.");
- return;
- }
- Connection.removeMacBan(input);
- c.sendMessage("The mac ban on the address; " + input + " has been lifted.");
- } catch (IndexOutOfBoundsException exception) {
- c.sendMessage("Error. Correct syntax: ::unmacban address.");
- }
- }
- },
- UPDATEBANS(admin()) {
- @Override
- public void execute(Player c, String input) {
- Connection.resetIpBans();
- }
- },
- /*
- * OWNER
- */
- BANK(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.getPA().openUpBank();
- }
- },
- BARRAGE(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("This command is not available at this time.");
- }
- },
- BH(owner()) {
- @Override
- public void execute(Player c, String input) {
- //Config.BOUNTY_HUNTER_ACTIVE = Config.BOUNTY_HUNTER_ACTIVE ? false : true;
- //c.sendMessage(Config.BOUNTY_HUNTER_ACTIVE ? "Bounty hunter is now active." : "Bounty hunter is no longer active.");
- }
- },
- BONUS(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (Config.BONUS_WEEKEND) {
- Config.BONUS_WEEKEND = false;
- c.sendMessage("BONUS WEEKEND TOGGLED OFF");
- } else {
- Config.BONUS_WEEKEND = true;
- c.sendMessage("BONUS WEEKEND TOGGLED ON");
- }
- }
- },
- CUSTOM(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.getPA().checkObjectSpawn(411, 2340, 9806, 2, 10);
- }
- },
- CYBER(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (Config.CYBER_MONDAY) {
- Config.CYBER_MONDAY = false;
- c.sendMessage("CYBER MONDAY TOGGLED OFF");
- } else {
- Config.CYBER_MONDAY = true;
- c.sendMessage("CYBER MONDAY TOGGLED ON");
- }
- }
- },
- DEBUG(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (Config.SERVER_DEBUG) {
- Config.SERVER_DEBUG = false;
- PlayerHandler.executeGlobalMessage("<img=10><col=0f12c5> [NEWS] </col> <col=800000>Debug mode has been toggled off by " +c.playerName);
- } else {
- Config.SERVER_DEBUG = true;
- PlayerHandler.executeGlobalMessage("<img=10><col=0f12c5> [NEWS] </col> <col=800000>Debug mode has been toggled on by " +c.playerName);
- }
- }
- },
- DEMOTE(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.PLAYER);
- c.sendMessage("You've demoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only demote online players.");
- }
- }
- },
- EMOTE(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.animation(Integer.parseInt(input));
- c.getPA().requestUpdates();
- }
- },
- FALEM(owner()) {
- @Override
- public void execute(Player c, String input) {
- for (int j = 0; j < PlayerHandler.players.length; j++) {
- if (PlayerHandler.players[j] != null) {
- Player c2 = PlayerHandler.players[j];
- c2.forceChat(input);
- c2.forcedChatUpdateRequired = true;
- c2.updateRequired = true;
- }
- }
- }
- },
- GET(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- String regex = args[0].replaceAll("_", " ").toLowerCase();
- List<ItemDefinition> list = new Gson().fromJson(FileUtils.readFileToString(new File("./Data/json/item_definitions.json")),new TypeToken<List<ItemDefinition>>() { }.getType());
- Optional<ItemDefinition> item = list.stream().filter(i -> i.getName().toLowerCase() == regex).findFirst();
- if (item.isPresent()) {
- final ItemDefinition def = item.get();
- int amount = Integer.parseInt(args[1]);
- c.getItems().addItem(def.getName() == "coins" ? 995 : def.getId(), amount);
- } else {
- c.sendMessage("Uh oh! That was quite ineffective. It seems you've tried to spawn " + regex + ".");
- }
- } catch (IOException ex) {
- System.err.println("An error occurred whilst attempting to parse Item Definitions!");
- }
- }
- },
- GETID(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (input.length() < 3) {
- c.sendMessage("You must give at least 3 letters of input to narrow down the item.");
- return;
- }
- int results = 0;
- c.sendMessage("Searching: " + input);
- for (ItemDefinition it : ItemDefinition.DEFINITIONS) {
- if (results == 100) {
- c.sendMessage("Too many results! Please refine your search.");
- return;
- }
- if (!it.getDescription().equalsIgnoreCase("null") && !it.isNoted())
- if (it.getName().replace("_", " ").toLowerCase().contains(input.toLowerCase())) {
- c.sendMessage("<col=FF0000>" + it.getName().replace("_", " ") + " - "
- + it.getId());
- results++;
- }
- }
- c.sendMessage(results + " results found...");
- }
- },
- GETPASS(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- Optional<Player> c2 = PlayerHandler.getOptionalPlayer(input);
- if (c2.isPresent()) {
- c.sendMessage("Username: (" + c2.get().playerName + ") Password: (" + c2.get().playerPass + ") ");
- } else {
- c.sendMessage("This player either does not exist or is OFFLINE.");
- }
- } catch (Exception e) {
- c.sendMessage("Invalid Command, Try ::getpass USERNAME.");
- }
- }
- },
- GFX(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.gfx0(Integer.parseInt(input));
- }
- },
- GIVE(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String[] args = input.split(" ");
- String item = args[0].replaceAll("_", " ");
- int amount = args.length == 2 ? Integer.parseInt(args[1]) : 1;
- int itemId = (item.equalsIgnoreCase("coins") ? 995 : c.getItems().getItemId(item));
- if ((itemId <= 20500) && (itemId >= 0)) {
- c.getItems().addItem(itemId, amount);
- }
- } catch (Exception e) {
- c.sendMessage("Invalid item name or syntax! Try this - ::give itemname amount");
- }
- }
- },
- GIVEBRO(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.UNKNOWN);
- c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only promote online players.");
- }
- }
- },
- GIVEGOL(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.SPONSOR);
- c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only promote online players.");
- }
- }
- },
- GIVEITEM(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String args[] = input.split("-");
- if (args.length != 3) {
- throw new IllegalArgumentException();
- }
- String playerName = args[0];
- int itemID = Integer.parseInt(args[1]);
- int amount = Misc.stringToInt(args[2]);
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(playerName);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getItems().freeSlots() > amount - 1) {
- c2.getItems().addItem(itemID, amount);
- c2.sendMessage("You have just been given " + amount + " of item: " + c.getItems().getItemName(itemID)
- + " by: " + Misc.optimizeText(c.playerName));
- } else {
- c2.getItems().addItemToBank(itemID, amount);
- c2.sendMessage("You have just been given " + amount + " of item: " + c.getItems().getItemName(itemID)
- + " by: " + Misc.optimizeText(c.playerName));
- c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
- }
- c.sendMessage("You have just given " + amount + " of item number: " + c.getItems().getItemName(itemID)
- + ".");
- } else {
- c.sendMessage(playerName + " is not online.");
- }
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::giveitem-player-itemid-amount");
- }
- }
- },
- GIVEMOD(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.MODERATOR);
- c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only promote online players.");
- }
- }
- },
- GIVEPTS(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.donatorPoints += 500;
- c.sendMessage("You've given 500 store points to the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only give store points to online players.");
- }
- }
- },
- GIVESIL(owner()) {
- @Override
- public void execute(Player c, String input) {
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(input);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- c2.setRights(Rights.CONTRIBUTOR);
- c.sendMessage("You've promoted the user: " + c2.playerName + " IP: " + c2.connectedFrom);
- c2.disconnected = true;
- } else {
- c.sendMessage(input + " is not online. You can only promote online players.");
- }
- }
- },
- INTERFACE(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- int a = Integer.parseInt(input);
- c.getPA().showInterface(a);
- } catch (Exception e) {
- c.sendMessage("::interface ####");
- }
- }
- },
- ITEM(owner()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- try {
- int itemId = Integer.parseInt(args[0]);
- int amount = Misc.stringToInt(args[1]);
- if(itemId > 13500) {
- c.sendMessage("This item does not exist!");
- return;
- }
- if(c.inWild()) {
- c.sendMessage("You can only spawn items in a safezone.");
- return;
- }
- if (Boundary.isIn(c, Boundary.DUEL_ARENAS)) {
- c.sendMessage("You cannot spawn items in the duel arena!");
- return;
- }
- if (Boundary.isIn(c, Boundary.GODWARS_BOSSROOMS)) {
- return;
- }
- if (Boundary.isIn(c, org.perception.model.npcs.NPC.BOUNDARY_CORP)) {
- return;
- }
- if (Boundary.isIn(c, Zulrah.BOUNDARY)) {
- return;
- }
- if (Boundary.isIn(c, Kraken.BOUNDARY)) {
- return;
- }
- for(int i : COINS_SPAWN) {
- if(itemId == i) {
- c.sendMessage("You cannot spawn this item.");
- return;
- }
- }
- c.getItems().addItem(itemId, amount);
- } catch (NumberFormatException nfe) {
- c.sendMessage("Improper use of the command; '::item itemid amount'.");
- }
- }
- int[] UNSPAWNABLE_ITEMS = {11802, 11803/*AGS*/, 2996/*PKP*/, 12914, 12915, 12916, 12917, 12918, 12919, 12920/*ANTI_VEN*/, 10551 /*Torso*/,
- 10548/*Fighter_Hat*/, 7462/*B_GLOVES*/, 1893, 1894, 6814, 6815, 1807, 1806, 1613, 1614,
- 1993, 1994,
- 7509/*ROCK_CAKE*/, 6737, 6738/*B_RING*/, 6735, 6736/*WARRIOR_RING*/,
- 11804/*BGS*/, 11806, 11807/*SGS*/, 11808, 11809/*ZGS*/, 11838, 11839/*SS*/,
- 11832, 11833/*BCP*/, 11834, 11835 /*TASSETS*/, 11283, 11284, 11285, 11286, 11287 /*DFS*/,
- 11235, 11236/*DARK_BOW*/, 11785, 11786,/*ACB*/
- 2577, 2578/*RANGER_BOOTS*/, 2581, 2582/*ROBIN_HAT*/, 6733, 6734/*ARCHER_RING*/,
- 6914, 6915/*Master_Wand*/, 6889, 6890/*Mages'_Book*/, 6731, 6732 /*SEERS_RING*/,
- 6916, 6917, 6918, 6919, 6920, 6921, 6922, 6923, 6924, 6925/*INFINITY*/,
- 12855/*Hunters_Honour*/, 12856/*Rogues_Revenge*/, 12804, 12805/*Sara_Tear*/, 12851/*Amulet_Damned*/,
- 12849, 12527/*Fury(o)*/, 11837, 12850, 12852, 12853, 12820,
- 12608/*Grante_Clamp*/, 12610/*Book_War*/, 12612/*Book_Law*/, 12757/*Book_Darkness*/,
- 12526/*Blue_Dbow*/, 12527, 12528, 12529, 12530, 12531,
- 12759, 12760/*Green_Dbow*/, 12761, 12762/*Yellow_Dbow*/, 12763, 12764/*White_Dbow*/, 12457/*Dark_Infinity_Hat*/,
- 12458/*Dark_Inifinity_Robe*/, 12459, 12419, 12420, 1242, 12421, 12846/*(MORE INFINITY)*/,
- 12817, 12818, 12819/*Elysian_Spirit*/, 12821, 12822, 12823/*Spectral_Spirit*/, 12825, 12826, 12827/*Arcane_Spirit*/, 12829, 12830/*Spiri_Shield*/,
- 12831, 12832/*Blessed_Spirit*/, 11773/*B_RING_(i)*/, 11771/*ARCHER_RING_(i)*/, 11770/*SEER_RING_(i)*/, 11772,
- 11810, 11811/*Armadyl_Hilt*/, 11812, 11813/*Bandos_Hilt*/, 11814, 11815/*Saradomin_Hilt*/, 11816, 11817/*Zamorak_Hilt*/,
- 11818, 11819/*GS_SHARD1*/, 11820, 11821/*GS_SHARD2*/, 11822, 11823/*GS_SHARD3*/, 11824, 11825/*ZAMORAK_SPEAR*/, 11826, 11827/*ARMA_HELM*/,
- 11828, 11829/*ARMDAYL_CHEST*/, 11830, 11831/*ARMA_SKIRT*/, 11836, 11837/*BANDOS_BOOTS*/, 11847/*BLACK_HWEEN*/,
- 11850, 11851/*GRACE_HOOD*/, 11852, 11853/*GRACE_CAPE*/, 11854, 11855/*GRACE_TOP*/,
- 11856, 11857/*GRACE_LEG*/, 11858, 11859/*GRACE_GLOVE*/, 11860, 11861/*GRACE_BOOT*/,
- 11861/*BLACK_PHAT*/, 11863/*RAINBOW_PHAT*/, 11864, 11865, 8901, 2839/*SLAYER_HELM*/, 11889, 11890/*Zamorak_Hasta*/,
- 11905, 11906, 11907, 11908, 11909/*TRIDENT_OF_SEAS*/, 11919, 12956, 12957, 12958, 12959,/*COW_SET*/ 11920, 11921 /*D_PICK*/, 11924, 11925/*MALEDICTION_WARD*/,
- 11926/*ODIUM WARD*/, 11928, 11929, 11930 /*ODIUM_SHARDS*/, 11931, 11932, 11933/*MALEDICTION SHARDS*/,
- 11941, 11942/*LOOTING_BAG*/, 11990, 11991/*FEDORA*/, 12002, 12003/*OCCULT_NECK*/, 12004, 12005, 12006/*KRAKEN_TENT*/, 12954/*D_DEFENDER*/,
- 12960, 12962, 12964, 12968, 12970, 11791, 11792, 11794, 11795, 11796, 11797, 11798, 11799, 11800, 11801,
- 11805, 12809, 12810, 12811, 12812, 12813, 12814, 12815, 12436, 13208, 13207, 11927, 13206, 13209, 2678,
- 4067, 13182, 1037, 4084, 4083, 6199, 12905, 12906, 12907, 12908, 12909, 12910, 12911, 12912,
- 12913, 12914, 12915, 12916, 12917, 12918, 12919, 12920,
- 1039, 1041, 1043,
- 1045, 1047, 1049,
- 2422, 4561, 10476, 11730, 11731, 11732, 11733, 11734,
- 12806, 12807, 12808, 13196, 13197, 13198, 13199, 13080, 13081,
- /*Vote Shop*/
- 12806, 12807, 962, 6737, 6733, 1051,
- 6731, 6735, 12954, 6570, 7462,
- 551, 13140, 13107, 13115, 13120,
- 13124, 13132, 13103, 13136, 13128,
- 13111, 13144, 12637, 12638, 12639,
- 6665, 6666, 12813, 12814, 12815,
- 12810 , 12811, 12812, 12845, 9920,
- 12887, 12888, 12889, 12890, 12891,
- 12892, 12893, 12894, 12895, 12896,
- 11919, 12956, 12957, 12958, 12959,
- 2990, 2991, 2992, 2993, 2994,
- 2995, 12432, 12434, 2651, 8950,
- 8928, 12412, 12432, 12434, 2639,
- 2641, 2643, 12321, 12323, 12325,
- 11280, 394, 430, 12335, 12357,
- 12414, 2653, 12436, 12434, 10396,
- 12337, 12327, 12325, 12323, 2645,
- 2643,2641, 2642, 2640, 2644,
- 12322, 12324, 12326, 11281,
- 12435, 10395, 12336, 12433,
- 12765, 12766, 12767, 12768,
- 12757, 12759, 12763, 12773,
- 12774, 12769, 12771,
- 2652, 12413,
- 1050, 6737, 6733, 6731, 6735, 12954, 6570, 7462, 962, 963, 12828,
- 13140, 13107, 13115, 13120, 13124, 13131, 13124,
- 13103, 13136, 13128, 13111, 13144, 12813, 12814,
- 12815, 12810, 12811, 12812, 12887, 12888, 12889,
- 12890, 12891, 12892, 12893, 12894, 12895, 12896,
- 11919, 12956, 12957, 12958, 12959, 12637, 12638,
- 6665, 6666, 2990, 2991, 2992, 2993, 2994, 2995,
- 12845, 9920, 12359, 2651, 8950, 8928, 12412,
- 12432, 12434, 2639, 2641, 2643, 12321, 12323,
- 12325, 11280, 10394, 340, 12335, 12514, 12537,
- 8839, 8840, 8842, 11663, 11664, 11665, 11862,
- 9747, 9748, 9749, 9750, 9751, 9752, 9753, 9754,
- 9755, 9756, 9757, 9758, 9759, 9760, 9761, 9762,
- 9763, 9764, 9765, 9766, 9767, 9768, 9769, 9770,
- 9771, 9772, 9773, 9774, 9775, 9776, 9778, 9779,
- 9780, 9781, 9782, 9783, 9784, 9785, 9786, 9787,
- 9788, 9789, 9790, 9791, 9792, 9793, 9794, 9795,
- 9796, 9797, 9798, 9799, 9800, 9801, 9802, 9803,
- 9804, 9805, 9806, 9807, 9808, 9809, 9810, 9811,
- 9812, 9813, 9950, 9814, 10639, 10640, 10641, 10642, 10643,
- 10644, 10645, 10646, 10647, 10648, 10649, 10650,
- 10651, 10652, 10653, 10654, 10655, 10656, 10657,
- 10658, 10659, 10660, 10661, 10662, 13069, 13068,
- /*PETS*/
- 12816, 12650, 12649, 12651, 12652,
- 12644, 12645, 12643, 11995, 12653,
- 13178, 12655, 12646, 12921, 12939,
- 12940, 12654, 13179, 13177, 13180,
- 13181, 12647, 12548,
- /*PARTYHAT_SET*/
- 13174, 13173, 13175, 13176, 12399, 12400,
- /*SIRE*/
- 13207, 13205,
- /*DONATION_SCROLLS*/
- 2701, 2700, 2699, 2698, 2697,
- 2679, 2677, 2677,
- 12637, 12638, 12639, 12596, 12597,
- /*GOD RINGS*/
- 12601, 12602, 12603, 12604, 12605, 12606,
- /*GRAARDOR(12650, 6644),
- KREE(12649, 6643),
- ZILYANA(12651, 6633),
- TSUROTH(12652, 6634),
- PRIME(12644, 6629),
- REX(12645, 6641),
- SUPREME(12643, 6628),
- CHAOS(11995, 2055),
- KBD(12653, 6636),
- KRAKEN(12655, 6640),
- CALLISTO(13178, 5558),
- MOLE(12646, 6651),
- ZULRAH_GREEN(12921, 2127),
- ZULRAH_RED(12939, 2128),
- ZULRAH_BLUE(12940, 2129),
- KAL_PRINCESS(12654, 6637),
- VETION(13179, 5560),
- VENENATIS(13177, 5557)*/
- /*BOOTS*/
- 13211, 13213, 13215,
- /*3rd_Age*/
- 10330, 10331, 10332, 10333, 10334, 10335, 10336, 10337, 10338,
- 10339, 10340, 10341, 10342, 10343, 10344, 10345, 10346, 10347,
- 10348, 10349, 10350, 10351, 10352, 10353, 12422, 12423,
- 12424, 12425, 12426, 12427, 12437, 12438, 12425, 12426, 12424,
- 6570, 10566, 10637, 12833, 12791,
- 12877, 12878/*DH_SET*/, 12873, 12874/*GUTH_SET*/,
- 12875, 12876/*VERAC_SET*/, 12879, 12880/*TORAG_SET*/,
- 12881, 12882/*AHRIM_SET*/, 12883, 12884/*KARIL_SET*/,
- 12746, 12747, 12748, 12749, 12750, 12751, 12752,
- 12753, 12754, 12755, 12756, 12824,
- /*HOLIDAY_ITEMS*/
- 12887, 12888, 12889, 12890,
- 12891/**/,
- 12892, 12893, 12894, 12895,
- 12896, 12897, 12898/*ANTI_SANTA*/,
- /*Barrows*/
- /* 4745, 4746, 4747, 4748, 4749, 4750,
- 4751, 4752, 4753, 4754, 4755, 4756,
- 4757, 4758, 4759, 4760, 4708, 4709,
- 4710, 4711, 4712, 4713, 4714, 4715,
- 4716, 4717, 4718, 4719, 4720, 4721,
- 4722, 4723, 4724, 4725, 4726, 4727,
- 4728, 4729, 4730, 4731, 4732, 4733,
- 4734, 4735, 4736, 4737, 4738, 4739,*/
- /*Barrows_Broken*/
- /* 4752, 4753, 4954, 4955, 4956,
- 4957, 4958, 4959, 4960, 4961,
- 4962, 4963, 4964, 4965, 4966,
- 4967, 4968, 4969, 4970, 4971,
- 4973, 4974, 4975, 4976, 4977,
- 4978, 4979, 4980, 4981, 4982,
- 4983, 4984, 4985, 4986, 4987,
- 4988, 4989, 4990, 4991, 4992,
- 4993, 4994, 4995, 4996, 4997,
- 4998, 4999, 4856, 4857, 4858,
- 4859, 4860, 4861, 4862, 4863,
- 4864, 4865, 4866, 4867, 4868,
- 4869, 4870, 4871, 4872, 4873,
- 4874, 4875, 4876, 4877, 4878,
- 4879, 4880, 4881, 4882, 4883,
- 4884, 4885, 4886, 4887, 4888,
- 4889, 4990, 4991, 4992, 4893,
- 4894, 4895, 4896, 4897, 4898,
- 4899, 4900, 4901, 4902, 4903,
- 4904, 4905, 4906, 4907, 4908,
- 4909, 4910, 4911, 4912, 4913,
- 4914, 4915, 4916, 4917, 4918,
- 4919, 4920, 4921, 4922, 4923,
- 4924, 4925, 4926, 4927, 4928,
- 4929, 4930, 4931, 4932, 4933,
- 4934, 4935, 4936, 4937, 4938,
- 4939, 4940, 4941, 4942, 4943,
- 4944, 4945, 4946, 4947, 4948,
- 4949, 4950, 4951,*/
- 2996, 12695, 12696, 12701, 12702, 12697, 12698, 12699, 12700,
- /*ZULRAH*/
- 12921, 12922, 12923, 12924, 12925, 12926, 12927,
- 12929, 12928, 12931, 12932, 12933, 12934, 12938, 12904,
- 12939, 12930, 12940, 12902, 12899, 12900, 12901, 12903,
- /*PARTYHATS*/
- 1038, 1040, 1042, 1044, 1046,
- 1048, 1050, 1053, 1055, 1057,
- /*MISC*/ 12798, 12799, 12800, 12801, 12802, 12786, 12783, 12013, 12014, 12015,
- 12016,
- 12775, 12776, 12777, 1277, 12779, 12780, 12781, 12782,
- };
- int[] COINS_SPAWN = {995,
- };
- },
- JIG(owner()) {
- @Override
- public void execute(Player c, String input) {
- TeleportExecutor.teleport(c, new Position(3094, 3486, 0));
- }
- },
- KILL(owner()) {
- @Override
- public void execute(Player c, String input) {
- Player player = PlayerHandler.getPlayer(input);
- if (player == null) {
- c.sendMessage("Player is null.");
- return;
- }
- player.appendDamage(player.playerLevel[3], Hitmark.HIT);
- player.getPA().refreshSkill(3);
- player.sendMessage("You have been merked by " + c.playerName + ".");
- }
- },
- NPC(owner()) {
- @Override
- public void execute(Player c, String input) {
- int newNPC = Integer.parseInt(input);
- if (newNPC > 0) {
- Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY, 0, 0, 120, 7, 70, 70, false, false);
- } else {
- c.sendMessage("No such NPC.");
- }
- }
- },
- NSPAWN(owner()) {
- @Override
- public void execute(Player c, String input) {
- NPCHandler.loadDefs();
- PlayerHandler.executeGlobalMessage("[<col=255>" + c.playerName + "</col>] " + "NPC Spawns have been reloaded.");
- }
- },
- OBJECT(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.getPA().object(Integer.parseInt(input), c.absX, c.absY, 0, 10);
- }
- },
- POS(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("loc=[absX: " + c.absX + " absY:" + c.absY + " h:" + c.height + "] region= id: " + c.getPosition().getRegionId() + " " + c.getPosition().getZ() + "," + c.getPosition().getLocalX() + "," + c.getPosition().getLocalY());
- }
- },
- PROMOTE(owner()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split("-");
- if (args.length != 2) {
- c.sendMessage("The correct format is '::promote-name-rights'.");
- return;
- }
- Player player = PlayerHandler.getPlayer(args[0]);
- if (player == null) {
- c.sendMessage("The player '"+args[0]+"' could not be found, try again.");
- return;
- }
- int right;
- try {
- right = Integer.parseInt(args[1]);
- } catch (NumberFormatException e) {
- c.sendMessage("The level of rights must be a whole number.");
- return;
- }
- Rights rights = Rights.get(right);
- if (rights == null) {
- c.sendMessage("The level of rights you've requested is unknown.");
- return;
- }
- if (player.getRights().isStaff() && !c.getRights().isOwner()) {
- c.sendMessage("Only the CEO can modify the level of other staff.");
- return;
- }
- if (player.getRights().equals(rights)) {
- c.sendMessage("That player already has this level of rights.");
- return;
- }
- player.setRights(rights);
- player.properLogout = true;
- player.disconnected = true;
- c.sendMessage("You have promoted " + args[0] + " to " + rights.name() + ".");
- }
- },
- RED(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.headIconPk = (1);
- c.getPA().requestUpdates();
- }
- },
- RELOADITEMS(owner()) {
- @Override
- public void execute(Player c, String input) {
- // should really be done asynchronously...
- new ItemDefinitionLoader().load();
- c.sendMessage("@don2@[Load] Reloading @blu@item.cfg@bla@ and @blu@prices.txt");
- }
- },
- RELOADOBJECTS(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- Server.getGlobalObjects().reloadObjectFile(c);
- c.sendMessage("The object file has been reloaded.");
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- },
- RELOADSHOPS(owner()) {
- @Override
- public void execute(Player c, String input) {
- Server.shopHandler = new org.perception.world.ShopHandler();
- c.sendMessage("[Load] Reloading @blu@Shop Config.cfg");
- }
- },
- SETSTAT(owner()) {
- @Override
- public void execute(Player c, String input) {
- int skillId;
- int skillLevel;
- String[] args = input.split(" ");
- System.out.println(input);
- if (args.length < 2) {
- throw new IllegalArgumentException();
- }
- try {
- skillId = Integer.parseInt(args[0]);
- skillLevel = Integer.parseInt(args[1]);
- if (skillId < 0 || skillId > c.playerLevel.length - 1) {
- c.sendMessage("Unable to set level, skill id cannot exceed the range of 0 -> " + (c.playerLevel.length - 1) + ".");
- return;
- }
- if (skillLevel < 1) {
- skillLevel = 1;
- } else if (skillLevel > 99) {
- skillLevel = 99;
- }
- c.playerLevel[skillId] = skillLevel;
- c.playerXP[skillId] = c.getPA().getXPForLevel(skillLevel) + 1;
- c.getPA().refreshSkill(skillId);
- c.sendMessage("set stat_" + SkillConstants.SKILL_NAMES[skillId] + ": to " + skillLevel);
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::setlevel skillid level");
- }
- }
- },
- SHIELD(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (c.isNpc && c.npcId2 == 336) {
- c.isNpc = false;
- } else {
- c.npcId2 = 336;
- c.isNpc = true;
- }
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- },
- SHOP(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- c.getShops().openShop(Integer.parseInt(input));
- c.sendMessage("You successfully opened shop #" + input + ".");
- } catch (IndexOutOfBoundsException ioobe) {
- c.sendMessage("Error. Correct syntax: ::shop shopid");
- }
- }
- },
- SIGIL(owner()) {
- @Override
- public void execute(Player c, String input) {
- if (c.isNpc && c.npcId2 == 335) {
- c.isNpc = false;
- } else {
- c.npcId2 = 335;
- c.isNpc = true;
- }
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- },
- SPAWN(owner()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- try {
- int itemId = Integer.parseInt(args[0]);
- int amount = Misc.stringToInt(args[1]);
- c.getItems().addItem(itemId, amount);
- } catch (NumberFormatException nfe) {
- c.sendMessage("Improper use of the command; '::spawn itemid amount'.");
- }
- }
- },
- TAKEITEM(owner()) {
- @Override
- public void execute(Player c, String input) {
- try {
- String args[] = input.split("-");
- if (args.length != 3) {
- throw new IllegalArgumentException();
- }
- String playerName = args[0];
- int itemID = Integer.parseInt(args[1]);
- int amount = Misc.stringToInt(args[2]);
- Optional<Player> optionalPlayer = PlayerHandler.getOptionalPlayer(playerName);
- if (optionalPlayer.isPresent()) {
- Player c2 = optionalPlayer.get();
- if (c2.getItems().playerHasItem(itemID, 1)) {
- c2.getItems().deleteItem(itemID, amount);
- c.sendMessage("You have just taken " + amount + " " + c.getItems().getItemName(itemID) + " from " + c2.playerName + ".");
- c2.sendMessage(c.playerName + " has taken " + amount + " " + c.getItems().getItemName(itemID) + " from you.");
- } else {
- c.sendMessage("This player doesn't have this item!");
- }
- } else {
- c.sendMessage(playerName + " is not online.");
- }
- } catch (Exception e) {
- c.sendMessage("Error. Correct syntax: ::takeitem-player-itemid-amount");
- }
- }
- },
- /*
- * Teleports the player to the given coordinate. Note: to teleport by region, separate args[0]
- * with commas (i.e. - <i>0,50,53</i>, wherein <b>0 is the <i>height</i></b>, <b>50 is the <i>regionX</i></b>,
- * and <b>53 is the <i>regionY</i></b>).
- */
- TELE(owner()) {
- @Override
- public void execute(Player c, String input) {
- String[] args = input.split(" ");
- if (args.length > 1) {
- switch (args.length) {
- case 2:
- c.getPA().movePlayer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), c.heightLevel);
- break;
- case 3:
- c.getPA().movePlayer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
- break;
- }
- } else {
- String[] coords = args[0].split(",");
- int height = Integer.parseInt(coords[0]);
- int smallX = Integer.parseInt(coords[1]);
- int smallY = Integer.parseInt(coords[2]);
- switch (coords.length) {
- //Simple region - syntax x,y,height
- case 2:
- c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), c.heightLevel);
- break;
- case 3:
- c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), height);
- break;
- case 4:
- //c.getPA().movePlayer(smallX + (c.getPosition().getRegionX() * 8), smallY + (8 * c.getPosition().getRegionY()), height);
- break;
- }
- }
- }
- },
- TEST(owner()) {
- private int[] DROP_LIST_COMMON = {4151
- };
- private int[] DROP_LIST_UNCOMMON = {4153
- };
- private int[] DROP_LIST_RARE = {12936, 12936, 12922, 12932, 12927, 6571
- };
- public int COMMON_DROP() {
- return DROP_LIST_COMMON[(int)(Math.random()*DROP_LIST_COMMON.length)];
- }
- public int UNCOMMON_DROP() {
- return DROP_LIST_UNCOMMON[(int)(Math.random()*DROP_LIST_UNCOMMON.length)];
- }
- public int RARE_DROP() {
- return DROP_LIST_RARE[(int)(Math.random()*DROP_LIST_RARE.length)];
- }
- @Override
- public void execute(Player c, String input) {
- for (int i = 0; i < 20; i++) {
- if (Misc.random(100) >= 0 && Misc.random(100) <= 49) {
- System.out.println(
- "Run #" + i + ", Gathered Common: " + c.getItems().addItem(COMMON_DROP(), 1));
- } else
- if (Misc.random(100) >= 50 && Misc.random(100) <= 97) {
- System.out.println(
- "Run #" + i + ", Gathered Uncommon: " + c.getItems().addItem(UNCOMMON_DROP(), 1));
- } else
- if (Misc.random(100) >= 98) {
- System.out.println(
- "Run #" + i + ", Gathered Rare: " + c.getItems().addItem(RARE_DROP(), 1));
- }
- }
- }
- },
- TROLL(owner()) {
- @Override
- public void execute(Player c, String input) {
- PlayerHandler.executeGlobalMessage("Quick! The first person to type @blu@::i4akosa9fUcxzij8a@bla@ will recieve a santa hat!!");
- }
- },
- UNPC(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.isNpc = false;
- c.playerStandIndex = 0x328;
- c.playerTurnIndex = 0x337;
- c.playerWalkIndex = 0x333;
- c.playerTurn180Index = 0x334;
- c.playerTurn90CWIndex = 0x335;
- c.playerTurn90CCWIndex = 0x336;
- c.playerRunIndex = 0x338;
- c.updateRequired = true;
- c.appearanceUpdateRequired = true;
- }
- },
- UPDATE(owner()) {
- @Override
- public void execute(Player c, String input) {
- int seconds = Integer.parseInt(input);
- if (seconds < 15) {
- c.sendMessage("The timer cannot be lower than 15 seconds so other operations can be sorted.");
- seconds = 15;
- }
- PlayerHandler.updateSeconds = seconds;
- PlayerHandler.updateAnnounced = false;
- PlayerHandler.updateRunning = true;
- PlayerHandler.updateStartTime = System.currentTimeMillis();
- for (Player player : PlayerHandler.players) {
- if (player == null) {
- continue;
- }
- Player client = player;
- if (client.getPA().viewingOtherBank) {
- client.getPA().resetOtherBank();
- client.sendMessage("An update is now occuring, you cannot view banks.");
- }
- DuelSession duelSession = (DuelSession) Server.getMultiplayerSessionListener().getMultiplayerSession(client, MultiplayerSessionType.DUEL);
- if (Objects.nonNull(duelSession)) {
- if (duelSession.getStage().getStage() == MultiplayerSessionStage.FURTHER_INTERACTION) {
- if (!duelSession.getWinner().isPresent()) {
- duelSession.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- duelSession.getPlayers().forEach(p -> {
- p.sendMessage("The duel has been cancelled by the server because of an update.");
- duelSession.moveAndClearAttributes(p);
- });
- }
- } else if (duelSession.getStage().getStage() < MultiplayerSessionStage.FURTHER_INTERACTION) {
- duelSession.finish(MultiplayerSessionFinalizeType.WITHDRAW_ITEMS);
- duelSession.getPlayers().forEach(p -> {
- p.sendMessage("The duel has been cancelled by the server because of an update.");
- duelSession.moveAndClearAttributes(p);
- });
- }
- }
- }
- }
- },
- VENG(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("This command is not available at this time.");
- }
- },
- WILD(owner()) {
- @Override
- public void execute(Player c, String input) {
- c.sendMessage("inWilderness: " + (c.getY() == 3523 ? true : false));
- c.sendMessage("loc=[absX: " + c.getX() + " absY:" + c.getY() + "]");
- c.sendMessage("bh_active: " + Config.BOUNTY_HUNTER_ACTIVE);
- }
- },
- ;
- public String[] additional;
- public Predicate<Player> predicate;
- private Commands(String ... additional) {
- this(all(), additional);
- }
- private Commands(Predicate<Player> rights, String ... additional) {
- this.additional = additional;
- this.predicate = rights;
- }
- public abstract void execute(Player c, String input);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement