public static void SetupDictionary() { _logger.LogMessage("Setting up!"); //Delimiter credit: https://github.com/KomradeSpectre/AetheriumMod/blob/c6fe6e8a30c3faf5087802ad7e5d88020748a766/Aetherium/Items/AccursedPotion.cs#L349 TeamIndex teamIndex = TeamIndex.None; foreach (var value in new string[] { cfgNone.Value, cfgNeutral.Value, cfgPlayer.Value, cfgMonster.Value, cfgLunar.Value }) { _logger.LogMessage($"Adding bodies to TeamIndex: {teamIndex}"); var valueArray = value.Split(','); if (valueArray.Length > 0) { foreach (string valueToTest in valueArray) { var bodyIndex = BodyCatalog.FindBodyIndex(valueToTest); if (bodyIndex == BodyIndex.None) { continue; } bodyIndex_to_teamIndex.Add(bodyIndex, teamIndex); _logger.LogMessage(valueToTest); } } teamIndex++; } //bodyIndex_to_teamIndex.Add(BodyCatalog.FindBodyIndex("ImpBody"), TeamIndex.Lunar); //bodyIndex_to_teamIndex.Add(BodyCatalog.FindBodyIndex("ImpBossBody"), TeamIndex.Lunar); }
public override void Load() { try { Logger = Log; GameOptionsData.RecommendedImpostors = GameOptionsData.MaxImpostors = Enumerable.Repeat <int>(255, 255).ToArray <int>(); Logger.LogMessage("Patching harmony..."); Logger.LogInfo("Succesfully loaded CorsacHats"); Attribute[] attrs = Attribute.GetCustomAttributes(typeof(MyHats.HatManagerHatsPatch)); foreach (Attribute attr in attrs) { Logger.LogMessage($"Looking {attr.GetType()}"); } if (attrs.Length == 0) { Logger.LogError("HarmonyPatchers not found."); } _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); Logger.LogMessage($"Is patched? {Harmony.HasAnyPatches(_harmony.Id)}"); } catch (Exception e) { Log.LogError(e); throw e; } }
public void SetupConfig() { cfgCurrentLanguage = Config.Bind("LANG", GetToken("CFG_LanguageString", Language.currentLanguageName), Language.currentLanguageName).Value; if (cfgCurrentLanguage != Language.currentLanguageName) { _logger.LogMessage($"{cfgCurrentLanguage} does not match {Language.currentLanguageName}"); ResetConfig(); } var categoryName = GetToken("CFG_Category1"); cfgBaseAmount = Config.Bind(categoryName, GetToken("CFG_BaseAmount"), 1f, GetToken("CFG_BaseAmountDescription")).Value; cfgStackAmount = Config.Bind(categoryName, GetToken("CFG_StackAmount"), 0.25f, GetToken("CFG_StackAmountDescription")).Value; }
public override void Load() { log = Log; log.LogMessage("Loading..."); if (!AutoUpdate.CheckUpdate()) { log.LogError("Not Loaded... old version and not have update"); return; } ClassInjector.RegisterTypeInIl2Cpp <MyClass>(); MyOptions.CustomGameOptions = new MyOptions(); ClientSocket.BuildUri(""); _harmony.PatchAll(); log.LogMessage("Loaded..."); }
public override void Load() { log.LogMessage("Sheriff Mod loaded"); Name = Config.Bind("Custom", "Name", "Custom"); Ip = Config.Bind("Custom", "Ipv4 or Hostname", "127.0.0.1"); Port = Config.Bind("Custom", "Port", (ushort)22023); var defaultRegions = ServerManager.DefaultRegions.ToList(); var ip = Ip.Value; if (Uri.CheckHostName(Ip.Value).ToString() == "Dns") { log.LogMessage("Resolving " + ip + " ..."); try { foreach (IPAddress address in Dns.GetHostAddresses(Ip.Value)) { if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { ip = address.ToString(); break; } } } catch { log.LogMessage("Hostname could not be resolved" + ip); } log.LogMessage("IP is " + ip); } var port = Port.Value; //adding custom server region defaultRegions.Insert(defaultRegions.Count, new StaticRegionInfo( Name.Value, (StringNames)CustomStringNames.CustomServerName, ip, new[] { new ServerInfo($"{Name.Value}-Master-1", ip, port) }).Duplicate() ); ServerManager.DefaultRegions = defaultRegions.ToArray(); this.harmony.PatchAll(); }
internal static void Log(object input) { if (logger != null) { logger.LogMessage(input); } }
public override void Load() { log = Log; log.LogMessage("Jester Mod Loaded"); Harmony.PatchAll(); }
public override void Load() { log.LogMessage("Sheriff Mod loaded"); Name = Config.Bind("Custom", "Name", "Custom"); Ip = Config.Bind("Custom", "Ipv4 or Hostname", "127.0.0.1"); Port = Config.Bind("Custom", "Port", (ushort)22023); var defaultRegions = AOBNFCIHAJL.DefaultRegions.ToList(); var ip = Ip.Value; if (Uri.CheckHostName(Ip.Value).ToString() == "Dns") { log.LogMessage("Resolving " + ip + " ..."); try { foreach (IPAddress address in Dns.GetHostAddresses(Ip.Value)) { if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { ip = address.ToString(); break; } } } catch { log.LogMessage("Hostname could not be resolved" + ip); } log.LogMessage("IP is " + ip); } var port = Port.Value; defaultRegions.Insert(0, new OIBMKGDLGOG( Name.Value, ip, new[] { new PLFDMKKDEMI($"{Name.Value}-Master-1", ip, port) }) ); AOBNFCIHAJL.DefaultRegions = defaultRegions.ToArray(); this.harmony.PatchAll(); }
public static void ConsoleDump(BepInEx.Logging.ManualLogSource logger, FilingDictionary <CatalogBoilerplate> instances) { int longestClassName = 0; int longestObjectName = 0; var allStrings = new List <ConsoleStrings>(); foreach (CatalogBoilerplate x in instances) { var strings = x.GetConsoleStrings(); allStrings.Add(strings); longestClassName = Mathf.Max(strings.className.Length, longestClassName); longestObjectName = Mathf.Max(strings.objectName.Length, longestObjectName); } logger.LogMessage("Index dump follows (pairs of name / index):"); foreach (ConsoleStrings strings in allStrings) { logger.LogMessage($"{strings.className.PadLeft(longestClassName)} {strings.objectName.PadRight(longestObjectName)} / {strings.formattedIndex}"); } }
public RunTimer(int newFile, int cat, int difficulty) : this() { //beginning a new run runFile = newFile; if (cat < categories.Length) { //default to Normal if (difficulty == 0) { difficulty = 2; } category = categories[cat] + " " + difficulties[difficulty]; goal = goals[cat]; refresh(); } else { Logger.LogMessage("invalid category, so no category loaded"); } }
public void Awake() { IcarusColorPickerPlugin.Config = base.Config; IcarusColorPickerPlugin.Logger = base.Logger; Logger.LogMessage("Loading IcarusColorPicker configs..."); ChangeColors(null, null); Config.ConfigReloaded += ChangeColors; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), ModGuid); }
/// <summary> /// 取得字體 /// </summary> /// <param name="fontName">字體名稱</param> /// <returns></returns> public static Font GetFont(string fontName) { if (!CheckFontInOS(fontName)) { Logger.LogMessage($"Cannot find {fontName} in your System."); FallbackFont(); } else if (DynamicFonts.Count >= 499) { Logger.LogMessage($"Based on Unity's limitations, you can't generate more than 500 different fonts at the same time."); Logger.LogMessage($"Please restart Studio."); FallbackFont(); } if (!DynamicFonts.ContainsKey(fontName)) { DynamicFonts.Add(fontName, Font.CreateDynamicFontFromOSFont(new string[] { fontName, "Arial" }, 30)); } return(DynamicFonts[fontName]); void FallbackFont() { if (CheckFontInOS("MS Gothic")) { Logger.LogMessage($"Fallback to MS Gothic"); fontName = "MS Gothic"; } else { Logger.LogMessage($"Use Unity BuiltinResource Arial."); fontName = "Arial"; } } }
public RunTimer(int newFile, int cat, int difficulty) : this() { //beginning a new run runFile = newFile; if (cat < categories.Length) { category = categories[cat] + " " + difficulties[difficulty]; goal = goals[cat]; //search for comparison date splits string target = "splits/data/" + category + " Dates.txt"; string target2 = "splits/data/" + category + " Bonuses.txt"; ReadFile(target, comparisonDates); ReadFile(target2, comparisonBonuses); //search for gold splits target = "splits/data/" + category + " Dates Golds.txt"; target2 = "splits/data/" + category + " Bonuses Golds.txt"; ReadFile(target, goldDates); ReadFile(target2, goldBonuses); } else { Logger.LogMessage("invalid category, so no category loaded"); } }
public override void Load() { RegisterInIl2CppAttribute.Register(); RegisterCustomRpcAttribute.Register(this); log = Log; log.LogMessage("squarewaterlemon More Roles Mod Loaded!"); // Credit given in the Ping Tracker & Github CustomOption.ShamelessPlug = false; Harmony.PatchAll(); }
private void PrintGameObjects() { string text = ""; foreach (GameObject obj in Resources.FindObjectsOfTypeAll <GameObject>()) { foreach (MonoBehaviour comp in obj.GetComponents <MonoBehaviour>()) { text = string.Concat(new string[] { text, obj.name, " - ", comp.GetType().Name, " - tag: ", comp.tag, " <> enabled: ", comp.enabled.ToString(), "\n" }); } } Logger.LogMessage(text); }
public void Start() { cfgNoWarnings = Config.Bind("", "No Warnings", false, "If true, then the animations that play with errors will play."); if (cfgNoWarnings.Value) { _logger.LogMessage("Config Setting \"No Warnings\" set to true, " + "Charge animations for Bandit2, Engineer, MUL-T, and REX will heft up the size of your log."); } On.EntityStates.GlobalSkills.LunarNeedle.FireLunarNeedle.OnEnter += FireLunarNeedle_OnEnter; On.EntityStates.GlobalSkills.LunarNeedle.ChargeLunarSecondary.PlayChargeAnimation += ChargeLunarSecondary_PlayChargeAnimation; On.EntityStates.GlobalSkills.LunarNeedle.ThrowLunarSecondary.PlayThrowAnimation += ThrowLunarSecondary_PlayThrowAnimation; On.EntityStates.GhostUtilitySkillState.OnEnter += GhostUtilitySkillState_OnEnter; On.EntityStates.EntityState.OnExit += EntityState_OnExit; CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; //On.EntityStates.GlobalSkills.LunarDetonator.Detonate.OnEnter += Detonate_OnEnter; }
public void Awake() { _logger = Logger; SetupDeployableSlots(); ModifyPrefabs(); if (!scanner.GetComponent <Deployable>()) { _logger.LogError("f**k"); } On.RoR2.EquipmentSlot.FireScanner += EquipmentSlot_FireScanner; On.RoR2.EquipmentSlot.FireGateway += EquipmentSlot_FireGateway; On.RoR2.EquipmentSlot.FireSaw += EquipmentSlot_FireSaw; On.RoR2.EquipmentSlot.FireBlackhole += EquipmentSlot_FireBlackhole; _logger.LogMessage($"Modded deployable count: {DeployableAPI.ModdedDeployableSlotCount}"); }
public static void Initialize() { neededTypes = new List <string>(); PluginPaths = new List <string> { Paths.PluginPath }; if (BepInEx.Preloader.Patching.AssemblyPatcher.PatcherPlugins.Any((x) => { return(x.TypeName == "BepInEx.MultiFolderLoader.MultiFolderLoader"); })) { Logger.LogMessage("BepInEx is running MultiFolderLoader"); GetPluginListsFromMultiFolder(); } }
public static void Debug(object obj, int level, int line, string caller, string path) { var msg = $"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} {path.Split('\\').Last()} {caller}:{line} {obj}"; switch (level) { case 0: log.LogMessage(msg); break; case 1: log.LogWarning(msg); break; case 2: log.LogError(msg); break; default: log.LogFatal(msg); break; } }
private static void Initialize() { #region [AssetBundle Loading - Put the AssetBundles folder in the Game root folder!] if (testAssetBundle == null) { if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\AssetBundles\\testassetbundle")) { log.LogMessage(" "); log.LogMessage("Trying to Load AssetBundle..."); testAssetBundle = Il2CppAssetBundleManager.LoadFromFile(AppDomain.CurrentDomain.BaseDirectory + "\\AssetBundles\\testassetbundle"); if (testAssetBundle == null) { log.LogMessage("AssetBundle Failed to Load!"); return; } #region [Print out asset names/paths] log.LogMessage("Assets:"); foreach (var asset in testAssetBundle.AllAssetNames()) { log.LogMessage(" Asset Name: " + asset.ToString()); } #endregion #region [Test Loading a prefab and instantiating it] /* * * // NOTE: There's currently a error in Unhollower that throws a NullReference exception, but the object and components DO get instantiated * // but the prefab doesn't display. It and it's components are running though. * * log.LogMessage("Trying to Load Prefab..."); * * var prefab = testAssetBundle.LoadAsset<GameObject>("SOME PREFAB ASSET"); * if (prefab != null) * { * log.LogMessage("Asset Loaded!"); * * // Instantiate the object * log.LogMessage("Trying to Instantiate Prefab..."); * var t = Instantiate(prefab, new Vector3(0f, 0f), Quaternion.identity); * if (t != null) { log.LogMessage("Prefab Instantiated! Position: " + t.transform.position.ToString()); } else { log.LogMessage("Failed to Instantiated Prefab!"); } * #region[Test adding a custom component and make sure it works] *//* * if (t != null) * { * log.LogMessage("Test adding a custom component and make sure it works"); * var type = UnhollowerRuntimeLib.Il2CppType.Of<WindowDragHandler>(); * comp = t.AddComponent(type).Cast<WindowDragHandler>(); * log.LogMessage("Component testBool: " + comp.testBool.ToString()); * } *//* #endregion * } * else { log.LogMessage("Failed to Load Asset!"); } */ #endregion log.LogMessage("Complete!"); } else { log.LogWarning("Skipping AssetBundle Loading - testassetBundle Doesn't Exist at: " + AppDomain.CurrentDomain.BaseDirectory + "\\AssetBundles\\testassetbundle"); log.LogWarning("Make sure the 'AssetBundles' folder from the Git Repo exists in the Game's root folder!"); } } #endregion // Create a uGUI UI instance.CreateUI(); #region [Display HotKeys] log.LogMessage(" "); log.LogMessage("HotKeys:"); log.LogMessage(" Shift+Delete = Enable/Disable Option Toggle"); log.LogMessage(" Keypress + optionToggle = Display Mouse/World/Viewport Positions for Debugging"); log.LogMessage(" A = Dump All Scene's Objects (w/ optionToggle True prints components also)"); log.LogMessage(" R = Dump Current Scene's Root Objects w/ Values (w/ optionToggle True prints components also)"); log.LogMessage(" S = Display Scene Details"); log.LogMessage(" U = Test Creating UI Elements"); log.LogMessage(" X = Dump Objects to XML (w/ optionToggle uses FindObjectsOfType<>() (Finds more, but loss of Hierarchy)"); log.LogMessage(" T = Toggle GUI GameObject Tooltip w/ optionToggle (Drag mouse around while holding down mouse button)"); log.LogMessage(" Tab = Test Unity MonoBehavior Events"); log.LogMessage(" "); #endregion initialized = true; }
public static void TestAllPermutations() { PlayerFile file = Game.Persistence.playerFile; List <GirlPairDefinition> allPairs = Game.Data.GirlPairs.GetAllBySpecial(false); List <int> possiblePairs = new List <int>(); Dictionary <int, int> occurences = new Dictionary <int, int>(); Dictionary <int, int> phaseoccurences = new Dictionary <int, int>(); phaseoccurences.Add((int)ClockDaytimeType.MORNING, 0); phaseoccurences.Add((int)ClockDaytimeType.AFTERNOON, 0); phaseoccurences.Add((int)ClockDaytimeType.EVENING, 0); phaseoccurences.Add((int)ClockDaytimeType.NIGHT, 0); Dictionary <GirlDefinition, bool> impossibleGirls = new Dictionary <GirlDefinition, bool>(); foreach (GirlPairDefinition p in allPairs) { //ignore pairs that have a girl I'm currently with if (file.girlPairDefinition && (file.girlPairDefinition.girlDefinitionOne == p.girlDefinitionOne || file.girlPairDefinition.girlDefinitionTwo == p.girlDefinitionOne || file.girlPairDefinition.girlDefinitionOne == p.girlDefinitionTwo || file.girlPairDefinition.girlDefinitionTwo == p.girlDefinitionTwo)) { continue; } //ignore pairs who meet where i'm at currently if (file.GetPlayerFileGirlPair(p).relationshipType == GirlPairRelationshipType.UNKNOWN && p.meetingLocationDefinition == file.locationDefinition) { continue; } //ignore pairs with no known girl if (!file.GetPlayerFileGirl(p.girlDefinitionOne).playerMet&& !file.GetPlayerFileGirl(p.girlDefinitionTwo).playerMet) { continue; } //ignore lovers, and attracted pairs that can't f**k if (file.GetPlayerFileGirlPair(p).relationshipType == GirlPairRelationshipType.LOVERS) { continue; } if (file.GetPlayerFileGirlPair(p).relationshipType == GirlPairRelationshipType.ATTRACTED && (file.daytimeElapsed + 1) % 4 != (int)p.sexDaytime) { continue; } //non-intro pairs require us to have met both girls if (!p.introductionPair && (!file.GetPlayerFileGirl(p.girlDefinitionOne).playerMet || !file.GetPlayerFileGirl(p.girlDefinitionTwo).playerMet)) { continue; } //in the end our pair list should have: DTF pairs, valid intro and new pairs, and compatible pairs possiblePairs.Add(p.id); occurences.Add(p.id, 0); } //we now have the shuffled list of every order of girl pairs that could possibly exist. (line 17 of populatefinderslots, but smaller) //now just check through each like the game does //11 pairs = 39,916,800 permutations. This is too much if (possiblePairs.Count >= 9) { Logger.LogMessage("Number of possible pairs is too large to permute! (" + possiblePairs.Count + ")"); return; } IList <IList <int> > permutations = Permute(possiblePairs.ToArray()); Logger.LogMessage("Total permutations: " + permutations.Count); string str = "\n"; foreach (IList <int> i in permutations) { //convert the permutated ints back into a girl pair list List <PlayerFileGirlPair> list = new List <PlayerFileGirlPair>(); foreach (int j in i) { list.Add(file.GetPlayerFileGirlPair(Game.Data.GirlPairs.Get(j))); } //blank lists used to keep track of selected pairs and definitions List <GirlPairDefinition> list2 = new List <GirlPairDefinition>(); List <LocationDefinition> list3 = new List <LocationDefinition>(); //this code has some extraneous checks removed, because we already handled those checks earlier //like if we've met either girl or if the attracted pair is DTF for (int l = 0; l < list.Count; l++) { if (list[l].relationshipType == GirlPairRelationshipType.ATTRACTED) { l = AddToFinderLists(list2, list3, list[l].girlPairDefinition, null, list); } } for (int m = 0; m < list.Count; m++) { if (list[m].relationshipType == GirlPairRelationshipType.UNKNOWN && list[m].girlPairDefinition.introductionPair && !list3.Contains(list[m].girlPairDefinition.meetingLocationDefinition)) { m = AddToFinderLists(list2, list3, list[m].girlPairDefinition, list[m].girlPairDefinition.meetingLocationDefinition, list); } } for (int n = 0; n < list.Count; n++) { if ((list[n].relationshipType == GirlPairRelationshipType.UNKNOWN && !list[n].girlPairDefinition.introductionPair && !list3.Contains(list[n].girlPairDefinition.meetingLocationDefinition)) || list[n].relationshipType == GirlPairRelationshipType.COMPATIBLE) { n = AddToFinderLists(list2, list3, list[n].girlPairDefinition, (list[n].relationshipType == GirlPairRelationshipType.UNKNOWN) ? list[n].girlPairDefinition.meetingLocationDefinition : null, list); } } //list2 is now all the girls string testOutput = ""; int[] foundtimes = new int[4]; foreach (GirlPairDefinition gpd in list2) { testOutput += gpd.girlDefinitionOne.girlName + "&" + gpd.girlDefinitionTwo.girlName + ", "; occurences[gpd.id] = occurences[gpd.id] + 1; //i think the sex daytime info is only useful if it's not a DTF pair if (file.GetPlayerFileGirlPair(gpd).relationshipType != GirlPairRelationshipType.ATTRACTED) { foundtimes[(int)gpd.sexDaytime] += 1; } } for (int t = 0; t <= 3; t++) { if (foundtimes[t] > 0) { phaseoccurences[t] = phaseoccurences[t] + 1; } } //Logger.LogDebug(testOutput); } //this is so lazy lol for (int i = 0; i < 30; i++) { if (occurences.ContainsKey(i) && occurences[i] > 0) { str += Game.Data.GirlPairs.Get(i).girlDefinitionOne.girlName + " & " + Game.Data.GirlPairs.Get(i).girlDefinitionTwo.girlName + //" (" + file.GetPlayerFileGirlPair(Game.Data.GirlPairs.Get(i)).relationshipType + ")" + ": " + occurences[i] + "/" + permutations.Count + " (" + ((occurences[i] / (float)permutations.Count) * 100).ToString("F") + "%)\n"; } } str += "\n"; for (int i = 0; i <= 3; i++) { str += "New " + (ClockDaytimeType)i + " Sex Pair Chance: " + phaseoccurences[i] + "/" + permutations.Count + " (" + ((phaseoccurences[i] / (float)permutations.Count) * 100).ToString("F") + "%)\n"; } Logger.LogMessage(str); }
public override void Load() { #region [Register TrainerComponent in Il2Cpp] log.LogMessage("Registering C# Type's in Il2Cpp"); try { // Trainer ClassInjector.RegisterTypeInIl2Cpp <Bootstrapper>(); ClassInjector.RegisterTypeInIl2Cpp <TrainerComponent>(); // UI ClassInjector.RegisterTypeInIl2Cpp <UIControls>(); ClassInjector.RegisterTypeInIl2Cpp <WindowDragHandler>(); ClassInjector.RegisterTypeInIl2Cpp <TooltipGUI>(); // Debugging ClassInjector.RegisterTypeInIl2Cpp <Trainer.Tools.EventTestComponent>(); } catch { log.LogError("FAILED to Register Il2Cpp Type!"); } #endregion #region [Harmony Patching] try { log.LogMessage(" "); log.LogMessage("Inserting Harmony Hooks..."); var harmony = new Harmony("wh0am15533.trainer.il2cpp"); #region [Enable/Disable Harmony Debug Log] //Harmony.DEBUG = true; (Old) //HarmonyFileLog.Enabled = true; #endregion #region [Update() Hook - Only Needed for Bootstrapper] var originalUpdate = AccessTools.Method(typeof(UnityEngine.UI.CanvasScaler), "Update"); log.LogMessage(" Original Method: " + originalUpdate.DeclaringType.Name + "." + originalUpdate.Name); var postUpdate = AccessTools.Method(typeof(Trainer.Bootstrapper), "Update"); log.LogMessage(" Postfix Method: " + postUpdate.DeclaringType.Name + "." + postUpdate.Name); harmony.Patch(originalUpdate, postfix: new HarmonyMethod(postUpdate)); #endregion #region [IBeginDragHandler, IDragHandler, IEndDragHandler Hooks] // These are required since UnHollower doesn't support Interfaces yet - Only needed if you need these events. // IBeginDragHandler var originalOnBeginDrag = AccessTools.Method(typeof(UnityEngine.EventSystems.EventTrigger), "OnBeginDrag"); log.LogMessage(" Original Method: " + originalOnBeginDrag.DeclaringType.Name + "." + originalOnBeginDrag.Name); var postOnBeginDrag = AccessTools.Method(typeof(WindowDragHandler), "OnBeginDrag"); log.LogMessage(" Postfix Method: " + postOnBeginDrag.DeclaringType.Name + "." + postOnBeginDrag.Name); harmony.Patch(originalOnBeginDrag, postfix: new HarmonyMethod(postOnBeginDrag)); // IDragHandler var originalOnDrag = AccessTools.Method(typeof(UnityEngine.EventSystems.EventTrigger), "OnDrag"); log.LogMessage(" Original Method: " + originalOnDrag.DeclaringType.Name + "." + originalOnDrag.Name); var postOnDrag = AccessTools.Method(typeof(WindowDragHandler), "OnDrag"); log.LogMessage(" Postfix Method: " + postOnDrag.DeclaringType.Name + "." + postOnDrag.Name); harmony.Patch(originalOnDrag, postfix: new HarmonyMethod(postOnDrag)); // IEndDragHandler var originalOnEndDrag = AccessTools.Method(typeof(UnityEngine.EventSystems.EventTrigger), "OnEndDrag"); log.LogMessage(" Original Method: " + originalOnEndDrag.DeclaringType.Name + "." + originalOnEndDrag.Name); var postOnEndDrag = AccessTools.Method(typeof(WindowDragHandler), "OnEndDrag"); log.LogMessage(" Postfix Method: " + postOnEndDrag.DeclaringType.Name + "." + postOnEndDrag.Name); harmony.Patch(originalOnEndDrag, postfix: new HarmonyMethod(postOnEndDrag)); #endregion log.LogMessage("Runtime Hooks's Applied"); log.LogMessage(" "); } catch { log.LogError("FAILED to Apply Hooks's!"); } #endregion log.LogMessage("Initializing Il2CppTypeSupport..."); // Helps with AssetBundles Il2CppTypeSupport.Initialize(); #region [Bootstrap The Main Trainer GameObject] #region [DevNote] // If you create your main object here, only Awake(), OnEnabled() get fired. But if you try to create the trainer in either of // those it doesn't get created properly as the object get's destroyed right away. Bootstrapping the GameObject like this allows // for it to inherit Unity MonoBehavior Events like OnGUI(), Update(), etc without a Harmony Patch. The only patch needed // is for the Bootstrapper. You'll see. The Trainer has an EventTest function, Press 'Tab', and watch the BepInEx Console. #endregion Bootstrapper.Create("BootStrapperGO"); #endregion }
private void ContentPack_Copy(On.RoR2.ContentManagement.ContentPack.orig_Copy orig, RoR2.ContentManagement.ContentPack src, RoR2.ContentManagement.ContentPack dest) { orig(src, dest); foreach (var survivorDef in src.survivorDefs) { if (survivorDef.bodyPrefab && survivorDef.bodyPrefab.GetComponent <SkillLocator>()) { var skillLoc = survivorDef.bodyPrefab.GetComponent <SkillLocator>(); var survivorName = (survivorDef.cachedName.IsNullOrWhiteSpace() ? survivorDef.bodyPrefab.name : survivorDef.cachedName); survivorName = survivorName.Replace(" ", "_"); if (modifiedBodyNames.Contains(survivorName)) { continue; } _logger.LogMessage($"Checking {survivorName}"); int index = 0; void ApplyChange(GenericSkill genericSkill) { if (genericSkill && genericSkill.skillFamily) { var skillFamily = genericSkill.skillFamily as ScriptableObject; if (skillFamily.name.IsNullOrWhiteSpace()) { _logger.LogMessage($"SkillFamily {genericSkill.name} has been updated to:"); string newFamilyName = $"{survivorName}{index}Family"; skillFamily.name = newFamilyName; _logger.LogMessage(skillFamily.name); index++; } } foreach (var variant in genericSkill.skillFamily.variants) { var skillDef = variant.skillDef; if ((skillDef as ScriptableObject).name.IsNullOrWhiteSpace()) { _logger.LogMessage($"SkillDef {skillDef.skillName} INDEX:{skillDef.skillIndex} has been updated to:"); (skillDef as ScriptableObject).name = skillDef.skillName; _logger.LogMessage((skillDef as ScriptableObject).name); } } } ApplyChange(skillLoc.primary); ApplyChange(skillLoc.secondary); ApplyChange(skillLoc.utility); ApplyChange(skillLoc.special); modifiedBodyNames.Add(survivorName); //reduces log bloat } } }
public override void Load() { log.LogMessage("RedShirt Mod loaded"); this._harmony = new Harmony("gg.xevira.redshirt"); this._harmony.PatchAll(); }
public override void Load() { Logger.LogMessage("Metamorphosis loaded"); this.harmony.PatchAll(); }
static void find_postfix(int __0) { Logger.LogMessage($"You can get parameters like this! {__0}"); }
public static void Modify() { foreach (var body in BodyCatalog.allBodyPrefabs.ToList()) { if (!body) { continue; } if (bannedBodyNames.Contains(body.name)) { _logger.LogWarning($"Skipping {body.name}!"); continue; } _logger.LogMessage($"Working on {body.name}"); var skillLocator = body.GetComponent <SkillLocator>(); if (!skillLocator) { _logger.LogError("No SkillLocator, continuing."); continue; } var esmList = body.GetComponents <EntityStateMachine>().ToList(); if (esmList.Count <= 0) { _logger.LogWarning("No Entity State Machines, continuing."); continue; } foreach (var entityStateMachines in body.GetComponents <EntityStateMachine>().ToList()) { if (entityStateMachines.customName == "Body") { continue; } Destroy(entityStateMachines); } var primaryState = CreateEntityStateMachine(body, primaryName); var secondaryState = CreateEntityStateMachine(body, secondaryName); var utilityState = CreateEntityStateMachine(body, utilityName); var specialState = CreateEntityStateMachine(body, specialName); var networkStateMachine = body.GetComponent <NetworkStateMachine>(); if (networkStateMachine) { networkStateMachine.stateMachines = new EntityStateMachine[] { primaryState, secondaryState, utilityState, specialState }; } if (skillLocator.primary) { //skillLocator.primary.skillDef.activationStateMachineName = primaryState.customName; foreach (var variant in skillLocator.primary.skillFamily.variants) { _logger.LogMessage($"Modifying PRIMARY skillDef {variant.skillDef.skillNameToken}"); variant.skillDef.activationStateMachineName = primaryState.customName; } } if (skillLocator.secondary) { //skillLocator.secondary.skillDef.activationStateMachineName = primaryState.customName; foreach (var variant in skillLocator.secondary.skillFamily.variants) { _logger.LogMessage($"Modifying SECONDARY skillDef {variant.skillDef.skillNameToken}"); variant.skillDef.activationStateMachineName = primaryState.customName; } } if (skillLocator.utility) { //skillLocator.utility.skillDef.activationStateMachineName = primaryState.customName; foreach (var variant in skillLocator.utility.skillFamily.variants) { _logger.LogMessage($"Modifying UTILITY skillDef {variant.skillDef.skillNameToken}"); variant.skillDef.activationStateMachineName = primaryState.customName; } } if (skillLocator.special) { //skillLocator.special.skillDef.activationStateMachineName = primaryState.customName; foreach (var variant in skillLocator.special.skillFamily.variants) { _logger.LogMessage($"Modifying SPECIAL skillDef {variant.skillDef.skillNameToken}"); variant.skillDef.activationStateMachineName = primaryState.customName; } } } }
public override void Load() { log = Log; log.LogMessage("Sheriff Mod has loaded"); Harmony.PatchAll(); }