Jump to content
  • 0
Arix

PM system is not working properly

Question

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:

[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

9 answers to this question

Recommended Posts

  • 0
Ah, now I understand your problem. It's displaying the old name and not the new? Couldn't you simply make a String to set the new name and make it grab the new name? If you're already doing that, play with the things like "username2" etc., sorry I couldn't help much.

Share this post


Link to post
Share on other sites
  • 0
[quote name='falconpunch']Ah, now I understand your problem. It's displaying the old name and not the new? Couldn't you simply make a String to set the new name and make it grab the new name? If you're already doing that, play with the things like "username2" etc., sorry I couldn't help much.[/QUOTE]
Yeah I tried many things. The names switch around but it's never good. I don't know why this is a thing. :(

Share this post


Link to post
Share on other sites
  • 0
[quote name='Arix']Yeah I tried many things. The names switch around but it's never good. I don't know why this is a thing. :([/QUOTE]

I'm baffled at this as whale.

This might be wrong, and probably is, but, it doesn't seem like you set, in receivePrivateMessage, did you set String name to the original name and display name to the new name? I know you made it so if they aren't equal to set the display name, but it doesn't look like they have anything to refer to.

Share this post


Link to post
Share on other sites
  • 0
[quote name='falconpunch']I'm baffled at this as whale.

This might be wrong, and probably is, but, it doesn't seem like you set, in receivePrivateMessage, did you set String name to the original name and display name to the new name? I know you made it so if they aren't equal to set the display name, but it doesn't look like they have anything to refer to.[/QUOTE]
Yes, the server sends the correct data. The client also receives the correct data and puts it in the correct places, however the from will never be a good from.

I'm not sure how this is shown on-screen but I think it is a client script, so potentially it could be due to something in the cache?

Share this post


Link to post
Share on other sites
  • 0
[quote name='Arix']Yes, the server sends the correct data. The client also receives the correct data and puts it in the correct places, however the from will never be a good from.

I'm not sure how this is shown on-screen but I think it is a client script, so potentially it could be due to something in the cache?[/QUOTE]

I don't think so. I might be wrong, but that wouldn't entirely make sense, it's only text, the cache can't grab the name etc.

Share this post


Link to post
Share on other sites
  • 0
[quote name='falconpunch']I don't think so. I might be wrong, but that wouldn't entirely make sense, it's only text, the cache can't grab the name etc.[/QUOTE]
Yes but the cache contains scripts. The "from" and "to" words aren't added in the client code they come from somewhere else and not the server.

Share this post


Link to post
Share on other sites
  • 0
The only thing I can see so far is that you do indeed string username2, but it isn't used in the receive packet.

[CODE]username, displayName, username2[/CODE]

So maybe you could try changing your receiving method to this one and let me know if it worked?

[CODE] if (IncomingPacket.RECEIVE_PRIVATE_MESSAGE_PACKET == class25.INCOMMING_PACKET) {
boolean hasDisplayName = stream.readUnsignedByte() == 1;
String username = stream.readString(-323676906);
String displayName = username2;
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]

Let me know if it worked [MENTION=94449]Arix[/MENTION]. Might not as I don't code anything 600+. Edited by PwntNoob

Share this post


Link to post
Share on other sites
  • 0
[quote name='PwntNoob']The only thing I can see so far is that you do indeed string username2, but it isn't used in the receive packet.

[CODE]username, displayName, username2[/CODE]

So maybe you could try changing your receiving method to this one and let me know if it worked?

[CODE] if (IncomingPacket.RECEIVE_PRIVATE_MESSAGE_PACKET == class25.INCOMMING_PACKET) {
boolean hasDisplayName = stream.readUnsignedByte() == 1;
String username = stream.readString(-323676906);
String displayName = username2;
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]

Let me know if it worked [MENTION=94449]Arix[/MENTION]. Might not as I don't code anything 600+.[/QUOTE]
[code]
String displayName = username2;
[/code]

will not compile because username2 is not declared anywhere. What I did find out is that when the player does not have a display name, everywhere else in the client the server would send an empty string instead of the regular username

however in this it sends the username instead of an empty string.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Arix'][code]
String displayName = username2;
[/code]

will not compile because username2 is not declared anywhere. What I did find out is that when the player does not have a display name, everywhere else in the client the server would send an empty string instead of the regular username

however in this it sends the username instead of an empty string.[/QUOTE]

Sorry then mate. Only thing I could really think of, Don't work with this revision.

Share this post


Link to post
Share on other sites

×