-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
152 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
using BepInEx; | ||
using BepInEx.Configuration; | ||
using BepInEx.Logging; | ||
using HarmonyLib; | ||
using KKAPI; | ||
using KKAPI.Chara; | ||
using System; | ||
using System.Collections; | ||
using UnityEngine; | ||
using KKAPI.MainGame; | ||
|
||
namespace MaterialGreeting | ||
{ | ||
[BepInPlugin(GUID, PluginName, Version)] | ||
// Tell BepInEx that this plugin needs KKAPI of at least the specified version. | ||
// If not found, this plugi will not be loaded and a warning will be shown. | ||
[BepInDependency(KoikatuAPI.GUID, KoikatuAPI.VersionConst)] | ||
public class DebugPlugin : BaseUnityPlugin | ||
{ | ||
/// <summary> | ||
/// Human-readable name of the plugin. In general, it should be short and concise. | ||
/// This is the name that is shown to the users who run BepInEx and to modders that inspect BepInEx logs. | ||
/// </summary> | ||
public const string PluginName = "MaterialGreetingDebugPlugin"; | ||
|
||
/// <summary> | ||
/// Unique ID of the plugin. Will be used as the default config file name. | ||
/// This must be a unique string that contains only characters a-z, 0-9 underscores (_) and dots (.) | ||
/// When creating Harmony patches or any persisting data, it's best to use this ID for easier identification. | ||
/// </summary> | ||
public const string GUID = "mosirnik.material-greeting-debug-plugin"; | ||
|
||
/// <summary> | ||
/// Version of the plugin. Must be in form <major>.<minor>.<build>.<revision>. | ||
/// Major and minor versions are mandatory, but build and revision can be left unspecified. | ||
/// </summary> | ||
public const string Version = "1.0.0"; | ||
|
||
internal static new ManualLogSource Logger; | ||
|
||
private void Awake() | ||
{ | ||
Logger = base.Logger; | ||
|
||
Harmony.CreateAndPatchAll(typeof(Hooks), GUID); | ||
CharacterApi.RegisterExtraBehaviour<DebugController>(GUID); | ||
GameAPI.PeriodChange += OnPeriodChange; | ||
} | ||
|
||
private static void OnPeriodChange(object sender, GameAPI.PeriodChangeEventArgs args) | ||
{ | ||
foreach (var heroine in Singleton<Manager.Game>.Instance.HeroineList) | ||
{ | ||
if (heroine.fixCharaID == 0 && heroine.relation < 0) | ||
{ | ||
heroine.talkEvent.Add(1); | ||
DebugPlugin.Logger.LogWarning($"Increasing relationship with {heroine.Name}"); | ||
} | ||
} | ||
} | ||
|
||
[HarmonyPatch(typeof(Illusion.Utils.ProbabilityCalclator))] | ||
private static class Hooks | ||
{ | ||
[HarmonyPatch(nameof(Illusion.Utils.ProbabilityCalclator.DetectFromPercent))] | ||
[HarmonyPostfix] | ||
public static void PostDetectFromPercent(float percent, ref bool __result) | ||
{ | ||
DebugPlugin.Logger.LogWarning($"Cheating on {percent}% chance ({__result})"); | ||
__result = true; | ||
} | ||
} | ||
|
||
private class DebugController : CharaCustomFunctionController | ||
{ | ||
protected override void OnCardBeingSaved(GameMode mode) | ||
{ | ||
} | ||
|
||
protected override void OnReload(GameMode currentGameMode) | ||
{ | ||
DebugPlugin.Logger.LogWarning($"[{Time.frameCount}] OnReload"); | ||
StartCoroutine(OnReloadCo()); | ||
} | ||
|
||
private IEnumerator OnReloadCo() | ||
{ | ||
while (true) | ||
{ | ||
bool top = ChaControl.objTop; | ||
bool head = ChaControl.objHead; | ||
DebugPlugin.Logger.LogWarning($"[{Time.frameCount}] top={top} head={head}"); | ||
if (top && head) break; | ||
yield return null; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="IllusionLibs.BepInEx" version="5.4.4" targetFramework="net35" /> | ||
<package id="IllusionLibs.BepInEx.Harmony" version="2.2.0.1" targetFramework="net35" /> | ||
<package id="IllusionLibs.Koikatu.Assembly-CSharp" version="2019.4.27.2" targetFramework="net35" /> | ||
<package id="ExtensibleSaveFormat.Koikatu" version="16.4.0" targetFramework="net35" developmentDependency="true" /> | ||
<package id="IllusionLibs.BepInEx" version="5.4.15" targetFramework="net35" /> | ||
<package id="IllusionLibs.BepInEx.Harmony" version="2.5.4" targetFramework="net35" /> | ||
<package id="IllusionLibs.BepInEx.MonoMod" version="21.8.5.1" targetFramework="net35" /> | ||
<package id="IllusionLibs.Koikatu.Assembly-CSharp" version="2019.4.27.4" targetFramework="net35" /> | ||
<package id="IllusionLibs.Koikatu.Assembly-CSharp-firstpass" version="2019.4.27.4" targetFramework="net35" /> | ||
<package id="IllusionLibs.Koikatu.UnityEngine" version="5.6.2.2" targetFramework="net35" /> | ||
<package id="IllusionModdingAPI.KKAPI" version="1.14.0" targetFramework="net35" developmentDependency="true" /> | ||
<package id="IllusionLibs.Koikatu.UnityEngine.UI" version="5.6.2" targetFramework="net35" developmentDependency="true" /> | ||
<package id="IllusionModdingAPI.KKAPI" version="1.30.0" targetFramework="net35" developmentDependency="true" /> | ||
<package id="KoikatuCompatibilityAnalyzer" version="1.0.1" targetFramework="net35" developmentDependency="true" /> | ||
<package id="Microsoft.Unity.Analyzers" version="1.9.0" targetFramework="net35" developmentDependency="true" /> | ||
</packages> |