using System; 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 BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Localization; using UnityEngine.Localization.Settings; using UnityEngine.Localization.Tables; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("ViViKo.BetterMarket")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Fixes and Tweaks")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("BetterMarket")] [assembly: AssemblyTitle("ViViKo.BetterMarket")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BetterMarket { [BepInPlugin("ViViKo.BetterMarket", "BetterMarket", "1.2.0")] public class BetterMarket : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("ViViKo.BetterMarket"); public static BetterMarket Instance; internal static ManualLogSource Logger { get; private set; } private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); Logger.LogInfo((object)"Plugin BetterMarket v1.2.0 is loaded!"); } public static int GetProductAmount(ProductSO product) { return (from x in Object.FindObjectsOfType() where x.itemSO is ProductSO && x.itemSO.itemName == ((ItemSO)product).itemName select x).Sum((Item item) => item.amount.Value); } } public static class PluginInfo { public const string PLUGIN_GUID = "ViViKo.BetterMarket"; public const string PLUGIN_NAME = "BetterMarket"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace BetterMarket.Patches { [HarmonyPatch(typeof(BlockAlcoholMachine))] public class BlockJamMachinePatch { [HarmonyPatch("GetDescription")] [HarmonyPostfix] private static void GetDescriptionPatch(BlockAlcoholMachine __instance, ref string __result) { if (__instance.currentOutput.Value != -1) { ItemSO itemById = GameManager.Instance.GetItemById(__instance.currentOutput.Value); __result = itemById.GetLocalizedName(); if (__instance.remainingDays.Value > 0) { int value = __instance.remainingDays.Value; string text = string.Format("{0} {1} left", value, (value == 1) ? "day" : "days"); __result = __result + " " + text + ""; } } } } [HarmonyPatch(typeof(BlockAnimal))] public class BlockAnimalPatch { [HarmonyPatch("GetDescription")] [HarmonyPostfix] private static void GetDescriptionPatch(BlockAnimal __instance, ref string __result) { if (__instance.dayCounter.Value < __instance.animalSO.daysToHarvestAfterGrowth) { int num = __instance.animalSO.daysToHarvestAfterGrowth - __instance.dayCounter.Value; string text = string.Format("{0} {1} left", num, (num == 1) ? "day" : "days"); __result = __result + " " + text + ""; } } } [HarmonyPatch(typeof(BlockDirt))] public class BlockDirtPatch { [HarmonyPatch("GetDescription")] [HarmonyPostfix] private static void GetDescriptionPatch(BlockDirt __instance, ref string __result) { if (__instance.currentSeed.Value != -1) { ItemSO itemById = GameManager.Instance.GetItemById(__instance.currentSeed.Value); SeedSO val = (SeedSO)(object)((itemById is SeedSO) ? itemById : null); if (__instance.dayCounter.Value < val.daysToFullGrowth) { int num = val.daysToFullGrowth - __instance.dayCounter.Value; string text = string.Format("{0} {1} left", num, (num == 1) ? "day" : "days"); __result = __result + " " + text + ""; } } } } [HarmonyPatch(typeof(BlockTree))] public class BlockTreePatch { [HarmonyPatch("GetDescription")] [HarmonyPostfix] private static void GetDescriptionPatch(BlockTree __instance, ref string __result) { if (__instance.dayCounter.Value < __instance.treeSO.daysToHarvestAfterGrowth) { int num = __instance.treeSO.daysToHarvestAfterGrowth - __instance.dayCounter.Value; string text = string.Format("{0} {1} left", num, (num == 1) ? "day" : "days"); __result = __result + " " + text + ""; } } } [HarmonyPatch(typeof(DockOrderTile))] public class DockOrderTilePatch { [HarmonyPatch("SetData")] [HarmonyPostfix] private static void SetDataPatch(DockOrderTile __instance, ProductSO productSO) { int productAmount = GetProductAmount(productSO); TextMeshProUGUI textTitle = __instance.textTitle; ((TMP_Text)textTitle).text = ((TMP_Text)textTitle).text + $" [{productAmount}]"; } public static int GetProductAmount(ProductSO product) { return (from x in Object.FindObjectsOfType() where x.itemSO is ProductSO && x.itemSO.itemName == ((ItemSO)product).itemName select x).Sum((Item item) => item.amount.Value); } } [HarmonyPatch(typeof(PlayerInventory))] public class PlayerInventoryPatch { private const float angleToRotate = 45f; private static readonly List AllowPlacementAnywhere = new List(7) { "floor_sign", "wall_sign", "big_fence", "chandelier", "lantern", "small_fence", "wall_candle" }; [HarmonyPatch("HandleNewBlockPlacement")] [HarmonyPrefix] private static bool HandleNewBlockPlacementPatch(PlayerInventory __instance) { HandleNewBlockPlacement(__instance); return false; } private static void HandleNewBlockPlacement(PlayerInventory __instance) { //IL_000a: 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) //IL_002f: 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_0035: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00ad: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0309: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) PlayerActions player = InputManager.Instance.inputMaster.Player; if (((PlayerActions)(ref player)).Place.IsPressed() || (Object)(object)__instance.itemBlueprint != (Object)null) { return; } InventorySlot currentInventorySlot = __instance.GetCurrentInventorySlot(); if (currentInventorySlot.itemId == -1) { return; } ItemSO itemById = GameManager.Instance.GetItemById(currentInventorySlot.itemId); BlockSO val = (BlockSO)(object)((itemById is BlockSO) ? itemById : null); if ((Object)(object)val == (Object)null || val == null) { return; } bool flag = AllowPlacementAnywhere.Contains(((ItemSO)val).itemName); Ray val2 = __instance.playerCamera.ViewportPointToRay(Vector3.one / 2f); LayerMask val3 = LayerMask.op_Implicit(~LayerMask.op_Implicit(__instance.blockIgnoredLayerMask)); LayerMask val4 = LayerMask.op_Implicit(-1 & LayerMask.op_Implicit(val3)); QueryTriggerInteraction val5 = (QueryTriggerInteraction)1; int num = 1; if (((ItemSO)val).prefab.CompareTag("Boat") || ((ItemSO)val).prefab.CompareTag("Floatable")) { val5 = (QueryTriggerInteraction)2; num = 2; } RaycastHit val6 = default(RaycastHit); if (Physics.Raycast(val2, ref val6, __instance.buildDistance * (float)num, flag ? (-1) : LayerMask.op_Implicit(val4), val5)) { if (!flag && !LayerMaskExtensions.Includes(val.placementLayerMask, ((Component)((RaycastHit)(ref val6)).collider).gameObject.layer)) { __instance.DestroyBlockBlueprint(); return; } if ((Object)(object)__instance.blockBlueprint == (Object)null) { Quaternion rotation = ((RaycastHit)(ref val6)).transform.rotation; string text = LayerMask.LayerToName(((Component)((RaycastHit)(ref val6)).collider).gameObject.layer); if (GameManager.Instance.mapSO.id == 0 && (text == "Water" || text == "Terrain")) { ((Quaternion)(ref rotation)).eulerAngles = new Vector3(((Quaternion)(ref rotation)).eulerAngles.x, ((Quaternion)(ref rotation)).eulerAngles.y - 28.85f, ((Quaternion)(ref rotation)).eulerAngles.z); } __instance.blockBlueprint = Object.Instantiate(((ItemSO)val).prefab, ((RaycastHit)(ref val6)).point, rotation); __instance.blockBlueprintHit = ((RaycastHit)(ref val6)).transform; Collider[] componentsInChildren = __instance.blockBlueprint.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } __instance.blockBlueprint.GetComponent().AutoObjectParentSync = false; __instance.blueprintTrigger = null; __instance.blueprintTrigger = __instance.blockBlueprint.GetComponent().blueprintTrigger; ((Component)__instance.blueprintTrigger).gameObject.layer = LayerMask.NameToLayer("IgnoreBlockCollision"); ObstacleColliderVisualizer val7 = default(ObstacleColliderVisualizer); if (((Component)__instance.blueprintTrigger).TryGetComponent(ref val7)) { ((Behaviour)val7).enabled = true; } if ((Object)(object)__instance.blueprintTrigger != (Object)null) { ((Collider)__instance.blueprintTrigger).enabled = true; } __instance.meshRenderersBlockBlueprint = __instance.blockBlueprint.GetComponentsInChildren().ToList(); __instance.ShowObstacleVisualizers(true); return; } __instance.blockBlueprint.transform.position = ((RaycastHit)(ref val6)).point; if ((Object)(object)__instance.blockBlueprintHit != (Object)(object)((RaycastHit)(ref val6)).transform) { __instance.blockBlueprintHit = ((RaycastHit)(ref val6)).transform; string text2 = LayerMask.LayerToName(((Component)((RaycastHit)(ref val6)).collider).gameObject.layer); Quaternion rotation2 = ((RaycastHit)(ref val6)).transform.rotation; if (GameManager.Instance.mapSO.id == 0 && (text2 == "Water" || text2 == "Terrain")) { ((Quaternion)(ref rotation2)).eulerAngles = new Vector3(((Quaternion)(ref rotation2)).eulerAngles.x, ((Quaternion)(ref rotation2)).eulerAngles.y - 28.85f, ((Quaternion)(ref rotation2)).eulerAngles.z); } __instance.blockBlueprint.transform.rotation = rotation2; } player = InputManager.Instance.inputMaster.Player; if (((PlayerActions)(ref player)).Rotate.WasPerformedThisFrame() && !val.disableRotation) { LeanTweenExt.LeanRotateAroundLocal(__instance.blockBlueprint, Vector3.up, 45f, 0.1f); } bool flag2 = true; if ((Object)(object)__instance.blueprintTrigger == (Object)null) { Debug.LogError((object)"Block needs a blueprint collider!"); } else { Vector3 val8 = Vector3.Scale(__instance.blueprintTrigger.size, ((Component)__instance.blueprintTrigger).transform.lossyScale) / 2f; Bounds bounds = ((Collider)__instance.blueprintTrigger).bounds; flag2 = Physics.CheckBox(((Bounds)(ref bounds)).center, val8, ((Component)__instance.blueprintTrigger).transform.rotation, LayerMask.op_Implicit(val4), (QueryTriggerInteraction)2); } if (flag2) { foreach (MeshRenderer item in __instance.meshRenderersBlockBlueprint) { int num2 = ((Renderer)item).sharedMaterials.Length; Material[] array = (Material[])(object)new Material[num2]; for (int j = 0; j < num2; j++) { array[j] = __instance.materialBlueprintInvalid; } ((Renderer)item).materials = array; } return; } foreach (MeshRenderer item2 in __instance.meshRenderersBlockBlueprint) { int num3 = ((Renderer)item2).sharedMaterials.Length; Material[] array2 = (Material[])(object)new Material[num3]; for (int k = 0; k < num3; k++) { array2[k] = __instance.materialBlueprintValid; } ((Renderer)item2).materials = array2; } player = InputManager.Instance.inputMaster.Player; if (((PlayerActions)(ref player)).Put.WasPerformedThisFrame()) { __instance.audioSource.PlayOneShot(__instance.placementSound, 0.2f); __instance.PlaceBlockServerRpc(((ItemSO)val).id, __instance.blockBlueprint.transform.position, __instance.blockBlueprint.transform.rotation, currentInventorySlot.dayCounter); __instance.UseItem(); __instance.DestroyBlockBlueprint(); } } else { __instance.DestroyBlockBlueprint(); } } [HarmonyPatch("HandleItemPlacement")] [HarmonyPrefix] private static bool HandleItemPlacementPatch(PlayerInventory __instance) { HandleItemPlacement(__instance); return false; } private static void HandleItemPlacement(PlayerInventory __instance) { //IL_000a: 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) //IL_006f: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053d: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) PlayerActions player = InputManager.Instance.inputMaster.Player; if (((PlayerActions)(ref player)).Place.WasPerformedThisFrame()) { ItemSO itemById = GameManager.Instance.GetItemById(__instance.GetCurrentInventorySlot().itemId); if ((Object)(object)itemById != (Object)null && itemById is ProductSO && (Object)(object)__instance.cameraHolder != (Object)null) { __instance.cameraHolder.SetActive(false); __instance.DestroyBlockBlueprint(); } } player = InputManager.Instance.inputMaster.Player; if (((PlayerActions)(ref player)).Place.IsPressed()) { InventorySlot currentInventorySlot = __instance.GetCurrentInventorySlot(); if (currentInventorySlot.itemId == -1) { return; } ItemSO itemById2 = GameManager.Instance.GetItemById(__instance.GetCurrentInventorySlot().itemId); if (!(itemById2 is ProductSO) && !itemById2.allowPlacement) { return; } if ((Object)(object)__instance.blockBlueprint != (Object)null) { __instance.DestroyBlockBlueprint(); } RaycastHit val = default(RaycastHit); if (Physics.Raycast(__instance.playerCamera.ViewportPointToRay(Vector3.one / 2f), ref val, __instance.buildDistance, LayerMask.op_Implicit(__instance.itemPlacementLayerMask), (QueryTriggerInteraction)1)) { if ((Object)(object)__instance.itemBlueprint == (Object)null) { ((Component)__instance.localToolHolder).gameObject.SetActive(false); if (itemById2 is BlockSO) { __instance.itemBlueprint = Object.Instantiate(GameManager.Instance.blockBox); } else { __instance.itemBlueprint = Object.Instantiate(itemById2.prefab, ((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).transform.rotation); __instance.itemBlueprintHit = ((RaycastHit)(ref val)).transform; ItemCrate component = __instance.itemBlueprint.GetComponent(); if ((Object)(object)component != (Object)null) { component.EnableDummyItems(currentInventorySlot.amount); } } __instance.itemCollider = null; __instance.itemCollider = __instance.itemBlueprint.GetComponentInChildren(); ((Collider)__instance.itemCollider).isTrigger = true; __instance.meshRenderersItemBlueprint = __instance.itemBlueprint.GetComponentsInChildren().ToList(); } else { __instance.itemBlueprint.transform.position = ((RaycastHit)(ref val)).point; if ((Object)(object)__instance.itemBlueprintHit != (Object)(object)((RaycastHit)(ref val)).transform) { __instance.itemBlueprintHit = ((RaycastHit)(ref val)).transform; __instance.itemBlueprint.transform.rotation = ((RaycastHit)(ref val)).transform.rotation; } player = InputManager.Instance.inputMaster.Player; if (((PlayerActions)(ref player)).Rotate.WasPerformedThisFrame()) { LeanTweenExt.LeanRotateAroundLocal(__instance.itemBlueprint, Vector3.up, 45f, 0.1f); } if (((Component)((RaycastHit)(ref val)).collider).tag == "Terrain") { __instance.itemBlueprint.transform.rotation = Quaternion.Lerp(__instance.itemBlueprint.transform.rotation, Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val)).normal), 0.5f); } bool flag = true; if ((Object)(object)__instance.itemCollider == (Object)null) { Debug.LogError((object)"Item needs a collider!"); } else { Vector3 val2 = Vector3.Scale(__instance.itemCollider.size, __instance.itemBlueprint.transform.lossyScale) / 2f; Bounds bounds = ((Collider)__instance.itemCollider).bounds; flag = Physics.CheckBox(((Bounds)(ref bounds)).center, val2, __instance.itemBlueprint.transform.rotation, LayerMask.op_Implicit(__instance.itemObstacleLayerMask), (QueryTriggerInteraction)1); } if (!flag) { ProductSO val3 = (ProductSO)(object)((itemById2 is ProductSO) ? itemById2 : null); if (val3 == null || LayerMaskExtensions.Includes(val3.placementLayerMask, ((Component)((RaycastHit)(ref val)).collider).gameObject.layer)) { foreach (MeshRenderer item in __instance.meshRenderersItemBlueprint) { int num = ((Renderer)item).sharedMaterials.Length; Material[] array = (Material[])(object)new Material[num]; for (int i = 0; i < num; i++) { array[i] = __instance.materialBlueprintValid; } ((Renderer)item).materials = array; } player = InputManager.Instance.inputMaster.Player; if (((PlayerActions)(ref player)).Put.WasPerformedThisFrame()) { Block componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && componentInParent.blockSO.isStand && itemById2 is ProductSO) { Vector3 position = __instance.itemBlueprint.transform.position; Quaternion rotation = __instance.itemBlueprint.transform.rotation; Quaternion rotation2 = ((Component)componentInParent).transform.rotation; __instance.PlaceItemOnStandServerRpc(currentInventorySlot, position, rotation, ((Quaternion)(ref rotation2)).eulerAngles.y); } else { __instance.PlaceItemOnContainerServerRpc(currentInventorySlot, __instance.itemBlueprint.transform.position, __instance.itemBlueprint.transform.rotation); } __instance.audioSource.PlayOneShot(__instance.placementSound, 0.2f); __instance.UseItem(); __instance.DestroyItemBlueprint(); } goto IL_052e; } } foreach (MeshRenderer item2 in __instance.meshRenderersItemBlueprint) { int num2 = ((Renderer)item2).sharedMaterials.Length; Material[] array2 = (Material[])(object)new Material[num2]; for (int j = 0; j < num2; j++) { array2[j] = __instance.materialBlueprintInvalid; } ((Renderer)item2).materials = array2; } } } else { __instance.DestroyItemBlueprint(); } } goto IL_052e; IL_052e: player = InputManager.Instance.inputMaster.Player; if (((PlayerActions)(ref player)).Place.WasReleasedThisFrame()) { if ((Object)(object)__instance.cameraHolder != (Object)null) { __instance.cameraHolder.SetActive(true); } __instance.DestroyItemBlueprint(); ((Component)__instance.localToolHolder).gameObject.SetActive(true); } } [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(PlayerInventory __instance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) InputActionMap val = new InputActionMap(); InputActionSetupExtensions.AddAction(val, "slot0", (InputActionType)1, "/1", (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddAction(val, "slot1", (InputActionType)1, "/2", (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddAction(val, "slot2", (InputActionType)1, "/3", (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddAction(val, "slot3", (InputActionType)1, "/4", (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddAction(val, "slot4", (InputActionType)1, "/5", (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddAction(val, "slot5", (InputActionType)1, "/6", (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddAction(val, "slot6", (InputActionType)1, "/7", (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddAction(val, "slot7", (InputActionType)1, "/8", (string)null, (string)null, (string)null, (string)null); val.actionTriggered += delegate(CallbackContext context) { if (((CallbackContext)(ref context)).performed) { int num = int.Parse(((CallbackContext)(ref context)).action.name.Replace("slot", "")); if (num < __instance.activeSlots) { __instance.currentSlot.Value = num; } } }; val.Enable(); } } [HarmonyPatch(typeof(RecipeTile))] public class RecipeTilePatch { [HarmonyPatch("UpdateSlot")] [HarmonyPostfix] private static void UpdateSlotPatch(RecipeTile __instance, RecipeSO recipeSO) { if (recipeSO.requiredDays > 0) { string text = string.Format("{0} {1}", recipeSO.requiredDays, (recipeSO.requiredDays == 1) ? "day" : "days"); Text textOutputName = __instance.textOutputName; textOutputName.text = textOutputName.text + "\n" + text + ""; } } } [HarmonyPatch(typeof(UIManager))] public class UIManagerPatch { [HarmonyPatch("SetCoinTooltip")] [HarmonyPostfix] private static void SetCoinTooltipPatch(UIManager __instance) { //IL_005f: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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) string text = ""; int num = 0; foreach (long activeEmployee in GameManager.Instance.GetActiveEmployees()) { EmployeeSO employeeById = GameManager.Instance.GetEmployeeById(activeEmployee); num += employeeById.price; } string localizedString = LocalizationSettings.StringDatabase.GetLocalizedString(TableReference.op_Implicit("Translations"), TableEntryReference.op_Implicit("employees"), (Locale)null, (FallbackBehavior)0, Array.Empty()); text += $"\n{localizedString}\n-{num} C"; EventSO currentEvent = GameManager.Instance.GetCurrentEvent(); float num2 = 1f; if ((Object)(object)currentEvent != (Object)null) { num2 = currentEvent.taxMultiplier; } string localizedString2 = LocalizationSettings.StringDatabase.GetLocalizedString(TableReference.op_Implicit("Translations"), TableEntryReference.op_Implicit("tax_rate"), (Locale)null, (FallbackBehavior)0, Array.Empty()); int num3 = Mathf.RoundToInt((float)GameManager.Instance.initialTaxPercentage * num2); text += $"\n{localizedString2}\n{num3}%"; int rent = GameManager.Instance.GetRent(); int maintenanceValue = GameManager.Instance.GetMaintenanceValue(); int num4 = 0; foreach (Transaction dailyTransaction in GameManager.Instance.dailyTransactions) { num4 += dailyTransaction.Amount; } num4 = GameManager.Instance.CalculateTax(num4); int num5 = rent + maintenanceValue + num4; text += $"\nTAXED SALES\n-{num4} C"; text += $"\nTOTAL EXPENSES\n-{num5} C"; TooltipTrigger tooltipTriggerCoins = __instance.tooltipTriggerCoins; tooltipTriggerCoins.content += text; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }