More work on item packet

This commit is contained in:
KimLS 2024-12-04 22:28:07 -08:00
parent c4a7fcc063
commit 2db1b1b9b0
2 changed files with 51 additions and 30 deletions

View File

@ -2859,19 +2859,40 @@ namespace Laurion
uchar* __emu_buffer = in->pBuffer; uchar* __emu_buffer = in->pBuffer;
ItemPacket_Struct* old_item_pkt = (ItemPacket_Struct*)__emu_buffer; ItemPacket_Struct* old_item_pkt = (ItemPacket_Struct*)__emu_buffer;
switch (old_item_pkt->PacketType) auto type = ServerToLaurionItemPacketType(old_item_pkt->PacketType);
if (type == structs::ItemPacketInvalid) {
delete in;
return;
}
switch (type)
{ {
case ItemPacketParcel: { case structs::ItemPacketType::ItemPacketParcel: {
//parcels are significantly changed so we will need to figure this out ParcelMessaging_Struct pms{};
EQ::Util::MemoryStreamReader ss(reinterpret_cast<char*>(in->pBuffer), in->size);
cereal::BinaryInputArchive ar(ss);
ar(pms);
uint32 player_name_length = pms.player_name.length();
uint32 note_length = pms.note.length();
auto* int_struct = (EQ::InternalSerializedItem_Struct*)pms.serialized_item.data();
SerializeBuffer buffer;
buffer.WriteInt32((int32_t)type);
SerializeItem(buffer, (const EQ::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
buffer.WriteUInt32(pms.sent_time);
buffer.WriteLengthString(pms.player_name);
buffer.WriteLengthString(pms.note);
auto outapp = new EQApplicationPacket(OP_ItemPacket, buffer.size());
outapp->WriteData(buffer.buffer(), buffer.size());
dest->FastQueuePacket(&outapp, ack_req);
break;
} }
default: { default: {
EQ::InternalSerializedItem_Struct* int_struct = (EQ::InternalSerializedItem_Struct*)(&__emu_buffer[4]); EQ::InternalSerializedItem_Struct* int_struct = (EQ::InternalSerializedItem_Struct*)(&__emu_buffer[4]);
auto type = ServerToLaurionItemPacketType(old_item_pkt->PacketType);
if (type == structs::ItemPacketInvalid) {
break;
}
SerializeBuffer buffer; SerializeBuffer buffer;
buffer.WriteInt32((int32_t)type); buffer.WriteInt32((int32_t)type);
SerializeItem(buffer, (const EQ::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType); SerializeItem(buffer, (const EQ::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
@ -4444,6 +4465,14 @@ namespace Laurion
return structs::ItemPacketType::ItemPacketCharInventory; return structs::ItemPacketType::ItemPacketCharInventory;
case ItemPacketType::ItemPacketLimbo: case ItemPacketType::ItemPacketLimbo:
return structs::ItemPacketType::ItemPacketLimbo; return structs::ItemPacketType::ItemPacketLimbo;
case ItemPacketType::ItemPacketWorldContainer:
return structs::ItemPacketType::ItemPacketWorldContainer;
case ItemPacketType::ItemPacketTributeItem:
return structs::ItemPacketType::ItemPacketTributeItem;
case ItemPacketType::ItemPacketGuildTribute:
return structs::ItemPacketType::ItemPacketGuildTribute;
case ItemPacketType::ItemPacketCharmUpdate:
return structs::ItemPacketType::ItemPacketCharmUpdate;
default: default:
return structs::ItemPacketType::ItemPacketInvalid; return structs::ItemPacketType::ItemPacketInvalid;
} }

View File

@ -609,32 +609,24 @@ namespace Laurion {
ItemPacketTradeView = 0x65, ItemPacketTradeView = 0x65,
ItemPacketLoot = 0x66, ItemPacketLoot = 0x66,
ItemPacketTrade = 0x67, ItemPacketTrade = 0x67,
//looks like they added something at 0x68 that didn't exist before and shifted everything after it up by 1
ItemPacketUnknown068 = 0x68, //Not sure but it seems to deal with the cursor somehow.
ItemPacketCharInventory = 0x6A, //Rof 0x69 -> Larion 0x6a (requires translation) ItemPacketCharInventory = 0x6A, //Rof 0x69 -> Larion 0x6a (requires translation)
ItemPacketLimbo = 0x6B, //0x6A -> 0x6B ItemPacketLimbo = 0x6B, //0x6A -> 0x6B
//ItemPacketWorldContainer = 0x6B, //These aren't found yet ItemPacketWorldContainer = 0x6C,
//ItemPacketTributeItem = 0x6C, ItemPacketTributeItem = 0x6D,
//ItemPacketGuildTribute = 0x6D, ItemPacketGuildTribute = 0x6E,
//ItemPacketCharmUpdate = 0x6E, // Larion has a specific packet for this ItemPacketCharmUpdate = 0x6f,
//ItemPacketRecovery = 0x71, ItemPacketRecovery = 0x72,
//ItemPacketParcel = 0x73, ItemPacketParcel = 0x74,
ItemPacketUnknown075 = 0x75, //Not sure but uses a lot of the same logic as the trade and char inventory types
ItemPacketOverflow = 0x76,
ItemPacketDragonHoard = 0x77,
ItemPacketTradeskill = 0x78,
ItemPacketTradeskillDepot = 0x79,
ItemPacketInvalid = 0xFF ItemPacketInvalid = 0xFF
}; };
/*
enum ItemPacketType
{
ItemPacketViewLink = 0x00,
ItemPacketTradeView = 0x65,
ItemPacketLoot = 0x66,
ItemPacketTrade = 0x67,
ItemPacketCharInventory = 0x69,
ItemPacketSummonItem = 0x6A,
ItemPacketTributeItem = 0x6C,
ItemPacketMerchant = 0x64,
ItemPacketWorldContainer = 0x6B
};
*/
#pragma pack() #pragma pack()
}; //end namespace structs }; //end namespace structs