Decompiled source of GtfoEZAbsurdItems v18.0.0
GTFO.EZ.AbsurdItems.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AIGraph; using AK; using Agents; using AssetShards; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Enemies; using FX_EffectSystem; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Attributes; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Localization; using Microsoft.CodeAnalysis; using MindAttic.GTFO.Shared; using Player; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("GTFO.EZ.AbsurdItems")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+1556dc78ec59acfdd75dd703c443e67d0c132e27")] [assembly: AssemblyProduct("GTFO.EZ.AbsurdItems")] [assembly: AssemblyTitle("GTFO.EZ.AbsurdItems")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MindAttic.GTFO.Shared { internal static class SharedOwner { internal static readonly ManualLogSource Log = Logger.CreateLogSource("MindAttic.GTFO.Shared"); internal const string MasterSection = "0. Mod"; internal const string MasterKey = "Enabled"; private static readonly string[] Order = new string[4] { "MindAttic.GTFO.EZ", "MindAttic.GTFO.EZ.AbsurdWeapons", "MindAttic.GTFO.EZ.AbsurdMoves", "MindAttic.GTFO.EZ.AbsurdItems" }; private static bool? _isOwner; internal static bool IsOwner { get { bool valueOrDefault = _isOwner == true; if (!_isOwner.HasValue) { valueOrDefault = FindOwner(); _isOwner = valueOrDefault; return valueOrDefault; } return valueOrDefault; } } private static bool FindOwner() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] order = Order; for (int i = 0; i < order.Length; i++) { if (TryGetActive(order[i], out BasePlugin plugin)) { Assembly assembly = ((object)plugin).GetType().Assembly; if (!(assembly.GetType(typeof(SharedOwner).FullName) == null)) { return assembly == executingAssembly; } } } } catch (Exception ex) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Couldn't tell which GTFO.* mod runs the shared keys. "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } Log.LogWarning(val); } return false; } internal static bool IsActive(string guid) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown try { BasePlugin plugin; return TryGetActive(guid, out plugin); } catch (Exception ex) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(38, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Couldn't check whether "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(guid); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is installed. "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } Log.LogWarning(val); return false; } } internal static bool TryGetSetting<T>(string guid, string section, string key, [NotNullWhen(true)] out ConfigEntry<T>? entry) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown entry = null; try { BasePlugin plugin; return TryGetActive(guid, out plugin) && plugin.Config.TryGetEntry<T>(section, key, ref entry); } catch (Exception ex) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(25, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Couldn't read ["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(section); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(key); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" from "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(guid); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } Log.LogWarning(val); entry = null; return false; } } private static bool TryGetActive(string guid, [NotNullWhen(true)] out BasePlugin? plugin) { plugin = null; if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue(guid, out var value)) { object instance = value.Instance; BasePlugin val = (BasePlugin)((instance is BasePlugin) ? instance : null); if (val != null) { ConfigEntry<bool> val2 = default(ConfigEntry<bool>); if (val.Config.TryGetEntry<bool>("0. Mod", "Enabled", ref val2) && !val2.Value) { return false; } plugin = val; return true; } } return false; } internal static bool Get(string key) { object data = AppDomain.CurrentDomain.GetData("MindAttic.GTFO." + key); if (data is bool) { return (bool)data; } return false; } internal static void Set(string key, bool value) { AppDomain.CurrentDomain.SetData("MindAttic.GTFO." + key, value); } } internal static class InfiniteToggles { private const string AmmoKey = "InfiniteAmmo"; private const string HealthKey = "InfiniteHealth"; private static readonly InventorySlot[] AmmoSlots; private static int _lastFrame; internal static bool InfiniteAmmoOn => SharedOwner.Get("InfiniteAmmo"); internal static bool InfiniteHealthOn => SharedOwner.Get("InfiniteHealth"); internal static void Tick() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 if (Time.frameCount == _lastFrame || !SharedOwner.IsOwner) { return; } _lastFrame = Time.frameCount; if ((int)FocusStateManager.CurrentState == 4) { if (Input.GetKeyDown((KeyCode)277)) { Toggle("InfiniteHealth", "Infinite health"); } if (Input.GetKeyDown((KeyCode)127)) { Toggle("InfiniteAmmo", "Infinite ammo"); } } if (InfiniteAmmoOn) { Refill(); } } private static void Toggle(string key, string what) { bool flag = !SharedOwner.Get(key); SharedOwner.Set(key, flag); Show(what + ": " + (flag ? "ON" : "OFF")); } private static void Show(string message) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown try { MessageHelper.Show(message, MessageType.EventLog); } catch (Exception ex) { bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (no warden message: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } SharedOwner.Log.LogInfo(val); return; } SharedOwner.Log.LogInfo((object)message); } private static void Refill() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_00d9: Unknown result type (might be due to invalid IL or missing references) try { PlayerAgent val = default(PlayerAgent); if (!PlayerManager.TryGetLocalPlayerAgent(ref val) || (Object)(object)val == (Object)null || !((Agent)val).Alive) { return; } PlayerBackpack localBackpack = PlayerBackpackManager.LocalBackpack; PlayerAmmoStorage val2 = ((localBackpack != null) ? localBackpack.AmmoStorage : null); if (val2 == null) { return; } bool flag = false; InventorySlot[] ammoSlots = AmmoSlots; foreach (InventorySlot val3 in ammoSlots) { InventorySlotAmmo inventorySlotAmmo = val2.GetInventorySlotAmmo(val3); if (inventorySlotAmmo != null && !(inventorySlotAmmo.AmmoInPack >= inventorySlotAmmo.AmmoMaxCap)) { val2.SetAmmo(inventorySlotAmmo.AmmoType, inventorySlotAmmo.AmmoMaxCap); flag = true; } } PlayerInventoryBase inventory = val.Inventory; object obj; if (inventory == null) { obj = null; } else { ItemEquippable wieldedItem = inventory.WieldedItem; obj = ((wieldedItem != null) ? ((Il2CppObjectBase)wieldedItem).TryCast<BulletWeapon>() : null); } BulletWeapon val4 = (BulletWeapon)obj; if ((Object)(object)val4 != (Object)null && ((ItemEquippable)val4).GetCurrentClip() < ((ItemEquippable)val4).ClipSize) { ((ItemEquippable)val4).SetCurrentClip(((ItemEquippable)val4).ClipSize); val2.SetClipAmmoInSlot(val.Inventory.WieldedSlot); flag = true; } if (flag) { val2.UpdateAllAmmoUI(); val2.NeedsSync = true; } } catch (Exception ex) { bool flag2 = default(bool); BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(30, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Infinite ammo: refill failed. "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message); } SharedOwner.Log.LogWarning(val5); } } internal static bool AllowDamage(Dam_PlayerDamageLocal damage) { if (!InfiniteHealthOn) { return true; } try { PlayerAgent owner = ((Dam_PlayerDamageBase)damage).Owner; return (Object)(object)owner == (Object)null || (Object)(object)owner.Owner == (Object)null || owner.Owner.IsBot; } catch (Exception) { return true; } } static InfiniteToggles() { InventorySlot[] array = new InventorySlot[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); AmmoSlots = (InventorySlot[])(object)array; _lastFrame = -1; } } [HarmonyPatch(typeof(Dam_PlayerDamageLocal))] internal static class InfiniteToggles_Patches { [HarmonyPatch("Update")] [HarmonyPostfix] private static void AfterUpdate() { InfiniteToggles.Tick(); } [HarmonyPatch("ReceiveBulletDamage")] [HarmonyPatch("ReceiveExplosionDamage")] [HarmonyPatch("ReceiveMeleeDamage")] [HarmonyPatch("ReceivePushDamage")] [HarmonyPatch("ReceiveFireDamage")] [HarmonyPatch("ReceiveTentacleAttackDamage")] [HarmonyPatch("ReceiveTentacleTrapGrabDamage")] [HarmonyPatch("ReceiveParasiteTrapDamage")] [HarmonyPatch("ReceiveTentacleTankGrabDamage")] [HarmonyPatch("ReceiveShooterProjectileDamage")] [HarmonyPatch("ReceiveParasiteDamage")] [HarmonyPatch("ReceiveStickyDamage")] [HarmonyPatch("ReceiveFallDamage")] [HarmonyPatch("ReceiveNoAirDamage")] [HarmonyPatch("ReceiveSetDead")] [HarmonyPrefix] private static bool BeforeDamage(Dam_PlayerDamageLocal __instance) { return InfiniteToggles.AllowDamage(__instance); } } internal enum MessageType { Warden, EventLog, Center, Subtitle } internal static class MessageHelper { internal const float DefaultSeconds = 5f; private const string UpUntilKey = "MindAttic.GTFO.WardenMessageUpUntil"; private const string RoutineKey = "MindAttic.GTFO.WardenMessageRoutine"; private const float RevealSpeed = 200f; private const float StaleMargin = 3f; private static float UpUntil { get { object data = AppDomain.CurrentDomain.GetData("MindAttic.GTFO.WardenMessageUpUntil"); if (data is float) { return (float)data; } return 0f; } set { AppDomain.CurrentDomain.SetData("MindAttic.GTFO.WardenMessageUpUntil", value); } } private static IntPtr Routine { get { object data = AppDomain.CurrentDomain.GetData("MindAttic.GTFO.WardenMessageRoutine"); if (data is IntPtr) { return (IntPtr)data; } return IntPtr.Zero; } set { AppDomain.CurrentDomain.SetData("MindAttic.GTFO.WardenMessageRoutine", value); } } internal static bool Show(string text, MessageType type = MessageType.Warden, float seconds = 5f) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown bool flag = default(bool); try { seconds = Mathf.Max(0.5f, seconds); flag = type switch { MessageType.Warden => Warden(text, seconds), MessageType.EventLog => EventLog(text), MessageType.Center => Center(text, seconds), MessageType.Subtitle => Subtitle(text, seconds), _ => false, }; return flag; } catch (Exception ex) { BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (no "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<MessageType>(type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" message: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } SharedOwner.Log.LogInfo(val); return false; } } private static bool EventLog(string text) { PlayerGuiLayer playerLayer = GuiManager.PlayerLayer; PUI_GameEventLog val = ((playerLayer != null) ? playerLayer.m_gameEventLog : null); if ((Object)(object)val == (Object)null) { return false; } val.AddLogItem(text, (eGameEventChatLogType)2); return true; } private static bool Center(string text, float seconds) { InteractionGuiLayer interactionLayer = GuiManager.InteractionLayer; if (interactionLayer == null) { return false; } interactionLayer.SetTimedMessage(text, seconds, (ePUIMessageStyle)0, 0); return true; } private static bool Subtitle(string text, float seconds) { PlayerGuiLayer playerLayer = GuiManager.PlayerLayer; PUI_Subtitles val = ((playerLayer != null) ? playerLayer.m_subtitles : null); if ((Object)(object)val == (Object)null) { return false; } val.ShowSingleLineSubtitle(text, seconds); return true; } private static bool Warden(string text, float seconds) { PlayerGuiLayer playerLayer = GuiManager.PlayerLayer; PUI_WardenIntel val = ((playerLayer != null) ? playerLayer.m_wardenIntel : null); if ((Object)(object)val == (Object)null) { return false; } Coroutine newObjectiveRoutine = val.m_newObjectiveRoutine; LinkedList<IEnumerator> subObjectiveMessageQueue = val.m_subObjectiveMessageQueue; if (Time.unscaledTime < UpUntil && newObjectiveRoutine != null && ((Il2CppObjectBase)newObjectiveRoutine).Pointer == Routine && (subObjectiveMessageQueue == null || subObjectiveMessageQueue.Count == 0)) { ((MonoBehaviour)val).StopCoroutine(newObjectiveRoutine); if (val.m_revealTextRoutine != null) { ((MonoBehaviour)val).StopCoroutine(val.m_revealTextRoutine); } val.m_newObjectiveRoutine = null; val.m_revealTextRoutine = null; val.ResetSubObjectiveMesssagQueue(); } Coroutine newObjectiveRoutine2 = val.m_newObjectiveRoutine; IntPtr intPtr = ((newObjectiveRoutine2 != null) ? ((Il2CppObjectBase)newObjectiveRoutine2).Pointer : IntPtr.Zero); float until = Time.unscaledTime + seconds + 3f; val.ShowSubObjectiveMessage("", text, false, 200f, seconds, DelegateSupport.ConvertDelegate<Action>((Delegate)(Action)delegate { if (UpUntil == until) { UpUntil = 0f; } })); Coroutine newObjectiveRoutine3 = val.m_newObjectiveRoutine; IntPtr intPtr2 = ((newObjectiveRoutine3 != null) ? ((Il2CppObjectBase)newObjectiveRoutine3).Pointer : IntPtr.Zero); if (intPtr2 != IntPtr.Zero && intPtr2 != intPtr) { Routine = intPtr2; UpUntil = until; } else { Routine = IntPtr.Zero; UpUntil = 0f; } return true; } } internal sealed class KitLootSettings { internal string LogName = "Kits"; internal float LootPercent = 20f; internal int MinCharges = 1; internal int MaxCharges = 2; internal float HealthWeight = 1f; internal float ToolWeight = 1f; internal float AmmoWeight = 1f; internal List<(uint Id, float Weight)> Extras = new List<(uint, float)>(); } internal static class KitLoot { internal const int ChargePercent = 20; internal static readonly Dictionary<uint, (int Min, int Max)> Charges = new Dictionary<uint, (int, int)>(); internal static int Fill(KitLootSettings settings, Action<ConsumableDistributionDataBlock>? perTable = null) { //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Expected O, but got Unknown //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown int num = Math.Max(1, settings.MinCharges); int num2 = Math.Max(num, settings.MaxCharges); (float Health, float WeaponAmmo, float ToolAmmo) tuple = AverageBudgetPerZone(); float item = tuple.Health; float item2 = tuple.WeaponAmmo; float item3 = tuple.ToolAmmo; List<(uint, float)> list = new List<(uint, float)>(); int found = 0; float settingsWeight = 0f; Add(settings, list, Find(settings, "health", num, num2, "medi", "health"), item, settings.HealthWeight, "health", ref found, ref settingsWeight); Add(settings, list, Find(settings, "tool", num, num2, "tool"), item3, settings.ToolWeight, "tool", ref found, ref settingsWeight); Add(settings, list, Find(settings, "ammo", num, num2, "ammo"), item2, settings.AmmoWeight, "ammo", ref found, ref settingsWeight); if (found == 0) { return 0; } float num3 = 0f; foreach (var extra in settings.Extras) { float item4 = extra.Weight; num3 += Mathf.Max(0f, item4); } if (list.Count == 0 && num3 <= 0f) { return Empty(settings); } float num4 = 0f; foreach (var item7 in list) { float item5 = item7.Item2; num4 += item5; } float num5 = ((num4 > 0f) ? (settingsWeight / num4) : 0f); for (int i = 0; i < list.Count; i++) { list[i] = (list[i].Item1, list[i].Item2 * num5); } float num6 = (float)(num + num2) / 2f * 20f / 100f; float num7 = Mathf.Max(0f, settings.LootPercent) / 100f * (item + item2 + item3) / num6; float num8 = 0f; foreach (var item8 in list) { float item6 = item8.Item2; num8 += item6; } float num9 = ((num8 > 0f) ? (num7 * (num8 + num3) / num8) : num7); float num10 = AverageSpawnsPerZone(); int num11 = 0; int num12 = 0; foreach (ConsumableDistributionDataBlock allBlock in GameDataBlockBase<ConsumableDistributionDataBlock>.GetAllBlocks()) { if (((allBlock != null) ? allBlock.SpawnData : null) == null || allBlock.SpawnData.Count == 0) { continue; } allBlock.SpawnData.Clear(); foreach (var (itemID, weight) in list) { allBlock.SpawnData.Add(new ConsumableSpawnData { ItemID = itemID, Weight = weight }); } foreach (var (itemID2, num13) in settings.Extras) { if (num13 > 0f) { allBlock.SpawnData.Add(new ConsumableSpawnData { ItemID = itemID2, Weight = num13 }); } } allBlock.SpawnsPerZone = ((num10 > 0f) ? Mathf.RoundToInt(num9 * (float)allBlock.SpawnsPerZone / num10) : 0); perTable?.Invoke(allBlock); num12 += allBlock.SpawnsPerZone; num11++; } bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(130, 12, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(settings.LogName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("-"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" charge kits, "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num7, "0.##"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" per zone on average ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(settings.LootPercent, "0.#"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("% of "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(item, "0.##"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" health + "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(item2, "0.##"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ammo + "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(item3, "0.##"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" tool packs)"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((num3 > 0f) ? $" plus {settings.Extras.Count} extra item(s)" : ""); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num11); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" table(s) went from "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num10, "0.##"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" consumables each on average to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>((num11 > 0) ? ((float)num12 / (float)num11) : 0f, "0.##"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } SharedOwner.Log.LogInfo(val); return num11; } private static (float Health, float WeaponAmmo, float ToolAmmo) AverageBudgetPerZone() { float num = 0f; float num2 = 0f; float num3 = 0f; int num4 = 0; foreach (ExpeditionBalanceDataBlock allBlock in GameDataBlockBase<ExpeditionBalanceDataBlock>.GetAllBlocks()) { if (allBlock != null) { num += allBlock.HealthPerZone; num2 += allBlock.WeaponAmmoPerZone; num3 += allBlock.ToolAmmoPerZone; num4++; } } if (num4 != 0) { return (Health: num / (float)num4, WeaponAmmo: num2 / (float)num4, ToolAmmo: num3 / (float)num4); } return (Health: 1f, WeaponAmmo: 1f, ToolAmmo: 1f); } private static float AverageSpawnsPerZone() { int num = 0; int num2 = 0; foreach (ConsumableDistributionDataBlock allBlock in GameDataBlockBase<ConsumableDistributionDataBlock>.GetAllBlocks()) { if (((allBlock != null) ? allBlock.SpawnData : null) != null && allBlock.SpawnData.Count != 0) { num += allBlock.SpawnsPerZone; num2++; } } if (num2 != 0) { return (float)num / (float)num2; } return 0f; } private static int Empty(KitLootSettings settings) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown int num = 0; foreach (ConsumableDistributionDataBlock allBlock in GameDataBlockBase<ConsumableDistributionDataBlock>.GetAllBlocks()) { if (((allBlock != null) ? allBlock.SpawnData : null) != null && allBlock.SpawnData.Count != 0) { allBlock.SpawnsPerZone = 0; num++; } } bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(57, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(settings.LogName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": every kit weight is 0 - "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" table(s) spawn no consumables."); } SharedOwner.Log.LogInfo(val); return num; } private static void Add(KitLootSettings settings, List<(uint, float)> kits, uint? id, float budget, float setting, string what, ref int found, ref float settingsWeight) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown if (!id.HasValue) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(32, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(settings.LogName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": no "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" kit item found - left out."); } SharedOwner.Log.LogWarning(val); } else { found++; float num = budget * setting; if (!(num <= 0f)) { kits.Add((id.Value, num)); settingsWeight += setting; } } } private static uint? Find(KitLootSettings settings, string what, int min, int max, params string[] keys) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown bool flag2 = default(bool); foreach (ItemDataBlock allBlock in GameDataBlockBase<ItemDataBlock>.GetAllBlocks()) { if (allBlock == null || (int)allBlock.inventorySlot != 4) { continue; } string text = (((GameDataBlockBase<ItemDataBlock>)(object)allBlock).name ?? string.Empty).ToLowerInvariant(); if (text.Contains("disinfect") || (what == "ammo" && text.Contains("tool"))) { continue; } bool flag = false; foreach (string value in keys) { flag |= text.Contains(value); } if (flag) { BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(21, 4, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(settings.LogName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" kit is '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((GameDataBlockBase<ItemDataBlock>)(object)allBlock).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (item "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(((GameDataBlockBase<ItemDataBlock>)(object)allBlock).persistentID); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")."); } SharedOwner.Log.LogInfo(val); allBlock.ConsumableAmmoMin = min * 20; allBlock.ConsumableAmmoMax = max * 20; Charges[((GameDataBlockBase<ItemDataBlock>)(object)allBlock).persistentID] = (min, max); return ((GameDataBlockBase<ItemDataBlock>)(object)allBlock).persistentID; } } return null; } } [HarmonyPatch(typeof(LG_PickupItem))] internal static class KitLoot_SetupAsConsumable_Patch { private static int _logged; [HarmonyPatch("SetupAsConsumable", new Type[] { typeof(int), typeof(uint) })] [HarmonyPostfix] private static void AfterSetup(LG_PickupItem __instance) { Snap(__instance); } [HarmonyPatch("SetupAsConsumable", new Type[] { typeof(ConsumableDistributionDataBlock), typeof(int), typeof(uint) })] [HarmonyPostfix] private static void AfterSetupFromTable(LG_PickupItem __instance) { Snap(__instance); } private static void Snap(LG_PickupItem pickup) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); try { if (KitLoot.Charges.Count == 0) { return; } ResourcePackPickup componentInChildren = ((Component)pickup).GetComponentInChildren<ResourcePackPickup>(); if (((componentInChildren != null) ? ((Item)componentInChildren).ItemDataBlock : null) == null || !KitLoot.Charges.TryGetValue(((GameDataBlockBase<ItemDataBlock>)(object)((Item)componentInChildren).ItemDataBlock).persistentID, out (int, int) value)) { return; } pItemData_Custom customData = ((Item)componentInChildren).GetCustomData(); int num = Mathf.Clamp(Mathf.RoundToInt(customData.ammo / 20f), value.Item1, value.Item2); int num2 = num * 20; if (customData.ammo == (float)num2) { return; } if (_logged++ < 3) { BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(41, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Kits: '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((GameDataBlockBase<ItemDataBlock>)(object)((Item)componentInChildren).ItemDataBlock).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' rolled "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(customData.ammo, "0.#"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("%, rounded to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" charge(s)."); } SharedOwner.Log.LogInfo(val); } customData.ammo = num2; ((Item)componentInChildren).SetCustomData(customData, false); } catch (Exception ex) { BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Kits: couldn't round a kit to whole charges. "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } SharedOwner.Log.LogWarning(val2); } } } } namespace GTFO.EZ.AbsurdItems { internal static class ArtifactBuffs { internal static ConfigEntry<bool> Enabled = null; internal static ConfigEntry<float> BoldMaxHealthPercent = null; internal static ConfigEntry<float> AggressiveDamagePercent = null; internal static ConfigEntry<float> MutedQuieterPercent = null; private static readonly Dictionary<ulong, int[]> CountsByPlayer = new Dictionary<ulong, int[]>(); private static readonly Dictionary<IntPtr, (ulong Player, ArtifactCategory Category)> Counted = new Dictionary<IntPtr, (ulong, ArtifactCategory)>(); private static IntPtr _healthOwner; private static float _baseMaxHealth; private static float _bonusApplied; internal static void Bind(ConfigFile config) { Enabled = config.Bind<bool>("Artifacts", "Artifact Buffs Enabled", true, "Picking up an artifact buffs whoever picked it up until the level ends (a checkpoint restart that puts the artifact back takes the buff back off). Bold, Aggressive and Muted are the game's Uncommon, Rare and Common artifacts."); BoldMaxHealthPercent = NonNegative.Bind(config, "Artifacts", "Bold: Max Health (%)", 5f, "Max health added per Bold artifact picked up, in percent of your starting max health (the gain is healed too). Default 5."); AggressiveDamagePercent = NonNegative.Bind(config, "Artifacts", "Aggressive: Damage (%)", 5f, "Damage dealt to enemies (guns, melee and Hand Grenades) added per Aggressive artifact picked up. Default 5."); MutedQuieterPercent = NonNegative.Bind(config, "Artifacts", "Muted: Quieter (%)", 5f, "How much harder enemies find it to detect you, per Muted artifact picked up (capped at 75%). Default 5."); } internal static int Count(PlayerAgent? player, ArtifactCategory category) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) SNet_Player val = ((player != null) ? player.Owner : null); if ((Object)(object)val == (Object)null || !CountsByPlayer.TryGetValue(val.Lookup, out int[] value)) { return 0; } return value[category]; } internal static void OnArtifactState(ArtifactPickup_Core artifact, ePickupItemStatus status, PlayerAgent? player) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) IntPtr pointer = ((Il2CppObjectBase)artifact).Pointer; ArtifactCategory artifactCategory = artifact.m_artifactCategory; (ulong, ArtifactCategory) value; if ((int)status == 1) { SNet_Player val = ((player != null) ? player.Owner : null); if (!((Object)(object)val == (Object)null) && !Counted.ContainsKey(pointer)) { Counted[pointer] = (val.Lookup, artifactCategory); Change(val.Lookup, artifactCategory, 1); ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(53, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Artifact buffs: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(val.NickName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" picked up a "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(Name(artifactCategory)); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" artifact ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(Count(player, artifactCategory)); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" this level)."); } logger.LogInfo(val2); } } else if (Counted.TryGetValue(pointer, out value)) { Counted.Remove(pointer); Change(value.Item1, value.Item2, -1); } } private static void Change(ulong player, ArtifactCategory category, int by) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 if (!CountsByPlayer.TryGetValue(player, out int[] value)) { value = (CountsByPlayer[player] = new int[3]); } value[category] = Math.Max(0, value[category] + by); if ((int)category == 1) { ApplyMaxHealth(); } } internal static void ApplyMaxHealth() { PlayerAgent val = default(PlayerAgent); if (!PlayerManager.TryGetLocalPlayerAgent(ref val) || (Object)(object)val == (Object)null) { return; } Dam_PlayerDamageBase damage = val.Damage; Dam_PlayerDamageLocal val2 = ((damage != null) ? ((Il2CppObjectBase)damage).TryCast<Dam_PlayerDamageLocal>() : null); if ((Object)(object)val2 == (Object)null) { return; } if (((Il2CppObjectBase)val2).Pointer != _healthOwner) { _healthOwner = ((Il2CppObjectBase)val2).Pointer; _bonusApplied = 0f; PlayerDataBlock block = GameDataBlockBase<PlayerDataBlock>.GetBlock(1u); _baseMaxHealth = ((block != null && block.health > 0f) ? block.health : ((Dam_SyncedDamageBase)val2).HealthMax); } float num = _baseMaxHealth * BoldMaxHealthPercent.Value / 100f * (float)Count(val, (ArtifactCategory)1); float num2 = num - _bonusApplied; if (!(Math.Abs(num2) < 0.01f)) { _bonusApplied = num; float healthMax = ((Dam_SyncedDamageBase)val2).HealthMax; float val3 = (((Dam_SyncedDamageBase)val2).HealthMax = Math.Max(0.01f, healthMax + num2)); float num4 = Math.Max(0.01f, ((Dam_SyncedDamageBase)val2).Health + Math.Max(0f, num2)); if (((Dam_SyncedDamageBase)val2).Health <= healthMax) { num4 = Math.Min(val3, num4); } ((Dam_SyncedDamageBase)val2).SendSetHealth(num4); } } internal static void Reset() { CountsByPlayer.Clear(); Counted.Clear(); _healthOwner = IntPtr.Zero; } internal static float DamageMultiplier(Agent? source) { PlayerAgent player = ((source != null) ? ((Il2CppObjectBase)source).TryCast<PlayerAgent>() : null); return 1f + AggressiveDamagePercent.Value / 100f * (float)Count(player, (ArtifactCategory)2); } internal static float DetectionMultiplier(PlayerAgent player) { return Math.Max(0.25f, 1f - MutedQuieterPercent.Value / 100f * (float)Count(player, (ArtifactCategory)0)); } private unsafe static string Name(ArtifactCategory category) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected I4, but got Unknown return (int)category switch { 0 => "Muted", 1 => "Bold", 2 => "Aggressive", _ => ((object)(*(ArtifactCategory*)(&category))/*cast due to .constrained prefix*/).ToString(), }; } } [HarmonyPatch] internal static class ArtifactBuffs_Patches { [HarmonyPatch(typeof(ArtifactPickup_Core), "OnSyncStateChange")] [HarmonyPostfix] private static void AfterArtifactState(ArtifactPickup_Core __instance, ePickupItemStatus status, PlayerAgent player) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!ArtifactBuffs.Enabled.Value) { return; } try { ArtifactBuffs.OnArtifactState(__instance, status, player); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Artifact buffs: couldn't count a pickup. "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogWarning(val); } } [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "Setup")] [HarmonyPostfix] private static void AfterLevelSetup(Dam_PlayerDamageLocal __instance) { if (LocalPlayerDamage.IsMine(__instance)) { ArtifactBuffs.Reset(); } } [HarmonyPatch(typeof(Dam_EnemyDamageLimb), "BulletDamage")] [HarmonyPrefix] private static void BeforeBulletDamage(ref float dam, Agent sourceAgent) { if (ArtifactBuffs.Enabled.Value) { dam *= SafeDamageMultiplier(sourceAgent); } } [HarmonyPatch(typeof(Dam_EnemyDamageLimb), "MeleeDamage")] [HarmonyPrefix] private static void BeforeMeleeDamage(ref float dam, Agent sourceAgent) { if (ArtifactBuffs.Enabled.Value) { dam *= SafeDamageMultiplier(sourceAgent); } } [HarmonyPatch(typeof(PlayerAgent), "GetDetectionMod")] [HarmonyPostfix] private static void AfterDetectionMod(PlayerAgent __instance, ref float __result) { if (!ArtifactBuffs.Enabled.Value) { return; } try { __result *= ArtifactBuffs.DetectionMultiplier(__instance); } catch (Exception) { } } private static float SafeDamageMultiplier(Agent sourceAgent) { try { return ArtifactBuffs.DamageMultiplier(sourceAgent); } catch (Exception) { return 1f; } } } internal sealed class ArtifactGlow : MonoBehaviour { private const float ScanSeconds = 1f; private const float Range = 2.5f; private const float Intensity = 1.1f; private const float TintStrength = 0.55f; internal static ConfigEntry<bool> Enabled = null; private static readonly Dictionary<ArtifactCategory, Color> Colors = new Dictionary<ArtifactCategory, Color> { { (ArtifactCategory)2, new Color(1f, 0.15f, 0.15f) }, { (ArtifactCategory)0, new Color(0.2f, 0.45f, 1f) }, { (ArtifactCategory)1, new Color(0.3f, 0.9f, 0.35f) } }; private readonly HashSet<IntPtr> seen = new HashSet<IntPtr>(); private float nextScanAt; public ArtifactGlow(IntPtr ptr) : base(ptr) { } internal static void Bind(ConfigFile config) { Enabled = config.Bind<bool>("Artifacts", "Artifact Glow Enabled", true, "Artifacts still lying in the level glow and are tinted in their category's color: Aggressive (Rare) red, Muted (Common) blue, Bold (Uncommon) green - so which buff one gives is visible from across the room."); } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown try { if ((int)GameStateManager.CurrentStateName != 10) { seen.Clear(); } else if (Enabled.Value && !(Time.time < nextScanAt)) { nextScanAt = Time.time + 1f; Scan(); } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(42, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdItems artifact glow failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } [HideFromIl2Cpp] private void Scan() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) foreach (Object item in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<ArtifactPickup_Core>())) { ArtifactPickup_Core val = ((Il2CppObjectBase)item).TryCast<ArtifactPickup_Core>(); if (!((Object)(object)val == (Object)null) && seen.Add(((Il2CppObjectBase)val).Pointer) && Colors.TryGetValue(val.m_artifactCategory, out var value)) { Light(val, value); Tint(val, value); } } } [HideFromIl2Cpp] private static void Light(ArtifactPickup_Core artifact, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002c: 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) GameObject val = new GameObject("GTFO.EZ.AbsurdItems Artifact Glow"); val.transform.SetParent(((Component)artifact).transform, false); val.transform.localPosition = Vector3.up * 0.15f; EffectLight obj = val.AddComponent<EffectLight>(); ((LightBase)obj).Color = color; ((LightBase)obj).Range = 2.5f; ((LightBase)obj).Intensity = 1.1f; ((Behaviour)obj).enabled = true; } [HideFromIl2Cpp] private static void Tint(ArtifactPickup_Core artifact, Color color) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0058: Unknown result type (might be due to invalid IL or missing references) foreach (Renderer componentsInChild in ((Component)artifact).GetComponentsInChildren<Renderer>(true)) { try { Material material = componentsInChild.material; material.color = Color.Lerp(material.color, color, 0.55f); if (material.HasProperty("_EmissionColor")) { material.EnableKeyword("_EMISSION"); material.SetColor("_EmissionColor", color * 0.4f); } } catch (Exception) { } } } } internal static class Explosion { private const string TripMineExplosion = "Assets/AssetPrefabs/FX_Effects/FX_Tripmine.prefab"; private static FX_Pool? pool; private static bool effectFailed; private static bool effectLogged; internal static void Show(Vector3 position) { //IL_0005: 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) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_0108: 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) CellSound.Post(EVENTS.FRAGGRENADEEXPLODE, position); BurstFlash.Spawn(position + Vector3.up * 0.3f, new Color(1f, 0.55f, 0.2f), 10f, 10f, 0.35f); if (effectFailed) { return; } bool flag = default(bool); try { if ((Object)(object)pool == (Object)null) { pool = MineDeployerInstance_Detonate_Explosive.s_explosionPool; } if ((Object)(object)pool == (Object)null) { GameObject loadedAsset = AssetShardManager.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/FX_Effects/FX_Tripmine.prefab", false); if ((Object)(object)loadedAsset != (Object)null) { pool = FX_Manager.GetEffectPool(loadedAsset); } } if (!effectLogged) { effectLogged = true; ManualLogSource logger = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdItems grenade explosion effect: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)(object)pool != (Object)null) ? "trip mine explosion" : "none loaded (flash only)"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } logger.LogInfo(val); } FX_Pool? obj = pool; if (obj != null) { FX_EffectBase_Poolable obj2 = obj.AquireEffect(); if (obj2 != null) { ((FX_EffectBase)obj2).Play((FX_Trigger)null, position, Quaternion.identity); } } } catch (Exception ex) { effectFailed = true; ManualLogSource logger2 = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(58, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("GTFO.EZ.AbsurdItems grenade explosion effect unavailable: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } logger2.LogWarning(val2); } } } internal static class AreaDamage { internal static void Apply(Vector3 center, float radius, float damage, float edgeDamageFraction, float staggerMulti, Agent source, uint gearCategoryId) { //IL_0006: 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_00c4: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: 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) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) Dictionary<IntPtr, (Dam_EnemyDamageLimb, Vector3, float)> dictionary = new Dictionary<IntPtr, (Dam_EnemyDamageLimb, Vector3, float)>(); foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(center, radius, LayerManager.MASK_ENEMY_DAMAGABLE)) { Dam_EnemyDamageLimb component = ((Component)item).GetComponent<Dam_EnemyDamageLimb>(); object obj; if (component == null) { obj = null; } else { Dam_EnemyDamageBase obj2 = component.m_base; obj = ((obj2 != null) ? obj2.Owner : null); } EnemyAgent val = (EnemyAgent)obj; if (!((Object)(object)component == (Object)null) && !((Object)(object)val == (Object)null) && ((Agent)val).Alive) { Vector3 val2 = item.ClosestPoint(center); float num = Vector3.Distance(center, val2); if (!dictionary.TryGetValue(((Il2CppObjectBase)val).Pointer, out var value) || !(value.Item3 <= num)) { dictionary[((Il2CppObjectBase)val).Pointer] = (component, val2, num); } } } Vector3 val3 = center + Vector3.up * 0.2f; foreach (var (val4, val5, distance) in dictionary.Values) { if (!Physics.Linecast(val3, val5, LayerManager.MASK_WORLD)) { float num2 = Formulas.AreaFalloff(distance, radius, edgeDamageFraction); Vector3 val6 = val5 - center; Vector3 val7; if (!(((Vector3)(ref val6)).sqrMagnitude > 0.0001f)) { val7 = Vector3.up; } else { val6 = val5 - center; val7 = ((Vector3)(ref val6)).normalized; } Vector3 val8 = val7; val4.BulletDamage(damage * num2, source, val5, val8, -val8, false, staggerMulti, 1f, gearCategoryId); } } LockDamage.Radius(center, radius, damage, source); } } internal static class LockDamage { internal static void Radius(Vector3 center, float radius, float damage, Agent source) { //IL_0006: 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_00d9: Expected O, but got Unknown //IL_0046: 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_004c: 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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) HashSet<IntPtr> hashSet = new HashSet<IntPtr>(); bool flag = default(bool); foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(center, radius, -1, (QueryTriggerInteraction)2)) { LG_WeakLockDamage componentInParent = ((Component)item).GetComponentInParent<LG_WeakLockDamage>(); if ((Object)(object)componentInParent == (Object)null || !hashSet.Add(((Il2CppObjectBase)componentInParent).Pointer)) { continue; } Vector3 val = item.ClosestPoint(center); Vector3 val2 = val - center; if (((Vector3)(ref val2)).magnitude > 0.5f && Physics.Raycast(center, ((Vector3)(ref val2)).normalized, ((Vector3)(ref val2)).magnitude - 0.4f, LayerManager.MASK_WORLD)) { continue; } Vector3 val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : Vector3.forward); try { componentInParent.BulletDamage(damage, source, val, val3, -val3, false, 1f, 1f, 0u); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("GTFO.EZ.AbsurdItems lock damage failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } logger.LogWarning(val4); } } } } internal static class GrenadeModel { private static readonly string[] LockMelterPrefabs = new string[3] { "Assets/AssetPrefabs/Items/Consumables/LockMelter/Consumable_LockMelter_Pickup.prefab", "Assets/AssetPrefabs/Items/Consumables/LockMelter/Consumable_LockMelter.prefab", "Assets/AssetPrefabs/Items/Consumables/LockMelter/Consumable_LockMelter_FirstPerson.prefab" }; private static bool logged; internal static void Build(Transform parent) { //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) string text = "fallback capsule"; try { string[] lockMelterPrefabs = LockMelterPrefabs; foreach (string text2 in lockMelterPrefabs) { GameObject loadedAsset = AssetShardManager.GetLoadedAsset<GameObject>(text2, false); if ((Object)(object)loadedAsset == (Object)null) { continue; } Transform transform = loadedAsset.transform; int num = 0; foreach (MeshFilter componentsInChild in loadedAsset.GetComponentsInChildren<MeshFilter>(true)) { MeshRenderer component = ((Component)componentsInChild).GetComponent<MeshRenderer>(); if (!((Object)(object)componentsInChild.sharedMesh == (Object)null) && !((Object)(object)component == (Object)null)) { Matrix4x4 val = transform.worldToLocalMatrix * ((Component)componentsInChild).transform.localToWorldMatrix; GameObject val2 = new GameObject("Part"); val2.transform.SetParent(parent, false); val2.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val)).GetColumn(3)); val2.transform.localRotation = ((Matrix4x4)(ref val)).rotation; val2.transform.localScale = ((Matrix4x4)(ref val)).lossyScale; val2.AddComponent<MeshFilter>().sharedMesh = componentsInChild.sharedMesh; ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterials = ((Renderer)component).sharedMaterials; num++; } } if (num != 0) { text = $"{text2} ({num} meshes)"; return; } } GameObject obj = GameObject.CreatePrimitive((PrimitiveType)1); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); obj.transform.SetParent(parent, false); obj.transform.localScale = new Vector3(0.12f, 0.12f, 0.12f); } finally { if (!logged) { logged = true; ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("GTFO.EZ.AbsurdItems Hand Grenade model: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("."); } logger.LogInfo(val3); } } } } internal sealed class BurstFlash : MonoBehaviour { private EffectLight light; private float peak; private float duration; private float elapsed; public BurstFlash(IntPtr ptr) : base(ptr) { } [HideFromIl2Cpp] internal static void Spawn(Vector3 position, Color color, float range, float intensity, float seconds) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GTFO.EZ.AbsurdItems Flash"); val.transform.position = position; BurstFlash burstFlash = val.AddComponent<BurstFlash>(); burstFlash.peak = intensity; burstFlash.duration = seconds; burstFlash.light = val.AddComponent<EffectLight>(); ((LightBase)burstFlash.light).Color = color; ((LightBase)burstFlash.light).Range = range; ((LightBase)burstFlash.light).Intensity = intensity; ((Behaviour)burstFlash.light).enabled = true; } private void Update() { elapsed += Time.deltaTime; if (elapsed >= duration) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { ((LightBase)light).Intensity = peak * (1f - elapsed / duration); } } } internal static class Breadcrumbs { internal static ConfigEntry<bool> ContainersEnabled = null; internal static ConfigEntry<bool> DoorsUnlockedEnabled = null; internal static ConfigEntry<bool> DoorsOpenedEnabled = null; internal static ConfigEntry<bool> AreasEnabled = null; private static readonly Color MarkerColor = new Color(0.65f, 0.95f, 0.25f); private const float Range = 2f; private const float Intensity = 1f; private static readonly HashSet<IntPtr> openedContainers = new HashSet<IntPtr>(); private static readonly HashSet<IntPtr> unlockedDoors = new HashSet<IntPtr>(); private static readonly HashSet<IntPtr> openedDoors = new HashSet<IntPtr>(); private static readonly HashSet<IntPtr> visitedAreas = new HashSet<IntPtr>(); internal static void Bind(ConfigFile config) { ContainersEnabled = config.Bind<bool>("Breadcrumbs", "Mark Opened Containers", true, "Drops a glow stick marker wherever a resource container (locker/case) is opened, so the team can see what's already been looted."); DoorsUnlockedEnabled = config.Bind<bool>("Breadcrumbs", "Mark Unlocked Doors", true, "Drops a glow stick marker at a door the moment it's unlocked."); DoorsOpenedEnabled = config.Bind<bool>("Breadcrumbs", "Mark Opened Doors", true, "Drops a glow stick marker at a door the moment it's opened."); AreasEnabled = config.Bind<bool>("Breadcrumbs", "Mark New Areas", true, "Drops a glow stick marker the first time you walk into a new area, leaving a breadcrumb trail of where you've already been."); } internal static void ResetForLevel() { openedContainers.Clear(); unlockedDoors.Clear(); openedDoors.Clear(); visitedAreas.Clear(); } [HideFromIl2Cpp] internal static void ContainerOpened(IntPtr container, Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (ContainersEnabled.Value && openedContainers.Add(container)) { Drop(position); } } [HideFromIl2Cpp] internal static void DoorUnlocked(IntPtr door, Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (DoorsUnlockedEnabled.Value && unlockedDoors.Add(door)) { Drop(position); } } [HideFromIl2Cpp] internal static void DoorOpened(IntPtr door, Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (DoorsOpenedEnabled.Value && openedDoors.Add(door)) { Drop(position); } } [HideFromIl2Cpp] internal static void AreaEntered(IntPtr area, Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (AreasEnabled.Value && visitedAreas.Add(area)) { Drop(position); } } [HideFromIl2Cpp] private static void Drop(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown try { GameObject val = new GameObject("GTFO.EZ.AbsurdItems Breadcrumb"); val.transform.position = position + Vector3.up * 0.05f; BuildModel(val.transform); EffectLight obj = val.AddComponent<EffectLight>(); ((LightBase)obj).Color = MarkerColor; ((LightBase)obj).Range = 2f; ((LightBase)obj).Intensity = 1f; ((Behaviour)obj).enabled = true; } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(46, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("GTFO.EZ.AbsurdItems breadcrumb marker failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } logger.LogWarning(val2); } } [HideFromIl2Cpp] private static void BuildModel(Transform parent) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown GameObject obj = GameObject.CreatePrimitive((PrimitiveType)1); Object.Destroy((Object)(object)obj.GetComponent<Collider>()); obj.transform.SetParent(parent, false); obj.transform.localScale = new Vector3(0.05f, 0.09f, 0.05f); Renderer component = obj.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { component.material = new Material(Shader.Find("Unlit/Color")) { color = MarkerColor }; } } } [HarmonyPatch] internal static class Breadcrumbs_Patches { [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "Setup")] [HarmonyPostfix] private static void AfterLevelSetup(Dam_PlayerDamageLocal __instance) { if (LocalPlayerDamage.IsMine(__instance)) { Breadcrumbs.ResetForLevel(); } } [HarmonyPatch(typeof(LG_WeakResourceContainer), "OnSyncStateChanged")] [HarmonyPostfix] private static void AfterContainerStateChanged(LG_WeakResourceContainer __instance, eResourceContainerStatus status, bool isRecall) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (isRecall || (int)status != 3) { return; } try { Breadcrumbs.ContainerOpened(((Il2CppObjectBase)__instance).Pointer, ((Component)__instance).transform.position); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(56, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdItems: couldn't mark an opened container. "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void AfterWeakDoorStatus(LG_WeakDoor __instance, eDoorStatus value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown try { Mark(value, ((Il2CppObjectBase)__instance).Pointer, ((Component)__instance).transform.position); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(48, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdItems: couldn't mark a weak door. "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void AfterSecurityDoorStatus(LG_SecurityDoor __instance, eDoorStatus value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown try { Mark(value, ((Il2CppObjectBase)__instance).Pointer, ((Component)__instance).transform.position); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(52, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdItems: couldn't mark a security door. "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } private static void Mark(eDoorStatus status, IntPtr door, Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0006: 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) if ((int)status == 9) { Breadcrumbs.DoorUnlocked(door, position); } else if ((int)status == 10) { Breadcrumbs.DoorOpened(door, position); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void AfterSetCourseNode(PlayerAgent __instance, AIG_CourseNode value) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) try { if (((Agent)__instance).IsLocallyOwned && value != null) { LG_Area area = value.m_area; if (!((Object)(object)area == (Object)null)) { Breadcrumbs.AreaEntered(((Il2CppObjectBase)area).Pointer, ((Agent)__instance).Position); } } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdItems: couldn't mark a new area. "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } } internal static class ConfigImport { private const string EzFile = "MindAttic.GTFO.EZ.cfg"; private const string AbsurdWeaponsFile = "MindAttic.GTFO.EZ.AbsurdWeapons.cfg"; private static HashSet<(string, string)> existing = new HashSet<(string, string)>(); internal static void Snapshot(ConfigFile config) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown try { existing = (File.Exists(config.ConfigFilePath) ? Keys(Read(config.ConfigFilePath)) : new HashSet<(string, string)>()); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(52, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Config import: couldn't read this mod's own config. "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); existing = new HashSet<(string, string)>(); } } internal static void Apply(ConfigFile config) { //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Expected O, but got Unknown //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Expected O, but got Unknown bool flag2 = default(bool); try { Dictionary<(string, string), string> dictionary = ReadOld("MindAttic.GTFO.EZ.cfg"); Dictionary<(string, string), string> dictionary2 = ReadOld("MindAttic.GTFO.EZ.AbsurdWeapons.cfg"); if (dictionary.Count == 0 && dictionary2.Count == 0) { return; } int imported = 0; string[] array = new string[4] { "Artifact Buffs Enabled", "Bold: Max Health (%)", "Aggressive: Damage (%)", "Muted: Quieter (%)" }; foreach (string text in array) { Copy(dictionary, "MindAttic.GTFO.EZ.cfg", "Artifacts", text, "Artifacts", text); } array = new string[9] { "Hand Grenade Enabled", "FuseSeconds", "BlastRadius", "BlastDamage", "BlastEdgeFraction", "BlastStagger", "MaxCarried", "PickupCount", "ThrowForceMultiplier" }; foreach (string text2 in array) { Copy(dictionary2, "MindAttic.GTFO.EZ.AbsurdWeapons.cfg", "Hand Grenade", text2, "Hand Grenade", text2); } array = new string[6] { "Stim Pack Enabled", "HealPercent", "MaxHealthPercent", "DrainPercentPerSecond", "DamageBoostPercent", "DamageBoostSeconds" }; foreach (string text3 in array) { Copy(dictionary2, "MindAttic.GTFO.EZ.AbsurdWeapons.cfg", "Stim Pack", text3, "Stim Pack", text3); } array = new string[2] { "HandGrenadeThrow", "HandGrenadeBounce" }; foreach (string text4 in array) { Copy(dictionary2, "MindAttic.GTFO.EZ.AbsurdWeapons.cfg", "Sounds", text4, "Sounds", text4); } array = new string[4] { "Loot Mix Enabled", "HandGrenadeWeight", "StimPackWeight", "OutInTheOpenShare" }; foreach (string text5 in array) { Copy(dictionary2, "MindAttic.GTFO.EZ.AbsurdWeapons.cfg", "Loot", text5, "Loot", text5); } bool flag = IsTrue(dictionary2, "Loot", "Loot Mix Enabled", missing: false) && IsTrue(dictionary2, "0. Mod", "Enabled", missing: true); (string, string)[] array2 = new(string, string)[6] { ("Kit Loot (%)", "KitLootPercent"), ("Health Kit Weight", "HealthKitWeight"), ("Tool Kit Weight", "ToolKitWeight"), ("Ammo Kit Weight", "AmmoKitWeight"), ("Kit Charges Min", "KitChargesMin"), ("Kit Charges Max", "KitChargesMax") }; for (int i = 0; i < array2.Length; i++) { var (text6, fromKey) = array2[i]; if (flag) { Copy(dictionary2, "MindAttic.GTFO.EZ.AbsurdWeapons.cfg", "Loot", fromKey, "Loot", text6); } else { Copy(dictionary, "MindAttic.GTFO.EZ.cfg", "Loot", text6, "Loot", text6); } } if (!flag) { Copy(dictionary, "MindAttic.GTFO.EZ.cfg", "Loot", "Consumables Are Kits", "Loot", "Consumables Are Kits"); } if (imported > 0) { ManualLogSource logger = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(77, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Config import: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(imported); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" setting(s) carried over from GTFO.EZ / GTFO.EZ.AbsurdWeapons."); } logger.LogInfo(val); } void Copy(Dictionary<(string, string), string> from, string file, string fromSection, string item, string section, string key) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown if (!existing.Contains((section, key)) && from.TryGetValue((fromSection, item), out string value) && TryGetAny(config, section, key, out ConfigEntryBase entry) && entry != null) { string serializedValue = entry.GetSerializedValue(); entry.SetSerializedValue(value); if (entry.GetSerializedValue() != serializedValue) { imported++; ManualLogSource logger3 = Plugin.Logger; bool flag3 = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(30, 4, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Config import: ["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(section); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(key); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" = "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(entry.GetSerializedValue()); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" (from "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(file); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(")."); } logger3.LogInfo(val3); } } } } catch (Exception ex) { ManualLogSource logger2 = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(82, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Config import: couldn't carry settings over from GTFO.EZ / GTFO.EZ.AbsurdWeapons. "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } logger2.LogWarning(val2); } } private static bool TryGetAny(ConfigFile config, string section, string key, out ConfigEntryBase? entry) { foreach (ConfigDefinition key2 in config.Keys) { if (!(key2.Section != section) && !(key2.Key != key)) { entry = config[key2]; return true; } } entry = null; return false; } private static bool IsTrue(Dictionary<(string, string), string> values, string section, string key, bool missing) { if (!values.TryGetValue((section, key), out string value)) { return missing; } return string.Equals(value, "true", StringComparison.OrdinalIgnoreCase); } private static Dictionary<(string, string), string> ReadOld(string file) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown try { string path = Path.Combine(Paths.ConfigPath, file); return File.Exists(path) ? Read(path) : new Dictionary<(string, string), string>(); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Config import: couldn't read "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(file); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); return new Dictionary<(string, string), string>(); } } private static HashSet<(string, string)> Keys(Dictionary<(string, string), string> values) { return new HashSet<(string, string)>(values.Keys); } private static Dictionary<(string, string), string> Read(string path) { Dictionary<(string, string), string> dictionary = new Dictionary<(string, string), string>(); string item = string.Empty; string[] array = File.ReadAllLines(path); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length == 0 || text.StartsWith("#")) { continue; } if (text.StartsWith("[") && text.EndsWith("]")) { item = text.Substring(1, text.Length - 2).Trim(); continue; } int num = text.IndexOf('='); if (num > 0) { dictionary[(item, text.Substring(0, num).Trim())] = text.Substring(num + 1).Trim(); } } return dictionary; } } [HarmonyPatch] internal static class ConsumablesAreKits { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<float> KitLootPercent; internal static ConfigEntry<float> HealthKitWeight; internal static ConfigEntry<float> ToolKitWeight; internal static ConfigEntry<float> AmmoKitWeight; internal static ConfigEntry<int> KitChargesMin; internal static ConfigEntry<int> KitChargesMax; internal static ConfigEntry<bool> LootMixEnabled; internal static ConfigEntry<float> HandGrenadeWeight; internal static ConfigEntry<float> StimPackWeight; internal static ConfigEntry<float> OutInTheOpenShare; internal static void Bind(ConfigFile config) { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown Enabled = config.Bind<bool>("Loot", "Consumables Are Kits", true, "Consumables found in lockers, boxes or lying around are small health, tool and ammo kits, and only a few of them (see Kit Loot) - on top of the zone's normal resource packs, which are left as they are. Loot Mix adds Hand Grenades and Stim Packs to them. Off: vanilla consumables (retuned by GTFO.EZ's per-item weights, if that's installed), and no Loot Mix. Takes effect on restart."); KitLootPercent = NonNegative.Bind(config, "Loot", "Kit Loot (%)", 20f, "With Consumables Are Kits on: how much the kits found as loot add, in percent of a zone's normal health, ammo and tool pack budget (averaged over the difficulty tiers). Default 20 - about a fifth more kits than the resource packs alone. Loot Mix's Hand Grenades and Stim Packs come on top. Takes effect on restart."); HealthKitWeight = NonNegative.Bind(config, "Loot", "Health Kit Weight", 1f, "With Consumables Are Kits on: multiplies the odds a kit is a health kit. The odds already follow the zone's own health pack budget; 1 keeps that split. Takes effect on restart."); ToolKitWeight = NonNegative.Bind(config, "Loot", "Tool Kit Weight", 1f, "With Consumables Are Kits on: multiplies the odds a kit is a tool kit. The odds already follow the zone's own tool pack budget; 1 keeps that split. Takes effect on restart."); AmmoKitWeight = NonNegative.Bind(config, "Loot", "Ammo Kit Weight", 1f, "With Consumables Are Kits on: multiplies the odds a kit is an ammo kit. The odds already follow the zone's own ammo pack budget; 1 keeps that split. Takes effect on restart."); KitChargesMin = config.Bind<int>("Loot", "Kit Charges Min", 1, "Fewest charges a kit found as loot holds. One charge is one use, 20% of a full pack. Takes effect on restart."); KitChargesMax = config.Bind<int>("Loot", "Kit Charges Max", 2, "Most charges a kit found as loot holds. Takes effect on restart."); LootMixEnabled = config.Bind<bool>("Loot", "Loot Mix Enabled", true, "With Consumables Are Kits on: Hand Grenades and Stim Packs join the kits in the loot, and OutInTheOpenShare of it lies out in the open. Off: kits only, where the game puts them. Takes effect on restart."); HandGrenadeWeight = NonNegative.Bind(config, "Loot", "HandGrenadeWeight", 4f, "With Loot Mix on: odds a loot consumable is a Hand Grenade, against the kits' weights (1 each). Takes effect on restart."); StimPackWeight = NonNegative.Bind(config, "Loot", "StimPackWeight", 1f, "With Loot Mix on: relative odds it's a Stim Pack. Takes effect on restart."); OutInTheOpenShare = config.Bind<float>("Loot", "OutInTheOpenShare", 0.6f, new ConfigDescription("With Loot Mix on: share (0-1) of loot consumables left lying out in the open instead of in boxes and lockers. Takes effect on restart.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); } [HarmonyPatch(typeof(GameDataInit), "Initialize")] [HarmonyPostfix] [HarmonyAfter(new string[] { "MindAttic.GTFO.EZ" })] [HarmonyPriority(200)] private static void Apply() { //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown bool flag = default(bool); try { if (!Enabled.Value) { return; } KitLootSettings kitLootSettings = new KitLootSettings { LogName = "Consumables Are Kits", LootPercent = KitLootPercent.Value, MinCharges = KitChargesMin.Value, MaxCharges = KitChargesMax.Value, HealthWeight = HealthKitWeight.Value, ToolWeight = ToolKitWeight.Value, AmmoWeight = AmmoKitWeight.Value }; if (!LootMixEnabled.Value) { KitLoot.Fill(kitLootSettings); return; } if (HandGrenade.Enabled.Value) { AddExtra(kitLootSettings.Extras, 1203u, HandGrenadeWeight, "Hand Grenade"); } if (StimPack.Enabled.Value) { AddExtra(kitLootSettings.Extras, 1204u, StimPackWeight, "Stim Pack"); } float inBoxes = 1f - Mathf.Clamp01(OutInTheOpenShare.Value); int num = KitLoot.Fill(kitLootSettings, delegate(ConsumableDistributionDataBlock block) { block.ChanceToSpawnInResourceContainer = inBoxes; }); ManualLogSource logger = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loot Mix: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" table(s), "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(1f - inBoxes, "P0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" out in the open."); } logger.LogInfo(val); } catch (Exception ex) { ManualLogSource logger2 = Plugin.Logger; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("GTFO.EZ.AbsurdItems couldn't set the kit loot: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex); } logger2.LogError(val2); } } private static void AddExtra(List<(uint Id, float Weight)> into, uint id, ConfigEntry<float> weight, string what) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (!GameDataBlockBase<ItemDataBlock>.HasBlock(id)) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(48, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loot Mix: no "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" item found - left out of the loot."); } logger.LogWarning(val); } else if (weight.Value > 0f) { into.Add((id, weight.Value)); } } } internal static class DataBlocks { internal static T Clone<T>(T source) where T : GameDataBlockBase<T>, new() { T val = new T(); PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanRead && propertyInfo.CanWrite && propertyInfo.GetIndexParameters().Length == 0) { propertyInfo.SetValue(val, propertyInfo.GetValue(source)); } } return val; } } [HarmonyPatch] internal static class HandGrenade { internal const uint ItemId = 1203u; internal static ConfigEntry<float> FuseSeconds; internal static ConfigEntry<float> BlastRadius; internal static ConfigEntry<float> BlastDamage; internal static ConfigEntry<float> BlastEdgeFraction; internal static ConfigEntry<float> BlastStagger; internal static ConfigEntry<int> PickupCount; internal static ConfigEntry<int> MaxCarried; internal static ConfigEntry<float> ThrowForceMultiplier; internal static ConfigEntry<bool> Enabled; private static bool added; private const string ModelName = "GTFO.EZ.AbsurdItems Hand Grenade Model"; internal static void Bind(ConfigFile config) { Enabled = config.Bind<bool>("Hand Grenade", "Hand Grenade Enabled", true, "Adds the Hand Grenade (the glowstick's item, cloned) at all. It only spawns as loot through [Loot] Loot Mix Enabled, which adds it to the kit loot (Consumables Are Kits). Takes effect on restart."); FuseSeconds = NonNegative.Bind(config, "Hand Grenade", "FuseSeconds", 3f, "Seconds from the throw until it explodes."); BlastRadius = NonNegative.Bind(config, "Hand Grenade", "BlastRadius", 6f, "Metres the blast reaches."); BlastDamage = NonNegative.Bind(config, "Hand Grenade", "BlastDamage", 60f, "Damage at the blast's center, before damage boosts (Aggressive artifacts, a Stim Pack)."); BlastEdgeFraction = NonNegative.Bind(config, "Hand Grenade", "BlastEdgeFraction", 0.25f, "Share of damage left at the blast's edge."); BlastStagger = NonNegative.Bind(config, "Hand Grenade", "BlastStagger", 6f, "Blast stagger multiplier."); MaxCarried = AtLeastOne.Bind(config, "Hand Grenade", "MaxCarried", 6, "The most Hand Grenades you can carry."); PickupCount = AtLeastOne.Bind(config, "Hand Grenade", "PickupCount", 1, "How many Hand Grenades one loot pickup holds. Takes effect on restart."); ThrowForceMultiplier = NonNegative.Bind(config, "Hand Grenade", "ThrowForceMultiplier", 2f, "Multiplies the glowstick's own wind-up throw strength, so it lobs much farther."); } internal static bool IsOurs(ItemDataBlock? block) { if (block != null) { return ((GameDataBlockBase<ItemDataBlock>)(object)block).persistentID == 1203; } return false; } internal static void Uncap(InventorySlotAmmo? ammo) { int num = Mathf.Max(1, MaxCarried.Value); if (ammo != null && ammo.BulletsMaxCap != num && InLocalConsumableSlot()) { ammo.AmmoMaxCap = Mathf.Max(0.0001f, ammo.CostOfBullet) * (float)num; ammo.BulletsMaxCap = num; } } private static bool InLocalConsumableSlot() { PlayerBackpack localBackpack = PlayerBackpackManager.LocalBackpack; BackpackItem val = default(BackpackItem); if (localBackpack != null && localBackpack.TryGetBackpackItem((InventorySlot)5, ref val) && val != null) { if (val.ItemID != 1203) { Item instance = val.Instance; return IsOurs((instance != null) ? instance.ItemDataBlock : null); } return true; } return false; } [HarmonyPatch(typeof(PlayerAmmoStorage), "SetupAmmoType")] [HarmonyPostfix] private static void AfterSetupAmmoType(PlayerAmmoStorage __instance, AmmoType type) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 try { PlayerBackpack localBackpack = PlayerBackpackManager.LocalBackpack; PlayerAmmoStorage val = ((localBackpack != null) ? localBackpack.AmmoStorage : null); if ((int)type == 5 && val != null && ((Il2CppObjectBase)val).Pointer == ((Il2CppObjectBase)__instance).Pointer) { Uncap(__instance.ConsumableAmmo); } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(55, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("GTFO.EZ.AbsurdItems couldn't set the Hand Grenade cap: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } logger.LogWarning(val2); } } [HarmonyPatch(typeof(GameDataInit), "Initialize")] [HarmonyPostfix] [HarmonyAfter(new string[] { "MindAttic.GTFO.EZ" })] private static void AddItem() { //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00de: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown bool flag = default(bool); try { if (!Enabled.Value) { Plugin.Logger.LogInfo((object)"GTFO.EZ.AbsurdItems: Hand Grenade disabled in the config - not adding it."); return; } if (GameDataBlockBase<ItemDataBlock>.HasBlock(1203u)) { if (!added) { ManualLogSource logger = Plugin.Logger; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(104, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdItems: item id "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(1203u); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is already taken by another mod's datablock - not adding the Hand Grenade."); } logger.LogError(val); } return; } ItemDataBlock val2 = FindGlowstick(); if (val2 == null) { Plugin.Logger.LogError((object)"GTFO.EZ.AbsurdItems: couldn't find the glowstick's item datablock - not adding the Hand Grenade."); return; } ItemDataBlock val3 = DataBlocks.Clone<ItemDataBlock>(val2); ((GameDataBlockBase<ItemDataBlock>)(object)val3).persistentID = 1203u; ((GameDataBlockBase<ItemDataBlock>)(object)val3).name = "HandGrenade"; val3.publicName = Formulas.DisplayName("Hand Grenade"); val3.LocalizedName = new LocalizedText { Id = 0u, UntranslatedText = Formulas.DisplayName("Hand Grenade") }; val3.terminalItemLongName = new LocalizedText { Id = 0u, UntranslatedText = "Hand Grenade" }; val3.terminalItemShortName = "HAND_GRENADE"; val3.ConsumableAmmoMin = PickupCount.Value; val3.ConsumableAmmoMax = PickupCount.Value; GameDataBlockBase<ItemDataBlock>.AddBlock(val3, -1); added = true; ManualLogSource logger2 = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(104, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("GTFO.EZ.AbsurdItems added the Hand Grenade (consumable; item id "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<uint>(1203u); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", cloned from '"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(((GameDataBlockBase<ItemDataBlock>)(object)val2).name); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("' "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<uint>(((GameDataBlockBase<ItemDataBlock>)(object)val2).persistentID); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("; sync id "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<uint>(val3.syncID); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" vs source "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<uint>(val2.syncID); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(")."); } logger2.LogInfo(val4); } catch (Exception ex) { ManualLogSource logger3 = Plugin.Logger; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHan