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 VikingsForHire v1.6.7
plugins/ValheimNpc.dll
Decompiled 2 weeks 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.Net; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using Splatform; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; using Valheim.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ValheimNpc")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+6b9e785656b96cff4d40cb3e4edf87ef8774a356")] [assembly: AssemblyProduct("ValheimNpc")] [assembly: AssemblyTitle("ValheimNpc")] [assembly: AssemblyVersion("0.1.0.0")] [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 ValheimNpc { [HarmonyPatch(typeof(ArcheryTarget), "OnProjectileHit")] internal static class ArcheryScoreContextPatch { [ThreadStatic] private static bool s_npcShot; internal static bool NpcShot => s_npcShot; private static void Prefix(Character owner, out bool __state) { __state = s_npcShot; s_npcShot = (Object)(object)owner != (Object)null && VikingNpc.TryGet(owner, out var _); } private static Exception Finalizer(bool __state, Exception __exception) { s_npcShot = __state; return __exception; } } [HarmonyPatch(typeof(Player), "Message")] internal static class ArcheryScoreMessagePatch { private static bool Prefix(MessageType type, string msg) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 int result; if (ArcheryScoreContextPatch.NpcShot && (int)type == 2 && !string.IsNullOrEmpty(msg)) { return !int.TryParse(msg, out result); } return true; } } internal static class ArchitectStones { internal const string PrefabName = "vnpc_architect"; internal static readonly int CenterXKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_cx"); internal static readonly int CenterZKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_cz"); internal static readonly int WidthKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_wf"); internal static readonly int LengthKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_lf"); internal static readonly int HeightKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_hf"); internal static readonly int BottomKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_b"); internal static readonly int SetKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_set"); internal static readonly int ForKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_for"); internal static readonly int NameKey = StringExtensionMethods.GetStableHashCode("vnpc_arch_name"); private static readonly string[] Bases = new string[2] { "piece_stone_marker", "sign" }; private static GameObject s_prefab; internal static void RegisterPiece() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown PrefabManager.OnVanillaPrefabsAvailable -= RegisterPiece; if ((Object)(object)s_prefab == (Object)null) { string text = Bases.FirstOrDefault((string b) => (Object)(object)PrefabManager.Instance.GetPrefab(b) != (Object)null); GameObject prefab = PrefabManager.Instance.GetPrefab("Stone"); if (text == null || (Object)(object)prefab == (Object)null) { return; } GameObject val = PrefabManager.Instance.CreateClonedPrefab("vnpc_architect", text); MonoBehaviour[] componentsInChildren = val.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val2 in componentsInChildren) { if (val2 is Hoverable || val2 is Interactable || val2 is TextReceiver) { Object.DestroyImmediate((Object)(object)val2); } } val.AddComponent<ArchitectStone>(); Piece component = val.GetComponent<Piece>(); component.m_name = "$vnpc_architect"; component.m_description = "$vnpc_architect_desc"; component.m_category = (PieceCategory)0; component.m_enabled = true; component.m_resources = (Requirement[])(object)new Requirement[1] { new Requirement { m_resItem = prefab.GetComponent<ItemDrop>(), m_amount = 5, m_recover = true } }; PrefabManager.Instance.AddPrefab(val); s_prefab = val; Plugin.Log.LogInfo((object)("«Камень зодчего» сделан на основе " + text)); } AddToHammer(ObjectDB.instance); } internal static void AddToHammer(ObjectDB db) { if (!((Object)(object)s_prefab == (Object)null) && !((Object)(object)db == (Object)null) && VikingModules.Factions) { GameObject itemPrefab = db.GetItemPrefab("Hammer"); PieceTable val = ((itemPrefab == null) ? null : itemPrefab.GetComponent<ItemDrop>()?.m_itemData.m_shared.m_buildPieces); if ((Object)(object)val != (Object)null && !val.m_pieces.Contains(s_prefab)) { val.m_pieces.Add(s_prefab); } } } } public sealed class ArchitectStone : MonoBehaviour, Hoverable, Interactable { internal const float MinSize = 3f; internal const float MaxSize = 30f; internal const float MaxHeight = 20f; private const float FrameSeconds = 300f; private ZNetView m_view; internal Vector2 Center; internal Vector3 Size = new Vector3(10f, 8f, 10f); internal float Bottom = -0.5f; private GameObject m_frame; private LineRenderer[] m_edges; private readonly List<ArchitectHandle> m_handles = new List<ArchitectHandle>(); private float m_frameUntil; private ArchitectHandle m_dragging; private bool m_dirty; internal static bool WalkMode; internal static ArchitectStone Dragging { get; private set; } internal bool Valid { get { if ((Object)(object)m_view != (Object)null) { return m_view.IsValid(); } return false; } } internal Quaternion Yaw => Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); internal HouseTemplates.For For { get { if (!Valid) { return HouseTemplates.For.Freeholders; } return (HouseTemplates.For)Mathf.Clamp(m_view.GetZDO().GetInt(ArchitectStones.ForKey, 1), 1, 3); } } internal string SavedName { get { if (!Valid) { return ""; } return m_view.GetZDO().GetString(ArchitectStones.NameKey, ""); } } internal Vector3 WorldCenter => ((Component)this).transform.position + Yaw * new Vector3(Center.x, Bottom + Size.y * 0.5f, Center.y); private static int PieceMask => LayerMask.GetMask(new string[4] { "piece", "piece_nonsolid", "Default", "Default_small" }); private void Awake() { m_view = ((Component)this).GetComponent<ZNetView>(); if (Valid) { Load(); if (!m_view.GetZDO().GetBool(ArchitectStones.SetKey, false) && m_view.IsOwner()) { ((MonoBehaviour)this).Invoke("AutoFitFirstTime", 1f); } } } private void AutoFitFirstTime() { if (Valid && !m_view.GetZDO().GetBool(ArchitectStones.SetKey, false)) { AutoFit(); ShowFrame(); } } private void Load() { //IL_002d: 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_0068: 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) ZDO zDO = m_view.GetZDO(); Center = new Vector2(zDO.GetFloat(ArchitectStones.CenterXKey, 0f), zDO.GetFloat(ArchitectStones.CenterZKey, 0f)); Size = new Vector3(zDO.GetFloat(ArchitectStones.WidthKey, 10f), zDO.GetFloat(ArchitectStones.HeightKey, 8f), zDO.GetFloat(ArchitectStones.LengthKey, 10f)); Bottom = zDO.GetFloat(ArchitectStones.BottomKey, -0.5f); } internal void Store() { if (Valid) { m_view.ClaimOwnership(); ZDO zDO = m_view.GetZDO(); zDO.Set(ArchitectStones.CenterXKey, Center.x); zDO.Set(ArchitectStones.CenterZKey, Center.y); zDO.Set(ArchitectStones.WidthKey, Size.x); zDO.Set(ArchitectStones.HeightKey, Size.y); zDO.Set(ArchitectStones.LengthKey, Size.z); zDO.Set(ArchitectStones.BottomKey, Bottom); zDO.Set(ArchitectStones.SetKey, true); } } internal void SetFor(HouseTemplates.For side) { m_view.ClaimOwnership(); m_view.GetZDO().Set(ArchitectStones.ForKey, (int)side, false); } internal void SetName(string name) { m_view.ClaimOwnership(); m_view.GetZDO().Set(ArchitectStones.NameKey, name ?? ""); } internal void Clamp() { Size.x = Mathf.Clamp(Size.x, 3f, 30f); Size.z = Mathf.Clamp(Size.z, 3f, 30f); Size.y = Mathf.Clamp(Size.y, 2f, 20f); Bottom = Mathf.Clamp(Bottom, -4f, 2f); Center.x = Mathf.Clamp(Center.x, -30f, 30f); Center.y = Mathf.Clamp(Center.y, -30f, 30f); } public string GetHoverName() { return "$vnpc_architect"; } public float GetHoverOffset() { return 0f; } public string GetHoverText() { return Localization.instance.Localize($"<color=#ffd070>$vnpc_architect</color> · {Size.x:0.#}×{Size.z:0.#}×{Size.y:0.#} $vnpc_m\n" + "[<color=yellow><b>$KEY_Use</b></color>] $vnpc_architect_open\n<size=80%>$vnpc_architect_hint</size>"); } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (hold || !(user is Player) || !Valid) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } ShowFrame(); ArchitectWindow.Open(this); return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } internal static bool Skip(GameObject go) { if (!((Object)(object)go.GetComponent<TeleportWorld>() != (Object)null) && !((Object)(object)go.GetComponent<PrivateArea>() != (Object)null) && !((Object)(object)go.GetComponent<Ship>() != (Object)null) && !((Object)(object)go.GetComponent<Vagon>() != (Object)null) && !((Object)(object)go.GetComponent<Plant>() != (Object)null) && !((Object)(object)go.GetComponent<Pickable>() != (Object)null) && !((Object)(object)go.GetComponent<Character>() != (Object)null) && !((Object)(object)go.GetComponent<SettlementBanner>() != (Object)null) && !((Object)(object)go.GetComponent<ArchitectStone>() != (Object)null)) { return Utils.GetPrefabName(go).StartsWith("vnpc_"); } return true; } internal bool AutoFit() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) Piece val = (from p in (from c in Physics.OverlapSphere(((Component)this).transform.position + Vector3.up, 5f, PieceMask) select ((Component)c).GetComponentInParent<Piece>()).Where(delegate(Piece p) { if ((Object)(object)p != (Object)null) { ZNetView component2 = ((Component)p).GetComponent<ZNetView>(); if (component2 != null && component2.IsValid()) { return !Skip(((Component)p).gameObject); } } return false; }) orderby Vector3.Distance(((Component)p).transform.position, ((Component)this).transform.position) select p).FirstOrDefault(); if ((Object)(object)val == (Object)null) { return false; } HashSet<Piece> hashSet = new HashSet<Piece> { val }; Queue<Piece> queue = new Queue<Piece>(); queue.Enqueue(val); while (queue.Count > 0 && hashSet.Count < 600) { Collider[] componentsInChildren = ((Component)queue.Dequeue()).GetComponentsInChildren<Collider>(); foreach (Collider val2 in componentsInChildren) { if (val2.isTrigger) { continue; } Bounds bounds = val2.bounds; Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).extents + Vector3.one * 0.25f, Quaternion.identity, PieceMask, (QueryTriggerInteraction)1); for (int num2 = 0; num2 < array.Length; num2++) { Piece componentInParent = ((Component)array[num2]).GetComponentInParent<Piece>(); if ((Object)(object)componentInParent != (Object)null && !hashSet.Contains(componentInParent) && !Skip(((Component)componentInParent).gameObject)) { ZNetView component = ((Component)componentInParent).GetComponent<ZNetView>(); if (component != null && component.IsValid() && Vector3.Distance(((Component)componentInParent).transform.position, ((Component)val).transform.position) < 40f) { hashSet.Add(componentInParent); queue.Enqueue(componentInParent); } } } } } Quaternion val3 = Quaternion.Inverse(Yaw); Vector3 val4 = Vector3.one * float.MaxValue; Vector3 val5 = Vector3.one * float.MinValue; foreach (Piece item in hashSet) { Collider[] componentsInChildren = ((Component)item).GetComponentsInChildren<Collider>(); foreach (Collider val6 in componentsInChildren) { if (!val6.isTrigger) { Bounds bounds2 = val6.bounds; for (int num3 = 0; num3 < 8; num3++) { Vector3 val7 = ((Bounds)(ref bounds2)).center + Vector3.Scale(((Bounds)(ref bounds2)).extents, new Vector3(((num3 & 1) == 0) ? (-1f) : 1f, ((num3 & 2) == 0) ? (-1f) : 1f, ((num3 & 4) == 0) ? (-1f) : 1f)); Vector3 val8 = val3 * (val7 - ((Component)this).transform.position); val4 = Vector3.Min(val4, val8); val5 = Vector3.Max(val5, val8); } } } } if (val4.x > val5.x) { return false; } Center = new Vector2((val4.x + val5.x) * 0.5f, (val4.z + val5.z) * 0.5f); Size = new Vector3(val5.x - val4.x + 0.5f, val5.y - val4.y + 0.5f, val5.z - val4.z + 0.5f); Bottom = val4.y - 0.25f; Clamp(); Store(); UpdateFrame(); return true; } internal (int parts, int live, int beds) Count() { List<Piece> list = PiecesInside(); return (parts: list.Count, live: list.Count((Piece p) => IsLive(((Component)p).gameObject)), beds: list.Count((Piece p) => (Object)(object)((Component)p).GetComponent<Bed>() != (Object)null)); } internal List<Piece> PiecesInside() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0018: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Size * 0.5f; HashSet<Piece> hashSet = new HashSet<Piece>(); Collider[] array = Physics.OverlapBox(WorldCenter, val, Yaw, PieceMask, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { Piece componentInParent = ((Component)array[i]).GetComponentInParent<Piece>(); ZNetView val2 = (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).GetComponent<ZNetView>() : null); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)val2 == (Object)null) && val2.IsValid() && !Skip(((Component)componentInParent).gameObject)) { Vector3 val3 = Quaternion.Inverse(Yaw) * (((Component)componentInParent).transform.position - ((Component)this).transform.position); if (Mathf.Abs(val3.x - Center.x) <= val.x + 0.01f && Mathf.Abs(val3.z - Center.y) <= val.z + 0.01f && val3.y >= Bottom - 0.01f && val3.y <= Bottom + Size.y) { hashSet.Add(componentInParent); } } } return hashSet.ToList(); } internal static bool IsLive(GameObject go) { if (!((Object)(object)go.GetComponent<Bed>() != (Object)null) && !((Object)(object)go.GetComponent<Door>() != (Object)null) && !((Object)(object)go.GetComponent<Container>() != (Object)null) && !((Object)(object)go.GetComponent<Fireplace>() != (Object)null) && !((Object)(object)go.GetComponent<Chair>() != (Object)null) && !((Object)(object)go.GetComponent<CraftingStation>() != (Object)null) && !((Object)(object)go.GetComponent<CookingStation>() != (Object)null) && !((Object)(object)go.GetComponent<Smelter>() != (Object)null) && !((Object)(object)go.GetComponent<Fermenter>() != (Object)null) && !((Object)(object)go.GetComponent<Beehive>() != (Object)null)) { return (Object)(object)go.GetComponent<StationExtension>() != (Object)null; } return true; } internal bool Save(string name, out string message) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00bc: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) name = (name ?? "").Trim(); if (name.Length == 0) { message = "$vnpc_architect_need_name"; return false; } SetName(name); Store(); List<Piece> list = PiecesInside(); if (list.Count == 0) { message = "$vnpc_architect_empty"; return false; } HouseTemplates.Template template = new HouseTemplates.Template { Name = name, Factions = For }; List<(HouseTemplates.Part, bool)> list2 = new List<(HouseTemplates.Part, bool)>(); Quaternion val = Quaternion.Inverse(Yaw); float num = float.MaxValue; float num2 = float.MinValue; float num3 = float.MaxValue; float num4 = float.MinValue; foreach (Piece item3 in list) { Vector3 val2 = val * (((Component)item3).transform.position - ((Component)this).transform.position); Quaternion val3 = val * ((Component)item3).transform.rotation; list2.Add((new HouseTemplates.Part { Prefab = Utils.GetPrefabName(((Component)item3).gameObject), Position = val2, Euler = ((Quaternion)(ref val3)).eulerAngles }, IsLive(((Component)item3).gameObject))); num = Mathf.Min(num, val2.x); num2 = Mathf.Max(num2, val2.x); num3 = Mathf.Min(num3, val2.z); num4 = Mathf.Max(num4, val2.z); } float num5 = (((Object)(object)ZoneSystem.instance != (Object)null) ? ZoneSystem.instance.GetGroundHeight(((Component)this).transform.position) : ((Component)this).transform.position.y); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor((num + num2) * 0.5f, num5 - ((Component)this).transform.position.y, (num3 + num4) * 0.5f); foreach (var item4 in list2) { HouseTemplates.Part item = item4.Item1; bool item2 = item4.Item2; item.Position -= val4; (item2 ? template.Live : template.Static).Add(item); } template.Beds = list.Count((Piece p) => (Object)(object)((Component)p).GetComponent<Bed>() != (Object)null); template.HalfSize = new Vector2(Size.x * 0.5f, Size.z * 0.5f); if (template.Static.Count > 400 || template.Live.Count > 40) { message = "$vnpc_architect_too_big"; return false; } HouseTemplates.Submit(HouseTemplates.Serialize(template, visualOnly: false), out var _); BlueprintItems.Refresh(); message = Localization.instance.Localize("$vnpc_architect_saved") + $" «{name}»: {list.Count}, $vnpc_architect_beds {template.Beds}" + ((template.Beds == 0) ? (" — " + Localization.instance.Localize("$vnpc_architect_no_bed_bp")) : ""); return true; } internal void ShowFrame() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) m_frameUntil = Time.time + 300f; if ((Object)(object)m_frame == (Object)null) { m_frame = new GameObject("VNPC_ArchitectFrame"); m_frame.transform.SetParent(((Component)this).transform, false); Shader val = Shader.Find("Sprites/Default"); m_edges = (LineRenderer[])(object)new LineRenderer[13]; for (int i = 0; i < m_edges.Length; i++) { GameObject val2 = new GameObject("edge"); val2.transform.SetParent(m_frame.transform, false); LineRenderer val3 = val2.AddComponent<LineRenderer>(); if ((Object)(object)val != (Object)null) { ((Renderer)val3).material = new Material(val); } val3.useWorldSpace = true; val3.positionCount = 2; float startWidth = (val3.endWidth = ((i == 12) ? 0.2f : 0.07f)); val3.startWidth = startWidth; Color startColor = (val3.endColor = ((i == 12) ? new Color(0.3f, 0.7f, 1f, 0.95f) : ((i < 4) ? new Color(0.3f, 1f, 0.4f, 0.95f) : new Color(1f, 0.85f, 0.3f, 0.85f)))); val3.startColor = startColor; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; m_edges[i] = val3; } ArchitectHandle.Side[] array = new ArchitectHandle.Side[5] { ArchitectHandle.Side.Left, ArchitectHandle.Side.Right, ArchitectHandle.Side.Back, ArchitectHandle.Side.Front, ArchitectHandle.Side.Top }; foreach (ArchitectHandle.Side side in array) { m_handles.Add(ArchitectHandle.Create(this, side, m_frame.transform)); } } UpdateFrame(); } internal void HideFrame() { if ((Object)(object)m_frame != (Object)null) { Object.Destroy((Object)(object)m_frame); } m_frame = null; m_edges = null; m_handles.Clear(); } internal Vector3 Corner(float sx, float sy, float sz) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_007a: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position + Yaw * new Vector3(Center.x + sx * Size.x * 0.5f, Bottom + ((sy > 0f) ? Size.y : 0f), Center.y + sz * Size.z * 0.5f); } internal void UpdateFrame() { //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) //IL_003d: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) if (m_edges == null) { return; } Vector3[] array = (Vector3[])(object)new Vector3[8] { Corner(-1f, 0f, -1f), Corner(1f, 0f, -1f), Corner(1f, 0f, 1f), Corner(-1f, 0f, 1f), Corner(-1f, 1f, -1f), Corner(1f, 1f, -1f), Corner(1f, 1f, 1f), Corner(-1f, 1f, 1f) }; int[,] array2 = new int[12, 2] { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 0 }, { 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 4 }, { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } }; for (int i = 0; i < 12; i++) { m_edges[i].SetPosition(0, array[array2[i, 0]]); m_edges[i].SetPosition(1, array[array2[i, 1]]); } Vector3 val = ((Component)this).transform.position + Yaw * new Vector3(Center.x, Bottom + 0.15f, Center.y + Size.z * 0.5f); m_edges[12].SetPosition(0, val); m_edges[12].SetPosition(1, val + Yaw * Vector3.forward * 1.5f); foreach (ArchitectHandle handle in m_handles) { handle.Place(); } } internal void StartDrag(ArchitectHandle handle) { if ((Object)(object)Dragging != (Object)null && (Object)(object)Dragging != (Object)(object)this) { Dragging.StopDrag(); } m_dragging = handle; Dragging = this; Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "$vnpc_architect_dragging", 0, (Sprite)null, false); } } internal void StopDrag() { m_dragging = null; if ((Object)(object)Dragging == (Object)(object)this) { Dragging = null; } Store(); Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, $"{Size.x:0.#}×{Size.z:0.#}×{Size.y:0.#} $vnpc_m", 0, (Sprite)null, false); } } internal bool IsDragging(ArchitectHandle handle) { return (Object)(object)m_dragging == (Object)(object)handle; } private void Update() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_frame != (Object)null && Time.time > m_frameUntil && (Object)(object)m_dragging == (Object)null && !ArchitectWindow.IsOpenFor(this)) { HideFrame(); WalkMode = false; } if ((Object)(object)m_dragging != (Object)null) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || Vector3.Distance(((Component)localPlayer).transform.position, WorldCenter) > 60f) { StopDrag(); return; } m_frameUntil = Time.time + 300f; Vector3 local = Quaternion.Inverse(Yaw) * (((Component)localPlayer).transform.position - ((Component)this).transform.position); Drag(m_dragging.Which, local, localPlayer); UpdateFrame(); m_dirty = true; } else if (m_dirty) { m_dirty = false; Store(); } else if (WalkMode && (Object)(object)m_frame != (Object)null) { UpdateFrame(); } } internal void Drag(ArchitectHandle.Side side, Vector3 local, Player player) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) float num7; float num3; float num4; float num5; float num6; float num8; float num9; float num10; switch (side) { case ArchitectHandle.Side.Left: num7 = -1f; goto IL_002b; case ArchitectHandle.Side.Right: num7 = 1f; goto IL_002b; case ArchitectHandle.Side.Back: num3 = -1f; goto IL_009c; case ArchitectHandle.Side.Front: num3 = 1f; goto IL_009c; case ArchitectHandle.Side.Top: { Vector3 val = (((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).transform.forward : ((Component)player).transform.forward); Vector3 eyePoint = ((Character)player).GetEyePoint(); Vector3 val2 = WorldCenter - eyePoint; val2.y = 0f; float num = Mathf.Max(1f, ((Vector3)(ref val2)).magnitude); Vector2 val3 = new Vector2(val.x, val.z); float magnitude = ((Vector2)(ref val3)).magnitude; float num2 = eyePoint.y + ((magnitude > 0.05f) ? (val.y / magnitude * num) : 0f) - ((Component)this).transform.position.y; Size.y = Mathf.Clamp(num2 - Bottom, 2f, 20f); break; } IL_009c: num4 = num3; num5 = Center.y - num4 * Size.z * 0.5f; num6 = Mathf.Clamp(Mathf.Abs(local.z - num5), 3f, 30f); Center.y = num5 + num4 * num6 * 0.5f; Size.z = num6; break; IL_002b: num8 = num7; num9 = Center.x - num8 * Size.x * 0.5f; num10 = Mathf.Clamp(Mathf.Abs(local.x - num9), 3f, 30f); Center.x = num9 + num8 * num10 * 0.5f; Size.x = num10; break; } } private void OnDestroy() { if ((Object)(object)Dragging == (Object)(object)this) { Dragging = null; } ArchitectWindow.CloseFor(this); } } public sealed class ArchitectHandle : MonoBehaviour, Hoverable, Interactable { internal enum Side { Left, Right, Back, Front, Top } internal Side Which; private ArchitectStone m_stone; internal static ArchitectHandle Create(ArchitectStone stone, Side side, Transform parent) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val).name = "handle_" + side; val.transform.SetParent(parent, true); val.transform.localScale = Vector3.one * 0.6f; val.layer = LayerMask.NameToLayer("piece_nonsolid"); Shader val2 = Shader.Find("Sprites/Default"); if ((Object)(object)val2 != (Object)null) { ((Renderer)val.GetComponent<MeshRenderer>()).material = new Material(val2) { color = ((side == Side.Top) ? new Color(1f, 0.85f, 0.3f, 0.9f) : new Color(0.35f, 1f, 0.45f, 0.9f)) }; } Light obj = new GameObject("light").AddComponent<Light>(); ((Component)obj).transform.SetParent(val.transform, false); obj.type = (LightType)2; obj.range = 3f; obj.intensity = 1.5f; obj.color = ((side == Side.Top) ? new Color(1f, 0.85f, 0.3f) : new Color(0.35f, 1f, 0.45f)); ArchitectHandle architectHandle = val.AddComponent<ArchitectHandle>(); architectHandle.Which = side; architectHandle.m_stone = stone; return architectHandle; } internal void Place() { //IL_0039: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_stone == (Object)null)) { Player localPlayer = Player.m_localPlayer; float num = ((ArchitectStone.WalkMode && (Object)(object)localPlayer != (Object)null) ? (((Character)localPlayer).GetEyePoint().y - ((Component)m_stone).transform.position.y - 0.2f) : (m_stone.Bottom + 1.4f)); float num2 = m_stone.Size.x * 0.5f + 0.6f; float num3 = m_stone.Size.z * 0.5f + 0.6f; Vector3 val = default(Vector3); switch (Which) { case Side.Left: ((Vector3)(ref val))..ctor(0f - num2, num, 0f); break; case Side.Right: ((Vector3)(ref val))..ctor(num2, num, 0f); break; case Side.Back: ((Vector3)(ref val))..ctor(0f, num, 0f - num3); break; case Side.Front: ((Vector3)(ref val))..ctor(0f, num, num3); break; default: val = (ArchitectStone.WalkMode ? new Vector3(num2, num, num3) : new Vector3(0f, m_stone.Bottom + m_stone.Size.y + 0.4f, 0f)); break; } ((Component)this).transform.position = ((Component)m_stone).transform.position + m_stone.Yaw * new Vector3(m_stone.Center.x + val.x, val.y, m_stone.Center.y + val.z); } } public string GetHoverName() { return "$vnpc_architect"; } public float GetHoverOffset() { return 0f; } public string GetHoverText() { return Localization.instance.Localize(((Object)(object)m_stone != (Object)null && m_stone.IsDragging(this)) ? "[<color=yellow><b>$KEY_Use</b></color>] $vnpc_architect_release" : ("[<color=yellow><b>$KEY_Use</b></color>] " + ((Which == Side.Top) ? "$vnpc_architect_drag_top" : "$vnpc_architect_drag_side"))); } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold || (Object)(object)m_stone == (Object)null || !(user is Player)) { return false; } if (m_stone.IsDragging(this)) { m_stone.StopDrag(); } else { m_stone.StartDrag(this); } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } } internal static class ArchitectWindow { private const float Width = 760f; private const int Preview = 340; private static GameObject s_panel; private static ArchitectStone s_stone; private static Camera s_camera; private static RenderTexture s_texture; private static float s_renderAt; private static Text s_info; private static InputField s_name; private static float s_infoAt; private static RectTransform s_preview; private static readonly List<PreviewHandle> s_previewHandles = new List<PreviewHandle>(); private static bool s_frozen; private static Vector3 s_frozenCenter; private static float s_frozenSize; private static Vector3 CameraCenter { get { //IL_0012: 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) if (!s_frozen) { return s_stone.WorldCenter; } return s_frozenCenter; } } private static float CameraSize { get { if (!s_frozen) { return Mathf.Max(s_stone.Size.x, s_stone.Size.z) * 0.5f + 2f; } return s_frozenSize; } } private static float PixelsPerMeter => 170f / CameraSize; internal static bool IsOpenFor(ArchitectStone stone) { if ((Object)(object)s_panel != (Object)null) { return (Object)(object)s_stone == (Object)(object)stone; } return false; } private static void PlacePreviewHandles() { //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_0022: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_stone == (Object)null) { return; } Vector3 val = Quaternion.Inverse(s_stone.Yaw) * (s_stone.WorldCenter - CameraCenter); Vector2 val2 = new Vector2(val.x, val.z) * PixelsPerMeter; float num = s_stone.Size.x * 0.5f * PixelsPerMeter; float num2 = s_stone.Size.z * 0.5f * PixelsPerMeter; foreach (PreviewHandle s_previewHandle in s_previewHandles) { if (!((Object)(object)s_previewHandle == (Object)null)) { Vector2 anchoredPosition = ((s_previewHandle.Which == ArchitectHandle.Side.Left) ? (val2 + new Vector2(0f - num, 0f)) : ((s_previewHandle.Which == ArchitectHandle.Side.Right) ? (val2 + new Vector2(num, 0f)) : ((s_previewHandle.Which == ArchitectHandle.Side.Back) ? (val2 + new Vector2(0f, 0f - num2)) : (val2 + new Vector2(0f, num2))))); ((RectTransform)((Component)s_previewHandle).transform).anchoredPosition = anchoredPosition; } } } internal static void BeginPreviewDrag() { //IL_0005: 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) s_frozenCenter = s_stone.WorldCenter; s_frozenSize = Mathf.Max(s_stone.Size.x, s_stone.Size.z) * 0.5f + 2f; s_frozen = true; } internal static void PreviewDrag(ArchitectHandle.Side side, Vector2 screen, Camera eventCamera) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); if (!((Object)(object)s_preview == (Object)null) && !((Object)(object)s_stone == (Object)null) && RectTransformUtility.ScreenPointToLocalPointInRectangle(s_preview, screen, eventCamera, ref val)) { Vector2 val2 = new Vector2(val.x, val.y + 170f) / PixelsPerMeter; Vector3 val3 = Quaternion.Inverse(s_stone.Yaw) * (CameraCenter - ((Component)s_stone).transform.position); Vector3 local = default(Vector3); ((Vector3)(ref local))..ctor(val3.x + val2.x, 0f, val3.z + val2.y); s_stone.Drag(side, local, Player.m_localPlayer); s_stone.Clamp(); s_stone.UpdateFrame(); PlacePreviewHandles(); s_renderAt = 0f; } } internal static void EndPreviewDrag() { s_frozen = false; if ((Object)(object)s_stone != (Object)null) { s_stone.Store(); Build(); } } internal static void Open(ArchitectStone stone) { Close(); if (!((Object)(object)stone == (Object)null) && !((Object)(object)GUIManager.CustomGUIFront == (Object)null)) { s_stone = stone; Build(); GUIManager.BlockInput(true); } } internal static void CloseFor(ArchitectStone stone) { if ((Object)(object)s_stone == (Object)(object)stone) { Close(); } } internal static void Close() { if ((Object)(object)s_panel != (Object)null) { Object.Destroy((Object)(object)s_panel); s_panel = null; GUIManager.BlockInput(false); } if ((Object)(object)s_camera != (Object)null) { Object.Destroy((Object)(object)((Component)s_camera).gameObject); s_camera = null; } s_stone = null; } internal static void Update() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_panel == (Object)null) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)s_stone == (Object)null || !s_stone.Valid || (Object)(object)localPlayer == (Object)null || Vector3.Distance(((Component)localPlayer).transform.position, ((Component)s_stone).transform.position) > 40f || ZInput.GetKeyDown((KeyCode)27, true)) { Close(); return; } if (Time.time >= s_renderAt) { s_renderAt = Time.time + 0.2f; RenderTop(); } if (Time.time >= s_infoAt && (Object)(object)s_info != (Object)null) { s_infoAt = Time.time + 0.5f; var (num, num2, num3) = s_stone.Count(); s_info.text = Localization.instance.Localize($"$vnpc_architect_count: {num} · $vnpc_architect_live: {num2} · $vnpc_architect_beds: {num3}"); ((Graphic)s_info).color = ((num > 440 || num3 == 0) ? VikingUi.Warn : VikingUi.Good); } } private static void RenderTop() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown if ((Object)(object)s_camera == (Object)null) { s_camera = new GameObject("VNPC_ArchitectCamera").AddComponent<Camera>(); ((Behaviour)s_camera).enabled = false; s_camera.orthographic = true; s_camera.clearFlags = (CameraClearFlags)2; s_camera.backgroundColor = new Color(0.12f, 0.14f, 0.12f); s_camera.cullingMask = ~LayerMask.GetMask(new string[4] { "UI", "character", "character_net", "character_ghost" }); s_camera.nearClipPlane = 0.3f; s_camera.farClipPlane = 200f; } if ((Object)(object)s_texture == (Object)null) { s_texture = new RenderTexture(680, 680, 24); } s_camera.targetTexture = s_texture; Vector3 cameraCenter = CameraCenter; ((Component)s_camera).transform.position = cameraCenter + Vector3.up * (s_stone.Size.y * 0.5f + 40f); ((Component)s_camera).transform.rotation = Quaternion.LookRotation(Vector3.down, s_stone.Yaw * Vector3.forward); s_camera.orthographicSize = CameraSize; s_camera.Render(); PlacePreviewHandles(); } private static void Build() { //IL_003a: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_panel != (Object)null) { Object.Destroy((Object)(object)s_panel); } s_stone.ShowFrame(); s_panel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 760f, 520f, false); Transform transform = s_panel.transform; float num = -24f; VikingUi.Label(transform, "$vnpc_architect", new Vector2(0f, num), new Vector2(700f, 36f), 26, VikingUi.Orange, (TextAnchor)4, bold: true); num -= 40f; float num2 = -180f; RectTransform val = VikingUi.Rect(transform, "Preview", new Vector2(num2, num), new Vector2(340f, 340f)); RawImage val2 = ((Component)val).gameObject.AddComponent<RawImage>(); s_preview = val; s_previewHandles.Clear(); RenderTop(); val2.texture = (Texture)(object)s_texture; ArchitectHandle.Side[] array = new ArchitectHandle.Side[4] { ArchitectHandle.Side.Left, ArchitectHandle.Side.Right, ArchitectHandle.Side.Back, ArchitectHandle.Side.Front }; Vector2 val4 = default(Vector2); foreach (ArchitectHandle.Side which in array) { Image val3 = VikingUi.Box((Transform)(object)val, Vector2.zero, new Vector2(30f, 30f), new Color(0.35f, 1f, 0.45f, 0.95f), VikingUi.Circle()); ((Graphic)val3).raycastTarget = true; RectTransform rectTransform = ((Graphic)val3).rectTransform; RectTransform rectTransform2 = ((Graphic)val3).rectTransform; ((Vector2)(ref val4))..ctor(0.5f, 0.5f); rectTransform2.anchorMax = val4; rectTransform.anchorMin = val4; ((Graphic)val3).rectTransform.pivot = new Vector2(0.5f, 0.5f); PreviewHandle previewHandle = ((Component)val3).gameObject.AddComponent<PreviewHandle>(); previewHandle.Which = which; s_previewHandles.Add(previewHandle); } PlacePreviewHandles(); float num3 = num2 + 170f + 30f + 175f; float y = num; Slide(transform, num3, ref y, "$vnpc_architect_width", s_stone.Size.x, 3f, 30f, delegate(float v) { s_stone.Size.x = v; }); Slide(transform, num3, ref y, "$vnpc_architect_length", s_stone.Size.z, 3f, 30f, delegate(float v) { s_stone.Size.z = v; }); Slide(transform, num3, ref y, "$vnpc_architect_height", s_stone.Size.y, 2f, 20f, delegate(float v) { s_stone.Size.y = v; }); Slide(transform, num3, ref y, "$vnpc_architect_shift_x", s_stone.Center.x, -15f, 15f, delegate(float v) { s_stone.Center.x = v; }); Slide(transform, num3, ref y, "$vnpc_architect_shift_z", s_stone.Center.y, -15f, 15f, delegate(float v) { s_stone.Center.y = v; }); y -= 6f; VikingUi.WideButton(transform, "$vnpc_architect_autofit", new Vector2(num3, y), 330f, 38f, enabled: true, delegate { if (!s_stone.AutoFit()) { Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "$vnpc_architect_nothing_near", 0, (Sprite)null, false); } } Build(); }); y -= 46f; HouseTemplates.For obj = s_stone.For; VikingUi.WideButton(transform, Localization.instance.Localize("$vnpc_architect_for: " + obj switch { HouseTemplates.For.Both => "$vnpc_architect_for_b", HouseTemplates.For.Outlaws => "$vnpc_architect_for_o", _ => "$vnpc_architect_for_f", }), new Vector2(num3, y), 330f, 38f, enabled: true, delegate { s_stone.SetFor((HouseTemplates.For)((int)s_stone.For % 3 + 1)); Build(); }); y -= 46f; VikingUi.WideButton(transform, "$vnpc_architect_walk", new Vector2(num3, y), 330f, 38f, enabled: true, delegate { ArchitectStone.WalkMode = true; ArchitectStone architectStone = s_stone; Close(); architectStone?.ShowFrame(); }); float num4 = num - 340f - 20f; s_info = VikingUi.Label(transform, "", new Vector2(0f, num4), new Vector2(700f, 26f), 17, VikingUi.Good, (TextAnchor)4); num4 -= 40f; s_name = GUIManager.Instance.CreateInputField(transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(-110f, num4), (ContentType)0, Localization.instance.Localize("$vnpc_architect_name"), 18, 420f, 38f).GetComponent<InputField>(); s_name.text = ((s_name.text.Length == 0) ? s_stone.SavedName : s_name.text); VikingUi.WideButton(transform, "$vnpc_architect_save", new Vector2(220f, num4), 200f, 40f, enabled: true, delegate { string message; bool num5 = s_stone.Save(((Object)(object)s_name != (Object)null) ? s_name.text : "", out message); Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, message, 0, (Sprite)null, false); } if (num5) { Close(); } }); num4 -= 48f; VikingUi.Label(transform, "$vnpc_architect_body", new Vector2(0f, num4), new Vector2(700f, 44f), 14, VikingUi.Muted, (TextAnchor)4); num4 -= 52f; ((RectTransform)transform).SetSizeWithCurrentAnchors((Axis)1, 0f - num4 + 10f); VikingUi.ApplyScale(transform, 0f - num4 + 10f); VikingUi.FixFonts(transform); s_infoAt = 0f; } private static void Slide(Transform panel, float x, ref float y, string caption, float value, float min, float max, Action<float> set) { //IL_0019: 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_002f: 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_0067: 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_008f: Unknown result type (might be due to invalid IL or missing references) VikingUi.Label(panel, caption, new Vector2(x - 95f, y), new Vector2(140f, 30f), 16, VikingUi.Beige, (TextAnchor)3); Text label = VikingUi.Label(panel, $"{value:0.#} $vnpc_m", new Vector2(x + 135f, y), new Vector2(70f, 30f), 15, Color.white, (TextAnchor)4, bold: true); VikingUi.Slider(panel, new Vector2(x + 25f, y - 2f), 170f, min * 2f, max * 2f, value * 2f, wholeNumbers: true, delegate(float raw) { float num = raw * 0.5f; set(num); s_stone.Clamp(); s_stone.UpdateFrame(); label.text = Localization.instance.Localize($"{num:0.#} $vnpc_m"); s_renderAt = 0f; s_infoAt = Time.time + 0.2f; s_stone.Store(); }); y -= 40f; } } internal sealed class PreviewHandle : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { internal ArchitectHandle.Side Which; public void OnBeginDrag(PointerEventData eventData) { ArchitectWindow.BeginPreviewDrag(); } public void OnDrag(PointerEventData eventData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ArchitectWindow.PreviewDrag(Which, eventData.position, eventData.pressEventCamera); } public void OnEndDrag(PointerEventData eventData) { ArchitectWindow.EndPreviewDrag(); } } internal static class AwayAccounting { internal static readonly int LastSeenKey = StringExtensionMethods.GetStableHashCode("vnpc_away_seen"); private const float SeenStepSeconds = 30f; private static readonly Dictionary<VikingJob, (string prefab, int perDay)[]> Yield = new Dictionary<VikingJob, (string, int)[]> { { VikingJob.Woodcutter, new(string, int)[1] { ("Wood", 30) } }, { VikingJob.Miner, new(string, int)[1] { ("Stone", 30) } }, { VikingJob.Hunter, new(string, int)[3] { ("RawMeat", 4), ("LeatherScraps", 4), ("DeerHide", 2) } }, { VikingJob.Fisher, new(string, int)[1] { ("Fish1", 3) } }, { VikingJob.Gatherer, new(string, int)[2] { ("Raspberry", 8), ("Mushroom", 4) } } }; internal static void Tick(SettlementBanner banner, ref float nextAt, ref bool settled) { if (Time.time < nextAt || (Object)(object)banner == (Object)null || (Object)(object)banner.NetView == (Object)null || !banner.NetView.IsValid() || !banner.NetView.IsOwner() || (Object)(object)ZNet.instance == (Object)null || (Object)(object)ObjectDB.instance == (Object)null) { return; } nextAt = Time.time + 30f; ZDO zDO = banner.NetView.GetZDO(); if (NpcSettlements.IsNpcBanner(zDO)) { return; } long ticks = ZNet.instance.GetTime().Ticks; if (!settled) { settled = true; long num = zDO.GetLong(LastSeenKey, 0L); bool flag = zDO.GetInt(KeepLoaded.RadiusKey, 0) > 0 && zDO.GetInt(KeepLoaded.NearKey, 0) == 0; if (Plugin.AwayProduction.Value && num > 0 && !flag) { double num2 = TimeSpan.FromTicks(ticks - num).TotalSeconds / (double)Mathf.Max(60f, ((Object)(object)EnvMan.instance != (Object)null) ? ((float)EnvMan.instance.m_dayLengthSec) : 1800f); if (num2 >= 0.25) { Settle(zDO, (float)Math.Min(num2, Plugin.AwayMaxDays.Value)); } } } zDO.Set(LastSeenKey, ticks); } private static void Settle(ZDO banner, float days) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Vector3 position = banner.GetPosition(); float num = Settlements.RadiusOf(banner); List<Container> list = (from c in AreaScan.Components<Container>(position, num + 15f, LayerMask.GetMask(new string[2] { "piece", "piece_nonsolid" }), (QueryTriggerInteraction)0) where (Object)(object)c != (Object)null && VikingNpc.IsStorageChest(c) && !c.IsInUse() && !Plugin.IsIgnoredContainer((Component)(object)c) && NpcSettlements.PieceFaction((Component)(object)c) == VikingFaction.None && ChestTags.ModeOf(ChestTags.RuleZdo(c)) != ChestTags.Mode.Treasury && ChestTags.ModeOf(ChestTags.RuleZdo(c)) != ChestTags.Mode.DoNotTouch select c).Distinct().ToList(); if (list.Count == 0) { return; } List<ZDO> list2 = (from v in WorldScan.Of("VNPC_Viking") where v.GetLong(VikingNpc.BaseUserKey, 0L) == ((ZDOID)(ref banner.m_uid)).UserID && (uint)v.GetLong(VikingNpc.BaseIdKey, 0L) == ((ZDOID)(ref banner.m_uid)).ID && v.GetLong(VikingNpc.HostileToKey, 0L) == 0 select v).ToList(); if (list2.Count == 0) { return; } Dictionary<string, int> dictionary = new Dictionary<string, int>(); foreach (ZDO item3 in list2) { foreach (VikingJob item4 in VikingNpc.ParseJobs(item3.GetString(VikingNpc.JobsKey, ""), item3.GetInt(VikingNpc.JobKey, 0))) { if (Yield.TryGetValue(item4, out (string, int)[] value)) { (string, int)[] array = value; for (int num2 = 0; num2 < array.Length; num2++) { (string, int) tuple = array[num2]; string item = tuple.Item1; int item2 = tuple.Item2; dictionary[item] = (dictionary.TryGetValue(item, out var value2) ? value2 : 0) + Mathf.RoundToInt((float)item2 * days); } } } } List<string> list3 = new List<string>(); foreach (KeyValuePair<string, int> item5 in dictionary) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(item5.Key); if (!((Object)(object)itemPrefab == (Object)null) && item5.Value > 0) { int num3 = SettlementResourceLimits.Limit(banner, item5.Key); int amount = ((num3 > 0) ? Mathf.Min(item5.Value, Mathf.Max(0, num3 - SettlementResourceLimits.Stock(banner, item5.Key))) : item5.Value); int num4 = Put(list, itemPrefab, amount); if (num4 > 0) { list3.Add($"{item5.Key} {num4}"); } } } int num5 = Mathf.RoundToInt((float)list2.Count * days); int num6 = Eat(list, num5); Plugin.Log.LogInfo((object)($"Расчёт за отсутствие «{Settlements.NameOf(banner)}»: {days:0.0} дн., жителей {list2.Count}; добыто: " + ((list3.Count > 0) ? string.Join(", ", list3) : "ничего") + $"; съедено {num6} из {num5}")); if (list3.Count > 0 || num6 > 0) { Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)1, Localization.instance.Localize($"{Settlements.NameOf(banner)}: $vnpc_away_done {days:0.0} $vnpc_unit_day"), 0, (Sprite)null, false); } } } private static int Put(List<Container> chests, GameObject prefab, int amount) { int num = amount; ItemData sample = prefab.GetComponent<ItemDrop>().m_itemData; foreach (Container item in chests.OrderByDescending((Container c) => c.GetInventory().CountItems(sample.m_shared.m_name, -1, true))) { if (num <= 0) { break; } ZNetView component = ((Component)item).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { continue; } component.ClaimOwnership(); Inventory inventory = item.GetInventory(); while (num > 0) { int num2 = Mathf.Min(num, Mathf.Max(1, sample.m_shared.m_maxStackSize)); if (!inventory.CanAddItem(prefab, num2)) { break; } inventory.AddItem(prefab, num2); num -= num2; } } return amount - num; } private static int Eat(List<Container> chests, int meals) { int num = 0; foreach (Container chest in chests) { if (num >= meals) { break; } Inventory inventory = chest.GetInventory(); foreach (ItemData item in (from i in inventory.GetAllItems() where i.m_shared.m_food > 0f && (int)i.m_shared.m_itemType == 2 select i).ToList()) { if (num >= meals) { break; } ZNetView component = ((Component)chest).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { break; } component.ClaimOwnership(); int num2 = Mathf.Min(item.m_stack, meals - num); inventory.RemoveItem(item, num2); num += num2; } } return num; } } internal static class Backpack { public const string InventoryName = "$vnpc_backpack"; public static float MaxWeight => Plugin.BackpackMaxWeight.Value; public static bool Is(Inventory inventory) { if (inventory != null) { return inventory.GetName() == "$vnpc_backpack"; } return false; } public static bool Fits(Inventory backpack, float addedWeight, float removedWeight = 0f) { if (backpack.GetTotalWeight() - removedWeight + addedWeight <= MaxWeight + 0.01f) { return true; } Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, string.Format(Localization.instance.Localize("$vnpc_msg_too_heavy"), Mathf.RoundToInt(MaxWeight)), 0, (Sprite)null, false); } return false; } } [HarmonyPatch(typeof(InventoryGrid), "DropItem")] internal static class BackpackDropPatch { private static bool Prefix(InventoryGrid __instance, Inventory fromInventory, ItemData item, int amount, Vector2i pos, ref bool __result) { //IL_0019: 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) Inventory inventory = __instance.GetInventory(); if (!Backpack.Is(inventory) || fromInventory == inventory || item == null) { return true; } ItemData itemAt = inventory.GetItemAt(pos.x, pos.y); bool flag = itemAt != null && itemAt != item && item.m_stack == amount && (itemAt.m_shared.m_name != item.m_shared.m_name || (item.m_shared.m_maxQuality > 1 && itemAt.m_quality != item.m_quality) || itemAt.m_shared.m_maxStackSize == 1); if (Backpack.Fits(inventory, item.GetWeight(amount), flag ? itemAt.GetWeight(-1) : 0f)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(Inventory), "MoveItemToThis", new Type[] { typeof(Inventory), typeof(ItemData) })] internal static class BackpackQuickMovePatch { private static bool Prefix(Inventory __instance, Inventory fromInventory, ItemData item) { if (Backpack.Is(__instance) && fromInventory != __instance && item != null) { return Backpack.Fits(__instance, item.GetWeight(-1)); } return true; } } [HarmonyPatch(typeof(Inventory), "StackAll")] internal static class BackpackStackAllPatch { private static bool Prefix(Inventory __instance, Inventory fromInventory, ref int __result) { if (!Backpack.Is(__instance) || fromInventory == null) { return true; } float num = 0f; foreach (ItemData allItem in fromInventory.GetAllItems()) { if (__instance.ContainsItemByName(allItem.m_shared.m_name)) { num += allItem.GetWeight(-1); } } if (Backpack.Fits(__instance, num)) { return true; } __result = 0; return false; } } [HarmonyPatch(typeof(InventoryGui), "UpdateContainerWeight")] internal static class BackpackWeightTextPatch { private static void Postfix(InventoryGui __instance, Container ___m_currentContainer) { if (!((Object)(object)___m_currentContainer == (Object)null) && Backpack.Is(___m_currentContainer.GetInventory())) { int num = Mathf.CeilToInt(___m_currentContainer.GetInventory().GetTotalWeight()); int num2 = Mathf.RoundToInt(Backpack.MaxWeight); __instance.m_containerWeight.text = ((num > num2) ? $"<color=red>{num}/{num2}</color>" : $"{num}/{num2}"); } } } public class VikingNpc : MonoBehaviour, Interactable, TextReceiver { internal enum FormationShape { Column, Wedge, Ring } internal sealed class Spec { public string Id; public float Damage = 1f; public float Taken = 1f; public float Health = 1f; public float Heal = 1f; public float Taunt = 1f; public float Lifesteal; } private struct SortMove { public Container Destination; public Container Source; public float Until; } private sealed class QueuedSpeech { public VikingNpc Npc; public string Line; } private enum FieldKind { None, Chop, Break, Mimic } private enum GuardShift { Always, SleepsAtNight, SleepsByDay } internal enum MoveNote { None, Arrived, Direct, Path, Door, Sidestep, Back, Jump, Detour, Memory, Stairs } private sealed class ChestLabel { public readonly HashSet<string> Kinds = new HashSet<string>(); public readonly List<string> Words = new List<string>(); public readonly HashSet<VikingJob> Jobs = new HashSet<VikingJob>(); public bool Private; public float At; public bool Empty { get { if (!Private && Kinds.Count == 0 && Words.Count == 0) { return Jobs.Count == 0; } return false; } } } private enum TownActivity { None, Seat, Stroll, Fire, Chat } private struct Order { public long Player; public string Prefab; public int Stack; public int Day; } private enum TaskKind { Hit, Pick, Plant, Feed, Withdraw, Deposit, Repair, CookTake, CookAdd, PutItem, FeedAnimal, Drink, BrewTap, BrewAdd, Honey, CookWatch, Sit, Walk, Ask, Custom } private sealed class WorkTask { public TaskKind Kind; public Component Target; public Collider Collider; public Vector3 Point; public float Reach; public string Item; public string PrefabName; public bool IsFuel; public int Count; public float StartedAt = Time.time; public bool HasStand; public Vector3 Stand; public ItemData Tool; public uint LastRevision; public bool Swung; public bool Repositioned; public bool CameCloser; public Vector3 AimFacing; public string TreePrefab; public Vector3 TreePos; public Func<WorkTask, bool> Act; public Func<bool> Valid; public float Cooldown = 1f; public bool NoTarget; } private struct PendingPlant { public Vector3 Position; public string Crop; public float Until; } private struct Crop { public GameObject Sapling; public string Seed; } private struct Need { public Component Station; public string Item; public string PrefabName; public bool IsFuel; public int Count; } private static VikingNpc s_bedPicker; private static long s_bedPickerPlayer; private static float s_bedPickUntil; private BlueprintSite m_bpCarrySite; private static float s_bagLogAt; private static readonly Color RayFree = new Color(0.3f, 1f, 0.3f); private static readonly Color RayNear = new Color(1f, 0.85f, 0.2f); private static readonly Color RayBlocked = new Color(1f, 0.25f, 0.2f); private static readonly Color RayHole = new Color(0.85f, 0.3f, 1f); private EpicLootCompat.Stats m_epicStats; internal static readonly int TraderDebtDaysKey = StringExtensionMethods.GetStableHashCode("vnpc_tdebt_days"); internal static readonly int TraderLastDayKey = StringExtensionMethods.GetStableHashCode("vnpc_tdebt_day"); internal static readonly int TraderStageKey = StringExtensionMethods.GetStableHashCode("vnpc_tdebt_stage"); internal static readonly int TraderGraceKey = StringExtensionMethods.GetStableHashCode("vnpc_tdebt_grace"); internal static readonly int TraderKillsKey = StringExtensionMethods.GetStableHashCode("vnpc_tdebt_kills"); internal static readonly int TraderTickKey = StringExtensionMethods.GetStableHashCode("vnpc_tdebt_tick"); private const float KillReach = 4.5f; private float m_debtTickAt; private float m_bannerBackAt; private float m_nagAt; private bool m_killing; internal static readonly int SupplyKey = StringExtensionMethods.GetStableHashCode("vnpc_supply"); internal static readonly int SupplyAtKey = StringExtensionMethods.GetStableHashCode("vnpc_supply_at"); private const float MarketMaxDrop = 0.5f; private const float MarketRecoverDays = 3f; private const float AlarmRange = 60f; private const float WorkerThreatRange = 14f; private const float WorkerAlertedRange = 8f; private float m_helpCallAt; private float m_guardReplyAt; internal const int TintSlots = 4; internal static readonly int[] TintKeys = new int[4] { StringExtensionMethods.GetStableHashCode("vnpc_tint_helmet"), StringExtensionMethods.GetStableHashCode("vnpc_tint_chest"), StringExtensionMethods.GetStableHashCode("vnpc_tint_legs"), StringExtensionMethods.GetStableHashCode("vnpc_tint_cape") }; internal static readonly Vector3[] TintChoices = (Vector3[])(object)new Vector3[9] { Vector3.zero, new Vector3(0.75f, 0.2f, 0.18f), new Vector3(0.2f, 0.35f, 0.75f), new Vector3(0.25f, 0.55f, 0.25f), new Vector3(0.85f, 0.7f, 0.25f), new Vector3(0.45f, 0.25f, 0.6f), new Vector3(0.95f, 0.95f, 0.95f), new Vector3(0.3f, 0.3f, 0.32f), new Vector3(0.55f, 0.38f, 0.22f) }; private static readonly FieldRef<VisEquipment, GameObject> s_helmetInstance = AccessTools.FieldRefAccess<VisEquipment, GameObject>("m_helmetItemInstance"); private static readonly FieldRef<VisEquipment, List<GameObject>> s_chestInstances = AccessTools.FieldRefAccess<VisEquipment, List<GameObject>>("m_chestItemInstances"); private static readonly FieldRef<VisEquipment, List<GameObject>> s_legInstances = AccessTools.FieldRefAccess<VisEquipment, List<GameObject>>("m_legItemInstances"); private static readonly FieldRef<VisEquipment, List<GameObject>> s_shoulderInstances = AccessTools.FieldRefAccess<VisEquipment, List<GameObject>>("m_shoulderItemInstances"); private static readonly int s_colorId = Shader.PropertyToID("_Color"); private static MaterialPropertyBlock s_tintBlock; private readonly int[] m_tintSignature = new int[4]; internal static readonly int[] LookAsKeys = new int[4] { StringExtensionMethods.GetStableHashCode("vnpc_lookas_helmet"), StringExtensionMethods.GetStableHashCode("vnpc_lookas_chest"), StringExtensionMethods.GetStableHashCode("vnpc_lookas_legs"), StringExtensionMethods.GetStableHashCode("vnpc_lookas_cape") }; internal static readonly ItemType[] LookAsTypes; private static List<string>[] s_lookAsChoices; private const float AssaultSeconds = 90f; private const float AssaultClearRadius = 15f; private const float AssaultAlertRange = 60f; private static readonly FieldRef<MonsterAI, Vector3> s_lastKnownTargetPos; private static readonly FieldRef<MonsterAI, bool> s_beenAtLastPos; private static readonly FieldRef<MonsterAI, float> s_timeSinceSensed; private const float AssaultViewRange = 60f; private bool m_assault; private Character m_assaultTarget; private Vector3 m_assaultPoint; private float m_assaultUntil; private float m_assaultCalm; private bool m_assaultHadAnchor; private Vector3 m_assaultPrevAnchor; private float m_atmosphereAt; private float m_storyAt; private float m_petAt; private float m_voiceAt; private float m_weatherCheckAt; private static float s_storyGlobalAt; private static string s_weatherSaidFor; private static float s_weatherAgainAt; private static float s_playerDiedAt; private static int s_recentDeaths; private static float s_recentDeathsAt; private static readonly Dictionary<ZDOID, float> s_bossesAnnounced; private const int StoryCount = 6; private static readonly Regex s_jarlWord; private static EffectList s_voiceMale; private static EffectList s_voiceFemale; private static bool s_voicesLooked; private const float IdleSeatSeconds = 8f; private const float SeatRecheckSeconds = 8f; private const float ThroneCatchRange = 5f; private static readonly Dictionary<Chair, VikingNpc> s_chairTakers; private static int s_chairMask; private Chair m_seat; private float m_seatSearchAt; private float m_seatWorkCheckAt; private bool m_noSeat; private float m_throneBanUntil; private float m_throneLeaveAt; private readonly Dictionary<long, float> m_caughtBy = new Dictionary<long, float>(); internal static readonly int OvertimeKey; internal static readonly int OvertimeDayKey; internal static readonly int BurnoutDayKey; internal static readonly int BonusAskDayKey; internal static readonly int BonusPaidDayKey; internal static readonly int SulkDayKey; private const float WatchDistance = 20f; private const int OvertimeToBurnout = 4; private const int BonusAfterActions = 60; private float m_watchCheckAt; private bool m_ownerWatching; private bool m_lazyBreak; private float m_shamedUntil; private float m_shameCheckAt; private bool m_cheerNear; private float m_cheerCheckAt; private float m_cheerSayAt; private float m_drunkUntil; private float m_songAt; private float m_drunkEmoteAt; private float m_staggerSeed = -1f; private float m_seatedSince = -1f; private bool m_dozing; private float m_snoreAt; private float m_dozeWakeAt; private float m_darkSayAt; private float m_characterAt; private int m_actionsDay = -1; private int m_actionsToday; private int m_luckyDay = -1; private int m_luckyToday; private static readonly (string prefab, int weight)[] LuckyFinds; private static readonly Dictionary<long, (float until, Vector3 at)> s_warCry; private static readonly Dictionary<long, float> s_volley; private static readonly FieldRef<Projectile, Character> s_projectileOwner; private float m_combatPart5At; private float m_coverSayAt; private float m_waterIgnoreUntil; private Character m_counterWatch; private float m_counterWatchUntil; private float m_tankSwapAt; private static readonly List<Projectile> s_liveProjectiles; internal static readonly int CombatRoleKey; public static readonly CombatRole[] CombatRoles; private static readonly string[][] MeleeWeapons; private static readonly string[][] TankWeapons; private static readonly string[][] ArcherWeapons; private static readonly string[][] HealerWeapons; private static readonly string[][] MageWeapons; private static readonly string[][] BerserkerWeapons; private const float TauntRange = 10f; private const float HealRange = 15f; private float m_nextTaunt; private float m_nextTauntLine; private float m_nextHeal; private VikingNpc m_reviveTarget; private Player m_revivePlayer; private float m_reviveStartedAt = -1f; private const float ReviveRange = 25f; internal static readonly int FormationShapeKey; internal static readonly int SpecsKey; private float m_crewRepairAt; private float m_crewSayAt; private static ZDOID s_lastFocus; private static float s_lastFocusAt; private static readonly Dictionary<string, Spec[][]> SpecTable; private static readonly int[] SpecLevels; private float m_combatExtrasAt; private float m_retreatReadyAt; private float m_berryAt; private float m_berryLootUntil; private float m_returnCheckAt; private Vector3? m_depositCenter; private int m_greetDay = -1; private bool m_wasDownedLocal; private float m_woundSoundAt; private static float s_buildSayAt; private static float s_fallSayAt; private static float s_swimSayAt; private static bool s_ownerWasSwimming; private static float s_swimCheckAt; private static readonly FieldInfo s_vagonsField; private static object s_woundClip; private static Type s_clipType; internal static readonly int CookRecipesKey; private static List<Recipe> s_cookRecipes; private static int s_cookRecipesCount; private const float BossPanicRange = 60f; private float m_nextBossCheck; private static readonly Func<CookingStation, bool> s_stationHasDone; private static readonly Func<CookingStation, int> s_stationFreeSlot; private static readonly Func<CookingStation, bool> s_stationFireLit; private static readonly Func<CookingStation, bool> s_stationHasUncooked; private CookingStation m_watchStation; private static HashSet<string> s_preyNames; private static string s_preyConfig; private readonly HashSet<string> m_supplies = new HashSet<string>(); private readonly Dictionary<ZDOID, float> m_fedAt = new Dictionary<ZDOID, float>(); private Character m_prey; private float m_preySince; private Vector3 m_huntedPos; private float m_huntedAt = -1000f; private const float PreyGiveUpSeconds = 60f; private const float HuntEngageDistance = 20f; private const float HuntEngageDistanceShy = 32f; private bool m_huntZone; private readonly Dictionary<string, SortMove> m_sortMoves = new Dictionary<string, SortMove>(); internal static readonly bool DefenseEnabled; private const float ThreatRange = 4.5f; private const float ThreatAngle = 55f; private const float DefenseCooldown = 1.3f; private const float BlockSeconds = 0.8f; private const float DodgeSeconds = 0.4f; private const float DodgeInvulnerable = 0.35f; private static readonly FieldRef<Character, bool> s_blockingField; private static readonly Func<Humanoid, ItemData> s_currentBlocker; private float m_defenseReadyAt; private float m_blockUntil; private float m_dodgeUntil; private float m_invulnerableUntil; private Vector3 m_dodgeDir; private Character m_threat; private float m_reactAt; private float m_nextThreatScan; private const float DoorRouteCheckSeconds = 1.5f; private const float DoorSearchRadius = 20f; private const float DoorSideOffset = 1.1f; private static readonly List<Piece> s_nearPieces; private Door m_routeDoor; private Vector3 m_routeGoal; private Vector3 m_routeNear; private Vector3 m_routeFar; private int m_routeStage; private float m_routeStageSince; private float m_nextRouteCheck; private static readonly Dictionary<string, Vector3> s_doorCenters; private static readonly Dictionary<string, bool> s_windows; private static int s_roofMask; private const float EmoteReactRadius = 20f; private static readonly List<QueuedSpeech> s_globalSpeech; private static float s_nextSpeechAt; private static readonly Dictionary<string, (string emote, string line)> s_emoteReactions; private string m_pendingEmote; private float m_pendingEmoteAt; private float m_emotePauseUntil; private float m_sitUntil; private float m_emoteStopAt; private ZDOID m_emoteFrom; private static readonly int s_emoteTag; private static readonly int s_emoteStopHash; private static readonly HashSet<string> s_loopingEmotes; internal static readonly int FactionKey; internal static readonly int NpcRoleKey; internal static readonly int NpcRadiusKey; internal static readonly int SurrenderedKey; internal static readonly int SurrenderedAtKey; internal static readonly int FormerOutlawKey; private static readonly int OutlawProgressionKey; internal static readonly int BetrayAtKey; internal static readonly int PoachTriedKey; private float m_npcCareAt; private bool m_surrenderRolled; private float m_kneelAt; private float m_feudSyncAt; private const float TilledCacheSeconds = 30f; private const int SpotChecksPerSearch = 400; private static readonly Dictionary<Vector3Int, (float at, List<Vector3> cells)> s_tilledCells; private static int s_growSpaceMask; private float m_tilledSearchAt; private float m_noTilledSeedsSayAt; private string m_tilledProblem; private float m_sowLogAt; private static readonly Dictionary<Vector3Int, int> s_tilledLogged; private readonly Dictionary<Vector3Int, float> m_badSowSpots = new Dictionary<Vector3Int, float>(); private static readonly List<Container> s_unreachableChests; private string m_seedsOutOfReach; private const float BeyondRingMeters = 20f; private static readonly List<Heightmap> s_heightmapBuffer; private static readonly Dictionary<Vector3Int, float> s_fieldReach; internal static readonly int FarmSkipKey; internal static readonly int TreeSkipKey; private static readonly Vector2[] s_sowOffsets; private float m_noSpotLogAt; private float m_farmIdleLogAt; internal static readonly int FieldKindKey; internal static readonly int FieldCenterKey; internal static readonly int FieldRadiusKey; internal static readonly int MimicKey; private const float ChopRadius = 20f; private const float BreakRadius = 4f; private const float BreakWoodRadius = 8f; internal const float MimicRange = 30f; private static ZDOID s_lastMimicTarget; private static float s_lastMimicAt; private const float FireLookAhead = 2.5f; private const float FireScanSeconds = 1f; private const float FireScanRange = 15f; private const float FireOrbitGiveUp = 5f; private readonly List<(EffectArea area, float radius)> m_fires = new List<(EffectArea, float)>(); private float m_nextFireScan; private EffectArea m_orbitFire; private float m_orbitSince; private EffectArea m_ignoredFire; private float m_ignoredFireUntil; private Vector3 m_moveGoal; private float m_moveGoalAt = -10f; private const float CastSeconds = 5f; private const int CastsPerSpot = 12; private const float CatchChance = 0.12f; private const float BaitBonus = 0.18f; private const float FishSpotCacheSeconds = 300f; private const float EmptyFishSpotCacheSeconds = 20f; private const float MinFishingDepth = 0.55f; private const float MaxWaterFromBank = 10f; private static readonly Dictionary<Vector3Int, (float at, List<(Vector3 stand, Vector3 water)> spots)> s_fishSpots; private int m_fishCasts; private const string GravePrefab = "Player_tombstone"; internal static readonly int MasteryKey; internal static readonly int PrestigeKey; private static readonly int[] MasteryThresholds; private string m_masteryRaw; private readonly Dictionary<int, int> m_mastery = new Dictionary<int, int>(); private int m_workXpCounter; private float m_guardWatchAt; private int m_patrolIndex = -1; private float m_guardsOnDutyAt; private bool m_guardsOnDuty; private static readonly Dictionary<Vector3Int, (List<Vector3> points, float at)> s_patrolRings; private const float GuardChaseMargin = 12f; private const float GuardSpotRange = 40f; private const float AlarmChaseSeconds = 40f; private float m_guardAlert; private float m_alarmChase; private float m_alarmUntil; private float m_guardTurnUntil; private bool m_guardTraining; internal static readonly int GuardAssignKey; internal static readonly int GuardPostKey; private List<Vector3> m_guardPoints; private float m_guardPointsAt; private int m_routeStep = 1; private float m_postLookAt; internal static readonly int GuardShiftPrefKey; private GuardShift m_guardShift; private float m_guardShiftAt; private float m_loneGuardGrumbleAt; private const float HealerSafeDistance = 6f; private const float HealerLeash = 18f; private static GameObject s_glowHolder; private Character m_healerThreat; private float m_healerScanAt; private Transform m_glow; private Vector3 m_glowVelocity; private float m_glowCheckAt; private bool m_glowWanted; private Color m_glowColor; internal static readonly int BedUserKey; internal static readonly int BedIdKey; internal static readonly int HomeRotKey; internal static readonly int SleepingKey; internal static readonly int GoingHomeKey; internal static readonly int GoingHomeSinceKey; internal static readonly int BedClaimUserKey; internal static readonly int BedClaimIdKey; internal static readonly int BedClaimNameKey; internal static readonly int BaseKey; internal static readonly int HasBaseKey; internal static readonly int BaseUserKey; internal static readonly int BaseIdKey; internal static readonly int BaseNameKey; private const float BedSearchRadius = 15f; private const float LeaveTimeoutSeconds = 25f; private static int s_pieceMask; private float m_bedSearchTimer; private float m_nearBedSince; private float m_homeCheckAt; private float m_relinkAt; private bool m_bedLostCache; private bool m_bannerLostCache; private float m_bedRoomCheckAt; private Animator m_bedAnimator; private bool m_bedPoseLogged; private float m_sleepPoseSince; private const float SightingRange = 30f; private const float HunterSightRange = 40f; private const float TellRange = 6f; private const int MaxSightings = 8; private readonly List<ZDOID> m_sightings = new List<ZDOID>(); private readonly List<ZDOID> m_knownPrey = new List<ZDOID>(); private float m_sightScanAt; private float m_preyScanAt; private float m_tellAt; private float m_thanksAt; internal static readonly int HuntSkipKey; private HashSet<string> m_huntSkip; private float m_huntSkipAt; internal static readonly int KillsKey; internal static readonly int BossKillsKey; internal static readonly int WorkDoneKey; internal static readonly int HiredAtKey; private int m_rainSayDay = -1; private float m_whisperAt; private float m_coinAt; private static readonly string[] Tutorials; private static float s_tutorialAt; private static Tutorial s_tutorialFilled; private static readonly float[] LavaAngles; private static readonly float[] LavaEscapeRings; private const float LavaSenseSeconds = 0.12f; private float m_lavaSenseAt; private Vector3 m_lavaDesired; private Vector3 m_lavaChoice; private Vector3 m_lastLavaSafe; private bool m_haveLavaSafe; private float m_lavaRescueUntil; private float m_lavaLogAt; private float m_lavaBlockLogAt; internal static readonly int LookVersionKey; internal static readonly int HeightKey; internal static readonly int BuildKey; internal static readonly int AgeKey; internal static readonly int OriginKey; internal static readonly int OutfitKey; internal static readonly int OutfitChoiceKey; internal static readonly int HatDefaultKey; internal static readonly int HatChoiceKey; internal static readonly int ShieldStyleKey; private const int LookVersion = 1; internal static readonly string[] Outfits; internal static readonly string[] Hats; private static readonly int[] HeadscarfHats; private static readonly int[] CapHats; private static readonly Vector3 Platinum; private static readonly Vector3 Blond; private static readonly Vector3 Golden; private static readonly Vector3 Strawberry; private static readonly Vector3 Ginger; private static readonly
plugins/ValheimNpc.Companions.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Jotunn.Utils; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ValheimNpc.Companions")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6b9e785656b96cff4d40cb3e4edf87ef8774a356")] [assembly: AssemblyProduct("ValheimNpc.Companions")] [assembly: AssemblyTitle("ValheimNpc.Companions")] [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] [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 ValheimNpc.Modules { internal static class ModuleVersion { public const string Value = "1.6.7"; } [BepInPlugin("com.valheimnpc.vikings.companions", "Vikings for Hire - Companions", "1.6.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class CompanionsModule : BaseUnityPlugin { public const string Guid = "com.valheimnpc.vikings.companions"; public const string Name = "Vikings for Hire - Companions"; private const string What = "спутники: идут с тобой, приказы и колесо (Y), отряд, корабли и порталы"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Модуль включён — спутники: идут с тобой, приказы и колесо (Y), отряд, корабли и порталы"); } } }
plugins/ValheimNpc.Settlement.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Jotunn.Utils; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ValheimNpc.Settlement")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6b9e785656b96cff4d40cb3e4edf87ef8774a356")] [assembly: AssemblyProduct("ValheimNpc.Settlement")] [assembly: AssemblyTitle("ValheimNpc.Settlement")] [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] [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 ValheimNpc.Modules { internal static class ModuleVersion { public const string Value = "1.6.7"; } [BepInPlugin("com.valheimnpc.vikings.settlement", "Vikings for Hire - Settlement", "1.6.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class SettlementModule : BaseUnityPlugin { public const string Guid = "com.valheimnpc.vikings.settlement"; public const string Name = "Vikings for Hire - Settlement"; private const string What = "своё поселение: знамя, профессии и работа, дома, жизнь поселения"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Модуль включён — своё поселение: знамя, профессии и работа, дома, жизнь поселения"); } } }
plugins/ValheimNpc.Factions.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Jotunn.Utils; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ValheimNpc.Factions")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6b9e785656b96cff4d40cb3e4edf87ef8774a356")] [assembly: AssemblyProduct("ValheimNpc.Factions")] [assembly: AssemblyTitle("ValheimNpc.Factions")] [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] [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 ValheimNpc.Modules { internal static class ModuleVersion { public const string Value = "1.6.7"; } [BepInPlugin("com.valheimnpc.vikings.factions", "Vikings for Hire - Factions", "1.6.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class FactionsModule : BaseUnityPlugin { public const string Guid = "com.valheimnpc.vikings.factions"; public const string Name = "Vikings for Hire - Factions"; private const string What = "чужие поселения и фракции: хутора бондов, стоянки изгоев, разбойники"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Модуль включён — чужие поселения и фракции: хутора бондов, стоянки изгоев, разбойники"); } } }
plugins/ValheimNpc.Traders.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Jotunn.Utils; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ValheimNpc.Traders")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6b9e785656b96cff4d40cb3e4edf87ef8774a356")] [assembly: AssemblyProduct("ValheimNpc.Traders")] [assembly: AssemblyTitle("ValheimNpc.Traders")] [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] [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 ValheimNpc.Modules { internal static class ModuleVersion { public const string Value = "1.6.7"; } [BepInPlugin("com.valheimnpc.vikings.traders", "Vikings for Hire - Traders", "1.6.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class TradersModule : BaseUnityPlugin { public const string Guid = "com.valheimnpc.vikings.traders"; public const string Name = "Vikings for Hire - Traders"; private const string What = "торговцы: бродячие и в поселении, заказы, долги"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Модуль включён — торговцы: бродячие и в поселении, заказы, долги"); } } }
plugins/ValheimNpc.World.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Jotunn.Utils; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ValheimNpc.World")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6b9e785656b96cff4d40cb3e4edf87ef8774a356")] [assembly: AssemblyProduct("ValheimNpc.World")] [assembly: AssemblyTitle("ValheimNpc.World")] [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] [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 ValheimNpc.Modules { internal static class ModuleVersion { public const string Value = "1.6.7"; } [BepInPlugin("com.valheimnpc.vikings.world", "Vikings for Hire - World Events", "1.6.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class WorldModule : BaseUnityPlugin { public const string Guid = "com.valheimnpc.vikings.world"; public const string Name = "Vikings for Hire - World Events"; private const string What = "события мира: охотники за головами, поручения, отшельник, поединки, беженцы, кузнец, сияние"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Модуль включён — события мира: охотники за головами, поручения, отшельник, поединки, беженцы, кузнец, сияние"); } } }