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 BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Luggage_For_All; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.TextCore; 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("legocool.LuggageForAll")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.1.0")] [assembly: AssemblyInformationalVersion("1.2.1+b5def1fa90e84bc194969348698b3212cfa22c1d")] [assembly: AssemblyProduct("legocool.LuggageForAll")] [assembly: AssemblyTitle("Luggage_For_All")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.1.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; } } } public class LuggageTimer : MonoBehaviourPun { public double lastOpenedTime; public float duration; public int reopenCount; public int maxReopens = Plugin.MaxReopens.Value; private TextMeshPro text; private static TMP_FontAsset? _gameFontAsset; private static bool _fontSearchAttempted; public static TMP_FontAsset? GameFont { get { if ((Object)(object)_gameFontAsset == (Object)null && !_fontSearchAttempted) { _gameFontAsset = FindGameFont(); _fontSearchAttempted = true; } return _gameFontAsset; } } private void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) text = new GameObject("TimerText").AddComponent(); text.transform.SetParent(((Component)this).transform); ((TMP_Text)text).alignment = (TextAlignmentOptions)514; ((TMP_Text)text).fontSize = Plugin.TimerFontSize.Value; ((Graphic)text).color = Color.green; TMP_FontAsset gameFont = GameFont; if ((Object)(object)gameFont != (Object)null) { ((TMP_Text)text).font = gameFont; } else { Plugin.Log.LogWarning((object)"Using fallback TMP font (Darumadrop One not found)."); } ((TMP_Text)text).fontMaterial.EnableKeyword("OUTLINE_ON"); ((TMP_Text)text).outlineWidth = 0.05f; ((TMP_Text)text).outlineColor = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue); } [PunRPC] public void RPC_SetOpenedTime(double time, float SetTime) { string[] luggageTypes = Plugin.GetLuggageTypes(); string[] array = luggageTypes; foreach (string value in array) { if (((Object)this).name.Contains(value)) { ((Component)text).gameObject.SetActive(Plugin.ShowTimer.Value); lastOpenedTime = time; duration = SetTime; break; } } } private void Update() { //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) //IL_015c: 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) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (lastOpenedTime <= 0.0) { return; } float num = duration - (float)(PhotonNetwork.Time - lastOpenedTime); if (num <= 0f) { num = 0f; ((Component)this.text).gameObject.SetActive(false); if (PhotonNetwork.IsMasterClient) { Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; string name = ((Object)this).name; string[] luggageTypes = Plugin.GetLuggageTypes(); string[] array = luggageTypes; foreach (string text in array) { if (name.Contains(text, StringComparison.OrdinalIgnoreCase) && (maxReopens < 0 || reopenCount < maxReopens)) { name = text; GameObject val = PhotonNetwork.Instantiate("0_Items/" + name, position, rotation, (byte)0, (object[])null); val.GetComponent().reopenCount = reopenCount + 1; PhotonNetwork.Destroy(((Component)this).gameObject); break; } } lastOpenedTime = 0.0; } } int num2 = Mathf.CeilToInt(num); int num3 = num2 / 60; int num4 = num2 % 60; ((TMP_Text)this.text).text = $"{num3}:{num4:00}"; this.text.transform.position = ((Component)this).transform.position + Vector3.up * 2f; if ((Object)(object)Camera.main != (Object)null) { this.text.transform.forward = ((Component)Camera.main).transform.forward; } } private static TMP_FontAsset? FindGameFont() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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) try { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"Found {array.Length} TMP fonts in resources"); } TMP_FontAsset val = ((IEnumerable)array).FirstOrDefault((Func)delegate(TMP_FontAsset fontAsset) { //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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) FaceInfo faceInfo2 = ((TMP_Asset)fontAsset).faceInfo; if (!(((FaceInfo)(ref faceInfo2)).familyName == "Darumadrop One")) { faceInfo2 = ((TMP_Asset)fontAsset).faceInfo; return ((FaceInfo)(ref faceInfo2)).familyName == "Daruma Drop One"; } return true; }); FaceInfo faceInfo; if ((Object)(object)val != (Object)null) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { string[] obj = new string[5] { "Found game font: ", ((Object)val).name, " (Family: ", null, null }; faceInfo = ((TMP_Asset)val).faceInfo; obj[3] = ((FaceInfo)(ref faceInfo)).familyName; obj[4] = ")"; log2.LogInfo((object)string.Concat(obj)); } return val; } ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogWarning((object)"Available TMP fonts:"); } TMP_FontAsset[] array2 = array; foreach (TMP_FontAsset val2 in array2) { ManualLogSource log4 = Plugin.Log; if (log4 != null) { string[] obj2 = new string[5] { " - ", ((Object)val2).name, " (Family: ", null, null }; faceInfo = ((TMP_Asset)val2).faceInfo; obj2[3] = ((FaceInfo)(ref faceInfo)).familyName; obj2[4] = ")"; log4.LogWarning((object)string.Concat(obj2)); } } return null; } catch (Exception ex) { ManualLogSource log5 = Plugin.Log; if (log5 != null) { log5.LogWarning((object)("Error finding game font: " + ex.Message)); } return null; } } [PunRPC] private void RefillLuggage() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) Luggage component = ((Component)this).GetComponent(); component.state = (LuggageState)0; component.anim.Play("Closed", 0, 0f); if (!Luggage.ALL_LUGGAGE.Contains(component)) { Luggage.ALL_LUGGAGE.Add(component); } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Luggage_For_All { [HarmonyPatch(typeof(Luggage))] public static class LuggagePatches { private static ManualLogSource Log => Plugin.Log; [HarmonyPostfix] [HarmonyPatch("Awake")] public static void AddLuggageTimer(Luggage __instance) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPostfix] [HarmonyPatch("OpenLuggageRPC")] public static void SetLuggageTimer(Luggage __instance) { LuggageTimer component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { component = ((Component)__instance).gameObject.AddComponent(); } if (PhotonNetwork.IsMasterClient) { __instance.photonView.RPC("RPC_SetOpenedTime", (RpcTarget)0, new object[2] { PhotonNetwork.Time, Plugin.RefillDuration.Value }); } } } [BepInPlugin("legocool.LuggageForAll", "Luggage_For_All", "1.2.1")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; internal static ConfigEntry RefillDuration; internal static ConfigEntry TimerFontSize; internal static ConfigEntry ShowTimer; internal static ConfigEntry MaxReopens; internal static ConfigEntry LuggageSmall; internal static ConfigEntry LuggageBig; internal static ConfigEntry LuggageEpic; internal static ConfigEntry LuggageAncient; public const string Id = "legocool.LuggageForAll"; internal static ManualLogSource Log { get; private set; } public static string Name => "Luggage_For_All"; public static string Version => "1.2.1"; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("legocool.Luggage_For_All"); _harmony.PatchAll(); RefillDuration = ((BaseUnityPlugin)this).Config.Bind("General", "Refill Duration", 60f, "The number of seconds it takes for luggage to refill after being opened."); TimerFontSize = ((BaseUnityPlugin)this).Config.Bind("General", "Timer Font Size", 5f, "The font size of the countdown timer displayed above luggage."); ShowTimer = ((BaseUnityPlugin)this).Config.Bind("General", "Show Timer", true, "Whether to display the countdown timer above luggage."); MaxReopens = ((BaseUnityPlugin)this).Config.Bind("General", "Max Reopens", -1, "The maximum number of times a luggage can be reopened before it stops refilling. Set to -1 for unlimited reopens."); LuggageSmall = ((BaseUnityPlugin)this).Config.Bind("Luggages", "Luggage Small", true, "Whether the small luggage should refill."); LuggageBig = ((BaseUnityPlugin)this).Config.Bind("Luggages", "Luggage Big", true, "Whether the big luggage should refill."); LuggageEpic = ((BaseUnityPlugin)this).Config.Bind("Luggages", "Luggage Epic", true, "Whether the explorer luggage should refill."); LuggageAncient = ((BaseUnityPlugin)this).Config.Bind("Luggages", "Luggage Ancient", true, "Whether the ancient luggage should refill."); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } public static string[] GetLuggageTypes() { List list = new List(); if (LuggageSmall.Value) { list.Add("LuggageSmall"); } if (LuggageBig.Value) { list.Add("LuggageBig"); } if (LuggageEpic.Value) { list.Add("LuggageEpic"); } if (LuggageAncient.Value) { list.Add("LuggageAncient"); } return list.ToArray(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }