using 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 BodyModelAdditionsAPI;
using HG.Reflection;
using Microsoft.CodeAnalysis;
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.0")]
[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;
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.0";
public static AssetBundle assetBundle;
public static GameObject freakyEye;
public static PluginInfo PInfo { get; private set; }
public void Awake()
{
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Expected O, but got Unknown
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: 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_0198: 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_01a6: Expected O, but got Unknown
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Expected O, but got Unknown
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Expected O, but got Unknown
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Expected O, but got Unknown
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Expected O, but got Unknown
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Expected O, but got Unknown
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Expected O, but got Unknown
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Expected O, but got Unknown
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Expected O, but got Unknown
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Expected O, but got Unknown
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Expected O, but got Unknown
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Expected O, but got Unknown
//IL_034e: 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"));
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>();
ModelPartInfo val2 = new ModelPartInfo();
val2.bodyName = "FlyingVerminBody";
val2.gameObject = freakyEye;
val2.inputString = "Body";
val2.codeAfterApplying = new CodeAfterApplying(PlaceIt);
ModelPartInfo val3 = val2;
new ModelPart(val3);
val2 = new ModelPartInfo();
val2.bodyName = "FlyingVerminBody";
val2.gameObject = freakyEye;
val2.inputString = "Body";
val2.codeAfterApplying = new CodeAfterApplying(PlaceIt2);
val3 = val2;
new ModelPart(val3);
val2 = new ModelPartInfo();
val2.bodyName = "VerminBody";
val2.gameObject = freakyEye;
val2.inputString = "Head";
val2.codeAfterApplying = new CodeAfterApplying(PlaceIt3);
val3 = val2;
new ModelPart(val3);
val2 = new ModelPartInfo();
val2.bodyName = "VerminBody";
val2.gameObject = freakyEye;
val2.inputString = "Head";
val2.codeAfterApplying = new CodeAfterApplying(PlaceIt4);
val3 = val2;
new ModelPart(val3);
val2 = new ModelPartInfo();
val2.bodyName = "LemurianBody";
val2.gameObject = freakyEye;
val2.inputString = "Head";
val2.codeAfterApplying = new CodeAfterApplying(PlaceIt5);
val3 = val2;
new ModelPart(val3);
val2 = new ModelPartInfo();
val2.bodyName = "LemurianBody";
val2.gameObject = freakyEye;
val2.inputString = "Head";
val2.codeAfterApplying = new CodeAfterApplying(PlaceIt6);
val3 = val2;
new ModelPart(val3);
val2 = new ModelPartInfo();
val2.bodyName = "LemurianBruiserBody";
val2.gameObject = freakyEye;
val2.inputString = "Head";
val2.codeAfterApplying = new CodeAfterApplying(PlaceIt7);
val3 = val2;
new ModelPart(val3);
val2 = new ModelPartInfo();
val2.bodyName = "LemurianBruiserBody";
val2.gameObject = freakyEye;
val2.inputString = "Head";
val2.codeAfterApplying = new CodeAfterApplying(PlaceIt8);
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;
}
}
}
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);
}
}
}
}