static bool BeforeSendData(CharacterCreatorController __instance) { MethodInfo PrepareDataBlobMethod = __instance.GetType().GetMethod("PrepareDataBlob", BindingFlags.NonPublic | BindingFlags.Instance); PrepareDataBlobMethod.Invoke(__instance, new object[] { }); FieldInfo DataBlobField = __instance.GetType().GetField("DataBlob", BindingFlags.NonPublic | BindingFlags.Instance); Blob CategoryDataBlob = (SendDataPatch.GetFieldValue(__instance, "DataBlob") as Blob); SendDataPatch.AddExtraCategoryDataToBlob(__instance, CategoryDataBlob); ClientContext.WebOverlayRenderer.Call("setData", CategoryDataBlob.ToString(), null, null, null, null, null); return(false); // Do not execute original }
/// <summary> /// Retrieve private field value through reflection /// </summary> /// <param name="__instance"></param> /// <param name="FieldName"></param> /// <returns></returns> static object GetFieldValue(CharacterCreatorController __instance, string FieldName) { FieldInfo Field = __instance.GetType().GetField(FieldName, BindingFlags.NonPublic | BindingFlags.Instance); Object FieldValue = Field.GetValue(__instance); return(FieldValue); }