From ce54071296e99bb920e2af563ad53cfe9decef8a Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 10 Jan 2015 13:50:48 -0500 Subject: [PATCH] Added text link translators for OP_Emote --- changelog.txt | 3 +++ common/patches/rof.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/rof2.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/rof2_ops.h | 2 ++ common/patches/rof_ops.h | 2 ++ common/patches/sod.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/sod_ops.h | 2 ++ common/patches/sof.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/sof_ops.h | 2 ++ common/patches/titanium.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/titanium_ops.h | 2 ++ common/patches/underfoot.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/underfoot_ops.h | 2 ++ 13 files changed, 309 insertions(+) diff --git a/changelog.txt b/changelog.txt index 8d9ab0ff9..95204e643 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/10/2015 == +Uleat: Added text link translators for OP_Emote + == 01/09/2015 == Uleat: Added text link translators for OP_FormattedMessage diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index d915ae808..3fce18414 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -830,6 +830,34 @@ namespace RoF FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToRoFTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -4275,6 +4303,27 @@ namespace RoF FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + RoFToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_EnvDamage) { DECODE_LENGTH_EXACT(structs::EnvDamage2_Struct); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index dc6c60603..782df8be7 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -896,6 +896,34 @@ namespace RoF2 FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToRoF2TextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -4347,6 +4375,27 @@ namespace RoF2 FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + RoF2ToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_EnvDamage) { DECODE_LENGTH_EXACT(structs::EnvDamage2_Struct); diff --git a/common/patches/rof2_ops.h b/common/patches/rof2_ops.h index 7b4e6b7d4..c2a1bb5e6 100644 --- a/common/patches/rof2_ops.h +++ b/common/patches/rof2_ops.h @@ -42,6 +42,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GMLastName) @@ -134,6 +135,7 @@ D(OP_ConsiderCorpse) D(OP_Consume) D(OP_Damage) D(OP_DeleteItem) +D(OP_Emote) D(OP_EnvDamage) D(OP_FaceChange) D(OP_FindPersonRequest) diff --git a/common/patches/rof_ops.h b/common/patches/rof_ops.h index 8ce23e94a..ce994ea11 100644 --- a/common/patches/rof_ops.h +++ b/common/patches/rof_ops.h @@ -31,6 +31,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GMLastName) @@ -123,6 +124,7 @@ D(OP_ConsiderCorpse) D(OP_Consume) D(OP_Damage) D(OP_DeleteItem) +D(OP_Emote) D(OP_EnvDamage) D(OP_FaceChange) D(OP_FindPersonRequest) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 00ae9b3eb..34469d987 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -599,6 +599,34 @@ namespace SoD FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToSoDTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -2970,6 +2998,27 @@ namespace SoD FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + SoDToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_FaceChange) { DECODE_LENGTH_EXACT(structs::FaceChange_Struct); diff --git a/common/patches/sod_ops.h b/common/patches/sod_ops.h index 1eda944d0..5a1d313a2 100644 --- a/common/patches/sod_ops.h +++ b/common/patches/sod_ops.h @@ -22,6 +22,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GroundSpawn) @@ -91,6 +92,7 @@ D(OP_Consider) D(OP_ConsiderCorpse) D(OP_Consume) D(OP_DeleteItem) +D(OP_Emote) D(OP_FaceChange) D(OP_FindPersonRequest) D(OP_GroupCancelInvite) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index c503e2c5f..22e8771b6 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -586,6 +586,34 @@ namespace SoF FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToSoFTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -2370,6 +2398,27 @@ namespace SoF FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + SoFToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_FaceChange) { DECODE_LENGTH_EXACT(structs::FaceChange_Struct); diff --git a/common/patches/sof_ops.h b/common/patches/sof_ops.h index df58cffa8..08e30aeff 100644 --- a/common/patches/sof_ops.h +++ b/common/patches/sof_ops.h @@ -23,6 +23,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GroundSpawn) @@ -80,6 +81,7 @@ D(OP_Consider) D(OP_ConsiderCorpse) D(OP_Consume) D(OP_DeleteItem) +D(OP_Emote) D(OP_FaceChange) D(OP_FindPersonRequest) D(OP_GroupFollow) diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 97be94693..77077c3bc 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -455,6 +455,34 @@ namespace Titanium FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToTitaniumTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_FormattedMessage) { EQApplicationPacket *in = *p; @@ -1571,6 +1599,27 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + TitaniumToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_FaceChange) { DECODE_LENGTH_EXACT(structs::FaceChange_Struct); diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index ad3723ab6..47d992b16 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -16,6 +16,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_FormattedMessage) E(OP_GuildMemberLevelUpdate) E(OP_GuildMemberList) @@ -56,6 +57,7 @@ D(OP_ChannelMessage) D(OP_CharacterCreate) D(OP_Consume) D(OP_DeleteItem) +D(OP_Emote) D(OP_FaceChange) D(OP_InspectAnswer) D(OP_InspectRequest) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index e6c081823..fb5daa179 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -743,6 +743,34 @@ namespace Underfoot FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToUnderfootTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -3269,6 +3297,27 @@ namespace Underfoot FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + UnderfootToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_EnvDamage) { DECODE_LENGTH_EXACT(structs::EnvDamage2_Struct); diff --git a/common/patches/underfoot_ops.h b/common/patches/underfoot_ops.h index 2f0f8ba94..4443425fb 100644 --- a/common/patches/underfoot_ops.h +++ b/common/patches/underfoot_ops.h @@ -25,6 +25,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GroundSpawn) @@ -99,6 +100,7 @@ D(OP_ConsiderCorpse) D(OP_Consume) D(OP_Damage) D(OP_DeleteItem) +D(OP_Emote) D(OP_EnvDamage) D(OP_FaceChange) D(OP_FindPersonRequest)