Added text link translators for OP_TaskDescription (RoF+ -- all clients current)

This commit is contained in:
Uleat
2015-01-12 14:35:38 -05:00
parent 51fe41bf51
commit d5b24543e8
8 changed files with 109 additions and 22 deletions
+46 -6
View File
@@ -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)