Closed evilmu closed 9 months ago
You can't just set OrderScore
to 10000.0f;
. You need instance of ProtoPartnerAnimalBreed
ProtoPartnerAnimalBreed MyAnimal= new ProtoPartnerAnimalBreed();
MyAnimal.OrderScore = 10000.0f;
I really didn't understand how to use it.
BNM has a lot of comments in src code. You can use:
LoadClass::CreateNewInstance
, LoadClass::CreateNewObject
, LoadClass::CreateNewObjectArgs
.
I don't know which one is better for you. Read comments in BNM.h
to find API that will be better for your problem.
I tried but without success look what I did:
Class: public sealed class FarmerNameManager : MonoBehaviour, IUserBlobCallbacks2, IUserBlobCallbacksBase Method: public void CreateFarmerName(string farmerName) { }
#if !BNM_DISABLE_NEW_CLASSES
using namespace BNM::Structures::Mono;
using namespace BNM::Operators;
BNM::LoadClass FarmerNameManagerClass{};
BNM::Method<monoString*> CreateFarmerNameMethod{};
void (*old_CreateFarmerNameA)(BNM::UnityEngine::Object*, monoString*);
void NewCreateFarmerName(BNM::UnityEngine::Object* instance, monoString* originalName) {
monoString* newNameA = BNM::CreateMonoString("BILL GATES");
old_CreateFarmerNameA(instance, newNameA);
}
void OnLoaded() {
using namespace BNM;
FarmerNameManagerClass = LoadClass(OBFUSCATE_BNM("Assembly-CSharp"), OBFUSCATE_BNM("FarmerNameManager"));
CreateFarmerNameMethod = FarmerNameManagerClass.GetMethodByName(OBFUSCATE_BNM("CreateFarmerName"), 1);
InvokeHook(CreateFarmerNameMethod, NewCreateFarmerName, old_CreateFarmerNameA);
}
#endif
case 14: {
BNM::AddOnLoadedEvent(OnLoaded);
break;
}
Thanks, could you show an example with a class
public class ProtoPartnerAnimalBreed : ProtoData // TypeDefIndex: 12771 { // Fields [ProtoMemberAttribute] // RVA: 0x3A5218 Offset: 0x3A5218 VA: 0x3A5218 public float OrderScore; // 0x10
OrderScore = 10000.0f;