Decompiled source of Erenshor ZoneInfo v1.0.3

Expulsion.Erenshor.ZoneInfo.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine.SceneManagement;

[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("Expulsion.Erenshor.ZoneInfo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+57e0e58f18c682d61e56443b785ba810b2eb2050")]
[assembly: AssemblyProduct("Expulsion.Erenshor.ZoneInfo")]
[assembly: AssemblyTitle("Expulsion.Erenshor.ZoneInfo")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace Expulsion.Erenshor.ZoneInfo
{
	[BepInPlugin("Expulsion.Erenshor.ZoneInfo", "ZoneInfo", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "Expulsion.Erenshor.ZoneInfo";

		public const string PluginName = "ZoneInfo";

		public const string PluginVersion = "1.0.3";

		private Harmony? _harmonyInstance;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmonyInstance = new Harmony("Expulsion.Erenshor.ZoneInfo");
			_harmonyInstance.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ZoneInfo is loaded!");
		}

		private void OnDestroy()
		{
			Harmony? harmonyInstance = _harmonyInstance;
			if (harmonyInstance != null)
			{
				harmonyInstance.UnpatchSelf();
			}
		}
	}
}
namespace Expulsion.Erenshor.ZoneInfo.Patches
{
	[HarmonyPatch(typeof(GameManager), "ShowZoneName")]
	public class GameManager_ShowZoneName
	{
		public static void Postfix(GameManager __instance, string _name)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			TextMeshProUGUI zoneName = __instance.ZoneName;
			TextMeshProUGUI val = zoneName;
			string text = ((TMP_Text)zoneName).text;
			if (1 == 0)
			{
			}
			string text2 = name switch
			{
				"Azure" => "\n" + StyleString("Level 1 - 35"), 
				"Stowaway" => "\n" + StyleString("Level 1 - 6"), 
				"Hidden" => "\n" + StyleString("Level 4 - 8"), 
				"Brake" => "\n" + StyleString("Level 3 - 10"), 
				"Vitheo" => "\n" + StyleString("Level 4 - 10"), 
				"FernallaField" => "\n" + StyleString("Level 6 - 18"), 
				"Duskenlight" => "\n" + StyleString("Level 7 - 19"), 
				"Rottenfoot" => "\n" + StyleString("Level 12 - 20"), 
				"SaltedStrand" => "\n" + StyleString("Level 14 - 21"), 
				"Braxonian" => "\n" + StyleString("Level 16 - 25"), 
				"Loomingwood" => "\n" + StyleString("Level 18 - 26"), 
				"Silkengrass" => "\n" + StyleString("Level 10 - 30"), 
				"Windwashed" => "\n" + StyleString("Level 15 - 30"), 
				"Malaroth" => "\n" + StyleString("Level 20 - 30"), 
				"Soluna" => "\n" + StyleString("Level 25 - 33"), 
				"Blight" => "\n" + StyleString("Level 26 - 33"), 
				"Ripper" => "\n" + StyleString("Level 28 - 33"), 
				"Azynthi" => "\n" + StyleString("Level 30 - 35"), 
				"AzynthiClear" => "\n" + StyleString("Level 30 - 35"), 
				"Tutorial" => "\n" + StyleString("Level 3 - 7"), 
				"Bonepits" => "\n" + StyleString("Level 4 - 9"), 
				"Krakengard" => "\n" + StyleString("Level 8 - 13"), 
				"Underspine" => "\n" + StyleString("Level 10 - 16"), 
				"Undercity" => "\n" + StyleString("Level 13 - 20"), 
				"DuskenPortal" => "\n" + StyleString("Level 14 - 15"), 
				"FernallaPortal" => "\n" + StyleString("Level 21 - 24"), 
				"RipperPortal" => "\n" + StyleString("Level 28 - 35"), 
				"Elderstone" => "\n" + StyleString("Level 16 - 21"), 
				"Rockshade" => "\n" + StyleString("Level 22 - 26"), 
				"Abyssal" => "\n" + StyleString("Level 24 - 33"), 
				"Braxonia" => "\n" + StyleString("Level 28 - 33"), 
				"PrielPlateau" => "\n" + StyleString("Level 28 - 35"), 
				"VitheosEnd" => "\n" + StyleString("Level 22 - 35"), 
				"Jaws" => "\n" + StyleString("Level 30 - 35"), 
				"ShiveringStep" => "\n" + StyleString("Level 6 - 12"), 
				"ShiveringTomb" => "\n" + StyleString("Level 6 - 12"), 
				_ => "\n<size=25%>Unknown Zone of Name: [" + name + " | " + _name + "], Please Report</size>", 
			};
			if (1 == 0)
			{
			}
			((TMP_Text)val).text = text + text2;
		}

		private static string StyleString(string text)
		{
			int level = GameData.PlayerStats.Level;
			string[] array = text.Replace("Level ", "").Split('-');
			if (array.Length != 2 || !int.TryParse(array[0].Trim(), out var result) || !int.TryParse(array[1].Trim(), out var result2))
			{
				return "<size=50%>" + text + "</size>";
			}
			int num = level;
			if (1 == 0)
			{
			}
			string text2 = ((level >= result - 5) ? ((level >= result) ? ((level > result2) ? ((level > result2 + 5) ? "#808080" : "#4caf50") : "#ffeb3b") : "#ff9800") : "#f44336");
			if (1 == 0)
			{
			}
			string text3 = text2;
			return "<size=50%><color=" + text3 + ">" + text + "</color></size>";
		}
	}
}