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.Bootstrap;
using BepInEx.Configuration;
using BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("UniversalGust")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UniversalGust")]
[assembly: AssemblyTitle("UniversalGust")]
[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 UniversalGust
{
[BepInPlugin("com.mintysharky.universalgust", "UniversalGust", "1.0.0")]
public class UniversalGust : BaseUnityPlugin
{
public class Patches
{
public static bool tsuGEnabled;
private static void universalgust(ref Shockwave __instance)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: 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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: 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_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.isGustAbility)
{
return;
}
__instance.radius = (Fix)gustStrength.Value;
GameObject val = GameObject.Find("Level");
int childCount = val.transform.childCount;
List<Transform> list = new List<Transform>();
for (int i = 0; i < childCount; i++)
{
list.Add(val.transform.GetChild(i));
}
float num = float.PositiveInfinity;
Transform val2 = null;
for (int j = 0; j < list.Count; j++)
{
if (list[j].position.x < num)
{
num = list[j].position.x;
val2 = list[j];
}
}
Vector3 val3 = ((Component)__instance).transform.position - val2.position;
Fix val4 = (Fix)(((Vector3)(ref val3)).magnitude * (float)__instance.radius * (float)__instance.platformForce / 3f);
if (tsuGEnabled)
{
val4 *= (Fix)2L;
}
Vec2 val5 = default(Vec2);
for (int k = 0; k < list.Count; k++)
{
((Vec2)(ref val5))..ctor(-(Fix)(((Component)__instance).transform.position - list[k].position).x * val4, -(Fix)(((Component)__instance).transform.position - list[k].position).y * val4);
((Component)list[k]).gameObject.GetComponent<DPhysicsRoundedRect>().AddForce(val5);
}
}
}
internal static ConfigFile config;
internal static ConfigEntry<float> gustStrength;
private void Log(string message)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)message);
}
private void Awake()
{
config = ((BaseUnityPlugin)this).Config;
gustStrength = config.Bind<float>("Monten Gust Patches", "Gust Strength", 1f, "changes the shockwave radius for a gust");
Log("Plugin UniversalGust is loaded!");
foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
{
if (pluginInfo.Key.Equals("com.maxgamertyper1.suck"))
{
Patches.tsuGEnabled = true;
Log("tsuG detected... Amplifying... Amplifying Complete");
break;
}
}
DoPatching();
}
private void DoPatching()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony harmony = new Harmony("com.mintysharky.universalgust");
Patch(harmony, typeof(Shockwave), "ActivateShockWave", "universalgust", postfix: false);
}
private void OnDestroy()
{
Log("Bye Bye From UniversalGust");
}
private void Patch(Harmony harmony, Type OriginalClass, string OriginalMethod, string PatchMethod, bool postfix = true)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
MethodInfo methodInfo = AccessTools.Method(OriginalClass, OriginalMethod, (Type[])null, (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(typeof(Patches), PatchMethod, (Type[])null, (Type[])null);
if (!postfix)
{
harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
else
{
harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
Log("Patched " + OriginalMethod + " in " + OriginalClass.ToString());
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "UniversalGust";
public const string PLUGIN_NAME = "UniversalGust";
public const string PLUGIN_VERSION = "1.0.0";
}
}