Help! How to hook enum

ASDFGHJKLQWE

Solid & Active Platinian
Original poster
Jul 10, 2022
65
19
8
Nepal
// RVA: 0x25A2DAC Offset: 0x25A2DAC VA: 0x25A2DAC
public IList<LootRewardTags> get_RewardTag() { }


public enum LootRewardTags // TypeDefIndex: 3084
{
// Fields
public int value__; // 0x0
public const LootRewardTags DebugReward = -10;
public const LootRewardTags TutorialLoot = -1;
public const LootRewardTags InternalRareness1Common = 0;
public const LootRewardTags InternalRareness2Uncommon = 1;
public const LootRewardTags InternalRareness3Rare = 2;
public const LootRewardTags InternalRareness4Legendary = 3;
public const LootRewardTags InternalRareness5Epic = 4;
}
 

nik2143

Jr. PMT Modder
Staff member
Modding-Team
Jun 30, 2018
536
28,662
1,193
Italy
The enum is only a cool way to return an integer so if you want to return InternalRareness5Epic make your hook return an int with value 4
 

ASDFGHJKLQWE

Solid & Active Platinian
Original poster
Jul 10, 2022
65
19
8
Nepal
The enum is only a cool way to return an integer so if you want to return InternalRareness5Epic make your hook return an int with value 4
bool rewardtag;
void (*old_BeyRewardTag) (void *instance);
void reward(instance *instance){
if (instance != NULL){
if(rewardtag){
return 4;
}
}
return old_BeyRewardTag;
}

Are you saying like this
 

sobogamer_2020

Approved Modder
Approved Modder
Apr 6, 2022
384
14,843
1,193
23
Romania
bool rewardtag;
void (*old_BeyRewardTag) (void *instance);
void reward(instance *instance){
if (instance != NULL){
if(rewardtag){
return 4;
}
}
return old_BeyRewardTag;
}

Are you saying like this
It's not correct, declaring your variable as a void one (non-returnable), in the hook, and using the return part, would just result in an error.
 
  • Like
Reactions: ASDFGHJKLQWE