using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[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("aquavirtualpet")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Aqua Virtual Ultra Pet")]
[assembly: AssemblyTitle("aquavirtualpet")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 aquavirtualpet
{
public class Aqua : MonoBehaviour
{
private RectTransform trans;
private Animator ani;
private float yVelocity;
private float xCoeff = 1f;
private float waveTime = 0f;
private RectTransform canvas;
private readonly float[] waveTimes = new float[2] { 1.35f, 1.017f };
public float width => AQUAConfig.sizeField.value;
public float jumpMult => AQUAConfig.jumpField.value;
public float speedMult => AQUAConfig.speedField.value;
public float gravMult => AQUAConfig.gravField.value;
public float waveProbability => AQUAConfig.waveProbField.value;
public bool willWave => AQUAConfig.waveField.value;
public bool wallJumps => AQUAConfig.wallJumpField.value;
public bool throwsKnives => AQUAConfig.knifeField.value;
private void Start()
{
trans = ((Component)this).gameObject.GetComponent<RectTransform>();
canvas = GameObject.Find("/Canvas").GetComponent<RectTransform>();
ani = ((Component)this).gameObject.GetComponent<Animator>();
Jump();
}
public void ThrowKnives(int amt = 6)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
float num = Random.Range(0f, MathF.PI * 2f / (float)amt);
for (float num2 = 0f; num2 < MathF.PI * 2f; num2 += MathF.PI * 2f / (float)amt)
{
GameObject val = Object.Instantiate<GameObject>((GameObject)Plugin.assetDict["Knife"], ((Component)this).transform.parent);
Knife knife = val.AddComponent<Knife>();
knife.direction = num2 + num;
}
waveTime = 0f;
Jump(-1f, 1f, jumps: true, canWave: false, 2f);
ani.SetInteger("Anim", 3);
}
private void Jump(float min = -1f, float max = 1f, bool jumps = true, bool canWave = false, float power = 1f)
{
if (waveTime > 0f)
{
return;
}
ani.SetInteger("Anim", 0);
if (willWave && canWave && Random.Range(0f, 1f) > 1f - 1f / waveProbability)
{
int num = Random.Range(1, 3);
ani.SetInteger("Anim", num);
waveTime = waveTimes[num - 1] * (float)Random.Range(2, 6);
yVelocity = 0f;
xCoeff = 0f;
}
else
{
if (jumps)
{
yVelocity = power * width * jumpMult * Random.Range(2f, 4f);
}
xCoeff = Random.Range(min, max);
}
}
private void Update()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
trans.sizeDelta = new Vector2(width, width);
if (trans.anchoredPosition.x > canvas.sizeDelta.x / 2f - width / 2f)
{
trans.anchoredPosition = new Vector2(canvas.sizeDelta.x / 2f - width / 2f, trans.anchoredPosition.y);
Jump(-1f, -0.1f, wallJumps);
}
if (trans.anchoredPosition.x < 0f - (canvas.sizeDelta.x / 2f - width / 2f))
{
trans.anchoredPosition = new Vector2(0f - (canvas.sizeDelta.x / 2f - width / 2f), trans.anchoredPosition.y);
Jump(0.1f, 1f, wallJumps);
}
if (trans.anchoredPosition.y < 0f)
{
trans.anchoredPosition = new Vector2(trans.anchoredPosition.x, 0f);
Jump(-1f, 1f, jumps: true, canWave: true);
}
if (ani.GetInteger("Anim") != 0 && ani.GetInteger("Anim") != 3)
{
waveTime -= Time.unscaledDeltaTime;
if (waveTime < 0f)
{
ani.SetInteger("Anim", 0);
Jump();
}
}
else
{
((Transform)trans).Translate(Vector2.op_Implicit(new Vector2(width * xCoeff * 2f * speedMult, yVelocity) * Time.unscaledDeltaTime));
yVelocity -= width * 8f * gravMult * Time.unscaledDeltaTime;
}
}
}
public class Knife : MonoBehaviour
{
private GameObject aquaContainer;
private GameObject aquaImage;
private Aqua aquaAttr;
private RectTransform trans;
private Image img;
public float direction = 0f;
private float age;
public float speed => AQUAConfig.knifeSpeedField.value;
public float lifetime => AQUAConfig.knifeLifetimeField.value;
private void Start()
{
//IL_0087: 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)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
age = lifetime;
aquaContainer = ((Component)((Component)this).transform.parent).gameObject;
aquaImage = ((Component)((Component)this).transform.parent.Find("Image")).gameObject;
aquaAttr = aquaImage.GetComponent<Aqua>();
img = ((Component)this).gameObject.GetComponent<Image>();
trans = ((Component)this).gameObject.GetComponent<RectTransform>();
trans.anchoredPosition = aquaImage.GetComponent<RectTransform>().anchoredPosition + new Vector2(0f, aquaAttr.width / 2f);
((Transform)trans).rotation = Quaternion.Euler(0f, 0f, 57.29578f * direction);
}
private void Update()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = new Vector2(Mathf.Cos(direction), Mathf.Sin(direction)) * aquaAttr.width * speed * (age / lifetime) * 4f;
age -= Time.unscaledDeltaTime;
if (age < 0f)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
((Graphic)img).color = new Color(1f, 1f, 1f, age / lifetime);
RectTransform obj = trans;
obj.anchoredPosition += val * Time.unscaledDeltaTime;
}
}
[BepInPlugin("aquavirtualpet", "Aqua Virtual Ultra Pet", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static class PatchMethods
{
[HarmonyPostfix]
[HarmonyPatch(typeof(TimeController), "ContinueTime")]
public static void AquaLikesHitStop(float length)
{
if (!(length >= 0.4f))
{
return;
}
foreach (GameObject aqualing in aqualings)
{
((Component)aqualing.transform.GetChild(0)).gameObject.GetComponent<Aqua>().ThrowKnives();
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(TimeController), "ParryFlash")]
public static void AquaAlsoLikesParries()
{
foreach (GameObject aqualing in aqualings)
{
((Component)aqualing.transform.GetChild(0)).gameObject.GetComponent<Aqua>().ThrowKnives(8);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(TimeController), "SlowDown")]
public static void AquaAlsoAlsoLikesSlowDowns(float amount)
{
foreach (GameObject aqualing in aqualings)
{
((Component)aqualing.transform.GetChild(0)).gameObject.GetComponent<Aqua>().ThrowKnives(12);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(StyleHUD), "AddPoints")]
private static void AquaLikesCertainStylePoints(int points, string pointID)
{
if (!styles.Contains(pointID))
{
return;
}
foreach (GameObject aqualing in aqualings)
{
((Component)aqualing.transform.GetChild(0)).gameObject.GetComponent<Aqua>().ThrowKnives(8);
}
}
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static IntValueChangeEventDelegate <>9__7_0;
internal void <Start>b__7_0(IntValueChangeEvent e)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
GameObject val = GameObject.Find("/Canvas");
int num = aqualings.Count - e.value;
if (num < 0)
{
for (int i = 0; i < -num; i++)
{
GameObject val2 = Object.Instantiate<GameObject>((GameObject)assetDict["Aqua"], val.transform);
((Component)val2.transform.GetChild(0)).gameObject.AddComponent<Aqua>();
aqualings.Add(val2);
}
}
else if (num > 0)
{
for (int j = 0; j < num; j++)
{
GameObject val3 = aqualings[0];
aqualings.RemoveAt(0);
Object.Destroy((Object)(object)val3);
}
}
}
}
internal static ManualLogSource Logger;
public static List<GameObject> aqualings = new List<GameObject>();
public Harmony harm;
public static string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static readonly AssetBundle Assets = AssetBundle.LoadFromFile(Path.Combine(directory, "aqua.bundle"));
public static readonly Dictionary<string, Object> assetDict = new Dictionary<string, Object>();
public static List<string> styles = new List<string> { "ultrakill.fireworks", "ultrakill.terminalvelocity", "ultrakill.chargeback" };
private void Awake()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin aquavirtualpet is loaded!");
harm = new Harmony("aquavirtualpet");
harm.PatchAll(typeof(PatchMethods));
SceneManager.sceneLoaded += OnSceneLoaded;
Object[] array = Assets.LoadAllAssets();
Object[] array2 = array;
foreach (Object val in array2)
{
Object val2 = val;
assetDict[val2.name] = val2;
}
}
private void Start()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
AQUAConfig.Init();
IntField numberField = AQUAConfig.numberField;
object obj = <>c.<>9__7_0;
if (obj == null)
{
IntValueChangeEventDelegate val = delegate(IntValueChangeEvent e)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
GameObject val2 = GameObject.Find("/Canvas");
int num = aqualings.Count - e.value;
if (num < 0)
{
for (int i = 0; i < -num; i++)
{
GameObject val3 = Object.Instantiate<GameObject>((GameObject)assetDict["Aqua"], val2.transform);
((Component)val3.transform.GetChild(0)).gameObject.AddComponent<Aqua>();
aqualings.Add(val3);
}
}
else if (num > 0)
{
for (int j = 0; j < num; j++)
{
GameObject val4 = aqualings[0];
aqualings.RemoveAt(0);
Object.Destroy((Object)(object)val4);
}
}
};
<>c.<>9__7_0 = val;
obj = (object)val;
}
numberField.onValueChange += (IntValueChangeEventDelegate)obj;
}
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
aqualings.Clear();
GameObject val = GameObject.Find("/Canvas");
if ((Object)(object)val != (Object)null)
{
for (int i = 0; i < AQUAConfig.numberField.value; i++)
{
GameObject val2 = Object.Instantiate<GameObject>((GameObject)assetDict["Aqua"], val.transform);
((Component)val2.transform.GetChild(0)).gameObject.AddComponent<Aqua>();
aqualings.Add(val2);
}
}
}
}
public static class AQUAConfig
{
private static PluginConfigurator config;
public static IntField numberField;
public static FloatField sizeField;
public static FloatField jumpField;
public static FloatField speedField;
public static FloatField gravField;
public static FloatField waveProbField;
public static BoolField knifeField;
public static FloatField knifeSpeedField;
public static FloatField knifeLifetimeField;
public static BoolField waveField;
public static BoolField wallJumpField;
public static Dictionary<string, StringField[]> weaponPairs = new Dictionary<string, StringField[]>();
private static string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static void Init()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Expected O, but got Unknown
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Expected O, but got Unknown
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Expected O, but got Unknown
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Expected O, but got Unknown
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Expected O, but got Unknown
config = PluginConfigurator.Create("Aqua Virtual Ultra Pet", "aquavirtualpet");
config.SetIconWithURL("file://" + Path.Combine(directory, "icon.png"));
numberField = new IntField(config.rootPanel, "Number of Aquas", "num", 1, 1, 100);
sizeField = new FloatField(config.rootPanel, "Aqua Size", "size", 80f, 1f, 500f);
jumpField = new FloatField(config.rootPanel, "Jump Power", "jump", 1f, 0.1f, 10f);
speedField = new FloatField(config.rootPanel, "Speed", "spd", 1f, 0.1f, 10f);
gravField = new FloatField(config.rootPanel, "Gravity", "grav", 1f, 0.1f, 10f);
waveField = new BoolField(config.rootPanel, "Waves", "wv", true);
waveProbField = new FloatField(config.rootPanel, "Wave Probability (1 in", "wvp", 20f, 1f, 100f);
wallJumpField = new BoolField(config.rootPanel, "Wall Jumps", "wll", true);
knifeField = new BoolField(config.rootPanel, "Throws Knives", "kn", true);
knifeSpeedField = new FloatField(config.rootPanel, "Knife Velocity", "knvel", 1f, 0.1f, 10f);
knifeLifetimeField = new FloatField(config.rootPanel, "Knife Lifetime", "knlif", 2f, 0.1f, 5f);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "aquavirtualpet";
public const string PLUGIN_NAME = "Aqua Virtual Ultra Pet";
public const string PLUGIN_VERSION = "1.0.0";
}
}