U like code in darkness, without flashlight.
- first of all, BOOL - integer microsoft type,
bool - C++
byte type, u have prototype of original function with
bool (
byte) and in same time use for hook
BOOL (
int), its mistake what mean that u dont know what wait application in result
- ur income argument is
pointer type, not int, this function looks like:
bool IsJewelBundle(ItemObject* item), ur code work without crash only bcz main.exe builded for x32 system and pointer size is 4 bytes (like integer), but in x64 system its be 8 bytes
- dont know what u mean with ur own pointer idea, also and with "class method", but its just class object which have first element like unsigned short (int16), for what u place int16 in int32 too i cant understand, maybe byte-racism?
Method - its function inside class or structure object, so u get 'ur own pointer' not to method, u get 'ur own pointer' to variable.
Code:
class ItemObject {
public:
ItemObject() {} // method
virtual ~ItemObject() {} // too method
void Initialize() {} // too method
private:
short _index; // local variable
public:
short Index; // public variable
};
- boolean type its only 1 or 0, true or false, how u get value >= 2 if u use boolean which will return to u only 1 as maximum?...
----
in final u can improve ur code to like this:
Code:
bool IsJewelBundle(ItemObject* item) {
if (item == nullptr) {
return false;
}
if (item->Index >= ITEM_INDEX(12, 30) && item->Index <= ITEM_INDEX(12, 31) ||
item->Index >= ITEM_INDEX(12, 150) && item->Index <= ITEM_INDEX(12, 156)) {
return true;
}
return false;
// or call to original function if u catch not all code
// like: return ((bool (__cdecl*) (ItemObject*)) 0x5146C0) (item);
}
of course only if u sure that need use
bool :laugh:
P.S.: if u code all in this trash style i not recommend to sell anything, ur skill while small for it.