Hey guys so I have been trying to fix my PM system for a while now. Alright so basically what happens is this:
[IMG]http://i.imgur.com/kKy7l6j.png[/IMG]
When a username has a display name, it'll say "from bla" in the receiver's client however it DOES send to loll instead of bla. I looked at the order of variables in the packets and they match. I think they use a script to display it on-screen so I wanted to look in the script wether I can see why it's doing this... the only problem is I can't get the script :P Could anyone tell me how to get it or perhaps someone has already found a solution to this?
I refactored some of the client code for easier reading.
When a player sends a message to another player, the server does this code:
[code]
public void receivePrivateMessage(String name, String display, int rights, String message) {
OutputStream stream = new OutputStream();
stream.writePacketVarShort(player, 105);
stream.writeByte(name.equals(display) ? 0 : 1);
stream.writeString(name);
if (!name.equals(display)) {
stream.writeString(display);
}
for (int i = 0; i < 5; i++) {
stream.writeByte(Utils.getRandom(255));
}
stream.writeByte(rights);
Huffman.sendEncryptMessage(stream, message);
stream.endPacketVarShort();
session.write(stream);
}
[/code]
All simple ok... in the client when receiving this packet this code happens
[code]
if (IncomingPacket.RECEIVE_PRIVATE_MESSAGE_PACKET == class25.INCOMMING_PACKET) {
boolean hasDisplayName = stream.readUnsignedByte() == 1;
String username = stream.readString(-323676906);
String displayName = username;
if (hasDisplayName) {
displayName = stream.readString(-726880698);
}
long l = (long) stream.readUnsignedShort();
long l_489_ = (long) stream.read24BitUnsignedInteger((byte) -115);
int rights = stream.readUnsignedByte();
long l_491_ = l_489_ + (l << 32);
boolean bool_492_ = false;
while_93_:
do {
for (int i_493_ = 0; i_493_ < 100; i_493_++) {
if (l_491_ == client.aLongArray8915[i_493_]) {
bool_492_ = true;
break while_93_;
}
}
if (rights != 2) {
if (client.aBoolean8811 && !client.aBoolean8812 || client.aBoolean8802) {
bool_492_ = true;
} else if (Class287.method2722(displayName, -2116888507)) {
bool_492_ = true;
}
}
} while (false);
if (!bool_492_) {
client.aLongArray8915[client.anInt8916 * 1594173071] = l_491_;
client.anInt8916 = 1356544111 * ((1 + client.anInt8916 * 1594173071) % 100);
String decryptedMessage = (Class248.decryptStringMessage(Class127_Sub1.huffManDecryption(stream, -1313378115), 19429593));
if (2 == rights) {
Class25.addNewPM(7, 0, new StringBuilder().append(Class247.method2368(1, -278777595)).append(username).toString(), new StringBuilder().append(Class247.method2368(1, -278777595)).append(displayName).toString(), username, decryptedMessage, null, -1, 1446000206);
} else if (rights == 1) {
Class25.addNewPM(7, 0, new StringBuilder().append(Class247.method2368(0, -278777595)).append(username).toString(), new StringBuilder().append(Class247.method2368(0, -278777595)).append(displayName).toString(), username, decryptedMessage, null, -1, 1446000206);
} else if (rights != 0) {
Class25.addNewPM(3, 0, "<img=" + rights + ">" + username, "<img=" + rights + ">" + displayName, username, decryptedMessage, null, -1, 1446000206);
} else {
Class25.addNewPM(3, 0, username, displayName, username, decryptedMessage, null, -1, 1446000206);
}
}
class25.INCOMMING_PACKET = null;
return true;
}
[/code]
alright... I go to the "addNewPM" method to see what happens there:
[IMG]http://i.imgur.com/kKy7l6j.png[/IMG]
When a username has a display name, it'll say "from bla" in the receiver's client however it DOES send to loll instead of bla. I looked at the order of variables in the packets and they match. I think they use a script to display it on-screen so I wanted to look in the script wether I can see why it's doing this... the only problem is I can't get the script :P Could anyone tell me how to get it or perhaps someone has already found a solution to this?
I refactored some of the client code for easier reading.
When a player sends a message to another player, the server does this code:
[code]
public void receivePrivateMessage(String name, String display, int rights, String message) {
OutputStream stream = new OutputStream();
stream.writePacketVarShort(player, 105);
stream.writeByte(name.equals(display) ? 0 : 1);
stream.writeString(name);
if (!name.equals(display)) {
stream.writeString(display);
}
for (int i = 0; i < 5; i++) {
stream.writeByte(Utils.getRandom(255));
}
stream.writeByte(rights);
Huffman.sendEncryptMessage(stream, message);
stream.endPacketVarShort();
session.write(stream);
}
[/code]
All simple ok... in the client when receiving this packet this code happens
[code]
if (IncomingPacket.RECEIVE_PRIVATE_MESSAGE_PACKET == class25.INCOMMING_PACKET) {
boolean hasDisplayName = stream.readUnsignedByte() == 1;
String username = stream.readString(-323676906);
String displayName = username;
if (hasDisplayName) {
displayName = stream.readString(-726880698);
}
long l = (long) stream.readUnsignedShort();
long l_489_ = (long) stream.read24BitUnsignedInteger((byte) -115);
int rights = stream.readUnsignedByte();
long l_491_ = l_489_ + (l << 32);
boolean bool_492_ = false;
while_93_:
do {
for (int i_493_ = 0; i_493_ < 100; i_493_++) {
if (l_491_ == client.aLongArray8915[i_493_]) {
bool_492_ = true;
break while_93_;
}
}
if (rights != 2) {
if (client.aBoolean8811 && !client.aBoolean8812 || client.aBoolean8802) {
bool_492_ = true;
} else if (Class287.method2722(displayName, -2116888507)) {
bool_492_ = true;
}
}
} while (false);
if (!bool_492_) {
client.aLongArray8915[client.anInt8916 * 1594173071] = l_491_;
client.anInt8916 = 1356544111 * ((1 + client.anInt8916 * 1594173071) % 100);
String decryptedMessage = (Class248.decryptStringMessage(Class127_Sub1.huffManDecryption(stream, -1313378115), 19429593));
if (2 == rights) {
Class25.addNewPM(7, 0, new StringBuilder().append(Class247.method2368(1, -278777595)).append(username).toString(), new StringBuilder().append(Class247.method2368(1, -278777595)).append(displayName).toString(), username, decryptedMessage, null, -1, 1446000206);
} else if (rights == 1) {
Class25.addNewPM(7, 0, new StringBuilder().append(Class247.method2368(0, -278777595)).append(username).toString(), new StringBuilder().append(Class247.method2368(0, -278777595)).append(displayName).toString(), username, decryptedMessage, null, -1, 1446000206);
} else if (rights != 0) {
Class25.addNewPM(3, 0, "<img=" + rights + ">" + username, "<img=" + rights + ">" + displayName, username, decryptedMessage, null, -1, 1446000206);
} else {
Class25.addNewPM(3, 0, username, displayName, username, decryptedMessage, null, -1, 1446000206);
}
}
class25.INCOMMING_PACKET = null;
return true;
}
[/code]
alright... I go to the "addNewPM" method to see what happens there:
[code]
public static void addNewPM(int i, int i_20_, String username, String displayName, String username2, String message, String string_24_, int i_25_, int i_26_) {
try {
Class102 class102 = Class107.privateMessages[99];
for (int i_27_ = 99; i_27_ > 0; i_27_--) {
Class107.privateMessages[i_27_] = Class107.privateMessages[i_27_ - 1];
}
if (class102 == null) {
class102 = new Class102(i, i_20_, username, displayName, username2, string_24_, i_25_, message);
} else {
class102.setData(i, i_20_, username, displayName, username2, string_24_, i_25_, message, (short) 8448);
}
Class107.privateMessages[0] = class102;
Class107.anInt1310 += 760013237;
client.anInt8882 = client.anInt8933 * 1619726147;
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder().append("az.i(").append(')').toString());
}
}
[/code]
and finally I found this:
[code]
static final void method5859(ClientScript2 class403, byte i) {
try {
int i_10_ = (((ClientScript2) class403).anIntArray5244[((((ClientScript2) class403).anInt5239 -= -391880689) * 681479919)]);
Class102 class102 = Class298_Sub40_Sub13.getPrivateMessage(i_10_, 689328854);
String string = "";
if (null != class102 && null != class102.displayName) {
string = class102.displayName;
}
((ClientScript2) class403).anObjectArray5240[((((ClientScript2) class403).anInt5241 += 969361751) * -203050393 - 1)] = string;
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder().append("se.ach(").append(')').toString());
}
}
[/code] Edited by Arix
Share this post
Link to post
Share on other sites