using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("modding_discord_button")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("modding_discord_button")]
[assembly: AssemblyTitle("modding_discord_button")]
[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 modding_discord_button
{
[BepInPlugin("com.erwer.modding_discord_button", "modding_discord_button", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__6_0;
internal void <Update>b__6_0()
{
Application.OpenURL("https://discord.gg/official-bopl-battle-modding-comunity-1175164882388275310");
}
}
public const string AUTHOR = "erwer";
public const string PLUGIN_GUID = "com.erwer.modding_discord_button";
public const string PLUGIN_NAME = "modding_discord_button";
public const string PLUGIN_VERSION = "1.0.0";
private GameObject modding_discord_button;
private 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.modding_discord_button is loaded!");
Harmony val = new Harmony("com.erwer.modding_discord_button");
val.PatchAll(typeof(Patches));
}
private void Update()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: 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_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
if (!((Object)(object)modding_discord_button == (Object)null))
{
return;
}
GameObject val = GameObject.Find("Canvas (1)");
Sprite sprite = texTils.LoadTexture(Path.Combine(Paths.BepInExRootPath, "plugins", "erwer-modding_discord_button", "mds_erwer_discordCircle.png"));
GameObject val2 = new GameObject("Discord-Link-Modding");
RectTransform val3 = val2.AddComponent<RectTransform>();
float num = 0.053f;
float num2 = 0.03f;
val3.anchoredPosition = new Vector2(0f, 0f);
val3.anchorMin = new Vector2(num, num2);
val3.anchorMax = new Vector2(num, num2);
val3.pivot = new Vector2(num, num2);
val3.sizeDelta = new Vector2(50f, 50f) * 3f;
Image val4 = val2.AddComponent<Image>();
val2.AddComponent<Button>();
val4.sprite = sprite;
val2.SetActive(true);
val2.transform.SetParent(val.transform, false);
ButtonClickedEvent onClick = ((Component)val4).GetComponent<Button>().onClick;
object obj = <>c.<>9__6_0;
if (obj == null)
{
UnityAction val5 = delegate
{
Application.OpenURL("https://discord.gg/official-bopl-battle-modding-comunity-1175164882388275310");
};
<>c.<>9__6_0 = val5;
obj = (object)val5;
}
((UnityEvent)onClick).AddListener((UnityAction)obj);
ColorBlock colors = ((Selectable)((Component)val4).GetComponent<Button>()).colors;
((ColorBlock)(ref colors)).normalColor = Color.white;
((ColorBlock)(ref colors)).highlightedColor = new Color(1.2f, 1.2f, 1.2f);
((ColorBlock)(ref colors)).pressedColor = new Color(0.9f, 0.9f, 0.9f);
((ColorBlock)(ref colors)).selectedColor = Color.white;
((ColorBlock)(ref colors)).disabledColor = new Color(0.5f, 0.5f, 0.5f);
((Selectable)((Component)val4).GetComponent<Button>()).colors = colors;
modding_discord_button = val2;
}
}
public static class texTils
{
public static Sprite LoadTexture(string path)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
byte[] array = File.ReadAllBytes(path);
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, array);
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
}
}
public static class Patches
{
[HarmonyPatch(typeof(CharacterSelectHandler_online), "Awake")]
private static void Prefix(CharacterSelectBox __instance)
{
CharacterSelectHandler_online.clientSideMods_you_can_increment_this_to_enable_matchmaking_for_your_mods__please_dont_use_it_to_cheat_thats_really_cringe_especially_if_its_desyncing_others___you_didnt_even_win_on_your_opponents_screen___I_cannot_imagine_a_sadder_existence++;
}
}
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("modding_discord_button.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static Bitmap mds_erwer_discordCircle
{
get
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
object @object = ResourceManager.GetObject("mds_erwer_discordCircle", resourceCulture);
return (Bitmap)@object;
}
}
internal Resources()
{
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "modding_discord_button";
public const string PLUGIN_NAME = "modding_discord_button";
public const string PLUGIN_VERSION = "1.0.0";
}
}