Help! How to write the hook for this

xLots

Platinian
i want to make a coins and gems mod for a game and what i found on the dump is a bit different from versions before

i have this inside Wallet class
private readonly CurrencyMap<int> _currencyAmount; // 0x60
and this is what i think hold the coins and gems
class CurrencyMap<T>
public T Coins; // 0x0
public T Gems; // 0x0
public T Crown; // 0x0
public T Skulls; // 0x0
public T Shades; // 0x0
public T Merchandise; // 0x0
private Dictionary<CurrencyType, T> _map; // 0x0

how do i write the hook?
 
 
To modify the _currencyAmount field in the Wallet class, you will need to:

  1. Obtain a pointer to Wallet (the instance you want to modify).
  2. Get the offset of _currencyAmount (0x60).
  3. Access the CurrencyMap&lt;int&gt; structure inside _currencyAmount.
Modify the specific currency fields (Coins, Gems, etc.).


Since _currencyAmount is a readonly field, it is stored at offset 0x60 in the Wallet class.


C++:
// Define CurrencyMap<int> structure
struct CurrencyMap
{
    int Coins;
    int Gems;
    int Crown;
    int Skulls;
    int Shades;
    int Merchandise;
    void* _map; // Dictionary (not needed for simple modification)
};

// Function to modify Wallet currencies
void ModifyWallet(void* walletInstance)
{
    if (!walletInstance) return;

    // Get pointer to _currencyAmount field (offset 0x60)
    CurrencyMap* currencyMap = *(CurrencyMap**)((uintptr_t)walletInstance + 0x60);

    if (currencyMap)
    {
        // Modify currency values
        currencyMap->Coins = 99999;
        currencyMap->Gems = 9999;
        currencyMap->Crown = 500;
        currencyMap->Skulls = 250;
        currencyMap->Shades = 100;
        currencyMap->Merchandise = 50;

        std::cout << "[+] Wallet Modified: Coins = " << currencyMap->Coins << std::endl;
    }
    else
    {
        std::cout << "[-] Failed to access Wallet currencies!" << std::endl;
    }
}
 
Back
Top Bottom