Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DynamicStorage Tanners Hall v1.0.0
plugins/DynamicStorageAnimalProducts/DynamicStorageAnimalProducts.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("DynamicStorageAnimalProducts")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DynamicStorageAnimalProducts")] [assembly: AssemblyTitle("DynamicStorageAnimalProducts")] [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] internal sealed class IsReadOnlyAttribute : Attribute { } [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 DynamicStorageAnimalProducts { internal sealed class ConfigurationManagerAttributes { public int? Order; public bool? IsAdminOnly; public bool? ReadOnly; public bool? Browsable; public bool? IsAdvanced; } [BepInPlugin("com.muji.DynamicStorageAnimalProducts", "DynamicStorage Animal Products - Hide Rack Mapping", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal sealed class DynamicStorageAnimalProductsPlugin : BaseUnityPlugin { internal const string PluginGuid = "com.muji.DynamicStorageAnimalProducts"; internal const string PluginName = "DynamicStorage Animal Products - Hide Rack Mapping"; internal const string PluginVersion = "1.0.0"; internal const string SourcePrefabName = "piece_workbench_ext2"; internal const string FunctionalContainerPrefabName = "piece_chest_barrel"; internal const string HideRackPrefabName = "DSAP_HideRack_Standard_POC"; private const int FullRackRendererIndex = 7; private const float CalibrationRayDistance = 7f; private static readonly FieldInfo PlacementGhostField = AccessTools.Field(typeof(Player), "m_placementGhost"); private readonly Dictionary<string, HideVisualProfileConfig> hideProfileConfigs = new Dictionary<string, HideVisualProfileConfig>(StringComparer.Ordinal); private readonly Dictionary<string, RugVisualTemplate> rugTemplates = new Dictionary<string, RugVisualTemplate>(StringComparer.Ordinal); private readonly Dictionary<string, RugVisualTemplate> pileItemTemplates = new Dictionary<string, RugVisualTemplate>(StringComparer.Ordinal); private readonly Dictionary<string, HidePileItemConfig> pileItemConfigs = new Dictionary<string, HidePileItemConfig>(StringComparer.Ordinal); private RackCalibrationConfig baseRackConfig; private HidePileLayoutConfig pileLayoutConfig; private TrollSurfaceMapper trollSurfaceMapper; private ConfigEntry<float> assemblyOffsetY; private ConfigEntry<bool> showPileElements; private ConfigEntry<int> previewPileCount; private ConfigEntry<int> pileLooksFullAt; private ConfigEntry<bool> showCalibrationOverlay; private ConfigEntry<string> previewHide; private ConfigEntry<int> rackSlots; private float nextAppearanceConfigSync; private string observedAppearanceSignature = string.Empty; private GameObject sourcePrefab; private HideRackCalibrationTarget currentTarget; private GUIStyle overlayStyle; private Harmony harmony; private HidesAppearanceEditorWindow appearanceEditorWindow; private HideRackAppearance appearanceEditorTarget; private HidesEditorState editorWorkingState; private bool editorWorkingStateLoaded; private bool appearanceEditorOpen; private bool editorPreviousCursorVisible; private CursorLockMode editorPreviousCursorLock; internal static DynamicStorageAnimalProductsPlugin Current { get; private set; } internal SourceVisualLibrary SourceLibrary { get; private set; } internal int RackStorageCapacity => NormalizeStorageCapacity((rackSlots != null) ? rackSlots.Value : 20); internal bool CanEditServerCapacity { get { if (!((Object)(object)ZNet.instance == (Object)null)) { return ZNet.instance.IsServer(); } return true; } } internal bool LiveCalibrationEnabled => false; internal bool TrySetServerCapacity(int slots) { if (!CanEditServerCapacity || rackSlots == null || (slots != 10 && slots != 20 && slots != 40 && slots != 60)) { return false; } rackSlots.Value = slots; return true; } internal static int NormalizeStorageCapacity(int value) { if (value == 10 || value == 20 || value == 40 || value == 60) { return value; } if (value <= 60) { return 20; } return 60; } internal static void GetSafeStorageGrid(int capacity, out int width, out int height) { switch (capacity) { case 10: width = 5; height = 2; break; case 20: width = 5; height = 4; break; case 40: width = 8; height = 5; break; case 60: width = 6; height = 10; break; case 80: width = 8; height = 10; break; default: width = 8; height = 10; break; } } private void Awake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown Current = this; BindConfig(); if (!GUIManager.IsHeadless()) { GUIManager.OnCustomGUIAvailable += OnAppearanceEditorGuiAvailable; } harmony = new Harmony("com.muji.DynamicStorageAnimalProducts"); HideRackInventoryPatches.Install(harmony); HideRackCapacityPatches.Install(harmony); InstallPlacementHooks(); InstallAppearanceHoverText(); PrefabManager.OnPrefabsRegistered += OnPrefabsRegistered; ((BaseUnityPlugin)this).Logger.LogInfo((object)"DynamicStorage Animal Products - Hide Rack Mapping 1.0.0 loaded; waiting for vanilla prefabs."); } private void OnDestroy() { if (!GUIManager.IsHeadless()) { GUIManager.OnCustomGUIAvailable -= OnAppearanceEditorGuiAvailable; } if (appearanceEditorOpen) { SetAppearanceEditorOpen(open: false); } trollSurfaceMapper?.DisposeMaterials(); PrefabManager.OnPrefabsRegistered -= OnPrefabsRegistered; if (harmony != null) { try { harmony.UnpatchSelf(); } catch { } } if ((Object)(object)Current == (Object)(object)this) { Current = null; } } private void Update() { if (GUIManager.IsHeadless() || appearanceEditorWindow == null) { return; } if (Input.GetKeyDown((KeyCode)289)) { appearanceEditorTarget = null; if (appearanceEditorOpen) { SetAppearanceEditorOpen(open: false); } else { SetAppearanceEditorOpen(open: true); } return; } if (!appearanceEditorOpen && Input.GetKeyDown((KeyCode)112) && Object.op_Implicit((Object)(object)Player.m_localPlayer) && Time.timeScale > 0f && !InventoryGui.IsVisible() && !Menu.IsVisible() && !TextInput.IsVisible() && !Console.IsVisible()) { HideRackCalibrationTarget hideRackCalibrationTarget = FindCalibrationTargetFromCamera(); HideRackAppearance hideRackAppearance = (Object.op_Implicit((Object)(object)hideRackCalibrationTarget) ? ((Component)hideRackCalibrationTarget).GetComponent<HideRackAppearance>() : null); if (Object.op_Implicit((Object)(object)hideRackAppearance) && !hideRackAppearance.IsPlacementPreview()) { HideRackStorage component = ((Component)hideRackCalibrationTarget).GetComponent<HideRackStorage>(); if (Object.op_Implicit((Object)(object)component)) { component.NotifyInteraction(); } appearanceEditorTarget = hideRackAppearance; SetAppearanceEditorOpen(open: true); return; } } if (appearanceEditorOpen && Input.GetKeyDown((KeyCode)27)) { SetAppearanceEditorOpen(open: false); } else if (appearanceEditorOpen) { if ((Object)(object)appearanceEditorTarget == (Object)null && appearanceEditorWindow.HasSelectedRack) { appearanceEditorWindow.SetSelectedRack(selected: false); } appearanceEditorWindow.Tick(); } } private void OnAppearanceEditorGuiAvailable() { if (appearanceEditorOpen) { SetAppearanceEditorOpen(open: false); } appearanceEditorWindow = new HidesAppearanceEditorWindow(SetAppearanceEditorOpen, ((BaseUnityPlugin)this).Logger, ReadHidesEditorState, WriteHidesEditorState); appearanceEditorWindow.Build(GUIManager.CustomGUIFront.transform); appearanceEditorWindow.SetVisible(visible: false); } private void SetAppearanceEditorOpen(bool open) { //IL_008b: 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) if (appearanceEditorWindow != null && open != appearanceEditorOpen) { appearanceEditorOpen = open; if (open) { editorWorkingState = CaptureRackEditorState(); editorWorkingStateLoaded = Object.op_Implicit((Object)(object)appearanceEditorTarget); appearanceEditorWindow.SetSelectedRack(Object.op_Implicit((Object)(object)appearanceEditorTarget)); appearanceEditorWindow.LoadCurrentState(); editorPreviousCursorVisible = Cursor.visible; editorPreviousCursorLock = Cursor.lockState; GUIManager.BlockInput(true); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { GUIManager.BlockInput(false); Cursor.lockState = editorPreviousCursorLock; Cursor.visible = editorPreviousCursorVisible; appearanceEditorTarget = null; editorWorkingStateLoaded = false; } appearanceEditorWindow.SetVisible(open); if (open && Object.op_Implicit((Object)(object)appearanceEditorTarget)) { appearanceEditorTarget.FlashSelectionTwice(); } } } private HidesEditorState ReadHidesEditorState() { if (!editorWorkingStateLoaded) { return CaptureRackEditorState(); } return editorWorkingState; } private HidesEditorState CaptureRackEditorState() { return ((Object.op_Implicit((Object)(object)appearanceEditorTarget) ? appearanceEditorTarget.GetEffectiveSnapshot() : null) ?? CaptureAppearanceTemplate()).ToEditorState(); } private void WriteHidesEditorState(HidesEditorState state) { if (Object.op_Implicit((Object)(object)appearanceEditorTarget)) { if (appearanceEditorTarget.RequestEditorState(state)) { editorWorkingState = state; editorWorkingStateLoaded = true; return; } editorWorkingState = CaptureRackEditorState(); editorWorkingStateLoaded = true; appearanceEditorWindow.LoadCurrentState(); HideRackStorage component = ((Component)appearanceEditorTarget).GetComponent<HideRackStorage>(); appearanceEditorWindow.Notify((state.StorageBehaviour == "Dedicated stack" && Object.op_Implicit((Object)(object)component) && component.HasMultipleSupportedTypes()) ? "Empty the extra hide types before switching to Dedicated stack." : "Could not save this rack's appearance; check the game log."); } } private void InstallAppearanceHoverText() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown try { harmony.Patch((MethodBase)AccessTools.Method(typeof(Container), "GetHoverText", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(DynamicStorageAnimalProductsPlugin), "AddAppearanceEditorHoverText", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not add Hide Rack appearance tooltip: " + ex.Message)); } } private static void AddAppearanceEditorHoverText(Container __instance, ref string __result) { if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<HideRackAppearance>())) { __result = (__result ?? string.Empty) + "\n<color=white>[</color><color=yellow>P</color><color=white>]</color> Open Appearance Editor"; HideRackCapacity component = ((Component)__instance).GetComponent<HideRackCapacity>(); if (Object.op_Implicit((Object)(object)component)) { __result += component.SafetyWarning; } } } private void BindConfig() { //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Expected O, but got Unknown //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Expected O, but got Unknown rackSlots = ConfigFileExtensions.BindConfig<int>(((BaseUnityPlugin)this).Config, "Server Settings", "Hide Rack Slots", 20, "Server-controlled Hide Rack capacity. Reductions preserve stored stacks and wait until every stack can be moved into visible slots safely.", true, (int?)100, (AcceptableValueBase)(object)new AcceptableValueList<int>(new int[4] { 10, 20, 40, 60 }), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); rackSlots.SettingChanged += delegate { HideRackCapacity.RefreshAll(); HideRackAppearance.RefreshAllVisuals(); }; trollSurfaceMapper = new TrollSurfaceMapper(((BaseUnityPlugin)this).Config, NotifyAppearanceTemplateChanged); LegacyConfigReader legacyConfigReader = new LegacyConfigReader(Path.Combine(Paths.ConfigPath, "com.muji.DynamicStorageAnimalProducts.cfg")); Action changed = delegate { NotifyAppearanceTemplateChanged(); }; string oldValue = legacyConfigReader.ReadStringValue("DEBUG 00 - Tools", "02 Preview Hide", "Auto (Contents)"); previewHide = ((BaseUnityPlugin)this).Config.Bind<string>("MAPPING - Tools", "Preview Hide", FriendlyPreviewName(oldValue), new ConfigDescription("Choose which hide to display while mapping. Auto uses the rack's actual stored hide.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[11] { "Auto (Rack Contents)", "Leather Scraps", "Deer Hide", "Troll Hide", "Wolf Pelt", "Lox Pelt", "Scale Hide", "Asksvin Hide", "Bear Hide", "Seal Pelt", "Moose Hide" }), Array.Empty<object>())); previewHide.SettingChanged += delegate { NotifyAppearanceTemplateChanged(); }; showPileElements = ((BaseUnityPlugin)this).Config.Bind<bool>("MAPPING - Tools", "Show Dynamic Hide Pile", true, "Show or hide the new dropped-model hide pile while mapping. This does not change stored items."); showPileElements.SettingChanged += delegate { NotifyAppearanceTemplateChanged(); }; previewPileCount = ((BaseUnityPlugin)this).Config.Bind<int>("MAPPING - Tools", "Preview Pile Count", 10, new ConfigDescription("When Preview Hide is forced, show exactly this many of the 10 pyramid slots so every fill stage can be mapped without adding items.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); previewPileCount.SettingChanged += delegate { NotifyAppearanceTemplateChanged(); }; pileLooksFullAt = ((BaseUnityPlugin)this).Config.Bind<int>("PILE - Behaviour", "Looks Full At", 40, new ConfigDescription("Legacy absolute hide-count threshold for racks with a custom non-percentage pile setting. Appearance Editor percentages use occupied stack fractions and the server slot capacity instead.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 1000), Array.Empty<object>())); pileLooksFullAt.SettingChanged += delegate { HideRackStorage.RefreshAll(); NotifyAppearanceTemplateChanged(); }; showCalibrationOverlay = ((BaseUnityPlugin)this).Config.Bind<bool>("MAPPING - Tools", "Show Mapping Overlay", legacyConfigReader.ReadBoolValue("DEBUG 00 - Tools", "03 Show On-Screen Mapping Overlay", fallback: true), "Show the small on-screen mapping summary while aiming at a Hide Rack."); RackTransformValues defaults = legacyConfigReader.ReadCurrentRack("DEBUG 01 - Shared Rack", CreateBaseRackDefaults()); baseRackConfig = new RackCalibrationConfig(((BaseUnityPlugin)this).Config, "MAPPING - Shared Rack", defaults, changed, "Rack"); float num = legacyConfigReader.ReadFloatValue("DEBUG 01 - Shared Rack", "00 Entire Assembly Height Offset Y", 0.13f); assemblyOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("MAPPING - Shared Rack", "Whole Hide Rack Position Up / Down", num, new ConfigDescription("Moves the complete visible rack, hide and pile together up or down without moving Valheim's placement root.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-5f, 5f), Array.Empty<object>())); assemblyOffsetY.SettingChanged += delegate { NotifyAppearanceTemplateChanged(); }; for (int num2 = 0; num2 < HideCatalog.Definitions.Length; num2++) { HideDefinition hideDefinition = HideCatalog.Definitions[num2]; string oldSection = "DEBUG HIDE " + (num2 + 1).ToString("00") + " - " + hideDefinition.DisplayName; string section = "HIDE MAPPING - " + hideDefinition.DisplayName; HideVisualProfileValues fallback = legacyConfigReader.ReadCurrentHideProfile(oldSection, CreateDefaultHideProfile(hideDefinition.ItemPrefabName)); HideVisualProfileValues defaults2 = legacyConfigReader.ReadClearMenuHideProfile(section, fallback); hideProfileConfigs[hideDefinition.ItemPrefabName] = new HideVisualProfileConfig(((BaseUnityPlugin)this).Config, section, defaults2, changed); if (!string.Equals(hideDefinition.ItemPrefabName, "LeatherScraps", StringComparison.Ordinal)) { pileItemConfigs[hideDefinition.ItemPrefabName] = new HidePileItemConfig(((BaseUnityPlugin)this).Config, "PILE MAPPING - " + hideDefinition.DisplayName, hideDefinition.ItemPrefabName, CreateDefaultPileItemProfile(hideDefinition.ItemPrefabName), changed); } } int num3 = ((legacyConfigReader.ReadStringValue("PILE MAPPING - Troll Hide", "Pile Model Position Forward / Back", null) == null) ? 1 : 0); ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>("DSAP INTERNAL", "Troll Bear Proxy Migration Revision", num3, new ConfigDescription("Internal one-time migration marker for the Troll pile Bear-geometry proxy.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = false } })); if (val.Value < 1 && pileItemConfigs.TryGetValue("BjornHide", out var value) && pileItemConfigs.TryGetValue("TrollHide", out var value2)) { value2.ApplyValues(value.Capture()); val.Value = 1; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Seeded Troll Hide pile mapping from the current Bear Hide pile mapping for the Troll Bear-geometry proxy conversion."); } pileLayoutConfig = new HidePileLayoutConfig(((BaseUnityPlugin)this).Config, CreateDefaultPileLayout(), changed); } private static string FriendlyPreviewName(string oldValue) { if (string.IsNullOrEmpty(oldValue) || string.Equals(oldValue, "Auto (Contents)", StringComparison.Ordinal) || string.Equals(oldValue, "Auto (Rack Contents)", StringComparison.Ordinal)) { return "Auto (Rack Contents)"; } HideDefinition[] definitions = HideCatalog.Definitions; foreach (HideDefinition hideDefinition in definitions) { if (string.Equals(oldValue, hideDefinition.ItemPrefabName, StringComparison.Ordinal) || string.Equals(oldValue, hideDefinition.DisplayName, StringComparison.Ordinal)) { return hideDefinition.DisplayName; } } return "Auto (Rack Contents)"; } private static RackTransformValues CreateBaseRackDefaults() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) return new RackTransformValues(1f, 1f, 1f, 1f, Vector3.zero, new Vector3(0f, -0.17f, -0.17f)); } private static HideVisualProfileValues CreateDefaultHideProfile(string itemPrefabName) { string text = HideCatalog.NormalizePrefabName(itemPrefabName); return text switch { "DeerHide" => MappedHideProfile(1.7f, 1f, 1f, 1f, 0.74f, 1.23f, 1f, 1.13f, 80f, 0f, 0f, 0f, 0.3f, 1.29f, 0.23f), "TrollHide" => MappedHideProfile(2.3f, 1f, 1f, 1f, 2f, 1f, 0.01f, 0.84f, 80f, 0f, 0f, -15f, 0.46f, 2.21f, 0.32f), "WolfPelt" => MappedHideProfile(1.25f, 0.94f, 1.26f, 1f, 0.61f, 1f, 0.01f, 0.95f, 83f, 0f, 0f, -2f, 0.13f, 1.53f, 0.16f), "LoxPelt" => MappedHideProfile(2.05f, 1f, 1f, 1f, 0.87f, 1f, 1f, 0.84f, 81f, 0f, 0f, 0f, 0.3f, 1.96f, 0.22f), "ScaleHide" => MappedHideProfile(1.2f, 0.81f, 1.1f, 1f, 1.15f, 1f, 0.01f, 1f, 81f, 0f, 0f, 3f, 0.12f, 1.29f, 0.17f), "AskHide" => MappedHideProfile(1.2f, 1f, 1f, 1f, 0.64f, 1f, 1f, 1f, 80f, 0f, 0f, 0f, 0.21f, 1.12f, 0.14f), "BjornHide" => MappedHideProfile(2.14f, 0.77f, 1f, 1f, 0.67f, 1f, 1f, 1f, 80f, 0f, 0f, 0f, 0.21f, 1.96f, 0.29f), "SealHide" => MappedHideProfile(1.55f, 1f, 1.13f, 1f, 1.1f, 1f, 0.01f, 1f, 82f, 0f, 0f, 0f, 0.21f, 1.62f, 0.2f), "MooseHide" => MappedHideProfile(2.45f, 0.77f, 1f, 1f, 0.8f, 1f, 0.01f, 1f, 81f, 0f, 0f, 180f, 0.21f, 2.37f, 0.32f), _ => MappedHideProfile(GetEstimatedRearRackOverallScale(text), 1f, 1f, 1f, 1f, 1f, 1f, 1f, 80f, 0f, 0f, 0f, 0.13f, 0.79f, 0.15f), }; } private static HideVisualProfileValues MappedHideProfile(float rackOverall, float rackWidth, float rackHeight, float rackDepth, float hideOverall, float hideWidth, float hideThickness, float hideLength, float hideTilt, float hideTurn, float hideLean, float hideTwist, float hideX, float hideY, float hideZ) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) return new HideVisualProfileValues(new RackTransformValues(rackOverall, rackWidth, rackHeight, rackDepth, Vector3.zero, new Vector3(0f, -0.17f, -0.17f)), new RugOverlayTransformValues(new Vector3(hideX, hideY, hideZ), new Vector3(hideTilt, hideTurn, hideLean), hideTwist, hideOverall, new Vector3(hideWidth, hideThickness, hideLength))); } private static HidePileLayoutValues CreateDefaultPileLayout() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) return new HidePileLayoutValues(new Vector3(0f, -0.55f, 0.95f), 0.62f, 0.34f, 0f); } private static HidePileItemTransformValues CreateDefaultPileItemProfile(string itemPrefabName) { return HideCatalog.NormalizePrefabName(itemPrefabName) switch { "DeerHide" => PileProfile(0f, 0.42f, 0.17f, 0f, 0f, -6f, 0f, 90f, 0f, 1f, 1f, 1f, 1f, 0.5f, 1f, 0.75f, 1f, 20f, 10f, 4f, 180f, 55f), "WolfPelt" => PileProfile(0.25f, 0.42f, 0.03f, 0f, 0f, 0f, 0f, 90f, 0f, 1f, 1f, 1f, 1f, 0.46f, 0.83f, 1f, 1f, 21.58f, 7f, 7.38f, 61f, 50f), "LoxPelt" => PileProfile(0.42f, 0.42f, -0.08f, 0f, 0f, 0f, 0f, -90f, 0f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 17f, 4f, 4f, 4f, 30f), "ScaleHide" => PileProfile(0.1f, 0.42f, -0.17f, 0f, 0f, 0f, 0f, 0f, 0f, 1f, 1f, 1f, 1f, 0.67f, 1f, 1f, 1f, 29.72f, 4f, 4f, 25f, 35f), "AskHide" => PileProfile(0f, 0.47f, 0.17f, 0f, 0f, 0f, 0f, 0f, 0f, 1f, 1f, 1f, 1f, 1f, 1f, 0.66f, 1f, 17.5f, 0f, 22f, 20f, 35f), "BjornHide" => PileProfile(0f, 0.42f, 0.44f, 0f, 0f, 0f, 0f, 0f, 0f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 12f, 4f, 4f, 4f, 35f), "SealHide" => PileProfile(0.17f, 0.42f, 0.08f, 0f, 0f, 0f, 0f, 0f, 0f, 1.42f, 1f, 1f, 1f, 0.74f, 1f, 0.89f, 1f, 27f, 4f, 4f, 46f, 40.83f), "MooseHide" => PileProfile(0f, 0.42f, 0.75f, 0f, 0f, 0f, 0f, 0f, 0f, 1.2f, 1f, 1f, 1f, 1.2f, 1f, 1f, 1f, 12f, 8.5f, 4f, 49f, 35f), "TrollHide" => PileProfile(0f, 0.42f, 0.53f, 0f, 0f, 0f, 0f, 0f, 0f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 12f, 4f, 4f, 4f, 35f), _ => PileProfile(0f, 0.42f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 12f, 4f, 4f, 4f, 35f), }; } private static HidePileItemTransformValues PileProfile(float positionX, float positionY, float positionZ, float modelTilt, float modelTurn, float modelLean, float groupTilt, float groupTurn, float groupLean, float overallScale, float scaleX, float scaleY, float scaleZ, float slotSpacingScale, float widthSpacingScale, float heightSpacingScale, float thicknessDomeScale, float sizeVariancePercent, float turnVariance, float leanVariance, float twistVariance, float reverseChancePercent) { //IL_0003: 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_0018: 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_003d: Unknown result type (might be due to invalid IL or missing references) return new HidePileItemTransformValues(new Vector3(positionX, positionY, positionZ), new Vector3(modelTilt, modelTurn, modelLean), new Vector3(groupTilt, groupTurn, groupLean), overallScale, new Vector3(scaleX, scaleY, scaleZ), slotSpacingScale, widthSpacingScale, heightSpacingScale, thicknessDomeScale, sizeVariancePercent, new Vector3(0f, turnVariance, leanVariance), twistVariance, reverseChancePercent); } private static float GetEstimatedRearRackOverallScale(string itemPrefabName) { return HideCatalog.NormalizePrefabName(itemPrefabName) switch { "LeatherScraps" => 0.9f, "DeerHide" => 1.7f, "TrollHide" => 1.85f, "WolfPelt" => 1.7f, "LoxPelt" => 2.05f, "ScaleHide" => 1.1f, "AskHide" => 1.1f, "BjornHide" => 2.85f, "SealHide" => 1.55f, "MooseHide" => 2.45f, _ => 1f, }; } private void InstallPlacementHooks() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(Player), "UpdatePlacementGhost", new Type[1] { typeof(bool) }, (Type[])null) ?? AccessTools.Method(typeof(Player), "UpdatePlacementGhost", Type.EmptyTypes, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(DynamicStorageAnimalProductsPlugin), "UpdatePlacementGhostPostfix", (Type[])null, (Type[])null); if (methodInfo != null && methodInfo2 != null) { try { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Hide Rack placement ghost hook failed: " + ex.Message)); } } MethodInfo[] array = (from method in typeof(Piece).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where method.Name == "SetCreator" && method.GetParameters().Length != 0 && method.GetParameters()[0].ParameterType == typeof(long) select method).ToArray(); MethodInfo methodInfo3 = AccessTools.Method(typeof(DynamicStorageAnimalProductsPlugin), "CaptureNewPiece", (Type[])null, (Type[])null); MethodInfo[] array2 = array; foreach (MethodInfo methodInfo4 in array2) { try { harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Hide Rack SetCreator appearance hook failed: " + ex2.Message)); } } } private static void UpdatePlacementGhostPostfix(Player __instance) { if (!Object.op_Implicit((Object)(object)__instance) || (Object)(object)__instance != (Object)(object)Player.m_localPlayer || PlacementGhostField == null) { return; } GameObject val; try { object? value = PlacementGhostField.GetValue(__instance); val = (GameObject)((value is GameObject) ? value : null); } catch { return; } if (Object.op_Implicit((Object)(object)val)) { HideRackAppearance component = val.GetComponent<HideRackAppearance>(); DynamicStorageAnimalProductsPlugin current = Current; if (Object.op_Implicit((Object)(object)component) && !((Object)(object)current == (Object)null)) { component.ApplyPlacementGhostTemplate(current.CaptureAppearanceTemplate()); } } } private static void CaptureNewPiece(Piece __instance) { try { if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { HideRackAppearance component = ((Component)__instance).GetComponent<HideRackAppearance>(); if (Object.op_Implicit((Object)(object)component)) { component.SavePlacementDefaults(); } HideRackCapacity component2 = ((Component)__instance).GetComponent<HideRackCapacity>(); if (Object.op_Implicit((Object)(object)component2)) { component2.InitializeNewPlacement(); } } } catch (Exception ex) { DynamicStorageAnimalProductsPlugin current = Current; if (current != null) { ((BaseUnityPlugin)current).Logger.LogError((object)("Hide Rack placement appearance initialization failed: " + ex)); } } } private void OnPrefabsRegistered() { PrefabManager.OnPrefabsRegistered -= OnPrefabsRegistered; try { sourcePrefab = PrefabManager.Instance.GetPrefab("piece_workbench_ext2"); if (!Object.op_Implicit((Object)(object)sourcePrefab)) { ((BaseUnityPlugin)this).Logger.LogError((object)"Vanilla Tanning Rack source 'piece_workbench_ext2' was not found."); return; } HideCatalog.Initialize(); CaptureRugTemplates(); CapturePileItemTemplates(); SourceLibrary = SourceVisualLibrary.Capture(sourcePrefab, 7); if (SourceLibrary == null || SourceLibrary.FullRack == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not capture the fixed Tanning Rack source renderers."); return; } RegisterHideRack(); WriteCalibrationReport(); observedAppearanceSignature = BuildAppearanceConfigSignature(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Registered one Hide Rack buildable with " + HideCatalog.AvailableCount + " confirmed hide/rug profiles.")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Hide Rack registration failed: " + ex)); } } private void CaptureRugTemplates() { rugTemplates.Clear(); HideDefinition[] definitions = HideCatalog.Definitions; foreach (HideDefinition hideDefinition in definitions) { if (hideDefinition.IsAvailable) { RugVisualTemplate rugVisualTemplate = RugVisualTemplate.Capture(hideDefinition.RugPrefab); if (rugVisualTemplate == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not capture rug visual '" + hideDefinition.RugPrefabName + "' for " + hideDefinition.DisplayName + ".")); } else { rugTemplates[hideDefinition.ItemPrefabName] = rugVisualTemplate; } } } } private void CapturePileItemTemplates() { trollSurfaceMapper.DisposeMaterials(); pileItemTemplates.Clear(); HideDefinition[] definitions = HideCatalog.Definitions; foreach (HideDefinition hideDefinition in definitions) { if (hideDefinition.IsAvailable && !string.Equals(hideDefinition.ItemPrefabName, "LeatherScraps", StringComparison.Ordinal)) { RugVisualTemplate rugVisualTemplate = RugVisualTemplate.Capture(hideDefinition.ItemPrefab); if (rugVisualTemplate == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not capture dropped ItemDrop visual for dynamic pile: " + hideDefinition.DisplayName + " ('" + hideDefinition.ItemPrefabName + "').")); } else { pileItemTemplates[hideDefinition.ItemPrefabName] = rugVisualTemplate; } } } if (pileItemTemplates.TryGetValue("BjornHide", out var value) && pileItemTemplates.TryGetValue("TrollHide", out var value2)) { RugVisualTemplate rugVisualTemplate2 = value.WithTrollShineTintProxyFrom(value2, trollSurfaceMapper); if (rugVisualTemplate2 != null) { pileItemTemplates["TrollHide"] = rugVisualTemplate2; trollSurfaceMapper.Apply(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Troll Hide dynamic pile uses Bear Hide drop geometry/albedo with Troll Hide-style material shine/tint."); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not build Troll Hide Bear-geometry shine/tint proxy; falling back to the vanilla TrollHide drop visual."); } } } private void RegisterHideRack() { //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab("piece_chest_barrel"); if (!Object.op_Implicit((Object)(object)prefab) || !Object.op_Implicit((Object)(object)prefab.GetComponent<Container>()) || !Object.op_Implicit((Object)(object)prefab.GetComponent<Piece>()) || !Object.op_Implicit((Object)(object)prefab.GetComponent<ZNetView>())) { ((BaseUnityPlugin)this).Logger.LogError((object)"Functional Hide Rack container source is unavailable or incomplete."); return; } GameObject val = PrefabManager.Instance.CreateClonedPrefab("DSAP_HideRack_Standard_POC", prefab); if (!Object.op_Implicit((Object)(object)val)) { ((BaseUnityPlugin)this).Logger.LogError((object)"CreateClonedPrefab failed for Hide Rack."); return; } Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2) && !(val2 is ParticleSystemRenderer)) { val2.enabled = false; } } Piece component = val.GetComponent<Piece>(); component.m_name = "Dynamic Hide Rack"; component.m_description = "Dynamic hide and pelt storage. The first supported hide inserted assigns the rack until it is emptied."; component.m_craftingStation = null; Piece component2 = sourcePrefab.GetComponent<Piece>(); if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.m_icon)) { component.m_icon = component2.m_icon; } Container component3 = val.GetComponent<Container>(); component3.m_name = "Dynamic Hide Rack"; component3.m_width = 8; component3.m_height = 10; ZNetView component4 = val.GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component4)) { component4.m_persistent = true; } WearNTear component5 = val.GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component5)) { component5.m_autoCreateFragments = false; } (val.GetComponent<HideRackCalibrationTarget>() ?? val.AddComponent<HideRackCalibrationTarget>()).Setup(); if (!Object.op_Implicit((Object)(object)val.GetComponent<HideRackStorage>())) { val.AddComponent<HideRackStorage>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<HideRackCapacity>())) { val.AddComponent<HideRackCapacity>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<HideRackRugVisual>())) { val.AddComponent<HideRackRugVisual>(); } PieceConfig val3 = new PieceConfig { PieceTable = PieceTables.Hammer, Category = "Dynamic Storage" }; val3.AddRequirement(new RequirementConfig("Wood", 1, 0, true)); if (!PieceManager.Instance.AddPiece(new CustomPiece(val, true, val3))) { ((BaseUnityPlugin)this).Logger.LogError((object)"Jotunn PieceManager rejected Hide Rack."); } } internal RackTransformValues GetBaseRackTransform() { return baseRackConfig.Capture(); } internal HidePileLayoutValues GetPileLayout() { if (pileLayoutConfig == null) { return CreateDefaultPileLayout(); } return pileLayoutConfig.Capture(); } internal HidePileItemTransformValues GetPileItemProfile(string itemPrefabName) { itemPrefabName = HideCatalog.NormalizePrefabName(itemPrefabName); if (pileItemConfigs.TryGetValue(itemPrefabName, out var value)) { return value.Capture(); } return CreateDefaultPileItemProfile(itemPrefabName); } internal float GetAssemblyOffsetY() { if (assemblyOffsetY == null) { return 0.13f; } return assemblyOffsetY.Value; } internal HideVisualProfileValues GetHideVisualProfile(string itemPrefabName) { itemPrefabName = HideCatalog.NormalizePrefabName(itemPrefabName); if (hideProfileConfigs.TryGetValue(itemPrefabName, out var value)) { return value.Capture(); } return CreateDefaultHideProfile(itemPrefabName); } internal HideRackAppearanceSnapshot CaptureAppearanceTemplate() { List<HideVisualProfileSnapshot> list = new List<HideVisualProfileSnapshot>(); List<HidePileItemSnapshot> list2 = new List<HidePileItemSnapshot>(); HideDefinition[] definitions = HideCatalog.Definitions; foreach (HideDefinition hideDefinition in definitions) { list.Add(HideVisualProfileSnapshot.From(hideDefinition.ItemPrefabName, GetHideVisualProfile(hideDefinition.ItemPrefabName))); if (!string.Equals(hideDefinition.ItemPrefabName, "LeatherScraps", StringComparison.Ordinal)) { list2.Add(HidePileItemSnapshot.From(hideDefinition.ItemPrefabName, GetPileItemProfile(hideDefinition.ItemPrefabName))); } } return new HideRackAppearanceSnapshot { version = 2, emptyRack = RackTransformSnapshot.From(GetBaseRackTransform()), assemblyOffsetY = GetAssemblyOffsetY(), pileLooksFullAt = GetDefaultPileLooksFullAt(), pileAlwaysFull = false, pileFullnessPercent = 100, editorDefaultAssemblyHeight = GetAssemblyOffsetY(), editorDefaultPileFullAt = GetDefaultPileLooksFullAt(), editorDefaultsCaptured = true, displayStyle = ((showPileElements == null || showPileElements.Value) ? "Full display" : "Stand only"), storageBehaviour = "Dedicated stack", emptyBehaviour = "Empty rack", visualScale = 1f, standScale = 1f, pileScale = 1f, rackFootprint = "Per-hide size", pileFootprint = "Per-hide size", pileDisplayMode = ((showPileElements == null || showPileElements.Value) ? "Visible" : "Hidden"), pileLayout = HidePileLayoutSnapshot.From(GetPileLayout()), pileProfiles = list2.ToArray(), hideProfiles = list.ToArray() }; } internal RugVisualTemplate GetRugTemplate(string itemPrefabName) { if (!rugTemplates.TryGetValue(HideCatalog.NormalizePrefabName(itemPrefabName), out var value)) { return null; } return value; } internal RugVisualTemplate GetPileItemTemplate(string itemPrefabName) { if (!pileItemTemplates.TryGetValue(HideCatalog.NormalizePrefabName(itemPrefabName), out var value)) { return null; } return value; } internal int GetVisualPileModelCount(GameObject rackObject) { if (!string.IsNullOrEmpty(GetPreviewHidePrefab())) { return Mathf.Clamp((previewPileCount != null) ? previewPileCount.Value : 10, 0, 10); } if (!Object.op_Implicit((Object)(object)rackObject)) { return 0; } HideRackStorage component = rackObject.GetComponent<HideRackStorage>(); int num = (((Object)(object)component != (Object)null) ? component.GetStoredSupportedItemCount() : 0); float num2 = (((Object)(object)component != (Object)null) ? component.GetStoredSupportedSlotUnits() : 0f); HideRackAppearance component2 = rackObject.GetComponent<HideRackAppearance>(); HideRackAppearanceSnapshot hideRackAppearanceSnapshot = (Object.op_Implicit((Object)(object)component2) ? component2.GetEffectiveSnapshot() : null); if (num <= 0) { if (hideRackAppearanceSnapshot == null || hideRackAppearanceSnapshot.GetEmptyBehaviour() != "Remember hide" || GetPileItemTemplate(GetVisualHidePrefab(rackObject)) == null) { return 0; } num = Mathf.Max(1, hideRackAppearanceSnapshot.lastStoredCount); num2 = ((hideRackAppearanceSnapshot.lastStoredSlotUnits > 0f) ? hideRackAppearanceSnapshot.lastStoredSlotUnits : ((float)num / (float)GetHideMaxStackSize(GetVisualHidePrefab(rackObject)))); } if (hideRackAppearanceSnapshot != null && hideRackAppearanceSnapshot.pileAlwaysFull) { return 10; } int num3 = hideRackAppearanceSnapshot?.GetFullnessPercent() ?? 100; if (num3 > 0) { double fullAt = (double)(RackStorageCapacity * num3) / 100.0; return PileFullnessMath.VisibleModels(num2, fullAt); } int num4 = ((hideRackAppearanceSnapshot != null && hideRackAppearanceSnapshot.pileLooksFullAt > 0) ? hideRackAppearanceSnapshot.pileLooksFullAt : GetDefaultPileLooksFullAt()); return PileFullnessMath.VisibleModels(num, num4); } private static int GetHideMaxStackSize(string prefabName) { GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(prefabName) : null); ItemDrop val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<ItemDrop>() : null); if (!((Object)(object)val2 != (Object)null) || val2.m_itemData == null || val2.m_itemData.m_shared == null) { return 50; } return Mathf.Max(1, val2.m_itemData.m_shared.m_maxStackSize); } internal int GetDefaultPileLooksFullAt() { if (pileLooksFullAt == null) { return 40; } return Mathf.Max(1, pileLooksFullAt.Value); } internal string GetVisualHidePrefab(GameObject rackObject) { string previewHidePrefab = GetPreviewHidePrefab(); if (!string.IsNullOrEmpty(previewHidePrefab)) { return previewHidePrefab; } if (Object.op_Implicit((Object)(object)rackObject)) { HideRackStorage component = rackObject.GetComponent<HideRackStorage>(); HideRackAppearance component2 = rackObject.GetComponent<HideRackAppearance>(); HideRackAppearanceSnapshot hideRackAppearanceSnapshot = (Object.op_Implicit((Object)(object)component2) ? component2.GetEffectiveSnapshot() : null); if (Object.op_Implicit((Object)(object)component) && !component.IsConfirmedEmpty && !string.IsNullOrEmpty(component.AssignedPrefabName)) { return component.AssignedPrefabName; } if (Object.op_Implicit((Object)(object)component) && component.GetStoredSupportedItemCount() > 0) { return component.AssignedPrefabName; } if (hideRackAppearanceSnapshot != null && hideRackAppearanceSnapshot.GetEmptyBehaviour() == "Remember hide") { string text = HideCatalog.NormalizePrefabName(hideRackAppearanceSnapshot.lastDisplayedHide); if (HideCatalog.IsSupported(text)) { return text; } if (Object.op_Implicit((Object)(object)component) && !string.IsNullOrEmpty(component.AssignedPrefabName)) { return component.AssignedPrefabName; } return "DeerHide"; } } return null; } internal string GetPreviewHidePrefab() { if (previewHide == null) { return null; } string value = previewHide.Value; if (string.IsNullOrEmpty(value) || string.Equals(value, "Auto (Rack Contents)", StringComparison.Ordinal) || string.Equals(value, "Auto (Contents)", StringComparison.Ordinal)) { return null; } HideDefinition[] definitions = HideCatalog.Definitions; foreach (HideDefinition hideDefinition in definitions) { if (string.Equals(value, hideDefinition.DisplayName, StringComparison.Ordinal) || string.Equals(value, hideDefinition.ItemPrefabName, StringComparison.Ordinal)) { if (!HideCatalog.IsSupported(hideDefinition.ItemPrefabName)) { return null; } return hideDefinition.ItemPrefabName; } } return null; } internal void LogCalibrationWarning(string message) { ((BaseUnityPlugin)this).Logger.LogWarning((object)message); } private void NotifyAppearanceTemplateChanged() { trollSurfaceMapper?.Apply(); observedAppearanceSignature = BuildAppearanceConfigSignature(); HideRackAppearance.RefreshAllVisuals(); } private string BuildAppearanceConfigSignature() { try { string text = CaptureAppearanceTemplate().Serialize(); string text2 = ((previewHide != null) ? previewHide.Value : string.Empty); return (LiveCalibrationEnabled ? "1" : "0") + "|" + ((showPileElements == null || showPileElements.Value) ? "pile:on" : "pile:off") + "|previewPile=" + ((previewPileCount != null) ? previewPileCount.Value.ToString(CultureInfo.InvariantCulture) : "10") + "|fullAt=" + ((pileLooksFullAt != null) ? pileLooksFullAt.Value.ToString(CultureInfo.InvariantCulture) : "40") + "|" + text2 + "|" + text + "|trollSurface=" + (trollSurfaceMapper?.Signature ?? string.Empty); } catch { return string.Empty; } } private void SynchronizeAppearanceConfig() { string a = BuildAppearanceConfigSignature(); if (!string.Equals(a, observedAppearanceSignature, StringComparison.Ordinal)) { observedAppearanceSignature = a; trollSurfaceMapper?.Apply(); HideRackAppearance.RefreshAllVisuals(); } } private void LateUpdate() { if (Time.unscaledTime >= nextAppearanceConfigSync) { nextAppearanceConfigSync = Time.unscaledTime + 0.1f; SynchronizeAppearanceConfig(); } UpdateTarget(); if (Input.GetKeyDown((KeyCode)114) && Object.op_Implicit((Object)(object)currentTarget)) { HideRackAppearance component = ((Component)currentTarget).GetComponent<HideRackAppearance>(); bool flag = Object.op_Implicit((Object)(object)component) && component.ApplyCurrentTemplateToPlacedPiece(); if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { ((Character)Player.m_localPlayer).Message((MessageType)2, flag ? "Saved current Hide Rack visual mapping to this rack." : "Could not save Hide Rack appearance: this client is not the ZDO owner.", 0, (Sprite)null, false); } } if (Input.GetKeyDown((KeyCode)287)) { string text = WriteCalibrationReport(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Wrote Hide Rack mapping report: " + text)); } } private void UpdateTarget() { HideRackCalibrationTarget hideRackCalibrationTarget = FindCalibrationTargetFromCamera(); if (Object.op_Implicit((Object)(object)hideRackCalibrationTarget) || Time.timeScale != 0f) { currentTarget = hideRackCalibrationTarget; } } private HideRackCalibrationTarget FindCalibrationTargetFromCamera() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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) Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main)) { return null; } RaycastHit val = default(RaycastHit); if (!Physics.Raycast(new Ray(((Component)main).transform.position, ((Component)main).transform.forward), ref val, 7f, -1, (QueryTriggerInteraction)1)) { return null; } if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider)) { return null; } return ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<HideRackCalibrationTarget>(); } private void OnGUI() { //IL_0036: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0058: 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_0069: Expected O, but got Unknown //IL_006e: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) if (showCalibrationOverlay != null && showCalibrationOverlay.Value && Object.op_Implicit((Object)(object)currentTarget)) { if (overlayStyle == null) { overlayStyle = new GUIStyle(GUI.skin.box) { alignment = (TextAnchor)0, richText = true, wordWrap = false, fontSize = 13, padding = new RectOffset(10, 10, 8, 8) }; } HideRackAppearance component = ((Component)currentTarget).GetComponent<HideRackAppearance>(); HideRackAppearanceSnapshot hideRackAppearanceSnapshot = (Object.op_Implicit((Object)(object)component) ? component.GetEffectiveSnapshot() : null); string visualHidePrefab = GetVisualHidePrefab(((Component)currentTarget).gameObject); HideVisualProfileValues hideVisualProfile = GetHideVisualProfile(visualHidePrefab); RackTransformValues rackTransformValues = hideRackAppearanceSnapshot?.GetRearRack(visualHidePrefab, GetBaseRackTransform(), hideVisualProfile) ?? (string.IsNullOrEmpty(visualHidePrefab) ? GetBaseRackTransform() : hideVisualProfile.RearRack); StringBuilder stringBuilder = new StringBuilder(1800); stringBuilder.Append("<color=#ffcc66>[Hide Rack Mapping]</color>\n"); HideRackStorage component2 = ((Component)currentTarget).GetComponent<HideRackStorage>(); stringBuilder.Append("Assigned: ").Append(((Object)(object)component2 != (Object)null && !string.IsNullOrEmpty(component2.AssignedPrefabName)) ? HideCatalog.DisplayName(component2.AssignedPrefabName) : "<empty>").Append(" | Visual: ") .Append(string.IsNullOrEmpty(visualHidePrefab) ? "<base rack>" : HideCatalog.DisplayName(visualHidePrefab)) .Append("\n"); stringBuilder.Append("Assembly Y: ").Append(F(hideRackAppearanceSnapshot?.assemblyOffsetY ?? GetAssemblyOffsetY())).Append("\n"); stringBuilder.Append("Rear rack scale XYZ: ").Append(Format(rackTransformValues.EffectiveScale)).Append(" | offset ") .Append(Format(rackTransformValues.Offset)) .Append("\n"); stringBuilder.Append("<color=#aaaaaa>F6 exports mapping values | R saves current mapping to the aimed rack</color>"); GUI.Box(new Rect(18f, 18f, 1120f, 180f), stringBuilder.ToString(), overlayStyle); } } internal string WriteCalibrationReport() { string text = Path.Combine(Paths.ConfigPath, "DynamicStorageAnimalProducts_HideRackMapping.txt"); File.WriteAllText(text, BuildCalibrationReport()); return text; } private string BuildCalibrationReport() { //IL_0101: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(14000); stringBuilder.AppendLine("DynamicStorage Animal Products - Hide Rack Mapping"); stringBuilder.AppendLine("Plugin version: 1.0.0"); stringBuilder.AppendLine("Internal prefab compatibility ID: DSAP_HideRack_Standard_POC"); stringBuilder.AppendLine(); stringBuilder.AppendLine("=== SHARED RACK ==="); stringBuilder.AppendLine("AssemblyOffsetY=" + F(GetAssemblyOffsetY())); AppendRack(stringBuilder, "EmptyRack", GetBaseRackTransform()); HideDefinition[] definitions = HideCatalog.Definitions; foreach (HideDefinition hideDefinition in definitions) { HideVisualProfileValues hideVisualProfile = GetHideVisualProfile(hideDefinition.ItemPrefabName); stringBuilder.AppendLine(); stringBuilder.AppendLine("=== " + hideDefinition.DisplayName + " [" + hideDefinition.ItemPrefabName + " -> " + hideDefinition.RugPrefabName + "] ==="); AppendRack(stringBuilder, "RearRack", hideVisualProfile.RearRack); stringBuilder.AppendLine("Rug.PositionXYZ=" + Format(hideVisualProfile.Rug.Position)); stringBuilder.AppendLine("Rug.RotationXYZ=" + Format(hideVisualProfile.Rug.Rotation)); stringBuilder.AppendLine("Rug.OverallScale=" + F(hideVisualProfile.Rug.OverallScale)); stringBuilder.AppendLine("Rug.AxisScaleXYZ=" + Format(hideVisualProfile.Rug.AxisScale)); stringBuilder.AppendLine("Rug.EffectiveScaleXYZ=" + Format(hideVisualProfile.Rug.EffectiveScale)); } return stringBuilder.ToString(); } private static void AppendRack(StringBuilder sb, string prefix, RackTransformValues values) { //IL_007c: 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) sb.AppendLine(prefix + ".OverallScale=" + F(values.OverallScale)); sb.AppendLine(prefix + ".WidthScaleX=" + F(values.WidthScale)); sb.AppendLine(prefix + ".HeightScaleY=" + F(values.HeightScale)); sb.AppendLine(prefix + ".DepthScaleZ=" + F(values.DepthScale)); sb.AppendLine(prefix + ".RotationXYZ=" + Format(values.Rotation)); sb.AppendLine(prefix + ".OffsetXYZ=" + Format(values.Offset)); } private static string F(float value) { return value.ToString("0.####", CultureInfo.InvariantCulture); } private static string Format(Vector3 value) { //IL_0010: 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_003c: Unknown result type (might be due to invalid IL or missing references) return "(" + F(value.x) + ", " + F(value.y) + ", " + F(value.z) + ")"; } } internal sealed class HideDefinition { internal readonly string ItemPrefabName; internal readonly string DisplayName; internal readonly string RugPrefabName; internal GameObject ItemPrefab { get; private set; } internal GameObject RugPrefab { get; private set; } internal bool IsAvailable { get { if (Object.op_Implicit((Object)(object)ItemPrefab)) { return Object.op_Implicit((Object)(object)RugPrefab); } return false; } } internal HideDefinition(string itemPrefabName, string displayName, string rugPrefabName) { ItemPrefabName = itemPrefabName; DisplayName = displayName; RugPrefabName = rugPrefabName; } internal void Resolve() { ItemPrefab = FindPrefab(ItemPrefabName); RugPrefab = FindPrefab(RugPrefabName); } private static GameObject FindPrefab(string prefabName) { GameObject val = null; if (Object.op_Implicit((Object)(object)ZNetScene.instance)) { val = ZNetScene.instance.GetPrefab(prefabName); } if (!Object.op_Implicit((Object)(object)val)) { val = PrefabManager.Instance.GetPrefab(prefabName); } return val; } } internal static class HideCatalog { internal static readonly HideDefinition[] Definitions = new HideDefinition[10] { new HideDefinition("LeatherScraps", "Leather Scraps", "LeatherScraps"), new HideDefinition("DeerHide", "Deer Hide", "rug_deer"), new HideDefinition("TrollHide", "Troll Hide", "TrollHide"), new HideDefinition("WolfPelt", "Wolf Pelt", "rug_wolf"), new HideDefinition("LoxPelt", "Lox Pelt", "rug_fur"), new HideDefinition("ScaleHide", "Scale Hide", "rug_hare"), new HideDefinition("AskHide", "Asksvin Hide", "rug_asksvin"), new HideDefinition("BjornHide", "Bear Hide", "rug_Bjorn"), new HideDefinition("SealHide", "Seal Pelt", "rug_seal"), new HideDefinition("MooseHide", "Moose Hide", "rug_moose") }; private static readonly Dictionary<string, HideDefinition> ByItem = new Dictionary<string, HideDefinition>(StringComparer.Ordinal); internal static int AvailableCount { get; private set; } internal static void Initialize() { ByItem.Clear(); AvailableCount = 0; HideDefinition[] definitions = Definitions; foreach (HideDefinition hideDefinition in definitions) { hideDefinition.Resolve(); if (!hideDefinition.IsAvailable) { Logger.LogWarning((object)("Hide Rack definition unavailable: item='" + hideDefinition.ItemPrefabName + "' found=" + (Object.op_Implicit((Object)(object)hideDefinition.ItemPrefab) ? "yes" : "no") + ", rug='" + hideDefinition.RugPrefabName + "' found=" + (Object.op_Implicit((Object)(object)hideDefinition.RugPrefab) ? "yes" : "no") + ".")); } else { ByItem[hideDefinition.ItemPrefabName] = hideDefinition; AvailableCount++; } } Logger.LogInfo((object)("Hide Rack catalogue initialized: " + AvailableCount + "/" + Definitions.Length + " hide/display definitions available.")); } internal static bool IsSupported(string prefabName) { HideDefinition value; return ByItem.TryGetValue(NormalizePrefabName(prefabName), out value); } internal static bool IsRackInputAllowed(string prefabName) { prefabName = NormalizePrefabName(prefabName); if (prefabName != "LeatherScraps") { return IsSupported(prefabName); } return false; } internal static HideDefinition Get(string prefabName) { if (!ByItem.TryGetValue(NormalizePrefabName(prefabName), out var value)) { return null; } return value; } internal static string DisplayName(string prefabName) { HideDefinition hideDefinition = Get(prefabName); if (hideDefinition == null) { return NormalizePrefabName(prefabName); } return hideDefinition.DisplayName; } internal static string PrefabName(ItemData item) { if (item == null) { return string.Empty; } if (Object.op_Implicit((Object)(object)item.m_dropPrefab)) { return NormalizePrefabName(((Object)item.m_dropPrefab).name); } if (item.m_shared != null && !string.IsNullOrEmpty(item.m_shared.m_name)) { return NormalizePrefabName(item.m_shared.m_name); } return string.Empty; } internal static string NormalizePrefabName(string value) { if (string.IsNullOrEmpty(value)) { return string.Empty; } if (value.EndsWith("(Clone)", StringComparison.Ordinal)) { value = value.Substring(0, value.Length - "(Clone)".Length); } return value.Trim(); } } internal readonly struct HidePileItemTransformValues { internal readonly Vector3 Position; internal readonly Vector3 Rotation; internal readonly Vector3 GroupRotation; internal readonly float OverallScale; internal readonly Vector3 AxisScale; internal readonly float SlotSpacingScale; internal readonly float WidthSpacingScale; internal readonly float HeightSpacingScale; internal readonly float ThicknessDomeScale; internal readonly float SizeVariancePercent; internal readonly Vector3 RotationVariance; internal readonly float TwistVariance; internal readonly float ReverseDirectionChancePercent; internal Vector3 EffectiveScale => AxisScale * OverallScale; internal HidePileItemTransformValues(Vector3 position, Vector3 rotation, Vector3 groupRotation, float overallScale, Vector3 axisScale, float slotSpacingScale, float widthSpacingScale, float heightSpacingScale, float thicknessDomeScale, float sizeVariancePercent, Vector3 rotationVariance, float twistVariance, float reverseDirectionChancePercent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_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) Position = position; Rotation = rotation; GroupRotation = groupRotation; OverallScale = overallScale; AxisScale = axisScale; SlotSpacingScale = slotSpacingScale; WidthSpacingScale = widthSpacingScale; HeightSpacingScale = heightSpacingScale; ThicknessDomeScale = thicknessDomeScale; SizeVariancePercent = sizeVariancePercent; RotationVariance = rotationVariance; TwistVariance = twistVariance; ReverseDirectionChancePercent = reverseDirectionChancePercent; } } internal readonly struct HidePileLayoutValues { internal readonly Vector3 Anchor; internal readonly float HorizontalSpacing; internal readonly float VerticalSpacing; internal readonly float LayerForwardStep; internal HidePileLayoutValues(Vector3 anchor, float horizontalSpacing, float verticalSpacing, float layerForwardStep) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Anchor = anchor; HorizontalSpacing = horizontalSpacing; VerticalSpacing = verticalSpacing; LayerForwardStep = layerForwardStep; } } internal sealed class HidePileItemConfig { private readonly ConfigEntry<float> positionX; private readonly ConfigEntry<float> positionY; private readonly ConfigEntry<float> positionZ; private readonly ConfigEntry<float> rotationX; private readonly ConfigEntry<float> rotationY; private readonly ConfigEntry<float> rotationZ; private readonly ConfigEntry<float> groupRotationX; private readonly ConfigEntry<float> groupRotationY; private readonly ConfigEntry<float> groupRotationZ; private readonly ConfigEntry<float> overallScale; private readonly ConfigEntry<float> scaleX; private readonly ConfigEntry<float> scaleY; private readonly ConfigEntry<float> scaleZ; private readonly ConfigEntry<float> slotSpacingScale; private readonly ConfigEntry<float> widthSpacingScale; private readonly ConfigEntry<float> heightSpacingScale; private readonly ConfigEntry<float> sizeVariancePercent; private readonly ConfigEntry<float> twistVariance; private readonly ConfigEntry<float> rotationVarianceY; private readonly ConfigEntry<float> rotationVarianceZ; private readonly ConfigEntry<float> reverseDirectionChancePercent; internal HidePileItemConfig(ConfigFile config, string section, string itemPrefabName, HidePileItemTransformValues defaults, Action changed) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_00cc: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) positionX = Bind(config, section, "Pile Model Position Left / Right", defaults.Position.x, -5f, 5f, "Offsets this hide's dropped model left or right from each shared pyramid slot.", changed); positionY = Bind(config, section, "Pile Model Position Up / Down", defaults.Position.y, -5f, 5f, "Offsets this hide's dropped model up or down from each shared pyramid slot. New hide profiles use 0.42 as the common pile baseline.", changed); positionZ = Bind(config, section, "Pile Model Position Forward / Back", defaults.Position.z, -5f, 5f, "Offsets this hide's dropped model forward or backward from each shared pyramid slot.", changed); rotationX = Bind(config, section, "Pile Model Tilt Forward / Back", defaults.Rotation.x, -180f, 180f, "Rotates every pile copy of this hide around local X.", changed); rotationY = Bind(config, section, "Pile Model Turn Left / Right", defaults.Rotation.y, -180f, 180f, "Rotates every pile copy of this hide around local Y.", changed); rotationZ = Bind(config, section, "Pile Model Lean Left / Right", defaults.Rotation.z, -180f, 180f, "Rotates every pile copy of this hide around local Z.", changed); groupRotationX = Bind(config, section, "Pile Group Tilt Forward / Back", defaults.GroupRotation.x, -180f, 180f, "Rotates the complete 4/3/2/1 pile geometry around its shared anchor on X. Use this to re-orient the whole pyramid without changing each hide model's own calibration.", changed); groupRotationY = Bind(config, section, "Pile Group Turn Left / Right", defaults.GroupRotation.y, -180f, 180f, "Rotates the complete 4/3/2/1 pile geometry around its shared anchor on Y. This is useful for turning larger hide stacks sideways.", changed); groupRotationZ = Bind(config, section, "Pile Group Lean Left / Right", defaults.GroupRotation.z, -180f, 180f, "Rotates the complete 4/3/2/1 pile geometry around its shared anchor on Z.", changed); overallScale = Bind(config, section, "Pile Model Scale", defaults.OverallScale, 0.01f, 5f, "Uniform scale for this hide's dropped model inside the dynamic pile.", changed); scaleX = Bind(config, section, "Pile Model Scale X", defaults.AxisScale.x, 0.01f, 5f, "Local X scale multiplier for this hide's dropped model.", changed); scaleY = Bind(config, section, "Pile Model Scale Y", defaults.AxisScale.y, 0.01f, 5f, "Local Y scale multiplier for this hide's dropped model.", changed); scaleZ = Bind(config, section, "Pile Model Scale Z", defaults.AxisScale.z, 0.01f, 5f, "Local Z scale multiplier for this hide's dropped model.", changed); slotSpacingScale = Bind(config, section, "Pile Slot Spacing Scale", defaults.SlotSpacingScale, 0.2f, 2.5f, "Overall spacing multiplier for this hide type. Lower values pull the complete pyramid together without changing model size. Width and height can then be tuned independently below.", changed); widthSpacingScale = Bind(config, section, "Pile Width Spacing Scale", defaults.WidthSpacingScale, 0.2f, 2.5f, "Additional left/right spacing multiplier for this hide type. Lower values make each pyramid row narrower without changing layer height or model size.", changed); heightSpacingScale = Bind(config, section, "Pile Height Spacing Scale", defaults.HeightSpacingScale, 0.2f, 2.5f, "Additional vertical layer-spacing multiplier for this hide type. Lower values squash the complete stack vertically without changing its model size or row width.", changed); sizeVariancePercent = Bind(config, section, "Pile Size Variance %", defaults.SizeVariancePercent, 0f, 50f, "Deterministic plus/minus size variation between individual pile hides. The pattern stays stable across refreshes and reloads.", changed); twistVariance = Bind(config, section, "Pile Twist Variance +/- Degrees", defaults.TwistVariance, 0f, 180f, "Deterministic twist in both directions around each dropped hide model's detected long axis. This varies each individual hide without changing the mapped base orientation.", changed); rotationVarianceY = Bind(config, section, "Pile Turn Variance +/- Degrees", defaults.RotationVariance.y, 0f, 45f, "Deterministic left/right turn variance in both directions around the mapped base turn.", changed); rotationVarianceZ = Bind(config, section, "Pile Lean Variance +/- Degrees", defaults.RotationVariance.z, 0f, 45f, "Deterministic left/right lean variance in both directions around the mapped base lean.", changed); reverseDirectionChancePercent = Bind(config, section, "Pile 180 Degree Reverse Chance %", defaults.ReverseDirectionChancePercent, 0f, 100f, "Chance for each deterministic pile slot to turn the hide 180 degrees around its local turn axis so some hides face the opposite direction.", changed); } internal HidePileItemTransformValues Capture() { //IL_0021: 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_006d: 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_0185: Unknown result type (might be due to invalid IL or missing references) return new HidePileItemTransformValues(new Vector3(positionX.Value, positionY.Value, positionZ.Value), new Vector3(rotationX.Value, rotationY.Value, rotationZ.Value), new Vector3(groupRotationX.Value, groupRotationY.Value, groupRotationZ.Value), Mathf.Clamp(overallScale.Value, 0.01f, 5f), new Vector3(Mathf.Clamp(scaleX.Value, 0.01f, 5f), Mathf.Clamp(scaleY.Value, 0.01f, 5f), Mathf.Clamp(scaleZ.Value, 0.01f, 5f)), Mathf.Clamp(slotSpacingScale.Value, 0.2f, 2.5f), Mathf.Clamp(widthSpacingScale.Value, 0.2f, 2.5f), Mathf.Clamp(heightSpacingScale.Value, 0.2f, 2.5f), 1f, Mathf.Clamp(sizeVariancePercent.Value, 0f, 50f), new Vector3(0f, Mathf.Clamp(rotationVarianceY.Value, 0f, 45f), Mathf.Clamp(rotationVarianceZ.Value, 0f, 45f)), Mathf.Clamp(twistVariance.Value, 0f, 180f), Mathf.Clamp(reverseDirectionChancePercent.Value, 0f, 100f)); } internal void ApplyValues(HidePileItemTransformValues values) { //IL_0007: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0075: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) positionX.Value = values.Position.x; positionY.Value = values.Position.y; positionZ.Value = values.Position.z; rotationX.Value = values.Rotation.x; rotationY.Value = values.Rotation.y; rotationZ.Value = values.Rotation.z; groupRotationX.Value = values.GroupRotation.x; groupRotationY.Value = values.GroupRotation.y; groupRotationZ.Value = values.GroupRotation.z; overallScale.Value = values.OverallScale; scaleX.Value = values.AxisScale.x; scaleY.Value = values.AxisScale.y; scaleZ.Value = values.AxisScale.z; slotSpacingScale.Value = values.SlotSpacingScale; widthSpacingScale.Value = values.WidthSpacingScale; heightSpacingScale.Value = values.HeightSpacingScale; sizeVariancePercent.Value = values.SizeVariancePercent; twistVariance.Value = values.TwistVariance; rotationVarianceY.Value = values.RotationVariance.y; rotationVarianceZ.Value = values.RotationVariance.z; reverseDirectionChancePercent.Value = values.ReverseDirectionChancePercent; } private static ConfigEntry<float> Bind(ConfigFile config, string section, string key, float value, float min, float max, string description, Action changed) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown ConfigEntry<float> val = config.Bind<float>(section, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>())); if (changed != null) { val.SettingChanged += delegate { changed(); }; } return val; } } internal sealed class HidePileLayoutConfig { private readonly ConfigEntry<float> anchorX; private readonly ConfigEntry<float> anchorY; private readonly ConfigEntry<float> anchorZ; private readonly ConfigEntry<float> horizontalSpacing; private readonly ConfigEntry<float> verticalSpacing; private readonly ConfigEntry<float> layerForwardStep; internal HidePileLayoutConfig(ConfigFile config, HidePileLayoutValues defaults, Action changed) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) anchorX = Bind(config, "PILE MAPPING - Shared Pyramid", "Pile Anchor Left / Right", defaults.Anchor.x, -5f, 5f, "Moves the complete 10-hide pyramid left or right.", changed); anchorY = Bind(config, "PILE MAPPING - Shared Pyramid", "Pile Anchor Up / Down", defaults.Anchor.y, -5f, 5f, "Moves the complete 10-hide pyramid up or down.", changed); anchorZ = Bind(config, "PILE MAPPING - Shared Pyramid", "Pile Anchor Forward / Back", defaults.Anchor.z, -5f, 5f, "Moves the complete 10-hide pyramid forward or backward.", changed); horizontalSpacing = Bind(config, "PILE MAPPING - Shared Pyramid", "Pile Horizontal Spacing", defaults.HorizontalSpacing, 0.01f, 3f, "Base distance between adjacent hide slots in each pyramid row. Each hide type also has its own spacing-scale multiplier.", changed); verticalSpacing = Bind(config, "PILE MAPPING - Shared Pyramid", "Pile Layer Height", defaults.VerticalSpacing, 0.01f, 3f, "Base vertical distance between the 4/3/2/1 pyramid layers.", changed); layerForwardStep = Bind(config, "PILE MAPPING - Shared Pyramid", "Pile Layer Forward / Back Step", defaults.LayerForwardStep, -2f, 2f, "Base forward/back shift for each higher pyramid layer.", changed); } internal HidePileLayoutValues Capture() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) return new HidePileLayoutValues(new Vector3(anchorX.Value, anchorY.Value, anchorZ.Value), Mathf.Clamp(horizontalSpacing.Value, 0.01f, 3f), Mathf.Clamp(verticalSpacing.Value, 0.01f, 3f), Mathf.Clamp(layerForwardStep.Value, -2f, 2f)); } private static ConfigEntry<float> Bind(ConfigFile config, string section, string key, float value, float min, float max, string description, Action changed) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown ConfigEntry<float> val = config.Bind<float>(section, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>())); if (changed != null) { val.SettingChanged += delegate { changed(); }; } return val; } } [Serializable] internal sealed class HidePileItemSnapshot { public string itemPrefab; public Vector3 position; public Vector3 rotation; public Vector3 groupRotation; public float overallScale; public Vector3 axisScale; public float slotSpacingScale; public float widthSpacingScale; public float heightSpacingScale; public float thicknessDomeScale; public float sizeVariancePercent; public Vector3 rotationVariance; public float twistVariance; public float reverseDirectionChancePercent; internal static HidePileItemSnapshot From(string itemPrefabName, HidePileItemTransformValues value) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0090: Unknown result type (might be due to invalid IL or missing references) return new HidePileItemSnapshot { itemPrefab = HideCatalog.NormalizePrefabName(itemPrefabName), position = value.Position, rotation = value.Rotation, groupRotation = value.GroupRotation, overallScale = value.OverallScale, axisScale = value.AxisScale, slotSpacingScale = value.SlotSpacingScale, widthSpacingScale = value.WidthSpacingScale, heightSpacingScale = value.HeightSpacingScale, thicknessDomeScale = value.ThicknessDomeScale, sizeVariancePercent = value.SizeVariancePercent, rotationVariance = value.RotationVariance, twistVariance = value.TwistVariance, reverseDirectionChancePercent = value.ReverseDirectionChancePercent }; } internal HidePileItemTransformValues ToValues() { //IL_00a9: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) float num = ((slotSpacingScale > 0f) ? Mathf.Clamp(slotSpacingScale, 0.2f, 2.5f) : 1f); float num2 = ((widthSpacingScale > 0f) ? Mathf.Clamp(widthSpacingScale, 0.2f, 2.5f) : 1f); float num3 = ((heightSpacingScale > 0f) ? Mathf.Clamp(heightSpacingScale, 0.2f, 2.5f) : 1f); float num4 = ((thicknessDomeScale > 0f) ? Mathf.Clamp(thicknessDomeScale, 0.01f, 4f) : 1f); return new HidePileItemTransformValues(position, rotation, groupRotation, overallScale, axisScale, num, num2, num3, num4, Mathf.Clamp(sizeVariancePercent, 0f, 50f), new Vector3(0f, Mathf.Clamp(rotationVariance.y, 0f, 45f), Mathf.Clamp(rotationVariance.z, 0f, 45f)), (twistVariance > 0f) ? Mathf.Clamp(twistVariance, 0f, 180f) : Mathf.Clamp(rotationVariance.x, 0f, 180f), Mathf.Clamp(reverseDirectionChancePercent, 0f, 100f)); } } [Serializable] internal sealed class HidePileLayoutSnapshot { public Vector3 anchor; public float horizontalSpacing; public float verticalSpacing; public float layerForwardStep; internal static HidePileLayoutSnapshot From(HidePileLayoutValues value) { //IL_0007: 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) return new HidePileLayoutSnapshot { anchor = value.Anchor, horizontalSpacing = value.HorizontalSpacing, verticalSpacing = value.VerticalSpacing, layerForwardStep = value.LayerForwardStep }; } internal HidePileLayoutValues ToValues() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return new HidePileLayoutValues(anchor, horizontalSpacing, verticalSpacing, layerForwardStep); } } [Serializable] internal sealed class RackTransformSnapshot { public float overallScale; public float widthScale; public float heightScale; public float depthScale; public Vector3 rotation; public Vector3 offset; internal static RackTransformSnapshot From(RackTransformValues value) { //IL_0037: 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) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) return new RackTransformSnapshot { overallScale = value.OverallScale, widthScale = value.WidthScale, heightScale = value.HeightScale, depthScale = value.DepthScale, rotation = value.Rotation, offset = value.Offset }; } internal RackTransformValues ToValues() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) return new RackTransformValues(overallScale, widthScale, heightScale, depthScale, rotation, offset); } } [Serializable] internal sealed class RugOverlaySnapshot { public string itemPrefab; public Vector3 position; public Vector3 rotation; public float twist; public float overallScale; public Vector3 axisScale; internal RugOverlayTransformValues ToValues() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) return new RugOverlayTransformValues(position, rotation, twist, overallScale, axisScale); } } [Serializable] internal sealed class HideVisualProfileSnapshot { public string itemPrefab; public RackTransformSnapshot rearRack; public RugOverlaySnapshot rug; internal static HideVisualProfileSnapshot From(string itemPrefabName, HideVisualProfileValues value) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_007f: 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) return new HideVisualProfileSnapshot { itemPrefab = HideCatalog.NormalizePrefabName(itemPrefabName), rearRack = RackTransformSnapshot.From(value.RearRack), rug = new RugOverlaySnapshot { itemPrefab = HideCatalog.NormalizePrefabName(itemPrefabName), position = value.Rug.Position, rotation = value.Rug.Rotation, twist = value.Rug.Twist, overallScale = value.Rug.OverallScale, axisScale = value.Rug.AxisScale } }; } internal HideVisualProfileValues ToValues(HideVisualProfileValues fallback) { return new HideVisualProfileValues((rearRack != null) ? rearRack.ToValues() : fallback.RearRack, (rug != null) ? rug.ToValues() : fallback.Rug); } } [Serializable] internal sealed class HideRackAppearanceSnapshot { public int version = 2; public RackTransformSnapshot emptyRack; public float assemblyOffsetY; public int pileLooksFullAt; public bool pileAlwaysFull; public int pileFullnessPercent; public float editorDefaultAssemblyHeight; public int editorDefaultPileFullAt; public bool editorDefaultsCaptured; public string displayStyle; public string storageBehaviour; public string emptyBehaviour; public string lastDisplayedHide; public int lastStoredCount; public float lastStoredSlotUnits; public float visualRotation; public float visualScale; public float standRotation; public float pileRotation; public float standScale; public float pileScale; public float standOffsetX; public float standOffsetZ; public float pileOffsetX; public float pileOffsetZ; public float standHeight; public float pileHeight; public string rackFootprint; public string pileFootprint; public string pileDisplayMode; public HidePileLayoutSnapshot pileLayout; public HidePileItemSnapshot[] pileProfiles; public HideVisualProfileSnapshot[] hideProfiles; public int rackSize; public RackTransformSnapshot rack; public RugOverlaySnapshot[] rugs; internal bool IsPileVisible() { return GetDisplayStyle() != "Stand only"; } internal bool IsRackVisible(bool hasRenderablePile) { if (!(GetDisplayStyle() != "Pile only")) { return !hasRenderablePile; } return true; } internal string GetDisplayStyle() { if (displayStyle == "Stand only" || displayStyle == "Pile only") { return displayStyle; } if (!string.Equals(pileDisplayMode, "Hidden", StringComparison.OrdinalIgnoreCase)) { return "Full display"; } return "Stand only"; } internal string GetStorageBehaviour() { if (!(storageBehaviour == "Mixed hides")) { return "Dedicated stack"; } return "Mixed hides"; } internal string GetEmptyBehaviour() { if (emptyBehaviour == "Remember hide" || emptyBehaviour == "Deer hide") { return "Remember hide"; } return "Empty rack"; } internal string GetRackFootprint() { if (!(rackFootprint == "Compact")) { return "Per-hide size"; } return "Compact"; } internal string GetPileFootprint() { if (!(pileFootprint == "Compact")) { return "Per-hide size"; } return "Compact"; } internal float GetVisualScale() { if (!(visualScale >= 0.5f) || !(visualScale <= 1.5f)) { return 1f; } return visualScale; } internal float GetStandScale() { if (!(standScale >= 0.5f) || !(standScale <= 1.5f)) { return GetVisualScale(); } return standScale; } internal float GetPileScale() { if (!(pileScale >= 0.5f) || !(pileScale <= 1.5f)) { return GetVisualScale(); } return pileScale; } internal int GetEditorReferenceFullAt() { if (editorDefaultPileFullAt <= 0) { if (pileLooksFullAt <= 0) { if (!((Object)(object)DynamicStorageAnimalProductsPlugin.Current != (Object)null)) { return 40; } return DynamicStorageAnimalProductsPlugin.Current.GetDefaultPileLooksFullAt(); } return pileLooksFullAt; } return editorDefaultPileFullAt; } internal int GetFullnessPercent() { if (pileFullnessPercent == 25 || pileFullnessPercent == 50 || pileFullnessPercent == 75 || pileFullnessPercent == 100) { return pileFullnessPercent; } int editorReferenceFullAt = GetEditorReferenceFullAt(); int[] array = new int[4] { 25, 50, 75, 100 }; foreach (int num in array) { if (Mathf.Max(1, Mathf.RoundToInt((float)(editorReferenceFullAt * num) / 100f)) == pileLooksFullAt) { return num; } } return 0; } internal HidesEditorState ToEditorState() { return new HidesEditorState { Protocol = 4, DisplayStyle = GetDisplayStyle(), LooksFullAt = ((pileLooksFullAt > 0) ? pileLooksFullAt : GetEditorReferenceFullAt()), LooksFullReference = GetEditorReferenceFullAt(), AlwaysFull = pileAlwaysFull, FullnessPercent = GetFullnessPercent(), StorageBehaviour = GetStorageBehaviour(), EmptyBehaviour = GetEmptyBehaviour(), AssemblyHeight = assemblyOffsetY, StandHeight = standHeight, PileHeight = pileHeight, DefaultAssemblyHeight = (editorDefaultsCaptured ? editorDefaultAssemblyHeight : assemblyOffsetY), Rotation = visualRotation, StandRotation = standRotation, PileRotation = pileRotation, StandScale = GetStandScale(), PileScale = GetPileScale(), StandOffsetX = standOffsetX, StandOffsetZ = standOffsetZ, PileOffsetX = pileOffsetX, PileOffsetZ = pileOffsetZ, RackFootprint = GetRackFootprint(), PileFootprint = GetPileFootprint() }; } internal HidePileLayoutValues GetPileLayout(HidePileLayoutValues fallback) { if (pileLayout == null) { return fallback; } return pileLayout.ToValues(); } internal HidePileItemTransformValues GetPileItem(string itemPrefabName, HidePileItemTransformValues fallback) { itemPrefabName = HideCatalog.NormalizePrefabName(itemPrefabName); if (pileProfiles != null) { for (int i = 0; i < pileProfiles.Length; i++) { HidePileItemSnapshot hidePileItemSnapshot = pileProfiles[i]; if (hidePileItemSnapshot != null && string.Equals(hidePileItemSnapshot.itemPrefab, itemPrefabName, StringComparison.Ordinal)) { return hidePileItemSnapshot.ToValues(); } } } return fallback; } internal RackTransformValues GetRearRack(string itemPrefabName, RackTransformValues fallbackEmptyRack, HideVisualProfileValues fallbackHideProfile) { itemPrefabName = HideCatalog.NormalizePrefabName(itemPrefabName); if (string.IsNullOrEmpty(itemPrefabName)) { if (emptyRack != null) { return emptyRack.ToValues(); } if (rack != null) { return rack.ToValues(); } return fallbackEmptyRack; } HideVisualProfileSnapshot hideVisualProfileSnapshot = FindProfile(itemPrefabName); if (hideVisualProfileSnapshot != null && hideVisualProfileSnapshot.rearRack != null) { return hideVisualProfileSnapshot.rearRack.ToValues(); } if (rack != null) { return rack.ToValues(); } return fallbackHideProfile.RearRack; } internal Vector3 GetCompactRackScale(RackTransformValues fallbackEmptyRack) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (emptyRack != null) { return emptyRack.ToValues().EffectiveScale; } return fallbackEmptyRack.EffectiveScale; } internal Vector3 GetCompactRackRatio(RackTransformValues rearRack, RackTransformValues fallbackEmptyRack) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_000f: 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_001b: 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_0032: 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) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Vector3 compactRackScale = GetCompactRackScale(fallbackEmptyRack); Vector3 effectiveScale = rearRack.EffectiveScale; return new Vector3(compactRackScale.x / Mathf.Max(0.01f, effectiveScale.x), compactRackScale.y / Mathf.Max(0.01f, effectiveScale.y), compactRackScale.z / Mathf.Max(0.01f, effectiveScale.z)); } internal RugOverlayTransformValues GetRug(string itemPrefabName, RugOverlayTransformValues fallback) { itemPrefabName = HideCatalog.NormalizePrefabName(itemPrefabName); HideVisualProfileSnapshot hideVisualProfileSnapshot = FindProfile(itemPrefabName); if (hideVisualProfileSnapshot != null && hideVisualProfileSnapshot.rug != null) { return hideVisualProfileSnapshot.rug.ToValues(); } if (rugs != null) { for (int i = 0; i < rugs.Length; i++) { RugOverlaySnapshot rugOverlaySnapshot = rugs[i]; if (rugOverlaySnapshot != null && string.Equals(rugOverlaySnapshot.itemPrefab, itemPrefabName, StringComparison.Ordinal)) { return rugOverlaySnapshot.ToValues(); } } } return fallback; } private HideVisualProfileSnapshot FindProfile(string itemPrefabName) { if (hideProfiles == null) { return null; } for (int i = 0; i < hideProfiles.Length; i++) { HideVisualProfileSnapshot hideVisualProfileSnapshot = hideProfiles[i]; if (hideVisualProfileSnapshot != null && string.Equals(hideVisualProfileSnapshot.itemPrefab, itemPrefabName, StringComparison.Ordinal)) { return hideVisualProfileSnapshot; } } return null; } internal string Serialize() { return JsonUtility.ToJson((object)this); } internal static HideRackAppearanceSnapshot Deserialize(string json) { if (string.IsNullOrEmpty(json)) { return null; } try { HideRackAppearanceSnapshot hideRackAppearanceSnapshot = JsonUtility.FromJson<HideRackAppearanceSnapshot>(json); if (hideRackAppearanceSnapshot == null || hideRackAppearanceSnapshot.version < 1) { return null; } if (hideRackAppearanceSnapshot.version >= 2 && hideRackAppearanceSnapshot.emptyRack == null) { return null; } if (hideRackAppearanceSnapshot.version == 1 && hideRackAppearanceSnapshot.rack == null) { return null; } return hideRackAppearanceSnapshot; } catch { return null; } } } internal sealed class HideRackAppearance : MonoBehaviour { private const string KeyVersion = "DSAP.Appearance.Version"; private const string KeyData = "DSAP.Appearance.Data"; private const string EditorRpc = "DSAP_SetEditorAppearance"; private const string EditorKey = "DSAP.Editor."; private HideRackAppearanceSnapshot pendingPlacementSnapshot; private float pendingPlacementDeadline; private float nextCheck; private float startedAt; private string lastAppliedIdentity; private bool legacyMigrationAttempted; private bool isPlacementGhost; private Coroutine selectionFlash; private float lastEditorAppliedLogTime = -10f; internal void Setup() { } private void Start() { ZNetView component = ((Component)this).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component)) { component.Register<string>("DSAP_SetEditorAppearance", (Action<long, string>)ReceiveEditorState); } startedAt = Time.unscaledTime; SafeRefresh(force: true); } internal void FlashSelectionTwice() { if (selectionFlash == null) { selectionFlash = ((MonoBehaviour)this).StartCoroutine(FlashSelection()); } } private IEnumerator FlashSelection() { Transform val = FindActiveAssemblyRoot(); Renderer[] renderers = (Renderer[])(Object.op_Implicit((Object)(object)val) ? ((Array)((Component)val).GetComponentsInChildren<Renderer>(true)) : ((Array)new Renderer[0])); MaterialPropertyBlock[] original = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[renderers.Length]; for (int i = 0; i < renderers.Length; i++) { original[i] = new MaterialPropertyBlock(); if (Object.op_Implicit((Object)(object)renderers[i])) { renderers[i].GetPropertyBlock(original[i]); } } int i2 = 0; while (i2 < 2) { for (int j = 0; j < renderers.Length; j++) { if (Object.op_Implicit((Object)(object)renderers[j]) && renderers[j].enabled) { MaterialPropertyBlock val2 = new MaterialPropertyBlock(); renderers[j].GetPropertyBlock(val2); val2.SetColor("_Color", new Color(0.55f, 1f, 0.62f, 1f)); val2.SetColor("_EmissionColor", new Color(0.35f, 0.9f, 0.45f, 1f)); renderers[j].SetPropertyBlock(val2); } } yield return (object)new WaitForSecondsRealtime(0.2f); for (int k = 0; k < renderers.Length; k++) { if (Object.op_Implicit((Object)(object)renderers[k])) { renderers[k].SetPropertyBlock(original[k]); } } yield return (object)new WaitForSecondsRealtime(0.16f); int num = i2 + 1; i2 = num; } selectionFlash = null; } internal bool RequestEditorState(HidesEditorState state) { ZNetView component = ((Component)this).GetComponent<ZNetView>(); if (!Object.op_Implicit((Object)(object)component) || !component.IsValid() || component.GetZDO() == null) { Logger.LogWarning((object)"Appearance Editor edit was not sent: selected rack has no valid ZDO."); return false; } HideRackStorage component2 = ((Component)this).GetComponent<HideRackStorage>(); if (state.StorageBehaviour == "Dedicated stack" && Object.op_Implicit((Object)(object)component2) && component2.HasMultipleSupportedTypes()) { return false; } if (!ValidEditorState(state)) { Logger.LogWarning((object)"Appearance Editor edit was not sent: invalid editor values."); return false; } string text = SerializeEditorState(state); if (component.IsOwner()) { return ApplyEditorState(text); } component.InvokeRPC("DSAP_SetEditorAppearance", new object[1] { text }); return true; } private void ReceiveEditorState(long sender, string payload) { ApplyEditorState(payload); } private bool ApplyEditorState(string payload) { ZNetView component = ((Component)this).GetComponent<ZNetView>(); if (!Object.op_Implicit((Object)(object)component) || !component.IsValid() || !component.IsOwner() || component.GetZDO() == null || string.IsNullOrEmpty(payload) || payload.Length > 384) { Logger.LogWarning((object)"Appearance Editor edit rejected: no owning ZDO or invalid message length."); return false; } if (!TryDeserializeEditorState(payload, out var state) || !ValidEditorState(state)) { Logger.LogWarning((object)"Appearance Editor edit rejected: invalid message or editor values."); return false; } HideRackStorage component2 = ((Component)this).GetComponent<HideRackStorage>(); if (state.StorageBehaviour == "Dedicated stack" && Object.op_Implicit((Object)(object)component2) && component2.HasMultipleSupportedTypes()) { return false; } HideRackAppearanceSnapshot hideRackAppearanceSnapshot = ReadSnapshot(component.GetZDO()); HideRackAppearanceSnapshot hideRackAppearanceSnapshot2 = pendingPlacementSnapshot ?? hideRackAppearanceSnapshot; if (hideRackAppearanceSnapshot2 == null) { hideRackAppearanceSnapshot2 = DynamicStorageAnimalProductsPlugin.Current?.CaptureAppearanceTemplate(); } if (hideRackAppearanceSnapshot2 == null) { Logger.LogWarning((object)"Appearance Editor edit rejected: appearance snapshot unavailable."); return false; } if (!hideRackAppearanceSnapshot2.editorDefaultsCaptured) { hideRackAppearanceSnapshot2.editorDefaultAssemblyHeight = hideRackAppearanceSnapshot2.assemblyOffsetY; hideRackAppearanceSnapshot2.editorDefaultPileFullAt = ((hideRackAppearanceSnapshot2.pileLooksFullAt > 0) ? hideRackAppearanceSnapshot2.pileLooksFullAt : DynamicStorageAnimalProductsPlugin.Current.GetDefaultPileLooksFullAt()); hideRackAppearanceSnapshot2.editorDefaultsCaptured = true; } hideRackAppearanceSnapshot2.displayStyle = state.DisplayStyle; hideRackAppearanceSnapshot2.pileDisplayMode = ((state.DisplayStyle == "Stand only") ? "Hidden" : "Visible"); hideRackAppearanceSnapshot2.pileLooksFullAt = state.LooksFullAt; hideRackAppearanceSnapshot2.pileAlwaysFull = state.AlwaysFull; hideRackAppearanceSnapshot2.pileFullnessPercent = state.FullnessPercent; hideRackAppearanceSnapshot2.storageBehaviour = state.StorageBehaviour; hideRackAppearanceSnapshot2.emptyBehaviour = state.EmptyBehaviour; hideRackAppearanceSnapshot2.assemblyOffsetY = state.AssemblyHeight; hideRackAppearanceSnapshot2.standHeight = state.StandHeight; hideRackAppearanceSnapshot2.pileHeight = state.PileHeight; hideRackAppearanceSnapshot2.visualRotation = state.Rotation; hideRackAppearanceSnapshot2.standRotation = state.StandRotation; hideRackAppearanceSnapshot2.pileRotation = state.PileRotation; hideRackAppearanceSnapshot2.standScale = state.StandScale; hideRackAppearanceSn