Decompiled source of CustomStatsPlugin v2.4.0

CustomStatsPlugin.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Bounce.Singletons;
using Bounce.Unmanaged;
using Newtonsoft.Json;
using RadialUI;
using TMPro;
using Unity.Mathematics;
using UnityEngine;
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: AssemblyTitle("CustomStatsPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomStatsPlugin")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("TemplatePlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("2.4.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.4.0.0")]
namespace LordAshes;

[BepInPlugin("org.lordashes.plugins.customstats", "Custom Stats Plug-In", "2.4.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CustomStatsPlugin : BaseUnityPlugin
{
	public static class PatchAssistant
	{
		public static object GetProperty(object instance, string propertyName)
		{
			Type type = instance.GetType();
			foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties())
			{
				if (runtimeProperty.Name.Contains(propertyName))
				{
					return runtimeProperty.GetValue(instance);
				}
			}
			PropertyInfo[] properties = type.GetProperties();
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.Name.Contains(propertyName))
				{
					return propertyInfo.GetValue(instance);
				}
			}
			return null;
		}

		public static void SetProperty(object instance, string propertyName, object value)
		{
			Type type = instance.GetType();
			foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties())
			{
				if (runtimeProperty.Name.Contains(propertyName))
				{
					runtimeProperty.SetValue(instance, value);
					return;
				}
			}
			PropertyInfo[] properties = type.GetProperties();
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.Name.Contains(propertyName))
				{
					propertyInfo.SetValue(instance, value);
					break;
				}
			}
		}

		public static object GetField(object instance, string fieldName)
		{
			Type type = instance.GetType();
			foreach (FieldInfo runtimeField in type.GetRuntimeFields())
			{
				if (runtimeField.Name.Contains(fieldName))
				{
					try
					{
						return runtimeField.GetValue(instance);
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("Patch Assistant: Unable To GetValue Of '" + fieldName + "' From '" + instance?.ToString() + "'\r\n" + ex));
						return null;
					}
				}
			}
			FieldInfo[] fields = type.GetFields();
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.Name.Contains(fieldName))
				{
					try
					{
						return fieldInfo.GetValue(instance);
					}
					catch (Exception ex2)
					{
						Debug.LogWarning((object)("Patch Assistant: Unable To GetValue Of '" + fieldName + "' From '" + instance?.ToString() + "'\r\n" + ex2));
						return null;
					}
				}
			}
			return null;
		}

		public static void SetField(object instance, string fieldName, object value)
		{
			Type type = instance.GetType();
			foreach (FieldInfo runtimeField in type.GetRuntimeFields())
			{
				if (runtimeField.Name.Contains(fieldName))
				{
					runtimeField.SetValue(instance, value);
					return;
				}
			}
			FieldInfo[] fields = type.GetFields();
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.Name.Contains(fieldName))
				{
					fieldInfo.SetValue(instance, value);
					break;
				}
			}
		}

		public static object UseMethod(object instance, string methodName, object[] parameters)
		{
			Type type = instance.GetType();
			foreach (MethodInfo runtimeMethod in type.GetRuntimeMethods())
			{
				if (runtimeMethod.Name.Contains(methodName))
				{
					return runtimeMethod.Invoke(instance, parameters);
				}
			}
			MethodInfo[] methods = type.GetMethods();
			foreach (MethodInfo methodInfo in methods)
			{
				if (methodInfo.Name.Contains(methodName))
				{
					return methodInfo.Invoke(instance, parameters);
				}
			}
			return null;
		}
	}

	public static class Utility
	{
		private static GameInput gameInputInstance;

		private static MethodInfo gameInputDisable;

		private static MethodInfo gameInputEnable;

		public static void PostOnMainPage(MemberInfo plugin)
		{
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Expected O, but got Unknown
				try
				{
					if (((Scene)(ref scene)).name == "UI")
					{
						TextMeshProUGUI uITextByName = GetUITextByName("BETA");
						if (Object.op_Implicit((Object)(object)uITextByName))
						{
							((TMP_Text)uITextByName).text = "INJECTED BUILD - unstable mods";
						}
					}
					else
					{
						TextMeshProUGUI uITextByName2 = GetUITextByName("TextMeshPro Text");
						if (Object.op_Implicit((Object)(object)uITextByName2))
						{
							BepInPlugin val = (BepInPlugin)Attribute.GetCustomAttribute(plugin, typeof(BepInPlugin));
							if (((TMP_Text)uITextByName2).text.EndsWith("</size>"))
							{
								((TMP_Text)uITextByName2).text = ((TMP_Text)uITextByName2).text + "\n\nMods Currently Installed:\n";
							}
							TextMeshProUGUI val2 = uITextByName2;
							((TMP_Text)val2).text = ((TMP_Text)val2).text + "\nLord Ashes' " + val.Name + " - " + val.Version;
						}
					}
				}
				catch (Exception ex)
				{
					Debug.Log((object)ex);
				}
			};
		}

		public static bool isBoardLoaded()
		{
			return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
		}

		public static string GetCreatureName(string nameBlock)
		{
			if (nameBlock == null)
			{
				return "(Unknown)";
			}
			if (!nameBlock.Contains("<size=0>"))
			{
				return nameBlock;
			}
			return nameBlock.Substring(0, nameBlock.IndexOf("<size=0>")).Trim();
		}

		private static TextMeshProUGUI GetUITextByName(string name)
		{
			TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>();
			for (int i = 0; i < array.Length; i++)
			{
				if (((Object)array[i]).name == name)
				{
					return array[i];
				}
			}
			return null;
		}

		public static void GameInputEnabled(bool setting)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			if (gameInputInstance == null || gameInputDisable == null || gameInputEnable == null)
			{
				try
				{
					Debug.Log((object)"Plane Image Plugin: Getting Game Input Reference");
					gameInputInstance = null;
					gameInputDisable = null;
					gameInputEnable = null;
					gameInputInstance = (GameInput)(from f in typeof(ControllerManager).GetRuntimeFields()
						where f.Name == "_gameInput"
						select f).ToArray()[0].GetValue(null);
					gameInputDisable = (from m in typeof(GameInput).GetMethods()
						where m.Name == "Disable"
						select m).ElementAt(0);
					gameInputEnable = (from m in typeof(GameInput).GetMethods()
						where m.Name == "Enable"
						select m).ElementAt(0);
				}
				catch
				{
					Debug.LogWarning((object)"Plane Image Plugin: Unable To Get Game Input Reference Or Reference To One Of Its Methods");
				}
			}
			if (setting)
			{
				Debug.Log((object)"Plane Image Plugin: Enabling Game Input");
				gameInputEnable.Invoke(gameInputInstance, new object[0]);
			}
			else
			{
				Debug.Log((object)"Plane Image Plugin: Disabling Game Input");
				gameInputDisable.Invoke(gameInputInstance, new object[0]);
			}
		}
	}

	private static class Internal
	{
		public static bool selectedMiniStatsOpen = false;

		public static Vector2 statMenuCentre = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2));

		public static Dictionary<string, string> selectedMiniStats = new Dictionary<string, string>();

		public static ConfigEntry<KeyboardShortcut> defineModel;

		public static ConfigEntry<float> menuBaseRadius;

		public static ConfigEntry<float> menuItemMultiplier;

		public static ConfigEntry<bool> whisperToGM;

		public static ConfigEntry<bool> diagnostics;
	}

	public const string Name = "Custom Stats Plug-In";

	public const string Guid = "org.lordashes.plugins.customstats";

	public const string Version = "2.4.0.0";

	private void Awake()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Expected O, but got Unknown
		Debug.Log((object)"Custom Stats Plugin: Active.");
		Internal.whisperToGM = ((BaseUnityPlugin)this).Config.Bind<bool>("Hotkeys", "Whisper Changes To GM", true, (ConfigDescription)null);
		Internal.defineModel = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Apply Model", new KeyboardShortcut((KeyCode)97, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null);
		Internal.menuBaseRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Setting", "Stat Menu Base Radius", 25f, (ConfigDescription)null);
		Internal.menuItemMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Setting", "Stat Menu Radius Increase Per Item", 10f, (ConfigDescription)null);
		Internal.diagnostics = ((BaseUnityPlugin)this).Config.Bind<bool>("Setting", "Log Plugin Diagnostocs In Log", false, (ConfigDescription)null);
		if (((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Remove Core Stats Menu", true, (ConfigDescription)null).Value)
		{
			RadialUIPlugin.HideDefaultCharacterMenuItem("org.lordashes.plugins.customstats", "Stats", (ShouldShowMenu)null);
		}
		RadialUIPlugin.AddCustomButtonOnCharacter("org.lordashes.plugins.customstats", new ItemArgs
		{
			Action = StatMenuCallback,
			CloseMenuOnActivate = true,
			FadeName = true,
			Icon = Image.LoadSprite("Stats.png", (CacheType)999),
			Title = "Custom Stats"
		}, (Func<NGuid, NGuid, bool>)((NGuid a, NGuid b) => true));
		Utility.PostOnMainPage(((object)this).GetType());
	}

	private void StatMenuCallback(MapMenuItem arg1, object arg2)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: 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_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Custom Stats Plugin: Radial Stats Menu Callback");
		CreatureBoardAsset val = default(CreatureBoardAsset);
		CreaturePresenter.TryGetAsset(new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), ref val);
		Vector3 val2 = Camera.main.WorldToScreenPoint(val.GetHook((HookTransform)2).position);
		Internal.statMenuCentre = new Vector2(val2.x, 1080f - val2.y);
		Internal.selectedMiniStats.Clear();
		CreatureGuid creatureId = val.CreatureId;
		string text = AssetDataPlugin.ReadInfo(((object)(CreatureGuid)(ref creatureId)).ToString(), "org.lordashes.plugins.customstats.stats");
		if (text != null && text.Trim() != "")
		{
			Debug.Log((object)("Custom Stats Plugin: Custom Stats JSON = " + text));
			Internal.selectedMiniStats = JsonConvert.DeserializeObject<Dictionary<string, string>>(text);
		}
		Internal.selectedMiniStatsOpen = true;
		Utility.GameInputEnabled(setting: false);
		Debug.Log((object)"Custom Stats Plugin: Syncing Core Stats With Custom Stats");
		CampaignSessionManager instance = Object.FindObjectOfType<CampaignSessionManager>();
		string[] array = (string[])PatchAssistant.GetField(instance, "_statNames");
		for (int i = 0; i < array.Length; i++)
		{
			if (Internal.selectedMiniStats.ContainsKey(array[i]))
			{
				Debug.Log((object)("Custom Stats Plugin: Syncing '" + array[i] + "'"));
				CreatureDataV3 val3 = default(CreatureDataV3);
				CreatureManager.TryGetCreatureData(val.CreatureId, ref val3);
				Dictionary<string, string> selectedMiniStats = Internal.selectedMiniStats;
				string key = array[i];
				float value = ((CreatureDataV3)(ref val3)).StatByIndex(i, false).Value;
				string text2 = value.ToString();
				value = ((CreatureDataV3)(ref val3)).StatByIndex(i, false).Max;
				selectedMiniStats[key] = text2 + "/" + value;
			}
		}
	}

	private void Update()
	{
		//IL_0010: 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)
		if (!Utility.isBoardLoaded())
		{
			return;
		}
		KeyboardShortcut value = Internal.defineModel.Value;
		if (!((KeyboardShortcut)(ref value)).IsUp())
		{
			return;
		}
		SystemMessage.AskForTextInput("Apply Custom Stats", "Custom Stats Model:", "Apply", (Action<string>)delegate(string modelName)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			Internal.selectedMiniStats.Clear();
			string[] array = File.Find(modelName + ".model", (CacheType)999);
			if (array.Length != 0)
			{
				if (array.Length > 1)
				{
					Debug.LogWarning((object)("Custom Stats Plugin: Multiple Definitions For '" + modelName + "' (" + modelName + ".model) Exist. Using First."));
				}
				string[] array2 = File.ReadAllText(array[0], (CacheType)999).Split(new char[1] { ',' });
				foreach (string key in array2)
				{
					Internal.selectedMiniStats.Add(key, "---");
				}
				string text = JsonConvert.SerializeObject((object)Internal.selectedMiniStats);
				CreatureGuid selectedCreatureId = LocalClient.SelectedCreatureId;
				AssetDataPlugin.SetInfo(((object)(CreatureGuid)(ref selectedCreatureId)).ToString(), "org.lordashes.plugins.customstats.stats", text, false);
			}
			else
			{
				SystemMessage.DisplayInfoText("Custom Stats Plugin: Unable To Find Definition For Model '" + modelName + "'", 2.5f);
			}
		}, (Action)null, "Cancel", (Action)null, "");
	}

	private void OnGUI()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Expected O, but got Unknown
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: 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_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0357: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
		if (!Internal.selectedMiniStatsOpen)
		{
			return;
		}
		Internal.statMenuCentre = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2));
		if (Internal.diagnostics.Value)
		{
			Debug.Log((object)("Custom Stats Plugin: Screen = " + Screen.width + "x" + Screen.height));
			Debug.Log((object)("Custom Stats Plugin: Custom Stat Centre = " + Internal.statMenuCentre.x + "x" + Internal.statMenuCentre.y));
		}
		GUIStyle val = new GUIStyle();
		val.alignment = (TextAnchor)4;
		val.fontSize = 16;
		val.normal.textColor = Color.red;
		GUI.Box(new Rect(Internal.statMenuCentre.x - 10f, Internal.statMenuCentre.y, 20f, 20f), (Texture)(object)Texture2D.blackTexture);
		if (GUI.Button(new Rect(Internal.statMenuCentre.x - 10f, Internal.statMenuCentre.y, 20f, 20f), "X", val))
		{
			Utility.GameInputEnabled(setting: true);
			if (Internal.whisperToGM.Value)
			{
				WhisperToGM();
			}
			string text = JsonConvert.SerializeObject((object)Internal.selectedMiniStats);
			Debug.Log((object)"Custom Stats Plugin: Updating Custom Stats");
			CreatureGuid val2 = new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature());
			AssetDataPlugin.SetInfo(((object)(CreatureGuid)(ref val2)).ToString(), "org.lordashes.plugins.customstats.stats", text, false);
			Debug.Log((object)"Custom Stats Plugin: Updating Core Stats");
			UpdateCoreStats(new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), Internal.selectedMiniStats);
			Internal.selectedMiniStatsOpen = false;
		}
		float num = 360f / (float)Internal.selectedMiniStats.Count;
		float num2 = Internal.menuBaseRadius.Value + (float)Internal.selectedMiniStats.Count * Internal.menuItemMultiplier.Value;
		for (int i = 0; i < Internal.selectedMiniStats.Count; i++)
		{
			Vector2 val3 = num2 * Rotate(new Vector2(0f, 1f), num * (float)i);
			if (Internal.diagnostics.Value)
			{
				Debug.Log((object)("Custom Stats Plugin: Custom Stat Pos = " + (Internal.statMenuCentre.x + val3.x) + "x" + (Internal.statMenuCentre.y + val3.y)));
			}
			float num3 = ((num * (float)i >= 90f && num * (float)i <= 270f) ? (-20) : 20);
			val.normal.textColor = Color.black;
			GUI.Label(new Rect(Internal.statMenuCentre.x + val3.x - 100f, Internal.statMenuCentre.y + val3.y + num3, 200f, 20f), Internal.selectedMiniStats.ElementAt(i).Key, val);
			val.normal.textColor = Color.white;
			GUI.Label(new Rect(Internal.statMenuCentre.x + val3.x + 2f - 100f, Internal.statMenuCentre.y + val3.y + 2f + num3, 200f, 20f), Internal.selectedMiniStats.ElementAt(i).Key, val);
			Internal.selectedMiniStats[Internal.selectedMiniStats.ElementAt(i).Key] = GUI.TextField(new Rect(Internal.statMenuCentre.x + val3.x - 30f, Internal.statMenuCentre.y + val3.y, 60f, 20f), Internal.selectedMiniStats.ElementAt(i).Value);
		}
	}

	private void WhisperToGM()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Custom Stats Plug-In: Whispering Custom Stats To GM");
		CreatureBoardAsset val = null;
		CreaturePresenter.TryGetAsset(new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), ref val);
		if ((Object)(object)val == (Object)null)
		{
			CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val);
		}
		if (!((Object)(object)val != (Object)null))
		{
			return;
		}
		string text = "[" + Utility.GetCreatureName(val.Name) + "]\r\n";
		foreach (KeyValuePair<string, string> selectedMiniStat in Internal.selectedMiniStats)
		{
			text = text + selectedMiniStat.Key + " = " + selectedMiniStat.Value + "\r\n";
		}
		ChatManager.SendChatMessageToGms(text, NGuid.Empty, (float3?)null, false);
	}

	public void UpdateCoreStats(CreatureGuid cid, Dictionary<string, string> stats)
	{
		//IL_0122: 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)
		string[] array = (string[])PatchAssistant.GetField(Object.FindObjectOfType<CampaignSessionManager>(), "_statNames");
		CreatureStat val = default(CreatureStat);
		foreach (KeyValuePair<string, string> stat in stats)
		{
			bool flag = false;
			for (int i = 0; i < array.Length; i++)
			{
				if (stat.Key == array[i])
				{
					Debug.Log((object)("Custom Stats Plugin: Setting Stat '" + stat.Key + "' At Index " + i + " To " + stat.Value));
					if (stat.Value.Split(new char[1] { '/' }).Length < 2)
					{
						((CreatureStat)(ref val))..ctor(float.Parse(stat.Value), float.Parse(stat.Value));
					}
					else
					{
						((CreatureStat)(ref val))..ctor(float.Parse(stat.Value.Split(new char[1] { '/' })[0]), float.Parse(stat.Value.Split(new char[1] { '/' })[1]));
					}
					CreatureManager.SetCreatureStatByIndex(cid, val, i);
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				Debug.Log((object)("Custom Stats Plugin: Stat '" + stat.Key + "' Not Found In Core Stats"));
			}
		}
	}

	public static Vector2 Rotate(Vector2 v, float deltaDeg)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: 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)
		return new Vector2(v.x * Mathf.Cos((float)Math.PI / 180f * deltaDeg) - v.y * Mathf.Sin((float)Math.PI / 180f * deltaDeg), v.x * Mathf.Sin((float)Math.PI / 180f * deltaDeg) + v.y * Mathf.Cos((float)Math.PI / 180f * deltaDeg));
	}
}