mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 00:32:06 +00:00
Mousewheel camera and shift drop
This commit is contained in:
@@ -1153,7 +1153,12 @@ public class Game extends RSApplet {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (class9_1.usableItemInterface) {
|
if (class9_1.usableItemInterface) {
|
||||||
menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
|
if (shiftDown)
|
||||||
|
{
|
||||||
|
menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
|
||||||
|
} else {
|
||||||
|
menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
|
||||||
|
}
|
||||||
menuActionID[menuActionRow] = 447;
|
menuActionID[menuActionRow] = 447;
|
||||||
menuActionCmd1[menuActionRow] = itemDef.id;
|
menuActionCmd1[menuActionRow] = itemDef.id;
|
||||||
menuActionCmd2[menuActionRow] = k2;
|
menuActionCmd2[menuActionRow] = k2;
|
||||||
@@ -4193,6 +4198,12 @@ public class Game extends RSApplet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (l == 447) {
|
if (l == 447) {
|
||||||
|
if (shiftDown)
|
||||||
|
{
|
||||||
|
doAction(2); //Drop?
|
||||||
|
needDrawTabArea = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
itemSelected = 1;
|
itemSelected = 1;
|
||||||
anInt1283 = j;
|
anInt1283 = j;
|
||||||
anInt1284 = k;
|
anInt1284 = k;
|
||||||
@@ -9000,6 +9011,7 @@ public class Game extends RSApplet {
|
|||||||
if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
|
if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String s;
|
String s;
|
||||||
if (itemSelected == 1 && menuActionRow < 2) {
|
if (itemSelected == 1 && menuActionRow < 2) {
|
||||||
s = "Use " + selectedItemName + " with...";
|
s = "Use " + selectedItemName + " with...";
|
||||||
@@ -12119,4 +12131,11 @@ public class Game extends RSApplet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mouseWheelDragged(int i, int j) {
|
||||||
|
if (!mouseWheelDown)
|
||||||
|
return;
|
||||||
|
this.anInt1186 += i * 3;
|
||||||
|
this.anInt1187 += (j << 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,9 @@
|
|||||||
// Jad home page: http://www.kpdus.com/jad.html
|
// Jad home page: http://www.kpdus.com/jad.html
|
||||||
// Decompiler options: packimports(3)
|
// Decompiler options: packimports(3)
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
import java.applet.Applet;
|
import java.applet.Applet;
|
||||||
import java.awt.Color;
|
import java.awt.*;
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.FontMetrics;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
@@ -21,6 +18,12 @@ import java.awt.event.WindowListener;
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class RSApplet extends Applet implements Runnable, MouseListener, MouseMotionListener, KeyListener, FocusListener, WindowListener {
|
public class RSApplet extends Applet implements Runnable, MouseListener, MouseMotionListener, KeyListener, FocusListener, WindowListener {
|
||||||
|
|
||||||
|
public static boolean ctrlDown = false;
|
||||||
|
public static boolean shiftDown = false;
|
||||||
|
private int mouseWheelX = 0;
|
||||||
|
private int mouseWheelY = 0;
|
||||||
|
public static boolean removeShiftDropOnMenuOpen;
|
||||||
|
|
||||||
final void createClientFrame(int i, int j) {
|
final void createClientFrame(int i, int j) {
|
||||||
myWidth = j;
|
myWidth = j;
|
||||||
myHeight = i;
|
myHeight = i;
|
||||||
@@ -203,6 +206,8 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo
|
|||||||
raiseWelcomeScreen();
|
raiseWelcomeScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean mouseWheelDown;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void mousePressed(MouseEvent mouseevent) {
|
public final void mousePressed(MouseEvent mouseevent) {
|
||||||
int i = mouseevent.getX();
|
int i = mouseevent.getX();
|
||||||
@@ -215,6 +220,13 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo
|
|||||||
clickX = i;
|
clickX = i;
|
||||||
clickY = j;
|
clickY = j;
|
||||||
clickTime = System.currentTimeMillis();
|
clickTime = System.currentTimeMillis();
|
||||||
|
if (mouseevent.getButton() == 2) {
|
||||||
|
mouseWheelDown = true;
|
||||||
|
mouseWheelX = mouseevent.getX();
|
||||||
|
mouseWheelY = mouseevent.getY();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mouseevent.isMetaDown()) {
|
if (mouseevent.isMetaDown()) {
|
||||||
clickMode1 = 2;
|
clickMode1 = 2;
|
||||||
clickMode2 = 2;
|
clickMode2 = 2;
|
||||||
@@ -222,12 +234,14 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo
|
|||||||
clickMode1 = 1;
|
clickMode1 = 1;
|
||||||
clickMode2 = 1;
|
clickMode2 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void mouseReleased(MouseEvent mouseevent) {
|
public final void mouseReleased(MouseEvent mouseevent) {
|
||||||
idleTime = 0;
|
idleTime = 0;
|
||||||
clickMode2 = 0;
|
clickMode2 = 0;
|
||||||
|
mouseWheelDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -245,17 +259,28 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo
|
|||||||
mouseY = -1;
|
mouseY = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public final void mouseDragged(MouseEvent e) {
|
||||||
public final void mouseDragged(MouseEvent mouseevent) {
|
int x = e.getX();
|
||||||
int i = mouseevent.getX();
|
int y = e.getY();
|
||||||
int j = mouseevent.getY();
|
if(gameFrame != null) {
|
||||||
if (gameFrame != null) {
|
Insets insets = gameFrame.getInsets();
|
||||||
i -= 4;
|
x -= insets.left;//4
|
||||||
j -= 22;
|
y -= insets.top;//22
|
||||||
|
}
|
||||||
|
if (mouseWheelDown) {
|
||||||
|
y = mouseWheelX - e.getX();
|
||||||
|
int k = mouseWheelY - e.getY();
|
||||||
|
mouseWheelDragged(y, -k);
|
||||||
|
mouseWheelX = e.getX();
|
||||||
|
mouseWheelY = e.getY();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
idleTime = 0;
|
idleTime = 0;
|
||||||
mouseX = i;
|
mouseX = x;
|
||||||
mouseY = j;
|
mouseY = y;
|
||||||
|
}
|
||||||
|
void mouseWheelDragged(int param1, int param2) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -276,6 +301,18 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo
|
|||||||
idleTime = 0;
|
idleTime = 0;
|
||||||
int i = keyevent.getKeyCode();
|
int i = keyevent.getKeyCode();
|
||||||
int j = keyevent.getKeyChar();
|
int j = keyevent.getKeyChar();
|
||||||
|
switch (keyevent.getKeyCode())
|
||||||
|
{
|
||||||
|
case KeyEvent.VK_ESCAPE:
|
||||||
|
//call ::close_interface
|
||||||
|
break;
|
||||||
|
case KeyEvent.VK_SHIFT:
|
||||||
|
shiftDown = true;
|
||||||
|
break;
|
||||||
|
case KeyEvent.VK_CONTROL:
|
||||||
|
ctrlDown = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (j < 30) {
|
if (j < 30) {
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
@@ -335,6 +372,15 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo
|
|||||||
idleTime = 0;
|
idleTime = 0;
|
||||||
int i = keyevent.getKeyCode();
|
int i = keyevent.getKeyCode();
|
||||||
char c = keyevent.getKeyChar();
|
char c = keyevent.getKeyChar();
|
||||||
|
switch (keyevent.getKeyCode())
|
||||||
|
{
|
||||||
|
case KeyEvent.VK_SHIFT:
|
||||||
|
shiftDown = false;
|
||||||
|
break;
|
||||||
|
case KeyEvent.VK_CONTROL:
|
||||||
|
ctrlDown = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (c < '\036') {
|
if (c < '\036') {
|
||||||
c = '\0';
|
c = '\0';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package redone.net.packets.impl;
|
package redone.net.packets.impl;
|
||||||
|
|
||||||
import redone.Connection;
|
import redone.Connection;
|
||||||
import redone.Constants;
|
import redone.Constants;
|
||||||
import redone.game.items.ItemAssistant;
|
import redone.game.items.ItemAssistant;
|
||||||
@@ -10,15 +10,15 @@ import redone.net.packets.PacketType;
|
|||||||
import redone.util.GameLogger;
|
import redone.util.GameLogger;
|
||||||
import redone.util.Misc;
|
import redone.util.Misc;
|
||||||
import redone.world.clip.Region;
|
import redone.world.clip.Region;
|
||||||
|
|
||||||
public class Commands implements PacketType {
|
public class Commands implements PacketType {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processPacket(Client player, int packetType, int packetSize) {
|
public void processPacket(Client player, int packetType, int packetSize) {
|
||||||
String playerCommand = player.getInStream().readString();
|
String playerCommand = player.getInStream().readString();
|
||||||
if ((playerCommand.startsWith("ban") || playerCommand.startsWith("ip") || playerCommand.startsWith("mute") || playerCommand.startsWith("un")) && player.playerRights > 0 && player.playerRights < 4) {
|
if ((playerCommand.startsWith("ban") || playerCommand.startsWith("ip") || playerCommand.startsWith("mute") || playerCommand.startsWith("un")) && player.playerRights > 0 && player.playerRights < 4) {
|
||||||
GameLogger.writeLog(player.playerName, "commands", player.playerName + " used command: " + playerCommand + "");
|
GameLogger.writeLog(player.playerName, "commands", player.playerName + " used command: " + playerCommand + "");
|
||||||
}
|
}
|
||||||
if (player.playerRights >= 0) {
|
if (player.playerRights >= 0) {
|
||||||
playerCommands(player, playerCommand);
|
playerCommands(player, playerCommand);
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ public class Commands implements PacketType {
|
|||||||
developerCommands(player, playerCommand);
|
developerCommands(player, playerCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playerCommands(Client player, String playerCommand) {
|
public static void playerCommands(Client player, String playerCommand) {
|
||||||
if (playerCommand.equalsIgnoreCase("players")) {
|
if (playerCommand.equalsIgnoreCase("players")) {
|
||||||
if (PlayerHandler.getPlayerCount() > 1) {
|
if (PlayerHandler.getPlayerCount() > 1) {
|
||||||
@@ -44,35 +44,43 @@ public class Commands implements PacketType {
|
|||||||
player.getActionSender().sendMessage("There is currently " + PlayerHandler.getPlayerCount() + " player online.");
|
player.getActionSender().sendMessage("There is currently " + PlayerHandler.getPlayerCount() + " player online.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.contains("clip") && player.playerRights < 2) {
|
if (playerCommand.contains("clip") && player.playerRights < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (playerCommand)
|
||||||
|
{
|
||||||
|
case "close_interface":
|
||||||
|
player.getPlayerAssistant().closeAllWindows();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void donatorCommands(Client player, String playerCommand) {
|
public static void donatorCommands(Client player, String playerCommand) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void moderatorCommands(Client player, String playerCommand) {
|
public static void moderatorCommands(Client player, String playerCommand) {
|
||||||
if (playerCommand.startsWith("yell")) {
|
if (playerCommand.startsWith("yell")) {
|
||||||
for (int j = 0; j < PlayerHandler.players.length; j++) {
|
for (int j = 0; j < PlayerHandler.players.length; j++) {
|
||||||
if (PlayerHandler.players[j] != null) {
|
if (PlayerHandler.players[j] != null) {
|
||||||
Client c2 = (Client)PlayerHandler.players[j];
|
Client c2 = (Client)PlayerHandler.players[j];
|
||||||
if (player.playerRights == 1) {
|
if (player.playerRights == 1) {
|
||||||
c2.getActionSender().sendMessage("@blu@[Moderator]@bla@"+ Misc.optimizeText(player.playerName) +": " + Misc.optimizeText(playerCommand.substring(5)) +"");
|
c2.getActionSender().sendMessage("@blu@[Moderator]@bla@"+ Misc.optimizeText(player.playerName) +": " + Misc.optimizeText(playerCommand.substring(5)) +"");
|
||||||
} else if (player.playerRights == 2) {
|
} else if (player.playerRights == 2) {
|
||||||
c2.getActionSender().sendMessage("@gre@[Administator]@bla@"+ Misc.optimizeText(player.playerName) +": " + Misc.optimizeText(playerCommand.substring(5)) +"");
|
c2.getActionSender().sendMessage("@gre@[Administator]@bla@"+ Misc.optimizeText(player.playerName) +": " + Misc.optimizeText(playerCommand.substring(5)) +"");
|
||||||
} else if (player.playerRights == 3) {
|
} else if (player.playerRights == 3) {
|
||||||
c2.getActionSender().sendMessage("@red@[Owner]@bla@"+ Misc.optimizeText(player.playerName) +": " + Misc.optimizeText(playerCommand.substring(5)) +"");
|
c2.getActionSender().sendMessage("@red@[Owner]@bla@"+ Misc.optimizeText(player.playerName) +": " + Misc.optimizeText(playerCommand.substring(5)) +"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("mute")) {
|
if (playerCommand.startsWith("mute")) {
|
||||||
try {
|
try {
|
||||||
String playerToBan = playerCommand.substring(5);
|
String playerToBan = playerCommand.substring(5);
|
||||||
Connection.addNameToMuteList(playerToBan);
|
Connection.addNameToMuteList(playerToBan);
|
||||||
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
||||||
@@ -86,11 +94,11 @@ public class Commands implements PacketType {
|
|||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("ipmute")) {
|
if (playerCommand.startsWith("ipmute")) {
|
||||||
try {
|
try {
|
||||||
String playerToBan = playerCommand.substring(7);
|
String playerToBan = playerCommand.substring(7);
|
||||||
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
||||||
if(PlayerHandler.players[i] != null) {
|
if(PlayerHandler.players[i] != null) {
|
||||||
@@ -105,11 +113,11 @@ public class Commands implements PacketType {
|
|||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("unipmute")) {
|
if (playerCommand.startsWith("unipmute")) {
|
||||||
try {
|
try {
|
||||||
String playerToBan = playerCommand.substring(9);
|
String playerToBan = playerCommand.substring(9);
|
||||||
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
||||||
if(PlayerHandler.players[i] != null) {
|
if(PlayerHandler.players[i] != null) {
|
||||||
@@ -122,25 +130,25 @@ public class Commands implements PacketType {
|
|||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("unmute")) {
|
if (playerCommand.startsWith("unmute")) {
|
||||||
try {
|
try {
|
||||||
String playerToBan = playerCommand.substring(7);
|
String playerToBan = playerCommand.substring(7);
|
||||||
Connection.unMuteUser(playerToBan);
|
Connection.unMuteUser(playerToBan);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void adminCommands(Client player, String playerCommand) {
|
public static void adminCommands(Client player, String playerCommand) {
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("clearbank")) {
|
if (playerCommand.equalsIgnoreCase("clearbank")) {
|
||||||
player.getItemAssistant().clearBank();
|
player.getItemAssistant().clearBank();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("ipban")) { // use as ::ipban name
|
if (playerCommand.startsWith("ipban")) { // use as ::ipban name
|
||||||
try {
|
try {
|
||||||
String playerToBan = playerCommand.substring(6);
|
String playerToBan = playerCommand.substring(6);
|
||||||
@@ -158,9 +166,9 @@ public class Commands implements PacketType {
|
|||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') { // use as ::ban name
|
if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') { // use as ::ban name
|
||||||
try {
|
try {
|
||||||
String playerToBan = playerCommand.substring(4);
|
String playerToBan = playerCommand.substring(4);
|
||||||
Connection.addNameToBanList(playerToBan);
|
Connection.addNameToBanList(playerToBan);
|
||||||
Connection.addNameToFile(playerToBan);
|
Connection.addNameToFile(playerToBan);
|
||||||
@@ -175,9 +183,9 @@ public class Commands implements PacketType {
|
|||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("unban")) {
|
if (playerCommand.startsWith("unban")) {
|
||||||
try {
|
try {
|
||||||
String playerToBan = playerCommand.substring(6);
|
String playerToBan = playerCommand.substring(6);
|
||||||
Connection.removeNameFromBanList(playerToBan);
|
Connection.removeNameFromBanList(playerToBan);
|
||||||
player.getActionSender().sendMessage(playerToBan + " has been unbanned.");
|
player.getActionSender().sendMessage(playerToBan + " has been unbanned.");
|
||||||
@@ -185,71 +193,71 @@ public class Commands implements PacketType {
|
|||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("empty")) {
|
if (playerCommand.equalsIgnoreCase("empty")) {
|
||||||
player.getPlayerAssistant().handleEmpty();
|
player.getPlayerAssistant().handleEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("dialogue")) {
|
if (playerCommand.startsWith("dialogue")) {
|
||||||
int npcType = 1552;
|
int npcType = 1552;
|
||||||
int id = Integer.parseInt(playerCommand.split(" ")[1]);
|
int id = Integer.parseInt(playerCommand.split(" ")[1]);
|
||||||
player.getDialogueHandler().sendDialogues(id, npcType);
|
player.getDialogueHandler().sendDialogues(id, npcType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("interface")) {
|
if (playerCommand.startsWith("interface")) {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
player.getPlayerAssistant().showInterface(Integer.parseInt(args[1]));
|
player.getPlayerAssistant().showInterface(Integer.parseInt(args[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("gfx")) {
|
if (playerCommand.startsWith("gfx")) {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
player.gfx0(Integer.parseInt(args[1]));
|
player.gfx0(Integer.parseInt(args[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("anim")) {
|
if (playerCommand.startsWith("anim")) {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
player.startAnimation(Integer.parseInt(args[1]));
|
player.startAnimation(Integer.parseInt(args[1]));
|
||||||
player.getPlayerAssistant().requestUpdates();
|
player.getPlayerAssistant().requestUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("mypos")) {
|
if (playerCommand.equalsIgnoreCase("mypos")) {
|
||||||
player.getActionSender().sendMessage("X: " + player.absX);
|
player.getActionSender().sendMessage("X: " + player.absX);
|
||||||
player.getActionSender().sendMessage("Y: " + player.absY);
|
player.getActionSender().sendMessage("Y: " + player.absY);
|
||||||
player.getActionSender().sendMessage("H: " + player.heightLevel);
|
player.getActionSender().sendMessage("H: " + player.heightLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("bank")) {
|
if (playerCommand.startsWith("bank")) {
|
||||||
player.getPlayerAssistant().openUpBank();
|
player.getPlayerAssistant().openUpBank();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (playerCommand.startsWith("xteletome")) {
|
if (playerCommand.startsWith("xteletome")) {
|
||||||
try {
|
try {
|
||||||
String teleTo = playerCommand.substring(10);
|
String teleTo = playerCommand.substring(10);
|
||||||
for (int i = 0; i < PlayerHandler.players.length; i++) {
|
for (int i = 0; i < PlayerHandler.players.length; i++) {
|
||||||
if (PlayerHandler.players[i] != null) {
|
if (PlayerHandler.players[i] != null) {
|
||||||
if (PlayerHandler.players[i].playerName.equalsIgnoreCase(teleTo)) {
|
if (PlayerHandler.players[i].playerName.equalsIgnoreCase(teleTo)) {
|
||||||
Client p = (Client) PlayerHandler.players[i];
|
Client p = (Client) PlayerHandler.players[i];
|
||||||
player.getActionSender().sendMessage(p.playerName + " has been teleported to you.");
|
player.getActionSender().sendMessage(p.playerName + " has been teleported to you.");
|
||||||
p.getPlayerAssistant().movePlayer(player.absX, player.absY, player.heightLevel);
|
p.getPlayerAssistant().movePlayer(player.absX, player.absY, player.heightLevel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
player.getActionSender().sendMessage("Player is not online.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerCommand.startsWith("xteleto")) {
|
||||||
|
String name = playerCommand.substring(8);
|
||||||
|
for (int i = 0; i < PlayerHandler.players.length; i++) {
|
||||||
|
if (PlayerHandler.players[i] != null) {
|
||||||
|
if (PlayerHandler.players[i].playerName.equalsIgnoreCase(name)) {
|
||||||
|
player.getPlayerAssistant().movePlayer(PlayerHandler.players[i].getX(), PlayerHandler.players[i].getY(), PlayerHandler.players[i].heightLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
player.getActionSender().sendMessage("Player is not online.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerCommand.startsWith("xteleto")) {
|
|
||||||
String name = playerCommand.substring(8);
|
|
||||||
for (int i = 0; i < PlayerHandler.players.length; i++) {
|
|
||||||
if (PlayerHandler.players[i] != null) {
|
|
||||||
if (PlayerHandler.players[i].playerName.equalsIgnoreCase(name)) {
|
|
||||||
player.getPlayerAssistant().movePlayer(PlayerHandler.players[i].getX(), PlayerHandler.players[i].getY(), PlayerHandler.players[i].heightLevel);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (playerCommand.startsWith("tele")) {
|
if (playerCommand.startsWith("tele")) {
|
||||||
String[] arg = playerCommand.split(" ");
|
String[] arg = playerCommand.split(" ");
|
||||||
if (arg.length > 3) {
|
if (arg.length > 3) {
|
||||||
@@ -258,29 +266,29 @@ public class Commands implements PacketType {
|
|||||||
player.getPlayerAssistant().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), player.heightLevel);
|
player.getPlayerAssistant().movePlayer(Integer.parseInt(arg[1]), Integer.parseInt(arg[2]), player.heightLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("up")) {
|
if (playerCommand.equalsIgnoreCase("up")) {
|
||||||
player.getPlayerAssistant().movePlayer(player.absX, player.absY, player.heightLevel + 1);
|
player.getPlayerAssistant().movePlayer(player.absX, player.absY, player.heightLevel + 1);
|
||||||
player.getActionSender().sendMessage("You are now on height level " + player.heightLevel + ".");
|
player.getActionSender().sendMessage("You are now on height level " + player.heightLevel + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("down2")) {
|
if (playerCommand.equalsIgnoreCase("down2")) {
|
||||||
player.getPlayerAssistant().movePlayer(player.absX, player.absY + 6400, player.heightLevel);
|
player.getPlayerAssistant().movePlayer(player.absX, player.absY + 6400, player.heightLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("down")) {
|
if (playerCommand.equalsIgnoreCase("down")) {
|
||||||
player.getPlayerAssistant().movePlayer(player.absX, player.absY, player.heightLevel - 1);
|
player.getPlayerAssistant().movePlayer(player.absX, player.absY, player.heightLevel - 1);
|
||||||
player.getActionSender().sendMessage("You are now on height level " + player.heightLevel + ".");
|
player.getActionSender().sendMessage("You are now on height level " + player.heightLevel + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("up2")) {
|
if (playerCommand.equalsIgnoreCase("up2")) {
|
||||||
player.getPlayerAssistant().movePlayer(player.absX, player.absY - 6400, player.heightLevel);
|
player.getPlayerAssistant().movePlayer(player.absX, player.absY - 6400, player.heightLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equals("spec")) {
|
if (playerCommand.equals("spec")) {
|
||||||
player.specAmount = 100.0;
|
player.specAmount = 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("setlevel")) {
|
if (playerCommand.startsWith("setlevel")) {
|
||||||
try {
|
try {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
@@ -296,10 +304,10 @@ public class Commands implements PacketType {
|
|||||||
player.getPlayerAssistant().refreshSkill(skill);
|
player.getPlayerAssistant().refreshSkill(skill);
|
||||||
player.getPlayerAssistant().levelUp(skill);
|
player.getPlayerAssistant().levelUp(skill);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("spellbook")) {
|
if (playerCommand.equalsIgnoreCase("spellbook")) {
|
||||||
if (player.inWild()) {
|
if (player.inWild()) {
|
||||||
return;
|
return;
|
||||||
@@ -317,7 +325,7 @@ public class Commands implements PacketType {
|
|||||||
player.getPlayerAssistant().resetAutocast();
|
player.getPlayerAssistant().resetAutocast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("item")) {
|
if (playerCommand.startsWith("item")) {
|
||||||
try {
|
try {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
@@ -327,8 +335,8 @@ public class Commands implements PacketType {
|
|||||||
if (newItemID <= 10000 && newItemID >= 0) {
|
if (newItemID <= 10000 && newItemID >= 0) {
|
||||||
player.getItemAssistant().addItem(newItemID, newItemAmount);
|
player.getItemAssistant().addItem(newItemID, newItemAmount);
|
||||||
if (player.isBusy()) {
|
if (player.isBusy()) {
|
||||||
player.getPlayerAssistant().closeAllWindows();
|
player.getPlayerAssistant().closeAllWindows();
|
||||||
}
|
}
|
||||||
player.getActionSender().sendMessage("You spawn (" + newItemAmount + ") "+ ItemAssistant.getItemName(newItemID) + ".");
|
player.getActionSender().sendMessage("You spawn (" + newItemAmount + ") "+ ItemAssistant.getItemName(newItemID) + ".");
|
||||||
} else {
|
} else {
|
||||||
player.getActionSender().sendMessage("No such item.");
|
player.getActionSender().sendMessage("No such item.");
|
||||||
@@ -339,7 +347,7 @@ public class Commands implements PacketType {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("master")) {
|
if (playerCommand.equalsIgnoreCase("master")) {
|
||||||
for (int i = 0; i < 25; i++) {
|
for (int i = 0; i < 25; i++) {
|
||||||
player.playerLevel[i] = 99;
|
player.playerLevel[i] = 99;
|
||||||
@@ -348,14 +356,14 @@ public class Commands implements PacketType {
|
|||||||
}
|
}
|
||||||
player.getPlayerAssistant().requestUpdates();
|
player.getPlayerAssistant().requestUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void developerCommands(Client player, String playerCommand) {
|
public static void developerCommands(Client player, String playerCommand) {
|
||||||
|
|
||||||
if (playerCommand.startsWith("giveadmin")) {
|
if (playerCommand.startsWith("giveadmin")) {
|
||||||
try {
|
try {
|
||||||
String playerToAdmin = playerCommand.substring(10);
|
String playerToAdmin = playerCommand.substring(10);
|
||||||
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
||||||
if(PlayerHandler.players[i] != null) {
|
if(PlayerHandler.players[i] != null) {
|
||||||
@@ -370,11 +378,11 @@ public class Commands implements PacketType {
|
|||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("demote")) {
|
if (playerCommand.startsWith("demote")) {
|
||||||
try {
|
try {
|
||||||
String playerToAdmin = playerCommand.substring(7);
|
String playerToAdmin = playerCommand.substring(7);
|
||||||
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
||||||
if(PlayerHandler.players[i] != null) {
|
if(PlayerHandler.players[i] != null) {
|
||||||
@@ -389,11 +397,11 @@ public class Commands implements PacketType {
|
|||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("givemod")) {
|
if (playerCommand.startsWith("givemod")) {
|
||||||
try {
|
try {
|
||||||
String playerToMod = playerCommand.substring(8);
|
String playerToMod = playerCommand.substring(8);
|
||||||
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
|
||||||
if(PlayerHandler.players[i] != null) {
|
if(PlayerHandler.players[i] != null) {
|
||||||
@@ -408,25 +416,25 @@ public class Commands implements PacketType {
|
|||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
player.getActionSender().sendMessage("Player Must Be Offline.");
|
player.getActionSender().sendMessage("Player Must Be Offline.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("object")) {
|
if (playerCommand.startsWith("object")) {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
player.getActionSender().object(Integer.parseInt(args[1]), player.absX, player.absY, player.heightLevel, 0, 10);
|
player.getActionSender().object(Integer.parseInt(args[1]), player.absX, player.absY, player.heightLevel, 0, 10);
|
||||||
Region.addObject(Integer.parseInt(args[1]), player.absX, player.absY, player.heightLevel, 10, 0, false);
|
Region.addObject(Integer.parseInt(args[1]), player.absX, player.absY, player.heightLevel, 10, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("object2")) {
|
if (playerCommand.startsWith("object2")) {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
player.getActionSender().object(Integer.parseInt(args[1]), player.absX, player.absY, player.heightLevel, 0, 0);
|
player.getActionSender().object(Integer.parseInt(args[1]), player.absX, player.absY, player.heightLevel, 0, 0);
|
||||||
Region.addObject(Integer.parseInt(args[1]), player.absX, player.absY, player.heightLevel, 0, 0, false);
|
Region.addObject(Integer.parseInt(args[1]), player.absX, player.absY, player.heightLevel, 0, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("npc")) {
|
if (playerCommand.startsWith("npc")) {
|
||||||
try {
|
try {
|
||||||
int newNPC = Integer.parseInt(playerCommand.substring(4)), maxHit = NpcHandler.getNpcListCombat(newNPC) / 10,
|
int newNPC = Integer.parseInt(playerCommand.substring(4)), maxHit = NpcHandler.getNpcListCombat(newNPC) / 10,
|
||||||
attack = NpcHandler.getNpcListCombat(newNPC), defence = NpcHandler.getNpcListCombat(newNPC);
|
attack = NpcHandler.getNpcListCombat(newNPC), defence = NpcHandler.getNpcListCombat(newNPC);
|
||||||
boolean attackPlayer = NpcHandler.getNpcListCombat(newNPC) > 0;
|
boolean attackPlayer = NpcHandler.getNpcListCombat(newNPC) > 0;
|
||||||
if (newNPC > 0) {
|
if (newNPC > 0) {
|
||||||
NpcHandler.spawnNpc(player, newNPC, player.absX, player.absY, player.heightLevel, 0, NpcHandler.getNpcListHP(newNPC), maxHit, attack, defence, attackPlayer, false);
|
NpcHandler.spawnNpc(player, newNPC, player.absX, player.absY, player.heightLevel, 0, NpcHandler.getNpcListHP(newNPC), maxHit, attack, defence, attackPlayer, false);
|
||||||
@@ -436,10 +444,10 @@ public class Commands implements PacketType {
|
|||||||
player.getActionSender().sendMessage("Npc " + newNPC + " does not exist.");
|
player.getActionSender().sendMessage("Npc " + newNPC + " does not exist.");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("cantAttack")) {
|
if (playerCommand.equalsIgnoreCase("cantAttack")) {
|
||||||
if (player.npcCanAttack == true) {
|
if (player.npcCanAttack == true) {
|
||||||
player.getActionSender().sendMessage("Npcs can no longer attack you.");
|
player.getActionSender().sendMessage("Npcs can no longer attack you.");
|
||||||
@@ -449,47 +457,47 @@ public class Commands implements PacketType {
|
|||||||
player.npcCanAttack = true;
|
player.npcCanAttack = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("sound")) {
|
if (playerCommand.startsWith("sound")) {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
player.getActionSender().sendSound(Integer.parseInt(args[1]), 100, 0);
|
player.getActionSender().sendSound(Integer.parseInt(args[1]), 100, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("tutprog")) {
|
|
||||||
String[] args = playerCommand.split(" ");
|
|
||||||
int id = Integer.parseInt(args[1]);
|
|
||||||
player.tutorialProgress = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerCommand.startsWith("song")) {
|
|
||||||
String[] args = playerCommand.split(" ");
|
|
||||||
int id = Integer.parseInt(args[1]);
|
|
||||||
player.getActionSender().sendSong(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("run")) {
|
|
||||||
player.getActionSender().sendMessage("You have refilled your run-energy!");
|
|
||||||
player.playerEnergy = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerCommand.equalsIgnoreCase("runes")) {
|
if (playerCommand.startsWith("tutprog")) {
|
||||||
final int amount = 10000;
|
String[] args = playerCommand.split(" ");
|
||||||
final int[][] RUNES = { { 554, amount }, { 555, amount },
|
int id = Integer.parseInt(args[1]);
|
||||||
{ 556, amount }, { 557, amount }, { 558, amount },
|
player.tutorialProgress = id;
|
||||||
{ 559, amount }, { 560, amount }, { 561, amount },
|
}
|
||||||
{ 562, amount }, { 563, amount }, { 564, amount },
|
|
||||||
{ 565, amount }, { 566, amount }, { 1963, 1 }, };
|
if (playerCommand.startsWith("song")) {
|
||||||
for (int[] element : RUNES) {
|
String[] args = playerCommand.split(" ");
|
||||||
int item = element[0];
|
int id = Integer.parseInt(args[1]);
|
||||||
int amountToRecieve = element[1];
|
player.getActionSender().sendSong(id);
|
||||||
player.getItemAssistant().addItem(item, amountToRecieve);
|
}
|
||||||
}
|
|
||||||
}
|
if (playerCommand.equalsIgnoreCase("run")) {
|
||||||
|
player.getActionSender().sendMessage("You have refilled your run-energy!");
|
||||||
|
player.playerEnergy = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerCommand.equalsIgnoreCase("runes")) {
|
||||||
|
final int amount = 10000;
|
||||||
|
final int[][] RUNES = { { 554, amount }, { 555, amount },
|
||||||
|
{ 556, amount }, { 557, amount }, { 558, amount },
|
||||||
|
{ 559, amount }, { 560, amount }, { 561, amount },
|
||||||
|
{ 562, amount }, { 563, amount }, { 564, amount },
|
||||||
|
{ 565, amount }, { 566, amount }, { 1963, 1 }, };
|
||||||
|
for (int[] element : RUNES) {
|
||||||
|
int item = element[0];
|
||||||
|
int amountToRecieve = element[1];
|
||||||
|
player.getItemAssistant().addItem(item, amountToRecieve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerCommand.startsWith("sidebars")) {
|
||||||
|
player.getPlayerAssistant().sendSidebars();
|
||||||
|
}
|
||||||
|
|
||||||
if (playerCommand.startsWith("sidebars")) {
|
|
||||||
player.getPlayerAssistant().sendSidebars();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerCommand.startsWith("update")) {
|
if (playerCommand.startsWith("update")) {
|
||||||
try {
|
try {
|
||||||
String[] args = playerCommand.split(" ");
|
String[] args = playerCommand.split(" ");
|
||||||
@@ -505,8 +513,8 @@ public class Commands implements PacketType {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user