using System;
using System.Collections;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mycopunk.UITweaks.MonoBehaviours;
using Mycopunk.UITweaks.Patches;
using Pigeon.Movement;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Mycopunk.UITweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0")]
[assembly: AssemblyProduct("Mycopunk.UITweaks")]
[assembly: AssemblyTitle("Mycopunk.UITweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[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 Mycopunk.UITweaks
{
public static class Logger
{
private static readonly ManualLogSource myLogs;
static Logger()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
myLogs = new ManualLogSource("Cactus.UITweaks");
Logger.Sources.Add((ILogSource)(object)myLogs);
}
public static void Info(string message)
{
myLogs.LogInfo((object)message);
}
public static void Warn(string message)
{
myLogs.LogWarning((object)message);
}
public static void Error(string message)
{
myLogs.LogError((object)message);
}
public static void Fatal(string message)
{
myLogs.LogFatal((object)message);
}
public static void Debug(string message)
{
myLogs.LogDebug((object)message);
}
}
internal static class MyPluginInfo
{
internal const string PLUGIN_GUID = "Mycopunk.UITweaks";
internal const string PLUGIN_NAME = "Mycopunk.UITweaks";
internal const string PLUGIN_VERSION = "1.3.0";
}
[MycoMod(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Mycopunk.UITweaks", "Mycopunk.UITweaks", "1.3.0")]
public class Plugin : BaseUnityPlugin
{
private ConfigEntry<bool> patchXP;
private ConfigEntry<bool> patchEndscreen;
private ConfigEntry<bool> patchHealth;
private ConfigEntry<bool> patchCooldowns;
private Harmony m_Harmony;
private void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
GetConfig();
m_Harmony = new Harmony("Mycopunk.UITweaks");
if (patchXP.Value)
{
m_Harmony.PatchAll(typeof(XP_Patches));
}
if (patchEndscreen.Value)
{
m_Harmony.PatchAll(typeof(EndScreen_Patches));
}
if (patchHealth.Value)
{
m_Harmony.PatchAll(typeof(HealthBar_Patches));
}
if (patchCooldowns.Value)
{
m_Harmony.PatchAll(typeof(Cooldown_Patches));
}
}
public void GetConfig()
{
patchXP = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PatchXP", true, "Set false to disable numerical XP values");
patchEndscreen = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PatchEndscreen", true, "Set false to disable end game stats");
patchHealth = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PatchHealth", true, "Set false to disable numerical health values");
patchCooldowns = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PatchCooldowns", true, "Set false to disable numerical cooldown values");
}
}
}
namespace Mycopunk.UITweaks.Patches
{
[HarmonyPatch]
internal class Cooldown_Patches
{
public static GameObject coolDownGO;
public static TextMeshProUGUI coolDownText;
public static Vector3 coolDownPosition = new Vector3(99.1806f, 64.116f, 0f);
public static Dictionary<string, TextMeshProUGUI> coolDownDict = new Dictionary<string, TextMeshProUGUI>();
public static Cooldown_CR cooldown_CR;
[HarmonyPatch("SelectCharacter")]
[HarmonyPatch(typeof(CharacterSelectWindow), new Type[] { typeof(Character) })]
[HarmonyPostfix]
internal static void CreateObject__Postfix(CharacterSelectWindow __instance)
{
if (Object.op_Implicit((Object)(object)coolDownGO))
{
foreach (TextMeshProUGUI value in coolDownDict.Values)
{
Object.Destroy((Object)(object)((Component)value).gameObject);
}
}
if (!Object.op_Implicit((Object)(object)cooldown_CR))
{
cooldown_CR = ((Component)Player.LocalPlayer.healthbar).gameObject.AddComponent<Cooldown_CR>();
}
coolDownDict.Clear();
cooldown_CR.MakeCooldowns();
}
[HarmonyPatch(typeof(JoinFriendsWindow), "QuitToMenu")]
[HarmonyPostfix]
internal static void DestroyGM__Postfix(JoinFriendsWindow __instance)
{
if (Object.op_Implicit((Object)(object)coolDownGO))
{
foreach (TextMeshProUGUI value in coolDownDict.Values)
{
Object.Destroy((Object)(object)((Component)value).gameObject);
}
}
coolDownDict.Clear();
Object.Destroy((Object)(object)cooldown_CR);
}
[HarmonyPatch(typeof(MatchmakingWindow), "JoinLobby")]
[HarmonyPostfix]
internal static void DestroyJoin__Postfix(MatchmakingWindow __instance)
{
if (Object.op_Implicit((Object)(object)coolDownGO))
{
foreach (TextMeshProUGUI value in coolDownDict.Values)
{
Object.Destroy((Object)(object)((Component)value).gameObject);
}
}
coolDownDict.Clear();
Object.Destroy((Object)(object)cooldown_CR);
}
[HarmonyPatch(typeof(AbilityRechargeUI), "OnCooldownChanged")]
[HarmonyPostfix]
internal static void GetCD__Postfix(AbilityRechargeUI __instance)
{
foreach (string key in coolDownDict.Keys)
{
if (key == ((Object)__instance.ability.AbilityIcon).name)
{
((TMP_Text)coolDownDict[key]).text = $"{__instance.prevCharge * 100f:F2}%";
break;
}
}
}
}
[HarmonyPatch]
internal class EndScreen_Patches
{
public static string playerName;
[HarmonyPatch(typeof(DropPod), "HasStats")]
[HarmonyPrefix]
internal static bool HasStats__Prefix(DropPod __instance, ref bool __result)
{
__result = true;
return false;
}
[HarmonyPatch(typeof(MissionRewardsWindow), "AfterClosed")]
[HarmonyPostfix]
internal static void SoloStats__Postfix(MissionRewardsWindow __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if ((int)__instance.missionState == 0 && GameManager.players.Count == 1)
{
GameManager.Instance.OpenPopupWindowFromPrefab((Window)(object)Global.Instance.MissionStatsWindow, false, true);
}
}
[HarmonyPatch(typeof(MissionStat), "Setup")]
[HarmonyPrefix]
internal static void StatSetup__Prefix(MissionStat __instance, Player player, ref MissionPlayerData data)
{
playerName = ((Object)player).name;
}
[HarmonyPatch(typeof(MissionPlayerData), "GetStatText")]
[HarmonyPostfix]
internal static void GetEndStats__Postfix(MissionPlayerData __instance, out string title, out string description)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
float damageDealt = __instance.damageDealt;
int enemiesKilled = __instance.enemiesKilled;
float appliedStatusEffect = __instance.appliedStatusEffect;
float damageTaken = __instance.damageTaken;
float num = __instance.deaths;
float friendlyFireDamageDealt = __instance.friendlyFireDamageDealt;
float healingDealt = __instance.healingDealt;
int playersRepaired = __instance.playersRepaired;
float num2 = __instance.targetsKilled;
float timeInAir = __instance.timeInAir;
float num3 = __instance.timesCorroded;
float num4 = __instance.timesIgnited;
float timeSliding = __instance.timeSliding;
int resourcesCollected = __instance.resourcesCollected;
int timesOverloaded = __instance.timesOverloaded;
int upgradesCollected = __instance.upgradesCollected;
title = string.Empty;
description = $"Damage Dealt: {damageDealt}\n" + $"Enemies Killed: {enemiesKilled}\n" + $"Elemental Stacks: {appliedStatusEffect}";
Logger.Info("\n________________________________________________________________Player: " + playerName + "\n" + $"Damage Dealt: {damageDealt}\n" + $"Enemies Killed: {enemiesKilled}\n" + $"Elemental Stacks: {appliedStatusEffect}\n" + $"Damage Taken: {damageTaken}\n" + $"Deaths: {num}\n" + $"Friendly Fire Dealt: {friendlyFireDamageDealt}\n" + $"Healing Dealt: {healingDealt}\n" + $"Players Repaired: {playersRepaired}\n" + $"Targets Killed: {num2}\n" + $"Time In Air: {timeInAir}\n" + $"Times Corroded: {num3}\n" + $"Times Ignited: {num4}\n" + $"Times Overloaded: {timesOverloaded}\n" + $"Time Sliding: {timeSliding}\n" + $"Resources Collected: {resourcesCollected}\n" + $"Upgrades Collected: {upgradesCollected}");
}
}
[HarmonyPatch]
internal class HealthBar_Patches
{
public static Health_MB health_MB;
public static TextMeshProUGUI healthText;
public static GameObject healthTextGO;
public static Player player;
[HarmonyPatch(typeof(Player), "Start")]
[HarmonyPrefix]
internal static void GetPlayer__Prefix(Player __instance)
{
if (((NetworkBehaviour)__instance).IsLocalPlayer)
{
player = __instance;
}
}
[HarmonyPatch("SelectCharacter")]
[HarmonyPatch(typeof(CharacterSelectWindow), new Type[] { typeof(Character) })]
[HarmonyPostfix]
internal static void CreateObject__Postfix(CharacterSelectWindow __instance)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)player).IsLocalPlayer && !Object.op_Implicit((Object)(object)healthTextGO))
{
Logger.Debug("Creating Health Text Object ------------------------------------------------------");
healthTextGO = new GameObject("HealthText");
health_MB = healthTextGO.AddComponent<Health_MB>();
healthTextGO.TryGetComponent<TextMeshProUGUI>(ref healthText);
healthTextGO.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
healthTextGO.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
healthTextGO.layer = 5;
health_MB.health = player.health;
healthTextGO.SetActive(true);
}
}
[HarmonyPatch(typeof(Player), "OnSyncedHealthChanged")]
[HarmonyPostfix]
internal static void OwnerHealthChange__Postfix(Player __instance)
{
if (((NetworkBehaviour)__instance).IsLocalPlayer && (Object)(object)healthText != (Object)null)
{
health_MB.health = __instance.health;
health_MB.healthPercent = health_MB.health / __instance.maxHealth;
health_MB.isDamaged = true;
}
}
}
[HarmonyPatch]
internal class XP_Patches
{
[HarmonyPatch(typeof(GearData), "GetLevelString")]
[HarmonyPostfix]
internal static void NumericalXP__Postfix(GearData __instance, ref string __result)
{
if (__instance.level >= __instance.MaxLevel)
{
__result = "∞";
}
int num = __instance.NextLevelXPCost - __instance.levelXP;
__result = $"{TextBlocks.GetNumberString(__instance.level)} (NEXT LEVEL: {num})";
}
}
}
namespace Mycopunk.UITweaks.MonoBehaviours
{
internal class Cooldown_CR : MonoBehaviour
{
public void MakeCooldowns()
{
((MonoBehaviour)this).StartCoroutine(CooldownCoroutine());
}
public IEnumerator CooldownCoroutine()
{
if (!((NetworkBehaviour)Player.LocalPlayer).IsLocalPlayer)
{
yield break;
}
yield return (object)new WaitForSeconds(2f);
foreach (AbilityRechargeUI rechargeUI in PlayerLook.Instance.rechargeUIs)
{
Logger.Warn("Creating Cooldown Objects --------------------------------------------");
Logger.Warn("Cooldown Setup: " + ((Object)rechargeUI.ability.AbilityIcon).name);
Cooldown_Patches.coolDownGO = new GameObject("CoolDownText");
Cooldown_Patches.coolDownText = Cooldown_Patches.coolDownGO.AddComponent<TextMeshProUGUI>();
((TMP_Text)Cooldown_Patches.coolDownText).fontSize = 16f;
((TMP_Text)Cooldown_Patches.coolDownText).text = "100.00%";
((TMP_Text)Cooldown_Patches.coolDownText).outlineWidth = 0.01f;
((TMP_Text)Cooldown_Patches.coolDownText).outlineColor = Color32.op_Implicit(Color.black);
Cooldown_Patches.coolDownGO.transform.SetParent(((Component)rechargeUI).transform);
Cooldown_Patches.coolDownGO.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
Cooldown_Patches.coolDownGO.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
Cooldown_Patches.coolDownGO.transform.localPosition = Cooldown_Patches.coolDownPosition;
Cooldown_Patches.coolDownGO.transform.localScale = Vector3.one;
Cooldown_Patches.coolDownGO.layer = 5;
Cooldown_Patches.coolDownGO.SetActive(true);
Cooldown_Patches.coolDownDict.Add(((Object)rechargeUI.ability.AbilityIcon).name, Cooldown_Patches.coolDownText);
}
}
}
internal class Health_MB : MonoBehaviour
{
public static TextMeshProUGUI text;
public float health;
public float healthPercent;
public Color healthColor = Color.white;
public static Vector3 position = new Vector3(8.0934f, -41.4283f, 0f);
public static Vector3 position2 = new Vector3(128.0934f, -41.4283f, 0f);
public static Quaternion rotation = Quaternion.Euler(0f, 0f, 0f);
public static Vector3 scale = new Vector3(1f, 1f, 1f);
public bool isDamaged;
public void Awake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("Healthbar");
text = ((Component)this).gameObject.AddComponent<TextMeshProUGUI>();
((TMP_Text)text).fontSize = 24f;
((Graphic)text).color = Color.white;
((TMP_Text)text).rectTransform.sizeDelta = new Vector2(250f, 50f);
((Component)this).gameObject.transform.SetParent(val.transform);
((Component)this).gameObject.transform.rotation = rotation;
if (((NetworkBehaviour)HealthBar_Patches.player).IsLocalPlayer)
{
((Component)this).gameObject.transform.localPosition = position;
}
else
{
((Component)this).gameObject.transform.localPosition = position2;
}
((Component)this).gameObject.transform.localScale = scale;
((Component)text).gameObject.layer = 5;
((TMP_Text)text).text = $"100% ({Math.Round(health, 2):F2})";
((MaskableGraphic)text).maskable = false;
}
public void Update()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
if (isDamaged)
{
((TMP_Text)text).text = $"{healthPercent * 100f:F2}% ({Math.Round(health, 2):F2})";
float num = Player.CalculateWeightedHealth(healthPercent);
((Graphic)text).color = Global.Instance.HealthGradient.Evaluate(num);
isDamaged = false;
}
if (((Component)Player.LocalPlayer.overhealthbar).gameObject.activeSelf)
{
((Graphic)text).color = Player.LocalPlayer.overhealthbar.color;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}