Alright, so I was able to get Consume working (somewhat), but it doesn't look like we have the correct structure or OpCode for OP_Stamina, which is sent to the client after eating something. Here's the diff for OP_Consume:
Code:
Index: common/patches/SoF.cpp
===================================================================
--- common/patches/SoF.cpp (revision 343)
+++ common/patches/SoF.cpp (working copy)
@@ -1273,6 +1273,14 @@
FINISH_DIRECT_DECODE();
}
+DECODE(OP_Consume) {
+ DECODE_LENGTH_EXACT(structs::Consume_Struct);
+ SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct);
+ IN(slot);
+ emu->auto_consumed = 999; //auto_consumed, e7030000 = 0x37e = 999
+ emu->type = 1;//type, 1 = food, 2 = water
+ FINISH_DIRECT_DECODE();
+}
DECODE(OP_WhoAllRequest) {
DECODE_LENGTH_EXACT(structs::Who_All_Struct);
Index: common/patches/SoF_ops.h
===================================================================
--- common/patches/SoF_ops.h (revision 343)
+++ common/patches/SoF_ops.h (working copy)
@@ -26,6 +26,7 @@
E(OP_ExpansionInfo)
E(OP_LogServer)
E(OP_Damage)
+//E(OP_Stamina) //not sure we have the right structure
//E(OP_ZoneServerReady)
//E(OP_BazaarSearch)
//E(OP_Trader)
@@ -43,6 +44,7 @@
D(OP_ClientUpdate)
D(OP_MoveItem)
D(OP_WhoAllRequest)
+D(OP_Consume)
//D(OP_SendExpZonein)
//D(OP_TraderBuy)
#undef E
Index: common/patches/SoF_structs.h
===================================================================
--- common/patches/SoF_structs.h (revision 343)
+++ common/patches/SoF_structs.h (working copy)
@@ -1426,12 +1428,22 @@
};
struct Consume_Struct
{
/*0000*/ int32 slot;
-/*0004*/ int32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click
-/*0008*/ int8 c_unknown1[4];
-/*0012*/ int8 type; // 0x01=Food 0x02=Water
-/*0013*/ int8 unknown13[3];
+/*0004*/ int32 unknown4; // usually 0x0, but also saw 0x43
};
Unfortunately, I'm not sure what the best way is to figure out the OpCode/Struct for OP_Stamina... In addition, I'm not sure how exactly I can pull the inventory from here to get the item stored in "slot" & look at the ItemType to see if it is food or drink (cast to Client/Mob/Entity from a packet?). Any thoughts?