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.3.9
ValheimNpc.dll
Decompiled 12 hours 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 { 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}"); } } } internal static class BountyHunters { private static float s_timer; public static void Update(Player player, float deltaTime) { if (!Plugin.BountyEnabled.Value) { return; } s_timer += deltaTime; if (!(s_timer < Plugin.BountyIntervalMinutes.Value * 60f)) { s_timer = 0f; int num = Reputation.Get(player); if (num <= Plugin.BountyTrustThreshold.Value && !((Character)player).IsDead() && !((Character)player).InInterior() && !((Character)player).IsTeleporting() && !HasActiveHunters(player) && !(Random.value * 100f > Plugin.BountyChance.Value)) { Spawn(player, num); } } } public static bool HasActiveHunters(Player player) { foreach (VikingNpc item in VikingNpc.All) { if (item.IsBountyHunter() && (Object)(object)item.GetHuntTarget(float.MaxValue) == (Object)(object)player) { return true; } } return false; } public static int Spawn(Player player, int trust) { //IL_0013: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_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) if ((Object)(object)NpcPrefab.Prefab == (Object)null || !TryFindSpot(((Component)player).transform.position, out var spot)) { return 0; } int num = Mathf.Max(0, Plugin.BountyTrustThreshold.Value - trust); int num2 = Mathf.Clamp(1 + num / 25, 1, Plugin.BountyMaxHunters.Value); int level = Mathf.Clamp(1 + num / 10, 1, Plugin.MaxLevel.Value); for (int i = 0; i < num2; i++) { Vector3 val = spot + new Vector3(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f)); Object.Instantiate<GameObject>(NpcPrefab.Prefab, val, Quaternion.LookRotation(((Component)player).transform.position - val)).GetComponent<VikingNpc>()?.MakeBountyHunter(player, level); } ((Character)player).Message((MessageType)2, "$vnpc_msg_bounty_arrived", 0, (Sprite)null, false); return num2; } private static bool TryFindSpot(Vector3 center, out Vector3 spot) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0030: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0051: 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_009d: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 20; i++) { Vector3 val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f) * Vector3.forward; Vector3 val2 = center + val * Random.Range(35f, 55f); float solidHeight = ZoneSystem.instance.GetSolidHeight(val2); if (solidHeight > ZoneSystem.instance.m_waterLevel + 0.5f) { spot = new Vector3(val2.x, solidHeight + 0.5f, val2.z); return true; } } spot = Vector3.zero; return false; } } internal class SpawnVikingCommand : ConsoleCommand { public override string Name => "vnpc_spawn"; public override string Help => "[count] - spawn wandering vikings in front of you (Valheim NPC)"; public override bool IsCheat => true; public override void Run(string[] args) { int count = 1; if (args.Length != 0 && int.TryParse(args[0], out var result)) { count = result; } int num = VikingSpawner.SpawnInFront(Player.m_localPlayer, count); Console.instance.Print((num > 0) ? $"Викингов создано: {num}" : "Нет игрока или префаб викинга не создан"); } } internal class TrustCommand : ConsoleCommand { public override string Name => "vnpc_trust"; public override string Help => "[value] - show or set your trust among vikings (Valheim NPC)"; public override bool IsCheat => true; public override void Run(string[] args) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { if (args.Length != 0 && int.TryParse(args[0], out var result)) { Reputation.ApplyLocal(localPlayer, result - Reputation.Get(localPlayer), "$vnpc_reason_console"); } int num = Reputation.Get(localPlayer); Console.instance.Print($"Доверие: {num} ({Localization.instance.Localize(Reputation.Title(num))}), срок обещания: {Reputation.ContractDays(num)} дн."); } } } internal class SleeplessCommand : ConsoleCommand { public override string Name => "vnpc_sleepless"; public override string Help => "[nights 0-3] - set sleepless nights for your workers within 20 m (Valheim NPC)"; public override bool IsCheat => true; public override void Run(string[] args) { if (!((Object)(object)Player.m_localPlayer == (Object)null)) { int result; int sleepless = ((args.Length == 0 || !int.TryParse(args[0], out result)) ? 1 : result); Console.instance.Print(Localization.instance.Localize(TestTools.SetSleepless(sleepless))); } } } internal class TraderCommand : ConsoleCommand { public override string Name => "vnpc_trader"; public override string Help => "- spawn a wandering trader in front of you (Valheim NPC)"; public override bool IsCheat => true; public override void Run(string[] args) { Console.instance.Print(Localization.instance.Localize(TestTools.SpawnTrader())); } } internal class BountyCommand : ConsoleCommand { public override string Name => "vnpc_bounty"; public override string Help => "- send bounty hunters after you right now (Valheim NPC)"; public override bool IsCheat => true; public override void Run(string[] args) { if (!((Object)(object)Player.m_localPlayer == (Object)null)) { Console.instance.Print(Localization.instance.Localize(TestTools.SendBounty())); } } } internal static class DebugMaterial { private static Material s_material; public static Material Get() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown if ((Object)(object)s_material == (Object)null) { Shader val = Shader.Find("Hidden/Internal-Colored"); if ((Object)(object)val != (Object)null) { s_material = new Material(val) { hideFlags = (HideFlags)61 }; s_material.SetInt("_SrcBlend", 5); s_material.SetInt("_DstBlend", 10); s_material.SetInt("_Cull", 0); s_material.SetInt("_ZWrite", 0); s_material.SetInt("_ZTest", 8); s_material.renderQueue = 4000; } else { val = Shader.Find("Sprites/Default"); if ((Object)(object)val != (Object)null) { s_material = new Material(val); } } } return s_material; } } internal sealed class LinePool { private readonly string m_name; private readonly List<LineRenderer> m_lines = new List<LineRenderer>(); private GameObject m_root; private int m_used; public LinePool(string name) { m_name = name; } public void Begin() { m_used = 0; } public void Line(Vector3 a, Vector3 b, Color color, float width) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) LineRenderer obj = Next(color, width); obj.positionCount = 2; obj.SetPosition(0, a); obj.SetPosition(1, b); } public void Polyline(List<Vector3> points, Color color, float width, Vector3 lift) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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) if (points != null && points.Count >= 2) { LineRenderer val = Next(color, width); val.positionCount = points.Count; for (int i = 0; i < points.Count; i++) { val.SetPosition(i, points[i] + lift); } } } public void End() { for (int i = m_used; i < m_lines.Count; i++) { if ((Object)(object)m_lines[i] != (Object)null && ((Component)m_lines[i]).gameObject.activeSelf) { ((Component)m_lines[i]).gameObject.SetActive(false); } } } public void Clear() { Begin(); End(); } private LineRenderer Next(Color color, float width) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_00c8: 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_00ca: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_root == (Object)null) { m_root = new GameObject(m_name); m_lines.Clear(); } if (m_used >= m_lines.Count) { GameObject val = new GameObject("Line"); val.transform.SetParent(m_root.transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.useWorldSpace = true; ((Renderer)val2).material = DebugMaterial.Get(); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; val2.numCapVertices = 1; m_lines.Add(val2); } LineRenderer obj = m_lines[m_used++]; ((Component)obj).gameObject.SetActive(true); obj.widthMultiplier = width; Color startColor = (obj.endColor = color); obj.startColor = startColor; return obj; } } 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 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 bool Private; public float At; public bool Empty { get { if (!Private && Kinds.Count == 0) { return Words.Count == 0; } return false; } } } 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 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); 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; private const float AlarmRange = 60f; private const float WorkerThreatRange = 14f; private const float WorkerAlertedRange = 8f; private float m_helpCallAt; private float m_guardReplyAt; private const float AssaultSeconds = 90f; private const float AssaultClearRadius = 15f; private const float AssaultAlertRange = 60f; private static readonly FieldRef<MonsterAI, Vector3> s_lastKnownTargetPos = AccessTools.FieldRefAccess<MonsterAI, Vector3>("m_lastKnownTargetPos"); private static readonly FieldRef<MonsterAI, bool> s_beenAtLastPos = AccessTools.FieldRefAccess<MonsterAI, bool>("m_beenAtLastPos"); private static readonly FieldRef<MonsterAI, float> s_timeSinceSensed = AccessTools.FieldRefAccess<MonsterAI, float>("m_timeSinceSensedTargetCreature"); 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 = -1f; private static int s_recentDeaths; private static float s_recentDeathsAt; private static readonly Dictionary<ZDOID, float> s_bossesAnnounced = new Dictionary<ZDOID, float>(); private const int StoryCount = 6; private static readonly Regex s_jarlWord = new Regex("\\b(ярл|jarl)\\b", RegexOptions.IgnoreCase | RegexOptions.Compiled); 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 = new Dictionary<Chair, VikingNpc>(); 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 = StringExtensionMethods.GetStableHashCode("vnpc_overtime"); internal static readonly int OvertimeDayKey = StringExtensionMethods.GetStableHashCode("vnpc_overtime_day"); internal static readonly int BurnoutDayKey = StringExtensionMethods.GetStableHashCode("vnpc_burnout_day"); internal static readonly int BonusAskDayKey = StringExtensionMethods.GetStableHashCode("vnpc_bonus_ask_day"); internal static readonly int BonusPaidDayKey = StringExtensionMethods.GetStableHashCode("vnpc_bonus_paid_day"); internal static readonly int SulkDayKey = StringExtensionMethods.GetStableHashCode("vnpc_sulk_day"); 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 = new(string, int)[5] { ("Amber", 40), ("AmberPearl", 25), ("Ruby", 15), ("SilverNecklace", 10), ("Coins", 10) }; private static readonly Dictionary<long, (float until, Vector3 at)> s_warCry = new Dictionary<long, (float, Vector3)>(); private static readonly Dictionary<long, float> s_volley = new Dictionary<long, float>(); private static readonly FieldRef<Projectile, Character> s_projectileOwner = AccessTools.FieldRefAccess<Projectile, Character>("m_owner"); 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 = new List<Projectile>(); internal static readonly int CombatRoleKey = StringExtensionMethods.GetStableHashCode("vnpc_combat_role"); public static readonly CombatRole[] CombatRoles = new CombatRole[7] { CombatRole.Auto, CombatRole.Melee, CombatRole.Tank, CombatRole.Archer, CombatRole.Healer, CombatRole.Mage, CombatRole.Berserker }; private static readonly string[][] MeleeWeapons = new string[8][] { new string[1] { "AxeFlint|Club" }, new string[1] { "SwordBronze|AxeBronze" }, new string[1] { "SwordIron|MaceIron|AxeIron" }, new string[1] { "SwordSilver|MaceSilver" }, new string[1] { "SwordBlackmetal|AxeBlackMetal" }, new string[1] { "SwordMistwalker|AxeJotunBane" }, new string[1] { "SwordNiedhogg|MaceEldner|SwordMistwalker" }, new string[1] { "SwordNiedhogg|MaceEldner|SwordMistwalker" } }; private static readonly string[][] TankWeapons = new string[8][] { new string[2] { "Club", "ShieldWood" }, new string[2] { "MaceBronze|SwordBronze", "ShieldBronzeBuckler|ShieldWood" }, new string[2] { "MaceIron|SwordIron", "ShieldBanded|ShieldIronSquare" }, new string[2] { "MaceSilver|SwordSilver", "ShieldSilver" }, new string[2] { "SwordBlackmetal|MaceNeedle", "ShieldBlackmetal" }, new string[2] { "SwordMistwalker|MaceNeedle", "ShieldCarapace|ShieldBlackmetal" }, new string[2] { "MaceEldner|SwordNiedhogg|SwordMistwalker", "ShieldFlametal|ShieldCarapace" }, new string[2] { "MaceEldner|SwordNiedhogg|SwordMistwalker", "ShieldFlametal|ShieldCarapace" } }; private static readonly string[][] ArcherWeapons = new string[8][] { new string[2] { "Bow", "ArrowWood" }, new string[2] { "BowFineWood|Bow", "ArrowBronze|ArrowFlint" }, new string[2] { "BowHuntsman|BowFineWood", "ArrowIron" }, new string[2] { "BowDraugrFang|BowHuntsman", "ArrowObsidian|ArrowIron" }, new string[2] { "BowDraugrFang", "ArrowNeedle|ArrowObsidian" }, new string[2] { "BowSpineSnap|BowDraugrFang", "ArrowCarapace|ArrowNeedle" }, new string[2] { "BowAshlands|BowSpineSnap", "ArrowCharred|ArrowCarapace" }, new string[2] { "BowAshlands|BowSpineSnap", "ArrowCharred|ArrowCarapace" } }; private static readonly string[][] HealerWeapons = ArcherWeapons; private static readonly string[][] MageWeapons = new string[8][] { new string[0], new string[0], new string[0], new string[0], new string[0], new string[1] { "StaffFireball|StaffIceShards" }, new string[1] { "StaffLightning|StaffFireball" }, new string[1] { "StaffLightning|StaffFireball" } }; private static readonly string[][] BerserkerWeapons = new string[8][] { new string[1] { "Club" }, new string[1] { "AtgeirBronze|AxeBronze" }, new string[1] { "Battleaxe|AtgeirIron" }, new string[1] { "Battleaxe|MaceSilver" }, new string[1] { "THSwordKrom|AtgeirBlackmetal|Battleaxe" }, new string[1] { "BattleaxeCrystal|THSwordKrom" }, new string[1] { "THSwordSlayer|BattleaxeCrystal|THSwordKrom" }, new string[1] { "THSwordSlayer|BattleaxeCrystal|THSwordKrom" } }; 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 = StringExtensionMethods.GetStableHashCode("vnpc_formation_shape"); internal static readonly int SpecsKey = StringExtensionMethods.GetStableHashCode("vnpc_specs"); 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 = new Dictionary<string, Spec[][]> { { "fighter", new Spec[2][] { new Spec[2] { new Spec { Id = "slasher", Damage = 1.15f }, new Spec { Id = "tough", Health = 1.2f } }, new Spec[2] { new Spec { Id = "blademaster", Damage = 1.15f }, new Spec { Id = "unbending", Taken = 0.85f } } } }, { "tank", new Spec[2][] { new Spec[2] { new Spec { Id = "wall", Taken = 0.85f }, new Spec { Id = "bully", Taunt = 1.5f } }, new Spec[2] { new Spec { Id = "bastion", Taken = 0.85f, Health = 1.1f }, new Spec { Id = "brute", Damage = 1.2f } } } }, { "archer", new Spec[2][] { new Spec[2] { new Spec { Id = "sniper", Damage = 1.2f }, new Spec { Id = "dodger", Taken = 0.85f } }, new Spec[2] { new Spec { Id = "assassin", Damage = 1.2f }, new Spec { Id = "survivor", Health = 1.2f } } } }, { "healer", new Spec[2][] { new Spec[2] { new Spec { Id = "mender", Heal = 1.5f }, new Spec { Id = "steady", Health = 1.25f } }, new Spec[2] { new Spec { Id = "grace", Heal = 1.5f }, new Spec { Id = "battlemedic", Damage = 1.3f } } } }, { "mage", new Spec[2][] { new Spec[2] { new Spec { Id = "destroyer", Damage = 1.2f }, new Spec { Id = "sage", Health = 1.2f } }, new Spec[2] { new Spec { Id = "archmage", Damage = 1.2f }, new Spec { Id = "spiritshield", Taken = 0.8f } } } }, { "berserker", new Spec[2][] { new Spec[2] { new Spec { Id = "fury", Damage = 1.15f }, new Spec { Id = "bloodthirst", Lifesteal = 0.1f } }, new Spec[2] { new Spec { Id = "frenzy", Damage = 1.15f }, new Spec { Id = "steelskin", Taken = 0.85f } } } } }; private static readonly int[] SpecLevels = new int[2] { 10, 20 }; 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 = AccessTools.Field(typeof(Vagon), "m_instances"); private static object s_woundClip; private static Type s_clipType; private const float BossPanicRange = 60f; private float m_nextBossCheck; private static readonly Func<CookingStation, bool> s_stationHasDone = AccessTools.MethodDelegate<Func<CookingStation, bool>>(AccessTools.Method(typeof(CookingStation), "HaveDoneItem", (Type[])null, (Type[])null), (object)null, true); private static readonly Func<CookingStation, int> s_stationFreeSlot = AccessTools.MethodDelegate<Func<CookingStation, int>>(AccessTools.Method(typeof(CookingStation), "GetFreeSlot", (Type[])null, (Type[])null), (object)null, true); private static readonly Func<CookingStation, bool> s_stationFireLit = AccessTools.MethodDelegate<Func<CookingStation, bool>>(AccessTools.Method(typeof(CookingStation), "IsFireLit", (Type[])null, (Type[])null), (object)null, true); private static readonly Func<CookingStation, bool> s_stationHasUncooked = AccessTools.MethodDelegate<Func<CookingStation, bool>>(AccessTools.Method(typeof(CookingStation), "HaveUncookedItem", (Type[])null, (Type[])null), (object)null, true); 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 const float PreyGiveUpSeconds = 60f; private const float HuntEngageDistance = 20f; private bool m_huntZone; internal static readonly bool DefenseEnabled = false; 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 = AccessTools.FieldRefAccess<Character, bool>("m_blocking"); private static readonly Func<Humanoid, ItemData> s_currentBlocker = AccessTools.MethodDelegate<Func<Humanoid, ItemData>>(AccessTools.Method(typeof(Humanoid), "GetCurrentBlocker", (Type[])null, (Type[])null), (object)null, true); 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 = new List<Piece>(); 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 int s_roofMask; private const float EmoteReactRadius = 20f; private static readonly List<QueuedSpeech> s_globalSpeech = new List<QueuedSpeech>(); private static float s_nextSpeechAt; private static readonly Dictionary<string, (string emote, string line)> s_emoteReactions = new Dictionary<string, (string, string)> { { "wave", ("wave", "$vnpc_say_wave") }, { "sit", ("sit", "$vnpc_say_sit") }, { "challenge", ("challenge", "$vnpc_say_challenge") }, { "cheer", ("cheer", "$vnpc_say_cheer") }, { "nonono", ("shrug", "$vnpc_say_nonono") }, { "thumbsup", ("thumbsup", "$vnpc_say_thumbsup") }, { "point", ("thumbsup", "$vnpc_say_point") }, { "blowkiss", ("cower", "$vnpc_say_blowkiss") }, { "bow", ("bow", "$vnpc_say_bow") }, { "cower", ("laugh", "$vnpc_say_cower") }, { "cry", ("comehere", "$vnpc_say_cry") }, { "despair", ("shrug", "$vnpc_say_despair") }, { "flex", ("flex", "$vnpc_say_flex") }, { "comehere", ("thumbsup", "$vnpc_say_comehere") }, { "headbang", ("headbang", "$vnpc_say_headbang") }, { "kneel", ("kneel", "$vnpc_say_kneel") }, { "laugh", ("laugh", "$vnpc_say_laugh") }, { "roar", ("roar", "$vnpc_say_roar") }, { "shrug", ("shrug", "$vnpc_say_shrug") }, { "dance", ("dance", "$vnpc_say_dance") }, { "relax", ("relax", "$vnpc_say_relax") }, { "toast", ("toast", "$vnpc_say_toast") }, { "rest", ("rest", "$vnpc_say_rest") }, { "vibe", ("vibe", "$vnpc_say_vibe") }, { "loveyou", ("blowkiss", "$vnpc_say_loveyou") } }; 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 = ZSyncAnimation.GetHash("emote"); private static readonly int s_emoteStopHash = ZSyncAnimation.GetHash("emote_stop"); private static readonly HashSet<string> s_loopingEmotes = new HashSet<string> { "dance", "headbang", "vibe", "relax", "rest", "kneel", "toast", "cower", "flex" }; internal static readonly int FactionKey = StringExtensionMethods.GetStableHashCode("vnpc_faction"); internal static readonly int NpcRoleKey = StringExtensionMethods.GetStableHashCode("vnpc_npc_role"); internal static readonly int NpcRadiusKey = StringExtensionMethods.GetStableHashCode("vnpc_npc_radius"); internal static readonly int SurrenderedKey = StringExtensionMethods.GetStableHashCode("vnpc_surrendered"); internal static readonly int SurrenderedAtKey = StringExtensionMethods.GetStableHashCode("vnpc_surrendered_at"); internal static readonly int FormerOutlawKey = StringExtensionMethods.GetStableHashCode("vnpc_former_outlaw"); internal static readonly int BetrayAtKey = StringExtensionMethods.GetStableHashCode("vnpc_betray_at"); internal static readonly int PoachTriedKey = StringExtensionMethods.GetStableHashCode("vnpc_poach_tried"); private float m_npcCareAt; private bool m_surrenderRolled; private float m_kneelAt; private const float TilledCacheSeconds = 30f; private const int SpotChecksPerSearch = 400; private static readonly Dictionary<Vector3Int, (float at, List<Vector3> cells)> s_tilledCells = new Dictionary<Vector3Int, (float, List<Vector3>)>(); 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 = new Dictionary<Vector3Int, int>(); private readonly Dictionary<Vector3Int, float> m_badSowSpots = new Dictionary<Vector3Int, float>(); private static readonly List<Container> s_unreachableChests = new List<Container>(); private string m_seedsOutOfReach; private const float BeyondRingMeters = 20f; private static readonly List<Heightmap> s_heightmapBuffer = new List<Heightmap>(); private static readonly Dictionary<Vector3Int, float> s_fieldReach = new Dictionary<Vector3Int, float>(); private static readonly Vector2[] s_sowOffsets = (Vector2[])(object)new Vector2[4] { new Vector2(0.25f, 0.25f), new Vector2(0.75f, 0.25f), new Vector2(0.25f, 0.75f), new Vector2(0.75f, 0.75f) }; private float m_noSpotLogAt; private float m_farmIdleLogAt; internal static readonly int FieldKindKey = StringExtensionMethods.GetStableHashCode("vnpc_field_kind"); internal static readonly int FieldCenterKey = StringExtensionMethods.GetStableHashCode("vnpc_field_center"); internal static readonly int FieldRadiusKey = StringExtensionMethods.GetStableHashCode("vnpc_field_radius"); internal static readonly int MimicKey = StringExtensionMethods.GetStableHashCode("vnpc_mimic"); 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 = ZDOID.None; 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 = new Dictionary<Vector3Int, (float, List<(Vector3, Vector3)>)>(); private int m_fishCasts; internal static readonly int MasteryKey = StringExtensionMethods.GetStableHashCode("vnpc_mastery"); internal static readonly int PrestigeKey = StringExtensionMethods.GetStableHashCode("vnpc_prestige"); private static readonly int[] MasteryThresholds = new int[4] { 0, 100, 300, 700 }; 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 = new Dictionary<Vector3Int, (List<Vector3>, float)>(); 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 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 = StringExtensionMethods.GetStableHashCode("vnpc_bed_user"); internal static readonly int BedIdKey = StringExtensionMethods.GetStableHashCode("vnpc_bed_id"); internal static readonly int HomeRotKey = StringExtensionMethods.GetStableHashCode("vnpc_home_rot"); internal static readonly int SleepingKey = StringExtensionMethods.GetStableHashCode("vnpc_sleeping"); internal static readonly int GoingHomeKey = StringExtensionMethods.GetStableHashCode("vnpc_going_home"); internal static readonly int GoingHomeSinceKey = StringExtensionMethods.GetStableHashCode("vnpc_going_home_since"); internal static readonly int BedClaimUserKey = StringExtensionMethods.GetStableHashCode("vnpc_claim_user"); internal static readonly int BedClaimIdKey = StringExtensionMethods.GetStableHashCode("vnpc_claim_id"); internal static readonly int BedClaimNameKey = StringExtensionMethods.GetStableHashCode("vnpc_claim_name"); internal static readonly int BaseKey = StringExtensionMethods.GetStableHashCode("vnpc_base"); internal static readonly int HasBaseKey = StringExtensionMethods.GetStableHashCode("vnpc_has_base"); internal static readonly int BaseUserKey = StringExtensionMethods.GetStableHashCode("vnpc_base_user"); internal static readonly int BaseIdKey = StringExtensionMethods.GetStableHashCode("vnpc_base_id"); internal static readonly int BaseNameKey = StringExtensionMethods.GetStableHashCode("vnpc_base_name"); 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 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 KillsKey = StringExtensionMethods.GetStableHashCode("vnpc_kills"); internal static readonly int BossKillsKey = StringExtensionMethods.GetStableHashCode("vnpc_boss_kills"); internal static readonly int WorkDoneKey = StringExtensionMethods.GetStableHashCode("vnpc_work_done"); internal static readonly int HiredAtKey = StringExtensionMethods.GetStableHashCode("vnpc_hired_at"); private int m_rainSayDay = -1; private float m_whisperAt; private float m_coinAt; private static readonly string[] Tutorials = new string[5] { "vnpc_tut_hire", "vnpc_tut_squad", "vnpc_tut_settlement", "vnpc_tut_trader", "vnpc_tut_factions" }; private static float s_tutorialAt; private static Tutorial s_tutorialFilled; private static readonly float[] LavaAngles = new float[10] { 0f, -25f, 25f, -50f, 50f, -80f, 80f, -115f, 115f, 180f }; private static readonly float[] LavaEscapeRings = new float[5] { 1.5f, 3f, 5f, 8f, 12f }; 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; internal static readonly int LookVersionKey = StringExtensionMethods.GetStableHashCode("vnpc_look_v"); internal static readonly int HeightKey = StringExtensionMethods.GetStableHashCode("vnpc_height"); internal static readonly int BuildKey = StringExtensionMethods.GetStableHashCode("vnpc_build"); internal static readonly int AgeKey = StringExtensionMethods.GetStableHashCode("vnpc_age"); internal static readonly int OriginKey = StringExtensionMethods.GetStableHashCode("vnpc_origin"); internal static readonly int OutfitKey = StringExtensionMethods.GetStableHashCode("vnpc_outfit"); internal static readonly int OutfitChoiceKey = StringExtensionMethods.GetStableHashCode("vnpc_outfit_choice"); internal static readonly int HatDefaultKey = StringExtensionMethods.GetStableHashCode("vnpc_hat_default"); internal static readonly int HatChoiceKey = StringExtensionMethods.GetStableHashCode("vnpc_hat_choice"); internal static readonly int ShieldStyleKey = StringExtensionMethods.GetStableHashCode("vnpc_shield_style"); private const int LookVersion = 1; internal static readonly string[] Outfits = new string[20] { "ArmorTunic1", "ArmorTunic2", "ArmorTunic3", "ArmorTunic4", "ArmorTunic5", "ArmorTunic6", "ArmorTunic7", "ArmorTunic8", "ArmorTunic9", "ArmorTunic10", "ArmorDress1", "ArmorDress2", "ArmorDress3", "ArmorDress4", "ArmorDress5", "ArmorDress6", "ArmorDress7", "ArmorDress8", "ArmorDress9", "ArmorDress10" }; internal static readonly string[] Hats = new string[16] { "HelmetHat1", "HelmetHat2", "HelmetHat3", "HelmetHat4", "HelmetHat5", "HelmetHat6", "HelmetHat7", "HelmetHat8", "HelmetHat9", "HelmetHat10", "HelmetStrawHat|HelmetStrawhat", "HelmetFishingHat", "HelmetSweatBand", "HelmetPointyHat", "HelmetLeather", "HelmetTrollLeather" }; private static readonly int[] HeadscarfHats = new int[4] { 0, 1, 5, 6 }; private static readonly int[] CapHats = new int[6] { 2, 3, 4, 7, 8, 9 }; private static readonly Vector3 Platinum = new Vector3(1f, 0.95f, 0.8f); private static readonly Vector3 Blond = new Vector3(1f, 0.86f, 0.55f); private static readonly Vector3 Golden = new Vector3(0.95f, 0.72f, 0.38f); private static readonly Vector3 Strawberry = new Vector3(0.9f, 0.55f, 0.3f); private static readonly Vector3 Ginger = new Vector3(0.75f, 0.33f, 0.13f); private static readonly Vector3 AshBlond = new Vector3(0.75f, 0.68f, 0.55f); private static readonly Vector3 LightBrown = new Vector3(0.6f, 0.42f, 0.25f); private static readonly Vector3 Brown = new Vector3(0.42f, 0.28f, 0.17f); private static readonly Vector3 DarkBrown = new Vector3(0.25f, 0.17f, 0.11f); private static readonly Vector3 Black = new Vector3(0.1f, 0.08f, 0.07f); private static readonly Vector3 DarkRed = new Vector3(0.45f, 0.12f, 0.08f); private static readonly Vector3 SkinPale = new Vector3(1f, 1f, 1f); private static readonly Vector3 SkinFair = new Vector3(0.95f, 0.86f, 0.78f); private static readonly Vector3 SkinLight = new Vector3(0.86f, 0.72f, 0.6f); private static readonly Vector3 SkinTan = new Vector3(0.7f, 0.55f, 0.43f); private static readonly Vector3 SkinBrown = new Vector3(0.5f, 0.38f, 0.3f); private static readonly Vector3 SkinDark = new Vector3(0.38f, 0.28f, 0.22f); private static readonly Vector3 GreyHair = new Vector3(0.72f, 0.72f, 0.7f); private static readonly Vector3 WhiteHair = new Vector3(0.92f, 0.91f, 0.88f); private static readonly Vector3[][] HairByOrigin = new Vector3[8][] { (Vector3[])(object)new Vector3[7] { Blond, Golden, LightBrown, Brown, Strawberry, Ginger, DarkBrown }, (Vector3[])(object)new Vector3[6] { Brown, DarkBrown, LightBrown, Ginger, Blond, AshBlond }, (Vector3[])(object)new Vector3[4] { DarkBrown, Black, Brown, AshBlond }, (Vector3[])(object)new Vector3[5] { Platinum, Blond, AshBlond, Strawberry, Ginger }, (Vector3[])(object)new Vector3[4] { Golden, Blond, Strawberry, LightBrown }, (Vector3[])(object)new Vector3[4] { Black, DarkBrown, AshBlond, Brown }, (Vector3[])(object)new Vector3[4] { Black, DarkBrown, DarkRed, Ginger }, (Vector3[])(object)new Vector3[4] { Platinum, AshBlond, Blond, Strawberry } }; private static readonly Vector3[][] SkinByOrigin = new Vector3[8][] { (Vector3[])(object)new Vector3[3] { SkinPale, SkinFair, SkinLight }, (Vector3[])(object)new Vector3[3] { SkinPale, SkinFair, SkinLight }, (Vector3[])(object)new Vector3[3] { SkinFair, SkinLight, SkinTan }, (Vector3[])(object)new Vector3[2] { SkinPale, SkinFair }, (Vector3[])(object)new Vector3[3] { SkinLight, SkinTan, SkinBrown }, (Vector3[])(object)new Vector3[2] { SkinFair, SkinLight }, (Vector3[])(object)new Vector3[3] { SkinTan, SkinBrown, SkinDark }, (Vector3[])(object)new Vector3[2] { SkinPale, SkinFair } }; internal static readonly Vector3[] HairChoices = (Vector3[])(object)new Vector3[13] { Platinum, Blond, Golden, AshBlond, Strawberry, Ginger, DarkRed, LightBrown, Brown, DarkBrown, Black, GreyHair, WhiteHair }; internal static readonly Vector3[] SkinChoices = (Vector3[])(object)new Vector3[6] { SkinPale, SkinFair, SkinLight, SkinTan, SkinBrown, SkinDark }; private Transform m_visualRoot; private float m_scaleCheckAt; private Vector2 m_appliedScale = Vector2.one; private static readonly Action<Humanoid, VisEquipment, bool> s_setupVis = AccessTools.MethodDelegate<Action<Humanoid, VisEquipment, bool>>(AccessTools.Method(typeof(Humanoid), "SetupVisEquipment", (Type[])null, (Type[])null), (object)null, true); private float m_lookCheckAt; private string m_lookSignature; private static readonly Dictionary<string, string> s_itemNames = new Dictionary<string, string>(); private const float MapReplanSeconds = 2f; private const float MapPointReach = 0.45f; private readonly List<Vector3> m_mapPath = new List<Vector3>(); private int m_mapIndex; private Vector3 m_mapGoal; private float m_mapPlanAt; private float m_mapFailUntil; private Vector3 m_mapFailGoal; private float m_mapBest; private float m_mapLogAt; private NavMap.PathJob m_mapJob; private float m_mapOkLogAt; private float m_mapJumpAt; internal static readonly int SearchBonusKey = StringExtensionMethods.GetStableHashCode("vnpc_search_bonus"); internal static readonly int MinerIdleKey = StringExtensionMethods.GetStableHashCode("vnpc_miner_idle"); private float m_minerIdleSince = -1f; internal static readonly int MoodKey = StringExtensionMethods.GetStableHashCode("vnpc_mood"); internal static readonly int MopeUntilKey = StringExtensionMethods.GetStableHashCode("vnpc_mope_until"); private const float MoodStart = 60f; private const float MoodGood = 70f; private const float MoodBad = 30f; private const float MoodMope = 10f; private float m_moodAt; private float m_moodTarget = 60f; private float m_mopeSayAt; private float m_duetAt; private readonly List<(string token, float at)> m_sayQueue = new List<(string, float)>(); private float m_competeUntil; internal static readonly int NativeBiomeKey = StringExtensionMethods.GetStableHashCode("vnpc_native_biome"); private float m_biomeCheckAt; private bool m_inNativeBiome; private float m_animalsCheckAt; private bool m_animalsNear; private const float StuckSeconds = 5f; private const float DetourSeconds = 20f; private const float ArriveHeight = 1.8f; private object m_approachKey; private float m_approachBest; private float m_approachStuck; private Vector3 m_approachBestPos; private bool m_traveling; private const float MemoryReplanSeconds = 1f; private readonly List<Vector3> m_memoryPath = new List<Vector3>(); private int m_memoryIndex; private float m_memoryPlanAt; private Vector3 m_memoryGoal; private float m_memoryFailUntil; private readonly List<Vector3> m_stairRoute = new List<Vector3>(); private int m_stairIndex; private float m_stairPlanAt; private float m_stairSince; private const int TrappedGiveUps = 4; private const float TrappedWindow = 180f; private Vector3 m_giveUpSpot; private int m_giveUpCount; private float m_giveUpSince; private object m_teleportedFor; private const float NearDistance = 7f; private const float ProgressWindow = 1.2f; private const float SidestepSeconds = 0.6f; private static int s_obstacleMask; private float m_directUntil; private float m_modeCheckAt; private object m_modeKey; private bool m_modeDirect; private float m_lineCheckAt; private bool m_lineClear; private float m_lastApproachAt; private Vector3 m_progressPos; private float m_progressSince; private float m_sidestepUntil; private float m_unstickReadyAt; private Vector3 m_sidestepDir; private int m_sidestepSide = 1; private bool m_steppingBack; private float m_jumpedAt = -10f; private static int s_doorMask; private readonly List<(Door door, float openedAt)> m_openedDoors = new List<(Door, float)>(); private float m_nextDoorCheck; internal static readonly int LastMeadKey = StringExtensionMethods.GetStableHashCode("vnpc_last_mead"); internal static readonly int LastFoodKey = StringExtensionMethods.GetStableHashCode("vnpc_last_food"); private const float GrumbleRange = 25f; private const int MeadDryDays = 3; private const int FoodHungryDays = 1; private const float EveningStart = 0.66f; private const string FoodTaskMarker = "vnpc_food"; private float m_grumbleTimer = 60f; private int m_meadTriedDay = -1; private float m_foodRetryAt; internal static readonly int RumorDayKey = StringExtensionMethods.GetStableHashCode("vnpc_rumor_day"); internal static readonly int DreamDayKey = StringExtensionMethods.GetStableHashCode("vnpc_dream_day"); private const int VeteranStartLevel = 5; private float m_chatAt; private float m_lonerCheckAt; private float m_lonerPace = 1f; private float m_crowdSayAt; private float m_stormSayAt; private float m_amuletCheckAt; private bool m_amuletNear; private float m_inspiredUntil; private float m_dreamUntil; private float m_veteranCheckAt; private bool m_veteranNear; private float m_veteranSayAt; private static readonly Dictionary<string, string> RumorPlaces = new Dictionary<string, string> { { "Vendor_BlackForest", "$vnpc_rumor_haldor" }, { "Hildir_camp", "$vnpc_rumor_hildir" }, { "BogWitch_Camp", "$vnpc_rumor_bogwitch" }, { "Crypt2", "$vnpc_rumor_crypt" }, { "Crypt3", "$vnpc_rumor_crypt" }, { "Crypt4", "$vnpc_rumor_crypt" }, { "TrollCave02", "$vnpc_rumor_trollcave" }, { "SunkenCrypt4", "$vnpc_rumor_sunken" }, { "MountainCave02", "$vnpc_rumor_frostcave" }, { "Mistlands_DvergrTownEntrance1", "$vnpc_rumor_mine" }, { "Mistlands_DvergrTownEntrance2", "$vnpc_rumor_mine" }, { "Eikthyrnir", "$vnpc_rumor_altar" }, { "GDKing", "$vnpc_rumor_altar" }, { "Bonemass", "$vnpc_rumor_altar" }, { "Dragonqueen", "$vnpc_rumor_altar" }, { "GoblinKing", "$vnpc_rumor_altar" }, { "Mistlands_DvergrBossEntrance1", "$vnpc_rumor_altar" } }; private const float RumorRange = 1500f; private static readonly FieldRef<Minimap, List<PinData>> s_minimapPins = AccessTools.FieldRefAccess<Minimap, List<PinData>>("m_pins"); public const string DownedAnimation = "attach_bed"; private static readonly Dictionary<Character, VikingNpc> s_byCharacter = new Dictionary<Character, VikingNpc>(); private static readonly HashSet<Character> s_downed = new HashSet<Character>(); internal static readonly int InitKey = StringExtensionMethods.GetStableHashCode("vnpc_init"); internal static readonly int NameKey = StringExtensionMethods.GetStableHashCode("vnpc_name"); internal static readonly int TierKey = StringExtensionMethods.GetStableHashCode("vnpc_tier"); internal static readonly int OwnerIdKey = StringExtensionMethods.GetStableHashCode("vnpc_owner_id"); internal static readonly int OwnerNameKey = StringExtensionMethods.GetStableHashCode("vnpc_owner_name"); internal static readonly int FollowKey = StringExtensionMethods.GetStableHashCode("vnpc_follow"); internal static readonly int DownedKey = StringExtensionMethods.GetStableHashCode("vnpc_downed"); internal static readonly int DownedAtKey = StringExtensionMethods.GetStableHashCode("vnpc_downed_at"); internal static readonly int PortalPendingKey = StringExtensionMethods.GetStableHashCode("vnpc_portal_pending"); internal static readonly int PortalPosKey = StringExtensionMethods.GetStableHashCode("vnpc_portal_pos"); internal static readonly int DebtKey = StringExtensionMethods.GetStableHashCode("vnpc_debt"); internal static readonly int DebtDeadlineKey = StringExtensionMethods.GetStableHashCode("vnpc_debt_deadline"); internal static readonly int HostileToKey = StringExtensionMethods.GetStableHashCode("vnpc_hostile_to"); internal static readonly int HostileNameKey = StringExtensionMethods.GetStableHashCode("vnpc_hostile_name"); internal static readonly int VouchedKey = StringExtensionMethods.GetStableHashCode("vnpc_vouched"); internal static readonly int CheatedByKey = StringExtensionMethods.GetStableHashCode("vnpc_cheated_by"); internal static readonly int ReviveTrustAtKey = StringExtensionMethods.GetStableHashCode("vnpc_revive_trust_at"); internal static readonly int LevelKey = StringExtensionMethods.GetStableHashCode("vnpc_level"); internal static readonly int XpKey = StringExtensionMethods.GetStableHashCode("vnpc_xp"); internal static readonly int BountyKey = StringExtensionMethods.GetStableHashCode("vnpc_bounty"); internal static readonly int BountySeenKey = StringExtensionMethods.GetStableHashCode("vnpc_bounty_seen"); internal static readonly int LeaveAtKey = StringExtensionMethods.GetStableHashCode("vnpc_leave_at"); private static int s_hairCount = -1; private static int s_beardCount = -1; private ZNetView m_nview; private Humanoid m_character; private MonsterAI m_ai; private VisEquipment m_visEquipment; private ZSyncAnimation m_zanim; private Rigidbody m_body; private float m_updateTimer; private float m_fifthAt; private float m_lastTickAt = -1f; private float m_compatAt; private bool m_waitingForOwner; private float m_portalHoldTime; private Container m_backpack; private string m_gearSignature; private bool m_wasOwner; private long m_ownerIdCache; private long m_hostileToCache; private bool m_bountyCache; private string m_displayToken; private string m_displayName; private static readonly ItemType[] ArmorSlots; private int m_gearRetries; private static readonly FieldRef<Humanoid, ItemData> s_leftItem; private static readonly FieldRef<Humanoid, ItemData> s_rightItem; private float m_portalRefusedUntil; private const float HearRange = 40f; internal static readonly int ModeKey; internal static readonly int HomeKey; internal static readonly int HasHomeKey; internal static readonly int PassiveKey; internal static readonly int PassiveUntilKey; internal static readonly int LootKey; private const int QuietFlag = 256; private const float RetreatSeconds = 15f; private const float HomeWalkDistance = 80f; private static readonly FieldRef<MonsterAI, Character> s_targetCreature; private static readonly FieldRef<MonsterAI, StaticTarget> s_targetStatic; private static readonly FieldRef<BaseAI, float> s_randomMoveTimer; private static readonly Action<BaseAI, bool> s_setAlerted; private static readonly Action<BaseAI, Vector3> s_setPatrolPoint; internal static readonly Func<BaseAI, float, Vector3, float, bool, bool> MoveToFn; private static int s_itemMask; private VikingMode m_modeCache; private ItemDrop m_lootTarget; private float m_lootSince; internal static readonly int LentFromKey; internal static readonly int LentFromNameKey; internal static readonly int LentUntilKey; private const float HandOverRange = 10f; private float m_lendCheckAt; private static readonly FieldRef<BaseAI, List<Vector3>> s_aiPath; private MoveNote m_moveNote; private float m_moveNoteAt = -10f; private Vector3 m_noteGoal; private object m_noteKey; private float m_gaveUpAt = -10f; private string m_gaveUpWhat; private Vector3 m_gaveUpGoal; private const float ClothRange = 20f; private static readonly List<Cloth> s_cloths; private static readonly List<Light> s_lights; private float m_visualLodAt; private const int AnimBoolKey = 438569; private static readonly int s_sitHash; private static readonly int s_chairHash; private static readonly int s_throneHash; private static readonly int s_bedHash; private static readonly int s_crouchHash; private float m_poseCheckAt; private float m_poseLogAt; private int m_stuckChecks; private int m_emoteChecks; internal static readonly int QuestWaitUntilKey; internal static readonly int QuestWaitPosKey; internal static readonly int QuestGratefulKey; internal static readonly int UidKey; internal const float BaseAlertRange = 20f; internal const float BaseViewRange = 30f; private const float RaidViewRange = 60f; private const float RaidChaseRange = 80f; private bool m_defending; private float m_raidRange; private float m_nextRaidScan; internal static readonly int LoyaltyKey; internal static readonly int LoyaltyDayKey; internal static readonly int LoyaltyWarnedKey; internal static readonly int RelationsKey; public const int FriendThreshold = 50; public const int RivalThreshold = -50; private const float RelationTickSeconds = 60f; private const float RelationRange = 15f; private const int LoyaltyWarningThreshold = 25; private float m_relationTimer = 20f; private float m_nextScuffle; private float m_lastDrinkTime = -999f; private bool m_friendNear; private bool m_rivalNear; internal static readonly int FatigueKey; internal static readonly int FatigueAtKey; internal static readonly int RelaxPointKey; internal static readonly int CompanionSleepKey; private float m_fatigueUpdateAt; private float m_fatigueSayAt; private float m_companionBedAt; internal static readonly int WorkerKey; private static readonly (string key, string name)[] Bosses; private Character m_seaTarget; private float m_seaScanAt; private float m_seaShotAt; private float m_lookoutAt; private float m_seasickSayAt; private float m_meetScanAt; private static float s_overboardSince; private static Ship s_lastShip; private static float s_lastAboardAt; private static readonly Dictionary<(long, long), float> s_squadsMet; private static readonly float[] SenseAngles; private const float SenseRange = 3f; private const float SenseSeconds = 0.12f; private const float SenseRadius = 0.28f; private const float HoleDepth = 1.6f; private static int s_groundMask; private static readonly RaycastHit[] s_senseHits; private readonly Vector3[] m_rayDirs = (Vector3[])(object)new Vector3[SenseAngles.Length]; private readonly float[] m_rayFree = new float[SenseAngles.Length]; private readonly bool[] m_rayHole = new bool[SenseAngles.Length]; private int m_rayChosen; private Vector3 m_rayOrigin; private float m_rayAt = -10f; private float m_senseAt; private Vector3 m_senseDesired; private Vector3 m_senseChoice; private bool m_senseJump; private const float PersonRange = 2.5f; private static int s_characterMask; private static readonly FieldRef<Fermenter, bool> s_fermenterHasRoof; private static readonly FieldRef<Fermenter, bool> s_fermenterExposed; private const float RepairStationRange = 50f; internal static readonly int PriorityKey; internal static readonly int NewcomerKey; internal static readonly int NewcomerPosKey; internal static readonly int GuestedKey; internal static readonly int GuestBedKey; internal static readonly int GuestBedRotKey; internal static readonly int GuestSleepKey; internal static readonly int BathDayKey; internal static readonly int RequestKey; internal static readonly int RequestDayKey; internal static readonly int TrainingUntilKey; private const int TrainingMaxLevel = 10; private VikingJob m_priorityCache; private float m_priorityAt; private float m_dutiesAt; private float m_guestCheckAt; private float m_newcomerGreetAt; private ItemData m_nightTorch; private float m_bathSearchAt; private float m_bathLeaveAt; private float m_requestAt; private float m_cullAt; private float m_medicScanAt; private readonly Dictionary<int, float> m_healedAt = new Dictionary<int, float>(); private Character m_trainingDummy; private float m_traineeCheckAt; private float m_trainXpAt; private static readonly Dictionary<Vector3Int, VikingNpc> s_guestBeds; private static readonly string[] RequestKinds; private bool m_torchLogged; internal static readonly int FeastDayKey; private const float FeastSeconds = 100f; private const int FeastEveryDays = 7; private float m_feastUntil; private bool m_feastAte; private float m_feastActAt; private float m_feastCheckAt; private int m_feastGrumbleDay = -1; private static readonly string[] PrivateWords; private static readonly Dictionary<int, ChestLabel> s_chestLabels; private static readonly ChestLabel NoLabel; private static int s_signMask; private static readonly Regex s_richText; private static readonly (string kind, string[] words)[] LabelWords; internal static readonly int AwaySinceKey; private float m_postRaidRepairUntil; private float m_comfortAt; private float m_comfortMood; private float m_apprenticeAt; private bool m_apprentice; private float m_apprenticeXpAt; private float m_homesickAt; private float m_homesickSayAt; private bool m_homesick; private bool m_reconciled; private float m_practiceAt; private const float BoardRange = 40f; private Ship m_ship; private bool m_aboard; private Vector3 m_shipSlot; private float m_offShipTime; private readonly List<(Collider passenger, Collider hull)> m_shipCollisions = new List<(Collider, Collider)>(); internal static readonly int SleptKey; internal static readonly int MissedNightsKey; internal static readonly int RestUntilKey; internal static readonly int JoinAfterRestKey; public const int ExhaustedNights = 3; private const float RestoreCheckDistance = 40f; private bool m_nightStateKnown; private bool m_wasNight; private bool m_sawDusk; private bool m_exhaustedSitting; private float m_sitBlockedUntil; private float m_restoreTimer; private const float SmoothTurnDegrees = 360f; private Vector3 m_smoothDir; private float m_smoothAt; private static readonly HashSet<Character> s_sneaking; private bool m_sneaking; private bool m_sneakWanted; private float m_sneakSwitchAt; private const float TalkHoldSeconds = 2.5f; private const float TalkPingSeconds = 1f; private const float TalkEnemyRange = 10f; private float m_talkUntil; private Vector3 m_talkerPos; private static VikingNpc s_talkingTo; private static float s_nextTalkPing; private static readonly FieldRef<Humanoid, Attack> s_currentAttack; private static readonly FieldRef<Attack, Transform> s_attachTarget; private const float SwatRange = 3f; private const float SwatSeconds = 1f; private float m_swatAt; private float m_swatLogAt; internal static readonly int TraderKey; internal static readonly int TraderSeatSetKey; internal static readonly int TraderSeatKey; private static VikingNpc s_traderSeatPicker; private static long s_traderSeatPlayer; private static float s_traderSeatPickUntil; private static readonly (string prefab, int stack, int price)[][] Stock; private const float BuybackShare = 0.4f; private static List<Dictionary<string, int>> s_buyback; private static readonly Dictionary<TradeItem, string> s_goodsRows; internal static readonly int OrdersKey; internal const int MaxOrdersPerPlayer = 8; private static readonly (string prefab, int stack, int price, int tier)[] RareGoods; private int m_rareWeek = -1; private TradeItem m_rare; private float m_collectBlockUntil; internal static readonly int TraitsKey; internal static readonly int LuckyDayKey; private static readonly VikingTrait[] AllTraits; private static readonly (VikingTrait, VikingTrait)[] Opposites; private string m_traitsRaw; private readonly List<VikingTrait> m_traits = new List<VikingTrait>(); private bool m_traitStatsApplied; private float m_nextBreak; private int m_curiousDay = -1; private float m_bullyAt; private float m_chillyAt; private float m_waterSayAt; internal static readonly int BornKey; private const float TroubleRange = 14f; private const float AlertedTroubleRange = 8f; private const float FleeSeconds = 5f; private const float FleeStep = 12f; internal static readonly int LeaveNowKey; private const float WandererLeaveDistance = 40f; private float m_fleeUntil; private Vector3 m_fleeFrom; private float m_leavingSince = -1f; private GameObject m_warPaint; private float m_warPaintAt; private CombatRole m_warPaintRole = (CombatRole)(-1); private static readonly Dictionary<CombatRole, Material> s_paintMaterials; internal static readonly int JobKey; internal static readonly int JobsKey; public const int MaxJobs = 3; private string m_jobsRaw; private int m_jobsPrimary = -1; private readonly List<VikingJob> m_jobs = new List<VikingJob>(); private VikingJob m_activeJob; public static readonly VikingJob[] Jobs; private static Dictionary<string, Crop> s_crops; private static int s_workMask; private static int s_pieceMaskWork; private WorkTask m_task; private ItemData m_workTool; private float m_actionCooldown; private float m_lastTaskTime; private string m_workProblem; private bool m_depositing; private readonly Dictionary<int, float> m_blacklist = new Dictionary<int, float>(); private readonly List<PendingPlant> m_pendingPlants = new List<PendingPlant>(); private float m_selectWorkAt; private bool m_searchUnfinished; private float m_farSearchAt; private readonly Dictionary<int, (bool safe, bool needStand, Vector3 dir, float until)> m_fellPlans = new Dictionary<int, (bool, bool, Vector3, float)>(); private const float StandOffset = 1.8f; private static Dictionary<string, Crop> s_trees; private float m_freePlantAt; private WorkTask m_freePlantCandidate; private static HashSet<string> s_gatherSkip; private static string s_gatherSkipConfig; private float m_noSeedsSayAt; internal static readonly int PendingPlantsKey; private bool m_pendingLoaded; private string m_pendingSaved; private float m_pendingSaveAt; private float m_stokerLogAt; private const float ChestReach = 2.8f; private static readonly string[] WoodNames; private static readonly string[] StoneNames; private static readonly string[] OreNames; private static readonly string[] HideNames; private float m_outOfReachSince = -1f; private const float RepairReachUp = 4.5f; private const float InteractReachUp = 3.2f; internal static readonly int EscortPlayerKey; internal static readonly int EscortDestKey; internal static readonly int EscortUntilKey; internal static readonly int EscortRewardKey; internal static readonly int EscortArrivedKey; internal static readonly int HermitKey; internal static readonly int HermitPosKey; internal static readonly int HermitAskedKey; internal static readonly int DuelWithKey; internal static readonly int DuelUntilKey; internal static readonly int DuelWonByKey; private const float EscortArriveRange = 20f; private const float DuelEndHealth = 0.3f; private static readonly int[] RiddleAnswers; private float m_escortSayAt; internal static readonly int TraderPrepaidKey; internal static readonly int DemandKey; internal static readonly int DemandDayKey; internal static readonly int SmithKey; internal static readonly int SharpenKey; internal static readonly int RefugeeKey; private static float s_banditCheckAt; private static int s_auroraDay; private static int s_auroraRolledDay; private int m_auroraCheeredDay = -1; private float ZoneRadius { get { float num = (IsNpcResident() ? NpcWorkRadius : (HasBase() ? Settlements.Radius : WorkRadius)); if ((!m_huntZone && !((Object)(object)m_prey != (Object)null)) || !HasJob(VikingJob.Hunter)) { return num; } return num * 1.5f; } } private float NpcWorkRadius { get { if (!m_nview.IsValid()) { return 25f; } return Mathf.Max(12f, Zdo.GetFloat(NpcRadiusKey, 25f)); } } private FieldKind CurrentField { get { if (!m_nview.IsValid()) { return FieldKind.None; } return (FieldKind)Zdo.GetInt(FieldKindKey, 0); } } private Vector3 BasePosition => Zdo.GetVec3(BaseKey, ((Component)this).transform.position); private Vector3 DestinationPosition { get { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!HasHome()) { return BasePosition; } return HomePosition; } } private Vector3 WorkCenter { get { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!HasBase()) { return HomePosition; } return BasePosition; } } private Vector3 HomePosition => Zdo.GetVec3(HomeKey, ((Component)this).transform.position); private float HuntRange => Mathf.Min(Mathf.Max((HasBase() ? Settlements.Radius : WorkRadius) * 1.5f, Plugin.FarWorkRadius.Value), Mathf.Max(ZoneRadius, KeepLoaded.WorkCap(WorkCenter))); private bool LazyHunter => HasTrait(VikingTrait.Lazy); internal static int HairCount => CountVariants("Hair", ref s_hairCount); internal static int BeardCount => CountVariants("Beard", ref s_beardCount); internal static int NavGroundMask => GroundMask; internal static int NavObstacleMask => ObstacleMask; internal List<Vector3> MapPath => m_mapPath; internal int MapIndex => m_mapIndex; private int SearchBonus { get { if (!HasJob(VikingJob.Miner)) { return 0; } return StoredSearchBonus; } } private int StoredSearchBonus { get { if (!m_nview.IsValid()) { return 0; } return Zdo.GetInt(SearchBonusKey, 0); } } private static int ObstacleMask { get { if (s_obstacleMask == 0) { ComputeCollisionMasks(); } return s_obstacleMask; } } private float TickSeconds { get; set; } = 0.5f; public static IEnumerable<VikingNpc> All => s_byCharacter.Values; public Humanoid Character => m_character; public ZNetView NetView => m_nview; private ZDO Zdo => m_nview.GetZDO(); private static long Now => ZNet.instance.GetTime().Ticks; private static double DayLengthSeconds { get { if (!((Object)(object)EnvMan.instance != (Object)null)) { return 1800.0; } return EnvMan.instance.m_dayLengthSec; } } internal long Uid { get { if (!((Object)(object)m_nview != (Object)null) || !m_nview.IsValid()) { return 0L; } return Zdo.GetLong(UidKey, 0L); } } private static int GroundMask { get { if (s_groundMask == 0) { ComputeCollisionMasks(); } return s_groundMask; } } private static int CharacterMask { get { if (s_characterMask == 0) { s_characterMask = LayerMask.GetMask(new string[3] { "character", "character_net", "character_noenv" }); } return s_characterMask; } } public static float RestSeconds { get { if (!((Object)(object)EnvMan.instance != (Object)null)) { return 600f; } return (float)EnvMan.instance.m_dayLengthSec * 0.5f; } } public IReadOnlyList<VikingTrait> Traits { get { string text = (((Object)(object)m_nview != (Object)null && m_nview.IsValid()) ? Zdo.GetString(TraitsKey, "") : ""); if (text != m_traitsRaw) { m_traitsRaw = text; m_traits.Clear(); m_traits.AddRange(ParseTraits(text)); } return m_traits; } } private int JobLimit => 3 + (HasTrait(VikingTrait.JackOfAllTrades) ? 1 : 0); private static float WorkRadius => Plugin.WorkRadius.Value; private float FarRadius => Mathf.Min(Mathf.Max(ZoneRadius, Plugin.FarWorkRadius.Value) + (float)SearchBonus, Mathf.Max(ZoneRadius, KeepLoaded.WorkCap(WorkCenter))); private static int WorkMask { get { if (s_workMask == 0) { s_workMask = LayerMask.GetMask(new string[6] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "item" }); } return s_workMask; } } private static Dictionary<string, Crop> Crops { get { if (s_crops != null || (Object)(object)ZNetScene.instance == (Object)null) { return s_crops ?? new Dictionary<string, Crop>(); } s_crops = new Dictionary<string, Crop>(); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { Plant val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<Plant>() : null); Piece val2 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<Piece>() : null); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || !val.m_needCultivatedGround || val2.m_resources.Length == 0 || (Object)(object)val2.m_resources[0].m_resItem == (Object)null) { continue; } GameObject[] grownPrefabs = val.m_grownPrefabs; foreach (GameObject val3 in grownPrefabs) { if ((Object)(object)val3 != (Object)null && !s_crops.ContainsKey(((Object)val3).name)) { s_crops[((Object)val3).name] = new Crop { Sapling = prefab, Seed = val2.m_resources[0].m_resItem.m_itemData.m_shared.m_name }; } } } return s_crops; } } private static Dictionary<string, Crop> Trees { get { if (s_trees != null || (Object)(object)ZNetScene.instance == (Object)null) { return s_trees ?? new Dictionary<string, Crop>(); } s_trees = new Dictionary<string, Crop>(); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { Plant val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<Plant>() : null); Piece val2 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<Piece>() : null); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || val.m_needCultivatedGround || val2.m_resources.Length == 0 || (Object)(object)val2.m_resources[0].m_resItem == (Object)null) { continue; } GameObject[] grownPrefabs = val.m_grownPrefabs; foreach (GameObject val3 in grownPrefabs) { if ((Object)(object)val3 != (Object)null && (Object)(object)val3.GetComponent<TreeBase>() != (Object)null && !s_trees.ContainsKey(((Object)val3).name)) { s_trees[((Object)val3).name] = new Crop { Sapling = prefab, Seed = val2.m_resources[0].m_resItem.m_itemData.m_shared.m_name }; } } } return s_trees; } } internal void DrawSenses(LinePool pool) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00ac: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time - m_rayAt > 0.6f)) { Vector3 val = m_rayOrigin + Vector3.up; for (int i = 0; i < SenseAngles.Length; i++) { float num = Mathf.Max(0.05f, m_rayFree[i]); bool flag = i == m_rayChosen; Color val2 = (m_rayHole[i] ? RayHole : ((num >= 2f) ? RayFree : ((num >= 0.8f) ? RayNear : RayBlocked))); pool.Line(val, val + m_rayDirs[i] * (flag ? Mathf.Max(num, 1f) : num), flag ? Color.white : val2, flag ? 0.05f : 0.02f); } } } internal void CollectRoute(List<Vector3> route) { GetDebugView(route, out var _); } private void RPC_Recall(long sender, long playerId, Vector3 position) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (m_nview.IsOwner() && GetOwnerId() == playerId && !IsHostile()) { EndAssault(); WakeUp(); StandUp(); StopSitting(); CancelEmote(); if (m_aboard) { Disembark(null); } Zdo.Set(GoingHomeKey, false); if (m_modeCache != VikingMode.Formation) { Zdo.Set(ModeKey, 0, false); } Zdo.Set(FollowKey, Zdo.GetString(OwnerNameKey, "")); ((BaseAI)m_ai).ResetPatrolPoint(); RefreshCache(); Zdo.Set(PortalPendingKey, true); Zdo.Set(PortalPosKey, position); m_portalHoldTime = 0f; MoveTo(position); } } internal void CollectStatusIcons(List<StatusIcon> icons, Player local) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_00b4: 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_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0315: 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_027f: 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_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) icons.Clear(); if (!m_nview.IsValid() || (Object)(object)local == (Object)null) { return; } if (!IsHired()) { if (IsQuestGiverFor(local)) { icons.Add(StatusIcons.Glyph("!", new Color(1f, 0.82f, 0.3f))); } if (IsTrader()) { icons.Add(StatusIcons.Item("Coins", Color.white)); } if (IsSmith()) { icons.Add(StatusIcons.Item("Hammer", Color.white)); } if (IsOutlaw() && !IsSurrendered()) { icons.Add(StatusIcons.Item("TrophySkeleton", new Color(1f, 0.4f, 0.35f))); } } else if (IsTrader()) { bool flag = IsOwnedBy(local); if (IsDowned()) { icons.Add(StatusIcons.Item("TrophySkeleton", new Color(1f, 0.5f, 0.45f))); } else if (flag && IsCollectingDebt()) { icons.Add(StatusIcons.Glyph("!", new Color(1f, 0.35f, 0.3f))); icons.Add(StatusIcons.Item("Coins", new Color(1f, 0.55f, 0.5f))); } else if (IsSleeping()) { icons.Add(StatusIcons.Piece("bed", new Color(0.7f, 0.85f, 1f))); } else if (CanTradeNow()) { icons.Add(StatusIcons.Item("Coins", Color.white)); if (flag && TraderDebtDays() >= 20) { icons.Add(StatusIcons.Glyph("!", new Color(1f, 0.75f, 0.35f))); } } } else { if (!IsOwnedBy(local)) { return; } if (IsDowned()) { icons.Add(StatusIcons.Item("TrophySkeleton", new Color(1f, 0.5f, 0.45f))); return; } if (IsSleeping() || IsResting()) { icons.Add(StatusIcons.Piece("bed", new Color(0.7f, 0.85f, 1f))); } else if (IsWorker() && (IsExhausted() || IsSleepDeprived())) { icons.Add(StatusIcons.Piece("bed", IsExhausted() ? new Color(1f, 0.45f, 0.4f) : new Color(1f, 0.75f, 0.35f))); icons.Add(StatusIcons.Glyph("!", IsExhausted() ? new Color(1f, 0.45f, 0.4f) : new Color(1f, 0.75f, 0.35f))); } if (IsWorker()) { if (EnvMan.IsNight() && !HasWarmth()) { icons.Add(StatusIcons.Piece("fire_pit", new Color(0.7f, 0.85f, 1f))); } if (DaysWithoutMead() >= MeadDryDaysFor()) { icons.Add(StatusIcons.Item("Honey", Color.white)); } if (Plugin.FoodNeeds.Value && DaysWithoutFood() >= 1) { icons.Add(StatusIcons.Item("CookedMeat", new Color(1f, 0.75f, 0.45f))); } if (GetJob() == VikingJob.None && !IsSleeping()) { icons.Add(StatusIcons.Glyph("?", new Color(0.85f, 0.85f, 0.85f))); } } if (icons.Count > 3) { icons.RemoveRange(3, icons.Count - 3); } } } public bool IsSettledTrader() { if (IsHired()) { return IsTrader(); } return false; } internal int TraderStage() { if (!m_nview.IsValid()) { return 0; } return Zdo.GetInt(TraderStageKey, 0); } internal int TraderDebtDays() { if (!m_nview.IsValid()) { return 0; } return Zdo.GetInt(TraderDebtDaysKey, 0); } public bool IsCollectingDebt() { if (IsSettledTrader()) { return TraderStage() > 0; } return false; } private void UpdateSettledTrader() { //IL_003c: 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) if (!((Character)m_character).IsTamed()) { ((Character)m_character).SetTamed(true); } ((Character)m_character).m_aiCannotTargetOthers = true; Character val = FindThreat(); if ((Object)(object)val != (Object)null) { m_fleeFrom = ((Component)val).transform.position; m_fleeUntil = Time.time + 5f; s_targetCreature.Invoke(m_ai) = null; s_targetStatic.Invoke(m_ai) = null; } if (Time.time >= m_debtTickAt) { m_debtTickAt = Time.time + 2f; if (TraderDebts.Advance(Zdo, Now)) { StartCollecting(); } } if (HasBase() && BannerLost()) { LoseBanner(); } else if (!HasBase() && Time.time >= m_bannerBackAt) { m_bannerBackAt = Time.time + 5f; TryReturnToBanner(); } if (TraderStage() > 0) { UpdateCollecting(); } else if (!HasBase()) { FollowOwner(); } else { if (m_modeCache != VikingMode.Home && HasDestination()) { OrderGoHome(Player.GetPlayer(GetOwnerId())); } UpdateHome(); } UpdateFollow(); } private void LoseBanner() { WakeUp(); ReleaseBedClaim(); ClearHome(); TraderDebts.LoseBanner(Zdo); ((BaseAI)m_ai).ResetPatrolPoint(); RefreshCache(); MessageOwner("$vnpc_trader_banner_lost"); } private void TryReturnToBanner() { //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) Vector3 vec = Zdo.GetVec3(BaseKey, Vector3.zero); ZDO val = ((vec != Vector3.zero) ? Settlements.FindBannerZdo(vec) : null); if (val != null && !((Object)(object)EnvMan.instance == (Object)null)) { Zdo.Set(HasBaseKey, true); Zdo.Set(BaseUserKey, ((ZDOID)(ref val.m_uid)).UserID); Zdo.Set(BaseIdKey, (long)((ZDOID)(ref val.m_uid)).ID); Zdo.Set(BaseNameKey, Settlements.NameOf(val)); Zdo.Set(TraderLastDayKey, EnvMan.instance.GetDay(), false); OrderGoHome(Player.GetPlayer(GetOwnerId())); RefreshCache(); MessageOwner("$vnpc_trader_banner_back"); } } private void FollowOwner() { string text = Zdo.GetString(OwnerNameKey, ""); if (IsSleeping()) { WakeUp(); } if (m_modeCache != VikingMode.Follow || Zdo.GetString(FollowKey, "") != text) { Zdo.Set(ModeKey, 0, false); Zdo.Set(FollowKey, text); Zdo.Set(GoingHomeKey, false); ((BaseAI)m_ai).ResetPatrolPoint(); RefreshCache(); } } private void StartCollecting() { WakeUp(); StopSitting(); TraderDebts.StartCollecting(Zdo, Now); ((BaseAI)m_ai).ResetPatrolPoint(); m_ai.SetFollowTarget((GameObject)null); RefreshCache(); m_nagAt = Time.time + 5f; } private void UpdateCollecting() { //IL_0032: 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) FollowOwner(); Player player = Player.GetPlayer(GetOwnerId()); if ((Object)(object)player == (Object)null || ((Character)player).IsDead() || m_killing) { return; } float num = Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position); if (Zdo.GetLong(TraderGraceKey, 0L) <= 0) { if (num < 4.5f && !((Character)player).IsTeleporting()) { ((MonoBehaviour)this).StartCoroutine(KillOwner(player)); } } else if (Time.time >= m_nagAt && num < 15f) { m_nagAt = Time.time + Random.Range(45f, 90f); m_nview.InvokeRPC(ZNetView.Everybody, "VNPC_Say", new object[1] { $"$vnpc_trader_nag_{Random.Range(1, 6)}" }); TraderDebts.Notice(GetOwnerId(), GetNameToken() + ": " + TraderDebtLine()); } } internal void DebugTraderDebt(Player player, int addDays, bool expire) { m_nview.InvokeRPC("VNPC_TraderDebug", new object[3] { player.GetPlayerID(), addDays, expire }); } private void RPC_TraderDebug(long sender, long playerId, int addDays, bool expire) { if (m_nview.IsOwner() && GetOwnerId() == playerId && IsTrader()) { if (addDays > 0) { Zdo.Set(TraderDebtDaysKey, Mathf.Min(30, TraderDebtDays() + addDays), false); m_debtTickAt = 0f; } if (expire && TraderStage() > 0) { Zdo.Set(TraderGraceKey, TimeSpan.FromSeconds(10.0).Ticks); } } } private IEnumerator KillOwner(Player owner) { m_killing = true; Vector3 toOwner = ((Component)owner).transform.position - ((Component)this).transform.position; toOwner.y = 0f; ((BaseAI)m_ai).LookTowards(toOwner); m_nview.InvokeRPC(ZNetView.Everybody, "VNPC_Say", new object[1] { "$vnpc_trader_kill_say" }); ((Character)m_character).StartAttack((Character)(object)owner, false); yield return (object)new WaitForSeconds(0.5f); m_killing = false; if (m_nview.IsValid() && m_nview.IsOwner() && !((Object)(object)owner == (Object)null) && !((Character)owner).IsDead() && TraderStage() != 0 && Zdo.GetLong(TraderGraceKey, 0L) <= 0) { HitData val = new HitData(); val.m_damage.m_damage = 1000000f; val.m_point = ((Character)owner).GetCenterPoint(); val.m_dir = ((((Vector3)(ref toOwner)).sqrMagnitude > 0.01f) ? ((Vector3)(ref toOwner)).normalized : ((Component)this).transform.forward); val.m_hitType = (HitType)1; val.SetAttacker((Character)(object)m_character); ((Character)owner).Damage(val); int num = Zdo.GetInt(TraderKillsKey, 0) + 1; Zdo.Set(TraderKillsKey, num, false); Zdo.Set(TraderGraceKey, TraderDebts.CycleTicks(num)); Zdo.Set(TraderTickKey, Now); TraderDebts.Notice(GetOwnerId(), GetNameToken() + ": $vnpc_trader_killed_you"); } } private bool IsTimidWorker() { if (IsWorker() && !HasJob(VikingJob.Guard) && !HasTrait(VikingTrait.Brave)) { return !IsDefending(); } return false; } private Character FindWorkerThreat() { //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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; Character result = null; float num = 14f; foreach (Character allCharacter in Character.GetAllCharacters()) { if ((Object)(object)allCharacter == (Object)null || (Object)(object)allCharacter == (Object)(object)m_character || allCharacter.IsDead() || allCharacter.IsPlayer() || IsViking(allCharacter)) { continue; } BaseAI baseAI = allCharacter.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if (val != null && BaseAI.IsEnemy(allCharacter, (Character)(object)m_character) && (!HasJob(VikingJob.Hunter) || !IsPrey(allCharacter))) { float num2 = Vector3.Distance(((Component)allCharacter).transform.position, position); if (!(num2 >= num) && ((Object)(object)((BaseAI)val).GetTargetCreature() == (Object)(object)m_character || (num2 < 8f && ((BaseAI)val).IsAlerted()))) { result = allCharacter; num = num2; } } } return result; } private void UpdateWorkerAlarm() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!IsTimidWorker() || IsDowned() || IsSleeping()) { return; } Character val = FindWorkerThreat(); if (!((Object)(object)val == (Object)null)) { if (!IsFleeing()) { StopWork(); } m_fleeFrom = ((Component)val).transform.position; m_fleeUntil = Time.time + 5f; s_targetCreature.Invoke(m_ai) = null; s_targetStatic.Invoke(m_ai) = null; if (Time.time >= m_helpCallAt) { m_helpCallAt = Time.time + 10f; m_nview.InvokeRPC(ZNetView.Everybody, "VNPC_Say", new object[1] { $"$vnpc_say_help_{Random.Range(1, 5)}" }); CallGuards(val); } } } private void CallGuards(Character threat) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00a8: Unknown result type (might be due to invalid IL or missing references) ZDOID zDOID = threat.GetZDOID(); long ownerId = GetOwnerId(); foreach (VikingNpc item in All) { if ((Object)(object)item != (Object)null && (Object)(object)item != (Object)(object)this && item.m_nview.IsValid() && item.GetOwnerId() == ownerId && (item.HasJob(VikingJob.Guard) || (item.HasTrait(VikingTrait.Brave) && item.IsWorker())) && !item.IsDowned() && Vector3.Distance(((Component)item).transform.position, ((Component)threat).transform.position) <= 60f) { item.m_nview.InvokeRPC("VNPC_GuardAlarm", new object[1] { zDOID }); } } } private void RPC_GuardAlarm(long sender, ZDOID threatId) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.IsOwner() || (!HasJob(VikingJob.Guard) && !HasTrait(VikingTrait.Brave)) || IsDowned()) { return; } GameObject val = ZNetScene.instance.FindInstance(threatId); Character val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<Character>() : null); if (!((Object)(object)val2 == (Object)null) && !val2.IsDead()) { WakeUp(); StopWork(); AllowAlarmChase(val2); AimAiAt(val2); if (Time.time >= m_guardReplyAt) { m_guardReplyAt = Time.time + 10f; m_nview.InvokeRPC(ZNetView.Everybody, "VNPC_Say", new object[1] { $"$vnpc_say_guard_coming_{Random.Range(1, 4)}" }); } } } private void AimAiAt(Character target) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) s_targetCreature.Invoke(m_ai) = target; s_targetStatic.Invoke(m_ai) = null; s_lastKnownTargetPos.Invoke(m_ai) = ((Component)target).transform.position; s_beenAtLastPos.Invoke(m_ai) = false; s_timeSinceSensed.Invoke(m_ai) = 0f; s_setAlerted((BaseAI)(object)m_ai, arg2: true); } public bool IsAssaulting() { return m_assault; } private string StartAssault(Vector3 point, ZDOID targetId) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00d1: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) Character val = null; if (targetId != ZDOID.None) { GameObject val2 = ZNetScene.instance.FindInstance(targetI
ValheimNpc.Companions.dll
Decompiled 12 hours 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.3.9"; } [BepInPlugin("com.valheimnpc.vikings.companions", "Vikings for Hire - Companions", "1.3.9")] [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), отряд, корабли и порталы"); } } }
ValheimNpc.Settlement.dll
Decompiled 12 hours 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.3.9"; } [BepInPlugin("com.valheimnpc.vikings.settlement", "Vikings for Hire - Settlement", "1.3.9")] [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)"Модуль включён — своё поселение: знамя, профессии и работа, дома, жизнь поселения"); } } }
ValheimNpc.Factions.dll
Decompiled 12 hours 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.3.9"; } [BepInPlugin("com.valheimnpc.vikings.factions", "Vikings for Hire - Factions", "1.3.9")] [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)"Модуль включён — чужие поселения и фракции: хутора бондов, стоянки изгоев, разбойники"); } } }
ValheimNpc.Traders.dll
Decompiled 12 hours 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.3.9"; } [BepInPlugin("com.valheimnpc.vikings.traders", "Vikings for Hire - Traders", "1.3.9")] [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)"Модуль включён — торговцы: бродячие и в поселении, заказы, долги"); } } }
ValheimNpc.World.dll
Decompiled 12 hours 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.3.9"; } [BepInPlugin("com.valheimnpc.vikings.world", "Vikings for Hire - World Events", "1.3.9")] [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)"Модуль включён — события мира: охотники за головами, поручения, отшельник, поединки, беженцы, кузнец, сияние"); } } }