Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of InterrogatorGuiltyRework v1.2.0
InterrogatorGuiltyRework.dll
Decompiled 6 months agousing System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GuiltyPatch.Components; using GuiltyPatch.Content; using GuiltyPatch.Patches; using HarmonyLib; using InterrogatorMod.Interrogator.Components; using InterrogatorMod.Interrogator.Content; using InterrogatorMod.Interrogator.SkillStates; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("InterrogatorGuiltyRework")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HP")] [assembly: AssemblyProduct("InterrogatorGuiltyRework")] [assembly: AssemblyCopyright("Copyright © HP 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6b95f5ec-cfc6-4d7f-a17c-8392cbd59d62")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace GuiltyPatch { [HarmonyPatch(typeof(InterrogatorTracker), "SearchForTarget")] public static class GuiltyAllyTargetingPatch { private static void Postfix(InterrogatorTracker __instance) { if ((Object)(object)__instance == (Object)null) { return; } BullseyeSearch value = Traverse.Create((object)__instance).Field("search").GetValue<BullseyeSearch>(); if (value == null) { return; } ((TeamMask)(ref value.teamMaskFilter)).AddTeam((TeamIndex)1); value.RefreshCandidates(); value.FilterOutGameObject(((Component)__instance).gameObject); CharacterBody value2 = Traverse.Create((object)__instance).Field("characterBody").GetValue<CharacterBody>(); if ((Object)(object)value2 != (Object)null) { foreach (HurtBox result in value.GetResults()) { if ((Object)(object)result?.healthComponent?.body != (Object)null) { CharacterBody body = result.healthComponent.body; GenericSkill val = value2.skillLocator?.special; bool flag = ((val != null) ? val.skillNameToken : null) == "KENKO_INTERROGATOR_SPECIAL_SCEPTER_CONVICT_NAME"; if (!body.HasBuff(InterrogatorBuffs.interrogatorGuiltyDebuff) && !flag) { value.FilterOutGameObject(((Component)body).gameObject); } } } } HurtBox value3 = value.GetResults().FirstOrDefault(); Traverse.Create((object)__instance).Field("trackingTarget").SetValue((object)value3); Debug.Log((object)"[GuiltyPatch] Ally targeting enabled: Player team added and candidates refreshed."); } } [HarmonyPatch(typeof(DamageTypes), "GlobalEventManager_onServerDamageDealt")] public static class GuiltyAllyPermanentPatch { private static void Postfix(DamageReport damageReport) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = damageReport?.attackerBody; CharacterBody val2 = damageReport?.victimBody; if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || !DamageAPI.HasModdedDamageType(damageReport.damageInfo, DamageTypes.InterrogatorGuilty)) { return; } TeamComponent teamComponent = val.teamComponent; TeamIndex? val3 = ((teamComponent != null) ? new TeamIndex?(teamComponent.teamIndex) : null); TeamComponent teamComponent2 = val2.teamComponent; if (val3 == ((teamComponent2 != null) ? new TeamIndex?(teamComponent2.teamIndex) : null)) { BuffDef interrogatorGuiltyDebuff = InterrogatorBuffs.interrogatorGuiltyDebuff; if (val2.HasBuff(interrogatorGuiltyDebuff)) { val2.ClearTimedBuffs(interrogatorGuiltyDebuff); val2.AddBuff(interrogatorGuiltyDebuff); Debug.Log((object)"[GuiltyPatch] Damage-based: Converted ally Guilty to permanent."); } } } } [HarmonyPatch(typeof(Convict), "OnEnter")] public static class GuiltyAllyConvictBuffPatch { private static void Postfix(Convict __instance) { CharacterBody value = Traverse.Create((object)__instance).Field("victimBody").GetValue<CharacterBody>(); if (!((Object)(object)value == (Object)null)) { BuffDef interrogatorGuiltyDebuff = InterrogatorBuffs.interrogatorGuiltyDebuff; if (value.HasBuff(interrogatorGuiltyDebuff)) { value.ClearTimedBuffs(interrogatorGuiltyDebuff); value.AddBuff(interrogatorGuiltyDebuff); Debug.Log((object)"[GuiltyPatch] Convict.OnEnter: Ensured victim’s Guilty is permanent."); } } } } [BepInPlugin("gabriel.guiltypatch", "GuiltyPatch", "1.0.0")] public class GuiltyPatchPlugin : BaseUnityPlugin { private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("gabriel.guiltypatch"); val.PatchAll(typeof(ConvictGuiltyStackPatch).Assembly); InterrogatorExtraBuffs.Init(); Debug.Log((object)"[GuiltyPatch] Patches applied."); } } } namespace GuiltyPatch.Content { public static class InterrogatorExtraBuffs { public static BuffDef interrogatorConvictGuiltyBuff; internal static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) interrogatorConvictGuiltyBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)interrogatorConvictGuiltyBuff).name = "InterrogatorConvictGuiltyBuff"; interrogatorConvictGuiltyBuff.buffColor = Color.red; interrogatorConvictGuiltyBuff.canStack = true; interrogatorConvictGuiltyBuff.isDebuff = false; interrogatorConvictGuiltyBuff.isHidden = false; interrogatorConvictGuiltyBuff.iconSprite = null; ContentAddition.AddBuffDef(interrogatorConvictGuiltyBuff); } } } namespace GuiltyPatch.Components { public class ConvictedStackLink : MonoBehaviour { public CharacterBody victimBody; public CharacterBody attackerBody; public int convictGrantedStacks; private void OnDestroy() { if ((Object)(object)attackerBody != (Object)null && convictGrantedStacks > 0) { for (int i = 0; i < convictGrantedStacks; i++) { attackerBody.RemoveBuff(InterrogatorBuffs.interrogatorGuiltyBuff); } convictGrantedStacks = 0; attackerBody = null; } } } } namespace GuiltyPatch.Patches { [HarmonyPatch(typeof(ConvictedController), "OnDestroy")] public static class ConvictedControllerHybrid { private static bool Prefix(ConvictedController __instance) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown CharacterBody attackerBody = __instance.attackerBody; CharacterBody characterBody = __instance.characterBody; if (!NetworkServer.active || (Object)(object)attackerBody == (Object)null || (Object)(object)characterBody == (Object)null) { return false; } attackerBody.RemoveOldestTimedBuff(InterrogatorBuffs.interrogatorConvictBuff); if (!characterBody.healthComponent.alive) { attackerBody.healthComponent.AddBarrier(attackerBody.healthComponent.fullCombinedHealth * 0.5f); attackerBody.AddTimedBuff(Buffs.ArmorBoost, 3f); } NetworkIdentity component = ((Component)attackerBody).GetComponent<NetworkIdentity>(); if ((Object)(object)component != (Object)null) { NetMessageExtensions.Send((INetMessage)new SyncSword(component.netId, false), (NetworkDestination)1); } Debug.Log((object)"[GuiltyPatch] Hybrid OnDestroy: skipped Guilty wipe, preserved barrier/armor + sword sync."); return false; } } [HarmonyPatch(typeof(DamageTypes), "GlobalEventManager_onServerDamageDealt")] public static class ConvictGuiltyStackPatch { private static void Postfix(DamageReport damageReport) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = damageReport?.attackerBody; CharacterBody val2 = damageReport?.victimBody; if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && DamageAPI.HasModdedDamageType(damageReport.damageInfo, DamageTypes.InterrogatorConvict) && val2.HasBuff(InterrogatorBuffs.interrogatorConvictBuff) && val2.HasBuff(InterrogatorBuffs.interrogatorGuiltyDebuff)) { ConvictedStackLink convictedStackLink = ((Component)val2).GetComponent<ConvictedStackLink>(); if ((Object)(object)convictedStackLink == (Object)null) { convictedStackLink = ((Component)val2).gameObject.AddComponent<ConvictedStackLink>(); convictedStackLink.victimBody = val2; convictedStackLink.attackerBody = val; } else if ((Object)(object)convictedStackLink.attackerBody == (Object)null) { convictedStackLink.attackerBody = val; } convictedStackLink.convictGrantedStacks++; val.AddBuff(InterrogatorExtraBuffs.interrogatorConvictGuiltyBuff); Debug.Log((object)("[GuiltyPatch] Convict hit: victim=" + val2.GetDisplayName() + ", " + $"tally={convictedStackLink.convictGrantedStacks}, " + $"convictBuffCount={val.GetBuffCount(InterrogatorExtraBuffs.interrogatorConvictGuiltyBuff)}")); } } } [HarmonyPatch(typeof(Stage), "Start")] public static class StageResetPatch { private static void Postfix() { foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { ConvictedStackLink component = ((Component)readOnlyInstances).GetComponent<ConvictedStackLink>(); if ((Object)(object)component != (Object)null && (Object)(object)component.attackerBody != (Object)null && component.convictGrantedStacks > 0) { for (int i = 0; i < component.convictGrantedStacks; i++) { component.attackerBody.RemoveBuff(InterrogatorBuffs.interrogatorGuiltyBuff); } component.convictGrantedStacks = 0; component.attackerBody = null; } } Debug.Log((object)"[GuiltyPatch] Stage transition: cleared Convict-granted Guilty stacks."); } } }