ByNameModding / BNM-Android

Modding il2cpp games by classes, methods, fields names on Android.
MIT License
218 stars 44 forks source link

Hooking question #7

Closed ADH36 closed 1 year ago

ADH36 commented 1 year ago

First of all sorry for noob question but i need help .

namespace Legion.Shared.Battles.Data.Stats {

public class AbilityStats : StatsBase<AbilityStats>
{

    public float HealingRadius
    {

        get
        {
            return 0f;
        }
    }

Imagine this is a game code , and i want to hook HealingRadius or say get_HealingRadius .

How would i do that ? i have tried multiple work arounds like -

auto Player = LoadClass("Legion.Shared.Model","AbilityStats"); HOOK(Player.GetMethodByName("get_Cooldown", 0.0).GetOffset(), get_CD, old_CD);

dll name - Legion.Shared.Model.dll

Help will be thankful .

chiteroman commented 1 year ago
LoadClass AbilityStats("Legion.Shared.Battles.Data.Stats", "AbilityStats");
auto HealingRadius = AbilityStats.GetPropertyByName("HealingRadius").getter.GetOffset();
HOOK(HealingRadius, my_custom_method, original_method);
ADH36 commented 1 year ago

No , it's not working with above solution as well .

BNM-Dev commented 1 year ago

No , it's not working with above solution as well .

It work with offsets?

ADH36 commented 1 year ago

Yup same source code , only change is offsets and yes it works with offsets .

BNM-Dev commented 1 year ago

Yup same source code , only change is offsets and yes it works with offsets .

Need see, because for me and a lot of other people BNM work without any problems.