Hello packet
Code:
public class HELLO_Packet implements RWable {
public String buildVersion_; // String
public int gameId_ = 0; // int
public String guid_; // String
public String password_; // String
public String secret_; // String
public int keyTime_ = 0; // int
public byte[] key_; // ByteArray
public String jD; // String
public String pk = ""; // String
public String Tq = ""; // String
public String H = ""; // String
public String playPlatform = ""; // String
public String unknow1 ="";
public void parseFromInput(ByteArrayDataInput badi) throws IOException {
this.buildVersion_ = badi.readUTF(); // UTF
this.gameId_ = badi.readInt(); // Int
this.guid_ = badi.readUTF(); // UTF
this.password_ = badi.readUTF(); // UTF
this.secret_ = badi.readUTF(); // UTF
this.keyTime_ = badi.readInt(); // Int
this.key_ = new byte[badi.readShort()]; // Short
badi.readFully(this.key_); // Bytes
byte[] buf = new byte[badi.readInt()]; // Int
badi.readFully(buf);
this.jD = new String(buf, Charset.forName("UTF-8"));
this.pk = badi.readUTF(); // UTF
this.Tq = badi.readUTF(); // UTF
this.H = badi.readUTF(); // UTF
this.playPlatform = badi.readUTF(); // UTF
//new version 12.4
this.unknow1 = badi.readUTF(); // UTF
}
public void writeToOutput(ByteArrayDataOutput bado) throws IOException {
bado.writeUTF(this.buildVersion_); // UTF
bado.writeInt(this.gameId_); // Int
bado.writeUTF(this.guid_); // UTF
bado.writeUTF(this.password_); // UTF
bado.writeUTF(this.secret_); // UTF
bado.writeInt(this.keyTime_); // Int
bado.writeShort(this.key_.length); // Short
bado.write(this.key_); // Bytes
bado.writeInt(this.jD.getBytes().length); // Int
bado.write(this.jD.getBytes()); // UTFBytes
bado.writeUTF(this.pk); // UTF
bado.writeUTF(this.Tq); // UTF
bado.writeUTF(this.H); // UTF
bado.writeUTF(this.playPlatform); // UTF
//new version 12.4
bado.writeUTF(this.unknow1);
}
public int getId() {
return Packets.HELLO;
}
public String toString() {
return "HELLO [" + buildVersion_ + " , " + gameId_ + " , " + guid_ + " , " + password_ + " , " + secret_ + " , " + keyTime_ + " , " + (key_ == null ? null : DatatypeConverter.printHexBinary(key_)) + " , " + jD + " , " + pk + " , " + Tq + " , " + H + " , " + playPlatform + "]";
}
}
construct Hello Packet
Code:
// Positive values are instanced dungeons
public final static int MAP_TESTING = -6;
public final static int VAULT = -5;
public final static int TUTORIAL_PT2 = -4;
public final static int REALM = -3; // seems to auto join a realm?
public final static int NORMAL = -2;
public final static int TUTORIAL_PT1 = -1;
public HELLO_Packet constructHelloPacket(int gm) {
HELLO_Packet hp = new HELLO_Packet();
hp.buildVersion_ = "14.2";
hp.gameId_ = gm; //NORMAL = -2
hp.keyTime_ = -1;
hp.secret_ = "";
hp.key_ = new byte[0];
hp.guid_ = getGuid();
hp.password_ = getPassword();
hp.jD = "";
hp.pk = "";
hp.Tq = "rotmg";
hp.H = "";
hp.playPlatform = "rotmg";
return hp;
}
Packet ids
Code:
public class Packets {
// public static final Map<Integer, String> map = new HashMap<Integer, String>();
public static final Map<Integer, String> allmap = new HashMap<Integer, String>();
public final static int FAILURE = 0;
public final static int CANCELTRADE = 1;
public final static int USEPORTAL = 3;
public final static int INVRESULT = 4;
public final static int JOINGUILD = 5;
public final static int PING = 6;
public final static int MOVE = 7;
public final static int GUILDINVITE = 8;
public final static int GLOBAL_NOTIFICATION = 9;
public final static int SETCONDITION = 10;
public final static int UPDATEACK = 11;
public final static int TRADEDONE = 12;
public final static int SHOOT = 13;
public final static int GOTOACK = 14;
public final static int CREATEGUILD = 15;
public final static int PONG = 16;
public final static int HELLO = 17;
public final static int TRADEACCEPTED = 18;
public final static int SHOOTMULTI = 19;
public final static int NAMERESULT = 20;
public final static int REQUESTTRADE = 21;
public final static int SHOOTACK = 22;
public final static int TRADECHANGED = 23;
public final static int PLAYERHIT = 24;
public final static int TEXT = 25;
public final static int UPDATE = 26;
public final static int BUYRESULT = 27;
public final static int PIC = 28;
public final static int USEITEM = 30;
public final static int CREATE_SUCCESS = 31;
public final static int CHOOSENAME = 33;
public final static int QUESTOBJID = 34;
public final static int INVDROP = 35;
public final static int CREATE = 36;
public final static int CHANGETRADE = 37;
public final static int PLAYERSHOOT = 38;
public final static int RECONNECT = 39;
public final static int CHANGEGUILDRANK = 40;
public final static int DEATH = 41;
public final static int ESCAPE = 42;
public final static int PLAYSOUND = 44;
public final static int LOAD = 45;
public final static int ACCOUNTLIST = 46;
public final static int DAMAGE = 47;
public final static int CHECKCREDITS = 48;
public final static int TELEPORT = 49;
public final static int BUY = 50;
public final static int SQUAREHIT = 51;
public final static int GOTO = 52;
public final static int EDITACCOUNTLIST = 53;
public final static int SHOW_EFFECT = 56;
public final static int ACCEPTTRADE = 57;
public final static int AOEACK = 59;
public final static int MAPINFO = 60;
public final static int TRADEREQUESTED = 61;
public final static int NEW_TICK = 62;
public final static int NOTIFICATION = 63;
public final static int GROUNDDAMAGE = 64;
public final static int INVSWAP = 65;
public final static int OTHERHIT = 66;
public final static int TRADESTART = 67;
public final static int AOE = 68;
public final static int PLAYERTEXT = 69;
public final static int ALLYSHOOT = 74;
public final static int CLIENTSTAT = 75;
public final static int ENEMYHIT = 76;
public final static int INVITEDTOGUILD = 77;
public final static int GUILDREMOVE = 78;
public final static int CREATEGUILDRESULT = 83;
public final static int CLIENTSTAT_FILE = 86;