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 Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ArrowTrajectory")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArrowTrajectory")]
[assembly: AssemblyTitle("ArrowTrajectory")]
[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 ArrowTrajectory
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "ArrowTrajectory";
public const string PLUGIN_NAME = "ArrowTrajectory";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace ArrowTrajectories
{
[BepInPlugin("com.Obelous.ArrowTrajectories", "ArrowTrajectories", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private static Dictionary<GameObject, GameObject> lineObjects = new Dictionary<GameObject, GameObject>();
private Dictionary<GameObject, int> frameCounts = new Dictionary<GameObject, int>();
private void Start()
{
string text = "Please Don't Cheat!";
if (text == null)
{
}
}
public void drawLine(GameObject obj, float force, float angle)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)obj == (Object)null || (Object)(object)obj.transform == (Object)null)
{
return;
}
if (!lineObjects.ContainsKey(obj))
{
GameObject val = new GameObject("LineObject");
LineRenderer val2 = val.AddComponent<LineRenderer>();
((Renderer)val2).material = new Material(Shader.Find("Sprites/Default"));
val2.widthMultiplier = 0.1f;
val2.positionCount = 100;
frameCounts[obj] = 0;
for (int i = 0; i < 100; i++)
{
val2.SetPosition(i, new Vector3(0f, 0f, 0f));
}
lineObjects[obj] = val;
}
LineRenderer component = lineObjects[obj].GetComponent<LineRenderer>();
float num = 9.8f;
for (int j = 0; j < 100; j++)
{
float num2 = (float)j / 10f;
float num3 = force * Mathf.Cos(angle * ((float)Math.PI / 180f)) * num2;
float num4 = force * Mathf.Sin(angle * ((float)Math.PI / 180f)) * num2 - 0.5f * num * num2 * num2;
component.SetPosition(j, new Vector3(obj.transform.position.x + num3, obj.transform.position.y + num4, 0f));
}
}
private void Update()
{
//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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == null)
{
return;
}
activeScene = SceneManager.GetActiveScene();
if (!((Scene)(ref activeScene)).name.Contains("Level") || GameLobby.isOnlineGame)
{
return;
}
GameObject[] array = Object.FindObjectsOfType<GameObject>();
if (array == null)
{
return;
}
GameObject[] array2 = array;
foreach (GameObject val in array2)
{
if (!((Object)val).name.StartsWith("Bow"))
{
continue;
}
BowTransform component = val.GetComponent<BowTransform>();
if (!((Object)(object)component != (Object)null))
{
continue;
}
FieldInfo field = typeof(BowTransform).GetField("hasFired", BindingFlags.Instance | BindingFlags.NonPublic);
if (!(bool)field.GetValue(component))
{
if (!frameCounts.ContainsKey(val))
{
frameCounts[val] = 0;
}
frameCounts[val]++;
float force = 37f;
Quaternion rotation = val.transform.rotation;
float angle = ((Quaternion)(ref rotation)).eulerAngles.z + 90f;
drawLine(val, force, angle);
}
else if (frameCounts.ContainsKey(val))
{
frameCounts[val] = 0;
}
}
List<GameObject> list = new List<GameObject>();
foreach (KeyValuePair<GameObject, GameObject> lineObject in lineObjects)
{
if (!lineObject.Key.activeInHierarchy)
{
list.Add(lineObject.Key);
((MonoBehaviour)this).StartCoroutine(DeactivateLine(lineObject.Value));
}
}
foreach (GameObject item in list)
{
lineObjects.Remove(item);
}
}
private IEnumerator DeactivateLine(GameObject lineObject)
{
yield return (object)new WaitForSeconds(10f);
Object.Destroy((Object)(object)lineObject);
}
}
}