Decompiled source of MonsterDB v0.2.4
MonsterDB.dll
Decompiled a day 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.IO.Compression; 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 System.Threading; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using MonsterDB.Misc; using MonsterDB.Solution; using MonsterDB.Solution.Methods; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; 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: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyProduct("MonsterDB")] [assembly: AssemblyCompany("RustyMods")] [assembly: AssemblyFileVersion("0.2.4")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("MonsterDB")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyConfiguration("")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.4.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<56aad80b-79b3-4888-9a69-0138421bb2ee>Embedded] internal sealed class <56aad80b-79b3-4888-9a69-0138421bb2ee>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<56aad80b-79b3-4888-9a69-0138421bb2ee>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <2819d005-da1c-4536-902d-199916b6db56>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <2819d005-da1c-4536-902d-199916b6db56>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <2819d005-da1c-4536-902d-199916b6db56>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [<56aad80b-79b3-4888-9a69-0138421bb2ee>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContextAttribute : Attribute { public readonly byte Flag; public <0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace MonsterDB { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] [PublicAPI] public static class AssetBundleManager { private static readonly Dictionary<string, AssetBundle> CachedBundles = new Dictionary<string, AssetBundle>(); [return: <2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public static T LoadAsset<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] T>(string assetBundle, string prefab) where T : Object { AssetBundle assetBundle2 = GetAssetBundle(assetBundle); return (assetBundle2 == null) ? default(T) : assetBundle2.LoadAsset<T>(prefab); } public static AssetBundle GetAssetBundle(string fileName) { if (CachedBundles.TryGetValue(fileName, out var value)) { return value; } AssetBundle val = AssetBundle.GetAllLoadedAssetBundles().FirstOrDefault((Func<AssetBundle, bool>)([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (AssetBundle b) => ((Object)b).name == fileName)); if (val != null) { CachedBundles[fileName] = val; return val; } Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetManifestResourceNames().Single([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (string str) => str.EndsWith(fileName)); using Stream stream = executingAssembly.GetManifestResourceStream(name); AssetBundle val2 = AssetBundle.LoadFromStream(stream); CachedBundles[fileName] = val2; return val2; } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public class AnimalTameable : MonoBehaviour { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] [HarmonyPatch(typeof(BaseAI), "IdleMovement")] private static class AnimalAI_IdleMovement_Patch { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static bool Prefix(BaseAI __instance, float dt) { AnimalTameable animalTameable = default(AnimalTameable); if (!((Component)__instance).TryGetComponent<AnimalTameable>(ref animalTameable)) { return true; } AnimalAI val = (AnimalAI)(object)((__instance is AnimalAI) ? __instance : null); if (val == null) { return true; } Tameable tameable = default(Tameable); if (!((Component)__instance).TryGetComponent<Tameable>(ref tameable)) { return true; } return !animalTameable.UpdateConsumeItem(__instance.m_character, val, tameable, dt); } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] [HarmonyPatch(typeof(Tameable), "TamingUpdate")] private static class Tameable_TamingUpdate_Patch { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static void Postfix(Tameable __instance) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (ShouldPatchTameable(__instance) && !__instance.IsHungry()) { __instance.DecreaseRemainingTime(3f); if ((double)__instance.GetRemainingTime() <= 0.0) { __instance.Tame(); } else { __instance.m_sootheEffect.Create(((Component)__instance).transform.position, ((Component)__instance).transform.rotation, (Transform)null, 1f, -1); } } } } [HarmonyPatch(typeof(Tameable), "Tame")] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] private static class Tameable_Tame_Patch { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static void Postfix(Tameable __instance) { //IL_0029: 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_004c: Unknown result type (might be due to invalid IL or missing references) if (ShouldPatchTameable(__instance)) { __instance.m_character.SetTamed(true); __instance.m_tamedEffect.Create(((Component)__instance).transform.position, ((Component)__instance).transform.rotation, (Transform)null, 1f, -1); Player closestPlayer = Player.GetClosestPlayer(((Component)__instance).transform.position, 30f); if (Object.op_Implicit((Object)(object)closestPlayer)) { ((Character)closestPlayer).Message((MessageType)2, __instance.m_character.m_name + " $hud_tamedone", 0, (Sprite)null); } } } } public List<ItemDrop> m_consumeItems = new List<ItemDrop>(); public float m_consumeRange = 2f; public float m_consumeSearchRange = 5f; public float m_consumeSearchInterval = 10f; public EffectList m_consumeItemEffects = new EffectList(); public float m_consumeSearchTimer; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public ItemDrop m_consumeTarget; private static readonly int Consume = Animator.StringToHash("consume"); private static bool ShouldPatchTameable(Tameable __instance) { return __instance.m_nview.IsValid() && __instance.m_nview.IsOwner() && !__instance.IsTamed() && Object.op_Implicit((Object)(object)__instance.m_character) && !Object.op_Implicit((Object)(object)__instance.m_monsterAI); } public bool UpdateConsumeItem(Character character, AnimalAI animalAI, Tameable tameable, float dt) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) if (m_consumeItems.Count == 0) { return false; } m_consumeSearchTimer += dt; if (m_consumeSearchTimer > m_consumeSearchInterval) { m_consumeSearchTimer = 0f; if (!tameable.IsHungry()) { return false; } ItemDrop consumeTarget = FindClosestConsumableItem(animalAI, m_consumeSearchRange); m_consumeTarget = consumeTarget; } if (!Object.op_Implicit((Object)(object)m_consumeTarget)) { return false; } if (((BaseAI)animalAI).MoveTo(dt, ((Component)m_consumeTarget).transform.position, m_consumeRange, false)) { ((BaseAI)animalAI).LookAt(((Component)m_consumeTarget).transform.position); if (((BaseAI)animalAI).IsLookingAt(((Component)m_consumeTarget).transform.position, 20f, false) && m_consumeTarget.RemoveOne()) { tameable.OnConsumedItem(m_consumeTarget); m_consumeItemEffects.Create(((Component)character).transform.position, Quaternion.identity, (Transform)null, 1f, -1); character.m_animator.SetTrigger(Consume); m_consumeTarget = null; } } return true; } [return: <2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public ItemDrop FindClosestConsumableItem(AnimalAI animalAI, float maxRange) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (MonsterAI.m_itemMask == 0) { MonsterAI.m_itemMask = LayerMask.GetMask(new string[1] { "item" }); } Collider[] array = (Collider[])(object)new Collider[20]; int num = Physics.OverlapSphereNonAlloc(((Component)animalAI).transform.position, maxRange, array, MonsterAI.m_itemMask); ItemDrop val = null; float num2 = 999999f; for (int i = 0; i < num; i++) { Collider val2 = array[i]; if ((Object)(object)val2 == (Object)null || !Object.op_Implicit((Object)(object)val2.attachedRigidbody)) { continue; } ItemDrop component = ((Component)val2.attachedRigidbody).GetComponent<ItemDrop>(); if (!((Object)(object)component == (Object)null) && ((Component)component).GetComponent<ZNetView>().IsValid() && CanConsume(component.m_itemData)) { float num3 = Vector3.Distance(((Component)component).transform.position, ((Component)animalAI).transform.position); if ((Object)(object)val == (Object)null || num3 < num2) { val = component; num2 = num3; } } } return ((Object)(object)val != (Object)null && ((BaseAI)animalAI).HavePath(((Component)val).transform.position)) ? val : null; } public bool CanConsume(ItemData item) { if (m_consumeItems.Count == 0) { return false; } foreach (ItemDrop consumeItem in m_consumeItems) { if (consumeItem.m_itemData.m_shared.m_name == item.m_shared.m_name) { return true; } } return false; } } [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] public static class GrowUpText { private static ConfigEntry<Toggle> addGrowUpText; public static void Setup() { addGrowUpText = ConfigManager.config("Grow Up", "Add Progress Text", Toggle.Off, "If on, will add progress text on character hover"); } public static bool AddGrowUpText() { return addGrowUpText.Value == Toggle.On; } public static string GetGrowthPercentageText(this Growup __instance) { if ((Object)(object)__instance.m_baseAI == (Object)null) { return "$hud_growup_maturing 0%"; } double totalSeconds = __instance.m_baseAI.GetTimeSinceSpawned().TotalSeconds; double num = totalSeconds / (double)__instance.m_growTime * 100.0; return $"$hud_growup_maturing {num:0}%"; } } public static class ProcreateText { [HarmonyPatch(typeof(Tameable), "GetStatusString")] private static class Tameable_GetStatusString { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static void Postfix(Tameable __instance, ref string __result) { Procreation val = default(Procreation); if (AddProgressText() && __instance.IsTamed() && ((Component)__instance).TryGetComponent<Procreation>(ref val)) { if (val.IsPregnant()) { __result += ", $hud_procreate_pregnant"; return; } int lovePoints = val.GetLovePoints(); float num = (float)lovePoints / (float)val.m_requiredLovePoints * 100f; __result += $", $hud_procreate_bonding {num}%"; } } } [<2819d005-da1c-4536-902d-199916b6db56>Nullable(1)] private static ConfigEntry<Toggle> addProcreateProgressText; public static void Setup() { addProcreateProgressText = ConfigManager.config("Procreation", "Add Progress Text", Toggle.Off, "If on, will add procreation progress info to hover text"); } private static bool AddProgressText() { return addProcreateProgressText.Value == Toggle.On; } } [HarmonyPatch(typeof(Character), "GetHoverText")] public static class Character_GetHoverText_Patch { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static bool Prefix(Character __instance, ref string __result) { if (!__instance.m_nview.IsValid()) { return true; } StringBuilder stringBuilder = new StringBuilder(); Tameable val = default(Tameable); Growup _instance2 = default(Growup); if (((Component)__instance).TryGetComponent<Tameable>(ref val)) { stringBuilder.Append(val.GetName()); if (val.IsTamed()) { stringBuilder.AppendFormat(" ( {0}, {1}", "$hud_tame", val.GetStatusString()); Growup _instance = default(Growup); if (((Component)__instance).TryGetComponent<Growup>(ref _instance) && GrowUpText.AddGrowUpText()) { stringBuilder.Append(", " + _instance.GetGrowthPercentageText()); } stringBuilder.Append(" )"); stringBuilder.Append("\n[<color=yellow><b>$KEY_Use</b></color>] $hud_pet"); bool flag = ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive(); stringBuilder.AppendFormat("\n[<color=yellow><b>{0} + $KEY_Use</b></color>] $hud_rename", flag ? "$KEY_AltKeys" : "$KEY_AltPlace"); Saddle saddle = default(Saddle); if (((Component)__instance).TryGetComponent<Saddle>(ref saddle) && (!saddle.HasSaddleItem() || saddle.HaveSaddle())) { saddle.GetHoverText(stringBuilder, flag); } } else { int tameness = val.GetTameness(); stringBuilder.AppendFormat(" ( {0}, {1} )", (tameness <= 0) ? "$hud_wild" : $"$hud_tameness {tameness}%", val.GetStatusString()); } } else if (((Component)__instance).TryGetComponent<Growup>(ref _instance2) && GrowUpText.AddGrowUpText() && __instance.IsTamed()) { stringBuilder.Append(__instance.m_name + " ( " + _instance2.GetGrowthPercentageText() + " )"); } __result = Localization.instance.Localize(stringBuilder.ToString()); return false; } } [HarmonyPatch(typeof(Growup), "GrowUpdate")] public static class GrowUp_ConditioanlGrow_Patch { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static bool Prefix(Growup __instance) { if (!__instance.m_nview.IsValid() || !__instance.m_nview.IsOwner()) { return true; } Character val = default(Character); if (!((Component)__instance).TryGetComponent<Character>(ref val) || val.IsTamed()) { return true; } __instance.m_nview.GetZDO().Set(ZDOVars.s_spawnTime, ZNet.instance.GetTime().Ticks); return false; } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public class Human : Humanoid { [CompilerGenerated] private sealed class <ReloadRoutine>d__20 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] private object <>2__current; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public string reloadAnimation; public float reloadTime; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public Human <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] [return: <2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <ReloadRoutine>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.m_reloading = true; ((Character)<>4__this).m_zanim.SetBool(reloadAnimation, true); <>2__current = (object)new WaitForSeconds(reloadTime); <>1__state = 1; return true; case 1: <>1__state = -1; ((Character)<>4__this).m_zanim.SetTrigger(reloadAnimation + "_done"); ((Character)<>4__this).m_zanim.SetBool(reloadAnimation, false); <>2__current = <>4__this.m_weaponLoadedDelay; <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.m_weaponLoaded = true; <>4__this.m_reloadCoroutine = null; <>4__this.m_reloading = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public int m_modelIndex; public Vector3 m_skinColor; public Vector3 m_hairColor; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public int[] m_models; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] public string[] m_skinColors; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] public string[] m_hairColors; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] public string[] m_beards; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] public string[] m_hairs; public bool m_reloading; public bool m_weaponLoaded; private readonly WaitForSeconds m_weaponLoadedDelay = new WaitForSeconds(1f); [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] private Coroutine m_reloadCoroutine; public override void Start() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) ((Humanoid)this).Start(); BaseAI baseAI = ((Character)this).m_baseAI; MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if (val != null) { val.m_onConsumedItem = (Action<ItemDrop>)Delegate.Combine(val.m_onConsumedItem, new Action<ItemDrop>(OnConsumeItem)); } if (((Character)this).m_nview.IsValid() && !((Character)this).m_nview.GetZDO().GetBool(ZDOVars.s_addedDefaultItems, false)) { if (m_models != null && m_models.Length != 0) { m_modelIndex = m_models[Random.Range(0, m_models.Length)]; } if (m_beards != null && m_beards.Length != 0) { base.m_beardItem = m_beards[Random.Range(0, m_beards.Length)]; } if (m_hairs != null && m_hairs.Length != 0) { base.m_hairItem = m_hairs[Random.Range(0, m_hairs.Length)]; } if (m_skinColors != null && m_skinColors.Length != 0) { string hex = m_skinColors[Random.Range(0, m_skinColors.Length)]; m_skinColor = Utils.ColorToVec3(hex.FromHexOrRGBA(Color.white)); } if (m_hairColors != null && m_hairColors.Length != 0) { string hex2 = m_hairColors[Random.Range(0, m_hairColors.Length)]; m_hairColor = Utils.ColorToVec3(hex2.FromHexOrRGBA(Color.black)); } ((Character)this).m_nview.GetZDO().Set(ZDOVars.s_addedDefaultItems, true); ((Humanoid)this).SetupVisEquipment(base.m_visEquipment, false); } } private void OnConsumeItem(ItemDrop item) { string trigger = (item.m_itemData.m_shared.m_isDrink ? "emote_drink" : "eat"); ((Character)this).m_animator.SetTrigger(trigger); } public override void SetupVisEquipment(VisEquipment visEq, bool isRagdoll) { //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (!isRagdoll) { visEq.SetLeftItem((base.m_leftItem != null) ? ((Object)base.m_leftItem.m_dropPrefab).name : "", (base.m_leftItem != null) ? base.m_leftItem.m_variant : 0); visEq.SetRightItem((base.m_rightItem != null) ? ((Object)base.m_rightItem.m_dropPrefab).name : ""); } visEq.SetChestItem((base.m_chestItem != null) ? ((Object)base.m_chestItem.m_dropPrefab).name : ""); visEq.SetLegItem((base.m_legItem != null) ? ((Object)base.m_legItem.m_dropPrefab).name : ""); visEq.SetHelmetItem((base.m_helmetItem != null) ? ((Object)base.m_helmetItem.m_dropPrefab).name : ""); visEq.SetShoulderItem((base.m_shoulderItem != null) ? ((Object)base.m_shoulderItem.m_dropPrefab).name : "", (base.m_shoulderItem != null) ? base.m_shoulderItem.m_variant : 0); visEq.SetUtilityItem((base.m_utilityItem != null) ? ((Object)base.m_utilityItem.m_dropPrefab).name : ""); visEq.SetTrinketItem((base.m_trinketItem != null) ? ((Object)base.m_trinketItem.m_dropPrefab).name : ""); visEq.SetBeardItem(base.m_beardItem); visEq.SetHairItem(base.m_hairItem); visEq.SetSkinColor(m_skinColor); visEq.SetHairColor(m_hairColor); visEq.SetModel(m_modelIndex); } public override float GetMaxEitr() { return 9999f; } public void LateUpdate() { if (base.m_currentAttack != null && base.m_currentAttack.m_loopingAttack) { int num = Mathf.CeilToInt(base.m_lastCombatTimer / base.m_currentAttack.m_burstInterval); if (num > 10) { base.m_currentAttack.Stop(); base.m_previousAttack = base.m_currentAttack; base.m_currentAttack = null; } } } public override void ResetLoadedWeapon() { m_weaponLoaded = false; StartWeaponReload(); } public override bool IsWeaponLoaded() { if (!m_weaponLoaded) { StartWeaponReload(); } return m_weaponLoaded; } public void StartWeaponReload() { if (m_reloading || m_weaponLoaded) { return; } ItemData currentWeapon = ((Humanoid)this).GetCurrentWeapon(); if (currentWeapon != null && currentWeapon.m_shared.m_attack.m_requiresReload) { if (m_reloadCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_reloadCoroutine); m_reloadCoroutine = null; } m_reloadCoroutine = ((MonoBehaviour)this).StartCoroutine(ReloadRoutine(currentWeapon.m_shared.m_attack.m_reloadAnimation, currentWeapon.m_shared.m_attack.m_reloadTime)); } } [IteratorStateMachine(typeof(<ReloadRoutine>d__20))] private IEnumerator ReloadRoutine(string reloadAnimation, float reloadTime) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ReloadRoutine>d__20(0) { <>4__this = this, reloadAnimation = reloadAnimation, reloadTime = reloadTime }; } } public static class Humanoid_Patches { [HarmonyPatch(typeof(Humanoid), "EquipItem")] private static class Humanoid_EquipItem_Patch { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static void Prefix(Humanoid __instance, ItemData item) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 if (!((Character)__instance).IsPlayer() && (int)item.m_shared.m_itemType == 10 && !((Object)(object)item.m_dropPrefab == (Object)null)) { string prefabName = Utils.GetPrefabName(item.m_dropPrefab); if (Utils.CustomStartsWith(prefabName, "Beard")) { __instance.SetBeard(prefabName); } else if (Utils.CustomStartsWith(prefabName, "Hair")) { __instance.SetHair(prefabName); } } } } } [HarmonyPatch(typeof(Hud), "UpdateMount")] public static class Hud_UpdateMount { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static bool Prefix(Hud __instance, Player player, float dt) { Saddle saddle = player.GetDoodadController() as Saddle; if ((Object)(object)saddle == (Object)null) { return true; } Character character = saddle.GetCharacter(); __instance.m_mountPanel.SetActive(true); __instance.m_mountIcon.overrideSprite = saddle.m_mountIcon; __instance.m_mountHealthBarSlow.SetValue(character.GetHealthPercentage()); __instance.m_mountHealthBarFast.SetValue(character.GetHealthPercentage()); ((TMP_Text)__instance.m_mountHealthText).text = StringExtensionMethods.ToFastString(Mathf.CeilToInt(character.GetHealth())); float stamina = saddle.GetStamina(); float maxStamina = saddle.GetMaxStamina(); __instance.m_mountStaminaBar.SetValue(stamina / maxStamina); ((TMP_Text)__instance.m_mountStaminaText).text = StringExtensionMethods.ToFastString(Mathf.CeilToInt(stamina)); ((TMP_Text)__instance.m_mountNameText).text = character.GetHoverName() + " ( " + Localization.instance.Localize(saddle.GetTameable().GetStatusString()) + " )"; return false; } } [HarmonyPatch(typeof(Player), "IsRiding")] public static class Player_IsRiding { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static void Postfix(Player __instance, ref bool __result) { __result |= __instance.m_doodadController != null && __instance.m_doodadController.IsValid() && __instance.m_doodadController is Saddle; } } [HarmonyPatch(typeof(Player), "SetControls")] public static class Player_SetControls_SaddlePatch { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static bool Prefix(Player __instance, Vector3 movedir, bool attack, bool secondaryAttack, bool block, bool jump, bool run, bool autoRun) { //IL_0025: 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) if (!(__instance.m_doodadController is Saddle saddle) || !saddle.IsValid()) { return true; } saddle.ApplyCustomControls(movedir, ((Character)__instance).m_lookDir, run, autoRun, block, attack, secondaryAttack, jump); return false; } } [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] public class Saddle : MonoBehaviour, Interactable, Hoverable, IDoodadController { [HarmonyPatch(typeof(Tameable), "UseItem")] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] public static class Tameable_UseItem { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static bool Prefix(Tameable __instance, Humanoid user, ItemData item, ref bool __result) { Saddle saddle = default(Saddle); if (!((Component)__instance).TryGetComponent<Saddle>(ref saddle)) { return true; } __result = saddle.UseItem(user, item); return false; } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] [HarmonyPatch(typeof(BaseAI), "UpdateAI")] public static class BaseAI_UpdateAI { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static bool Prefix(BaseAI __instance, float dt, ref bool __result) { Saddle saddle = default(Saddle); if (!((Component)__instance).TryGetComponent<Saddle>(ref saddle)) { return true; } if (!__instance.m_nview.IsValid() || !__instance.m_nview.IsOwner()) { return true; } if (!__instance.m_character.IsTamed()) { return true; } if (saddle.UpdateRiding(dt)) { __instance.UpdateTakeoffLanding(dt); if ((double)__instance.m_jumpInterval > 0.0) { __instance.m_jumpTimer += dt; } if ((double)__instance.m_randomMoveUpdateTimer > 0.0) { __instance.m_randomMoveUpdateTimer -= dt; } __instance.UpdateRegeneration(dt); __instance.m_timeSinceHurt += dt; __result = false; return false; } return true; } } [HarmonyPatch(typeof(Tameable), "Interact")] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] public static class Tameable_Interact { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] private static bool Prefix(Tameable __instance, Humanoid user, bool hold, bool alt, ref bool __result) { Saddle saddle = default(Saddle); if (!((Component)__instance).TryGetComponent<Saddle>(ref saddle)) { return true; } if (saddle.HasSaddleItem() && !saddle.HaveSaddle()) { return true; } if (alt || hold) { return true; } if (ZInput.GetKey((KeyCode)308, true) || ZInput.GetKeyDown((KeyCode)308, true) || ZInput.GetButton("JoyLTrigger")) { __result = saddle.Interact(user, repeat: false, alt: false); return false; } if (ZInput.GetKey((KeyCode)306, true) || ZInput.GetKeyDown((KeyCode)306, true) || ZInput.GetButton("JoyButtonB")) { __result = saddle.Interact(user, repeat: false, alt: true); return false; } return true; } } public string m_hoverText = ""; public float m_maxUseRange = 10f; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public Transform m_attachPoint; public Vector3 m_attachOffset; public GameObject m_attachParent; public Vector3 m_detachOffset = new Vector3(0f, 0.5f, 0f); public string m_attachAnimation = "attach_chair"; public float m_maxStamina = 100f; public float m_runStaminaDrain = 10f; public float m_swimStaminaDrain = 10f; public float m_staminaRegen = 10f; public float m_staminaRegenHungry = 10f; public EffectList m_drownEffects = new EffectList(); [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public Sprite m_mountIcon; public Vector3 m_controlDir; public Speed m_speed; public float m_rideSkill; public float m_staminaRegenTimer; public float m_drownDamageTimer; public float m_raiseSkillTimer; public Character m_character = null; public ZNetView m_nview = null; public Tameable m_tambable = null; public BaseAI m_baseAI = null; public bool m_haveValidUser; public const string rideKey = "JoyLTrigger"; private const string removeKey = "JoyButtonB"; public void Awake() { m_character = ((Component)this).GetComponent<Character>(); m_nview = ((Component)this).GetComponent<ZNetView>(); m_tambable = ((Component)this).GetComponent<Tameable>(); m_baseAI = ((Component)this).GetComponent<BaseAI>(); m_nview.Register<long>("RequestControl", (Action<long, long>)RPC_RequestControl); m_nview.Register<long>("ReleaseControl", (Action<long, long>)RPC_ReleaseControl); m_nview.Register<bool>("RequestRespons", (Action<long, bool>)RPC_RequestRespons); m_nview.Register<Vector3>("RemoveSaddle", (Action<long, Vector3>)RPC_RemoveSaddle); m_nview.Register<Vector3, int, float>("Controls", (Action<long, Vector3, int, float>)RPC_Controls); m_nview.Register("AddSaddle", (Action<long>)RPC_AddSaddle); } public void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("attach"); val.transform.SetParent(((Object)(object)m_attachParent != (Object)null) ? m_attachParent.transform : ((Component)this).transform); val.transform.localPosition = m_attachOffset; val.transform.rotation = Quaternion.identity; m_attachPoint = val.transform; } public void Restart() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_attachPoint != (Object)null) { m_attachPoint.SetParent(((Object)(object)m_attachParent != (Object)null) ? m_attachParent.transform : ((Component)this).transform); m_attachPoint.localPosition = m_attachOffset; m_attachPoint.rotation = Quaternion.identity; } } public bool IsValid() { return Object.op_Implicit((Object)(object)this) && (Object)(object)m_attachPoint != (Object)null; } public bool UseItem(Humanoid user, ItemData item) { if (!m_nview.IsValid() || (Object)(object)m_tambable.m_saddleItem == (Object)null || !m_tambable.IsTamed() || item.m_shared.m_name != m_tambable.m_saddleItem.m_itemData.m_shared.m_name) { return false; } if (HaveSaddle()) { ((Character)user).Message((MessageType)2, m_tambable.GetHoverName() + " $hud_saddle_already", 0, (Sprite)null); } else { m_nview.InvokeRPC("AddSaddle", Array.Empty<object>()); user.GetInventory().RemoveOneItem(item); ((Character)user).Message((MessageType)2, m_tambable.GetHoverName() + " $hud_saddle_ready", 0, (Sprite)null); } return true; } public void FixedUpdate() { if (!m_nview.IsValid()) { return; } CalculateHaveValidUser(); if (m_character.IsTamed()) { if (IsLocalUser()) { UpdateRidingSkill(Time.fixedDeltaTime); } if (m_nview.IsOwner()) { float fixedDeltaTime = Time.fixedDeltaTime; UpdateStamina(fixedDeltaTime); UpdateDrown(fixedDeltaTime); } } } public void LateUpdate() { if (HaveValidUser()) { UpdateAttachRotation(); } } public void UpdateDrown(float dt) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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) //IL_00ca: Expected O, but got Unknown //IL_00d7: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if (m_character.IsSwimming() && !m_character.IsOnGround() && !HaveStamina()) { m_drownDamageTimer += dt; if (!((double)m_drownDamageTimer <= 1.0)) { m_drownDamageTimer = 0f; float damage = Mathf.Ceil(m_character.GetMaxHealth() / 20f); m_character.Damage(new HitData { m_damage = { m_damage = damage }, m_point = m_character.GetCenterPoint(), m_dir = Vector3.down, m_pushForce = 10f, m_hitType = (HitType)4 }); EffectList drownEffects = m_drownEffects; Vector3 position = ((Component)this).transform.position; position.y = m_character.GetLiquidLevel(); drownEffects.Create(position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } } } public bool UpdateRiding(float dt) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Invalid comparison between Unknown and I4 //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Invalid comparison between Unknown and I4 //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Invalid comparison between Unknown and I4 //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Invalid comparison between Unknown and I4 if (!m_character.IsTamed() || !HaveValidUser() || (int)m_speed == 0 || (double)((Vector3)(ref m_controlDir)).magnitude == 0.0) { return false; } bool flag = HaveStamina(); if (m_character.IsFlying() && !flag && m_character.CanToggleFly()) { m_character.Land(); } if ((int)m_speed == 1 || (int)m_speed == 2) { if ((int)m_speed == 2 && !flag) { m_speed = (Speed)1; } m_baseAI.MoveTowards(m_controlDir, (int)m_speed == 2); float num = Mathf.Lerp(1f, 0.5f, GetRiderSkill()); if (m_character.IsSwimming() || m_character.IsFlying()) { UseStamina(m_swimStaminaDrain * num * dt); } else if ((int)m_speed == 2) { UseStamina(m_runStaminaDrain * num * dt); } } else if ((int)m_speed == 3) { m_baseAI.StopMoving(); m_character.SetRun(false); m_baseAI.LookTowards(m_controlDir); } m_baseAI.ResetRandomMovement(); return true; } public bool HasSaddleItem() { return (Object)(object)m_tambable.m_saddleItem != (Object)null; } public bool HaveSaddle() { return m_nview.IsValid() && m_nview.GetZDO().GetBool(ZDOVars.s_haveSaddleHash, false); } public void RPC_AddSaddle(long sender) { if (m_nview.IsOwner() && !HaveSaddle()) { m_nview.GetZDO().Set(ZDOVars.s_haveSaddleHash, true); m_nview.InvokeRPC(ZNetView.Everybody, "SetSaddle", new object[1] { true }); } } public bool DropSaddle(Vector3 userPoint) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) if (!HaveSaddle()) { return false; } m_nview.GetZDO().Set(ZDOVars.s_haveSaddleHash, false); m_nview.InvokeRPC(ZNetView.Everybody, "SetSaddle", new object[1] { false }); SpawnSaddle(userPoint - ((Component)this).transform.position); return true; } public void SpawnSaddle(Vector3 flyDirection) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_007a: 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) Rigidbody component = Object.Instantiate<GameObject>(((Component)m_tambable.m_saddleItem).gameObject, ((Component)this).transform.TransformPoint(m_tambable.m_dropSaddleOffset), Quaternion.identity).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { Vector3 val = Vector3.up; if ((double)((Vector3)(ref flyDirection)).magnitude > 0.10000000149011612) { flyDirection.y = 0f; ((Vector3)(ref flyDirection)).Normalize(); val += flyDirection; } component.AddForce(val * m_tambable.m_dropItemVel, (ForceMode)2); } } public string GetHoverText() { if (!m_nview.IsValid()) { return ""; } StringBuilder stringBuilder = new StringBuilder(); GetHoverText(stringBuilder, ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive()); return Localization.instance.Localize(stringBuilder.ToString()); } public void GetHoverText(StringBuilder sb, bool gamepad) { sb.AppendFormat("\n[<color=yellow><b>{0} + $KEY_Use</b></color>] $hud_ride", gamepad ? ZInput.instance.GetBoundKeyString("JoyLTrigger", false) : "$button_lalt"); if (HasSaddleItem()) { sb.AppendFormat("\n[<color=yellow><b>{0} + $KEY_Use</b></color>] $hud_saddle_remove", gamepad ? ZInput.instance.GetBoundKeyString("JoyButtonB", false) : "$button_lctrl"); } } public string GetHoverName() { return Localization.instance.Localize(m_hoverText); } public bool Interact(Humanoid character, bool repeat, bool alt) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (repeat || !m_nview.IsValid() || !InUseDistance(character) || !m_character.IsTamed()) { return false; } Player val = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val == (Object)null) { return false; } if (alt && HasSaddleItem()) { m_nview.InvokeRPC("RemoveSaddle", new object[1] { ((Component)character).transform.position }); return true; } ZNetView nview = m_nview; object[] array = new object[1]; ZDOID zDOID = ((Character)val).GetZDOID(); array[0] = ((ZDOID)(ref zDOID)).UserID; nview.InvokeRPC("RequestControl", array); return false; } public Character GetCharacter() { return m_character; } public Tameable GetTameable() { return m_tambable; } public void ApplyCustomControls(Vector3 moveDir, Vector3 lookDir, bool run, bool autoRun, bool block, bool attack, bool attackSecondary, bool jump) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } if (jump) { if (m_character.GetBaseAI().m_randomFly || m_character.CanToggleFly()) { if (m_character.IsFlying()) { m_character.Land(); } else { m_character.TakeOff(); } } else { m_character.Jump(false); } } ApplyControlls(moveDir, lookDir, run, autoRun, block); BaseAI baseAI = m_character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if (val == null) { return; } Character character = m_character; Humanoid val2 = (Humanoid)(object)((character is Humanoid) ? character : null); if (val2 != null && (attack || attackSecondary)) { List<ItemData> availableAttacks = val2.GetAvailableAttacks(); if (availableAttacks.Count > 0) { ItemData val3 = availableAttacks[Random.Range(0, availableAttacks.Count)]; val2.EquipItem(val3, true); } val.DoAttack((Character)null, false); } } public void ApplyControlls(Vector3 moveDir, Vector3 lookDir, bool run, bool autoRun, bool block) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00b5: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected I4, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } float skillFactor = ((Character)Player.m_localPlayer).GetSkills().GetSkillFactor((SkillType)110); Speed val = (Speed)4; Vector3 val2 = Vector3.zero; if (run || block || moveDir.z > 0.5f) { val2 = lookDir; if (!m_character.IsFlying()) { val2.y = 0f; } if (((Vector3)(ref val2)).sqrMagnitude > 0f) { ((Vector3)(ref val2)).Normalize(); } } if (run) { val = (Speed)2; } else if (moveDir.z > 0.5f) { val = (Speed)1; } else if (moveDir.z < -0.5f) { val = (Speed)0; } else if (block) { val = (Speed)3; } m_nview.InvokeRPC("Controls", new object[3] { val2, (int)val, skillFactor }); } public void RPC_Controls(long sender, Vector3 rideDir, int rideSpeed, float skill) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.IsOwner()) { return; } m_rideSkill = skill; if (rideDir != Vector3.zero) { m_controlDir = rideDir; } switch (rideSpeed) { case 3: if ((int)m_speed == 1 || (int)m_speed == 2) { return; } break; case 4: if ((int)m_speed == 3) { m_speed = (Speed)0; } return; } m_speed = (Speed)rideSpeed; } public void UpdateRidingSkill(float dt) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 m_raiseSkillTimer += dt; if (!((double)m_raiseSkillTimer <= 1.0)) { m_raiseSkillTimer = 0f; if ((int)m_speed == 2) { ((Character)Player.m_localPlayer).RaiseSkill((SkillType)110, 1f); } } } public void ResetControlls() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) m_controlDir = Vector3.zero; m_speed = (Speed)0; m_rideSkill = 0f; } public Component GetControlledComponent() { return (Component)(object)m_character; } public Vector3 GetPosition() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public void RPC_RemoveSaddle(long sender, Vector3 userPoint) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (m_nview.IsOwner() && !HaveValidUser()) { DropSaddle(userPoint); } } public void RPC_RequestControl(long sender, long playerID) { if (m_nview.IsOwner()) { CalculateHaveValidUser(); if (GetUser() == playerID || !HaveValidUser()) { UpdateAttachRotation(); m_nview.GetZDO().Set(ZDOVars.s_user, playerID); ResetControlls(); m_nview.InvokeRPC(sender, "RequestRespons", new object[1] { true }); m_nview.GetZDO().SetOwner(sender); } else { m_nview.InvokeRPC(sender, "RequestRespons", new object[1] { false }); } } } public void UpdateAttachRotation() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_attachPoint == (Object)null)) { Vector3 forward = ((Component)this).transform.forward; forward.y = 0f; if (!(((Vector3)(ref forward)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref forward)).Normalize(); m_attachPoint.rotation = Quaternion.LookRotation(forward, Vector3.up); } } } public bool HaveValidUser() { return m_haveValidUser; } public void CalculateHaveValidUser() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) m_haveValidUser = false; long user = GetUser(); if (user == 0) { return; } List<ZDO> allCharacterZDOS = ZNet.instance.GetAllCharacterZDOS(); for (int i = 0; i < allCharacterZDOS.Count; i++) { ZDO val = allCharacterZDOS[i]; if (((ZDOID)(ref val.m_uid)).UserID == user) { m_haveValidUser = Vector3.Distance(val.GetPosition(), ((Component)this).transform.position) < m_maxUseRange; break; } } } public void RPC_ReleaseControl(long sender, long playerID) { if (m_nview.IsOwner() && GetUser() == playerID) { m_nview.GetZDO().Set(ZDOVars.s_user, 0L); ResetControlls(); } } public void RPC_RequestRespons(long sender, bool granted) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { if (granted && (Object)(object)m_attachPoint != (Object)null) { Player.m_localPlayer.StartDoodadControl((IDoodadController)(object)this); ((Character)Player.m_localPlayer).AttachStart(m_attachPoint, ((Component)this).gameObject, false, false, false, m_attachAnimation, m_detachOffset, (Transform)null); } else { ((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_inuse", 0, (Sprite)null); } } } public void OnUseStop(Player player) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (m_nview.IsValid()) { ZNetView nview = m_nview; object[] array = new object[1]; ZDOID zDOID = ((Character)player).GetZDOID(); array[0] = ((ZDOID)(ref zDOID)).UserID; nview.InvokeRPC("ReleaseControl", array); ((Character)player).AttachStop(); } } public bool IsLocalUser() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } long user = GetUser(); int result; if (user != 0L) { ZDOID zDOID = ((Character)Player.m_localPlayer).GetZDOID(); result = ((user == ((ZDOID)(ref zDOID)).UserID) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } public long GetUser() { return ((Object)(object)m_nview == (Object)null || !m_nview.IsValid()) ? 0 : m_nview.GetZDO().GetLong(ZDOVars.s_user, 0L); } public bool InUseDistance(Humanoid human) { //IL_001b: 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) if ((Object)(object)m_attachPoint == (Object)null) { return false; } return (double)Vector3.Distance(((Component)human).transform.position, m_attachPoint.position) < (double)m_maxUseRange; } public void UseStamina(float v) { if ((double)v != 0.0 && m_nview.IsValid() && m_nview.IsOwner()) { float num = GetStamina() - v; if ((double)num < 0.0) { num = 0f; } SetStamina(num); m_staminaRegenTimer = 1f; } } public bool HaveStamina(float amount = 0f) { return m_nview.IsValid() && GetStamina() > amount; } public float GetStamina() { return ((Object)(object)m_nview == (Object)null || m_nview.GetZDO() == null) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_stamina, GetMaxStamina()); } public void SetStamina(float stamina) { m_nview.GetZDO().Set(ZDOVars.s_stamina, stamina); } public float GetMaxStamina() { return m_maxStamina; } public void UpdateStamina(float dt) { m_staminaRegenTimer -= dt; if (!(m_staminaRegenTimer > 0f) && !m_character.InAttack() && !m_character.IsSwimming()) { float stamina = GetStamina(); float maxStamina = GetMaxStamina(); if (!(stamina >= maxStamina)) { float num = (m_tambable.IsHungry() ? m_staminaRegenHungry : m_staminaRegen); float num2 = 1f - stamina / maxStamina; float num3 = num + num2 * num; float num4 = stamina + num3 * dt; SetStamina(Mathf.Min(num4, maxStamina)); } } } public float GetRiderSkill() { return m_rideSkill; } } [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] public static class AudioManager { public static readonly Dictionary<string, AudioRef> clips; static AudioManager() { clips = new Dictionary<string, AudioRef>(); } public static void Start() { HashSet<string> audioExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".wav", ".mp3", ".ogg", ".flac", ".aac", ".m4a", ".wma", ".aiff", ".aif" }; string[] array = (from f in Directory.GetFiles(FileManager.ImportFolder, "*", SearchOption.AllDirectories) where audioExtensions.Contains(Path.GetExtension(f)) select f).ToArray(); foreach (string filePath in array) { new AudioRef(filePath); } } [return: <2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public static AudioClip ReadAudioFile(string file) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file:///" + file.Replace("\\", "/"), (AudioType)0); try { audioClip.SendWebRequest(); while (!audioClip.isDone) { } if ((int)audioClip.result == 2 || (int)audioClip.result == 3) { MonsterDBPlugin.LogWarning("Failed to load audio file: " + audioClip.error); return null; } DownloadHandlerAudioClip val = (DownloadHandlerAudioClip)audioClip.downloadHandler; AudioClip audioClip2 = val.audioClip; ((Object)audioClip2).name = Path.GetFileNameWithoutExtension(file); MonsterDBPlugin.LogDebug("Successfully loaded audio: " + ((Object)audioClip2).name); return audioClip2; } finally { ((IDisposable)audioClip)?.Dispose(); } } } [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] public class AudioRef { public string filePath; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public AudioClip clip; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] public GameObject sfx; public AudioRef(string filePath) { this.filePath = filePath; clip = AudioManager.ReadAudioFile(filePath); if (!((Object)(object)clip != (Object)null)) { return; } Clone clone = new Clone("sfx_Bonemass_idle", ((Object)clip).name); clone.OnCreated += delegate(GameObject p) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) ZSFX val = default(ZSFX); if (p.TryGetComponent<ZSFX>(ref val)) { val.m_captionType = (CaptionType)2; val.m_closedCaptionToken = ((Object)clip).name; val.m_secondaryCaptionToken = ""; val.m_audioClips = (AudioClip[])(object)new AudioClip[1] { clip }; sfx = p; } TimedDestruction val2 = default(TimedDestruction); if (p.TryGetComponent<TimedDestruction>(ref val2)) { val2.m_timeout = clip.length; } MonsterDBPlugin.LogInfo("Loaded SFX as " + ((Object)p).name); }; AudioManager.clips[((Object)clip).name] = this; } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public class Clone { [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] private GameObject Source; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] private GameObject Prefab; public readonly string SourceName; private readonly string NewName; private bool Loaded; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] [method: <2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] [field: <2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] public event Action<GameObject> OnCreated; public Clone(string prefabName, string newName) { SourceName = prefabName; NewName = newName; CloneManager.clones[newName] = this; } public Clone(GameObject prefab, string newName) : this(((Object)prefab).name, newName) { Source = prefab; } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(2)] internal GameObject Create() { if (Loaded) { return Prefab; } if (Source == null) { Source = PrefabManager.GetPrefab(NewName); } if ((Object)(object)Source == (Object)null) { return null; } Prefab = Object.Instantiate<GameObject>(Source, CloneManager.GetRootTransform(), false); ((Object)Prefab).name = NewName; this.OnCreated?.Invoke(Prefab); PrefabManager.RegisterPrefab(Prefab); CloneManager.prefabs[((Object)Prefab).name] = Prefab; Loaded = true; return Prefab; } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public static class CloneManager { private static readonly GameObject root; internal static readonly Dictionary<string, GameObject> prefabs; internal static readonly Dictionary<string, Clone> clones; static CloneManager() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown prefabs = new Dictionary<string, GameObject>(); clones = new Dictionary<string, Clone>(); root = new GameObject("MonsterDB_prefab_root"); Object.DontDestroyOnLoad((Object)(object)root); root.SetActive(false); } public static Transform GetRootTransform() { return root.transform; } public static void Clear() { for (int i = 0; i < root.transform.childCount; i++) { GameObject gameObject = ((Component)root.transform.GetChild(i)).gameObject; int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)gameObject).name); if (Object.op_Implicit((Object)(object)ZNetScene.instance)) { ZNetScene.instance.m_prefabs.Remove(gameObject); ZNetScene.instance.m_namedPrefabs.Remove(stableHashCode); } if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { ObjectDB.instance.m_items.Remove(gameObject); ObjectDB.instance.m_itemByHash.Remove(stableHashCode); } PrefabManager.PrefabsToRegister.Remove(gameObject); PrefabManager._prefabs.Remove(((Object)gameObject).name); MonsterDBPlugin.LogDebug("Destroyed " + ((Object)gameObject).name); Object.Destroy((Object)(object)gameObject); } prefabs.Clear(); clones.Clear(); } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public static class CommandManager { [Serializable] [CompilerGenerated] private sealed class <>c { [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public static readonly <>c <>9 = new <>c(); [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public static ConsoleEventFailable <>9__3_0; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public static Func<KeyValuePair<string, Command>, bool> <>9__3_1; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public static Func<KeyValuePair<string, Command>, string> <>9__3_2; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 0, 1 })] public static Func<ConsoleEventArgs, bool> <>9__3_3; [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] internal object <Patch_Terminal_Awake>b__3_0(ConsoleEventArgs args) { if (args.Length < 2) { return false; } if (!commands.TryGetValue(args[1], out var value)) { return false; } return value.Run(args); } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] internal bool <Patch_Terminal_Awake>b__3_1(KeyValuePair<string, Command> x) { return !x.Value.IsSecret(); } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] internal string <Patch_Terminal_Awake>b__3_2(KeyValuePair<string, Command> x) { return x.Key; } internal bool <Patch_Terminal_Awake>b__3_3(ConsoleEventArgs _) { StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair<string, Command> command in commands) { if (!command.Value.IsSecret()) { stringBuilder.Clear(); stringBuilder.AppendFormat("{0}: {1}", command.Key, command.Value.m_description); if (command.Value.m_adminOnly) { stringBuilder.Append(" (admin only)"); } MonsterDBPlugin.LogInfo(stringBuilder.ToString()); } } return true; } } private static readonly string startCommand; public static readonly Dictionary<string, Command> commands; static CommandManager() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown commands = new Dictionary<string, Command>(); Harmony harmony = MonsterDBPlugin.harmony; startCommand = "MonsterDB".ToLower(); harmony.Patch((MethodBase)AccessTools.Method(typeof(Terminal), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(CommandManager), "Patch_Terminal_Awake", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Terminal), "updateSearch", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.Method(typeof(CommandManager), "Patch_Terminal_UpdateSearch", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Terminal), "tabCycle", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.Method(typeof(CommandManager), "Patch_Terminal_TabCycle", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void Patch_Terminal_Awake() { //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_002a: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) string text = startCommand; object obj = <>c.<>9__3_0; if (obj == null) { ConsoleEventFailable val = [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (ConsoleEventArgs args) => { if (args.Length < 2) { return false; } Command value; return (!commands.TryGetValue(args[1], out value)) ? ((object)false) : ((object)value.Run(args)); }; <>c.<>9__3_0 = val; obj = (object)val; } new ConsoleCommand(text, "use help to find available commands", (ConsoleEventFailable)obj, false, false, false, false, false, new ConsoleOptionsFetcher(Enumerable.ToList), false, false, false); new Command("help", "list of available commands", delegate { StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair<string, Command> command in commands) { if (!command.Value.IsSecret()) { stringBuilder.Clear(); stringBuilder.AppendFormat("{0}: {1}", command.Key, command.Value.m_description); if (command.Value.m_adminOnly) { stringBuilder.Append(" (admin only)"); } MonsterDBPlugin.LogInfo(stringBuilder.ToString()); } } return true; }); } private static bool Patch_Terminal_UpdateSearch(Terminal __instance, string word) { if ((Object)(object)__instance.m_search == (Object)null) { return true; } string[] array = ((TMP_InputField)__instance.m_input).text.Split(new char[1] { ' ' }); if (array.Length < 3) { return true; } if (array[0] != startCommand) { return true; } return HandleSearch(__instance, word, array); } private static bool HandleSearch(Terminal __instance, string word, string[] strArray) { if (!commands.TryGetValue(strArray[1], out var value)) { return true; } if (value.HasOptions() && strArray.Length == 3) { List<string> list = value.FetchOptions(); string currentSearch = strArray[2]; List<string> list2; if (!Utility.IsNullOrWhiteSpace(currentSearch)) { int num = list.IndexOf(currentSearch); list2 = ((num != -1) ? list.GetRange(num, list.Count - num) : list); list2 = list2.FindAll((string x) => x.ToLower().Contains(currentSearch.ToLower())); } else { list2 = list; } if (list2.Count <= 0) { __instance.m_search.text = value.m_description; } else { __instance.m_lastSearch.Clear(); __instance.m_lastSearch.AddRange(list2); __instance.m_lastSearch.Remove(word); __instance.m_search.text = ""; int num2 = 10; int num3 = Math.Min(__instance.m_lastSearch.Count, num2); for (int i = 0; i < num3; i++) { string text = __instance.m_lastSearch[i]; TMP_Text search = __instance.m_search; search.text = search.text + text + " "; } if (__instance.m_lastSearch.Count <= num2) { return false; } int num4 = __instance.m_lastSearch.Count - num2; TMP_Text search2 = __instance.m_search; search2.text += $"... {num4} more."; } } else { __instance.m_search.text = value.m_description; } return false; } private static void Patch_Terminal_TabCycle(string word, [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] ref List<string> options) { if (commands.TryGetValue(word, out var value)) { options = value.FetchOptions(); } } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public static class Extensions { private static readonly Dictionary<string, bool> canFlyToggleCache = new Dictionary<string, bool>(); private static readonly MethodInfo LoadImage = AccessTools.Method(typeof(ImageConversion), "LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }, (Type[])null); public static string GetString(this ConsoleEventArgs args, int index, string defaultValue = "") { if (args.Length < index + 1) { return defaultValue; } return args[index]; } public static float GetFloat(this ConsoleEventArgs args, int index, float defaultValue = 0f) { if (args.Length < index + 1) { return defaultValue; } string s = args[index]; float result; return float.TryParse(s, out result) ? result : defaultValue; } public static int GetInt(this ConsoleEventArgs args, int index, int defaultValue = 0) { if (args.Length < index + 1) { return defaultValue; } string s = args[index]; int result; return int.TryParse(s, out result) ? result : defaultValue; } public static HashSet<GameObject> GetAttacks(this Humanoid humanoid) { HashSet<GameObject> hashSet = new HashSet<GameObject>(); if (humanoid.m_defaultItems != null) { hashSet.AddRange(humanoid.m_defaultItems); } if (humanoid.m_randomWeapon != null) { hashSet.AddRange(humanoid.m_randomWeapon); } if (humanoid.m_randomSets != null) { hashSet.AddRange(humanoid.m_randomSets.SelectMany([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (ItemSet x) => x.m_items).ToArray()); } ItemDrop val = default(ItemDrop); hashSet.RemoveWhere((GameObject x) => (Object)(object)x == (Object)null || !x.TryGetComponent<ItemDrop>(ref val) || string.IsNullOrEmpty(val.m_itemData.m_shared.m_attack.m_attackAnimation)); return hashSet; } public static HashSet<GameObject> GetItems(this Humanoid humanoid) { HashSet<GameObject> hashSet = new HashSet<GameObject>(); if (humanoid.m_defaultItems != null) { hashSet.AddRange(humanoid.m_defaultItems); } if (humanoid.m_randomWeapon != null) { hashSet.AddRange(humanoid.m_randomWeapon); } if (humanoid.m_randomShield != null) { hashSet.AddRange(humanoid.m_randomShield); } if (humanoid.m_randomArmor != null) { hashSet.AddRange(humanoid.m_randomArmor); } if (humanoid.m_randomSets != null) { hashSet.AddRange(humanoid.m_randomSets.SelectMany([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (ItemSet x) => x.m_items).ToArray()); } if (humanoid.m_randomItems != null) { hashSet.AddRange(humanoid.m_randomItems.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (RandomItem x) => x.m_prefab).ToArray()); } hashSet.RemoveWhere((GameObject x) => (Object)(object)x == (Object)null || !Object.op_Implicit((Object)(object)x.GetComponent<ItemDrop>())); return hashSet; } public static ItemDataSharedRef[] ToItemDataSharedRefArray(this HashSet<GameObject> items) { List<ItemDataSharedRef> list = new List<ItemDataSharedRef>(); foreach (GameObject item in items) { PrefabManager.AddToCache(item); ItemDrop component = item.GetComponent<ItemDrop>(); if (!((Object)(object)component == (Object)null)) { ItemDataSharedRef itemDataSharedRef = new ItemDataSharedRef(); itemDataSharedRef.Setup<SharedData>(component.m_itemData.m_shared); itemDataSharedRef.m_prefab = ((Object)item).name; list.Add(itemDataSharedRef); } } return list.ToArray(); } public static HumanoidRef.RandomItem[] ToHumanoidRefRandomItemArray(this RandomItem[] ria) { return (from x in ria where x != null && (Object)(object)x.m_prefab != (Object)null select new HumanoidRef.RandomItem { m_prefab = ((Object)x.m_prefab).name, m_chance = x.m_chance }).ToArray(); } public static RandomItem[] ToHumanoidRandomItemArray(this HumanoidRef.RandomItem[] ria) { return (from x in ria.Where([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (HumanoidRef.RandomItem x) => !string.IsNullOrEmpty(x.m_prefab)).Select((Func<HumanoidRef.RandomItem, RandomItem>)([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (HumanoidRef.RandomItem x) => new RandomItem { m_prefab = PrefabManager.GetPrefab(x.m_prefab), m_chance = x.m_chance })) where (Object)(object)x.m_prefab != (Object)null select x).ToArray(); } public static HumanoidRef.ItemSet[] ToHumanoidRefItemSetArray(this ItemSet[] isa) { return (from x in isa where x != null select new HumanoidRef.ItemSet { m_name = x.m_name, m_items = (from it in x.m_items where (Object)(object)it != (Object)null select ((Object)it).name).ToArray() }).ToArray(); } public static ItemSet[] ToHumanoidItemSetArray(this HumanoidRef.ItemSet[] isa) { return isa.Where([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (HumanoidRef.ItemSet x) => x.m_items.Length != 0).Select((Func<HumanoidRef.ItemSet, ItemSet>)([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (HumanoidRef.ItemSet x) => new ItemSet { m_name = x.m_name, m_items = (from p in x.m_items where !string.IsNullOrEmpty(p) select PrefabManager.GetPrefab(p) into p where (Object)(object)p != (Object)null select p).ToArray() })).ToArray(); } public static string[] ToGameObjectNameArray(this GameObject[] goa) { return (from x in goa where (Object)(object)x != (Object)null select ((Object)x).name).ToArray(); } public static GameObject[] ToGameObjectArray(this string[] goNames) { return (from x in goNames where !string.IsNullOrEmpty(x) select PrefabManager.GetPrefab(x) into x where (Object)(object)x != (Object)null select x).ToArray(); } public static List<DropRef> ToRef(this List<Drop> cd) { return (from x in cd where (Object)(object)x.m_prefab != (Object)null select new DropRef(x)).ToList(); } public static List<Drop> FromRef(this List<DropRef> dr) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown List<Drop> list = new List<Drop>(); foreach (DropRef item in dr) { Drop val = new Drop(); item.UpdateFields<Drop>(val, item.m_prefab ?? "Null", log: false); list.Add(val); } return list; } public static List<GrowUpRef.GrownEntry> ToGrowUpRefEntryList(this List<GrownEntry> ge) { return (from x in ge where (Object)(object)x.m_prefab != (Object)null select new GrowUpRef.GrownEntry(x)).ToList(); } public static List<GrownEntry> FromRef(this List<GrowUpRef.GrownEntry> ge) { return (from x in ge select x.ToGrowUpGrowEntry() into x where (Object)(object)x.m_prefab != (Object)null select x).ToList(); } public static List<RandomAnimationRef.RandomValueRef> ToRef(this List<RandomValue> list) { return list.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (RandomValue x) => new RandomAnimationRef.RandomValueRef { m_name = x.m_name, m_values = x.m_values, m_interval = x.m_interval, m_floatValue = x.m_floatValue, m_floatTransition = x.m_floatTransition }).ToList(); } public static List<RandomValue> FromRef(this List<RandomAnimationRef.RandomValueRef> list) { return ((IEnumerable<RandomAnimationRef.RandomValueRef>)list).Select((Func<RandomAnimationRef.RandomValueRef, RandomValue>)([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (RandomAnimationRef.RandomValueRef x) => new RandomValue { m_name = x.m_name, m_values = x.m_values, m_interval = x.m_interval, m_floatValue = x.m_floatValue, m_floatTransition = x.m_floatTransition })).ToList(); } public static EffectListRef ToEffectListRef(this EffectList el) { EffectListRef effectListRef = new EffectListRef(); EffectData[] effectPrefabs = el.m_effectPrefabs; foreach (EffectData val in effectPrefabs) { if (!((Object)(object)val.m_prefab == (Object)null)) { EffectListRef.EffectDataRef effectDataRef = new EffectListRef.EffectDataRef(); effectDataRef.Setup<EffectData>(val); effectListRef.Add(effectDataRef); } } return effectListRef; } public static void Add<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] T>(this List<T> list, params T[] values) { list.AddRange(values); } public static void CopyFrom<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] T, [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] V>(this T target, V source) where T : MonoBehaviour where V : MonoBehaviour { Dictionary<string, FieldInfo> dictionary = typeof(T).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).ToDictionary([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (FieldInfo f) => f.Name); FieldInfo[] fields = typeof(V).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (dictionary.TryGetValue(fieldInfo.Name, out var value) && value.FieldType.IsAssignableFrom(fieldInfo.FieldType)) { value.SetValue(target, fieldInfo.GetValue(source)); } } } public static void Remove<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] T>(this GameObject prefab) where T : Component { T val = default(T); if (prefab.TryGetComponent<T>(ref val)) { Object.DestroyImmediate((Object)(object)val); } } private static void AddRange<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] T>(this HashSet<T> set, params T[] values) { foreach (T item in values) { set.Add(item); } } public static Dictionary<TKey, SValue> ToDict<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] TKey, [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] SValue>(this IEnumerable<SValue> enumerable, Func<SValue, TKey> func) { Dictionary<TKey, SValue> dictionary = new Dictionary<TKey, SValue>(); foreach (SValue item in enumerable) { TKey key = func(item); dictionary[key] = item; } return dictionary; } public static List<ItemData> GetAvailableAttacks(this Humanoid humanoid) { return (from item in humanoid.GetInventory().GetAllItems() where item.IsWeapon() && ((Character)humanoid).m_baseAI.CanUseAttack(item) select item).ToList(); } public static bool CanToggleFly(this Character character) { string prefabName = Utils.GetPrefabName(((Object)character).name); if (canFlyToggleCache.TryGetValue(prefabName, out var value)) { return value; } bool flag = character.m_animator.parameters.Any([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (AnimatorControllerParameter p) => p.name == "fly_takeoff" || p.name == "fly_land"); canFlyToggleCache[prefabName] = flag; return flag; } public static List<BaitSettingRef> ToRef(this List<BaitSetting> baitSettings) { return (from x in baitSettings where (Object)(object)x.m_bait != (Object)null select new BaitSettingRef { m_bait = ((Object)x.m_bait).name, m_chance = x.m_chance }).ToList(); } public static List<BaitSetting> FromRef(this List<BaitSettingRef> reference) { return (from x in reference.Where([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (BaitSettingRef x) => !string.IsNullOrEmpty(x.m_bait)).Select((Func<BaitSettingRef, BaitSetting>)([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (BaitSettingRef x) => { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown BaitSetting val = new BaitSetting(); GameObject prefab = PrefabManager.GetPrefab(x.m_bait); val.m_bait = ((prefab != null) ? prefab.GetComponent<ItemDrop>() : null); val.m_chance = x.m_chance; return val; })) where (Object)(object)x.m_bait != (Object)null select x).ToList(); } public static List<DropDataRef> ToDropDataRefList(this List<DropData> dropData) { return (from x in dropData where (Object)(object)x.m_item != (Object)null select new DropDataRef(x)).ToList(); } public static List<DropData> ToDropDataList(this List<DropDataRef> reference) { return (from x in reference select x.ToDropData() into x where (Object)(object)x.m_item != (Object)null select x).ToList(); } public static AttackRef ToAttackRef(this Attack att) { AttackRef attackRef = new AttackRef(); attackRef.Setup<Attack>(att); return attackRef; } public static List<string> ToItemNameList(this List<ItemDrop> items) { return (from x in items where (Object)(object)x != (Object)null select ((Object)x).name).ToList(); } public static List<ItemDrop> ToItemDropList(this List<string> il) { return (from x in il select PrefabManager.GetPrefab(x) into x where (Object)(object)x != (Object)null select x.GetComponent<ItemDrop>() into x where (Object)(object)x != (Object)null select x).ToList(); } public static string[] ToSpriteNameArray(this Sprite[] icons) { return icons.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (Sprite x) => ((Object)x).name).ToArray(); } public static Sprite[] ToSpriteArray(this string[] spriteNames) { return (from x in spriteNames select TextureManager.GetSprite(x, null) into x where (Object)(object)x != (Object)null select x).ToArray(); } public static List<SpawnDataRef> ToSpawnDataRefList(this List<SpawnData> sps) { return sps.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (SpawnData x) => new SpawnDataRef(x)).ToList(); } public static bool LoadImage4x(this Texture2D tex, byte[] data) { return (bool)LoadImage.Invoke(null, new object[2] { tex, data }); } public static List<LevelSetupRef> ToRef(this List<LevelSetup> ls) { return ls.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (LevelSetup x) => new LevelSetupRef(x)).ToList(); } public static LightRef[] ToRef(this Light[] lights) { return lights.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (Light x) => new LightRef(x)).ToArray(); } public static MaterialRef[] ToMaterialRefArray(this Material[] mats) { List<MaterialRef> list = new List<MaterialRef>(); foreach (Material val in mats) { if (!((Object)(object)val == (Object)null)) { list.Add(new MaterialRef(val)); } } return list.ToArray(); } public static string ToRGBAString(this Color color) { return ((object)(Color)(ref color)).ToString(); } public static string ToHexString(this Color color, bool includeAlpha = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0053: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) Color32 val = Color32.op_Implicit(color); return includeAlpha ? $"#{val.r:X2}{val.g:X2}{val.b:X2}{val.a:X2}" : $"#{val.r:X2}{val.g:X2}{val.b:X2}"; } public static Color FromHexOrRGBA(this string hex, Color defaultValue) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(hex)) { return defaultValue; } if (hex.StartsWith("#")) { hex = hex.TrimStart(new char[1] { '#' }); if (hex.Length != 6 && hex.Length != 8) { return defaultValue; } byte b = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber); byte b2 = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber); byte b3 = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber); byte b4 = ((hex.Length == 8) ? byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber) : byte.MaxValue); return Color32.op_Implicit(new Color32(b, b2, b3, b4)); } if (hex.StartsWith("RGBA")) { int num = hex.IndexOf('(') + 1; int num2 = hex.IndexOf(')'); string[] array = hex.Substring(num, num2 - num).Split(new char[1] { ',' }); if (array.Length != 4) { return defaultValue; } if (!float.TryParse(array[0], out var result)) { return defaultValue; } if (!float.TryParse(array[1], out var result2)) { return defaultValue; } if (!float.TryParse(array[2], out var result3)) { return defaultValue; } if (!float.TryParse(array[3], out var result4)) { return defaultValue; } return new Color(result, result2, result3, result4); } return defaultValue; } public static ParticleSystemRef[] ToParticleSystemRefArray(this ParticleSystem[] particleSystems) { return particleSystems.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (ParticleSystem x) => new ParticleSystemRef(x)).ToArray(); } public static GradientAlphaKeyRef[] ToRef(this GradientAlphaKey[] keys) { return keys.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (GradientAlphaKey x) => new GradientAlphaKeyRef(x)).ToArray(); } public static GradientAlphaKey[] FromRef(this GradientAlphaKeyRef[] keys) { return keys.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (GradientAlphaKeyRef x) => x.ToGradientAlphaKey()).ToArray(); } public static GradientColorKeyRef[] ToRef(this GradientColorKey[] keys) { return keys.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (GradientColorKey x) => new GradientColorKeyRef(x)).ToArray(); } public static GradientColorKey[] FromRef(this GradientColorKeyRef[] keys) { return keys.Select([<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] (GradientColorKeyRef x) => x.ToGradientColorKey()).ToArray(); } public static RendererRef[] ToRendererRefArray(this Renderer[] renderers) { return (from x in renderers select new RendererRef(x) into x orderby x.m_parent, x.m_index select x).ToArray(); } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public class Command { public readonly string m_description; private readonly bool m_isSecret; public readonly bool m_adminOnly; private readonly Func<ConsoleEventArgs, bool> m_command; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1, 1 })] private readonly Func<List<string>> m_optionFetcher; public bool Run(ConsoleEventArgs args) { return !IsAdmin() || m_command(args); } private bool IsAdmin() { if (!Object.op_Implicit((Object)(object)ZNet.m_instance)) { return true; } if (!m_adminOnly || ZNet.m_instance.LocalPlayerIsAdminOrHost()) { return true; } MonsterDBPlugin.LogWarning("Admin only"); return false; } public bool IsSecret() { return m_isSecret; } public List<string> FetchOptions() { return (m_optionFetcher == null) ? new List<string>() : m_optionFetcher(); } public bool HasOptions() { return m_optionFetcher != null; } public Command(string input, string description, Func<ConsoleEventArgs, bool> command, [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1, 1 })] Func<List<string>> optionsFetcher = null, bool isSecret = false, bool adminOnly = false) { m_description = description; m_command = command; m_isSecret = isSecret; CommandManager.commands[input] = this; m_optionFetcher = optionsFetcher; m_adminOnly = adminOnly; } } public enum Toggle { On = 1, Off = 0 } [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] public static class ConfigManager { [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(0)] [Flags] public enum LogLevel { None = 0, Debug = 1, Warning = 2, Error = 4, Info = 8, All = 0xF } private static readonly FieldPrefixStrippingNamingConvention NamingConvention; private static readonly ISerializer serializer; private static readonly IDeserializer deserializer; private static readonly ConfigFile Config; public static readonly ConfigSync ConfigSync; private static readonly string ConfigFileName; private static readonly string ConfigFileFullPath; public static readonly string DirectoryPath; private static readonly ConfigEntry<LogLevel> logLevels; private static readonly ConfigEntry<Toggle> detailedDebugLogs; public static T Deserialize<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] T>(string data) { return deserializer.Deserialize<T>(data); } public static string Serialize<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] T>(T obj) { if (obj == null) { return ""; } using StringWriter stringWriter = new StringWriter(); serializer.Serialize(stringWriter, obj, obj.GetType()); return stringWriter.ToString(); } public static bool ShouldLog(LogLevel type) { return logLevels.Value.HasFlag(type); } public static bool ShouldLogDetails() { return detailedDebugLogs.Value == Toggle.On; } static ConfigManager() { NamingConvention = new FieldPrefixStrippingNamingConvention("m_"); serializer = new SerializerBuilder().ConfigureDefaultValuesHandling(DefaultValuesHandling.OmitNull | DefaultValuesHandling.OmitDefaults | DefaultValuesHandling.OmitEmptyCollections).DisableAliases().WithNamingConvention(NamingConvention) .WithTypeConverter(VectorConverter.Instance) .Build(); deserializer = new DeserializerBuilder().IgnoreUnmatchedProperties().WithNamingConvention(NamingConvention).WithTypeConverter(FactionConverter.Instance) .WithTypeConverter(VectorConverter.Instance) .Build(); Config = ((BaseUnityPlugin)MonsterDBPlugin.instance).Config; ConfigFileName = "RustyMods.MonsterDB.cfg"; ConfigFileFullPath = Path.Combine(Paths.ConfigPath, ConfigFileName); ConfigSync = new ConfigSync("RustyMods.MonsterDB") { DisplayName = "MonsterDB", CurrentVersion = "0.2.4", MinimumRequiredVersion = "0.2.4" }; DirectoryPath = Path.Combine(Paths.ConfigPath, "MonsterDB"); if (!Directory.Exists(DirectoryPath)) { Directory.CreateDirectory(DirectoryPath); } ConfigEntry<Toggle> lockingConfig = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only."); ConfigSync.AddLockingConfigEntry<Toggle>(lockingConfig); logLevels = config("1 - General", "Log Levels", LogLevel.All, "Set log levels", synchronizedSetting: false); detailedDebugLogs = config("1 - General", "Detailed Debug Logs", Toggle.Off, "If on, debug logs will be detailed"); } public static void Start() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown Harmony harmony = MonsterDBPlugin.harmony; harmony.Patch((MethodBase)AccessTools.Method(typeof(ZNet), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(ConfigManager), "Patch_ZNet_Awake", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void Patch_ZNet_Awake(ZNet __instance) { FactionManager.Init(__instance); LoadManager.Init(__instance); SpawnManager.Init(__instance); RaidManager.Init(__instance); LocalizationManager.Init(__instance); } public static void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private static void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { MonsterDBPlugin.LogDebug("ReadConfigValues called"); Config.Reload(); } catch { MonsterDBPlugin.LogError("There was an issue loading your " + ConfigFileName); MonsterDBPlugin.LogError("Please check your config entries for spelling and format!"); } } public static ConfigEntry<T> config<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = Config.Bind<T>(group, name, value, val); SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val2; } public static ConfigEntry<T> config<[<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } } public class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order = null; [UsedImplicitly] public bool? Browsable = null; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] [UsedImplicitly] public string Category = null; [<2819d005-da1c-4536-902d-199916b6db56>Nullable(new byte[] { 2, 1 })] [UsedImplicitly] public Action<ConfigEntryBase> CustomDrawer = null; } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public sealed class FieldPrefixStrippingNamingConvention : INamingConvention { private readonly string prefix; public FieldPrefixStrippingNamingConvention(string prefix) { this.prefix = prefix; } public string Apply(string value) { return value.StartsWith(prefix) ? value.Substring(prefix.Length) : value; } } [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] public sealed class FactionConverter : IYamlTypeConverter { public static readonly IYamlTypeConverter Instance = new FactionConverter(); public bool Accepts(Type type) { return (Nullable.GetUnderlyingType(type) ?? type) == typeof(Faction); } public object ReadYaml(IParser parser, Type type) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) YamlDotNet.Core.Events.Scalar scalar = parser.Consume<YamlDotNet.Core.Events.Scalar>(); return FactionManager.GetFaction(scalar.Value); } public void WriteYaml(IEmitter emitter, [<2819d005-da1c-4536-902d-199916b6db56>Nullable(2)] object value, Type type) { //IL_000c: 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) if (value != null) { Faction val = (Faction)value; emitter.Emit(new YamlDotNet.Core.Events.Scalar(((object)(Faction)(ref val)).ToString())); } } } [<2819d005-da1c-4536-902d-199916b6db56>Nullable(0)] [<0d2aadd4-155f-4763-8258-d90d7e81134f>NullableContext(1)] public sealed class VectorConverter : IYamlTypeConverter { public static readonly VectorConverter Instance = new VectorConverter(); public bool Accepts(Type type)