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.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Innangard.Blueprints; using Innangard.Jobs; using Innangard.UI; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using Splatform; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: AssemblyCompany("Innangard")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.0.8.0")] [assembly: AssemblyInformationalVersion("0.0.8")] [assembly: AssemblyProduct("Innangard")] [assembly: AssemblyTitle("Innangard")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 Innangard { [HarmonyPatch(typeof(WearNTear), "Destroy")] internal static class BaseDestroyedPatch { [HarmonyPrefix] private static void Prefix(WearNTear __instance, HitData hitData) { if (hitData != null) { SettlementAlarm.StructureLost(__instance, hitData.GetAttacker()); } } } [Flags] internal enum CaretakerDuties { None = 0, Mending = 1, Sorting = 2, Fires = 4, MachineFuel = 8, MachineInput = 0x10, Gathering = 0x20, All = 0x3F } internal sealed class ChestSortPanel : MonoBehaviour { private sealed class ItemChoice { internal string SharedName; internal string DisplayName; internal Sprite Icon; internal Button Button; } [HarmonyPatch(typeof(Container), "Interact")] private static class OpenPatch { [HarmonyPrefix] private static bool Prefix(Container __instance, Humanoid character, bool hold, ref bool __result) { if (!hold) { Player val = (Player)(object)((character is Player) ? character : null); if (val != null && !((Object)(object)val != (Object)(object)Player.m_localPlayer)) { if (!ModifierHeld() || !ChestSortRules.CanConfigure(__instance, val.GetPlayerID())) { return true; } Toggle(__instance); __result = true; return false; } } return true; } private static bool ModifierHeld() { if (!ZInput.GetButton("Run") && !Input.GetKey((KeyCode)304)) { return Input.GetKey((KeyCode)303); } return true; } } private const float PanelWidth = 660f; private const float PanelHeight = 740f; private const float TitleHeight = 40f; private const float Edge = 14f; private const float Gap = 8f; private const float MaxUseDistance = 10f; private const float BetweenRefreshes = 0.25f; private const float ItemButtonHeight = 40f; private const float IconSize = 28f; private static readonly (IntakeRoles Role, string LabelKey)[] IntakeChoices = new(IntakeRoles, string)[8] { (IntakeRoles.Lumberjack, "$inn_trade_lumberjack"), (IntakeRoles.Miner, "$inn_trade_miner"), (IntakeRoles.Farmer, "$inn_trade_farmer"), (IntakeRoles.Forager, "$inn_trade_forager"), (IntakeRoles.Hunter, "$inn_trade_hunter"), (IntakeRoles.Fisherman, "$inn_role_fisherman"), (IntakeRoles.Cook, "$inn_trade_cook"), (IntakeRoles.Builder, "$inn_role_builder") }; private static ChestSortPanel _instance; private Container _container; private GameObject _panel; private bool _blocking; private float _scaledAt = -1f; private float _nextRefresh; private bool _wasConfigured; private HashSet _selected = new HashSet(StringComparer.Ordinal); private readonly List _choices = new List(); private Text _intakeState; private Text _intakeNoFrithstone; private RectTransform _intakeControls; private Button _intakeRemove; private readonly List