From bd2798f2cc1fcb492d1365c96f39de639430a77e Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 28 Dec 2024 22:59:32 -0800 Subject: [PATCH] Add support for augment items. --- common/patches/laurion.cpp | 38 ++++++++++++++++++++++++++++++++ common/patches/laurion_ops.h | 3 +++ common/patches/laurion_structs.h | 23 +++++++++++++++++++ utils/patches/patch_Laurion.conf | 2 +- 4 files changed, 65 insertions(+), 1 deletion(-) diff --git a/common/patches/laurion.cpp b/common/patches/laurion.cpp index d5d55c303..c028db8ae 100644 --- a/common/patches/laurion.cpp +++ b/common/patches/laurion.cpp @@ -193,6 +193,18 @@ namespace Laurion FINISH_ENCODE(); } + ENCODE(OP_AugmentInfo) + { + ENCODE_LENGTH_EXACT(AugmentInfo_Struct); + SETUP_DIRECT_ENCODE(AugmentInfo_Struct, structs::AugmentInfo_Struct); + + OUT(itemid); + OUT(window); + strn0cpy(eq->augment_info, emu->augment_info, 64); + + FINISH_ENCODE(); + } + ENCODE(OP_BeginCast) { ENCODE_LENGTH_EXACT(BeginCast_Struct); @@ -3296,6 +3308,32 @@ namespace Laurion } // DECODE methods + DECODE(OP_AugmentInfo) + { + DECODE_LENGTH_EXACT(structs::AugmentInfo_Struct); + SETUP_DIRECT_DECODE(AugmentInfo_Struct, structs::AugmentInfo_Struct); + + IN(itemid); + IN(window); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_AugmentItem) + { + DECODE_LENGTH_EXACT(structs::AugmentItem_Struct); + SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct); + + emu->container_slot = LaurionToServerSlot(eq->container_slot); + emu->augment_slot = LaurionToServerSlot(eq->augment_slot); + emu->container_index = eq->container_index; + emu->augment_index = eq->augment_index; + emu->dest_inst_id = eq->dest_inst_id; + emu->augment_action = eq->augment_action; + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_BlockedBuffs) { DECODE_LENGTH_EXACT(structs::BlockedBuffs_Struct); diff --git a/common/patches/laurion_ops.h b/common/patches/laurion_ops.h index f481d96dc..14c8f8182 100644 --- a/common/patches/laurion_ops.h +++ b/common/patches/laurion_ops.h @@ -2,6 +2,7 @@ //list of packets we need to encode on the way out: E(OP_Action) E(OP_Animation) +E(OP_AugmentInfo) E(OP_BeginCast) E(OP_BlockedBuffs) E(OP_Buff) @@ -52,6 +53,8 @@ E(OP_ZonePlayerToBind) E(OP_ZoneSpawns) //list of packets we need to decode on the way in: +D(OP_AugmentInfo) +D(OP_AugmentItem) D(OP_BlockedBuffs) D(OP_CastSpell) D(OP_ChannelMessage) diff --git a/common/patches/laurion_structs.h b/common/patches/laurion_structs.h index d9ff005be..7c9870937 100644 --- a/common/patches/laurion_structs.h +++ b/common/patches/laurion_structs.h @@ -875,6 +875,29 @@ namespace Laurion { /*0152*/ uint16 unknown0152; /*0154*/ }; + + struct AugmentInfo_Struct + { + /*000*/ uint32 itemid; // id of the solvent needed + /*004*/ uint32 window; // window to display the information in + /*008*/ char augment_info[64]; // total packet length 80, all the rest were always 00 + /*072*/ uint32 unknown072; // seen 0, 56 + /*076*/ uint32 unknown076; // seen 8, 3, 11, always matches what client sends + /*080*/ + }; + + //seems to be unchanged from rof2? + //it's the same size at least + struct AugmentItem_Struct { + /*00*/ uint32 dest_inst_id; // The unique serial number for the item instance that is being augmented + /*04*/ uint32 container_index; // Seen 0 + /*08*/ InventorySlot_Struct container_slot; // Slot of the item being augmented + /*20*/ uint32 augment_index; // Seen 0 + /*24*/ InventorySlot_Struct augment_slot; // Slot of the distiller to use (if one applies) + /*36*/ int32 augment_action; // Guessed - 0 = augment, 1 = remove with distiller, 3 = delete aug + /*36*/ //int32 augment_slot; + /*40*/ + }; #pragma pack() }; //end namespace structs diff --git a/utils/patches/patch_Laurion.conf b/utils/patches/patch_Laurion.conf index 0b98ecc90..89aa1845c 100644 --- a/utils/patches/patch_Laurion.conf +++ b/utils/patches/patch_Laurion.conf @@ -321,7 +321,7 @@ OP_Translocate=0x2772 OP_Sacrifice=0x2cbf OP_PopupResponse=0x6be9 OP_OnLevelMessage=0x2a41 -OP_AugmentInfo=0x0000 +OP_AugmentInfo=0x2e11 OP_Petition=0x0000 OP_SomeItemPacketMaybe=0x0000 OP_PVPStats=0x0000