-
Active Member
[Classic] 1.13.5.35753 CGItem_C::Use
Was reversing some lua API garbage, as usual--I wanted to use my hearthstone in my bot, so here's some reversing info that I've done to accomplish this.
Code:
uint64_t CGItemUseOffset = 0x984660;
How to use an item on yourself:
Code:
bool CGItemUse(WowItem* item) {
WowGUID target_guid = { 0, 0 };
WowGUID v22 = { 0, 0 };
return reinterpret_cast<bool(__fastcall*)(WowItem* item_ptr, WowGUID* guid, bool unk1, WowGUID* unk2)>(baseAddress + CGItemUseOffset)(item, &target_guid, 0, &v22);
}
Too lazy to find this on the vtable...and too lazy to figure out what unk1 and unk2 here are. unk2 seems to be some out-parameter that's also 128-bit data.
target_guid is obtained by the following simplified pseudocode:
Code:
v16 = (_BYTE *)lua_tolstring_7FF60DD9C630(v2, 2u, 0i64);
sub_7FF60D871450(v16, 1i64, (__int64)&v20, 1, 0)
Inside sub_7FF60D871450, it does some stuff to grab the GUID of what your "target" is. If your target is "player", which is yourself, v20 is just filled with a null WowGUID--hence the code WowGUID target_guid = { 0, 0 };
If someone's interested in the bag garbage that I've also reversed, please let me know and I'll find some time to post it.
-
Post Thanks / Like - 3 Thanks
-
Contributor
I'm guessing its this one that I have:
Code:
DECLARE_FUNC(Item_UseItem, bool, __fastcall, (blizz::CGItem* _this, object_guid* target, bool skip_confirm, uint16_t* unk_2), detail::FunctionOffsets::Item_UseItem);
3rd argument is a boolean whether to show the confirmation dialog box for example override enchantments on gear. Or so I think, never really went deep into these functions. Interesting that you found 4th argument to be a guid pointer, I found it to be 16-bit integer.
-
Active Member
Originally Posted by
ejt
I'm guessing its this one that I have:
Code:
DECLARE_FUNC(Item_UseItem, bool, __fastcall, (blizz::CGItem* _this, object_guid* target, bool skip_confirm, uint16_t* unk_2), detail::FunctionOffsets::Item_UseItem);
3rd argument is a boolean whether to show the confirmation dialog box for example override enchantments on gear. Or so I think, never really went deep into these functions. Interesting that you found 4th argument to be a guid pointer, I found it to be 16-bit integer.
I'll look more into the 4th parameter. I remember seeing it as a int64, which then had an assignment to a 128-bit value in the function it was passed into, which made me believe it was a pointer to a GUID.