Decompiled source of NewtoPolo v0.1.1

NewtoPoloPlugin.dll

Decompiled 5 days ago
using System;
using System.Collections;
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 Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using RoR2.Orbs;
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("NewtoPoloPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+691e4d1bba4770213709e49984d454b4200e6ace")]
[assembly: AssemblyProduct("NewtoPoloPlugin")]
[assembly: AssemblyTitle("NewtoPoloPlugin")]
[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 NewtoPoloPlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Coffee.NewtoPolo", "NewtoPolo", "0.1.1")]
	public class NewtoPoloPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "Coffee.NewtoPolo";

		public const string PluginAuthor = "Coffee";

		public const string PluginName = "NewtoPolo";

		public const string PluginVersion = "0.1.1";

		public void Awake()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			UserChatMessage.OnProcessed += new hook_OnProcessed(UserChatMessageOnProcessed);
		}

		private void UserChatMessageOnProcessed(orig_OnProcessed orig, UserChatMessage self)
		{
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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_020e: Unknown result type (might be due to invalid IL or missing references)
			Log.Debug("AAAAAAAAAAA");
			bool flag = self.text.ToLower().Contains("newto");
			bool flag2 = self.text.ToLower().Contains("saplo");
			if (!Object.op_Implicit((Object)(object)self.sender) || !Object.op_Implicit((Object)(object)self.sender.GetComponent<NetworkUser>()) || !(flag || flag2))
			{
				return;
			}
			int num = 0;
			foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList<PurchaseInteraction>())
			{
				if (((instances.displayNameToken.ToUpper() == "NEWT_STATUE_NAME" && flag) || (instances.displayNameToken.ToUpper().Contains("SS2_SHRINE_ETHEREAL") && flag2)) && instances.Networkavailable)
				{
					CharacterBody playerBody = self.sender.GetComponent<NetworkUser>().GetCurrentBody();
					Transform transform = playerBody.transform;
					Vector3 val = ((Component)instances).transform.position - transform.localPosition;
					Vector3 localPosition = transform.localPosition;
					Vector3 val2 = new Vector3
					{
						x = val.x,
						y = 0f,
						z = val.z
					};
					Vector3 effectSpawn = localPosition + 25f * ((Vector3)(ref val2)).normalized;
					string text = "";
					text = ((((Vector3)(ref val)).magnitude > 350f) ? (text + "that sounded like it came from very far away") : ((!(((Vector3)(ref val)).magnitude > 75f)) ? (text + "that sounded like it was very nearby") : (text + "that sounded like it was in the distance")));
					if (val.y > 75f)
					{
						text += ", up above the clouds";
					}
					else if (val.y < -75f)
					{
						text += ", in dark depths of the world";
					}
					string text2 = "#02f7e7";
					string text3 = "POLO";
					if (instances.displayNameToken.ToUpper().Contains("SS2_SHRINE_ETHEREAL"))
					{
						text2 = "#02f77d";
						text3 = "SAPOLO";
					}
					string chatMessage = "<color=" + text2 + ">" + instances.GetDisplayName() + "</color>: " + text3 + " (" + text + ")";
					((MonoBehaviour)(object)this).Invoke(delegate
					{
						//IL_001e: Unknown result type (might be due to invalid IL or missing references)
						announceAltar(chatMessage, instances, effectSpawn, playerBody);
					}, 0.5f);
					num++;
				}
			}
			if (num == 0)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "You hear nothing but the void and it's deafening silence."
				});
			}
		}

		public void announceAltar(string chatMessage, PurchaseInteraction altar, Vector3 effectSpawn, CharacterBody player)
		{
			//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_0012: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_003f: 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_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_005c: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0069: 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_007a: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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)
			//IL_00d1: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = chatMessage
			});
			EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
			{
				origin = ((Component)altar).transform.position,
				rotation = Quaternion.identity,
				scale = 10f,
				color = ColorCatalog.GetColor((ColorIndex)4)
			}, true);
			OrbManager.instance.AddOrb((Orb)new LightningOrb
			{
				origin = effectSpawn,
				attacker = ((Component)altar).gameObject,
				target = player.mainHurtBox,
				damageValue = 25f + Run.instance.difficultyCoefficient * (float)Math.Pow(1.8, Run.instance.shopPortalCount) * 5f,
				damageColorIndex = (DamageColorIndex)9,
				damageType = DamageTypeCombo.op_Implicit((DamageType)33554432),
				isCrit = true,
				procCoefficient = 1f
			});
		}
	}
	public static class Utility
	{
		[CompilerGenerated]
		private sealed class <InvokeRoutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Action f;

			public float delay;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InvokeRoutine>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(delay);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					f();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static void Invoke(this MonoBehaviour mb, Action f, float delay)
		{
			mb.StartCoroutine(InvokeRoutine(f, delay));
		}

		[IteratorStateMachine(typeof(<InvokeRoutine>d__1))]
		private static IEnumerator InvokeRoutine(Action f, float delay)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InvokeRoutine>d__1(0)
			{
				f = f,
				delay = delay
			};
		}
	}
}