Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Freaky Eyes v1.3.1
plugins/FreakyEyes.dll
Decompiled 6 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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.Bootstrap; using BepInEx.Configuration; using BodyModelAdditionsAPI; using HG.Reflection; using Microsoft.CodeAnalysis; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.CharacterAI; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FreakyEyes")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FreakyEyes")] [assembly: AssemblyTitle("FreakyEyes")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [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 FreakyEyes { [Serializable] [BepInPlugin("com.brynzananas.freakyeyes", "Freaky Eyes", "1.3.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { public class TrackingEye : MonoBehaviour { public Transform eyeBone; public Transform eyeTarget; public BaseAI baseAI; public PlayerCharacterMasterController characterMasterController; public bool freakier = false; public void Start() { if ((Object)(object)baseAI == (Object)null) { Object.Destroy((Object)(object)this); return; } eyeBone = ((Component)this).transform; if ((Object)(object)eyeBone == (Object)null) { Object.Destroy((Object)(object)this); } else { freakier = Util.CheckRoll(5f, 0f, (CharacterMaster)null); } } public void FixedUpdate() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)baseAI) && baseAI.enemySearch != null && baseAI.enemySearch.candidatesEnumerable != null && baseAI.enemySearch.candidatesEnumerable.Count > 0) { HurtBox hurtBox = baseAI.enemySearch.candidatesEnumerable.FirstOrDefault().hurtBox; if ((Object)(object)hurtBox != (Object)null) { eyeTarget = ((Component)hurtBox).transform; } if (freakier && Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.healthComponent.body) && Object.op_Implicit((Object)(object)hurtBox.healthComponent.body.master) && Object.op_Implicit((Object)(object)hurtBox.healthComponent.body.master.playerCharacterMasterController)) { characterMasterController = hurtBox.healthComponent.body.master.playerCharacterMasterController; eyeTarget = ((Component)characterMasterController.networkUser.cameraRigController.sceneCam).transform; } } } public void LateUpdate() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)eyeTarget) && Object.op_Implicit((Object)(object)eyeBone)) { Transform obj = eyeBone; Vector3 val = ((Component)eyeTarget).transform.position - eyeBone.position; obj.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized); } } } public const string ModGuid = "com.brynzananas.freakyeyes"; public const string ModName = "Freaky Eyes"; public const string ModVer = "1.3.1"; private static bool riskOfOptionsEnabled; public static AssetBundle assetBundle; public static GameObject freakyEye; public static PluginInfo PInfo { get; private set; } public void Awake() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Expected O, but got Unknown //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Expected O, but got Unknown //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Expected O, but got Unknown //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Expected O, but got Unknown //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Expected O, but got Unknown //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Expected O, but got Unknown //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Expected O, but got Unknown //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Expected O, but got Unknown //IL_0453: Unknown result type (might be due to invalid IL or missing references) PInfo = ((BaseUnityPlugin)this).Info; assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PInfo.Location), "assetbundles", "freakyeye")); riskOfOptionsEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); List<Material> list = new List<Material>(); list.AddRange(assetBundle.LoadAllAssets<Material>()); foreach (Material item in list) { if (((Object)item.shader).name.StartsWith("StubbedRoR2")) { string text = ((Object)item.shader).name.Replace("StubbedRoR2", "RoR2") + ".shader"; Shader val = Addressables.LoadAssetAsync<Shader>((object)text).WaitForCompletion(); if (Object.op_Implicit((Object)(object)val)) { item.shader = val; } } } freakyEye = assetBundle.LoadAsset<GameObject>("Assets/CosmeticsMod/googlyeye.prefab"); freakyEye.AddComponent<TrackingEye>(); ConfigEntry<bool> config1 = CreateConfig("Blind Pest"); ModelPartInfo val2 = new ModelPartInfo(); val2.bodyName = "FlyingVerminBody"; val2.gameObject = freakyEye; val2.inputString = "Body"; val2.codeAfterApplying = new CodeAfterApplying(PlaceIt); val2.customCondition = new CustomCondition(Config1); ModelPartInfo val3 = val2; new ModelPart(val3); val2 = new ModelPartInfo(); val2.bodyName = "FlyingVerminBody"; val2.gameObject = freakyEye; val2.inputString = "Body"; val2.codeAfterApplying = new CodeAfterApplying(PlaceIt2); val2.customCondition = new CustomCondition(Config1); val3 = val2; new ModelPart(val3); ConfigEntry<bool> config2 = CreateConfig("Blind Vermin"); val2 = new ModelPartInfo(); val2.bodyName = "VerminBody"; val2.gameObject = freakyEye; val2.inputString = "Head"; val2.codeAfterApplying = new CodeAfterApplying(PlaceIt3); val2.customCondition = new CustomCondition(Config2); val3 = val2; new ModelPart(val3); val2 = new ModelPartInfo(); val2.bodyName = "VerminBody"; val2.gameObject = freakyEye; val2.inputString = "Head"; val2.codeAfterApplying = new CodeAfterApplying(PlaceIt4); val2.customCondition = new CustomCondition(Config2); val3 = val2; new ModelPart(val3); ConfigEntry<bool> config3 = CreateConfig("Lemurian"); val2 = new ModelPartInfo(); val2.bodyName = "LemurianBody"; val2.gameObject = freakyEye; val2.inputString = "Head"; val2.codeAfterApplying = new CodeAfterApplying(PlaceIt5); val2.customCondition = new CustomCondition(Config3); val3 = val2; new ModelPart(val3); val2 = new ModelPartInfo(); val2.bodyName = "LemurianBody"; val2.gameObject = freakyEye; val2.inputString = "Head"; val2.codeAfterApplying = new CodeAfterApplying(PlaceIt6); val2.customCondition = new CustomCondition(Config3); val3 = val2; new ModelPart(val3); ConfigEntry<bool> config4 = CreateConfig("Elder Lemurian"); val2 = new ModelPartInfo(); val2.bodyName = "LemurianBruiserBody"; val2.gameObject = freakyEye; val2.inputString = "Head"; val2.codeAfterApplying = new CodeAfterApplying(PlaceIt7); val2.customCondition = new CustomCondition(Config4); val3 = val2; new ModelPart(val3); val2 = new ModelPartInfo(); val2.bodyName = "LemurianBruiserBody"; val2.gameObject = freakyEye; val2.inputString = "Head"; val2.codeAfterApplying = new CodeAfterApplying(PlaceIt8); val2.customCondition = new CustomCondition(Config4); val3 = val2; new ModelPart(val3); static void ApplyFreakyTracking(GameObject gameObject, CharacterModel characterModel) { if (Object.op_Implicit((Object)(object)characterModel) && Object.op_Implicit((Object)(object)characterModel.body) && Object.op_Implicit((Object)(object)characterModel.body.master)) { BaseAI component = ((Component)characterModel.body.master).GetComponent<BaseAI>(); if ((Object)(object)component != (Object)null) { TrackingEye component2 = gameObject.GetComponent<TrackingEye>(); component2.baseAI = component; } } } bool Config1(CharacterModel characterModel) { return config1.Value; } bool Config2(CharacterModel characterModel) { return config2.Value; } bool Config3(CharacterModel characterModel) { return config3.Value; } bool Config4(CharacterModel characterModel) { return config4.Value; } ConfigEntry<bool> CreateConfig(string bodyName) { ConfigEntry<bool> val4 = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", bodyName, true, "Enable freaky eyes for " + bodyName + "?"); if (riskOfOptionsEnabled) { val4.AddBoolConfig(); } return val4; } static void PlaceIt(GameObject modelObject, ChildLocator childLocator, CharacterModel characterModel, ActivePartsComponent activePartsComponent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) ApplyFreakyTracking(modelObject, characterModel); modelObject.transform.localPosition = new Vector3(-0.45f, 0.641f, 0.89f); modelObject.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); } static void PlaceIt2(GameObject modelObject, ChildLocator childLocator, CharacterModel characterModel, ActivePartsComponent activePartsComponent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) ApplyFreakyTracking(modelObject, characterModel); modelObject.transform.localPosition = new Vector3(0.45f, 0.641f, 0.89f); modelObject.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); } static void PlaceIt3(GameObject modelObject, ChildLocator childLocator, CharacterModel characterModel, ActivePartsComponent activePartsComponent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) ApplyFreakyTracking(modelObject, characterModel); modelObject.transform.localPosition = new Vector3(-0.312f, 0.999f, -0.308f); modelObject.transform.localEulerAngles = new Vector3(-127.928f, 0f, 0f); modelObject.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); } static void PlaceIt4(GameObject modelObject, ChildLocator childLocator, CharacterModel characterModel, ActivePartsComponent activePartsComponent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) ApplyFreakyTracking(modelObject, characterModel); modelObject.transform.localPosition = new Vector3(0.312f, 0.999f, -0.308f); modelObject.transform.localEulerAngles = new Vector3(-127.928f, 0f, 0f); modelObject.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); } static void PlaceIt5(GameObject modelObject, ChildLocator childLocator, CharacterModel characterModel, ActivePartsComponent activePartsComponent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) ApplyFreakyTracking(modelObject, characterModel); modelObject.transform.localPosition = new Vector3(1.47f, 1.86f, -0.33f); modelObject.transform.localEulerAngles = new Vector3(-70f, 90f, 0f); modelObject.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); } static void PlaceIt6(GameObject modelObject, ChildLocator childLocator, CharacterModel characterModel, ActivePartsComponent activePartsComponent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) ApplyFreakyTracking(modelObject, characterModel); modelObject.transform.localPosition = new Vector3(-1.47f, 1.86f, -0.33f); modelObject.transform.localEulerAngles = new Vector3(250f, 90f, 0f); modelObject.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); } static void PlaceIt7(GameObject modelObject, ChildLocator childLocator, CharacterModel characterModel, ActivePartsComponent activePartsComponent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) ApplyFreakyTracking(modelObject, characterModel); modelObject.transform.localPosition = new Vector3(1.7f, 2f, -0.2f); modelObject.transform.localEulerAngles = new Vector3(-75f, 90f, 0f); modelObject.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); } static void PlaceIt8(GameObject modelObject, ChildLocator childLocator, CharacterModel characterModel, ActivePartsComponent activePartsComponent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) ApplyFreakyTracking(modelObject, characterModel); modelObject.transform.localPosition = new Vector3(-1.7f, 2f, -0.2f); modelObject.transform.localEulerAngles = new Vector3(255f, 90f, 0f); modelObject.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); } } } public static class RiskOfOptionsCompatimility { public const string riskOfOptionsGUID = "com.rune580.riskofoptions"; public static void AddFloatConfig(this ConfigEntry<float> configEntry) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(configEntry)); } public static void AddIntConfig(this ConfigEntry<int> configEntry) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new IntFieldOption(configEntry)); } public static void AddBoolConfig(this ConfigEntry<bool> configEntry) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntry)); } } }