using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RoachReplacement")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RoachReplacement")] [assembly: AssemblyTitle("RoachReplacement")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 RoachReplacement { [BepInPlugin("RoachReplacement", "RoachReplacement", "1.0.0")] public class Plugin : BaseUnityPlugin { public static ManualLogSource Logger; public static AssetBundle bundle; public static GameObject roachTextObj; public static GameObject hopperTextObj; public static GameObject breederTextObj; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "roachtext"); Logger.LogDebug((object)text); bundle = AssetBundle.LoadFromFile(text); roachTextObj = bundle.LoadAsset("roachtext"); hopperTextObj = bundle.LoadAsset("hoppertext"); breederTextObj = bundle.LoadAsset("breedertext"); Harmony.CreateAndPatchAll(typeof(Patches), (string)null); } public static void Tint(GameObject target, Color32 color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) MaterialPropertyBlock val = new MaterialPropertyBlock(); val.SetColor("_Color", Color32.op_Implicit(color)); ((Renderer)target.GetComponent()).SetPropertyBlock(val); } } public class Patches { [HarmonyPatch(typeof(Hand_Roach_Base), "Start")] [HarmonyPrefix] [HarmonyWrapSafe] public static void HandRoachPrevent(Hand_Roach_Base __instance) { ((Component)((Component)__instance).transform.Find("Roach_Hands_AnimRoot/Roach_Root/Chest_Parent/Head_Parent")).gameObject.SetActive(false); Transform val = ((Component)__instance).transform.Find("Roach_Hands_AnimRoot/Roach_Root"); Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren(); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if (((Object)((Component)val2).gameObject).name.Contains("Leg_")) { ((Component)val2).gameObject.SetActive(false); } } Object.Destroy((Object)(object)__instance); } [HarmonyPatch(typeof(DEN_Roach), "Start")] [HarmonyPrefix] [HarmonyWrapSafe] public static void RoachReplace(DEN_Roach __instance) { //IL_0097: 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_00aa: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)__instance).transform.Find("Denizen_Roach_GEO"); ((Component)val).gameObject.SetActive(false); GameObject target = Object.Instantiate(Plugin.roachTextObj, ((Component)__instance).transform); switch (((GameEntity)__instance).entityPrefabID.Replace("Navmesh", string.Empty)) { case "Denizen_Roach": Plugin.Tint(target, new Color32((byte)116, (byte)107, (byte)90, byte.MaxValue)); break; case "Denizen_Roach_Explosive": Plugin.Tint(target, Color32.op_Implicit(Color.red)); break; case "Denizen_Roach_Gold": Plugin.Tint(target, Color32.op_Implicit(Color.yellow)); break; case "Denizen_Roach_Lemon": Plugin.Tint(target, Color32.op_Implicit(Color.green)); break; case "Denizen_Roach_Platinum": Plugin.Tint(target, new Color32((byte)229, (byte)228, (byte)226, byte.MaxValue)); break; default: Plugin.Tint(target, Color32.op_Implicit(Color.black)); break; } } [HarmonyPatch(typeof(DEN_BasicDenizen_Flier), "Start")] [HarmonyPrefix] [HarmonyWrapSafe] public static void RubyRoachReplace(DEN_BasicDenizen_Flier __instance) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!(((GameEntity)__instance).entityPrefabID != "Denizen_Roach_Flying_Ruby")) { Transform val = ((Component)__instance).transform.Find("DEN_Roach_Flying_Gem"); ((Component)val).gameObject.SetActive(false); GameObject val2 = Object.Instantiate(Plugin.roachTextObj, ((Component)__instance).transform); UT_FaceCamera val3 = val2.AddComponent(); val3.alignToCameraFacing = true; Plugin.Tint(val2, Color32.op_Implicit(Color.cyan)); } } [HarmonyPatch(typeof(DEN_Hopper), "Update")] [HarmonyPrefix] [HarmonyWrapSafe] public static void HopperReplace(DEN_Hopper __instance) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (!((GameEntity)__instance).GetTagger().HasTag("roachpatched")) { ((GameEntity)__instance).GetTagger().AddTag("roachpatched"); bool flag = ((GameEntity)__instance).entityPrefabID == "Denizen_Breeder"; Transform val = ((Component)__instance).transform.Find((!flag) ? "DEN_Hopper_Model" : "DEN_Breeder"); ((Component)val).gameObject.SetActive(false); GameObject target = Object.Instantiate((!flag) ? Plugin.hopperTextObj : Plugin.breederTextObj, ((Component)__instance).transform); Plugin.Tint(target, Color32.op_Implicit((!flag) ? Color.red : Color.yellow)); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "RoachReplacement"; public const string PLUGIN_NAME = "RoachReplacement"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }