Decompiled source of TNHFramework v0.2.2
patchers/OldTweakerDisabler.dll
Decompiled 2 weeks agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BepInEx; using BepInEx.Logging; using Mono.Cecil; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("OldTweakerDisabler")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OldTweakerDisabler")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("86ca37de-2467-4dad-991f-25a8cb18f841")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace TweakerDisabler; public static class Entrypoint { private static readonly ManualLogSource Logger = Logger.CreateLogSource("Deliter"); public static IEnumerable<string> TargetDLLs => Enumerable.Empty<string>(); public static void Patch(AssemblyDefinition asm) { Logger.LogWarning((object)("No DLLs should be patched, but the patch method was called. Assembly: " + (object)asm)); } public static void Initialize() { string[] directories = Directory.GetDirectories(Paths.PluginPath); foreach (string text in directories) { Logger.LogInfo((object)("Found directory " + text)); if (text.Contains("devyndamonster-TakeAndHoldTweaker")) { ModifyTNHTweakerFiles(text); break; } } } public static void ModifyTNHTweakerFiles(string dir) { string text = Path.Combine(dir, "TakeAndHoldTweaker.deli"); string text2 = Path.Combine(dir, "TakeAndHoldTweaker.deli.bak"); string text3 = Path.Combine(dir, "TakeAndHoldTweaker.deli.old"); string text4 = Path.Combine(dir, "TakeAndHoldTweaker.deli.bak.old"); if (File.Exists(text2)) { if (File.Exists(text)) { File.Delete(text2); } else { File.Move(text2, text); } } if (File.Exists(text4)) { if (File.Exists(text3)) { File.Delete(text4); } else { File.Move(text4, text3); } } if (File.Exists(text)) { File.Copy(text, text3, overwrite: true); File.Delete(text); Logger.LogInfo((object)"Disabled old TakeAndHoldTweaker install. To re-enable it, you must disable TNHFramework, and then disable and enable TakeAndHoldFramework"); } } }
plugins/TNHTweaker/TNHFramework.dll
Decompiled 2 weeks 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.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Deli; using Deli.Immediate; using Deli.Setup; using Deli.VFS; using FistVR; using HarmonyLib; using MagazinePatcher; using Microsoft.CodeAnalysis; using OtherLoader; using Stratum; using Stratum.Extensions; using TNHFramework.ObjectTemplates; using TNHFramework.ObjectTemplates.V1; using TNHFramework.Patches; using TNHFramework.Utilities; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using Valve.Newtonsoft.Json; using Valve.Newtonsoft.Json.Converters; using YamlDotNet.Core; using YamlDotNet.Serialization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TakeAndHoldTweaker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TakeAndHoldTweaker")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("13103263-bab2-4450-ae68-23c78eb493b2")] [assembly: AssemblyFileVersion("0.2.2.0")] [assembly: AssemblyVersion("0.2.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TNHFramework { public static class AsyncLoadMonitor { public static List<AnvilCallback<AssetBundle>> CallbackList = new List<AnvilCallback<AssetBundle>>(); public static float GetProgress() { if (CallbackList.Count == 0) { return 1f; } float num = 0f; for (int num2 = CallbackList.Count - 1; num2 >= 0; num2--) { if (((AnvilCallbackBase)CallbackList[num2]).IsCompleted) { CallbackList.RemoveAt(num2); } else { num += ((AnvilCallbackBase)CallbackList[num2]).Progress; } } return num / (float)CallbackList.Count; } } public class SosigLinkLootWrapper : MonoBehaviour { public TNH_Manager M; public global::TNHFramework.ObjectTemplates.CustomCharacter character; public global::TNHFramework.ObjectTemplates.EquipmentGroup group; public bool dontDrop; public bool shouldDropOnCleanup; private void OnDestroy() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_018d: Unknown result type (might be due to invalid IL or missing references) if (dontDrop) { return; } TNHFrameworkLogger.Log("Lootable link was destroyed!", TNHFrameworkLogger.LogType.TNH); List<global::TNHFramework.ObjectTemplates.EquipmentGroup> spawnedEquipmentGroups = group.GetSpawnedEquipmentGroups(); string text = null; int num = 0; string text2 = default(string); foreach (global::TNHFramework.ObjectTemplates.EquipmentGroup item in spawnedEquipmentGroups) { for (int i = 0; i < item.ItemsToSpawn; i++) { if (item.IsCompatibleMagazine) { FVRObject ammoContainerForEquipped = FirearmUtils.GetAmmoContainerForEquipped(item.MinAmmoCapacity, item.MaxAmmoCapacity, character.GlobalObjectBlacklist, character.GetMagazineBlacklist()); if ((Object)(object)ammoContainerForEquipped != (Object)null) { text = ammoContainerForEquipped.ItemID; } else { TNHFrameworkLogger.Log("Spawning nothing since group was compatible magazines, and could not find a compatible magazine for player", TNHFrameworkLogger.LogType.TNH); } } else { List<string> objects = item.GetObjects(); if (objects.Count == 0) { TNHFrameworkLogger.Log("Spawning nothing since group was empty", TNHFrameworkLogger.LogType.TNH); } else { text = objects.GetRandom(); } } if (!Utility.IsNullOrWhiteSpace(text)) { if (LoadedTemplateManager.LoadedVaultFiles.ContainsKey(text)) { TNHFrameworkLogger.Log("Spawning vault file " + text, TNHFrameworkLogger.LogType.TNH); Transform transform = ((Component)this).transform; transform.position = ((Component)this).transform.position + Vector3.up * 0.1f * (float)num; VaultSystem.SpawnVaultFile(LoadedTemplateManager.LoadedVaultFiles[text], transform, true, false, false, ref text2, Vector3.zero, (ReturnObjectListDelegate)null, false); } else if (LoadedTemplateManager.LoadedLegacyVaultFiles.ContainsKey(text)) { TNHFrameworkLogger.Log("Spawning legacy vault file " + text, TNHFrameworkLogger.LogType.TNH); AnvilManager.Run(TNHFrameworkUtils.SpawnFirearm(LoadedTemplateManager.LoadedLegacyVaultFiles[text], ((Component)this).transform.position + Vector3.up * 0.1f * (float)num, ((Component)this).transform.rotation, M)); } else { TNHFrameworkLogger.Log("Spawning item " + text, TNHFrameworkLogger.LogType.TNH); GameObject val = Object.Instantiate<GameObject>(((AnvilAsset)IM.OD[text]).GetGameObject(), ((Component)this).transform.position + Vector3.up * 0.1f * (float)num, ((Component)this).transform.rotation); M.AddObjectToTrackedList(val); } num++; } } } } } public class DebugPatches { [HarmonyPatch(typeof(TNH_Manager), "Start")] [HarmonyPrefix] public static void AddPointDebugText(TNH_Manager __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0035: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) foreach (TNH_HoldPoint holdPoint in __instance.HoldPoints) { TNHFrameworkLogger.Log("Adding text!", TNHFrameworkLogger.LogType.TNH); GameObject val = new GameObject("Canvas"); val.transform.rotation = Quaternion.LookRotation(Vector3.right); val.transform.position = holdPoint.SpawnPoint_SystemNode.position + Vector3.up * 0.2f; Canvas obj = val.AddComponent<Canvas>(); RectTransform component = ((Component)obj).GetComponent<RectTransform>(); obj.renderMode = (RenderMode)2; component.sizeDelta = new Vector2(1f, 1f); GameObject val2 = new GameObject("Text"); val2.transform.SetParent(val.transform); val2.transform.rotation = val.transform.rotation; val2.transform.localPosition = Vector3.zero; val2.AddComponent<CanvasRenderer>(); Text obj2 = val2.AddComponent<Text>(); Font font = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf"); obj2.text = "Hold " + __instance.HoldPoints.IndexOf(holdPoint); obj2.alignment = (TextAnchor)4; obj2.fontSize = 32; val2.transform.localScale = new Vector3(0.0015f, 0.0015f, 0.0015f); obj2.font = font; obj2.horizontalOverflow = (HorizontalWrapMode)1; } } } public class SosigLoaderDeli { public void LoadAsset(SetupStage stage, Mod mod, IHandle handle) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown IFileHandle val = (IFileHandle)(object)((handle is IFileHandle) ? handle : null); if (val == null) { throw new ArgumentException("Could not load sosig! Make sure you're pointing to a sosig template json file in the manifest"); } try { string text = ((Stage)stage).ImmediateReaders.Get<string>().Invoke(val); JsonSerializerSettings val2 = new JsonSerializerSettings { NullValueHandling = (NullValueHandling)1 }; SosigTemplate sosigTemplate = JsonConvert.DeserializeObject<SosigTemplate>(text, val2); TNHFrameworkLogger.Log("Sosig loaded successfully : " + sosigTemplate.DisplayName, TNHFrameworkLogger.LogType.General); LoadedTemplateManager.AddSosigTemplate(sosigTemplate); } catch (Exception ex) { TNHFrameworkLogger.LogError("Failed to load setup assets for sosig file! Caused Error: " + ex.ToString()); } } } public class CharacterLoaderDeli { public void LoadAsset(SetupStage stage, Mod mod, IHandle handle) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown IDirectoryHandle val = (IDirectoryHandle)(object)((handle is IDirectoryHandle) ? handle : null); if (val == null) { throw new ArgumentException("Could not load character! Character should point to a folder holding the character.json and thumb.png"); } try { global::TNHFramework.ObjectTemplates.V1.CustomCharacter customCharacter = null; Sprite val2 = null; foreach (IFileHandle file in ExtIDirectoryHandle.GetFiles(val)) { if (((IHandle)file).Path.EndsWith("character.json")) { string text = ((Stage)stage).ImmediateReaders.Get<string>().Invoke(file); JsonSerializerSettings val3 = new JsonSerializerSettings { NullValueHandling = (NullValueHandling)1 }; customCharacter = JsonConvert.DeserializeObject<global::TNHFramework.ObjectTemplates.V1.CustomCharacter>(text, val3); } else if (((IHandle)file).Path.EndsWith("thumb.png")) { val2 = TNHFrameworkUtils.LoadSprite(file); } } if (customCharacter == null) { TNHFrameworkLogger.LogError("Failed to load custom character! No character.json file found"); return; } if ((Object)(object)val2 == (Object)null) { TNHFrameworkLogger.LogError("Failed to load custom character! No thumb.png file found"); return; } foreach (IFileHandle file2 in ExtIDirectoryHandle.GetFiles(val)) { foreach (global::TNHFramework.ObjectTemplates.V1.EquipmentPool equipmentPool in customCharacter.EquipmentPools) { if (((IHandle)file2).Path.Split(new char[1] { '/' }).Last() == equipmentPool.IconName) { equipmentPool.GetPoolEntry().TableDef.Icon = TNHFrameworkUtils.LoadSprite(file2); } } } TNHFrameworkLogger.Log("Character loaded successfully : " + customCharacter.DisplayName, TNHFrameworkLogger.LogType.General); LoadedTemplateManager.AddCharacterTemplate(new global::TNHFramework.ObjectTemplates.CustomCharacter(customCharacter), val2); } catch (Exception ex) { TNHFrameworkLogger.LogError("Failed to load setup assets for character! Caused Error: " + ex.ToString()); } } } public class VaultFileLoaderDeli { public void LoadAsset(SetupStage stage, Mod mod, IHandle handle) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown IFileHandle val = (IFileHandle)(object)((handle is IFileHandle) ? handle : null); if (val == null) { throw new ArgumentException("Could not load vault file! Make sure you're pointing to a vault json file in the manifest"); } try { string text = ((Stage)stage).ImmediateReaders.Get<string>().Invoke(val); JsonSerializerSettings val2 = new JsonSerializerSettings { NullValueHandling = (NullValueHandling)1 }; SavedGunSerializable savedGunSerializable = JsonConvert.DeserializeObject<SavedGunSerializable>(text, val2); TNHFrameworkLogger.Log("Vault file loaded successfully : " + savedGunSerializable.FileName, TNHFrameworkLogger.LogType.General); LoadedTemplateManager.AddVaultFile(savedGunSerializable); } catch (Exception ex) { TNHFrameworkLogger.LogError("Failed to load setup assets for vault file! Caused Error: " + ex.ToString()); } } } public static class TNHMenuInitializer { [CompilerGenerated] private sealed class <InitializeTNHMenuAsync>d__3 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SceneLoader hotdog; public Text itemsText; public Text progressText; public TNH_CharacterDatabase CharDatabase; public bool outputFiles; public string path; public TNH_UIManager instance; public List<CharacterCategory> Categories; private bool <isOtherLoaderLoaded>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializeTNHMenuAsync>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; ((Component)hotdog).gameObject.SetActive(false); try { PokeOtherloader(); <isOtherLoaderLoaded>5__2 = true; } catch { <isOtherLoaderLoaded>5__2 = false; TNHFrameworkLogger.LogWarning("OtherLoader not found. If you are using OtherLoader, please ensure you have version 0.1.6 or later!"); } float num2 = 0f; goto IL_005b; } case 1: { <>1__state = -1; float num2 = AsyncLoadMonitor.GetProgress(); if (<isOtherLoaderLoaded>5__2) { num2 = Mathf.Min(num2, GetOtherLoaderProgress()); itemsText.text = GetLoadingItems(); } progressText.text = $"LOADING ITEMS : {num2 * 100f:0.0}%"; if (num2 < 1f) { goto IL_005b; } bool flag; try { PokeMagPatcher(); flag = true; TNHFrameworkLogger.LogWarning("MagazinePatcher is detected."); } catch { flag = false; TNHFrameworkLogger.LogWarning("MagazinePatcher not found."); } if (!flag) { if (TNHFramework.InternalMagPatcher.Value) { TNHFrameworkLogger.Log($"[{DateTime.Now:HH:mm:ss}] Internal Mag Patcher started!", TNHFrameworkLogger.LogType.General); InternalMagPatcher(); TNHFrameworkLogger.Log($"[{DateTime.Now:HH:mm:ss}] Internal Mag Patcher finished!", TNHFrameworkLogger.LogType.General); } break; } goto IL_00ec; } case 2: { <>1__state = -1; float num = PokeMagPatcher(); itemsText.text = GetMagPatcherCacheLog(); progressText.text = $"CACHING ITEMS : {num * 100f:0.0}%"; if (!(num < 1f)) { break; } goto IL_00ec; } IL_00ec: <>2__current = null; <>1__state = 2; return true; IL_005b: <>2__current = null; <>1__state = 1; return true; } LoadTNHTemplates(CharDatabase); SavedCharacters = CharDatabase.Characters; if (outputFiles) { CreateTNHFiles(path); } RefreshTNHUI(instance, Categories, CharDatabase); itemsText.text = ""; progressText.text = ""; ((Component)hotdog).gameObject.SetActive(true); TNHInitialized = 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(); } } public static bool TNHInitialized; public static bool MagazineCacheFailed; public static List<TNH_CharacterDef> SavedCharacters; public static IEnumerator InitializeTNHMenuAsync(string path, Text progressText, Text itemsText, SceneLoader hotdog, List<CharacterCategory> Categories, TNH_CharacterDatabase CharDatabase, TNH_UIManager instance, bool outputFiles) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializeTNHMenuAsync>d__3(0) { path = path, progressText = progressText, itemsText = itemsText, hotdog = hotdog, Categories = Categories, CharDatabase = CharDatabase, instance = instance, outputFiles = outputFiles }; } public static void InternalMagPatcher() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Invalid comparison between Unknown and I4 //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Invalid comparison between Unknown and I4 //IL_012c: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025b: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Invalid comparison between Unknown and I4 //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Invalid comparison between Unknown and I4 //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) List<FVRObject> list = new List<FVRObject>(); foreach (KeyValuePair<string, FVRObject> item in IM.OD) { if ((int)item.Value.Category == 1) { list.Add(item.Value); } else if ((int)item.Value.Category == 4) { if (!TNHFramework.CartridgeDictionary.ContainsKey(item.Value.RoundType)) { TNHFramework.CartridgeDictionary.Add(item.Value.RoundType, new List<FVRObject>()); } TNHFramework.CartridgeDictionary[item.Value.RoundType].Add(item.Value); } else if ((int)item.Value.Category == 2) { if (!TNHFramework.MagazineDictionary.ContainsKey(item.Value.MagazineType)) { TNHFramework.MagazineDictionary.Add(item.Value.MagazineType, new List<FVRObject>()); } TNHFramework.MagazineDictionary[item.Value.MagazineType].Add(item.Value); } else if ((int)item.Value.Category == 3) { if (!TNHFramework.StripperDictionary.ContainsKey(item.Value.ClipType)) { TNHFramework.StripperDictionary.Add(item.Value.ClipType, new List<FVRObject>()); } TNHFramework.StripperDictionary[item.Value.ClipType].Add(item.Value); } else if ((int)item.Value.Category == 6) { if (!TNHFramework.SpeedloaderDictionary.ContainsKey(item.Value.RoundType)) { TNHFramework.SpeedloaderDictionary.Add(item.Value.RoundType, new List<FVRObject>()); } if (item.Value.ItemID == "Speedloader12gauge_5Shot") { item.Value.MagazineCapacity = 5; } TNHFramework.SpeedloaderDictionary[item.Value.RoundType].Add(item.Value); } } foreach (FVRObject item2 in list) { FVRFireArm val = null; FireArmClipType clipType = item2.ClipType; FireArmRoundType roundType = item2.RoundType; FireArmMagazineType magazineType = item2.MagazineType; int num = item2.MagazineCapacity; if (!ValidFireArm(roundType, clipType, magazineType, 0)) { if (!item2.IsModContent && (int)item2.TagFirearmAction == 8 && item2.TagFirearmFeedOption.Contains((OTagFirearmFeedOption)1)) { continue; } TNHFrameworkLogger.Log($"Loading firearm {item2.DisplayName} [Mod = {item2.IsModContent}]", TNHFrameworkLogger.LogType.General); GameObject gameObject = ((AnvilAsset)item2).GetGameObject(); if ((Object)(object)gameObject != (Object)null) { val = gameObject.GetComponent<FVRFireArm>(); } if ((Object)(object)val != (Object)null) { roundType = val.RoundType; magazineType = val.MagazineType; clipType = val.ClipType; } } if (!ValidFireArm(roundType, clipType, magazineType, num)) { TNHFrameworkLogger.Log("Firearm " + item2.DisplayName + " skipped!", TNHFrameworkLogger.LogType.General); continue; } if ((item2.CompatibleSingleRounds == null || item2.CompatibleSingleRounds.Count == 0) && TNHFramework.CartridgeDictionary.ContainsKey(roundType)) { TNHFrameworkLogger.Log($"Giving firearm {item2.DisplayName} new rounds of type {roundType}", TNHFrameworkLogger.LogType.General); item2.CompatibleSingleRounds = TNHFramework.CartridgeDictionary[roundType]; } if ((item2.CompatibleMagazines == null || item2.CompatibleMagazines.Count == 0) && TNHFramework.MagazineDictionary.ContainsKey(magazineType) && (int)magazineType != 0) { TNHFrameworkLogger.Log($"Giving firearm {item2.DisplayName} new magazines of type {magazineType}", TNHFrameworkLogger.LogType.General); item2.CompatibleMagazines = TNHFramework.MagazineDictionary[magazineType]; } if ((item2.CompatibleClips == null || item2.CompatibleClips.Count == 0) && TNHFramework.StripperDictionary.ContainsKey(clipType) && (int)clipType != 0) { TNHFrameworkLogger.Log($"Giving firearm {item2.DisplayName} new clips of type {clipType}", TNHFrameworkLogger.LogType.General); item2.CompatibleClips = TNHFramework.StripperDictionary[clipType]; } if ((item2.CompatibleSpeedLoaders != null && item2.CompatibleSpeedLoaders.Count != 0) || (int)item2.TagFirearmAction != 3) { continue; } if ((Object)(object)val == (Object)null) { GameObject gameObject2 = ((AnvilAsset)item2).GetGameObject(); if ((Object)(object)gameObject2 != (Object)null) { val = gameObject2.GetComponent<FVRFireArm>(); } } if ((Object)(object)val != (Object)null) { roundType = val.RoundType; Revolver component = ((Component)val).gameObject.GetComponent<Revolver>(); if ((Object)(object)component != (Object)null) { num = component.Chambers.Length; } } if (!TNHFramework.SpeedloaderDictionary.ContainsKey(roundType)) { continue; } foreach (FVRObject item3 in TNHFramework.SpeedloaderDictionary[roundType]) { if (item3.MagazineCapacity == num) { TNHFrameworkLogger.Log($"Giving firearm {item2.DisplayName} new speedloader of type {roundType}", TNHFrameworkLogger.LogType.General); item2.CompatibleSpeedLoaders.Add(item3); } } } } public static bool ValidFireArm(FireArmRoundType roundType, FireArmClipType clipType, FireArmMagazineType magazineType, int magazineCapacity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if ((int)roundType == 0 && (int)magazineType == 0 && magazineCapacity == 0) { return (int)clipType > 0; } return true; } public static void PokeOtherloader() { LoaderStatus.GetLoaderProgress(); _ = LoaderStatus.LoadingItems; } public static float PokeMagPatcher() { return PatcherStatus.PatcherProgress; } public static string GetMagPatcherCacheLog() { return PatcherStatus.CacheLog; } public static float GetOtherLoaderProgress() { return LoaderStatus.GetLoaderProgress(); } public static string GetLoadingItems() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) List<string> loadingItems = LoaderStatus.LoadingItems; for (int i = 0; i < loadingItems.Count; i++) { string text = ColorUtility.ToHtmlStringRGBA(new Color(0.5f, 0.5f, 0.5f, Mathf.Clamp(((float)loadingItems.Count - (float)i) / (float)loadingItems.Count, 0f, 1f))); loadingItems[i] = "<color=#" + text + ">Loading Assets (" + loadingItems[i] + ")</color>"; } loadingItems.Reverse(); return string.Join("\n", loadingItems.ToArray()); } public static void LoadTNHTemplates(TNH_CharacterDatabase CharDatabase) { TNHFrameworkLogger.Log("Performing TNH Initialization", TNHFrameworkLogger.LogType.General); TNHFrameworkLogger.Log("Adding default sosigs to template dictionary", TNHFrameworkLogger.LogType.General); LoadDefaultSosigs(); TNHFrameworkLogger.Log("Adding default characters to template dictionary", TNHFrameworkLogger.LogType.General); LoadDefaultCharacters(CharDatabase.Characters); LoadedTemplateManager.DefaultIconSprites = TNHFrameworkUtils.GetAllIcons(LoadedTemplateManager.DefaultCharacters); TNHFrameworkLogger.Log("Delayed Init of default characters", TNHFrameworkLogger.LogType.General); InitCharacters(LoadedTemplateManager.DefaultCharacters); TNHFrameworkLogger.Log("Delayed Init of custom characters", TNHFrameworkLogger.LogType.General); InitCharacters(LoadedTemplateManager.CustomCharacters); TNHFrameworkLogger.Log("Delayed Init of custom sosigs", TNHFrameworkLogger.LogType.General); InitSosigs(LoadedTemplateManager.CustomSosigs); } public static void CreateTNHFiles(string path) { TNHFrameworkLogger.Log("Creating character creation files", TNHFrameworkLogger.LogType.General); TNHFrameworkUtils.CreateSosigTemplateFiles(LoadedTemplateManager.DefaultSosigs, path); TNHFrameworkUtils.CreateSosigTemplateFiles(LoadedTemplateManager.CustomSosigs, path); TNHFrameworkUtils.CreateCharacterFiles(LoadedTemplateManager.DefaultCharacters, path, isCustom: false); TNHFrameworkUtils.CreateCharacterFiles(LoadedTemplateManager.CustomCharacters, path, isCustom: true); TNHFrameworkUtils.CreateIconIDFile(path, LoadedTemplateManager.DefaultIconSprites.Keys.ToList()); TNHFrameworkUtils.CreateObjectIDFile(path); TNHFrameworkUtils.CreateSosigIDFile(path); TNHFrameworkUtils.CreateJsonVaultFiles(path); TNHFrameworkUtils.CreateGeneratedTables(path); TNHFrameworkUtils.CreatePopulatedCharacterTemplate(path); } private static void LoadDefaultSosigs() { foreach (SosigEnemyTemplate value in ManagerSingleton<IM>.Instance.odicSosigObjsByID.Values) { LoadedTemplateManager.AddSosigTemplate(value); } } private static void LoadDefaultCharacters(List<TNH_CharacterDef> characters) { foreach (TNH_CharacterDef character in characters) { LoadedTemplateManager.AddCharacterTemplate(character); } } private static void InitCharacters(List<global::TNHFramework.ObjectTemplates.CustomCharacter> characters) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) for (int num = characters.Count - 1; num >= 0; num--) { global::TNHFramework.ObjectTemplates.CustomCharacter character = characters[num]; try { character.DelayedInit(); } catch (Exception ex) { TNHFrameworkLogger.LogError("Failed to load character: " + character.DisplayName + ". Error Output:\n" + ex.ToString()); characters.RemoveAt(num); CharacterTemplate value = LoadedTemplateManager.LoadedCharacterDict.Single((KeyValuePair<TNH_Char, CharacterTemplate> o) => o.Value.Custom == character).Value; LoadedTemplateManager.LoadedCharacterDict.Remove(value.Def.CharacterID); } } } private static void InitSosigs(List<SosigTemplate> sosigs) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < sosigs.Count; i++) { SosigTemplate sosig = sosigs[i]; try { sosig.DelayedInit(); } catch (Exception ex) { TNHFrameworkLogger.LogError("Failed to load sosig: " + sosig.DisplayName + ". Error Output:\n" + ex.ToString()); KeyValuePair<TNH_Char, CharacterTemplate>[] array = LoadedTemplateManager.LoadedCharacterDict.Where((KeyValuePair<TNH_Char, CharacterTemplate> o) => o.Value.Custom.CharacterUsesSosig(sosig.SosigEnemyID)).ToArray(); for (int j = 0; j < array.Length; j++) { KeyValuePair<TNH_Char, CharacterTemplate> keyValuePair = array[j]; TNHFrameworkLogger.LogError("Removing character that used removed sosig: " + keyValuePair.Value.Custom.DisplayName); LoadedTemplateManager.LoadedCharacterDict.Remove(keyValuePair.Key); } } } } public static void RefreshTNHUI(TNH_UIManager instance, List<CharacterCategory> Categories, TNH_CharacterDatabase CharDatabase) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected I4, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected I4, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) TNHFrameworkLogger.Log("Refreshing TNH UI", TNHFrameworkLogger.LogType.General); foreach (KeyValuePair<TNH_Char, CharacterTemplate> item in LoadedTemplateManager.LoadedCharacterDict) { bool flag = false; foreach (CharacterCategory Category in Categories) { if (Category.CategoryName == item.Value.Custom.CategoryData.Name) { flag = true; break; } } if (!flag) { Categories.Insert(item.Value.Custom.CategoryData.Priority, new CharacterCategory { CategoryName = item.Value.Custom.CategoryData.Name, Characters = new List<TNH_Char>() }); } if (!Categories[(int)item.Value.Def.Group].Characters.Contains(item.Key)) { Categories[(int)item.Value.Def.Group].Characters.Add(item.Key); CharDatabase.Characters.Add(item.Value.Def); } } Traverse obj = Traverse.Create((object)instance); int num = (int)obj.Field("m_selectedCategory").GetValue(); int selectedButton = (int)obj.Field("m_selectedCharacter").GetValue(); obj.Method("SetSelectedCategory", new object[1] { num }).GetValue(); instance.OBS_CharCategory.SetSelectedButton(selectedButton); } } public class CharacterTemplate { public TNH_CharacterDef Def; public global::TNHFramework.ObjectTemplates.CustomCharacter Custom; public CharacterTemplate(TNH_CharacterDef def, global::TNHFramework.ObjectTemplates.CustomCharacter custom) { Def = def; Custom = custom; } } public static class LoadedTemplateManager { public static global::TNHFramework.ObjectTemplates.CustomCharacter CurrentCharacter; public static Dictionary<TNH_Char, CharacterTemplate> LoadedCharacterDict = new Dictionary<TNH_Char, CharacterTemplate>(); public static Dictionary<SosigEnemyTemplate, SosigTemplate> LoadedSosigsDict = new Dictionary<SosigEnemyTemplate, SosigTemplate>(); public static Dictionary<PoolEntry, global::TNHFramework.ObjectTemplates.EquipmentPool> EquipmentPoolDictionary = new Dictionary<PoolEntry, global::TNHFramework.ObjectTemplates.EquipmentPool>(); public static Dictionary<string, VaultFile> LoadedVaultFiles = new Dictionary<string, VaultFile>(); public static Dictionary<string, SavedGunSerializable> LoadedLegacyVaultFiles = new Dictionary<string, SavedGunSerializable>(); public static List<global::TNHFramework.ObjectTemplates.CustomCharacter> CustomCharacters = new List<global::TNHFramework.ObjectTemplates.CustomCharacter>(); public static List<global::TNHFramework.ObjectTemplates.CustomCharacter> DefaultCharacters = new List<global::TNHFramework.ObjectTemplates.CustomCharacter>(); public static List<SosigTemplate> CustomSosigs = new List<SosigTemplate>(); public static List<SosigEnemyTemplate> DefaultSosigs = new List<SosigEnemyTemplate>(); public static Dictionary<string, int> SosigIDDict = new Dictionary<string, int>(); public static int NewSosigID = 30000; public static int NewCharacterID = 1000; public static Dictionary<string, Sprite> DefaultIconSprites = new Dictionary<string, Sprite>(); public static void AddSosigTemplate(SosigTemplate template) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) template.Validate(); SosigEnemyTemplate sosigEnemyTemplate = template.GetSosigEnemyTemplate(); if (!SosigIDDict.ContainsKey(template.SosigEnemyID)) { SosigIDDict.Add(template.SosigEnemyID, NewSosigID); NewSosigID++; sosigEnemyTemplate.SosigEnemyID = (SosigEnemyID)SosigIDDict[template.SosigEnemyID]; CustomSosigs.Add(template); LoadedSosigsDict.Add(sosigEnemyTemplate, template); TNHFrameworkLogger.Log("Sosig added successfully : " + template.DisplayName, TNHFrameworkLogger.LogType.Character); } else { TNHFrameworkLogger.LogError("Loaded sosig had same SosigEnemyID as another sosig -- SosigEnemyID : " + template.SosigEnemyID); } } public static void AddSosigTemplate(SosigEnemyTemplate realTemplate) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown SosigTemplate sosigTemplate = new SosigTemplate(realTemplate); if (!SosigIDDict.ContainsKey(sosigTemplate.SosigEnemyID)) { SosigIDDict.Add(sosigTemplate.SosigEnemyID, (int)realTemplate.SosigEnemyID); DefaultSosigs.Add(realTemplate); LoadedSosigsDict.Add(realTemplate, sosigTemplate); TNHFrameworkLogger.Log("Sosig added successfully : " + sosigTemplate.DisplayName, TNHFrameworkLogger.LogType.Character); } else { TNHFrameworkLogger.LogError("Loaded sosig had same SosigEnemyID as another sosig -- SosigEnemyID : " + sosigTemplate.SosigEnemyID); } } public static void AddCharacterTemplate(global::TNHFramework.ObjectTemplates.CustomCharacter template, Sprite thumbnail) { template.isCustom = true; template.Validate(); CustomCharacters.Add(template); LoadedCharacterDict.Add((TNH_Char)NewCharacterID, new CharacterTemplate(template.GetCharacter(NewCharacterID, thumbnail), template)); NewCharacterID++; foreach (global::TNHFramework.ObjectTemplates.EquipmentPool equipmentPool in template.EquipmentPools) { EquipmentPoolDictionary.Add(equipmentPool.GetPoolEntry(), equipmentPool); } TNHFrameworkLogger.Log($"Character added successfully ({NewCharacterID - 1}) : " + template.DisplayName, TNHFrameworkLogger.LogType.Character); } public static void AddCharacterTemplate(TNH_CharacterDef realTemplate) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) global::TNHFramework.ObjectTemplates.CustomCharacter customCharacter = new global::TNHFramework.ObjectTemplates.CustomCharacter(realTemplate); DefaultCharacters.Add(customCharacter); LoadedCharacterDict.Add(realTemplate.CharacterID, new CharacterTemplate(realTemplate, customCharacter)); foreach (global::TNHFramework.ObjectTemplates.EquipmentPool equipmentPool in customCharacter.EquipmentPools) { if (!EquipmentPoolDictionary.ContainsKey(equipmentPool.GetPoolEntry())) { EquipmentPoolDictionary.Add(equipmentPool.GetPoolEntry(), equipmentPool); } } TNHFrameworkLogger.Log($"Character added successfully ({realTemplate.CharacterID}) : " + realTemplate.DisplayName, TNHFrameworkLogger.LogType.Character); } public static void AddVaultFile(VaultFile template) { if (!LoadedVaultFiles.ContainsKey(template.FileName)) { LoadedVaultFiles.Add(template.FileName, template); } } public static void AddVaultFile(SavedGunSerializable template) { template.Validate(); if (!LoadedLegacyVaultFiles.ContainsKey(template.FileName)) { LoadedLegacyVaultFiles.Add(template.FileName, template); } } } public enum PanelType { MagDuplicator, Recycler, AmmoReloader, MagUpgrader, AddFullAuto, AmmoPurchase, FireRateUp, FireRateDown, MagPurchase } public class MagazinePanel : MonoBehaviour { public TNH_MagDuplicator original; public Dictionary<string, MagazineBlacklistEntry> blacklist; public int DupeCost = 2; public int UpgradeCost = 3; public int PurchaseCost = 2; private int numTokensSelected; public static Sprite background; private TNH_ObjectConstructorIcon DupeIcon; private TNH_ObjectConstructorIcon UpgradeIcon; private TNH_ObjectConstructorIcon PurchaseIcon; private Text priceText_0; private Text priceText_1; private Text priceText_2; private FVRPhysicalObject selectedObject; private FVRFireArmMagazine detectedMag; private Speedloader detectedSpeedLoader; private FVRObject purchaseMag; private FVRObject upgradeMag; private Collider[] colBuffer = (Collider[])(object)new Collider[50]; private readonly MethodInfo miUpdateIconDisplay = typeof(TNH_ObjectConstructorIcon).GetMethod("UpdateIconDisplay", BindingFlags.Instance | BindingFlags.NonPublic); public void Awake() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown original = ((Component)this).gameObject.GetComponent<TNH_MagDuplicator>(); if ((Object)(object)original == (Object)null) { TNHFrameworkLogger.LogError("Mag Upgrader failed, original Mag Duplicator was null!"); } ((Behaviour)original).enabled = false; blacklist = LoadedTemplateManager.CurrentCharacter.GetMagazineBlacklist(); InitPanel(); UpdateIcons(); original.M.TokenCountChangeEvent += new TokenCountChange(UpdateTokenDisplay); } private void OnDestroy() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if ((Object)(object)original.M != (Object)null) { original.M.TokenCountChangeEvent -= new TokenCountChange(UpdateTokenDisplay); } } private void InitPanel() { //IL_0071: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) ((Component)((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas/AmmoReloaderTitle (3)")).gameObject.GetComponent<Text>().text = "-- Mag Dupe / Upgrade / Buy --"; Transform val = ((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas/Backing"); Transform val2 = ((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas"); Transform val3 = val2.Find("Icon_0"); val3.localPosition = new Vector3(-270f, -200f, 0f); Transform val4 = val2.Find("Icon_1"); val4.localPosition = new Vector3(0f, -200f, 0f); Transform transform = Object.Instantiate<GameObject>(((Component)val4).gameObject, val2).transform; transform.localPosition = new Vector3(275f, -200f, 0f); Transform obj = ((Component)original).transform.Find("PointableButton_0"); obj.position = val3.position; Transform val5 = ((Component)original).transform.Find("PointableButton_1"); val5.position = val4.position; Transform transform2 = Object.Instantiate<GameObject>(((Component)val5).gameObject, val5.parent).transform; transform2.position = transform.position; ((Component)val).gameObject.GetComponent<Image>().sprite = background; DupeIcon = ((Component)val3).gameObject.GetComponent<TNH_ObjectConstructorIcon>(); UpgradeIcon = ((Component)val4).gameObject.GetComponent<TNH_ObjectConstructorIcon>(); PurchaseIcon = ((Component)transform).gameObject.GetComponent<TNH_ObjectConstructorIcon>(); Button component = ((Component)obj).gameObject.GetComponent<Button>(); component.onClick = new ButtonClickedEvent(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { DupeMagButton(); }); Button component2 = ((Component)val5).gameObject.GetComponent<Button>(); component2.onClick = new ButtonClickedEvent(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { UpgradeMagButton(); }); Button component3 = ((Component)transform2).gameObject.GetComponent<Button>(); component3.onClick = new ButtonClickedEvent(); ((UnityEvent)component3.onClick).AddListener((UnityAction)delegate { PurchaseMagButton(); }); priceText_0 = AddPriceText(val3, new Vector3(-235f, 155f, 0f)); priceText_1 = AddPriceText(val4, new Vector3(40f, 155f, 0f)); priceText_2 = AddPriceText(transform, new Vector3(355f, 150f, 0f)); priceText_2.alignment = (TextAnchor)3; priceText_0.text = "x" + DupeCost; priceText_1.text = "x" + UpgradeCost; priceText_2.text = "x" + PurchaseCost; } private Text AddPriceText(Transform iconTransform, Vector3 localPosition) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0023: 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_0057: 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_006c: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PriceCanvas"); val.transform.SetParent(iconTransform.parent); val.transform.rotation = iconTransform.rotation; val.transform.localPosition = localPosition; Canvas obj = val.AddComponent<Canvas>(); RectTransform component = ((Component)obj).GetComponent<RectTransform>(); obj.renderMode = (RenderMode)2; component.sizeDelta = new Vector2(1f, 1f); GameObject val2 = new GameObject("Text"); val2.transform.SetParent(val.transform); val2.transform.rotation = val.transform.rotation; val2.transform.localPosition = Vector3.zero; val2.AddComponent<CanvasRenderer>(); Text obj2 = val2.AddComponent<Text>(); Font font = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf"); obj2.text = "x?"; obj2.alignment = (TextAnchor)4; obj2.fontSize = 30; obj2.fontStyle = (FontStyle)1; val2.transform.localScale = new Vector3(0.0015f, 0.0015f, 0.0015f); obj2.font = font; obj2.horizontalOverflow = (HorizontalWrapMode)1; return obj2; } private void DupeMagButton() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_00c1: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)detectedMag == (Object)null && (Object)(object)detectedSpeedLoader == (Object)null) || original.M.GetNumTokens() < DupeCost) { SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Fail, ((Component)this).transform.position); return; } SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Spawn, ((Component)this).transform.position); original.M.SubtractTokens(DupeCost); if ((Object)(object)detectedMag != (Object)null) { FirearmUtils.SpawnDuplicateMagazine(original.M, detectedMag, original.Spawnpoint_Mag.position, original.Spawnpoint_Mag.rotation); } else { FirearmUtils.SpawnDuplicateSpeedloader(original.M, detectedSpeedLoader, original.Spawnpoint_Mag.position, original.Spawnpoint_Mag.rotation); } ClearSelection(); UpdateIcons(); } private void UpgradeMagButton() { //IL_0039: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)upgradeMag == (Object)null || original.M.GetNumTokens() < UpgradeCost) { SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Fail, ((Component)this).transform.position); return; } SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Spawn, ((Component)this).transform.position); original.M.SubtractTokens(UpgradeCost); Object.Destroy((Object)(object)((FVRInteractiveObject)detectedMag).GameObject); Object.Instantiate<GameObject>(((AnvilAsset)upgradeMag).GetGameObject(), original.Spawnpoint_Mag.position, original.Spawnpoint_Mag.rotation); ClearSelection(); UpdateIcons(); } private void PurchaseMagButton() { //IL_0039: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)purchaseMag == (Object)null || original.M.GetNumTokens() < PurchaseCost) { SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Fail, ((Component)this).transform.position); return; } SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Spawn, ((Component)this).transform.position); original.M.SubtractTokens(PurchaseCost); Object.Instantiate<GameObject>(((AnvilAsset)purchaseMag).GetGameObject(), original.Spawnpoint_Mag.position, original.Spawnpoint_Mag.rotation); ClearSelection(); UpdateIcons(); } private void Update() { //IL_000b: 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) if (Vector3.Distance(original.ScanningVolume.position, ((Component)GM.CurrentPlayerBody.Head).transform.position) < 2f) { Scan(); UpdateIcons(); } else { ClearSelection(); } } private void ClearSelection() { detectedMag = null; detectedSpeedLoader = null; purchaseMag = null; upgradeMag = null; selectedObject = null; TG_Bounds placementBoundsRenderer = original.PlacementBoundsRenderer; if (placementBoundsRenderer != null) { ((Component)placementBoundsRenderer).gameObject.SetActive(false); } } private void Scan() { //IL_0024: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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) global::TNHFramework.ObjectTemplates.CustomCharacter currentCharacter = LoadedTemplateManager.CurrentCharacter; if ((Object)(object)selectedObject != (Object)null) { Bounds val = default(Bounds); ((Bounds)(ref val))..ctor(((Component)selectedObject).transform.position, new Vector3(0.01f, 0.01f, 0.01f)); Collider[] componentsInChildren = ((Component)((Component)selectedObject).transform).GetComponentsInChildren<Collider>(); foreach (Collider val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && val2.isTrigger) { ((Bounds)(ref val)).Encapsulate(val2.bounds); } } Vector3 position = selectedObject.RootRigidbody.position; Vector3 val3 = ((Bounds)(ref val)).center - ((Component)selectedObject).transform.position; if ((Object)(object)original.PlacementBoundsRenderer == (Object)null) { GameObject val4 = Object.Instantiate<GameObject>(original.PlacementBoundsPrefab, position, Quaternion.identity); original.PlacementBoundsRenderer = val4.GetComponent<TG_Bounds>(); } ((Component)original.PlacementBoundsRenderer).gameObject.SetActive(true); original.PlacementBoundsRenderer.PoseAndRescale(position + val3, ((Bounds)(ref val)).extents * 2f, original.EmitterPoint.position); Bounds val5 = default(Bounds); ((Bounds)(ref val5))..ctor(original.ScanningVolume.position, new Vector3(0.001f, 0.001f, 0.001f)); ((Bounds)(ref val5)).Encapsulate(original.ScanningVolume.TransformPoint(new Vector3(0.5f, 0.5f, 0.5f))); ((Bounds)(ref val5)).Encapsulate(original.ScanningVolume.TransformPoint(new Vector3(-0.5f, -0.5f, -0.5f))); if (!((Bounds)(ref val)).Intersects(val5)) { ClearSelection(); } } if (!((Object)(object)selectedObject == (Object)null)) { return; } int num = Physics.OverlapBoxNonAlloc(original.ScanningVolume.position, original.ScanningVolume.localScale * 0.5f, colBuffer, original.ScanningVolume.rotation, LayerMask.op_Implicit(original.ScanningLM), (QueryTriggerInteraction)2); detectedMag = null; detectedSpeedLoader = null; purchaseMag = null; upgradeMag = null; for (int j = 0; j < num; j++) { if (!((Object)(object)colBuffer[j].attachedRigidbody != (Object)null)) { continue; } FVRFireArm component = ((Component)colBuffer[j]).GetComponent<FVRFireArm>(); if ((Object)(object)purchaseMag == (Object)null && (Object)(object)component != (Object)null && !((FVRInteractiveObject)component).IsHeld && (Object)(object)((FVRPhysicalObject)component).QuickbeltSlot == (Object)null) { MagazineBlacklistEntry magazineBlacklistEntry = (blacklist.ContainsKey(((FVRPhysicalObject)component).ObjectWrapper.ItemID) ? blacklist[((FVRPhysicalObject)component).ObjectWrapper.ItemID] : null); List<FVRObject> compatibleMagazines = FirearmUtils.GetCompatibleMagazines(((FVRPhysicalObject)component).ObjectWrapper, -1, -1, smallestIfEmpty: false, currentCharacter.GlobalObjectBlacklist, magazineBlacklistEntry); if (compatibleMagazines.Count > 0) { purchaseMag = FirearmUtils.GetSmallestCapacityMagazine(compatibleMagazines, currentCharacter.GlobalObjectBlacklist, magazineBlacklistEntry); selectedObject = (FVRPhysicalObject)(object)component; } } FVRFireArmMagazine component2 = ((Component)colBuffer[j].attachedRigidbody).GetComponent<FVRFireArmMagazine>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.FireArm == (Object)null && !((FVRInteractiveObject)component2).IsHeld && (Object)(object)((FVRPhysicalObject)component2).QuickbeltSlot == (Object)null && !component2.IsIntegrated) { detectedMag = component2; selectedObject = (FVRPhysicalObject)(object)component2; } Speedloader component3 = ((Component)colBuffer[j].attachedRigidbody).GetComponent<Speedloader>(); if ((Object)(object)component3 != (Object)null && !((FVRInteractiveObject)component3).IsHeld && (Object)(object)((FVRPhysicalObject)component3).QuickbeltSlot == (Object)null && component3.IsPretendingToBeAMagazine) { detectedSpeedLoader = component3; selectedObject = (FVRPhysicalObject)(object)component3; } if ((Object)(object)purchaseMag != (Object)null && ((Object)(object)detectedMag != (Object)null || (Object)(object)detectedSpeedLoader != (Object)null)) { break; } } } private void UpdateIcons() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) _ = LoadedTemplateManager.CurrentCharacter; DupeIcon.State = (IconState)2; UpgradeIcon.State = (IconState)2; PurchaseIcon.State = (IconState)2; int numTokens = original.M.GetNumTokens(); numTokensSelected = 0; if ((Object)(object)detectedMag != (Object)null || (Object)(object)detectedSpeedLoader != (Object)null) { DupeIcon.State = (IconState)1; if (numTokens >= DupeCost) { numTokensSelected = DupeCost; } } if ((Object)(object)purchaseMag != (Object)null) { PurchaseIcon.State = (IconState)1; if (numTokens >= PurchaseCost) { numTokensSelected = PurchaseCost; } } if ((Object)(object)detectedMag != (Object)null) { upgradeMag = FirearmUtils.GetNextHighestCapacityMagazine(((FVRPhysicalObject)detectedMag).ObjectWrapper); if ((Object)(object)upgradeMag != (Object)null) { UpgradeIcon.State = (IconState)1; if (numTokens >= UpgradeCost) { numTokensSelected = UpgradeCost; } } } miUpdateIconDisplay.Invoke(DupeIcon, new object[0]); miUpdateIconDisplay.Invoke(UpgradeIcon, new object[0]); miUpdateIconDisplay.Invoke(PurchaseIcon, new object[0]); UpdateTokenDisplay(numTokens); } private void UpdateTokenDisplay(int numTokens) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) for (int i = 0; i < original.TokenList.Count; i++) { if (i < numTokens) { if (i < numTokens - numTokensSelected) { ((Graphic)original.TokenList[i]).color = original.Token_Unselected; } else { ((Graphic)original.TokenList[i]).color = original.Token_Selected; } } else { ((Graphic)original.TokenList[i]).color = original.Token_Empty; } } } } public class AmmoPurchasePanel : MonoBehaviour { public TNH_MagDuplicator original; public Dictionary<string, MagazineBlacklistEntry> blacklist; public int PanelCost = 1; private int numTokensSelected; public static Sprite background; private TNH_ObjectConstructorIcon PurchaseIcon; private FVRPhysicalObject selectedObject; private FVRFireArm detectedFirearm; private Collider[] colBuffer = (Collider[])(object)new Collider[50]; private readonly MethodInfo miUpdateIconDisplay = typeof(TNH_ObjectConstructorIcon).GetMethod("UpdateIconDisplay", BindingFlags.Instance | BindingFlags.NonPublic); public void Awake() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown original = ((Component)this).gameObject.GetComponent<TNH_MagDuplicator>(); if ((Object)(object)original == (Object)null) { TNHFrameworkLogger.LogError("Ammo Purchaser failed, original mag duplicator was null!"); } ((Behaviour)original).enabled = false; InitPanel(); UpdateIcons(); original.M.TokenCountChangeEvent += new TokenCountChange(UpdateTokenDisplay); } private void OnDestroy() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if ((Object)(object)original.M != (Object)null) { original.M.TokenCountChangeEvent -= new TokenCountChange(UpdateTokenDisplay); } } private void InitPanel() { //IL_0070: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown ((Component)((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas/AmmoReloaderTitle (3)")).gameObject.GetComponent<Text>().text = "-- Ammo Purchaser --"; Transform val = ((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas/Backing"); Transform obj = ((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas"); Transform val2 = obj.Find("Icon_0"); val2.localPosition = new Vector3(0f, -290f, 0f); Object.Destroy((Object)(object)((Component)obj.Find("Icon_1")).gameObject); Transform obj2 = ((Component)original).transform.Find("PointableButton_0"); obj2.position = val2.position; Object.Destroy((Object)(object)((Component)((Component)original).transform.Find("PointableButton_1")).gameObject); ((Component)val).gameObject.GetComponent<Image>().sprite = background; PurchaseIcon = ((Component)val2).gameObject.GetComponent<TNH_ObjectConstructorIcon>(); Button component = ((Component)obj2).gameObject.GetComponent<Button>(); component.onClick = new ButtonClickedEvent(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { PurchaseAmmoButton(); }); } public void PurchaseAmmoButton() { //IL_0039: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)detectedFirearm == (Object)null || original.M.GetNumTokens() < PanelCost) { SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Fail, ((Component)this).transform.position); return; } SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Spawn, ((Component)this).transform.position); original.M.SubtractTokens(PanelCost); OTagFirearmRoundPower roundPower = AM.GetRoundPower(detectedFirearm.RoundType); int roundsToSpawn = GetRoundsToSpawn(roundPower); TNHFrameworkLogger.Log("Compatible rounds count for " + ((FVRPhysicalObject)detectedFirearm).ObjectWrapper.ItemID + ": " + IM.OD[((FVRPhysicalObject)detectedFirearm).ObjectWrapper.ItemID].CompatibleSingleRounds.Count, TNHFrameworkLogger.LogType.General); global::TNHFramework.ObjectTemplates.CustomCharacter currentCharacter = LoadedTemplateManager.CurrentCharacter; MagazineBlacklistEntry magazineBlacklistEntry = null; if (currentCharacter.GetMagazineBlacklist().ContainsKey(((FVRPhysicalObject)detectedFirearm).ObjectWrapper.ItemID)) { magazineBlacklistEntry = currentCharacter.GetMagazineBlacklist()[((FVRPhysicalObject)detectedFirearm).ObjectWrapper.ItemID]; } FVRObject random = FirearmUtils.GetCompatibleRounds(((FVRPhysicalObject)detectedFirearm).ObjectWrapper, currentCharacter.ValidAmmoEras, currentCharacter.ValidAmmoSets, currentCharacter.GlobalAmmoBlacklist, currentCharacter.GlobalObjectBlacklist, magazineBlacklistEntry).GetRandom(); AnvilManager.Run(SpawnRounds(original.M, random, roundsToSpawn)); ClearSelection(); UpdateIcons(); } public IEnumerator SpawnRounds(TNH_Manager M, FVRObject bullet, int count) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((AnvilAsset)bullet).GetGameObject(); return TNHFrameworkUtils.InstantiateMultiple(M, gameObject, original.Spawnpoint_Mag.position, count); } public int GetRoundsToSpawn(OTagFirearmRoundPower roundPower) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 if ((int)roundPower == 3) { return 18; } if ((int)roundPower == 2) { return 30; } if ((int)roundPower == 1) { return 30; } if ((int)roundPower == 4) { return 20; } if ((int)roundPower == 5) { return 16; } if ((int)roundPower == 8) { return 16; } if ((int)roundPower == 6) { return 6; } if ((int)roundPower == 7) { return 3; } return 10; } private void Update() { //IL_000b: 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) if (Vector3.Distance(original.ScanningVolume.position, ((Component)GM.CurrentPlayerBody.Head).transform.position) < 2f) { Scan(); UpdateIcons(); } else { ClearSelection(); } } private void ClearSelection() { detectedFirearm = null; selectedObject = null; TG_Bounds placementBoundsRenderer = original.PlacementBoundsRenderer; if (placementBoundsRenderer != null) { ((Component)placementBoundsRenderer).gameObject.SetActive(false); } } private void Scan() { //IL_001e: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00b1: 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_0115: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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) if ((Object)(object)selectedObject != (Object)null) { Bounds val = default(Bounds); ((Bounds)(ref val))..ctor(((Component)selectedObject).transform.position, new Vector3(0.01f, 0.01f, 0.01f)); Collider[] componentsInChildren = ((Component)((Component)selectedObject).transform).GetComponentsInChildren<Collider>(); foreach (Collider val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && val2.isTrigger) { ((Bounds)(ref val)).Encapsulate(val2.bounds); } } Vector3 position = selectedObject.RootRigidbody.position; Vector3 val3 = ((Bounds)(ref val)).center - ((Component)selectedObject).transform.position; if ((Object)(object)original.PlacementBoundsRenderer == (Object)null) { GameObject val4 = Object.Instantiate<GameObject>(original.PlacementBoundsPrefab, position, Quaternion.identity); original.PlacementBoundsRenderer = val4.GetComponent<TG_Bounds>(); } ((Component)original.PlacementBoundsRenderer).gameObject.SetActive(true); original.PlacementBoundsRenderer.PoseAndRescale(position + val3, ((Bounds)(ref val)).extents * 2f, original.EmitterPoint.position); Bounds val5 = default(Bounds); ((Bounds)(ref val5))..ctor(original.ScanningVolume.position, new Vector3(0.001f, 0.001f, 0.001f)); ((Bounds)(ref val5)).Encapsulate(original.ScanningVolume.TransformPoint(new Vector3(0.5f, 0.5f, 0.5f))); ((Bounds)(ref val5)).Encapsulate(original.ScanningVolume.TransformPoint(new Vector3(-0.5f, -0.5f, -0.5f))); if (!((Bounds)(ref val)).Intersects(val5)) { ClearSelection(); } } if (!((Object)(object)selectedObject == (Object)null)) { return; } int num = Physics.OverlapBoxNonAlloc(original.ScanningVolume.position, original.ScanningVolume.localScale * 0.5f, colBuffer, original.ScanningVolume.rotation, LayerMask.op_Implicit(original.ScanningLM), (QueryTriggerInteraction)2); detectedFirearm = null; for (int j = 0; j < num; j++) { if ((Object)(object)colBuffer[j].attachedRigidbody != (Object)null) { FVRFireArm component = ((Component)colBuffer[j].attachedRigidbody).GetComponent<FVRFireArm>(); if ((Object)(object)component != (Object)null && !((FVRInteractiveObject)component).IsHeld && (Object)(object)((FVRPhysicalObject)component).QuickbeltSlot == (Object)null) { detectedFirearm = component; selectedObject = (FVRPhysicalObject)(object)component; break; } } } } private void UpdateIcons() { //IL_0007: 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) PurchaseIcon.State = (IconState)2; int numTokens = original.M.GetNumTokens(); numTokensSelected = 0; if ((Object)(object)detectedFirearm != (Object)null) { PurchaseIcon.State = (IconState)1; if (numTokens >= PanelCost) { numTokensSelected = PanelCost; } } miUpdateIconDisplay.Invoke(PurchaseIcon, new object[0]); UpdateTokenDisplay(numTokens); } private void UpdateTokenDisplay(int numTokens) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) for (int i = 0; i < original.TokenList.Count; i++) { if (i < numTokens) { if (i < numTokens - numTokensSelected) { ((Graphic)original.TokenList[i]).color = original.Token_Unselected; } else { ((Graphic)original.TokenList[i]).color = original.Token_Selected; } } else { ((Graphic)original.TokenList[i]).color = original.Token_Empty; } } } } public class FullAutoPanel : MonoBehaviour { public TNH_MagDuplicator original; public int PanelCost = 4; private int numTokensSelected; public static Sprite background; private TNH_ObjectConstructorIcon PurchaseIcon; private FVRPhysicalObject selectedObject; public Handgun detectedHandgun; public ClosedBoltWeapon detectedClosedBolt; public OpenBoltReceiver detectedOpenBolt; private Collider[] colBuffer = (Collider[])(object)new Collider[50]; private readonly MethodInfo miUpdateIconDisplay = typeof(TNH_ObjectConstructorIcon).GetMethod("UpdateIconDisplay", BindingFlags.Instance | BindingFlags.NonPublic); public void Awake() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown original = ((Component)this).gameObject.GetComponent<TNH_MagDuplicator>(); if ((Object)(object)original == (Object)null) { TNHFrameworkLogger.LogError("Full Auto Enabler failed, original Mag Duplicator was null!"); } ((Behaviour)original).enabled = false; InitPanel(); UpdateIcons(); original.M.TokenCountChangeEvent += new TokenCountChange(UpdateTokenDisplay); } private void OnDestroy() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if ((Object)(object)original.M != (Object)null) { original.M.TokenCountChangeEvent -= new TokenCountChange(UpdateTokenDisplay); } } private void InitPanel() { //IL_0070: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown ((Component)((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas/AmmoReloaderTitle (3)")).gameObject.GetComponent<Text>().text = "-- Full Auto Upgrader --"; Transform val = ((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas/Backing"); Transform obj = ((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas"); Transform val2 = obj.Find("Icon_0"); val2.localPosition = new Vector3(0f, -290f, 0f); Object.Destroy((Object)(object)((Component)obj.Find("Icon_1")).gameObject); Transform obj2 = ((Component)original).transform.Find("PointableButton_0"); obj2.position = val2.position; Object.Destroy((Object)(object)((Component)((Component)original).transform.Find("PointableButton_1")).gameObject); ((Component)val).gameObject.GetComponent<Image>().sprite = background; PurchaseIcon = ((Component)val2).gameObject.GetComponent<TNH_ObjectConstructorIcon>(); Button component = ((Component)obj2).gameObject.GetComponent<Button>(); component.onClick = new ButtonClickedEvent(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { AddFullAutoButton(); }); } public void AddFullAutoButton() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)detectedHandgun == (Object)null && (Object)(object)detectedClosedBolt == (Object)null && (Object)(object)detectedOpenBolt == (Object)null) || PanelCost > original.M.GetNumTokens()) { SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Fail, ((Component)this).transform.position); return; } SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Spawn, ((Component)this).transform.position); original.M.SubtractTokens(PanelCost); if ((Object)(object)detectedHandgun != (Object)null) { AddFullAutoToHandgun(detectedHandgun); ClearSelection(); } else if ((Object)(object)detectedClosedBolt != (Object)null) { AddFullAutoToClosedBolt(detectedClosedBolt); ClearSelection(); } else if ((Object)(object)detectedOpenBolt != (Object)null) { AddFullAutoToOpenBolt(detectedOpenBolt); ClearSelection(); } } private void AddFullAutoToHandgun(Handgun gun) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0013: 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_005e: Expected O, but got Unknown //IL_006b: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown FireSelectorMode val = new FireSelectorMode(); val.SelectorPosition = 0f; val.ModeType = (FireSelectorModeType)2; if (gun.FireSelectorModes != null) { FireSelectorMode[] fireSelectorModes = gun.FireSelectorModes; for (int i = 0; i < fireSelectorModes.Length; i++) { Debug.Log((object)fireSelectorModes[i].ModeType); } } if (gun.FireSelectorModes == null || gun.FireSelectorModes.Length == 0) { FireSelectorMode val2 = new FireSelectorMode(); val2.SelectorPosition = 0f; val2.ModeType = (FireSelectorModeType)1; gun.FireSelectorModes = (FireSelectorMode[])(object)new FireSelectorMode[2] { val2, val }; } else { List<FireSelectorMode> list = new List<FireSelectorMode>(gun.FireSelectorModes) { val }; gun.FireSelectorModes = list.ToArray(); } if (!gun.HasFireSelector) { gun.HasFireSelector = true; if (gun.HasSafety) { gun.FireSelectorAxis = gun.SafetyAxis; gun.FireSelectorInterpStyle = gun.Safety_Interp; gun.FireSelector = gun.Safety; } else if ((Object)(object)gun.FireSelector == (Object)null) { gun.FireSelector = Object.Instantiate<GameObject>(new GameObject(), ((FVRInteractiveObject)gun).GameObject.transform).transform; } } if (gun.HasSafety) { ((FVRFireArm)gun).AudioClipSet.FireSelector = ((FVRFireArm)gun).AudioClipSet.Safety; gun.HasSafety = false; } } private void AddFullAutoToClosedBolt(ClosedBoltWeapon gun) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0008: 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_002f: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) FireSelectorMode val = new FireSelectorMode(); val.ModeType = (FireSelectorModeType)3; val.SelectorPosition = 0f; if (gun.FireSelector_Modes == null || gun.FireSelector_Modes.Length == 0) { FireSelectorMode val2 = new FireSelectorMode(); val2.ModeType = (FireSelectorModeType)1; val2.SelectorPosition = 0f; gun.FireSelector_Modes = (FireSelectorMode[])(object)new FireSelectorMode[2] { val2, val }; } else { List<FireSelectorMode> list = new List<FireSelectorMode>(gun.FireSelector_Modes) { val }; gun.FireSelector_Modes = list.ToArray(); } } private void AddFullAutoToOpenBolt(OpenBoltReceiver gun) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0008: 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_002f: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) FireSelectorMode val = new FireSelectorMode(); val.ModeType = (FireSelectorModeType)2; val.SelectorPosition = 0f; if (gun.FireSelector_Modes == null || gun.FireSelector_Modes.Length == 0) { FireSelectorMode val2 = new FireSelectorMode(); val2.ModeType = (FireSelectorModeType)1; val2.SelectorPosition = 0f; gun.FireSelector_Modes = (FireSelectorMode[])(object)new FireSelectorMode[2] { val2, val }; } else { List<FireSelectorMode> list = new List<FireSelectorMode>(gun.FireSelector_Modes) { val }; gun.FireSelector_Modes = list.ToArray(); } } private void Update() { //IL_000b: 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) if (Vector3.Distance(original.ScanningVolume.position, ((Component)GM.CurrentPlayerBody.Head).transform.position) < 2f) { Scan(); UpdateIcons(); } else { ClearSelection(); } } private void ClearSelection() { detectedHandgun = null; detectedClosedBolt = null; detectedOpenBolt = null; selectedObject = null; TG_Bounds placementBoundsRenderer = original.PlacementBoundsRenderer; if (placementBoundsRenderer != null) { ((Component)placementBoundsRenderer).gameObject.SetActive(false); } } private void Scan() { //IL_001e: 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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00b1: 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_0115: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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) if ((Object)(object)selectedObject != (Object)null) { Bounds val = default(Bounds); ((Bounds)(ref val))..ctor(((Component)selectedObject).transform.position, new Vector3(0.01f, 0.01f, 0.01f)); Collider[] componentsInChildren = ((Component)((Component)selectedObject).transform).GetComponentsInChildren<Collider>(); foreach (Collider val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && val2.isTrigger) { ((Bounds)(ref val)).Encapsulate(val2.bounds); } } Vector3 position = selectedObject.RootRigidbody.position; Vector3 val3 = ((Bounds)(ref val)).center - ((Component)selectedObject).transform.position; if ((Object)(object)original.PlacementBoundsRenderer == (Object)null) { GameObject val4 = Object.Instantiate<GameObject>(original.PlacementBoundsPrefab, position, Quaternion.identity); original.PlacementBoundsRenderer = val4.GetComponent<TG_Bounds>(); } ((Component)original.PlacementBoundsRenderer).gameObject.SetActive(true); original.PlacementBoundsRenderer.PoseAndRescale(position + val3, ((Bounds)(ref val)).extents * 2f, original.EmitterPoint.position); Bounds val5 = default(Bounds); ((Bounds)(ref val5))..ctor(original.ScanningVolume.position, new Vector3(0.001f, 0.001f, 0.001f)); ((Bounds)(ref val5)).Encapsulate(original.ScanningVolume.TransformPoint(new Vector3(0.5f, 0.5f, 0.5f))); ((Bounds)(ref val5)).Encapsulate(original.ScanningVolume.TransformPoint(new Vector3(-0.5f, -0.5f, -0.5f))); if (!((Bounds)(ref val)).Intersects(val5)) { ClearSelection(); } } if (!((Object)(object)selectedObject == (Object)null)) { return; } detectedHandgun = null; detectedClosedBolt = null; detectedOpenBolt = null; int num = Physics.OverlapBoxNonAlloc(original.ScanningVolume.position, original.ScanningVolume.localScale * 0.5f, colBuffer, original.ScanningVolume.rotation, LayerMask.op_Implicit(original.ScanningLM), (QueryTriggerInteraction)2); for (int j = 0; j < num; j++) { if ((Object)(object)colBuffer[j].attachedRigidbody != (Object)null) { Handgun component = ((Component)colBuffer[j].attachedRigidbody).GetComponent<Handgun>(); if ((Object)(object)component != (Object)null && (component.FireSelectorModes == null || !component.FireSelectorModes.Any((FireSelectorMode o) => (int)o.ModeType == 2))) { detectedHandgun = component; selectedObject = (FVRPhysicalObject)(object)component; break; } ClosedBoltWeapon component2 = ((Component)colBuffer[j].attachedRigidbody).GetComponent<ClosedBoltWeapon>(); if ((Object)(object)component2 != (Object)null && (component2.FireSelector_Modes == null || !component2.FireSelector_Modes.Any((FireSelectorMode o) => (int)o.ModeType == 3))) { detectedClosedBolt = component2; selectedObject = (FVRPhysicalObject)(object)component2; break; } OpenBoltReceiver component3 = ((Component)colBuffer[j].attachedRigidbody).GetComponent<OpenBoltReceiver>(); if ((Object)(object)component3 != (Object)null && (component3.FireSelector_Modes == null || !component3.FireSelector_Modes.Any((FireSelectorMode o) => (int)o.ModeType == 2))) { detectedOpenBolt = component3; selectedObject = (FVRPhysicalObject)(object)component3; break; } } } } private void UpdateIcons() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) PurchaseIcon.State = (IconState)2; int numTokens = original.M.GetNumTokens(); numTokensSelected = 0; if ((Object)(object)detectedHandgun != (Object)null || (Object)(object)detectedClosedBolt != (Object)null || (Object)(object)detectedOpenBolt != (Object)null) { PurchaseIcon.State = (IconState)1; if (numTokens >= PanelCost) { numTokensSelected = PanelCost; } } miUpdateIconDisplay.Invoke(PurchaseIcon, new object[0]); UpdateTokenDisplay(numTokens); } private void UpdateTokenDisplay(int numTokens) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) for (int i = 0; i < original.TokenList.Count; i++) { if (i < numTokens) { if (i < numTokens - numTokensSelected) { ((Graphic)original.TokenList[i]).color = original.Token_Unselected; } else { ((Graphic)original.TokenList[i]).color = original.Token_Selected; } } else { ((Graphic)original.TokenList[i]).color = original.Token_Empty; } } } } public class FireRatePanel : MonoBehaviour { public TNH_MagDuplicator original; public static Sprite background; public static Sprite plusSprite; public static Sprite minusSprite; private TNH_ObjectConstructorIcon PlusIcon; private TNH_ObjectConstructorIcon MinusIcon; private FVRPhysicalObject selectedObject; public Handgun detectedHandgun; public ClosedBoltWeapon detectedClosedBolt; public OpenBoltReceiver detectedOpenBolt; private int PanelCost = 1; private int numTokensSelected; private Collider[] colBuffer = (Collider[])(object)new Collider[50]; private readonly MethodInfo miUpdateIconDisplay = typeof(TNH_ObjectConstructorIcon).GetMethod("UpdateIconDisplay", BindingFlags.Instance | BindingFlags.NonPublic); private float fireRateMultiplier = 1.5f; public void Awake() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown original = ((Component)this).gameObject.GetComponent<TNH_MagDuplicator>(); if ((Object)(object)original == (Object)null) { TNHFrameworkLogger.LogError("Fire Rate Modifier failed, original Mag Duplicator was null!"); } ((Behaviour)original).enabled = false; InitPanel(); UpdateIcons(); original.M.TokenCountChangeEvent += new TokenCountChange(UpdateTokenDisplay); } private void OnDestroy() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if ((Object)(object)original.M != (Object)null) { original.M.TokenCountChangeEvent -= new TokenCountChange(UpdateTokenDisplay); } } public void InitPanel() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown ((Component)((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas/AmmoReloaderTitle (3)")).gameObject.GetComponent<Text>().text = "-- Fire Rate Up / Down --"; Transform val = ((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas/Backing"); Transform obj = ((Component)original).transform.Find("_CanvasHolder/_UITest_Canvas"); Transform val2 = obj.Find("Icon_0"); val2.localPosition = new Vector3(-165f, -290f, 0f); Transform val3 = obj.Find("Icon_1"); val3.localPosition = new Vector3(165f, -290f, 0f); Transform obj2 = ((Component)original).transform.Find("PointableButton_0"); obj2.position = val2.position; Transform val4 = ((Component)original).transform.Find("PointableButton_1"); val4.position = val3.position; ((Component)val).gameObject.GetComponent<Image>().sprite = background; MinusIcon = ((Component)val2).gameObject.GetComponent<TNH_ObjectConstructorIcon>(); PlusIcon = ((Component)val3).gameObject.GetComponent<TNH_ObjectConstructorIcon>(); MinusIcon.Sprite_Accept = minusSprite; PlusIcon.Sprite_Accept = plusSprite; Button component = ((Component)obj2).gameObject.GetComponent<Button>(); component.onClick = new ButtonClickedEvent(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { DecreaseFireRateButton(); }); Button component2 = ((Component)val4).gameObject.GetComponent<Button>(); component2.onClick = new ButtonClickedEvent(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { IncreaseFireRateButton(); }); } public void IncreaseFireRateButton() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)detectedHandgun == (Object)null && (Object)(object)detectedClosedBolt == (Object)null && (Object)(object)detectedOpenBolt == (Object)null) || PanelCost > original.M.GetNumTokens()) { SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Fail, ((Component)this).transform.position); return; } SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Spawn, ((Component)this).transform.position); original.M.SubtractTokens(PanelCost); IncreaseFireRate(); ClearSelection(); } public void DecreaseFireRateButton() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)detectedHandgun == (Object)null && (Object)(object)detectedClosedBolt == (Object)null && (Object)(object)detectedOpenBolt == (Object)null) || PanelCost > original.M.GetNumTokens()) { SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Fail, ((Component)this).transform.position); return; } SM.PlayCoreSound((FVRPooledAudioType)20, original.AudEvent_Spawn, ((Component)this).transform.position); original.M.SubtractTokens(PanelCost); DecreaseFireRate(); ClearSelection(); } public void IncreaseFireRate() { if ((Object)(object)detectedHandgun != (Object)null) { HandgunSlide slide = detectedHandgun.Slide; slide.SpringStiffness *= fireRateMultiplier; HandgunSlide slide2 = detectedHandgun.Slide; slide2.Speed_Rearward *= fireRateMultiplier; HandgunSlide slide3 = detectedHandgun.Slide; slide3.Speed_Forward *= fireRateMultiplier; } else if ((Object)(object)detectedClosedBolt != (Object)null) { ClosedBolt bolt = detectedClosedBolt.Bolt; bolt.SpringStiffness *= fireRateMultiplier; ClosedBolt bolt2 = detectedClosedBolt.Bolt; bolt2.Speed_Forward *= fireRateMultiplier; ClosedBolt bolt3 = detectedClosedBolt.Bolt; bolt3.Speed_Rearward *= fireRateMultiplier; } else { OpenBoltReceiverBolt bolt4 = detectedOpenBolt.Bolt; bolt4.BoltSpringStiffness *= fireRateMultiplier; OpenBoltReceiverBolt bolt5 = detectedOpenBolt.Bolt; bolt5.BoltSpeed_Forward *= fireRateMultiplier; OpenBoltReceiverBolt bolt6 = detectedOpenBolt.Bolt; bolt6.BoltSpeed_Rearward *= fireRateMultiplier; } } public void DecreaseFireRate() { if ((Object)(object)detectedHandgun != (Object)null) { HandgunSlide slide = detectedHandgun.Slide; slide.SpringStiffness *= 1f / fireRateMultiplier; HandgunSlide slide2 = detectedHandgun.Slide; slide2.Speed_Rearward *= 1f / fireRateMultiplier; HandgunSlide slide3 = detectedHandgun.Slide; slide3.Sp