using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AngryTulipSnakes.Configs;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Lib;
using CSync.Util;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[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("inoyu.AngryTulipSnakes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.5.1.0")]
[assembly: AssemblyInformationalVersion("0.5.1+cf3517e023ad69d955fc8036d5c35fa405389ee1")]
[assembly: AssemblyProduct("AngryTulipSnakes")]
[assembly: AssemblyTitle("inoyu.AngryTulipSnakes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.1.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 AngryTulipSnakes
{
[BepInPlugin("inoyu.AngryTulipSnakes", "AngryTulipSnakes", "0.5.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AngryTulipSnakes : BaseUnityPlugin
{
internal static ATSConfigs atsConfigs;
public static AngryTulipSnakes Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
atsConfigs = new ATSConfigs(((BaseUnityPlugin)this).Config);
Patch();
Logger.LogInfo((object)"inoyu.AngryTulipSnakes v0.5.1 has loaded!");
}
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("inoyu.AngryTulipSnakes");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "inoyu.AngryTulipSnakes";
public const string PLUGIN_NAME = "AngryTulipSnakes";
public const string PLUGIN_VERSION = "0.5.1";
}
}
namespace AngryTulipSnakes.Patches
{
[HarmonyPatch(typeof(FlowerSnakeEnemy))]
public class SnakeFlightPower
{
private static bool boostedFlightPower;
[HarmonyPatch("MainSnakeActAsConductor")]
[HarmonyPrefix]
private static void PatchSnakeStrength(FlowerSnakeEnemy __instance)
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
if (__instance.activatedFlight && !boostedFlightPower)
{
boostedFlightPower = true;
__instance.flightPower = 8 * SyncedEntry<int>.op_Implicit(SyncedInstance<ATSConfigs>.Instance.YOINK_POWER_MULTIPLPLIER);
PlayerControllerB clingingToPlayer = __instance.clingingToPlayer;
clingingToPlayer.enemiesOnPerson += 2 * SyncedEntry<int>.op_Implicit(SyncedInstance<ATSConfigs>.Instance.YOINK_POWER_MULTIPLPLIER);
}
if (!__instance.activatedFlight && boostedFlightPower)
{
boostedFlightPower = false;
__instance.clingingToPlayer.enemiesOnPerson = 0;
}
if (__instance.clingingToPlayer.thisPlayerBody.position.y >= (float)SyncedEntry<int>.op_Implicit(SyncedInstance<ATSConfigs>.Instance.DROP_HEIGHT))
{
__instance.flightPower = 0f;
__instance.clingPosition = 0;
__instance.StopClingingServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
}
}
}
}
namespace AngryTulipSnakes.Configs
{
[DataContract]
internal class ATSConfigs : SyncedConfig<ATSConfigs>
{
[DataMember]
internal SyncedEntry<int> YOINK_POWER_MULTIPLPLIER;
[DataMember]
internal SyncedEntry<int> DROP_HEIGHT;
internal ATSConfigs(ConfigFile cfg)
: base("AngryTulipSnakes")
{
ConfigManager.Register<ATSConfigs>(this);
YOINK_POWER_MULTIPLPLIER = Extensions.BindSyncedEntry<int>(cfg, "LiftingPower", "lifting power multiplier", 5, "How fast a player gets yoinked.");
DROP_HEIGHT = Extensions.BindSyncedEntry<int>(cfg, "LiftingPower", "max flight height", 65, "The height from where a player is dropped.");
}
}
}