using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using RoundsMod.Patches;
using TMPro;
using UnboundLib;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
[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("RoundsMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My First Rounds Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RoundsMod")]
[assembly: AssemblyTitle("RoundsMod")]
[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 RoundsMod
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.yourname.rounds.statreveal", "Stat Reveal", "1.1.0")]
[BepInProcess("Rounds.exe")]
public class RoundsMod : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__5_0;
public static UnityAction<bool> <>9__6_0;
internal void <Start>b__5_0()
{
}
internal void <GUI>b__6_0(bool value)
{
ShowRealStats = value;
}
}
private const string ModId = "com.yourname.rounds.statreveal";
private const string ModName = "Stat Reveal";
public const string Version = "1.1.0";
public static bool ShowRealStats = true;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
Debug.Log((object)"[Stat Reveal] Loading version 1.1.0...");
Harmony val = new Harmony("com.yourname.rounds.statreveal");
val.PatchAll();
Debug.Log((object)"[Stat Reveal] Harmony patches applied.");
}
private void Start()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
Debug.Log((object)"[Stat Reveal] Start method called.");
object obj = <>c.<>9__5_0;
if (obj == null)
{
UnityAction val = delegate
{
};
<>c.<>9__5_0 = val;
obj = (object)val;
}
Unbound.RegisterMenu("Stat Reveal", (UnityAction)obj, (Action<GameObject>)GUI, (GameObject)null, false);
GameObject val2 = new GameObject("SandboxGUI");
val2.AddComponent<SandboxGUIPatch>();
Object.DontDestroyOnLoad((Object)(object)val2);
Debug.Log((object)"[Stat Reveal] SandboxGUI component spawned.");
}
private void GUI(GameObject menu)
{
TextMeshProUGUI val = default(TextMeshProUGUI);
MenuHandler.CreateText("Stat Reveal Options", menu, ref val, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateToggle(ShowRealStats, "Show Real Stats", menu, (UnityAction<bool>)delegate(bool value)
{
ShowRealStats = value;
}, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
}
}
}
namespace RoundsMod.Patches
{
[HarmonyPatch(typeof(CardInfo), "Awake")]
internal class CardInfoPatch
{
private static void Prefix(CardInfo __instance)
{
if (RoundsMod.ShowRealStats)
{
StatCalculator.ApplyRealStats(__instance);
}
}
}
[HarmonyPatch(typeof(CardVisuals), "Start")]
internal class CardVisualsPatch
{
private static void Prefix(CardVisuals __instance)
{
if (RoundsMod.ShowRealStats)
{
CardInfo component = ((Component)__instance).GetComponent<CardInfo>();
if ((Object)(object)component != (Object)null)
{
StatCalculator.ApplyRealStats(component);
}
}
}
}
internal class StatCalculator
{
public static void ApplyRealStats(CardInfo card)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
if (card.cardStats == null)
{
return;
}
Gun component = ((Component)card).GetComponent<Gun>();
CharacterStatModifiers component2 = ((Component)card).GetComponent<CharacterStatModifiers>();
CardInfoStat[] cardStats = card.cardStats;
foreach (CardInfoStat val in cardStats)
{
val.simepleAmount = (SimpleAmount)0;
if (string.IsNullOrEmpty(val.amount) || !val.amount.Contains("%"))
{
string statValue = GetStatValue(val.stat, component, component2);
if (!string.IsNullOrEmpty(statValue))
{
val.amount = statValue;
}
}
}
}
private static string GetStatValue(string statName, Gun gun, CharacterStatModifiers charStats)
{
float num = 0f;
bool flag = true;
bool flag2 = false;
string text = statName.ToLower();
if ((Object)(object)gun != (Object)null)
{
if (text.Contains("damage"))
{
num = gun.damage;
flag2 = true;
}
else if (text.Contains("reload"))
{
num = gun.reloadTime;
flag2 = true;
}
else if (text.Contains("ammo"))
{
num = gun.ammo;
flag = false;
flag2 = true;
}
else if (text.Contains("attack speed"))
{
num = gun.attackSpeed;
flag2 = true;
}
else if (text.Contains("projectile speed"))
{
num = gun.projectielSimulatonSpeed;
flag2 = true;
}
}
if (!flag2 && (Object)(object)charStats != (Object)null)
{
if (text.Contains("health"))
{
num = charStats.health;
flag2 = true;
}
else if (text.Contains("movement speed"))
{
num = charStats.movementSpeed;
flag2 = true;
}
else if (text.Contains("jump"))
{
num = charStats.jump;
flag2 = true;
}
else if (text.Contains("size"))
{
num = charStats.sizeMultiplier;
flag2 = true;
}
}
if (flag2)
{
if (flag)
{
float num2 = (num - 1f) * 100f;
return ((num2 >= 0f) ? "+" : "") + num2.ToString("0") + "%";
}
return ((num >= 0f) ? "+" : "") + num.ToString("0");
}
return null;
}
}
internal class SandboxGUIPatch : MonoBehaviour
{
private static bool showGui = false;
private static string searchText = "";
private static Vector2 scrollPosition;
private static List<CardInfo> allCards = new List<CardInfo>();
private void Update()
{
if (!Input.GetKeyDown((KeyCode)283))
{
return;
}
showGui = !showGui;
if (showGui)
{
allCards = CardManager.cards.Values.Select((Card c) => c.cardInfo).ToList();
}
}
private void OnGUI()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
if (!showGui)
{
return;
}
GUI.Box(new Rect(10f, 10f, 300f, (float)(Screen.height - 20)), "Sandbox Card Spawner");
GUILayout.BeginArea(new Rect(20f, 40f, 280f, (float)(Screen.height - 60)));
GUILayout.Label("Search:", Array.Empty<GUILayoutOption>());
searchText = GUILayout.TextField(searchText, Array.Empty<GUILayoutOption>());
scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
foreach (CardInfo allCard in allCards)
{
if ((string.IsNullOrEmpty(searchText) || allCard.cardName.ToLower().Contains(searchText.ToLower())) && GUILayout.Button(allCard.cardName, Array.Empty<GUILayoutOption>()))
{
SpawnCard(allCard);
}
}
GUILayout.EndScrollView();
GUILayout.EndArea();
}
private void SpawnCard(CardInfo card)
{
Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.data.view.IsMine));
if ((Object)(object)val != (Object)null)
{
Cards.instance.AddCardToPlayer(val, card, false, "", 0f, 0f);
Debug.Log((object)$"[Sandbox] Spawned {card.cardName} for {val.playerID}");
}
}
}
}