Decompiled source of InternalRevenueStorage v0.8.44
plugins/InternalRevenueStorage.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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 InternalRevenueStorage.Components; using InternalRevenueStorage.Data; using InternalRevenueStorage.Managers; using InternalRevenueStorage.Managers.HUDS; using InternalRevenueStorage.Utility; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("KITEForce")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.8.3.0")] [assembly: AssemblyInformationalVersion("0.8.3+ac5eaad6dadd28bcdb337ccfce30e8e7e1d54036")] [assembly: AssemblyProduct("InternalRevenueStorage")] [assembly: AssemblyTitle("InternalRevenueStorage")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.8.3.0")] [module: UnverifiableCode] [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.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; } } [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 InternalRevenueStorage { [BepInPlugin("KITEForce.InternalRevenueStorage", "InternalRevenueStorage", "0.8.44")] public class InternalRevenueStorage : BaseUnityPlugin { internal static InternalRevenueStorage Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); IRSConfigManager.Init(((BaseUnityPlugin)this).Config); LocalizationManager.Init(); SoundManager.LoadSounds(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } } namespace InternalRevenueStorage.Utility { public static class JsonUtilityWrapper { [Serializable] private class Wrapper<T> { public List<T> Items; } public static List<T> FromJsonList<T>(string json) { try { Type typeFromHandle = typeof(Wrapper<T>); MethodInfo method = typeof(JsonUtility).GetMethod("FromJson", new Type[1] { typeof(string) }); MethodInfo methodInfo = method.MakeGenericMethod(typeFromHandle); object obj = methodInfo.Invoke(null, new object[1] { json }); FieldInfo field = typeFromHandle.GetField("Items"); return (List<T>)field.GetValue(obj); } catch { return new List<T>(); } } public static string ToJsonList<T>(List<T> list) { Wrapper<T> wrapper = new Wrapper<T> { Items = list }; return JsonUtility.ToJson((object)wrapper, true); } } public static class WavUtility { public static AudioClip ToAudioClip(byte[] wavFile, int offsetSamples = 0, string name = "wav") { using MemoryStream input = new MemoryStream(wavFile); using BinaryReader binaryReader = new BinaryReader(input); binaryReader.ReadChars(4); binaryReader.ReadInt32(); binaryReader.ReadChars(4); binaryReader.ReadChars(4); binaryReader.ReadInt32(); ushort num = binaryReader.ReadUInt16(); ushort num2 = binaryReader.ReadUInt16(); int num3 = binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadUInt16(); ushort num4 = binaryReader.ReadUInt16(); string text = new string(binaryReader.ReadChars(4)); while (text != "data") { int count = binaryReader.ReadInt32(); binaryReader.ReadBytes(count); text = new string(binaryReader.ReadChars(4)); } int num5 = binaryReader.ReadInt32(); byte[] array = binaryReader.ReadBytes(num5); float[] array2 = null; if (num4 == 16) { short[] array3 = new short[num5 / 2]; for (int i = 0; i < array3.Length; i++) { array3[i] = (short)(array[i * 2] | (array[i * 2 + 1] << 8)); } array2 = new float[array3.Length]; for (int j = 0; j < array3.Length; j++) { array2[j] = (float)array3[j] / 32768f; } AudioClip val = AudioClip.Create(name, array2.Length / num2, (int)num2, num3, false); val.SetData(array2, offsetSamples); return val; } Debug.LogError((object)"[WavUtility] Only 16-bit WAVs are supported."); return null; } } } namespace InternalRevenueStorage.Patches { [HarmonyPatch(typeof(ExtractionPoint), "StateSetRPC")] public class ExtractionPointPatch { [HarmonyPostfix] public static void Postfix(State state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown switch (state - 3) { case 0: InternalRevenueStorage.Logger.LogInfo((object)"[IRS] Extraction entered 'Success' state, checking for storage reminder."); if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.StartExtractionReminder(); } break; case 2: case 4: InternalRevenueStorage.Logger.LogInfo((object)"[IRS] Extraction ended or cancelled, stopping storage reminder."); if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.StopExtractionReminder(); } break; case 1: case 3: break; } } } [HarmonyPatch(typeof(SemiFunc), "UIHideHealth")] public class HideUIPatch { [HarmonyPostfix] public static void Postfix() { if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.HideHUD(); } } } [HarmonyPatch(typeof(PhysGrabber), "ShowValue")] public class PhysGrabberShowValuePatch { public static void Postfix(PhysGrabber __instance) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (!__instance.grabbed || (Object)(object)__instance.grabbedPhysGrabObject == (Object)null) { return; } ValuableObject component = ((Component)__instance.grabbedPhysGrabObject).GetComponent<ValuableObject>(); if (!((Object)(object)component == (Object)null)) { string volumeLabel = GetVolumeLabel(component.volumeType); Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.46f, 0f); if (!Utility.IsNullOrWhiteSpace(volumeLabel)) { ItemInfoExtraUI.instance.ItemInfoText("Size: " + volumeLabel, val); } } } private static string GetVolumeLabel(Type type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected I4, but got Unknown return (int)type switch { 0 => LocalizationManager.Translate("volume.tiny"), 1 => LocalizationManager.Translate("volume.small"), 2 => LocalizationManager.Translate("volume.medium"), 3 => LocalizationManager.Translate("volume.big"), _ => LocalizationManager.Translate("volume.denied"), }; } } [HarmonyPatch(typeof(PlayerController))] internal static class PlayerControllerPatch { [CompilerGenerated] private sealed class <DelayedBagUpgrade>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public StorageComponent storageComponent; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedBagUpgrade>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; InternalRevenueStorage.Logger.LogInfo((object)"[IRS] Delayed bag limit upgrade -- triggered after PlayerController Start."); storageComponent.ResetBags(); storageComponent.UpdateBagLimitBasedOnRunLevel(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ShowTipsOnce>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ShowTipsOnce>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown PhysGrabber instance; switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0022; case 1: <>1__state = -1; goto IL_0022; case 2: { <>1__state = -1; IRSConfigManager.StoreTipShown.Value = true; ((ConfigEntryBase)IRSConfigManager.StoreTipShown).ConfigFile.Save(); InternalRevenueStorage.Logger.LogInfo((object)"[IRS] Displayed store tip after first item pickup."); break; } IL_0022: instance = PhysGrabber.instance; if ((Object)(object)instance != (Object)null) { PhysGrabObject grabbedPhysGrabObject = instance.grabbedPhysGrabObject; if ((Object)(object)grabbedPhysGrabObject != (Object)null) { ValuableObject component = ((Component)grabbedPhysGrabObject).GetComponent<ValuableObject>(); if ((Object)(object)component != (Object)null) { if (!IRSConfigManager.StoreTipShown.Value) { KeyCode value = IRSConfigManager.KeyInfoHud.Value; string arg = ((object)(KeyCode)(ref value)).ToString(); string text = string.Format(LocalizationManager.Translate("storetip.small"), arg); SemiFunc.UIFocusText(text, Color.white, AssetManager.instance.colorYellow, 3f); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 2; return true; } break; } } } <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { InternalRevenueStorage.Logger.LogDebug((object)$"{__instance} Start Postfix"); StorageComponent storageComponent = ((Component)__instance).GetComponent<StorageComponent>(); if ((Object)(object)storageComponent == (Object)null) { storageComponent = ((Component)__instance).gameObject.AddComponent<StorageComponent>(); InternalRevenueStorage.Logger.LogInfo((object)("[Attach] InternalRevenueStorage Storage Component attached to: " + ((Object)((Component)__instance).gameObject).name)); ((MonoBehaviour)__instance).StartCoroutine(ShowTipsOnce(__instance, storageComponent)); } if ((Object)(object)((Component)__instance).GetComponent<HUDManager>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<HUDManager>(); InternalRevenueStorage.Logger.LogInfo((object)("[Attach] InternalRevenueStorage HUDManager attached to: " + ((Object)((Component)__instance).gameObject).name)); } if ((Object)(object)storageComponent != (Object)null && (Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject != (Object)null) { ((Component)__instance).gameObject.GetComponent<MonoBehaviour>().StartCoroutine(DelayedBagUpgrade(storageComponent)); } if (PhotonNetwork.IsMasterClient) { storageComponent.SyncBlacklistSettingsFromHost(); } } [IteratorStateMachine(typeof(<DelayedBagUpgrade>d__1))] private static IEnumerator DelayedBagUpgrade(StorageComponent storageComponent) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedBagUpgrade>d__1(0) { storageComponent = storageComponent }; } [IteratorStateMachine(typeof(<ShowTipsOnce>d__2))] private static IEnumerator ShowTipsOnce(PlayerController player, StorageComponent storageComponent) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ShowTipsOnce>d__2(0); } } [HarmonyPatch(typeof(PlayerAvatar), "PlayerDeathRPC")] public class PlayerDeathPatch { [HarmonyPostfix] public static void Postfix(PlayerAvatar __instance) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } PhotonView component = ((Component)__instance).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { InternalRevenueStorage.Logger.LogWarning((object)"[IRS PDP] No PhotonView on dead PlayerAvatar."); return; } if (!component.IsMine) { InternalRevenueStorage.Logger.LogInfo((object)"[IRS PDP] Skipping drop - not my PlayerAvatar."); return; } PlayerController instance = PlayerController.instance; if ((Object)(object)instance == (Object)null) { InternalRevenueStorage.Logger.LogWarning((object)"[IRS PDP] No PlayerController found for local player."); return; } StorageComponent component2 = ((Component)instance).GetComponent<StorageComponent>(); if ((Object)(object)component2 == (Object)null) { InternalRevenueStorage.Logger.LogWarning((object)"[IRS PDP] No StorageComponent found on local player."); return; } StorageManager storageManager = component2.StorageManager; int totalStorageValue = storageManager.GetTotalStorageValue(); if (totalStorageValue <= 0) { InternalRevenueStorage.Logger.LogInfo((object)"[IRS PDP] No valuables to drop."); return; } Vector3 val = storageManager.CalculateBoundsForDropping(); PhotonView component3 = ((Component)instance).GetComponent<PhotonView>(); if ((Object)(object)component3 != (Object)null) { component3.RPC("RPC_RequestDropMoneyBag", (RpcTarget)2, new object[2] { totalStorageValue, val }); component2._bagManager.TryIncrementBag(); storageManager.ClearStorage(); } else { InternalRevenueStorage.Logger.LogError((object)"[IRS PDP] Could not find PhotonView on local PlayerController."); } } } [HarmonyPatch(typeof(PlayerAvatar), "ReviveRPC")] public class ReviveRPCPatch { public static void Postfix(PlayerAvatar __instance) { if (__instance.isLocal && (Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.ShowHUD(); } } } } namespace InternalRevenueStorage.Managers { public class BagManager : MonoBehaviourPunCallbacks { public int BagsDropped { get; private set; } public int MaxBagsAllowed { get; private set; } = 2; public void TryIncrementBag() { BagsDropped++; } public bool CanDropBag() { InternalRevenueStorage.Logger.LogInfo((object)$"[IRS BM] CanDropBag check: BagsDropped={BagsDropped} MaxBagsAllowed={MaxBagsAllowed}"); return BagsDropped < MaxBagsAllowed; } public void ResetBags() { BagsDropped = 0; } public void UpdateBagLimitBasedOnRunLevel() { bool flag = !PhotonNetwork.IsConnectedAndReady || PhotonNetwork.OfflineMode; if (PhotonNetwork.IsMasterClient || flag) { int num = SemiFunc.RunGetLevelsCompleted(); InternalRevenueStorage.Logger.LogInfo((object)$"[IRS BM] Host calculating bag limit at RunLevel {num}"); int num2 = Mathf.Max(2, IRSConfigManager.BagLevelInterval.Value); int num3 = Mathf.Clamp(IRSConfigManager.MaxBagLimit.Value, 2, 20); int num4 = Mathf.Min(num3, 2 + num / num2); InternalRevenueStorage.Logger.LogInfo((object)$"[IRS BM] Host setting new bag limit: {num4} (clamped from config {num3})"); if (flag) { MaxBagsAllowed = num4; ValuableCheckManager.LoadBlacklist(); } ((MonoBehaviourPun)this).photonView.RPC("RPC_SetMaxBagLimitFromHost", (RpcTarget)0, new object[1] { num4 }); ValuableCheckManager.LoadBlacklist(); ValuableCheckManager.BroadcastUserBlacklistToClients((MonoBehaviour)(object)this); } } [PunRPC] public void RPC_SetMaxBagLimitFromHost(int hostLimit) { MaxBagsAllowed = hostLimit; InternalRevenueStorage.Logger.LogInfo((object)$"[IRS BM] Max bag limit set by host to {MaxBagsAllowed}"); } [PunRPC] public void RPC_RequestDropMoneyBag(int totalValue, Vector3 dropPosition) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient) { InternalRevenueStorage.Logger.LogInfo((object)$"[IRS BM] Spawning money bag at {dropPosition} worth ${totalValue}"); MoneyBagManager.SpawnMoneyBag(totalValue, dropPosition); } } } public class HUDManager : SemiUI { [CompilerGenerated] private sealed class <ExtractionReminderPulse>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HUDManager <>4__this; private BaseHUD <valueHud>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ExtractionReminderPulse>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <valueHud>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; HUDManager hUDManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; InternalRevenueStorage.Logger.LogInfo((object)"[HUD] Starting extraction reminder pulse..."); goto IL_0219; case 1: <>1__state = -1; goto IL_01a1; case 2: <>1__state = -1; goto IL_01fb; case 3: { <>1__state = -1; <valueHud>5__2 = null; goto IL_0219; } IL_0219: if (hUDManager._reminderActive) { BaseHUD baseHUD = hUDManager._huds.Find((BaseHUD hud) => hud is StorageHUD); <valueHud>5__2 = hUDManager._huds.Find((BaseHUD hud) => hud is ValueHUD); int storageCount = hUDManager._storageManager.GetStorageCount(); int totalStorageValue = hUDManager._storageManager.GetTotalStorageValue(); if (storageCount <= 0 && totalStorageValue <= 0) { return false; } if ((Object)(object)baseHUD?.Text != (Object)null && !hUDManager._originalTextColors.ContainsKey(baseHUD.Text)) { hUDManager._originalTextColors[baseHUD.Text] = ((Graphic)baseHUD.Text).color; } if ((Object)(object)<valueHud>5__2?.Text != (Object)null && !hUDManager._originalTextColors.ContainsKey(<valueHud>5__2.Text)) { hUDManager._originalTextColors[<valueHud>5__2.Text] = ((Graphic)<valueHud>5__2.Text).color; } if (baseHUD != null) { <>2__current = hUDManager.PulseText(baseHUD.Text, baseHUD.OriginalScale, Vector2.op_Implicit(hUDManager.GetAdjustedPosition(baseHUD.OriginalAnchoredPosition)), Color.red, Color.white); <>1__state = 1; return true; } goto IL_01a1; } return false; IL_01fb: <>2__current = null; <>1__state = 3; return true; IL_01a1: if (<valueHud>5__2 != null) { <>2__current = hUDManager.PulseText(<valueHud>5__2.Text, <valueHud>5__2.OriginalScale, Vector2.op_Implicit(hUDManager.GetAdjustedPosition(<valueHud>5__2.OriginalAnchoredPosition)), Color.red, Color.white); <>1__state = 2; return true; } goto IL_01fb; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FadeHUD>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HUDManager <>4__this; public float targetAlpha; private float <duration>5__2; private float <elapsed>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeHUD>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) int num = <>1__state; HUDManager hUDManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <duration>5__2 = 0.2f; <elapsed>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsed>5__3 < <duration>5__2) { <elapsed>5__3 += Time.deltaTime; float num2 = <elapsed>5__3 / <duration>5__2; foreach (BaseHUD hud in hUDManager._huds) { if ((Object)(object)hud.Text != (Object)null) { Color color = ((Graphic)hud.Text).color; ((Graphic)hud.Text).color = new Color(color.r, color.g, color.b, Mathf.Lerp(color.a, targetAlpha, num2)); } } <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FlashTextColor>d__16 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TextMeshProUGUI text; public Color flashColor; public float duration; private Color <originalColor>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlashTextColor>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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_002f: 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_004a: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <originalColor>5__2 = ((Graphic)text).color; ((Graphic)text).color = flashColor; <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; ((Graphic)text).color = <originalColor>5__2; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PulseText>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HUDManager <>4__this; public TextMeshProUGUI text; public Vector3 originalScale; public Vector3 originalPos; public Color first; public Color second; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PulseText>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; HUDManager hUDManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = hUDManager.PulseTextAlphaColorShake(text, originalScale, originalPos, 0.2f, first, 0.25f, 1.15f); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = hUDManager.PulseTextAlphaColorShake(text, originalScale, originalPos, 1f, second, 0.25f, 1.05f); <>1__state = 2; return true; case 2: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PulseTextAlphaColorShake>d__22 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TextMeshProUGUI text; public float duration; public float targetAlpha; public Color targetColor; public Vector3 originalPos; public Vector3 originalScale; public float punchScale; private RectTransform <rect>5__2; private float <startAlpha>5__3; private Color <startColor>5__4; private float <elapsed>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PulseTextAlphaColorShake>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rect>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)text == (Object)null) { return false; } <rect>5__2 = ((TMP_Text)text).rectTransform; <startAlpha>5__3 = ((Graphic)text).color.a; <startColor>5__4 = ((Graphic)text).color; <elapsed>5__5 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsed>5__5 < duration) { <elapsed>5__5 += Time.deltaTime; float num = <elapsed>5__5 / duration; float num2 = Mathf.Lerp(<startAlpha>5__3, targetAlpha, num); Color val = Color.Lerp(<startColor>5__4, targetColor, num); ((Graphic)text).color = new Color(val.r, val.g, val.b, num2); <rect>5__2.anchoredPosition = Vector2.op_Implicit(originalPos + Vector2.op_Implicit(Random.insideUnitCircle) * 2f); ((Transform)<rect>5__2).localScale = Vector3.Lerp(originalScale * punchScale, originalScale, num); <>2__current = null; <>1__state = 1; return true; } <rect>5__2.anchoredPosition = Vector2.op_Implicit(originalPos); ((Transform)<rect>5__2).localScale = originalScale; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PunchText>d__17 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RectTransform rect; public float punchScale; public float duration; private Vector3 <originalScale>5__2; private Vector3 <targetScale>5__3; private float <elapsed>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PunchText>d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0038: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <originalScale>5__2 = ((Transform)rect).localScale; <targetScale>5__3 = <originalScale>5__2 * punchScale; <elapsed>5__4 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsed>5__4 < duration) { <elapsed>5__4 += Time.deltaTime; float num = <elapsed>5__4 / duration; ((Transform)rect).localScale = Vector3.Lerp(<targetScale>5__3, <originalScale>5__2, num); <>2__current = null; <>1__state = 1; return true; } ((Transform)rect).localScale = <originalScale>5__2; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static HUDManager Instance; private readonly List<BaseHUD> _huds = new List<BaseHUD>(); private readonly Dictionary<TextMeshProUGUI, Color> _originalTextColors = new Dictionary<TextMeshProUGUI, Color>(); private Coroutine _fadeCoroutine; private Coroutine _extractionReminderCoroutine; private Coroutine _pulseCoroutine; private bool _isTabHeld; private bool _reminderActive; private StorageManager? _storageManager; private bool _hudVisible; private void Start() { Instance = this; _storageManager = ((Component)PlayerController.instance).GetComponent<StorageComponent>().StorageManager; HealthUI instance = HealthUI.instance; if ((Object)(object)instance == (Object)null) { InternalRevenueStorage.Logger.LogWarning((object)"[IRS HUD] HealthUI not found!"); return; } RectTransform component = ((Component)instance).GetComponent<RectTransform>(); _huds.Add(new StorageHUD()); _huds.Add(new ValueHUD()); _huds.Add(new BagsHUD()); _huds.Add(new PickupCapacityHUD()); _huds.Add(new InfoHUD()); foreach (BaseHUD hud in _huds) { hud.Initialize(component); } } private void Update() { if (SemiFunc.MenuLevel() || SemiFunc.RunIsLobby()) { HideHUD(); return; } bool value = IRSConfigManager.HeldHud.Value; bool grabbed = PhysGrabber.instance.grabbed; PhysGrabObject grabbedPhysGrabObject = PhysGrabber.instance.grabbedPhysGrabObject; if (!value || (value && grabbed && (Object)(object)grabbedPhysGrabObject != (Object)null && grabbedPhysGrabObject.isValuable)) { ShowHUD(); } else { HideHUD(); } foreach (BaseHUD hud in _huds) { hud.UpdateHUD(); } HandleTabInput(); } private void HandleTabInput() { if (Input.GetKeyDown((KeyCode)9) && !_isTabHeld) { _isTabHeld = true; StartFade(0.05f); } if (Input.GetKeyUp((KeyCode)9) && _isTabHeld) { _isTabHeld = false; StartFade(1f); } } private void StartFade(float targetAlpha) { if (_fadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_fadeCoroutine); } _fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeHUD(targetAlpha)); } [IteratorStateMachine(typeof(<FadeHUD>d__14))] private IEnumerator FadeHUD(float targetAlpha) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeHUD>d__14(0) { <>4__this = this, targetAlpha = targetAlpha }; } public void FlashAndPunchBasedOnIncDec(TextMeshProUGUI text, bool isPositive) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)text == (Object)null)) { Color flashColor = (isPositive ? Color.green : Color.red); ((MonoBehaviour)this).StartCoroutine(FlashTextColor(text, flashColor, 0.2f)); ((MonoBehaviour)this).StartCoroutine(PunchText(((TMP_Text)text).rectTransform, 1.3f, 0.3f)); ((SemiUI)this).SemiUISpringShakeY(20f, 10f, 0.3f); ((SemiUI)this).SemiUISpringScale(0.3f, 5f, 0.2f); } } [IteratorStateMachine(typeof(<FlashTextColor>d__16))] private IEnumerator FlashTextColor(TextMeshProUGUI text, Color flashColor, float duration) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlashTextColor>d__16(0) { text = text, flashColor = flashColor, duration = duration }; } [IteratorStateMachine(typeof(<PunchText>d__17))] private IEnumerator PunchText(RectTransform rect, float punchScale, float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PunchText>d__17(0) { rect = rect, punchScale = punchScale, duration = duration }; } public void StartExtractionReminder() { if (!_reminderActive) { _reminderActive = true; _extractionReminderCoroutine = ((MonoBehaviour)this).StartCoroutine(ExtractionReminderPulse()); } } public void StopExtractionReminder() { if (_reminderActive) { _reminderActive = false; if (_extractionReminderCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_extractionReminderCoroutine); } ResetReminderColors(); } } [IteratorStateMachine(typeof(<ExtractionReminderPulse>d__20))] private IEnumerator ExtractionReminderPulse() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ExtractionReminderPulse>d__20(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<PulseText>d__21))] private IEnumerator PulseText(TextMeshProUGUI text, Vector3 originalScale, Vector3 originalPos, Color first, Color second) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_001d: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PulseText>d__21(0) { <>4__this = this, text = text, originalScale = originalScale, originalPos = originalPos, first = first, second = second }; } [IteratorStateMachine(typeof(<PulseTextAlphaColorShake>d__22))] private IEnumerator PulseTextAlphaColorShake(TextMeshProUGUI text, Vector3 originalScale, Vector3 originalPos, float targetAlpha, Color targetColor, float duration, float punchScale) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PulseTextAlphaColorShake>d__22(0) { text = text, originalScale = originalScale, originalPos = originalPos, targetAlpha = targetAlpha, targetColor = targetColor, duration = duration, punchScale = punchScale }; } private void ResetReminderColors() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) foreach (BaseHUD hud in _huds) { if ((Object)(object)hud.Text != (Object)null && _originalTextColors.TryGetValue(hud.Text, out var value)) { ((Graphic)hud.Text).color = value; } } _originalTextColors.Clear(); } public void HideHUD() { if (!_hudVisible) { return; } _hudVisible = false; foreach (BaseHUD hud in _huds) { hud.HideHUD(); } } public void ShowHUD() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) if (_hudVisible) { return; } _hudVisible = true; foreach (BaseHUD hud in _huds) { if (!(hud is InfoHUD)) { hud.ShowHUD(); if ((Object)(object)hud.Text != (Object)null) { ((MonoBehaviour)this).StartCoroutine(PulseText(hud.Text, hud.OriginalScale, Vector2.op_Implicit(GetAdjustedPosition(hud.OriginalAnchoredPosition)), Color.green, Color.white)); } } } } private Vector2 GetAdjustedPosition(Vector2 original) { //IL_0000: 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_0018: Unknown result type (might be due to invalid IL or missing references) return new Vector2(original.x, original.y - (float)IRSConfigManager.HudSlider.Value); } public T? GetHUD<T>() where T : BaseHUD { return _huds.OfType<T>().FirstOrDefault(); } } public static class IRSConfigManager { public static ConfigEntry<bool> StoreTipShown; public static ConfigEntry<int> MaxBagLimit; public static ConfigEntry<int> BagLevelInterval; public static ConfigEntry<bool> EnableInternalBlacklist; public static ConfigEntry<bool> EnableUserBlacklist; public static ConfigEntry<KeyCode> KeyStoreItem; public static ConfigEntry<KeyCode> KeyDropMoney; public static ConfigEntry<KeyCode> KeyBlacklistItem; public static ConfigEntry<KeyCode> KeyInfoHud; public static ConfigEntry<int> HudSlider; public static ConfigEntry<bool> HeldHud; public static ConfigEntry<float> PickUpSoundVolume; public static ConfigEntry<string> SelectedLanguage; public static void Init(ConfigFile config) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown StoreTipShown = config.Bind<bool>("General", "StoreTipShown", false, "Whether the 'Store item' tip has been shown to the player."); MaxBagLimit = config.Bind<int>("General", "MaxBagLimit", 6, new ConfigDescription("Maximum number of bags allowed (2 to 20) per player", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 20), Array.Empty<object>())); BagLevelInterval = config.Bind<int>("General", "BagLevelInterval", 2, new ConfigDescription("Run levels required to increase max bags by 1", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 10), Array.Empty<object>())); EnableInternalBlacklist = config.Bind<bool>("Blacklist", "EnableInternalBlacklist", true, "Enable the internal mod-provided blacklist. Host-only setting."); EnableUserBlacklist = config.Bind<bool>("Blacklist", "EnableUserBlacklist", false, "Enable the user-provided custom blacklist from file. Host-only setting."); KeyStoreItem = config.Bind<KeyCode>("Keybinds", "StoreHeldItem", (KeyCode)98, "Key to store the held item into inventory."); KeyDropMoney = config.Bind<KeyCode>("Keybinds", "DropMoneyBag", (KeyCode)109, "Key to drop stored items as a money bag."); KeyBlacklistItem = config.Bind<KeyCode>("Keybinds", "BlacklistHeldItem", (KeyCode)107, "Key to add held item to a temporary blacklist file."); KeyInfoHud = config.Bind<KeyCode>("Keybinds", "InfoHud", (KeyCode)284, "Key to show information about the mod."); HudSlider = config.Bind<int>("HUD", "HudSlider", 0, new ConfigDescription("Slide the hud down by increasing this value", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200), Array.Empty<object>())); HeldHud = config.Bind<bool>("HUD", "HeldHud", false, "Show the HUD only when Grabbing"); PickUpSoundVolume = config.Bind<float>("Sound", "PickUpSoundVolume", 1f, new ConfigDescription("How loud the pickup sound is", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SelectedLanguage = config.Bind<string>("Localization", "Language", "en", "Language to use for mod text (e.g., en, es, español, english, spanish)."); SelectedLanguage.SettingChanged += delegate { LocalizationManager.Reload(); HUDManager.Instance?.ShowHUD(); }; } } public static class LocalizationManager { private static Dictionary<string, string> _entries = new Dictionary<string, string>(); private static readonly Dictionary<string, string> LanguageAliases = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "en", "en" }, { "english", "en" }, { "es", "es" }, { "spanish", "es" }, { "espanol", "es" }, { "español", "es" }, { "da", "da" }, { "danish", "da" }, { "dansk", "da" }, { "de", "de" }, { "german", "de" }, { "deutsch", "de" }, { "fr", "fr" }, { "french", "fr" }, { "pl", "pl" }, { "polish", "pl" } }; public static void Init(string languageInput = "en") { bool flag = false; if (string.IsNullOrWhiteSpace(languageInput) || languageInput.Trim().ToLower() == "en") { languageInput = IRSConfigManager.SelectedLanguage.Value; } string value = string.Empty; if (!LanguageAliases.TryGetValue(languageInput.Trim().ToLower(), out value)) { value = languageInput.Trim().ToLower(); flag = true; InternalRevenueStorage.Logger.LogWarning((object)("[Localization] Unknown language alias: '" + languageInput + "' — attempting to load as external language.")); } string location = typeof(LocalizationManager).Assembly.Location; string directoryName = Path.GetDirectoryName(location); string text = Path.Combine(directoryName, "InternalRevenueStorage", "Resources", "Locales", value + ".txt"); string text2 = Path.Combine(directoryName, "Resources", "Locales", value + ".txt"); string text3 = null; if (File.Exists(text)) { text3 = text; } else { if (!File.Exists(text2)) { InternalRevenueStorage.Logger.LogWarning((object)("[Localization] Localization file not found at either path:\n- " + text + "\n- " + text2)); return; } InternalRevenueStorage.Logger.LogWarning((object)("[Localization] Primary localization file not found. Using fallback: " + text2)); text3 = text2; } _entries.Clear(); string[] array = File.ReadAllLines(text3); foreach (string text4 in array) { if (!string.IsNullOrWhiteSpace(text4) && text4.Contains("=")) { string[] array2 = text4.Split(new char[1] { '=' }, 2); string key = array2[0].Trim(); string value2 = array2[1].Trim(); _entries[key] = value2; } } if (flag) { InternalRevenueStorage.Logger.LogWarning((object)$"[Localization] Loaded unsupported (external) language '{value}' with {_entries.Count} entries."); } else { InternalRevenueStorage.Logger.LogInfo((object)$"[Localization] Loaded '{value}' with {_entries.Count} entries."); } } public static string Translate(string key) { if (_entries.TryGetValue(key, out string value)) { return value; } return "<missing:" + key + ">"; } public static void Reload() { Init(IRSConfigManager.SelectedLanguage.Value); (HUDManager.Instance?.GetHUD<InfoHUD>())?.RefreshText(); } } public class MoneyBagManager { public static int LargeThreshold { get; } = 10000; public static int MediumThreshold { get; } = 5000; public static void SpawnMoneyBag(int totalValue, Vector3 spawnPosition) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0069: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (totalValue <= 0) { return; } GameObject val = AssetManager.instance.surplusValuableSmall; if (totalValue > LargeThreshold) { val = AssetManager.instance.surplusValuableBig; } else if (totalValue > MediumThreshold) { val = AssetManager.instance.surplusValuableMedium; } if ((Object)(object)val == (Object)null) { InternalRevenueStorage.Logger.LogError((object)"Surplus prefab is missing."); return; } GameObject val2 = ((!SemiFunc.IsMultiplayer()) ? Object.Instantiate<GameObject>(val, spawnPosition, Quaternion.identity) : PhotonNetwork.InstantiateRoomObject("Valuables/" + ((Object)val).name, spawnPosition, Quaternion.identity, (byte)0, (object[])null)); ValuableObject component = val2.GetComponent<ValuableObject>(); PhysGrabObject component2 = val2.GetComponent<PhysGrabObject>(); if ((Object)(object)component != (Object)null) { component.dollarValueOverride = totalValue; } if ((Object)(object)component2 != (Object)null) { component2.spawnTorque = Random.insideUnitSphere * 0.05f; } } public static bool IsMoneyBag(ValuableObject valuable) { if ((Object)(object)valuable == (Object)null) { return false; } GameObject surplusValuableSmall = AssetManager.instance.surplusValuableSmall; GameObject surplusValuableMedium = AssetManager.instance.surplusValuableMedium; GameObject surplusValuableBig = AssetManager.instance.surplusValuableBig; string text = ((Object)((Component)valuable).gameObject).name.Replace("(Clone)", "").Trim(); if (!(text == ((Object)surplusValuableSmall).name) && !(text == ((Object)surplusValuableMedium).name)) { return text == ((Object)surplusValuableBig).name; } return true; } } public static class SoundManager { private static AudioClip? _pickupClip; private static AudioClip? _reminderClip; public static void LoadSounds() { Assembly assembly = typeof(SoundManager).Assembly; using Stream stream = assembly.GetManifestResourceStream("InternalRevenueStorage.Resources.Sounds.pickup.wav"); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); _pickupClip = WavUtility.ToAudioClip(array, 0, "pickup"); } else { InternalRevenueStorage.Logger.LogWarning((object)"[IRS SoundManager] Pickup sound not found!"); } } public static void PlayPickupSound(Vector3 position) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_pickupClip != (Object)null) { AudioSource.PlayClipAtPoint(_pickupClip, position, IRSConfigManager.PickUpSoundVolume.Value); } } } public class StorageManager { private enum SlotFitResult { CannotStore, FitsOneSlot, FitsTwoSlots } private readonly int _maxStorageAmount = 2; private readonly List<ValuableObject> _storage = new List<ValuableObject>(); public int GetMaxStorage() { return _maxStorageAmount; } public int GetStorageCount() { return _storage.Count; } public int GetTotalStorageValue() { return _storage.Sum((ValuableObject valuable) => (int)valuable.dollarValueCurrent); } public void ClearStorage() { _storage.Clear(); } public void DropAllAsMoneyBag() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) PhotonView component = ((Component)PlayerController.instance).GetComponent<PhotonView>(); if (GetStorageCount() == 0) { InternalRevenueStorage.Logger.LogInfo((object)"Storage is empty, nothing to drop."); return; } int totalStorageValue = GetTotalStorageValue(); Vector3 val = CalculateBoundsForDropping(); if (SemiFunc.IsMultiplayer()) { component.RPC("RPC_RequestDropMoneyBag", (RpcTarget)2, new object[2] { totalStorageValue, val }); } else { MoneyBagManager.SpawnMoneyBag(totalStorageValue, val); } _storage.Clear(); InternalRevenueStorage.Logger.LogInfo((object)$"Dropped money bag worth ${totalStorageValue}."); } public void StoreHeldItem() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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) PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance == (Object)null) { return; } PhysGrabObject grabbedPhysGrabObject = instance.grabbedPhysGrabObject; if ((Object)(object)grabbedPhysGrabObject == (Object)null) { instance.grabbedPhysGrabObject = null; return; } ValuableObject component = ((Component)grabbedPhysGrabObject).GetComponent<ValuableObject>(); if ((Object)(object)component == (Object)null) { instance.ReleaseObjectRPC(true, 0.1f); instance.grabbedPhysGrabObject = null; return; } if (!component.physGrabObject.grabbed) { instance.ReleaseObjectRPC(true, 0.1f); instance.grabbedPhysGrabObject = null; return; } if (MoneyBagManager.IsMoneyBag(component)) { SendChatMessage("Must. Extract.", Color.yellow); return; } if (ValuableCheckManager.TryGetRestriction(component, out var restricted)) { if (string.IsNullOrEmpty(restricted.CustomMessage) || string.IsNullOrWhiteSpace(restricted.CustomMessage)) { SendChatMessage("DENIED.", restricted.MessageColor); } SendChatMessage(restricted.CustomMessage, restricted.MessageColor); InternalRevenueStorage.Logger.LogInfo((object)("Attempted to store restricted item: " + ((Object)component).name)); return; } SlotFitResult slotFitResult = GetSlotFitResult(component); if (slotFitResult == SlotFitResult.CannotStore) { SendChatMessage("Too. Heavy.", Color.red); InternalRevenueStorage.Logger.LogInfo((object)$"Item: {((Object)component).name} is too large to store (volume type: {component.volumeType})."); return; } int num = _maxStorageAmount - GetSlotsUsed(); int num2 = ((slotFitResult != SlotFitResult.FitsTwoSlots) ? 1 : 2); if (num2 > num) { SendChatMessage((num2 == 2) ? "Need more room!" : "No room!", Color.green); return; } if (component.physGrabObject.grabbed) { if (SemiFunc.IsMultiplayer()) { PhotonView obj = PhotonView.Get((Component)(object)instance); if (obj != null) { obj.RPC("ReleaseObjectRPC", (RpcTarget)0, new object[2] { true, 0.1f }); } } else { instance.ReleaseObjectRPC(true, 0.1f); } } instance.grabbedPhysGrabObject = null; PhotonView component2 = ((Component)PlayerController.instance).GetComponent<PhotonView>(); if (SemiFunc.IsMultiplayer()) { if (PhotonNetwork.IsMasterClient || ((Component)component).GetComponent<PhotonView>().IsMine) { PhotonNetwork.Destroy(((Component)component).gameObject); SoundManager.PlayPickupSound(((Component)PlayerController.instance).transform.position); } else { component2.RPC("RPC_RequestDestroy", (RpcTarget)2, new object[1] { ((Component)component).GetComponent<PhotonView>().ViewID }); SoundManager.PlayPickupSound(((Component)PlayerController.instance).transform.position); } } else { Object.Destroy((Object)(object)((Component)component).gameObject); SoundManager.PlayPickupSound(((Component)PlayerController.instance).transform.position); } RemoveFromHaulList(component); _storage.Add(component); InternalRevenueStorage.Logger.LogInfo((object)$"$Stored: {((Object)component).name} (${component.dollarValueCurrent})"); InternalRevenueStorage.Logger.LogInfo((object)$"Total items in bag: {GetStorageCount()} (${GetTotalStorageValue()})"); } public int GetSlotsUsed() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (ValuableObject item in _storage) { switch (GetItemSlotSize(item)) { case SlotFitResult.FitsOneSlot: num++; break; case SlotFitResult.FitsTwoSlots: num += 2; break; case SlotFitResult.CannotStore: InternalRevenueStorage.Logger.LogWarning((object)$"[IRS] Stored item '{((Object)item).name}' is considered unstoreable (volumeType: {item.volumeType})"); break; } } return num; } private SlotFitResult GetSlotFitResult(ValuableObject valuable) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0038: 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_0046: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected I4, but got Unknown int num = 0; if (StatsManager.instance.playerUpgradeStrength.TryGetValue(PlayerController.instance.playerSteamID, out var value)) { num += value; } if ((int)valuable.volumeType == 4 || (int)valuable.volumeType == 5) { return SlotFitResult.CannotStore; } if ((int)valuable.volumeType == 0 || (int)valuable.volumeType == 1) { return SlotFitResult.FitsOneSlot; } Type volumeType = valuable.volumeType; switch ((int)volumeType) { case 0: case 1: return SlotFitResult.FitsOneSlot; case 2: if (num < 2) { return SlotFitResult.FitsTwoSlots; } return SlotFitResult.FitsOneSlot; case 3: if (num < 4) { return SlotFitResult.CannotStore; } return SlotFitResult.FitsTwoSlots; default: return SlotFitResult.CannotStore; } } private SlotFitResult GetItemSlotSize(ValuableObject valuable) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0040: Expected I4, but got Unknown int num = 0; if (StatsManager.instance.playerUpgradeStrength.TryGetValue(PlayerController.instance.playerSteamID, out var value)) { num += value; } Type volumeType = valuable.volumeType; switch ((int)volumeType) { case 0: case 1: return SlotFitResult.FitsOneSlot; case 2: if (num >= 2) { return SlotFitResult.FitsOneSlot; } return SlotFitResult.FitsTwoSlots; case 3: if (num < 4) { return SlotFitResult.CannotStore; } return SlotFitResult.FitsTwoSlots; default: return SlotFitResult.CannotStore; } } public Vector3 CalculateBoundsForDropping() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) Vector3 val = ((Component)PhysGrabber.instance).transform.position + Vector3.up * 0.5f; Vector3 forward = ((Component)PhysGrabber.instance).transform.forward; float num = 2f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, forward, ref val2, num, -1, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 0.2f; } return val + forward * 1.5f; } private void RemoveFromHaulList(ValuableObject valuableObject) { if (RoundDirector.instance.dollarHaulList.Contains(((Component)valuableObject).gameObject)) { RoundDirector.instance.dollarHaulList.Remove(((Component)valuableObject).gameObject); } } private void AddToHaulList(ValuableObject valuableObject) { if (!RoundDirector.instance.dollarHaulList.Contains(((Component)valuableObject).gameObject)) { RoundDirector.instance.dollarHaulList.Add(((Component)valuableObject).gameObject); } } public void SendChatMessage(string message, Color color) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) try { ChatManager.instance.PossessChatScheduleStart(1); ChatManager.instance.PossessChat((PossessChatID)0, message, 1f, color, 0f, false, 0, (UnityEvent)null); ChatManager.instance.PossessChatScheduleEnd(); } catch (Exception) { InternalRevenueStorage.Logger.LogWarning((object)"Attempted to use ChatManager in an unexpected context."); } } } public static class ValuableCheckManager { private static readonly Dictionary<string, RestrictedValuable> internalBlacklist = new Dictionary<string, RestrictedValuable> { { "Valuable Scream Doll", new RestrictedValuable("Valuable Scream Doll", "DOLL. CURSED.", Color.red) }, { "Valuable Wizard Time Glass", new RestrictedValuable("Valuable Wizard Time Glass", "TIME. IS. AN. ILLUSION.", Color.magenta) }, { "Valuable Chomp Book", new RestrictedValuable("Valuable Chomp Book", "FORBIDDEN. KNOWLEDGE.", Color.gray) }, { "Valuable Music Box", new RestrictedValuable("Valuable Music Box", "DANCE. FOR. US.", Color.cyan) }, { "Valuable Fan", new RestrictedValuable("Valuable Fan", "BLOWING. THE. BAG. AWAY.", Color.gray) } }; public static readonly Dictionary<string, RestrictedValuable> userBlacklist = new Dictionary<string, RestrictedValuable>(); private static readonly string TempBlacklistPath = Path.Combine(Path.GetDirectoryName(typeof(ValuableCheckManager).Assembly.Location), "InternalRevenueStorage", "Resources", "TempBlacklist.json"); public static bool InternalBlacklistEnabled { get; set; } = IRSConfigManager.EnableInternalBlacklist.Value; public static bool UserBlacklistEnabled { get; set; } = IRSConfigManager.EnableUserBlacklist.Value; private static string ResolveBlacklistPath() { string location = typeof(ValuableCheckManager).Assembly.Location; string directoryName = Path.GetDirectoryName(location); string text = Path.Combine(directoryName, "InternalRevenueStorage", "Resources", "Blacklist.json"); string text2 = Path.Combine(directoryName, "Resources", "Blacklist.json"); if (File.Exists(text)) { return text; } if (File.Exists(text2)) { return text2; } return text; } public static void LoadBlacklist() { try { string text = ResolveBlacklistPath(); if (!File.Exists(text)) { InternalRevenueStorage.Logger.LogWarning((object)("[IRS] No blacklist file found. Creating default at: " + text)); CreateDefaultBlacklist(text); } string text2 = File.ReadAllText(text); List<RestrictedValuable> list = JsonConvert.DeserializeObject<List<RestrictedValuable>>(text2); if (list == null) { InternalRevenueStorage.Logger.LogWarning((object)"[IRS] Blacklist file is empty or malformed."); return; } foreach (RestrictedValuable item in list) { string text3 = item.ItemName?.Trim(); if (!string.IsNullOrEmpty(text3) && !userBlacklist.ContainsKey(text3)) { userBlacklist[text3] = new RestrictedValuable(text3, item.CustomMessage); } } InternalRevenueStorage.Logger.LogInfo((object)$"[IRS] Loaded {userBlacklist.Count} user-restricted valuables."); } catch (Exception ex) { InternalRevenueStorage.Logger.LogError((object)("[IRS] Failed to load blacklist: " + ex.Message)); } } private static void CreateDefaultBlacklist(string path) { List<RestrictedValuable> list = new List<RestrictedValuable> { new RestrictedValuable("Valuable Item Example", "Valuable. Message."), new RestrictedValuable("Valuable Item Example Two", "Valuable. Message. Two.") }; string contents = JsonConvert.SerializeObject((object)list, (Formatting)1); Directory.CreateDirectory(Path.GetDirectoryName(path)); File.WriteAllText(path, contents); } public static bool TryGetRestriction(ValuableObject valuable, out RestrictedValuable restricted) { restricted = default(RestrictedValuable); if ((Object)(object)valuable == (Object)null) { return false; } string key = ((Object)valuable).name.Replace("(Clone)", "").Trim(); if (IRSConfigManager.EnableUserBlacklist.Value && userBlacklist.TryGetValue(key, out restricted)) { return true; } if (IRSConfigManager.EnableInternalBlacklist.Value && internalBlacklist.TryGetValue(key, out restricted)) { return true; } return false; } public static void AppendToTempBlacklist(string itemName) { string itemName2 = itemName; try { List<RestrictedValuable> list = new List<RestrictedValuable>(); if (File.Exists(TempBlacklistPath)) { string text = File.ReadAllText(TempBlacklistPath); list = JsonConvert.DeserializeObject<List<RestrictedValuable>>(text) ?? new List<RestrictedValuable>(); } if (list.Exists((RestrictedValuable rv) => rv.ItemName.Equals(itemName2, StringComparison.OrdinalIgnoreCase))) { InternalRevenueStorage.Logger.LogInfo((object)("[IRS] '" + itemName2 + "' is already in TempBlacklist.")); return; } list.Add(new RestrictedValuable(itemName2, "")); string contents = JsonConvert.SerializeObject((object)list, (Formatting)1); Directory.CreateDirectory(Path.GetDirectoryName(TempBlacklistPath)); File.WriteAllText(TempBlacklistPath, contents); InternalRevenueStorage.Logger.LogInfo((object)("[IRS] Added '" + itemName2 + "' to TempBlacklist.")); } catch (Exception ex) { InternalRevenueStorage.Logger.LogError((object)("[IRS] Failed to append to TempBlacklist: " + ex.Message)); } } public static void BroadcastUserBlacklistToClients(MonoBehaviour senderContext) { bool flag = !PhotonNetwork.IsConnectedAndReady || PhotonNetwork.OfflineMode; if (!PhotonNetwork.IsMasterClient && !flag) { return; } try { List<RestrictedValuable> list = new List<RestrictedValuable>(userBlacklist.Values); string text = JsonConvert.SerializeObject((object)list, (Formatting)0); if (flag) { ((Component)senderContext).SendMessage("RPC_ReceiveUserBlacklist", (object)text); InternalRevenueStorage.Logger.LogInfo((object)$"[IRS] Applied custom blacklist locally in singleplayer ({list.Count} items)."); return; } PhotonView component = ((Component)senderContext).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { component.RPC("RPC_ReceiveUserBlacklist", (RpcTarget)1, new object[1] { text }); InternalRevenueStorage.Logger.LogInfo((object)$"[IRS] Broadcasted custom blacklist to clients ({list.Count} items)."); } else { InternalRevenueStorage.Logger.LogWarning((object)"[IRS] Broadcast failed: PhotonView not found on sender context."); } } catch (Exception ex) { InternalRevenueStorage.Logger.LogError((object)("[IRS] Failed to broadcast custom blacklist: " + ex.Message)); } } } } namespace InternalRevenueStorage.Managers.HUDS { public class BagsHUD : BaseHUD { private int _previousBagsUsed; public override void Initialize(RectTransform referenceRect) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_002b: 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_005c: Unknown result type (might be due to invalid IL or missing references) Text = CreateHUDText(referenceRect, new Vector2(referenceRect.anchoredPosition.x + referenceRect.sizeDelta.x, referenceRect.anchoredPosition.y - 80f)); base.OriginalScale = ((Transform)((TMP_Text)Text).rectTransform).localScale; base.OriginalAnchoredPosition = ((TMP_Text)Text).rectTransform.anchoredPosition; } public override void UpdateHUD() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MenuLevel()) { return; } Vector2 anchoredPosition = ((TMP_Text)Text).rectTransform.anchoredPosition; anchoredPosition.y = base.OriginalAnchoredPosition.y - (float)IRSConfigManager.HudSlider.Value; ((TMP_Text)Text).rectTransform.anchoredPosition = anchoredPosition; PlayerController instance = PlayerController.instance; StorageComponent storageComponent = ((instance != null) ? ((Component)instance).GetComponent<StorageComponent>() : null); if (!((Object)(object)storageComponent == (Object)null)) { int bagsDropped = storageComponent._bagManager.BagsDropped; int maxBagsAllowed = storageComponent._bagManager.MaxBagsAllowed; float usagePercent = (float)bagsDropped / (float)maxBagsAllowed; Color bagColor = GetBagColor(usagePercent); string format = LocalizationManager.Translate("hud.bags.used"); string text = string.Format(format, bagsDropped, maxBagsAllowed); ((TMP_Text)Text).text = "<size=65%><color=#" + ColorUtility.ToHtmlStringRGB(bagColor) + ">" + text + "</color></size>"; if (ShouldFlash(bagsDropped, _previousBagsUsed)) { HUDManager.Instance.FlashAndPunchBasedOnIncDec(Text, bagsDropped > _previousBagsUsed); } _previousBagsUsed = bagsDropped; } } private Color GetBagColor(float usagePercent) { //IL_0008: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (usagePercent >= 0.9f) { return Color.red; } if (usagePercent >= 0.75f) { return new Color(1f, 0.5f, 0f); } if (usagePercent >= 0.5f) { return Color.yellow; } return Color.white; } private bool ShouldFlash(int newValue, int oldValue) { if (newValue > 0) { if (newValue == oldValue) { return oldValue == 0; } return true; } return false; } } public abstract class BaseHUD { public TextMeshProUGUI Text; public Vector3 OriginalScale { get; protected set; } public Vector2 OriginalAnchoredPosition { get; protected set; } public abstract void Initialize(RectTransform referenceRect); public abstract void UpdateHUD(); public virtual void ShowHUD() { if ((Object)(object)Text != (Object)null) { ((Behaviour)Text).enabled = true; } } public virtual void HideHUD() { if ((Object)(object)Text != (Object)null) { ((Behaviour)Text).enabled = false; } } protected TextMeshProUGUI CreateHUDText(RectTransform referenceRect, Vector2 anchoredPosition) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0040: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("HUDText", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Transform)referenceRect).parent, false); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); RectTransform component = ((Component)val2).GetComponent<RectTransform>(); component.anchorMin = referenceRect.anchorMin; component.anchorMax = referenceRect.anchorMax; component.pivot = referenceRect.pivot; component.anchoredPosition = anchoredPosition; ((Behaviour)val2).enabled = false; SetupTextStyle(val2); return val2; } public void SetupTextStyle(TextMeshProUGUI text) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI component = ((Component)HealthUI.instance).GetComponent<TextMeshProUGUI>(); ((TMP_Text)text).font = ((TMP_Text)component).font; ((Graphic)text).material = ((TMP_Text)component).fontMaterial; ((TMP_Text)text).fontSize = 32f; ((TMP_Text)text).alignment = (TextAlignmentOptions)513; ((Graphic)text).color = Color.white; ((TMP_Text)text).text = ""; } } public class InfoHUD : BaseHUD { [CompilerGenerated] private sealed class <FadeHUD>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public InfoHUD <>4__this; public float targetAlpha; private float <duration>5__2; private float <elapsed>5__3; private Color <startColor>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeHUD>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; InfoHUD infoHUD = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <duration>5__2 = 0.3f; <elapsed>5__3 = 0f; <startColor>5__4 = ((Graphic)infoHUD.Text).color; ((Behaviour)infoHUD.Text).enabled = true; break; case 1: <>1__state = -1; break; } if (<elapsed>5__3 < <duration>5__2) { <elapsed>5__3 += Time.deltaTime; float num2 = <elapsed>5__3 / <duration>5__2; float num3 = Mathf.Lerp(<startColor>5__4.a, targetAlpha, num2); ((Graphic)infoHUD.Text).color = new Color(<startColor>5__4.r, <startColor>5__4.g, <startColor>5__4.b, num3); <>2__current = null; <>1__state = 1; return true; } if (targetAlpha == 0f) { ((Behaviour)infoHUD.Text).enabled = false; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool _isHoldingKey; private Coroutine _fadeCoroutine; public override void Initialize(RectTransform referenceRect) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0053: 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_007d: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("InfoHUDText", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Transform)referenceRect).parent, false); Text = val.AddComponent<TextMeshProUGUI>(); RectTransform component = ((Component)Text).GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); SetupTextStyle(Text); ((TMP_Text)Text).alignment = (TextAlignmentOptions)514; ((TMP_Text)Text).fontSize = 12f; ((Graphic)Text).color = new Color(((Graphic)Text).color.r, ((Graphic)Text).color.g, ((Graphic)Text).color.b, 0f); ((Behaviour)Text).enabled = false; RefreshText(); } public void RefreshText() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //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) KeyCode value = IRSConfigManager.KeyStoreItem.Value; string arg = ((object)(KeyCode)(ref value)).ToString(); value = IRSConfigManager.KeyDropMoney.Value; string arg2 = ((object)(KeyCode)(ref value)).ToString(); ((TMP_Text)Text).text = "<color=#FFD700>" + LocalizationManager.Translate("mod.version") + "</color>\n" + string.Format(LocalizationManager.Translate("info.store"), arg) + "\n" + string.Format(LocalizationManager.Translate("info.drop"), arg2) + "\n\n" + LocalizationManager.Translate("info.sl.title") + "\n\n<color=yellow>" + LocalizationManager.Translate("info.sl.medium") + "</color>\n<color=yellow>" + LocalizationManager.Translate("info.sl.big") + "</color>\n\n" + LocalizationManager.Translate("info.sl.upgrade") + "\n\n" + LocalizationManager.Translate("info.bag.limit"); } public override void UpdateHUD() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MenuLevel()) { if (Input.GetKeyDown(IRSConfigManager.KeyInfoHud.Value)) { _isHoldingKey = true; StartFade(1f); } if (Input.GetKeyUp(IRSConfigManager.KeyInfoHud.Value)) { _isHoldingKey = false; StartFade(0f); } } } private void StartFade(float targetAlpha) { if (_fadeCoroutine != null) { ((MonoBehaviour)HUDManager.Instance).StopCoroutine(_fadeCoroutine); } _fadeCoroutine = ((MonoBehaviour)HUDManager.Instance).StartCoroutine(FadeHUD(targetAlpha)); } [IteratorStateMachine(typeof(<FadeHUD>d__6))] private IEnumerator FadeHUD(float targetAlpha) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeHUD>d__6(0) { <>4__this = this, targetAlpha = targetAlpha }; } } public class PickupCapacityHUD : BaseHUD { public override void Initialize(RectTransform referenceRect) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_002b: 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_005c: Unknown result type (might be due to invalid IL or missing references) Text = CreateHUDText(referenceRect, new Vector2(referenceRect.anchoredPosition.x + referenceRect.sizeDelta.x, referenceRect.anchoredPosition.y - 100f)); base.OriginalScale = ((Transform)((TMP_Text)Text).rectTransform).localScale; base.OriginalAnchoredPosition = ((TMP_Text)Text).rectTransform.anchoredPosition; } public override void UpdateHUD() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_0042: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MenuLevel()) { Vector2 anchoredPosition = ((TMP_Text)Text).rectTransform.anchoredPosition; anchoredPosition.y = base.OriginalAnchoredPosition.y - (float)IRSConfigManager.HudSlider.Value; ((TMP_Text)Text).rectTransform.anchoredPosition = anchoredPosition; int num = 0; if (StatsManager.instance.playerUpgradeStrength.TryGetValue(PlayerController.instance.playerSteamID, out var value)) { num += value; } string key = ((num <= 3) ? "hud.sl.medium" : "hud.sl.big"); string text = LocalizationManager.Translate(key); ((TMP_Text)Text).text = "<size=65%><color=#FFFFFF>" + text + "</color></size>"; } } } public class StorageHUD : BaseHUD { private StorageManager _storageManager; private int _previousSlotsUsed; public override void Initialize(RectTransform referenceRect) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) _storageManager = ((Component)PlayerController.instance).GetComponent<StorageComponent>().StorageManager; Text = CreateHUDText(referenceRect, new Vector2(referenceRect.anchoredPosition.x + referenceRect.sizeDelta.x, referenceRect.anchoredPosition.y - 60f)); base.OriginalScale = ((Transform)((TMP_Text)Text).rectTransform).localScale; base.OriginalAnchoredPosition = ((TMP_Text)Text).rectTransform.anchoredPosition; } public override void UpdateHUD() { //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) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MenuLevel() && _storageManager != null) { Vector2 anchoredPosition = ((TMP_Text)Text).rectTransform.anchoredPosition; anchoredPosition.y = base.OriginalAnchoredPosition.y - (float)IRSConfigManager.HudSlider.Value; ((TMP_Text)Text).rectTransform.anchoredPosition = anchoredPosition; int slotsUsed = _storageManager.GetSlotsUsed(); int maxStorage = _storageManager.GetMaxStorage(); Color storageColor = GetStorageColor((float)slotsUsed / (float)maxStorage); ((TMP_Text)Text).text = $"<color=#{ColorUtility.ToHtmlStringRGB(storageColor)}>{slotsUsed}<size=80%><sup>/{maxStorage}</sup></size></color>"; if (ShouldFlash(slotsUsed, _previousSlotsUsed)) { HUDManager.Instance.FlashAndPunchBasedOnIncDec(Text, slotsUsed > _previousSlotsUsed); } _previousSlotsUsed = slotsUsed; } } private Color GetStorageColor(float usagePercent) { //IL_001a: 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_0035: 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) if (!(usagePercent >= 0.9f)) { if (!(usagePercent >= 0.75f)) { if (usagePercent >= 0.5f) { return Color.yellow; } return Color.white; } return new Color(1f, 0.5f, 0f); } return Color.red; } private bool ShouldFlash(int newValue, int oldValue) { if (newValue > 0) { if (newValue == oldValue) { return oldValue == 0; } return true; } return false; } } public class ValueHUD : BaseHUD { private StorageManager _storageManager; private int _previousValue; public override void Initialize(RectTransform referenceRect) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) _storageManager = ((Component)PlayerController.instance).GetComponent<StorageComponent>().StorageManager; Text = CreateHUDText(referenceRect, new Vector2(referenceRect.anchoredPosition.x + referenceRect.sizeDelta.x + 50f, referenceRect.anchoredPosition.y - 60f)); base.OriginalScale = ((Transform)((TMP_Text)Text).rectTransform).localScale; base.OriginalAnchoredPosition = ((TMP_Text)Text).rectTransform.anchoredPosition; } public override void UpdateHUD() { //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) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MenuLevel() && _storageManager != null) { Vector2 anchoredPosition = ((TMP_Text)Text).rectTransform.anchoredPosition; anchoredPosition.y = base.OriginalAnchoredPosition.y - (float)IRSConfigManager.HudSlider.Value; ((TMP_Text)Text).rectTransform.anchoredPosition = anchoredPosition; int totalStorageValue = _storageManager.GetTotalStorageValue(); ((TMP_Text)Text).text = $"<size=65%><color=#558B2F>$</color>{totalStorageValue}</size>"; if (ShouldFlash(totalStorageValue, _previousValue)) { HUDManager.Instance.FlashAndPunchBasedOnIncDec(Text, totalStorageValue > _previousValue); } _previousValue = totalStorageValue; } } private bool ShouldFlash(int newValue, int oldValue) { if (newValue > 0) { if (newValue == oldValue) { return oldValue == 0; } return true; } return false; } } } namespace InternalRevenueStorage.Data { [Serializable] public struct RestrictedValuable { public string ItemName; public string CustomMessage; [NonSerialized] public Color MessageColor; public RestrictedValuable(string name, string message, Color color) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) ItemName = name; CustomMessage = message; MessageColor = color; } public RestrictedValuable(string name, string message) : this(name, message, Color.red) { }//IL_0003: Unknown result type (might be due to invalid IL or missing references) } } namespace InternalRevenueStorage.Components { public class StorageComponent : MonoBehaviourPunCallbacks { public readonly StorageManager StorageManager = new StorageManager(); public BagManager _bagManager; public static StorageComponent Instance { get; private set; } private void Awake() { if (((MonoBehaviourPun)this).photonView.IsMine) { Instance = this; } _bagManager = ((Component)this).gameObject.AddComponent<BagManager>(); } private void Update() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 if (IsLocalPlayer()) { if (Input.GetKeyDown(IRSConfigManager.KeyStoreItem.Value) && (int)ChatManager.instance.chatState != 1) { TryStoreHeldItem(); } if (Input.GetKeyDown(IRSConfigManager.KeyDropMoney.Value) && (int)ChatManager.instance.chatState != 1) { TryDropMoneyBag(); } if (Input.GetKeyDown(IRSConfigManager.KeyBlacklistItem.Value) && (int)ChatManager.instance.chatState != 1) { TryBlacklistHeldItem(); } } } private void TryStoreHeldItem() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!_bagManager.CanDropBag()) { StorageManager.SendChatMessage("No. More. Bags.", Color.red); return; } InternalRevenueStorage.Logger.LogInfo((object)"[IRS SC] Storage key pressed - Storing held item"); StorageManager.StoreHeldItem(); } private void TryDropMoneyBag() { if (StorageManager.GetStorageCount() > 0) { InternalRevenueStorage.Logger.LogInfo((object)"[IRS SC] Money key pressed - Dropping money bag"); StorageManager.DropAllAsMoneyBag(); _bagManager.TryIncrementBag(); } } private void TryBlacklistHeldItem() { //IL_0027: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) PhysGrabber instance = PhysGrabber.instance; PhysGrabObject val = instance?.grabbedPhysGrabObject; if ((Object)(object)val == (Object)null) { StorageManager.SendChatMessage("No. Item. Held.", Color.yellow); instance.grabbedPhysGrabObject = null; return; } ValuableObject component = ((Component)val).GetComponent<ValuableObject>(); if ((Object)(object)component == (Object)null) { StorageManager.SendChatMessage("Not. Valuable.", Color.gray); instance.grabbedPhysGrabObject = null; } else if (MoneyBagManager.IsMoneyBag(component)) { StorageManager.SendChatMessage("Why.", Color.yellow); } else { string text = ((Object)component).name.Replace("(Clone)", "").Trim(); ValuableCheckManager.AppendToTempBlacklist(text); StorageManager.SendChatMessage("Blacklisted: " + text, Color.red); } } public void ResetBags() { _bagManager.ResetBags(); } public void UpdateBagLimitBasedOnRunLevel() { _bagManager.UpdateBagLimitBasedOnRunLevel(); } private bool IsLocalPlayer() { PlayerController component = ((Component)this).GetComponent<PlayerController>(); PlayerController instance = PlayerController.instance; return (Object)(object)component == (Object)(object)instance; } [PunRPC] public void RPC_ReceiveUserBlacklist(string json) { try { List<RestrictedValuable> list = JsonConvert.DeserializeObject<List<RestrictedValuable>>(json); if (list == null) { InternalRevenueStorage.Logger.LogWarning((object)"[IRS] Received user blacklist was null."); return; } foreach (RestrictedValuable item in list) { string text = item.ItemName?.Trim(); if (!string.IsNullOrEmpty(text) && !ValuableCheckManager.userBlacklist.ContainsKey(text)) { ValuableCheckManager.userBlacklist[text] = new RestrictedValuable(text, item.CustomMessage); } } InternalRevenueStorage.Logger.LogInfo((object)$"[IRS] Client received user blacklist with {list.Count} entries."); } catch (Exception ex) { InternalRevenueStorage.Logger.LogError((object)("[IRS] Failed to apply received blacklist: " + ex.Message)); } } [PunRPC] public void RPC_SyncBlacklistSettings(bool internalEnabled, bool userEnabled) { ValuableCheckManager.InternalBlacklistEnabled = internalEnabled; ValuableCheckManager.UserBl