mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 12:36:36 +00:00
Added text link translators for OP_TaskDescription (RoF+ -- all clients current)
This commit is contained in:
+46
-6
@@ -3249,16 +3249,55 @@ namespace RoF
|
||||
EQApplicationPacket *in = *p;
|
||||
*p = nullptr;
|
||||
|
||||
unsigned char *__emu_buffer = in->pBuffer;
|
||||
|
||||
char *InBuffer = (char *)in->pBuffer;
|
||||
char *block_start = InBuffer;
|
||||
|
||||
InBuffer += sizeof(TaskDescriptionHeader_Struct);
|
||||
uint32 title_size = strlen(InBuffer) + 1;
|
||||
InBuffer += title_size;
|
||||
|
||||
TaskDescriptionData1_Struct *emu_tdd1 = (TaskDescriptionData1_Struct *)InBuffer;
|
||||
emu_tdd1->StartTime = (time(nullptr) - emu_tdd1->StartTime); // RoF has elapsed time here rather than start time
|
||||
|
||||
InBuffer += sizeof(TaskDescriptionData1_Struct);
|
||||
uint32 description_size = strlen(InBuffer) + 1;
|
||||
InBuffer += description_size;
|
||||
InBuffer += sizeof(TaskDescriptionData2_Struct);
|
||||
|
||||
std::string old_message = InBuffer; // start 'Reward' as string
|
||||
std::string new_message;
|
||||
ServerToRoFTextLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
title_size + description_size + new_message.length() + 1;
|
||||
|
||||
in->pBuffer = new unsigned char[in->size];
|
||||
|
||||
char *OutBuffer = (char *)in->pBuffer;
|
||||
|
||||
memcpy(OutBuffer, block_start, (InBuffer - block_start));
|
||||
OutBuffer += (InBuffer - block_start);
|
||||
|
||||
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
|
||||
|
||||
InBuffer += strlen(InBuffer) + 1;
|
||||
|
||||
memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct));
|
||||
|
||||
delete[] __emu_buffer;
|
||||
dest->FastQueuePacket(&in, ack_req);
|
||||
|
||||
#if 0 // original code
|
||||
EQApplicationPacket *in = *p;
|
||||
*p = nullptr;
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_TaskDescription, in->size + 1);
|
||||
// Set the Write pointer as we don't know what has been done with the packet before we get it.
|
||||
in->SetReadPosition(0);
|
||||
// Copy the header
|
||||
//
|
||||
// Server header struct is { uint32; uint32; uint32; uint32; uint8; }
|
||||
// Yet, we're writing 5 uint32's... that's 17 vs 20 bytes...
|
||||
// 3 Bytes difference..but, we only increase packet size by 1 byte..something wrong here? -U
|
||||
// (Tying to add text link translators and can't figure out if '+1' size is a new RoF field or something else)
|
||||
//
|
||||
for (int i = 0; i < 5; ++i)
|
||||
outapp->WriteUInt32(in->ReadUInt32());
|
||||
|
||||
@@ -3278,6 +3317,7 @@ namespace RoF
|
||||
|
||||
delete in;
|
||||
dest->FastQueuePacket(&outapp, ack_req);
|
||||
#endif
|
||||
}
|
||||
|
||||
ENCODE(OP_TaskHistoryReply)
|
||||
|
||||
@@ -3315,6 +3315,51 @@ namespace RoF2
|
||||
EQApplicationPacket *in = *p;
|
||||
*p = nullptr;
|
||||
|
||||
unsigned char *__emu_buffer = in->pBuffer;
|
||||
|
||||
char *InBuffer = (char *)in->pBuffer;
|
||||
char *block_start = InBuffer;
|
||||
|
||||
InBuffer += sizeof(TaskDescriptionHeader_Struct);
|
||||
uint32 title_size = strlen(InBuffer) + 1;
|
||||
InBuffer += title_size;
|
||||
|
||||
TaskDescriptionData1_Struct *emu_tdd1 = (TaskDescriptionData1_Struct *)InBuffer;
|
||||
emu_tdd1->StartTime = (time(nullptr) - emu_tdd1->StartTime); // RoF2 has elapsed time here rather than start time
|
||||
|
||||
InBuffer += sizeof(TaskDescriptionData1_Struct);
|
||||
uint32 description_size = strlen(InBuffer) + 1;
|
||||
InBuffer += description_size;
|
||||
InBuffer += sizeof(TaskDescriptionData2_Struct);
|
||||
|
||||
std::string old_message = InBuffer; // start 'Reward' as string
|
||||
std::string new_message;
|
||||
ServerToRoF2TextLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
title_size + description_size + new_message.length() + 1;
|
||||
|
||||
in->pBuffer = new unsigned char[in->size];
|
||||
|
||||
char *OutBuffer = (char *)in->pBuffer;
|
||||
|
||||
memcpy(OutBuffer, block_start, (InBuffer - block_start));
|
||||
OutBuffer += (InBuffer - block_start);
|
||||
|
||||
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
|
||||
|
||||
InBuffer += strlen(InBuffer) + 1;
|
||||
|
||||
memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct));
|
||||
|
||||
delete[] __emu_buffer;
|
||||
dest->FastQueuePacket(&in, ack_req);
|
||||
|
||||
#if 0 // original code
|
||||
EQApplicationPacket *in = *p;
|
||||
*p = nullptr;
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_TaskDescription, in->size + 1);
|
||||
// Set the Write pointer as we don't know what has been done with the packet before we get it.
|
||||
in->SetReadPosition(0);
|
||||
@@ -3338,6 +3383,7 @@ namespace RoF2
|
||||
|
||||
delete in;
|
||||
dest->FastQueuePacket(&outapp, ack_req);
|
||||
#endif
|
||||
}
|
||||
|
||||
ENCODE(OP_TaskHistoryReply)
|
||||
|
||||
@@ -2201,15 +2201,15 @@ namespace SoD
|
||||
std::string new_message;
|
||||
ServerToSoDTextLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
title_size + description_size + new_message.length() + 1;
|
||||
|
||||
in->pBuffer = new unsigned char[in->size];
|
||||
|
||||
char *OutBuffer = (char *)in->pBuffer;
|
||||
|
||||
memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start));
|
||||
memcpy(OutBuffer, block_start, (InBuffer - block_start));
|
||||
OutBuffer += (InBuffer - block_start);
|
||||
|
||||
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
|
||||
|
||||
@@ -1800,15 +1800,15 @@ namespace SoF
|
||||
std::string new_message;
|
||||
ServerToSoFTextLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
title_size + description_size + new_message.length() + 1;
|
||||
|
||||
in->pBuffer = new unsigned char[in->size];
|
||||
|
||||
char *OutBuffer = (char *)in->pBuffer;
|
||||
|
||||
memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start));
|
||||
memcpy(OutBuffer, block_start, (InBuffer - block_start));
|
||||
OutBuffer += (InBuffer - block_start);
|
||||
|
||||
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
|
||||
|
||||
@@ -1258,7 +1258,7 @@ namespace Titanium
|
||||
|
||||
char *OutBuffer = (char *)in->pBuffer;
|
||||
|
||||
memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start));
|
||||
memcpy(OutBuffer, block_start, (InBuffer - block_start));
|
||||
OutBuffer += (InBuffer - block_start);
|
||||
|
||||
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
|
||||
|
||||
@@ -2467,15 +2467,15 @@ namespace Underfoot
|
||||
std::string new_message;
|
||||
ServerToUnderfootTextLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
title_size + description_size + new_message.length() + 1;
|
||||
|
||||
in->pBuffer = new unsigned char[in->size];
|
||||
|
||||
char *OutBuffer = (char *)in->pBuffer;
|
||||
|
||||
memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start));
|
||||
memcpy(OutBuffer, block_start, (InBuffer - block_start));
|
||||
OutBuffer += (InBuffer - block_start);
|
||||
|
||||
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
|
||||
|
||||
Reference in New Issue
Block a user