Sonicforce41
July 30th, 2011, 00:41
Hey guys, This tutorial/snippet (What ever you want to call it) is for RuneEscape source released by Dragonkk (Alex).
He did it over teamviewer in my pc.
Do not flame that i did not get permission from him because
he was one who said to release it to public and if you want picture,
I sent him a pm about it.
Let's begin:
1.First create a class called Commands in game > player > content
2.Put this code in:
package com.rs.game.player.content;
import com.rs.game.WorldTile;
import com.rs.game.player.Player;
/*
* doesnt let it be extended
*/
public final class Commands {
/*
* all console commands only for admin, chat commands processed if they not processed by console
*/
/*
* returns if command was processed
*/
public static boolean processCommand(Player player, String command, boolean console, boolean clientCommand) {
if(command.length() == 0) //if they used ::(nothing) theres no command
return false;
String[] cmd = command.toLowerCase().split(" ");
if(player.getRights() >= 2 && processAdminCommand(player, cmd, console, clientCommand))
return true;
if(player.getRights() >= 1 && processModCommand(player, cmd, console, clientCommand))
return true;
return processNormalCommand(player, cmd, console, clientCommand);
}
/*
* extra parameters if you want to check them
*/
public static boolean processAdminCommand(Player player, String[] cmd, boolean console, boolean clientCommand) {
if(cmd[0].equals("dungtest")) {
player.getControlerManager().startControler("Dungeoneering", new WorldTile(4000, 4200, 0));
return true;
}
return false;
}
public static boolean processModCommand(Player player, String[] cmd, boolean console, boolean clientCommand) {
return false;
}
public static boolean processNormalCommand(Player player, String[] cmd, boolean console, boolean clientCommand) {
if(cmd[0].equals("test")) {
player.getPackets().sendGameMessage("works as it should.");
return true;
}
return false;
}
/*
* doesnt let it be instanced
*/
private Commands() {
}
}
3. Save and Exit
4. Make sure to import the Commands class
import com.rs.game.player.content.Commands;
5. Go into WorldPacketsDecover class and Replace your PUBLIC_CHAT_PACKET with this:
}else if(packetId == PUBLIC_CHAT_PACKET) {
if(!player.hasStarted() || player.hasFinished())
return;
int effects = stream.readShort();
String message = Huffman.readEncryptedMessage(76, stream);
if(message.startsWith("::"))
//if command exists and processed wont send message as public message
if(Commands.processCommand(player, message.replace("::", ""), false, false))
return;
player.setNextPublicChatMessage(new PublicChatMessage(message, effects));
6. After you did that, Find COMMANDS_PACKET and replace it with this:
} else if(packetId == COMMANDS_PACKET) {
if(!player.isRunning())
return;
boolean clientCommand = stream.readUnsignedByte() == 1;
String command = stream.readString();//.toLowerCase();
Commands.processCommand(player, command, true, clientCommand);
Credits:
100% Credit and Honor to Dragonkk
He did it over teamviewer in my pc.
Do not flame that i did not get permission from him because
he was one who said to release it to public and if you want picture,
I sent him a pm about it.
Let's begin:
1.First create a class called Commands in game > player > content
2.Put this code in:
package com.rs.game.player.content;
import com.rs.game.WorldTile;
import com.rs.game.player.Player;
/*
* doesnt let it be extended
*/
public final class Commands {
/*
* all console commands only for admin, chat commands processed if they not processed by console
*/
/*
* returns if command was processed
*/
public static boolean processCommand(Player player, String command, boolean console, boolean clientCommand) {
if(command.length() == 0) //if they used ::(nothing) theres no command
return false;
String[] cmd = command.toLowerCase().split(" ");
if(player.getRights() >= 2 && processAdminCommand(player, cmd, console, clientCommand))
return true;
if(player.getRights() >= 1 && processModCommand(player, cmd, console, clientCommand))
return true;
return processNormalCommand(player, cmd, console, clientCommand);
}
/*
* extra parameters if you want to check them
*/
public static boolean processAdminCommand(Player player, String[] cmd, boolean console, boolean clientCommand) {
if(cmd[0].equals("dungtest")) {
player.getControlerManager().startControler("Dungeoneering", new WorldTile(4000, 4200, 0));
return true;
}
return false;
}
public static boolean processModCommand(Player player, String[] cmd, boolean console, boolean clientCommand) {
return false;
}
public static boolean processNormalCommand(Player player, String[] cmd, boolean console, boolean clientCommand) {
if(cmd[0].equals("test")) {
player.getPackets().sendGameMessage("works as it should.");
return true;
}
return false;
}
/*
* doesnt let it be instanced
*/
private Commands() {
}
}
3. Save and Exit
4. Make sure to import the Commands class
import com.rs.game.player.content.Commands;
5. Go into WorldPacketsDecover class and Replace your PUBLIC_CHAT_PACKET with this:
}else if(packetId == PUBLIC_CHAT_PACKET) {
if(!player.hasStarted() || player.hasFinished())
return;
int effects = stream.readShort();
String message = Huffman.readEncryptedMessage(76, stream);
if(message.startsWith("::"))
//if command exists and processed wont send message as public message
if(Commands.processCommand(player, message.replace("::", ""), false, false))
return;
player.setNextPublicChatMessage(new PublicChatMessage(message, effects));
6. After you did that, Find COMMANDS_PACKET and replace it with this:
} else if(packetId == COMMANDS_PACKET) {
if(!player.isRunning())
return;
boolean clientCommand = stream.readUnsignedByte() == 1;
String command = stream.readString();//.toLowerCase();
Commands.processCommand(player, command, true, clientCommand);
Credits:
100% Credit and Honor to Dragonkk