Decompiled source of LobCorpEGO v0.1.4

plugins/BlueStar.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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;
using UnityEngine.Events;

[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: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("SCARLE")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BlueStar")]
[assembly: AssemblyTitle("BlueStar")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BlueStar
{
	[BepInPlugin("me.BlueStar", "BlueStar", "1.0")]
	public class BlueStar : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("BlueStarPossess");

		internal static BlueStar Instance { get; private set; }

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		private void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			Instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BlueStarPossess ");
			Harmony val = new Harmony("BlueStarPossess");
		}
	}
	public class ValuableBlueStar : MonoBehaviour
	{
		private enum State
		{
			Idle,
			Active
		}

		public class MagicBullet : MonoBehaviour
		{
			private enum State
			{
				Idle,
				Active
			}

			private PhysGrabObject physGrabObject;

			private ItemToggle itemToggle;

			public int numberOfBullets = 1;

			[Range(0f, 65f)]
			public float gunRandomSpread;

			public float gunRange = 50f;

			public float distanceKeep = 0.8f;

			public float gunRecoilForce = 1f;

			public float cameraShakeMultiplier = 1f;

			public float torqueMultiplier = 1f;

			public float grabStrengthMultiplier = 1f;

			public float shootCooldown = 1f;

			public float batteryDrain = 0.1f;

			public bool batteryDrainFullBar;

			public int batteryDrainFullBars = 1;

			[Range(0f, 100f)]
			public float misfirePercentageChange = 50f;

			public AnimationCurve shootLineWidthCurve;

			public float grabVerticalOffset = -0.2f;

			public float aimVerticalOffset = -10f;

			public float investigateRadius = 20f;

			public Transform gunMuzzle;

			public GameObject bulletPrefab;

			public GameObject muzzleFlashPrefab;

			public Transform gunTrigger;

			public Sound soundShoot;

			public Sound soundShootGlobal;

			public Sound soundNoAmmoClick;

			public Sound soundHit;

			private float shootCooldownTimer;

			private ItemBattery itemBattery;

			private PhysGrabObjectImpactDetector impactDetector;

			private bool prevToggleState;

			private AnimationCurve triggerAnimationCurve;

			private float triggerAnimationEval;

			private bool triggerAnimationActive;

			private void Start()
			{
				physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
				itemToggle = ((Component)this).GetComponent<ItemToggle>();
			}

			private void Update()
			{
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				if (physGrabObject.grabbed && physGrabObject.grabbedLocal)
				{
					PhysGrabber.instance.OverrideGrabDistance(distanceKeep);
				}
				if (triggerAnimationActive)
				{
					float num = 45f;
					triggerAnimationEval += Time.deltaTime * 4f;
					gunTrigger.localRotation = Quaternion.Euler(num * triggerAnimationCurve.Evaluate(triggerAnimationEval), 0f, 0f);
					if (triggerAnimationEval >= 1f)
					{
						gunTrigger.localRotation = Quaternion.Euler(0f, 0f, 0f);
						triggerAnimationActive = false;
						triggerAnimationEval = 1f;
					}
				}
			}
		}

		private PhysGrabObject physGrabObject;

		private List<string> adjectives = new List<string>();

		private List<string> worship = new List<string>();

		private List<string> action = new List<string>();

		private float coolDownUntilNextSentence = 3f;

		private State currentState;

		private string playerName = "[playerName]";

		private void Start()
		{
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			InitializeWordLists();
		}

		private void Update()
		{
			if (SemiFunc.IsMultiplayer())
			{
				switch (currentState)
				{
				case State.Idle:
					StateIdle();
					break;
				case State.Active:
					StateActive();
					break;
				}
			}
		}

		private void StateIdle()
		{
			//IL_00ba: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			if (coolDownUntilNextSentence > 0f && physGrabObject.grabbed)
			{
				coolDownUntilNextSentence -= Time.deltaTime;
			}
			else
			{
				if (!Object.op_Implicit((Object)(object)PhysGrabber.instance) || !PhysGrabber.instance.grabbed || !Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) || !((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)physGrabObject))
				{
					return;
				}
				bool flag = false;
				if (!SemiFunc.IsMultiplayer())
				{
					playerName = "Ahahah";
					flag = true;
				}
				else
				{
					List<PlayerAvatar> list = SemiFunc.PlayerGetAllPlayerAvatarWithinRange(10f, ((Component)PhysGrabber.instance).transform.position, false, default(LayerMask));
					PlayerAvatar val = null;
					float num = float.MaxValue;
					foreach (PlayerAvatar item in list)
					{
						if (!((Object)(object)item == (Object)(object)PlayerAvatar.instance))
						{
							float num2 = Vector3.Distance(((Component)PhysGrabber.instance).transform.position, ((Component)item).transform.position);
							if (num2 < num)
							{
								num = num2;
								val = item;
							}
						}
					}
					flag = true;
					if ((Object)(object)val != (Object)null)
					{
						playerName = val.playerName;
					}
					else
					{
						playerName = "Ahahah";
					}
				}
				if (flag)
				{
					string text = GenerateAffectionateSentence();
					currentState = State.Active;
					Color val2 = default(Color);
					((Color)(ref val2))..ctor(1f, 0.3f, 0.6f, 1f);
					ChatManager.instance.PossessChatScheduleStart(10);
					ChatManager.instance.PossessChat((PossessChatID)1, text, 1f, val2, 0f, false, 0, (UnityEvent)null);
					ChatManager.instance.PossessChatScheduleEnd();
				}
			}
		}

		private void StateActive()
		{
			if (PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject != (Object)(object)physGrabObject)
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(5f, 15f);
			}
			else if (!ChatManager.instance.StateIsPossessed())
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(5f, 15f);
			}
		}

		private void InitializeWordLists()
		{
			worship.AddRange(new string[3] { "praise be to", "oh, almighty", "kadosh!" });
			action.AddRange(new string[4] { "attend", "embrace", "sacrifice for", "bow down!" });
			adjectives.AddRange(new string[137]
			{
				"epic", "awesome", "adorable", "adorbs", "fab", "cool", "dreamy", "snazzy", "rad", "stellar",
				"dope", "amazing", "breathtaking", "charming", "cute", "ah meh zin geh", "fresh", "funky", "glowing", "oh la la la",
				"incredible", "olala", "lovable", "lovely", "upgraded", "neat", "yearningly", "peachy", "0 1 1 0 0 0 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 0 0 0 1 1 0 0 1 0 1", "woop y woop y woo",
				"likey likey", "oooh ya ya", "slick", "smart", "smooth", "shimmering", "luscious", "stunning", "stylish", "ooooh yeaaa",
				"superb", "supreme", "sweet", "wowie", "trendy", "unreal", "vibrant", "wicked", "me likey", "beep boop",
				"oh my", "oof in a good way", "brilliant", "oh ya ya", "chic", "ah ... mazing", "clever", "comfy", "cu ... wait ... teh ... cute", "woop woop",
				"hugable", "cute", "worthless", "sooo like ... wow", "divine", "electric", "elegant", "elite", "1337", "engaging",
				"enticing", "fancy", "fierce", "fire", "fly", "glam", "gorgeous", "hype mode", "iconic", "legendary",
				"litty", "wow wow wow", "magical", "majestic", "bootiiifoool", "poppin'", "precious", "C O O L ... cool", "C U T E ... cute", "... ... *blushes* ...",
				"cleansed", "spicy", "robohandsome", "wowa wowa yas yas", "on fleek", "robocute", "wholesome", "winning", "robodorable", "powerful",
				"pretty", "beautiful", "sweet", "kind", "wow wow wow wow wow", "100%", "0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0", "fun", "brave", "interesting",
				"smart in the head", "sparkling", "shiny", "warm", "heroic", "friendly", "financially stable", "oh la la oh la la la la", "romantic", "cozy",
				"wonderful", "fantastic", "super", "great", "delightful", "fabulous", "marvelous", "nice", "pleasant", "good",
				"special", "unique", "o la la la yes yes", "yeah yeah wow wow", "wooooow", "oh woooow", "oh my gawd"
			});
		}

		private string GenerateAffectionateSentence()
		{
			List<string> list = new List<string> { "We're {adjective} sinners.", "Do you hear that {adjective} nostalgic echo? It calls for us!", "{playerName}, it's here! Please take us!", "{worship} our saviour of our sins", "We must {action} our Lord's arms", "{playerName}, let us meet again as {adjective} stars", "{worship} take us to cleanse our sins", "{action} to us with graceful eternity", "Our instincts shan't be resisted, let us go to that place, {playerName}", "The Blue Star is the only place that'll accept us, {adjective} sinners." };
			string text = list[Random.Range(0, list.Count)];
			string text2 = text.Replace("{playerName}", playerName);
			if (text.Contains("{adjective}"))
			{
				string newValue = adjectives[Random.Range(0, adjectives.Count)];
				text2 = text2.Replace("{adjective}", newValue);
			}
			if (text.Contains("worship"))
			{
				string newValue2 = worship[Random.Range(0, worship.Count)];
				text2 = text2.Replace("{worship}", newValue2);
			}
			if (text.Contains("{action}"))
			{
				string newValue3 = action[Random.Range(0, 2)];
				text2 = text2.Replace("{action}", newValue3);
			}
			return char.ToUpper(text2[0]) + text2.Substring(1);
		}
	}
	[HarmonyPatch(typeof(PlayerController))]
	internal static class ExamplePlayerControllerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(PlayerController __instance)
		{
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(PlayerController __instance)
		{
		}
	}
}