Help! How to hook enum

ASDFGHJKLQWE

Solid & Active Platinian
// 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;
}
 
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
 
Example Hooking:
Code:
int CurrencySelectedType;

void(*old_Currency)(void*instance,int CurrencyType);
void Currency(void*instance,int CurrencyType) {
if (instance != NULL) {
if (CurrencySelectedType) {
old_Currency(instance,CurrencySelectedType);
return;
}
}
old_Currency(instance,CurrencyType);
}

Example EnumType:

Const CurrencyType None = 0;
Const CurrencyType Money = 1;
Const CurrencyType Gold = 2;
Const CurrencyType Gems = 3;

Code:
OBFUSCATE("1_Spinner_CurrencyType_None,Money,Gold,Gems"),

Cases Example:
Code:
case 1: switch(value) {
case 1: CurrencySelectedType = 0; break;
case 2: CurrencySelectedType = 1; break;
case 3: CurrencySelectedType = 2; break;
case 4: CurrencySelectedType = 3; break;
break
}
break;
 
Example Hooking:
Code:
int CurrencySelectedType;

void(*old_Currency)(void*instance,int CurrencyType);
void Currency(void*instance,int CurrencyType) {
if (instance != NULL) {
if (CurrencySelectedType) {
old_Currency(instance,CurrencySelectedType);
return;
}
}
old_Currency(instance,CurrencyType);
}

Example EnumType:

Const CurrencyType None = 0;
Const CurrencyType Money = 1;
Const CurrencyType Gold = 2;
Const CurrencyType Gems = 3;

Code:
OBFUSCATE("1_Spinner_CurrencyType_None,Money,Gold,Gems"),

Cases Example:
Code:
case 1: switch(value) {
case 1: CurrencySelectedType = 0; break;
case 2: CurrencySelectedType = 1; break;
case 3: CurrencySelectedType = 2; break;
case 4: CurrencySelectedType = 3; break;
break
}
break;[/COD how to set the value to 5000, or 99999
[/QUOTE]
 
Back
Top Bottom