fix offsets in chat packets

This commit is contained in:
Aaron Kimbre 2023-08-05 01:01:27 -05:00
parent 6dfd5ca933
commit 043d7366d7
2 changed files with 10 additions and 6 deletions

View File

@ -241,7 +241,7 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) {
CINSTREAM_SKIP_HEADER;
LWOOBJID playerID;
inStream.Read(playerID);
inStream.IgnoreBytes(4);
eAddFriendResponseCode clientResponseCode;
inStream.Read(clientResponseCode);
LUWString friendName(33);
@ -318,6 +318,7 @@ void ChatPacketHandler::HandleRemoveFriend(Packet* packet) {
CINSTREAM_SKIP_HEADER;
LWOOBJID playerID;
inStream.Read(playerID);
inStream.IgnoreBytes(4);
LUWString friendName(33);
inStream.Read(friendName);
@ -386,11 +387,11 @@ void ChatPacketHandler::HandleChatMessage(Packet* packet) {
const auto senderName = std::string(sender->playerName.c_str());
inStream.SetReadOffset(0x14 * 8);
inStream.IgnoreBytes(20);
uint8_t channel = 0;
inStream.Read(channel);
inStream.IgnoreBytes(77);
LUWString message(512);
inStream.Read(message);
@ -435,6 +436,7 @@ void ChatPacketHandler::HandlePrivateChatMessage(Packet* packet) {
CINSTREAM_SKIP_HEADER;
LWOOBJID senderID;
inStream.Read(senderID);
inStream.IgnoreBytes(78);
LUWString receiverName(33);
inStream.Read(receiverName);
LUWString message(512);
@ -467,7 +469,7 @@ void ChatPacketHandler::HandlePrivateChatMessage(Packet* packet) {
bitStream.Write(LUWString(goonBName));
bitStream.Write<uint8_t>(0); //not mythran for receiver
bitStream.Write<uint8_t>(0); //success
bitStream.Write(LUWString(message.string, 512));
bitStream.Write(message);
SystemAddress sysAddr = goonA->sysAddr;
SEND_PACKET;
@ -501,6 +503,7 @@ void ChatPacketHandler::HandleTeamInvite(Packet* packet) {
CINSTREAM_SKIP_HEADER;
LWOOBJID playerID;
inStream.Read(playerID);
inStream.IgnoreBytes(4);
LUWString invitedPlayer(33);
inStream.Read(invitedPlayer);

View File

@ -251,6 +251,7 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
CINSTREAM_SKIP_HEADER;
LUWString name(33);
inStream.Read(name);
uint32_t firstNameIndex;
inStream.Read(firstNameIndex);
uint32_t middleNameIndex;
@ -258,8 +259,8 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
uint32_t lastNameIndex;
inStream.Read(lastNameIndex);
std::string predefinedName = GetPredefinedName(firstNameIndex, middleNameIndex, lastNameIndex);
// unknown 9 bytes
inStream.SetReadOffset(inStream.GetReadOffset() + BYTES_TO_BITS(9));
inStream.IgnoreBytes(9);
uint32_t shirtColor;
inStream.Read(shirtColor);
uint32_t shirtStyle;