using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AIGraph; using AK; using Agents; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using GTFO.API; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem; using LevelGeneration; using Microsoft.CodeAnalysis; using Player; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("SupplyCrateSetup")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SupplyCrateSetup")] [assembly: AssemblyTitle("SupplyCrateSetup")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace SupplyCrateSetup { [BepInPlugin("cris.SupplyCrateSetup", "SupplyCrateSetup", "0.0.1")] public class EntryPoint : BasePlugin { private readonly string[] SupplyCratePrefabPaths = new string[3] { "Assets/EternalPrefabs/2026_F.04/geo_64x64_mining_refinery_I_HA_06_AW_F04.prefab", "Assets/EternalPrefabs/2026_F.04/geo_64x64_service_gardens_I_01_F04.prefab", "Assets/EternalPrefabs/2026_F.04/geo_64x64_tech_data_center_hub_SF_01_F04.prefab" }; public static EntryPoint e; public override void Load() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown e = this; Harmony val = new Harmony("cris.SupplyCrateSetup"); ((BasePlugin)this).Log.LogInfo((object)"Loading SupplyCrateSetup..."); ClassInjector.RegisterTypeInIl2Cpp(); LG_Factory.OnFactoryBuildStart += Action.op_Implicit((Action)OverrideInteraction); val.PatchAll(); ((BasePlugin)this).Log.LogInfo((object)"SupplyCrateSetup loaded."); } private void OverrideInteraction() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown string[] supplyCratePrefabPaths = SupplyCratePrefabPaths; bool flag = default(bool); foreach (string text in supplyCratePrefabPaths) { GameObject loadedAsset = AssetAPI.GetLoadedAsset(text); if ((Object)(object)loadedAsset != (Object)null) { ManualLogSource log = ((BasePlugin)this).Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SupplyCrateSetup] Processing prefab: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); } log.LogInfo(val); AddTargetComponent(loadedAsset); } else { ManualLogSource log2 = ((BasePlugin)this).Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[SupplyCrateSetup] Prefab not found at: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(text); } log2.LogWarning(val2); } } } private void AddTargetComponent(GameObject prefab) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown bool flag = default(bool); foreach (Transform componentsInChild in prefab.GetComponentsInChildren(true)) { if (!((Object)componentsInChild).name.Contains("GIVE")) { continue; } GameObject gameObject = ((Component)componentsInChild).gameObject; if ((Object)(object)gameObject.GetComponent() == (Object)null) { gameObject.AddComponent(); ManualLogSource log = ((BasePlugin)this).Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[AmmoCrateSetup] Attached to: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)gameObject).name); } log.LogInfo(val); } } } } public class SupplyCrateSetup : MonoBehaviour { private enum CrateType { Ammo, Medi, Tool, Gear } private Interact_Timed m_interact; private CrateType type; private Dictionary gearListStandard = new Dictionary { { "Shelling S49", 300u }, { "Shelling Nano", 6700u }, { "Bataldo 3RB", 4700u }, { "Raptus Treffen 2", 2900u }, { "Raptus Steigro", 4500u }, { "Drekker Pres MOD 556", 4100u }, { "Malatack LX", 1200u }, { "Malatack CH 4", 3000u }, { "Van Auken CAB F4", 3400u }, { "Accrat Golok DA", 4000u }, { "TR22 Hanaway", 500u }, { "Hanaway PSB", 5000u }, { "Van Auken LTC5", 400u }, { "Accrat ND6", 4900u }, { "Accrat STB", 6000u }, { "Bataldo Custom K330", 6500u }, { "Buckland SBS III", 5100u }, { "Bataldo J 300", 6100u } }; private Dictionary gearListSpecial = new Dictionary { { "Mastaba R66", 1500u }, { "Shelling Arid 5", 6300u }, { "Drekker CLR", 6600u }, { "Malatack HXC", 4600u }, { "Buckland s870", 1300u }, { "Buckland XDist2", 4400u }, { "Drekker INEX Drei", 5600u }, { "Buckland AF6", 3100u }, { "TechMan Klust 6", 3900u }, { "TechMan Arbalist V", 1600u }, { "TechMan Veruta XII", 3800u }, { "Omneco exp1", 4300u }, { "Omneco LRG", 4200u }, { "Drekker DEL P1", 6200u }, { "Köning PR 11", 1400u } }; private void Awake() { m_interact = ((Component)this).GetComponent(); Interact_Timed interact = m_interact; interact.OnInteractionTriggered += Action.op_Implicit((Action)OnInteractComplete); string name = ((Object)((Component)this).gameObject).name; if (name.Contains("AMMO")) { type = CrateType.Ammo; } else if (name.Contains("MEDI")) { type = CrateType.Medi; } else if (name.Contains("TOOL")) { type = CrateType.Tool; } else if (name.Contains("GEAR")) { type = CrateType.Gear; } } private void OnInteractComplete(PlayerAgent player) { switch (type) { case CrateType.Ammo: GiveResource(player, 101u, 100f); break; case CrateType.Medi: GiveResource(player, 102u, 40f); break; case CrateType.Tool: GiveResource(player, 127u, 40f); break; case CrateType.Gear: SwapGear(player); break; } } private void GiveResource(PlayerAgent player, uint id, float ammo) { //IL_0016: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) ItemDataBlock block = GameDataBlockBase.GetBlock(id); InventorySlot inventorySlot = block.inventorySlot; PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); LocalPlayerAgent val = ((localPlayerAgent != null) ? ((Il2CppObjectBase)localPlayerAgent).TryCast() : null); pItemData val2 = default(pItemData); val2.custom = new pItemData_Custom { ammo = ammo, byteId = 0, byteState = 0 }; val2.itemID_gearCRC = id; val2.slot = inventorySlot; val2.originLayer = ((Agent)val).CourseNode.LayerType; pItemData val3 = val2; ((pCourseNode)(ref val3.originCourseNode)).Set(((Agent)player).CourseNode); ItemReplicationManager.SpawnItem(val3, DelegateSupport.ConvertDelegate((Delegate)(Action)delegate(ISyncedItem item, PlayerAgent player) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_009b: Unknown result type (might be due to invalid IL or missing references) ItemInLevel val4 = ((Il2CppObjectBase)item).TryCast(); if (!((Object)(object)val4 == (Object)null)) { ItemInLevel val5 = val4; if (val5.CourseNode == null) { AIG_CourseNode val6 = (val5.CourseNode = ((Agent)player).CourseNode); } val4.internalSync.AttemptPickupInteraction((ePickupItemInteractionType)2, player.Owner, new pItemData_Custom { ammo = ammo }, default(Vector3), default(Quaternion), (AIG_CourseNode)null, false, false); val4.internalSync.AttemptPickupInteraction((ePickupItemInteractionType)0, player.Owner, default(pItemData_Custom), default(Vector3), default(Quaternion), (AIG_CourseNode)null, false, false); } }), (ItemMode)2, ((Agent)player).Position + new Vector3(0f, 0.06f, 0f), ((Agent)player).Rotation, ((Agent)player).CourseNode, (PlayerAgent)(object)val); } private void SwapGear(PlayerAgent player) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(player.Owner); PlayerAmmoStorage ammoStorage = backpack.AmmoStorage; PlayerOfflineGearDataBlock val = new PlayerOfflineGearDataBlock(); InventorySlot wieldedSlot = player.Inventory.WieldedSlot; if ((int)wieldedSlot == 1) { BackpackItem item = PlayerBackpackManager.GetItem(player.Owner, (InventorySlot)1); if (!gearListStandard.ContainsKey(item.GearIDRange.PublicGearName)) { return; } val = GameDataBlockBase.GetBlock(gearListStandard[item.GearIDRange.PublicGearName]); } else { BackpackItem item2 = PlayerBackpackManager.GetItem(player.Owner, (InventorySlot)2); if (!gearListSpecial.ContainsKey(item2.GearIDRange.PublicGearName)) { return; } val = GameDataBlockBase.GetBlock(gearListSpecial[item2.GearIDRange.PublicGearName]); } GearIDRange val2 = new GearIDRange(val.GearJSON); PlayerBackpackManager.EquipLocalGear(val2); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } } }