From 24dbe6da0e5fae6367c8c4c11b9453254525b357 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 30 Dec 2024 19:10:56 -0800 Subject: [PATCH] Add tradeskill opcodes, some encodes and decodes to match rof2; i think they're all still the same but i could be wrong. --- common/patches/laurion.cpp | 49 ++++++++++++++++++++++++++++++++ common/patches/laurion_ops.h | 3 ++ common/patches/laurion_structs.h | 44 ++++++++++++++++++++++++++++ utils/patches/patch_Laurion.conf | 18 ++++++------ 4 files changed, 105 insertions(+), 9 deletions(-) diff --git a/common/patches/laurion.cpp b/common/patches/laurion.cpp index bfcb03ad8..bfc0d3d25 100644 --- a/common/patches/laurion.cpp +++ b/common/patches/laurion.cpp @@ -434,6 +434,22 @@ namespace Laurion dest->FastQueuePacket(&in, ack_req); } + ENCODE(OP_ClickObjectAction) + { + ENCODE_LENGTH_EXACT(ClickObjectAction_Struct); + SETUP_DIRECT_ENCODE(ClickObjectAction_Struct, structs::ClickObjectAction_Struct); + + OUT(drop_id); + eq->unknown04 = -1; + eq->unknown08 = -1; + OUT(type); + OUT(icon); + eq->unknown16 = 0; + OUT_str(object_name); + + FINISH_ENCODE(); + } + ENCODE(OP_ClientUpdate) { ENCODE_LENGTH_EXACT(PlayerPositionUpdateServer_Struct); @@ -2187,6 +2203,28 @@ namespace Laurion delete in; } + ENCODE(OP_RecipeAutoCombine) + { + ENCODE_LENGTH_EXACT(RecipeAutoCombine_Struct); + SETUP_DIRECT_ENCODE(RecipeAutoCombine_Struct, structs::RecipeAutoCombine_Struct); + + OUT(object_type); + OUT(some_id); + eq->container_slot = ServerToLaurionSlot(emu->unknown1); + structs::InventorySlot_Struct LaurionSlot; + LaurionSlot.Type = 8; // Observed + LaurionSlot.Padding1 = 0; + LaurionSlot.Slot = 0xffff; + LaurionSlot.SubIndex = 0xffff; + LaurionSlot.AugIndex = 0xffff; + LaurionSlot.Padding2 = 0; + eq->unknown_slot = LaurionSlot; + OUT(recipe_id); + OUT(reply_code); + + FINISH_ENCODE(); + } + ENCODE(OP_RemoveBlockedBuffs) { ENCODE_FORWARD(OP_BlockedBuffs); } ENCODE(OP_RespondAA) @@ -3613,6 +3651,17 @@ namespace Laurion FINISH_DIRECT_DECODE(); } + DECODE(OP_TradeSkillCombine) + { + DECODE_LENGTH_EXACT(structs::NewCombine_Struct); + SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); + + emu->container_slot = RoF2ToServerSlot(eq->container_slot); + emu->guildtribute_slot = RoF2ToServerSlot(eq->guildtribute_slot); // this should only return INVALID_INDEX until implemented + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_WearChange) { DECODE_LENGTH_EXACT(structs::WearChange_Struct); diff --git a/common/patches/laurion_ops.h b/common/patches/laurion_ops.h index 3e2485a84..30ad3c6b1 100644 --- a/common/patches/laurion_ops.h +++ b/common/patches/laurion_ops.h @@ -11,6 +11,7 @@ E(OP_BuffCreate) E(OP_CastSpell) E(OP_ChannelMessage) E(OP_CharInventory) +E(OP_ClickObjectAction) E(OP_ClientUpdate) E(OP_Consider) E(OP_Damage) @@ -37,6 +38,7 @@ E(OP_PlayerProfile) E(OP_RemoveBlockedBuffs) E(OP_RespondAA) E(OP_RequestClientZoneChange) +E(OP_RecipeAutoCombine) E(OP_SendAATable) E(OP_SendCharInfo) E(OP_SendMaxCharacters) @@ -76,6 +78,7 @@ D(OP_RemoveBlockedBuffs) D(OP_SetServerFilter) D(OP_ShopRequest) D(OP_SpawnAppearance) +D(OP_TradeSkillCombine) D(OP_WearChange) D(OP_ZoneEntry) D(OP_ZoneChange) diff --git a/common/patches/laurion_structs.h b/common/patches/laurion_structs.h index 9ed1829e4..6d14ccdb3 100644 --- a/common/patches/laurion_structs.h +++ b/common/patches/laurion_structs.h @@ -904,6 +904,50 @@ namespace Laurion { TypelessInventorySlot_Struct inventorySlot; uint32 success; }; + + /* + ** Click Object Acknowledgement Struct + ** Response to client clicking on a World Container (ie, forge) + ** Seems to have not changed from RoF2 + */ + struct ClickObjectAction_Struct { + /*00*/ //uint32 player_id; // Appears to have been removed + /*00*/ uint32 drop_id; // Appears to use the object_count field now + /*04*/ int32 unknown04; // Seen -1 + /*08*/ int32 unknown08; // Seen -1 + /*08*/ //uint32 open; // 1=opening, 0=closing - Removed? + /*12*/ uint32 type; // See object.h, "Object Types" + /*16*/ uint32 unknown16; // + /*20*/ uint32 icon; // Icon to display for tradeskill containers + /*24*/ uint32 unknown24; // + /*28*/ char object_name[64]; // Object name to display + /*92*/ + }; + + //received and sent back as an ACK with different reply_code + struct RecipeAutoCombine_Struct { + /*00*/ uint32 object_type; + /*04*/ uint32 some_id; + /*08*/ InventorySlot_Struct container_slot; //echoed in reply - Was uint32 unknown1 + /*20*/ InventorySlot_Struct unknown_slot; //echoed in reply + /*32*/ uint32 recipe_id; + /*36*/ uint32 reply_code; + /*40*/ + }; + + /* + ** New Combine Struct + ** Client requesting to perform a tradeskill combine + ** Size: 24 bytes + ** Used In: OP_TradeSkillCombine + ** Last Updated: 01-05-2013 + */ + struct NewCombine_Struct + { + /*00*/ InventorySlot_Struct container_slot; + /*12*/ InventorySlot_Struct guildtribute_slot; // Slot type is 8? (MapGuildTribute = 8) + /*24*/ + }; #pragma pack() }; //end namespace structs diff --git a/utils/patches/patch_Laurion.conf b/utils/patches/patch_Laurion.conf index 40381fe43..7471131f1 100644 --- a/utils/patches/patch_Laurion.conf +++ b/utils/patches/patch_Laurion.conf @@ -475,15 +475,15 @@ OP_ShopRetrieveParcel=0x0000 OP_ShopParcelIcon=0x0000 # tradeskill stuff: -OP_ClickObject=0x0000 -OP_ClickObjectAction=0x0000 -OP_ClearObject=0x0000 -OP_RecipeDetails=0x0000 -OP_RecipesFavorite=0x0000 -OP_RecipesSearch=0x0000 -OP_RecipeReply=0x0000 -OP_RecipeAutoCombine=0x0000 -OP_TradeSkillCombine=0x0000 +OP_ClickObject=0x687e +OP_ClickObjectAction=0x110f +OP_ClearObject=0x6155 +OP_RecipeDetails=0x01e7 +OP_RecipesFavorite=0x0495 +OP_RecipesSearch=0x2f4e +OP_RecipeReply=0x2cd2 +OP_RecipeAutoCombine=0x5dba +OP_TradeSkillCombine=0x4ed8 # Tribute Packets: OP_OpenTributeMaster=0x0000