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.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GoldItems; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreUpgrades.Classes; using NoItemSpawnLimit.Patches; using Photon.Pun; using REPOLib; using REPOLib.Modules; using UnityEngine; using VanillaUpgrades; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Discord.Sdk")] [assembly: IgnoresAccessChecksTo("Domain_Reload")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("GoldItems")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("MoreUpgrades")] [assembly: IgnoresAccessChecksTo("NoItemSpawnLimit")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")] [assembly: IgnoresAccessChecksTo("Unity.Localization")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.ResourceManager")] [assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")] [assembly: IgnoresAccessChecksTo("Unity.Splines")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("VanillaUpgrades")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("SeroRonin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.5.2.0")] [assembly: AssemblyInformationalVersion("1.5.2")] [assembly: AssemblyProduct("ItemBundles")] [assembly: AssemblyTitle("ItemBundles")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ItemBundles { public static class BundleHelper { public static int GetItemBundleChance(Item item) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) itemType key = ValidateItemType(item); int result = ((ItemBundles.Instance.itemTypeBundleInfos[key].chanceInShop >= 0) ? ItemBundles.Instance.itemTypeBundleInfos[key].chanceInShop : ItemBundles.Instance.config_chanceBundlesInShop.Value); if (ItemBundles.Instance.itemBundleInfos[((PrefabRef)(object)item.prefab).prefabName].chanceInShop >= 0) { result = ItemBundles.Instance.itemBundleInfos[((PrefabRef)(object)item.prefab).prefabName].chanceInShop; } return result; } public static int GetItemBundleBudget(Item item) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) itemType key = ValidateItemType(item); int globalSpawnBudget = ItemBundles.globalSpawnBudget; int num = ((ItemBundles.Instance.itemTypeBundleInfos[key].spawnBudget >= 0) ? ItemBundles.Instance.itemTypeBundleInfos[key].spawnBudget : globalSpawnBudget); int val = ((ItemBundles.Instance.itemBundleInfos[((PrefabRef)(object)item.prefab).prefabName].spawnBudget >= 0) ? ItemBundles.Instance.itemBundleInfos[((PrefabRef)(object)item.prefab).prefabName].spawnBudget : num); return Math.Min(globalSpawnBudget, Math.Min(num, val)); } public static int GetItemBundleMinItem(Item item) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) itemType key = ValidateItemType(item); int value = ItemBundles.Instance.config_minPerBundle.Value; if (ItemBundles.Instance.itemTypeBundleInfos[key].config_minPerBundle.Value >= 0) { value = ItemBundles.Instance.itemTypeBundleInfos[key].config_minPerBundle.Value; } if (ItemBundles.Instance.itemBundleInfos[((PrefabRef)(object)item.prefab).prefabName].config_minPerBundle.Value >= 0) { value = ItemBundles.Instance.itemBundleInfos[((PrefabRef)(object)item.prefab).prefabName].config_minPerBundle.Value; } return value; } public static int GetItemBundleMinItem(string itemString, itemType itemType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) itemType key = ValidateItemType(itemType); int value = ItemBundles.Instance.config_minPerBundle.Value; if (ItemBundles.Instance.itemTypeBundleInfos[key].config_minPerBundle.Value >= 0) { value = ItemBundles.Instance.itemTypeBundleInfos[key].config_minPerBundle.Value; } if (ItemBundles.Instance.itemBundleInfos[itemString].config_minPerBundle.Value >= 0) { value = ItemBundles.Instance.itemBundleInfos[itemString].config_minPerBundle.Value; } return value; } public static float GetItemBundlePriceMult(string itemString, itemType itemType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) itemType key = ValidateItemType(itemType); float value = ItemBundles.Instance.config_priceMultiplier.Value; if (ItemBundles.Instance.itemTypeBundleInfos[key].config_priceMultiplier.Value >= 0f) { value = ItemBundles.Instance.itemTypeBundleInfos[key].config_priceMultiplier.Value; } if (ItemBundles.Instance.itemBundleInfos[itemString].config_priceMultiplier.Value >= 0f) { value = ItemBundles.Instance.itemBundleInfos[itemString].config_priceMultiplier.Value; } return value; } public static itemType ValidateItemType(Item item) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return (itemType)(((int)item.itemType == 4) ? 3 : ((int)item.itemType)); } public static itemType ValidateItemType(itemType itemType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: 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_000c: Unknown result type (might be due to invalid IL or missing references) return (itemType)(((int)itemType == 4) ? 3 : ((int)itemType)); } public static string GetItemStringFromBundle(Item bundleItem) { string prefabName = ((PrefabRef)(object)bundleItem.prefab).prefabName; return GetItemStringFromBundle(prefabName); } public static string GetItemStringFromBundle(string bundleItemString) { string removeString = " Bundle"; return RemoveString(bundleItemString, removeString); } public static string RemoveString(string baseString, string removeString) { int num = baseString.IndexOf(removeString); return (num < 0) ? baseString : baseString.Remove(num, removeString.Length); } public static List PlayerGetAllAlive() { List list = new List(); foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { if (item.playerHealth.health > 0) { list.Add(item); } } return list; } public static bool IsObjectBundlePrefab(GameObject obj) { ItemUpgradeBundleGenerated component = obj.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { return component.isPrefab; } return false; } public static bool SceneIsPrefabStage() { if (!ItemBundles.Instance.mainMenuReached || SemiFunc.MenuLevel()) { return true; } return (Object)(object)RunManager.instance == (Object)null; } public static void AttemptBundlesFromList(ref List itemList) { List list = new List(itemList); for (int num = list.Count - 1; num >= 0; num--) { Item item = list[num]; list[num] = AttemptBundleItem(item); } ListExtension.Shuffle((IList)list); itemList = list; } public static Item AttemptBundleItem(Item item) { //IL_0048: 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_0058: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMultiplayer() && ItemBundles.Instance.config_disableBundlesSP.Value) { return item; } if (ItemBundles.Instance.itemBundleInfos.ContainsKey(((PrefabRef)(object)item.prefab).prefabName)) { itemType key = ValidateItemType(item); ItemBundles.BundleShopInfo bundleShopInfo = ItemBundles.Instance.itemTypeBundleInfos[key]; ItemBundles.BundleShopInfo bundleShopInfo2 = ItemBundles.Instance.itemBundleInfos[((PrefabRef)(object)item.prefab).prefabName]; if (!Object.op_Implicit((Object)(object)((PrefabRef)(object)bundleShopInfo2.bundleItem.prefab).Prefab)) { DebugLogger.LogError($"|---- {bundleShopInfo2.bundleItem} prefab was null! Skipping entry"); return item; } float num = GetItemBundleChance(item); num /= 100f; if (GetItemBundleBudget(item) == 0 && !NoItemSpawnLimitCompat.enabled) { DebugLogger.LogWarning("|---- Already have max bundles for " + ((PrefabRef)(object)item.prefab).prefabName + "!", debugOnly: true); return item; } float num2 = Random.Range(0f, 1f); if (num2 <= num || num < 0f) { DebugLogger.LogWarning($"|---- Passed with {num2} {num2 <= num}, Replacing item {item} with {bundleShopInfo2.bundleItem}!", debugOnly: true); ItemBundles.globalSpawnBudget--; bundleShopInfo.spawnBudget--; bundleShopInfo2.spawnBudget--; return bundleShopInfo2.bundleItem; } DebugLogger.LogInfo($"|---- Failed with {num2} {num2 <= num}, keeping item {item}!", debugOnly: true); } return item; } public static void UpdateBundlePrices() { DebugLogger.LogInfo("Updating Item Prices!", debugOnly: true); if (!SemiFunc.RunIsShop()) { return; } List list = new List(); ItemConsumableBundle[] array = Object.FindObjectsByType((FindObjectsSortMode)0); ItemConsumableBundle[] array2 = array; foreach (ItemConsumableBundle itemConsumableBundle in array2) { ItemAttributes component = ((Component)itemConsumableBundle).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { list.Add(component); } } ItemUpgradeBundleGenerated[] array3 = Object.FindObjectsByType((FindObjectsSortMode)0); ItemUpgradeBundleGenerated[] array4 = array3; foreach (ItemUpgradeBundleGenerated itemUpgradeBundleGenerated in array4) { ItemAttributes component2 = ((Component)itemUpgradeBundleGenerated).gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null && !itemUpgradeBundleGenerated.isPrefab) { list.Add(component2); } } foreach (ItemAttributes item in list) { DebugLogger.LogInfo("Updating Item Prices " + item.itemName + "!", debugOnly: true); item.GetValue(); } } } public class BundleManager : MonoBehaviour { public static BundleManager instance; public void Awake() { if (!Object.op_Implicit((Object)(object)instance)) { instance = this; } } } [HarmonyPatch(typeof(StatsManager))] internal static class BundlePatch_StatsManager { [HarmonyPostfix] [HarmonyPatch("RunStartStats")] [HarmonyPriority(0)] public static void RunStartStats_PostFix() { ItemBundles.Instance.InitializeItemBundles(); } } [HarmonyPatch(typeof(ItemAttributes))] internal static class BundlePatch_ItemAttributes { [HarmonyPrefix] [HarmonyPatch("ShopInTruckLogic")] private static bool ShopInTruckLogic_Prefix(ItemAttributes __instance) { return !BundleHelper.IsObjectBundlePrefab(((Component)__instance).gameObject); } [HarmonyPrefix] [HarmonyPatch("GetValue")] private static bool GetValue_Prefix(ItemAttributes __instance) { return !BundleHelper.SceneIsPrefabStage(); } [HarmonyPostfix] [HarmonyPatch("GetValue")] [HarmonyPriority(0)] private static void GetValue_Postfix(ItemAttributes __instance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Invalid comparison between Unknown and I4 //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Invalid comparison between Unknown and I4 //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Invalid comparison between Unknown and I4 //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) if (BundleHelper.SceneIsPrefabStage() || (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient)) { return; } string value = "Bundle"; string itemAssetName = __instance.itemAssetName; if (!itemAssetName.Contains(value)) { return; } int num = __instance.value; int count = SemiFunc.PlayerGetAll().Count; count += ItemBundles.Instance.config_debugFakePlayers.Value; if ((int)__instance.itemType == 3) { float num2 = ShopManager.instance.itemValueMultiplier; float upgradeValueIncrease = ShopManager.instance.upgradeValueIncrease; if (itemAssetName.Contains("Modded") && MoreUpgradesCompat.enabled) { num2 = MoreUpgradesCompat.GetOriginalValueMultiplier(itemAssetName); upgradeValueIncrease = MoreUpgradesCompat.GetUpgradeValueIncrease(itemAssetName); } float num3 = Random.Range(__instance.itemValueMin, __instance.itemValueMax) * num2; num3 = Mathf.Max(num3, 1000f); num3 = Mathf.CeilToInt(num3 / 1000f); num3 += num3 * upgradeValueIncrease * (float)StatsManager.instance.GetItemsUpgradesPurchased(BundleHelper.GetItemStringFromBundle(__instance.itemAssetName)); num = (int)num3; } itemType val = BundleHelper.ValidateItemType(__instance.itemType); if ((int)val == 6 || (int)val == 11 || (int)val == 3) { count = Mathf.Max(count, BundleHelper.GetItemBundleMinItem(BundleHelper.GetItemStringFromBundle(__instance.item), __instance.itemType)); } if (count > 1) { float num4 = BundleHelper.GetItemBundlePriceMult(BundleHelper.GetItemStringFromBundle(__instance.item), __instance.itemType) / 100f; float num5 = (float)count * num4; int num6 = Mathf.RoundToInt((float)num * num5); num = num6; } __instance.value = num; if (GameManager.Multiplayer() && __instance.photonView.ViewID != 0) { __instance.photonView.RPC("GetValueRPC", (RpcTarget)1, new object[1] { __instance.value }); } } [HarmonyTranspiler] [HarmonyPatch("ShowingInfo")] private static IEnumerable ShowingInfo_Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_3, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Beq, (object)null, (string)null) }).ThrowIfInvalid("|---- ShowingInfo(): Couldn't find matching code"); DebugLogger.LogInfo("|---- ShowingInfo(): ADDING NEW INSTRUCTIONS", debugOnly: true); object operand = val.Operand; val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(ItemAttributes), "itemAssetName")), new CodeInstruction(OpCodes.Ldstr, (object)"Bundle"), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(string), "Contains", new Type[1] { typeof(string) }, (Type[])null)), new CodeInstruction(OpCodes.Brtrue, operand) }); return val.InstructionEnumeration(); } [HarmonyPostfix] [HarmonyPatch("ShowingInfo")] private static void ShowingInfo_Postfix(ItemAttributes __instance) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 //IL_012e: Unknown result type (might be due to invalid IL or missing references) if (!__instance.itemAssetName.Contains("Bundle")) { return; } string promptName = __instance.promptName; string text = ""; int num = SemiFunc.PlayerGetAll().Count + ItemBundles.Instance.config_debugFakePlayers.Value; ItemBundleShopPrompter component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return; } component.previousPrompt = promptName; itemType itemType = __instance.itemType; itemType val = itemType; if ((int)val <= 6) { if ((int)val == 3 || (int)val == 6) { goto IL_00d2; } } else if ((int)val != 8) { if ((int)val == 11) { goto IL_00d2; } } else { int healAmount = ((Component)__instance).GetComponent().healAmount; text = (BundleHelper.PlayerGetAllAlive().Count + ItemBundles.Instance.config_debugFakePlayers.Value) * healAmount + "hp"; } goto IL_00fc; IL_00fc: bool grabbedLocal = __instance.physGrabObject.grabbedLocal; if (component.shopConfirm && grabbedLocal) { string text2 = InputManager.instance.InputDisplayGet(InputManager.instance.tagDictionary["[interact]"], (KeyType)0, (MovementDirection)0); promptName = component.confirmUnbundlePrompt + " [" + text2 + "]"; } else { promptName = promptName + "\n[Bundle" + (string.IsNullOrEmpty(text) ? text : (" of " + text)) + "]"; } __instance.promptName = promptName; return; IL_00d2: text = Mathf.Max(num, BundleHelper.GetItemBundleMinItem(BundleHelper.GetItemStringFromBundle(__instance.item), __instance.itemType)).ToString(); goto IL_00fc; } } [HarmonyPatch(typeof(ShopManager))] [HarmonyPriority(0)] internal static class BundlePatch_ShopManager { [HarmonyPrefix] [HarmonyPatch("GetAllItemsFromStatsManager")] private static void GetAllItemsFromStatsManager_Prefix(ShopManager __instance) { if (SemiFunc.IsNotMasterClient()) { return; } DebugLogger.LogInfo("|---- GetAllItemsFromStatsManager_Prefix(): Overriding Shop List ----|", debugOnly: true); ItemBundles.Instance.itemDictionaryShop.Clear(); foreach (KeyValuePair item in StatsManager.instance.itemDictionary) { List list = ItemBundles.Instance.itemDictionaryShopBlacklist.Keys.ToList(); List list2 = ItemBundles.Instance.itemDictionaryShopBlacklist.Values.ToList(); if (list.Contains(item.Key) || list2.Contains(item.Value)) { DebugLogger.LogInfo($"|----- Blacklisting {item.Key} or {item.Value} from shop list", debugOnly: true); continue; } DebugLogger.LogInfo($"|---- Adding {item.Key} or {item.Value} to shop list", debugOnly: true); ItemBundles.Instance.itemDictionaryShop.Add(item.Key, item.Value); } } [HarmonyTranspiler] [HarmonyPatch("GetAllItemsFromStatsManager")] private static IEnumerable GetAllItemsFromStatsManager_Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }).ThrowIfInvalid("|---- GetAllItemsFromStatsManager(): Couldn't find matching code"); DebugLogger.LogInfo("|---- GetAllItemsFromStatsManager(): ADDING NEW INSTRUCTIONS", debugOnly: true); val.Opcode = OpCodes.Call; val.Operand = AccessTools.PropertyGetter(typeof(ItemBundles), "Instance"); val.Advance(1); val.Operand = AccessTools.Field(typeof(ItemBundles), "itemDictionaryShop"); return val.InstructionEnumeration(); } [HarmonyPostfix] [HarmonyPatch("GetAllItemsFromStatsManager")] private static void GetAllItemsFromStatsManager_Postfix(ShopManager __instance) { ItemBundles.globalSpawnBudget = ItemBundles.Instance.config_maxBundlesInShop.Value; foreach (KeyValuePair itemTypeBundleInfo in ItemBundles.Instance.itemTypeBundleInfos) { itemTypeBundleInfo.Value.spawnBudget = itemTypeBundleInfo.Value.config_maxInShop.Value; } foreach (KeyValuePair itemBundleInfo in ItemBundles.Instance.itemBundleInfos) { itemBundleInfo.Value.spawnBudget = itemBundleInfo.Value.config_maxInShop.Value; } BundleHelper.AttemptBundlesFromList(ref __instance.potentialItemUpgrades); BundleHelper.AttemptBundlesFromList(ref __instance.potentialItemConsumables); BundleHelper.AttemptBundlesFromList(ref __instance.potentialItems); BundleHelper.AttemptBundlesFromList(ref __instance.potentialItemHealthPacks); DebugLogger.LogInfo("|---- GetAllItemsFromStatsManager_Postfix(): Bundling Lists ----|", debugOnly: true); } } [HarmonyPatch(typeof(UpgradeStand))] internal static class BundlePatch_UpdgradeStand { [HarmonyTranspiler] [HarmonyPatch("GetWeightedUpgradeExcluding")] private static IEnumerable GetWeightedUpgradeExcluding_Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }).ThrowIfInvalid("|---- GetWeightedUpgradeExcluding(): Couldn't find matching code"); DebugLogger.LogInfo("|---- GetWeightedUpgradeExcluding(): ADDING NEW INSTRUCTIONS", debugOnly: true); val.Opcode = OpCodes.Call; val.Operand = AccessTools.PropertyGetter(typeof(ItemBundles), "Instance"); val.Advance(1); val.Operand = AccessTools.Field(typeof(ItemBundles), "itemDictionaryShop"); return val.InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch("SpawnNewUpgrades")] private static IEnumerable SpawnNewUpgrades_Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null) }).ThrowIfInvalid("|---- SpawnNewUpgrades(): Couldn't find matching code"); DebugLogger.LogInfo("|---- SpawnNewUpgrades(): ADDING NEW INSTRUCTIONS", debugOnly: true); OpCode opcode = val.Opcode; object operand = val.Operand; val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(opcode, operand) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BundleHelper), "AttemptBundleItem", (Type[])null, (Type[])null)) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Stloc_S, operand) }); return val.InstructionEnumeration(); } } [HarmonyPatch(typeof(PhysGrabObject))] internal static class BundlePatch_PhysGrabObject { [HarmonyPrefix] [HarmonyPatch("OnEnable")] private static bool OnEnable_Prefix(PhysGrabObject __instance) { return !BundleHelper.SceneIsPrefabStage(); } } [HarmonyPatch(typeof(RoomVolumeCheck))] internal static class BundlePatch_RoomVolumeCheck { [HarmonyPrefix] [HarmonyPatch("CheckStart")] private static bool CheckStart_Prefix(RoomVolumeCheck __instance) { return !BundleHelper.SceneIsPrefabStage(); } } internal static class DebugLogger { public static ManualLogSource ManualLogSource { get; private set; } public static void Init(ManualLogSource manualLogSource) { ManualLogSource = manualLogSource; } public static void Log(LogLevel level, object data, bool debugOnly = false) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!debugOnly || ItemBundles.Instance.config_debugLogging.Value) { ManualLogSource.Log(level, data); } } public static void LogFatal(object data, bool debugOnly = false) { Log((LogLevel)1, data, debugOnly); } public static void LogError(object data, bool debugOnly = false) { Log((LogLevel)2, data, debugOnly); } public static void LogWarning(object data, bool debugOnly = false) { Log((LogLevel)4, data, debugOnly); } public static void LogMessage(object data, bool debugOnly = false) { Log((LogLevel)8, data, debugOnly); } public static void LogInfo(object data, bool debugOnly = false) { Log((LogLevel)16, data, debugOnly); } public static void LogDebug(object data, bool debugOnly = false) { Log((LogLevel)32, data, debugOnly); } } [BepInPlugin("SeroRonin.ItemBundles", "ItemBundles", "1.5.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ItemBundles : BaseUnityPlugin { public class BundleShopInfo { public Item bundleItem; public int spawnBudget; public ConfigEntry config_chanceInShop; public ConfigEntry config_maxInShop; public ConfigEntry config_minPerBundle; public ConfigEntry config_priceMultiplier; public int chanceInShop => config_chanceInShop.Value; } public AssetBundle assetBundle; public Dictionary itemDictionaryShop = new Dictionary(); public Dictionary itemDictionaryShopBlacklist = new Dictionary(); public Dictionary itemTypeBundleInfos = new Dictionary(); public Dictionary itemBundleInfos = new Dictionary(); public Dictionary generatedBundles = new Dictionary(); public Dictionary upgradeParentModDict = new Dictionary(); public List upgradeBundleMeshes = new List(); public static int globalSpawnBudget; public static ItemBundles Instance { get; private set; } internal Harmony? Harmony { get; set; } public ConfigEntry config_disableBundlesSP { get; private set; } public ConfigEntry config_chanceBundlesInShop { get; private set; } public ConfigEntry config_maxBundlesInShop { get; private set; } public ConfigEntry config_minPerBundle { get; private set; } public ConfigEntry config_priceMultiplier { get; private set; } public ConfigEntry config_debugFakePlayers { get; private set; } public ConfigEntry config_debugLogging { get; private set; } public bool mainMenuReached { get; set; } public GameObject templateUpgradeBundlePrefab { get; set; } private void Awake() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)Instance)) { Instance = this; DebugLogger.Init(((BaseUnityPlugin)this).Logger); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, "itembundles"); assetBundle = AssetBundle.LoadFromFile(text); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; CreateConfigs(); Patch(); GameObject val = new GameObject("Bundle Manager"); val.AddComponent(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); BundleLoader.OnAllBundlesLoaded += RegisterItemBundles; DebugLogger.LogInfo($"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } } public void RegisterItemBundles() { if (!Object.op_Implicit((Object)(object)assetBundle)) { DebugLogger.LogError("Assetbundle \"itembundles\" not found! Please make sure that it exists in the same folder as the mod DLL"); DebugLogger.LogError("ItemBundles has run into a fatal error! The mod will not work correctly and may cause issues elsewhere!"); return; } RegisterBundleItemRepoLib("Item Health Pack Small Bundle"); RegisterBundleItemRepoLib("Item Health Pack Medium Bundle"); RegisterBundleItemRepoLib("Item Health Pack Large Bundle"); RegisterBundleItemRepoLib("Item Grenade Explosive Bundle"); RegisterBundleItemRepoLib("Item Grenade Shockwave Bundle"); RegisterBundleItemRepoLib("Item Grenade Stun Bundle"); RegisterBundleItemRepoLib("Item Mine Explosive Bundle"); RegisterBundleItemRepoLib("Item Mine Shockwave Bundle"); RegisterBundleItemRepoLib("Item Mine Stun Bundle"); Item val = assetBundle.LoadAsset("Item Upgrade Bundle Template"); templateUpgradeBundlePrefab = assetBundle.LoadAsset("Item Upgrade Bundle Template"); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)templateUpgradeBundlePrefab)) { DebugLogger.LogError("Template bundle item or prefab was null! Unable to generate upgrade bundles"); DebugLogger.LogError("ItemBundles has run into a fatal error! The mod will not work correctly and may cause issues elsewhere!"); return; } List list = (from item in Resources.LoadAll("items/items") where (int)item.itemType == 3 select item).ToList(); foreach (Item item3 in list) { upgradeParentModDict.Add(item3, "Vanilla"); } foreach (PlayerUpgrade playerUpgrade in Upgrades.PlayerUpgrades) { Item item2 = playerUpgrade.Item; if (!((Object)(object)item2 == (Object)null) && !((Object)(object)((PrefabRef)(object)item2?.prefab).Prefab == (Object)null)) { upgradeParentModDict.Add(item2, "REPOLib"); } } if (StatsManager.instance.itemDictionary.Count == 0) { Traverse.Create((object)StatsManager.instance).Method("LoadItemsFromFolder", Array.Empty()).GetValue(); } foreach (KeyValuePair item4 in StatsManager.instance.itemDictionary.Where((KeyValuePair itemKV) => (int)itemKV.Value.itemType == 3).ToList()) { Item value = item4.Value; if (!upgradeParentModDict.ContainsKey(value)) { upgradeParentModDict.Add(value, "Modded"); } } foreach (KeyValuePair item5 in upgradeParentModDict) { DebugLogger.LogInfo("|- " + item5.Value + " Upgrade found and registered for bundles: " + item5.Key.itemName, debugOnly: true); } upgradeBundleMeshes = (from mesh in assetBundle.LoadAllAssets() where ((Object)mesh).name.ToLower().Contains("mesh_bundle_upgrade") select mesh).ToList(); foreach (Item key in upgradeParentModDict.Keys) { GenerateUpgradeBundle(key); } } public void GenerateUpgradeBundle(Item baseItem) { //IL_0033: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0150: Expected O, but got Unknown DebugLogger.LogInfo("|-- Generating Upgrade Bundle: " + ((Object)baseItem).name, debugOnly: true); Item val = ScriptableObject.CreateInstance(); GameObject itemPrefab = Object.Instantiate(templateUpgradeBundlePrefab, new Vector3(0f, 100f, 0f), Quaternion.identity); ((Object)itemPrefab).name = ((Object)baseItem).name + " Bundle"; ((Object)val).name = ((Object)baseItem).name + " Bundle"; val.itemName = baseItem.itemName + "s"; val.itemType = BundleHelper.ValidateItemType(baseItem.itemType); val.emojiIcon = baseItem.emojiIcon; val.itemVolume = baseItem.itemVolume; val.itemSecretShopType = baseItem.itemSecretShopType; val.colorPreset = baseItem.colorPreset; val.value = baseItem.value; val.maxAmount = baseItem.maxAmount; val.maxAmountInShop = baseItem.maxAmountInShop; val.maxPurchase = baseItem.maxPurchase; val.maxPurchaseAmount = baseItem.maxPurchaseAmount; val.spawnRotationOffset = baseItem.spawnRotationOffset; val.physicalItem = baseItem.physicalItem; string text = ((PrefabRef)(object)baseItem.prefab).prefabName + " Bundle"; PrefabRef val2 = new PrefabRef(); ((PrefabRef)val2).prefabName = text; ((PrefabRef)val2).resourcePath = "Items/" + text; PrefabRef prefab = val2; val.prefab = prefab; ItemAttributes component = itemPrefab.GetComponent(); component.item = val; ItemUpgradeBundleGenerated component2 = itemPrefab.GetComponent(); component2.originalItem = baseItem; if (((Object)baseItem).name.ToLower().Contains("gold") && GoldItemsCompat.enabled) { GoldItemsCompat.TryAddGoldMarker(((PrefabRef)(object)baseItem.prefab).Prefab, ref itemPrefab); } int index = Random.RandomRangeInt(0, upgradeBundleMeshes.Count); component2.SetBoxMesh(upgradeBundleMeshes[index]); Items.RegisterItem(component); generatedBundles[val] = itemPrefab; } public void InitializeItemBundles() { if (!Object.op_Implicit((Object)(object)assetBundle)) { DebugLogger.LogError("Assetbundle \"itembundles\" not found! Please make sure that it exists in the same folder as the mod DLL"); DebugLogger.LogError("ItemBundles has run into a fatal error! The mod will not work correctly and may cause issues elsewhere!"); return; } InitializeBundle("Item Health Pack Small Bundle", "Health Packs"); InitializeBundle("Item Health Pack Medium Bundle", "Health Packs"); InitializeBundle("Item Health Pack Large Bundle", "Health Packs"); InitializeBundle("Item Grenade Explosive Bundle", "Weapons"); InitializeBundle("Item Grenade Shockwave Bundle", "Weapons"); InitializeBundle("Item Grenade Stun Bundle", "Weapons"); InitializeBundle("Item Mine Explosive Bundle", "Weapons"); InitializeBundle("Item Mine Shockwave Bundle", "Weapons"); InitializeBundle("Item Mine Stun Bundle", "Weapons"); foreach (Item key in generatedBundles.Keys) { ItemUpgradeBundleGenerated component = ((PrefabRef)(object)key.prefab).Prefab.GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.originalItem == (Object)null)) { if (!upgradeParentModDict.TryGetValue(component.originalItem, out string value)) { DebugLogger.LogError("InitializeItemsBundles(): Base item was not found in upgradeParentModDict! Something is broken, skipping bundle initialization for " + key.itemName); } else { InitializeBundle(key, "Upgrades (" + value + ")"); } } } } public void CreateConfigs() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Expected O, but got Unknown //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Expected O, but got Unknown //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Expected O, but got Unknown //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Expected O, but got Unknown //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Expected O, but got Unknown //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Expected O, but got Unknown //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Expected O, but got Unknown //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Expected O, but got Unknown //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Expected O, but got Unknown config_disableBundlesSP = ((BaseUnityPlugin)this).Config.Bind("General", "Disable Bundles in Singleplayer", true, new ConfigDescription("Whether bundles are disabled when doing a singleplayer run", (AcceptableValueBase)null, Array.Empty())); config_chanceBundlesInShop = ((BaseUnityPlugin)this).Config.Bind("General", "Bundle Chance", 20, new ConfigDescription("Percent chance that an item will be replaced with a bundle variant", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); config_maxBundlesInShop = ((BaseUnityPlugin)this).Config.Bind("General", "Maximum Bundles In Shop", -1, new ConfigDescription("Maximum number of bundles that can appear of ANY one type. Setting to -1 makes shop ignore this entry", (AcceptableValueBase)(object)new AcceptableValueRange(-1, 100), Array.Empty())); config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind("General", "Mininum consumables per bundle", 0, new ConfigDescription("Minimum amount of items in non-health bundles. Default: 0", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind("General", "Bundle Price Multiplier", 66.66f, new ConfigDescription("Multiplier of total item costs that bundles have", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 200f), Array.Empty())); string text = "Has priority over General entry. Ignored if set below 0"; itemTypeBundleInfos[(itemType)11] = new BundleShopInfo { config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Mines: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 100), Array.Empty())), config_maxInShop = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Mines: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())), config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Mines: Mininum per bundle", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())), config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Mines: Price Multiplier", -1f, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 200f), Array.Empty())) }; itemTypeBundleInfos[(itemType)6] = new BundleShopInfo { config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Grenades: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 100), Array.Empty())), config_maxInShop = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Grenades: Max", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())), config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Grenades: Mininum per bundle", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())), config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Grenades: Price Multiplier", -1f, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 200f), Array.Empty())) }; itemTypeBundleInfos[(itemType)8] = new BundleShopInfo { config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Health Packs: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 100), Array.Empty())), config_maxInShop = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Health Packs: Max", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())), config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Health Packs: Price Multiplier", -1f, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 200f), Array.Empty())) }; itemTypeBundleInfos[(itemType)3] = new BundleShopInfo { config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Upgrades: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 100), Array.Empty())), config_maxInShop = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Upgrades: Max", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())), config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Upgrades: Mininum per bundle", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())), config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind("Bundles by Type", "Upgrades: Price Multiplier", -1f, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 200f), Array.Empty())) }; config_debugLogging = ((BaseUnityPlugin)this).Config.Bind("Developer", "Debug Logging", false, new ConfigDescription("Enables debug logging", (AcceptableValueBase)null, new object[1] { "HideFromREPOConfig" })); config_debugFakePlayers = ((BaseUnityPlugin)this).Config.Bind("Developer", "Number of Fake Players", 0, new ConfigDescription("Increase all player-related bundle calculations.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 10), new object[1] { "HideFromREPOConfig" })); } internal void RegisterBundleItemRepoLib(string itemString) { GameObject val = assetBundle.LoadAsset(itemString); ItemAttributes component = val.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { DebugLogger.LogError("RegisterBundleItemRepoLib() Failed: ItemAttributes for " + itemString + " was null!"); } else { Items.RegisterItem(component); } } internal void InitializeBundle(string bundleItemString, string configSection = "") { Item val = assetBundle.LoadAsset(bundleItemString); if (!Object.op_Implicit((Object)(object)val)) { DebugLogger.LogError("InitializeBundle() Failed: Bundle Item \"" + bundleItemString + "\" not found!"); } else { InitializeBundle(val, configSection); } } internal void InitializeBundle(Item item, string configSection = "") { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Invalid comparison between Unknown and I4 //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Invalid comparison between Unknown and I4 //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Invalid comparison between Unknown and I4 //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Invalid comparison between Unknown and I4 //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)item)) { DebugLogger.LogError("InitializeBundle() Failed: Bundle Item was null!"); return; } string text = " Bundle"; if (!((Object)item).name.Contains(text)) { DebugLogger.LogError("InitializeBundle() Failed: '" + ((Object)item).name + "' is not a valid bundle name! Add \" Bundle\" to item name (WITH THE SPACE)"); return; } string itemStringFromBundle = BundleHelper.GetItemStringFromBundle(item); if (!StatsManager.instance.itemDictionary.TryGetValue(itemStringFromBundle, out var value)) { DebugLogger.LogError("InitializeBundle() Failed: Didn't find " + itemStringFromBundle + "! Make sure itemAssetName of bundle Item and bundle Prefab is " + itemStringFromBundle + text); return; } if (itemBundleInfos.ContainsKey(itemStringFromBundle)) { DebugLogger.LogWarning("InitializeBundle() Warning: bundleStringPairs " + itemStringFromBundle + " already has an entry, skippping!", debugOnly: true); return; } itemDictionaryShopBlacklist.Add(((PrefabRef)(object)item.prefab).resourcePath, item); if ((int)item.itemType == 3) { item.value = ScriptableObject.CreateInstance(); item.value.valueMin = value.value.valueMin; item.value.valueMax = value.value.valueMax; } string text2 = "Has Priority over Item Type entry. Ignored if set below 0"; BundleShopInfo bundleShopInfo = new BundleShopInfo { bundleItem = item, config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind(configSection ?? "", value.itemName + ": Chance", -1, new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 100), Array.Empty())), config_maxInShop = ((BaseUnityPlugin)this).Config.Bind(configSection ?? "", value.itemName + ": Max", -1, new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())), config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind(configSection ?? "", value.itemName + ": Price Multiplier", -1f, new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 200f), Array.Empty())) }; if ((int)item.itemType == 6 || (int)item.itemType == 11 || (int)item.itemType == 3) { bundleShopInfo.config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind(configSection ?? "", value.itemName + ": Mininum per bundle", -1, new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange(-1, 10), Array.Empty())); } itemBundleInfos[itemStringFromBundle] = bundleShopInfo; DebugLogger.LogInfo("InitializeBundle(): Created BundleShopInfo [" + itemStringFromBundle + " | " + ((PrefabRef)(object)item.prefab).prefabName + "]", debugOnly: true); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { if (!mainMenuReached && Object.op_Implicit((Object)(object)RunManager.instance)) { mainMenuReached = SemiFunc.IsMainMenu(); } } } public static class GoldItemsCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("WorthyOtter.GoldItems"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void TryAddGoldMarker(GameObject baseItem, ref GameObject itemPrefab) { if (Object.op_Implicit((Object)(object)baseItem.GetComponent())) { DebugLogger.LogInfo("|---- GoldItem shop item found!", debugOnly: true); GoldItemMarker val = default(GoldItemMarker); if (!itemPrefab.TryGetComponent(ref val)) { itemPrefab.AddComponent(); } } } } public static class MoreUpgradesCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("bulletbot.moreupgrades"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static float GetOriginalValueMultiplier(string bundleAssetName) { string itemStringFromBundle = BundleHelper.GetItemStringFromBundle(bundleAssetName); Item val = StatsManager.instance.itemDictionary[itemStringFromBundle]; return MoreUpgradesAPI.ItemValueMultiplier(val); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static float GetUpgradeValueIncrease(string bundleAssetName) { string itemStringFromBundle = BundleHelper.GetItemStringFromBundle(bundleAssetName); Item val = StatsManager.instance.itemDictionary[itemStringFromBundle]; return MoreUpgradesAPI.UpgradeValueIncrease(val); } } public static class NoItemSpawnLimitCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("HeroHanex.NoItemSpawnLimit"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool IsGlobalLimitEnabled() { return ConfigManager.RemoveSpawnLimit.Value; } } public static class VanillaUpgradesCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = false; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static float GetUpgradeValueIncrease(float fallbackMult, string bundleAssetName) { string itemStringFromBundle = BundleHelper.GetItemStringFromBundle(bundleAssetName); return Plugin.UpgradeValueIncrease(fallbackMult, itemStringFromBundle); } } public class ItemBundleShopPrompter : MonoBehaviour { public string confirmUnbundlePrompt = "Confirm Unbundle?"; public string previousPrompt = ""; public bool shopConfirm; public void Start() { } } public class ItemConsumableBundle : MonoBehaviour { private ItemToggle itemToggle; private PhotonView photonView; private PhysGrabObject physGrabObject; private PhysGrabObjectImpactDetector impactDetector; public ItemBundleShopPrompter shopPrompter; private Vector3 startPosition; private Quaternion startRotation; public GameObject itemPrefab; private bool used; private void Start() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) itemToggle = ((Component)this).GetComponent(); photonView = ((Component)this).GetComponent(); physGrabObject = ((Component)this).GetComponent(); impactDetector = ((Component)this).GetComponent(); startPosition = ((Component)this).transform.position; startRotation = ((Component)this).transform.rotation; if (!((Component)this).TryGetComponent(ref shopPrompter)) { shopPrompter = ((Component)this).gameObject.AddComponent(); } } private void Update() { if (physGrabObject.playerGrabbing.Count == 0 && shopPrompter.shopConfirm) { shopPrompter.shopConfirm = false; } if (!itemToggle.toggleState || used || used || !itemToggle.toggleState) { return; } if (SemiFunc.RunIsShop() && !shopPrompter.shopConfirm) { shopPrompter.shopConfirm = true; itemToggle.ToggleItem(false, -1); } else if (SemiFunc.IsMasterClientOrSingleplayer()) { SpawnItems(); if (!SemiFunc.RunIsShop()) { StatsManager.instance.ItemRemove(((Component)this).GetComponent().instanceName); } impactDetector.destroyDisable = false; impactDetector.DestroyObject(false); used = true; } } public void SpawnItems() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_00ac: 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_00a5: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_0117: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_0164: Unknown result type (might be due to invalid IL or missing references) int num = SemiFunc.PlayerGetAll().Count + ItemBundles.Instance.config_debugFakePlayers.Value; Item item = ((Component)this).GetComponent().item; if ((int)item.itemType == 6 || (int)item.itemType == 11) { num = Mathf.Max(num, BundleHelper.GetItemBundleMinItem(BundleHelper.GetItemStringFromBundle(item), item.itemType)); } itemType itemType = item.itemType; itemType val = itemType; float num2 = (((int)val == 6) ? 0.25f : (((int)val != 11) ? 0f : 0.5f)); for (int i = 0; i < num; i++) { GameObject val2 = null; Vector3 val3 = ((i == 0) ? Vector3.zero : (Random.insideUnitSphere * num2)); if (!SemiFunc.IsMultiplayer()) { val2 = Object.Instantiate(itemPrefab, ((Component)this).transform.position + val3, Quaternion.identity); } else if (SemiFunc.IsMasterClient()) { val2 = PhotonNetwork.Instantiate("Items/" + ((Object)itemPrefab).name, ((Component)this).transform.position + val3, Quaternion.identity, (byte)0, (object[])null); } if ((Object)(object)val2 == (Object)null) { break; } val2.AddComponent(); ItemLateStartSetter itemLateStartSetter = val2.AddComponent(); itemLateStartSetter.newStartPosition = startPosition; itemLateStartSetter.newStartRotation = startRotation; itemLateStartSetter.enable = true; if ((SemiFunc.IsMasterClient() || !SemiFunc.IsMultiplayer()) && !SemiFunc.RunIsShop()) { StatsManager.instance.ItemPurchase(((PrefabRef)(object)val2.GetComponent().item.prefab).prefabName); } } } } public class ItemHealthPackBundle : MonoBehaviour { public int healAmount; private int healingBank; private ItemToggle itemToggle; private ItemEquippable itemEquippable; private ItemAttributes itemAttributes; private PhotonView photonView; private PhysGrabObject physGrabObject; public ItemBundleShopPrompter shopPrompter; private List playersToHeal; [Space] public ParticleSystem[] particles; public ParticleSystem[] rejectParticles; [Space] public PropLight propLight; public AnimationCurve lightIntensityCurve; private float lightIntensityLerp; public MeshRenderer mesh; private Material material; private Color materialEmissionOriginal; private int materialPropertyEmission = Shader.PropertyToID("_EmissionColor"); [Space] public Sound soundUse; public Sound soundReject; private bool used; private void Start() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) itemToggle = ((Component)this).GetComponent(); itemEquippable = ((Component)this).GetComponent(); itemAttributes = ((Component)this).GetComponent(); photonView = ((Component)this).GetComponent(); physGrabObject = ((Component)this).GetComponent(); if (!((Component)this).TryGetComponent(ref shopPrompter)) { shopPrompter = ((Component)this).gameObject.AddComponent(); } playersToHeal = new List(); material = ((Renderer)mesh).material; materialEmissionOriginal = material.GetColor(materialPropertyEmission); } private void Update() { //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_0193: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.RunIsShop()) { return; } LightLogic(); if (!SemiFunc.IsMasterClientOrSingleplayer() || !itemToggle.toggleState || used) { return; } playersToHeal.Clear(); foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { if (item.playerHealth.health < item.playerHealth.maxHealth && item.playerHealth.health > 0) { healingBank += healAmount; playersToHeal.Add(item); } } healingBank += healAmount * ItemBundles.Instance.config_debugFakePlayers.Value; if (playersToHeal.Count <= 0) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("RejectRPC", (RpcTarget)0, Array.Empty()); } else { RejectRPC(); } itemToggle.ToggleItem(false, -1); physGrabObject.rb.AddForce(Vector3.up * 2f, (ForceMode)1); physGrabObject.rb.AddTorque(-((Component)physGrabObject).transform.right * 0.05f, (ForceMode)1); return; } Dictionary dictionary = new Dictionary(); foreach (PlayerAvatar item2 in playersToHeal) { dictionary[item2] = 0; } while (healingBank > 0 && playersToHeal.Count > 0) { List list = new List(playersToHeal); foreach (PlayerAvatar item3 in playersToHeal) { int num = item3.playerHealth.maxHealth - (item3.playerHealth.health + dictionary[item3]); int num2 = Mathf.Min(healingBank, healAmount); int num3 = Mathf.Min(num, num2); if (num <= num2) { list.Remove(item3); } healingBank = Mathf.Max(healingBank - num3, 0); dictionary[item3] += num3; } playersToHeal = list; } foreach (KeyValuePair item4 in dictionary) { DebugLogger.LogInfo($"{item4.Key.playerName} missing {item4.Key.playerHealth.maxHealth - item4.Key.playerHealth.health} health, healing for {healAmount} base + {item4.Value - healAmount} excess!", debugOnly: true); item4.Key.playerHealth.HealOther(item4.Value, true); } _ = StatsManager.instance.itemsPurchased[((PrefabRef)(object)itemAttributes.item.prefab).prefabName]; StatsManager.instance.ItemRemove(itemAttributes.instanceName); physGrabObject.impactDetector.destroyDisable = false; physGrabObject.impactDetector.indestructibleBreakEffects = true; if (SemiFunc.IsMultiplayer()) { photonView.RPC("UsedRPC", (RpcTarget)0, Array.Empty()); } else { UsedRPC(); } } private void LightLogic() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (used && lightIntensityLerp < 1f) { lightIntensityLerp += 1f * Time.deltaTime; propLight.lightComponent.intensity = lightIntensityCurve.Evaluate(lightIntensityLerp); propLight.originalIntensity = propLight.lightComponent.intensity; material.SetColor(materialPropertyEmission, Color.Lerp(Color.black, materialEmissionOriginal, lightIntensityCurve.Evaluate(lightIntensityLerp))); } } [PunRPC] private void UsedRPC() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, ((Component)this).transform.position, 0.2f); itemToggle.ToggleDisable(true); itemAttributes.DisableUI(true); Object.Destroy((Object)(object)itemEquippable); ParticleSystem[] array = particles; for (int i = 0; i < array.Length; i++) { array[i].Play(); } soundUse.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); used = true; } [PunRPC] private void RejectRPC() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID); if (val.isLocal) { val.physGrabber.ReleaseObjectRPC(false, 1f, photonView.ViewID, default(PhotonMessageInfo)); } ParticleSystem[] array = rejectParticles; for (int i = 0; i < array.Length; i++) { array[i].Play(); } GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, ((Component)this).transform.position, 0.2f); soundReject.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } public void OnDestroy() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] array = particles; ParticleSystem[] array2 = array; foreach (ParticleSystem val in array2) { if (Object.op_Implicit((Object)(object)val) && val.isPlaying) { ((Component)val).transform.SetParent((Transform)null); MainModule main = val.main; ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)2; } } array = rejectParticles; ParticleSystem[] array3 = array; foreach (ParticleSystem val2 in array3) { if (Object.op_Implicit((Object)(object)val2) && val2.isPlaying) { ((Component)val2).transform.SetParent((Transform)null); MainModule main2 = val2.main; ((MainModule)(ref main2)).stopAction = (ParticleSystemStopAction)2; } } } } public class ItemLateImpulse : MonoBehaviour { private PhysGrabObject physGrabObject; private Rigidbody rb; private Vector3 direction = Vector3.zero; private float forceMin = 1f; private float forceMax = 5f; private float forceMult = 1f; public void Start() { physGrabObject = ((Component)this).GetComponent(); rb = ((Component)this).GetComponent(); ((MonoBehaviour)this).StartCoroutine(LateSpawn()); } private IEnumerator LateSpawn() { while (!physGrabObject.spawned || rb.isKinematic) { yield return null; } Vector3 vector = ((direction == Vector3.zero) ? Random.insideUnitSphere : direction); rb.AddForce(vector * forceMult * Random.Range(forceMin, forceMax), (ForceMode)1); rb.AddTorque(Random.insideUnitSphere * forceMult * Random.Range(forceMin, forceMax), (ForceMode)1); } } public class ItemLateStartSetter : MonoBehaviour { private PhysGrabObject physGrabObject; private Rigidbody rb; public Vector3 newStartPosition = Vector3.zero; public Quaternion newStartRotation = Quaternion.identity; public bool enable; public void Start() { physGrabObject = ((Component)this).GetComponent(); rb = ((Component)this).GetComponent(); ((MonoBehaviour)this).StartCoroutine(LateSpawn()); } private IEnumerator LateSpawn() { while (!physGrabObject.spawned || rb.isKinematic || !enable) { yield return null; } ItemGrenade grenadeComponent = ((Component)this).GetComponent(); if ((Object)(object)grenadeComponent != (Object)null) { grenadeComponent.grenadeStartPosition = newStartPosition; grenadeComponent.grenadeStartRotation = newStartRotation; } ItemMine mineComponent = ((Component)this).GetComponent(); if ((Object)(object)mineComponent != (Object)null) { mineComponent.startPosition = newStartPosition; mineComponent.startRotation = newStartRotation; } } } public class ItemUpgradeBundleGenerated : MonoBehaviour { private ItemToggle itemToggle; private bool used; private Rigidbody rb; private PhotonTransformView photonTransformView; private PhysGrabObject physGrabObject; private PhysGrabObjectImpactDetector impactDetector; public ItemBundleShopPrompter shopPrompter; public Item? originalItem; public bool isPrefab; private void Awake() { itemToggle = ((Component)this).GetComponent(); rb = ((Component)this).GetComponent(); photonTransformView = ((Component)this).GetComponent(); physGrabObject = ((Component)this).GetComponent(); impactDetector = ((Component)this).GetComponent(); if (!((Component)this).TryGetComponent(ref shopPrompter)) { shopPrompter = ((Component)this).gameObject.AddComponent(); } if (BundleHelper.SceneIsPrefabStage()) { ((Object)this).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); impactDetector.destroyDisable = true; ((Component)this).transform.parent = ((Component)BundleManager.instance).transform; rb.isKinematic = true; isPrefab = true; } else { impactDetector.destroyDisable = false; rb.isKinematic = false; ((Component)this).GetComponent().autoAdd = true; } } private void Start() { if (BundleHelper.SceneIsPrefabStage()) { ((MonoBehaviour)this).StartCoroutine(LateStart(0.1f)); } else { if (SemiFunc.RunIsLobby() || SemiFunc.RunIsLevel()) { ((MonoBehaviour)this).StartCoroutine(LateTruckStart(0.01f)); } rb.isKinematic = false; isPrefab = false; ((Behaviour)photonTransformView).enabled = true; } UpdateMaterial(); UpdateLightColor(); } private IEnumerator LateStart(float waitTime) { yield return (object)new WaitForSeconds(waitTime); ((Component)this).transform.parent = ((Component)BundleManager.instance).transform; rb.isKinematic = true; rb.rotation = Quaternion.identity; } private IEnumerator LateTruckStart(float waitTime) { yield return (object)new WaitForSeconds(waitTime); Rigidbody obj = rb; obj.position += new Vector3(-0.25f, 0f, 0f); } private void Update() { if (SemiFunc.RunIsShop()) { ((Behaviour)itemToggle).enabled = true; } if (physGrabObject.playerGrabbing.Count == 0 && shopPrompter.shopConfirm) { shopPrompter.shopConfirm = false; } if (!itemToggle.toggleState || used || (Object)(object)originalItem == (Object)null || used || !itemToggle.toggleState) { return; } if (SemiFunc.RunIsShop() && !shopPrompter.shopConfirm) { shopPrompter.shopConfirm = true; itemToggle.ToggleItem(false, -1); } else if (SemiFunc.IsMasterClientOrSingleplayer()) { SpawnItems(); if (!SemiFunc.RunIsShop()) { StatsManager.instance.ItemRemove(((Component)this).GetComponent().instanceName); } impactDetector.destroyDisable = false; impactDetector.DestroyObject(false); used = true; } } public void SpawnItems() { //IL_0042: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00cd: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) int num = SemiFunc.PlayerGetAll().Count + ItemBundles.Instance.config_debugFakePlayers.Value; num = Mathf.Max(num, BundleHelper.GetItemBundleMinItem(originalItem)); for (int i = 0; i < num; i++) { float num2 = 0.075f; Vector3 val = -((Component)this).transform.forward * num2 * (float)(i - 1); GameObject val2 = null; if (SemiFunc.IsMasterClient()) { val2 = PhotonNetwork.Instantiate(((PrefabRef)(object)originalItem.prefab).resourcePath, ((Component)this).transform.position + val, ((Component)this).gameObject.transform.rotation, (byte)0, (object[])null); } else if (!SemiFunc.IsMultiplayer()) { val2 = Object.Instantiate(((PrefabRef)(object)originalItem.prefab).Prefab, ((Component)this).transform.position + val, ((Component)this).gameObject.transform.rotation); } if ((Object)(object)val2 == (Object)null) { break; } if ((SemiFunc.IsMasterClient() || !SemiFunc.IsMultiplayer()) && !SemiFunc.RunIsShop()) { StatsManager.instance.ItemPurchase(((PrefabRef)(object)val2.GetComponent().item.prefab).prefabName); StatsManager.instance.AddItemsUpgradesPurchased(((PrefabRef)(object)val2.GetComponent().item.prefab).prefabName); } } } public void SetBoxMesh(Mesh mesh) { if (Object.op_Implicit((Object)(object)mesh)) { Transform val = ((Component)this).gameObject.transform.Find("Mesh"); MeshFilter component = ((Component)val).GetComponent(); component.mesh = mesh; } } public Material? GetOriginalBoxMat() { if ((Object)(object)originalItem == (Object)null) { return null; } Item val = originalItem; Material val2 = null; Transform val3 = ((PrefabRef)(object)val.prefab).Prefab.transform.Find("Mesh"); MeshRenderer component = ((Component)val3).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { val2 = ((Renderer)component).materials[0]; } if (!Object.op_Implicit((Object)(object)val2)) { DebugLogger.LogError("- GetBoxMat " + ((PrefabRef)(object)originalItem.prefab).prefabName + " failed, returning NULL", debugOnly: true); } else { DebugLogger.LogInfo($"- GetBoxMat returning {val2}", debugOnly: true); } return val2; } public Light? GetOriginalLight() { Item val = originalItem; if ((Object)(object)val == (Object)null) { return null; } Transform val2 = ((PrefabRef)(object)val.prefab).Prefab.transform.Find("Light - Small Lamp"); if (!Object.op_Implicit((Object)(object)val2)) { return null; } return ((Component)val2).GetComponent(); } public void UpdateMaterial() { Material originalBoxMat = GetOriginalBoxMat(); if (!((Object)(object)originalBoxMat == (Object)null)) { Transform val = ((Component)this).transform.Find("Mesh"); MeshRenderer component = ((Component)val).GetComponent(); if (((Object)((Renderer)component).materials[0]).name.Contains("upgrade")) { Material[] materials = (Material[])(object)new Material[2] { originalBoxMat, ((Renderer)component).materials[1] }; ((Renderer)component).materials = materials; } } } public void UpdateLightColor() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) Light component = ((Component)((Component)this).gameObject.transform.Find("Light - Small Lamp")).GetComponent(); Light originalLight = GetOriginalLight(); if ((Object)(object)component != (Object)null && (Object)(object)originalLight != (Object)null) { component.color = originalLight.color; } } public void OnDestroy() { } } }