using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.LunarExploderMonster;
using EntityStates.VagrantNovaItem;
using EntityStates.VoidCamp;
using Facepunch.Steamworks;
using HG;
using HarmonyLib;
using HunkMod.Modules.Survivors;
using HunkMod.SkillStates.Hunk.Counter;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.VagrantNovaItem;
using On.RoR2;
using R2API.Utils;
using RifterMod.Characters.Survivors.Rifter.Components;
using RifterMod.Survivors.Rifter;
using RifterMod.Survivors.Rifter.SkillStates;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
using TanksMod.Modules;
using TanksMod.Modules.Components;
using TanksMod.Modules.Components.BasicTank;
using TanksMod.Modules.Components.UI;
using TanksMod.Modules.Survivors;
using TanksMod.States;
using Tyranitar.Modules.Components;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MiscFixes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b5def976e947f1bb017d9b667e2fa91ef35e84e2")]
[assembly: AssemblyProduct("MiscFixes")]
[assembly: AssemblyTitle("MiscFixes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MiscFixes
{
[HarmonyPatch]
public class FixVanilla
{
[HarmonyPatch(typeof(FogDamageController), "EvaluateTeam")]
[HarmonyILManipulator]
public static void FixFog(ILContext il)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
int locTC = 0;
int locBody = 0;
ILLabel label = null;
ILCursor[] array = default(ILCursor[]);
if (val.TryGotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locTC),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(TeamComponent), "body")),
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBody)
}) && val.TryFindPrev(ref array, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref label)
}))
{
val.Emit(OpCodes.Ldloc, locTC);
val.Emit<Object>(OpCodes.Call, "op_Implicit");
val.Emit(OpCodes.Brfalse, (object)label);
val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBody)
});
val.Emit(OpCodes.Ldloc, locBody);
val.Emit<Object>(OpCodes.Call, "op_Implicit");
val.Emit(OpCodes.Brfalse, (object)label);
}
else
{
Debug.LogError((object)"IL hook failed for FogDamageController.EvaluateTeam");
}
}
[HarmonyPatch(typeof(TetherVfxOrigin), "AddTether")]
[HarmonyILManipulator]
public static void FixTether(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[5]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<TetherVfxOrigin>(x, "onTetherAdded"),
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<TetherAddDelegate>(x, "Invoke")
}))
{
ILLabel val2 = val.MarkLabel();
val.GotoPrev((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<TetherVfxOrigin>(x, "onTetherAdded")
});
ILLabel val3 = val.DefineLabel();
val.Emit(OpCodes.Dup);
val.Emit(OpCodes.Brtrue, (object)val3);
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Br, (object)val2);
val.MarkLabel(val3);
}
else
{
Debug.LogError((object)"IL hook failed for TetherVfxOrigin.AddTether");
}
}
[HarmonyPatch(typeof(CharacterMaster), "TrueKill", new Type[]
{
typeof(GameObject),
typeof(GameObject),
typeof(DamageTypeCombo)
})]
[HarmonyILManipulator]
public static void FixKill(ILContext il)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel label = null;
ILLabel label2 = null;
FieldReference val4 = default(FieldReference);
ILCursor[] array = default(ILCursor[]);
if (val.TryGotoNext(new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody"),
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, ref val4),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff")
}) && val.TryFindNext(ref array, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label)
}))
{
val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody")
});
ILLabel val2 = val.DefineLabel();
val.Emit(OpCodes.Dup);
val.Emit<Object>(OpCodes.Call, "op_Implicit");
val.Emit(OpCodes.Brtrue, (object)val2);
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Br, (object)label);
val.MarkLabel(val2);
}
else
{
Debug.LogError((object)"IL hook failed for CharacterMaster.TrueKill 1");
}
if (val.TryGotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody"),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(CharacterBody), "equipmentSlot"))
}) && val.TryFindNext(ref array, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label2)
}))
{
val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody")
});
ILLabel val3 = val.DefineLabel();
val.Emit(OpCodes.Dup);
val.Emit<Object>(OpCodes.Call, "op_Implicit");
val.Emit(OpCodes.Brtrue, (object)val3);
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Br, (object)label2);
val.MarkLabel(val3);
}
else
{
Debug.LogError((object)"IL hook failed for CharacterMaster.TrueKill 2");
}
}
[HarmonyPatch(typeof(FlickerLight), "Update")]
[HarmonyPrefix]
public static bool FixFlicker(FlickerLight __instance)
{
return Object.op_Implicit((Object)(object)__instance.light);
}
[HarmonyPatch(typeof(Indicator), "SetVisibleInternal")]
[HarmonyILManipulator]
public static void FixIndicator(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertySetter(typeof(Renderer), "enabled"))
}))
{
val.Remove();
val.EmitDelegate<Action<Renderer, bool>>((Action<Renderer, bool>)delegate(Renderer renderer, bool newVisible)
{
if (Object.op_Implicit((Object)(object)renderer))
{
renderer.enabled = newVisible;
}
});
}
else
{
Debug.LogError((object)"IL hook failed for Indicator.SetVisibleInternal");
}
}
[HarmonyPatch(typeof(DeathState), "FixedUpdate")]
[HarmonyILManipulator]
public static void FixExplode(ILContext il)
{
//IL_0001: 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_009f: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILCursor[] array = Array.Empty<ILCursor>();
if (val.TryFindNext(ref array, new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DeathState>(x, "FireExplosion"),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GameObject>(x, "SetActive")
}))
{
ILCursor obj = array[0];
ILCursor val2 = array[1];
int index = obj.Index;
obj.Index = index + 1;
obj.MoveAfterLabels();
index = val2.Index;
val2.Index = index + 1;
obj.Emit(OpCodes.Br, (object)val2.MarkLabel());
val2.Emit(OpCodes.Ldarg_0);
val2.EmitDelegate<Action<DeathState>>((Action<DeathState>)delegate(DeathState self)
{
if (Object.op_Implicit((Object)(object)((EntityState)self).modelLocator) && Object.op_Implicit((Object)(object)((EntityState)self).modelLocator.modelTransform))
{
((Component)((EntityState)self).modelLocator.modelTransform).gameObject.SetActive(false);
}
});
}
else
{
Debug.LogError((object)"IL hook failed for DeathState.FixedUpdate");
}
}
[HarmonyPatch(typeof(MPEventSystem), "Update")]
[HarmonyILManipulator]
public static void FixThisFuckingBullshitGearbox(ILContext il)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
ILCursor[] array = null;
if (new ILCursor(il).TryFindNext(ref array, new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)AccessTools.PropertyGetter(typeof(EventSystem), "current")),
(Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)AccessTools.PropertySetter(typeof(EventSystem), "current"))
}))
{
array[0].Remove();
array[1].Remove();
}
else
{
Debug.LogError((object)"IL hook failed for MPEventSystem.Update");
}
}
[HarmonyPatch(typeof(BaseSteamworks), "RunUpdateCallbacks")]
[HarmonyFinalizer]
public static Exception FixFacepunch(Exception __exception)
{
return null;
}
[HarmonyPatch(typeof(Idle), "FixedUpdate")]
[HarmonyPatch(typeof(VoidCampObjectiveTracker), "GenerateString")]
[HarmonyILManipulator]
public static void FixVoidSeed(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(ReadOnlyCollection<TeamComponent>), "Count"))
}))
{
val.Remove();
val.Emit(OpCodes.Call, (MethodBase)AccessTools.DeclaredMethod(typeof(FixVanilla), "GetRealCount", (Type[])null, (Type[])null));
}
else
{
Debug.LogError((object)"IL hook failed for EntityStates.VoidCamp.Idle");
}
}
[HarmonyPatch(typeof(Interactor), "FindBestInteractableObject")]
[HarmonyILManipulator]
public static void FixInteraction(ILContext il)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
int loc = 0;
ILLabel label = null;
int num = default(int);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<EntityLocator>(x, "entity")
}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label),
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<EntityLocator>(x, "entity"),
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref loc)
}))
{
val.Emit(OpCodes.Ldloc, loc);
val.Emit<Object>(OpCodes.Call, "op_Implicit");
val.Emit(OpCodes.Brfalse, (object)label);
}
else
{
Debug.LogError((object)"IL hook failed for Interactor.FindBestInteractableObject");
}
}
public static int GetRealCount(ReadOnlyCollection<TeamComponent> teamMembers)
{
int num = 0;
foreach (TeamComponent teamMember in teamMembers)
{
CharacterBody val = (Object.op_Implicit((Object)(object)teamMember) ? teamMember.body : null);
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.master) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive)
{
num++;
}
}
return num;
}
}
[HarmonyPatch]
public class FixHunk
{
[HarmonyPatch(typeof(Hunk), "TVirusDeathDefied")]
[HarmonyILManipulator]
public static void Tvirus(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, -1)
}))
{
val.Remove();
val.Emit(OpCodes.Ldc_I4_0);
}
else
{
Debug.LogError((object)"IL hook failed for Hunk.TVirusDeathDefied");
}
}
[HarmonyPatch(typeof(UroLunge), "OnEnter")]
[HarmonyILManipulator]
public static void Uro(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Aim")
}))
{
val.Next.Operand = "Slide";
}
else
{
Debug.LogError((object)"IL hook failed for UroLunge.OnEnter");
}
}
}
[HarmonyPatch]
public class FixRocks
{
[HarmonyPatch(typeof(KingsRockBehavior), "KillAllRocks")]
[HarmonyPrefix]
public static bool Prefix(KingsRockBehavior __instance)
{
__instance.activeRocks = 0;
if (__instance.rocks != null)
{
for (int i = 0; i < __instance.rocks.Length; i++)
{
GameObject rock = __instance.rocks[i].rock;
if (Object.op_Implicit((Object)(object)rock) && rock.activeSelf)
{
rock.SetActive(false);
}
}
}
return false;
}
}
[HarmonyPatch]
public class FixRift
{
[HarmonyPatch(typeof(RifterSurvivor), "AddPrimarySkills")]
[HarmonyPatch(typeof(RifterSurvivor), "AddSecondarySkills")]
[HarmonyPatch(typeof(RifterSurvivor), "AddUtiitySkills")]
[HarmonyPatch(typeof(RifterSurvivor), "InitializeScepter")]
[HarmonyILManipulator]
public static void FixNames(ILContext il)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
string str = null;
while (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, ref str)
}))
{
string text = str.Trim().Replace(" ", "_");
if (text != str)
{
Debug.LogError((object)text);
val.Next.Operand = text;
}
}
}
[HarmonyPatch(typeof(ModifiedTeleport), "CalculateSnapDestination")]
[HarmonyILManipulator]
public static void FixSnap(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertySetter(typeof(CharacterDirection), "forward"))
}))
{
val.Remove();
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Action<CharacterDirection, Vector3, ModifiedTeleport>>((Action<CharacterDirection, Vector3, ModifiedTeleport>)delegate(CharacterDirection cd, Vector3 targetFootPosition, ModifiedTeleport self)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)cd))
{
cd.forward = targetFootPosition;
}
else
{
((EntityState)self).transform.rotation = Util.QuaternionSafeLookRotation(targetFootPosition);
}
});
}
else
{
Debug.LogError((object)"IL hook failed for ModifiedTeleport.CalculateSnapDestination");
}
}
[HarmonyPatch(typeof(RiftBase), "Blast")]
[HarmonyILManipulator]
public static void FixProc(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.8f)
}))
{
val.Next.Operand = 1f;
}
else
{
Debug.LogError((object)"IL hook failed for RiftBase.Blast");
}
}
[HarmonyPatch(typeof(RifterTracker), "<FixedUpdate>g__SearchForTarget|19_0")]
[HarmonyPrefix]
public static bool FixList(RifterTracker __instance, ref Ray aimRay, ref Vector3 position, ref TeamComponent ___teamComponent, ref GameObject ___trackingTarget, ref BullseyeSearch ___search)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
TeamMask allButNeutral = TeamMask.allButNeutral;
((TeamMask)(ref allButNeutral)).RemoveTeam(___teamComponent.teamIndex);
___search.Reset();
___search.teamMaskFilter = allButNeutral;
___search.filterByLoS = true;
___search.searchOrigin = ((Ray)(ref aimRay)).origin;
___search.searchDirection = ((Ray)(ref aimRay)).direction;
___search.sortMode = (SortMode)1;
___search.maxDistanceFilter = 56.75f;
___search.maxAngleFilter = 5f;
___search.RefreshCandidates();
___search.FilterCandidatesByHealthFraction(Mathf.Epsilon, 1f);
___search.FilterOutGameObject(((Component)__instance).gameObject);
HurtBox val = null;
float num = 0f;
foreach (HurtBox result in ___search.GetResults())
{
Vector3 val2 = ((Component)result).transform.position - position;
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (num < sqrMagnitude)
{
val = result;
num = sqrMagnitude;
}
}
___trackingTarget = (Object.op_Implicit((Object)(object)val) ? ((Component)val).gameObject : null);
return false;
}
}
[HarmonyPatch]
public class FixTank
{
[HarmonyPatch(typeof(BasicTank), "InitializeSkills")]
[HarmonyPostfix]
public static void InitializeSkills()
{
foreach (SkillDef skillDef in ContentPacks.skillDefs)
{
skillDef.skillName = skillDef.skillName.Trim().Replace(" ", "_");
skillDef.skillNameToken = skillDef.skillNameToken.Trim().Replace(" ", "_");
((Object)skillDef).name = skillDef.skillName;
}
}
[HarmonyPatch(typeof(StaticModels), "CreateBodyModelFamily")]
[HarmonyPostfix]
public static void CreateBodyModelFamily(GenericSkill __result)
{
__result.skillName = "BodyModel";
((Object)__result._skillFamily).name = ((Object)((Component)__result).gameObject).name + "BodyModelFamily";
Content.AddSkillFamily(__result._skillFamily);
}
[HarmonyPatch(typeof(StaticModels), "CreateTurretModelFamily")]
[HarmonyPostfix]
public static void CreateTurretModelFamily(GenericSkill __result)
{
__result.skillName = "TurretModel";
((Object)__result._skillFamily).name = ((Object)((Component)__result).gameObject).name + "TurretModelFamily";
Content.AddSkillFamily(__result._skillFamily);
}
[HarmonyPatch(typeof(StaticColors), "CreateGlowColorFamily")]
[HarmonyPostfix]
public static void CreateGlowColorFamily(GenericSkill __result)
{
__result.skillName = "GlowColor";
((Object)__result._skillFamily).name = ((Object)((Component)__result).gameObject).name + "GlowColorFamily";
Content.AddSkillFamily(__result._skillFamily);
}
[HarmonyPatch(typeof(StaticColors), "CreateBodyColorFamily")]
[HarmonyPostfix]
public static void CreateBodyColorFamily(GenericSkill __result)
{
__result.skillName = "BodyColor";
((Object)__result._skillFamily).name = ((Object)((Component)__result).gameObject).name + "BodyColorFamily";
Content.AddSkillFamily(__result._skillFamily);
}
[HarmonyPatch(typeof(TankCrosshair), "Start")]
[HarmonyPrefix]
public static void IHateUI(TankCrosshair __instance)
{
TankController component = ((Component)__instance).GetComponentInParent<HUD>().targetBodyObject.GetComponent<TankController>();
if ((Object)(object)component.crosshair != (Object)null && (Object)(object)component.crosshair != (Object)(object)__instance)
{
Object.Destroy((Object)(object)((Component)component.crosshair).gameObject);
}
}
public static void BaseVagrantNovaItemState_OnEnter(orig_OnEnter orig, BaseVagrantNovaItemState self)
{
orig.Invoke(self);
if (Object.op_Implicit((Object)(object)self.chargeSparks) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((Object)((EntityState)self).characterBody).name == "BasicTankBody(Clone)")
{
self.chargeSparks.startSize = 0.02f;
}
}
public static BurnEffectControllerHelper BurnEffectController_AddFireParticles(orig_AddFireParticles orig, BurnEffectController self, Renderer modelRenderer, Transform targetParentTransform)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
BurnEffectControllerHelper val = orig.Invoke(self, modelRenderer, targetParentTransform);
if (Object.op_Implicit((Object)(object)targetParentTransform) && Object.op_Implicit((Object)(object)targetParentTransform.parent) && ((Object)targetParentTransform.parent).name == "mdlBasicTank")
{
NormalizeParticleScale val2 = default(NormalizeParticleScale);
if (((Component)val).TryGetComponent<NormalizeParticleScale>(ref val2))
{
Object.DestroyImmediate((Object)(object)val2);
}
Vector3 localScale = ((Component)modelRenderer).transform.localScale;
float num = Mathf.Max(1f, Vector3Utils.ComponentMax(ref localScale));
ParticleSystem[] componentsInChildren = ((Component)val).GetComponentsInChildren<ParticleSystem>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
MainModule main = componentsInChildren[i].main;
MinMaxCurve startSize = ((MainModule)(ref main)).startSize;
((MinMaxCurve)(ref startSize)).constantMin = ((MinMaxCurve)(ref startSize)).constantMin / num;
((MinMaxCurve)(ref startSize)).constantMax = ((MinMaxCurve)(ref startSize)).constantMax / num;
((MainModule)(ref main)).startSize = startSize;
}
}
return val;
}
[HarmonyPatch(typeof(VisualRuntime), "Start")]
[HarmonyPostfix]
public static void UpdateInfos(VisualRuntime __instance)
{
ColorRuntime component = ((Component)__instance).GetComponent<ColorRuntime>();
CharacterModel component2 = ((Component)((Component)__instance).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>();
for (int i = 0; i < component2.baseRendererInfos.Length; i++)
{
ref RendererInfo reference = ref component2.baseRendererInfos[i];
bool ignoreOverlays = !((Component)reference.renderer).gameObject.activeSelf || !((Component)reference.renderer).gameObject.activeInHierarchy || !component.bodyOnlyRenderers.Contains(reference.renderer);
reference.ignoreOverlays = ignoreOverlays;
}
}
[HarmonyPatch(typeof(GenericTankMain), "ApplyFuelBaseAmount")]
[HarmonyILManipulator]
public static void FixFuel(ILContext il)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
ILCursor[] array = null;
string[] s = new string[3];
if (new ILCursor(il).TryFindNext(ref array, new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, ref s[0]),
(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, ref s[1]),
(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, ref s[2])
}))
{
for (int i = 0; i < array.Length; i++)
{
array[i].Next.Operand = s[i].Trim().Replace(" ", "_");
}
}
else
{
Debug.LogError((object)"IL hook failed for GenericTankMain.ApplyFuelBaseAmount");
}
}
[HarmonyPatch(typeof(CheesePlayerHandler), "ExecuteInGameplay")]
[HarmonyILManipulator]
public static void BetterGameplay(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il)
{
Index = il.Instrs.Count - 1
};
if (val.TryGotoPrev((MoveType)1, new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<CheesePlayerHandler>(x, "myUser")
}))
{
val.Emit(OpCodes.Ret);
}
}
[HarmonyPatch(typeof(CheesePlayerHandler), "ExecuteInMenu")]
[HarmonyILManipulator]
public static void FuckUICode2(ILContext il)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
ILCursor[] array = null;
if (new ILCursor(il).TryFindNext(ref array, new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.DeclaredField(typeof(StaticLoadouts), "bodyRowId")),
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.DeclaredField(typeof(StaticLoadouts), "turretRowId")),
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.DeclaredField(typeof(StaticLoadouts), "glowRowId")),
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.DeclaredField(typeof(StaticLoadouts), "paintRowId"))
}))
{
ILCursor[] array2 = default(ILCursor[]);
int num = default(int);
for (int i = 0; i < array.Length; i++)
{
ILCursor val = array[i];
int loc = 0;
ILLabel label = null;
val.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref loc)
});
val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, loc)
});
val.FindNext(ref array2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label)
});
val.EmitDelegate<Func<List<Row>, int, bool>>((Func<List<Row>, int, bool>)((List<Row> rows, int idx) => idx < rows.Count));
val.Emit(OpCodes.Brfalse, (object)label);
val.Emit(OpCodes.Ldarg_0);
val.Emit<CheesePlayerHandler>(OpCodes.Ldfld, "panel");
val.Emit<LoadoutPanelController>(OpCodes.Ldfld, "rows");
val.Emit(OpCodes.Ldloc, loc);
if (i == 0)
{
val.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3)
});
val.Remove();
val.Emit(OpCodes.Ldloc, loc);
}
if (i == 1)
{
val.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStfld<CheesePlayerHandler>(x, "turretTips")
});
val.GotoPrev(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
(Instruction x) => ILPatternMatchingExt.MatchCgt(x)
});
val.Remove();
val.Emit(OpCodes.Ldloc, loc);
}
}
}
else
{
Debug.LogError((object)"IL hook failed for CheesePlayerHandler.ExecuteInMenu");
}
}
[HarmonyPatch(typeof(CheesePlayerHandler), "Update")]
[HarmonyILManipulator]
public static void FuckUICode(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdelemRef(x)
}))
{
ILLabel val2 = val.DefineLabel();
ILLabel val3 = val.DefineLabel();
ILLabel val4 = val.DefineLabel();
val.Emit(OpCodes.Dup);
val.Emit<Object>(OpCodes.Call, "op_Implicit");
val.Emit(OpCodes.Brtrue, (object)val3);
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Ldnull);
val.Emit(OpCodes.Br, (object)val2);
val.MarkLabel(val3);
int index = val.Index;
val.Index = index + 1;
val.Emit(OpCodes.Dup);
val.Emit<Object>(OpCodes.Call, "op_Implicit");
val.Emit(OpCodes.Brtrue, (object)val4);
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Ldnull);
val.Emit(OpCodes.Br, (object)val2);
val.MarkLabel(val4);
index = val.Index;
val.Index = index + 1;
val.MarkLabel(val2);
}
else
{
Debug.LogError((object)"IL hook failed for CheesePlayerHandler.Update");
}
}
}
[BepInPlugin("_score.MiscFixes", "MiscFixes", "1.1.3")]
public class MiscFixesPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_AddFireParticles <0>__BurnEffectController_AddFireParticles;
public static hook_OnEnter <1>__BaseVagrantNovaItemState_OnEnter;
}
public const string PluginGUID = "_score.MiscFixes";
public const string PluginAuthor = "score";
public const string PluginName = "MiscFixes";
public const string PluginVersion = "1.1.3";
public ConfigEntry<bool> extraFixTank;
public ConfigEntry<bool> fixTank;
public ConfigEntry<bool> fixRift;
public ConfigEntry<bool> fixHunk;
public ConfigEntry<bool> fixTyr;
public Harmony harm;
public void Awake()
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
fixHunk = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Fix Hunk", true, "Enables fixes for Hunk");
fixRift = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Fix Rifter", true, "Enables fixes for Rifter");
fixTyr = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Fix Tyranitar", true, "Enables fixes for Tyranitar");
fixTank = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Fix CelestialWarTank", true, "Enables fixes for CelestialWarTank");
extraFixTank = ((BaseUnityPlugin)this).Config.Bind<bool>("Experimental", "Optimize Tank", true, "Enables extremely effective optimization with no (known) drawbacks for Celestial War Tank.");
ReplaceDCCS();
harm = new Harmony("_score.MiscFixes");
harm.CreateClassProcessor(typeof(FixVanilla)).Patch();
if (fixHunk.Value)
{
Hunk(harm);
}
if (fixTyr.Value)
{
Tyr(harm);
}
if (fixTank.Value)
{
Tank(harm);
}
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Rift));
}
private void ReplaceDCCS()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
DirectorCardCategorySelection obj = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/DLC2/village/dccsVillageInteractablesDLC1.asset").WaitForCompletion();
string format = "RoR2/Base/Drones/iscBroken{0}.asset";
Category[] categories = obj.categories;
foreach (Category val in categories)
{
if (!(val.name == "Drones"))
{
continue;
}
DirectorCard[] cards = val.cards;
foreach (DirectorCard val2 in cards)
{
if (Object.op_Implicit((Object)(object)val2.spawnCard) && ((Object)val2.spawnCard).name.StartsWith("csc"))
{
InteractableSpawnCard val3 = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)string.Format(format, ((Object)val2.spawnCard).name.Replace("csc", string.Empty))).WaitForCompletion();
if (Object.op_Implicit((Object)(object)val3))
{
((BaseUnityPlugin)this).Logger.LogDebug((object)("Replacing " + ((Object)val2.spawnCard).name + " with " + ((Object)val3).name));
val2.spawnCard = (SpawnCard)(object)val3;
}
}
}
}
}
public void Hunk(Harmony harm)
{
try
{
harm.CreateClassProcessor(typeof(FixHunk)).Patch();
}
catch (Exception)
{
}
}
public void Tyr(Harmony harm)
{
try
{
harm.CreateClassProcessor(typeof(FixRocks)).Patch();
}
catch (Exception)
{
}
}
public void Tank(Harmony harm)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
try
{
harm.CreateClassProcessor(typeof(FixTank)).Patch();
object obj = <>O.<0>__BurnEffectController_AddFireParticles;
if (obj == null)
{
hook_AddFireParticles val = FixTank.BurnEffectController_AddFireParticles;
<>O.<0>__BurnEffectController_AddFireParticles = val;
obj = (object)val;
}
BurnEffectController.AddFireParticles += (hook_AddFireParticles)obj;
object obj2 = <>O.<1>__BaseVagrantNovaItemState_OnEnter;
if (obj2 == null)
{
hook_OnEnter val2 = FixTank.BaseVagrantNovaItemState_OnEnter;
<>O.<1>__BaseVagrantNovaItemState_OnEnter = val2;
obj2 = (object)val2;
}
BaseVagrantNovaItemState.OnEnter += (hook_OnEnter)obj2;
if (extraFixTank.Value)
{
harm.CreateClassProcessor(typeof(ReplaceRuntime)).Patch();
harm.CreateClassProcessor(typeof(ReplaceColorRuntime)).Patch();
harm.CreateClassProcessor(typeof(ReplaceVisualRuntime)).Patch();
}
}
catch (Exception)
{
}
}
public void Rift()
{
try
{
harm.CreateClassProcessor(typeof(FixRift)).Patch();
}
catch (Exception)
{
}
}
}
public class NewColorRuntime : MonoBehaviour
{
public ColorRuntime colorRuntime;
public ModelLocator modelLoc;
public Light light;
public ParticleSystem[] particleSystems;
public void OnEnable()
{
colorRuntime = ((Component)this).GetComponent<ColorRuntime>();
modelLoc = ((Component)this).GetComponent<ModelLocator>();
}
public void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
if (colorRuntime.previousGlowColor != colorRuntime.currentGlowColor)
{
ChangeGlowColor(colorRuntime.currentGlowColor);
if (Object.op_Implicit((Object)(object)modelLoc) && Object.op_Implicit((Object)(object)modelLoc.modelTransform))
{
if (particleSystems == null)
{
particleSystems = ((Component)modelLoc.modelTransform).GetComponentsInChildren<ParticleSystem>(true);
}
ParticleSystem[] array = particleSystems;
ParticleSystemRenderer val2 = default(ParticleSystemRenderer);
foreach (ParticleSystem val in array)
{
if (Object.op_Implicit((Object)(object)val))
{
MainModule main = val.main;
MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
if (((MinMaxGradient)(ref startColor)).color != colorRuntime.currentGlowColor && ((Component)val).TryGetComponent<ParticleSystemRenderer>(ref val2) && ((Object)((Renderer)val2).material).name.Contains("ThrusterParticleGradient"))
{
MainModule main2 = val.main;
((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(colorRuntime.currentGlowColor);
}
}
}
if (light == null)
{
light = ((Component)modelLoc.modelTransform).GetComponentInChildren<Light>(true);
}
if (Object.op_Implicit((Object)(object)light))
{
light.color = colorRuntime.currentGlowColor;
}
}
}
if (colorRuntime.previousBodyColor != colorRuntime.currentBodyColor)
{
ChangeBodyColor(colorRuntime.currentBodyColor);
}
}
public void ChangeBodyColor(Color color)
{
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < colorRuntime._matProperties.Length; i++)
{
foreach (Renderer bodyOnlyRenderer in colorRuntime.bodyOnlyRenderers)
{
if ((Object)(object)colorRuntime.renderers[i] == (Object)(object)bodyOnlyRenderer && (((Object)colorRuntime.renderers[i].material).name.Contains("Base") || ((Object)colorRuntime.renderers[i].material).name.Contains("Gummy")))
{
colorRuntime._matProperties[i].SetColor("_Color", color);
colorRuntime._matProperties[i].SetColor("_EmColor", Color.black);
colorRuntime._matProperties[i].SetFloat("_EmPower", 0f);
colorRuntime._matProperties[i].SetFloat("_SpecularStrength", 1f);
colorRuntime._matProperties[i].SetFloat("_SpecularExponent", 10f);
colorRuntime._matProperties[i].SetFloat("_RampInfo", 0f);
colorRuntime._matProperties[i].SetFloat("_DecalLayer", 2f);
}
}
colorRuntime.renderers[i].SetPropertyBlock(colorRuntime._matProperties[i]);
}
colorRuntime.previousBodyColor = color;
}
public void ChangeGlowColor(Color color)
{
//IL_00a1: 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)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < colorRuntime._matProperties.Length; i++)
{
if (((Object)colorRuntime.renderers[i].material).name.Contains("Base") || ((Object)colorRuntime.renderers[i].material).name.Contains("Gummy"))
{
colorRuntime._matProperties[i].SetColor("_EmColor", color);
colorRuntime.renderers[i].SetPropertyBlock(colorRuntime._matProperties[i]);
}
}
colorRuntime.previousGlowColor = color;
}
}
public class NewVisualRuntime : MonoBehaviour, IOnTakeDamageServerReceiver
{
public VisualRuntime visualRuntime;
public TankController tank;
public CharacterBody characterBody;
public ModelLocator modelLoc;
public ChildLocator childLoc;
public HealthComponent health;
public CharacterMotor motor;
public SkillLocator skillLoc;
public Rigidbody weightPoint;
public InputBankTest inputBank;
public CharacterModel model;
public Transform root;
public Transform anchor;
public Transform anchorLerp;
public GameObject missile1;
public GameObject missle2;
public GameObject body;
public GameObject turret;
public GameObject gun;
public GameObject pivot;
public MeshRenderer overheat;
public ParticleSystem[] hurtboxSystem;
public ParticleSystem[] bodySystem;
public ParticleSystem[][] thrusterSystems;
public ParticleSystem[][] jumpSystems;
public readonly string[] thrusters = new string[4] { "ThrusterRearLeft", "ThrusterRearRight", "ThrusterCenter", "ExhaustThruster" };
public readonly string[] jumpBoosters = new string[4] { "JumpBoosterFL", "JumpBoosterFR", "JumpBoosterRL", "JumpBoosterRR" };
public void OnEnable()
{
characterBody = ((Component)this).GetComponent<CharacterBody>();
tank = ((Component)this).GetComponent<TankController>();
visualRuntime = ((Component)this).GetComponent<VisualRuntime>();
modelLoc = ((Component)this).GetComponent<ModelLocator>();
model = ((Component)modelLoc.modelTransform).GetComponent<CharacterModel>();
childLoc = ((Component)modelLoc.modelTransform).GetComponent<ChildLocator>();
health = ((Component)this).GetComponent<HealthComponent>();
motor = ((Component)this).GetComponent<CharacterMotor>();
skillLoc = ((Component)this).GetComponent<SkillLocator>();
inputBank = ((Component)this).GetComponent<InputBankTest>();
root = childLoc.FindChild("ROOT");
anchor = childLoc.FindChild("Anchor");
anchorLerp = childLoc.FindChild("AnchorLerp");
weightPoint = ((Component)childLoc.FindChild("BodyWeightPoint")).GetComponent<Rigidbody>();
childLoc.FindChild("BodyWeightPoint").parent = null;
missile1 = ((Component)childLoc.FindChild("MicroMissle1")).gameObject;
missle2 = ((Component)childLoc.FindChild("MicroMissle2")).gameObject;
GameObject gameObject = ((Component)childLoc.FindChild("ThrusterLeftMesh")).gameObject;
GameObject gameObject2 = ((Component)childLoc.FindChild("ThrusterRightMesh")).gameObject;
((Component)childLoc.FindChild("ThrusterCenter")).gameObject.SetActive(!gameObject.activeSelf && !gameObject2.activeSelf);
body = ((Component)childLoc.FindChild("Body")).gameObject;
turret = ((Component)childLoc.FindChild("Turret")).gameObject;
gun = ((Component)childLoc.FindChild("Gun")).gameObject;
Transform? obj = ((IEnumerable<Transform>)((Component)childLoc.FindChild("SmallWeapons")).GetComponentsInChildren<Transform>()).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)((Component)t).gameObject).name == "Pivot"));
pivot = ((obj != null) ? ((Component)obj).gameObject : null);
jumpSystems = new ParticleSystem[4][];
thrusterSystems = new ParticleSystem[4][];
}
public void OnTakeDamageServer(DamageReport damageReport)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (!damageReport.damageInfo.canRejectForce && damageReport.damageDealt > 0f)
{
weightPoint.AddForce(damageReport.damageInfo.force, (ForceMode)5);
}
}
public void Update()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
if (!health.isInFrozenState && health.alive)
{
if (Object.op_Implicit((Object)(object)modelLoc.modelTransform))
{
float num = Vector3.Dot(anchorLerp.up, anchor.up);
float num2 = Mathf.SmoothStep(5f, 15f, num);
anchorLerp.rotation = Quaternion.Lerp(anchorLerp.rotation, anchor.rotation, num2 * Time.deltaTime);
anchorLerp.position = Vector3.Lerp(anchorLerp.position, anchor.position, 15f * Time.deltaTime);
if (tank.IsNotCrashed())
{
root.localPosition = Vector3.Lerp(root.localPosition, Vector3.zero, 10f * Time.deltaTime);
UpdateGeneratedTankAnimations();
}
if (!tank.IsStateNormal() && !motor.isGrounded)
{
visualRuntime.resetRootRotationToGround = false;
}
}
missile1.SetActive(skillLoc.primary.stock > 1);
missle2.SetActive(skillLoc.primary.stock > 0);
}
GroundDustEffect();
}
public void RotateTowardVectorDirection(Vector3 moveVector, GameObject objectPlane, GameObject objectToRotate, Vector3 lockAxises, Vector3 limitAxis, string driveAxis, float speed)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
Transform transform = objectToRotate.transform;
Transform transform2 = objectPlane.transform;
Vector3 val = transform2.forward;
if (driveAxis == "Up")
{
val = Vector3.ProjectOnPlane(moveVector - transform.position, transform2.up);
}
if (driveAxis == "Right")
{
val = Vector3.ProjectOnPlane(moveVector - transform.position, transform2.right);
}
Quaternion val2 = Quaternion.LookRotation(val, transform2.up);
transform.rotation = Quaternion.Lerp(transform.rotation, val2, speed * Time.deltaTime);
Quaternion localRotation = transform.localRotation;
if (lockAxises.x == 1f)
{
localRotation.x = 0f;
}
if (lockAxises.y == 1f)
{
localRotation.y = 0f;
}
if (lockAxises.z == 1f)
{
localRotation.z = 0f;
}
transform.localRotation = localRotation;
if (limitAxis != Vector3.zero && limitAxis.x != 0f)
{
float x = transform.localEulerAngles.x;
transform.localRotation = Quaternion.Euler(Mathf.Clamp((x > 180f) ? (x - 360f) : x, 0f - limitAxis.x, 20f), 0f, 0f);
}
}
public void UpdateGeneratedTankAnimations()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
RotateTowardVectorDirection(turret.transform.position + inputBank.aimDirection, body, turret, new Vector3(1f, 0f, 1f), Vector3.zero, "Up", 12.5f);
RotateTowardVectorDirection(gun.transform.position + inputBank.aimDirection, turret, gun, new Vector3(0f, 1f, 1f), new Vector3(45f, 0f, 0f), "Right", 10f);
if ((Object)(object)pivot != (Object)null)
{
RotateTowardVectorDirection(pivot.transform.position + inputBank.aimDirection, turret, pivot, new Vector3(0f, 1f, 1f), new Vector3(45f, 0f, 0f), "Right", 10f);
}
for (int i = 0; i < visualRuntime.beltRenders.Length; i++)
{
visualRuntime.beltRenders[i].offset = tank.forwardVelocity;
}
if (visualRuntime.trackLeftOffset > 1f)
{
visualRuntime.trackLeftOffset = 0f;
}
if (visualRuntime.trackRightOffset > 1f)
{
visualRuntime.trackRightOffset = 0f;
}
}
public void GroundDustEffect()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
Color approximateColor = default(Color);
((Color)(ref approximateColor))..ctor(0f, 0f, 0f, 0f);
ParticleSystem[] array = visualRuntime.particlesMain.FindGroupByName("TracksAndWheels").FindParticlesByName("Dust", true);
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(new Ray(((Component)motor).transform.position, Vector3.down), ref val, 4f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.water)).mask), (QueryTriggerInteraction)2))
{
SurfaceDef objectSurfaceDef = SurfaceDefProvider.GetObjectSurfaceDef(((RaycastHit)(ref val)).collider, ((RaycastHit)(ref val)).point);
if (Object.op_Implicit((Object)(object)objectSurfaceDef))
{
approximateColor = objectSurfaceDef.approximateColor;
}
for (int i = 0; i < array.Length; i++)
{
MainModule main = array[i].main;
((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(approximateColor + Color.black);
if (motor.isGrounded && ((Vector3)(ref visualRuntime.direction.moveVector)).magnitude > 0f)
{
array[i].Play();
}
else
{
array[i].Stop();
}
}
}
else
{
for (int j = 0; j < array.Length; j++)
{
array[j].Stop();
}
}
}
public void GroundFireTrailEffect(bool play)
{
ParticleSystem[] array = visualRuntime.particlesMain.FindGroupByName("TracksAndWheels").FindParticlesByName("Fire", true);
for (int i = 0; i < array.Length; i++)
{
PlaySystem(array[i], play);
}
}
public void GroundThrusterEffects(bool play, bool loop)
{
for (int i = 0; i < thrusters.Length; i++)
{
Transform val = childLoc.FindChild(thrusters[i]);
if (!Object.op_Implicit((Object)(object)val) || !((Component)val).gameObject.activeSelf)
{
continue;
}
ParticleSystem[][] array = thrusterSystems;
int num = i;
object obj = array[num];
if (obj == null)
{
Transform obj2 = childLoc.FindChild(thrusters[i]);
obj = (array[num] = ((obj2 != null) ? ((Component)obj2).GetComponentsInChildren<ParticleSystem>(true) : null));
}
ParticleSystem[] array2 = (ParticleSystem[])obj;
if (array2 != null)
{
for (int j = 0; j < array2.Length; j++)
{
PlaySystem(array2[j], play, loop);
}
}
}
}
public void ThrusterFailEffect()
{
}
public void MinigunOverheatEffect(float heatLevel)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (overheat == null)
{
overheat = ((Component)childLoc.FindChild("MinigunBarrelsHeat")).GetComponent<MeshRenderer>();
}
((Renderer)overheat).enabled = heatLevel > 0f;
Material material = ((Renderer)overheat).material;
Color color = material.color;
color.a = heatLevel;
material.SetColor("_Color", color);
}
public void FlameThrowerEffect(bool play)
{
ParticleSystem val = visualRuntime.particlesMain.FindParticleByName("FlamethrowerFireEffect");
if (Object.op_Implicit((Object)(object)val))
{
if (play)
{
val.Play();
}
else
{
val.Stop();
}
}
}
public void PlaySystem(ParticleSystem system, bool play, bool loop)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
MainModule main = system.main;
((MainModule)(ref main)).loop = loop;
if (play != system.isPlaying)
{
if (play)
{
system.Play();
}
else
{
system.Stop();
}
}
}
public void PlaySystem(ParticleSystem system, bool play)
{
if (play != system.isPlaying)
{
if (play)
{
system.Play();
}
else
{
system.Stop();
}
}
}
public void JumpThrusterEffects(bool play, bool loop)
{
for (int i = 0; i < jumpSystems.Length; i++)
{
ParticleSystem[][] array = jumpSystems;
int num = i;
object obj = array[num];
if (obj == null)
{
Transform obj2 = childLoc.FindChild(jumpBoosters[i]);
obj = (array[num] = ((obj2 != null) ? ((Component)obj2).GetComponentsInChildren<ParticleSystem>(true) : null));
}
ParticleSystem[] array2 = (ParticleSystem[])obj;
if (array2 != null)
{
for (int j = 0; j < array2.Length; j++)
{
PlaySystem(array2[j], play, loop);
}
}
}
}
public void JumpThrusterEffectScale(float scale)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < jumpSystems.Length; i++)
{
ParticleSystem[][] array = jumpSystems;
int num = i;
object obj = array[num];
if (obj == null)
{
Transform obj2 = childLoc.FindChild(jumpBoosters[i]);
obj = (array[num] = ((obj2 != null) ? ((Component)obj2).GetComponentsInChildren<ParticleSystem>(true) : null));
}
ParticleSystem[] array2 = (ParticleSystem[])obj;
if (array2 != null)
{
for (int j = 0; j < array2.Length; j++)
{
Vector3 localScale = ((Component)array2[j]).transform.localScale;
localScale.y = scale;
((Component)array2[j]).transform.localScale = localScale;
}
}
}
}
public void JumpBoosterEffects(bool play)
{
for (int i = 0; i < jumpSystems.Length; i++)
{
ParticleSystem[][] array = jumpSystems;
int num = i;
object obj = array[num];
if (obj == null)
{
Transform obj2 = childLoc.FindChild(jumpBoosters[i]);
obj = (array[num] = ((obj2 != null) ? ((Component)obj2).GetComponentsInChildren<ParticleSystem>(true) : null));
}
ParticleSystem[] array2 = (ParticleSystem[])obj;
if (array2 != null)
{
for (int j = 0; j < array2.Length; j++)
{
PlaySystem(array2[j], play, loop: true);
}
}
}
}
public void JumpBoosterEffectScale(float scale)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < jumpSystems.Length; i++)
{
ParticleSystem[][] array = jumpSystems;
int num = i;
object obj = array[num];
if (obj == null)
{
Transform obj2 = childLoc.FindChild(jumpBoosters[i]);
obj = (array[num] = ((obj2 != null) ? ((Component)obj2).GetComponentsInChildren<ParticleSystem>(true) : null));
}
ParticleSystem[] array2 = (ParticleSystem[])obj;
if (array2 != null)
{
for (int j = 0; j < array2.Length; j++)
{
Vector3 localScale = ((Component)array2[j]).transform.localScale;
localScale.y = scale;
((Component)array2[j]).transform.localScale = localScale;
}
}
}
}
public void JumpBoosterLid(bool openLid)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < jumpBoosters.Length; i++)
{
Transform obj = childLoc.FindChild(jumpBoosters[i]);
Transform val = ((obj != null) ? obj.Find("BoosterHinge") : null);
if (Object.op_Implicit((Object)(object)val))
{
Quaternion val2 = (openLid ? Quaternion.Euler(0f, 0f, 30f) : Quaternion.Euler(0f, 0f, 0f));
val.localRotation = Quaternion.Lerp(val.localRotation, val2, 20f * Time.deltaTime);
}
}
}
public void ThrusterEffects(bool play, bool loop, float scale, bool open)
{
JumpThrusterEffects(play, loop);
JumpThrusterEffectScale(scale);
JumpBoosterEffects(play);
JumpBoosterEffectScale(scale);
JumpBoosterLid(open);
}
}
[HarmonyPatch]
public class ReplaceVisualRuntime
{
[HarmonyTargetMethods]
public static IEnumerable<MethodBase> TargetMethods()
{
foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(typeof(VisualRuntime)))
{
switch (declaredMethod.Name)
{
case "Awake":
case "Update":
case "Start":
continue;
}
yield return declaredMethod;
}
}
[HarmonyPrefix]
public static bool Prefix(VisualRuntime __instance, MethodBase __originalMethod, object[] __args)
{
NewVisualRuntime newVisualRuntime = default(NewVisualRuntime);
if (((Component)__instance).TryGetComponent<NewVisualRuntime>(ref newVisualRuntime))
{
Reflection.InvokeMethod((object)newVisualRuntime, __originalMethod.Name, __args);
return false;
}
Debug.LogError((object)"NO VISUAL RUNTIME WHAT THE FUUUUCK");
return true;
}
}
[HarmonyPatch]
public class ReplaceColorRuntime
{
[HarmonyTargetMethods]
public static IEnumerable<MethodBase> TargetMethods()
{
foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(typeof(ColorRuntime)))
{
switch (declaredMethod.Name)
{
case "Awake":
case "Update":
case "Start":
continue;
}
yield return declaredMethod;
}
}
[HarmonyPrefix]
public static bool Prefix(ColorRuntime __instance, MethodBase __originalMethod, object[] __args)
{
NewColorRuntime newColorRuntime = default(NewColorRuntime);
if (((Component)__instance).TryGetComponent<NewColorRuntime>(ref newColorRuntime))
{
Reflection.InvokeMethod((object)newColorRuntime, __originalMethod.Name, __args);
return false;
}
Debug.LogError((object)"NO COLOR RUNTIME WHAT THE FUUUUCK");
return true;
}
}
[HarmonyPatch]
public class ReplaceRuntime
{
[HarmonyPatch(typeof(VisualRuntime), "Update")]
[HarmonyPrefix]
public static bool NoUpdate()
{
return false;
}
[HarmonyPatch(typeof(VisualRuntime), "Awake")]
[HarmonyPostfix]
public static void AddNewRuntime(VisualRuntime __instance)
{
((Component)__instance).gameObject.AddComponent<NewVisualRuntime>();
}
[HarmonyPatch(typeof(ColorRuntime), "Update")]
[HarmonyPrefix]
public static bool NoUpdate2()
{
return false;
}
[HarmonyPatch(typeof(ColorRuntime), "Awake")]
[HarmonyPostfix]
public static void AddNewRuntime2(ColorRuntime __instance)
{
((Component)__instance).gameObject.AddComponent<NewColorRuntime>();
}
}
}