using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using DbsContentApi; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.SceneManagement; using Zorro.Core; using Zorro.Core.Serizalization; using pworld.Scripts.Extensions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ProgressionRebalance")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+44a1e7060eb750aa5464efff7424010fea241365")] [assembly: AssemblyProduct("Progression Rebalance")] [assembly: AssemblyTitle("ProgressionRebalance")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [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 ProgressionRebalance { public class ItemSellDropBox : MonoBehaviourPunCallbacks { public const int PhotonViewId = 997; private const float RefundFraction = 0.3f; private const float DelayBeforeEvaluate = 0.3f; private const float MaxWaitAfterClosed = 1.5f; private const float ProcessingDuration = 3f; public ItemSellDropBoxItemDetector Detector; public ItemSellDropBoxLid Lid; public GameObject Particles; private PhotonView m_photonView; private ParticleSystem[] m_particleSystems = Array.Empty(); private bool m_checkingContents; private bool m_ejecting; private bool m_processing; private float m_elapsedSinceFullyClosed; private float m_processingElapsed; private int? m_pendingRefund; private float m_ignoreNewInteractionsUntilRealtime; private void Awake() { m_photonView = ((Component)this).GetComponent(); if ((Object)(object)m_photonView == (Object)null) { Logger.LogError("ItemSellDropBox: PhotonView not found on Awake."); } Transform val = ((Component)this).transform.Find("Particles/Left"); Transform val2 = ((Component)this).transform.Find("Particles/Right"); ParticleSystem val3 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); ParticleSystem val4 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent() : null); if ((Object)(object)val3 == (Object)null) { Logger.LogError("ItemSellDropBox: ParticleSystem not found on Particles/Left"); } if ((Object)(object)val4 == (Object)null) { Logger.LogError("ItemSellDropBox: ParticleSystem not found on Particles/Right"); } m_particleSystems = (ParticleSystem[])((!((Object)(object)val3 != (Object)null) || !((Object)(object)val4 != (Object)null)) ? ((!((Object)(object)val3 != (Object)null)) ? ((!((Object)(object)val4 != (Object)null)) ? ((Array)Array.Empty()) : ((Array)new ParticleSystem[1] { val4 })) : new ParticleSystem[1] { val3 }) : new ParticleSystem[2] { val3, val4 }); } private void FixedUpdate() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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) if (!PhotonNetwork.IsMasterClient || !m_ejecting) { return; } if (!Lid.m_opened) { Lid.Open(); } List<(Item, Pickup)> list = Detector.CheckForItems(); if (list.Count == 0) { m_ejecting = false; } else { if (!Lid.IsHalfwayOpenForEject()) { return; } Transform transform = ((Component)this).transform; foreach (var item2 in list) { Pickup item = item2.Item2; if (!((Object)(object)item == (Object)null) && !((Object)(object)item.Rigidbody == (Object)null)) { Rigidbody rigidbody = item.Rigidbody; if (!(rigidbody.linearVelocity.y > 0.1f)) { rigidbody.AddTorque(Vector3.right * 3f, (ForceMode)1); rigidbody.AddForce(Vector3.up * 25f + -transform.forward * 6f, (ForceMode)1); } } } } } private void Update() { if (PhotonNetwork.IsMasterClient) { UpdateLogic(); } } private static bool TryGetSellRefund(Item item, out int refund) { refund = 0; if ((Object)(object)item == (Object)null || item.price <= 0) { return false; } refund = Mathf.RoundToInt((float)item.price * 0.3f); return refund > 0; } private void UpdateLogic() { if (m_processing) { m_processingElapsed += Time.deltaTime; if (m_processingElapsed >= 3f) { EndProcessing(); } return; } List<(Item, Pickup)> list = Detector.CheckForItems(); bool flag = list.Count > 0; float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup < m_ignoreNewInteractionsUntilRealtime) { if (!flag) { m_ignoreNewInteractionsUntilRealtime = 0f; } return; } if (!m_checkingContents && !m_ejecting) { if (!flag && !Lid.m_opened) { Lid.Open(); } else if (flag && Lid.m_opened) { Lid.Close(); } } if (!m_checkingContents && !m_ejecting && flag && !Lid.m_opened && Lid.IsFullyClosed()) { m_checkingContents = true; m_elapsedSinceFullyClosed = 0f; } if (!m_checkingContents) { return; } list = Detector.CheckForItems(); if (list.Count == 0) { m_checkingContents = false; m_elapsedSinceFullyClosed = 0f; if (!Lid.m_opened) { Lid.Open(); } return; } m_elapsedSinceFullyClosed += Time.deltaTime; if (m_elapsedSinceFullyClosed < 0.3f) { return; } if (m_elapsedSinceFullyClosed <= 1.5f) { if (!TryConsumeSingleSellableItem(list)) { BeginEject(); } } else { BeginEject(); } } private bool TryConsumeSingleSellableItem(List<(Item item, Pickup pickup)> items) { if (items.Count != 1 || (Object)(object)items[0].pickup == (Object)null) { return false; } Item item = items[0].item; Pickup item2 = items[0].pickup; if (!TryGetSellRefund(item, out var refund)) { return false; } item2.m_photonView.RPC("RPC_Remove", (RpcTarget)2, Array.Empty()); m_checkingContents = false; m_elapsedSinceFullyClosed = 0f; BeginProcessing(refund); return true; } private void BeginProcessing(int refund) { if (PhotonNetwork.InRoom && (Object)(object)m_photonView != (Object)null) { m_photonView.RPC("RPC_BeginProcessing", (RpcTarget)0, new object[2] { refund, true }); } else { StartProcessingState(refund, 0f); PlayProcessingVisuals(playSfx: true); } } private void StartProcessingState(int refund, float elapsed) { m_processing = true; m_processingElapsed = elapsed; m_pendingRefund = refund; } private void PlayProcessingVisuals(bool playSfx) { if ((Object)(object)Particles != (Object)null) { if (!Particles.activeSelf) { Particles.SetActive(true); } ParticleSystem[] particleSystems = m_particleSystems; foreach (ParticleSystem val in particleSystems) { val.Clear(); val.Play(); } } else { Logger.LogError("ItemSellDropBox: Particles reference is null"); } if (!playSfx) { return; } Transform val2 = ((Component)this).transform.Find("SFX/Construction"); if ((Object)(object)val2 != (Object)null) { SFX_PlayOneShot component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null) { component.Play(); } else { Logger.LogError("ItemSellDropBox: SFX_PlayOneShot not found on SFX/Construction"); } } else { Logger.LogError("ItemSellDropBox: child SFX/Construction not found"); } } public void PlayHatchSfx(bool opened) { Transform val = ((Component)this).transform.Find(opened ? "SFX/HatchOpen" : "SFX/HatchClose"); if ((Object)(object)val != (Object)null) { SFX_PlayOneShot component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { component.Play(); } else { Logger.LogError("ItemSellDropBox: SFX_PlayOneShot not found on " + ((Object)val).name); } } else { Logger.LogError("ItemSellDropBox: hatch SFX child not found for opened=" + opened); } } private void StopProcessingVisuals(ParticleSystemStopBehavior stopBehavior) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] particleSystems = m_particleSystems; foreach (ParticleSystem val in particleSystems) { val.Stop(true, stopBehavior); } } private void EndProcessing() { m_processing = false; m_processingElapsed = 0f; int num = -1; if (m_pendingRefund.HasValue) { int value = m_pendingRefund.Value; RoomStatsHolder roomStats = SurfaceNetworkHandler.RoomStats; if (roomStats != null) { roomStats.AddMoney(value); } else { Logger.LogError("ItemSellDropBox: RoomStats is null; refund skipped."); } num = value; m_pendingRefund = null; } else { Logger.LogError("ItemSellDropBox: EndProcessing called but m_pendingRefund is null."); } if (PhotonNetwork.InRoom && (Object)(object)m_photonView != (Object)null) { m_photonView.RPC("RPC_EndProcessingVisuals", (RpcTarget)0, new object[1] { num }); } else { StopProcessingVisuals((ParticleSystemStopBehavior)1); if (num > 0) { ShowRefundNotification(num); } } m_ignoreNewInteractionsUntilRealtime = Time.realtimeSinceStartup + 0.65f; Lid.Open(); } private void BeginEject() { m_checkingContents = false; m_elapsedSinceFullyClosed = 0f; m_ejecting = true; if (!Lid.m_opened) { Lid.Open(); } } public void SyncHatchState() { if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient && (Object)(object)m_photonView != (Object)null) { m_photonView.RPC("RPC_SyncLid", (RpcTarget)1, new object[1] { Lid.m_opened }); } } [PunRPC] public void RPC_SyncLid(bool state) { Lid.SetOpenState(state, playSfx: true, syncIfMaster: false); } [PunRPC] private void RPC_BeginProcessing(int refund, bool playSfx) { StartProcessingState(refund, 0f); PlayProcessingVisuals(playSfx); } [PunRPC] private void RPC_EndProcessingVisuals(int refund) { m_processing = false; m_processingElapsed = 0f; m_pendingRefund = null; StopProcessingVisuals((ParticleSystemStopBehavior)1); if (refund > 0) { ShowRefundNotification(refund); } } private static void ShowRefundNotification(int refund) { UserInterface.ShowMoneyNotification("Item Sold", $"${refund}", (MoneyCellType)1); } public override void OnPlayerEnteredRoom(Player newPlayer) { ((MonoBehaviourPunCallbacks)this).OnPlayerEnteredRoom(newPlayer); if (PhotonNetwork.IsMasterClient && !((Object)(object)m_photonView == (Object)null)) { int num = m_pendingRefund ?? (-1); m_photonView.RPC("RPC_SyncState", newPlayer, new object[4] { Lid.m_opened, m_processing, num, m_processingElapsed }); } } [PunRPC] private void RPC_SyncState(bool lidOpened, bool processing, int pendingRefund, float processingElapsed) { Lid.SetOpenState(lidOpened, playSfx: false, syncIfMaster: false); if (processing) { if (pendingRefund >= 0) { StartProcessingState(pendingRefund, processingElapsed); } PlayProcessingVisuals(playSfx: false); } else { m_processing = false; m_processingElapsed = 0f; m_pendingRefund = null; StopProcessingVisuals((ParticleSystemStopBehavior)0); } } } public static class ItemSellDropBoxContent { public static GameObject? SellDropboxPrefab { get; private set; } public static void Init(AssetBundle bundle) { SellDropboxPrefab = ContentLoader.LoadPrefabFromBundle(bundle, "SellItemDropbox.prefab"); if ((Object)(object)SellDropboxPrefab == (Object)null) { Logger.LogError("ItemSellDropBox: SellItemDropbox.prefab missing from progressionrebalance bundle."); } } } public class ItemSellDropBoxItemDetector : MonoBehaviour { private Collider[] results = (Collider[])(object)new Collider[10]; public List<(Item item, Pickup pickup)> CheckForItems() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) HashSet hashSet = new HashSet(); List<(Item, Pickup)> list = new List<(Item, Pickup)>(); int num = Physics.OverlapBoxNonAlloc(((Component)this).transform.position, ((Component)this).transform.lossyScale * 0.5f, results, ((Component)this).transform.rotation); for (int i = 0; i < num; i++) { Collider val = results[i]; Pickup componentInParent = ((Component)val).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent) && (Object)(object)componentInParent.itemInstance != (Object)null && (Object)(object)componentInParent.itemInstance.item != (Object)null) { Item item = componentInParent.itemInstance.item; if (hashSet.Add(componentInParent)) { list.Add((item, componentInParent)); } } } return list; } private void OnDrawGizmos() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 matrix = Gizmos.matrix; Gizmos.matrix = ((Component)this).transform.localToWorldMatrix; Gizmos.color = new Color(0f, 1f, 0f, 0.5f); Gizmos.DrawCube(Vector3.zero, Vector3.one); Gizmos.matrix = matrix; } } public class ItemSellDropBoxLid : MonoBehaviour { public ItemSellDropBox Machine; public bool m_opened = true; public float Spring = 70f; public float Drag = 0.15f; public float m_openedRotation; public float m_closedRotation = 90f; private OneDPhysicsSpring m_spring; private void Awake() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) OneDPhysicsSpring spring = default(OneDPhysicsSpring); ((OneDPhysicsSpring)(ref spring)).Spring = Spring; ((OneDPhysicsSpring)(ref spring)).Drag = Drag; m_spring = spring; } private void Update() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) ((OneDPhysicsSpring)(ref m_spring)).Drag = Drag; ((OneDPhysicsSpring)(ref m_spring)).Spring = Spring; ((OneDPhysicsSpring)(ref m_spring)).Update(); ((Component)this).transform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, ((OneDPhysicsSpring)(ref m_spring)).Current)); } private void FixedUpdate() { //IL_002e: 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_006b: Unknown result type (might be due to invalid IL or missing references) ((OneDPhysicsSpring)(ref m_spring)).Target = (m_opened ? m_openedRotation : m_closedRotation); ((OneDPhysicsSpring)(ref m_spring)).FixedUpdate(); m_spring = SpringClamp.BounceClamp(m_spring, Mathf.Min(m_openedRotation, m_closedRotation) - 5f, Mathf.Max(m_openedRotation, m_closedRotation) + 5f, 0.6f); } public bool IsFullyClosed() { if (m_opened) { return false; } if (Mathf.Abs(((OneDPhysicsSpring)(ref m_spring)).Current - m_closedRotation) < 3f) { return Mathf.Abs(((OneDPhysicsSpring)(ref m_spring)).Velocity) < 0.25f; } return false; } public bool IsHalfwayOpenForEject() { if (!m_opened) { return false; } float num = (m_closedRotation + m_openedRotation) * 0.5f; return ((OneDPhysicsSpring)(ref m_spring)).Current <= num + 5f; } public void Close() { SetOpenState(opened: false, playSfx: true, syncIfMaster: true); } public void Open() { SetOpenState(opened: true, playSfx: true, syncIfMaster: true); } public void SetOpenState(bool opened, bool playSfx, bool syncIfMaster) { if (m_opened != opened) { m_opened = opened; if (syncIfMaster && PhotonNetwork.IsMasterClient) { Machine.SyncHatchState(); } if (playSfx) { Machine.PlayHatchSfx(opened); } } } } public static class Logger { private const string Prefix = "[ProgressionRebalance]"; public static void Log(string message) { Debug.Log((object)("[ProgressionRebalance] " + message)); } public static void LogWarning(string message) { Debug.LogWarning((object)("[ProgressionRebalance] " + message)); } public static void LogError(string message) { Debug.LogError((object)("[ProgressionRebalance] " + message)); } } internal class BigNumberTweaks { public static void ApplyTweaks() { Logger.Log("Applying BigNumber tweaks..."); AssetBundle bundle = ProgressionRebalance.Bundle; BigNumbers instance = SingletonAsset.Instance; BigNumbers obj = bundle.LoadAsset("AdjustedBigNumbers"); FieldInfo[] fields = typeof(BigNumbers).GetFields(); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(instance, fieldInfo.GetValue(obj)); } Logger.Log("BigNumber tweaks applied!"); } } public static class CustomItems { private static AssetBundle? _bundle; public static void Setup(AssetBundle bundle) { _bundle = bundle; Items.DeferRegistration((Action)delegate { RegisterSnailEgg(); }); } private static void RegisterSnailEgg() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) GameObject val = ContentLoader.LoadPrefabFromBundle(_bundle, "SnailEgg.prefab"); val.AddComponent(); GameMaterials.ApplyMaterial(val, (GameMaterial)26, true); ArtifactConfig val2 = new ArtifactConfig(); ((ItemConfig)val2).displayName = "Snail Egg"; ((ItemConfig)val2).persistentId = "progressionrebalance.snail_egg"; ((ItemConfig)val2).icon = GetSprite("snail_egg_icon"); ((ItemConfig)val2).impactSoundTypes = (ImpactSoundType[])(object)new ImpactSoundType[1] { (ImpactSoundType)7 }; ((ItemConfig)val2).holdPos = new Vector3(0.3f, -0.3f, 0.4f); ((ItemConfig)val2).budgetCost = 3; ((ItemConfig)val2).rarity = 1f; val2.contentValue = 75f; val2.comments = new string[2] { "is that an egg?", "please don't hatch that thing" }; Items.RegisterArtifact(val, val2); } public static Sprite GetSprite(string iconName) { return _bundle.LoadAsset(iconName); } } internal static class HospitalBillTweaks { public const int BaseCostPerDeadPlayer = 50; public const int CostIncreasePerQuota = 25; public static int GetPerDeadPlayerCost(RoomStatsHolder roomStats) { return 50 + 25 * roomStats.CurrentRun; } public static int GetTotalBill(int perDeadPlayer, int deadCount) { return perDeadPlayer * deadCount; } } internal class ItemTweaks { public static void ApplyTweaks() { Item itemByPrefabComponent = Items.GetItemByPrefabComponent(); if ((Object)(object)itemByPrefabComponent != (Object)null) { itemByPrefabComponent.price = 500; } Item itemByPrefabComponent2 = Items.GetItemByPrefabComponent(); if ((Object)(object)itemByPrefabComponent2 != (Object)null) { itemByPrefabComponent2.price = 300; } Item itemByCondition = getItemByCondition((Item item) => (Object)(object)item.itemObject.GetComponent() != (Object)null && item.price == 600); if ((Object)(object)itemByCondition != (Object)null) { itemByCondition.price = 300; } Item itemByCondition2 = getItemByCondition((Item item) => item.displayName == "Apple"); if ((Object)(object)itemByCondition2 != (Object)null) { itemByCondition2.price = 3; } } public static Item? getItemByCondition(Func condition) { ItemDatabase instance = SingletonAsset.Instance; FieldInfo objectsField = Items.GetObjectsField(instance); List itemsFromField = Items.GetItemsFromField(objectsField, instance); foreach (Item item in itemsFromField) { if (condition(item)) { return item; } } return null; } } public class SnailEggArtifactBehaviour : ItemInstanceBehaviour, IArtifactContent { private const string ZombiePrefabName = "Zombe"; private const int ZombiesToSpawn = 2; private const float HoldDuration = 3f; private IntRangeEntry chargesEntry; private StashAbleEntry stashAbleEntry; private float timeInHand; public bool IsHeld => base.isHeld; public bool IsActive => chargesEntry.selectedValue <= 0; private void Update() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (!base.isHeldByMe || !base.isSimulatedByMe || !base.isHeld) { return; } timeInHand += Time.deltaTime; if (!(timeInHand <= 3f)) { timeInHand = 0f; if (chargesEntry.selectedValue > 0) { chargesEntry.selectedValue = 0; ((ItemDataEntry)chargesEntry).SetDirty(); BinarySerializer val = new BinarySerializer(); Vector3 val2 = Player.localPlayer.Center(); val.WriteFloat(val2.x); val.WriteFloat(val2.y); val.WriteFloat(val2.z); base.itemInstance.CallRPC((ItemRPC)0, val); } } } public override void ConfigItem(ItemInstanceData data, PhotonView playerView) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0087: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown if (data.TryGetEntry(ref stashAbleEntry)) { Logger.Log($"stashAbleEntry entry found, isStashAble: {stashAbleEntry.isStashAble}"); } else { stashAbleEntry = new StashAbleEntry { isStashAble = false }; data.AddDataEntry((ItemDataEntry)(object)stashAbleEntry); Logger.Log("stashAbleEntry entry not found, adding new entry with false."); } if (data.TryGetEntry(ref chargesEntry)) { Logger.Log($"chargesEntry entry found, charges: {chargesEntry.selectedValue}"); } else { chargesEntry = new IntRangeEntry { selectedValue = 1, maxValue = 1 }; data.AddDataEntry((ItemDataEntry)(object)chargesEntry); Logger.Log("chargesEntry entry not found, adding new entry with 1."); } base.itemInstance.RegisterRPC((ItemRPC)0, (Action)RPCA_SpawnSnails); } private void RPCA_SpawnSnails(BinaryDeserializer deserializer) { //IL_002c: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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) if (!PhotonNetwork.IsMasterClient) { return; } float num = deserializer.ReadFloat(); float num2 = deserializer.ReadFloat(); float num3 = deserializer.ReadFloat(); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, num2, num3); Logger.Log($"RPCA_SpawnSnails: Received target position {val}"); List pointsOutsideMinDistanceSortedOnClosest = Level.currentLevel.GetPointsOutsideMinDistanceSortedOnClosest(ExtCollections.PToList((PatrolGroup)4), val, 40f, 10f, false); Logger.Log($"RPCA_SpawnSnails: Found {pointsOutsideMinDistanceSortedOnClosest.Count} potential spawn points."); int num4 = 0; Player val2 = default(Player); foreach (PatrolPoint item in pointsOutsideMinDistanceSortedOnClosest) { if (num4 >= 2) { break; } if (PlayerHandler.instance.CanAnAlivePlayerSeePoint(((Component)item).transform.position, ref val2, (Player)null)) { continue; } Logger.Log(string.Format("RPCA_SpawnSnails: Spawning {0} at {1}", "Zombe", ((Component)item).transform.position)); GameObject val3 = MonsterSpawner.SpawnMonster("Zombe", ((Component)item).transform.position); if ((Object)(object)val3 != (Object)null) { Bot componentInChildren = val3.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Logger.Log($"RPCA_SpawnSnails: Bot component found. Setting busy=true and targetPos={val}"); componentInChildren.busy = true; componentInChildren.navTargetPos_Set = val; ((MonoBehaviour)componentInChildren).StartCoroutine(MoveToTarget(componentInChildren, val)); } else { Logger.LogWarning("RPCA_SpawnSnails: Spawned Zombe but no Bot component found in children!"); } } else { Logger.LogError("RPCA_SpawnSnails: Failed to spawn Zombe!"); } num4++; } } private IEnumerator MoveToTarget(Bot bot, Vector3 target) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Logger.Log($"MoveToTarget: Started for bot {((Object)bot).name} towards {target}"); while ((Object)(object)bot != (Object)null && bot.busy) { float num = Vector3.Distance(bot.Center(), target); if (num < 1.5f) { Logger.Log($"MoveToTarget: Bot {((Object)bot).name} reached target (distance: {num}). Exiting busy mode."); bot.busy = false; bot.StandStill(); yield break; } bot.Look(bot.navDirection_Read, 3f); bot.Walk(); yield return null; } if ((Object)(object)bot == (Object)null) { Logger.LogWarning("MoveToTarget: Bot became null during movement."); } else if (!bot.busy) { Logger.Log("MoveToTarget: Bot " + ((Object)bot).name + " busy flag was cleared externally."); } } } public class MyPluginInfo { public const string PLUGIN_GUID = "db.progressionrebalance"; public const string PLUGIN_NAME = "Progression Rebalance"; public const string PLUGIN_VERSION = "0.1.0"; public const bool VANILLA_COMPATIBLE = false; } [ContentWarningPlugin("db.progressionrebalance", "0.1.0", false)] [BepInPlugin("db.progressionrebalance", "Progression Rebalance", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ProgressionRebalance : BaseUnityPlugin { private bool _isPatched; public static bool DEBUG_MODE; private string assetBundleName = "progressionrebalance"; public static AssetBundle? Bundle { get; private set; } private Harmony? Harmony { get; set; } public static ProgressionRebalance Instance { get; private set; } private void Awake() { Instance = this; InitializeMod(); BigNumberTweaks.ApplyTweaks(); ItemTweaks.ApplyTweaks(); PatchAll(); Logger.Log("Plugin db.progressionrebalance is loaded!"); } private void InitializeMod() { Logger.Log("Loading asset bundle..."); Bundle = ContentLoader.LoadAssetBundle(Assembly.GetExecutingAssembly(), assetBundleName); if ((Object)(object)Bundle != (Object)null) { CustomItems.Setup(Bundle); ItemSellDropBoxContent.Init(Bundle); } else { Logger.LogError("Failed to load asset bundle"); } } private void PatchAll() { //IL_002b: 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: Expected O, but got Unknown //IL_0037: Expected O, but got Unknown if (_isPatched) { Logger.LogError("Already patched!"); return; } Logger.Log("Patching..."); if (Harmony == null) { Harmony val = new Harmony("db.progressionrebalance"); Harmony val2 = val; Harmony = val; } try { Harmony.PatchAll(); _isPatched = true; Logger.Log("Patched!"); } catch (Exception arg) { Logger.LogError($"Failed to patch: {arg}"); } } public void UnpatchAll() { if (!_isPatched) { Logger.LogError("Already unpatched!"); return; } Logger.Log("Unpatching..."); try { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } _isPatched = false; Logger.Log("Unpatched!"); } catch (Exception arg) { Logger.LogError($"Failed to unpatch: {arg}"); } } } } namespace ProgressionRebalance.Patches { [HarmonyPatch(typeof(SurfaceNetworkHandler), "CheckForHospitalBill")] internal static class HospitalBillPatch { [HarmonyPrefix] public static bool Prefix(SurfaceNetworkHandler __instance) { List list = PhotonNetwork.CurrentRoom.Players.Values.ToList(); List<(int, int)> hospitalBill = new List<(int, int)>(); ICollection value = Traverse.Create(typeof(SurfaceNetworkHandler)).Field>("PlayersAliveFromUnderWorld").Value; if (value != null) { foreach (Player alivePlayer in value) { Player val = list.Find((Player p) => p.ActorNumber == alivePlayer.refs.view.OwnerActorNr); if (val != null) { list.Remove(val); } } } int count = list.Count; if (count == 0) { Logger.Log("Hospital bill: no dead players, skipping."); return false; } RoomStatsHolder roomStats = SurfaceNetworkHandler.RoomStats; int perDeadPlayerCost = HospitalBillTweaks.GetPerDeadPlayerCost(roomStats); int totalBill = HospitalBillTweaks.GetTotalBill(perDeadPlayerCost, count); string text = "Checking Hospital Bill, Dead Players Are: "; foreach (Player item in list) { text = text + item.NickName + " ID: " + item.ActorNumber + " \n"; hospitalBill.Add((item.ActorNumber, perDeadPlayerCost)); } MonoFunctions.instance.DelayCall((Action)delegate { Traverse.Create((object)__instance).Method("SendHospitalBill", new object[1] { hospitalBill }).GetValue(); }, 3f); text = text + " Per-dead fee: $" + perDeadPlayerCost + " Total Bill is: $" + totalBill + " (quota run " + roomStats.CurrentRun + ")"; Debug.Log((object)text); Logger.Log(text); return false; } } [HarmonyPatch(typeof(DivingBell), "Awake")] internal static class SpawnItemSellDropBoxPatch { [HarmonyPostfix] public static void Postfix(DivingBell __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name != "SurfaceScene")) { SetupItemSellDropbox(); } } private static void SetupItemSellDropbox() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) GameObject sellDropboxPrefab = ItemSellDropBoxContent.SellDropboxPrefab; if ((Object)(object)sellDropboxPrefab == (Object)null) { Logger.LogError("ProgressionRebalance: SellItemDropbox prefab is null; sell hatch not spawned."); return; } GameObject val = Object.Instantiate(sellDropboxPrefab); ((Object)val).name = "SellItemDropbox"; val.transform.localPosition = new Vector3(0.34f, 0.772f, 8.66f); val.transform.localEulerAngles = new Vector3(0f, 24.91f, 0f); val.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); Transform obj = val.transform.Find("Dropbox"); GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null); Transform obj2 = val.transform.Find("DropboxFrontText"); GameObject val3 = ((obj2 != null) ? ((Component)obj2).gameObject : null); Transform obj3 = val.transform.Find("Vents"); GameObject val4 = ((obj3 != null) ? ((Component)obj3).gameObject : null); Transform obj4 = val.transform.Find("Wheels"); GameObject val5 = ((obj4 != null) ? ((Component)obj4).gameObject : null); Transform obj5 = val.transform.Find("LidPivot"); GameObject val6 = ((obj5 != null) ? ((Component)obj5).gameObject : null); object obj6; if (val6 == null) { obj6 = null; } else { Transform obj7 = val6.transform.Find("Lid"); obj6 = ((obj7 != null) ? ((Component)obj7).gameObject : null); } GameObject val7 = (GameObject)obj6; Transform obj8 = val.transform.Find("UpgradeDetectionZone"); GameObject val8 = ((obj8 != null) ? ((Component)obj8).gameObject : null); if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null || (Object)(object)val5 == (Object)null || (Object)(object)val6 == (Object)null || (Object)(object)val7 == (Object)null || (Object)(object)val8 == (Object)null) { Logger.LogError("ProgressionRebalance: SellItemDropbox prefab hierarchy is incomplete; sell hatch not wired."); Object.Destroy((Object)(object)val); return; } PhotonView val9 = val.AddComponent(); val9.ViewID = 997; ItemSellDropBox itemSellDropBox = val.AddComponent(); itemSellDropBox.Particles = ((Component)val.transform.Find("Particles")).gameObject; ItemSellDropBoxItemDetector detector = val8.AddComponent(); ItemSellDropBoxLid itemSellDropBoxLid = val6.AddComponent(); itemSellDropBox.Detector = detector; itemSellDropBox.Lid = itemSellDropBoxLid; itemSellDropBoxLid.Machine = itemSellDropBox; ApplyDropboxMaterials(val2, val3, val4, val5, val7); ObjectHelper.FixShadersForCurrentScene(val); Logger.Log("ProgressionRebalance: Item sell hatch spawned on SurfaceScene."); } private static void ApplyDropboxMaterials(GameObject dropboxChild, GameObject dropboxFrontTextChild, GameObject dropboxVents, GameObject dropboxWheels, GameObject dropboxLid) { GameMaterials.ApplyMaterial(dropboxChild, (GameMaterial)301, true); GameMaterials.ApplyMaterial(dropboxFrontTextChild, (GameMaterial)301, true); MeshRenderer component = dropboxVents.GetComponent(); ((Renderer)component).materials = (Material[])(object)new Material[2] { GameMaterials.GetMaterial((GameMaterial)302), GameMaterials.GetMaterial((GameMaterial)302) }; GameMaterials.ApplyMaterial(dropboxWheels, (GameMaterial)34, true); MeshRenderer component2 = dropboxLid.GetComponent(); ((Renderer)component2).materials = (Material[])(object)new Material[2] { GameMaterials.GetMaterial((GameMaterial)302), GameMaterials.GetMaterial((GameMaterial)304) }; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }