Decompiled source of ValensHats v1.0.0

BepInEx/plugins/cretapark-More_Customizations/MoreCustomizations/MoreCustomizations.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreCustomizations.Data;
using MoreCustomizations.Helpers;
using MoreCustomizations.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreCustomizations")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3+d3db6cb19e0a1c2e0b6fbac74f53736f2a275616")]
[assembly: AssemblyProduct("MoreCustomizations")]
[assembly: AssemblyTitle("MoreCustomizations")]
[assembly: AssemblyVersion("1.1.3.0")]
[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 MoreCustomizations
{
	[BepInPlugin("MoreCustomizations", "MoreCustomizations", "1.1.3")]
	public class MoreCustomizationsPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		internal static Harmony _patcher = new Harmony("MoreCustomizations");

		internal static MoreCustomizationsPlugin Singleton { get; private set; }

		public static IReadOnlyDictionary<Type, IReadOnlyList<CustomizationData>> AllCustomizationsData { get; private set; }

		private void Awake()
		{
			Singleton = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAllCustomizations();
			Logger.LogInfo((object)"Patching methods...");
			_patcher.PatchAll(typeof(PassportManagerPatch));
			_patcher.PatchAll(typeof(CharacterCustomizationPatch));
			_patcher.PatchAll(typeof(PlayerCustomizationDummyPatch));
			_patcher.PatchAll(typeof(PeakHandlePatch));
			Logger.LogInfo((object)"MoreCustomizations is loaded!");
		}

		private void LoadAllCustomizations()
		{
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			AllCustomizationsData = null;
			Dictionary<Type, List<CustomizationData>> dictionary = new Dictionary<Type, List<CustomizationData>>();
			string[] files = Directory.GetFiles(Path.Combine(Paths.BepInExRootPath, "plugins"), "*.pcab", SearchOption.AllDirectories);
			if (files.Length == 0)
			{
				throw new FileNotFoundException("No customization files found in '" + Paths.PluginPath + "'.");
			}
			Logger.LogInfo((object)$"Found {files.Length} possible contents.");
			List<CustomizationData> list = new List<CustomizationData>();
			string[] array = files;
			foreach (string text in array)
			{
				string text2 = text;
				int length = Paths.PluginPath.Length;
				string text3 = text2.Substring(length, text2.Length - length);
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
				try
				{
					AssetBundle val = AssetBundle.LoadFromFile(text);
					Logger.LogInfo((object)("Asset bundle '" + fileNameWithoutExtension + "' loaded! (" + text3 + ")"));
					Logger.LogInfo((object)"Catalog list :");
					string[] allAssetNames = val.GetAllAssetNames();
					foreach (string text4 in allAssetNames)
					{
						Logger.LogInfo((object)("- " + text4));
					}
					CustomizationData[] array2 = val.LoadAllAssets<CustomizationData>();
					CustomizationData[] array3 = array2;
					foreach (CustomizationData customizationData in array3)
					{
						((Object)customizationData).name = $"{text3.GetHashCode()}_{((Object)customizationData).name}";
					}
					list.AddRange(array2);
				}
				catch (Exception ex)
				{
					Logger.LogError((object)("Error occurred while loading custom asset bundle. (" + text3 + ")"));
					Logger.LogError((object)ex.Message);
					Logger.LogError((object)ex.StackTrace);
				}
			}
			Logger.LogInfo((object)$"Loading {list.Count} customizations...");
			foreach (CustomizationData item in list)
			{
				Type type = item.Type;
				if (!dictionary.TryGetValue(type, out var value2))
				{
					value2 = (dictionary[type] = new List<CustomizationData>());
				}
				value2.Add(item);
				Logger.LogInfo((object)("Loaded '" + ((Object)item).name + "'!"));
			}
			Logger.LogInfo((object)"Done!");
			AllCustomizationsData = ((IEnumerable<KeyValuePair<Type, List<CustomizationData>>>)dictionary).ToDictionary((Func<KeyValuePair<Type, List<CustomizationData>>, Type>)((KeyValuePair<Type, List<CustomizationData>> key) => key.Key), (Func<KeyValuePair<Type, List<CustomizationData>>, IReadOnlyList<CustomizationData>>)((KeyValuePair<Type, List<CustomizationData>> value) => value.Value));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MoreCustomizations";

		public const string PLUGIN_NAME = "MoreCustomizations";

		public const string PLUGIN_VERSION = "1.1.3";
	}
}
namespace MoreCustomizations.Data
{
	public abstract class CustomizationData : ScriptableObject
	{
		public abstract Texture IconTexture { get; }

		public abstract Type Type { get; }

		public abstract bool IsValid();
	}
	public abstract class CustomAccessoryData : CustomizationData
	{
		public sealed override Type Type => (Type)10;
	}
	public abstract class CustomEyesData : CustomizationData
	{
		public sealed override Type Type => (Type)20;
	}
	public abstract class CustomMouthData : CustomizationData
	{
		public sealed override Type Type => (Type)30;
	}
	public abstract class CustomHatData : CustomizationData
	{
		public sealed override Type Type => (Type)50;
	}
	[CreateAssetMenu(menuName = "PEAK More Customizations/Accessory", fileName = "New Custom Accessory", order = int.MinValue)]
	public class CustomAccessory_V1 : CustomAccessoryData
	{
		[field: SerializeField]
		public Texture Texture { get; internal set; }

		public override Texture IconTexture => Texture;

		public override bool IsValid()
		{
			return Object.op_Implicit((Object)(object)Texture);
		}
	}
	[CreateAssetMenu(menuName = "PEAK More Customizations/Eye", fileName = "New Custom Eye", order = int.MinValue)]
	public class CustomEyes_V1 : CustomEyesData
	{
		[field: SerializeField]
		public Texture Texture { get; internal set; }

		public override Texture IconTexture => Texture;

		public override bool IsValid()
		{
			return Object.op_Implicit((Object)(object)Texture);
		}
	}
	[CreateAssetMenu(menuName = "PEAK More Customizations/Hat", fileName = "New Custom Hat", order = int.MinValue)]
	public class CustomHat_V1 : CustomHatData
	{
		[field: SerializeField]
		public Texture Icon { get; internal set; }

		[field: SerializeField]
		public GameObject Prefab { get; internal set; }

		[field: SerializeField]
		public Texture MainTexture { get; internal set; }

		[field: SerializeField]
		public Texture SubTexture { get; internal set; }

		[field: SerializeField]
		public Vector3 PositionOffset { get; internal set; }

		[field: SerializeField]
		public Vector3 EulerAngleOffset { get; internal set; }

		public Vector3 SwizzledPositionOffset => new Vector3(PositionOffset.x, 0f - PositionOffset.z, PositionOffset.y);

		public Vector3 SwizzledRotationOffset => new Vector3(EulerAngleOffset.x, 0f - EulerAngleOffset.z, 0f - EulerAngleOffset.y);

		public override Texture IconTexture => Icon;

		public override bool IsValid()
		{
			if (Object.op_Implicit((Object)(object)Icon))
			{
				return Object.op_Implicit((Object)(object)Prefab);
			}
			return false;
		}
	}
	[CreateAssetMenu(menuName = "PEAK More Customizations/Mouth", fileName = "New Custom Mouth", order = int.MinValue)]
	public class CustomMouth_V1 : CustomMouthData
	{
		[field: SerializeField]
		public Texture Texture { get; internal set; }

		public override Texture IconTexture => Texture;

		public override bool IsValid()
		{
			return Object.op_Implicit((Object)(object)Texture);
		}
	}
}
namespace MoreCustomizations.Patches
{
	public class CharacterCustomizationPatch
	{
		public const string HAT_PATH = "Scout/Armature/Hip/Mid/AimJoint/Torso/Head/Hat";

		private static Shader _characterShader;

		private static MaterialPropertyBlock _materialPropertyBlock = new MaterialPropertyBlock();

		private static readonly Vector3 INITIAL_HAT_OFFSET = new Vector3(0f, 0.2f, 6f);

		[HarmonyPatch(typeof(CharacterCustomization), "Awake")]
		[HarmonyPostfix]
		private static void Awake(CharacterCustomization __instance)
		{
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			IReadOnlyDictionary<Type, IReadOnlyList<CustomizationData>> allCustomizationsData = MoreCustomizationsPlugin.AllCustomizationsData;
			if (allCustomizationsData == null)
			{
				MoreCustomizationsPlugin.Logger.LogError((object)"Customizations data are not loaded!");
				return;
			}
			if (allCustomizationsData.Count == 0)
			{
				MoreCustomizationsPlugin.Logger.LogWarning((object)"There's no customizations data.");
				return;
			}
			if (!Object.op_Implicit((Object)(object)_characterShader))
			{
				_characterShader = Shader.Find("W/Character");
			}
			if (!allCustomizationsData.TryGetValue((Type)50, out var value))
			{
				return;
			}
			Transform val = ((Component)__instance).transform.Find("Scout/Armature/Hip/Mid/AimJoint/Torso/Head/Hat");
			if (!Object.op_Implicit((Object)(object)val))
			{
				MoreCustomizationsPlugin.Logger.LogError((object)"Something went wrong in CharacterCustomizationPatch...");
				return;
			}
			List<Renderer> list = new List<Renderer>(__instance.refs.playerHats);
			foreach (CustomHat_V1 item in value.OfType<CustomHat_V1>())
			{
				if (!Object.op_Implicit((Object)(object)item) || !item.IsValid())
				{
					continue;
				}
				GameObject val2 = Object.Instantiate<GameObject>(item.Prefab, val, false);
				Renderer componentInChildren = val2.GetComponentInChildren<Renderer>();
				if (!Object.op_Implicit((Object)(object)componentInChildren))
				{
					MoreCustomizationsPlugin.Logger.LogError((object)("Cannot find Renderer component of customization data '" + ((Object)item).name + "'."));
					Object.Destroy((Object)(object)val2);
					continue;
				}
				val2.transform.localPosition = INITIAL_HAT_OFFSET + item.SwizzledPositionOffset;
				val2.transform.localRotation = Quaternion.Euler(item.SwizzledRotationOffset) * Quaternion.AngleAxis(90f, Vector3.right);
				((Component)componentInChildren).gameObject.SetActive(false);
				((Object)componentInChildren).name = ((Object)item).name;
				Material val3 = new Material(_characterShader);
				Material val4 = new Material(_characterShader);
				if (Object.op_Implicit((Object)(object)item.MainTexture))
				{
					val3.SetTexture("_MainTex", item.MainTexture);
				}
				if (Object.op_Implicit((Object)(object)item.SubTexture))
				{
					val4.SetTexture("_MainTex", item.SubTexture);
				}
				componentInChildren.materials = (Material[])(object)new Material[2] { val3, val4 };
				list.Add(componentInChildren);
			}
			__instance.refs.playerHats = list.ToArray();
		}
	}
	public class PassportManagerPatch
	{
		[HarmonyPatch(typeof(PassportManager), "Awake")]
		[HarmonyPostfix]
		private static void Awake(PassportManager __instance)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Invalid comparison between Unknown and I4
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Invalid comparison between Unknown and I4
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Invalid comparison between Unknown and I4
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Invalid comparison between Unknown and I4
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Invalid comparison between Unknown and I4
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			IReadOnlyDictionary<Type, IReadOnlyList<CustomizationData>> allCustomizationsData = MoreCustomizationsPlugin.AllCustomizationsData;
			if (allCustomizationsData == null)
			{
				MoreCustomizationsPlugin.Logger.LogError((object)"Customizations data are not loaded!");
				return;
			}
			if (allCustomizationsData.Count == 0)
			{
				MoreCustomizationsPlugin.Logger.LogWarning((object)"There's no customizations data.");
				return;
			}
			Customization component = ((Component)__instance).GetComponent<Customization>();
			List<CustomizationOption> list = new List<CustomizationOption>(component.skins);
			List<CustomizationOption> list2 = new List<CustomizationOption>(component.accessories);
			List<CustomizationOption> list3 = new List<CustomizationOption>(component.eyes);
			List<CustomizationOption> list4 = new List<CustomizationOption>(component.mouths);
			List<CustomizationOption> list5 = new List<CustomizationOption>(component.fits);
			List<CustomizationOption> list6 = new List<CustomizationOption>(component.hats);
			foreach (var (val2, readOnlyList2) in allCustomizationsData)
			{
				List<CustomizationOption> list7;
				if ((int)val2 <= 20)
				{
					if ((int)val2 != 0)
					{
						if ((int)val2 != 10)
						{
							if ((int)val2 != 20)
							{
								goto IL_00fb;
							}
							list7 = list3;
						}
						else
						{
							list7 = list2;
						}
					}
					else
					{
						list7 = list;
					}
				}
				else if ((int)val2 != 30)
				{
					if ((int)val2 != 40)
					{
						if ((int)val2 != 50)
						{
							goto IL_00fb;
						}
						list7 = list6;
					}
					else
					{
						list7 = list5;
					}
				}
				else
				{
					list7 = list4;
				}
				goto IL_00fe;
				IL_00fb:
				list7 = null;
				goto IL_00fe;
				IL_00fe:
				List<CustomizationOption> list8 = list7;
				if (list8 == null)
				{
					continue;
				}
				foreach (CustomizationData item in readOnlyList2)
				{
					if (Object.op_Implicit((Object)(object)item) && item.IsValid())
					{
						CustomizationOption val3 = ScriptableObject.CreateInstance<CustomizationOption>();
						val3.requiredAchievement = (ACHIEVEMENTTYPE)0;
						((Object)val3).name = ((Object)item).name;
						val3.type = item.Type;
						val3.texture = item.IconTexture;
						list8.Add(val3);
					}
				}
			}
			component.skins = list.ToArray();
			component.accessories = list2.ToArray();
			component.eyes = list3.ToArray();
			component.mouths = list4.ToArray();
			component.fits = list5.ToArray();
			component.hats = list6.ToArray();
		}

		[HarmonyPatch(typeof(PassportManager), "CameraIn")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> CameraInTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				if (instruction.opcode == OpCodes.Ldc_R4 && instruction.operand != null && instruction.operand.Equals(1f))
				{
					instruction.operand = 3f;
					yield return instruction;
				}
				else
				{
					yield return instruction;
				}
			}
		}

		[HarmonyPatch(typeof(PassportManager), "CameraOut")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> CameraOutTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				if (instruction.opcode == OpCodes.Ldc_R4 && instruction.operand != null && instruction.operand.Equals(1f))
				{
					instruction.operand = 3f;
					yield return instruction;
				}
				else
				{
					yield return instruction;
				}
			}
		}
	}
	public class PeakHandlePatch
	{
		[HarmonyPatch(typeof(PeakHandler), "SetCosmetics")]
		[HarmonyPrefix]
		private static void SetCosmetics(PeakHandler __instance, List<Character> characters)
		{
			if (!CustomizationRefsHelper.SyncCustomHats(__instance.firstCutsceneScout))
			{
				MoreCustomizationsPlugin.Logger.LogError((object)"Something went wrong in PeakHandlePatch [firstCutsceneScout]...");
			}
			for (int i = 0; i < __instance.cutsceneScoutRefs.Count(); i++)
			{
				if (!CustomizationRefsHelper.SyncCustomHats(__instance.cutsceneScoutRefs[i]))
				{
					MoreCustomizationsPlugin.Logger.LogError((object)string.Format("Something went wrong in {0} [cutsceneScoutRefs-{1}]...", "PeakHandlePatch", i));
				}
			}
		}
	}
	public class PlayerCustomizationDummyPatch
	{
		[HarmonyPatch(typeof(PlayerCustomizationDummy), "SetPlayerHat")]
		[HarmonyPrefix]
		private static void SetPlayerHat(PlayerCustomizationDummy __instance, int index)
		{
			if (!CustomizationRefsHelper.SyncCustomHats(__instance.refs))
			{
				MoreCustomizationsPlugin.Logger.LogError((object)"Something went wrong in SetPlayerHat patch...");
			}
		}
	}
}
namespace MoreCustomizations.Helpers
{
	public class CustomizationRefsHelper
	{
		public const string REF_TO_HATS_PATH = "Armature/Hip/Mid/AimJoint/Torso/Head/Hat";

		public static bool SyncCustomHats(CustomizationRefs dstRefs, CustomizationRefs srcRefs = null)
		{
			if ((Object)(object)srcRefs == (Object)null)
			{
				Character localCharacter = Character.localCharacter;
				CharacterCustomization val = default(CharacterCustomization);
				if (!Object.op_Implicit((Object)(object)localCharacter) || !((Component)localCharacter).TryGetComponent<CharacterCustomization>(ref val))
				{
					MoreCustomizationsPlugin.Logger.LogError((object)"Cannot get [LocalCharacter] or its' [CustomizationRefs] ...");
					return false;
				}
				srcRefs = val.refs;
			}
			Renderer[] playerHats = srcRefs.playerHats;
			Renderer[] playerHats2 = dstRefs.playerHats;
			if (playerHats.Length == playerHats2.Length)
			{
				return true;
			}
			Renderer val2 = playerHats2.FirstOrDefault();
			if (!Object.op_Implicit((Object)(object)val2))
			{
				MoreCustomizationsPlugin.Logger.LogError((object)"Cannot find renders in dstPlayerHats...");
				return false;
			}
			int layer = ((Component)val2).gameObject.layer;
			Transform val3 = ((Component)srcRefs).transform.Find("Armature/Hip/Mid/AimJoint/Torso/Head/Hat");
			Transform val4 = ((Component)dstRefs).transform.Find("Armature/Hip/Mid/AimJoint/Torso/Head/Hat");
			List<Renderer> list = new List<Renderer>(playerHats2);
			for (int i = playerHats2.Length; i < playerHats.Length; i++)
			{
				Transform val5 = ((Component)playerHats[i]).transform;
				while ((Object)(object)val5.parent != (Object)(object)val3)
				{
					val5 = val5.parent;
				}
				GameObject obj = Object.Instantiate<GameObject>(((Component)val5).gameObject, val4, false);
				((Object)obj).name = ((Object)val5).name;
				Renderer componentInChildren = obj.GetComponentInChildren<Renderer>(true);
				((Component)componentInChildren).gameObject.layer = layer;
				list.Add(componentInChildren);
			}
			dstRefs.playerHats = list.ToArray();
			return true;
		}
	}
}

BepInEx/plugins/Radsi2-PassporPagination/PassportPagination.dll

Decompiled a day ago
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using Zorro.Core;

[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("PassportPagination")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("PassportPagination")]
[assembly: AssemblyTitle("PassportPagination")]
[assembly: AssemblyVersion("0.1.0.0")]
namespace PassportPagination;

[BepInPlugin("radsi.pagination", "PassportPagination", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private class Patcher
	{
		private static void ConfigureModButton(GameObject button, string name, Action onClick)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			((Object)button).name = name;
			Button component = button.GetComponent<Button>();
			((UnityEventBase)component.onClick).RemoveAllListeners();
			((UnityEvent)component.onClick).AddListener((UnityAction)delegate
			{
				onClick();
			});
		}

		[HarmonyPatch(typeof(PassportManager), "Awake")]
		[HarmonyPostfix]
		private static void PassportManagerAwakePostfix(PassportManager __instance)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			passportManager = __instance;
			GameObject val = GameObject.Find("GAME/PassportManager/PassportUI/Canvas/Panel/Panel/BG/Options/Grid/UI_PassportGridButton");
			Transform parent = val.transform.parent.parent.parent;
			buttonRight = Object.Instantiate<GameObject>(val);
			buttonLeft = Object.Instantiate<GameObject>(buttonRight);
			buttonRight.transform.SetParent(parent, false);
			buttonLeft.transform.SetParent(parent, false);
			buttonRight.transform.localScale = new Vector3(1f, 0.4f, 1f);
			buttonLeft.transform.localScale = new Vector3(-1f, 0.4f, 1f);
			((Component)buttonRight.transform.GetChild(1).GetChild(0)).GetComponent<RawImage>().texture = (Texture)(object)arrowImage;
			((Component)buttonLeft.transform.GetChild(1).GetChild(0)).GetComponent<RawImage>().texture = (Texture)(object)arrowImage;
			buttonRight.transform.localPosition = new Vector3(276.6f, -196.6f, 0f);
			buttonLeft.transform.localPosition = new Vector3(-56.6f, -196.6f, 0f);
			Object.Destroy((Object)(object)buttonRight.GetComponent<PassportButton>());
			Object.Destroy((Object)(object)buttonLeft.GetComponent<PassportButton>());
			buttonRight.SetActive(false);
			buttonLeft.SetActive(false);
			ConfigureModButton(buttonRight, "right_mod", delegate
			{
				currentPage = Mathf.Min(currentPage + 1, GetMaxPage());
				UpdatePage();
			});
			ConfigureModButton(buttonLeft, "left_mod", delegate
			{
				currentPage = Mathf.Max(currentPage - 1, 0);
				UpdatePage();
			});
		}

		[HarmonyPatch(typeof(PassportManager), "OpenTab")]
		[HarmonyPostfix]
		private static void PassportManagerOpenTabPostfix()
		{
			currentPage = 0;
			UpdatePage();
		}

		private static void UpdatePage()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			CustomizationOption[] list = Singleton<Customization>.Instance.GetList(passportManager.activeType);
			int num = currentPage * 28;
			for (int i = 0; i < passportManager.buttons.Length; i++)
			{
				int num2 = num + i;
				if (num2 < list.Length)
				{
					passportManager.buttons[i].SetButton(list[num2], num2);
				}
				else
				{
					passportManager.buttons[i].SetButton((CustomizationOption)null, -1);
				}
			}
			typeof(PassportManager).GetMethod("SetActiveButton", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(passportManager, null);
			int maxPage = GetMaxPage();
			buttonLeft.SetActive(currentPage > 0);
			buttonRight.SetActive(currentPage < maxPage);
		}

		private static int GetMaxPage()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			int num = Singleton<Customization>.Instance.GetList(passportManager.activeType).Length;
			return Mathf.Max((num - 1) / 28, 0);
		}
	}

	private static PassportManager passportManager;

	private static Texture2D arrowImage;

	private static int currentPage;

	private static GameObject buttonRight;

	private static GameObject buttonLeft;

	private void Awake()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		arrowImage = new Texture2D(2, 2);
		ImageConversion.LoadImage(arrowImage, Resource1.arrow);
		new Harmony("radsi.pagination").PatchAll(typeof(Patcher));
	}
}
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resource1
{
	private static ResourceManager resourceMan;

	private static CultureInfo resourceCulture;

	[EditorBrowsable(EditorBrowsableState.Advanced)]
	internal static ResourceManager ResourceManager
	{
		get
		{
			if (resourceMan == null)
			{
				ResourceManager resourceManager = new ResourceManager("PassportPagination.Resource1", typeof(Resource1).Assembly);
				resourceMan = resourceManager;
			}
			return resourceMan;
		}
	}

	[EditorBrowsable(EditorBrowsableState.Advanced)]
	internal static CultureInfo Culture
	{
		get
		{
			return resourceCulture;
		}
		set
		{
			resourceCulture = value;
		}
	}

	internal static byte[] arrow
	{
		get
		{
			object @object = ResourceManager.GetObject("arrow", resourceCulture);
			return (byte[])@object;
		}
	}

	internal Resource1()
	{
	}
}