Decompiled source of Norse Personality Construction System v0.0.7
Plugins/VentureValheim.NPCS.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: Guid("2A4C40B0-FB71-4081-853D-46B3FB39AE4C")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyProduct("VentureValheim.NPCS")] [assembly: AssemblyCompany("")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("VentureValheim.NPCS")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyFileVersion("0.0.7")] [assembly: AssemblyConfiguration("")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.7.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<487dec8c-a65f-4d68-bae1-c74c9aeef36a>Embedded] internal sealed class <487dec8c-a65f-4d68-bae1-c74c9aeef36a>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [<487dec8c-a65f-4d68-bae1-c74c9aeef36a>Embedded] [CompilerGenerated] internal sealed class <dfc8a453-6986-49ce-aefe-253b4e3f0a59>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <dfc8a453-6986-49ce-aefe-253b4e3f0a59>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <dfc8a453-6986-49ce-aefe-253b4e3f0a59>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [<487dec8c-a65f-4d68-bae1-c74c9aeef36a>Embedded] [CompilerGenerated] internal sealed class <d8e89b07-b022-4017-96cc-d985a31b852b>NullableContextAttribute : Attribute { public readonly byte Flag; public <d8e89b07-b022-4017-96cc-d985a31b852b>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace VentureValheim.NPCS { [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.orianaventure.mod.NorsePersonalityConstructionSystem", "NorsePersonalityConstructionSystem", "0.0.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public class NPCSPlugin : BaseUnityPlugin { private const string ModName = "NorsePersonalityConstructionSystem"; private const string ModVersion = "0.0.7"; private const string Author = "com.orianaventure.mod"; private const string ModGUID = "com.orianaventure.mod.NorsePersonalityConstructionSystem"; private readonly Harmony HarmonyInstance = new Harmony("com.orianaventure.mod.NorsePersonalityConstructionSystem"); public static readonly ManualLogSource NPCSLogger = Logger.CreateLogSource("NorsePersonalityConstructionSystem"); public static GameObject Root; public static AssetBundle Assets; public const string MOD_PREFIX = "vvnpcs_"; public void Awake() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown NPCSLogger.LogInfo((object)"You're finally awake!"); Root = new GameObject("NPCSRoot"); Root.SetActive(false); Object.DontDestroyOnLoad((Object)(object)Root); PrefabManager.OnPrefabsRegistered += NPCFactory.AddNPCS; Assembly executingAssembly = Assembly.GetExecutingAssembly(); HarmonyInstance.PatchAll(executingAssembly); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public interface INPC { HashSet<string> GetRequiredKeysSet(); HashSet<string> GetNotRequiredKeysSet(); void SetFromConfig(NPCConfiguration.NPCConfig config, bool newSpawn); void SetRandom(); void SetName(string name); void SetSpawnPoint(Vector3 position); void SetTrueDeath(bool death); void SetRotation(Quaternion rotation); void Attach(bool attach, Chair chair = null); } public class NPCAI : MonsterAI { public override void Awake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) ((BaseAI)this).m_viewRange = 15f; ((BaseAI)this).m_viewAngle = 90f; ((BaseAI)this).m_hearRange = 15f; ((BaseAI)this).m_mistVision = false; ((BaseAI)this).m_pathAgentType = (AgentType)1; ((BaseAI)this).m_moveMinAngle = 90f; ((BaseAI)this).m_smoothMovement = true; ((BaseAI)this).m_serpentMovement = false; ((BaseAI)this).m_jumpInterval = 0f; ((BaseAI)this).m_randomCircleInterval = 3f; ((BaseAI)this).m_randomMoveInterval = 15f; ((BaseAI)this).m_randomMoveRange = 5f; ((BaseAI)this).m_randomFly = false; ((BaseAI)this).m_avoidFire = false; ((BaseAI)this).m_afraidOfFire = false; ((BaseAI)this).m_avoidWater = true; ((BaseAI)this).m_avoidLava = true; ((BaseAI)this).m_skipLavaTargets = true; ((BaseAI)this).m_avoidLavaFlee = true; ((BaseAI)this).m_aggravatable = true; ((BaseAI)this).m_passiveAggresive = false; ((BaseAI)this).m_spawnMessage = ""; ((BaseAI)this).m_deathMessage = ""; ((BaseAI)this).m_alertedMessage = ""; ((BaseAI)this).m_fleeRange = 25f; ((BaseAI)this).m_fleeAngle = 45f; ((BaseAI)this).m_fleeInterval = 10f; base.m_alertRange = 15f; base.m_fleeIfHurtWhenTargetCantBeReached = true; base.m_fleeUnreachableSinceAttacking = 30f; base.m_fleeUnreachableSinceHurt = 20f; base.m_fleeIfNotAlerted = false; base.m_fleeIfLowHealth = 0f; base.m_fleeTimeSinceHurt = 10f; base.m_fleeInLava = true; base.m_circulateWhileCharging = true; base.m_enableHuntPlayer = false; base.m_attackPlayerObjects = false; base.m_privateAreaTriggerTreshold = 50; base.m_interceptTimeMax = 2f; base.m_interceptTimeMin = 0f; base.m_maxChaseDistance = 15f; base.m_minAttackInterval = 0f; base.m_circleTargetInterval = 5f; base.m_circleTargetDuration = 2f; base.m_circleTargetDistance = 2f; ((MonsterAI)this).Awake(); } public override void SetAlerted(bool alert) { ((MonsterAI)this).SetAlerted(alert); if (!alert) { ((BaseAI)this).SetAggravated(false, (AggravatedReason)0); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public static void SetupExisting(ref NPCAI monsterAI) { ((BaseAI)monsterAI).m_viewRange = 15f; ((BaseAI)monsterAI).m_hearRange = 15f; ((BaseAI)monsterAI).m_aggravatable = true; ((MonsterAI)monsterAI).m_enableHuntPlayer = false; ((MonsterAI)monsterAI).m_attackPlayerObjects = false; ((MonsterAI)monsterAI).m_privateAreaTriggerTreshold = 50; } } public class NPCAnimalAI : AnimalAI { public override void Awake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) ((BaseAI)this).m_viewRange = 15f; ((BaseAI)this).m_viewAngle = 90f; ((BaseAI)this).m_hearRange = 15f; ((BaseAI)this).m_mistVision = false; ((BaseAI)this).m_pathAgentType = (AgentType)1; ((BaseAI)this).m_moveMinAngle = 90f; ((BaseAI)this).m_smoothMovement = true; ((BaseAI)this).m_serpentMovement = false; ((BaseAI)this).m_jumpInterval = 0f; ((BaseAI)this).m_randomCircleInterval = 3f; ((BaseAI)this).m_randomMoveInterval = 15f; ((BaseAI)this).m_randomMoveRange = 5f; ((BaseAI)this).m_randomFly = false; ((BaseAI)this).m_avoidFire = false; ((BaseAI)this).m_afraidOfFire = false; ((BaseAI)this).m_avoidWater = true; ((BaseAI)this).m_avoidLava = true; ((BaseAI)this).m_skipLavaTargets = true; ((BaseAI)this).m_avoidLavaFlee = true; ((BaseAI)this).m_aggravatable = true; ((BaseAI)this).m_passiveAggresive = false; ((BaseAI)this).m_spawnMessage = ""; ((BaseAI)this).m_deathMessage = ""; ((BaseAI)this).m_alertedMessage = ""; ((BaseAI)this).m_fleeRange = 25f; ((BaseAI)this).m_fleeAngle = 45f; ((BaseAI)this).m_fleeInterval = 10f; ((AnimalAI)this).Awake(); } public override void SetAlerted(bool alert) { ((AnimalAI)this).SetAlerted(alert); if (!alert) { ((BaseAI)this).SetAggravated(false, (AggravatedReason)0); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public static void SetupExisting(ref NPCAnimalAI animalAI) { ((BaseAI)animalAI).m_viewRange = 15f; ((BaseAI)animalAI).m_hearRange = 15f; ((BaseAI)animalAI).m_aggravatable = true; } } [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public class NPCCharacter : Character, Interactable, Hoverable, INPC { public bool HasAttach; public Vector3 AttachPosition; public Quaternion AttachRotation; public string AttachAnimation; public GameObject AttachRoot; public Collider[] AttachColliders; protected HashSet<string> NPCRequiredKeysSet = new HashSet<string>(); protected HashSet<string> NPCNotRequiredKeysSet = new HashSet<string>(); public override void Awake() { ((Character)this).Awake(); IEnumerator enumerator = SetUp(); ((MonoBehaviour)this).StartCoroutine(enumerator); } public override void OnDestroy() { ((Character)this).OnDestroy(); } public IEnumerator SetUp() { yield return null; yield return null; base.m_name = NPCUtils.GetTamedName(base.m_nview); if (NPCUtils.GetAttached(base.m_nview)) { AttachStart(); } NPCRequiredKeysSet = Utility.StringToSet(NPCUtils.GetNPCRequiredKeys(base.m_nview)); NPCNotRequiredKeysSet = Utility.StringToSet(NPCUtils.GetNPCNotRequiredKeys(base.m_nview)); base.m_defeatSetGlobalKey = NPCUtils.GetNPCDefeatKey(base.m_nview); base.m_nview.GetZDO().Set(ZDOVars.s_tamed, false); base.m_tamed = false; } public override void CustomFixedUpdate(float fixedDeltaTime) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (!base.m_nview.IsValid() || !base.m_nview.IsOwner()) { return; } ((Character)this).CustomFixedUpdate(fixedDeltaTime); if (!HasAttach) { return; } ((Component)this).transform.position = AttachPosition; ((Component)this).transform.rotation = AttachRotation; Vector3 velocity = Vector3.zero; if ((Object)(object)AttachRoot != (Object)null) { Rigidbody componentInParent = AttachRoot.GetComponentInParent<Rigidbody>(); if ((Object)(object)componentInParent != (Object)null) { velocity = componentInParent.GetPointVelocity(((Component)this).transform.position); } } base.m_body.velocity = velocity; base.m_body.useGravity = false; base.m_body.angularVelocity = Vector3.zero; base.m_maxAirAltitude = ((Component)this).transform.position.y; } public override void OnDeath() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.m_nview == (Object)null || !base.m_nview.IsOwner()) { return; } GameObject[] array = base.m_deathEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1); for (int i = 0; i < array.Length; i++) { Ragdoll component = array[i].GetComponent<Ragdoll>(); if ((Object)(object)component != (Object)null) { Vector3 val = base.m_body.velocity; if (((Vector3)(ref base.m_pushForce)).magnitude * 0.5f > ((Vector3)(ref val)).magnitude) { val = base.m_pushForce * 0.5f; } component.Setup(val, 0f, 0f, 0f, (CharacterDrop)null); NPCUtils.SetTamedName(ref component.m_nview, base.m_name); NPCUtils.SetTrueDeath(ref component.m_nview, NPCUtils.GetTrueDeath(base.m_nview)); } } Utility.SetKey(base.m_defeatSetGlobalKey, global: true); if (base.m_onDeath != null) { base.m_onDeath(); } if (!NPCUtils.GetTrueDeath(base.m_nview)) { NPCFactory.RespawnNPC(((Component)((Component)this).transform.root).gameObject); } ZNetScene.instance.Destroy(((Component)this).gameObject); } public bool Interact(Humanoid user, bool hold, bool alt) { return NPCUtils.TryInteract(((Component)this).gameObject); } public bool UseItem(Humanoid user, ItemData item) { return NPCUtils.TryUseItem(((Component)this).gameObject, item); } public override string GetHoverText() { return NPCUtils.GetHoverText(base.m_nview, base.m_baseAI); } public override string GetHoverName() { return base.m_name; } public HashSet<string> GetRequiredKeysSet() { return NPCRequiredKeysSet; } public HashSet<string> GetNotRequiredKeysSet() { return NPCNotRequiredKeysSet; } public override bool IsAttached() { if (!HasAttach) { return ((Character)this).IsAttached(); } return true; } public void Attach(bool attach, Chair chair = null) { base.m_nview.ClaimOwnership(); if (attach) { ((Character)this).AttachStop(); if ((Object)(object)chair != (Object)null) { AttachStart(chair); } else { AttachStart(); } } else { ((Character)this).AttachStop(); } } public void AttachStart() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) HasAttach = true; AttachPosition = ((Component)this).transform.position; AttachRotation = ((Component)this).transform.rotation; if (base.m_nview.IsOwner()) { NPCUtils.SetAttached(ref base.m_nview, attach: true); } base.m_body.mass = 1000f; base.m_body.useGravity = false; base.m_body.velocity = Vector3.zero; base.m_body.angularVelocity = Vector3.zero; base.m_maxAirAltitude = ((Component)this).transform.position.y; } public void AttachStart(Chair chair) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0052: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) HasAttach = true; AttachPosition = chair.m_attachPoint.position; AttachRotation = chair.m_attachPoint.rotation; AttachAnimation = chair.m_attachAnimation; AttachRoot = ((Component)((Component)chair).transform.root).gameObject; ((Component)this).transform.position = AttachPosition; ((Component)this).transform.rotation = AttachRotation; if (base.m_nview.IsOwner()) { base.m_zanim.SetBool(AttachAnimation, true); NPCUtils.SetSitting(ref base.m_nview, sit: true); } base.m_body.mass = 1000f; Rigidbody component = AttachRoot.GetComponent<Rigidbody>(); base.m_body.useGravity = false; base.m_body.velocity = (Object.op_Implicit((Object)(object)component) ? component.GetPointVelocity(((Component)this).transform.position) : Vector3.zero); base.m_body.angularVelocity = Vector3.zero; base.m_maxAirAltitude = ((Component)this).transform.position.y; AttachColliders = AttachRoot.GetComponentsInChildren<Collider>(); Collider[] attachColliders = AttachColliders; foreach (Collider val in attachColliders) { Physics.IgnoreCollision((Collider)(object)base.m_collider, val, true); } ((Character)this).ResetCloth(); } public override void AttachStop() { if (!HasAttach) { return; } if (base.m_nview.IsOwner()) { NPCUtils.SetAttached(ref base.m_nview, attach: false); NPCUtils.SetSitting(ref base.m_nview, sit: false); } if (base.m_zanim.IsOwner() && AttachAnimation != null) { base.m_zanim.SetBool(AttachAnimation, false); } if (AttachColliders != null) { Collider[] attachColliders = AttachColliders; foreach (Collider val in attachColliders) { Physics.IgnoreCollision((Collider)(object)base.m_collider, val, false); } } HasAttach = false; AttachAnimation = ""; base.m_body.useGravity = true; base.m_body.mass = base.m_originalMass; AttachColliders = null; AttachRoot = null; ((Character)this).ResetCloth(); } public void SetFromConfig(NPCConfiguration.NPCConfig config, bool newSpawn) { if (config != null) { base.m_nview.ClaimOwnership(); if (config.StandStill && !HasAttach) { AttachStart(); } NPCRequiredKeysSet = Utility.StringToSet(config.RequiredKeys); NPCNotRequiredKeysSet = Utility.StringToSet(config.NotRequiredKeys); NPCUtils.SetZDOFromConfig(ref base.m_nview, config); } } public void SetName(string name) { base.m_nview.ClaimOwnership(); base.m_nview.GetZDO().Set(ZDOVars.s_tamedName, name); base.m_name = name; } public void SetSpawnPoint(Vector3 position) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) base.m_nview.ClaimOwnership(); NPCUtils.SetSpawnPoint(ref base.m_nview, position); } public void SetTrueDeath(bool death) { base.m_nview.ClaimOwnership(); NPCUtils.SetTrueDeath(ref base.m_nview, death); } public void SetRandom() { } public void SetRotation(Quaternion rotation) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) base.m_nview.ClaimOwnership(); if (NPCUtils.GetAttached(base.m_nview) && !NPCUtils.GetSitting(base.m_nview)) { AttachRotation = rotation; } else { ((Component)this).transform.rotation = rotation; } } } [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public class NPCConfiguration { [Serializable] [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(0)] public class NPCS { [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(1)] public List<NPCConfig> npcs; } [Serializable] [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] public class NPCConfig { public string Id { get; set; } public string Name { get; set; } public NPCUtils.NPCType Type { get; set; } public string DefaultText { get; set; } public string RequiredKeys { get; set; } public string NotRequiredKeys { get; set; } public string InteractKey { get; set; } public NPCUtils.NPCKeyType InteractKeyType { get; set; } public string DefeatKey { get; set; } public bool TrueDeath { get; set; } public bool StandStill { get; set; } public bool GiveDefaultItems { get; set; } public string InteractText { get; set; } public string GiveItem { get; set; } public int? GiveItemQuality { get; set; } public int? GiveItemAmount { get; set; } public string RewardText { get; set; } public string RewardItem { get; set; } public int? RewardItemQuality { get; set; } public int? RewardItemAmount { get; set; } public string RewardKey { get; set; } public NPCUtils.NPCKeyType RewardKeyType { get; set; } public int? RewardLimit { get; set; } public string Model { get; set; } public float? HairColorR { get; set; } public float? HairColorG { get; set; } public float? HairColorB { get; set; } public float? SkinColorR { get; set; } public float? SkinColorG { get; set; } public float? SkinColorB { get; set; } public int? ModelIndex { get; set; } public string Hair { get; set; } public string Beard { get; set; } public string Helmet { get; set; } public string Chest { get; set; } public string Legs { get; set; } public string Shoulder { get; set; } public int? ShoulderVariant { get; set; } public string Utility { get; set; } public string RightHand { get; set; } public string LeftHand { get; set; } public int? LeftHandVariant { get; set; } } private static readonly string FileName = "VV.NPCS.yaml"; protected static Dictionary<string, NPCConfig> Configurations; public static NPCConfig GetConfig(string id) { if (Configurations == null) { ReloadFile(); } id = id.ToLower(); if (Configurations.ContainsKey(id)) { NPCConfig nPCConfig; NPCConfig nPCConfig2 = (nPCConfig = Configurations[id]); if (nPCConfig.Name == null) { string text2 = (nPCConfig.Name = "Ragnar"); } nPCConfig = nPCConfig2; if (nPCConfig.DefaultText == null) { string text2 = (nPCConfig.DefaultText = ""); } nPCConfig = nPCConfig2; if (nPCConfig.RequiredKeys == null) { string text2 = (nPCConfig.RequiredKeys = ""); } nPCConfig = nPCConfig2; if (nPCConfig.NotRequiredKeys == null) { string text2 = (nPCConfig.NotRequiredKeys = ""); } nPCConfig = nPCConfig2; if (nPCConfig.InteractKey == null) { string text2 = (nPCConfig.InteractKey = ""); } nPCConfig = nPCConfig2; if (nPCConfig.DefeatKey == null) { string text2 = (nPCConfig.DefeatKey = ""); } nPCConfig = nPCConfig2; if (nPCConfig.InteractText == null) { string text2 = (nPCConfig.InteractText = ""); } nPCConfig = nPCConfig2; if (nPCConfig.GiveItem == null) { string text2 = (nPCConfig.GiveItem = ""); } nPCConfig = nPCConfig2; int? giveItemQuality = nPCConfig.GiveItemQuality; int valueOrDefault = giveItemQuality.GetValueOrDefault(); if (!giveItemQuality.HasValue) { valueOrDefault = -1; NPCConfig nPCConfig3 = nPCConfig; int? giveItemQuality2 = valueOrDefault; nPCConfig3.GiveItemQuality = giveItemQuality2; } nPCConfig = nPCConfig2; giveItemQuality = nPCConfig.GiveItemAmount; valueOrDefault = giveItemQuality.GetValueOrDefault(); if (!giveItemQuality.HasValue) { valueOrDefault = 1; NPCConfig nPCConfig4 = nPCConfig; int? giveItemQuality2 = valueOrDefault; nPCConfig4.GiveItemAmount = giveItemQuality2; } nPCConfig = nPCConfig2; if (nPCConfig.RewardText == null) { string text2 = (nPCConfig.RewardText = ""); } nPCConfig = nPCConfig2; if (nPCConfig.RewardItem == null) { string text2 = (nPCConfig.RewardItem = ""); } nPCConfig = nPCConfig2; giveItemQuality = nPCConfig.RewardItemQuality; valueOrDefault = giveItemQuality.GetValueOrDefault(); if (!giveItemQuality.HasValue) { valueOrDefault = 1; NPCConfig nPCConfig5 = nPCConfig; int? giveItemQuality2 = valueOrDefault; nPCConfig5.RewardItemQuality = giveItemQuality2; } nPCConfig = nPCConfig2; giveItemQuality = nPCConfig.RewardItemAmount; valueOrDefault = giveItemQuality.GetValueOrDefault(); if (!giveItemQuality.HasValue) { valueOrDefault = 1; NPCConfig nPCConfig6 = nPCConfig; int? giveItemQuality2 = valueOrDefault; nPCConfig6.RewardItemAmount = giveItemQuality2; } nPCConfig = nPCConfig2; if (nPCConfig.RewardKey == null) { string text2 = (nPCConfig.RewardKey = ""); } nPCConfig = nPCConfig2; giveItemQuality = nPCConfig.RewardLimit; valueOrDefault = giveItemQuality.GetValueOrDefault(); if (!giveItemQuality.HasValue) { valueOrDefault = -1; NPCConfig nPCConfig7 = nPCConfig; int? giveItemQuality2 = valueOrDefault; nPCConfig7.RewardLimit = giveItemQuality2; } nPCConfig = nPCConfig2; if (nPCConfig.Model == null) { string text2 = (nPCConfig.Model = "Player"); } nPCConfig = nPCConfig2; if (nPCConfig.Hair == null) { string text2 = (nPCConfig.Hair = ""); } nPCConfig = nPCConfig2; if (nPCConfig.Beard == null) { string text2 = (nPCConfig.Beard = ""); } nPCConfig = nPCConfig2; if (nPCConfig.Helmet == null) { string text2 = (nPCConfig.Helmet = ""); } nPCConfig = nPCConfig2; if (nPCConfig.Chest == null) { string text2 = (nPCConfig.Chest = ""); } nPCConfig = nPCConfig2; if (nPCConfig.Legs == null) { string text2 = (nPCConfig.Legs = ""); } nPCConfig = nPCConfig2; if (nPCConfig.Shoulder == null) { string text2 = (nPCConfig.Shoulder = ""); } nPCConfig = nPCConfig2; giveItemQuality = nPCConfig.ShoulderVariant; valueOrDefault = giveItemQuality.GetValueOrDefault(); if (!giveItemQuality.HasValue) { valueOrDefault = 0; NPCConfig nPCConfig8 = nPCConfig; int? giveItemQuality2 = valueOrDefault; nPCConfig8.ShoulderVariant = giveItemQuality2; } nPCConfig = nPCConfig2; if (nPCConfig.Utility == null) { string text2 = (nPCConfig.Utility = ""); } nPCConfig = nPCConfig2; if (nPCConfig.RightHand == null) { string text2 = (nPCConfig.RightHand = ""); } nPCConfig = nPCConfig2; if (nPCConfig.LeftHand == null) { string text2 = (nPCConfig.LeftHand = ""); } nPCConfig = nPCConfig2; giveItemQuality = nPCConfig.LeftHandVariant; valueOrDefault = giveItemQuality.GetValueOrDefault(); if (!giveItemQuality.HasValue) { valueOrDefault = 0; NPCConfig nPCConfig9 = nPCConfig; int? giveItemQuality2 = valueOrDefault; nPCConfig9.LeftHandVariant = giveItemQuality2; } return nPCConfig2; } return null; } public static void ReloadFile() { Configurations = new Dictionary<string, NPCConfig>(); NPCS nPCS = ReadFile(); if (nPCS != null) { for (int i = 0; i < nPCS.npcs.Count; i++) { NPCConfig nPCConfig = nPCS.npcs[i]; Configurations.Add(nPCConfig.Id.ToLower(), nPCConfig); } } } public static NPCS ReadFile() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; string path = configPath + directorySeparatorChar + FileName; try { using (new StreamReader(path)) { string input = File.ReadAllText(path); return new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build().Deserialize<NPCS>(input); } } catch (Exception ex) { NPCSPlugin.NPCSLogger.LogError((object)("Could not read file " + FileName)); NPCSPlugin.NPCSLogger.LogWarning((object)ex.Message); } return null; } } [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public class NPCFactory { private static List<Type> RemoveComponents = new List<Type> { typeof(PlayerController), typeof(Talker), typeof(Skills), typeof(CharacterDrop), typeof(NpcTalk), typeof(Tameable) }; public static GameObject SpawnNPC(Vector3 position, Quaternion rotation, string name = "Ragnar", string model = "Player") { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) string text = "vvnpcs_" + model; GameObject prefab = ZNetScene.instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { NPCSPlugin.NPCSLogger.LogError((object)"No prefab found"); return null; } GameObject obj = Object.Instantiate<GameObject>(prefab, position, rotation); INPC component = obj.GetComponent<INPC>(); if (component != null) { if (model.Equals("Player")) { component.SetRandom(); } component.SetName(name); component.SetSpawnPoint(position); } return obj; } public static GameObject SpawnSavedNPC(Vector3 position, Quaternion rotation, string id) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) NPCConfiguration.NPCConfig config = NPCConfiguration.GetConfig(id); if (config == null) { return null; } string text = "vvnpcs_" + config.Model; GameObject prefab = ZNetScene.instance.GetPrefab(StringExtensionMethods.GetStableHashCode(text)); if ((Object)(object)prefab == (Object)null) { NPCSPlugin.NPCSLogger.LogError((object)"No prefab found"); return null; } GameObject obj = Object.Instantiate<GameObject>(prefab, position, rotation); INPC component = obj.GetComponent<INPC>(); if (component != null) { component.SetFromConfig(config, newSpawn: true); component.SetSpawnPoint(position); } return obj; } public static GameObject RespawnNPC(GameObject original) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) ZNetView component = original.GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null) { return null; } Vector3 spawnPoint = NPCUtils.GetSpawnPoint(component); if (spawnPoint != Vector3.zero) { string prefabName = Utils.GetPrefabName(((Object)original).name); GameObject prefab = ZNetScene.instance.GetPrefab(StringExtensionMethods.GetStableHashCode(prefabName)); if ((Object)(object)prefab == (Object)null) { NPCSPlugin.NPCSLogger.LogDebug((object)"Issue finding prefab!"); return null; } GameObject val = Object.Instantiate<GameObject>(prefab, spawnPoint, Quaternion.identity); ZNetView copy = val.GetComponent<ZNetView>(); if ((Object)(object)copy == (Object)null) { NPCSPlugin.NPCSLogger.LogDebug((object)"Issue instantiating prefab!"); return null; } NPCUtils.CopyZDO(ref copy, component); VisEquipment component2 = original.GetComponent<VisEquipment>(); VisEquipment copy2 = val.GetComponent<VisEquipment>(); if ((Object)(object)component2 != (Object)null && (Object)(object)copy2 != (Object)null) { NPCUtils.CopyVisEquipment(ref copy2, component2); } return val; } NPCSPlugin.NPCSLogger.LogDebug((object)"No spawn point found!"); return null; } public static void AddNPCS() { CreateNPC("Player"); CreateNPC("Asksvin"); CreateNPC("Boar"); CreateNPC("Charred_Melee"); CreateNPC("Deer"); CreateNPC("Draugr"); CreateNPC("Dverger"); CreateNPC("Fenring"); CreateNPC("Fenring_Cultist"); CreateNPC("Ghost"); CreateNPC("Goblin"); CreateNPC("GoblinShaman"); CreateNPC("Greydwarf"); CreateNPC("Greyling"); CreateNPC("Lox"); CreateNPC("Neck"); CreateNPC("Skeleton"); CreateNPC("Troll"); CreateNPC("Wolf"); } public static GameObject CreateNPC(string model) { //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance == (Object)null) { NPCSPlugin.NPCSLogger.LogError((object)"ZNetScene not ready"); return null; } GameObject prefab = ZNetScene.instance.GetPrefab(StringExtensionMethods.GetStableHashCode(model)); if ((Object)(object)prefab == (Object)null) { NPCSPlugin.NPCSLogger.LogError((object)"No prefab found"); return null; } bool activeSelf = prefab.activeSelf; prefab.SetActive(false); GameObject val = NPCUtils.CreateGameObject(prefab, model); foreach (Type removeComponent in RemoveComponents) { Component component = val.GetComponent(removeComponent); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } } Character component2 = prefab.GetComponent<Character>(); Character component3 = val.GetComponent<Character>(); Character npc = null; if ((Object)(object)component2 != (Object)null) { Object.DestroyImmediate((Object)(object)component3); npc = (Character)((!(component2 is Humanoid)) ? ((INPC)val.AddComponent<NPCCharacter>()) : ((INPC)val.AddComponent<NPCHumanoid>())); } SetupNPC<Character>(ref npc, component2); if (model.Equals("Player")) { ((Humanoid)(npc as NPCHumanoid)).m_defaultItems = (GameObject[])(object)new GameObject[0]; npc.m_walkSpeed = 2f; npc.m_speed = 2f; npc.m_runSpeed = 4f; npc.m_health = 200f; } npc.m_eye = Utils.FindChild(((Component)npc).gameObject.transform, "EyePos", (IterativeSearchType)0); npc.m_faction = (Faction)10; npc.m_tamed = false; npc.m_group = "VV_NPC"; BaseAI component4 = val.GetComponent<BaseAI>(); if ((Object)(object)component4 == (Object)null) { val.AddComponent<NPCAI>(); } else if (component4 is MonsterAI) { MonsterAI component5 = prefab.GetComponent<MonsterAI>(); Object.DestroyImmediate((Object)(object)component4); NPCAI npcAI = val.AddComponent<NPCAI>(); SetupMonsterAI(ref npcAI, component5); } else if (component4 is AnimalAI) { AnimalAI component6 = prefab.GetComponent<AnimalAI>(); Object.DestroyImmediate((Object)(object)component4); NPCAnimalAI npcAI2 = val.AddComponent<NPCAnimalAI>(); SetupAnimalAI(ref npcAI2, component6); } ZNetView component7 = val.GetComponent<ZNetView>(); component7.m_persistent = true; component7.m_type = (ObjectType)0; ZSyncTransform component8 = val.GetComponent<ZSyncTransform>(); component8.m_syncPosition = true; component8.m_syncRotation = true; component8.m_syncBodyVelocity = false; component8.m_characterParentSync = false; prefab.SetActive(activeSelf); val.SetActive(activeSelf); NPCUtils.RegisterGameObject(val); return val; } private static void SetupNPC<[<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] T>(ref T npc, Character original) where T : Character { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown Utility.CopyFields<Character, T>(original, ref npc); EffectData[] effectPrefabs = original.m_deathEffects.m_effectPrefabs; EffectData[] array = (EffectData[])(object)new EffectData[effectPrefabs.Length]; for (int i = 0; i < effectPrefabs.Length; i++) { array[i] = new EffectData(); Utility.CopyFields<EffectData, EffectData>(effectPrefabs[i], ref array[i]); if ((Object)(object)effectPrefabs[i].m_prefab != (Object)null && Object.op_Implicit((Object)(object)effectPrefabs[i].m_prefab.GetComponent<Ragdoll>())) { array[i].m_prefab = SetupRagdoll(effectPrefabs[i].m_prefab); } } ((Character)npc).m_deathEffects = new EffectList(); ((Character)npc).m_deathEffects.m_effectPrefabs = array; } private static GameObject SetupRagdoll(GameObject original) { //IL_00a9: 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_0055: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown bool activeSelf = original.activeSelf; original.SetActive(false); GameObject val = NPCUtils.CreateGameObject(original, ((Object)original).name); Ragdoll component = original.GetComponent<Ragdoll>(); Object.DestroyImmediate((Object)(object)val.GetComponent<Ragdoll>()); NPCRagdoll clone = val.AddComponent<NPCRagdoll>(); Utility.CopyFields<Ragdoll, NPCRagdoll>(component, ref clone); if (((Ragdoll)clone).m_removeEffect.m_effectPrefabs.Length == 0) { ((Ragdoll)clone).m_removeEffect = new EffectList(); GameObject prefab = ZNetScene.instance.GetPrefab(StringExtensionMethods.GetStableHashCode("vfx_corpse_destruction_small")); EffectData val2 = new EffectData(); val2.m_prefab = prefab; ((Ragdoll)clone).m_removeEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[1]; ((Ragdoll)clone).m_removeEffect.m_effectPrefabs[0] = val2; } ZNetView component2 = val.GetComponent<ZNetView>(); component2.m_persistent = true; component2.m_type = (ObjectType)0; val.layer = 0; Rigidbody[] componentsInChildren = val.GetComponentsInChildren<Rigidbody>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = 0; } original.SetActive(activeSelf); val.SetActive(activeSelf); NPCUtils.RegisterGameObject(val); return val; } private static void SetupMonsterAI(ref NPCAI npcAI, MonsterAI original) { Utility.CopyFields<MonsterAI, NPCAI>(original, ref npcAI); NPCAI.SetupExisting(ref npcAI); } private static void SetupAnimalAI(ref NPCAnimalAI npcAI, AnimalAI original) { Utility.CopyFields<AnimalAI, NPCAnimalAI>(original, ref npcAI); NPCAnimalAI.SetupExisting(ref npcAI); } } [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public class NPCHumanoid : Humanoid, Interactable, Hoverable, INPC { public bool HasAttach; public Vector3 AttachPosition; public Quaternion AttachRotation; public string AttachAnimation; public GameObject AttachRoot; public Collider[] AttachColliders; protected HashSet<string> NPCRequiredKeysSet = new HashSet<string>(); protected HashSet<string> NPCNotRequiredKeysSet = new HashSet<string>(); private bool _newSpawn; public override void Awake() { ((Humanoid)this).Awake(); IEnumerator enumerator = SetUp(); ((MonoBehaviour)this).StartCoroutine(enumerator); } public override void Start() { if (!NPCUtils.GetInitialized(((Character)this).m_nview)) { ((Humanoid)this).Start(); } } public override void OnDestroy() { ((Humanoid)this).OnDestroy(); } public IEnumerator SetUp() { yield return null; yield return null; ((Character)this).m_name = NPCUtils.GetTamedName(((Character)this).m_nview); if (NPCUtils.GetSitting(((Character)this).m_nview)) { Chair closestChair = Utility.GetClosestChair(((Component)this).transform.position, ((Component)this).transform.localScale / 2f); if ((Object)(object)closestChair != (Object)null) { AttachStart(closestChair); } } else if (NPCUtils.GetAttached(((Character)this).m_nview)) { AttachStart(); } NPCRequiredKeysSet = Utility.StringToSet(NPCUtils.GetNPCRequiredKeys(((Character)this).m_nview)); NPCNotRequiredKeysSet = Utility.StringToSet(NPCUtils.GetNPCNotRequiredKeys(((Character)this).m_nview)); ((Character)this).m_defeatSetGlobalKey = NPCUtils.GetNPCDefeatKey(((Character)this).m_nview); ((Character)this).m_nview.GetZDO().Set(ZDOVars.s_tamed, false); ((Character)this).m_tamed = false; if (!_newSpawn && (Object)(object)base.m_visEquipment != (Object)null && (Object)(object)base.m_visEquipment.m_nview != (Object)null) { SetHelmet(base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_helmetItem, 0)); SetChest(base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_chestItem, 0)); SetLegs(base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_legItem, 0)); SetShoulder(base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_shoulderItem, 0), base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_shoulderItemVariant, 0)); SetUtility(base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_utilityItem, 0)); SetLeftHand(base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_leftItem, 0), base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_leftItemVariant, 0)); SetRightHand(base.m_visEquipment.m_nview.GetZDO().GetInt(ZDOVars.s_rightItem, 0)); } } public override void CustomFixedUpdate(float fixedDeltaTime) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (!((Character)this).m_nview.IsValid() || !((Character)this).m_nview.IsOwner()) { return; } ((Humanoid)this).CustomFixedUpdate(fixedDeltaTime); if (!HasAttach) { return; } ((Component)this).transform.position = AttachPosition; ((Component)this).transform.rotation = AttachRotation; Vector3 velocity = Vector3.zero; if ((Object)(object)AttachRoot != (Object)null) { Rigidbody componentInParent = AttachRoot.GetComponentInParent<Rigidbody>(); if ((Object)(object)componentInParent != (Object)null) { velocity = componentInParent.GetPointVelocity(((Component)this).transform.position); } } ((Character)this).m_body.velocity = velocity; ((Character)this).m_body.useGravity = false; ((Character)this).m_body.angularVelocity = Vector3.zero; ((Character)this).m_maxAirAltitude = ((Component)this).transform.position.y; } public override void OnDeath() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Character)this).m_nview == (Object)null || !((Character)this).m_nview.IsOwner()) { return; } GameObject[] array = ((Character)this).m_deathEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1); for (int i = 0; i < array.Length; i++) { Ragdoll component = array[i].GetComponent<Ragdoll>(); if ((Object)(object)component != (Object)null) { Vector3 val = ((Character)this).m_body.velocity; if (((Vector3)(ref ((Character)this).m_pushForce)).magnitude * 0.5f > ((Vector3)(ref val)).magnitude) { val = ((Character)this).m_pushForce * 0.5f; } component.Setup(val, 0f, 0f, 0f, (CharacterDrop)null); VisEquipment copy = array[i].GetComponent<VisEquipment>(); if ((Object)(object)copy != (Object)null) { NPCUtils.CopyVisEquipment(ref copy, base.m_visEquipment); } NPCUtils.SetTamedName(ref component.m_nview, ((Character)this).m_name); NPCUtils.SetTrueDeath(ref component.m_nview, NPCUtils.GetTrueDeath(((Character)this).m_nview)); } } Utility.SetKey(((Character)this).m_defeatSetGlobalKey, global: true); if (((Character)this).m_onDeath != null) { ((Character)this).m_onDeath(); } if (!NPCUtils.GetTrueDeath(((Character)this).m_nview)) { NPCFactory.RespawnNPC(((Component)((Component)this).transform.root).gameObject); } ZNetScene.instance.Destroy(((Component)this).gameObject); } public bool Interact(Humanoid user, bool hold, bool alt) { return NPCUtils.TryInteract(((Component)this).gameObject); } public bool UseItem(Humanoid user, ItemData item) { return NPCUtils.TryUseItem(((Component)this).gameObject, item); } public override string GetHoverText() { return NPCUtils.GetHoverText(((Character)this).m_nview, ((Character)this).m_baseAI); } public override string GetHoverName() { return ((Character)this).m_name; } public HashSet<string> GetRequiredKeysSet() { return NPCRequiredKeysSet; } public HashSet<string> GetNotRequiredKeysSet() { return NPCNotRequiredKeysSet; } public override bool IsAttached() { if (!HasAttach) { return ((Humanoid)this).IsAttached(); } return true; } public void Attach(bool attach, Chair chair = null) { ((Character)this).m_nview.ClaimOwnership(); if (attach) { ((Character)this).AttachStop(); if ((Object)(object)chair != (Object)null) { AttachStart(chair); } else { AttachStart(); } } else { ((Character)this).AttachStop(); } } public void AttachStart() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) HasAttach = true; AttachPosition = ((Component)this).transform.position; AttachRotation = ((Component)this).transform.rotation; if (((Character)this).m_nview.IsOwner()) { NPCUtils.SetAttached(ref ((Character)this).m_nview, attach: true); } ((Character)this).m_body.mass = 1000f; ((Character)this).m_body.useGravity = false; ((Character)this).m_body.velocity = Vector3.zero; ((Character)this).m_body.angularVelocity = Vector3.zero; ((Character)this).m_maxAirAltitude = ((Component)this).transform.position.y; } public void AttachStart(Chair chair) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0052: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) HasAttach = true; AttachPosition = chair.m_attachPoint.position; AttachRotation = chair.m_attachPoint.rotation; AttachAnimation = chair.m_attachAnimation; AttachRoot = ((Component)((Component)chair).transform.root).gameObject; ((Component)this).transform.position = AttachPosition; ((Component)this).transform.rotation = AttachRotation; if (((Character)this).m_nview.IsOwner()) { ((Character)this).m_zanim.SetBool(AttachAnimation, true); NPCUtils.SetSitting(ref ((Character)this).m_nview, sit: true); } ((Character)this).m_body.mass = 1000f; Rigidbody component = AttachRoot.GetComponent<Rigidbody>(); ((Character)this).m_body.useGravity = false; ((Character)this).m_body.velocity = (Object.op_Implicit((Object)(object)component) ? component.GetPointVelocity(((Component)this).transform.position) : Vector3.zero); ((Character)this).m_body.angularVelocity = Vector3.zero; ((Character)this).m_maxAirAltitude = ((Component)this).transform.position.y; AttachColliders = AttachRoot.GetComponentsInChildren<Collider>(); Collider[] attachColliders = AttachColliders; foreach (Collider val in attachColliders) { Physics.IgnoreCollision((Collider)(object)((Character)this).m_collider, val, true); } ((Humanoid)this).HideHandItems(false, true); ((Character)this).ResetCloth(); } public override void AttachStop() { if (!HasAttach) { return; } if (((Character)this).m_nview.IsOwner()) { NPCUtils.SetAttached(ref ((Character)this).m_nview, attach: false); NPCUtils.SetSitting(ref ((Character)this).m_nview, sit: false); } if (((Character)this).m_zanim.IsOwner() && AttachAnimation != null) { ((Character)this).m_zanim.SetBool(AttachAnimation, false); } if (AttachColliders != null) { Collider[] attachColliders = AttachColliders; foreach (Collider val in attachColliders) { Physics.IgnoreCollision((Collider)(object)((Character)this).m_collider, val, false); } } HasAttach = false; AttachAnimation = ""; ((Character)this).m_body.useGravity = true; ((Character)this).m_body.mass = ((Character)this).m_originalMass; AttachColliders = null; AttachRoot = null; ((Humanoid)this).ShowHandItems(false, true); ((Character)this).ResetCloth(); } public void SetFromConfig(NPCConfiguration.NPCConfig config, bool newSpawn) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) _newSpawn = newSpawn; if (config == null) { return; } ((Character)this).m_nview.ClaimOwnership(); Random.InitState((int)DateTime.Now.Ticks); base.m_inventory.RemoveAll(); if (config.StandStill && !HasAttach) { AttachStart(); } if (config.ModelIndex.HasValue) { SetModel(config.ModelIndex.Value); } if ((Object)(object)base.m_visEquipment != (Object)null) { if (config.SkinColorR.HasValue && config.SkinColorG.HasValue && config.SkinColorB.HasValue) { SetSkinColor(config.SkinColorR.Value, config.SkinColorG.Value, config.SkinColorB.Value); } else { SetSkinColor(GetRandomSkinColor()); } if (config.HairColorR.HasValue && config.HairColorG.HasValue && config.HairColorB.HasValue) { SetHairColor(config.HairColorR.Value, config.HairColorG.Value, config.HairColorB.Value); } else { SetHairColor(GetRandomHairColor()); } SetNPCHair(config.Hair); SetNPCBeard(config.Beard); SetHelmet(config.Helmet); SetChest(config.Chest); SetLegs(config.Legs); SetUtility(config.Utility); SetShoulder(config.Shoulder, config.ShoulderVariant.Value); SetLeftHand(config.LeftHand, config.LeftHandVariant.Value); SetRightHand(config.RightHand); } NPCRequiredKeysSet = Utility.StringToSet(config.RequiredKeys); NPCNotRequiredKeysSet = Utility.StringToSet(config.NotRequiredKeys); NPCUtils.SetZDOFromConfig(ref ((Character)this).m_nview, config); } public void SetName(string name) { ((Character)this).m_nview.ClaimOwnership(); ((Character)this).m_nview.GetZDO().Set(ZDOVars.s_tamedName, name); ((Character)this).m_name = name; } public void SetSpawnPoint(Vector3 position) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) ((Character)this).m_nview.ClaimOwnership(); NPCUtils.SetSpawnPoint(ref ((Character)this).m_nview, position); } public void SetTrueDeath(bool death) { ((Character)this).m_nview.ClaimOwnership(); NPCUtils.SetTrueDeath(ref ((Character)this).m_nview, death); } public void SetRandom() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ((Character)this).m_nview.ClaimOwnership(); Random.InitState((int)DateTime.Now.Ticks); int num = Random.Range(0, 2); SetModel(num); SetSkinColor(GetRandomSkinColor()); SetNPCHair("Hair" + Random.Range(1, 32)); SetHairColor(GetRandomHairColor()); switch (num) { case 0: SetRandomMale(); break; case 1: SetRandomFemale(); break; } } protected void SetRandomMale() { int num = Random.Range(1, 30); if (num <= 21) { SetNPCBeard("Beard" + num); } int num2 = Random.Range(1, 25); if (num2 <= 10) { SetHelmet("HelmetHat" + num2); } else if (num2 < 16) { SetHelmet("HelmetLeather"); } int num3 = Random.Range(1, 15); if (num3 > 10) { SetChest("ArmorLeatherChest"); } else { SetChest("ArmorTunic" + num3); } if (Random.Range(0, 15) < 10) { SetLegs("ArmorLeatherLegs"); } else { SetLegs("ArmorRagsLegs"); } } protected void SetRandomFemale() { SetNPCBeard(""); int num = Random.Range(1, 25); if (num <= 10) { SetHelmet("HelmetHat" + num); } else if (num < 17) { SetHelmet("HelmetMidsummerCrown"); } int num2 = Random.Range(1, 15); if (num2 <= 10) { SetChest("ArmorDress" + num2); } else { SetChest("ArmorLeatherChest"); } int num3 = Random.Range(0, 15); if (num3 < 5) { SetLegs("ArmorLeatherLegs"); } else if (num3 < 8) { SetLegs("ArmorRagsLegs"); } } protected void SetNPCHair(string name) { base.m_hairItem = name; base.m_visEquipment.SetHairItem(name); } protected void SetHairColor(Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) SetHairColor(color.r, color.g, color.b); } protected void SetHairColor(float r, float g, float b) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Vector3 hairColor = default(Vector3); ((Vector3)(ref hairColor))..ctor(r, g, b); base.m_visEquipment.SetHairColor(hairColor); } protected void SetSkinColor(Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) SetSkinColor(color.r, color.g, color.b); } protected void SetSkinColor(float r, float g, float b) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Vector3 skinColor = default(Vector3); ((Vector3)(ref skinColor))..ctor(r, g, b); base.m_visEquipment.SetSkinColor(skinColor); } protected void SetNPCBeard(string name) { base.m_beardItem = name; base.m_visEquipment.SetBeardItem(name); } protected void SetModel(int index) { base.m_visEquipment.SetModel(index); } private void SetItem(ref ItemData slot, int hash, int variant = -1) { if (base.m_inventory == null || !Utility.GetItemPrefab(hash, out var item)) { slot = null; return; } ItemData val = ((Humanoid)this).PickupPrefab(item, 0, false); if (val != null) { if (variant != -1) { val.m_variant = variant; } ((Humanoid)this).EquipItem(val, false); } } protected void SetHelmet(string name) { base.m_visEquipment.SetHelmetItem(name); SetHelmet(StringExtensionMethods.GetStableHashCode(name)); } protected void SetHelmet(int hash) { SetItem(ref base.m_helmetItem, hash); } protected void SetChest(string name) { base.m_visEquipment.SetChestItem(name); SetChest(StringExtensionMethods.GetStableHashCode(name)); } protected void SetChest(int hash) { SetItem(ref base.m_chestItem, hash); } protected void SetLegs(string name) { base.m_visEquipment.SetLegItem(name); SetLegs(StringExtensionMethods.GetStableHashCode(name)); } protected void SetLegs(int hash) { SetItem(ref base.m_legItem, hash); } protected void SetShoulder(string name, int variant = 0) { base.m_visEquipment.SetShoulderItem(name, variant); SetShoulder(StringExtensionMethods.GetStableHashCode(name), variant); } protected void SetShoulder(int hash, int variant = 0) { SetItem(ref base.m_shoulderItem, hash, variant); } protected void SetUtility(string name) { base.m_visEquipment.SetUtilityItem(name); SetUtility(StringExtensionMethods.GetStableHashCode(name)); } protected void SetUtility(int hash) { SetItem(ref base.m_utilityItem, hash); } protected void SetRightHand(string name) { base.m_visEquipment.SetRightItem(name); SetRightHand(StringExtensionMethods.GetStableHashCode(name)); } protected void SetRightHand(int hash) { SetItem(ref base.m_rightItem, hash); } protected void SetLeftHand(string name, int variant = 0) { base.m_visEquipment.SetLeftItem(name, variant); SetLeftHand(StringExtensionMethods.GetStableHashCode(name), variant); } protected void SetLeftHand(int hash, int variant = 0) { SetItem(ref base.m_leftItem, hash, variant); } protected Color GetRandomSkinColor() { //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_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_0025: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, 1f); return Color.Lerp(Color32.op_Implicit(NPCUtils.SkinColorMin), Color32.op_Implicit(NPCUtils.SkinColorMax), num); } protected Color GetRandomHairColor() { //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, 1f); float num2 = Random.Range(0f, 1f); return Color.Lerp(Color32.op_Implicit(NPCUtils.HairColorMin), Color32.op_Implicit(NPCUtils.HairColorMax), num) * Mathf.Lerp(0.1f, 1f, num2); } public string GetSkinColor() { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Vector3 skinColor = NPCUtils.GetSkinColor(((Character)this).m_nview); return $"Skin Color RGB: {skinColor.x}, {skinColor.y}, {skinColor.z}"; } public string GetHairColor() { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Vector3 hairColor = NPCUtils.GetHairColor(((Character)this).m_nview); return $"Hair Color RGB: {hairColor.x}, {hairColor.y}, {hairColor.z}"; } public void SetRotation(Quaternion rotation) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) ((Character)this).m_nview.ClaimOwnership(); if (NPCUtils.GetAttached(((Character)this).m_nview) && !NPCUtils.GetSitting(((Character)this).m_nview)) { AttachRotation = rotation; } else { ((Component)this).transform.rotation = rotation; } } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] public class NPCRagdoll : Ragdoll, Interactable, Hoverable { public void Awake() { base.m_nview = ((Component)this).GetComponent<ZNetView>(); base.m_bodies = ((Component)this).GetComponentsInChildren<Rigidbody>(); ((MonoBehaviour)this).Invoke("RemoveInitVel", 2f); if (Object.op_Implicit((Object)(object)base.m_mainModel)) { float @float = base.m_nview.GetZDO().GetFloat(ZDOVars.s_hue, 0f); float float2 = base.m_nview.GetZDO().GetFloat(ZDOVars.s_saturation, 0f); float float3 = base.m_nview.GetZDO().GetFloat(ZDOVars.s_value, 0f); base.m_mainModel.material.SetFloat("_Hue", @float); base.m_mainModel.material.SetFloat("_Saturation", float2); base.m_mainModel.material.SetFloat("_Value", float3); } base.m_ttl = 4f; IEnumerator enumerator = SetUp(); ((MonoBehaviour)this).StartCoroutine(enumerator); } public IEnumerator SetUp() { yield return null; yield return null; if (!base.m_nview.GetZDO().GetBool("VV_TrueDeath", false)) { ((MonoBehaviour)this).InvokeRepeating("DestroyNow", base.m_ttl, 1f); } } public bool Interact(Humanoid user, bool hold, bool alt) { ((Ragdoll)this).DestroyNow(); return false; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverText() { if ((Object)(object)base.m_nview != (Object)null && base.m_nview.GetZDO() != null && base.m_nview.GetZDO().GetBool("VV_TrueDeath", false)) { return Localization.instance.Localize(base.m_nview.GetZDO().GetString(ZDOVars.s_tamedName, "") + "\n[<color=yellow><b>$KEY_Use</b></color>] Bury Body\n[<color=yellow><b>F</b></color>] Pay Respects"); } return ""; } public string GetHoverName() { return ""; } } public class NPCTamable : Tameable { public void Awake() { base.m_fedDuration = 60f; base.m_tamingTime = 10000f; base.m_startsTamed = false; base.m_commandable = false; ((Tameable)this).Awake(); } } [<dfc8a453-6986-49ce-aefe-253b4e3f0a59>Nullable(0)] [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] public class NPCUtils { [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(0)] public enum NPCType { None, Information, Reward, Sellsword, SlayTarget, Trader } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(0)] public enum NPCKeyType { Player, Global } public const string NPCGROUP = "VV_NPC"; public static readonly int NONE_HASH = StringExtensionMethods.GetStableHashCode("none"); public static readonly Color32 HairColorMin = new Color32(byte.MaxValue, (byte)237, (byte)180, byte.MaxValue); public static readonly Color32 HairColorMax = new Color32(byte.MaxValue, (byte)124, (byte)71, byte.MaxValue); public static readonly Color32 SkinColorMin = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); public static readonly Color32 SkinColorMax = new Color32((byte)76, (byte)76, (byte)76, byte.MaxValue); public const string ZDOVar_INITIALIZED = "VV_Initialized"; public const string ZDOVar_NPCTYPE = "VV_NPCType"; public const string ZDOVar_SITTING = "VV_Sitting"; public const string ZDOVar_ATTACHED = "VV_Attached"; public const string ZDOVar_SPAWNPOINT = "VV_SpawnPoint"; public const string ZDOVar_DEFAULTTEXT = "VV_DefaultText"; public const string ZDOVar_INTERACTTEXT = "VV_InteractText"; public const string ZDOVar_GIVEITEM = "VV_GiveItem"; public const string ZDOVar_GIVEITEMQUALITY = "VV_UseItemQuality"; public const string ZDOVar_GIVEITEMAMOUNT = "VV_UseItemAmount"; public const string ZDOVar_REWARDTEXT = "VV_RewardText"; public const string ZDOVar_REWARDITEM = "VV_RewardItem"; public const string ZDOVar_REWARDITEMQUALITY = "VV_RewardItemQualtiy"; public const string ZDOVar_REWARDITEMAMOUNT = "VV_RewardItemAmount"; public const string ZDOVar_REWARDLIMIT = "VV_RewardLimit"; public const string ZDOVar_REQUIREDKEYS = "VV_RequiredKeys"; public const string ZDOVar_NOTREQUIREDKEYS = "VV_NotRequiredKeys"; public const string ZDOVar_INTERACTKEY = "VV_InteractKey"; public const string ZDOVar_INTERACTKEYTYPE = "VV_InteractKeyType"; public const string ZDOVar_REWARDKEY = "VV_RewardKey"; public const string ZDOVar_REWARDKEYTYPE = "VV_RewardKeyType"; public const string ZDOVar_DEFEATKEY = "VV_DefeatKey"; public const string ZDOVar_TRUEDEATH = "VV_TrueDeath"; public static List<int> ZdoVisEquipment = new List<int> { ZDOVars.s_beardItem, ZDOVars.s_hairItem, ZDOVars.s_helmetItem, ZDOVars.s_chestItem, ZDOVars.s_legItem, ZDOVars.s_shoulderItem, ZDOVars.s_shoulderItemVariant, ZDOVars.s_utilityItem, ZDOVars.s_rightItem, ZDOVars.s_leftItem, ZDOVars.s_leftItemVariant }; public static bool GetInitialized(ZNetView nview) { return nview.GetZDO().GetBool("VV_Initialized", false); } public static void SetInitialized(ref ZNetView nview, bool init) { nview.GetZDO().Set("VV_Initialized", init); } public static string GetTamedName(ZNetView nview) { return nview.GetZDO().GetString(ZDOVars.s_tamedName, ""); } public static void SetTamedName(ref ZNetView nview, string name) { nview.GetZDO().Set(ZDOVars.s_tamedName, name); } public static int GetType(ZNetView nview) { return nview.GetZDO().GetInt("VV_NPCType", 0); } public static void SetType(ref ZNetView nview, int type) { nview.GetZDO().Set("VV_NPCType", type); } public static bool GetSitting(ZNetView nview) { return nview.GetZDO().GetBool("VV_Sitting", false); } public static void SetSitting(ref ZNetView nview, bool sit) { nview.GetZDO().Set("VV_Sitting", sit); } public static bool GetAttached(ZNetView nview) { return nview.GetZDO().GetBool("VV_Attached", false); } public static void SetAttached(ref ZNetView nview, bool attach) { nview.GetZDO().Set("VV_Attached", attach); } public static Vector3 GetSpawnPoint(ZNetView nview) { //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) return nview.GetZDO().GetVec3("VV_SpawnPoint", Vector3.zero); } public static void SetSpawnPoint(ref ZNetView nview, Vector3 point) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) nview.GetZDO().Set("VV_SpawnPoint", point); } public static string GetNPCDefaultText(ZNetView nview) { return nview.GetZDO().GetString("VV_DefaultText", ""); } public static void SetNPCDefaultText(ref ZNetView nview, string text) { nview.GetZDO().Set("VV_DefaultText", text); } public static string GetNPCInteractText(ZNetView nview) { return nview.GetZDO().GetString("VV_InteractText", ""); } public static void SetNPCInteractText(ref ZNetView nview, string text) { nview.GetZDO().Set("VV_InteractText", text); } public static string GetNPCGiveItem(ZNetView nview) { return nview.GetZDO().GetString("VV_GiveItem", ""); } public static void SetNPCGiveItem(ref ZNetView nview, string item) { nview.GetZDO().Set("VV_GiveItem", item); } public static int GetNPCGiveItemQuality(ZNetView nview) { return nview.GetZDO().GetInt("VV_UseItemQuality", 0); } public static void SetNPCGiveItemQuality(ref ZNetView nview, int quality) { nview.GetZDO().Set("VV_UseItemQuality", quality); } public static int GetNPCGiveItemAmount(ZNetView nview) { return nview.GetZDO().GetInt("VV_UseItemAmount", 0); } public static void SetNPCGiveItemAmount(ref ZNetView nview, int amount) { nview.GetZDO().Set("VV_UseItemAmount", amount); } public static string GetNPCRewardText(ZNetView nview) { return nview.GetZDO().GetString("VV_RewardText", ""); } public static void SetNPCRewardText(ref ZNetView nview, string text) { nview.GetZDO().Set("VV_RewardText", text); } public static string GetNPCRewardItem(ZNetView nview) { return nview.GetZDO().GetString("VV_RewardItem", ""); } public static void SetNPCRewardItem(ref ZNetView nview, string item) { nview.GetZDO().Set("VV_RewardItem", item); } public static int GetNPCRewardItemQuality(ZNetView nview) { return nview.GetZDO().GetInt("VV_RewardItemQualtiy", 0); } public static void SetNPCRewardItemQuality(ref ZNetView nview, int quality) { nview.GetZDO().Set("VV_RewardItemQualtiy", quality); } public static int GetNPCRewardItemAmount(ZNetView nview) { return nview.GetZDO().GetInt("VV_RewardItemAmount", 0); } public static void SetNPCRewardItemAmount(ref ZNetView nview, int amount) { nview.GetZDO().Set("VV_RewardItemAmount", amount); } public static int GetNPCRewardLimit(ZNetView nview) { return nview.GetZDO().GetInt("VV_RewardLimit", -1); } public static void SetNPCRewardLimit(ref ZNetView nview, int limit) { nview.GetZDO().Set("VV_RewardLimit", limit); } public static string GetNPCRequiredKeys(ZNetView nview) { return nview.GetZDO().GetString("VV_RequiredKeys", ""); } public static void SetNPCRequiredKeys(ref ZNetView nview, string keys) { nview.GetZDO().Set("VV_RequiredKeys", keys); } public static string GetNPCNotRequiredKeys(ZNetView nview) { return nview.GetZDO().GetString("VV_NotRequiredKeys", ""); } public static void SetNPCNotRequiredKeys(ref ZNetView nview, string keys) { nview.GetZDO().Set("VV_NotRequiredKeys", keys); } public static string GetNPCInteractKey(ZNetView nview) { return nview.GetZDO().GetString("VV_InteractKey", ""); } public static void SetNPCInteractKey(ref ZNetView nview, string key) { nview.GetZDO().Set("VV_InteractKey", key); } public static bool GetNPCInteractKeyType(ZNetView nview) { return nview.GetZDO().GetBool("VV_InteractKeyType", false); } public static void SetNPCInteractKeyType(ref ZNetView nview, bool type) { nview.GetZDO().Set("VV_InteractKeyType", type); } public static string GetNPCRewardKey(ZNetView nview) { return nview.GetZDO().GetString("VV_RewardKey", ""); } public static void SetNPCRewardKey(ref ZNetView nview, string key) { nview.GetZDO().Set("VV_RewardKey", key); } public static bool GetNPCRewardKeyType(ZNetView nview) { return nview.GetZDO().GetBool("VV_RewardKeyType", false); } public static void SetNPCRewardKeyType(ref ZNetView nview, bool type) { nview.GetZDO().Set("VV_RewardKeyType", type); } public static string GetNPCDefeatKey(ZNetView nview) { return nview.GetZDO().GetString("VV_DefeatKey", ""); } public static void SetNPCDefeatKey(ref ZNetView nview, string key) { nview.GetZDO().Set("VV_DefeatKey", key); } public static bool GetTrueDeath(ZNetView nview) { return nview.GetZDO().GetBool("VV_TrueDeath", false); } public static void SetTrueDeath(ref ZNetView nview, bool death) { nview.GetZDO().Set("VV_TrueDeath", death); } public static Vector3 GetSkinColor(ZNetView nview) { //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) return nview.GetZDO().GetVec3(ZDOVars.s_skinColor, Vector3.zero); } public static Vector3 GetHairColor(ZNetView nview) { //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) return nview.GetZDO().GetVec3(ZDOVars.s_hairColor, Vector3.zero); } public static string SetupText(ZNetView zNetView, string text) { if ((Object)(object)zNetView == (Object)null) { return text; } string text2 = GetNPCGiveItem(zNetView); if (Utility.GetItemDrop(text2, out var item)) { text2 = item.m_itemData.m_shared.m_name; } string text3 = $"{GetNPCGiveItemAmount(zNetView)} {text2}"; if (GetNPCGiveItemQuality(zNetView) > 1) { text3 += $" *{GetNPCGiveItemQuality(zNetView)}"; } string text4 = GetNPCRewardItem(zNetView); if (Utility.GetItemDrop(text4, out var item2)) { text4 = item2.m_itemData.m_shared.m_name; } string text5 = $"{GetNPCRewardItemAmount(zNetView)} {text4}"; if (GetNPCRewardItemQuality(zNetView) > 1) { text5 += $" *{GetNPCRewardItemQuality(zNetView)}"; } text = text.Replace("{giveitem}", text3).Replace("{reward}", text5); return Localization.instance.Localize(text); } public static void CopyZDO(ref ZNetView copy, ZNetView original) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) copy.GetZDO().Set(ZDOVars.s_seed, original.GetZDO().GetInt(ZDOVars.s_seed, 0), false); SetInitialized(ref copy, GetInitialized(original)); SetTamedName(ref copy, GetTamedName(original)); SetType(ref copy, GetType(original)); SetSitting(ref copy, GetSitting(original)); SetAttached(ref copy, GetAttached(original)); SetSpawnPoint(ref copy, GetSpawnPoint(original)); SetTrueDeath(ref copy, GetTrueDeath(original)); SetNPCDefaultText(ref copy, GetNPCDefaultText(original)); SetNPCInteractText(ref copy, GetNPCInteractText(original)); SetNPCGiveItem(ref copy, GetNPCGiveItem(original)); SetNPCGiveItemQuality(ref copy, GetNPCGiveItemQuality(original)); SetNPCGiveItemAmount(ref copy, GetNPCGiveItemAmount(original)); SetNPCRewardText(ref copy, GetNPCRewardText(original)); SetNPCRewardItem(ref copy, GetNPCRewardItem(original)); SetNPCRewardItemQuality(ref copy, GetNPCRewardItemQuality(original)); SetNPCRewardItemAmount(ref copy, GetNPCRewardItemAmount(original)); SetNPCRewardLimit(ref copy, GetNPCRewardLimit(original)); SetNPCRequiredKeys(ref copy, GetNPCRequiredKeys(original)); SetNPCNotRequiredKeys(ref copy, GetNPCNotRequiredKeys(original)); SetNPCInteractKey(ref copy, GetNPCInteractKey(original)); SetNPCInteractKeyType(ref copy, GetNPCInteractKeyType(original)); SetNPCRewardKey(ref copy, GetNPCRewardKey(original)); SetNPCRewardKeyType(ref copy, GetNPCRewardKeyType(original)); SetNPCDefeatKey(ref copy, GetNPCDefeatKey(original)); } public static void CopyVisEquipment(ref VisEquipment copy, VisEquipment original) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) copy.SetModel(original.m_nview.GetZDO().GetInt(ZDOVars.s_modelIndex, 0)); copy.SetSkinColor(original.m_nview.GetZDO().GetVec3(ZDOVars.s_skinColor, Vector3.zero)); copy.SetHairColor(original.m_nview.GetZDO().GetVec3(ZDOVars.s_hairColor, Vector3.zero)); foreach (int item in ZdoVisEquipment) { copy.m_nview.GetZDO().Set(item, original.m_nview.GetZDO().GetInt(item, 0), false); } } public static void SetZDOFromConfig(ref ZNetView nview, NPCConfiguration.NPCConfig config) { try { SetTamedName(ref nview, config.Name); SetType(ref nview, (int)config.Type); SetTrueDeath(ref nview, config.TrueDeath); SetInitialized(ref nview, !config.GiveDefaultItems); SetNPCDefaultText(ref nview, config.DefaultText); SetNPCInteractText(ref nview, config.InteractText); SetNPCGiveItem(ref nview, config.GiveItem); SetNPCGiveItemQuality(ref nview, config.GiveItemQuality.Value); SetNPCGiveItemAmount(ref nview, config.GiveItemAmount.Value); SetNPCRewardText(ref nview, config.RewardText); SetNPCRewardItem(ref nview, config.RewardItem); SetNPCRewardItemQuality(ref nview, config.RewardItemQuality.Value); SetNPCRewardItemAmount(ref nview, config.RewardItemAmount.Value); SetNPCRewardLimit(ref nview, config.RewardLimit.Value); SetNPCRequiredKeys(ref nview, config.RequiredKeys); SetNPCNotRequiredKeys(ref nview, config.NotRequiredKeys); SetNPCInteractKey(ref nview, config.InteractKey); SetNPCInteractKeyType(ref nview, config.InteractKeyType == NPCKeyType.Global); SetNPCRewardKey(ref nview, config.RewardKey); SetNPCRewardKeyType(ref nview, config.RewardKeyType == NPCKeyType.Global); SetNPCDefeatKey(ref nview, config.DefeatKey); } catch (Exception ex) { NPCSPlugin.NPCSLogger.LogError((object)"There was an issue spawing the npc from configurations, did you forget to reload the file?"); NPCSPlugin.NPCSLogger.LogWarning((object)ex); } } public static void Talk(GameObject npc, string title, string text) { //IL_0027: 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 ((Object)(object)Player.m_localPlayer != (Object)null && !Utility.IsNullOrWhiteSpace(text)) { ZNetView component = npc.GetComponent<ZNetView>(); Chat.instance.SetNpcText(npc.gameObject, Vector3.up * 2f, 15f, 20f, title, SetupText(component, text), true); } } public static bool HasCorrectReqiuredKeys(HashSet<string> requiredKeys) { foreach (string requiredKey in requiredKeys) { if (!Utility.HasKey(requiredKey)) { return false; } } return true; } public static bool HasCorrectNotReqiuredKeys(HashSet<string> notRequiredKeys) { foreach (string notRequiredKey in notRequiredKeys) { if (Utility.HasKey(notRequiredKey)) { return false; } } return true; } public static bool HasCorrectKeys(HashSet<string> requiredKeys, HashSet<string> notRequiredKeys) { if (HasCorrectReqiuredKeys(requiredKeys)) { return HasCorrectNotReqiuredKeys(notRequiredKeys); } return false; } public static void GiveReward(ref ZNetView nview, ref Character character) { //IL_0037: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (!Utility.IsNullOrWhiteSpace(GetNPCRewardItem(nview))) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(GetNPCRewardItem(nview)); if ((Object)(object)itemPrefab != (Object)null) { ItemDrop component = Object.Instantiate<GameObject>(itemPrefab, ((Component)character).transform.position + new Vector3(0f, 0.75f, 0f) + ((Component)character).transform.rotation * Vector3.forward, ((Component)character).transform.rotation).GetComponent<ItemDrop>(); component.SetStack(GetNPCRewardItemAmount(nview)); component.SetQuality(GetNPCRewardItemQuality(nview)); ((Component)component).GetComponent<Rigidbody>().velocity = (((Component)character).transform.forward + Vector3.up) * 1f; character.m_zanim.SetTrigger("interact"); } } int nPCRewardLimit = GetNPCRewardLimit(nview); if (nPCRewardLimit > 0) { nview.ClaimOwnership(); SetNPCRewardLimit(ref nview, nPCRewardLimit - 1); } if (!Utility.IsNullOrWhiteSpace(GetNPCRewardKey(nview))) { Utility.SetKey(GetNPCRewardKey(nview), GetNPCRewardKeyType(nview)); } } public static bool TryUseItem(GameObject npc, ItemData item) { ZNetView nview = npc.GetComponent<ZNetView>(); INPC component = npc.GetComponent<INPC>(); BaseAI component2 = npc.GetComponent<BaseAI>(); if (GetType(nview) != 2 || !HasCorrectKeys(component.GetRequiredKeysSet(), component.GetNotRequiredKeysSet()) || GetNPCRewardLimit(nview) == 0 || component2.m_aggravated) { return false; } string nPCGiveItem = GetNPCGiveItem(nview); string tamedName = GetTamedName(nview); if (!Utility.IsNullOrWhiteSpace(nPCGiveItem)) { if (item == null || !((Object)item.m_dropPrefab).name.Equals(nPCGiveItem) || !((Object)(object)Player.m_localPlayer != (Object)null)) { Talk(npc, tamedName, "Hmmm that's not right... " + GetNPCInteractText(nview)); return false; } int nPCGiveItemQuality = GetNPCGiveItemQuality(nview); int nPCGiveItemAmount = GetNPCGiveItemAmount(nview); Player localPlayer = Player.m_localPlayer; if (((Humanoid)localPlayer).GetInventory().CountItems(item.m_shared.m_name, nPCGiveItemQuality, true) < nPCGiveItemAmount) { Talk(npc, tamedName, "Hmmm that's not enough... " + GetNPCInteractText(nview)); return false; } ((Humanoid)localPlayer).UnequipItem(item, true); ((Humanoid)localPlayer).GetInventory().RemoveItem(item.m_shared.m_name, nPCGiveItemAmount, nPCGiveItemQuality, true); } Character character = npc.GetComponent<Character>(); GiveReward(ref nview, ref character); Talk(npc, tamedName, GetNPCRewardText(nview)); return true; } public static bool TryInteract(GameObject npc) { ZNetView nview = npc.GetComponent<ZNetView>(); INPC component = npc.GetComponent<INPC>(); BaseAI component2 = npc.GetComponent<BaseAI>(); Character character = npc.GetComponent<Character>(); if (component2.m_aggravated) { return false; } string text = GetNPCDefaultText(nview); if (GetType(nview) == 2) { if (GetNPCRewardLimit(nview) != 0) { if (Utility.IsNullOrWhiteSpace(GetNPCGiveItem(nview))) { if (HasCorrectNotReqiuredKeys(component.GetNotRequiredKeysSet())) { if (HasCorrectReqiuredKeys(component.GetRequiredKeysSet())) { GiveReward(ref nview, ref character); string nPCRewardText = GetNPCRewardText(nview); if (!Utility.IsNullOrWhiteSpace(nPCRewardText)) { text = nPCRewardText; } } else { text = GetNPCInteractText(nview); } } } else if (HasCorrectKeys(component.GetRequiredKeysSet(), component.GetNotRequiredKeysSet())) { text = GetNPCInteractText(nview); } } } else if (HasCorrectKeys(component.GetRequiredKeysSet(), component.GetNotRequiredKeysSet())) { text = GetNPCInteractText(nview); } string nPCInteractKey = GetNPCInteractKey(nview); if (!Utility.IsNullOrWhiteSpace(nPCInteractKey)) { Utility.SetKey(nPCInteractKey, GetNPCInteractKeyType(nview)); } string tamedName = GetTamedName(nview); Talk(npc, tamedName, text); return false; } public static string GetHoverText(ZNetView zNetView, BaseAI baseAI) { if ((Object)(object)baseAI == (Object)null || baseAI.m_aggravated) { return ""; } if ((Object)(object)zNetView == (Object)null || zNetView.GetZDO() == null) { return ""; } int type = GetType(zNetView); string text = ""; if (type != 0) { text = Localization.instance.Localize("[<color=yellow><b>$KEY_Use</b></color>] Talk"); } if (type == 2 && !Utility.IsNullOrWhiteSpace(GetNPCRewardItem(zNetView))) { text += Localization.instance.Localize("\n[<color=yellow><b>1-8</b></color>] Give"); } return text; } public static GameObject CreateGameObject(GameObject original, string name) { GameObject obj = Object.Instantiate<GameObject>(original, NPCSPlugin.Root.transform, false); ((Object)obj).name = "vvnpcs_" + name; obj.transform.SetParent(NPCSPlugin.Root.transform, false); return obj; } public static void RegisterGameObject(GameObject obj) { ZNetScene.instance.m_prefabs.Add(obj); ZNetScene.instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)obj).name), obj); NPCSPlugin.NPCSLogger.LogDebug((object)("Adding object to prefabs " + ((Object)obj).name)); } } public class Patches { [HarmonyPatch(typeof(Terminal), "InitTerminal")] private static class Patch_Terminal_InitTerminal { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__1_0; public static ConsoleEvent <>9__1_1; public static ConsoleEvent <>9__1_2; public static ConsoleEvent <>9__1_3; public static ConsoleEvent <>9__1_4; public static ConsoleEvent <>9__1_5; public static ConsoleEvent <>9__1_6; public static ConsoleEvent <>9__1_7; public static ConsoleEvent <>9__1_8; public static ConsoleEvent <>9__1_9; public static ConsoleEvent <>9__1_10; public static ConsoleEvent <>9__1_11; public static ConsoleEvent <>9__1_12; public static ConsoleEvent <>9__1_13; public static ConsoleEvent <>9__1_14; [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_0(ConsoleEventArgs args) { NPCConfiguration.ReloadFile(); } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_1(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0079: 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_0064: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)Player.m_localPlayer).gameObject.transform.position; Quaternion rotation = ((Component)Player.m_localPlayer).gameObject.transform.rotation; Vector3 position2 = position + rotation * Vector3.forward; if (args.Length > 2) { NPCFactory.SpawnNPC(position2, rotation, args[1], args[2]); } else if (args.Length > 1) { NPCFactory.SpawnNPC(position2, rotation, args[1]); } else { NPCFactory.SpawnNPC(position2, rotation); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_2(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)Player.m_localPlayer).gameObject.transform.position; Quaternion rotation = ((Component)Player.m_localPlayer).gameObject.transform.rotation; Vector3 position2 = position + rotation * Vector3.forward; if (args.Length >= 2) { if ((Object)(object)NPCFactory.SpawnSavedNPC(position2, rotation, args[1]) == (Object)null) { args.Context.AddString("Could not spawn NPC!"); } } else { args.Context.AddString("Wrong Syntax!"); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_3(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null) { args.Context.AddString("No npc found."); } else if (args.Length >= 2) { closestNPC.SetFromConfig(NPCConfiguration.GetConfig(args[1]), newSpawn: false); } else { args.Context.AddString("Wrong Syntax!"); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_4(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null) { args.Context.AddString("No npc found."); } else if (args.Length >= 2) { closestNPC.SetTrueDeath(bool.Parse(args[1])); } else { closestNPC.SetTrueDeath(death: true); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_5(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null) { args.Context.AddString("No npc found."); } else { closestNPC.Attach(attach: false); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_6(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null) { args.Context.AddString("No npc found."); } else { closestNPC.Attach(attach: true); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_7(ConsoleEventArgs args) { //IL_000f: 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_0015: 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_003b: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)Player.m_localPlayer).gameObject.transform.position; INPC closestNPC = Utility.GetClosestNPC(position); if (closestNPC == null) { args.Context.AddString("No npc found."); return; } Chair closestChair = Utility.GetClosestChair(position, Vector3.one * 2f); closestNPC.Attach(attach: true, closestChair); } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_8(ConsoleEventArgs args) { //IL_000f: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)Player.m_localPlayer).gameObject.transform.position; if (args.Length >= 2) { foreach (NPCHumanoid allNPC in Utility.GetAllNPCS(position, float.Parse(args[1]))) { BaseAI component = ((Component)allNPC).GetComponent<BaseAI>(); if ((Object)(object)component != (Object)null) { component.SetAggravated(false, (AggravatedReason)0); } } return; } Utility.GetAllNPCS(position, 5f); } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_9(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)Player.m_localPlayer).gameObject.transform.position; Quaternion rotation = ((Component)Player.m_localPlayer).gameObject.transform.rotation; INPC closestNPC = Utility.GetClosestNPC(position); if (closestNPC == null) { args.Context.AddString("No npc found."); } else { closestNPC.SetRotation(rotation * new Quaternion(0f, 1f, 0f, 0f)); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_10(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null || !(closestNPC is NPCHumanoid)) { args.Context.AddString("No npc found."); } else { args.Context.AddString(((Character)(closestNPC as NPCHumanoid)).m_name + ": " + (closestNPC as NPCHumanoid).GetSkinColor()); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_11(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null || !(closestNPC is NPCHumanoid)) { args.Context.AddString("No npc found."); } else { args.Context.AddString(((Character)(closestNPC as NPCHumanoid)).m_name + ": " + (closestNPC as NPCHumanoid).GetHairColor()); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_12(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null) { args.Context.AddString("No npc found."); } else if (closestNPC is NPCHumanoid) { ((Character)(closestNPC as NPCHumanoid)).m_nview.ClaimOwnership(); ZNetScene.instance.Destroy(((Component)(closestNPC as NPCHumanoid)).gameObject); } else if (closestNPC is NPCCharacter) { ((Character)(closestNPC as NPCCharacter)).m_nview.ClaimOwnership(); ZNetScene.instance.Destroy(((Component)(closestNPC as NPCCharacter)).gameObject); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_13(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null) { args.Context.AddString("No npc found."); } else { closestNPC.SetRandom(); } } [<d8e89b07-b022-4017-96cc-d985a31b852b>NullableContext(1)] internal void <Postfix>b__1_14(ConsoleEventArgs args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) INPC closestNPC = Utility.GetClosestNPC(((Component)Player.m_localPlayer).gameObject.transform.position); if (closestNPC == null) { args.Context.AddString("No npc found."); } else if (closestNPC is NPCHumanoid) { NPCHumanoid nPCHumanoid = (NPCHumanoid)closestNPC; Terminal context = args.Context; string[] obj = ne