-Added several opcodes; not all confirmed working yet.

-Partial support for item packet (several of the types have been shuffled so this will take a while to get working).
This commit is contained in:
KimLS
2024-12-04 21:07:50 -08:00
parent 2c48ec39ef
commit c4a7fcc063
4 changed files with 119 additions and 56 deletions
+62 -1
View File
@@ -71,6 +71,8 @@ namespace Laurion
static inline uint32 LaurionToServerCorpseMainSlot(uint32 laurion_corpse_slot);
static inline uint32 LaurionToServerTypelessSlot(structs::TypelessInventorySlot_Struct laurion_slot, int16 laurion_type);
structs::ItemPacketType ServerToLaurionItemPacketType(ItemPacketType laurion_type);
void Register(EQStreamIdentifier& into)
{
//create our opcode manager if we havent already
@@ -2850,6 +2852,39 @@ namespace Laurion
delete in;
}
ENCODE(OP_ItemPacket)
{
EQApplicationPacket* in = *p;
*p = nullptr;
uchar* __emu_buffer = in->pBuffer;
ItemPacket_Struct* old_item_pkt = (ItemPacket_Struct*)__emu_buffer;
switch (old_item_pkt->PacketType)
{
case ItemPacketParcel: {
//parcels are significantly changed so we will need to figure this out
}
default: {
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;
buffer.WriteInt32((int32_t)type);
SerializeItem(buffer, (const EQ::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
auto outapp = new EQApplicationPacket(OP_ItemPacket, buffer.size());
outapp->WriteData(buffer.buffer(), buffer.size());
dest->FastQueuePacket(&outapp, ack_req);
}
}
delete in;
}
// DECODE methods
DECODE(OP_EnterWorld)
@@ -3969,7 +4004,14 @@ namespace Laurion
if (server_slot < EQ::invtype::POSSESSIONS_SIZE) {
LaurionSlot.Type = invtype::typePossessions;
LaurionSlot.Slot = server_slot;
if (server_slot == EQ::invslot::slotCursor) {
LaurionSlot.Slot = invslot::slotCursor;
}
else
{
LaurionSlot.Slot = server_slot;
}
}
else if (server_slot <= EQ::invbag::CURSOR_BAG_END && server_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
@@ -4387,4 +4429,23 @@ namespace Laurion
return ServerSlot;
}
structs::ItemPacketType ServerToLaurionItemPacketType(ItemPacketType server_type) {
switch (server_type) {
case ItemPacketType::ItemPacketMerchant:
return structs::ItemPacketType::ItemPacketMerchant;
case ItemPacketType::ItemPacketTradeView:
return structs::ItemPacketType::ItemPacketTradeView;
case ItemPacketType::ItemPacketLoot:
return structs::ItemPacketType::ItemPacketLoot;
case ItemPacketType::ItemPacketTrade:
return structs::ItemPacketType::ItemPacketTrade;
case ItemPacketType::ItemPacketCharInventory:
return structs::ItemPacketType::ItemPacketCharInventory;
case ItemPacketType::ItemPacketLimbo:
return structs::ItemPacketType::ItemPacketLimbo;
default:
return structs::ItemPacketType::ItemPacketInvalid;
}
}
} /*Laurion*/
+1
View File
@@ -33,6 +33,7 @@ E(OP_Death)
E(OP_MoveItem)
E(OP_ExpUpdate)
E(OP_SendAATable)
E(OP_ItemPacket)
//list of packets we need to decode on the way in:
D(OP_EnterWorld)
D(OP_ZoneEntry)
+33 -1
View File
@@ -522,7 +522,6 @@ namespace Laurion {
/*08*/ int32 unknown2;
/*12*/ uint8 doorid;
/*13*/ uint8 padding2[3];
};
/*
@@ -603,6 +602,39 @@ namespace Laurion {
/*0028*/
};
//These are significantly changed in Laurion from RoF2
enum ItemPacketType {
//ItemPacketViewLink = 0x00,
ItemPacketMerchant = 0x64,
ItemPacketTradeView = 0x65,
ItemPacketLoot = 0x66,
ItemPacketTrade = 0x67,
ItemPacketCharInventory = 0x6A, //Rof 0x69 -> Larion 0x6a (requires translation)
ItemPacketLimbo = 0x6B, //0x6A -> 0x6B
//ItemPacketWorldContainer = 0x6B, //These aren't found yet
//ItemPacketTributeItem = 0x6C,
//ItemPacketGuildTribute = 0x6D,
//ItemPacketCharmUpdate = 0x6E, // Larion has a specific packet for this
//ItemPacketRecovery = 0x71,
//ItemPacketParcel = 0x73,
ItemPacketInvalid = 0xFF
};
/*
enum ItemPacketType
{
ItemPacketViewLink = 0x00,
ItemPacketTradeView = 0x65,
ItemPacketLoot = 0x66,
ItemPacketTrade = 0x67,
ItemPacketCharInventory = 0x69,
ItemPacketSummonItem = 0x6A,
ItemPacketTributeItem = 0x6C,
ItemPacketMerchant = 0x64,
ItemPacketWorldContainer = 0x6B
};
*/
#pragma pack()
}; //end namespace structs