Decompiled source of AGoodNameLib v4.1.3

AGoodNameLib.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
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("AGoodNameLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AGoodNameLib")]
[assembly: AssemblyTitle("AGoodNameLib")]
[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 AGoodNameLib
{
	[BepInPlugin("com.erwer.AGoodNameLib", "AGoodNameLib", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.erwer.AGoodNameLib";

		public const string PLUGIN_NAME = "AGoodNameLib";

		public const string PLUGIN_VERSION = "1.0.0";

		public void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.erwer.AGoodNameLib is loaded!");
			Harmony val = new Harmony("com.erwer.AGoodNameLib");
			val.PatchAll(typeof(Patches));
		}
	}
	public class player
	{
		public static bool try_kill_player(Player player, PlayerBody __body, int id = 256, CauseOfDeath cod = 2)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"try_kill_player should not be used, try to use do_kill_player;");
			if (player == null)
			{
				return false;
			}
			((Component)__body).GetComponent<PlayerCollision>().killPlayer(id, false, true, cod);
			return true;
		}

		public static bool do_kill_player(PlayerBody __body, int id = 256, CauseOfDeath cod = 2)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((Component)__body).GetComponent<PlayerCollision>().killPlayer(id, false, true, cod);
			return true;
		}

		public static bool try_destroy_respawns(Player player)
		{
			if (player == null)
			{
				return false;
			}
			player.RespawnPositions = new List<RevivePositionIndicator>();
			return true;
		}

		public static void setPos(Player player, Vec2 position)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			player.Position = position;
		}

		public static Player player_from_body(PlayerBody body)
		{
			if ((Object)(object)body == (Object)null)
			{
				return null;
			}
			return PlayerHandler.Get().GetPlayer(body.idHolder.GetPlayerId());
		}

		public static int id_from_player_body(PlayerBody body)
		{
			if ((Object)(object)body == (Object)null)
			{
				return 256;
			}
			return body.idHolder.GetPlayerId();
		}

		public static PlayerPhysics Physics_from_body(PlayerBody body)
		{
			if ((Object)(object)body == (Object)null)
			{
				return null;
			}
			return body.physics;
		}

		public static void clear_ropes(PlayerBody body)
		{
			if (!((Object)(object)body == (Object)null))
			{
				body.EnterAbilityClearRope();
			}
		}

		public static bool does_own_rope(PlayerBody body)
		{
			if (id_from_player_body(body) == body.ropeBody.ownerId)
			{
				return true;
			}
			return false;
		}
	}
	public static class abilities
	{
		public static bool can_use_abilities(Player player)
		{
			List<GameObject> list = player.Abilities;
			foreach (GameObject item in list)
			{
				if (item.GetComponent<Ability>().isCastable)
				{
					return true;
				}
			}
			return false;
		}

		public static void clear_abilities(Player player)
		{
			player.Abilities.Clear();
		}

		public static void set_ability_at_index(Player player, GameObject ability, int index = 1, string ability_class_name = "BowTransform")
		{
			player.Abilities[index] = ability;
			player.AbilityIcons[index] = AbilityClassToSprite(ability_class_name);
		}

		public static Sprite AbilityClassToSprite(string name)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			RandomAbility val = new RandomAbility();
			return val.abilityIcons.FindSprite(name);
		}

		public static NamedSprite GetRandomAbilitySprite()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			RandomAbility val = new RandomAbility();
			return RandomAbility.GetRandomAbilityPrefab(val.abilityIcons, val.abilityIcons);
		}
	}
	public class auto_config
	{
		public static void Slider<T>(ref ConfigEntry<T> configVar, ConfigFile config, string sectionName, string description, T defaultValue, T minValue, T maxValue) where T : IComparable
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			configVar = config.Bind<T>(sectionName, description, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<T>(minValue, maxValue), Array.Empty<object>()));
		}

		public static void NumberBox<T>(ref ConfigEntry<T> configVar, ConfigFile config, string sectionName, string description, T defaultValue) where T : IComparable
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			configVar = config.Bind<T>(sectionName, description, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()));
		}

		public static void CheckBox(ref ConfigEntry<bool> configVar, ConfigFile config, string sectionName, string description, bool defaultValue)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			configVar = config.Bind<bool>(sectionName, description, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()));
		}
	}
	public class math
	{
		public static int RandomInt(int min, int max)
		{
			return Updater.RandomInt(min, max);
		}
	}
	public class match
	{
		public bool SuddenDeathState
		{
			get
			{
				return GameSessionHandler.SuddenDeathInProgress;
			}
			set
			{
				GameSessionHandler.SuddenDeathInProgress = value;
			}
		}
	}
	public class webhook_discord
	{
		public string defaultBotName = "\"A-Good-Name-Lib - Bot\"";

		public void SendDiscordMessage(string message, string webhookUrl, string botName = null)
		{
			botName = botName ?? defaultBotName;
			try
			{
				Debug.Log((object)"Sending discord message");
				WebClient webClient = new WebClient();
				webClient.Headers.Add("Content-Type", "application/json");
				string s = "{\"content\": \"" + message + "\", \"username\": \"" + botName + "\"}";
				webClient.UploadData(webhookUrl, Encoding.UTF8.GetBytes(s));
			}
			catch (WebException ex)
			{
				Debug.LogError((object)("Error sending Discord message: " + ex.Message));
				if (ex.Response != null)
				{
					using (StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream()))
					{
						string text = streamReader.ReadToEnd();
						Debug.LogError((object)("Discord response: " + text));
						return;
					}
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AGoodNameLib";

		public const string PLUGIN_NAME = "AGoodNameLib";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}