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 HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreUpgrades;
using MoreUpgrades.Classes;
using Photon.Pun;
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("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("MoreUpgrades")]
[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")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[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.4.1.0")]
[assembly: AssemblyInformationalVersion("1.4.1")]
[assembly: AssemblyProduct("ItemBundles")]
[assembly: AssemblyTitle("ItemBundles")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.1.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_000c: Unknown result type (might be due to invalid IL or missing references)
int chanceInShop = ItemBundles.Instance.itemTypeBundleInfos[item.itemType].chanceInShop;
if (ItemBundles.Instance.itemBundleInfos[item.itemAssetName].chanceInShop >= 0)
{
chanceInShop = ItemBundles.Instance.itemBundleInfos[item.itemAssetName].chanceInShop;
}
return chanceInShop;
}
public static int GetItemBundleMax(Item item)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
int maxInShop = ItemBundles.Instance.itemTypeBundleInfos[item.itemType].maxInShop;
if (ItemBundles.Instance.itemBundleInfos[item.itemAssetName].maxInShop >= 0)
{
maxInShop = ItemBundles.Instance.itemBundleInfos[item.itemAssetName].maxInShop;
}
return maxInShop;
}
public static int GetItemBundleMinItem(Item item)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
int value = ItemBundles.Instance.config_minPerBundle.Value;
if (ItemBundles.Instance.itemTypeBundleInfos[item.itemType].config_minPerBundle.Value >= 0)
{
value = ItemBundles.Instance.itemTypeBundleInfos[item.itemType].config_minPerBundle.Value;
}
if (ItemBundles.Instance.itemBundleInfos[item.itemAssetName].config_minPerBundle.Value >= 0)
{
value = ItemBundles.Instance.itemBundleInfos[item.itemAssetName].config_minPerBundle.Value;
}
return value;
}
public static int GetItemBundleMinItem(string itemString, itemType itemType)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
int value = ItemBundles.Instance.config_minPerBundle.Value;
if (ItemBundles.Instance.itemTypeBundleInfos[itemType].config_minPerBundle.Value >= 0)
{
value = ItemBundles.Instance.itemTypeBundleInfos[itemType].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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
float value = ItemBundles.Instance.config_priceMultiplier.Value;
if (ItemBundles.Instance.itemTypeBundleInfos[itemType].config_priceMultiplier.Value >= 0f)
{
value = ItemBundles.Instance.itemTypeBundleInfos[itemType].config_priceMultiplier.Value;
}
if (ItemBundles.Instance.itemBundleInfos[itemString].config_priceMultiplier.Value >= 0f)
{
value = ItemBundles.Instance.itemBundleInfos[itemString].config_priceMultiplier.Value;
}
return value;
}
public static string GetItemStringFromBundle(Item bundleItem)
{
string itemAssetName = bundleItem.itemAssetName;
return GetItemStringFromBundle(itemAssetName);
}
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<PlayerAvatar> PlayerGetAllAlive()
{
List<PlayerAvatar> list = new List<PlayerAvatar>();
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<ItemUpgradeBundleGenerated>();
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 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("Start")]
public static void Start_Postfix(StatsManager __instance)
{
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_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Invalid comparison between Unknown and I4
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Invalid comparison between Unknown and I4
//IL_01a1: 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)
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 itemValueMultiplier = ShopManager.instance.itemValueMultiplier;
float upgradeValueIncrease = ShopManager.instance.upgradeValueIncrease;
if (itemAssetName.Contains("Modded") && MoreUpgradesCompat.enabled)
{
itemValueMultiplier = MoreUpgradesCompat.GetItemValueMultiplier(itemValueMultiplier, itemAssetName);
upgradeValueIncrease = MoreUpgradesCompat.GetUpgradeValueIncrease(upgradeValueIncrease, itemAssetName);
}
else if (VanillaUpgradesCompat.enabled)
{
upgradeValueIncrease = VanillaUpgradesCompat.GetUpgradeValueIncrease(upgradeValueIncrease, itemAssetName);
}
float num2 = Random.Range(__instance.itemValueMin, __instance.itemValueMax) * itemValueMultiplier;
num2 = Mathf.Max(num2, 1000f);
num2 = Mathf.CeilToInt(num2 / 1000f);
DebugLogger.LogInfo($"base {num2}, upgradeIncreaseMult {upgradeValueIncrease}, num items {(float)StatsManager.instance.GetItemsUpgradesPurchased(BundleHelper.GetItemStringFromBundle(__instance.itemAssetName))}", debugOnly: true);
num2 += num2 * upgradeValueIncrease * (float)StatsManager.instance.GetItemsUpgradesPurchased(BundleHelper.GetItemStringFromBundle(__instance.itemAssetName));
num = (int)num2;
}
if ((int)__instance.itemType == 6 || (int)__instance.itemType == 11)
{
count = Mathf.Max(count, BundleHelper.GetItemBundleMinItem(BundleHelper.GetItemStringFromBundle(__instance.item), __instance.itemType));
}
if (count > 1)
{
float num3 = BundleHelper.GetItemBundlePriceMult(BundleHelper.GetItemStringFromBundle(__instance.item), __instance.itemType) / 100f;
float num4 = (float)count * num3;
num = Mathf.RoundToInt((float)num * num4);
}
__instance.value = num;
if (GameManager.Multiplayer())
{
__instance.photonView.RPC("GetValueRPC", (RpcTarget)1, new object[1] { __instance.value });
}
}
[HarmonyTranspiler]
[HarmonyPatch("ShowingInfo")]
private static IEnumerable<CodeInstruction> ShowingInfo_Transpiler(IEnumerable<CodeInstruction> 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: 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");
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)
});
DebugLogger.LogInfo("--- ShowingInfo(): ADDING NEW INSTRUCTIONS", debugOnly: true);
return val.InstructionEnumeration();
}
[HarmonyPostfix]
[HarmonyPatch("ShowingInfo")]
private static void ShowingInfo_Postfix(ItemAttributes __instance)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Invalid comparison between Unknown and I4
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Invalid comparison between Unknown and I4
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
string promptName = __instance.promptName;
string value = "Bundle";
if (__instance.itemAssetName.Contains(value))
{
string text = "";
int num = SemiFunc.PlayerGetAll().Count + ItemBundles.Instance.config_debugFakePlayers.Value;
if ((int)__instance.itemType == 8)
{
int healAmount = ((Component)__instance).GetComponent<ItemHealthPackBundle>().healAmount;
text = BundleHelper.PlayerGetAllAlive().Count * healAmount + "hp";
}
else if ((int)__instance.itemType == 6 || (int)__instance.itemType == 11)
{
text = Mathf.Max(num, BundleHelper.GetItemBundleMinItem(BundleHelper.GetItemStringFromBundle(__instance.item), __instance.itemType)).ToString();
}
else if ((int)__instance.itemType == 3)
{
text = num.ToString();
}
promptName = promptName + "\n[Bundle of " + text + "]";
__instance.promptName = promptName;
}
}
}
[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("------ Overriding Shop List", debugOnly: true);
ItemBundles.Instance.itemDictionaryShop.Clear();
foreach (KeyValuePair<string, Item> item in StatsManager.instance.itemDictionary)
{
List<string> list = ItemBundles.Instance.itemDictionaryShopBlacklist.Keys.ToList();
List<Item> 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<CodeInstruction> GetAllItemsFromStatsManager_Transpiler(IEnumerable<CodeInstruction> 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)
{
foreach (KeyValuePair<itemType, ItemBundles.BundleShopInfo> itemTypeBundleInfo in ItemBundles.Instance.itemTypeBundleInfos)
{
itemTypeBundleInfo.Value.chanceInShop = ((itemTypeBundleInfo.Value.config_chanceInShop.Value == -1) ? ItemBundles.Instance.config_chanceBundlesInShop.Value : itemTypeBundleInfo.Value.config_chanceInShop.Value);
itemTypeBundleInfo.Value.maxInShop = ((itemTypeBundleInfo.Value.config_maxInShop.Value == -1) ? ItemBundles.Instance.config_maxBundlesInShop.Value : itemTypeBundleInfo.Value.config_maxInShop.Value);
}
foreach (KeyValuePair<string, ItemBundles.BundleShopInfo> itemBundleInfo in ItemBundles.Instance.itemBundleInfos)
{
itemBundleInfo.Value.chanceInShop = itemBundleInfo.Value.config_chanceInShop.Value;
itemBundleInfo.Value.maxInShop = itemBundleInfo.Value.config_maxInShop.Value;
}
DebugLogger.LogInfo("------ Bundling Lists", debugOnly: true);
if (SemiFunc.IsMultiplayer() || !ItemBundles.Instance.config_disableBundlesSP.Value)
{
AttemptBundlesFromList(ref __instance.potentialItems);
AttemptBundlesFromList(ref __instance.potentialItemConsumables);
AttemptBundlesFromList(ref __instance.potentialItemUpgrades);
AttemptBundlesFromList(ref __instance.potentialItemHealthPacks);
}
}
private static void AttemptBundlesFromList(ref List<Item> itemList)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
List<Item> list = new List<Item>(itemList);
for (int num = list.Count - 1; num >= 0; num--)
{
Item val = list[num];
if (ItemBundles.Instance.itemBundleInfos.ContainsKey(val.itemAssetName))
{
ItemBundles.BundleShopInfo bundleShopInfo = ItemBundles.Instance.itemTypeBundleInfos[val.itemType];
ItemBundles.BundleShopInfo bundleShopInfo2 = ItemBundles.Instance.itemBundleInfos[val.itemAssetName];
if (!Object.op_Implicit((Object)(object)bundleShopInfo2.bundleItem.prefab))
{
DebugLogger.LogInfo($"{bundleShopInfo2.bundleItem} prefab was null! Skipping entry", debugOnly: true);
}
else
{
float num2 = BundleHelper.GetItemBundleChance(val);
num2 /= 100f;
if (BundleHelper.GetItemBundleMax(val) == 0)
{
DebugLogger.LogWarning($"-{num}- Already have max bundles for {val.itemAssetName}!", debugOnly: true);
}
else
{
float num3 = Random.Range(0f, 1f);
if (num3 <= num2)
{
DebugLogger.LogWarning($"-{num}- Passed with {num3} {num3 <= num2}, Replacing item {list[num]} with {bundleShopInfo2.bundleItem}!", debugOnly: true);
list[num] = bundleShopInfo2.bundleItem;
if (bundleShopInfo.maxInShop > 0)
{
bundleShopInfo.maxInShop--;
}
if (bundleShopInfo2.maxInShop > 0)
{
bundleShopInfo2.maxInShop--;
}
}
else
{
DebugLogger.LogError($"-{num}- Failed with {num3} {num3 <= num2}, keeping item {list[num]}!", debugOnly: true);
}
}
}
}
}
ListExtension.Shuffle<Item>((IList<Item>)list);
itemList = list;
}
}
[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.4.1")]
[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 chanceInShop;
public int maxInShop;
public ConfigEntry<int> config_chanceInShop;
public ConfigEntry<int> config_maxInShop;
public ConfigEntry<int> config_minPerBundle;
public ConfigEntry<float> config_priceMultiplier;
}
public AssetBundle assetBundle;
public Dictionary<string, Item> itemDictionaryShop = new Dictionary<string, Item>();
public Dictionary<string, Item> itemDictionaryShopBlacklist = new Dictionary<string, Item>();
public Dictionary<itemType, BundleShopInfo> itemTypeBundleInfos = new Dictionary<itemType, BundleShopInfo>();
public Dictionary<string, BundleShopInfo> itemBundleInfos = new Dictionary<string, BundleShopInfo>();
public Dictionary<Item, GameObject> generatedBundles = new Dictionary<Item, GameObject>();
public List<Item> allUpgradesVanilla = new List<Item>();
public List<Item> allUpgradesREPOLib = new List<Item>();
public List<Item> allUpgrades = new List<Item>();
public List<Mesh> upgradeBundleMeshes = new List<Mesh>();
public static ItemBundles Instance { get; private set; }
internal Harmony? Harmony { get; set; }
public ConfigEntry<bool> config_disableBundlesSP { get; private set; }
public ConfigEntry<int> config_chanceBundlesInShop { get; private set; }
public ConfigEntry<int> config_maxBundlesInShop { get; private set; }
public ConfigEntry<int> config_minPerBundle { get; private set; }
public ConfigEntry<float> config_priceMultiplier { get; private set; }
public ConfigEntry<int> config_debugFakePlayers { get; private set; }
public ConfigEntry<bool> 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<BundleManager>();
((Object)val).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)val);
if (MoreUpgradesCompat.enabled)
{
MoreUpgradesCompat.InitCompat();
DebugLogger.LogInfo("MoreUpgradesCompat has loaded!", debugOnly: true);
}
if (VanillaUpgradesCompat.enabled)
{
VanillaUpgradesCompat.InitCompat();
DebugLogger.LogInfo("VanillaUpgradesCompat has loaded!", debugOnly: true);
}
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>("Item Upgrade Bundle Template");
templateUpgradeBundlePrefab = val.prefab;
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;
}
allUpgradesVanilla.Clear();
allUpgrades.Clear();
allUpgradesVanilla = (from item in Resources.LoadAll<Item>("items/items")
where ((Object)item).name.ToLower().Contains("upgrade") && ((Object)item).name.ToLower().Contains("player") && (Object)(object)item.prefab != (Object)null
select item).ToList();
allUpgrades = new List<Item>(allUpgradesVanilla);
foreach (PlayerUpgrade playerUpgrade in Upgrades.PlayerUpgrades)
{
Item item2 = playerUpgrade.Item;
if (Object.op_Implicit((Object)(object)item2) && Object.op_Implicit((Object)(object)item2.prefab))
{
allUpgradesREPOLib.Add(item2);
allUpgrades.Add(item2);
}
}
if (MoreUpgradesCompat.enabled)
{
allUpgrades.AddRange(MoreUpgradesCompat.allUpgrades);
}
upgradeBundleMeshes = (from mesh in assetBundle.LoadAllAssets<Mesh>()
where ((Object)mesh).name.ToLower().Contains("mesh_bundle_upgrade")
select mesh).ToList();
foreach (Item allUpgrade in allUpgrades)
{
GenerateUpgradeBundle(allUpgrade);
}
}
public bool ValidateExistingBundle(Item upgradeItem)
{
Item val = assetBundle.LoadAsset<Item>(upgradeItem.itemAssetName + " Bundle.asset");
if (!Object.op_Implicit((Object)(object)val))
{
return false;
}
if (!Object.op_Implicit((Object)(object)val.prefab))
{
return false;
}
Items.RegisterItem(val);
return true;
}
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_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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_00b0: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
DebugLogger.LogInfo("Generating Upgrade Bundle: " + ((Object)baseItem).name, debugOnly: true);
Item val = ScriptableObject.CreateInstance<Item>();
GameObject val2 = Object.Instantiate<GameObject>(templateUpgradeBundlePrefab, new Vector3(0f, 100f, 0f), Quaternion.identity);
((Object)val2).name = ((Object)baseItem).name + " Bundle";
((Object)val).name = ((Object)baseItem).name + " Bundle";
val.itemAssetName = baseItem.itemAssetName + " Bundle";
val.itemName = baseItem.itemName + "s";
val.itemType = baseItem.itemType;
val.emojiIcon = baseItem.emojiIcon;
val.itemVolume = baseItem.itemVolume;
val.itemSecretShopType = baseItem.itemSecretShopType;
val.colorPreset = baseItem.colorPreset;
val.prefab = val2;
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;
ItemAttributes component = val2.GetComponent<ItemAttributes>();
component.item = val;
ItemUpgradeBundleGenerated component2 = val2.GetComponent<ItemUpgradeBundleGenerated>();
component2.originalItem = baseItem;
int index = Random.RandomRangeInt(0, upgradeBundleMeshes.Count);
component2.SetBoxMesh(upgradeBundleMeshes[index]);
Items.RegisterItem(val);
generatedBundles[val] = val2;
}
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");
InitializeBundle("Item Health Pack Medium Bundle");
InitializeBundle("Item Health Pack Large Bundle");
InitializeBundle("Item Grenade Explosive Bundle");
InitializeBundle("Item Grenade Shockwave Bundle");
InitializeBundle("Item Grenade Stun Bundle");
InitializeBundle("Item Mine Explosive Bundle");
InitializeBundle("Item Mine Shockwave Bundle");
InitializeBundle("Item Mine Stun Bundle");
foreach (Item key in generatedBundles.Keys)
{
string configSectionPrefix = "";
ItemUpgradeBundleGenerated component = key.prefab.GetComponent<ItemUpgradeBundleGenerated>();
if (!allUpgradesVanilla.Contains(component.originalItem))
{
configSectionPrefix = "Modded ";
}
if (MoreUpgradesCompat.enabled && MoreUpgradesCompat.allUpgrades.Contains(component.originalItem))
{
configSectionPrefix = "MoreUpgrades ";
}
InitializeBundle(key, configSectionPrefix);
}
}
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<bool>("General", "Disable Bundles in Singleplayer", true, new ConfigDescription("Whether bundles are disabled when doing a singleplayer run", (AcceptableValueBase)null, Array.Empty<object>()));
config_chanceBundlesInShop = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Bundle Chance", 20, new ConfigDescription("Percent chance that an item will be replaced with a bundle variant", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
config_maxBundlesInShop = ((BaseUnityPlugin)this).Config.Bind<int>("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<int>(-1, 10), Array.Empty<object>()));
config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Mininum consumables per bundle", 0, new ConfigDescription("Minimum amount of items in valid bundles. Price still scales. Default: 0", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Bundle Price Multiplier", 66.66f, new ConfigDescription("Multiplier of total item costs that bundles have", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>()));
string text = "Has Priority over General entry. Ignored if set below 0";
itemTypeBundleInfos[(itemType)11] = new BundleShopInfo
{
config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Mines: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100), Array.Empty<object>())),
config_maxInShop = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Mines: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>())),
config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Mines: Mininum per bundle", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>())),
config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Bundles: Item Type", "Mines: Price Multiplier", -1f, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 200f), Array.Empty<object>()))
};
itemTypeBundleInfos[(itemType)6] = new BundleShopInfo
{
config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Grenades: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100), Array.Empty<object>())),
config_maxInShop = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Grenades: Max", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>())),
config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Grenades: Mininum per bundle", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>())),
config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Bundles: Item Type", "Grenades: Price Multiplier", -1f, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 200f), Array.Empty<object>()))
};
itemTypeBundleInfos[(itemType)8] = new BundleShopInfo
{
config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Health Packs: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100), Array.Empty<object>())),
config_maxInShop = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Health Packs: Max", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>())),
config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Bundles: Item Type", "Health Packs: Price Multiplier", -1f, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 200f), Array.Empty<object>()))
};
itemTypeBundleInfos[(itemType)3] = new BundleShopInfo
{
config_chanceInShop = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Upgrades: Chance", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100), Array.Empty<object>())),
config_maxInShop = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Upgrades: Max", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>())),
config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind<int>("Bundles: Item Type", "Upgrades: Mininum per bundle", -1, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>())),
config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Bundles: Item Type", "Upgrades: Price Multiplier", -1f, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 200f), Array.Empty<object>()))
};
config_debugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev", "Debug Logging", false, new ConfigDescription("Enables debug logging", (AcceptableValueBase)null, new object[1] { "HideFromREPOConfig" }));
config_debugFakePlayers = ((BaseUnityPlugin)this).Config.Bind<int>("Dev", "Number of Fake Players", 0, new ConfigDescription("Adds fake players to bundle player calculations", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), new object[1] { "HideFromREPOConfig" }));
}
internal void RegisterBundleItemRepoLib(string itemString)
{
Item val = assetBundle.LoadAsset<Item>(itemString);
if (!Object.op_Implicit((Object)(object)val))
{
DebugLogger.LogError("RegisterBundleItemRepoLib() Failed: Item " + itemString + " not found!");
}
else
{
Items.RegisterItem(val);
}
}
internal void InitializeBundle(string bundleItemString, string configSectionPrefix = "")
{
Item val = assetBundle.LoadAsset<Item>(bundleItemString);
if (!Object.op_Implicit((Object)(object)val))
{
DebugLogger.LogError("InitializeBundle() Failed: Bundle Item \"" + bundleItemString + "\" not found!");
}
else
{
InitializeBundle(val, configSectionPrefix);
}
}
internal void InitializeBundle(Item item, string configSectionPrefix = "")
{
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Invalid comparison between Unknown and I4
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Expected O, but got Unknown
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Expected O, but got Unknown
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Expected O, but got Unknown
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Invalid comparison between Unknown and I4
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Invalid comparison between Unknown and I4
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Invalid comparison between Unknown and I4
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: 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 (!item.itemAssetName.Contains(text))
{
DebugLogger.LogError("InitializeBundle() Failed: Item " + item.itemAssetName + " is not a bundle! Add \" Bundle\" to item name (WITH THE SPACE)");
return;
}
string itemStringFromBundle = BundleHelper.GetItemStringFromBundle(item);
Item val = StatsManager.instance.itemDictionary[itemStringFromBundle];
if (!Object.op_Implicit((Object)(object)val))
{
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 {itemBundleInfos[itemStringFromBundle]}, we are overriding something!");
}
itemDictionaryShopBlacklist.Add(item.itemAssetName, item);
if ((int)item.itemType == 3)
{
item.value = ScriptableObject.CreateInstance<Value>();
item.value.valueMin = val.value.valueMin;
item.value.valueMax = val.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<int>(configSectionPrefix + "Bundles: Item", val.itemName + ": Chance", -1, new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 100), Array.Empty<object>())),
config_maxInShop = ((BaseUnityPlugin)this).Config.Bind<int>(configSectionPrefix + "Bundles: Item", val.itemName + ": Max", -1, new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>())),
config_priceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>(configSectionPrefix + "Bundles: Item", val.itemName + ": Price Multiplier", -1f, new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 200f), Array.Empty<object>()))
};
if ((int)item.itemType == 6 || (int)item.itemType == 11 || (int)item.itemType == 3)
{
bundleShopInfo.config_minPerBundle = ((BaseUnityPlugin)this).Config.Bind<int>(configSectionPrefix + "Bundles: Item", val.itemName + ": Mininum per bundle", -1, new ConfigDescription(text2, (AcceptableValueBase)(object)new AcceptableValueRange<int>(-1, 10), Array.Empty<object>()));
}
itemBundleInfos[itemStringFromBundle] = bundleShopInfo;
DebugLogger.LogInfo("InitializeBundle() Debug: Added bundleInfo { " + itemStringFromBundle + " | " + item.itemAssetName + " }", 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 MoreUpgradesCompat
{
private static bool? _enabled;
public static List<Item> allUpgrades = new List<Item>();
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("bulletbot.moreupgrades");
}
return _enabled.Value;
}
}
public static void InitCompat()
{
Plugin instance = Plugin.instance;
allUpgrades.Clear();
foreach (UpgradeItem upgradeItem in instance.upgradeItems)
{
Item val = instance.assetBundle.LoadAsset<Item>(upgradeItem.name);
DebugLogger.LogInfo($"MoreUpgradesCompat: Init {upgradeItem}, {val}");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.prefab))
{
allUpgrades.Add(val);
}
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static float GetItemValueMultiplier(float fallbackMult, string bundleAssetName)
{
string itemStringFromBundle = BundleHelper.GetItemStringFromBundle(bundleAssetName);
return Plugin.ItemValueMultiplier(fallbackMult, itemStringFromBundle);
}
[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 ItemConsumableBundle : MonoBehaviour
{
private ItemToggle itemToggle;
private PhotonView photonView;
private PhysGrabObjectImpactDetector impactDetector;
public GameObject itemPrefab;
private bool used;
private void Start()
{
itemToggle = ((Component)this).GetComponent<ItemToggle>();
photonView = ((Component)this).GetComponent<PhotonView>();
impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
}
private void Update()
{
if (!SemiFunc.RunIsShop() && SemiFunc.IsMasterClientOrSingleplayer() && itemToggle.toggleState && !used && !used && itemToggle.toggleState)
{
SpawnItems();
StatsManager.instance.ItemRemove(((Component)this).GetComponent<ItemAttributes>().instanceName);
impactDetector.destroyDisable = false;
impactDetector.DestroyObject(false);
used = true;
}
}
public void SpawnItems()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Invalid comparison between Unknown and I4
//IL_003b: 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_0063: Invalid comparison between Unknown and I4
//IL_0097: 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_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
int num = SemiFunc.PlayerGetAll().Count;
Item item = ((Component)this).GetComponent<ItemAttributes>().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));
if (!SemiFunc.IsMultiplayer())
{
for (int i = 0; i < num + ItemBundles.Instance.config_debugFakePlayers.Value; i++)
{
Vector3 val2 = Vector3.zero;
if (i != 0)
{
val2 = Random.insideUnitSphere * num2;
}
GameObject val3 = Object.Instantiate<GameObject>(itemPrefab, ((Component)this).transform.position + val2, Quaternion.identity);
val3.AddComponent<ItemLateImpulse>();
StatsManager.instance.ItemPurchase(val3.GetComponent<ItemAttributes>().item.itemAssetName);
}
}
else
{
if (!SemiFunc.IsMasterClient())
{
return;
}
for (int j = 0; j < num + ItemBundles.Instance.config_debugFakePlayers.Value; j++)
{
Vector3 val4 = Vector3.zero;
if (j != 0)
{
val4 = Random.insideUnitSphere * num2;
}
GameObject val5 = PhotonNetwork.Instantiate("Items/" + ((Object)itemPrefab).name, ((Component)this).transform.position + val4, Quaternion.identity, (byte)0, (object[])null);
val5.AddComponent<ItemLateImpulse>();
StatsManager.instance.ItemPurchase(val5.GetComponent<ItemAttributes>().item.itemAssetName);
}
}
}
}
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;
private List<PlayerAvatar> 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
itemToggle = ((Component)this).GetComponent<ItemToggle>();
itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
itemAttributes = ((Component)this).GetComponent<ItemAttributes>();
photonView = ((Component)this).GetComponent<PhotonView>();
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
playersToHeal = new List<PlayerAvatar>();
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<object>());
}
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<PlayerAvatar, int> dictionary = new Dictionary<PlayerAvatar, int>();
foreach (PlayerAvatar item2 in playersToHeal)
{
dictionary[item2] = 0;
}
while (healingBank > 0 && playersToHeal.Count > 0)
{
List<PlayerAvatar> list = new List<PlayerAvatar>(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<PlayerAvatar, int> 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[itemAttributes.item.itemAssetName];
StatsManager.instance.ItemRemove(itemAttributes.instanceName);
physGrabObject.impactDetector.destroyDisable = false;
physGrabObject.impactDetector.indestructibleBreakEffects = true;
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UsedRPC", (RpcTarget)0, Array.Empty<object>());
}
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_0075: 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)
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID);
if (val.isLocal)
{
val.physGrabber.ReleaseObjectRPC(false, 1f);
}
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<PhysGrabObject>();
rb = ((Component)this).GetComponent<Rigidbody>();
((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 ItemUpgradeBundleGenerated : MonoBehaviour
{
private ItemToggle itemToggle;
private PhotonTransformView photonTransformView;
private PhysGrabObjectImpactDetector impactDetector;
public Item originalItem;
public bool isPrefab;
private void Awake()
{
itemToggle = ((Component)this).GetComponent<ItemToggle>();
photonTransformView = ((Component)this).GetComponent<PhotonTransformView>();
impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
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;
Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
component.isKinematic = true;
isPrefab = true;
}
else
{
impactDetector.destroyDisable = false;
Rigidbody component2 = ((Component)this).GetComponent<Rigidbody>();
component2.isKinematic = false;
}
}
private void Start()
{
if (BundleHelper.SceneIsPrefabStage())
{
((MonoBehaviour)this).StartCoroutine(LateStart(0.1f));
}
else
{
Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
component.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;
Rigidbody rb = ((Component)this).GetComponent<Rigidbody>();
rb.isKinematic = true;
rb.rotation = Quaternion.identity;
((Component)this).transform.position = new Vector3(0f, 5f, 0f);
DebugLogger.LogWarning($"Upgrade Bundle pos start: {((Component)this).gameObject.transform.position}", debugOnly: true);
}
public void SpawnItems()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0046: 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)
//IL_006c: 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)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
int count = SemiFunc.PlayerGetAll().Count;
count = Mathf.Max(count, BundleHelper.GetItemBundleMinItem(originalItem));
for (int i = 0; i < count + ItemBundles.Instance.config_debugFakePlayers.Value; i++)
{
float num = 0.075f;
Vector3 val = -((Component)this).transform.forward * num * (float)(i - 1);
if (!SemiFunc.IsMultiplayer())
{
GameObject val2 = Object.Instantiate<GameObject>(originalItem.prefab, ((Component)this).transform.position + val, ((Component)this).gameObject.transform.rotation);
StatsManager.instance.ItemPurchase(val2.GetComponent<ItemAttributes>().item.itemAssetName);
StatsManager.instance.AddItemsUpgradesPurchased(val2.GetComponent<ItemAttributes>().item.itemAssetName);
}
if (SemiFunc.IsMasterClient())
{
GameObject val3 = PhotonNetwork.Instantiate("Items/" + ((Object)originalItem.prefab).name, ((Component)this).transform.position + val, ((Component)this).gameObject.transform.rotation, (byte)0, (object[])null);
StatsManager.instance.ItemPurchase(val3.GetComponent<ItemAttributes>().item.itemAssetName);
StatsManager.instance.AddItemsUpgradesPurchased(val3.GetComponent<ItemAttributes>().item.itemAssetName);
}
}
}
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<MeshFilter>();
component.mesh = mesh;
}
}
public Material? GetOriginalBoxMat()
{
Item val = originalItem;
if (!Object.op_Implicit((Object)(object)val))
{
return null;
}
Material val2 = null;
Transform val3 = val.prefab.transform.Find("Mesh");
MeshRenderer component = ((Component)val3).GetComponent<MeshRenderer>();
if (Object.op_Implicit((Object)(object)component))
{
val2 = ((Renderer)component).materials[0];
}
if (!Object.op_Implicit((Object)(object)val2))
{
DebugLogger.LogError("- GetBoxMat " + originalItem.itemAssetName + " failed, returning NULL", debugOnly: true);
}
else
{
DebugLogger.LogInfo($"- GetBoxMat returning {val2}", debugOnly: true);
}
return val2;
}
public Light? GetOriginalLight()
{
Item val = originalItem;
if (!Object.op_Implicit((Object)(object)val))
{
return null;
}
Transform val2 = val.prefab.transform.Find("Light - Small Lamp");
if (!Object.op_Implicit((Object)(object)val2))
{
return null;
}
return ((Component)val2).GetComponent<Light>();
}
public void UpdateMaterial()
{
Material originalBoxMat = GetOriginalBoxMat();
if (Object.op_Implicit((Object)(object)originalBoxMat))
{
Transform val = ((Component)this).transform.Find("Mesh");
MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>();
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>();
Light originalLight = GetOriginalLight();
if ((Object)(object)component != (Object)null && (Object)(object)originalLight != (Object)null)
{
component.color = originalLight.color;
}
}
public void OnDestroy()
{
}
}
public static class VanillaUpgradesCompat
{
private static bool? _enabled;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("bulletbot.vanillaupgrades");
}
return _enabled.Value;
}
}
public static void InitCompat()
{
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static float GetUpgradeValueIncrease(float fallbackMult, string bundleAssetName)
{
string itemStringFromBundle = BundleHelper.GetItemStringFromBundle(bundleAssetName);
return Plugin.UpgradeValueIncrease(fallbackMult, itemStringFromBundle);
}
}
}