package realmrelay.packets.client;
import java****.DataInput;
import java****.DataOutput;
import java********Exception;
import java.util.Arrays;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.Arrays;
import realmrelay.packets.Packet;
public class HelloPacket extends Packet {
public String buildVersion;
public int unkint;
public int unkint2;
public int gameId; // int
public String guid;
public String password;
public String secret;
public int keyTime; // int
public byte[] key;
public String unkStr;
public String pk;
public String Tq;
public String H;
public String playPlatform;
public int idk;
public byte idkey[];
public HelloPacket(DataInput read) {
pk = "";
Tq = "";
H = "";
playPlatform = "";
try {
// type = Packet.HELLO;
parseFromInput(read);
} catch (IOException e) {
}
}
public HelloPacket() {
pk = "";
Tq = "";
H = "";
playPlatform = "";
// type = Packet.HELLO;
}
public void parseFromInput(DataInput read) throws IOException {
buildVersion = read.readUTF();
unkint = read.readInt();
gameId = read.readInt();
secret = read.readUTF();
password = read.readUTF();
guid = read.readUTF();
keyTime = read.readInt();
key = new byte[read.readUnsignedShort()];
read.readFully(key);
byte buf[] = new byte[read.readInt()];
read.readFully(buf);
unkStr = new String(buf, Charset.forName("UTF-8"));
pk = read.readUTF();
Tq = read.readUTF();
H = read.readUTF();
playPlatform = read.readUTF();
unkint2 = read.readInt();
//idkey = new byte[idk];
//read.readFully(idkey);
}
public void writeToOutput(DataOutput write) throws IOException {
write.writeUTF(buildVersion);
write.writeInt(unkint);
write.writeInt(gameId);
write.writeUTF(secret);
write.writeUTF(password);
write.writeUTF(guid);
write.writeInt(keyTime);
if(key != null)
{
write.writeShort(key.length);
write.write(key);
} else
{
write.writeShort(0);
}
if(unkStr != null)
{
byte buf[] = unkStr.getBytes("UTF-8");
write.writeInt(buf.length);
write.write(buf);
} else
{
write.writeInt(0);
}
write.writeUTF(pk);
write.writeUTF(Tq);
write.writeUTF(H);
write.writeUTF(playPlatform);
write.writeInt(unkint2);
if(idkey != null)
{
write.writeShort(idkey.length);
write.write(idkey);
} else
{
write.writeShort(0);
}
}
public String toString() {
return (new StringBuilder()).append("HELLO_PACKET: buildVersion=")
.append(buildVersion).append(" gameId=").append(gameId)
.append(" guid=").append(guid).append(" pw=").append(password)
.append(" secret=").append(secret).append(" keyTime=")
.append(keyTime).append(" key=").append(Arrays.toString(key))
.append(" unkStr=").append(unkStr).append(" pk=").append(pk)
.append(" Tq=").append(Tq).append(" H=").append(H)
.append(" playPlatform=").append(playPlatform).append(" idk=")
.append(idk).append(" idkey=").append(idkey).toString();
}
}
